Re: [PATCH v12 01/12] lib: introduce copy_struct_{to, from}_user helpers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: Andreas Schwab <schwab@xxxxxxxxxxxxxx>
- Subject: Re: [PATCH v12 01/12] lib: introduce copy_struct_{to, from}_user helpers
- From: Gabriel Paubert <paubert@xxxxxxx>
- Date: Thu, 5 Sep 2019 12:13:15 +0200
- Cc: Aleksa Sarai <cyphar@xxxxxxxxxx>, linux-ia64@xxxxxxxxxxxxxxx, linux-sh@xxxxxxxxxxxxxxx, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>, Alexei Starovoitov <ast@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, David Howells <dhowells@xxxxxxxxxx>, linux-kselftest@xxxxxxxxxxxxxxx, sparclinux@xxxxxxxxxxxxxxx, Shuah Khan <shuah@xxxxxxxxxx>, linux-arch@xxxxxxxxxxxxxxx, linux-s390@xxxxxxxxxxxxxxx, Tycho Andersen <tycho@xxxxxxxx>, Aleksa Sarai <asarai@xxxxxxx>, Jiri Olsa <jolsa@xxxxxxxxxx>, Alexander Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-mips@xxxxxxxxxxxxxxx, linux-xtensa@xxxxxxxxxxxxxxxx, Kees Cook <keescook@xxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>, linuxppc-dev@xxxxxxxxxxxxxxxx, linux-m68k@xxxxxxxxxxxxxxx, Al Viro <viro@xxxxxxxxxxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxx>, Shuah Khan <skhan@xxxxxxxxxxxxxxxxxxx>, Namhyung Kim <namhyung@xxxxxxxxxx>, David Drysdale <drysdale@xxxxxxxxxx>, Christian Brauner <christian@xxxxxxxxxx>, "J. Bruce Fields" <bfields@xxxxxxxxxxxx>, linux-parisc@xxxxxxxxxxxxxxx, linux-api@xxxxxxxxxxxxxxx, Chanho Min <chanho.min@xxxxxxx>, Jeff Layton <jlayton@xxxxxxxxxx>, Oleg Nesterov <oleg@xxxxxxxxxx>, Eric Biederman <ebiederm@xxxxxxxxxxxx>, linux-alpha@xxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>, containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
- In-reply-to: <mvma7bj85yo.fsf@linux-m68k.org>
- References: <20190904201933.10736-1-cyphar@cyphar.com> <20190904201933.10736-2-cyphar@cyphar.com> <mvma7bj85yo.fsf@linux-m68k.org>
- User-agent: Mutt/1.10.1 (2018-07-13)
On Thu, Sep 05, 2019 at 11:09:35AM +0200, Andreas Schwab wrote:
> On Sep 05 2019, Aleksa Sarai <cyphar@xxxxxxxxxx> wrote:
>
> > diff --git a/lib/struct_user.c b/lib/struct_user.c
> > new file mode 100644
> > index 000000000000..7301ab1bbe98
> > --- /dev/null
> > +++ b/lib/struct_user.c
> > @@ -0,0 +1,182 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (C) 2019 SUSE LLC
> > + * Copyright (C) 2019 Aleksa Sarai <cyphar@xxxxxxxxxx>
> > + */
> > +
> > +#include <linux/types.h>
> > +#include <linux/export.h>
> > +#include <linux/uaccess.h>
> > +#include <linux/kernel.h>
> > +#include <linux/string.h>
> > +
> > +#define BUFFER_SIZE 64
> > +
> > +/*
> > + * "memset(p, 0, size)" but for user space buffers. Caller must have already
> > + * checked access_ok(p, size).
> > + */
> > +static int __memzero_user(void __user *p, size_t s)
> > +{
> > + const char zeros[BUFFER_SIZE] = {};
>
> Perhaps make that static?
On SMP? It should at least be per cpu, and I'm not even sure
with preemption.
Gabriel
>
> Andreas.
>
> --
> Andreas Schwab, schwab@xxxxxxxxxxxxxx
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]