From patchwork Tue Nov 27 03:12:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Rue X-Patchwork-Id: 10699619 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C623313BB for ; Tue, 27 Nov 2018 03:12:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B1C4A2A896 for ; Tue, 27 Nov 2018 03:12:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A29DA2A8A4; Tue, 27 Nov 2018 03:12:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44FD52A896 for ; Tue, 27 Nov 2018 03:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbeK0OJU (ORCPT ); Tue, 27 Nov 2018 09:09:20 -0500 Received: from mail-io1-f51.google.com ([209.85.166.51]:45332 "EHLO mail-io1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728381AbeK0OJU (ORCPT ); Tue, 27 Nov 2018 09:09:20 -0500 Received: by mail-io1-f51.google.com with SMTP id w7so15779717iom.12 for ; Mon, 26 Nov 2018 19:12:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wGt0nwknXf8js5Tv9n0b8MS3AqmG0XFqvIR4lkoqZTw=; b=QCWWrozDLm9AGnpjiOXGa4PFMJN2Pf/cim+RMMzNvMJ6syz7bMXCxXmB1XpvnddaUo 1lqSL6yjBjp4deDVpxQ1qlTg7UY+QRMefZozjSETvA/H41P2GdddstjILPBPbkYrabJn IICVT3FKOS8AGAsa8nCYLIovyU2tcPKNOJmlw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wGt0nwknXf8js5Tv9n0b8MS3AqmG0XFqvIR4lkoqZTw=; b=Z5d0xyVjHlwXnatcEPnmERx9yv5OhJnNCAcab1eXXnXbDc6LHGJXGrTtnqkGRKjU5N 9IKRY6LbWa2OWctQw4+byVqWS23s9tLbC3nhwZgxwfndMu6veUDkK/TN4uz23GCYKqrM wU3hmtGy2m6jm+rqbCOl21RxFTQS6y2korSFOvL6Px8rK77VhhRd80lJK+GIqyVpo5XA vfkxiCX/z9FgUGPvhlZuiDSkgySCDPhe4nISyIPTOTTvROyos4wKwhAx11wyckMjqcb5 w7J6ir6aWM0t18cjWLz16y+2jcejqQDA+5MRKEULXy9cgEFSNn2fIKvk5Dacng1EiAqb xEAQ== X-Gm-Message-State: AA+aEWaRVxZrxVrih9e6zQ93pAhzfCu3sPdsmgCF23nG/GeyTK5UiDgR fH6qaDPeWxr+TykRoW7ih22mAQ== X-Google-Smtp-Source: AFSGD/UMJ8pPtIU5vLa2r3TkJVC5NfColD3DTzPvA5gdtMWD8pCL2/4rj9UkRxmGlR6JW8C+PJc8tw== X-Received: by 2002:a5d:8b8d:: with SMTP id p13mr16027638iol.223.1543288376162; Mon, 26 Nov 2018 19:12:56 -0800 (PST) Received: from localhost (c-107-2-67-121.hsd1.mn.comcast.net. [107.2.67.121]) by smtp.gmail.com with ESMTPSA id w186sm1149449itb.15.2018.11.26.19.12.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 19:12:55 -0800 (PST) From: Dan Rue To: linux-kernel@vger.kernel.org Cc: Dan Rue , Shuah Khan , Greg Kroah-Hartman , Kees Cook , "Luis R. Rodriguez" , linux-kselftest@vger.kernel.org Subject: [PATCH 1/2] selftests: firmware: remove use of non-standard diff -Z option Date: Mon, 26 Nov 2018 21:12:15 -0600 Message-Id: <20181127031218.24419-2-dan.rue@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181127031218.24419-1-dan.rue@linaro.org> References: <20181127031218.24419-1-dan.rue@linaro.org> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Acked-by: Kees Cook 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 --- 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 From patchwork Tue Nov 27 03:12:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Rue X-Patchwork-Id: 10699621 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A171B13BB for ; Tue, 27 Nov 2018 03:13:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F1892A896 for ; Tue, 27 Nov 2018 03:13:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 831DA2A8A4; Tue, 27 Nov 2018 03:13:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2BFC22A896 for ; Tue, 27 Nov 2018 03:13:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728513AbeK0OJY (ORCPT ); Tue, 27 Nov 2018 09:09:24 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:50802 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728431AbeK0OJY (ORCPT ); Tue, 27 Nov 2018 09:09:24 -0500 Received: by mail-it1-f195.google.com with SMTP id z7so14448369iti.0 for ; Mon, 26 Nov 2018 19:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UNR7WQBsg6SMTrLbOHn0u1gL1Kd8gB6JnhT0P9RIk0s=; b=WNgHNzlu1vfMPm0OjpQTZzSHm8jb2ftPDjxJvmhhJzhhDOEqr+8o6gkRUMrsGp0WFZ x47aB00bfNqoTjF4WBMBXnXqHiWnDwsnN/rTUQiFEoBAxv1c3WOxafqNMJDwFqKzRjfU 1h7AuRGZQVJW4tkfScQVfarboCg3f5uK5BZuk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UNR7WQBsg6SMTrLbOHn0u1gL1Kd8gB6JnhT0P9RIk0s=; b=mQRZfXcQm22MLTxoARWhX3UNVmqYL7/45JpPiqEpM8LKIYN1jUx6AAxDQouD/MGjEA PEHls0A9xDJiwkrC6z7XErdivCaYF1ChIS8mMDFl7sPUXHDvek175tiZx6uJMIwwRspC 7K9slFHJ3dnDnM+DYe0Q1OxNXet+3TopOFxbyYkSUVYmSmZTF5oNcOnHvgRIBqGR6LnH uv+3WDvm3aRdsGMBZdMFOGjWibd5xGh80kaQRgNkWKoY4pFyscuJAII4zB6Aufkd8zKH h3WxY+vUCPMnsqvyOa31gi/fgb43ubZF0Im4zkjQv3gYrtQxZMuUJn2HgnaT/Ka4Khdn Huug== X-Gm-Message-State: AA+aEWaXYscKHNVMNt7RcVormyeh4KXHusegfzef9mcYi7o7fV9FGPy9 TNubSttkbgChnHGImrLcMwhFmwYa20g= X-Google-Smtp-Source: AFSGD/VXL+aSMH1u1OcEnwIrmxMibaXjSJ+Un++lK3iLSPGnrLODCRUiS7Lw7WDLuaA8DooKuW1Upg== X-Received: by 2002:a24:d60a:: with SMTP id o10mr23558527itg.162.1543288380352; Mon, 26 Nov 2018 19:13:00 -0800 (PST) Received: from localhost (c-107-2-67-121.hsd1.mn.comcast.net. [107.2.67.121]) by smtp.gmail.com with ESMTPSA id w16sm1775480ita.38.2018.11.26.19.12.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 26 Nov 2018 19:12:59 -0800 (PST) From: Dan Rue To: linux-kernel@vger.kernel.org Cc: Dan Rue , Shuah Khan , "Luis R. Rodriguez" , Greg Kroah-Hartman , Kees Cook , linux-kselftest@vger.kernel.org Subject: [PATCH 2/2] selftests: firmware: add CONFIG_FW_LOADER_USER_HELPER_FALLBACK to config Date: Mon, 26 Nov 2018 21:12:16 -0600 Message-Id: <20181127031218.24419-3-dan.rue@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181127031218.24419-1-dan.rue@linaro.org> References: <20181127031218.24419-1-dan.rue@linaro.org> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y is required for fw_fallback.sh. Without it, fw_fallback.sh fails with 'usermode helper disabled so ignoring test'. Enable the config in selftest so that it gets built by default. Signed-off-by: Dan Rue Acked-by: Kees Cook --- tools/testing/selftests/firmware/config | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/firmware/config b/tools/testing/selftests/firmware/config index bf634dda0720..913a25a4a32b 100644 --- a/tools/testing/selftests/firmware/config +++ b/tools/testing/selftests/firmware/config @@ -1,5 +1,6 @@ CONFIG_TEST_FIRMWARE=y CONFIG_FW_LOADER=y CONFIG_FW_LOADER_USER_HELPER=y +CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y