New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify documentation for Set{Task,Exec}Label #113
Clarify documentation for Set{Task,Exec}Label #113
Conversation
There are more calls then just these that need your comment. Also you need to sign your PR. |
SetFSCreateLabel(label string) |
933337c
to
4bfb31f
Compare
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but left one suggestion
go-selinux/selinux.go
Outdated
// SetFSCreateLabel tells the kernel the label to create all file system objects | ||
// created by this task. Set label="" to return to the default label. Calls to SetFSCreateLabel | ||
// should be wrapped in runtime.LockOSThread()/runtime.UnlockOSThread() until file system | ||
// objects created by this task are finished to guarantee another goroutine does not migrate | ||
// to the current thread before execution is complete. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker (as it was already a bit confusing), but the first line is a bit hard to grasp. Perhaps something like;
// SetFSCreateLabel tells the kernel the label to create all file system objects | |
// created by this task. Set label="" to return to the default label. Calls to SetFSCreateLabel | |
// should be wrapped in runtime.LockOSThread()/runtime.UnlockOSThread() until file system | |
// objects created by this task are finished to guarantee another goroutine does not migrate | |
// to the current thread before execution is complete. | |
// SetFSCreateLabel tells the kernel what label to use for all file system objects created by this task. | |
// Set label to an empty string to return to the default label. Calls to SetFSCreateLabel | |
// should be wrapped in runtime.LockOSThread()/runtime.UnlockOSThread() until file system | |
// objects created by this task are finished to guarantee another goroutine does not migrate | |
// to the current thread before execution is complete. |
(suggestions welcome! /cc @rhatdan)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@yulicrunchy Please take @thaJeztah input and then we can merge. |
In Go, there are no guarantees which goroutine runs in which thread. It is important to wrap calls to Set{Task,Exec,FsCreate,Socket,Key}Label with runtime.LockOSThread() and runtime.UnlockOSThread() to ensure reliable behavior of goroutine labeling. Signed-off-by: Yuli Khodorkovskiy <yuli@crunchydata.com>
4bfb31f
to
54d92ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@rhatdan @kolyshkin PTAL |
Thanks @yulicrunchy. This is an issue that often trips people up, including me. |
In Go, there are no guarantees which goroutine runs in which thread.
It is therefore important to wrap calls to Set{Task,Exec}Label with
runtime.LockOSThread() and runtime.UnlockOSThread() to ensure reliable
behavior of goroutine labeling.