Skip to content

Commit 0a32c88

Browse files
dengrafwilldeacon
authored andcommitted
arm64: signal: nofpsimd: Do not allocate fp/simd context when not available
Commit 6d502b6 ("arm64: signal: nofpsimd: Handle fp/simd context for signal frames") introduced saving the fp/simd context for signal handling only when support is available. But setup_sigframe_layout() always reserves memory for fp/simd context. The additional memory is not touched because preserve_fpsimd_context() is not called and thus the magic is invalid. This may lead to an error when parse_user_sigframe() checks the fp/simd area and does not find a valid magic number. Signed-off-by: David Engraf <[email protected]> Reviwed-by: Mark Brown <[email protected]> Fixes: 6d502b6 ("arm64: signal: nofpsimd: Handle fp/simd context for signal frames") Cc: <[email protected]> # 5.6.x Reviewed-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 0a2eec8 commit 0a32c88

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

arch/arm64/kernel/signal.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,10 +577,12 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user,
577577
{
578578
int err;
579579

580-
err = sigframe_alloc(user, &user->fpsimd_offset,
581-
sizeof(struct fpsimd_context));
582-
if (err)
583-
return err;
580+
if (system_supports_fpsimd()) {
581+
err = sigframe_alloc(user, &user->fpsimd_offset,
582+
sizeof(struct fpsimd_context));
583+
if (err)
584+
return err;
585+
}
584586

585587
/* fault information, if valid */
586588
if (add_all || current->thread.fault_code) {

0 commit comments

Comments
 (0)