From patchwork Thu Jan 2 23:26:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13925006 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 A02541BEF75; Thu, 2 Jan 2025 23:25:32 +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=1735860332; cv=none; b=MLY445iefML3D6YWRGQyvNjDLEMxUz3cRgL39u6ddpOwqzWTzYb4grpujdBdM2TPchXkTuxGWck/rZMzI3GtfIyZ4bDAI3c/wjtec/VTeiZ7oqRHZZsqfUS1H83ZgQwE3ER04sf19C+VC6/qBpwG+WNu/TncCHVV5lsebPNLsBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735860332; c=relaxed/simple; bh=vpefdYnotZYqFb3OuaEaxQCVmosOhU+jvix41HPEufg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=YzqCHSyaaKgrumAvjclyJBa68HAii4Buc4Vb3QExPOtTk4xfosPBFJE2rIFmASAeOfBYQi9mHu5Uqc8WX8qyuObG/jIuMKj0aAVkZXzXlB1hensDasD/57A0H6CPqKGeeai2YJelrSFLIy/iByru3Va7USd3ik+wVhMoeKjIlus= 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 4DE28C4CED0; Thu, 2 Jan 2025 23:25:32 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tTUaX-00000005Ysl-1sS3; Thu, 02 Jan 2025 18:26:49 -0500 Message-ID: <20250102232649.293540958@goodmis.org> User-Agent: quilt/0.68 Date: Thu, 02 Jan 2025 18:26:13 -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 v2 04/16] scripts/sorttable: Have the ORC code use the _r() functions to read References: <20250102232609.529842248@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 */