Skip to content

Commit 2df1ad0

Browse files
Brian GerstIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 06dd759 commit 2df1ad0

File tree

5 files changed

+6
-27
lines changed

5 files changed

+6
-27
lines changed

arch/x86/entry/syscalls/syscall_32.tbl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@
396396
381 i386 pkey_alloc sys_pkey_alloc
397397
382 i386 pkey_free sys_pkey_free
398398
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
400400
385 i386 io_pgetevents sys_io_pgetevents_time32 compat_sys_io_pgetevents
401401
386 i386 rseq sys_rseq
402402
393 i386 semget sys_semget

arch/x86/include/asm/proto.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ void entry_SYSCALL_64(void);
1515
void entry_SYSCALL_64_safe_stack(void);
1616
void entry_SYSRETQ_unsafe_stack(void);
1717
void entry_SYSRETQ_end(void);
18-
long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2);
1918
#endif
2019

2120
#ifdef CONFIG_X86_32
@@ -41,6 +40,6 @@ void x86_configure_nx(void);
4140

4241
extern int reboot_force;
4342

44-
long do_arch_prctl_common(int option, unsigned long arg2);
43+
long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2);
4544

4645
#endif /* _ASM_X86_PROTO_H */

arch/x86/kernel/process.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1043,7 +1043,7 @@ unsigned long __get_wchan(struct task_struct *p)
10431043
return addr;
10441044
}
10451045

1046-
long do_arch_prctl_common(int option, unsigned long arg2)
1046+
SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
10471047
{
10481048
switch (option) {
10491049
case ARCH_GET_CPUID:
@@ -1058,5 +1058,8 @@ long do_arch_prctl_common(int option, unsigned long arg2)
10581058
return fpu_xstate_prctl(option, arg2);
10591059
}
10601060

1061+
if (!in_ia32_syscall())
1062+
return do_arch_prctl_64(current, option, arg2);
1063+
10611064
return -EINVAL;
10621065
}

arch/x86/kernel/process_32.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,3 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
215215

216216
return prev_p;
217217
}
218-
219-
SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
220-
{
221-
return do_arch_prctl_common(option, arg2);
222-
}

arch/x86/kernel/process_64.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -980,24 +980,6 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
980980
return ret;
981981
}
982982

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-
1001983
unsigned long KSTK_ESP(struct task_struct *task)
1002984
{
1003985
return task_pt_regs(task)->sp;

0 commit comments

Comments
 (0)