Re: [PATCH -next] slub: play init_on_free=1 well with SLAB_RED_ZONE

2019-06-25 Thread Alexander Potapenko
On Fri, Jun 21, 2019 at 2:55 PM Qian Cai wrote: > > On Thu, 2019-06-20 at 18:19 -0700, Kees Cook wrote: > > On Thu, Jun 20, 2019 at 06:14:33PM -0700, Kees Cook wrote: > > > On Thu, Jun 20, 2019 at 03:28:01PM -0400, Qian Cai wrote: > > > > diff --git a/mm/slub.c b/mm/slub.c > > > > index a384228ff6

Re: [PATCH -next] slub: play init_on_free=1 well with SLAB_RED_ZONE

2019-06-21 Thread Qian Cai
On Thu, 2019-06-20 at 18:19 -0700, Kees Cook wrote: > On Thu, Jun 20, 2019 at 06:14:33PM -0700, Kees Cook wrote: > > On Thu, Jun 20, 2019 at 03:28:01PM -0400, Qian Cai wrote: > > > diff --git a/mm/slub.c b/mm/slub.c > > > index a384228ff6d3..787971d4fa36 100644 > > > --- a/mm/slub.c > > > +++ b/mm/

Re: [PATCH -next] slub: play init_on_free=1 well with SLAB_RED_ZONE

2019-06-20 Thread Kees Cook
On Thu, Jun 20, 2019 at 06:14:33PM -0700, Kees Cook wrote: > On Thu, Jun 20, 2019 at 03:28:01PM -0400, Qian Cai wrote: > > diff --git a/mm/slub.c b/mm/slub.c > > index a384228ff6d3..787971d4fa36 100644 > > --- a/mm/slub.c > > +++ b/mm/slub.c > > @@ -1437,7 +1437,7 @@ static inline bool slab_free_fr

Re: [PATCH -next] slub: play init_on_free=1 well with SLAB_RED_ZONE

2019-06-20 Thread Kees Cook
On Thu, Jun 20, 2019 at 03:28:01PM -0400, Qian Cai wrote: > The linux-next commit "mm: security: introduce init_on_alloc=1 and > init_on_free=1 boot options" [1] does not play well with SLAB_RED_ZONE > as it will overwrite the right-side redzone with all zeros and triggers > endless errors below. F

[PATCH -next] slub: play init_on_free=1 well with SLAB_RED_ZONE

2019-06-20 Thread Qian Cai
The linux-next commit "mm: security: introduce init_on_alloc=1 and init_on_free=1 boot options" [1] does not play well with SLAB_RED_ZONE as it will overwrite the right-side redzone with all zeros and triggers endless errors below. Fix it by only wiping out the slab object size and leave the redzon