From: shaolexi <shaolexi@huawei.com>
To: Christophe Leroy <christophe.leroy@c-s.fr>,
"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
"paulus@samba.org" <paulus@samba.org>,
"mpe@ellerman.id.au" <mpe@ellerman.id.au>
Cc: "Wangkefeng \(OS Kernel Lab\)" <wangkefeng.wang@huawei.com>,
"zhangyi \(F\)" <yi.zhang@huawei.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"liucheng \(G\)" <liucheng32@huawei.com>
Subject: Re: [PATCH] powerpc/kasan: KASAN is not supported on RELOCATABLE && FSL_BOOKE
Date: Sat, 30 Nov 2019 02:09:45 +0000 [thread overview]
Message-ID: <448c0af8be2247a780ed42bc401ff50c@huawei.com> (raw)
>Le 29/11/2019 à 08:46, Christophe Leroy a écrit :
>>
>>
>> Le 29/11/2019 à 08:04, Lexi Shao a écrit :
>>> CONFIG_RELOCATABLE and CONFIG_KASAN cannot be enabled at the same
>>> time on ppce500 fsl_booke. All functions called before
>>> kasan_early_init() should be disabled with kasan check. When
>>> CONFIG_RELOCATABLE is enabled on ppce500 fsl_booke, relocate_init()
>>> is called before kasan_early_init() which triggers kasan check and results in boot failure.
>>> Call trace and functions which triggers kasan check(*):
>>> - _start
>>> - set_ivor
>>> - relocate_init(*)
>>> - early_get_first_memblock_info(*)
>>> - of_scan_flat_dt(*)
>>> ...
>>> - kasan_early_init
>>>
>>> Potential solutions could be 1. implement relocate_init and all its
>>> children function in a seperate file or 2. introduce a global
>>> vairable in KASAN, only enable KASAN check when init is done.
>>
>> Solution 1 seems uneasy. of_scan_flat_dt() and children are general
>> functions that can't be set aside.
>> Solution 2 would destroy performance, and would anyway not work with
>> inline instrumentation.
>>
>> Have you tried moving the call to kasan_early_init() before the call
>> of
>> relocate_init() ?
>
>I just tried it with QEMU, it works. I'll send a patch out soon.
>
Yes I tried but couldn't get it to work on a P1010. There might be conflict
somewhere else with my kernel config. Will keep on debugging.
Thanks for the prompt reply and trying it out on qemu.
Lexi
>
>
>> On other PPC32, kasan_early_init() is the first thing done after
>> activating the MMU. But AFAIU, MMU is always active on BOOKE though.
>>
>> Christophe
>>
>>>
>>> Disable KASAN when RELOCATABLE is selected on fsl_booke for now until
>>> it is supported.
>>>
>>> Signed-off-by: Lexi Shao <shaolexi@huawei.com>
>>> ---
>>> arch/powerpc/Kconfig | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index
>>> 3e56c9c2f16e..14f3da63c088 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -171,7 +171,7 @@ config PPC
>>> select HAVE_ARCH_AUDITSYSCALL
>>> select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 &&
>>> PPC_RADIX_MMU
>>> select HAVE_ARCH_JUMP_LABEL
>>> - select HAVE_ARCH_KASAN if PPC32
>>> + select HAVE_ARCH_KASAN if PPC32 && !(RELOCATABLE &&
>>> FSL_BOOKE)
>>> select HAVE_ARCH_KGDB
>>> select HAVE_ARCH_MMAP_RND_BITS
>>> select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
>>>
WARNING: multiple messages have this Message-ID (diff)
From: shaolexi <shaolexi@huawei.com>
To: Christophe Leroy <christophe.leroy@c-s.fr>,
"benh@kernel.crashing.org" <benh@kernel.crashing.org>,
"paulus@samba.org" <paulus@samba.org>,
"mpe@ellerman.id.au" <mpe@ellerman.id.au>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Wangkefeng (OS Kernel Lab)" <wangkefeng.wang@huawei.com>,
"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
"liucheng (G)" <liucheng32@huawei.com>,
"zhangyi (F)" <yi.zhang@huawei.com>
Subject: Re: [PATCH] powerpc/kasan: KASAN is not supported on RELOCATABLE && FSL_BOOKE
Date: Sat, 30 Nov 2019 02:09:45 +0000 [thread overview]
Message-ID: <448c0af8be2247a780ed42bc401ff50c@huawei.com> (raw)
>Le 29/11/2019 à 08:46, Christophe Leroy a écrit :
>>
>>
>> Le 29/11/2019 à 08:04, Lexi Shao a écrit :
>>> CONFIG_RELOCATABLE and CONFIG_KASAN cannot be enabled at the same
>>> time on ppce500 fsl_booke. All functions called before
>>> kasan_early_init() should be disabled with kasan check. When
>>> CONFIG_RELOCATABLE is enabled on ppce500 fsl_booke, relocate_init()
>>> is called before kasan_early_init() which triggers kasan check and results in boot failure.
>>> Call trace and functions which triggers kasan check(*):
>>> - _start
>>> - set_ivor
>>> - relocate_init(*)
>>> - early_get_first_memblock_info(*)
>>> - of_scan_flat_dt(*)
>>> ...
>>> - kasan_early_init
>>>
>>> Potential solutions could be 1. implement relocate_init and all its
>>> children function in a seperate file or 2. introduce a global
>>> vairable in KASAN, only enable KASAN check when init is done.
>>
>> Solution 1 seems uneasy. of_scan_flat_dt() and children are general
>> functions that can't be set aside.
>> Solution 2 would destroy performance, and would anyway not work with
>> inline instrumentation.
>>
>> Have you tried moving the call to kasan_early_init() before the call
>> of
>> relocate_init() ?
>
>I just tried it with QEMU, it works. I'll send a patch out soon.
>
Yes I tried but couldn't get it to work on a P1010. There might be conflict
somewhere else with my kernel config. Will keep on debugging.
Thanks for the prompt reply and trying it out on qemu.
Lexi
>
>
>> On other PPC32, kasan_early_init() is the first thing done after
>> activating the MMU. But AFAIU, MMU is always active on BOOKE though.
>>
>> Christophe
>>
>>>
>>> Disable KASAN when RELOCATABLE is selected on fsl_booke for now until
>>> it is supported.
>>>
>>> Signed-off-by: Lexi Shao <shaolexi@huawei.com>
>>> ---
>>> arch/powerpc/Kconfig | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index
>>> 3e56c9c2f16e..14f3da63c088 100644
>>> --- a/arch/powerpc/Kconfig
>>> +++ b/arch/powerpc/Kconfig
>>> @@ -171,7 +171,7 @@ config PPC
>>> select HAVE_ARCH_AUDITSYSCALL
>>> select HAVE_ARCH_HUGE_VMAP if PPC_BOOK3S_64 &&
>>> PPC_RADIX_MMU
>>> select HAVE_ARCH_JUMP_LABEL
>>> - select HAVE_ARCH_KASAN if PPC32
>>> + select HAVE_ARCH_KASAN if PPC32 && !(RELOCATABLE &&
>>> FSL_BOOKE)
>>> select HAVE_ARCH_KGDB
>>> select HAVE_ARCH_MMAP_RND_BITS
>>> select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
>>>
next reply other threads:[~2019-11-30 2:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-30 2:09 shaolexi [this message]
2019-11-30 2:09 ` [PATCH] powerpc/kasan: KASAN is not supported on RELOCATABLE && FSL_BOOKE shaolexi
-- strict thread matches above, loose matches on Subject: below --
2019-11-29 7:04 Lexi Shao
2019-11-29 7:04 ` Lexi Shao
2019-11-29 7:46 ` Christophe Leroy
2019-11-29 7:46 ` Christophe Leroy
2019-11-29 14:13 ` Christophe Leroy
2019-11-29 14:13 ` Christophe Leroy
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=448c0af8be2247a780ed42bc401ff50c@huawei.com \
--to=shaolexi@huawei.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=liucheng32@huawei.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=wangkefeng.wang@huawei.com \
--cc=yi.zhang@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.