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

From
Andrey Konovalov <hidden>
Date
2020-09-29 13:48:41
Also in
linux-doc, linux-mm, lkml
Reply to
Marco Elver, 2020-09-29
On Tue, Sep 29, 2020 at 3:11 PM Marco Elver [off-list ref] wrote:
On Tue, Sep 29, 2020 at 02:42PM +0200, Andrey Konovalov wrote:
[...]
quoted
quoted
+        */
+       index = (addr - (unsigned long)__kfence_pool) / (PAGE_SIZE * 2) - 1;
Why do we subtract 1 here? We do have the metadata entry reserved for something?
Above the declaration of __kfence_pool it says:

        * We allocate an even number of pages, as it simplifies calculations to map
        * address to metadata indices; effectively, the very first page serves as an
        * extended guard page, but otherwise has no special purpose.

Hopefully that clarifies the `- 1` here.
So there are two guard pages at the beginning and only then a page
that holds an object?

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (50 messages) 50 messages, 9 authors, last reply 2020-10-15
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