Re: [PATCH] x86/kasan: map shadow for percpu pages on demand
From: Yin, Fengwei
Date: Sun Oct 30 2022 - 20:15:59 EST
On 10/28/2022 10:20 PM, Andrey Ryabinin wrote:
>
>
> On 10/28/22 05:51, Yin, Fengwei wrote:
>> Hi Andrey,
>>
>
>>> void __init kasan_init(void)
>>> {
>>> int i;
>>> @@ -393,9 +405,6 @@ void __init kasan_init(void)
>>> kasan_mem_to_shadow((void *)VMALLOC_END + 1),
>>> shadow_cpu_entry_begin);
>>>
>>> - kasan_populate_shadow((unsigned long)shadow_cpu_entry_begin,
>>> - (unsigned long)shadow_cpu_entry_end, 0);
>>> -
>> There will be address in the range (shadow_cpu_entry_begin, shadow_cpu_entry_end)
>> which has no KASAN shadow mapping populated after the patch. Not sure whether
>> it could be a problem. Thanks.
>>
>
>
> This shouldn't be a problem. It's vital to have shadow *only* for addresses with mapped memory.
> Shadow address accessed only if the address itself accessed. So the difference between not having shadow
> for address with no mapping vs having it, is whether we crash on access to KASAN shadow or crash few
> instructions later on access to the address itself.
Thanks for clarification.
Regards
Yin, Fengwei