summaryrefslogtreecommitdiff
path: root/include/linux/entry-common.h
diff options
context:
space:
mode:
authorSven Schnelle <svens@linux.ibm.com>2023-12-18 08:45:19 +0100
committerThomas Gleixner <tglx@linutronix.de>2023-12-21 23:12:18 +0100
commitcaf4062e35b21cd7d3d35ac2f58f9765d02d32a0 (patch)
tree0bead20254efc88d18020039f2c3e91785e3ca71 /include/linux/entry-common.h
parentd68019471995ba47e56a9da355df13a1cdb5bf7e (diff)
entry: Move enter_from_user_mode() to header file
To allow inlining of enter_from_user_mode(), move it to entry-common.h. Signed-off-by: Sven Schnelle <svens@linux.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20231218074520.1998026-3-svens@linux.ibm.com
Diffstat (limited to 'include/linux/entry-common.h')
-rw-r--r--include/linux/entry-common.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h
index 6a6e98f3805f..c4205390448e 100644
--- a/include/linux/entry-common.h
+++ b/include/linux/entry-common.h
@@ -11,6 +11,7 @@
#include <linux/livepatch.h>
#include <linux/resume_user_mode.h>
#include <linux/tick.h>
+#include <linux/kmsan.h>
#include <asm/entry-common.h>
@@ -102,7 +103,19 @@ static __always_inline void arch_enter_from_user_mode(struct pt_regs *regs) {}
* done between establishing state and enabling interrupts. The caller must
* enable interrupts before invoking syscall_enter_from_user_mode_work().
*/
-void enter_from_user_mode(struct pt_regs *regs);
+static __always_inline void enter_from_user_mode(struct pt_regs *regs)
+{
+ arch_enter_from_user_mode(regs);
+ lockdep_hardirqs_off(CALLER_ADDR0);
+
+ CT_WARN_ON(__ct_state() != CONTEXT_USER);
+ user_exit_irqoff();
+
+ instrumentation_begin();
+ kmsan_unpoison_entry_regs(regs);
+ trace_hardirqs_off_finish();
+ instrumentation_end();
+}
/**
* syscall_enter_from_user_mode_prepare - Establish state and enable interrupts