From patchwork Sun Jan 5 16:22:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steven Rostedt X-Patchwork-Id: 13926609 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 49F3A181CFD; Sun, 5 Jan 2025 16:22:21 +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=1736094141; cv=none; b=ciVN+2eOnlYYJNQIdzyXBL7xaSHLzRobxcPaW7SswvPQaAOmdX6ZV46ExmifZgllyyRgSwxF+PS1KZp0i4Ff/M/knWzCB+chuNpY9ULMh57G44jNTWbg1SETw1IPPr1QZGfrISS0BsCu+3/DTCNnv+ikvgHXfY+BbkMrQysUjuI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736094141; c=relaxed/simple; bh=vpefdYnotZYqFb3OuaEaxQCVmosOhU+jvix41HPEufg=; h=Message-ID:Date:From:To:Cc:Subject:References:MIME-Version: Content-Type; b=iU3N6gmhZqgc3QLY5xiSjY2TLFeAPXPwoSs/8ZO+VHFvSEz/5js0+rH07K9V6zclaDfutSG3sfiDuuYaNG+WFfJ/BjsewhZlquc5OWj3LaiLFBt+9uqP7p+Lpr5qhugEht7NM2eLR6niSl9CNUDAyht1wT4uLafVw8s2Nvrvp2E= 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 DF460C4CEE9; Sun, 5 Jan 2025 16:22:20 +0000 (UTC) Received: from rostedt by gandalf with local (Exim 4.98) (envelope-from ) id 1tUTPk-00000008Esa-3ro5; Sun, 05 Jan 2025 11:23:44 -0500 Message-ID: <20250105162344.721480386@goodmis.org> User-Agent: quilt/0.68 Date: Sun, 05 Jan 2025 11:22:15 -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: <20250105162211.971039541@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 */