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

libpriv/postprocess: work around semanage bug #4122

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Nov 2, 2022

There is a bug in the latest semanage code which causes an invocation of semodule --rebuild-if-modules-changed to still write a policy even though nothing changed since a full policy build. On FCOS and RHCOS, this bug is triggered as early as ostree admin deploy in cosa when creating the disk images. This results in shipping images with a policy diff baked in.

Hack around this by immediately rerunning
semodule --rebuild-if-modules-changed after building the policy.

Fixes: openshift/os#1036

There is a bug in the latest semanage code which causes an invocation of
`semodule --rebuild-if-modules-changed` to still write a policy even
though nothing changed since a full policy build. On FCOS and RHCOS,
this bug is triggered as early as `ostree admin deploy` in cosa when
creating the disk images. This results in shipping images with a policy
diff baked in.

Hack around this by immediately rerunning
`semodule --rebuild-if-modules-changed` after building the policy.

Fixes: openshift/os#1036
/* Temporary workaround for https://github.com/openshift/os/issues/1036. */
{
rust::Vec child_argv = { rust::String ("semodule"), rust::String ("-n"),
rust::String ("--rebuild-if-modules-changed") };
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I went with --rebuild-if-modules-changed here instead of the newer --refresh is that the latter is not in f36 and while f36 isn't affected by this bug, I'd like this patch in place ahead of time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I didn't add a feature check here for --rebuild-if-modules-changed. I think all the userspaces we care about for the main branch have that patch now.

@cgwalters I think we'll need to backport this to the rhel8 branch, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh blah. So we have newer semodule in rhel8 versus f36?? 😢

@cgwalters I think we'll need to backport this to the rhel8 branch, right?

Yeah

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.

RHCOS 8.6 failing on ext.config.rebuild-selinux-policy
2 participants