From 2b713061f5100659afb5d8ccec77e435c4e50b9a Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Fri, 25 Apr 2014 14:34:42 -0400 Subject: [PATCH] Fix SELinux errors caused by multi-threading Occasionally the selinux_test program will fail because we are setting file context based on the Process ID but not the TID. THis change will always use the TID to set SELinux labels. Docker-DCO-1.1-Signed-off-by: Daniel Walsh (github: rhatdan) Docker-DCO-1.1-Signed-off-by: Dan Walsh (github: crosbymichael) --- selinux/selinux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/selinux/selinux.go b/selinux/selinux.go index 422c39b..6cf7bd7 100644 --- a/selinux/selinux.go +++ b/selinux/selinux.go @@ -146,15 +146,15 @@ func Setfilecon(path string, scon string) error { } func Setfscreatecon(scon string) error { - return writeCon("/proc/self/attr/fscreate", scon) + return writeCon(fmt.Sprintf("/proc/self/task/%d/attr/fscreate", system.Gettid()), scon) } func Getfscreatecon() (string, error) { - return readCon("/proc/self/attr/fscreate") + return readCon(fmt.Sprintf("/proc/self/task/%d/attr/fscreate", system.Gettid())) } func getcon() (string, error) { - return readCon("/proc/self/attr/current") + return readCon(fmt.Sprintf("/proc/self/task/%d/attr/current", system.Gettid())) } func Getpidcon(pid int) (string, error) {