From: "Chunhui Li (李春辉)" <chunhui.li@mediatek.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: "Catalin Marinas" <catalin.marinas@arm.com>,
"Will Deacon" <will.deacon@arm.com>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
"Marc Zyngier" <marc.zyngier@arm.com>,
"Ard Biesheuvel" <ard.biesheuvel@linaro.org>,
"James Morse" <james.morse@arm.com>,
"Masahiro Yamada" <yamada.masahiro@socionext.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
wsd_upstream <wsd_upstream@mediatek.com>,
"Miles Chen (陳民樺)" <Miles.Chen@mediatek.com>,
"Walter-ZH Wu (吳祖寰)" <Walter-ZH.Wu@mediatek.com>,
"Yu Liang (梁宇)" <Yu.Liang@mediatek.com>,
"Nicholas Tang (鄭秦輝)" <nicholas.tang@mediatek.com>
Subject: 答复: 答复: [PATCH] kasan: avoid out-of-bounds in unwind_frame
Date: Wed, 10 Oct 2018 11:20:16 +0000 [thread overview]
Message-ID: <a96f9343ed35422498432cc24405f39b@MTKMBS32N1.mediatek.inc> (raw)
In-Reply-To: <20181010092618.pwkrqqw7br7762rs@lakrids.cambridge.arm.com>
Hi Mark,
Ok, thanks for your help
Best regards,
Chunhui Li
-----邮件原件-----
发件人: Mark Rutland [mailto:mark.rutland@arm.com]
发送时间: 2018年10月10日 17:26
收件人: Chunhui Li (李春辉)
抄送: Catalin Marinas; Will Deacon; Matthias Brugger; Marc Zyngier; Ard Biesheuvel; James Morse; Masahiro Yamada; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; linux-mediatek@lists.infradead.org; wsd_upstream; Miles Chen (陳民樺); Walter-ZH Wu (吳祖寰); Yu Liang (梁宇); Nicholas Tang (鄭秦輝)
主题: Re: 答复: [PATCH] kasan: avoid out-of-bounds in unwind_frame
On Wed, Oct 10, 2018 at 06:45:17AM +0000, Chunhui Li (李春辉) wrote:
> Hi Mark,
>
> kasan detect out-of-bounds in stacktrace.c line 70, it's already over
> READ_ONCE_NOCHECK, but still crash
> kernel-4.9/arch/arm64/kernel/stacktrace.c
> 69frame->sp = fp + 0x10;
> 70frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp));
>
> we test on Android platform, kernel-4.9 build with clang 6.0.2, we will do experiment to clarify whether compiler related issue.
>
> READ_ONCE_NOCHECK->__read_once_size_nocheck with __no_sanitize_address
> if enable CONFIG_KASAN
>
> kernel-4.9/include/linux/compiler-gcc.h
> #define __no_sanitize_address __attribute__((no_sanitize_address))
>
> kernel-4.9/include/linux/compiler-clang.h
> #define __no_sanitize_address __attribute__((no_sanitize("address")))
If READ_ONCE_NOCHECK() isn't working as intended, then this is a compiler issue, and there are bigger problems regardless.
If we need to workaround some compiler issue, that should be done in the implementation of READ_ONCE_NOCHECK().
Please note that there are other issues with using clang to compile the kernel; at minimum 7.0.0 is required to build a mainline kernel (and even then, the LSE atomics have to be explicitly disabled), so if this only affects 6.0.x, I don't think we need to carry any workaround upstream.
> there is patch from internet, avoid kasan by wrapping with kasan_disable_current, it seems better.
> https://lore.kernel.org/patchwork/patch/644463
> such as:
> +kasan_disable_current();
> // access fp
> +kasan_enable_current();
Please note that the solution later in the thread [1] was to use READ_ONCE_NOCHECK().
Thanks,
Mark.
[1] https://lore.kernel.org/patchwork/patch/644463/#829858
prev parent reply other threads:[~2018-10-10 11:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1539079863-19645-1-git-send-email-chunhui.li@mediatek.com>
2018-10-09 10:38 ` [PATCH] kasan: avoid out-of-bounds in unwind_frame Mark Rutland
2018-10-10 6:45 ` 答复: " Chunhui Li (李春辉)
2018-10-10 9:26 ` Mark Rutland
2018-10-10 11:20 ` Chunhui Li (李春辉) [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=a96f9343ed35422498432cc24405f39b@MTKMBS32N1.mediatek.inc \
--to=chunhui.li@mediatek.com \
--cc=Miles.Chen@mediatek.com \
--cc=Walter-ZH.Wu@mediatek.com \
--cc=Yu.Liang@mediatek.com \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=nicholas.tang@mediatek.com \
--cc=will.deacon@arm.com \
--cc=wsd_upstream@mediatek.com \
--cc=yamada.masahiro@socionext.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).