1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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 <dwalsh@redhat.com> (github: rhatdan)
Docker-DCO-1.1-Signed-off-by: Dan Walsh <dwalsh@redhat.com> (github: crosbymichael)
This commit is contained in:
Dan Walsh 2014-04-25 14:34:42 -04:00 committed by Michael Crosby
parent b7942ec2ca
commit 12934ef3a4

View file

@ -146,15 +146,15 @@ func Setfilecon(path string, scon string) error {
} }
func Setfscreatecon(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) { 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) { 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) { func Getpidcon(pid int) (string, error) {