diff mbox series

linux-user/riscv: Disable unsupported SA_RESTORER

Message ID 20250202-riscv-sa-restorer-v1-1-6f4bf814a1dd@t-8ch.de (mailing list archive)
State New
Headers show
Series linux-user/riscv: Disable unsupported SA_RESTORER | expand

Commit Message

Thomas Weißschuh Feb. 2, 2025, 10:57 p.m. UTC
Linux on riscv does not support SA_RESTORER.
Currently QEMU thinks there is a field 'sa_restorer' in the middle of
'struct sigaction' which does not actually exist.
This leads to corrupted data and out-of-bounds accesses.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
---
 linux-user/riscv/target_signal.h | 1 +
 1 file changed, 1 insertion(+)


---
base-commit: 6fccaa2fba391815308a746d68f7fa197bc93586
change-id: 20250202-riscv-sa-restorer-edd3dfa7790f

Best regards,

Comments

Alistair Francis Feb. 24, 2025, 3:41 a.m. UTC | #1
On Mon, Feb 3, 2025 at 8:58 AM Thomas Weißschuh <thomas@t-8ch.de> wrote:
>
> Linux on riscv does not support SA_RESTORER.
> Currently QEMU thinks there is a field 'sa_restorer' in the middle of
> 'struct sigaction' which does not actually exist.
> This leads to corrupted data and out-of-bounds accesses.
>
> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> ---
>  linux-user/riscv/target_signal.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/linux-user/riscv/target_signal.h b/linux-user/riscv/target_signal.h
> index 6c0470f0bc82c6330ce50cb662f2039cf1fab288..258945770b674c0b6b66a94659d9c93fbabffdfb 100644
> --- a/linux-user/riscv/target_signal.h
> +++ b/linux-user/riscv/target_signal.h
> @@ -4,5 +4,6 @@
>  #include "../generic/signal.h"
>
>  #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
> +#undef TARGET_SA_RESTORER
>
>  #endif /* RISCV_TARGET_SIGNAL_H */
>
> ---
> base-commit: 6fccaa2fba391815308a746d68f7fa197bc93586
> change-id: 20250202-riscv-sa-restorer-edd3dfa7790f
>
> Best regards,
> --
> Thomas Weißschuh <thomas@t-8ch.de>
>
>
Alistair Francis Feb. 24, 2025, 4:10 a.m. UTC | #2
On Mon, Feb 3, 2025 at 8:58 AM Thomas Weißschuh <thomas@t-8ch.de> wrote:
>
> Linux on riscv does not support SA_RESTORER.
> Currently QEMU thinks there is a field 'sa_restorer' in the middle of
> 'struct sigaction' which does not actually exist.
> This leads to corrupted data and out-of-bounds accesses.
>
> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>

Thanks!

Applied to riscv-to-apply.next

Alistair

> ---
>  linux-user/riscv/target_signal.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/linux-user/riscv/target_signal.h b/linux-user/riscv/target_signal.h
> index 6c0470f0bc82c6330ce50cb662f2039cf1fab288..258945770b674c0b6b66a94659d9c93fbabffdfb 100644
> --- a/linux-user/riscv/target_signal.h
> +++ b/linux-user/riscv/target_signal.h
> @@ -4,5 +4,6 @@
>  #include "../generic/signal.h"
>
>  #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
> +#undef TARGET_SA_RESTORER
>
>  #endif /* RISCV_TARGET_SIGNAL_H */
>
> ---
> base-commit: 6fccaa2fba391815308a746d68f7fa197bc93586
> change-id: 20250202-riscv-sa-restorer-edd3dfa7790f
>
> Best regards,
> --
> Thomas Weißschuh <thomas@t-8ch.de>
>
>
Thomas Weißschuh Feb. 25, 2025, 6:41 a.m. UTC | #3
Hi Alistair,

On 2025-02-24 14:10:19+1000, Alistair Francis wrote:
> On Mon, Feb 3, 2025 at 8:58 AM Thomas Weißschuh <thomas@t-8ch.de> wrote:
> >
> > Linux on riscv does not support SA_RESTORER.
> > Currently QEMU thinks there is a field 'sa_restorer' in the middle of
> > 'struct sigaction' which does not actually exist.
> > This leads to corrupted data and out-of-bounds accesses.
> >
> > Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
> 
> Thanks!
> 
> Applied to riscv-to-apply.next

Thanks, however this got superseded by Andreas Schwab's better
"linux-user: Move TARGET_SA_RESTORER out of generic/signal.h".

Could you drop it again?

[0] https://lore.kernel.org/qemu-devel/mvmed060xc9.fsf@suse.de/
diff mbox series

Patch

diff --git a/linux-user/riscv/target_signal.h b/linux-user/riscv/target_signal.h
index 6c0470f0bc82c6330ce50cb662f2039cf1fab288..258945770b674c0b6b66a94659d9c93fbabffdfb 100644
--- a/linux-user/riscv/target_signal.h
+++ b/linux-user/riscv/target_signal.h
@@ -4,5 +4,6 @@ 
 #include "../generic/signal.h"
 
 #define TARGET_ARCH_HAS_SIGTRAMP_PAGE 1
+#undef TARGET_SA_RESTORER
 
 #endif /* RISCV_TARGET_SIGNAL_H */