lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230814164804.GO776869@hirez.programming.kicks-ass.net>
Date:   Mon, 14 Aug 2023 18:48:04 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Dan Williams <dan.j.williams@...el.com>
Cc:     linux-coco@...ts.linux.dev, Borislav Petkov <bp@...en8.de>,
        Tom Lendacky <thomas.lendacky@....com>,
        Dionna Glaze <dionnaglaze@...gle.com>,
        Brijesh Singh <brijesh.singh@....com>, x86@...nel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/5] virt: sevguest: Add TSM_REPORTS support for
 SNP_{GET, GET_EXT}_REPORT

On Mon, Aug 14, 2023 at 09:25:06AM -0700, Dan Williams wrote:
> Peter Zijlstra wrote:
> > On Mon, Aug 14, 2023 at 12:43:38AM -0700, Dan Williams wrote:
> > > +static u8 *sev_report_new(struct device *dev, const struct tsm_desc *desc,
> > 
> > > +			  size_t *outblob_len)
> > > +{
> > 
> > > +
> > > +	u8 *buf __free(kvfree) = kvzalloc(size, GFP_KERNEL);
> > > +
> > 
> > > +
> > > +	*outblob_len = size;
> > > +	no_free_ptr(buf);
> > > +	return buf;
> > 
> > This seems broken, no_free_ptr(x) is basically xchg(X, NULL) (except no
> > atomics). So the above would end up being:
> > 
> > 	return NULL;
> > 
> > What you want to write is somehting like:
> > 
> > 	return no_free_ptr(buf);
> > 
> > or, a convenient shorthand:
> > 
> > 	return_ptr(buf);
> > 
> 
> Oh, I indeed did not realize that no_free_ptr() had side effects beyond
> canceling the free when the variable goes out of scope. Will switch to
> return_ptr().

Indeed -- ideally no_free_ptr() would be combined with __must_check, but
I'm not immediately sure how to pull that off. Let me stick that on the
to-do list.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ