lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMw=ZnSSA7F=Fth2eyTUSf=S2q1LA+UUXgO8vPS5HC6jN0E+Ww@mail.gmail.com>
Date: Mon, 7 Oct 2024 14:05:26 +0100
From: Luca Boccassi <luca.boccassi@...il.com>
To: Christian Brauner <brauner@...nel.org>
Cc: linux-kernel@...r.kernel.org, christian@...uner.io, oleg@...hat.com
Subject: Re: [PATCH v7] pidfd: add ioctl to retrieve pid info

On Mon, 7 Oct 2024 at 13:27, Christian Brauner <brauner@...nel.org> wrote:
>
> On Mon, Oct 07, 2024 at 10:43:28AM GMT, luca.boccassi@...il.com wrote:
> > From: Luca Boccassi <luca.boccassi@...il.com>
> > +     struct pidfd_info kinfo = {};
> > +     struct user_namespace *user_ns;
> > +     const struct cred *c;
> > +     __u64 request_mask;
> > +
> > +     if (!uinfo)
> > +             return -EINVAL;
> > +     if (usize < sizeof(struct pidfd_info))
> > +             return -EINVAL; /* First version, no smaller struct possible */
> > +
> > +     if (copy_from_user(&request_mask, &uinfo->request_mask, sizeof(request_mask)))
> > +             return -EFAULT;
>
> Use copy_struct_from_user() here it's not strictly needed as we
> technically don't care whether userspace passes unitialized stuff as
> this is an output-only struct right now but imho it's just good hygiene.

Here I was intentionally only copying the request_mask field, as we
really don't need the rest of the userspace struct and the mask is
fixed size, so I thought it would be simpler. Should I still change to
copy the whole thing instead?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ