From: David Engraf <david.engraf@sysgo.com> To: suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, mark.rutland@arm.com, elver@google.com, ebiederm@xmission.com, seanjc@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, David Engraf <david.engraf@sysgo.com> Subject: [PATCH] arm64: signal: nofpsimd: Do not allocate fp/simd context when not available Date: Fri, 25 Feb 2022 11:40:08 +0100 [thread overview] Message-ID: <20220225104008.820289-1-david.engraf@sysgo.com> (raw) 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@sysgo.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
WARNING: multiple messages have this Message-ID (diff)
From: David Engraf <david.engraf@sysgo.com> To: suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, mark.rutland@arm.com, elver@google.com, ebiederm@xmission.com, seanjc@google.com Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, David Engraf <david.engraf@sysgo.com> Subject: [PATCH] arm64: signal: nofpsimd: Do not allocate fp/simd context when not available Date: Fri, 25 Feb 2022 11:40:08 +0100 [thread overview] Message-ID: <20220225104008.820289-1-david.engraf@sysgo.com> (raw) 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@sysgo.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2022-02-25 10:49 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-25 10:40 David Engraf [this message] 2022-02-25 10:40 ` [PATCH] arm64: signal: nofpsimd: Do not allocate fp/simd context when not available David Engraf 2022-02-25 17:57 ` Mark Brown 2022-02-25 17:57 ` Mark Brown 2022-02-28 7:56 ` David Engraf 2022-02-28 7:56 ` David Engraf 2022-02-28 13:20 ` Mark Brown 2022-02-28 13:20 ` Mark Brown 2022-02-28 18:34 ` Catalin Marinas 2022-02-28 18:34 ` Catalin Marinas 2022-03-07 22:03 ` Will Deacon 2022-03-07 22:03 ` Will Deacon
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220225104008.820289-1-david.engraf@sysgo.com \ --to=david.engraf@sysgo.com \ --cc=broonie@kernel.org \ --cc=catalin.marinas@arm.com \ --cc=ebiederm@xmission.com \ --cc=elver@google.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=seanjc@google.com \ --cc=suzuki.poulose@arm.com \ --cc=will@kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.