Received: by 2002:a05:6a10:144:0:0:0:0 with SMTP id 4csp60630pxw; Fri, 8 Apr 2022 00:39:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2AoyohD+gxgvVcRsf1zC5VMbW3WH6s41qdFXFZrSHHQnSG13L9WzZqDZnI9ZGYP6uOue5 X-Received: by 2002:a05:6a00:198c:b0:4fa:c717:9424 with SMTP id d12-20020a056a00198c00b004fac7179424mr17825412pfl.63.1649403575460; Fri, 08 Apr 2022 00:39:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649403575; cv=none; d=google.com; s=arc-20160816; b=TYzHXcvqqPLzauRbgiH99bxfddNw97y8a+w5ne/ceLdlHAViBNUXrnUZKJC9oxl++q v/3xuabtaUCr6wkdn9pykZcfN9mLEBg4qrOjn/m1b7Oc3Zg1VovYiwtLeD4epceFSCx7 8WgFrdTjzSvaJBCDNS/LMjqCOLuBoN3RIzKlAzXyYMD+OmCN0DOKdYo3uLnWsmlci5Fc xBuqEXRnDrOufxUCfam51xyDIkj+Obf4UKeP2Pf7hPYtzSOk5gkyQBbNH18YIptxF5aD b3WEYJ3DUaGDzFWmpAd68/q4isr7PRQ+V0b8q726oGoc6X6u4vtlULhghKIoQBD8Pj71 N45g== 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=EIdT20lZyuxUif4lmdeJV2YtVVAT8aoGpkU+KSrIRGM=; b=wBQDNgnrviZWeGoxZtrubs3Ryc40ORWgTwtR63b40orBWH63M4TEYxsxwZrblWeEnj jJPRcGiOvo+ukXxI3SwdtAthUmnMEnGwCz8t+xSUf6q7LDhswWisrIdUuQfcBjBOgoh9 sGewJkWZDJ5gNT2XPzSoLqBOFTSoMVnPQ/HMN9nWX8QXsXuxE3+5/ySFV0QU1SE7V9U5 GfUTO/5LCEJXHxK0u1Vccdr0hI4P5XgUh+UfA0yUxDFymDJWb8HNA4xuAZ2T3iTYDssy UsoLRZGv8ubi5a82vniOCms7CcpXf+KL8dnZkJTWB3zlwFGZAZXH4wz1JEtOM/AsrUp8 O67w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aDxf4f0l; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id lb18-20020a17090b4a5200b001c650f7fa7esi4341526pjb.48.2022.04.08.00.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 00:39:35 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aDxf4f0l; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2AE9820D51C; Fri, 8 Apr 2022 00:12:59 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229456AbiDHHNa (ORCPT + 99 others); Fri, 8 Apr 2022 03:13:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229511AbiDHHN0 (ORCPT ); Fri, 8 Apr 2022 03:13:26 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BD35B209A72 for ; Fri, 8 Apr 2022 00:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649401881; 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=EIdT20lZyuxUif4lmdeJV2YtVVAT8aoGpkU+KSrIRGM=; b=aDxf4f0l4kagvWAtoOvj6R5Pwu21cI2UVD/PGyX6UPhfOAPcZ2vA7eyQocMK2fM6rhF6ph p5+ZgxJaKu2VdrayS+eYNbCl6GXvwlZfNuoGmxuLpigKII09PgcMe1PJfQJBI0ZoOzkQi8 9UIxVwCgY0BpkMiGSidgzaOWK7K/5Y0= 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-571-3p8lm4GcNhaDsIB05JZDhg-1; Fri, 08 Apr 2022 03:11:18 -0400 X-MC-Unique: 3p8lm4GcNhaDsIB05JZDhg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 44251805F68; Fri, 8 Apr 2022 07:11:17 +0000 (UTC) Received: from localhost (ovpn-12-202.pek2.redhat.com [10.72.12.202]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 00E57403179; Fri, 8 Apr 2022 07:11:16 +0000 (UTC) Date: Fri, 8 Apr 2022 15:11:08 +0800 From: Baoquan He To: Michal Suchanek , Coiby Xu Cc: Catalin Marinas , Will Deacon , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Philipp Rudo , Alexander Egorenkov , AKASHI Takahiro , James Morse , Dave Young , Mimi Zohar , Martin Schwidefsky , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, kexec@lists.infradead.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, stable@kernel.org Subject: Re: [PATCH 1/4] Fix arm64 kexec forbidding kernels signed with keys in the secondary keyring to boot Message-ID: References: <83b3583f35c50c609739a8d857d14e8410293373.1644953683.git.msuchanek@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83b3583f35c50c609739a8d857d14e8410293373.1644953683.git.msuchanek@suse.de> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi, On 02/15/22 at 08:39pm, Michal Suchanek wrote: > commit d3bfe84129f6 ("certs: Add a secondary system keyring that can be added to dynamically") > split of .system_keyring into .builtin_trusted_keys and > .secondary_trusted_keys broke kexec, thereby preventing kernels signed by > keys which are now in the secondary keyring from being kexec'd. > > Fix this by passing VERIFY_USE_SECONDARY_KEYRING to > verify_pefile_signature(). > > Cherry-picked from > commit ea93102f3224 ("Fix kexec forbidding kernels signed with keys in the secondary keyring to boot") This line may need a line feed? The patch 1~3 looks good to me. Coiby encountered the same issue on arm64, and has posted a patch series to fix that and there's clean up and code adjustment. https://lore.kernel.org/all/20220401013118.348084-1-coxu@redhat.com/T/#u Hi Coiby, Maybe you can check this patchset, and consider how to integrate your patches based on this patch 1~/3? For this patch itself, ack. Acked-by: Baoquan He > > Fixes: 732b7b93d849 ("arm64: kexec_file: add kernel signature verification support") > Cc: kexec@lists.infradead.org > Cc: keyrings@vger.kernel.org > Cc: linux-security-module@vger.kernel.org > Cc: stable@kernel.org > Signed-off-by: Michal Suchanek > --- > arch/arm64/kernel/kexec_image.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c > index 9ec34690e255..1fbf2ee7c005 100644 > --- a/arch/arm64/kernel/kexec_image.c > +++ b/arch/arm64/kernel/kexec_image.c > @@ -133,7 +133,8 @@ static void *image_load(struct kimage *image, > #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, > + return verify_pefile_signature(kernel, kernel_len, > + VERIFY_USE_SECONDARY_KEYRING, > VERIFYING_KEXEC_PE_SIGNATURE); > } > #endif > -- > 2.31.1 >