gdb: snapshot restore breaks breakpoints

Offen
#1,972 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust

Rechercherichtung

Start with snapshot() and restore() in the host VM code, then trace how gdb breakpoint state is stored and reapplied. Compare the MSHV and WHP reset_vcpu paths with KVM's kvm_guest_debug handling, using the referenced x86_64.rs files and build.rs as entry points. Done means hardware and software breakpoints behave correctly across snapshot and restore, including when a listed breakpoint is removed afterward.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

S-confirmed
  • Hardware breakpoints are lost on MSHV and WHP. Those backends store gdb hardware breakpoints in the guest's DR0-DR7 (mshv/x86_64.rs#L853, whp/x86_64.rs#L1181). reset_vcpu zeroes those registers (x86_64.rs#L327). gdb still lists the breakpoints. KVM keeps them in kvm_guest_debug, so they survive there.
  • Software breakpoints are written into snapshot memory. gdb builds make snapshot memory writable for this (build.rs#L162).
    • snapshot() captures the 0xCC bytes. After restore nothing tracks them.
    • restore() can remove a breakpoint that sw_breakpoints still lists. Removing it later writes the saved byte over whatever the restored snapshot holds at that address.

Possible fix: keep breakpoint state on the host and apply it again after restore(). Take software breakpoints out before snapshot().

Vorherrschende Sprache
Rust
Sterne
4.8k
Forks
223
Ø Merge
1 T. 18 Std.
Gemergte PRs (30 T.)
65

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus hyperlight-dev/hyperlight

Alle Issues in hyperlight-dev/hyperlight

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.