linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alexander Potapenko <glider@google.com>
Cc: Andrey Konovalov <adech.fo@gmail.com>,
	Christoph Lameter <cl@linux.com>,
	Dmitriy Vyukov <dvyukov@google.com>,
	Andrey Ryabinin <ryabinin.a.a@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	JoonSoo Kim <js1304@gmail.com>,
	Kostya Serebryany <kcc@google.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [PATCH v5 7/7] mm: kasan: Initial memory quarantine implementation
Date: Thu, 10 Mar 2016 12:14:26 -0800	[thread overview]
Message-ID: <20160310121426.b667420195a19ee17503ae2d@linux-foundation.org> (raw)
In-Reply-To: <CAG_fn=UkgkHw5Ed72hPkYYzhXcH5gy5ubTeS8SvggvzZDxFdJw@mail.gmail.com>

On Thu, 10 Mar 2016 14:50:56 +0100 Alexander Potapenko <glider@google.com> wrote:

> On Wed, Mar 9, 2016 at 9:21 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Wed,  9 Mar 2016 12:05:48 +0100 Alexander Potapenko <glider@google.com> wrote:
> >
> >> Quarantine isolates freed objects in a separate queue. The objects are
> >> returned to the allocator later, which helps to detect use-after-free
> >> errors.
> >
> > I'd like to see some more details on precisely *how* the parking of
> > objects in the qlists helps "detect use-after-free"?
> When the object is freed, its state changes from KASAN_STATE_ALLOC to
> KASAN_STATE_QUARANTINE. The object is poisoned and put into quarantine
> instead of being returned to the allocator, therefore every subsequent
> access to that object triggers a KASAN error, and the error handler is
> able to say where the object has been allocated and deallocated.
> When it's time for the object to leave quarantine, its state becomes
> KASAN_STATE_FREE and it's returned to the allocator. From now on the
> allocator may reuse it for another allocation.
> Before that happens, it's still possible to detect a use-after free on
> that object (it retains the allocation/deallocation stacks).
> When the allocator reuses this object, the shadow is unpoisoned and
> old allocation/deallocation stacks are wiped. Therefore a use of this
> object, even an incorrect one, won't trigger ASan warning.
> Without the quarantine, it's not guaranteed that the objects aren't
> reused immediately, that's why the probability of catching a
> use-after-free is lower than with quarantine in place.

I see, thanks.  I'll slurp that into the changelog for posterity.

> >> +}
> >
> > We could avoid th4ese ifdefs in the usual way: an empty version of
> > quarantine_remove_cache() if CONFIG_SLAB=n.
> Yes, agreed.
> I am sorry, I don't fully understand the review process now, when
> you've pulled the patches into mm-tree.
> Shall I send the new patch series version, as before, or is anything
> else needs to be done?
> Do I need to rebase against mm- or linux-next? Thanks in advance.

I like to queue a delta patch so I and others can see what changed and
also to keep track of who fixed what and why.  It's a bit harsh on the
reviewers to send them a slightly altered version of a 500 line patch
which they've already read through.

Before sending the patch up to Linus I'll clump everything into a
single patch and a lot of that history is somewhat lost.

Sending a replacement patch is often more convenient for the originator
so that's fine - I'll turn the replacement into a delta locally and
will review then queue that delta.  Also a new revision of a patch has
an altered changelog so I'll manually move that into the older original
patch's changelog immediately.

IOW: either a new patch or a delta is fine.

Your patch is in linux-next now so a diff against -next will work OK.

Probably the easiest thing for you to do is to just alter the patch you
have in-place and send out the new one.  A "[v2" in the Subject: helps
people keep track of things.

--
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:[~2016-03-10 20:14 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 11:05 [PATCH v4 0/7] SLAB support for KASAN Alexander Potapenko
2016-03-09 11:05 ` [PATCH v5 1/7] kasan: Modify kmalloc_large_oob_right(), add kmalloc_pagealloc_oob_right() Alexander Potapenko
2016-03-09 11:05 ` [PATCH v5 2/7] mm, kasan: SLAB support Alexander Potapenko
2016-03-11 11:47   ` Andrey Ryabinin
2016-03-11 13:05     ` Alexander Potapenko
2016-03-11 13:57       ` Andrey Ryabinin
2016-03-09 11:05 ` [PATCH v5 3/7] mm, kasan: Added GFP flags to KASAN API Alexander Potapenko
2016-03-09 11:05 ` [PATCH v5 4/7] arch, ftrace: For KASAN put hard/soft IRQ entries into separate sections Alexander Potapenko
2016-03-09 11:05 ` [PATCH v5 5/7] mm, kasan: Stackdepot implementation. Enable stackdepot for SLAB Alexander Potapenko
2016-03-09 20:09   ` Andrew Morton
2016-03-10 14:00     ` Alexander Potapenko
2016-03-09 11:05 ` [PATCH v5 6/7] kasan: Test fix: Warn if the UAF could not be detected in kmalloc_uaf2 Alexander Potapenko
2016-03-09 11:05 ` [PATCH v5 7/7] mm: kasan: Initial memory quarantine implementation Alexander Potapenko
2016-03-09 20:21   ` Andrew Morton
2016-03-10 13:50     ` Alexander Potapenko
2016-03-10 20:14       ` Andrew Morton [this message]
2016-03-11 10:05         ` Alexander Potapenko
2016-03-11 17:12       ` Alexander Potapenko
2016-03-09 11:12 ` [PATCH v4 0/7] SLAB support for KASAN Alexander Potapenko
2016-03-09 20:23 ` [PATCH v5 " Andrew Morton
2016-03-10 17:01   ` Andrey Ryabinin

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=20160310121426.b667420195a19ee17503ae2d@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adech.fo@gmail.com \
    --cc=cl@linux.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=js1304@gmail.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rostedt@goodmis.org \
    --cc=ryabinin.a.a@gmail.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