All of lore.kernel.org
 help / color / mirror / Atom feed
From: benjamin@sipsolutions.net
To: linux-um@lists.infradead.org
Cc: Benjamin Berg <benjamin@sipsolutions.net>
Subject: [PATCH v2 10/28] um: Always inline stub functions
Date: Tue, 22 Nov 2022 11:07:41 +0100	[thread overview]
Message-ID: <20221122100759.208290-11-benjamin@sipsolutions.net> (raw)
In-Reply-To: <20221122100759.208290-1-benjamin@sipsolutions.net>

From: Benjamin Berg <benjamin@sipsolutions.net>

The stub executable page is remapped to a different location in the
userland process. As these functions may be used by the stub, they
really need to be always inlined rather than permitting the compiler to
emit a function.

Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
---
 arch/x86/um/shared/sysdep/stub_32.h | 21 +++++++++++----------
 arch/x86/um/shared/sysdep/stub_64.h | 15 ++++++++-------
 2 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/arch/x86/um/shared/sysdep/stub_32.h b/arch/x86/um/shared/sysdep/stub_32.h
index 4c6c2be0c899..dc04d8cc2791 100644
--- a/arch/x86/um/shared/sysdep/stub_32.h
+++ b/arch/x86/um/shared/sysdep/stub_32.h
@@ -12,7 +12,7 @@
 #define STUB_MMAP_NR __NR_mmap2
 #define MMAP_OFFSET(o) ((o) >> UM_KERN_PAGE_SHIFT)
 
-static inline long stub_syscall0(long syscall)
+static __always_inline long stub_syscall0(long syscall)
 {
 	long ret;
 
@@ -21,7 +21,7 @@ static inline long stub_syscall0(long syscall)
 	return ret;
 }
 
-static inline long stub_syscall1(long syscall, long arg1)
+static __always_inline long stub_syscall1(long syscall, long arg1)
 {
 	long ret;
 
@@ -30,7 +30,7 @@ static inline long stub_syscall1(long syscall, long arg1)
 	return ret;
 }
 
-static inline long stub_syscall2(long syscall, long arg1, long arg2)
+static __always_inline long stub_syscall2(long syscall, long arg1, long arg2)
 {
 	long ret;
 
@@ -40,7 +40,8 @@ static inline long stub_syscall2(long syscall, long arg1, long arg2)
 	return ret;
 }
 
-static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
+static __always_inline long stub_syscall3(long syscall, long arg1, long arg2,
+					  long arg3)
 {
 	long ret;
 
@@ -50,8 +51,8 @@ static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
 	return ret;
 }
 
-static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
-				 long arg4)
+static __always_inline long stub_syscall4(long syscall, long arg1, long arg2,
+					  long arg3, long arg4)
 {
 	long ret;
 
@@ -61,8 +62,8 @@ static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
 	return ret;
 }
 
-static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
-				 long arg4, long arg5)
+static __always_inline long stub_syscall5(long syscall, long arg1, long arg2,
+					  long arg3, long arg4, long arg5)
 {
 	long ret;
 
@@ -72,12 +73,12 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
 	return ret;
 }
 
-static inline void trap_myself(void)
+static __always_inline void trap_myself(void)
 {
 	__asm("int3");
 }
 
-static inline void remap_stack_and_trap(void)
+static __always_inline void remap_stack_and_trap(void)
 {
 	__asm__ volatile (
 		"movl %%esp,%%ebx ;"
diff --git a/arch/x86/um/shared/sysdep/stub_64.h b/arch/x86/um/shared/sysdep/stub_64.h
index 92ea1670cf1c..da6fd28fa95e 100644
--- a/arch/x86/um/shared/sysdep/stub_64.h
+++ b/arch/x86/um/shared/sysdep/stub_64.h
@@ -16,7 +16,7 @@
 #define __syscall_clobber "r11","rcx","memory"
 #define __syscall "syscall"
 
-static inline long stub_syscall0(long syscall)
+static __always_inline long stub_syscall0(long syscall)
 {
 	long ret;
 
@@ -27,7 +27,7 @@ static inline long stub_syscall0(long syscall)
 	return ret;
 }
 
-static inline long stub_syscall2(long syscall, long arg1, long arg2)
+static __always_inline long stub_syscall2(long syscall, long arg1, long arg2)
 {
 	long ret;
 
@@ -38,7 +38,8 @@ static inline long stub_syscall2(long syscall, long arg1, long arg2)
 	return ret;
 }
 
-static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
+static __always_inline long stub_syscall3(long syscall, long arg1, long arg2,
+					  long arg3)
 {
 	long ret;
 
@@ -64,8 +65,8 @@ static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
 	return ret;
 }
 
-static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
-				 long arg4, long arg5)
+static __always_inline long stub_syscall5(long syscall, long arg1, long arg2,
+					  long arg3, long arg4, long arg5)
 {
 	long ret;
 
@@ -78,12 +79,12 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
 	return ret;
 }
 
-static inline void trap_myself(void)
+static __always_inline void trap_myself(void)
 {
 	__asm("int3");
 }
 
-static inline void remap_stack_and_trap(void)
+static __always_inline void remap_stack_and_trap(void)
 {
 	__asm__ volatile (
 		"movq %0,%%rax ;"
-- 
2.38.1


_______________________________________________
linux-um mailing list
linux-um@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-um

  parent reply	other threads:[~2022-11-22 10:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 10:07 [PATCH v2 00/28] Implement SECCOMP based userland benjamin
2022-11-22 10:07 ` [PATCH v2 01/28] um: Switch printk calls to adhere to correct coding style benjamin
2022-11-22 10:07 ` [PATCH v2 02/28] um: Declare fix_range_common as a static function benjamin
2022-11-22 10:07 ` [PATCH v2 03/28] um: Drop support for hosts without SYSEMU_SINGLESTEP support benjamin
2022-11-22 10:07 ` [PATCH v2 04/28] um: Drop NULL check from start_userspace benjamin
2022-11-22 10:07 ` [PATCH v2 05/28] um: Make errors to stop ptraced child fatal during startup benjamin
2022-11-22 10:07 ` [PATCH v2 06/28] um: Don't use vfprintf() for os_info() benjamin
2022-11-22 10:07 ` [PATCH v2 07/28] um: Do not use printk in SIGWINCH helper thread benjamin
2022-11-22 10:07 ` [PATCH v2 08/28] um: Reap winch thread if it fails benjamin
2022-11-22 10:07 ` [PATCH v2 09/28] um: Do not use printk in userspace trampoline benjamin
2022-11-22 10:07 ` benjamin [this message]
2022-11-22 10:07 ` [PATCH v2 11/28] um: Rely on PTRACE_SETREGSET to set FS/GS base registers benjamin
2022-11-22 10:07 ` [PATCH v2 12/28] um: Remove unused register save/restore functions benjamin
2022-11-22 10:07 ` [PATCH v2 13/28] um: Mark 32bit syscall helpers as clobbering memory benjamin
2022-11-22 10:07 ` [PATCH v2 14/28] um: Remove stub-data.h include from common-offsets.h benjamin
2022-11-22 10:07 ` [PATCH v2 15/28] um: Create signal stack memory assignment in stub_data benjamin
2022-11-22 10:07 ` [PATCH v2 16/28] um: Add generic stub_syscall6 function benjamin
2022-11-22 10:07 ` [PATCH v2 17/28] um: Rework syscall handling benjamin
2022-11-22 10:07 ` [PATCH v2 18/28] um: Store full CSGSFS and SS register from mcontext benjamin
2022-11-22 10:07 ` [PATCH v2 19/28] um: Pass full mm_id to functions creating helper processes benjamin
2022-11-22 10:07 ` [PATCH v2 20/28] um: Move faultinfo extraction into userspace routine benjamin
2022-11-22 10:07 ` [PATCH v2 21/28] um: Use struct uml_pt_regs for copy_context_skas0 benjamin
2022-11-22 10:07 ` [PATCH v2 22/28] um: Add UML_SECCOMP configuration option benjamin
2022-11-22 10:07 ` [PATCH v2 23/28] um: Add stub side of SECCOMP/futex based process handling benjamin
2022-11-22 10:07 ` [PATCH v2 24/28] um: Add helper functions to get/set state for SECCOMP benjamin
2022-11-22 10:07 ` [PATCH v2 25/28] um: Add SECCOMP support detection and initialization benjamin
2022-11-22 10:07 ` [PATCH v2 26/28] um: Die if a child dies unexpectedly in seccomp mode benjamin
2022-11-22 10:07 ` [PATCH v2 27/28] um: Implement kernel side of SECCOMP based process handling benjamin
2022-11-22 10:07 ` [PATCH v2 28/28] um: Delay flushing syscalls until the thread is restarted benjamin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221122100759.208290-11-benjamin@sipsolutions.net \
    --to=benjamin@sipsolutions.net \
    --cc=linux-um@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.