lkml.org 
[lkml]   [2021]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/4] Move userspace syscall dispatch outside of common entry
Date
From: Ryan Houdek <Houdek.Ryan@fex-emu.org>

This will allow other architectures to support userspace syscall
dispatch without supporting the syscall common entry.

Signed-off-by: Ryan Houdek <Houdek.Ryan@fex-emu.org>
---
arch/Kconfig | 4 ++++
include/linux/syscall_user_dispatch.h | 4 +++-
kernel/entry/Makefile | 3 ++-
kernel/entry/common.c | 3 +--
kernel/entry/common.h | 7 -------
kernel/entry/syscall_user_dispatch.c | 2 --
6 files changed, 10 insertions(+), 13 deletions(-)
delete mode 100644 kernel/entry/common.h

diff --git a/arch/Kconfig b/arch/Kconfig
index c45b770d3579..def67ebbae83 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -30,7 +30,11 @@ config SET_FS
config HOTPLUG_SMT
bool

+config SYSCALL_USER_DISPATCH
+ bool
+
config GENERIC_ENTRY
+ select SYSCALL_USER_DISPATCH
bool

config KPROBES
diff --git a/include/linux/syscall_user_dispatch.h b/include/linux/syscall_user_dispatch.h
index a0ae443fb7df..9d1e244d7021 100644
--- a/include/linux/syscall_user_dispatch.h
+++ b/include/linux/syscall_user_dispatch.h
@@ -7,7 +7,7 @@

#include <linux/thread_info.h>

-#ifdef CONFIG_GENERIC_ENTRY
+#ifdef CONFIG_SYSCALL_USER_DISPATCH

struct syscall_user_dispatch {
char __user *selector;
@@ -16,6 +16,8 @@ struct syscall_user_dispatch {
bool on_dispatch;
};

+bool syscall_user_dispatch(struct pt_regs *regs);
+
int set_syscall_user_dispatch(unsigned long mode, unsigned long offset,
unsigned long len, char __user *selector);

diff --git a/kernel/entry/Makefile b/kernel/entry/Makefile
index 095c775e001e..35684390d56e 100644
--- a/kernel/entry/Makefile
+++ b/kernel/entry/Makefile
@@ -9,5 +9,6 @@ KCOV_INSTRUMENT := n
CFLAGS_REMOVE_common.o = -fstack-protector -fstack-protector-strong
CFLAGS_common.o += -fno-stack-protector

-obj-$(CONFIG_GENERIC_ENTRY) += common.o syscall_user_dispatch.o
+obj-$(CONFIG_GENERIC_ENTRY) += common.o
+obj-$(CONFIG_SYSCALL_USER_DISPATCH) += syscall_user_dispatch.o
obj-$(CONFIG_KVM_XFER_TO_GUEST_WORK) += kvm.o
diff --git a/kernel/entry/common.c b/kernel/entry/common.c
index a0b3b04fb596..84ea1e66e0b2 100644
--- a/kernel/entry/common.c
+++ b/kernel/entry/common.c
@@ -5,8 +5,7 @@
#include <linux/highmem.h>
#include <linux/livepatch.h>
#include <linux/audit.h>
-
-#include "common.h"
+#include <linux/syscall_user_dispatch.h>

#define CREATE_TRACE_POINTS
#include <trace/events/syscalls.h>
diff --git a/kernel/entry/common.h b/kernel/entry/common.h
deleted file mode 100644
index f6e6d02f07fe..000000000000
--- a/kernel/entry/common.h
+++ /dev/null
@@ -1,7 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _COMMON_H
-#define _COMMON_H
-
-bool syscall_user_dispatch(struct pt_regs *regs);
-
-#endif
diff --git a/kernel/entry/syscall_user_dispatch.c b/kernel/entry/syscall_user_dispatch.c
index c240302f56e2..352da8427b01 100644
--- a/kernel/entry/syscall_user_dispatch.c
+++ b/kernel/entry/syscall_user_dispatch.c
@@ -14,8 +14,6 @@

#include <asm/syscall.h>

-#include "common.h"
-
static void trigger_sigsys(struct pt_regs *regs)
{
struct kernel_siginfo info;
--
2.30.2
\
 
 \ /
  Last update: 2021-05-29 10:17    [W:0.269 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site