Re: [linux-next:master] [init] b8de39bd1b: BUG:kernel_failed_in_early-boot_stage,last_printk:early_console_in_setup_code

From: Nam Cao
Date: Mon Apr 22 2024 - 06:18:22 EST


On Mon, Apr 22, 2024 at 12:18:46PM +0300, Mike Rapoport wrote:
> The kernel config here has CONFIG_DEBUG_VIRTUAL=y, so __pa translates to
> __phys_addr() in arch/x86/mm/physaddr.c and __pa(-PAGE_SIZE) triggers
>
> VIRTUAL_BUG_ON(y >= KERNEL_IMAGE_SIZE);

RISCV also has a similar thing when CONFIG_DEBUG_VIRTUAL=y

>
> x86 has __pa_nodebug() that does not do bounds check, but it cannot be used
> in generic code because no other arch except s390 define it.
>
> For now I don't have ideas how to make this work in the general case, so
> probably we should only fix riscv for now.

Agree, let's just fix riscv for now. This time I will cook up something
safer, no more __pa() on a potentially invalid address.

Best regards,
Nam