summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2017-12-18 17:41:25 -0500
committerMike Gilbert <floppym@gentoo.org>2017-12-18 21:01:31 -0500
commitc6bf76a0c3f92c9f9d450357e7ee08098cc7988d (patch)
tree0dce8d5393eed1f769f1caabcc9e88775769cdcc /sys-apps/systemd
parentx11-libs/vte: remove old (diff)
downloadgentoo-c6bf76a0c3f92c9f9d450357e7ee08098cc7988d.tar.gz
gentoo-c6bf76a0c3f92c9f9d450357e7ee08098cc7988d.tar.bz2
gentoo-c6bf76a0c3f92c9f9d450357e7ee08098cc7988d.zip
sys-apps/systemd: backport crypsetup-generator fix
Closes: https://bugs.gentoo.org/641380 Package-Manager: Portage-2.3.19_p1, Repoman-2.3.6_p35
Diffstat (limited to 'sys-apps/systemd')
-rw-r--r--sys-apps/systemd/files/236-0001-cryptsetup-generator-Don-t-mistake-NULL-input-as-OOM.patch49
-rw-r--r--sys-apps/systemd/systemd-236-r1.ebuild (renamed from sys-apps/systemd/systemd-236.ebuild)1
2 files changed, 50 insertions, 0 deletions
diff --git a/sys-apps/systemd/files/236-0001-cryptsetup-generator-Don-t-mistake-NULL-input-as-OOM.patch b/sys-apps/systemd/files/236-0001-cryptsetup-generator-Don-t-mistake-NULL-input-as-OOM.patch
new file mode 100644
index 000000000000..d1c451835e31
--- /dev/null
+++ b/sys-apps/systemd/files/236-0001-cryptsetup-generator-Don-t-mistake-NULL-input-as-OOM.patch
@@ -0,0 +1,49 @@
+From 357ffd95294e1f9a1e91f8ca01213fb7db2b7614 Mon Sep 17 00:00:00 2001
+From: Jan Alexander Steffens <jan.steffens@gmail.com>
+Date: Mon, 18 Dec 2017 14:47:18 +0100
+Subject: [PATCH] cryptsetup-generator: Don't mistake NULL input as OOM (#7688)
+
+Since systemd v236, several Arch users complained that
+systemd-cryptsetup-generator exits with an OOM error and that it
+prevents the boot from continuing.
+
+Investigating the diff of cryptsetup-generator between v235 and v236 I
+noticed that create_disk allowed for the `password` and `filtered`
+variables to be NULL (they're handled with `strempty()`) but not their
+`*_escaped` versions, and returned OOM errors in those cases.
+
+Fix this by checking that the input string is non-NULL before deciding
+that `specifier_escape` had an OOM error.
+
+I could not test this fix myself, but some users have reported success.
+
+Downstream bug: https://bugs.archlinux.org/task/56733
+---
+ src/cryptsetup/cryptsetup-generator.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
+index 7e61332e5..f91451353 100644
+--- a/src/cryptsetup/cryptsetup-generator.c
++++ b/src/cryptsetup/cryptsetup-generator.c
+@@ -111,7 +111,7 @@ static int create_disk(
+ return log_error_errno(r, "Failed to generate unit name: %m");
+
+ password_escaped = specifier_escape(password);
+- if (!password_escaped)
++ if (password && !password_escaped)
+ return log_oom();
+
+ f = fopen(p, "wxe");
+@@ -184,7 +184,7 @@ static int create_disk(
+ return r;
+
+ filtered_escaped = specifier_escape(filtered);
+- if (!filtered_escaped)
++ if (filtered && !filtered_escaped)
+ return log_oom();
+
+ fprintf(f,
+--
+2.15.1
+
diff --git a/sys-apps/systemd/systemd-236.ebuild b/sys-apps/systemd/systemd-236-r1.ebuild
index 8142a96390ba..e70e61f3fc5f 100644
--- a/sys-apps/systemd/systemd-236.ebuild
+++ b/sys-apps/systemd/systemd-236-r1.ebuild
@@ -148,6 +148,7 @@ src_unpack() {
src_prepare() {
local PATCHES=(
+ "${FILESDIR}/236-0001-cryptsetup-generator-Don-t-mistake-NULL-input-as-OOM.patch"
)
if ! use vanilla; then