Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp15334749rwb; Mon, 28 Nov 2022 10:19:46 -0800 (PST) X-Google-Smtp-Source: AA0mqf4tR/R5K0TBy1NkJg9hNHtX3FX0XsQvad/hRo5C+XM17vUE4q8MwI/Rll1RLfuuSVQ1i7zH X-Received: by 2002:a17:902:7898:b0:188:584d:b6d4 with SMTP id q24-20020a170902789800b00188584db6d4mr34186294pll.170.1669659586203; Mon, 28 Nov 2022 10:19:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669659586; cv=none; d=google.com; s=arc-20160816; b=vqt69bFVNFMM1SmOyqiR7SffqCfxVO9tQkDJhOrTBLNGtM6LSKb7Fkge+I4DitLTb9 fqEk4B4mO8V0Rg6QKGJT61PD1phWq/f6SvGnvAQ4AB7BSMwBSanvFgZrMTb06G+f0rIv wdYOB68zYFnxZDfgEcdhrllfURgOk0eEgXB3EoCBUqUl6+nIJO/BsFuGeiNYeB+yEo6H 3W4FXRYvqGh6YMqRMkgsr0KGTL/hqKvXQI8DkUiBfMfCEtpPFwgmAp1h5aKRXnpemNUk PfliaEYtvK5phauoJZxDNj4GLUet4/colh9e07GhASy10e7Wg58eaiipam4e1W8Bva+M +6+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=RZJVGDX/6B5Oe0iNQFvKjIT62omfWmQKvG7j7+mkPXg=; b=rojSHP2Dqdlg8A8Ccwm710stq3w7dnbIWkTrvC7M6IMhXyudN1b1sjcgGtogoeGVkx 067aVMb1GSHdruvDPVaHej61CDgqUK8k8T9ZNfPvOiyUu+VT88/ZbwrUAjK61D3Bg2AK mbHG+EcDE7VUwfuHGifGFUhY+SsEAH5vX2v4cHuli2EJ/HY1UfG1ALeNPoZ4Eo7S91i6 A/PVkKZRFjxV6/vCjUHiBmh2XMnY0c82lWbak3H91oNV8Zthpo295cVhHho3D6i/qI8W wV9oN6bnTI+49c/N/XmNtFylhM40DuKRgByfiwt5WewJ1x/xqQqukqRC9MNx2RLKNzHS fqFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="K3Iy9/sJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu16-20020a17090b1b1000b002135e1f5a7bsi17818850pjb.155.2022.11.28.10.19.35; Mon, 28 Nov 2022 10:19:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b="K3Iy9/sJ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232832AbiK1RQi (ORCPT + 84 others); Mon, 28 Nov 2022 12:16:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232793AbiK1RQa (ORCPT ); Mon, 28 Nov 2022 12:16:30 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7187525E87; Mon, 28 Nov 2022 09:16:29 -0800 (PST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ASFvbRZ032038; Mon, 28 Nov 2022 17:16:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : mime-version : content-transfer-encoding; s=pp1; bh=RZJVGDX/6B5Oe0iNQFvKjIT62omfWmQKvG7j7+mkPXg=; b=K3Iy9/sJ/sx1tmzXN7yRnRY+uDt7IvrHNw05L6MvmciQAs3HawKBYsgTo8427zAmPH+F IMRqOtQayO6L/xm44knAHK2uDCaE4mFfkPcEKAxYNZfbtobPQ96ELI9xAQVIcelO/TBm KEXMv1TjyK7DVSEhRctWywQEcijWuasrXB6IfqQIPCbK5WQx1CbN3HddcVaECwWi8yfA xgmMSpvggCAK1wtz+yNryWivvRps9BRpbiKzd/QQSJA+JLNkwansm1crg0zn0X+GmOmO YyVP5S0nNh7YUrpQNXnBHRWZvL/O4bAdeJr//XiPHC7XZy5XLFrMrh/fk1AngH0viBKt EA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m3vjdfpg3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Nov 2022 17:16:12 +0000 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2ASGrMPK002723; Mon, 28 Nov 2022 17:16:12 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3m3vjdfpf7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Nov 2022 17:16:12 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 2ASH9NBV027840; Mon, 28 Nov 2022 17:16:10 GMT Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by ppma01dal.us.ibm.com with ESMTP id 3m3ae9tmf2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 28 Nov 2022 17:16:10 +0000 Received: from smtpav06.dal12v.mail.ibm.com ([9.208.128.130]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 2ASHG5Sv23724522 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 28 Nov 2022 17:16:05 GMT Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 098E958055; Mon, 28 Nov 2022 17:16:09 +0000 (GMT) Received: from smtpav06.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5DC3058043; Mon, 28 Nov 2022 17:16:08 +0000 (GMT) Received: from li-f45666cc-3089-11b2-a85c-c57d1a57929f.ibm.com (unknown [9.160.26.105]) by smtpav06.dal12v.mail.ibm.com (Postfix) with ESMTP; Mon, 28 Nov 2022 17:16:08 +0000 (GMT) Message-ID: <2204915d319ff9acf80f68ccba8600aaeb5578d7.camel@linux.ibm.com> Subject: Re: [PATCH] lockdown: kexec_file: prevent unsigned kernel image when KEXEC_SIG not enabled From: Mimi Zohar To: Coiby Xu Cc: kexec@lists.infradead.org, Matthew Garrett , Jiri Bohac , David Howells , linux-integrity@vger.kernel.org, Eric Biederman , James Morris , Matthew Garrett , open list Date: Mon, 28 Nov 2022 12:16:08 -0500 In-Reply-To: <20221122023606.nrifkrng5nbfmkka@Rk> References: <20221121072947.836672-1-coxu@redhat.com> <5d98172d77a8a0f1e3daab44ad51bf38978cc053.camel@linux.ibm.com> <20221122023606.nrifkrng5nbfmkka@Rk> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: mqijHTnZy1VBf3pmbGa_r2tIH2ydgGu9 X-Proofpoint-ORIG-GUID: irI5J7NUXvt-rvRcC-babNVDtv_cJtnT X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-28_14,2022-11-28_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxlogscore=709 bulkscore=0 spamscore=0 suspectscore=0 clxscore=1015 impostorscore=0 phishscore=0 lowpriorityscore=0 adultscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211280126 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2022-11-22 at 10:36 +0800, Coiby Xu wrote: > Hi Mimi, > > On Mon, Nov 21, 2022 at 01:23:57PM -0500, Mimi Zohar wrote: > >Hi Coiby, > > > >On Mon, 2022-11-21 at 15:29 +0800, Coiby Xu wrote: > >> A kernel builder may not enable KEXEC_SIG and some architectures like > >> ppc64 simply don't have KEXEC_SIG. In these cases, unless both > >> IMA_ARCH_POLICY and secure boot also enabled, lockdown doesn't prevent > >> unsigned kernel image from being kexec'ed via the kexec_file_load > >> syscall whereas it could prevent one via the kexec_load syscall. Mandate > >> signature verification for those cases. > >> > >> Fixes: 155bdd30af17 ("kexec_file: Restrict at runtime if the kernel is locked down") > >> Cc: Matthew Garrett > >> Cc: Jiri Bohac > >> Cc: David Howells > >> Cc: kexec@lists.infradead.org > >> Cc: linux-integrity@vger.kernel.org > >> Signed-off-by: Coiby Xu > > > >Other than correcting the function name to mandate_signature_verificati > >on(), > > Applied to v2, thanks for correcting me! Btw, I realize I overwrote the > return code of kexec_image_verify_sig with > mandate_signature_verification's. v2 has fixed this issue as well. > > > > >Reviewed-by: Mimi Zohar > > And thanks for the review! You're welcome. Without either IMA_ARCH or KEXEC_SIG enabled, the kexec selftest test_kexec_file_load.sh properly failed with "kexec_file_load failed [PASS]", but from the informational messages output, it isn't clear why it failed. This should be corrected. -- thanks, Mimi