* [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