From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4D59C433EF for ; Tue, 15 Feb 2022 22:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244500AbiBOWNI (ORCPT ); Tue, 15 Feb 2022 17:13:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244212AbiBOWNI (ORCPT ); Tue, 15 Feb 2022 17:13:08 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D00BE27CC3; Tue, 15 Feb 2022 14:12:57 -0800 (PST) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMCD6A010478; Tue, 15 Feb 2022 22:12:42 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=/cHHipy2Vrf9DNNqEWGyjkLiea6SsZVNuOOjBxjrCp8=; b=j4xmLzvTx/oD+6UhdbP9yHye6S8y4DqnnfA+ocCaun/sTfdtGSUn3OzGe01rIKDXMJxr m+IQnLJrye3iO49GLeSttLyYMWGnEzWRua+aohPWJYlsh6KMDAQ1aiFe5Aw5xFyMyNtT CKsCLQUf/l/XB6zRvYtyJgoivn7wwVBwZEvwQ3TypUcXM9SEIs9FgLT/6Go2Wo3Q8POw y7lLMm78W0lw6bCj3B94/E7sxT1laqr3zP+u22oRTXr72QdvJ2302Pv8Bo334ribwvXK JyE05+8BwtI3sKQESO1ECSydSGCX0AayuHmbApvZ2UPL/bWqporQUJ1mdNchkAGvQ7HD Sg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e8mrjr06p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 22:12:42 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21FMCguW011036; Tue, 15 Feb 2022 22:12:42 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e8mrjr06c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 22:12:41 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21FM81qo005730; Tue, 15 Feb 2022 22:12:39 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 3e64ha1spe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 22:12:39 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21FMCZvR40108478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 22:12:35 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 975044C046; Tue, 15 Feb 2022 22:12:35 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 088C44C040; Tue, 15 Feb 2022 22:12:33 +0000 (GMT) Received: from sig-9-65-88-149.ibm.com (unknown [9.65.88.149]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 15 Feb 2022 22:12:32 +0000 (GMT) Message-ID: Subject: Re: [PATCH 4/4] module, KEYS: Make use of platform keyring for signature verification From: Mimi Zohar To: Michal =?ISO-8859-1?Q?Such=E1nek?= Cc: Catalin Marinas , Will Deacon , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Philipp Rudo , Baoquan He , Alexander Egorenkov , AKASHI Takahiro , James Morse , Dave Young , Kairui Song , Martin Schwidefsky , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-modules@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, stable@kernel.org, Eric Snowberg Date: Tue, 15 Feb 2022 17:12:32 -0500 In-Reply-To: <20220215204730.GQ3113@kunlun.suse.cz> References: <840433bc93a58d6dfc4d96c34c0c3b158a0e669d.1644953683.git.msuchanek@suse.de> <3e39412657a4b0839bcf38544d591959e89877b8.camel@linux.ibm.com> <20220215204730.GQ3113@kunlun.suse.cz> 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: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Lfgs039T7NiW0yrKmn-MSn9TZGi34WFG X-Proofpoint-GUID: BGuDujqa9oRYPvZ-QlR_Ad2lgoH2nzLt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-15_07,2022-02-14_04,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 phishscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202150126 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org On Tue, 2022-02-15 at 21:47 +0100, Michal Suchánek wrote: > Hello, > > On Tue, Feb 15, 2022 at 03:08:18PM -0500, Mimi Zohar wrote: > > [Cc'ing Eric Snowberg] > > > > Hi Michal, > > > > On Tue, 2022-02-15 at 20:39 +0100, Michal Suchanek wrote: > > > Commit 278311e417be ("kexec, KEYS: Make use of platform keyring for signature verify") > > > adds support for use of platform keyring in kexec verification but > > > support for modules is missing. > > > > > > Add support for verification of modules with keys from platform keyring > > > as well. > > > > Permission for loading the pre-OS keys onto the "platform" keyring and > > using them is limited to verifying the kexec kernel image, nothing > > else. > > Why is the platform keyring limited to kexec, and nothing else? > > It should either be used for everything or for nothing. You have the > option to compile it in and then it should be used, and the option to > not compile it in and then it cannot be used. > > There are two basic use cases: > > (1) there is a vendor key which is very hard to use so you sign > something small and simple like shim with the vendor key, and sign your > kernel and modules with your own key that's typically enrolled with shim > MOK, and built into the kernel. > > (2) you import your key into the firmware, and possibly disable the > vendor key. You can load the kernel directly without shim, and then your > signing key is typically in the platform keyring and built into the > kernel. > > In neither case do I see any reason to use some keyrings for kexec and > other keyrings for modules. When building your own kernel there isn't a problem. Additional keys may be built into the kernel image, which are loaded onto the ".builtin_trusted_keys" keyring, and may be stored in MOK. Normally different keys are used for signing the kernel image and kernel modules. Kernel modules can be signed by the build time ephemeral kernel module signing key, which is built into the kernel and automatically loaded onto the ".builtin_trusted_keys" keyring. Similarly distros build the kernel module signing key into the kernel, which is built into the kernel and loaded onto the ".builtin_trusted_keys" keyring. By loading the pre-OS keys onto the ".platform" keyring, kexec may verify the distro or other signed kernel images. -- thanks, Mimi From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BCBAAC433F5 for ; Tue, 15 Feb 2022 22:14:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Mime-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=v8nbsdbfuTzHwqmVH02ZQA57/PYJ1cRsHpeqjVEK/ds=; b=fHrLydVVbh8SaX dNofrw8VKdAGaUky7jZ6NSOhgGQrGpHyx7tFGZj0Unry7b0qRKl/HlBdaonroMCYujBo1oODBUsly iot03abGJR8tDflVZSobv3lLFtY15wQEGfXgOPagBIET/E9zB+tWL4TvRNcgeluYoLGHO4vv2lnEW Q8QXg4F+DBo2kLbgtBCLPQkvbCglgvqKfxOTDQt2Wrezh2QxAxJo+4xyRR9u4H8L63baFTP6WdMym E9dtBS9a3p119rPqMuuNvjdyg2Yi2+DPVsV9oDxd1efBjYVbrV88nqwy4QUbv+3KzoXIHMT1JjfjA k6ZDkSUrq6EihOJQShew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nK646-004lr7-4G; Tue, 15 Feb 2022 22:12:54 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nK642-004lqd-P8 for linux-arm-kernel@lists.infradead.org; Tue, 15 Feb 2022 22:12:52 +0000 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 21FMCD6A010478; Tue, 15 Feb 2022 22:12:42 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=/cHHipy2Vrf9DNNqEWGyjkLiea6SsZVNuOOjBxjrCp8=; b=j4xmLzvTx/oD+6UhdbP9yHye6S8y4DqnnfA+ocCaun/sTfdtGSUn3OzGe01rIKDXMJxr m+IQnLJrye3iO49GLeSttLyYMWGnEzWRua+aohPWJYlsh6KMDAQ1aiFe5Aw5xFyMyNtT CKsCLQUf/l/XB6zRvYtyJgoivn7wwVBwZEvwQ3TypUcXM9SEIs9FgLT/6Go2Wo3Q8POw y7lLMm78W0lw6bCj3B94/E7sxT1laqr3zP+u22oRTXr72QdvJ2302Pv8Bo334ribwvXK JyE05+8BwtI3sKQESO1ECSydSGCX0AayuHmbApvZ2UPL/bWqporQUJ1mdNchkAGvQ7HD Sg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e8mrjr06p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 22:12:42 +0000 Received: from m0098399.ppops.net (m0098399.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 21FMCguW011036; Tue, 15 Feb 2022 22:12:42 GMT Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e8mrjr06c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 22:12:41 +0000 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 21FM81qo005730; Tue, 15 Feb 2022 22:12:39 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma03fra.de.ibm.com with ESMTP id 3e64ha1spe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 15 Feb 2022 22:12:39 +0000 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 21FMCZvR40108478 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Feb 2022 22:12:35 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 975044C046; Tue, 15 Feb 2022 22:12:35 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 088C44C040; Tue, 15 Feb 2022 22:12:33 +0000 (GMT) Received: from sig-9-65-88-149.ibm.com (unknown [9.65.88.149]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 15 Feb 2022 22:12:32 +0000 (GMT) Message-ID: Subject: Re: [PATCH 4/4] module, KEYS: Make use of platform keyring for signature verification From: Mimi Zohar To: Michal =?ISO-8859-1?Q?Such=E1nek?= Cc: Catalin Marinas , Will Deacon , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Philipp Rudo , Baoquan He , Alexander Egorenkov , AKASHI Takahiro , James Morse , Dave Young , Kairui Song , Martin Schwidefsky , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-modules@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, stable@kernel.org, Eric Snowberg Date: Tue, 15 Feb 2022 17:12:32 -0500 In-Reply-To: <20220215204730.GQ3113@kunlun.suse.cz> References: <840433bc93a58d6dfc4d96c34c0c3b158a0e669d.1644953683.git.msuchanek@suse.de> <3e39412657a4b0839bcf38544d591959e89877b8.camel@linux.ibm.com> <20220215204730.GQ3113@kunlun.suse.cz> X-Mailer: Evolution 3.28.5 (3.28.5-18.el8) Mime-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: Lfgs039T7NiW0yrKmn-MSn9TZGi34WFG X-Proofpoint-GUID: BGuDujqa9oRYPvZ-QlR_Ad2lgoH2nzLt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-15_07,2022-02-14_04,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 phishscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 mlxlogscore=999 mlxscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202150126 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220215_141250_867088_ED245915 X-CRM114-Status: GOOD ( 35.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 2022-02-15 at 21:47 +0100, Michal Such=E1nek wrote: > Hello, > = > On Tue, Feb 15, 2022 at 03:08:18PM -0500, Mimi Zohar wrote: > > [Cc'ing Eric Snowberg] > > = > > Hi Michal, > > = > > On Tue, 2022-02-15 at 20:39 +0100, Michal Suchanek wrote: > > > Commit 278311e417be ("kexec, KEYS: Make use of platform keyring for s= ignature verify") > > > adds support for use of platform keyring in kexec verification but > > > support for modules is missing. > > > = > > > Add support for verification of modules with keys from platform keyri= ng > > > as well. > > = > > Permission for loading the pre-OS keys onto the "platform" keyring and > > using them is limited to verifying the kexec kernel image, nothing > > else. > = > Why is the platform keyring limited to kexec, and nothing else? > = > It should either be used for everything or for nothing. You have the > option to compile it in and then it should be used, and the option to > not compile it in and then it cannot be used. > = > There are two basic use cases: > = > (1) there is a vendor key which is very hard to use so you sign > something small and simple like shim with the vendor key, and sign your > kernel and modules with your own key that's typically enrolled with shim > MOK, and built into the kernel. > = > (2) you import your key into the firmware, and possibly disable the > vendor key. You can load the kernel directly without shim, and then your > signing key is typically in the platform keyring and built into the > kernel. > = > In neither case do I see any reason to use some keyrings for kexec and > other keyrings for modules. When building your own kernel there isn't a problem. Additional keys may be built into the kernel image, which are loaded onto the ".builtin_trusted_keys" keyring, and may be stored in MOK. Normally different keys are used for signing the kernel image and kernel modules. Kernel modules can be signed by the build time ephemeral kernel module signing key, which is built into the kernel and automatically loaded onto the ".builtin_trusted_keys" keyring. = Similarly distros build the kernel module signing key into the kernel, which is built into the kernel and loaded onto the ".builtin_trusted_keys" keyring. By loading the pre-OS keys onto the ".platform" keyring, kexec may verify the distro or other signed kernel images. -- = thanks, Mimi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel