mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
arm64: signal: nofpsimd: Handle fp/simd context for signal frames
Make sure we try to save/restore the vfp/fpsimd context for signal handling only when the fp/simd support is available. Otherwise, skip the frames. 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
c9d66999f0
commit
6d502b6ba1
@ -371,6 +371,8 @@ static int parse_user_sigframe(struct user_ctxs *user,
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
case FPSIMD_MAGIC:
|
case FPSIMD_MAGIC:
|
||||||
|
if (!system_supports_fpsimd())
|
||||||
|
goto invalid;
|
||||||
if (user->fpsimd)
|
if (user->fpsimd)
|
||||||
goto invalid;
|
goto invalid;
|
||||||
|
|
||||||
@ -506,7 +508,7 @@ static int restore_sigframe(struct pt_regs *regs,
|
|||||||
if (err == 0)
|
if (err == 0)
|
||||||
err = parse_user_sigframe(&user, sf);
|
err = parse_user_sigframe(&user, sf);
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0 && system_supports_fpsimd()) {
|
||||||
if (!user.fpsimd)
|
if (!user.fpsimd)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
@ -623,7 +625,7 @@ static int setup_sigframe(struct rt_sigframe_user_layout *user,
|
|||||||
|
|
||||||
err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set));
|
err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(*set));
|
||||||
|
|
||||||
if (err == 0) {
|
if (err == 0 && system_supports_fpsimd()) {
|
||||||
struct fpsimd_context __user *fpsimd_ctx =
|
struct fpsimd_context __user *fpsimd_ctx =
|
||||||
apply_user_offset(user, user->fpsimd_offset);
|
apply_user_offset(user, user->fpsimd_offset);
|
||||||
err |= preserve_fpsimd_context(fpsimd_ctx);
|
err |= preserve_fpsimd_context(fpsimd_ctx);
|
||||||
|
@ -223,7 +223,7 @@ static int compat_restore_sigframe(struct pt_regs *regs,
|
|||||||
err |= !valid_user_regs(®s->user_regs, current);
|
err |= !valid_user_regs(®s->user_regs, current);
|
||||||
|
|
||||||
aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace;
|
aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace;
|
||||||
if (err == 0)
|
if (err == 0 && system_supports_fpsimd())
|
||||||
err |= compat_restore_vfp_context(&aux->vfp);
|
err |= compat_restore_vfp_context(&aux->vfp);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -419,7 +419,7 @@ static int compat_setup_sigframe(struct compat_sigframe __user *sf,
|
|||||||
|
|
||||||
aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace;
|
aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace;
|
||||||
|
|
||||||
if (err == 0)
|
if (err == 0 && system_supports_fpsimd())
|
||||||
err |= compat_preserve_vfp_context(&aux->vfp);
|
err |= compat_preserve_vfp_context(&aux->vfp);
|
||||||
__put_user_error(0, &aux->end_magic, err);
|
__put_user_error(0, &aux->end_magic, err);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user