mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gregory Price <gregory.price@memverge.com>
To: Oleg Nesterov <oleg@redhat.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
Subject: Re: [PATCH v11 2/2] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD
Date: Thu, 23 Feb 2023 10:31:46 -0500	[thread overview]
Message-ID: <Y/eG4oHc2jz6uSfi@memverge.com> (raw)
In-Reply-To: <20230223123020.GA26182@redhat.com>

On Thu, Feb 23, 2023 at 01:30:20PM +0100, Oleg Nesterov wrote:
> On 02/22, Gregory Price wrote:
> >
> > On Wed, Feb 22, 2023 at 01:48:35PM +0100, Oleg Nesterov wrote:
> > > On 02/21, Gregory Price wrote:
> > > >
> > > > +struct ptrace_sud_config {
> > > > +	__u8  mode;
> > > > +	__u8  pad[7];
> > >               ^^^^^^
> > > Why?
> > >
> >
> > The struct isn't packed, so this is for alignment/consistency of size.
> > The padding gets added anyway, and differently between 32/64 bit.
> 
> OK, I have to admit I didn't know that alignof(long long) == 4 on 32 bit.
> 
> > > > +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?
> > >
> >
> > My understanding is that it's a sanity check against the above issue.
> > In fact, it was what lead me to add the padding.
> 
> Well, if this is the only reason then this check and the "size" argument
> ahould be removed, imo.
> 
> But perhaps it can be useful for future extensions, I dunno.
> 
> Oleg.
>

I suppose yes it could also be used to detect differences in versioning
if the struct changes in the future, and that would not require an API
change in the future to support it.

If something does change in the future, without the check you're kinda
SOL trying to add new fields.

~Gregory

  reply	other threads:[~2023-02-23 15:32 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
2023-02-22 15:24     ` Gregory Price
2023-02-23 12:30       ` Oleg Nesterov
2023-02-23 15:31         ` Gregory Price [this message]
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=Y/eG4oHc2jz6uSfi@memverge.com \
    --to=gregory.price@memverge.com \
    --cc=avagin@gmail.com \
    --cc=corbet@lwn.net \
    --cc=gourry.memverge@gmail.com \
    --cc=krisman@collabora.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=oleg@redhat.com \
    --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

all inboxes | Powered by JetHome®