提交 dd8e1c69 编写于 作者: D David Engraf 提交者: Zheng Zengkai

arm64: signal: nofpsimd: Do not allocate fp/simd context when not available

stable inclusion
from stable-v5.10.110
commit 7ce550a01b838a5e3d8efceb7aa79ec4c8a3fd29
bugzilla: https://gitee.com/openeuler/kernel/issues/I574AL

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7ce550a01b838a5e3d8efceb7aa79ec4c8a3fd29

--------------------------------

commit 0a32c88d upstream.

Commit 6d502b6b ("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: NDavid Engraf <david.engraf@sysgo.com>
Reviwed-by: NMark Brown <broonie@kernel.org>
Fixes: 6d502b6b ("arm64: signal: nofpsimd: Handle fp/simd context for signal frames")
Cc: <stable@vger.kernel.org> # 5.6.x
Reviewed-by: NCatalin Marinas <catalin.marinas@arm.com>
Link: https://lore.kernel.org/r/20220225104008.820289-1-david.engraf@sysgo.comSigned-off-by: NWill Deacon <will@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b97837d9
...@@ -447,10 +447,12 @@ int setup_sigframe_layout(struct rt_sigframe_user_layout *user, bool add_all) ...@@ -447,10 +447,12 @@ int setup_sigframe_layout(struct rt_sigframe_user_layout *user, bool add_all)
{ {
int err; int err;
err = sigframe_alloc(user, &user->fpsimd_offset, if (system_supports_fpsimd()) {
sizeof(struct fpsimd_context)); err = sigframe_alloc(user, &user->fpsimd_offset,
if (err) sizeof(struct fpsimd_context));
return err; if (err)
return err;
}
/* fault information, if valid */ /* fault information, if valid */
if (add_all || current->thread.fault_code) { if (add_all || current->thread.fault_code) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册