@@ -275,6 +275,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
275
275
}
276
276
277
277
extern void __sync_icache_dcache (pte_t pteval );
278
+ bool pgattr_change_is_safe (u64 old , u64 new );
278
279
279
280
/*
280
281
* PTE bits configuration in the presence of hardware Dirty Bit Management
@@ -292,7 +293,7 @@ extern void __sync_icache_dcache(pte_t pteval);
292
293
* PTE_DIRTY || (PTE_WRITE && !PTE_RDONLY)
293
294
*/
294
295
295
- static inline void __check_racy_pte_update (struct mm_struct * mm , pte_t * ptep ,
296
+ static inline void __check_safe_pte_update (struct mm_struct * mm , pte_t * ptep ,
296
297
pte_t pte )
297
298
{
298
299
pte_t old_pte ;
@@ -318,6 +319,9 @@ static inline void __check_racy_pte_update(struct mm_struct *mm, pte_t *ptep,
318
319
VM_WARN_ONCE (pte_write (old_pte ) && !pte_dirty (pte ),
319
320
"%s: racy dirty state clearing: 0x%016llx -> 0x%016llx" ,
320
321
__func__ , pte_val (old_pte ), pte_val (pte ));
322
+ VM_WARN_ONCE (!pgattr_change_is_safe (pte_val (old_pte ), pte_val (pte )),
323
+ "%s: unsafe attribute change: 0x%016llx -> 0x%016llx" ,
324
+ __func__ , pte_val (old_pte ), pte_val (pte ));
321
325
}
322
326
323
327
static inline void __set_pte_at (struct mm_struct * mm , unsigned long addr ,
@@ -346,7 +350,7 @@ static inline void __set_pte_at(struct mm_struct *mm, unsigned long addr,
346
350
mte_sync_tags (old_pte , pte );
347
351
}
348
352
349
- __check_racy_pte_update (mm , ptep , pte );
353
+ __check_safe_pte_update (mm , ptep , pte );
350
354
351
355
set_pte (ptep , pte );
352
356
}
0 commit comments