On Sat, Apr 07, 2018 at 08:16:46PM -0700, Matthew Wilcox wrote: > On Fri, Apr 06, 2018 at 03:33:36PM +0200, Dmitry Vyukov wrote: > > On Fri, Apr 6, 2018 at 3:24 PM, syzbot > > <syzbot+75397ee3df5c70164154@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > > > cache_from_obj: Wrong slab cache. names_cache but object is from kmalloc-96 > > > > Al, do you see how this can happen? > > I don't see how it happened, but when looking at this bug, I thought > "This is very complicated, I think there's a simpler way to handle this". > > Here's a proposal. It won't apply to any existing tree (depends on a > couple of local commits), but I think you'll get the general flavour > of it. It's mostly compile-tested (build still running, but fs/ and > kernel/ compiled without issue). > +struct audit_names; > + > +struct filename { > + const char *name; /* pointer to actual string */ > + const __user char *uptr; /* original userland pointer */ > + struct audit_names *aname; > +}; > > /* > * Each physical page in the system has a struct page associated with > @@ -188,6 +195,7 @@ struct page { > spinlock_t ptl; > #endif > }; > + struct filename filename; > }; Oh, lovely - extra 24 bytes into each struct page. Plus the delta to performance due to switching from kmem_cache_alloc to alloc_page. Negative one, that is...