lkml.org 
[lkml]   [2023]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v11 2/2] ptrace,syscall_user_dispatch: checkpoint/restore support for SUD
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.

\
 
 \ /
  Last update: 2023-03-27 00:33    [W:0.097 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site