Public bug reported:

I am running on QEMU riscv64 with upstream OpenSBI and U-Boot.

$ lsb_release -rd
Description:    Ubuntu 21.04
Release:        21.04

In U-Boot I define a boot option and boot via UEFI:

efidebug boot add -b 0001 Ubuntu virtio 0:1 boot/vmlinuz-5.11.0-1008-generic -i 
virtio 0:1 boot/initrd.img-5.11.0-1008-generic -s 
'root=UUID=386038e2-e47c-49db-a74b-db2e730fa494 earlycon console=ttyS0'
efidebug boot order 0001
bootefi bootmgr

Loading the initial RAM disk fails due to a bug in the EFI kernel stub:

U-Boot's implementation of the EFI_LOAD_FILE2_PROTOCOL is called with
buffer=NULL, *buffer_size=0 and returns the buffer size and status code
EFI_BUFFER_TOO_SMALL. Now the upstream kernel code would allocate the
memory and call the protocol a second time. But the Ubuntu kernel does
not allocate memory.

I added '#define DEBUG 1' to U-Boot's efi_memory.c to efi_load_initrd.c
to get more output:

Linux version 5.11.0-1008-generic (buildd@riscv64-qemu-lcy01-015) (gcc (Ubuntu 
10.3.0-1ubuntu1)
EFI: Entry efi_load_file2_initrd(00000000fffd98e8, 00000000fbe54f7c, 0, 
00000000ff73f3e0, 0000000000000000)
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 7 no
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
  EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 7 no
  EFI: Call: f->close(f)
  EFI: 0 returned by f->close(f)
EFI: Exit: efi_load_file2_initrd: 5
EFI stub: ERROR: Failed to load initrd!
EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 2 yes

When using a Debian kernel everything works as expected:

Linux version 5.10.0-7-riscv64 (debian-ker...@lists.debian.org) (gcc-10 (Debian 
10.2.1-6)
EFI: Entry efi_load_file2_initrd(00000000fffd98e8, 00000000fcd10afc, 0, 
00000000ff73dd30, 0000000000000000)
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 7 no
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
  EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 7 no
  EFI: Call: f->close(f)
  EFI: 0 returned by f->close(f)
EFI: Exit: efi_load_file2_initrd: 5
EFI: efi_add_memory_map_pg: 0x88c9d000 0x7562 2 yes
EFI: Entry efi_load_file2_initrd(00000000fffd98e8, 00000000fcd10afc, 0, 
00000000ff73dd30, 0000000088c9d000)
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 0 yes
  EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 7 no
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
  EFI: Call: f->read(f, &bs, (void *)(uintptr_t)buffer)
  EFI: 0 returned by f->read(f, &bs, (void *)(uintptr_t)buffer)
  EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 7 no
  EFI: Call: f->close(f)
  EFI: 0 returned by f->close(f)
EFI: Exit: efi_load_file2_initrd: 0

Best regards

Heinrich

ProblemType: Bug
DistroRelease: Ubuntu 21.04
Package: linux-image-5.11.0-1008-generic 5.11.0-1008.8
Uname: Linux 5.10.0-7-riscv64 riscv64
ApportVersion: 2.20.11-0ubuntu65
Architecture: riscv64
CasperMD5CheckResult: unknown
Date: Tue May 25 17:13:44 2021
ProcCpuinfoMinimal:
 processor      : 2
 hart           : 1
 isa            : rv64imafdcsu
 mmu            : sv48
SourcePackage: linux-riscv
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: linux-riscv (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: apport-bug hirsute riscv64 uec-images

-- 
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/1929594

Title:
  linux-image-5.11.0-1008-generic: cannot read initrd via
  EFI_LOAD_FILE2_PROTOCOL

Status in linux-riscv package in Ubuntu:
  New

Bug description:
  I am running on QEMU riscv64 with upstream OpenSBI and U-Boot.

  $ lsb_release -rd
  Description:    Ubuntu 21.04
  Release:        21.04

  In U-Boot I define a boot option and boot via UEFI:

  efidebug boot add -b 0001 Ubuntu virtio 0:1 boot/vmlinuz-5.11.0-1008-generic 
-i virtio 0:1 boot/initrd.img-5.11.0-1008-generic -s 
'root=UUID=386038e2-e47c-49db-a74b-db2e730fa494 earlycon console=ttyS0'
  efidebug boot order 0001
  bootefi bootmgr

  Loading the initial RAM disk fails due to a bug in the EFI kernel
  stub:

  U-Boot's implementation of the EFI_LOAD_FILE2_PROTOCOL is called with
  buffer=NULL, *buffer_size=0 and returns the buffer size and status
  code EFI_BUFFER_TOO_SMALL. Now the upstream kernel code would allocate
  the memory and call the protocol a second time. But the Ubuntu kernel
  does not allocate memory.

  I added '#define DEBUG 1' to U-Boot's efi_memory.c to
  efi_load_initrd.c to get more output:

  Linux version 5.11.0-1008-generic (buildd@riscv64-qemu-lcy01-015) (gcc 
(Ubuntu 10.3.0-1ubuntu1)
  EFI: Entry efi_load_file2_initrd(00000000fffd98e8, 00000000fbe54f7c, 0, 
00000000ff73f3e0, 0000000000000000)
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 7 no
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
    EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 7 no
    EFI: Call: f->close(f)
    EFI: 0 returned by f->close(f)
  EFI: Exit: efi_load_file2_initrd: 5
  EFI stub: ERROR: Failed to load initrd!
  EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 2 yes

  When using a Debian kernel everything works as expected:

  Linux version 5.10.0-7-riscv64 (debian-ker...@lists.debian.org) (gcc-10 
(Debian 10.2.1-6)
  EFI: Entry efi_load_file2_initrd(00000000fffd98e8, 00000000fcd10afc, 0, 
00000000ff73dd30, 0000000000000000)
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 7 no
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
    EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 7 no
    EFI: Call: f->close(f)
    EFI: 0 returned by f->close(f)
  EFI: Exit: efi_load_file2_initrd: 5
  EFI: efi_add_memory_map_pg: 0x88c9d000 0x7562 2 yes
  EFI: Entry efi_load_file2_initrd(00000000fffd98e8, 00000000fcd10afc, 0, 
00000000ff73dd30, 0000000088c9d000)
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 0 yes
    EFI: efi_add_memory_map_pg: 0xfe71d000 0x1 7 no
    EFI: efi_add_memory_map_pg: 0xfe71f000 0x1 7 no
    EFI: Call: f->read(f, &bs, (void *)(uintptr_t)buffer)
    EFI: 0 returned by f->read(f, &bs, (void *)(uintptr_t)buffer)
    EFI: efi_add_memory_map_pg: 0xfe71e000 0x1 7 no
    EFI: Call: f->close(f)
    EFI: 0 returned by f->close(f)
  EFI: Exit: efi_load_file2_initrd: 0

  Best regards

  Heinrich

  ProblemType: Bug
  DistroRelease: Ubuntu 21.04
  Package: linux-image-5.11.0-1008-generic 5.11.0-1008.8
  Uname: Linux 5.10.0-7-riscv64 riscv64
  ApportVersion: 2.20.11-0ubuntu65
  Architecture: riscv64
  CasperMD5CheckResult: unknown
  Date: Tue May 25 17:13:44 2021
  ProcCpuinfoMinimal:
   processor    : 2
   hart         : 1
   isa          : rv64imafdcsu
   mmu          : sv48
  SourcePackage: linux-riscv
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux-riscv/+bug/1929594/+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

Reply via email to