* [PATCH v2 0/2] riscv: signal: fix the size of signal frame
@ 2024-12-20 8:39 Yong-Xuan Wang
2024-12-20 8:39 ` [PATCH v2 1/2] riscv: signal: fix signal frame size Yong-Xuan Wang
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Yong-Xuan Wang @ 2024-12-20 8:39 UTC (permalink / raw)
To: linux-kernel, linux-riscv
Cc: greentime.hu, vincent.chen, AndybnAC, andybnac, zong.li,
Yong-Xuan Wang, Paul Walmsley, Palmer Dabbelt, Albert Ou
This series addresses two issues about the RISC-V signal frame size
calculation. PATCH1 removes the unnecessary header preservation for the
END header. PATCH2 reorders the apply_boot_alternatives() and
init_rt_signal_env() to get the correct signal_minsigstksz.
Yong-Xuan Wang (2):
riscv: signal: fix signal frame size
riscv: signal: fix signal_minsigstksz
---
v2:
- Remove the refactor of init_rt_signal_env(). Instead, we can just
put it after apply_boot_alternatives(). (Andy)
---
arch/riscv/kernel/setup.c | 2 +-
arch/riscv/kernel/signal.c | 6 ------
2 files changed, 1 insertion(+), 7 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] riscv: signal: fix signal frame size
2024-12-20 8:39 [PATCH v2 0/2] riscv: signal: fix the size of signal frame Yong-Xuan Wang
@ 2024-12-20 8:39 ` Yong-Xuan Wang
2025-01-06 14:00 ` Alexandre Ghiti
2024-12-20 8:39 ` [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz Yong-Xuan Wang
2025-02-13 18:30 ` [PATCH v2 0/2] riscv: signal: fix the size of signal frame patchwork-bot+linux-riscv
2 siblings, 1 reply; 7+ messages in thread
From: Yong-Xuan Wang @ 2024-12-20 8:39 UTC (permalink / raw)
To: linux-kernel, linux-riscv
Cc: greentime.hu, vincent.chen, AndybnAC, andybnac, zong.li,
Yong-Xuan Wang, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Conor Dooley, Zhongqiu Han, Bjorn Andersson,
Björn Töpel, Ben Dooks, Heiko Stuebner
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: 8ee0b41898fa ("riscv: signal: Add sigcontext save/restore for vector")
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Reviewed-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Andy Chiu <AndybnAC@gmail.com>
---
arch/riscv/kernel/signal.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
index dcd282419456..c3c517b9eee5 100644
--- a/arch/riscv/kernel/signal.c
+++ b/arch/riscv/kernel/signal.c
@@ -215,12 +215,6 @@ static size_t get_rt_frame_size(bool cal_all)
if (cal_all || riscv_v_vstate_query(task_pt_regs(current)))
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;
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz
2024-12-20 8:39 [PATCH v2 0/2] riscv: signal: fix the size of signal frame Yong-Xuan Wang
2024-12-20 8:39 ` [PATCH v2 1/2] riscv: signal: fix signal frame size Yong-Xuan Wang
@ 2024-12-20 8:39 ` Yong-Xuan Wang
2024-12-20 14:48 ` Andy Chiu
2025-01-06 14:07 ` Alexandre Ghiti
2025-02-13 18:30 ` [PATCH v2 0/2] riscv: signal: fix the size of signal frame patchwork-bot+linux-riscv
2 siblings, 2 replies; 7+ messages in thread
From: Yong-Xuan Wang @ 2024-12-20 8:39 UTC (permalink / raw)
To: linux-kernel, linux-riscv
Cc: greentime.hu, vincent.chen, AndybnAC, andybnac, zong.li,
Yong-Xuan Wang, Paul Walmsley, Palmer Dabbelt, Albert Ou,
Haibo Xu, Conor Dooley, Usama Arif, Hanjun Guo, Samuel Holland,
Alexandre Ghiti, Heiko Stuebner, Björn Töpel
The init_rt_signal_env() funciton is called before the alternative patch
is applied, so using the alternative-related API to check the availability
of an extension within this function doesn't have the intended effect.
This patch reorders the init_rt_signal_env() and apply_boot_alternatives()
to get the correct signal_minsigstksz.
Fixes: e92f469b0771 ("riscv: signal: Report signal frame size to userspace via auxv")
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Reviewed-by: Zong Li <zong.li@sifive.com>
---
arch/riscv/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index 016b48fcd6f2..b7c91f546453 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -324,8 +324,8 @@ void __init setup_arch(char **cmdline_p)
riscv_init_cbo_blocksizes();
riscv_fill_hwcap();
- init_rt_signal_env();
apply_boot_alternatives();
+ init_rt_signal_env();
if (IS_ENABLED(CONFIG_RISCV_ISA_ZICBOM) &&
riscv_isa_extension_available(NULL, ZICBOM))
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz
2024-12-20 8:39 ` [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz Yong-Xuan Wang
@ 2024-12-20 14:48 ` Andy Chiu
2025-01-06 14:07 ` Alexandre Ghiti
1 sibling, 0 replies; 7+ messages in thread
From: Andy Chiu @ 2024-12-20 14:48 UTC (permalink / raw)
To: Yong-Xuan Wang
Cc: linux-kernel, linux-riscv, greentime.hu, vincent.chen, zong.li,
Paul Walmsley, Palmer Dabbelt, Albert Ou, Haibo Xu, Conor Dooley,
Usama Arif, Hanjun Guo, Samuel Holland, Alexandre Ghiti,
Heiko Stuebner, Björn Töpel
Hi Yong-Xuan,
Yong-Xuan Wang <yongxuan.wang@sifive.com> 於 2024年12月20日 週五 下午4:39寫道:
>
> The init_rt_signal_env() funciton is called before the alternative patch
> is applied, so using the alternative-related API to check the availability
> of an extension within this function doesn't have the intended effect.
> This patch reorders the init_rt_signal_env() and apply_boot_alternatives()
> to get the correct signal_minsigstksz.
>
> Fixes: e92f469b0771 ("riscv: signal: Report signal frame size to userspace via auxv")
> Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
> Reviewed-by: Zong Li <zong.li@sifive.com>
Reviewed-by: Andy Chiu <andybnac@gmail.com>
> ---
> arch/riscv/kernel/setup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index 016b48fcd6f2..b7c91f546453 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -324,8 +324,8 @@ void __init setup_arch(char **cmdline_p)
>
> riscv_init_cbo_blocksizes();
> riscv_fill_hwcap();
> - init_rt_signal_env();
> apply_boot_alternatives();
> + init_rt_signal_env();
>
> if (IS_ENABLED(CONFIG_RISCV_ISA_ZICBOM) &&
> riscv_isa_extension_available(NULL, ZICBOM))
> --
> 2.17.1
>
Thanks,
Andy
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] riscv: signal: fix signal frame size
2024-12-20 8:39 ` [PATCH v2 1/2] riscv: signal: fix signal frame size Yong-Xuan Wang
@ 2025-01-06 14:00 ` Alexandre Ghiti
0 siblings, 0 replies; 7+ messages in thread
From: Alexandre Ghiti @ 2025-01-06 14:00 UTC (permalink / raw)
To: Yong-Xuan Wang, linux-kernel, linux-riscv
Cc: greentime.hu, vincent.chen, AndybnAC, zong.li, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Conor Dooley, Zhongqiu Han,
Bjorn Andersson, Björn Töpel, Ben Dooks, Heiko Stuebner
Hi Yong-Xuan,
On 20/12/2024 09:39, Yong-Xuan Wang wrote:
> 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: 8ee0b41898fa ("riscv: signal: Add sigcontext save/restore for vector")
> Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
> Reviewed-by: Zong Li <zong.li@sifive.com>
> Reviewed-by: Andy Chiu <AndybnAC@gmail.com>
> ---
> arch/riscv/kernel/signal.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
> index dcd282419456..c3c517b9eee5 100644
> --- a/arch/riscv/kernel/signal.c
> +++ b/arch/riscv/kernel/signal.c
> @@ -215,12 +215,6 @@ static size_t get_rt_frame_size(bool cal_all)
> if (cal_all || riscv_v_vstate_query(task_pt_regs(current)))
> 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;
>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Thanks,
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz
2024-12-20 8:39 ` [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz Yong-Xuan Wang
2024-12-20 14:48 ` Andy Chiu
@ 2025-01-06 14:07 ` Alexandre Ghiti
1 sibling, 0 replies; 7+ messages in thread
From: Alexandre Ghiti @ 2025-01-06 14:07 UTC (permalink / raw)
To: Yong-Xuan Wang, linux-kernel, linux-riscv
Cc: greentime.hu, vincent.chen, AndybnAC, zong.li, Paul Walmsley,
Palmer Dabbelt, Albert Ou, Haibo Xu, Conor Dooley, Usama Arif,
Hanjun Guo, Samuel Holland, Alexandre Ghiti, Heiko Stuebner,
Björn Töpel
Hi Yong-Xuan,
On 20/12/2024 09:39, Yong-Xuan Wang wrote:
> The init_rt_signal_env() funciton is called before the alternative patch
> is applied, so using the alternative-related API to check the availability
> of an extension within this function doesn't have the intended effect.
> This patch reorders the init_rt_signal_env() and apply_boot_alternatives()
> to get the correct signal_minsigstksz.
>
> Fixes: e92f469b0771 ("riscv: signal: Report signal frame size to userspace via auxv")
> Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
> Reviewed-by: Zong Li <zong.li@sifive.com>
> ---
> arch/riscv/kernel/setup.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
> index 016b48fcd6f2..b7c91f546453 100644
> --- a/arch/riscv/kernel/setup.c
> +++ b/arch/riscv/kernel/setup.c
> @@ -324,8 +324,8 @@ void __init setup_arch(char **cmdline_p)
>
> riscv_init_cbo_blocksizes();
> riscv_fill_hwcap();
> - init_rt_signal_env();
> apply_boot_alternatives();
> + init_rt_signal_env();
>
> if (IS_ENABLED(CONFIG_RISCV_ISA_ZICBOM) &&
> riscv_isa_extension_available(NULL, ZICBOM))
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Thanks for your fixes!
Alex
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 0/2] riscv: signal: fix the size of signal frame
2024-12-20 8:39 [PATCH v2 0/2] riscv: signal: fix the size of signal frame Yong-Xuan Wang
2024-12-20 8:39 ` [PATCH v2 1/2] riscv: signal: fix signal frame size Yong-Xuan Wang
2024-12-20 8:39 ` [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz Yong-Xuan Wang
@ 2025-02-13 18:30 ` patchwork-bot+linux-riscv
2 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+linux-riscv @ 2025-02-13 18:30 UTC (permalink / raw)
To: Yong-Xuan Wang
Cc: linux-riscv, linux-kernel, greentime.hu, vincent.chen, AndybnAC,
andybnac, zong.li, paul.walmsley, palmer, aou
Hello:
This series was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <palmer@rivosinc.com>:
On Fri, 20 Dec 2024 16:39:22 +0800 you wrote:
> This series addresses two issues about the RISC-V signal frame size
> calculation. PATCH1 removes the unnecessary header preservation for the
> END header. PATCH2 reorders the apply_boot_alternatives() and
> init_rt_signal_env() to get the correct signal_minsigstksz.
>
> Yong-Xuan Wang (2):
> riscv: signal: fix signal frame size
> riscv: signal: fix signal_minsigstksz
>
> [...]
Here is the summary with links:
- [v2,1/2] riscv: signal: fix signal frame size
https://git.kernel.org/riscv/c/0eeb13956757
- [v2,2/2] riscv: signal: fix signal_minsigstksz
https://git.kernel.org/riscv/c/5338770fc74b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-02-13 18:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-20 8:39 [PATCH v2 0/2] riscv: signal: fix the size of signal frame Yong-Xuan Wang
2024-12-20 8:39 ` [PATCH v2 1/2] riscv: signal: fix signal frame size Yong-Xuan Wang
2025-01-06 14:00 ` Alexandre Ghiti
2024-12-20 8:39 ` [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz Yong-Xuan Wang
2024-12-20 14:48 ` Andy Chiu
2025-01-06 14:07 ` Alexandre Ghiti
2025-02-13 18:30 ` [PATCH v2 0/2] riscv: signal: fix the size of signal frame patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox