Skip to content

Commit 2390095

Browse files
masahir0ytorvalds
authored andcommitted
tick/nohz: unexport __init-annotated tick_nohz_full_setup()
EXPORT_SYMBOL and __init is a bad combination because the .init.text section is freed up after the initialization. Hence, modules cannot use symbols annotated __init. The access to a freed symbol may end up with kernel panic. modpost used to detect it, but it had been broken for a decade. Commit 2843879 ("modpost: fix section mismatch check for exported init/exit sections") fixed it so modpost started to warn it again, then this showed up: MODPOST vmlinux.symvers WARNING: modpost: vmlinux.o(___ksymtab_gpl+tick_nohz_full_setup+0x0): Section mismatch in reference from the variable __ksymtab_tick_nohz_full_setup to the function .init.text:tick_nohz_full_setup() The symbol tick_nohz_full_setup is exported and annotated __init Fix this by removing the __init annotation of tick_nohz_full_setup or drop the export. Drop the export because tick_nohz_full_setup() is only called from the built-in code in kernel/sched/isolation.c. Fixes: ae9e557 ("time: Export tick start/stop functions for rcutorture") Reported-by: Linus Torvalds <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Paul E. McKenney <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 03c765b commit 2390095

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

kernel/time/tick-sched.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ void __init tick_nohz_full_setup(cpumask_var_t cpumask)
526526
cpumask_copy(tick_nohz_full_mask, cpumask);
527527
tick_nohz_full_running = true;
528528
}
529-
EXPORT_SYMBOL_GPL(tick_nohz_full_setup);
530529

531530
static int tick_nohz_cpu_down(unsigned int cpu)
532531
{

0 commit comments

Comments
 (0)