lkml.org 
[lkml]   [2018]   [Apr]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: Use struct page for filename
    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@syzkaller.appspotmail.com> 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...

    \
     
     \ /
      Last update: 2018-04-08 06:43    [W:4.483 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site