agent v0.36.4: serialize AttachDrive/DetachDrive (no double-bind TOCTOU race)
A GuestBinder mutex prevents a concurrent reconnect + periodic reconcile from both passing isHostMountpoint and double-binding a stable path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"strconv"
|
||||
"sync"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-agent/internal/proxmox"
|
||||
)
|
||||
@@ -35,6 +36,10 @@ const felhomDataNS = "felhom-data"
|
||||
type GuestBinder struct {
|
||||
runner proxmox.Runner
|
||||
logger *slog.Logger
|
||||
// mountMu serializes AttachDrive/DetachDrive so a concurrent reconnect (controller-triggered) and the
|
||||
// agent's periodic reconcile can't both pass the isHostMountpoint check and double-bind the same
|
||||
// stable path (a TOCTOU race — observed live as 2 stacked binds).
|
||||
mountMu sync.Mutex
|
||||
}
|
||||
|
||||
// NewGuestBinder builds a binder over the given root-CLI runner.
|
||||
|
||||
Reference in New Issue
Block a user