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 53CADC433EF for ; Mon, 18 Apr 2022 05:51:30 +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-Type: Content-Transfer-Encoding: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=osnCQ9JeVli+MdyaZME1p0xWO6bPbQoh7D7BeqSJj5k=; b=fTItJ9fbfWiEW07YwrQ4K9/t0I ryA2XSocZng4dN6GvoLp9XHjcVDnTxhs9d4iyJb/+UtJDZnazjNOMNyFYt0YjDRI9u8DdlSXAC7xc 1Et2NTTsHXWfH6vqY9E3ZAtjAUO4NFVKHF8sADaTO7oBTHVlLNP9C7yvZmn/AkbaLsuT8p+fzYRuM xQRboV7QIux0Q3+YWROTB4zTpk5Phnw03WKue6zkmLRJBKJ0HebAeSX1yRe6Mpl5LspElmCxSlg+B IDDjoWkggFkeGa+nwx8hhCZcQ+uwwHYu5MgaBvDYU3RHym/jbBWBsZJUy2jqg7FsDirMS7MIaSXZp WDBfCE8g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngKHK-00Fj4q-TC; Mon, 18 Apr 2022 05:50:27 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ngKHI-00Fj47-8n for linux-arm-kernel@lists.infradead.org; Mon, 18 Apr 2022 05:50:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650261023; 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=BQi37t5ImtJGz8dpkcjwi4DmC/UUnyTxDNTmEnfJgZE=; b=C3soIxfj83sZRSqKjKiTnChR6BPFwasnwX/5hUnSv4966/NyX1ZPNV/iL8HfYzJWbLxSGi f1Sw2/LK7rPd6Wjt4tbPhhwWRrNitiVom32YgiMtQoieiHn2xobNsxV+JxNv979Zd0D0zE aHYapaljHvTBtz6KWHg3xw8LC6ZGTXY= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-649-C8-qCb6lPuaBZqPAKg8POQ-1; Mon, 18 Apr 2022 01:50:13 -0400 X-MC-Unique: C8-qCb6lPuaBZqPAKg8POQ-1 Received: by mail-pj1-f72.google.com with SMTP id l10-20020a17090a72ca00b001cd46918af5so8478810pjk.8 for ; Sun, 17 Apr 2022 22:50:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=BQi37t5ImtJGz8dpkcjwi4DmC/UUnyTxDNTmEnfJgZE=; b=vB2NATpiOqw8NIHfZ6jxfcuDJ6/dgrXmY8EM7K20Qh+JpqmNl/thxQ4jEjPqzH28nG 3w595cA/3WPV81iYl5oYiPAv6YoaZdCdZ0OgJPRBdLTu5GbRNJJ6nTpL56J1fnhioA26 OlGHzGTpozYSR0mTiYFn4iUOewPMXSlVjeHwVhmq7or6A3DFeUVpRDJSE0k0ZSzN444z X5+gCi7nDVkVQl1CrxQdbeAc/UIO8OtiKuW2RkP6Z34MXRXe4BxZMsVBHS29w8hgNTD0 tPSUKRvnFw8bWT3AWPh8p0gxnjfn/Ndnt5s+VIp+fbLvPdO+Y8/nEAGW/IHajA/C6pkw DsEw== X-Gm-Message-State: AOAM531OpyKG2Ts7SFzdI3bgy/VEFqWPQxvvDnP8GmkoI7+Y1/5ogAjS nRUwOPCJkIFj4rPhsBlvxqjEgx66LKEdieg8ZSvI1uXKOEzmj8a9dIihEHrj/4YEtl6fE9lWMrw ZVa0s+S2enIwMP815dYTNL+8OTcHiC+HlWIY= X-Received: by 2002:a17:902:6b4b:b0:158:d86f:b232 with SMTP id g11-20020a1709026b4b00b00158d86fb232mr9562151plt.106.1650261012668; Sun, 17 Apr 2022 22:50:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwoSw0iKfS7lUTSONvN9gfujuFvECmwh9pZuI5ewINby/kFfzo9o5ZOvaHPQ7r4DFG4n6wQNg== X-Received: by 2002:a17:902:6b4b:b0:158:d86f:b232 with SMTP id g11-20020a1709026b4b00b00158d86fb232mr9562133plt.106.1650261012447; Sun, 17 Apr 2022 22:50:12 -0700 (PDT) Received: from localhost ([240e:3a1:2e1:fc30:496c:36d3:5798:d144]) by smtp.gmail.com with ESMTPSA id y16-20020a637d10000000b00381268f2c6fsm11661092pgc.4.2022.04.17.22.50.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Apr 2022 22:50:11 -0700 (PDT) Date: Mon, 18 Apr 2022 13:46:12 +0800 From: Coiby Xu To: Baoquan He 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: <20220418054612.54knzv4gqoxbq57a@Rk> References: <20220414014344.228523-1-coxu@redhat.com> <20220414014344.228523-4-coxu@redhat.com> MIME-Version: 1.0 In-Reply-To: Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=coxu@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220417_225024_412525_F5A39485 X-CRM114-Status: GOOD ( 18.22 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Apr 18, 2022 at 10:14:31AM +0800, Baoquan He wrote: >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? Thanks for the reminder! I've added "Cc stable@kernel.org". But it seems I should Cc stable@vger.kernel.org instead. > >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 >> >> > -- Best regards, Coiby _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel