Skip to content

Commit f5c0b4f

Browse files
KAGA-KOKOsuryasaimadhu
authored andcommitted
x86/prctl: Remove pointless task argument
The functions invoked via do_arch_prctl_common() can only operate on the current task and none of these function uses the task argument. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Link: https://lore.kernel.org/r/87lev7vtxj.ffs@tglx
1 parent 1ff2fb9 commit f5c0b4f

File tree

6 files changed

+10
-16
lines changed

6 files changed

+10
-16
lines changed

arch/x86/include/asm/fpu/api.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ static inline bool fpstate_is_confidential(struct fpu_guest *gfpu)
162162
}
163163

164164
/* prctl */
165-
struct task_struct;
166-
extern long fpu_xstate_prctl(struct task_struct *tsk, int option, unsigned long arg2);
165+
extern long fpu_xstate_prctl(int option, unsigned long arg2);
167166

168167
#endif /* _ASM_X86_FPU_API_H */

arch/x86/include/asm/proto.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ void x86_report_nx(void);
3939

4040
extern int reboot_force;
4141

42-
long do_arch_prctl_common(struct task_struct *task, int option,
43-
unsigned long arg2);
42+
long do_arch_prctl_common(int option, unsigned long arg2);
4443

4544
#endif /* _ASM_X86_PROTO_H */

arch/x86/kernel/fpu/xstate.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,16 +1687,13 @@ EXPORT_SYMBOL_GPL(xstate_get_guest_group_perm);
16871687
* e.g. for AMX which requires XFEATURE_XTILE_CFG(17) and
16881688
* XFEATURE_XTILE_DATA(18) this would be XFEATURE_XTILE_DATA(18).
16891689
*/
1690-
long fpu_xstate_prctl(struct task_struct *tsk, int option, unsigned long arg2)
1690+
long fpu_xstate_prctl(int option, unsigned long arg2)
16911691
{
16921692
u64 __user *uptr = (u64 __user *)arg2;
16931693
u64 permitted, supported;
16941694
unsigned long idx = arg2;
16951695
bool guest = false;
16961696

1697-
if (tsk != current)
1698-
return -EPERM;
1699-
17001697
switch (option) {
17011698
case ARCH_GET_XCOMP_SUPP:
17021699
supported = fpu_user_cfg.max_features | fpu_user_cfg.legacy_features;

arch/x86/kernel/process.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static int get_cpuid_mode(void)
334334
return !test_thread_flag(TIF_NOCPUID);
335335
}
336336

337-
static int set_cpuid_mode(struct task_struct *task, unsigned long cpuid_enabled)
337+
static int set_cpuid_mode(unsigned long cpuid_enabled)
338338
{
339339
if (!boot_cpu_has(X86_FEATURE_CPUID_FAULT))
340340
return -ENODEV;
@@ -985,20 +985,19 @@ unsigned long __get_wchan(struct task_struct *p)
985985
return addr;
986986
}
987987

988-
long do_arch_prctl_common(struct task_struct *task, int option,
989-
unsigned long arg2)
988+
long do_arch_prctl_common(int option, unsigned long arg2)
990989
{
991990
switch (option) {
992991
case ARCH_GET_CPUID:
993992
return get_cpuid_mode();
994993
case ARCH_SET_CPUID:
995-
return set_cpuid_mode(task, arg2);
994+
return set_cpuid_mode(arg2);
996995
case ARCH_GET_XCOMP_SUPP:
997996
case ARCH_GET_XCOMP_PERM:
998997
case ARCH_REQ_XCOMP_PERM:
999998
case ARCH_GET_XCOMP_GUEST_PERM:
1000999
case ARCH_REQ_XCOMP_GUEST_PERM:
1001-
return fpu_xstate_prctl(task, option, arg2);
1000+
return fpu_xstate_prctl(option, arg2);
10021001
}
10031002

10041003
return -EINVAL;

arch/x86/kernel/process_32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,5 +222,5 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
222222

223223
SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
224224
{
225-
return do_arch_prctl_common(current, option, arg2);
225+
return do_arch_prctl_common(option, arg2);
226226
}

arch/x86/kernel/process_64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,15 +844,15 @@ SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
844844

845845
ret = do_arch_prctl_64(current, option, arg2);
846846
if (ret == -EINVAL)
847-
ret = do_arch_prctl_common(current, option, arg2);
847+
ret = do_arch_prctl_common(option, arg2);
848848

849849
return ret;
850850
}
851851

852852
#ifdef CONFIG_IA32_EMULATION
853853
COMPAT_SYSCALL_DEFINE2(arch_prctl, int, option, unsigned long, arg2)
854854
{
855-
return do_arch_prctl_common(current, option, arg2);
855+
return do_arch_prctl_common(option, arg2);
856856
}
857857
#endif
858858

0 commit comments

Comments
 (0)