*** This bug is a duplicate of bug 1967130 *** https://bugs.launchpad.net/bugs/1967130
Public bug reported: [ Impact ] The kernel crashes when trying to access the EFI runtime services/variables if the kernel is configured with CONFIG_VMAP_STACK. Indeed, to access EFI variables/services, the kernel switches to the EFI page table which is created during the boot process *but* is never updated during the life of the kernel: as CONFIG_VMAP_STACK allocates the kernel stack in the vmalloc region and maps it in the *kernel page table*, the EFI page table never has this new mapping and then segfaults when trying to access the kernel stack of the current process. This is easier to reproduce on the Unmatched than on QEMU (never reproduced on this platform): ubuntu@ubuntu:~$ cat /sys/firmware/efi/efivars/* Which gives rise to a kernel crash, gdb traces below: (gdb) bt #0 handle_exception () at /home/alex/work/linux/arch/riscv/kernel/entry.S:27 #1 0xffffffff8080741a in efi_virtmap_load () at /home/alex/work/linux/arch/riscv/include/asm/current.h:31 #2 0x0000000000000000 in ?? () (gdb) p/x $stval $1 = 0xffffffc8946cbc38 (gdb) display /i $sepc 1: x/i $sepc 0xffffffff8000392c <handle_exception+44>: sd ra,8(sp) (gdb) p/x $sp $6 = 0xffffffc8946cbc30 A workaround can be to disable CONFIG_VMAP_STACK but actually any mapping in the kernel page table that is not also added to the EFI page table can cause such crash: but I'm not sure this can happen and this workaround was enough in the previous release to fix this bug and to be able to live install a system. I advise to implement this workaround for now as I'm implementing the proper patch which consists in updating the EFI page table before switching to it, just like x86 does. [ Test Plan ] Use a kernel with CONFIG_VMAP_STACK disabled and simply enter the following command, preferably on the Unmatched: ubuntu@ubuntu:~$ cat /sys/firmware/efi/efivars/* This should not trigger a crash. [ Where problems could occur ] As said above, just disabling CONFIG_VMAP_STACK may not be enough. ** Affects: linux-riscv (Ubuntu) Importance: Undecided Status: New ** This bug has been marked a duplicate of bug 1967130 rcu_sched detected stalls on CPUs/tasks -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux-riscv in Ubuntu. https://bugs.launchpad.net/bugs/1992458 Title: Disable VMAP_STACK as it causes crash in EFI Status in linux-riscv package in Ubuntu: New Bug description: [ Impact ] The kernel crashes when trying to access the EFI runtime services/variables if the kernel is configured with CONFIG_VMAP_STACK. Indeed, to access EFI variables/services, the kernel switches to the EFI page table which is created during the boot process *but* is never updated during the life of the kernel: as CONFIG_VMAP_STACK allocates the kernel stack in the vmalloc region and maps it in the *kernel page table*, the EFI page table never has this new mapping and then segfaults when trying to access the kernel stack of the current process. This is easier to reproduce on the Unmatched than on QEMU (never reproduced on this platform): ubuntu@ubuntu:~$ cat /sys/firmware/efi/efivars/* Which gives rise to a kernel crash, gdb traces below: (gdb) bt #0 handle_exception () at /home/alex/work/linux/arch/riscv/kernel/entry.S:27 #1 0xffffffff8080741a in efi_virtmap_load () at /home/alex/work/linux/arch/riscv/include/asm/current.h:31 #2 0x0000000000000000 in ?? () (gdb) p/x $stval $1 = 0xffffffc8946cbc38 (gdb) display /i $sepc 1: x/i $sepc 0xffffffff8000392c <handle_exception+44>: sd ra,8(sp) (gdb) p/x $sp $6 = 0xffffffc8946cbc30 A workaround can be to disable CONFIG_VMAP_STACK but actually any mapping in the kernel page table that is not also added to the EFI page table can cause such crash: but I'm not sure this can happen and this workaround was enough in the previous release to fix this bug and to be able to live install a system. I advise to implement this workaround for now as I'm implementing the proper patch which consists in updating the EFI page table before switching to it, just like x86 does. [ Test Plan ] Use a kernel with CONFIG_VMAP_STACK disabled and simply enter the following command, preferably on the Unmatched: ubuntu@ubuntu:~$ cat /sys/firmware/efi/efivars/* This should not trigger a crash. [ Where problems could occur ] As said above, just disabling CONFIG_VMAP_STACK may not be enough. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux-riscv/+bug/1992458/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp