Skip to content

Game Session Manager Safety Design

TZ edited this page Aug 26, 2026 · 1 revision

Game Session Manager: Safety Design

Desain pengaman suspend/resume proses Game Session Manager BoneFish, berdasarkan audit kode Bloxstrap/GameSession/.

Konsep

Game Session Manager men-suspend proses yang mengganggu performa game (via aturan GameSessionRule) dan me-restore-nya setelah game ditutup. Karena suspend thread adalah operasi berisiko, seluruh desain berprinsip fail-safe: gagal → tidak menyentuh.

Lapisan Pengaman 1 — Deteksi Security Software

Sebelum sesi dimulai, SecuritySoftwareDetector memeriksa software keamanan (antivirus/EDR):

  • Ok — aman, fitur otomatis aktif penuh.
  • Unavailable — deteksi tidak tersedia; fitur dibatasi.
  • Degraded — software keamanan terdeteksi; auto-select nonaktif (mengubah thread proses AV bisa memicu deteksi).

Auto-select aplikasi "aman" hanya berjalan saat state Ok.

Lapisan Pengaman 2 — CRITICAL-by-Default

ProcessClassifier menolak suspend untuk:

  1. Proses Windows service (SCM) — semua PID dari WMI Win32_Service otomatis CRITICAL (audio stack, driver companion, sync service — termasuk per-user service seperti OneDrive.Sync.Service, GameInputRedistService).
  2. Proses audio vendorRAVBg64, RAVCpl64, RtkNGUI64, RtkAudioService*, Nahimic*, dll. (lihat Troubleshooting Audio).
  3. Proses sendiri & koordinator — tidak pernah men-suspend dirinya sendiri.
  4. Proses CRITICAL bawaan — daftar proses sistem vital.

Lapisan Pengaman 3 — Suspend Terkendali

ProcessSuspensionService.SuspendProcess:

  • MaxSweepPasses = 5 — maksimal 5 pass sweep thread baru.
  • SweepTimeoutPerProcess = 2 detik — batas waktu per proses; lewat batas → berhenti.
  • Pelaporan jujurPartiallySuspended dilaporkan bila ada thread gagal/tertinggal.
  • Thread yang sudah tersuspend tetap dilaporkan walau enumerasi gagal di tengah jalan → bisa di-restore.

Restore dengan Verifikasi Identitas

RestoreProcess memastikan PID yang di-restore adalah proses yang sama yang di-suspend:

  • Bandingkan StartTimeUtc ±1 detik — bila PID sekarang milik proses lain (IdentityMismatch), resume dibatalkan (mencegah resume thread proses yang tidak kita suspend).
  • Verifikasi pasca-resume (2 percobaan × 100 ms): probe IsThreadSuspended per thread; bila masih tersuspend → resume ulang.
  • Thread yang hilang karena proses shutdown normal tidak dianggap failure.

Persistensi & Recovery

  • active.json ditulis sebelum mutasi pertama — interrupt di tengah suspend tetap meninggalkan catatan recovery.
  • Stale recovery guard (v7.2.6) — sesi stale dari handoff tidak salah me-restore sesi baru.
  • Rescue scan — jaring pengaman manual (tombol tray/page): pindai SEMUA proses untuk thread tersuspend dan resume. Hanya atas inisiatif user (probe per-thread memakan waktu).
  • Escape hatch restore — tombol tray untuk restore penuh.
  • Tray watcher selalu aktif (v7.2.7) — pantau game eksternal (suspend/restore otomatis), notifikasi suspend via tray balloon.

Checklist Aman (untuk kontributor)

  1. Jangan pernah men-suspend: service SCM, proses audio vendor, proses security software.
  2. Tambahan ke CRITICAL list wajib lewat audit: proses apa, kenapa vital, bukti kasus.
  3. Setiap perubahan suspend/resume harus lolos verifikasi identitas & verifikasi pasca-resume.