Skip to content

Commit bbbc51c

Browse files
committed
Need to set process attributes not task
The current setting of the kernel is failing to set the kernel keyring within runc. Changing to setting the process field instead of the thread field seems to have fixed the issue. With this change runc is labeling the kernel keyring correctly so that it can be used within the container. Signed-off-by: Daniel J Walsh <[email protected]>
1 parent 39d5d1c commit bbbc51c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

go-selinux/selinux_linux.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -401,12 +401,12 @@ func SocketLabel() (string, error) {
401401
// SetKeyLabel takes a process label and tells the kernel to assign the
402402
// label to the next kernel keyring that gets created
403403
func SetKeyLabel(label string) error {
404-
return writeCon(fmt.Sprintf("/proc/self/task/%d/attr/keycreate", syscall.Gettid()), label)
404+
return writeCon("/proc/self/attr/keycreate", label)
405405
}
406406

407407
// KeyLabel retrieves the current kernel keyring label setting
408408
func KeyLabel() (string, error) {
409-
return readCon(fmt.Sprintf("/proc/self/task/%d/attr/keycreate", syscall.Gettid()))
409+
return readCon("/proc/self/attr/keycreate")
410410
}
411411

412412
// Get returns the Context as a string

0 commit comments

Comments
 (0)