Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1220382img; Tue, 26 Feb 2019 16:58:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IYgu1VxEbDrSloHI+F5iWENKuC0gaOeUnHbQAAF8Hrde8yvZVjbo6sS1hhOACYEDXEkXd47 X-Received: by 2002:a63:6841:: with SMTP id d62mr266090pgc.133.1551229104356; Tue, 26 Feb 2019 16:58:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551229104; cv=none; d=google.com; s=arc-20160816; b=DxJTheuXDRbyUpJY7D+VshxsM73tvUrCh6DKUpN+dry+7XzzAic4PDEEd5qgI4wv5Z dpgcVESaqz4s6I+vy03f9VG8l+MveQcxWdKV3VIWfasuzZwcms21soaas/SmcKnJkDZi T0fIHS977mWd6SCENQPx0eG5Jf2XlzaAWEiIQOz0kF7/H5TPKTjWmScNJjF73ucTqY/o IhFrRzl0txkq9blZqAv7mY89IpOlr99KlPlbgCcygSOQlyQWL71nATl16uCDU/Dr7tDo qecWcKYpn0tJ6q2aVB2mKNSVrc8zt/CKXvUMQGKsNPiTUqfF75jzqvPr+1MOOWB2juzh jdwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=AKfXWiStnx6SQ1NWk79gXQvhnNDA7Ih3jmhzLrFrZKk=; b=oFA7MXxTZzcY/BA0E6HkN4aZEolMsTUa2nxpnbSw60zSd1SEkRFz7GBVlBG/d4lXg8 zZCKD7+kAE2vY4fo9fpr54ysHIxCP3mqKF4/Aq3LN7NAWtI0zlTgpUDkVx8IWvBBZEI1 V/JGgQvj0AqdDPUo7Qu9ZWUaDB6ARlSjuVC0ZtYW4bWMkHjf85mtFgxZyWP8XpArt0Qt UKYHRiwVD1irxb1Tkc9oEqUWF6whY1VGq1EQJLb2Vl4CGWKwAT0PON/NUSDIX6FStB57 9HJQVHZDJF7+KgXyMJvTegjhtXd2N/ockGTUyfEAqjHrn9zEwbNvYXk6YaBzqOhFyYuR VtUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UWYbABDQ; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14si13934834pfa.101.2019.02.26.16.58.09; Tue, 26 Feb 2019 16:58:24 -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=@kernel.org header.s=default header.b=UWYbABDQ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729289AbfB0A5o (ORCPT + 99 others); Tue, 26 Feb 2019 19:57:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:55992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727998AbfB0A5n (ORCPT ); Tue, 26 Feb 2019 19:57:43 -0500 Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8AEFE218CD; Wed, 27 Feb 2019 00:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551229062; bh=9B3aqTS5AoTT/ONu6CUGqUc7X1qgGOsOsWQK/fstrXQ=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=UWYbABDQbBm/YgFsjAv3XpmXMMugOSIIIxivym0v1PT0gpDPUlXhtMiPsggs3x231 nC/7vSonh90TyrDoOOs61Pxc0gAqDevPIrt/DkfiwJbn4tSmcC+S5PeifGvR11pRjZ 4fJP5dkEu46PEt8N1VnPnno3DQ41sEerx+GDv+xg= Subject: Re: [PATCH v2 1/5] selftests/ima: cleanup the kexec selftest To: Mimi Zohar , linux-kselftest@vger.kernel.org Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, shuah References: <1551223620-11586-1-git-send-email-zohar@linux.ibm.com> <1551223620-11586-2-git-send-email-zohar@linux.ibm.com> From: shuah Message-ID: Date: Tue, 26 Feb 2019 17:57:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <1551223620-11586-2-git-send-email-zohar@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mimi, Thanks for the patches. On 2/26/19 4:26 PM, Mimi Zohar wrote: > Remove the few bashisms and use the complete option name for clarity. > > Signed-off-by: Mimi Zohar > Reviewed-by: Petr Vorel > --- > tools/testing/selftests/ima/test_kexec_load.sh | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/tools/testing/selftests/ima/test_kexec_load.sh b/tools/testing/selftests/ima/test_kexec_load.sh > index 1c10093fb526..0345803e7bec 100755 > --- a/tools/testing/selftests/ima/test_kexec_load.sh > +++ b/tools/testing/selftests/ima/test_kexec_load.sh > @@ -1,7 +1,7 @@ > #!/bin/sh > -# SPDX-License-Identifier: GPL-2.0+ > +# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0 > # Loading a kernel image via the kexec_load syscall should fail > -# when the kerne is CONFIG_KEXEC_VERIFY_SIG enabled and the system > +# when the kernel is CONFIG_KEXEC_VERIFY_SIG enabled and the system > # is booted in secureboot mode. > > TEST="$0" > @@ -12,8 +12,8 @@ rc=0 > ksft_skip=4 > > # kexec requires root privileges > -if [ $UID != 0 ]; then > - echo "$TEST: must be run as root" >&2 > +if [ $(id -ru) -ne 0 ]; then > + echo "$TEST: requires root privileges" >&2 > exit $ksft_skip > fi > > @@ -33,17 +33,17 @@ secureboot=`hexdump $file | awk '{print substr($4,length($4),1)}'` > > # kexec_load should fail in secure boot mode > KERNEL_IMAGE="/boot/vmlinuz-`uname -r`" > -kexec -l $KERNEL_IMAGE &>> /dev/null > -if [ $? == 0 ]; then > - kexec -u > - if [ "$secureboot" == "1" ]; then > +kexec --load $KERNEL_IMAGE 2>&1 > /dev/null > +if [ $? -eq 0 ]; then > + kexec --unload > + if [ $secureboot -eq 1 ]; then > echo "$TEST: kexec_load succeeded [FAIL]" > rc=1 > else > echo "$TEST: kexec_load succeeded [PASS]" > fi > else > - if [ "$secureboot" == "1" ]; then > + if [ $secureboot -eq 1 ]; then > echo "$TEST: kexec_load failed [PASS]" > else > echo "$TEST: kexec_load failed [FAIL]" > The rest looks good to me. thanks, -- Shuah