From 5bdc8e2b27c0c80189a3511ebb33530820e85f57 Mon Sep 17 00:00:00 2001 From: Lukas Schmelting Date: Tue, 28 Jul 2026 23:16:58 +0200 Subject: [PATCH] scanelf: recognize .note.GNU-stack with SHT_NOTE type binutils 2.47 changed the section type of .note.GNU-stack from SHT_PROGBITS to SHT_NOTE. Allow scanelf to process both forms. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33851 Signed-off-by: Lukas Schmelting --- scanelf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scanelf.c b/scanelf.c index a3dd15c..eda1f5d 100644 --- a/scanelf.c +++ b/scanelf.c @@ -482,7 +482,8 @@ static const char *scanelf_file_phdr(elfobj *elf, char *found_phdr, char *found_ */ \ check_flags = /*SHF_WRITE|*/SHF_EXECINSTR; \ for (i = 0; i < shnum; ++i) { \ - if (EGET(shdr[i].sh_type) != SHT_PROGBITS) continue; \ + if (EGET(shdr[i].sh_type) != SHT_PROGBITS && EGET(shdr[i].sh_type) != SHT_NOTE) \ + continue; \ offset = EGET(strtbl->sh_offset) + EGET(shdr[i].sh_name); \ if (!VALID_RANGE(elf, offset, sizeof(NOTE_GNU_STACK))) \ continue; \ -- 2.55.0