On Thu, Mar 06, 2025 at 06:28:58PM +0100, Christophe Leroy wrote: > > > Le 06/03/2025 à 14:13, Petr Pavlu a écrit : > > 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. > > Maybe this suggestion is stupid, I didn't investigate the feasability but: > why don't we group everything that is ro_after_init in a single section just > like we do in vmlinux ? That would avoid having to add every new possible > section in the C code. > > Like we have in asm-generic/vmlinux.lds.h: > > #define RO_AFTER_INIT_DATA \ > . = ALIGN(8); \ > __start_ro_after_init = .; \ > *(.data..ro_after_init) \ > JUMP_TABLE_DATA \ > STATIC_CALL_DATA \ > __end_ro_after_init = .; I like this idea. Grouping the sections in the module linker script feels cleaner than having an array of section names in the code. To be fair, I think this code predates v5.10, where scripts/module.lds.S was first added. Sami