Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7489324imu; Thu, 31 Jan 2019 10:57:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN6wg/VGoWsWIS3gJCsuSE/7+CATCZQTHu1f6zS1XmnEqMGq3gUZHHaoWmUJUKiRsuS/xlNM X-Received: by 2002:a62:a209:: with SMTP id m9mr36532606pff.218.1548961048910; Thu, 31 Jan 2019 10:57:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548961048; cv=none; d=google.com; s=arc-20160816; b=tNfsAdqcfi0dj0uiAm0biL1REJAHIw/q843bIutbQqJGOs4xSjEIYXuj9qoLzbx8/L 4uqWxE/K6IUzTfT3vL1YINN9/PBO+8r+Q0iuV5v4++FQO0Ul9xkZWvo7GvNd7FXuHq4R cCpWCMxiljZpdJmcLJirE0DXSsDBQwyKtrnnsVMRde0BsFRRzfevW8F7qsoEpxATIuw3 cGz7HxmCAyABIAoTtWy//+7TGPbMW69MzEmtt5v5T9zKruo9IuUWMP5j4rRkYmWHDXI2 QuKWQjju4iBZ60yCohnVFCIN8CIXLCCKK2TNnO5AkrP0lDslMM3U99DC12tQvwZ0uT7y Ls3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=maw3sK1oxgxiHmSxP+9Kk4XQQYX+/RPpO/A1bNzcdBA=; b=XXh2Z7ItmREobxobKN7ntubalyklMIUQKxU26jyxrQaLMZcFutijOUtpJhKBguQ4Xj Ba5WKchAIuD8MXgRB/ne0QKj3TdcyJv63UwiW/ahF17oMo4p/Dx6qBG/C5578G4DgKA4 Up5q3MOHXSDHrrNQewW5FQZABzF4tu4rdwXCVyin5VR5yaGOLrrkSsHYZbcissWkJ+8a ddUoOBWbFOdlncbamSrsQjbmbAiBiMAG76JzzzELKhg822hZH47iD8IGP1Ori8B8cqnR 1eTnO6v4LRegseYE5ag3e3khlpk8jbdvSzqtgviE6pLX8rwcHdvzI09McQ3y/wn2G300 H+dg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y40si5286421pla.251.2019.01.31.10.57.13; Thu, 31 Jan 2019 10:57:28 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728268AbfAaS4Z (ORCPT + 99 others); Thu, 31 Jan 2019 13:56:25 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:36048 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728174AbfAaS4X (ORCPT ); Thu, 31 Jan 2019 13:56:23 -0500 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x0VIsAvc142498 for ; Thu, 31 Jan 2019 13:56:22 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2qc60cj45e-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 31 Jan 2019 13:56:21 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 31 Jan 2019 18:56:19 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 31 Jan 2019 18:56:15 -0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0VIuE3q20054198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 31 Jan 2019 18:56:15 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD45E4C044; Thu, 31 Jan 2019 18:56:14 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A19534C046; Thu, 31 Jan 2019 18:56:13 +0000 (GMT) Received: from localhost.ibm.com (unknown [9.80.107.203]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 31 Jan 2019 18:56:13 +0000 (GMT) From: Mimi Zohar To: linux-integrity@vger.kernel.org Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, David Howells , Dave Young , Eric Biederman , Mimi Zohar Subject: [PATCH 1/3] selftest/ima: cleanup the kexec selftest Date: Thu, 31 Jan 2019 13:55:34 -0500 X-Mailer: git-send-email 2.7.5 In-Reply-To: <1548960936-7800-1-git-send-email-zohar@linux.ibm.com> References: <1548960936-7800-1-git-send-email-zohar@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19013118-0020-0000-0000-0000030F7AEA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19013118-0021-0000-0000-000021607FB9 Message-Id: <1548960936-7800-2-git-send-email-zohar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-31_10:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=902 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901310141 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove the few bashisms in the script and use the complete option name for clarity. Signed-off-by: Mimi Zohar --- tools/testing/selftests/ima/test_kexec_load.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/ima/test_kexec_load.sh b/tools/testing/selftests/ima/test_kexec_load.sh index 1c10093fb526..74423c4229e2 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+ # 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,7 +12,7 @@ rc=0 ksft_skip=4 # kexec requires root privileges -if [ $UID != 0 ]; then +if [ $(id -ru) != 0 ]; then echo "$TEST: must be run as root" >&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]" -- 2.7.5