Refresh x86-make-x32-syscall-support-conditional patch

This commit is contained in:
Aleksey Samoilov 2024-06-15 00:55:56 +04:00
parent 78c735a869
commit d8ae023995
Signed by: Sunderland93
GPG key ID: D3E730685C28F1FB

View file

@ -27,19 +27,9 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/include/asm/syscall.h | 13 ++++++
6 files changed, 78 insertions(+), 2 deletions(-)
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -6160,6 +6160,10 @@
later by a loaded module cannot be set this way.
Example: sysctl.vm.swappiness=40
+ syscall.x32= [KNL,x86_64] Enable/disable use of x32 syscalls on
+ an x86_64 kernel where CONFIG_X86_X32 is enabled.
+ Default depends on CONFIG_X86_X32_DISABLED.
+
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2997,6 +2997,14 @@ config COMPAT_32
@@ -2987,6 +2987,14 @@
select HAVE_UID16
select OLD_SIGSUSPEND3
@ -56,7 +46,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
depends on IA32_EMULATION || X86_X32_ABI
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -63,7 +63,7 @@ static __always_inline bool do_syscall_x
@@ -63,7 +63,7 @@
*/
unsigned int xnr = nr - __X32_SYSCALL_BIT;
@ -77,7 +67,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
#include <linux/syscalls.h>
#include <asm/syscall.h>
@@ -20,3 +23,46 @@ long x32_sys_call(const struct pt_regs *
@@ -20,3 +23,46 @@
default: return __x64_sys_ni_syscall(regs);
}
};
@ -136,7 +126,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
typedef unsigned long elf_greg_t;
@@ -150,7 +153,8 @@ do { \
@@ -150,7 +153,8 @@
#define compat_elf_check_arch(x) \
(elf_check_arch_ia32(x) || \
@ -144,8 +134,8 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+ (IS_ENABLED(CONFIG_X86_X32_ABI) && x32_enabled && \
+ (x)->e_machine == EM_X86_64))
#if __USER32_DS != __USER_DS
# error "The following code assumes __USER32_DS == __USER_DS"
static inline void elf_common_init(struct thread_struct *t,
struct pt_regs *regs, const u16 ds)
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -13,6 +13,7 @@
@ -156,7 +146,7 @@ Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
#include <asm/thread_info.h> /* for TS_COMPAT */
#include <asm/unistd.h>
@@ -28,6 +29,18 @@ extern long ia32_sys_call(const struct p
@@ -28,6 +29,18 @@
extern long x32_sys_call(const struct pt_regs *, unsigned int nr);
extern long x64_sys_call(const struct pt_regs *, unsigned int nr);