Commit 91a164bb authored by Yong-Xuan Wang's avatar Yong-Xuan Wang Committed by Wentao Guan
Browse files

riscv: signal: fix signal frame size

stable inclusion
from stable-v6.6.81
commit 687322acb1eb68ef44444ddd3c33a8cdce007bae
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBYZED

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



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

commit aa49bc2ca8524186ceb0811c23a7f00c3dea6987 upstream.

The signal context of certain RISC-V extensions will be appended after
struct __riscv_extra_ext_header, which already includes an empty context
header. Therefore, there is no need to preserve a separate hdr for the
END of signal context.

Fixes: 8ee0b418 ("riscv: signal: Add sigcontext save/restore for vector")
Signed-off-by: default avatarYong-Xuan Wang <yongxuan.wang@sifive.com>
Reviewed-by: default avatarZong Li <zong.li@sifive.com>
Reviewed-by: default avatarAndy Chiu <AndybnAC@gmail.com>
Reviewed-by: default avatarAlexandre Ghiti <alexghiti@rivosinc.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20241220083926.19453-2-yongxuan.wang@sifive.com


Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 687322acb1eb68ef44444ddd3c33a8cdce007bae)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent 597675e3
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -211,12 +211,6 @@ static size_t get_rt_frame_size(bool cal_all)
		if (cal_all || riscv_v_vstate_query(task_pt_regs(current)))
		if (cal_all || riscv_v_vstate_query(task_pt_regs(current)))
			total_context_size += riscv_v_sc_size;
			total_context_size += riscv_v_sc_size;
	}
	}
	/*
	 * Preserved a __riscv_ctx_hdr for END signal context header if an
	 * extension uses __riscv_extra_ext_header
	 */
	if (total_context_size)
		total_context_size += sizeof(struct __riscv_ctx_hdr);


	frame_size += total_context_size;
	frame_size += total_context_size;