Vboxdrv compilation SUPDrvTracer RETPOLINE on 5.10.x?

Discussions related to using VirtualBox on Linux hosts.

Vboxdrv compilation SUPDrvTracer RETPOLINE on 5.10.x?

Postby segaloco » 6. Feb 2021, 07:07

Just wanted to share an observation I've made compiling the host drivers on Linux 5.10.13. I've just upgraded from 5.10.0, which seemed to handle the drivers for 6.1.16 well. I pulled down 6.1.18 and found that vboxdrv/SUPDrvTracer.c wouldn't compile, with objtool giving the following:

Code: Select all   Expand viewCollapse view
/opt/VirtualBox/src/vboxhost/vboxdrv/SUPDrvTracer.o: warning: objtool: .text+0x7: indirect jump found in RETPOLINE build
/opt/VirtualBox/src/vboxhost/vboxdrv/SUPDrvTracer.o: warning: objtool: supdrvTracerProbeFireStub() is missing an ELF size annotation
/opt/VirtualBox/src/vboxhost/vboxdrv/SUPDrvTracer.o: warning: objtool: missing symbol for insn at offset 0x0


Did a bit of searching and found that this is related to Spectre mitigations that were introduced in the 5.10 line. I don't think these were in 5.10.0, because I recall no issues in compiling the drivers. Anywho, it seems the solution in my case was to add the following immediately preceding the indirect jump at SUPR0TracerFireProbe in vboxdrv/SUPDrvTracer.c (line 1482 in my file):

Code: Select all   Expand viewCollapse view
999:
    .pushsection .discard.retpoline_safe
    .quad 999b
    .popsection


I'd supply a patch if I knew the right combination of headers and bitness abstractions to apply here, but locally this is just clobbered together to work on my machine. Hopefully this helps someone else experiencing the same issue though and eventually makes it into a real upstream patch.
segaloco
 
Posts: 1
Joined: 6. Feb 2021, 06:53
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: Windows XP, Windows 98SE, FreeBSD

Re: Vboxdrv compilation SUPDrvTracer RETPOLINE on 5.10.x?

Postby mrvanes » 15. Apr 2021, 13:57

You, friend, saved my day!
Thx!
mrvanes
 
Posts: 16
Joined: 8. Aug 2010, 21:20
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: WinXP


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 12 guests