Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp321057pxb; Tue, 12 Apr 2022 02:49:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRKJs2hlAIlhyirNMxgTchvDqLLihPzE49+V7zP6ul6/H54N52mGHVV6xMECvbf7VNNw+b X-Received: by 2002:a17:907:9620:b0:6e8:3f98:f3ea with SMTP id gb32-20020a170907962000b006e83f98f3eamr22249202ejc.142.1649756999387; Tue, 12 Apr 2022 02:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649756999; cv=none; d=google.com; s=arc-20160816; b=cWBhxWDWEqoZRw4RaJ5n0hiltx5risuOhbKyVd12w258B6dGJFwBshmpyHS23z/LPt Ln6RqmNg3ab/v+j5NDsmRBsW+rThaEbg6wX62vRYNPbBLwMWpRHX9nObhuRiV60HIXEe f2+FJpIgH5Jr6r/I9bhS8bWPatsqF2cpYqVk6FFtSlIdRjOGrqcExoHlvSUmtrIGwv4T Zy6o8roZ1HhFPlpXLechuW4lnoUDzuyIIvpjYZn1NIOhdp/QJ0Ww8e6h05YOsJkMkGhK 8QLsd56pe8EwYKy7qMT9bgTv9TNt3Q6sgdCmEhyk5puHp1BydfL0lqekV0mMgLx6SfzQ DD8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=Yym+/I6u//ozhc2zOZPC1O+yPiCJTgPKVNmp6jtW5XY=; b=o/7hdiO2bkpkATD8ce4KX1+Slpk//vTJ1gRzaV8/EzhJ65+23LBIjYg+rZx7HM0aw/ QPOrPEq8ojSenk24x/Hf4uTRUMgbIoWZ3hHH0laFfcO1oSPWhZiUteqf0xydkchCELku SlYOHt3/PAHZWJOwaPvheZc3SV9UEpTD8uB9ksJfCEAwRFz5pbJoASWNQCBw0WoVe8FH nffc7WO2HyzyXPOlTOf4Yho+baYAxknQdgALV8R/2lqKTq/n+SdEYd2c0aTcRsft9mr0 Il536SufqccRcD0sze7E7REOn30j5PU8kO8jmF+kfgYGXoTRjtSlCFjIK8o3V2b6dEVN eBPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=XxWqmXVM; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=q0Aiicaj; 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=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs11-20020a1709072d0b00b006dfc9a27ec9si10902380ejc.789.2022.04.12.02.49.34; Tue, 12 Apr 2022 02:49:59 -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=@suse.de header.s=susede2_rsa header.b=XxWqmXVM; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=q0Aiicaj; 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=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236336AbiDKJB6 (ORCPT + 99 others); Mon, 11 Apr 2022 05:01:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344002AbiDKJB4 (ORCPT ); Mon, 11 Apr 2022 05:01:56 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69B7A286F4 for ; Mon, 11 Apr 2022 01:59:41 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 1BD5021115; Mon, 11 Apr 2022 08:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1649667580; h=from:from:reply-to: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=Yym+/I6u//ozhc2zOZPC1O+yPiCJTgPKVNmp6jtW5XY=; b=XxWqmXVMraBVrm9/9a1ObsoomHNnSINj7CKniUwKgeFDA1Ny3GoEJhT/SR6YL+gwfu024u UR6sgIXRP8cDKWwDpnapwLi7uE9hDkA+zaPwmduotvvQ0bRY13+F7v1SJi50b3p9gwIaN5 vlQeb23apbsb6/Jt3Rn82MLrM8UzPuU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1649667580; h=from:from:reply-to: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=Yym+/I6u//ozhc2zOZPC1O+yPiCJTgPKVNmp6jtW5XY=; b=q0Aiicajw/Tq2Jsh9GpLgprlXwhdtBRHnxgF+HBV0gAmHZlk4cHsL/LLaGCS2fPUbUMiWL 7JkE32i5MKWSWqBA== Received: from kunlun.suse.cz (unknown [10.100.128.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id DEB9DA3B94; Mon, 11 Apr 2022 08:59:39 +0000 (UTC) Date: Mon, 11 Apr 2022 10:59:38 +0200 From: Michal =?iso-8859-1?Q?Such=E1nek?= To: Coiby Xu Cc: kexec@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Baoquan He , Dave Young , Will Deacon , "Eric W . Biederman" , Catalin Marinas , open list Subject: Re: [PATCH v5 3/3] arm64: kexec_file: use more system keyrings to verify kernel image signature Message-ID: <20220411085938.GA163591@kunlun.suse.cz> References: <20220401013118.348084-1-coxu@redhat.com> <20220401013118.348084-4-coxu@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220401013118.348084-4-coxu@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,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 Fri, Apr 01, 2022 at 09:31:18AM +0800, 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 is 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_key > keyring. > > Acked-by: Will Deacon > Signed-off-by: Coiby Xu > --- > arch/arm64/kernel/kexec_image.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/arch/arm64/kernel/kexec_image.c b/arch/arm64/kernel/kexec_image.c > index 9ec34690e255..51af1c22d6da 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 > @@ -133,8 +132,7 @@ 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, > - VERIFYING_KEXEC_PE_SIGNATURE); > + return kexec_kernel_verify_pe_sig(kernel, kernel_len); > } > #endif You can eliminate image_verify_sig here aswell and directly assign kexec_kernel_verify_pe_sig to fops. Thanks Michal