@@ -31,6 +31,7 @@ config HOTPLUG_SMT
bool
config GENERIC_ENTRY
+ select HAVE_ARCH_UACCESS_BUFFER
bool
config KPROBES
@@ -6,6 +6,7 @@
#include <linux/livepatch.h>
#include <linux/audit.h>
#include <linux/tick.h>
+#include <linux/uaccess-buffer.h>
#include "common.h"
@@ -89,6 +90,8 @@ __syscall_enter_from_user_work(struct pt_regs *regs, long syscall)
if (work & SYSCALL_WORK_ENTER)
syscall = syscall_trace_enter(regs, syscall, work);
+ uaccess_buffer_syscall_entry();
+
return syscall;
}
@@ -197,14 +200,17 @@ static unsigned long exit_to_user_mode_loop(struct pt_regs *regs,
static void exit_to_user_mode_prepare(struct pt_regs *regs)
{
unsigned long ti_work = READ_ONCE(current_thread_info()->flags);
+ bool uaccess_buffer_pending;
lockdep_assert_irqs_disabled();
/* Flush pending rcuog wakeup before the last need_resched() check */
tick_nohz_user_enter_prepare();
+ uaccess_buffer_pending = uaccess_buffer_pre_exit_loop();
if (unlikely(ti_work & EXIT_TO_USER_MODE_WORK))
ti_work = exit_to_user_mode_loop(regs, ti_work);
+ uaccess_buffer_post_exit_loop(uaccess_buffer_pending);
arch_exit_to_user_mode_prepare(regs, ti_work);
@@ -271,6 +277,7 @@ static void syscall_exit_to_user_mode_prepare(struct pt_regs *regs)
local_irq_enable();
}
+ uaccess_buffer_syscall_exit();
rseq_syscall(regs);
/*
Add uaccess logging support on architectures that use CONFIG_GENERIC_ENTRY (currently only s390 and x86). Link: https://linux-review.googlesource.com/id/I3c5eb19a7e4a1dbe6095f6971f7826c4b0663f7d Signed-off-by: Peter Collingbourne <pcc@google.com> --- arch/Kconfig | 1 + kernel/entry/common.c | 7 +++++++ 2 files changed, 8 insertions(+)