From patchwork Mon Jan 6 16:17:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13927646 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 457EB17799F; Mon, 6 Jan 2025 16:17:20 +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=1736180240; cv=none; b=afq/HJyMjof2cPoqWuPTW5t7/gA5cM/MlbnuzYGP32tY3ZI4CTC5i+j8YcqZqwGbDC85yAcqKfOe9LsU5vZRkq+AUDxVNgaDp12F0MuXBnh+g5xEAMmtBNKeGkDLiA6CcqW4CgeEgLxnR5yTR2bMQ7yrstz1zHX9lqoUvjHo5PQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736180240; c=relaxed/simple; bh=DQ7EH9i23/yGs3Y8LsmMVcN0j+K2pY6jjjeIMnUKv60=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=uFFhTyCvPbFnSkVDjzEv7D8KGOI25FyIZCAfMmgthRh0u0b4Lrwu3dnlwwop237/hV+V85QaV8U05OYt0vfJinkwYnbBgu4juPRx57Wca/aFuKwjLIYALwk8yyiu+dpqDZqQr1g420znASmYc/j17nztQN1qVXQm6PLl5KVbMCY= 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 16978C4CEEC; Mon, 6 Jan 2025 16:17:20 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tUpoU-00000009J0m-2hSS; Mon, 06 Jan 2025 11:18:46 -0500 Message-ID: <20250106161846.492818648@goodmis.org> User-Agent: quilt/0.68 Date: Mon, 06 Jan 2025 11:17:30 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org Cc: Masami Hiramatsu , Mark Rutland , Mathieu Desnoyers , Andrew Morton , bpf , Peter Zijlstra , Linus Torvalds , Masahiro Yamada , Nathan Chancellor , Nicolas Schier , Zheng Yejian , Martin Kelly , Christophe Leroy , Josh Poimboeuf Subject: [for-next][PATCH 04/14] scripts/sorttable: Have the ORC code use the _r() functions to read References: <20250106161726.131794583@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. Cc: bpf Cc: Masami Hiramatsu Cc: Mark Rutland Cc: Mathieu Desnoyers Cc: Andrew Morton Cc: Peter Zijlstra Cc: Linus Torvalds Cc: Masahiro Yamada Cc: Nathan Chancellor Cc: Nicolas Schier Cc: Zheng Yejian Cc: Martin Kelly Cc: Christophe Leroy Cc: Josh Poimboeuf Link: https://lore.kernel.org/20250105162344.721480386@goodmis.org 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 */