Skip to content

Commit 3887080

Browse files
bwendlingctmarinas
authored andcommitted
arm64/vdso: Discard .note.gnu.property sections in vDSO
The arm64 assembler in binutils 2.32 and above generates a program property note in a note section, .note.gnu.property, to encode used x86 ISAs and features. But the kernel linker script only contains a single NOTE segment: PHDRS { text PT_LOAD FLAGS(5) FILEHDR PHDRS; /* PF_R|PF_X */ dynamic PT_DYNAMIC FLAGS(4); /* PF_R */ note PT_NOTE FLAGS(4); /* PF_R */ } The NOTE segment generated by the vDSO linker script is aligned to 4 bytes. But the .note.gnu.property section must be aligned to 8 bytes on arm64. $ readelf -n vdso64.so Displaying notes found in: .note Owner Data size Description Linux 0x00000004 Unknown note type: (0x00000000) description data: 06 00 00 00 readelf: Warning: note with invalid namesz and/or descsz found at offset 0x20 readelf: Warning: type: 0x78, namesize: 0x00000100, descsize: 0x756e694c, alignment: 8 Since the note.gnu.property section in the vDSO is not checked by the dynamic linker, discard the .note.gnu.property sections in the vDSO. Similar to commit 4caffe6 ("x86/vdso: Discard .note.gnu.property sections in vDSO"), but for arm64. Signed-off-by: Bill Wendling <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Ard Biesheuvel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 75516c7 commit 3887080

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

arch/arm64/kernel/vdso/vdso.lds.S

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ SECTIONS
3131
.gnu.version_d : { *(.gnu.version_d) }
3232
.gnu.version_r : { *(.gnu.version_r) }
3333

34+
/*
35+
* Discard .note.gnu.property sections which are unused and have
36+
* different alignment requirement from vDSO note sections.
37+
*/
38+
/DISCARD/ : {
39+
*(.note.GNU-stack .note.gnu.property)
40+
}
3441
.note : { *(.note.*) } :text :note
3542

3643
. = ALIGN(16);
@@ -48,7 +55,6 @@ SECTIONS
4855
PROVIDE(end = .);
4956

5057
/DISCARD/ : {
51-
*(.note.GNU-stack)
5258
*(.data .data.* .gnu.linkonce.d.* .sdata*)
5359
*(.bss .sbss .dynbss .dynsbss)
5460
*(.eh_frame .eh_frame_hdr)

0 commit comments

Comments
 (0)