diff mbox series

[2/4] linux-user: Map signal number in PR_GET_PDEATHSIG

Message ID 20220106225738.103012-3-richard.henderson@linaro.org
State Superseded
Headers show
Series linux-user: prctl follow-ups | expand

Commit Message

Richard Henderson Jan. 6, 2022, 10:57 p.m. UTC
Convert the host signal number to guest signal number
before returning the value to the guest.

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

Comments

Philippe Mathieu-Daudé Jan. 7, 2022, 2:01 p.m. UTC | #1
On 6/1/22 23:57, Richard Henderson wrote:
> Convert the host signal number to guest signal number
> before returning the value to the guest.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/syscall.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
diff mbox series

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e8f9e0643e..9eb2fb2bb2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6444,7 +6444,8 @@  static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
             int deathsig;
             ret = get_errno(prctl(PR_GET_PDEATHSIG, &deathsig,
                                   arg3, arg4, arg5));
-            if (!is_error(ret) && put_user_s32(deathsig, arg2)) {
+            if (!is_error(ret) &&
+                put_user_s32(host_to_target_signal(deathsig), arg2)) {
                 return -TARGET_EFAULT;
             }
             return ret;