From: Vitaly Wool <vitalywool@gmail.com>
To: Henry Burns <henryburns@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Matthew Wilcox <mawilcox@microsoft.com>,
Vitaly Vul <vitaly.vul@sony.com>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Xidong Wang <wangxidong_97@163.com>,
Shakeel Butt <shakeelb@google.com>,
Jonathan Adams <jwadams@google.com>,
Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm/z3fold: Fix z3fold_buddy_slots use after free
Date: Tue, 2 Jul 2019 10:45:46 +0300 [thread overview]
Message-ID: <CAMJBoFPbRcdZ+NnX17OQ-sOcCwe+ZAsxcDJoR0KDkgBY9WXvpg@mail.gmail.com> (raw)
In-Reply-To: <20190701173042.221453-1-henryburns@google.com>
Hi Henry,
On Mon, Jul 1, 2019 at 8:31 PM Henry Burns <henryburns@google.com> wrote:
>
> Running z3fold stress testing with address sanitization
> showed zhdr->slots was being used after it was freed.
>
> z3fold_free(z3fold_pool, handle)
> free_handle(handle)
> kmem_cache_free(pool->c_handle, zhdr->slots)
> release_z3fold_page_locked_list(kref)
> __release_z3fold_page(zhdr, true)
> zhdr_to_pool(zhdr)
> slots_to_pool(zhdr->slots) *BOOM*
Thanks for looking into this. I'm not entirely sure I'm all for
splitting free_handle() but let me think about it.
> Instead we split free_handle into two functions, release_handle()
> and free_slots(). We use release_handle() in place of free_handle(),
> and use free_slots() to call kmem_cache_free() after
> __release_z3fold_page() is done.
A little less intrusive solution would be to move backlink to pool
from slots back to z3fold_header. Looks like it was a bad idea from
the start.
Best regards,
Vitaly
next prev parent reply other threads:[~2019-07-02 7:46 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-01 17:30 [PATCH] mm/z3fold: Fix z3fold_buddy_slots use after free Henry Burns
2019-07-02 7:45 ` Vitaly Wool [this message]
2019-07-02 16:56 ` Henry Burns
2019-07-03 6:02 ` Vitaly Wool
2019-07-03 17:18 ` Henry Burns
2019-07-03 20:14 ` Shakeel Butt
2019-07-04 6:59 ` Vitaly Wool
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=CAMJBoFPbRcdZ+NnX17OQ-sOcCwe+ZAsxcDJoR0KDkgBY9WXvpg@mail.gmail.com \
--to=vitalywool@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=henryburns@google.com \
--cc=jwadams@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mawilcox@microsoft.com \
--cc=rppt@linux.vnet.ibm.com \
--cc=shakeelb@google.com \
--cc=vitaly.vul@sony.com \
--cc=wangxidong_97@163.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;
as well as URLs for NNTP newsgroup(s).