[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f59e7e573aa40f08cb0e465d8d0150e@AcuMS.aculab.com>
Date: Thu, 31 Oct 2019 14:27:30 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Christian Brauner' <christian.brauner@...ntu.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Florian Weimer <fweimer@...hat.com>,
GNU C Library <libc-alpha@...rceware.org>
CC: Arnd Bergmann <arnd@...db.de>, Kees Cook <keescook@...omium.org>,
"Jann Horn" <jannh@...gle.com>,
David Howells <dhowells@...hat.com>,
Ingo Molnar <mingo@...hat.com>,
Oleg Nesterov <oleg@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
"linux-api@...r.kernel.org" <linux-api@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH] clone3: validate stack arguments
>From Christian Brauner
> Sent: 31 October 2019 11:36
>
> Validate the stack arguments and setup the stack depening on whether or not
> it is growing down or up.
>
...
> -static bool clone3_args_valid(const struct kernel_clone_args *kargs)
> +/**
> + * clone3_stack_valid - check and prepare stack
> + * @kargs: kernel clone args
> + *
> + * Verify that the stack arguments userspace gave us are sane.
> + * In addition, set the stack direction for userspace since it's easy for us to
> + * determine.
> + */
> +static inline bool clone3_stack_valid(struct kernel_clone_args *kargs)
> +{
> + if (kargs->stack == 0) {
> + if (kargs->stack_size > 0)
> + return false;
> + } else {
> + if (kargs->stack_size == 0)
> + return false;
> +
> + if (!access_ok((void __user *)kargs->stack, kargs->stack_size))
> + return false;
Does access_ok() do anything useful here?
It only verifies that the buffer isn't in kernel space.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists