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] [day] [month] [year] [list]
Message-ID: <202205121211.B7EFB5A@keescook>
Date:   Thu, 12 May 2022 12:12:02 -0700
From:   Kees Cook <keescook@...omium.org>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org,
        linux-hardening@...r.kernel.org
Subject: Re: [RFC][PATCH] lkdtm/usercopy: Add tests for other memory types

On Thu, May 12, 2022 at 07:56:13PM +0100, Matthew Wilcox wrote:
> On Thu, May 12, 2022 at 11:36:13AM -0700, Kees Cook wrote:
> > +static void lkdtm_USERCOPY_FOLIO(void)
> > +{
> > +	struct folio *folio;
> > +	void *addr;
> > +
> > +	/*
> > +	 * FIXME: Folio checking currently misses 0-order allocations, so
> > +	 * allocate and bump forward to the last page.
> > +	 */
> > +	folio = folio_alloc(GFP_KERNEL | __GFP_ZERO, 1);
> > +	if (!folio) {
> > +		pr_err("folio_alloc() failed!?\n");
> > +		return;
> > +	}
> > +	addr = page_address(&folio->page);
> 
> Ideally, code shouldn't be using &folio->page.  If it is, we have a
> gap in the folio API.  Fortunately, we have folio_address().

Ah! Perfect, thanks. In trying to find the right alloc/free pair I
missed folio_address() :)

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ