Re: [kernel-hardening] [RFC, PATCH] x86_64: KAISER - do not map kernel in user mode

From: Daniel Gruss
Date: Mon May 08 2017 - 09:24:47 EST


On 05.05.2017 10:23, Daniel Gruss wrote:
- How this approach prevent the hardware attacks you mentioned? You
still have to keep a part of _text in the pagetable and an attacker
could discover it no? (and deduce the kernel base address).

These parts are moved to a different section (.user_mapped) which is at a possibly predictable location - the location
of the randomized parts of the kernel is independent of the location of .user_mapped.
The code/data footprint for .user_mapped is quite small, helping to reduce or eliminate the attack surface...

We just discussed that in our group again: although we experimented with this part, it's not yet included in the patch. The solution we sketched is, as I wrote, we map the required (per-thread) variables in the user CR3 to a fixed location in memory. During the context switch, only this fixed part remains mapped but not the randomized pages. This is not a lot of work, because it's just mapping a few more pages and fixing a 1 or 2 lines in the context switch.