Re: [PATCH 7/7] exec: Implement kernel_execve

2020-07-15 Thread Eric W. Biederman
Christoph Hellwig writes: >> +static int count_strings_kernel(const char *const *argv) >> +{ >> +int i; >> + >> +if (!argv) >> +return 0; >> + >> +for (i = 0; argv[i]; ++i) { >> +if (i >= MAX_ARG_STRINGS) >> +return -E2BIG; >> +i

Re: [PATCH 7/7] exec: Implement kernel_execve

2020-07-15 Thread Christoph Hellwig
On Wed, Jul 15, 2020 at 08:00:16AM -0700, Kees Cook wrote: > Heh, yes please. :) (Which branch is this from? http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/exec-cleanup > Are yours and Eric's > tree going to collide?) Yes, badly.

RE: [PATCH 7/7] exec: Implement kernel_execve

2020-07-15 Thread David Laight
From: Kees Cook > Sent: 15 July 2020 16:09 > > On Wed, Jul 15, 2020 at 02:55:50PM +, David Laight wrote: > > From: Christoph Hellwig > > > Sent: 15 July 2020 07:43 > > > Subject: Re: [PATCH 7/7] exec: Implement kernel_execve > > > > > >

Re: [PATCH 7/7] exec: Implement kernel_execve

2020-07-15 Thread Kees Cook
On Wed, Jul 15, 2020 at 02:55:50PM +, David Laight wrote: > From: Christoph Hellwig > > Sent: 15 July 2020 07:43 > > Subject: Re: [PATCH 7/7] exec: Implement kernel_execve > > > > On Tue, Jul 14, 2020 at 02:49:23PM -0700, Kees Cook wrote: > > > On Tue, Jul

Re: [PATCH 7/7] exec: Implement kernel_execve

2020-07-15 Thread Kees Cook
On Wed, Jul 15, 2020 at 07:42:48AM +0100, Christoph Hellwig wrote: > On Tue, Jul 14, 2020 at 02:49:23PM -0700, Kees Cook wrote: > > On Tue, Jul 14, 2020 at 08:31:40AM -0500, Eric W. Biederman wrote: > > > +static int count_strings_kernel(const char *const *argv) > > > +{ > > > + int i; > > > + > >

RE: [PATCH 7/7] exec: Implement kernel_execve

2020-07-15 Thread David Laight
From: Christoph Hellwig > Sent: 15 July 2020 07:43 > Subject: Re: [PATCH 7/7] exec: Implement kernel_execve > > On Tue, Jul 14, 2020 at 02:49:23PM -0700, Kees Cook wrote: > > On Tue, Jul 14, 2020 at 08:31:40AM -0500, Eric W. Biederman wrote: > > > +static int coun

Re: [PATCH 7/7] exec: Implement kernel_execve

2020-07-14 Thread Christoph Hellwig
On Tue, Jul 14, 2020 at 02:49:23PM -0700, Kees Cook wrote: > On Tue, Jul 14, 2020 at 08:31:40AM -0500, Eric W. Biederman wrote: > > +static int count_strings_kernel(const char *const *argv) > > +{ > > + int i; > > + > > + if (!argv) > > + return 0; > > + > > + for (i = 0; argv[i]; +

Re: [PATCH 7/7] exec: Implement kernel_execve

2020-07-14 Thread Christoph Hellwig
> +static int count_strings_kernel(const char *const *argv) > +{ > + int i; > + > + if (!argv) > + return 0; > + > + for (i = 0; argv[i]; ++i) { > + if (i >= MAX_ARG_STRINGS) > + return -E2BIG; > + if (fatal_signal_pending(current)

Re: [PATCH 7/7] exec: Implement kernel_execve

2020-07-14 Thread Kees Cook
On Tue, Jul 14, 2020 at 08:31:40AM -0500, Eric W. Biederman wrote: > +static int count_strings_kernel(const char *const *argv) > +{ > + int i; > + > + if (!argv) > + return 0; > + > + for (i = 0; argv[i]; ++i) { > + if (i >= MAX_ARG_STRINGS) > +

[PATCH 7/7] exec: Implement kernel_execve

2020-07-14 Thread Eric W. Biederman
To allow the kernel not to play games with set_fs to call exec implement kernel_execve. The function kernel_execve takes pointers into kernel memory and copies the values pointed to onto the new userspace stack. The calls with arguments from kernel space of do_execve are replaced with calls to