Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/arch_prctl: Simplify sys_arch_prctl()

Use in_ia32_syscall() instead of a compat syscall entry.

No change in functionality intended.

Signed-off-by: Brian Gerst <brgerst@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lore.kernel.org/r/20250202202323.422113-2-brgerst@gmail.com

authored by

Brian Gerst and committed by
Ingo Molnar
2df1ad0d 06dd759b

+6 -27
+1 -1
arch/x86/entry/syscalls/syscall_32.tbl
··· 396 396 381 i386 pkey_alloc sys_pkey_alloc 397 397 382 i386 pkey_free sys_pkey_free 398 398 383 i386 statx sys_statx 399 - 384 i386 arch_prctl sys_arch_prctl compat_sys_arch_prctl 399 + 384 i386 arch_prctl sys_arch_prctl 400 400 385 i386 io_pgetevents sys_io_pgetevents_time32 compat_sys_io_pgetevents 401 401 386 i386 rseq sys_rseq 402 402 393 i386 semget sys_semget
+1 -2
arch/x86/include/asm/proto.h
··· 15 15 void entry_SYSCALL_64_safe_stack(void); 16 16 void entry_SYSRETQ_unsafe_stack(void); 17 17 void entry_SYSRETQ_end(void); 18 - long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2); 19 18 #endif 20 19 21 20 #ifdef CONFIG_X86_32 ··· 40 41 41 42 extern int reboot_force; 42 43 43 - long do_arch_prctl_common(int option, unsigned long arg2); 44 + long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2); 44 45 45 46 #endif /* _ASM_X86_PROTO_H */
+4 -1
arch/x86/kernel/process.c
··· 1043 1043 return addr; 1044 1044 } 1045 1045 1046 - long do_arch_prctl_common(int option, unsigned long arg2) 1046 + SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2) 1047 1047 { 1048 1048 switch (option) { 1049 1049 case ARCH_GET_CPUID: ··· 1057 1057 case ARCH_REQ_XCOMP_GUEST_PERM: 1058 1058 return fpu_xstate_prctl(option, arg2); 1059 1059 } 1060 + 1061 + if (!in_ia32_syscall()) 1062 + return do_arch_prctl_64(current, option, arg2); 1060 1063 1061 1064 return -EINVAL; 1062 1065 }
-5
arch/x86/kernel/process_32.c
··· 215 215 216 216 return prev_p; 217 217 } 218 - 219 - SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2) 220 - { 221 - return do_arch_prctl_common(option, arg2); 222 - }
-18
arch/x86/kernel/process_64.c
··· 980 980 return ret; 981 981 } 982 982 983 - SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2) 984 - { 985 - long ret; 986 - 987 - ret = do_arch_prctl_64(current, option, arg2); 988 - if (ret == -EINVAL) 989 - ret = do_arch_prctl_common(option, arg2); 990 - 991 - return ret; 992 - } 993 - 994 - #ifdef CONFIG_IA32_EMULATION 995 - COMPAT_SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2) 996 - { 997 - return do_arch_prctl_common(option, arg2); 998 - } 999 - #endif 1000 - 1001 983 unsigned long KSTK_ESP(struct task_struct *task) 1002 984 { 1003 985 return task_pt_regs(task)->sp;