summaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2018-09-18 23:51:42 -0700
committerThomas Gleixner <tglx@linutronix.de>2018-09-27 17:56:48 +0200
commit19483677684b6ca01606f58503cb79cdfbbc7c72 (patch)
treef2b8dc759e74ffbcc5f599dde452867bb342bf69 /init
parentb34006c4258c9c86597b6b7123d6a9a3513d6cd7 (diff)
downloadlinux-stable-19483677684b6ca01606f58503cb79cdfbbc7c72.tar.gz
linux-stable-19483677684b6ca01606f58503cb79cdfbbc7c72.tar.bz2
linux-stable-19483677684b6ca01606f58503cb79cdfbbc7c72.zip
jump_label: Annotate entries that operate on __init code earlier
Jump table entries are mostly read-only, with the exception of the init and module loader code that defuses entries that point into init code when the code being referred to is freed. For robustness, it would be better to move these entries into the ro_after_init section, but clearing the 'code' member of each jump table entry referring to init code at module load time races with the module_enable_ro() call that remaps the ro_after_init section read only, so we'd like to do it earlier. So given that whether such an entry refers to init code can be decided much earlier, we can pull this check forward. Since we may still need the code entry at this point, let's switch to setting a low bit in the 'key' member just like we do to annotate the default state of a jump table entry. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Kees Cook <keescook@chromium.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-s390@vger.kernel.org Cc: Arnd Bergmann <arnd@arndb.de> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Jessica Yu <jeyu@kernel.org> Link: https://lkml.kernel.org/r/20180919065144.25010-8-ard.biesheuvel@linaro.org
Diffstat (limited to 'init')
-rw-r--r--init/main.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/init/main.c b/init/main.c
index 18f8f0140fa0..a664246450d1 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1064,7 +1064,6 @@ static int __ref kernel_init(void *unused)
/* need to finish all async __init code before freeing the memory */
async_synchronize_full();
ftrace_free_init_mem();
- jump_label_invalidate_initmem();
free_initmem();
mark_readonly();