From e0ac10887c5a42e92386d8f0a35fae6656b3652c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Tue, 25 Feb 2020 10:22:06 +0100 Subject: [PATCH] Remove now uneeded patches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Timothée Ravier --- ...s-socket-treat-MSG_CTRUNC-gracefully.patch | 82 ------------------ ...h-improve-error-handling-for-opendir.patch | 47 ---------- ...he-constant-used-for-invalid-timesta.patch | 85 ------------------- 0001-units-system-add-messagebus-alias.patch | 28 ------ 4 files changed, 242 deletions(-) delete mode 100644 0001-dbus-socket-treat-MSG_CTRUNC-gracefully.patch delete mode 100644 0001-launch-improve-error-handling-for-opendir.patch delete mode 100644 0001-metrics-change-the-constant-used-for-invalid-timesta.patch delete mode 100644 0001-units-system-add-messagebus-alias.patch diff --git a/0001-dbus-socket-treat-MSG_CTRUNC-gracefully.patch b/0001-dbus-socket-treat-MSG_CTRUNC-gracefully.patch deleted file mode 100644 index e8bc510..0000000 --- a/0001-dbus-socket-treat-MSG_CTRUNC-gracefully.patch +++ /dev/null @@ -1,82 +0,0 @@ -From 520c47c53deeb893e03194fefaf3c5b9223ede27 Mon Sep 17 00:00:00 2001 -From: David Rheinsberg -Date: Fri, 10 May 2019 10:58:06 +0200 -Subject: [PATCH] dbus/socket: treat MSG_CTRUNC gracefully - -As it turns out, LSMs allow clients to trigger a MSG_CTRUNC on the -remote side of a unix socket. Whenever LSMs reject the transmission of -an FD, they will simply drop the FD and set MSG_CTRUNC, without any -other error notification. - -Therefore, we must assume any occurance of MSG_CTRUNC is trigger by a -client. This makes it impossible to consider MSG_CTRUNC for any other -error handling, and as such we are left to disconnecting the client and -ignoring the flag. - -Luckily, MSG_CTRUNC is expected for any other event, so we only used it -for diagnostics so far. - -Signed-off-by: David Rheinsberg ---- - src/dbus/socket.c | 44 +++++++++++++++++++++++++++++++++----------- - 1 file changed, 33 insertions(+), 11 deletions(-) - -diff --git a/src/dbus/socket.c b/src/dbus/socket.c -index cacdff2..6e6ba10 100644 ---- a/src/dbus/socket.c -+++ b/src/dbus/socket.c -@@ -593,18 +593,40 @@ static int socket_recvmsg(Socket *socket, - - if (msg.msg_flags & MSG_CTRUNC) { - /* -- * This flag means the control-buffer was too small to retrieve -- * all data. If this can be triggered remotely, it means a peer -- * can cause us to miss FDs. Hence, we really must protect -- * against this. -- * We do provide suitably sized buffers to be prepared for any -- * possible scenario. So if this happens, something is fishy -- * and we better report it. -- * Note that this is also reported by the kernel if we exceeded -- * our NOFILE limit. Since this implies resource -- * misconfiguration as well, we treat it the same way. -+ * Our control-buffer-size is carefully calculated to be big -+ * enough for any possible ancillary data we expect. Therefore, -+ * the kernel should never be required to truncate it, and thus -+ * MSG_CTRUNC will never be set. This is also foward compatible -+ * to future extensions to the ancillary data, since these must -+ * be enabled explicitly before the kernel considers forwarding -+ * them. -+ * -+ * Unfortunately, the SCM_RIGHTS implementation might set this -+ * flag as well. In particular, if not all FDs can be returned -+ * to user-space, MSG_CTRUNC will be set (signalling that the -+ * FD-set is non-complete). No other error is returned or -+ * signalled, though. There are several reasons why the FD -+ * transmission can fail. Most importantly, if we exhaust our -+ * FD limit, further FDs will simply be discarded. We are -+ * protected against this by our accounting-quotas, but we -+ * would still like to catch this condition and warn loudly. -+ * However, FDs are also dropped if the security layer refused -+ * the transmission of the FD in question. This means, if an -+ * LSM refuses the D-Bus client to send us an FD, the FD is -+ * just dropped and MSG_CTRUNC will be set. This can be -+ * triggered by clients. -+ * -+ * To summarize: In an ideal world, we would expect this flag -+ * to never be set, and we would just use -+ * `error_origin(-ENOTRECOVERABLE)` to provide diagnostics. -+ * Unfortunately, the gross misuse of this flag for LSM -+ * security enforcements means we have to assume any occurence -+ * of MSG_CTRUNC means the client was refused to send a -+ * specific message. Our only possible way to deal with this is -+ * to disconnect the client. - */ -- r = error_origin(-ENOTRECOVERABLE); -+ socket_close(socket); -+ r = SOCKET_E_LOST_INTEREST; - goto error; - } - --- -2.21.0 - diff --git a/0001-launch-improve-error-handling-for-opendir.patch b/0001-launch-improve-error-handling-for-opendir.patch deleted file mode 100644 index 135537b..0000000 --- a/0001-launch-improve-error-handling-for-opendir.patch +++ /dev/null @@ -1,47 +0,0 @@ -From f42d5e38859c65a186acd0da94bbeeca12faf7a2 Mon Sep 17 00:00:00 2001 -From: David Rheinsberg -Date: Thu, 2 May 2019 17:33:34 +0200 -Subject: [PATCH] launch: improve error handling for opendir() - -This improves the error-handling of opendir() by always printing -diagnostics. Furthermore, it aligns the behavior with dbus-deamon and -ignores EACCES. - -Signed-off-by: David Rheinsberg ---- - src/launch/launcher.c | 17 +++++++++++++++-- - 1 file changed, 15 insertions(+), 2 deletions(-) - -diff --git a/src/launch/launcher.c b/src/launch/launcher.c -index 31a5364..2ec4bda 100644 ---- a/src/launch/launcher.c -+++ b/src/launch/launcher.c -@@ -749,10 +749,23 @@ static int launcher_load_service_dir(Launcher *launcher, const char *dirpath, NS - - dir = opendir(dirpath); - if (!dir) { -- if (errno == ENOENT || errno == ENOTDIR) -+ if (errno == ENOENT || errno == ENOTDIR) { - return 0; -- else -+ } else if (errno == EACCES) { -+ log_append_here(&launcher->log, LOG_ERR, 0, NULL); -+ r = log_commitf(&launcher->log, "Access denied to service directory '%s'\n", dirpath); -+ if (r) -+ return error_fold(r); -+ -+ return 0; -+ } else { -+ log_append_here(&launcher->log, LOG_ERR, errno, NULL); -+ r = log_commitf(&launcher->log, "Unable to open service directory '%s': %m\n", dirpath); -+ if (r) -+ return error_fold(r); -+ - return error_origin(-errno); -+ } - } - - r = dirwatch_add(launcher->dirwatch, dirpath); --- -2.20.1 - diff --git a/0001-metrics-change-the-constant-used-for-invalid-timesta.patch b/0001-metrics-change-the-constant-used-for-invalid-timesta.patch deleted file mode 100644 index ea7beb9..0000000 --- a/0001-metrics-change-the-constant-used-for-invalid-timesta.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 3570b3e9ba367f10718b56336ce32d5254f66575 Mon Sep 17 00:00:00 2001 -From: Tom Gundersen -Date: Thu, 9 May 2019 13:00:37 +0200 -Subject: [PATCH] metrics: change the constant used for invalid timestamps - -Use (uint64_t)-1 rather than 0 to indicate an invalid timestamp. It -should not be possible for the kernel to return 0 from -clock_gettime(), but we have received some reports of our asserts -triggering, so avoid the issue entirely by using -1 instead (which -really can never be returned). - -See https://retrace.fedoraproject.org/faf/reports/2539484/ - -Signed-off-by: Tom Gundersen ---- - src/util/metrics.c | 8 ++++---- - src/util/metrics.h | 9 ++++++--- - 2 files changed, 10 insertions(+), 7 deletions(-) - -diff --git a/src/util/metrics.c b/src/util/metrics.c -index b5a7182..eef94eb 100644 ---- a/src/util/metrics.c -+++ b/src/util/metrics.c -@@ -26,7 +26,7 @@ void metrics_init(Metrics *metrics, clockid_t id) { - } - - void metrics_deinit(Metrics *metrics) { -- c_assert(!metrics->timestamp); -+ c_assert(metrics->timestamp == METRICS_TIMESTAMP_INVALID); - metrics_init(metrics, metrics->id); - } - -@@ -82,7 +82,7 @@ void metrics_sample_add(Metrics *metrics, uint64_t timestamp) { - * a sample is not currently running. - */ - void metrics_sample_start(Metrics *metrics) { -- c_assert(!metrics->timestamp); -+ c_assert(metrics->timestamp == METRICS_TIMESTAMP_INVALID); - metrics->timestamp = metrics_get_time(metrics); - } - -@@ -93,11 +93,11 @@ void metrics_sample_start(Metrics *metrics) { - * End a currently running sample, and update the internal state. - */ - void metrics_sample_end(Metrics *metrics) { -- c_assert(metrics->timestamp); -+ c_assert(metrics->timestamp != METRICS_TIMESTAMP_INVALID); - - metrics_sample_add(metrics, metrics->timestamp); - -- metrics->timestamp = 0; -+ metrics->timestamp = METRICS_TIMESTAMP_INVALID; - } - - /** -diff --git a/src/util/metrics.h b/src/util/metrics.h -index a8ee915..b00dee6 100644 ---- a/src/util/metrics.h -+++ b/src/util/metrics.h -@@ -8,6 +8,8 @@ - #include - #include - -+#define METRICS_TIMESTAMP_INVALID ((uint64_t) -1) -+ - typedef struct Metrics Metrics; - - struct Metrics { -@@ -23,9 +25,10 @@ struct Metrics { - uint64_t sum_of_squares; - }; - --#define METRICS_INIT(_id) { \ -- .minimum = (uint64_t) -1, \ -- .id = (_id), \ -+#define METRICS_INIT(_id) { \ -+ .minimum = (uint64_t) -1, \ -+ .id = (_id), \ -+ .timestamp = METRICS_TIMESTAMP_INVALID, \ - } - - void metrics_init(Metrics *metrics, clockid_t id); --- -2.21.0 - diff --git a/0001-units-system-add-messagebus-alias.patch b/0001-units-system-add-messagebus-alias.patch deleted file mode 100644 index 2ee7673..0000000 --- a/0001-units-system-add-messagebus-alias.patch +++ /dev/null @@ -1,28 +0,0 @@ -From b7155364aa8df83534cbe5795f5959cb32030be1 Mon Sep 17 00:00:00 2001 -From: Tom Gundersen -Date: Tue, 20 Nov 2018 17:09:44 +0100 -Subject: [PATCH] units/system: add `messagebus` alias - -This makes sure we are pulled in by services that depend on the old -sysvinit name for dbus. - -Signed-off-by: Tom Gundersen ---- - src/units/system/dbus-broker.service.in | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/units/system/dbus-broker.service.in b/src/units/system/dbus-broker.service.in -index 97f1655..ed28e66 100644 ---- a/src/units/system/dbus-broker.service.in -+++ b/src/units/system/dbus-broker.service.in -@@ -19,4 +19,6 @@ ExecStart=@bindir@/dbus-broker-launch --scope system --audit - ExecReload=@bindir@/busctl call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus ReloadConfig - - [Install] --Alias=dbus.service -+# Make sure that services can still refer to this under the name of the -+# old SysV script (messagebus). -+Alias=dbus.service messagebus.service --- -2.20.1 -