From 78c735a869fdcce79e67def7513042e359af4a54 Mon Sep 17 00:00:00 2001 From: Sunderland93 Date: Sat, 15 Jun 2024 00:52:39 +0400 Subject: [PATCH] Refresh patches --- ...make-x32-syscall-support-conditional.patch | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) 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 70f306a..200c19e 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 -@@ -6410,6 +6410,10 @@ +@@ -6160,6 +6160,10 @@ later by a loaded module cannot be set this way. Example: sysctl.vm.swappiness=40 @@ -37,12 +37,9 @@ Signed-off-by: Ben Hutchings + an x86_64 kernel where CONFIG_X86_X32 is enabled. + Default depends on CONFIG_X86_X32_DISABLED. + - sysrq_always_enabled - [KNL] - Ignore sysrq setting - this boot parameter will --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig -@@ -3024,6 +3024,14 @@ config COMPAT_32 +@@ -2997,6 +2997,14 @@ config COMPAT_32 select HAVE_UID16 select OLD_SIGSUSPEND3 @@ -66,7 +63,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_table[xnr](regs); + regs->ax = x32_sys_call(regs, xnr); return true; --- a/arch/x86/entry/syscall_x32.c +++ b/arch/x86/entry/syscall_x32.c @@ -80,9 +77,9 @@ Signed-off-by: Ben Hutchings #include #include -@@ -16,3 +19,46 @@ - asmlinkage const sys_call_ptr_t x32_sys_call_table[] = { - #include +@@ -20,3 +23,46 @@ long x32_sys_call(const struct pt_regs * + default: return __x64_sys_ni_syscall(regs); + } }; + +/* Maybe enable x32 syscalls */ @@ -129,7 +126,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 -@@ -12,6 +12,9 @@ +@@ -11,6 +11,9 @@ #include #include #include @@ -142,13 +139,13 @@ Signed-off-by: Ben Hutchings @@ -150,7 +153,8 @@ do { \ #define compat_elf_check_arch(x) \ - ((elf_check_arch_ia32(x) && ia32_enabled()) || \ + (elf_check_arch_ia32(x) || \ - (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)) - static inline void elf_common_init(struct thread_struct *t, - struct pt_regs *regs, const u16 ds) + #if __USER32_DS != __USER_DS + # error "The following code assumes __USER32_DS == __USER_DS" --- a/arch/x86/include/asm/syscall.h +++ b/arch/x86/include/asm/syscall.h @@ -13,6 +13,7 @@ @@ -159,9 +156,9 @@ Signed-off-by: Ben Hutchings #include /* for TS_COMPAT */ #include -@@ -30,6 +31,18 @@ extern const sys_call_ptr_t ia32_sys_cal - extern const sys_call_ptr_t x32_sys_call_table[]; - #endif +@@ -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); +#if defined(CONFIG_X86_X32_ABI) +#if defined(CONFIG_X86_X32_DISABLED)