Re: [PATCH v21 08/26] x86/mm: Introduce _PAGE_COW

Yu, Yu-cheng
2021-03-03T03:11:18Z

On 3/1/2021 7:52 AM, Borislav Petkov wrote:
> On Wed, Feb 17, 2021 at 02:27:12PM -0800, Yu-cheng Yu wrote:

[...]

>> static inline pmd_t pmd_mkdirty(pmd_t pmd)
>> {
>> - return pmd_set_flags(pmd, _PAGE_DIRTY | _PAGE_SOFT_DIRTY);
>> + pmdval_t dirty = _PAGE_DIRTY;
>> +
>> + /* Avoid creating (HW)Dirty=1, Write=0 PMDs */
>> + if (cpu_feature_enabled(X86_FEATURE_SHSTK) && !(pmd_flags(pmd) & _PAGE_RW))
>
> !(pmd_write(pmd))
>

There is a problem of doing that: pmd_write() is defined after this
function. Maybe we can declare it first, or leave this as-is?

--
Yu-cheng