Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4949133pxb; Wed, 26 Jan 2022 01:06:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGP1DG52weYnTdNeAsZpWU7ONG8LtD7uG8phcwbBjWFHeYSPQH8Jhohg2wTw2caY6HUEm6 X-Received: by 2002:a63:8b42:: with SMTP id j63mr16878770pge.554.1643188016086; Wed, 26 Jan 2022 01:06:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643188016; cv=none; d=google.com; s=arc-20160816; b=qUFEoaVjH2PDXz7FnC3cZO/oYM+EtH0l9uV3B+NqwFikfirtNhrhykXZBN5SdQl6ED +b8HespY80Gi6P02WXG4jpe2+yxS24RYkftBxCnPOmWTvLfFuSrl52KxyYppTdSodY41 BvPvtiXkLQGkOkMiq9GpxYpSgNsChlUuaa4o7JMDoQQMYEyezdNDM1Q1TaE1vrvSfz9J UrynUaybHi1NLKVmNVNCOWk7sacg10lyAlSpkGJc8qDuwv5ZoW9HFRksuVfrBetsOump O0jpYwXm19hE4aZr3sTa2+ZWWm4rJZx+7aP4xRs8izU4h/Q/QTbCSV/OMaG5DjGMvzKA lbCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=IbFB6DTJJ4iMyawf6GaaHr11tjdCfEphnSRzGKo+FKs=; b=ubI2DoX4qODStLAbPkMhvuL6Aj82mWSnBOBWUwkg5Z2yV9xS7MKyo0eiH8TtbriY0F zT+uYBhWe5WX5qS4SpfbHIIRyQWvVU88Bgnkf+xMDnaerR2RyoBzni3GOxu2od3F1J8u kymTjFYAS/Xf48yE5J4RBdYKuyvUngmlfyqnwnn+vr6eapdXTfc1M4agQLSvuQpWU5nR HeUh1Iw+IkmBezRzFPVfKuYS4IUsOepSYiUZWLu4cgbKBauyC3xqi/SbfJOULc4Ju80v kd+Dr9ASygh/mfgSDbHMG7cBaX3d8jHlTaXIXowqlalS56S0o64fLudUACqPKmsL5mXU VOEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=hiazood1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a4si1320093pfv.259.2022.01.26.01.06.43; Wed, 26 Jan 2022 01:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=hiazood1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231545AbiAYUQJ (ORCPT + 99 others); Tue, 25 Jan 2022 15:16:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbiAYUQA (ORCPT ); Tue, 25 Jan 2022 15:16:00 -0500 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F229C06173B; Tue, 25 Jan 2022 12:16:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=IbFB6DTJJ4iMyawf6GaaHr11tjdCfEphnSRzGKo+FKs=; b=hiazood1qkVjV1i29ykJOnWMCG pdtGgjfRr96hOK0waryYHqV7CuQ/60g6frDloZA/2zMXXtSSQKnuSTghjdm71KfQj+e/sDTIZCFy3 9J4RUJMLlw0WDKwiygF+M5IkUWO7f/G+k5Xdcb5vVJlyxSzHEWqFhleKyd5OJsv4RoQMiLKGVuufL bCa6XqV+LdXruqudaZhXBJCpikPUHa0HuJfLOSqtAj0qqKnz5Xr7nQGgFiNC+u1JgvdPXuR5lqruO Cz9ifdazAA6u/1kbSK6EbkCepDMfDq0vsfcCDZbup3nuIOB8WuAbcvUtjGhMHuzBNhACRfOpBdfOw qOUzk6lQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nCSEO-009T8k-2u; Tue, 25 Jan 2022 20:15:56 +0000 Date: Tue, 25 Jan 2022 12:15:56 -0800 From: Luis Chamberlain To: Michal Suchanek , David Howells Cc: keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-integrity@vger.kernel.org, kexec@lists.infradead.org, Philipp Rudo , Mimi Zohar , Nayna , Rob Herring , linux-s390@vger.kernel.org, Vasily Gorbik , Lakshmi Ramasubramanian , Heiko Carstens , Jessica Yu , linux-kernel@vger.kernel.org, Christian Borntraeger , Paul Mackerras , Hari Bathini , Alexander Gordeev , linuxppc-dev@lists.ozlabs.org, Frank van der Linden , Thiago Jung Bauermann , Daniel Axtens , buendgen@de.ibm.com, Michael Ellerman , Benjamin Herrenschmidt , Christian Borntraeger , Herbert Xu , "David S. Miller" , Dmitry Kasatkin , James Morris , "Serge E. Hallyn" , Sven Schnelle , Baoquan He , linux-security-module@vger.kernel.org Subject: Re: [PATCH v5 3/6] kexec_file: Don't opencode appended signature verification. Message-ID: References: <7834eb187ef67cd88fc67f10e831130e3717d776.1641900831.git.msuchanek@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7834eb187ef67cd88fc67f10e831130e3717d776.1641900831.git.msuchanek@suse.de> Sender: Luis Chamberlain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 11, 2022 at 12:37:45PM +0100, Michal Suchanek wrote: > diff --git a/include/linux/verification.h b/include/linux/verification.h > index a655923335ae..32db9287a7b0 100644 > --- a/include/linux/verification.h > +++ b/include/linux/verification.h > @@ -60,5 +60,8 @@ extern int verify_pefile_signature(const void *pebuf, unsigned pelen, > enum key_being_used_for usage); > #endif > > +int verify_appended_signature(const void *data, unsigned long *len, > + struct key *trusted_keys, const char *what); > + Looks very non-module specific. > diff --git a/kernel/module_signing.c b/kernel/module_signing.c > index 8723ae70ea1f..30149969f21f 100644 > --- a/kernel/module_signing.c > +++ b/kernel/module_signing.c > @@ -14,32 +14,38 @@ > #include > #include "module-internal.h" > > -/* > - * Verify the signature on a module. > +/** > + * verify_appended_signature - Verify the signature on a module with the > + * signature marker stripped. > + * @data: The data to be verified > + * @len: Size of @data. > + * @trusted_keys: Keyring to use for verification > + * @what: Informational string for log messages > */ > -int mod_verify_sig(const void *mod, struct load_info *info) > +int verify_appended_signature(const void *data, unsigned long *len, > + struct key *trusted_keys, const char *what) > { > - struct module_signature ms; > - size_t sig_len, modlen = info->len; > + struct module_signature *ms; There goes the abstraction, so why not make this clear where we re-use the struct module_signature for various things and call it as it is, verify_mod_appended_signature() or some such? David? Any preference? Other than that: Reviewed-by: Luis Chamberlain Luis