Skip to content

Commit 60b57b9

Browse files
committed
module: Make .static_call_sites read-only after init
Section .static_call_sites holds data structures that need to be sorted and processed only at module load time. This initial processing happens in static_call_add_module(), which is invoked as a callback to the MODULE_STATE_COMING notification from prepare_coming_module(). The section is never modified afterwards. Make it therefore read-only after module initialization to avoid any (non-)accidental modifications. Reviewed-by: Sami Tolvanen <[email protected]> Reviewed-by: Luis Chamberlain <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
1 parent f798494 commit 60b57b9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/module/strict_rwx.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ static const char *const ro_after_init[] = {
121121
* section, which are marked as such at module load time.
122122
*/
123123
"__jump_table",
124+
125+
#ifdef CONFIG_HAVE_STATIC_CALL_INLINE
126+
/*
127+
* Section .static_call_sites holds data structures that need to be
128+
* sorted and processed at module load time but are never modified
129+
* afterwards.
130+
*/
131+
".static_call_sites",
132+
#endif
124133
};
125134

126135
void module_mark_ro_after_init(const Elf_Ehdr *hdr, Elf_Shdr *sechdrs,

0 commit comments

Comments
 (0)