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] [day] [month] [year] [list]
Date:   Tue, 10 Oct 2017 07:50:44 +0200
From:   Michal Hocko <mhocko@...nel.org>
To:     Xishi Qiu <qiuxishi@...wei.com>
Cc:     Vlastimil Babka <vbabka@...e.cz>,
        Joonsoo Kim <iamjoonsoo.kim@....com>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Linux MM <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>,
        zhong jiang <zhongjiang@...wei.com>,
        yeyunfeng <yeyunfeng@...wei.com>, wanghaitao12@...wei.com,
        "Zhoukang (A)" <zhoukang7@...wei.com>
Subject: Re: [RFC] a question about mlockall() and mprotect()

On Tue 10-10-17 09:22:20, Xishi Qiu wrote:
> On 2017/10/10 2:26, Michal Hocko wrote:
> 
> > On Wed 27-09-17 13:51:09, Xishi Qiu wrote:
> >> On 2017/9/26 19:00, Michal Hocko wrote:
> >>
> >>> On Tue 26-09-17 11:45:16, Vlastimil Babka wrote:
> >>>> On 09/26/2017 11:22 AM, Xishi Qiu wrote:
> >>>>> On 2017/9/26 17:13, Xishi Qiu wrote:
> >>>>>>> This is still very fuzzy. What are you actually trying to achieve?
> >>>>>>
> >>>>>> I don't expect page fault any more after mlock.
> >>>>>>
> >>>>>
> >>>>> Our apps is some thing like RT, and page-fault maybe cause a lot of time,
> >>>>> e.g. lock, mem reclaim ..., so I use mlock and don't want page fault
> >>>>> any more.
> >>>>
> >>>> Why does your app then have restricted mprotect when calling mlockall()
> >>>> and only later adjusts the mprotect?
> >>>
> >>> Ahh, OK I see what is goging on. So you have PROT_NONE vma at the time
> >>> mlockall and then later mprotect it something else and want to fault all
> >>> that memory at the mprotect time?
> >>>
> >>> So basically to do
> >>> ---
> >>> diff --git a/mm/mprotect.c b/mm/mprotect.c
> >>> index 6d3e2f082290..b665b5d1c544 100644
> >>> --- a/mm/mprotect.c
> >>> +++ b/mm/mprotect.c
> >>> @@ -369,7 +369,7 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
> >>>  	 * Private VM_LOCKED VMA becoming writable: trigger COW to avoid major
> >>>  	 * fault on access.
> >>>  	 */
> >>> -	if ((oldflags & (VM_WRITE | VM_SHARED | VM_LOCKED)) == VM_LOCKED &&
> >>> +	if ((oldflags & (VM_WRITE | VM_LOCKED)) == VM_LOCKED &&
> >>>  			(newflags & VM_WRITE)) {
> >>>  		populate_vma_page_range(vma, start, end, NULL);
> >>>  	}
> >>>
> >>
> >> Hi Michal,
> >>
> >> My kernel is v3.10, and I missed this code, thank you reminding me.
> > 
> > I guess I didn't get your answer. Does the above diff resolves your
> > problem?
> 
> Hi Michal,
> 
> This upstream patch 36f881883c57941bb32d25cea6524f9612ab5a2c has already
> resolve my problem, thank you for your attention.

OK, fair enough. But is does it make sense to extend this behavior to
shared mappings as well?
-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ