From: Steven Rostedt Date: Sun, 5 Jan 2025 16:22:15 +0000 (-0500) Subject: scripts/sorttable: Have the ORC code use the _r() functions to read X-Git-Tag: block-6.14-20240131~41^2~11 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=66990c003306c240d570b3ba274ec4f68cf18c91;p=linux-block.git scripts/sorttable: Have the ORC code use the _r() functions to read 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) --- diff --git a/scripts/sorttable.h b/scripts/sorttable.h index 18d07fdb2716..58f7ab5f5644 100644 --- a/scripts/sorttable.h +++ b/scripts/sorttable.h @@ -299,14 +299,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 */