Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2457867pxb; Sun, 17 Apr 2022 23:58:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgyzTpTatvQNUJLUEeq67UanKf8o6QHOteu2uTYKafK1GXRmETu+JM3yC6UQlfonj8gRmZ X-Received: by 2002:a17:902:7407:b0:159:6a:8beb with SMTP id g7-20020a170902740700b00159006a8bebmr3185540pll.168.1650265137720; Sun, 17 Apr 2022 23:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650265137; cv=none; d=google.com; s=arc-20160816; b=V7w+6P4RsTPohazhEl0K8jZNoHpzK5mt5yC1ratjemie1C9PzTU8yRpcwLt11XpGNi gP2XK682lNxRZKgMcJgh/5hKBJ6NC+/DGhSaRe2vRlJ3ps0S9dhNkWscsp+ivKPGMjmz HNavqxEyG9WW3JM+shMwikuPyH9u8wR2w8k2hBueraW+a2WXNxdJNsVn4DzV1hewR/kw DBw84sRH5T1R/ANTaJN1iRnZjrMvIdTc9nwD0EDb1eGxgaUOVvx9gTpQP7wGMb92dMdV EIdSr2ppl8XEzS0n3slRk50RDMX7gtTnBS3X9LmdLC78N1KrSNr3B3aHIhEDI910q91l LRqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CjUVOfmdq+w5waJLzW1hPEzdp8hwxycbwFM39B4Hvjg=; b=DDfAoXsCCZz+4fBetIeztqVyh6Rr59O/0YOE6tm9XID/hLYYVhIA+iXsFyCVV+m1jL LQ9oPEWfzRBKXycVG4xtrW5ALNCglJH4SNGfhjmq3CEOYknWYfj8x0i+ib3/sdXvf4Q7 zkO+URyAWQvVNUDy0+9dr3lOuSK6zYuOMJ6bhlDZrFNeBnLUo6M3osolDSkz9nKB6aiL EVPNfoIn4MimcRjYitkfN7wW3PFYAvM4U8w342bkuzhqq5BGRV7Ot7zBLGd7YvtdjtIW 5IaCB7ptZaxiCPWDqkv8AUQU0obK/GZg2t1wUu0lBTVb/V3sw+mMfdxNiwPLPXE1it8B 5QMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gHsBgQm1; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j194-20020a636ecb000000b00397ffaa5f06si8435086pgc.718.2022.04.17.23.58.41; Sun, 17 Apr 2022 23:58:57 -0700 (PDT) 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=@redhat.com header.s=mimecast20190719 header.b=gHsBgQm1; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235805AbiDRCRV (ORCPT + 99 others); Sun, 17 Apr 2022 22:17:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235800AbiDRCRT (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 B97DE186C7 for ; Sun, 17 Apr 2022 19:14:41 -0700 (PDT) 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-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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 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 > >