preempt: Move PREEMPT_RT before PREEMPT in vermagic.
Sebastian Andrzej Siewior
maintainerPATCH 1/1 preempt: Move PREEMPT_RT before PREEMPT in vermagic.
Since the dynamic preemption has been enabled for PREEMPT_RT we have now CONFIG_PREEMPT and CONFIG_PREEMPT_RT set simultaneously. This affects the vermagic strings which comes now PREEMPT with PREEMPT_RT enabled.
The PREEMPT_RT module usually can not be loaded on a PREEMPT kernel because some symbols are missing.
However if the symbols are fine then it continues and it crashes later. The problem is that the struct module has a different layout and the num_exentries or init members are at a different position leading to a crash later on. This is not necessary caught by the size check in elf_validity_cache_index_mod() because the mem member has an alignment requirement of __module_memory_align which is big enough keep the total size unchanged. Therefore we should keep the string accurate instead of removing it.
Move the PREEMPT_RT check before the PREEMPT so that it takes precedence if both symbols are enabled.
--- include/linux/vermagic.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/linux/vermagic.h +3 -3
@@ -15,10 +15,10 @@#else #define MODULE_VERMAGIC_SMP ""#endif -#ifdef CONFIG_PREEMPT_BUILD -#define MODULE_VERMAGIC_PREEMPT "preempt " -#elif defined(CONFIG_PREEMPT_RT ) +#ifdef CONFIG_PREEMPT_RT #define MODULE_VERMAGIC_PREEMPT "preempt_rt " +#elif defined(CONFIG_PREEMPT_BUILD ) +#define MODULE_VERMAGIC_PREEMPT "preempt "#else #define MODULE_VERMAGIC_PREEMPT ""#endif
Signature · 1 line
2.45.2
Quoted 15 lines · Sebastian Andrzej Siewior
Since the dynamic preemption has been enabled for
PREEMPT_RTwe have nowCONFIG_PREEMPTandCONFIG_PREEMPT_RTset simultaneously. This affects the vermagic strings which comes now PREEMPT withPREEMPT_RTenabled.The
PREEMPT_RTmodule usually can not be loaded on a PREEMPT kernel because some symbols are missing.
However if the symbols are fine then it continues and it crashes later. The problem is that the struct module has a different layout and thenum_exentriesor init members are at a different position leading to a crash later on. This is not necessary caught by the size check inelf_validity_cache_index_mod()because the mem member has an alignment requirement of__module_memory_alignwhich is big enough keep the total size unchanged. Therefore we should keep the string accurate instead of removing it.
Quoted 5 lines
Move the
PREEMPT_RTcheck before the PREEMPT so that it takes precedence if both symbols are enabled.Fixes 35772d627b55c ("sched: Enable PREEMPT_DYNAMIC for PREEMPT_RT")Signed-off-by Sebastian Andrzej Siewior <[email protected]>
I'm going to wait for a few days if others want to comment and then plan to take this through the modules tree for 6.13-rcX fixes.
[Luis asked me to look after the modules tree for a while, with the plan to rotate it.]
Signature · 2 lines
Thanks, Petr
Sebastian Andrzej Siewior
maintainerQuoted 5 lines · Petr Pavlu
Reviewed-by Petr Pavlu <[email protected]>I'm going to wait for a few days if others want to comment and then plan to take this through the modules tree for 6.13-rcX fixes.
thank you.
Quoted 2 lines
[Luis asked me to look after the modules tree for a while, with the plan to rotate it.]
understood.
Sebastian