|
|
1aff52 |
From db81de97febc8c79bfe7c54f57ae313cc5ba0728 Mon Sep 17 00:00:00 2001
|
|
|
1aff52 |
From: Ondrej Mosnacek <omosnace@redhat.com>
|
|
|
1aff52 |
Date: Wed, 8 Jun 2022 19:09:53 +0200
|
|
|
1aff52 |
Subject: [PATCH] libsemanage: always write kernel policy when
|
|
|
1aff52 |
check_ext_changes is specified
|
|
|
1aff52 |
|
|
|
1aff52 |
For the use case of rebuilding the policy after package updates, we need
|
|
|
1aff52 |
the check_ext_changes operation to always do at least the do_write_kernel
|
|
|
1aff52 |
step, because the various semanage dbs may have also changed content
|
|
|
1aff52 |
relative to the current binary policy. As this step is itself relatively
|
|
|
1aff52 |
fast, we can do it unconditionally.
|
|
|
1aff52 |
|
|
|
1aff52 |
Fixes: 286a679fadc4 ("libsemanage: optionally rebuild policy when modules are changed externally")
|
|
|
1aff52 |
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
|
|
|
1aff52 |
Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
|
|
|
1aff52 |
---
|
|
|
1aff52 |
libsemanage/include/semanage/handle.h | 2 +-
|
|
|
1aff52 |
libsemanage/src/direct_api.c | 8 +++++---
|
|
|
1aff52 |
2 files changed, 6 insertions(+), 4 deletions(-)
|
|
|
1aff52 |
|
|
|
1aff52 |
diff --git a/libsemanage/include/semanage/handle.h b/libsemanage/include/semanage/handle.h
|
|
|
1aff52 |
index 7f298a49..df919a14 100644
|
|
|
1aff52 |
--- a/libsemanage/include/semanage/handle.h
|
|
|
1aff52 |
+++ b/libsemanage/include/semanage/handle.h
|
|
|
1aff52 |
@@ -67,7 +67,7 @@ void semanage_set_reload(semanage_handle_t * handle, int do_reload);
|
|
|
1aff52 |
void semanage_set_rebuild(semanage_handle_t * handle, int do_rebuild);
|
|
|
1aff52 |
|
|
|
1aff52 |
/* set whether to rebuild the policy on commit when potential changes
|
|
|
1aff52 |
- * to module files since last rebuild are detected,
|
|
|
1aff52 |
+ * to store files since last rebuild are detected,
|
|
|
1aff52 |
* 1 for yes (default), 0 for no */
|
|
|
1aff52 |
extern void semanage_set_check_ext_changes(semanage_handle_t * handle, int do_check);
|
|
|
1aff52 |
|
|
|
1aff52 |
diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
|
|
|
1aff52 |
index bbdca2b2..252fc5bb 100644
|
|
|
1aff52 |
--- a/libsemanage/src/direct_api.c
|
|
|
1aff52 |
+++ b/libsemanage/src/direct_api.c
|
|
|
1aff52 |
@@ -1430,13 +1430,15 @@ static int semanage_direct_commit(semanage_handle_t * sh)
|
|
|
1aff52 |
* Determine what else needs to be done.
|
|
|
1aff52 |
* We need to write the kernel policy if we are rebuilding
|
|
|
1aff52 |
* or if any other policy component that lives in the kernel
|
|
|
1aff52 |
- * policy has been modified.
|
|
|
1aff52 |
+ * policy has been modified. We also want to force it when
|
|
|
1aff52 |
+ * check_ext_changes was specified as the various dbases may have
|
|
|
1aff52 |
+ * changes as well.
|
|
|
1aff52 |
* We need to install the policy files if any of the managed files
|
|
|
1aff52 |
* that live under /etc/selinux (kernel policy, seusers, file contexts)
|
|
|
1aff52 |
* will be modified.
|
|
|
1aff52 |
*/
|
|
|
1aff52 |
- do_write_kernel = do_rebuild | ports_modified | ibpkeys_modified |
|
|
|
1aff52 |
- ibendports_modified |
|
|
|
1aff52 |
+ do_write_kernel = do_rebuild | sh->check_ext_changes |
|
|
|
1aff52 |
+ ports_modified | ibpkeys_modified | ibendports_modified |
|
|
|
1aff52 |
bools->dtable->is_modified(bools->dbase) |
|
|
|
1aff52 |
ifaces->dtable->is_modified(ifaces->dbase) |
|
|
|
1aff52 |
nodes->dtable->is_modified(nodes->dbase) |
|
|
|
1aff52 |
--
|
|
|
1aff52 |
2.35.3
|
|
|
1aff52 |
|