public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Dmitry Safonov <0x7f454c46@gmail.com>
Cc: Gregory Price <gourry.memverge@gmail.com>,
	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 v12 2/3] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD
Date: Tue, 28 Feb 2023 19:33:52 +0100	[thread overview]
Message-ID: <20230228183351.GB15021@redhat.com> (raw)
In-Reply-To: <c44af068-8f30-9fbc-1b06-da9fe317f213@gmail.com>

On 02/28, Dmitry Safonov wrote:
>
> On 2/28/23 16:52, Oleg Nesterov wrote:
> > On 02/27, Dmitry Safonov wrote:
> >>
> >>> +int syscall_user_dispatch_set_config(struct task_struct *task, unsigned long size,
> >>> +                                    void __user *data)
> >>> +{
> >>> +       int rc;
> >>> +       struct ptrace_sud_config cfg;
> >>> +
> >>> +       if (size != sizeof(struct ptrace_sud_config))
> >>> +               return -EINVAL;
> >>> +
> >>> +       if (copy_from_user(&cfg, data, sizeof(struct ptrace_sud_config)))
> >>> +               return -EFAULT;
> >>
> >> It seems that the tool you want here would be copy_struct_from_user(),
> >> which is designed for extendable syscalls.
> >
> > Hmm. Why?
> >
> > In this case ksize == usize, so why do we need copy_struct_from_user ?
>
> In case the structure extends in future, that will let newer userspace
> run on an older kernel (as long as it doesn't use [set] any new fields).

Sure, I understand that, but I don't think it's worth the trouble
in this case.

If (unlikely, I think) this structure ever extends we can switch to
copy_struct_from_user() or do something else if check_zeroed_user()
makes no real sense for the new fields.

Right now I think it is more important to ensure that the new users
of this API use the correct size.

Oleg.


  reply	other threads:[~2023-02-28 18:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 23:31 [PATCH v12 0/3] Checkpoint Support for Syscall User Dispatch Gregory Price
2023-02-24 23:31 ` [PATCH v12 1/3] syscall_user_dispatch: helper function to operate on given task Gregory Price
2023-02-24 23:31 ` [PATCH v12 2/3] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD Gregory Price
2023-02-27 16:02   ` Dmitry Safonov
2023-02-27 16:04     ` Dmitry Safonov
2023-02-28 16:52     ` Oleg Nesterov
2023-02-28 17:04       ` Dmitry Safonov
2023-02-28 18:33         ` Oleg Nesterov [this message]
2023-02-28 17:03   ` Oleg Nesterov
2023-02-24 23:31 ` [PATCH v12 3/3] selftest,ptrace: Add selftest for syscall user dispatch config api 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=20230228183351.GB15021@redhat.com \
    --to=oleg@redhat.com \
    --cc=0x7f454c46@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox