Re: [PATCH v4 1/4] lib: introduce copy_struct_from_user() helper

2019-10-10 Thread Kees Cook
On Thu, Oct 10, 2019 at 10:40:07PM +1100, Aleksa Sarai wrote: > Yeah, it takes about 5-10s on my laptop. We could switch it to just > everything within a 4K block, but the main reason for testing with > 2*PAGE_SIZE is to make sure that check_nonzero_user() works across page > boundaries. Though we

Re: [PATCH v4 1/4] lib: introduce copy_struct_from_user() helper

2019-10-10 Thread Aleksa Sarai
On 2019-10-10, Michael Ellerman wrote: > Aleksa Sarai writes: > > A common pattern for syscall extensions is increasing the size of a > > struct passed from userspace, such that the zero-value of the new fields > > result in the old kernel behaviour (allowing for a mix of userspace and > >

Re: [PATCH v4 1/4] lib: introduce copy_struct_from_user() helper

2019-10-10 Thread Michael Ellerman
Hi Aleksa, Aleksa Sarai writes: > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages to operate on one another

Re: [PATCH v4 1/4] lib: introduce copy_struct_from_user() helper

2019-10-01 Thread Kees Cook
On Tue, Oct 01, 2019 at 04:31:27AM +0200, Christian Brauner wrote: > On Mon, Sep 30, 2019 at 06:58:39PM -0700, Kees Cook wrote: > > On Tue, Oct 01, 2019 at 11:10:52AM +1000, Aleksa Sarai wrote: > > > +static __always_inline > > > +int copy_struct_from_user(void *dst, size_t ksize, > > > +

Re: [PATCH v4 1/4] lib: introduce copy_struct_from_user() helper

2019-09-30 Thread Christian Brauner
On Mon, Sep 30, 2019 at 06:58:39PM -0700, Kees Cook wrote: > On Tue, Oct 01, 2019 at 11:10:52AM +1000, Aleksa Sarai wrote: > > A common pattern for syscall extensions is increasing the size of a > > struct passed from userspace, such that the zero-value of the new fields > > result in the old

Re: [PATCH v4 1/4] lib: introduce copy_struct_from_user() helper

2019-09-30 Thread Kees Cook
On Tue, Oct 01, 2019 at 11:10:52AM +1000, Aleksa Sarai wrote: > A common pattern for syscall extensions is increasing the size of a > struct passed from userspace, such that the zero-value of the new fields > result in the old kernel behaviour (allowing for a mix of userspace and > kernel vintages

[PATCH v4 1/4] lib: introduce copy_struct_from_user() helper

2019-09-30 Thread Aleksa Sarai
A common pattern for syscall extensions is increasing the size of a struct passed from userspace, such that the zero-value of the new fields result in the old kernel behaviour (allowing for a mix of userspace and kernel vintages to operate on one another in most cases). While this interface