Skip to content

Commit ca136ca

Browse files
kaccardiPeter Zijlstra
authored andcommitted
vmlinux.lds.h: Have ORC lookup cover entire _etext - _stext
When using -ffunction-sections to place each function in its own text section (so it can be randomized at load time in the future FGKASLR series), the linker will place most of the functions into separate .text.* sections. SIZEOF(.text) won't work here for calculating the ORC lookup table size, so the total text size must be calculated to include .text AND all .text.* sections. Signed-off-by: Kristen Carlson Accardi <[email protected]> [ alobakin: move it to vmlinux.lds.h and make arch-indep ] Signed-off-by: Alexander Lobakin <[email protected]> Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Reviewed-by: Tony Luck <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Josh Poimboeuf <[email protected]> Tested-by: Tony Luck <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 33f98a9 commit ca136ca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/asm-generic/vmlinux.lds.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,10 +869,11 @@
869869
KEEP(*(.orc_unwind)) \
870870
__stop_orc_unwind = .; \
871871
} \
872+
text_size = _etext - _stext; \
872873
. = ALIGN(4); \
873874
.orc_lookup : AT(ADDR(.orc_lookup) - LOAD_OFFSET) { \
874875
orc_lookup = .; \
875-
. += (((SIZEOF(.text) + LOOKUP_BLOCK_SIZE - 1) / \
876+
. += (((text_size + LOOKUP_BLOCK_SIZE - 1) / \
876877
LOOKUP_BLOCK_SIZE) + 1) * 4; \
877878
orc_lookup_end = .; \
878879
}

0 commit comments

Comments
 (0)