x86: Rewrite ret_from_fork() in C
authorBrian Gerst <brgerst@gmail.com>
Fri, 23 Jun 2023 22:55:29 +0000 (18:55 -0400)
committerPeter Zijlstra <peterz@infradead.org>
Mon, 10 Jul 2023 07:52:25 +0000 (09:52 +0200)
commit3aec4ecb3d1f313a8ab985df7cab07c4af81f478
treeb7866bb1960211cf8f1b4f2cbd1263fa309fc661
parent81f755d561f365f544795fad92f05a085ea4f292
x86: Rewrite ret_from_fork() in C

When kCFI is enabled, special handling is needed for the indirect call
to the kernel thread function.  Rewrite the ret_from_fork() function in
C so that the compiler can properly handle the indirect call.

Suggested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Link: https://lkml.kernel.org/r/20230623225529.34590-3-brgerst@gmail.com
arch/x86/entry/entry_32.S
arch/x86/entry/entry_64.S
arch/x86/include/asm/switch_to.h
arch/x86/kernel/process.c