Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp4077493imc; Thu, 14 Mar 2019 11:44:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxKqqYgAptRWa2nxSHlg+JREY3nFLqyEF+zifG6QUMg+t8s79xJHGgeaqobVcB822d3bw1C X-Received: by 2002:a63:d453:: with SMTP id i19mr46397728pgj.237.1552589046386; Thu, 14 Mar 2019 11:44:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552589046; cv=none; d=google.com; s=arc-20160816; b=dfol0pzBHKrokMs+UnxtCp/ErySqKbMxNajoSpevvdGFZs5gJO6Qhp97zkQZo6/YYd TboU/68uJHF9yuqREBoeMAdmfXaX4XoYUua4X+nJtDXBj3tEj2mxv7fd5Z0dK3WivTXA Boq/IhQBgZd/dFJo5seHWoIKbBOwReUbS16xdFmDhf7E6B0tJkEUCTotoJS+T9a2CX4K j1Y7lPdc0uTXpifTIVj84rtS7u5cjnu4rgha/5qwtpO5jAMqBw7EK9PLA6C/bEtSgJNV fc1cqap7yBuiHdUnkQuKL6E5ohJ66O0ZnEodUWxuee1sSirA1kcsiAYkZJoYRuykCfG9 eMeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=u7XtbTK/bMU/+Qyj7Xupc+jbjhwDrFv5iAdlfbFTv+U=; b=LV18MXWoXmVqSqZ+GPU6+yg+GkDvU2FxYK1lFAq7wElUIieC7/dbgp/dIxawc3Gz2+ DVg+bc3PJ5lMgQ8D+b39nKrSWaDB/Wv/pYsPtX8oqfc4jjbHr6Mwxm2cxYa564QhByjM KxU4Ht5Wae0ZH0bZ6B4AfP57sq/HCZkcAcrgaKrn7osHhJO3jBpkawqn6gP2O8t2T9Lk ojh+nBjtx41u98f/H1NEIQJjgkfnmwpJ8S7/BP+8LeFDuSIL7U+89B0/EpLVJrShI2tQ S+fN63rbqogGgJkMaGwjVewSJsVQQbQ/C4lG2iy9QwSiECHlGMkykNNu2k2tgZi1EKVH bdgg== 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 g14si13321235pfh.190.2019.03.14.11.43.51; Thu, 14 Mar 2019 11:44:06 -0700 (PDT) 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 S1727680AbfCNSl7 (ORCPT + 99 others); Thu, 14 Mar 2019 14:41:59 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:34702 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726938AbfCNSl7 (ORCPT ); Thu, 14 Mar 2019 14:41:59 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2EIfRaD037922 for ; Thu, 14 Mar 2019 14:41:57 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2r7svufvs1-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Mar 2019 14:41:57 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Mar 2019 18:41:55 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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, 14 Mar 2019 18:41:52 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2EIfp3v24182810 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 14 Mar 2019 18:41:51 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E83A4203F; Thu, 14 Mar 2019 18:41:51 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5262042049; Thu, 14 Mar 2019 18:41:50 +0000 (GMT) Received: from localhost.ibm.com (unknown [9.80.108.186]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Mar 2019 18:41:50 +0000 (GMT) From: Mimi Zohar To: linux-integrity@vger.kernel.org Cc: linux-kselftest@vger.kernel.org, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Petr Vorel , Dave Young , Matthew Garrett , Mimi Zohar Subject: [PATCH v4 0/8] selftests/kexec: add kexec tests Date: Thu, 14 Mar 2019 14:41:08 -0400 X-Mailer: git-send-email 2.7.5 X-TM-AS-GCONF: 00 x-cbid: 19031418-0020-0000-0000-000003236301 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19031418-0021-0000-0000-0000217568F3 Message-Id: <1552588876-28481-1-git-send-email-zohar@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-03-14_08:,, 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=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903140130 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel may be configured or an IMA policy specified on the boot command line requiring the kexec kernel image signature to be verified. At runtime a custom IMA policy may be loaded, replacing the policy specified on the boot command line. In addition, the arch specific policy rules are dynamically defined based on the secure boot mode that may require the kernel image signature to be verified. The kernel image may have a PE signature, an IMA signature, or both. In addition, there are two kexec syscalls - kexec_load and kexec_file_load - but only the kexec_file_load syscall can verify signatures. These kexec selftests verify that only properly signed kernel images are loaded as required, based on the kernel config, the secure boot mode, and the IMA runtime policy. Loading a kernel image or kernel module requires root privileges. To run just the KEXEC selftests: sudo make TARGETS=kexec kselftest Changelog v4: - Moved the kexec tests to selftests/kexec, as requested by Dave Young. - Removed the kernel module selftest from this patch set. - Rewritten cover letter, removing reference to kernel modules. Changelog v3: - Updated tests based on Petr's review, including the defining a common test to check for root privileges. - Modified config, removing the CONFIG_KEXEC_VERIFY_SIG requirement. - Updated the SPDX license to GPL-2.0 based on Shuah's review. - Updated the secureboot mode test to check the SetupMode as well, based on David Young's review. Mimi Zohar (7): selftests/kexec: move the IMA kexec_load selftest to selftests/kexec selftests/kexec: cleanup the kexec selftest selftests/kexec: define a set of common functions selftests/kexec: define common logging functions kselftest/kexec: define "require_root_privileges" selftests/kexec: kexec_file_load syscall test selftests/kexec: check kexec_load and kexec_file_load are enabled Petr Vorel (1): selftests/kexec: Add missing '=y' to config options tools/testing/selftests/Makefile | 2 +- tools/testing/selftests/ima/Makefile | 11 -- tools/testing/selftests/ima/config | 4 - tools/testing/selftests/ima/test_kexec_load.sh | 54 ------ tools/testing/selftests/kexec/Makefile | 12 ++ tools/testing/selftests/kexec/config | 3 + tools/testing/selftests/kexec/kexec_common_lib.sh | 175 ++++++++++++++++++ .../selftests/kexec/test_kexec_file_load.sh | 195 +++++++++++++++++++++ tools/testing/selftests/kexec/test_kexec_load.sh | 39 +++++ 9 files changed, 425 insertions(+), 70 deletions(-) delete mode 100644 tools/testing/selftests/ima/Makefile delete mode 100644 tools/testing/selftests/ima/config delete mode 100755 tools/testing/selftests/ima/test_kexec_load.sh create mode 100644 tools/testing/selftests/kexec/Makefile create mode 100644 tools/testing/selftests/kexec/config create mode 100755 tools/testing/selftests/kexec/kexec_common_lib.sh create mode 100755 tools/testing/selftests/kexec/test_kexec_file_load.sh create mode 100755 tools/testing/selftests/kexec/test_kexec_load.sh -- 2.7.5