cdown / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
cd9c77
From a80ba745cc54d5ba726e48065aebe6dac50dedd2 Mon Sep 17 00:00:00 2001
cd9c77
From: Karel Zak <kzak@redhat.com>
cd9c77
Date: Mon, 24 Jan 2022 14:08:08 +0100
cd9c77
Subject: uuidd: fix open/lock state issue
cd9c77
cd9c77
* warn on open/lock state issue
cd9c77
cd9c77
* enable access to /var/lib/libuuid/, because ProtectSystem=strict make it read-only
cd9c77
cd9c77
  openat(AT_FDCWD, "/var/lib/libuuid/clock.txt",
cd9c77
     O_RDWR|O_CREAT|O_CLOEXEC, 0660) = -1 EROFS (Read-only file system)
cd9c77
cd9c77
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2040366
cd9c77
Upstream: http://github.com/util-linux/util-linux/commit/f27876f9c1056bf41fd940d5c4990b4277e0024f
cd9c77
Upstream: http://github.com/util-linux/util-linux/commit/417982d0236a12756923d88e627f5e4facf8951c
cd9c77
Signed-off-by: Karel Zak <kzak@redhat.com>
cd9c77
---
cd9c77
 misc-utils/uuidd.c          | 9 ++++++---
cd9c77
 misc-utils/uuidd.service.in | 1 +
cd9c77
 2 files changed, 7 insertions(+), 3 deletions(-)
cd9c77
cd9c77
diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
cd9c77
index fa8db173b..78a37d2e8 100644
cd9c77
--- a/misc-utils/uuidd.c
cd9c77
+++ b/misc-utils/uuidd.c
cd9c77
@@ -494,7 +494,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
cd9c77
 			break;
cd9c77
 		case UUIDD_OP_TIME_UUID:
cd9c77
 			num = 1;
cd9c77
-			__uuid_generate_time(uu, &num);
cd9c77
+			if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet)
cd9c77
+				warnx(_("failed to open/lock clock counter"));
cd9c77
 			if (uuidd_cxt->debug) {
cd9c77
 				uuid_unparse(uu, str);
cd9c77
 				fprintf(stderr, _("Generated time UUID: %s\n"), str);
cd9c77
@@ -504,7 +505,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
cd9c77
 			break;
cd9c77
 		case UUIDD_OP_RANDOM_UUID:
cd9c77
 			num = 1;
cd9c77
-			__uuid_generate_random(uu, &num);
cd9c77
+			if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet)
cd9c77
+				warnx(_("failed to open/lock clock counter"));
cd9c77
 			if (uuidd_cxt->debug) {
cd9c77
 				uuid_unparse(uu, str);
cd9c77
 				fprintf(stderr, _("Generated random UUID: %s\n"), str);
cd9c77
@@ -513,7 +515,8 @@ static void server_loop(const char *socket_path, const char *pidfile_path,
cd9c77
 			reply_len = sizeof(uu);
cd9c77
 			break;
cd9c77
 		case UUIDD_OP_BULK_TIME_UUID:
cd9c77
-			__uuid_generate_time(uu, &num);
cd9c77
+			if (__uuid_generate_time(uu, &num) < 0 && !uuidd_cxt->quiet)
cd9c77
+				warnx(_("failed to open/lock clock counter"));
cd9c77
 			if (uuidd_cxt->debug) {
cd9c77
 				uuid_unparse(uu, str);
cd9c77
 				fprintf(stderr, P_("Generated time UUID %s "
cd9c77
diff --git a/misc-utils/uuidd.service.in b/misc-utils/uuidd.service.in
cd9c77
index b4c9c4635..e64ca59b5 100644
cd9c77
--- a/misc-utils/uuidd.service.in
cd9c77
+++ b/misc-utils/uuidd.service.in
cd9c77
@@ -18,6 +18,7 @@ ProtectKernelModules=yes
cd9c77
 ProtectControlGroups=yes
cd9c77
 RestrictAddressFamilies=AF_UNIX
cd9c77
 MemoryDenyWriteExecute=yes
cd9c77
+ReadWritePaths=/var/lib/libuuid/
cd9c77
 SystemCallFilter=@default @file-system @basic-io @system-service @signal @io-event @network-io
cd9c77
 
cd9c77
 [Install]
cd9c77
-- 
cd9c77
2.34.1
cd9c77