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 1CEFFC433F5 for ; Mon, 18 Apr 2022 02:15:45 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R5L8ZZpTSe4rc/lZAwn329qDF+vl1Us4dr6lfSTzHgw=; b=tbAnzSPL5DKTv9 Gk25v4U1LaIsoAUrqfwqe4m7BqjDA88gjy9E/nhcXj/RriPBZrA9q0WhN7EQ+E1V7lTMTfvD2uN8T ze0E+WNXf9VKQoRMEeZPhZU/XaJKHTm/hvZWGo7uss2G5LjtREVqBBj/Qk87bSzQzQGyvOe+O1hTB 3cGpchsBPtZLGQKpB8kdOtIb+d7Dyn+t0Dl1BRcXfKzkysb/ujTmC6XGdQjyZN4iUmbXemOnyfv/J Px3JPTBV0Wmb4HZBjELp5seNCBaf3A1sDPzTlvH7NyS9a7QckP8ogZWsFbmy2bTkO9m8qPjLTvs7m mibhCgFOl42dgrGj9SOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngGuZ-00FJPk-QO; Mon, 18 Apr 2022 02:14:43 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngGuX-00FJP6-6s for linux-arm-kernel@lists.infradead.org; Mon, 18 Apr 2022 02:14:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650248080; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=CjUVOfmdq+w5waJLzW1hPEzdp8hwxycbwFM39B4Hvjg=; b=gHsBgQm14vrCnZ+uf1M1S3oyeekYG4Cw4K5sd3FTgOrGP7+rxdkARquepDLBXk1RtmTBRt sPEQ3wmbtY2ZUD8sXs+wu0Mm/0RsKFBc+G37ztm8B4fcQmTK3eNdn3axU8CPbIdjpMsIgR 1+H0ypOOwk1GV0p/vZCt14VF32ok7CY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-248-ajl70rPPO7a1dQbxSqxrVg-1; Sun, 17 Apr 2022 22:14:37 -0400 X-MC-Unique: ajl70rPPO7a1dQbxSqxrVg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6A5B8811E76; Mon, 18 Apr 2022 02:14:36 +0000 (UTC) Received: from localhost (ovpn-12-21.pek2.redhat.com [10.72.12.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 933871454547; Mon, 18 Apr 2022 02:14:35 +0000 (UTC) Date: Mon, 18 Apr 2022 10:14:31 +0800 From: Baoquan He To: Coiby Xu Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Michal Suchanek , Dave Young , Will Deacon , "Eric W . Biederman" , Mimi Zohar , Chun-Yi Lee , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, stable@kernel.org, Catalin Marinas , James Morse , AKASHI Takahiro , open list Subject: Re: [PATCH v6 3/4] arm64: kexec_file: use more system keyrings to verify kernel image signature Message-ID: References: <20220414014344.228523-1-coxu@redhat.com> <20220414014344.228523-4-coxu@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220414014344.228523-4-coxu@redhat.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220417_191441_360801_D38F06F1 X-CRM114-Status: GOOD ( 20.66 ) 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="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 04/14/22 at 09:43am, Coiby Xu wrote: > Currently, a problem faced by arm64 is if a kernel image is signed by a > MOK key, loading it via the kexec_file_load() system call would be > rejected with the error "Lockdown: kexec: kexec of unsigned images is > restricted; see man kernel_lockdown.7". > > This happens because image_verify_sig uses only the primary keyring that > contains only kernel built-in keys to verify the kexec image. > > This patch allows to verify arm64 kernel image signature using not only > .builtin_trusted_keys but also .platform and .secondary_trusted_keys > keyring. > > Fixes: 732b7b93d849 ("arm64: kexec_file: add kernel signature verification support") Cc stable? Otherwise, LGTM, Acked-by: Baoquan He > Cc: kexec@lists.infradead.org > Cc: keyrings@vger.kernel.org > Cc: linux-security-module@vger.kernel.org > Cc: stable@kernel.org > Co-developed-by: Michal Suchanek > Signed-off-by: Michal Suchanek > Acked-by: Will Deacon > Signed-off-by: Coiby Xu > --- > arch/arm64/kernel/kexec_image.c | 11 +---------- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c > index 9ec34690e255..5ed6a585f21f 100644 > --- a/arch/arm64/kernel/kexec_image.c > +++ b/arch/arm64/kernel/kexec_image.c > @@ -14,7 +14,6 @@ > #include > #include > #include > -#include > #include > #include > #include > @@ -130,18 +129,10 @@ static void *image_load(struct kimage *image, > return NULL; > } > > -#ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG > -static int image_verify_sig(const char *kernel, unsigned long kernel_len) > -{ > - return verify_pefile_signature(kernel, kernel_len, NULL, > - VERIFYING_KEXEC_PE_SIGNATURE); > -} > -#endif > - > const struct kexec_file_ops kexec_image_ops = { > .probe = image_probe, > .load = image_load, > #ifdef CONFIG_KEXEC_IMAGE_VERIFY_SIG > - .verify_sig = image_verify_sig, > + .verify_sig = kexec_kernel_verify_pe_sig, > #endif > }; > -- > 2.34.1 > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel