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 74CD1C433F5 for ; Mon, 18 Apr 2022 02:11:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233700AbiDRCNu (ORCPT ); Sun, 17 Apr 2022 22:13:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232816AbiDRCNt (ORCPT ); Sun, 17 Apr 2022 22:13:49 -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 7BCD0186C2 for ; Sun, 17 Apr 2022 19:11:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1650247871; 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=ZKaQFNHJPrlVC1wRNehHPLwYyKFIA2KNeeEMoRic3Y0=; b=Th7+juziiiRa+hV1HeSrYhYKn+NzrrMjpeWTFr5wxBswt4eE6Vj5Kw1k6W/wG+m9TTApbR QK+gr20OVM5r8a4nhfqWVkoVawCNpO67TqtnytYGe3Kw3QP1LHuoH6fghVFYf2u9fwb/jb //YJ7LIckx3ZbTivd/CAYiH8teMhNRk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-303-WDnMna3fO8-lP_vzT6cKaw-1; Sun, 17 Apr 2022 22:11:08 -0400 X-MC-Unique: WDnMna3fO8-lP_vzT6cKaw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B96929AB3F1; Mon, 18 Apr 2022 02:11:07 +0000 (UTC) Received: from localhost (ovpn-12-21.pek2.redhat.com [10.72.12.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2FB7DC28105; Mon, 18 Apr 2022 02:11:06 +0000 (UTC) Date: Mon, 18 Apr 2022 10:11:02 +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 , Philipp Rudo , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, stable@kernel.org, Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Martin Schwidefsky , "open list:S390" , open list Subject: Re: [PATCH v6 4/4] kexec, KEYS, s390: Make use of built-in and secondary keyring for signature verification Message-ID: References: <20220414014344.228523-1-coxu@redhat.com> <20220414014344.228523-5-coxu@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220414014344.228523-5-coxu@redhat.com> X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Precedence: bulk List-ID: On 04/14/22 at 09:43am, Coiby Xu wrote: > From: Michal Suchanek > > commit e23a8020ce4e ("s390/kexec_file: Signature verification prototype") > adds support for KEXEC_SIG verification with keys from platform keyring > but the built-in keys and secondary keyring are not used. > > Add support for the built-in keys and secondary keyring as x86 does. > > Fixes: e23a8020ce4e ("s390/kexec_file: Signature verification prototype") Should Cc stable kernel? Otherwise, LGTM, Acked-by: Baoquan He > Cc: Philipp Rudo > 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 > Reviewed-by: "Lee, Chun-Yi" > Signed-off-by: Coiby Xu > --- > arch/s390/kernel/machine_kexec_file.c | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > > diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machine_kexec_file.c > index 8f43575a4dd3..fc6d5f58debe 100644 > --- a/arch/s390/kernel/machine_kexec_file.c > +++ b/arch/s390/kernel/machine_kexec_file.c > @@ -31,6 +31,7 @@ int s390_verify_sig(const char *kernel, unsigned long kernel_len) > const unsigned long marker_len = sizeof(MODULE_SIG_STRING) - 1; > struct module_signature *ms; > unsigned long sig_len; > + int ret; > > /* Skip signature verification when not secure IPLed. */ > if (!ipl_secure_flag) > @@ -65,11 +66,18 @@ int s390_verify_sig(const char *kernel, unsigned long kernel_len) > return -EBADMSG; > } > > - return verify_pkcs7_signature(kernel, kernel_len, > - kernel + kernel_len, sig_len, > - VERIFY_USE_PLATFORM_KEYRING, > - VERIFYING_MODULE_SIGNATURE, > - NULL, NULL); > + ret = verify_pkcs7_signature(kernel, kernel_len, > + kernel + kernel_len, sig_len, > + VERIFY_USE_SECONDARY_KEYRING, > + VERIFYING_MODULE_SIGNATURE, > + NULL, NULL); > + if (ret == -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) > + ret = verify_pkcs7_signature(kernel, kernel_len, > + kernel + kernel_len, sig_len, > + VERIFY_USE_PLATFORM_KEYRING, > + VERIFYING_MODULE_SIGNATURE, > + NULL, NULL); > + return ret; > } > #endif /* CONFIG_KEXEC_SIG */ > > -- > 2.34.1 > >