# Re: \[PATCH v4 02/11\] x86, kfence: enable KFENCE for x86

- From: Jann Horn \<jannh@google.com\>
- Date: 2020-10-02 06:09:25 
- List: linux-arm-kernel
- Page: https://ratatoskr.run/linux-arm-kernel/2020/10/6128247
- Thread: https://ratatoskr.run/linux-doc/2020/09/6124388/t.md

```text
On Tue, Sep 29, 2020 at 3:38 PM Marco Elver [ref] wrote:
> Add architecture specific implementation details for KFENCE and enable
> KFENCE for the x86 architecture. In particular, this implements the
> required interface in <asm/kfence.h> for setting up the pool and
> providing helper functions for protecting and unprotecting pages.
[...]
> diff --git a/arch/x86/include/asm/kfence.h b/arch/x86/include/asm/kfence.h
[...]
> +/* Protect the given page and flush TLBs. */
> +static inline bool kfence_protect_page(unsigned long addr, bool protect)
> +{
[...]
> +       flush_tlb_one_kernel(addr);

flush_tlb_one_kernel() -> flush_tlb_one_user() ->
__flush_tlb_one_user() -> native_flush_tlb_one_user() only flushes on
the local CPU core, not on others. If you want to leave it this way, I
think this needs a comment explaining why we're not doing a global
flush (locking context / performance overhead / ... ?).

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
```
