Skip to content

Commit 7ce550a

Browse files
dengrafgregkh
authored andcommitted
arm64: signal: nofpsimd: Do not allocate fp/simd context when not available
commit 0a32c88 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 210e7b4 commit 7ce550a

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
@@ -572,10 +572,12 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user,
572572
{
573573
int err;
574574

575-
err = sigframe_alloc(user, &user->fpsimd_offset,
576-
sizeof(struct fpsimd_context));
577-
if (err)
578-
return err;
575+
if (system_supports_fpsimd()) {
576+
err = sigframe_alloc(user, &user->fpsimd_offset,
577+
sizeof(struct fpsimd_context));
578+
if (err)
579+
return err;
580+
}
579581

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

0 commit comments

Comments
 (0)