diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-02-13 10:40:51 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-02-13 10:40:51 +0900 |
| commit | 099da78af5b78ac69a9c3550229a29d8dac0e9f8 (patch) | |
| tree | bc140d49a812b7250fc302a39a26f61b17b7440e | |
| parent | 18466cfd02fdd25394a8c7c808189b58a05dc780 (diff) | |
helper/seccomp: eliminate data race on pfd
Turns out the doc comment on os.File was lying about its methods being safe for concurrent use. The race detector picked up a data race from concurrent use of Fd and Close.
This change eliminates that by calling Fd in the prepare routine.
Signed-off-by: Ophestra <cat@gensokyo.uk>
| -rw-r--r-- | helper/seccomp/export.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/helper/seccomp/export.go b/helper/seccomp/export.go index 6706408f..dd1aedad 100644 --- a/helper/seccomp/export.go +++ b/helper/seccomp/export.go @@ -28,7 +28,7 @@ func (e *exporter) prepare() error { } ec := make(chan error, 1) - go func() { ec <- exportFilter(e.w.Fd(), e.opts); close(ec); _ = e.closeWrite() }() + go func(fd uintptr) { ec <- exportFilter(fd, e.opts); close(ec); _ = e.closeWrite() }(e.w.Fd()) e.exportErr = ec runtime.SetFinalizer(e, (*exporter).closeWrite) }) |
