Skip to content

Conversation

@kolyshkin
Copy link
Collaborator

The SetFSCreateLabel documentation says the caller should use runtime.LockOSThread. Indeed, if not used, there is an occasional flake:

$ go test -run TestSELinux -count 10000 .
selinux_linux_test.go:168: SetFSCreateLabel failed write /proc/thread-self/attr/fscreate: permission denied
selinux_linux_test.go:169: write /proc/thread-self/attr/fscreate: permission denied

Add LockOSThread to fix the flake.

While at it, fix logging to avoid printing the same error twice.

Fixes: #225.

The SetFSCreateLabel documentation says the caller should use
runtime.LockOSThread. Indeed, if not used, there is an occasional flake:

> $ go test  -run TestSELinux -count 10000 .
> selinux_linux_test.go:168: SetFSCreateLabel failed write /proc/thread-self/attr/fscreate: permission denied
> selinux_linux_test.go:169: write /proc/thread-self/attr/fscreate: permission denied

Add LockOSThread to fix the flake.

While at it, fix logging to avoid printing the same error twice.

Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin kolyshkin changed the title TestSELinux: use LockOSThread to avoid flakes tests: use LockOSThread to avoid flakes Mar 12, 2025
@kolyshkin kolyshkin marked this pull request as draft March 12, 2025 02:21
@kolyshkin
Copy link
Collaborator Author

Let me redo it.

@kolyshkin kolyshkin closed this Mar 12, 2025
@kolyshkin
Copy link
Collaborator Author

Redone in #227

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flake in TestSELinux, TestSocketLabel

1 participant