Skip to content

Commit 0b7a66a

Browse files
Sebastian Andrzej Siewiorpetrpavlu
authored andcommitted
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. Fixes: 35772d6 ("sched: Enable PREEMPT_DYNAMIC for PREEMPT_RT") Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Reviewed-by: Petr Pavlu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Petr Pavlu <[email protected]>
1 parent 4bbf902 commit 0b7a66a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/linux/vermagic.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
#else
1616
#define MODULE_VERMAGIC_SMP ""
1717
#endif
18-
#ifdef CONFIG_PREEMPT_BUILD
19-
#define MODULE_VERMAGIC_PREEMPT "preempt "
20-
#elif defined(CONFIG_PREEMPT_RT)
18+
#ifdef CONFIG_PREEMPT_RT
2119
#define MODULE_VERMAGIC_PREEMPT "preempt_rt "
20+
#elif defined(CONFIG_PREEMPT_BUILD)
21+
#define MODULE_VERMAGIC_PREEMPT "preempt "
2222
#else
2323
#define MODULE_VERMAGIC_PREEMPT ""
2424
#endif

0 commit comments

Comments
 (0)