Skip to content

Don't free breakpoints racing the debugger walk#52

Merged
desertkun merged 1 commit into
masterfrom
fix-breakpoint-free-race
Jun 9, 2026
Merged

Don't free breakpoints racing the debugger walk#52
desertkun merged 1 commit into
masterfrom
fix-breakpoint-free-race

Conversation

@morozov

@morozov morozov commented Jun 9, 2026

Copy link
Copy Markdown
Member

On gdb client disconnect the network thread freed the breakpoint list directly; if the emulator was running this raced debugger_check()'s walk on the emulator thread, dereferencing a freed breakpoint (EXC_BAD_ACCESS in breakpoint_check). The cleanup now frees directly only while the emulator is parked (gdbserver_trapped), otherwise defers the free to the emulator thread via debugger_breakpoints_remove_pending, honored at a safe point in debugger_check().

Prevent the use-after-free crash when a gdb client disconnects while
the emulator is running.
@desertkun desertkun merged commit 1673f32 into master Jun 9, 2026
2 checks passed
@desertkun desertkun deleted the fix-breakpoint-free-race branch June 9, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants