Commit 6d97af48 authored by Sven Schnelle's avatar Sven Schnelle Committed by Heiko Carstens

entry: Rename arch_check_user_regs() to arch_enter_from_user_mode()

arch_check_user_regs() is used at the moment to verify that struct pt_regs
contains valid values when entering the kernel from userspace. s390 needs
a place in the generic entry code to modify a cpu data structure when
switching from userspace to kernel mode. As arch_check_user_regs() is
exactly this, rename it to arch_enter_from_user_mode().

When entering the kernel from userspace, arch_check_user_regs() is
used to verify that struct pt_regs contains valid values. Note that
the NMI codepath doesn't call this function. s390 needs a place in the
generic entry code to modify a cpu data structure when switching from
userspace to kernel mode. As arch_check_user_regs() is exactly this,
rename it to arch_enter_from_user_mode().
Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andy Lutomirski <luto@kernel.org>
Link: https://lore.kernel.org/r/20220504062351.2954280-2-tmricht@linux.ibm.comSigned-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent fcdc03f7
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
void do_per_trap(struct pt_regs *regs); void do_per_trap(struct pt_regs *regs);
#ifdef CONFIG_DEBUG_ENTRY #ifdef CONFIG_DEBUG_ENTRY
static __always_inline void arch_check_user_regs(struct pt_regs *regs) static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs)
{ {
debug_user_asce(0); debug_user_asce(0);
} }
#define arch_check_user_regs arch_check_user_regs #define arch_enter_from_user_mode arch_enter_from_user_mode
#endif /* CONFIG_DEBUG_ENTRY */ #endif /* CONFIG_DEBUG_ENTRY */
static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs, static __always_inline void arch_exit_to_user_mode_work(struct pt_regs *regs,
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <asm/fpu/api.h> #include <asm/fpu/api.h>
/* Check that the stack and regs on entry from user mode are sane. */ /* Check that the stack and regs on entry from user mode are sane. */
static __always_inline void arch_check_user_regs(struct pt_regs *regs) static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs)
{ {
if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) { if (IS_ENABLED(CONFIG_DEBUG_ENTRY)) {
/* /*
...@@ -42,7 +42,7 @@ static __always_inline void arch_check_user_regs(struct pt_regs *regs) ...@@ -42,7 +42,7 @@ static __always_inline void arch_check_user_regs(struct pt_regs *regs)
WARN_ON_ONCE(regs != task_pt_regs(current)); WARN_ON_ONCE(regs != task_pt_regs(current));
} }
} }
#define arch_check_user_regs arch_check_user_regs #define arch_enter_from_user_mode arch_enter_from_user_mode
static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs, static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs,
unsigned long ti_work) unsigned long ti_work)
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
ARCH_EXIT_TO_USER_MODE_WORK) ARCH_EXIT_TO_USER_MODE_WORK)
/** /**
* arch_check_user_regs - Architecture specific sanity check for user mode regs * arch_enter_from_user_mode - Architecture specific sanity check for user mode regs
* @regs: Pointer to currents pt_regs * @regs: Pointer to currents pt_regs
* *
* Defaults to an empty implementation. Can be replaced by architecture * Defaults to an empty implementation. Can be replaced by architecture
...@@ -73,10 +73,10 @@ ...@@ -73,10 +73,10 @@
* section. Use __always_inline so the compiler cannot push it out of line * section. Use __always_inline so the compiler cannot push it out of line
* and make it instrumentable. * and make it instrumentable.
*/ */
static __always_inline void arch_check_user_regs(struct pt_regs *regs); static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs);
#ifndef arch_check_user_regs #ifndef arch_enter_from_user_mode
static __always_inline void arch_check_user_regs(struct pt_regs *regs) {} static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs) {}
#endif #endif
/** /**
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
/* See comment for enter_from_user_mode() in entry-common.h */ /* See comment for enter_from_user_mode() in entry-common.h */
static __always_inline void __enter_from_user_mode(struct pt_regs *regs) static __always_inline void __enter_from_user_mode(struct pt_regs *regs)
{ {
arch_check_user_regs(regs); arch_enter_from_user_mode(regs);
lockdep_hardirqs_off(CALLER_ADDR0); lockdep_hardirqs_off(CALLER_ADDR0);
CT_WARN_ON(ct_state() != CONTEXT_USER); CT_WARN_ON(ct_state() != CONTEXT_USER);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment