[PATCH v2 2/2] riscv: signal: fix signal_minsigstksz

Yong-Xuan Wang posted 2 patches 12 months ago
[PATCH v2 2/2] riscv: signal: fix signal_minsigstksz
Posted by Yong-Xuan Wang 12 months ago
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
Re: [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz
Posted by Alexandre Ghiti 11 months, 2 weeks ago
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
Re: [PATCH v2 2/2] riscv: signal: fix signal_minsigstksz
Posted by Andy Chiu 12 months ago
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