[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220225104008.820289-1-david.engraf@sysgo.com>
Date: Fri, 25 Feb 2022 11:40:08 +0100
From: David Engraf <david.engraf@...go.com>
To: suzuki.poulose@....com, catalin.marinas@....com, will@...nel.org,
broonie@...nel.org, mark.rutland@....com, elver@...gle.com,
ebiederm@...ssion.com, seanjc@...gle.com
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
David Engraf <david.engraf@...go.com>
Subject: [PATCH] arm64: signal: nofpsimd: Do not allocate fp/simd context when not available
Commit 6d502b6ba1b2 ("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 <david.engraf@...go.com>
---
arch/arm64/kernel/signal.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index d8aaf4b6f432..3d66fba69016 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -577,10 +577,12 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user,
{
int err;
- err = sigframe_alloc(user, &user->fpsimd_offset,
- sizeof(struct fpsimd_context));
- if (err)
- return err;
+ if (system_supports_fpsimd()) {
+ err = sigframe_alloc(user, &user->fpsimd_offset,
+ sizeof(struct fpsimd_context));
+ if (err)
+ return err;
+ }
/* fault information, if valid */
if (add_all || current->thread.fault_code) {
--
2.25.1
Powered by blists - more mailing lists