summaryrefslogtreecommitdiff
path: root/internal/namespace/pinning.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/namespace/pinning.go')
-rw-r--r--internal/namespace/pinning.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/namespace/pinning.go b/internal/namespace/pinning.go
index eb0a376..2433203 100644
--- a/internal/namespace/pinning.go
+++ b/internal/namespace/pinning.go
@@ -6,6 +6,7 @@ import (
"fmt"
"os"
"path/filepath"
+ "runtime"
"strconv"
"syscall"
@@ -84,6 +85,10 @@ func JoinExistingNamespace(pm *paths.PathManager, profile string) (bool, error)
return false, nil
}
+ // Lock the OS thread before joining namespaces to ensure this goroutine stays on the modified thread,
+ // and that the thread is not reused for other goroutines (since we never unlock it).
+ runtime.LockOSThread()
+
// Join User Namespace first
userNsPath := fmt.Sprintf("/proc/%d/ns/user", activePid)
userFd, err := os.Open(userNsPath)