From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Qian Cai <cai@lca.pw>, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] page_poison: play nicely with KASAN
Date: Tue, 15 Jan 2019 20:25:20 +0300 [thread overview]
Message-ID: <3a2aefb4-f108-5354-ddb9-7a35d8e0b3f2@virtuozzo.com> (raw)
In-Reply-To: <20190114233405.67843-1-cai@lca.pw>
On 1/15/19 2:34 AM, Qian Cai wrote:
> KASAN does not play well with the page poisoning
> (CONFIG_PAGE_POISONING). It triggers false positives in the allocation
> path,
>
> BUG: KASAN: use-after-free in memchr_inv+0x2ea/0x330
> Read of size 8 at addr ffff88881f800000 by task swapper/0
> CPU: 0 PID: 0 Comm: swapper Not tainted 5.0.0-rc1+ #54
> Call Trace:
> dump_stack+0xe0/0x19a
> print_address_description.cold.2+0x9/0x28b
> kasan_report.cold.3+0x7a/0xb5
> __asan_report_load8_noabort+0x19/0x20
> memchr_inv+0x2ea/0x330
> kernel_poison_pages+0x103/0x3d5
> get_page_from_freelist+0x15e7/0x4d90
>
> because KASAN has not yet unpoisoned the shadow page for allocation
> before it checks memchr_inv() but only found a stale poison pattern.
>
> Also, false positives in free path,
>
> BUG: KASAN: slab-out-of-bounds in kernel_poison_pages+0x29e/0x3d5
> Write of size 4096 at addr ffff8888112cc000 by task swapper/0/1
> CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.0.0-rc1+ #55
> Call Trace:
> dump_stack+0xe0/0x19a
> print_address_description.cold.2+0x9/0x28b
> kasan_report.cold.3+0x7a/0xb5
> check_memory_region+0x22d/0x250
> memset+0x28/0x40
> kernel_poison_pages+0x29e/0x3d5
> __free_pages_ok+0x75f/0x13e0
>
> due to KASAN adds poisoned redzones around slab objects, but the page
> poisoning needs to poison the whole page.
>
> Signed-off-by: Qian Cai <cai@lca.pw>
> ---
>
Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
prev parent reply other threads:[~2019-01-15 17:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 22:36 [PATCH] page_poison: plays nicely with KASAN Qian Cai
2019-01-11 18:45 ` Andrey Ryabinin
2019-01-14 23:34 ` [PATCH v2] page_poison: play " Qian Cai
2019-01-15 17:25 ` Andrey Ryabinin [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=3a2aefb4-f108-5354-ddb9-7a35d8e0b3f2@virtuozzo.com \
--to=aryabinin@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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).