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

Hillf Danton hdanton at sina.com
Thu Sep 17 19:45:39 EDT 2020


On Thu, 17 Sep 2020 15:36:38 +0200 Marco Elver wrote:
> On Thu, 17 Sep 2020 at 15:26, Hillf Danton wrote:
> > Tue, 15 Sep 2020 15:20:37 +0200
> > > From: Alexander Potapenko <glider at 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?

Yes, that's great.
> 
> https://lore.kernel.org/linux-arm-kernel/20200915132046.3332537-10-elver@google.com/
> (at "The following figure illustrates the page layout::")
> 
> Let us know if you'd like that copied into the commit message.

Then the copy can help more readers.

Thanks
Hillf




More information about the linux-arm-kernel mailing list