[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH v2 17/19] heki: x86: Update permissions counters during t
|
From: |
Peter Zijlstra |
|
Subject: |
Re: [RFC PATCH v2 17/19] heki: x86: Update permissions counters during text patching |
|
Date: |
Thu, 30 Nov 2023 12:33:15 +0100 |
On Wed, Nov 29, 2023 at 03:07:15PM -0600, Madhavan T. Venkataraman wrote:
> Kernel Lockdown
> ---------------
>
> But, we must provide at least some security in V2. Otherwise, it is useless.
>
> So, we have implemented what we call a kernel lockdown. At the end of kernel
> boot, Heki establishes permissions in the extended page table as mentioned
> before. Also, it adds an immutable attribute for kernel text and kernel RO
> data.
> Beyond that point, guest requests that attempt to modify permissions on any of
> the immutable pages will be denied.
>
> This means that features like FTrace and KProbes will not work on kernel text
> in V2. This is a temporary limitation. Once authentication is in place, the
> limitation will go away.
So either you're saying your patch 17 / text_poke is broken (so why
include it ?!?) or your statement above is incorrect. Pick one.
> __text_poke()
> This function is called by various features to patch text.
> This calls heki_text_poke_start() and heki_text_poke_end().
>
> heki_text_poke_start() is called to add write permissions to the
> extended page table so that text can be patched. heki_text_poke_end()
> is called to revert write permissions in the extended page table.
This, if text_poke works, then static_call / jump_label / ftrace and
everything else should work, they all rely on this.
> Peter mentioned the following:
>
> "if you want to mirror the native PTEs why don't you hook into the
> paravirt page-table muck and get all that for free?"
>
> We did consider using a shadow page table kind of approach so that guest page
> table
> modifications can be intercepted and reflected in the page table entry. We
> did not
> do this for two reasons:
>
> - there are bits in the page table entry that are not permission bits. We
> would like
> the guest kernel to be able to modify them directly.
This statement makes no sense.
> - we cannot tell a genuine request from an attack.
Why not? How is an explicit call different from an explicit call in a
paravirt hook?
>From a maintenance pov we already hate paravirt with a passion, but it
is ever so much better than sprinkling yet another pile of crap
(heki_*) around.
- [RFC PATCH v2 08/19] KVM: x86: Extend kvm_vm_set_mem_attributes() with a mask, (continued)
- [RFC PATCH v2 08/19] KVM: x86: Extend kvm_vm_set_mem_attributes() with a mask, Mickaël Salaün, 2023/11/12
- [RFC PATCH v2 12/19] x86: Implement the Memory Table feature to store arbitrary per-page data, Mickaël Salaün, 2023/11/12
- [RFC PATCH v2 13/19] heki: Implement a kernel page table walker, Mickaël Salaün, 2023/11/12
- [RFC PATCH v2 14/19] heki: x86: Initialize permissions counters for pages mapped into KVA, Mickaël Salaün, 2023/11/12
- [RFC PATCH v2 15/19] heki: x86: Initialize permissions counters for pages in vmap()/vunmap(), Mickaël Salaün, 2023/11/12
- [RFC PATCH v2 17/19] heki: x86: Update permissions counters during text patching, Mickaël Salaün, 2023/11/12
- Re: [RFC PATCH v2 17/19] heki: x86: Update permissions counters during text patching, Peter Zijlstra, 2023/11/13
- Re: [RFC PATCH v2 17/19] heki: x86: Update permissions counters during text patching, Madhavan T. Venkataraman, 2023/11/27
- Re: [RFC PATCH v2 17/19] heki: x86: Update permissions counters during text patching, Peter Zijlstra, 2023/11/27
- Re: [RFC PATCH v2 17/19] heki: x86: Update permissions counters during text patching, Madhavan T. Venkataraman, 2023/11/29
- Re: [RFC PATCH v2 17/19] heki: x86: Update permissions counters during text patching,
Peter Zijlstra <=
- Re: [RFC PATCH v2 17/19] heki: x86: Update permissions counters during text patching, Edgecombe, Rick P, 2023/11/30
[RFC PATCH v2 18/19] heki: x86: Protect guest kernel memory using the KVM hypervisor, Mickaël Salaün, 2023/11/12
[RFC PATCH v2 16/19] heki: x86: Update permissions counters when guest page permissions change, Mickaël Salaün, 2023/11/12
[RFC PATCH v2 19/19] virt: Add Heki KUnit tests, Mickaël Salaün, 2023/11/12