Skip to content
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

Fix thread safety of SelinuxEnabled and getSelinuxMountPoint #1216

Merged
merged 1 commit into from
Dec 6, 2016

Conversation

eparis
Copy link
Contributor

@eparis eparis commented Dec 6, 2016

Both suffered from different race conditions.

SelinuxEnabled assigned selinuxEnabledChecked before selinuxEnabled.
Thus racing callers could see the wrong selinuxEnabled.

getSelinuxMountPoint assigned selinuxfs to "" before it know the right
value. Thus racing could see "" improperly.

The gate selinuxfs, enabled, and mclist all on the same lock

@eparis
Copy link
Contributor Author

eparis commented Dec 6, 2016

@rhatdan @pmorie @mrunalp

@eparis
Copy link
Contributor Author

eparis commented Dec 6, 2016

https://play.golang.org/p/Ipe7Iql9EA is an example of the bug in selinuxEnabled()

Both suffered from different race conditions.

SelinuxEnabled assigned selinuxEnabledChecked before selinuxEnabled.
Thus racing callers could see the wrong selinuxEnabled.

getSelinuxMountPoint assigned selinuxfs to "" before it know the right
value. Thus racing could see "" improperly.

The gate selinuxfs, enabled, and mclist all on the same lock
@mrunalp
Copy link
Contributor

mrunalp commented Dec 6, 2016

LGTM

Approved with PullApprove

@rhatdan
Copy link
Contributor

rhatdan commented Dec 6, 2016

LGTM

@cyphar
Copy link
Member

cyphar commented Dec 6, 2016

LGTM

Approved with PullApprove

@cyphar cyphar merged commit a4f3123 into opencontainers:master Dec 6, 2016
cyphar added a commit that referenced this pull request Dec 6, 2016
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.

4 participants