Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp574164lqp; Fri, 5 Apr 2024 02:30:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWJZ/Yrs7kAFH9TlDKv9aeMGaa4Ifgoe6AaJwTSDb1oxbXbiD2LC03Y+urhqZfw7MpTVUpmi4gXG7kc0AUYovr8fmHeRIfPkvBW9EgRwQ== X-Google-Smtp-Source: AGHT+IH4MD1MEjw9xu/c2+rlNRP1wDzaRJDKttorwsB7fLO9NEJGBkUVb1/Gucxdvj5MC+otKAlw X-Received: by 2002:a05:6a00:1915:b0:6ec:ea3b:4529 with SMTP id y21-20020a056a00191500b006ecea3b4529mr944767pfi.11.1712309447814; Fri, 05 Apr 2024 02:30:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712309447; cv=pass; d=google.com; s=arc-20160816; b=eVHkuqzCIRNvtSjszX15r/wB4eOjgh2+CiSegNLW3jSzgKTEJL3FeXwbVSAUoFcOkE OKPkgv0oOgb3hg7ulFqFfr10F1hFS37bgEF6QfRFkaspVEXYtUXi6fVSHqSgiDuomTha 8hnQdr3O0r/pT9WqX5vShTFSaalDvufwI4QE4pNccJDu5M6Jmrl9Tw4z8tuZWcvwC/fC JrqSiIIMXwjuWV9V2D86FaAUEilu8J3X1ZH1hyv380oCANVKsv2lx+bsGskVG5L3L7T1 XqL4HqgE30iS7OjxiSAYvD2zVrH8hRbk5FLJwiSEasLzebtkMtgO0WbWA8hucWzKAoiR evIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date; bh=Wp1Mz1L1z5XIGZFBc/IW+99s3ZWbSJQ6efqNqTBuyJo=; fh=Li5i1MTar58DduIiPWt4WiHkIdPAl70/ymDO1HQqQPE=; b=lcyWL0myqNu/Gnav3OU0Zgvv+hLGmKsFKh68WOVUk04KuKPefICv2NsyxgsHqGRPpU R16BB/EVG/H81GawpjrNH1xlju68ufQFK5d2eOqpJO8RPCdMR/EQe6nC7NkbYIrTpTf3 9E5SLT37YM9fU7DlWQOIKYqvOAIK8B3dERaVeZrjr8RUdeU30NCc15JVSHnsuO6fM1OQ HKgjtFSxe/oPZtC+qoc7n6B8OOMy2QTUdFQNbNkVDu1zsunk5frT47sfexNL3GiSV1zr TftsM444+xE5PyXq2uIbUariK7kQDmp31zT69o87rEjK2ruBmgZxxie7BHaBO20/uPVZ 6uYA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-3366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3366-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l34-20020a635b62000000b005dbed76d0b0si1038296pgm.779.2024.04.05.02.30.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 02:30:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-3366-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3366-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 51D2AB214D3 for ; Fri, 5 Apr 2024 09:29:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 011C715FD08; Fri, 5 Apr 2024 09:29:18 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B96815FCE2; Fri, 5 Apr 2024 09:29:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=176.9.242.62 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712309357; cv=none; b=qNeMiZz5IzN97B9e6L9I6mu1xjljEVVKQSs5pi2R9YvKyxIaO9j6pm8XHB52RYVyQM0CzKLMZ5it6diHmFBWkoP7fS/CIqPZXzYj2/1i1s1dLwTlix/SsqK4SezgJNDA+VeqydcG0RI2aZp6lcVZdjvMulYQGiWQ8zmXUTEFwew= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712309357; c=relaxed/simple; bh=Y24ye3Z3sxdzRUqBmE+2D+Ilmvls6rU9q0bvb5UvSM8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=sQnMwVm1MKhQgy5i15FWHbn7cd1i4f4tChFccI677TVvTAqYm5IWCtE7PFUcjayQxvCZ9QDvXBQsNs/T2TWDil7WkD4bI4COOhETmpQg2GyRRwOX4KmqNtIqJXaN871zvAhH9lQjJKo/kaP6vKGjmK7iR/beprZ8MAbiwhPeHI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de; spf=none smtp.mailfrom=h08.hostsharing.net; arc=none smtp.client-ip=176.9.242.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 1C4E8100DA1A6; Fri, 5 Apr 2024 11:29:06 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id E7B329926C7; Fri, 5 Apr 2024 11:29:05 +0200 (CEST) Date: Fri, 5 Apr 2024 11:29:05 +0200 From: Lukas Wunner To: Jarkko Sakkinen Cc: David Howells , Herbert Xu , "David S. Miller" , Jonathan Cameron , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, Andy Shevchenko , Peter Zijlstra , Dan Williams , Ard Biesheuvel , Nick Desaulniers , Nathan Chancellor Subject: Re: [PATCH v3] X.509: Introduce scope-based x509_certificate allocation Message-ID: Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Feb 20, 2024 at 06:00:41PM +0000, Jarkko Sakkinen wrote: > On Tue Feb 20, 2024 at 3:10 PM UTC, Lukas Wunner wrote: > > Add a DEFINE_FREE() clause for x509_certificate structs and use it in > > x509_cert_parse() and x509_key_preparse(). These are the only functions > > where scope-based x509_certificate allocation currently makes sense. > > A third user will be introduced with the forthcoming SPDM library > > (Security Protocol and Data Model) for PCI device authentication. > > I think you are adding scope-based memory management and not > DEFINE_FREE(). Otherwise, this would be one-liner patch. Above it states very clearly: "and use it in x509_cert_parse() and x509_key_preparse()". That's the reason it is not a one-liner patch. > I'm not sure if the last sentence adds more than clutter as this > patch has nothing to do with SPDM changes per se. I disagree. It is important as a justification for the change that the two functions converted here are not going to be the only users, but that there's a third one coming up. > > I've compared the Assembler output before/after and they are identical, > > save for the fact that gcc-12 always generates two return paths when > > __cleanup() is used, one for the success case and one for the error case. > > Use passive as commit message is not a personal letter. Okay, I will respin and change to passive mood. > I don't see a story here but instead I see bunch of disordered tecnical > terms. That doesn't sound like constructive criticism. > We have the code diff for detailed technical stuff. The commit message > should simply explain why we want this and what it does for us. [...] > What is the most important function of a commit message? Well, it comes > when the commit is in the mainline. It reminds of the *reasons* why a > change was made and this commit message does not really serve well in > that role. The reason for the commit is that Jonathan requested it during code review of my PCI device authentication patches. I've been stating this very clearly in the first iteration of the present patch. You asked that I delete the sentence and instead use a Suggested-by. Perhaps it would have been better had I not listened to you. Because now you seem to have forgotten the reason for the patch, which, again, you asked me to delete. FWIW, here's the link to Jonathan's review: https://lore.kernel.org/all/20231003153937.000034ca@Huawei.com/ And here's the quote with his explicit request to use cleanup.h: "Maybe cleanup.h magic? Seems like it would simplify error paths here a tiny bit. Various other cases follow, but I won't mention this every time [...] Even this could be done with the cleanup.h stuff with appropriate pointer stealing and hence allow direct returns. This is the sort of case that I think really justifies that stuff." Thanks, Lukas