diff --git a/debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch b/debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch index adf87d0..70f306a 100644 --- a/debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch +++ b/debian/patches/features/x86/x86-make-x32-syscall-support-conditional.patch @@ -29,7 +29,7 @@ Signed-off-by: Ben Hutchings --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt -@@ -6160,6 +6160,10 @@ +@@ -6410,6 +6410,10 @@ later by a loaded module cannot be set this way. Example: sysctl.vm.swappiness=40 @@ -37,12 +37,12 @@ Signed-off-by: Ben Hutchings + an x86_64 kernel where CONFIG_X86_X32 is enabled. + Default depends on CONFIG_X86_X32_DISABLED. + - sysfs.deprecated=0|1 [KNL] - Enable/disable old style sysfs layout for old udev - on older distributions. When this option is enabled + sysrq_always_enabled + [KNL] + Ignore sysrq setting - this boot parameter will --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig -@@ -2997,6 +2997,14 @@ config COMPAT_32 +@@ -3024,6 +3024,14 @@ config COMPAT_32 select HAVE_UID16 select OLD_SIGSUSPEND3 @@ -66,7 +66,7 @@ Signed-off-by: Ben Hutchings - if (IS_ENABLED(CONFIG_X86_X32_ABI) && likely(xnr < X32_NR_syscalls)) { + if (IS_ENABLED(CONFIG_X86_X32_ABI) && unlikely(x32_enabled) && likely(xnr < X32_NR_syscalls)) { xnr = array_index_nospec(xnr, X32_NR_syscalls); - regs->ax = x32_sys_call(regs, xnr); + regs->ax = x32_sys_call_table[xnr](regs); return true; --- a/arch/x86/entry/syscall_x32.c +++ b/arch/x86/entry/syscall_x32.c @@ -80,9 +80,9 @@ Signed-off-by: Ben Hutchings #include #include -@@ -20,3 +23,46 @@ long x32_sys_call(const struct pt_regs * - default: return __x64_sys_ni_syscall(regs); - } +@@ -16,3 +19,46 @@ + asmlinkage const sys_call_ptr_t x32_sys_call_table[] = { + #include }; + +/* Maybe enable x32 syscalls */ @@ -129,7 +129,7 @@ Signed-off-by: Ben Hutchings +arch_param_cb(x32, &x32_param_ops, NULL, 0444); --- a/arch/x86/include/asm/elf.h +++ b/arch/x86/include/asm/elf.h -@@ -11,6 +11,9 @@ +@@ -12,6 +12,9 @@ #include #include #include @@ -142,13 +142,13 @@ Signed-off-by: Ben Hutchings @@ -150,7 +153,8 @@ do { \ #define compat_elf_check_arch(x) \ - (elf_check_arch_ia32(x) || \ + ((elf_check_arch_ia32(x) && ia32_enabled()) || \ - (IS_ENABLED(CONFIG_X86_X32_ABI) && (x)->e_machine == EM_X86_64)) + (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 @@ @@ -159,9 +159,9 @@ Signed-off-by: Ben Hutchings #include /* for TS_COMPAT */ #include -@@ -28,6 +29,18 @@ extern long ia32_sys_call(const struct p - extern long x32_sys_call(const struct pt_regs *, unsigned int nr); - extern long x64_sys_call(const struct pt_regs *, unsigned int nr); +@@ -30,6 +31,18 @@ extern const sys_call_ptr_t ia32_sys_cal + extern const sys_call_ptr_t x32_sys_call_table[]; + #endif +#if defined(CONFIG_X86_X32_ABI) +#if defined(CONFIG_X86_X32_DISABLED)