Opened 7 months ago
Last modified 7 months ago
#22195 new defect
Hardware breakpoints are inconsistent on VirtualBox 7.x when guest is macOS (Intel)
Reported by: | mrindeciso | Owned by: | |
---|---|---|---|
Component: | VMM | Version: | VirtualBox-7.1.2 |
Keywords: | macOS, hardware breakpoint, debug register, DR | Cc: | |
Guest type: | Linux | Host type: | Mac OS X |
Description (last modified by ) ¶
We found a bug with VirtualBox 7.x that happens when the host is macOS (Intel based). We tried with just Ubuntu 24.04 LTS as guest OS, but we strongly suspect this to be guest-independent.
The issue is the following: hardware breakpoints are inconsistent and unreliable, and there seems to be some sort of race in the hypervisor which makes the guest almost always miss the breakpoint.
To reproduce the issue we present a small setup that relies on GDB, and which we tested on a fresh Ubuntu 24.04 LTS install.
Compile the following minimal program using gcc:
// gcc -o test test.c -no-pie int main() { int i, j = 0; for (i = 0; i < 10000; i++) j += i; return 0; }
Create the following GDB script:
file test start hb *0x401121 c c 10000 info b 2
Do note that the address of the hardware breakpoint should be inside the for-loop, this worked for our compilation but obviously it might vary.
Then run gdb like so:
gdb -nx -x script
It should print the number of times the hardware breakpoint was hit, which for this specific for-loop is expected to be 10000.
Our tests, instead, show that the number of hits varies between 3 (!) and 1000, and is usually closer to ~100, which is 1% of the expected amount of hits.
We ran this small setup on three different versions of VirtualBox: 6.1, 7.1.2 and the latest development build, all on the same machine running the same VM image and everything else identical. 6.1 worked as expected and hit the breakpoint 10000 times, whereas the other two versions both showed the bug.
We have attached to this ticket the test files, along with a log of our test running on two different versions of VirtualBox, one that exhibits the bug and one that does not.
Here are the attachments: Gist
Attachments (1)
Change History (4)
by , 7 months ago
comment:1 by , 7 months ago
I didn't know I could upload only a single attachment, so here is the rest of the logs: Gist
comment:2 by , 7 months ago
Description: | modified (diff) |
---|
comment:3 by , 7 months ago
Description: | modified (diff) |
---|
Test Binary