Vboxdrv compilation SUPDrvTracer RETPOLINE on 5.10.x?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
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

Vboxdrv compilation SUPDrvTracer RETPOLINE on 5.10.x?

Post by segaloco »

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

/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

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.
mrvanes
Posts: 17
Joined: 8. Aug 2010, 21:20
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: WinXP

Re: Vboxdrv compilation SUPDrvTracer RETPOLINE on 5.10.x?

Post by mrvanes »

You, friend, saved my day!
Thx!
Post Reply