Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] The implicit 8-byte alignment added to `BOUNDED_SECTION` macros corrupts the `.notes` ELF section by injecting padding at the start, breaking `PT_NOTE` parsing. - [Low] The patch fails to apply the `_ALIGNED` variant to `.BTF_ids`, violating the commit message's stated refactoring rules. --
commit 8b6f5abfb8521b62106505848b2663ec04bac566 Author: Jim Cromie <[email protected]> Subject: vmlinux.lds.h: Fix ALIGN(8) omission causing NULL ptr on i386 This commit explicitly adds 8-byte alignment to BOUNDED_SECTION macros to prevent unaligned section pointers. It also introduces _ALIGNED variants for manually aligned sections and updates existing macros to use them. Link: https://lore.kernel.org/lkml/177402491426.6181.12855763650074831089.b4-review@b4/ > diff --git a/include/asm-generic/bounded_sections.lds.h > b/include/asm-generic/bounded_sections.lds.h > index 268cdc34389b0..8ff3e3420f60a 100644 > --- a/include/asm-generic/bounded_sections.lds.h > +++ b/include/asm-generic/bounded_sections.lds.h [ ... ] > -#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ > +#define BOUNDED_SECTION_PRE_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, > _ALIGNED_) \ > + . = ALIGN(_ALIGNED_); \ > _BEGIN_##_label_ = .; \ > KEEP(*(_sec_)) \ > _END_##_label_ = .; > > -#define BOUNDED_SECTION_POST_LABEL(_sec_, _label_, _BEGIN_, _END_) \ > +#define BOUNDED_SECTION_PRE_LABEL(_sec_, _label_, _BEGIN_, _END_) \ > + BOUNDED_SECTION_PRE_LABEL_ALIGNED(_sec_, _label_, _BEGIN_, _END_, 8) [Severity: High] Does this implicit 8-byte alignment break the .notes ELF section by injecting padding? The NOTES macro in vmlinux.lds.h defines the .notes output section, which inherits a 4-byte alignment from its input *(.note.*) sections. It often follows RO_EXCEPTION_TABLE, which can end on a 4-byte boundary. If the output section VMA is not 8-byte aligned, this new explicit . = ALIGN(8) inside the BOUNDED_SECTION_BY macro will inject 4 bytes of zero padding at the beginning of the .notes section. This padding can be misinterpreted as an empty note header by external tools and the kernel, breaking PT_NOTE parsing. Should the NOTES macro be updated to use BOUNDED_SECTION_BY_ALIGNED(.note.*, _notes, 4)? > diff --git a/include/asm-generic/vmlinux.lds.h > b/include/asm-generic/vmlinux.lds.h > index 9c61dd083f26a..477333bdf3d35 100644 > --- a/include/asm-generic/vmlinux.lds.h > +++ b/include/asm-generic/vmlinux.lds.h [ ... ] > @@ -650,7 +650,7 @@ > #define BTF \ > . = ALIGN(PAGE_SIZE); \ > .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) { \ > - BOUNDED_SECTION_BY(.BTF, _BTF) \ > + BOUNDED_SECTION_BY_ALIGNED(.BTF, _BTF, PAGE_SIZE) \ > } \ > . = ALIGN(PAGE_SIZE); \ > .BTF_ids : AT(ADDR(.BTF_ids) - LOAD_OFFSET) { \ [Severity: Low] The commit message states "update BOUNDED_SECTION uses inside . = ALIGN(x) stanzas to use _ALIGNED variants". Was .BTF_ids intentionally omitted from this rule? It sits right below .BTF and also has an outer . = ALIGN(PAGE_SIZE), but still uses the base BOUNDED_SECTION_BY macro. This doesn't cause functional issues since it is already page-aligned, but it leaves the macro usage inconsistent with the stated refactoring rules. -- Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5
