Re: [PATCH v8 11/27] x86/mm: Introduce _PAGE_DIRTY_SW

From: Andy Lutomirski
Date: Tue Aug 13 2019 - 19:49:44 EST



On Aug 13, 2019, at 4:02 PM, Dave Hansen <dave.hansen@xxxxxxxxx> wrote:

>>
>> static inline pte_t pte_mkwrite(pte_t pte)
>> {
>> + pte = pte_move_flags(pte, _PAGE_DIRTY_SW, _PAGE_DIRTY_HW);
>> return pte_set_flags(pte, _PAGE_RW);
>> }
>
> It also isn't clear to me why this *must* move bits here. Its doubly
> unclear why you would need to do this on systems when shadow stacks are
> compiled in but disabled.

Why is it conditional at all? ISTM, in x86, RO+dirty has been effectively repurposed. To avoid having extra things that can conditionally break, I think this code should be unconditional.

That being said, Iâm not at all sure that pte_mkwrite on a shadow stack page makes any sense.

> <snip>
>
> Same comments for pmds and puds.

Wasnât Kirill working on a rework if the whole page table system to just have integer page table levels?