lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200429182508.GU29705@bombadil.infradead.org>
Date:   Wed, 29 Apr 2020 11:25:08 -0700
From:   Matthew Wilcox <willy@...radead.org>
To:     Markus Elfring <Markus.Elfring@....de>
Cc:     Waiman Long <longman@...hat.com>, Christoph Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        Changbin Du <changbin.du@...il.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] mm/slub: Fix incorrect interpretation of s->offset

On Wed, Apr 29, 2020 at 06:42:55PM +0200, Markus Elfring wrote:
> > In a couple of places in the slub memory allocator, the code uses
> > "s->offset" as a check to see if the free pointer is put right after the
> > object. That check is no longer true with commit 3202fa62fb43 ("slub:
> > relocate freelist pointer to middle of object").
> 
> Will any further collateral evolution become interesting?

What do you mean by this question?

> > +static inline unsigned int get_info_end(struct kmem_cache *s)
> > +{
> > +	if (freeptr_outside_object(s))
> > +		return s->inuse + sizeof(void *);
> > +	else
> > +		return s->inuse;
> > +}
> 
> How do you think about the following source code variants?
> 
> +	return freeptr_outside_object(s)
> +	       ? s->inuse + sizeof(void *)
> +	       : s->inuse;

That is less clear than the version Wayman posted.

> >  static struct track *get_track(struct kmem_cache *s, void *object,
> >  	enum track_item alloc)
> >  {
> >  	struct track *p;
> >
> > -	if (s->offset)
> > -		p = object + s->offset + sizeof(void *);
> > -	else
> > -		p = object + s->inuse;
> > +	p = object + get_info_end(s);
> >
> >  	return p + alloc;
> >  }
> 
> +	struct track *p = object + get_info_end(s);
> 
>  	return p + alloc;

Yes, I think that's an improvement.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ