From: Oleg Nesterov <oleg@redhat.com>
To: Gregory Price <gourry.memverge@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
avagin@gmail.com, peterz@infradead.org, luto@kernel.org,
krisman@collabora.com, tglx@linutronix.de, corbet@lwn.net,
shuah@kernel.org, Gregory Price <gregory.price@memverge.com>
Subject: Re: [PATCH v11 2/2] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD
Date: Wed, 22 Feb 2023 13:48:35 +0100 [thread overview]
Message-ID: <20230222124834.GA15591@redhat.com> (raw)
In-Reply-To: <20230221201740.2236-3-gregory.price@memverge.com>
On 02/21, Gregory Price wrote:
>
> +struct ptrace_sud_config {
> + __u8 mode;
> + __u8 pad[7];
^^^^^^
Why?
> +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 ptrace_sud_config config;
> + if (size != sizeof(struct ptrace_sud_config))
> + return -EINVAL;
Andrei, do we really need this check?
> +
> + if (test_task_syscall_work(task, SYSCALL_USER_DISPATCH))
> + config.mode = PR_SYS_DISPATCH_ON;
> + else
> + config.mode = PR_SYS_DISPATCH_OFF;
> +
> + config.offset = sd->offset;
> + config.len = sd->len;
> + config.selector = (__u64)sd->selector;
As the kernel test robot reports, this is not -Wpointer-to-int-cast friendly.
Please use uintptr_t. See for example ptrace_get_rseq_configuration(). Same
for syscall_user_dispatch_set_config().
> + if (copy_to_user(data, &config, sizeof(config))) {
This leaks info in (uninitialized) config.pad[]. You can probably simply make
config.mode __u64 as well.
Minor, but sizeof(struct ptrace_sud_config) above vs this sizeof(config)) doesn't
look consistent to me...
> +static int sys_ptrace(int request, pid_t pid, void *addr, void *data)
> +{
> + return syscall(SYS_ptrace, request, pid, addr, data);
> +}
Why can't you simply use ptrace() ?
Oleg.
next prev parent reply other threads:[~2023-02-22 12:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 20:17 [PATCH v11 0/2] Checkpoint Support for Syscall User Dispatch Gregory Price
2023-02-21 20:17 ` [PATCH v11 1/2] syscall_user_dispatch: helper function to operate on given task Gregory Price
2023-02-21 20:17 ` [PATCH v11 2/2] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD Gregory Price
2023-02-21 23:00 ` kernel test robot
2023-02-22 12:48 ` Oleg Nesterov [this message]
2023-02-22 15:24 ` Gregory Price
2023-02-23 12:30 ` Oleg Nesterov
2023-02-23 15:31 ` Gregory Price
2023-02-23 18:37 ` Oleg Nesterov
2023-02-24 8:17 ` Andrei Vagin
2023-02-24 16:02 ` Gregory Price
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230222124834.GA15591@redhat.com \
--to=oleg@redhat.com \
--cc=avagin@gmail.com \
--cc=corbet@lwn.net \
--cc=gourry.memverge@gmail.com \
--cc=gregory.price@memverge.com \
--cc=krisman@collabora.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=shuah@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.