- RPMDB crashes with SIGBUS when updating the RPMDB repeatedly Resolves: RHEL-94540 - File /run/fapolicyd differs from RPM expectations Resolves: RHEL-94536 - fapolicyd.service badly instructs how to start after nss-user-lookup.target Resolves: RHEL-94538 - fapolicy rule containing 'pattern=normal' produces error Resolves: RHEL-94537 Signed-off-by: Radovan Sroka <rsroka@redhat.com>
82 lines
2.2 KiB
Diff
82 lines
2.2 KiB
Diff
diff -up ./src/daemon/fapolicyd.c.sync-update ./src/daemon/fapolicyd.c
|
|
--- ./src/daemon/fapolicyd.c.sync-update 2024-04-29 17:27:41.000000000 +0200
|
|
+++ ./src/daemon/fapolicyd.c 2025-04-21 13:35:21.751343832 +0200
|
|
@@ -66,7 +66,11 @@
|
|
unsigned int debug_mode = 0, permissive = 0;
|
|
|
|
// Signal handler notifications
|
|
-volatile atomic_bool stop = false, hup = false, run_stats = false;
|
|
+volatile atomic_bool try_to_stop = false, stop = false;
|
|
+volatile atomic_bool hup = false, run_stats = false;
|
|
+
|
|
+extern volatile atomic_bool update_thread_loop;
|
|
+extern volatile atomic_bool update_thread_stop;
|
|
|
|
// Local variables
|
|
static conf_t config;
|
|
@@ -214,7 +218,7 @@ static void init_fs_list(const char *wat
|
|
|
|
static void term_handler(int sig __attribute__((unused)))
|
|
{
|
|
- stop = true;
|
|
+ try_to_stop = true;
|
|
}
|
|
|
|
|
|
@@ -667,7 +672,7 @@ int main(int argc, const char *argv[])
|
|
msg(LOG_DEBUG, "Got SIGHUP");
|
|
reconfigure();
|
|
}
|
|
- rc = poll(pfd, 2, -1);
|
|
+ rc = poll(pfd, 2, 1000);
|
|
|
|
#ifdef DEBUG
|
|
msg(LOG_DEBUG, "Main poll interrupted");
|
|
@@ -699,7 +704,15 @@ int main(int argc, const char *argv[])
|
|
sigaction(SIGINT, &sa, NULL);
|
|
#endif
|
|
}
|
|
+
|
|
+ if (try_to_stop)
|
|
+ update_thread_stop = true;
|
|
+
|
|
+ if (try_to_stop && !update_thread_loop)
|
|
+ stop = true;
|
|
+
|
|
}
|
|
+
|
|
msg(LOG_INFO, "shutting down...");
|
|
shutdown_fanotify(m);
|
|
close(pfd[0].fd);
|
|
diff -up ./src/library/database.c.sync-update ./src/library/database.c
|
|
--- ./src/library/database.c.sync-update 2025-04-21 13:34:57.479790359 +0200
|
|
+++ ./src/library/database.c 2025-04-21 13:34:57.480928947 +0200
|
|
@@ -70,6 +70,9 @@ static struct pollfd ffd[1] = { {0, 0,
|
|
static integrity_t integrity;
|
|
static atomic_int reload_db = 0;
|
|
|
|
+volatile atomic_bool update_thread_loop = false;
|
|
+volatile atomic_bool update_thread_stop = false;
|
|
+
|
|
static pthread_t update_thread;
|
|
static pthread_mutex_t update_lock;
|
|
static pthread_mutex_t rule_lock;
|
|
@@ -1283,7 +1286,8 @@ static void *update_thread_main(void *ar
|
|
fcntl(ffd[0].fd, F_SETFL, O_NONBLOCK);
|
|
ffd[0].events = POLLIN;
|
|
|
|
- while (!stop) {
|
|
+ update_thread_loop = true;
|
|
+ while (!update_thread_stop) {
|
|
|
|
rc = poll(ffd, 1, 1000);
|
|
|
|
@@ -1407,6 +1411,7 @@ static void *update_thread_main(void *ar
|
|
}
|
|
|
|
finalize:
|
|
+ update_thread_loop = false;
|
|
close(ffd[0].fd);
|
|
unlink_fifo();
|
|
|