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 EF253C433F5 for ; Mon, 18 Apr 2022 02:14:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235803AbiDRCRU (ORCPT ); Sun, 17 Apr 2022 22:17:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235799AbiDRCRT (ORCPT ); Sun, 17 Apr 2022 22:17:19 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2773A186C8 for ; Sun, 17 Apr 2022 19:14:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650248081; 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=BttXnTVee/9104vcgkkJvCt+JRyJzLOTdOZfx/eNTKxxGw7zFA5zYmGCzGaPoSXReZbzgb HKmzjUxtI0fKnpRqbGAvHa8dCEwXFHER7QXZYsGCnvBMT3pcB+2Q3K/bEh0+UxTY+JNSYV 37EJEvIejwSJykuMhmVYEoPt9C93ybU= 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220414014344.228523-4-coxu@redhat.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Precedence: bulk List-ID: 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 > >