mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +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
2 changed files with 6 additions and 4 deletions
|
@ -371,6 +371,8 @@ static int parse_user_sigframe(struct user_ctxs *user,
|
|||
goto done;
|
||||
|
||||
case FPSIMD_MAGIC:
|
||||
if (!system_supports_fpsimd())
|
||||
goto invalid;
|
||||
if (user->fpsimd)
|
||||
goto invalid;
|
||||
|
||||
|
@ -506,7 +508,7 @@ static int restore_sigframe(struct pt_regs *regs,
|
|||
if (err == 0)
|
||||
err = parse_user_sigframe(&user, sf);
|
||||
|
||||
if (err == 0) {
|
||||
if (err == 0 && system_supports_fpsimd()) {
|
||||
if (!user.fpsimd)
|
||||
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));
|
||||
|
||||
if (err == 0) {
|
||||
if (err == 0 && system_supports_fpsimd()) {
|
||||
struct fpsimd_context __user *fpsimd_ctx =
|
||||
apply_user_offset(user, user->fpsimd_offset);
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
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;
|
||||
|
||||
if (err == 0)
|
||||
if (err == 0 && system_supports_fpsimd())
|
||||
err |= compat_preserve_vfp_context(&aux->vfp);
|
||||
__put_user_error(0, &aux->end_magic, err);
|
||||
|
||||
|
|
Loading…
Reference in a new issue