mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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
This commit is contained in:
		
							parent
							
								
									06dd759b68
								
							
						
					
					
						commit
						2df1ad0d25
					
				
					 5 changed files with 6 additions and 27 deletions
				
			
		| 
						 | 
					@ -396,7 +396,7 @@
 | 
				
			||||||
381	i386	pkey_alloc		sys_pkey_alloc
 | 
					381	i386	pkey_alloc		sys_pkey_alloc
 | 
				
			||||||
382	i386	pkey_free		sys_pkey_free
 | 
					382	i386	pkey_free		sys_pkey_free
 | 
				
			||||||
383	i386	statx			sys_statx
 | 
					383	i386	statx			sys_statx
 | 
				
			||||||
384	i386	arch_prctl		sys_arch_prctl			compat_sys_arch_prctl
 | 
					384	i386	arch_prctl		sys_arch_prctl
 | 
				
			||||||
385	i386	io_pgetevents		sys_io_pgetevents_time32	compat_sys_io_pgetevents
 | 
					385	i386	io_pgetevents		sys_io_pgetevents_time32	compat_sys_io_pgetevents
 | 
				
			||||||
386	i386	rseq			sys_rseq
 | 
					386	i386	rseq			sys_rseq
 | 
				
			||||||
393	i386	semget			sys_semget
 | 
					393	i386	semget			sys_semget
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,6 @@ void entry_SYSCALL_64(void);
 | 
				
			||||||
void entry_SYSCALL_64_safe_stack(void);
 | 
					void entry_SYSCALL_64_safe_stack(void);
 | 
				
			||||||
void entry_SYSRETQ_unsafe_stack(void);
 | 
					void entry_SYSRETQ_unsafe_stack(void);
 | 
				
			||||||
void entry_SYSRETQ_end(void);
 | 
					void entry_SYSRETQ_end(void);
 | 
				
			||||||
long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2);
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef CONFIG_X86_32
 | 
					#ifdef CONFIG_X86_32
 | 
				
			||||||
| 
						 | 
					@ -41,6 +40,6 @@ void x86_configure_nx(void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern int reboot_force;
 | 
					extern int reboot_force;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
long do_arch_prctl_common(int option, unsigned long arg2);
 | 
					long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* _ASM_X86_PROTO_H */
 | 
					#endif /* _ASM_X86_PROTO_H */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1043,7 +1043,7 @@ unsigned long __get_wchan(struct task_struct *p)
 | 
				
			||||||
	return addr;
 | 
						return addr;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
long do_arch_prctl_common(int option, unsigned long arg2)
 | 
					SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	switch (option) {
 | 
						switch (option) {
 | 
				
			||||||
	case ARCH_GET_CPUID:
 | 
						case ARCH_GET_CPUID:
 | 
				
			||||||
| 
						 | 
					@ -1058,5 +1058,8 @@ long do_arch_prctl_common(int option, unsigned long arg2)
 | 
				
			||||||
		return fpu_xstate_prctl(option, arg2);
 | 
							return fpu_xstate_prctl(option, arg2);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (!in_ia32_syscall())
 | 
				
			||||||
 | 
							return do_arch_prctl_64(current, option, arg2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return -EINVAL;
 | 
						return -EINVAL;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -215,8 +215,3 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return prev_p;
 | 
						return prev_p;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return do_arch_prctl_common(option, arg2);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -980,24 +980,6 @@ long do_arch_prctl_64(struct task_struct *task, int option, unsigned long arg2)
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	long ret;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	ret = do_arch_prctl_64(current, option, arg2);
 | 
					 | 
				
			||||||
	if (ret == -EINVAL)
 | 
					 | 
				
			||||||
		ret = do_arch_prctl_common(option, arg2);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return ret;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#ifdef CONFIG_IA32_EMULATION
 | 
					 | 
				
			||||||
COMPAT_SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return do_arch_prctl_common(option, arg2);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
unsigned long KSTK_ESP(struct task_struct *task)
 | 
					unsigned long KSTK_ESP(struct task_struct *task)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return task_pt_regs(task)->sp;
 | 
						return task_pt_regs(task)->sp;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue