public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Nylon Chen <nylon7@andestech.com>
To: <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>
Cc: aou@eecs.berkeley.edu, nickhu@andestech.com,
	alankao@andestech.com, kasan-dev@googlegroups.com,
	nylon7@andestech.com, nylon7717@gmail.com,
	aryabinin@virtuozzo.com, glider@google.com,
	paul.walmsley@sifive.com, palmer@dabbelt.com, dvyukov@google.com
Subject: [PATCH 0/1] kasan: support backing vmalloc space for riscv
Date: Wed, 13 Jan 2021 10:28:21 +0800	[thread overview]
Message-ID: <20210113022822.9230-1-nylon7@andestech.com> (raw)

This patchset is support KASAN_VMALLOC in riscv.

We reference x86/s390 mailing list discussion for our implement.
https://lwn.net/Articles/797950/

It's also pass `vmalloc-out-of-bounds` of test_kasan.ko

log:
[  235.834318]     # Subtest: kasan
[  235.835190]     1..37
[  235.845238]
==================================================================
[  235.847818] BUG: KASAN: slab-out-of-bounds in
kmalloc_oob_right+0xe2/0x192 [test_kasan]
[  235.850688] Write of size 1 at addr ffffffe0075d5a7b by task
kunit_try_catch/125
[  235.852630]
[  235.853212] CPU: 0 PID: 125 Comm: kunit_try_catch Tainted: G    B
5.11.0-rc3-13940-gb0bb4cd86282-dirty #1
...
[  241.835850]
==================================================================
[1154/67143]
[  241.840884]     ok 36 - kmalloc_double_kzfree
[  241.852642]
==================================================================
[  241.857261] BUG: KASAN: vmalloc-out-of-bounds in
vmalloc_oob+0xcc/0x17c [test_kasan]
[  241.861327] Read of size 1 at addr ffffffd00407ec1c by task
kunit_try_catch/161
[  241.864525]
[  241.865200] CPU: 0 PID: 161 Comm: kunit_try_catch Tainted: G    B
5.11.0-rc3-13940-gb0bb4cd86282-dirty #1
[  241.869887] Call Trace:
[  241.870972] [<ffffffe0000052d2>] walk_stackframe+0x0/0x128
[  241.873353] [<ffffffe000abcff0>] show_stack+0x32/0x3e
[  241.875457] [<ffffffe000ac0d46>] dump_stack+0x84/0xa0
[  241.877806] [<ffffffe000188926>]
print_address_description.constprop.0+0x88/0x362
[  241.881150] [<ffffffe000188e4a>] kasan_report+0x176/0x194
[  241.883604] [<ffffffe000189390>] __asan_load1+0x42/0x4a
[  241.885897] [<ffffffdf81f9f2f4>] vmalloc_oob+0xcc/0x17c [test_kasan]
[  241.889458] [<ffffffdf81f91e8e>] kunit_try_run_case+0x80/0x11a
[kunit]
[  241.892665] [<ffffffdf81f92e16>]
kunit_generic_run_threadfn_adapter+0x2c/0x4e [kunit]
[  241.896568] [<ffffffe000034ac4>] kthread+0x206/0x222
[  241.899219] [<ffffffe00000361a>] ret_from_exception+0x0/0xc
[  241.901700]
[  241.902497]
[  241.903257] Memory state around the buggy address:
[  241.905430]  ffffffd00407eb00: 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00
[  241.908661]  ffffffd00407eb80: 00 00 00 00 00 00 00 f8 f8 f8 f8 f8 f8
f8 f8 f8
[  241.911841] >ffffffd00407ec00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
f8 f8 f8
[  241.915037]                             ^
[  241.916053]  ffffffd00407ec80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
f8 f8 f8
[  241.919272]  ffffffd00407ed00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8
f8 f8 f8
[  241.922417]
==================================================================
[  242.073698]     ok 37 - vmalloc_oob


Nylon Chen (1):
  riscv/kasan: add KASAN_VMALLOC support

 arch/riscv/Kconfig         |  1 +
 arch/riscv/mm/kasan_init.c | 66 +++++++++++++++++++++++++++++++++++++-
 2 files changed, 66 insertions(+), 1 deletion(-)

-- 
2.17.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

             reply	other threads:[~2021-01-13  2:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13  2:28 Nylon Chen [this message]
2021-01-13  2:28 ` [PATCH 1/1] riscv/kasan: add KASAN_VMALLOC support Nylon Chen
2021-01-15  2:24   ` Palmer Dabbelt

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=20210113022822.9230-1-nylon7@andestech.com \
    --to=nylon7@andestech.com \
    --cc=alankao@andestech.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=nickhu@andestech.com \
    --cc=nylon7717@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.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