[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANaxB-zet4+S4saBHgYPP6feppBVHkCRJxTkL8R-OyXa_gXG3Q@mail.gmail.com>
Date: Fri, 20 Jan 2023 19:18:49 -0800
From: Andrei Vagin <avagin@...il.com>
To: Gregory Price <gourry.memverge@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-doc@...r.kernel.org, linux-kselftest@...r.kernel.org,
krisman@...labora.com, tglx@...utronix.de, luto@...nel.org,
oleg@...hat.com, peterz@...radead.org, ebiederm@...ssion.com,
akpm@...ux-foundation.org, adobriyan@...il.com, corbet@....net,
shuah@...nel.org, Gregory Price <gregory.price@...verge.com>
Subject: Re: [PATCH v3 3/3] ptrace,syscall_user_dispatch: add a getter/setter
for sud configuration
On Fri, Jan 20, 2023 at 7:05 AM Gregory Price <gourry.memverge@...il.com> wrote:
>
> Implement ptrace getter/setter interface for syscall user dispatch.
>
> Presently, these settings are write-only via prctl, making it impossible
> to implement transparent checkpoint (coordination with the software is
> required).
>
> This is modeled after a similar interface for SECCOMP, which can have
> its configuration dumped by ptrace for software like CRIU.
>
> Signed-off-by: Gregory Price <gregory.price@...verge.com>
> ---
> .../admin-guide/syscall-user-dispatch.rst | 5 +-
> include/linux/syscall_user_dispatch.h | 19 +++++++
> include/uapi/linux/ptrace.h | 10 ++++
> kernel/entry/syscall_user_dispatch.c | 49 +++++++++++++++++++
> kernel/ptrace.c | 9 ++++
> 5 files changed, 91 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/admin-guide/syscall-user-dispatch.rst b/Documentation/admin-guide/syscall-user-dispatch.rst
> index 60314953c728..a23ae21a1d5b 100644
> --- a/Documentation/admin-guide/syscall-user-dispatch.rst
> +++ b/Documentation/admin-guide/syscall-user-dispatch.rst
<snip>
> +
> +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 (sd->selector) {
> + config.mode = PR_SYS_DISPATCH_ON;
> + config.offset = sd->offset;
> + config.len = sd->len;
> + config.selector = sd->selector;
> + config.on_dispatch = sd->on_dispatch;
> + } else {
This doesn't look right for me. selector is optional and if it is 0,
it doesn't mean that
mode is PR_SYS_DISPATCH_OFF, does it?
> + config.mode = PR_SYS_DISPATCH_OFF;
> + config.offset = 0;
> + config.len = 0;
> + config.selector = NULL;
> + config.on_dispatch = false;
> + }
> + if (copy_to_user(data, &config, sizeof(config)))
> + return -EFAULT;
> +
> + return 0;
> +}
> +
Powered by blists - more mailing lists