[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190905101315.GA25637@lt-gp.iram.es>
Date: Thu, 5 Sep 2019 12:13:15 +0200
From: Gabriel Paubert <paubert@...m.es>
To: Andreas Schwab <schwab@...ux-m68k.org>
Cc: Aleksa Sarai <cyphar@...har.com>, linux-ia64@...r.kernel.org,
linux-sh@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Alexei Starovoitov <ast@...nel.org>,
linux-kernel@...r.kernel.org, David Howells <dhowells@...hat.com>,
linux-kselftest@...r.kernel.org, sparclinux@...r.kernel.org,
Shuah Khan <shuah@...nel.org>, linux-arch@...r.kernel.org,
linux-s390@...r.kernel.org, Tycho Andersen <tycho@...ho.ws>,
Aleksa Sarai <asarai@...e.de>, Jiri Olsa <jolsa@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>,
linux-arm-kernel@...ts.infradead.org, linux-mips@...r.kernel.org,
linux-xtensa@...ux-xtensa.org, Kees Cook <keescook@...omium.org>,
Arnd Bergmann <arnd@...db.de>, Jann Horn <jannh@...gle.com>,
linuxppc-dev@...ts.ozlabs.org, linux-m68k@...ts.linux-m68k.org,
Al Viro <viro@...iv.linux.org.uk>,
Andy Lutomirski <luto@...nel.org>,
Shuah Khan <skhan@...uxfoundation.org>,
Namhyung Kim <namhyung@...nel.org>,
David Drysdale <drysdale@...gle.com>,
Christian Brauner <christian@...uner.io>,
"J. Bruce Fields" <bfields@...ldses.org>,
linux-parisc@...r.kernel.org, linux-api@...r.kernel.org,
Chanho Min <chanho.min@....com>,
Jeff Layton <jlayton@...nel.org>,
Oleg Nesterov <oleg@...hat.com>,
Eric Biederman <ebiederm@...ssion.com>,
linux-alpha@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
containers@...ts.linux-foundation.org
Subject: Re: [PATCH v12 01/12] lib: introduce copy_struct_{to, from}_user
helpers
On Thu, Sep 05, 2019 at 11:09:35AM +0200, Andreas Schwab wrote:
> On Sep 05 2019, Aleksa Sarai <cyphar@...har.com> 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@...har.com>
> > + */
> > +
> > +#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@...ux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
Powered by blists - more mailing lists