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

SelinuxProfile never finishes reconcilation and causes semodule to use 100% cpu #1842

Closed
novaesis opened this issue Aug 22, 2023 · 1 comment · Fixed by #1843
Closed

SelinuxProfile never finishes reconcilation and causes semodule to use 100% cpu #1842

novaesis opened this issue Aug 22, 2023 · 1 comment · Fixed by #1843
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@novaesis
Copy link
Contributor

What happened:

When applying an SelinuxProfile to a K8s cluster running the security-profiles-operator, the semodule process on the node uses 100% cpu. This appears to be caused by the operator constantly detecting a drift between the applied policy on the node and what is stored in the CRD. For each detection of a drift, the operator attempts to install the policy again. However, since the operator does not currently care about order in the Selinux policy it changes each time which triggers another drift. Since the policy is constantly changing, semodule runs constantly and attempts to install the selinux policy.

What you expected to happen:

The operator to only install / change the policy if the upstream CRD has changed and therefore semodule only runs for actual changed policy.

How to reproduce it (as minimally and precisely as possible):

Apply an SelinuxProfile CRD with selinux in enforcement mode.

Anything else we need to know?:

no

Environment:

RHEL8

@novaesis novaesis added the kind/bug Categorizes issue or PR as related to a bug. label Aug 22, 2023
@novaesis
Copy link
Contributor Author

I will add further that the root cause seems to be the use of map in https://github.com/kubernetes-sigs/security-profiles-operator/blob/main/api/selinuxprofile/v1alpha2/selinuxprofile_types.go#L83 obviously does not maintain order. So the order defined in the map compared to what is on the node will rarely ever be equal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant