[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGXu5jKaVB=bTJCBWhsxAny7-OkzXQ+8KCd5O+_-7hKcJFiqKw@mail.gmail.com>
Date: Mon, 15 Apr 2019 22:14:51 -0500
From: Kees Cook <keescook@...omium.org>
To: Matthew Wilcox <willy@...radead.org>
Cc: Herbert Xu <herbert@...dor.apana.org.au>,
Kees Cook <keescook@...omium.org>,
Eric Biggers <ebiggers@...nel.org>,
Rik van Riel <riel@...riel.com>,
linux-crypto <linux-crypto@...r.kernel.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
linux-security-module <linux-security-module@...r.kernel.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Laura Abbott <labbott@...hat.com>,
Linux-MM <linux-mm@...ck.org>
Subject: Re: [PATCH] crypto: testmgr - allocate buffers with __GFP_COMP
On Mon, Apr 15, 2019 at 9:18 PM Matthew Wilcox <willy@...radead.org> wrote:
> I agree; if the crypto code is never going to try to go from the address of
> a byte in the allocation back to the head page, then there's no need to
> specify GFP_COMP.
>
> But that leaves us in the awkward situation where
> HARDENED_USERCOPY_PAGESPAN does need to be able to figure out whether
> 'ptr + n - 1' lies within the same allocation as ptr. Without using
> a compound page, there's no indication in the VM structures that these
> two pages were allocated as part of the same allocation.
>
> We could force all multi-page allocations to be compound pages if
> HARDENED_USERCOPY_PAGESPAN is enabled, but I worry that could break
> something. We could make it catch fewer problems by succeeding if the
> page is not compound. I don't know, these all seem like bad choices
> to me.
If GFP_COMP is _not_ the correct signal about adjacent pages being
part of the same allocation, then I agree: we need to drop this check
entirely from PAGESPAN. Is there anything else that indicates this
property? (Or where might we be able to store that info?)
There are other pagespan checks, though, so those could stay. But I'd
really love to gain page allocator allocation size checking ...
--
Kees Cook
Powered by blists - more mailing lists