mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Ryabinin <aryabinin@virtuozzo.com>
To: Fengguang Wu <fengguang.wu@intel.com>, linux-kernel@vger.kernel.org
Cc: Petr Mladek <pmladek@suse.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Aleksey Makarov <aleksey.makarov@linaro.org>,
	Ingo Molnar <mingo@kernel.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Dmitry Vyukov <dvyukov@google.com>,
	Alexander Potapenko <glider@google.com>
Subject: Re: [devkmsg_write] BUG: KASAN: slab-out-of-bounds in copyin+0xea/0x170
Date: Tue, 7 Nov 2017 15:06:53 +0300	[thread overview]
Message-ID: <51c8afc1-263a-ed9a-855a-761e44a6f158@virtuozzo.com> (raw)
In-Reply-To: <20171107093921.ulnjqoaycig5qqoy@wfg-t540p.sh.intel.com>



On 11/07/2017 12:39 PM, Fengguang Wu wrote:
> Hello,
> 
> FYI this happens in v4.14-rc8 -- it's not necessarily a new bug.
> 
> [   22.184920] Freeing unused kernel memory: 824K
> [   22.199198] Freeing unused kernel memory: 1436K
> [   22.228460] x86/mm: Checked W+X mappings: passed, no W+X pages found.
> [   22.230474] rodata_test: all tests were successful
> [   22.254830] ==================================================================
> [   22.257125] BUG: KASAN: slab-out-of-bounds in copyin+0xea/0x170
> [   22.258648] Write of size 26 at addr ffff880013432540 by task init/1
> [   22.260272] 


It says that we write 26 bytes starting from ffff880013432540.

But according to the dump of shadow memory:

[   22.297667] >ffff880013432500: fc fc fb fb fb fb fc fc 00 00 00 03 fc fc fb fb
[   22.298581]                                                     ^


we have allocated 27 bytes at address stating from ffff880013432540.
So this looks like a false positive. I've seen reports like this before:
https://lkml.kernel.org/r/<5163c242-4bbe-7fec-ab58-9c360abf0afd@virtuozzo.com>
https://lkml.kernel.org/r/<899f0c39-81b5-5d02-5ced-937884d22c89@gmail.com>

This happens only on old gcc versions, in your case it's 4.6:
[    0.000000] Linux version 4.14.0-rc8 (kbuild@lkp-wsx01) (gcc version 4.6.4 (Debian 4.6.4-7)) #14 SMP PREEMPT Tue Nov 7 06:50:21 CST 2017

Old GCC is misscompiling something in check_memory_region() which cause false-positive like this one.
I never bothered to dig it deeper, because I've never seen this with GCC versions (>= 4.9.2) that actually support KASAN.
It's almost pointless to use KASAN=y kernel built with old GCC. All memory accesses, except manually instrumented with kasan_check_[read|write](),
won't be checked. 

  parent reply	other threads:[~2017-11-07 12:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-07  9:39 Fengguang Wu
2017-11-07 10:45 ` Sergey Senozhatsky
2017-11-07 11:09   ` Dmitry Vyukov
2017-11-07 12:05     ` Sergey Senozhatsky
2017-11-07 11:59   ` Sergey Senozhatsky
2017-11-07 12:12     ` Andrey Ryabinin
2017-11-07 12:06 ` Andrey Ryabinin [this message]
2017-11-07 12:06   ` Fengguang Wu

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=51c8afc1-263a-ed9a-855a-761e44a6f158@virtuozzo.com \
    --to=aryabinin@virtuozzo.com \
    --cc=akpm@linux-foundation.org \
    --cc=aleksey.makarov@linaro.org \
    --cc=dvyukov@google.com \
    --cc=fengguang.wu@intel.com \
    --cc=glider@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®