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

From: Mike Rapoport
Date: Mon Apr 22 2024 - 05:20:54 EST


On Mon, Apr 22, 2024 at 10:29:42AM +0200, Nam Cao wrote:
> On Mon, Apr 22, 2024 at 03:45:00PM +0800, kernel test robot wrote:
> > kernel test robot noticed "BUG:kernel_failed_in_early-boot_stage,last_printk:early_console_in_setup_code" on:
> >
> > commit: b8de39bd1b76faffe7cd91e148a6d7d9bf4e38f7 ("init: fix allocated page overlapping with PTR_ERR")
> > https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
>
> I can reproduce the problem. I rebased this commit onto v6.8.7, I can still
> observe the problem.
>
> No immediate idea what is the problem. Backtrace from gdb goes crazy:
>
> (gdb) bt
> #0 0xffffffffb2074ded in ?? ()
> #1 0x00000000000000a1 in ?? ()
> #2 0x00000000000000a1 in ?? ()
> #3 0x000000007ffff000 in ?? ()
> #4 0x00000000543ff000 in ?? ()
> #5 0x0000000000000000 in ?? ()

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);

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.

> @akpm: drop this commit until this is figured out?
>
> Best regards,
> Nam
>

--
Sincerely yours,
Mike.