lkml.org 
[lkml]   [2023]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] ptrace,syscall_user_dispatch: add a getter/setter for sud configuration
On Mon, Jan 23, 2023 at 04:41:02PM +0100, Oleg Nesterov wrote:
> On 01/22, Gregory Price wrote:
> >
> > +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.

\
 
 \ /
  Last update: 2023-03-26 23:52    [W:0.057 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site