Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1157111img; Tue, 26 Feb 2019 15:28:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IZYrfld75g79dFCgqQ+kIa36Uxz2juhwJduQecO31PvaFS9NLO9qdefHWhmt0Ijn6hIiR7U X-Received: by 2002:a65:6483:: with SMTP id e3mr26652421pgv.273.1551223708663; Tue, 26 Feb 2019 15:28:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551223708; cv=none; d=google.com; s=arc-20160816; b=oGZA1+b73fQv5/9qyXZHPlpxESnYQlptwq22damAcKcwa/xy2GqKUIQQzxwu2z+FuN Ej6Ss544iDc4rbtyQXytTIlGZ8oQXU8GMF1VzPG6ZWftioSj8DWitKLr4ebbp1XDVdyC TrUNRk1pIiTt6JBptOFDz3UZls0CxDa4swClpWJvcTfJvI+hl/OJu+IBqEwbtQd8tXn1 +YoAYL2WK3TY+utR06d5SkPmg4aHarHpyLZiw4IhJod95I7P6OAzE0xtDaPI9dUTOxcB qXvlR6qobpnZUbu3M5t6pMCMJ3T0Wr0+l/d6eG2vKt+Yg7MNvkGWKrIw2G9g9dxUwY1n 7FnA== 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=K1zN/f3oVnyr1ACBZKbced3vf/PLQnCRY/5ZJBOItdc=; b=JrvKMZqxmBFybmESIFRBSRFuNu65FrbBhgTajVBFvmqbJWsCvpHb6xhuPYhewP6Dpa ApyBuvJZUxzSC3F1gCUk3ssK3keSvtc328ip0Xp7aI4PDz+hZwnE7bixWbOexeKLFBDR 3w/cOAIsXOkE7eVQfalboqGMTagX76Sqon198odiwdwR928vU4pJ/XlL7QS3kJ4i1FXT 0joqv6irTgRyB3A0zYjL+rROeZCo9zW3JexAOXMAZ/QcEEfhuAsYmvJpZaOIVDr/fYsq aDb1XOU3j6pfs8cw2D+qwPmf9F8WnxnAVh1STKBryBkVycJ2DGW5QD4eSCzT1Ekw8Slr 2umA== 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 e69si13754087pgc.552.2019.02.26.15.28.11; Tue, 26 Feb 2019 15:28: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 S1729326AbfBZX1s (ORCPT + 99 others); Tue, 26 Feb 2019 18:27:48 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45778 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728729AbfBZX1r (ORCPT ); Tue, 26 Feb 2019 18:27:47 -0500 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1QNNx3r032132 for ; Tue, 26 Feb 2019 18:27:46 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qwe8hjfat-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 26 Feb 2019 18:27:45 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 26 Feb 2019 23:27:44 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 26 Feb 2019 23:27:42 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x1QNRfAP32833722 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 26 Feb 2019 23:27:41 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 964D0A4051; Tue, 26 Feb 2019 23:27:41 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D88FBA404D; Tue, 26 Feb 2019 23:27:40 +0000 (GMT) Received: from localhost.ibm.com (unknown [9.80.106.105]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 26 Feb 2019 23:27:40 +0000 (GMT) From: Mimi Zohar To: linux-kselftest@vger.kernel.org, Shuah Khan Cc: linux-integrity@vger.kernel.org, linux-kernel@vger.kernel.org, Mimi Zohar Subject: [PATCH v2 1/5] selftests/ima: cleanup the kexec selftest Date: Tue, 26 Feb 2019 18:26:56 -0500 X-Mailer: git-send-email 2.7.5 In-Reply-To: <1551223620-11586-1-git-send-email-zohar@linux.ibm.com> References: <1551223620-11586-1-git-send-email-zohar@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 19022623-0008-0000-0000-000002C54C62 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19022623-0009-0000-0000-00002231977A Message-Id: <1551223620-11586-2-git-send-email-zohar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-02-26_13:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=951 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902260158 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 # 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]" -- 2.7.5