Re: crypto: Kernel memory overwrite attempt detected to spans multiple pages

From: Kees Cook
Date: Wed Apr 10 2019 - 19:27:46 EST


On Wed, Apr 10, 2019 at 4:12 PM Eric Biggers <ebiggers@xxxxxxxxxx> wrote:
> You've explained *what* it does again, but not *why*. *Why* do you want
> hardened usercopy to detect copies across page boundaries, when there is no
> actual buffer overflow?

But that *is* how it determines it was a buffer overflow: "if you
cross page boundaries (of a non-compound allocation), it *is* a buffer
overflow". This assertion, however, is flawed because many contiguous
allocations are not marked as being grouped together when it reality
they were. It was an attempt to get allocation size information out of
the page allocator, similar to how slab can be queries about
allocation size. I'm open to improvements here, since it's obviously
broken in its current state. :)

--
Kees Cook