From patchwork Thu Jan 2 18:58:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13924838 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9ACC31B4F17; Thu, 2 Jan 2025 18:59:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844387; cv=none; b=f/5IFHurdEfMwgq/NchdjR5RfD+mCIwwzS6fZXj+Gkk6oY9cFv8vsalC54VE7sBD4n+6bVU223fZPqXVAHalX/iCIzah2yjqBiwowz48QexAVXFeI6wf1m6KS5nTLasIji+qOMICI6+pp7IMR7wzfhr4zxb6RnXS2Dad+ctYkk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735844387; c=relaxed/simple; bh=vpefdYnotZYqFb3OuaEaxQCVmosOhU+jvix41HPEufg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=G1kp/YC0WSyoEpZIPrm5PxAzoMS7VGOc8amRMQpcYlGRYeeKLKPbut24TLMhdUxIACKuM8qwYTS54GXQXgCoJS+wJrs3vGRsmLRmhYvcGSSRUzAl7WmxVO5FHuy8dKbE2elUh9vmyK7qIJgz2TauWUmBmtnTTLfiqbLAo1HEb+g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20123C4CEE7; Thu, 2 Jan 2025 18:59:47 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tTQRL-00000005Mkr-3xhF; Thu, 02 Jan 2025 14:01:03 -0500 Message-ID: <20250102190103.793159697@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 02 Jan 2025 13:58:49 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, bpf Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , Peter Zijlstra , Linus Torvalds , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Zheng Yejian , Martin Kelly , Christophe Leroy , Josh Poimboeuf Subject: [PATCH 04/14] scripts/sorttable: Have the ORC code use the _r() functions to read References: <20250102185845.928488650@goodmis.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Steven Rostedt The ORC code reads the section information directly from the file. This currently works because the default read function is for 64bit little endian machines. But if for some reason that ever changes, this will break. Instead of having a surprise breakage, use the _r() functions that will read the values from the file properly. Signed-off-by: Steven Rostedt (Google) --- scripts/sorttable.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/sorttable.h b/scripts/sorttable.h index aa7a8499a516..7c06a754e31a 100644 --- a/scripts/sorttable.h +++ b/scripts/sorttable.h @@ -296,14 +296,14 @@ static int do_sort(Elf_Ehdr *ehdr, #if defined(SORTTABLE_64) && defined(UNWINDER_ORC_ENABLED) /* locate the ORC unwind tables */ if (!strcmp(secstrings + idx, ".orc_unwind_ip")) { - orc_ip_size = s->sh_size; + orc_ip_size = _r(&s->sh_size); g_orc_ip_table = (int *)((void *)ehdr + - s->sh_offset); + _r(&s->sh_offset)); } if (!strcmp(secstrings + idx, ".orc_unwind")) { - orc_size = s->sh_size; + orc_size = _r(&s->sh_size); g_orc_table = (struct orc_entry *)((void *)ehdr + - s->sh_offset); + _r(&s->sh_offset)); } #endif } /* for loop */