mirror of
https://git.proxmox.com/git/mirror_ubuntu-kernels.git
synced 2025-12-10 14:50:14 +00:00
arm64: ptrace: nofpsimd: Fail FP/SIMD regset operations
When fp/simd is not supported on the system, fail the operations
of FP/SIMD regsets.
Fixes: 82e0191a1a ("arm64: Support systems without FP/ASIMD")
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
7559950aef
commit
c9d66999f0
@ -615,6 +615,13 @@ static int gpr_set(struct task_struct *target, const struct user_regset *regset,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int fpr_active(struct task_struct *target, const struct user_regset *regset)
|
||||||
|
{
|
||||||
|
if (!system_supports_fpsimd())
|
||||||
|
return -ENODEV;
|
||||||
|
return regset->n;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO: update fp accessors for lazy context switching (sync/flush hwstate)
|
* TODO: update fp accessors for lazy context switching (sync/flush hwstate)
|
||||||
*/
|
*/
|
||||||
@ -637,6 +644,9 @@ static int fpr_get(struct task_struct *target, const struct user_regset *regset,
|
|||||||
unsigned int pos, unsigned int count,
|
unsigned int pos, unsigned int count,
|
||||||
void *kbuf, void __user *ubuf)
|
void *kbuf, void __user *ubuf)
|
||||||
{
|
{
|
||||||
|
if (!system_supports_fpsimd())
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (target == current)
|
if (target == current)
|
||||||
fpsimd_preserve_current_state();
|
fpsimd_preserve_current_state();
|
||||||
|
|
||||||
@ -676,6 +686,9 @@ static int fpr_set(struct task_struct *target, const struct user_regset *regset,
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!system_supports_fpsimd())
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
ret = __fpr_set(target, regset, pos, count, kbuf, ubuf, 0);
|
ret = __fpr_set(target, regset, pos, count, kbuf, ubuf, 0);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@ -1134,6 +1147,7 @@ static const struct user_regset aarch64_regsets[] = {
|
|||||||
*/
|
*/
|
||||||
.size = sizeof(u32),
|
.size = sizeof(u32),
|
||||||
.align = sizeof(u32),
|
.align = sizeof(u32),
|
||||||
|
.active = fpr_active,
|
||||||
.get = fpr_get,
|
.get = fpr_get,
|
||||||
.set = fpr_set
|
.set = fpr_set
|
||||||
},
|
},
|
||||||
@ -1348,6 +1362,9 @@ static int compat_vfp_get(struct task_struct *target,
|
|||||||
compat_ulong_t fpscr;
|
compat_ulong_t fpscr;
|
||||||
int ret, vregs_end_pos;
|
int ret, vregs_end_pos;
|
||||||
|
|
||||||
|
if (!system_supports_fpsimd())
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
uregs = &target->thread.uw.fpsimd_state;
|
uregs = &target->thread.uw.fpsimd_state;
|
||||||
|
|
||||||
if (target == current)
|
if (target == current)
|
||||||
@ -1381,6 +1398,9 @@ static int compat_vfp_set(struct task_struct *target,
|
|||||||
compat_ulong_t fpscr;
|
compat_ulong_t fpscr;
|
||||||
int ret, vregs_end_pos;
|
int ret, vregs_end_pos;
|
||||||
|
|
||||||
|
if (!system_supports_fpsimd())
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
uregs = &target->thread.uw.fpsimd_state;
|
uregs = &target->thread.uw.fpsimd_state;
|
||||||
|
|
||||||
vregs_end_pos = VFP_STATE_SIZE - sizeof(compat_ulong_t);
|
vregs_end_pos = VFP_STATE_SIZE - sizeof(compat_ulong_t);
|
||||||
@ -1438,6 +1458,7 @@ static const struct user_regset aarch32_regsets[] = {
|
|||||||
.n = VFP_STATE_SIZE / sizeof(compat_ulong_t),
|
.n = VFP_STATE_SIZE / sizeof(compat_ulong_t),
|
||||||
.size = sizeof(compat_ulong_t),
|
.size = sizeof(compat_ulong_t),
|
||||||
.align = sizeof(compat_ulong_t),
|
.align = sizeof(compat_ulong_t),
|
||||||
|
.active = fpr_active,
|
||||||
.get = compat_vfp_get,
|
.get = compat_vfp_get,
|
||||||
.set = compat_vfp_set
|
.set = compat_vfp_set
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user