[PATCH 4/8] linux-user: Convert signal number for FUTEX_FD

Richard Henderson posted 8 patches 3 years, 5 months ago
Maintainers: Laurent Vivier <laurent@vivier.eu>
[PATCH 4/8] linux-user: Convert signal number for FUTEX_FD
Posted by Richard Henderson 3 years, 5 months ago
The val argument to FUTEX_FD is a signal number.  Convert to match
the host, as it will be converted back when the signal is delivered.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8bf4b79a9e..f50cc70f1a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -7778,6 +7778,7 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr,
         timeout = 0;
         break;
     case FUTEX_FD:
+        val = target_to_host_signal(val);
         timeout = 0;
         break;
     case FUTEX_CMP_REQUEUE:
-- 
2.34.1
Re: [PATCH 4/8] linux-user: Convert signal number for FUTEX_FD
Posted by Laurent Vivier 3 years, 4 months ago
Le 29/08/2022 à 04:10, Richard Henderson a écrit :
> The val argument to FUTEX_FD is a signal number.  Convert to match
> the host, as it will be converted back when the signal is delivered.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/syscall.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 8bf4b79a9e..f50cc70f1a 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -7778,6 +7778,7 @@ static int do_futex(CPUState *cpu, bool time64, target_ulong uaddr,
>           timeout = 0;
>           break;
>       case FUTEX_FD:
> +        val = target_to_host_signal(val);
>           timeout = 0;
>           break;
>       case FUTEX_CMP_REQUEUE:

Reviewed-by: Laurent Vivier <laurent@vivier.eu>