From 782c73bf414845114bc4dc4f1aa1960033547ec0 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Wed, 27 May 2026 23:30:22 +0000 Subject: [PATCH] cmd/containerboot: fix data race in TestContainerBoot Parallel subtests share *ipn.Notify pointers (e.g. runningNotify). When multiple subtests reached the same phase concurrently, they all wrote to the shared notify's InitialStatus field without synchronization, triggering the race detector. Fix by shallow-copying *ipn.Notify before setting InitialStatus, so each test iteration works on its own copy. Updates #19380 Change-Id: I9dd40037e02146166f006f4f7c1ddcc47adba191 Signed-off-by: Brad Fitzpatrick --- cmd/containerboot/main_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/containerboot/main_test.go b/cmd/containerboot/main_test.go index 9905123bd..6b64f3c43 100644 --- a/cmd/containerboot/main_test.go +++ b/cmd/containerboot/main_test.go @@ -1288,6 +1288,9 @@ type testCase struct { } } if p.Notify != nil && p.Notify.InitialStatus == nil { + // Shallow-copy before mutating to avoid a race with + // parallel subtests that share the same *ipn.Notify. + p.Notify = new(*p.Notify) p.Notify.InitialStatus = statusFromNotify(p.Notify) } env.lapi.Notify(p.Notify)