mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
syscall_user_dispatch: Make it configurable in Kconfig
Syscall User Dispatch is presently built under CONFIG_GENERIC_SYSCALL and cannot be disabled independently. Add CONFIG_SYSCALL_USER_DISPATCH to make it an optional feature. Signed-off-by: Gregory Price <gourry@gourry.net> Signed-off-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260706140020.873735-2-gourry@gourry.net
This commit is contained in:
committed by
Thomas Gleixner
parent
8cdeaa50ea
commit
ee935e8dc7
@@ -114,6 +114,16 @@ config GENERIC_ENTRY
|
|||||||
select GENERIC_IRQ_ENTRY
|
select GENERIC_IRQ_ENTRY
|
||||||
select GENERIC_SYSCALL
|
select GENERIC_SYSCALL
|
||||||
|
|
||||||
|
config SYSCALL_USER_DISPATCH
|
||||||
|
bool "Syscall User Dispatch"
|
||||||
|
depends on GENERIC_ENTRY
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
Syscall User Dispatch lets a thread have its own system calls
|
||||||
|
intercepted and redirected to a userspace signal handler based
|
||||||
|
on a prctl() configured instruction pointer range.
|
||||||
|
If unsure, say Y.
|
||||||
|
|
||||||
config KPROBES
|
config KPROBES
|
||||||
bool "Kprobes"
|
bool "Kprobes"
|
||||||
depends on HAVE_KPROBES
|
depends on HAVE_KPROBES
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include <linux/resume_user_mode.h>
|
#include <linux/resume_user_mode.h>
|
||||||
#include <linux/seccomp.h>
|
#include <linux/seccomp.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
|
#include <linux/syscall_user_dispatch.h>
|
||||||
|
|
||||||
#include <asm/entry-common.h>
|
#include <asm/entry-common.h>
|
||||||
#include <asm/syscall.h>
|
#include <asm/syscall.h>
|
||||||
@@ -55,7 +56,6 @@ static __always_inline int arch_ptrace_report_syscall_entry(struct pt_regs *regs
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool syscall_user_dispatch(struct pt_regs *regs);
|
|
||||||
long trace_syscall_enter(struct pt_regs *regs, long syscall);
|
long trace_syscall_enter(struct pt_regs *regs, long syscall);
|
||||||
void trace_syscall_exit(struct pt_regs *regs, long ret);
|
void trace_syscall_exit(struct pt_regs *regs, long ret);
|
||||||
|
|
||||||
@@ -232,10 +232,8 @@ static __always_inline void syscall_exit_work(struct pt_regs *regs, unsigned lon
|
|||||||
* of these syscalls is unknown.
|
* of these syscalls is unknown.
|
||||||
*/
|
*/
|
||||||
if (work & SYSCALL_WORK_SYSCALL_USER_DISPATCH) {
|
if (work & SYSCALL_WORK_SYSCALL_USER_DISPATCH) {
|
||||||
if (unlikely(current->syscall_dispatch.on_dispatch)) {
|
if (syscall_user_dispatch_clear_on_dispatch())
|
||||||
current->syscall_dispatch.on_dispatch = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
audit_syscall_exit(regs);
|
audit_syscall_exit(regs);
|
||||||
|
|||||||
@@ -6,9 +6,23 @@
|
|||||||
#define _SYSCALL_USER_DISPATCH_H
|
#define _SYSCALL_USER_DISPATCH_H
|
||||||
|
|
||||||
#include <linux/thread_info.h>
|
#include <linux/thread_info.h>
|
||||||
|
#include <linux/sched.h>
|
||||||
#include <linux/syscall_user_dispatch_types.h>
|
#include <linux/syscall_user_dispatch_types.h>
|
||||||
|
|
||||||
#ifdef CONFIG_GENERIC_ENTRY
|
struct pt_regs;
|
||||||
|
|
||||||
|
#ifdef CONFIG_SYSCALL_USER_DISPATCH
|
||||||
|
|
||||||
|
bool syscall_user_dispatch(struct pt_regs *regs);
|
||||||
|
|
||||||
|
static __always_inline bool syscall_user_dispatch_clear_on_dispatch(void)
|
||||||
|
{
|
||||||
|
if (likely(!current->syscall_dispatch.on_dispatch))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
current->syscall_dispatch.on_dispatch = false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
|
int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
|
||||||
unsigned long len, char __user *selector);
|
unsigned long len, char __user *selector);
|
||||||
@@ -24,6 +38,16 @@ int syscall_user_dispatch_set_config(struct task_struct *task, unsigned long siz
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
static __always_inline bool syscall_user_dispatch(struct pt_regs *regs)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static __always_inline bool syscall_user_dispatch_clear_on_dispatch(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
|
static inline int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
|
||||||
unsigned long len, char __user *selector)
|
unsigned long len, char __user *selector)
|
||||||
{
|
{
|
||||||
@@ -46,6 +70,6 @@ static inline int syscall_user_dispatch_set_config(struct task_struct *task,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_GENERIC_ENTRY */
|
#endif /* CONFIG_SYSCALL_USER_DISPATCH */
|
||||||
|
|
||||||
#endif /* _SYSCALL_USER_DISPATCH_H */
|
#endif /* _SYSCALL_USER_DISPATCH_H */
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
|
|
||||||
#ifdef CONFIG_GENERIC_ENTRY
|
#ifdef CONFIG_SYSCALL_USER_DISPATCH
|
||||||
|
|
||||||
struct syscall_user_dispatch {
|
struct syscall_user_dispatch {
|
||||||
char __user *selector;
|
char __user *selector;
|
||||||
|
|||||||
@@ -13,5 +13,6 @@ CFLAGS_REMOVE_common.o = -fstack-protector -fstack-protector-strong
|
|||||||
CFLAGS_common.o += -fno-stack-protector
|
CFLAGS_common.o += -fno-stack-protector
|
||||||
|
|
||||||
obj-$(CONFIG_GENERIC_IRQ_ENTRY) += common.o
|
obj-$(CONFIG_GENERIC_IRQ_ENTRY) += common.o
|
||||||
obj-$(CONFIG_GENERIC_SYSCALL) += syscall-common.o syscall_user_dispatch.o
|
obj-$(CONFIG_GENERIC_SYSCALL) += syscall-common.o
|
||||||
|
obj-$(CONFIG_SYSCALL_USER_DISPATCH) += syscall_user_dispatch.o
|
||||||
obj-$(CONFIG_VIRT_XFER_TO_GUEST_WORK) += virt.o
|
obj-$(CONFIG_VIRT_XFER_TO_GUEST_WORK) += virt.o
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
CONFIG_GENERIC_ENTRY=y
|
CONFIG_SYSCALL_USER_DISPATCH=y
|
||||||
|
|||||||
Reference in New Issue
Block a user