Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp131860imu; Tue, 27 Nov 2018 10:01:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/UTenkRLXIbW3fLYILOO7a9mtIAKbWb4E4lBdiJCb3EF3a3ONf+4OFlEVvLIkvXYN4P49Pc X-Received: by 2002:a63:3858:: with SMTP id h24mr29296549pgn.300.1543341687990; Tue, 27 Nov 2018 10:01:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543341687; cv=none; d=google.com; s=arc-20160816; b=CZyojjuPtCcVpaDggPFD73eA1HiC7UdXnNsgtwBh31syNb9SHu/6vDCUguiIEuRYa4 mwpuv4Y7z/YtLMJsy6Vw9c4anXjNZt9uSfLwoEOkXyqAB8kKd4D4So22/lPZFc6f0FEO SKJGpr7PZdJDXlG8lxASetfZ7DgYWJRgUzX0kDeWGwVc+8Sx18VFjMSywG58lcp5vpR4 qqg5rc4G9vwQGWt/YvumPaKZ2uNmH2DI97rCrmU+unsJdD6Hm+PM4eIZFE7BFOMDWI+f 0VZgYNiWWAT0IkiQAtb8AOyzHC8c8oDomAvQkThD3Ns+XmjrY3EaJMSDf+F8fCj8y6jD KAUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature; bh=JW0aEvufzitQixWSWQWj26FogOCWOXctwaJai/3NkaM=; b=fdsnGhupi1SPXhWjhcJPUa+zb47eBImkpV/fpdgcFJB6PzvQMWXQhZN9rG+GCxPYlB vIITVlCzgqto7dfW0rTOmi3wGGZ2liBXB7EI9n+wu5lkBzNFUZj+J1FGAQ0Q9XR61WCC 8D7Szz5yFwEKppxwHb7iKq87AZjOXyaWdZA7ta8/YY+rgxv3DiAa6+vR+w781oT5lety zwL61OUwihDEZCXvbYMmbxlIEanTeoyE2XoiO044fpDnJo3E+j8L4YmfYMkTONRflrLR bPamHa9RpCLMONjVSkndo2y5ndbIlzGeYuwFgOmg4WUrErJGAQcAX1TmtzjR7g2jjSx1 uIvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="IVlxy/Fe"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si4658064pfi.125.2018.11.27.10.00.37; Tue, 27 Nov 2018 10:01:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="IVlxy/Fe"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732160AbeK1Eyy (ORCPT + 99 others); Tue, 27 Nov 2018 23:54:54 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:36482 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731749AbeK1Eyx (ORCPT ); Tue, 27 Nov 2018 23:54:53 -0500 Received: by mail-yw1-f68.google.com with SMTP id y194so9509089ywg.3 for ; Tue, 27 Nov 2018 09:56:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=JW0aEvufzitQixWSWQWj26FogOCWOXctwaJai/3NkaM=; b=IVlxy/FedZwhPFUBQWpe8Wav7myRdSfCDzFwJNqjid/+IutjwpXwWOHrP1+oPxFhX6 FMG/vDK5CmB2EbaNBR/n+KpH9hCtu/KelW3X2UbZ7rblg1BtSYwyN0scBeBt0TH7gT0V tB4BOJobqsP9FpGVj8bxBk6WTrRbeXrVkCuj4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=JW0aEvufzitQixWSWQWj26FogOCWOXctwaJai/3NkaM=; b=P8hWOmQBgu6qUbTco/oTnoOD5GEPOj1GXHJGh5ZsaCiDSrMiG6tTf2bamhedVVGAgz niBR5yNXg2uVU1Y2i5xNz8HOJQkDVlOCefM5ivmzMJamMtT41e4/8zGSCfZeLbSaRNE+ IZt9Zb1UlM6tq9epd5IyqkhdWYHF7Ul53WXX7jExIkcrQca/+IvwPuM0ivHoYeqxU5+a jmDotcEsc/8mZMdylvbRDymKozVrLKb8XzAGjpSdQFqleNZWjWKS7wLhcf9moPE/7Q01 mlVHnlleQgKb2hCgntRpu4h2pmSk5SqREpDSw571FHpiIMLvp28/x+/ouH7qx3zXkkd9 r4IQ== X-Gm-Message-State: AGRZ1gLU4YicT5xr7KEyQikkPGVIeIm1xiSeWu5jY8AMkeveh5O6xvYt tQa0TFDqhKF/huiK3P2DhtcN36hP5D4= X-Received: by 2002:a81:36d8:: with SMTP id d207-v6mr35941066ywa.71.1543341371598; Tue, 27 Nov 2018 09:56:11 -0800 (PST) Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com. [209.85.219.181]) by smtp.gmail.com with ESMTPSA id 206-v6sm2167967ywp.0.2018.11.27.09.56.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Nov 2018 09:56:10 -0800 (PST) Received: by mail-yb1-f181.google.com with SMTP id i17-v6so9414344ybp.13 for ; Tue, 27 Nov 2018 09:56:10 -0800 (PST) X-Received: by 2002:a25:7644:: with SMTP id r65-v6mr29657454ybc.403.1543341369944; Tue, 27 Nov 2018 09:56:09 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:b906:0:0:0:0:0 with HTTP; Tue, 27 Nov 2018 09:56:09 -0800 (PST) In-Reply-To: <20181127031218.24419-2-dan.rue@linaro.org> References: <20181127031218.24419-1-dan.rue@linaro.org> <20181127031218.24419-2-dan.rue@linaro.org> From: Kees Cook Date: Tue, 27 Nov 2018 09:56:09 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] selftests: firmware: remove use of non-standard diff -Z option To: Dan Rue Cc: LKML , Shuah Khan , Greg Kroah-Hartman , "Luis R. Rodriguez" , "open list:KERNEL SELFTEST FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 26, 2018 at 7:12 PM, Dan Rue wrote: > diff -Z is used to trim the trailing whitespace when comparing the > loaded firmware file with the source firmware file. However, per the > comment in the source code, -Z should not be necessary. In testing, the > input and output files are identical. > > Additionally, -Z is not a standard option and is not available in > environments such as busybox. When -Z is not supported, diff fails with > a usage error, which is suppressed, but then causes read_firmwares() to > exit with a false failure message. > > Signed-off-by: Dan Rue Acked-by: Kees Cook -Kees > --- > tools/testing/selftests/firmware/fw_filesystem.sh | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/firmware/fw_filesystem.sh b/tools/testing/selftests/firmware/fw_filesystem.sh > index a4320c4b44dc..466cf2f91ba0 100755 > --- a/tools/testing/selftests/firmware/fw_filesystem.sh > +++ b/tools/testing/selftests/firmware/fw_filesystem.sh > @@ -155,11 +155,8 @@ read_firmwares() > { > for i in $(seq 0 3); do > config_set_read_fw_idx $i > - # Verify the contents are what we expect. > - # -Z required for now -- check for yourself, md5sum > - # on $FW and DIR/read_firmware will yield the same. Even > - # cmp agrees, so something is off. > - if ! diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then > + # Verify the contents match > + if ! diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then > echo "request #$i: firmware was not loaded" >&2 > exit 1 > fi > @@ -171,7 +168,7 @@ read_firmwares_expect_nofile() > for i in $(seq 0 3); do > config_set_read_fw_idx $i > # Ensures contents differ > - if diff -q -Z "$FW" $DIR/read_firmware 2>/dev/null ; then > + if diff -q "$FW" $DIR/read_firmware 2>/dev/null ; then > echo "request $i: file was not expected to match" >&2 > exit 1 > fi > -- > 2.19.1 > -- Kees Cook