From 7f5cf08ad86e9a48deee9c3f9ef77ed6934872fb Mon Sep 17 00:00:00 2001 From: Daniel Hilst <392820+dhilst@users.noreply.github.com> Date: Wed, 14 Oct 2026 17:33:44 -0300 Subject: [PATCH] fix(xcat-core): the erase of xCAT-selinux leaves three files unlabeled_t %postun removed the module and relabelled nothing, so the two entrypoint types left the policy while three files still carried them. The files became unlabeled_t, and /install kept public_content_t, which the stock policy does not define for it. %preun now saves the file contexts, because %pre does not run on an erase, and %postun relabels after the module is removed, on an erase only. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com> --- xCAT-selinux/xCAT-selinux.spec | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-selinux/xCAT-selinux.spec b/xCAT-selinux/xCAT-selinux.spec index cd224a90aa..9751811c2d 100644 --- a/xCAT-selinux/xCAT-selinux.spec +++ b/xCAT-selinux/xCAT-selinux.spec @@ -49,8 +49,16 @@ install -m 0644 xcat.pp.bz2 $RPM_BUILD_ROOT%{_datadir}/selinux/packages/targeted %post %selinux_modules_install -s targeted %{_datadir}/selinux/packages/targeted/xcat.pp.bz2 +%preun +# %pre does not run on an erase, and %postun needs the snapshot to find the +# files whose context the removed module defined. +%selinux_relabel_pre -s targeted + %postun %selinux_modules_uninstall -s targeted xcat +if [ $1 -eq 0 ]; then +%selinux_relabel_post -s targeted +fi %posttrans %selinux_relabel_post -s targeted