Re: [PATCH v3 1/3] mm/mprotect: Fix soft-dirty check in can_change_pte_writable()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Jul 22, 2022, at 12:08 AM, David Hildenbrand <david@xxxxxxxxxx> wrote:

>> +static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma)
>> +{
>> +	/*
>> +	 * NOTE: we must check this before VM_SOFTDIRTY on soft-dirty
>> +	 * enablements, because when without soft-dirty being compiled in,
>> +	 * VM_SOFTDIRTY is defined as 0x0, then !(vm_flags & VM_SOFTDIRTY)
>> +	 * will be constantly true.
>> +	 */
>> +	if (!IS_ENABLED(CONFIG_MEM_SOFT_DIRTY))
>> +		return false;
>> +
>> +	/*
>> +	 * Soft-dirty is kind of special: its tracking is enabled when the
>> +	 * vma flags not set.
>> +	 */
>> +	return !(vma->vm_flags & VM_SOFTDIRTY);
>> +}
> 
> That will come in handy in other patches I'm cooking.

clear_refs_write() also comes to mind as well (for consistency; I see no
correctness or performance issue).





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux