Thread (14 messages) 14 messages, 4 authors, 2023-01-24

Re: [PATCH 3/3] ptrace,syscall_user_dispatch: add a getter/setter for sud configuration

From: Gregory Price <hidden>
Date: 2023-01-23 18:12:53
Also in: linux-fsdevel, linux-kselftest, lkml

On Mon, Jan 23, 2023 at 04:41:02PM +0100, Oleg Nesterov wrote:
On 01/22, Gregory Price wrote:
quoted
+int syscall_user_dispatch_get_config(struct task_struct *task, unsigned long size,
+		void __user *data)
+{
+	struct syscall_user_dispatch *sd = &task->syscall_dispatch;
+	struct syscall_user_dispatch_config config;
+
+	if (size != sizeof(struct syscall_user_dispatch_config))
+		return -EINVAL;
+
+	if (test_syscall_work(SYSCALL_USER_DISPATCH))
+		config.mode = PR_SYS_DISPATCH_ON;
+	else
+		config.mode = PR_SYS_DISPATCH_OFF;
Stupid question...

Why do we need 2/3 (which reports SYSCALL_USER_DISPATCH in proc/pid/status) then?

Oleg.
Actually a good question.

My original though was: CRIU uses proc/status to determine whether to
use seccomp dumping, so i may as well implement the same thing.

On further thought, I think you're right.  We can just always read and
set these settings regardless of the original state because SUD is not
seccomp.

1. if GENERIC_ENTRY is not compiled, and TIF_SYSCALL_USER_DISPATCH is
   not available, these settings get ignored anyway.
2. if disabled, offset/len/selector is guaranteed to be off
3. if you try to set something other than the above then this will fail
   anyway (see: set_syscall_user_dispatch)

ergo
4. It's always say to read/write these settings.  As with anything else
   you can certainly cause the user program to crash by setting garbage
	 but that's to be expected.


So i think dropping 2/3 in the list is good.  If you concur i'll do
that.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help