Re: [PATCH v2 01/10] mm: add Kernel Electric-Fence infrastructure

From
Marco Elver <elver@google.com>
Date
2020-09-17 13:36:54
Also in
linux-mm
Reply to
Hillf Danton, 2020-09-17
On Thu, 17 Sep 2020 at 15:26, Hillf Danton [off-list ref] wrote:

Tue, 15 Sep 2020 15:20:37 +0200
quoted
From: Alexander Potapenko <glider@google.com>

This adds the Kernel Electric-Fence (KFENCE) infrastructure. KFENCE is a
low-overhead sampling-based memory safety error detector of heap
use-after-free, invalid-free, and out-of-bounds access errors.

KFENCE is designed to be enabled in production kernels, and has near
zero performance overhead. Compared to KASAN, KFENCE trades performance
for precision. The main motivation behind KFENCE's design, is that with
enough total uptime KFENCE will detect bugs in code paths not typically
exercised by non-production test workloads. One way to quickly achieve a
large enough total uptime is when the tool is deployed across a large
fleet of machines.

KFENCE objects each reside on a dedicated page, at either the left or
right page boundaries. The pages to the left and right of the object
page are "guard pages", whose attributes are changed to a protected
state, and cause page faults on any attempted access to them. Such page
faults are then intercepted by KFENCE, which handles the fault
gracefully by reporting a memory access error.
To help understand the magic of KFENCE, a simple diagram looks needed to
illustrate the relations between obj and guard pages, something like the
below asiic chart.

        |-----------------|-----------------------------------|------------------|
        | left guard page | the page containing KFENCE object | right guard page |
        |-----------------|-----------------------------------|------------------|
Would the one we have in Documentation be what you're after?

https://lore.kernel.org/linux-arm-kernel/20200915132046.3332537-10-elver@google.com/ (local)
(at "The following figure illustrates the page layout::")

Let us know if you'd like that copied into the commit message.

Thanks,
-- Marco

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (21 messages) 21 messages, 6 authors, last reply 2020-09-18
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help