VirtualBox

Ticket #20178 (closed defect: fixed)

Opened 3 months ago

Last modified 3 days ago

Building DKMS modules fails with some kernel configs, when using binutils 2.36

Reported by: nanana Owned by:
Component: other Version: VirtualBox 6.1.18
Keywords: Cc:
Guest type: other Host type: Linux

Description

Building DKMS modules on Arch linux fails after upgrading to binutils 2.36, against custom configured kernel, while building against a kernel built with the default Arch Linux kernel config works without issues.

I haven't managed to narrow down the specific configuration that causes the build to fail, but since the issue wasn't present with earlier binutils versions, I'd imagine this was something that should be fixed in the DKMS modules.

Based on the build error, and an kernel commit to fix a similar error ( https://git.kernel.org/linus/5e6dca82bcaa49348f9e5fcb48df4881f6d6c4ae), I think this might be related to this binutils commit:  https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d1bcae833b32f1408485ce69f844dcd7ded093a8. Although I must admit I have very little understanding about what this change does, so I could be completely wrong.

Logs from the failing build:

DKMS make.log for vboxhost-6.1.18_OSE for kernel 5.10.13-ooo (x86_64)
Mon  8 Feb 03:18:29 EET 2021
make: Entering directory '/usr/src/linux-5.10'
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetflt/linux/VBoxNetFlt-linux.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetflt/VBoxNetFlt.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetadp/linux/VBoxNetAdp-linux.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/linux/SUPDrv-linux.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetadp/VBoxNetAdp.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetflt/SUPR0IdcClient.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPDrv.o
  LD [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetadp/vboxnetadp.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetflt/SUPR0IdcClientComponent.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPDrvGip.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetflt/linux/SUPR0IdcClient-linux.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPDrvSem.o
  LD [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxnetflt/vboxnetflt.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPDrvTracer.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPLibAll.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/r0drv/alloc-r0drv.o
  CC [M]  /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/r0drv/initterm-r0drv.o
/var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPDrvTracer.o: warning: objtool: supdrvTracerProbeFireStub() is missing an ELF size annotation
/var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPDrvTracer.o: warning: objtool: missing symbol for insn at offset 0x0

make[2]: *** [scripts/Makefile.build:279: /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPDrvTracer.o] Error 255
make[2]: *** Deleting file '/var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv/SUPDrvTracer.o'
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [scripts/Makefile.build:496: /var/lib/dkms/vboxhost/6.1.18_OSE/build/vboxdrv] Error 2
make: *** [Makefile:1805: /var/lib/dkms/vboxhost/6.1.18_OSE/build] Error 2
make: Leaving directory '/usr/src/linux-5.10'

The working kernel config is available here  https://github.com/archlinux/svntogit-packages/blob/37abf96cac628b7f516c266a8c0288671ed96a2a/trunk/config

The kernel config that results in this issue here:  https://pastebin.com/Wtyp2iqJ

Related thread in Arch Linux forums:  https://bbs.archlinux.org/viewtopic.php?pid=1954957

Change History

comment:1 Changed 2 months ago by eyesee

I also stumbled upon a similar error message, which I suspect to be related to this issue:

   ./tools/objtool/objtool orc generate  --module --no-fp --retpoline --uaccess /var/tmp/portage/app-emulation/virtualbox-modules-6.1.18/work/virtualbox-modules-6.1.18/vboxdrv/SUPDrvTracer.o
/var/tmp/portage/app-emulation/virtualbox-modules-6.1.18/work/virtualbox-modules-6.1.18/vboxdrv/SUPDrvTracer.o: warning: objtool: .text+0x7: indirect jump found in RETPOLINE build
/var/tmp/portage/app-emulation/virtualbox-modules-6.1.18/work/virtualbox-modules-6.1.18/vboxdrv/SUPDrvTracer.o: warning: objtool: supdrvTracerProbeFireStub() is missing an ELF size annotation
/var/tmp/portage/app-emulation/virtualbox-modules-6.1.18/work/virtualbox-modules-6.1.18/vboxdrv/SUPDrvTracer.o: warning: objtool: missing symbol for insn at offset 0x0

make[3]: *** [scripts/Makefile.build:284: /var/tmp/portage/app-emulation/virtualbox-modules-6.1.18/work/virtualbox-modules-6.1.18/vboxdrv/SUPDrvTracer.o] Error 255

So far local patching vboxdrv/SUPDrvTracer.c with code from  https://forums.virtualbox.org/viewtopic.php?f=7&t=101686# helped to compile successfully with my customized 5.10.13 kernel and both binutils 2.35.2 and 2.36.1. This for sure is just a try and error finding as I have to admit I do not understand this problem to its full extend. It could be a bad idea to discard the retpoline mitigation.

Applied patch:

--- vboxdrv/SUPDrvTracer.c    2020-02-20 14:23:59.000000000 +0100
+++ vboxdrv/SUPDrvTracer.c    2021-03-19 08:44:27.953262434 +0100
@@ -1479,6 +1479,10 @@
 # if   defined(RT_ARCH_AMD64)
 __asm__(" \
             movq    g_pfnSupdrvProbeFireKernel(%rip), %rax                  \n\
+999:\n\
+            .pushsection .discard.retpoline_safe\n\
+            .quad 999b\n\
+            .popsection\n\
             jmp     *%rax \n\
 ");
 # elif defined(RT_ARCH_X86)

comment:2 Changed 3 weeks ago by eyesee

Problem seems resolved for me with Debian Kernel 5.10.28_p1 and Virtualbox modules 6.1.20 on Funtoo Linux 1.4.

I can not tell if it is resolved for Arch Linux aswell.

comment:3 Changed 3 days ago by klaus

  • Status changed from new to closed
  • Resolution set to fixed

It is resolved in VirtualBox 6.1.20 and later. Using a different solution than the proposed one. What matters is that it works.

Note: See TracTickets for help on using tickets.

www.oracle.com
ContactPrivacy policyTerms of Use