lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <05ab340a-d500-e742-fd59-5ef2e4ea86e0@linux.dev>
Date:   Mon, 22 May 2023 16:28:54 +0800
From:   Qi Zheng <qi.zheng@...ux.dev>
To:     Alistair Popple <apopple@...dia.com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        robin.murphy@....com, will@...nel.org, nicolinc@...dia.com,
        linux-arm-kernel@...ts.infradead.org, kvm@...r.kernel.org,
        jgg@...dia.com, John Hubbard <jhubbard@...dia.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] mmu_notifiers: Notify on pte permission upgrades



On 2023/5/22 15:45, Alistair Popple wrote:
> 
> Qi Zheng <qi.zheng@...ux.dev> writes:
> 
>> Hi Alistair,
>>
>> On 2023/5/22 14:37, Alistair Popple wrote:
> 
> [...]
> 
>>> +	if (changed) {
>>> +		struct mmu_notifier_range range;
>>> +
>>> +		mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_UPGRADE,
>>> +					0, vmf->vma, vmf->vma->vm_mm,
>>> +					vmf->address & PAGE_MASK,
>>> +					(vmf->address & PAGE_MASK) + PAGE_SIZE);
>>> +		mmu_notifier_invalidate_range_start(&range);
>>> +		mmu_notifier_invalidate_range_end(&range);
>>> +	}
>>
>> There are four similar patterns, can we introduce a helper function to
>> deduplicate them?
> 
> For sure. How about something like this?
> 
> void mmu_notifier_range_start_end(enum mmu_notifier_event event,
>                                    struct vm_area_struct *vma,
>                                    struct mm_struct *mm,
>                                    unsigned long start,
>                                    unsigned long end)

LGTM. :)

> 
> As an aside I didn't just use mmu_notifier_invalidate_range() as that
> doesn't allow an event type to be set for interval notifiers which may
> want to filter this.
> 
>>> +
>>>    	return 0;
>>>    }
>>>    
> 

-- 
Thanks,
Qi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ