From patchwork Sun Dec 30 15:04:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kei Kebreau X-Patchwork-Id: 601 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3A0F9169D8; Sun, 30 Dec 2018 15:06:13 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mira.cbaines.net (Postfix) with ESMTP id 52F10169BA for ; Sun, 30 Dec 2018 15:06:12 +0000 (GMT) Received: from localhost ([127.0.0.1]:45057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gdcfL-00018U-Ji for patchwork@mira.cbaines.net; Sun, 30 Dec 2018 10:06:11 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gdcfI-00018O-NG for guix-patches@gnu.org; Sun, 30 Dec 2018 10:06:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gdcfF-0001p6-GK for guix-patches@gnu.org; Sun, 30 Dec 2018 10:06:08 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:37278) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gdcfF-0001oX-Cm for guix-patches@gnu.org; Sun, 30 Dec 2018 10:06:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gdcfE-0004gV-Vp for guix-patches@gnu.org; Sun, 30 Dec 2018 10:06:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#33923] [PATCH] gnu: vboot-utils: Fix building on armhf-linux. Resent-From: Kei Kebreau Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 30 Dec 2018 15:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33923 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 33923@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.154618233317965 (code B ref -1); Sun, 30 Dec 2018 15:06:02 +0000 Received: (at submit) by debbugs.gnu.org; 30 Dec 2018 15:05:33 +0000 Received: from localhost ([127.0.0.1]:42538 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gdced-0004fc-CX for submit@debbugs.gnu.org; Sun, 30 Dec 2018 10:05:33 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60341) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gdceb-0004fU-As for submit@debbugs.gnu.org; Sun, 30 Dec 2018 10:05:26 -0500 Received: from lists.gnu.org ([208.118.235.17]:45692) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gdceb-0000ku-2U for submit@debbugs.gnu.org; Sun, 30 Dec 2018 10:05:25 -0500 Received: from eggs.gnu.org ([208.118.235.92]:35128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gdceY-00012m-Ug for guix-patches@gnu.org; Sun, 30 Dec 2018 10:05:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gdceU-0000Um-HU for guix-patches@gnu.org; Sun, 30 Dec 2018 10:05:22 -0500 Received: from mout02.posteo.de ([185.67.36.66]:37951) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gdceT-0000O1-R4 for guix-patches@gnu.org; Sun, 30 Dec 2018 10:05:18 -0500 Received: from submission (posteo.de [89.146.220.130]) by mout02.posteo.de (Postfix) with ESMTPS id 283492400FB for ; Sun, 30 Dec 2018 16:05:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1546182315; bh=wnUMR/RBM/iRRf0NnbpNvZVX0C2oYcc6EdcBxLDaCOA=; h=From:To:Cc:Subject:Date:From; b=omn3WrxetZ0l/aFzam3NAQV36GNetiC3EVLCbyFg7nRK2zT3pLtGMCtPZC0vv17j+ oeZaBRp8rCTB5JUQsDlq2hz3MOdYdBtYP93CNZmpzaA9qPCxwj3Oj/mdj5behTac// ke9wfFEQ9w2iiQXtLb8KFwP1XUMvRc8HbDU/VDGt77mqTcdVCt7EfGbZl5nkEHWCWq VFmNGPHDGjUy19Q4x1UaTOWlfnQRXdJMbxrRPsECOFh143OHR3otnCe3z/zvIaCJef NhJNUwOV2VNHu5wZhdnPQEcnsuc5L4tQRsts64zV0MzT771JxH+Gby3OgF2bgFreK9 ODoyFojswHZOg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 43SNzG1p4gz9rxD; Sun, 30 Dec 2018 16:05:13 +0100 (CET) From: Kei Kebreau Date: Sun, 30 Dec 2018 10:04:59 -0500 Message-Id: <20181230150459.19028-1-kkebreau@posteo.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kei Kebreau Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/bootloaders.scm (vboot-utils)[source]: Add patches. [arguments]: Conditionally add "HOST_ARCH=arm" to #:make-flags. * gnu/packages/patches/vboot-utils-fix-format-load-address.patch, gnu/packages/patches/vboot-utils-fix-tests-show-contents.patch, gnu/packages/patches/vboot-utils-skip-test-workbuf.patch: New files. * gnu/local.mk (dist_patch_DATA): Add them. --- gnu/local.mk | 3 + gnu/packages/bootloaders.scm | 17 ++- .../vboot-utils-fix-format-load-address.patch | 33 ++++ .../vboot-utils-fix-tests-show-contents.patch | 142 ++++++++++++++++++ .../vboot-utils-skip-test-workbuf.patch | 21 +++ 5 files changed, 215 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/vboot-utils-fix-format-load-address.patch create mode 100644 gnu/packages/patches/vboot-utils-fix-tests-show-contents.patch create mode 100644 gnu/packages/patches/vboot-utils-skip-test-workbuf.patch diff --git a/gnu/local.mk b/gnu/local.mk index 925d955a6..fc0f9bb9f 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1227,6 +1227,9 @@ dist_patch_DATA = \ %D%/packages/patches/upx-fix-CVE-2017-15056.patch \ %D%/packages/patches/valgrind-enable-arm.patch \ %D%/packages/patches/valgrind-glibc-compat.patch \ + %D%/packages/patches/vboot-utils-skip-test-workbuf.patch \ + %D%/packages/patches/vboot-utils-fix-tests-show-contents.patch \ + %D%/packages/patches/vboot-utils-fix-format-load-address.patch \ %D%/packages/patches/vinagre-revert-1.patch \ %D%/packages/patches/vinagre-revert-2.patch \ %D%/packages/patches/virglrenderer-CVE-2017-6386.patch \ diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm index 2a595fafa..69b4a904b 100644 --- a/gnu/packages/bootloaders.scm +++ b/gnu/packages/bootloaders.scm @@ -673,10 +673,25 @@ board-independent tools."))) (file-name (string-append name "-" version "-checkout")) (sha256 (base32 - "0h0m3l69vp9dr6xrs1p6y7ilkq3jq8jraw2z20kqfv7lvc9l1lxj")))) + "0h0m3l69vp9dr6xrs1p6y7ilkq3jq8jraw2z20kqfv7lvc9l1lxj")) + (patches + (search-patches "vboot-utils-skip-test-workbuf.patch" + "vboot-utils-fix-tests-show-contents.patch" + "vboot-utils-fix-format-load-address.patch")))) (build-system gnu-build-system) (arguments `(#:make-flags (list "CC=gcc" + ;; On ARM, we must pass "HOST_ARCH=arm" so that the + ;; ${HOST_ARCH} and ${ARCH} variables in the makefile + ;; match. Otherwise, ${HOST_ARCH} will be assigned + ;; "armv7l", the value of `uname -m`, and will not + ;; match ${ARCH}, which will make the tests require + ;; QEMU for testing. + ,@(if (string-prefix? "arm" + (or (%current-target-system) + (%current-system))) + '("HOST_ARCH=arm") + '()) (string-append "DESTDIR=" (assoc-ref %outputs "out"))) #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-hard-coded-paths diff --git a/gnu/packages/patches/vboot-utils-fix-format-load-address.patch b/gnu/packages/patches/vboot-utils-fix-format-load-address.patch new file mode 100644 index 000000000..899531e40 --- /dev/null +++ b/gnu/packages/patches/vboot-utils-fix-format-load-address.patch @@ -0,0 +1,33 @@ +This patch was copied from Debian. + +Description: Fix format load_address for 32 bits architectures + The offset and load_address are 64bits integers + On 32bits we have to use strtoull (instead of strtoul) to parse number + into 64bits unsigned integers. Without this the parsed numbers are + truncated to 2^32-1. +Author: Sophie Brun +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881997 +Forwarded: https://bugs.chromium.org/p/chromium/issues/detail?id=786969 +Last-Update: 2017-11-20 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/futility/cmd_bdb.c ++++ b/futility/cmd_bdb.c +@@ -637,7 +637,7 @@ static int do_bdb(int argc, char *argv[] + } + break; + case OPT_OFFSET: +- offset = strtoul(optarg, &e, 0); ++ offset = strtoull(optarg, &e, 0); + if (!*optarg || (e && *e)) { + fprintf(stderr, "Invalid --offset\n"); + parse_error = 1; +@@ -658,7 +658,7 @@ static int do_bdb(int argc, char *argv[] + } + break; + case OPT_LOAD_ADDRESS: +- load_address = strtoul(optarg, &e, 0); ++ load_address = strtoull(optarg, &e, 0); + if (!*optarg || (e && *e)) { + fprintf(stderr, "Invalid --load_address\n"); + parse_error = 1; diff --git a/gnu/packages/patches/vboot-utils-fix-tests-show-contents.patch b/gnu/packages/patches/vboot-utils-fix-tests-show-contents.patch new file mode 100644 index 000000000..8e0c691a2 --- /dev/null +++ b/gnu/packages/patches/vboot-utils-fix-tests-show-contents.patch @@ -0,0 +1,142 @@ +This patch was copied from Debian. + +Description: Fix tests/futility/test_show_contents.sh + Tests compare generated files containing the file path and upstream files + ("expected output") containing path like + "/mnt/host/source/src/platform/vboot_reference/tests/". They can't + match. Drop these lines mentioning paths in the generated files and in + the upstream provided files to avoid failures. +Author: Sophie Brun +Last-Update: 2017-11-14 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/tests/futility/expect_output/show.tests_devkeys_kernel.keyblock ++++ b/tests/futility/expect_output/show.tests_devkeys_kernel.keyblock +@@ -1,4 +1,3 @@ +-Key block: /mnt/host/source/src/platform/vboot_reference/tests/devkeys/kernel.keyblock + Signature: ignored + Size: 0x4b8 + Flags: 7 !DEV DEV !REC +--- a/tests/futility/expect_output/show.tests_devkeys_root_key.vbprivk ++++ b/tests/futility/expect_output/show.tests_devkeys_root_key.vbprivk +@@ -1,4 +1,3 @@ +-Private Key file: /mnt/host/source/src/platform/vboot_reference/tests/devkeys/root_key.vbprivk + Vboot API: 1.0 + Algorithm: 11 RSA8192 SHA512 + Key sha1sum: b11d74edd286c144e1135b49e7f0bc20cf041f10 +--- a/tests/futility/expect_output/show.tests_devkeys_root_key.vbpubk ++++ b/tests/futility/expect_output/show.tests_devkeys_root_key.vbpubk +@@ -1,4 +1,3 @@ +-Public Key file: /mnt/host/source/src/platform/vboot_reference/tests/devkeys/root_key.vbpubk + Vboot API: 1.0 + Algorithm: 11 RSA8192 SHA512 + Key Version: 1 +--- a/tests/futility/expect_output/show.tests_futility_data_bios_mario_mp.bin ++++ b/tests/futility/expect_output/show.tests_futility_data_bios_mario_mp.bin +@@ -1,4 +1,3 @@ +-BIOS: /mnt/host/source/src/platform/vboot_reference/tests/futility/data/bios_mario_mp.bin + GBB header: GBB Area + Version: 1.0 + Flags: 0x00000000 +--- a/tests/futility/expect_output/show.tests_futility_data_bios_zgb_mp.bin ++++ b/tests/futility/expect_output/show.tests_futility_data_bios_zgb_mp.bin +@@ -1,4 +1,3 @@ +-BIOS: /mnt/host/source/src/platform/vboot_reference/tests/futility/data/bios_zgb_mp.bin + GBB header: GBB + Version: 1.0 + Flags: 0x00000000 +--- a/tests/futility/expect_output/show.tests_futility_data_fw_gbb.bin ++++ b/tests/futility/expect_output/show.tests_futility_data_fw_gbb.bin +@@ -1,4 +1,3 @@ +-GBB header: /mnt/host/source/src/platform/vboot_reference/tests/futility/data/fw_gbb.bin + Version: 1.1 + Flags: 0x00000039 + Regions: offset size +--- a/tests/futility/expect_output/show.tests_futility_data_fw_vblock.bin ++++ b/tests/futility/expect_output/show.tests_futility_data_fw_vblock.bin +@@ -1,4 +1,3 @@ +-Key block: /mnt/host/source/src/platform/vboot_reference/tests/futility/data/fw_vblock.bin + Signature: ignored + Size: 0x8b8 + Flags: 7 !DEV DEV !REC +--- a/tests/futility/expect_output/show.tests_futility_data_kern_preamble.bin ++++ b/tests/futility/expect_output/show.tests_futility_data_kern_preamble.bin +@@ -1,4 +1,3 @@ +-Kernel partition: /mnt/host/source/src/platform/vboot_reference/tests/futility/data/kern_preamble.bin + Key block: + Signature: ignored + Size: 0x5b8 +--- a/tests/futility/expect_output/show.tests_futility_data_sample.vbprik2 ++++ b/tests/futility/expect_output/show.tests_futility_data_sample.vbprik2 +@@ -1,4 +1,3 @@ +-Private key file: /mnt/host/source/src/platform/vboot_reference/tests/futility/data/sample.vbprik2 + Vboot API: 2.1 + Desc: "sample vb21 keypair" + Signature Algorithm: 5 RSA8192 +--- a/tests/futility/expect_output/show.tests_futility_data_sample.vbpubk2 ++++ b/tests/futility/expect_output/show.tests_futility_data_sample.vbpubk2 +@@ -1,4 +1,3 @@ +-Public Key file: /mnt/host/source/src/platform/vboot_reference/tests/futility/data/sample.vbpubk2 + Vboot API: 2.1 + Desc: "sample vb21 keypair" + Signature Algorithm: 5 RSA8192 +--- a/tests/futility/expect_output/show.tests_testkeys_key_rsa2048.pem ++++ b/tests/futility/expect_output/show.tests_testkeys_key_rsa2048.pem +@@ -1,3 +1,2 @@ +-Private Key file: /mnt/host/source/src/platform/vboot_reference/tests/testkeys/key_rsa2048.pem + Key length: 2048 + Key sha1sum: bfb2fa9188a87bf766dd7c313ea6802553b646b6 +--- a/tests/futility/expect_output/show.tests_testkeys_key_rsa8192.pub.pem ++++ b/tests/futility/expect_output/show.tests_testkeys_key_rsa8192.pub.pem +@@ -1,3 +1,2 @@ +-Public Key file: /mnt/host/source/src/platform/vboot_reference/tests/testkeys/key_rsa8192.pub.pem + Key length: 8192 + Key sha1sum: f1afa44a1aed0d0e9ff630579df920a725e9de5e +--- a/tests/futility/test_show_contents.sh ++++ b/tests/futility/test_show_contents.sh +@@ -29,7 +29,7 @@ for file in $SHOW_FILES; do + outfile="show.${file//\//_}" + gotfile="${OUTDIR}/${outfile}" + wantfile="${SRCDIR}/tests/futility/expect_output/${outfile}" +- ${FUTILITY} show "${SRCDIR}/${file}" | tee "${gotfile}" ++ ${FUTILITY} show "${SRCDIR}/${file}" | grep -v "tests/" | tee "${gotfile}" + + # Uncomment this to update the expected output + #cp ${gotfile} ${wantfile} +@@ -48,7 +48,7 @@ for file in $VBUTIL_KEY_FILES; do + outfile="vbutil_key.${file//\//_}" + gotfile="${OUTDIR}/${outfile}" + wantfile="${SRCDIR}/tests/futility/expect_output/${outfile}" +- ${FUTILITY} vbutil_key --unpack "${SRCDIR}/${file}" | tee "${gotfile}" ++ ${FUTILITY} vbutil_key --unpack "${SRCDIR}/${file}" | grep -v "tests/" | tee "${gotfile}" + + # Uncomment this to update the expected output + #cp ${gotfile} ${wantfile} +@@ -64,7 +64,7 @@ gotfile="${OUTDIR}/${outfile}" + wantfile="${SRCDIR}/tests/futility/expect_output/${outfile}" + ${FUTILITY} vbutil_keyblock --unpack "${SRCDIR}/${file}" \ + --signpubkey "${SRCDIR}/tests/devkeys/kernel_subkey.vbpubk" \ +- | tee "${gotfile}" ++ | grep -v "tests/" | tee "${gotfile}" + + # Uncomment this to update the expected output + #cp ${gotfile} ${wantfile} +--- a/tests/futility/expect_output/vbutil_key.tests_devkeys_root_key.vbprivk ++++ b/tests/futility/expect_output/vbutil_key.tests_devkeys_root_key.vbprivk +@@ -1,2 +1 @@ +-Private Key file: /mnt/host/source/src/platform/vboot_reference/tests/devkeys/root_key.vbprivk + Algorithm: 11 RSA8192 SHA512 +--- a/tests/futility/expect_output/vbutil_keyblock.tests_devkeys_kernel.keyblock ++++ b/tests/futility/expect_output/vbutil_keyblock.tests_devkeys_kernel.keyblock +@@ -1,4 +1,3 @@ +-Key block file: /mnt/host/source/src/platform/vboot_reference/tests/devkeys/kernel.keyblock + Signature valid + Flags: 7 !DEV DEV !REC + Data key algorithm: 4 RSA2048 SHA256 +--- a/tests/futility/expect_output/vbutil_key.tests_devkeys_root_key.vbpubk ++++ b/tests/futility/expect_output/vbutil_key.tests_devkeys_root_key.vbpubk +@@ -1,4 +1,3 @@ +-Public Key file: /mnt/host/source/src/platform/vboot_reference/tests/devkeys/root_key.vbpubk + Algorithm: 11 RSA8192 SHA512 + Key Version: 1 + Key sha1sum: b11d74edd286c144e1135b49e7f0bc20cf041f10 diff --git a/gnu/packages/patches/vboot-utils-skip-test-workbuf.patch b/gnu/packages/patches/vboot-utils-skip-test-workbuf.patch new file mode 100644 index 000000000..9618c76f8 --- /dev/null +++ b/gnu/packages/patches/vboot-utils-skip-test-workbuf.patch @@ -0,0 +1,21 @@ +This patch was copied from Debian. + +Description: skip the workbuf test if VB2_WORKBUF_ALIGN different from 16 +Author: Sophie Brun +Last-Update: 2015-12-03 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/tests/vb2_common_tests.c ++++ b/tests/vb2_common_tests.c +@@ -70,6 +70,11 @@ static void test_workbuf(void) + /* NOTE: There are several magic numbers below which assume that + * VB2_WORKBUF_ALIGN == 16 */ + ++ /* Skip the tests if VB2_WORKBUF_ALIGN != 16 */ ++ if (VB2_WORKBUF_ALIGN != 16) { ++ return; ++ } ++ + /* Init */ + vb2_workbuf_init(&wb, p0, 64); + TEST_EQ(vb2_offset_of(p0, wb.buf), 0, "Workbuf init aligned");