[PATCH 2/4] vmlinux.lds.h: Split .static_call_sites from .static_call_tramp_key

From: Kees Cook
Date: Wed Sep 01 2021 - 19:38:04 EST


These two sections are ro_after_init and .rodata respectively. While
they will ultimately become read-only, there's no reason to confuse
their macro names.

Cc: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>
Cc: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Cc: linux-arch@xxxxxxxxxxxxxxx
Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
---
include/asm-generic/vmlinux.lds.h | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 70c74fdf9c9b..4781a8154254 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -396,17 +396,22 @@
. = __start_init_task + THREAD_SIZE; \
__end_init_task = .;

+/* Sorted during __init. */
#define JUMP_TABLE_RO_AFTER_INIT_DATA \
. = ALIGN(8); \
__start___jump_table = .; \
KEEP(*(__jump_table)) \
__stop___jump_table = .;

+/* Sorted during __init. */
#define STATIC_CALL_RO_AFTER_INIT_DATA \
. = ALIGN(8); \
__start_static_call_sites = .; \
KEEP(*(.static_call_sites)) \
__stop_static_call_sites = .; \
+
+#define STATIC_CALL_RODATA \
+ . = ALIGN(8); \
__start_static_call_tramp_key = .; \
KEEP(*(.static_call_tramp_key)) \
__stop_static_call_tramp_key = .;
@@ -434,6 +439,7 @@
__start_rodata = .; \
*(.rodata) *(.rodata.*) \
SCHED_RODATA \
+ STATIC_CALL_RODATA \
RO_AFTER_INIT_DATA /* Read only after init */ \
. = ALIGN(8); \
__start___tracepoints_ptrs = .; \
--
2.30.2