From patchwork Tue Sep 8 21:13:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1360092 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=rockwellcollins.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rockwellcollins.com header.i=@rockwellcollins.com header.a=rsa-sha256 header.s=hrcrc2020 header.b=suo7nCgc; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BmHv73GF3z9sRK for ; Wed, 9 Sep 2020 07:13:39 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C0D4687415; Tue, 8 Sep 2020 21:13:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 54AYEkPFa7oE; Tue, 8 Sep 2020 21:13:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 2E59C8740F; Tue, 8 Sep 2020 21:13:37 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 59FC81BF3AD for ; Tue, 8 Sep 2020 21:13:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 54E858740F for ; Tue, 8 Sep 2020 21:13:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6BcjDLARIHAI for ; Tue, 8 Sep 2020 21:13:33 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ch3vs05.rockwellcollins.com (ch3vs05.rockwellcollins.com [205.175.226.130]) by hemlock.osuosl.org (Postfix) with ESMTPS id 41B02873F0 for ; Tue, 8 Sep 2020 21:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rockwellcollins.com; s=hrcrc2020; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zcLjxAP6kZCZf0F4HHgtqIMCr0x2yEtXZR9EMkALFHs=; b=suo7nCgc430C3JjqsjRt2t+6ENldVdIeem/mDStp0KrJIryLKNoXKGvO JJ1di7Y1cWf7kQwd5KQX9Hb9YVEeap/PWFirMHbow5pR7ZH3WhG9kQS7t gQvl2Z8wjJ2+HE1oYfuZSCwdAPg7+0EwJySJuVDpiRa9FBDZj424rhP9u SraWh6MJWazs/Qe8xPID6dhHDMiJIoPYBACDejr2+TBlVCAPTFk42n1Qw l1i9YO7mqu0wP4j4+TwVk1bq6yOnvE5stbl8uzHJ1xqm+oE0VWqBOBl1j g2AatG5QcQgqyd5rnpngLFEX8adtyM8u7nu/fZfgrd/7nUG/5SSl78EpU g==; IronPort-SDR: M63WNfgwzvS2mNHc6J7QFxjTgiOnToqmqH1AxuH7rG0uM4PljQeHcL6KXY2ZUYRv/vdJRkW+BE 31VIO9H0XNEvpGaaaiNRAOPJlaj7sxZSP4t0oSxJG1bZXEQ12g4B9C7cNTJiiueMdzm0MZ6ykV UmcYU9JS7+KXi87KoQs7P6PiL66E6GeSs3rqhZ57TaDBM9FVIRv/rBw+3mc34+GWy+NpxT6Tdu BCPqFJBVcCUq0mYSduQWnDofLmmQFOHZXJIjipofD2LVtk/AK/CJmkoggFQSN706mQ3kcSt83K GkU= Received: from ofwch3n02.rockwellcollins.com (HELO ciulimr02.rockwellcollins.com) ([205.175.226.14]) by ch3vs05.rockwellcollins.com with ESMTP; 08 Sep 2020 16:13:32 -0500 X-Received: from righttwix.rockwellcollins.com (righttwix.rockwellcollins.com [192.168.141.218]) by ciulimr02.rockwellcollins.com (Postfix) with ESMTP id 9849820051; Tue, 8 Sep 2020 16:13:31 -0500 (CDT) From: Brandon Maier To: buildroot@buildroot.org Date: Tue, 8 Sep 2020 16:13:13 -0500 Message-Id: <20200908211313.107946-4-brandon.maier@rockwellcollins.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200908211313.107946-1-brandon.maier@rockwellcollins.com> References: <20200908211313.107946-1-brandon.maier@rockwellcollins.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2020.02.x 4/4] package/systemd: Backport fix for makefs X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter@korsgaard.com, Brandon Maier , "Yann E . MORIN" , Adam Duskett , Maxime Hadjinlian Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The systemd fstab option "x-systemd.makefs" will fail to work, and throw an error that it can't find a device named "" (an empty string). Backport this fix from systemd v245. Signed-off-by: Brandon Maier --- ...0004-makefs-strdup-arguments-to-mkfs.patch | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 package/systemd/0004-makefs-strdup-arguments-to-mkfs.patch diff --git a/package/systemd/0004-makefs-strdup-arguments-to-mkfs.patch b/package/systemd/0004-makefs-strdup-arguments-to-mkfs.patch new file mode 100644 index 0000000000..5134941a71 --- /dev/null +++ b/package/systemd/0004-makefs-strdup-arguments-to-mkfs.patch @@ -0,0 +1,45 @@ +From c315b79fb43a4d921a533ba0c2cb303324887993 Mon Sep 17 00:00:00 2001 +From: Oliver Giles +Date: Thu, 13 Feb 2020 08:55:57 +0200 +Subject: [PATCH] makefs: strdup arguments to mkfs + +Don't pass values from argv[] directly to child process forked using +safe_fork, because it clears argv[]. strdup them first. +--- + src/partition/makefs.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/partition/makefs.c b/src/partition/makefs.c +index 951989cbb6..d73d67c4e8 100644 +--- a/src/partition/makefs.c ++++ b/src/partition/makefs.c +@@ -41,8 +41,7 @@ static int makefs(const char *type, const char *device) { + } + + static int run(int argc, char *argv[]) { +- const char *device, *type; +- _cleanup_free_ char *detected = NULL; ++ _cleanup_free_ char *device = NULL, *type = NULL, *detected = NULL; + struct stat st; + int r; + +@@ -52,8 +51,14 @@ static int run(int argc, char *argv[]) { + return log_error_errno(SYNTHETIC_ERRNO(EINVAL), + "This program expects two arguments."); + +- type = argv[1]; +- device = argv[2]; ++ /* type and device must be copied because makefs calls safe_fork, which clears argv[] */ ++ type = strdup(argv[1]); ++ if (!type) ++ return -ENOMEM; ++ ++ device = strdup(argv[2]); ++ if (!device) ++ return -ENOMEM; + + if (stat(device, &st) < 0) + return log_error_errno(errno, "Failed to stat \"%s\": %m", device); +-- +2.23.0 +