qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] linux-user: Implement some prctls
@ 2024-03-02  1:06 Richard Henderson
  2024-03-02  1:06 ` [PATCH 1/3] linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER Richard Henderson
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Richard Henderson @ 2024-03-02  1:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini

Once upon a time I marked these TODO, which apparently
meant that I inherited them.  :-)


r~


Richard Henderson (3):
  linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER
  linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL
  linux-user: Implement PR_GET_TID_ADDRESS

 linux-user/syscall.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

-- 
2.34.1



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

* [PATCH 1/3] linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER
  2024-03-02  1:06 [PATCH 0/3] linux-user: Implement some prctls Richard Henderson
@ 2024-03-02  1:06 ` Richard Henderson
  2024-03-04 17:24   ` Peter Maydell
  2024-03-02  1:06 ` [PATCH 2/3] linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL Richard Henderson
  2024-03-02  1:06 ` [PATCH 3/3] linux-user: Implement PR_GET_TID_ADDRESS Richard Henderson
  2 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2024-03-02  1:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini

The "set" prctl passes through integral values.
The "get" prctl returns the value into a pointer.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1929
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/syscall.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index bc8c06522f..263b651cc5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6450,11 +6450,21 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
     case PR_SET_NO_NEW_PRIVS:
     case PR_GET_IO_FLUSHER:
     case PR_SET_IO_FLUSHER:
+    case PR_SET_CHILD_SUBREAPER:
         /* Some prctl options have no pointer arguments and we can pass on. */
         return get_errno(prctl(option, arg2, arg3, arg4, arg5));
 
     case PR_GET_CHILD_SUBREAPER:
-    case PR_SET_CHILD_SUBREAPER:
+        {
+            int val;
+            ret = get_errno(prctl(PR_GET_CHILD_SUBREAPER, &val,
+                                  arg3, arg4, arg5));
+            if (!is_error(ret) && put_user_s32(val, arg2)) {
+                return -TARGET_EFAULT;
+            }
+            return ret;
+        }
+
     case PR_GET_SPECULATION_CTRL:
     case PR_SET_SPECULATION_CTRL:
     case PR_GET_TID_ADDRESS:
-- 
2.34.1



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

* [PATCH 2/3] linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL
  2024-03-02  1:06 [PATCH 0/3] linux-user: Implement some prctls Richard Henderson
  2024-03-02  1:06 ` [PATCH 1/3] linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER Richard Henderson
@ 2024-03-02  1:06 ` Richard Henderson
  2024-03-04 17:25   ` Peter Maydell
  2024-03-02  1:06 ` [PATCH 3/3] linux-user: Implement PR_GET_TID_ADDRESS Richard Henderson
  2 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2024-03-02  1:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini

Both of these only pass and return integral values.

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

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 263b651cc5..efa200878f 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6451,6 +6451,8 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
     case PR_GET_IO_FLUSHER:
     case PR_SET_IO_FLUSHER:
     case PR_SET_CHILD_SUBREAPER:
+    case PR_GET_SPECULATION_CTRL:
+    case PR_SET_SPECULATION_CTRL:
         /* Some prctl options have no pointer arguments and we can pass on. */
         return get_errno(prctl(option, arg2, arg3, arg4, arg5));
 
@@ -6465,8 +6467,6 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
             return ret;
         }
 
-    case PR_GET_SPECULATION_CTRL:
-    case PR_SET_SPECULATION_CTRL:
     case PR_GET_TID_ADDRESS:
         /* TODO */
         return -TARGET_EINVAL;
-- 
2.34.1



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

* [PATCH 3/3] linux-user: Implement PR_GET_TID_ADDRESS
  2024-03-02  1:06 [PATCH 0/3] linux-user: Implement some prctls Richard Henderson
  2024-03-02  1:06 ` [PATCH 1/3] linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER Richard Henderson
  2024-03-02  1:06 ` [PATCH 2/3] linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL Richard Henderson
@ 2024-03-02  1:06 ` Richard Henderson
  2024-03-04 17:27   ` Peter Maydell
  2 siblings, 1 reply; 7+ messages in thread
From: Richard Henderson @ 2024-03-02  1:06 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini

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

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index efa200878f..a50a18b008 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6468,8 +6468,10 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
         }
 
     case PR_GET_TID_ADDRESS:
-        /* TODO */
-        return -TARGET_EINVAL;
+        {
+            TaskState *ts = env_cpu(env)->opaque;
+            return put_user_ual(ts->child_tidptr, arg2);
+        }
 
     case PR_GET_FPEXC:
     case PR_SET_FPEXC:
-- 
2.34.1



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

* Re: [PATCH 1/3] linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER
  2024-03-02  1:06 ` [PATCH 1/3] linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER Richard Henderson
@ 2024-03-04 17:24   ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2024-03-04 17:24 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, pbonzini

On Sat, 2 Mar 2024 at 04:13, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> The "set" prctl passes through integral values.
> The "get" prctl returns the value into a pointer.
>
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1929
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 2/3] linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL
  2024-03-02  1:06 ` [PATCH 2/3] linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL Richard Henderson
@ 2024-03-04 17:25   ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2024-03-04 17:25 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, pbonzini

On Sat, 2 Mar 2024 at 04:14, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Both of these only pass and return integral values.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/syscall.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

* Re: [PATCH 3/3] linux-user: Implement PR_GET_TID_ADDRESS
  2024-03-02  1:06 ` [PATCH 3/3] linux-user: Implement PR_GET_TID_ADDRESS Richard Henderson
@ 2024-03-04 17:27   ` Peter Maydell
  0 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2024-03-04 17:27 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel, pbonzini

On Sat, 2 Mar 2024 at 04:13, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/syscall.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM


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

end of thread, other threads:[~2024-03-04 17:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-02  1:06 [PATCH 0/3] linux-user: Implement some prctls Richard Henderson
2024-03-02  1:06 ` [PATCH 1/3] linux-user: Implement PR_{GET,SET}_CHILD_SUBREAPER Richard Henderson
2024-03-04 17:24   ` Peter Maydell
2024-03-02  1:06 ` [PATCH 2/3] linux-user: Implement PR_{GET,SET}_SPECULATION_CTRL Richard Henderson
2024-03-04 17:25   ` Peter Maydell
2024-03-02  1:06 ` [PATCH 3/3] linux-user: Implement PR_GET_TID_ADDRESS Richard Henderson
2024-03-04 17:27   ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).