Re: [GIT PULL] x86/shstk for 6.4

Edgecombe, Rick P
2023-05-07T15:57:19Z

On Sat, 2023-05-06 at 17:38 -0700, Linus Torvalds wrote:
> So that means that the
>
>         if (pte_dirty(pte))
>                 pte = pte_mksaveddirty(pte);
>
> in pte_wrprotect() is just nonsensical, and basically says "if either
> the real dirty or the SW dirty bit is set, set the SW dirty bit". But
> that's entirely redundant wrt the old state of the dirty bit.
>
> It reality should just 'or' the HW dirty bit into the SW dirty bit
> and
> be done with it.
>
> Of course, maybe I confused the issue by talking about HW dirty and
> SW
> dirty, because we *also* have that entirely *other* legacy
> "SOFT_DIRTY" bit that is different from the new SW dirty bit
> ("SAVED_DIRTY").

Sorry, I did think you meant the old _PAGE_SOFT_DIRTY when you were
talking about the SW dirty bit here.

Yea, if only _PAGE_SAVED_DIRTY is set, and not _PAGE_DIRTY, then it's
pointless to do pte_mksaveddirty() here. So I guess you were pointing
out an example of the general wrongness you elaborated on. I thought
you were saying it was a functional bug.