All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] linux-user: prctl follow-ups
@ 2022-01-06 22:57 Richard Henderson
  2022-01-06 22:57 ` [PATCH 1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG Richard Henderson
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Richard Henderson @ 2022-01-06 22:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent

Hi Laurent, as requested.  I did all of the cap_task_prctl options,
and fixed a few existing bugs with PR_GET_DEATHSIG.

r~

Richard Henderson (4):
  linux-user: Do not special-case NULL for PR_GET_PDEATHSIG
  linux-user: Map signal number in PR_GET_PDEATHSIG
  linux-user: Implement PR_SET_PDEATHSIG
  linux-user: Implement capability prctls

 linux-user/syscall.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

-- 
2.25.1



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG
  2022-01-06 22:57 [PATCH 0/4] linux-user: prctl follow-ups Richard Henderson
@ 2022-01-06 22:57 ` Richard Henderson
  2022-01-08 17:10   ` Laurent Vivier
  2022-01-06 22:57 ` [PATCH 2/4] linux-user: Map signal number in PR_GET_PDEATHSIG Richard Henderson
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Richard Henderson @ 2022-01-06 22:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent

The kernel does not special-case arg2 != NULL, so
neither should we.

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

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ce9d64896c..e8f9e0643e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6444,7 +6444,7 @@ 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) && arg2 && put_user_s32(deathsig, arg2)) {
+            if (!is_error(ret) && put_user_s32(deathsig, arg2)) {
                 return -TARGET_EFAULT;
             }
             return ret;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] linux-user: Map signal number in PR_GET_PDEATHSIG
  2022-01-06 22:57 [PATCH 0/4] linux-user: prctl follow-ups Richard Henderson
  2022-01-06 22:57 ` [PATCH 1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG Richard Henderson
@ 2022-01-06 22:57 ` Richard Henderson
  2022-01-07 14:01   ` Philippe Mathieu-Daudé
  2022-01-06 22:57 ` [PATCH 3/4] linux-user: Implement PR_SET_PDEATHSIG Richard Henderson
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Richard Henderson @ 2022-01-06 22:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent

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(-)

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;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] linux-user: Implement PR_SET_PDEATHSIG
  2022-01-06 22:57 [PATCH 0/4] linux-user: prctl follow-ups Richard Henderson
  2022-01-06 22:57 ` [PATCH 1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG Richard Henderson
  2022-01-06 22:57 ` [PATCH 2/4] linux-user: Map signal number in PR_GET_PDEATHSIG Richard Henderson
@ 2022-01-06 22:57 ` Richard Henderson
  2022-01-08 17:15   ` Laurent Vivier
  2022-01-06 22:57 ` [PATCH 4/4] linux-user: Implement capability prctls Richard Henderson
  2022-01-08 18:06 ` [PATCH 0/4] linux-user: prctl follow-ups Laurent Vivier
  4 siblings, 1 reply; 11+ messages in thread
From: Richard Henderson @ 2022-01-06 22:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent

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

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 9eb2fb2bb2..8495f5e08e 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6450,6 +6450,9 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
             }
             return ret;
         }
+    case PR_SET_PDEATHSIG:
+        return get_errno(prctl(PR_SET_PDEATHSIG, target_to_host_signal(arg2),
+                               arg3, arg4, arg5));
     case PR_GET_NAME:
         {
             void *name = lock_user(VERIFY_WRITE, arg2, 16, 1);
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] linux-user: Implement capability prctls
  2022-01-06 22:57 [PATCH 0/4] linux-user: prctl follow-ups Richard Henderson
                   ` (2 preceding siblings ...)
  2022-01-06 22:57 ` [PATCH 3/4] linux-user: Implement PR_SET_PDEATHSIG Richard Henderson
@ 2022-01-06 22:57 ` Richard Henderson
  2022-01-08 17:17   ` Laurent Vivier
  2022-01-08 18:06 ` [PATCH 0/4] linux-user: prctl follow-ups Laurent Vivier
  4 siblings, 1 reply; 11+ messages in thread
From: Richard Henderson @ 2022-01-06 22:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: laurent

This is PR_CAPBSET_READ, PR_CAPBSET_DROP and the "legacy"
PR_CAP_AMBIENT PR_GET_SECUREBITS, PR_SET_SECUREBITS.

All of these arguments are integer values only, and do not
require mapping of values between host and guest.

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

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 8495f5e08e..4711afaf8c 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6504,10 +6504,15 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
     case PR_SET_UNALIGN:
         return do_prctl_set_unalign(env, arg2);
 
+    case PR_CAP_AMBIENT:
+    case PR_CAPBSET_READ:
+    case PR_CAPBSET_DROP:
     case PR_GET_DUMPABLE:
     case PR_SET_DUMPABLE:
     case PR_GET_KEEPCAPS:
     case PR_SET_KEEPCAPS:
+    case PR_GET_SECUREBITS:
+    case PR_SET_SECUREBITS:
     case PR_GET_TIMING:
     case PR_SET_TIMING:
     case PR_GET_TIMERSLACK:
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/4] linux-user: Map signal number in PR_GET_PDEATHSIG
  2022-01-06 22:57 ` [PATCH 2/4] linux-user: Map signal number in PR_GET_PDEATHSIG Richard Henderson
@ 2022-01-07 14:01   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-01-07 14:01 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: laurent

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>


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG
  2022-01-06 22:57 ` [PATCH 1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG Richard Henderson
@ 2022-01-08 17:10   ` Laurent Vivier
  2022-01-08 17:13     ` Laurent Vivier
  0 siblings, 1 reply; 11+ messages in thread
From: Laurent Vivier @ 2022-01-08 17:10 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

Le 06/01/2022 à 23:57, Richard Henderson a écrit :
> The kernel does not special-case arg2 != NULL, so
> neither should we.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/syscall.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ce9d64896c..e8f9e0643e 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6444,7 +6444,7 @@ 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) && arg2 && put_user_s32(deathsig, arg2)) {
> +            if (!is_error(ret) && put_user_s32(deathsig, arg2)) {
>                   return -TARGET_EFAULT;
>               }
>               return ret;

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG
  2022-01-08 17:10   ` Laurent Vivier
@ 2022-01-08 17:13     ` Laurent Vivier
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2022-01-08 17:13 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

Le 08/01/2022 à 18:10, Laurent Vivier a écrit :
> Le 06/01/2022 à 23:57, Richard Henderson a écrit :
>> The kernel does not special-case arg2 != NULL, so
>> neither should we.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>   linux-user/syscall.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
>> index ce9d64896c..e8f9e0643e 100644
>> --- a/linux-user/syscall.c
>> +++ b/linux-user/syscall.c
>> @@ -6444,7 +6444,7 @@ 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) && arg2 && put_user_s32(deathsig, arg2)) {
>> +            if (!is_error(ret) && put_user_s32(deathsig, arg2)) {
>>                   return -TARGET_EFAULT;
>>               }
>>               return ret;
> 
> Reviewed-by: Laurent Vivier <laurent@vivier.eu>
> 

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/4] linux-user: Implement PR_SET_PDEATHSIG
  2022-01-06 22:57 ` [PATCH 3/4] linux-user: Implement PR_SET_PDEATHSIG Richard Henderson
@ 2022-01-08 17:15   ` Laurent Vivier
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2022-01-08 17:15 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

Le 06/01/2022 à 23:57, Richard Henderson a écrit :
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/syscall.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 9eb2fb2bb2..8495f5e08e 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6450,6 +6450,9 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
>               }
>               return ret;
>           }
> +    case PR_SET_PDEATHSIG:
> +        return get_errno(prctl(PR_SET_PDEATHSIG, target_to_host_signal(arg2),
> +                               arg3, arg4, arg5));
>       case PR_GET_NAME:
>           {
>               void *name = lock_user(VERIFY_WRITE, arg2, 16, 1);

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] linux-user: Implement capability prctls
  2022-01-06 22:57 ` [PATCH 4/4] linux-user: Implement capability prctls Richard Henderson
@ 2022-01-08 17:17   ` Laurent Vivier
  0 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2022-01-08 17:17 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

Le 06/01/2022 à 23:57, Richard Henderson a écrit :
> This is PR_CAPBSET_READ, PR_CAPBSET_DROP and the "legacy"
> PR_CAP_AMBIENT PR_GET_SECUREBITS, PR_SET_SECUREBITS.
> 
> All of these arguments are integer values only, and do not
> require mapping of values between host and guest.
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/syscall.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 8495f5e08e..4711afaf8c 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6504,10 +6504,15 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
>       case PR_SET_UNALIGN:
>           return do_prctl_set_unalign(env, arg2);
>   
> +    case PR_CAP_AMBIENT:
> +    case PR_CAPBSET_READ:
> +    case PR_CAPBSET_DROP:
>       case PR_GET_DUMPABLE:
>       case PR_SET_DUMPABLE:
>       case PR_GET_KEEPCAPS:
>       case PR_SET_KEEPCAPS:
> +    case PR_GET_SECUREBITS:
> +    case PR_SET_SECUREBITS:
>       case PR_GET_TIMING:
>       case PR_SET_TIMING:
>       case PR_GET_TIMERSLACK:

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


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/4] linux-user: prctl follow-ups
  2022-01-06 22:57 [PATCH 0/4] linux-user: prctl follow-ups Richard Henderson
                   ` (3 preceding siblings ...)
  2022-01-06 22:57 ` [PATCH 4/4] linux-user: Implement capability prctls Richard Henderson
@ 2022-01-08 18:06 ` Laurent Vivier
  4 siblings, 0 replies; 11+ messages in thread
From: Laurent Vivier @ 2022-01-08 18:06 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

Le 06/01/2022 à 23:57, Richard Henderson a écrit :
> Hi Laurent, as requested.  I did all of the cap_task_prctl options,
> and fixed a few existing bugs with PR_GET_DEATHSIG.
> 
> r~
> 
> Richard Henderson (4):
>    linux-user: Do not special-case NULL for PR_GET_PDEATHSIG
>    linux-user: Map signal number in PR_GET_PDEATHSIG
>    linux-user: Implement PR_SET_PDEATHSIG
>    linux-user: Implement capability prctls
> 
>   linux-user/syscall.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
> 

Series applied to my linux-user-for-7.0 branch.

Thanks,
Laurent


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-01-08 18:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-06 22:57 [PATCH 0/4] linux-user: prctl follow-ups Richard Henderson
2022-01-06 22:57 ` [PATCH 1/4] linux-user: Do not special-case NULL for PR_GET_PDEATHSIG Richard Henderson
2022-01-08 17:10   ` Laurent Vivier
2022-01-08 17:13     ` Laurent Vivier
2022-01-06 22:57 ` [PATCH 2/4] linux-user: Map signal number in PR_GET_PDEATHSIG Richard Henderson
2022-01-07 14:01   ` Philippe Mathieu-Daudé
2022-01-06 22:57 ` [PATCH 3/4] linux-user: Implement PR_SET_PDEATHSIG Richard Henderson
2022-01-08 17:15   ` Laurent Vivier
2022-01-06 22:57 ` [PATCH 4/4] linux-user: Implement capability prctls Richard Henderson
2022-01-08 17:17   ` Laurent Vivier
2022-01-08 18:06 ` [PATCH 0/4] linux-user: prctl follow-ups Laurent Vivier

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.