linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	"Alasdair G. Kergon" <agk@redhat.com>,
	Mike Snitzer <msnitzer@redhat.com>,
	Milan Broz <gmazyland@gmail.com>,
	kkolasa@winsoft.pl, dm-devel@redhat.com
Subject: Re: [PATCH] slab: implement kmalloc guard
Date: Thu, 16 Oct 2014 10:55:34 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LRH.2.02.1410161049280.25043@file01.intranet.prod.int.rdu2.redhat.com> (raw)
In-Reply-To: <20140915021133.GC2676@js1304-P5Q-DELUXE>



On Mon, 15 Sep 2014, Joonsoo Kim wrote:

> On Thu, Sep 11, 2014 at 10:32:52PM -0400, Mikulas Patocka wrote:
> > 
> > 
> > On Mon, 8 Sep 2014, Christoph Lameter wrote:
> > 
> > > On Mon, 8 Sep 2014, Mikulas Patocka wrote:
> > > 
> > > > I don't know what you mean. If someone allocates 10000 objects with sizes
> > > > from 1 to 10000, you can't have 10000 slab caches - you can't have a slab
> > > > cache for each used size. Also - you can't create a slab cache in
> > > > interrupt context.
> > > 
> > > Oh you can create them up front on bootup. And I think only the small
> > > sizes matter. Allocations >=8K are pushed to the page allocator anyways.
> > 
> > Only for SLUB. For SLAB, large allocations are still use SLAB caches up to 
> > 4M. But anyway - having 8K preallocated slab caches is too much.
> > 
> > If you want to integrate this patch into the slab/slub subsystem, a better 
> > solution would be to store the exact size requested with kmalloc along the 
> > slab/slub object itself (before the preceding redzone). But it would 
> > result in duplicating the work - you'd have to repeat the logic in this 
> > patch three times - once for slab, once for slub and once for 
> > kmalloc_large/kmalloc_large_node.
> > 
> > I don't know if it would be better than this patch.
> 
> Hello,
> 
> Out of bound write could be detected by kernel address asanitizer(KASan).
> See following link.
> 
> https://lkml.org/lkml/2014/9/10/441
> 
> Although this patch also looks good to me, I think that KASan is
> better than this, because it could detect out of bound write and
> has more features for debugging.
> 
> Thanks.

Surely, KAsan detects more bugs. But it has also high overhead. The 
overhead of kmalloc guard is very low.

The kmalloc guard already helped to find one previously unknown bug: 
http://lkml.iu.edu/hypermail/linux/kernel/1409.1/02325.html

Mikulas

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

      reply	other threads:[~2014-10-16 14:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-05 22:54 Mikulas Patocka
2014-09-08 14:36 ` Christoph Lameter
2014-09-08 14:46   ` Mikulas Patocka
2014-09-08 16:10     ` Christoph Lameter
2014-09-12  2:32       ` Mikulas Patocka
2014-09-15  2:11         ` Joonsoo Kim
2014-10-16 14:55           ` Mikulas Patocka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LRH.2.02.1410161049280.25043@file01.intranet.prod.int.rdu2.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=agk@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dm-devel@redhat.com \
    --cc=gmazyland@gmail.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kkolasa@winsoft.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=msnitzer@redhat.com \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox