Re: [lkp-robot] [x86/cpu_entry_area] 10043e02db: kernel_BUG_at_arch/x86/mm/physaddr.c

From: Andrey Ryabinin
Date: Thu Dec 28 2017 - 11:02:46 EST


On 12/27/2017 09:12 PM, Dmitry Vyukov wrote:

>>
>> Not really a problem caused by the patch above, it's merily exposing a code
>> path which relies blindly on "enough memory available" assumptions.
>>
>> Throwing more memory at the VM makes the problem go away...
>
> Hi Thomas,
>
> We just need a check inside of early_alloc() to properly diagnose such
> situation, right?
> KASAN allocates 1/8 of physical memory, so the code has _some_ logic
> behind it. But I guess it runs into a corner case where 1/8 is somehow
> larger than 1 :)
>

We may simply don't have 1/8 available. And we actually need slightly more
than 1/8. Kernel image is present in 2 locations (direct mapping/kernel mapping)
so at least ram/8 + kernel_size/8. The same for cpu_entry_area. Plus some memory
to build page tables.
And note that kernel_size could be hundreds of megabytes.