Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] scripts/gen_lr_unwind: unswapped little-endian ELF reads in
main()
--
commit 4321126beda1768f44ea752930b88bd2f0c6cb2c
Author: Dylan Hatch [off-list ref]
arm64, unwind: build with .eh_frame and add gen_lr_unwind skeleton
This commit adds CONFIG_ARM64_LR_UNWIND to build the kernel with
.eh_frame unwind tables while discarding them in the final linker
scripts, and wires up a skeleton scripts/gen_lr_unwind host tool invoked
on vmlinux.o.
quoted hunk ↗ jump to hunk
diff --git a/scripts/gen_lr_unwind.c b/scripts/gen_lr_unwind.c
new file mode 100644
index 0000000000000..1b52662838653
--- /dev/null
+++ b/scripts/gen_lr_unwind.c
[ ... ]
quoted hunk ↗ jump to hunk
+ ehdr = ctx.map;
+ if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) ||
+ ehdr->e_ident[EI_CLASS] != ELFCLASS64 ||
+ ehdr->e_ident[EI_DATA] != ELFDATA2LSB ||
+ ehdr->e_type != ET_REL ||
+ ehdr->e_machine != EM_AARCH64) {
+ fprintf(stderr, "gen_lr_unwind: %s is not an AArch64 ET_REL ELF\n",
+ argv[1]);
+ goto out;
+ }
+
+ shdrs = ctx.map + ehdr->e_shoff;
+ shnum = ehdr->e_shnum == SHN_UNDEF ? shdrs[0].sh_size : ehdr->e_shnum;
+ shstrndx = ehdr->e_shstrndx == SHN_XINDEX ?
+ shdrs[0].sh_link : ehdr->e_shstrndx;
+ shstrtab = ctx.map + shdrs[shstrndx].sh_offset;
+
+ for (unsigned int i = 0; i < shnum; i++) {
+ const char *name = shstrtab + shdrs[i].sh_name;
[Severity: Low]
Do these Elf64_Ehdr and Elf64_Shdr field reads need little-endian-to-host
conversion? Cross-compiling an arm64 kernel on a big-endian host will
reject vmlinux.o at the e_type / e_machine check and misinterpret the
section header offsets.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117043504.1021063-1-dylanbhatch@google.com?part=1