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: <20110615085515.GE4952@linux.vnet.ibm.com>
Date:	Wed, 15 Jun 2011 14:25:15 +0530
From:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...e.hu>,
	Steven Rostedt <rostedt@...dmis.org>,
	Linux-mm <linux-mm@...ck.org>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Hugh Dickins <hughd@...gle.com>,
	Christoph Hellwig <hch@...radead.org>,
	Andi Kleen <andi@...stfloor.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Jonathan Corbet <corbet@....net>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
	Roland McGrath <roland@...k.frob.com>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3.0-rc2-tip 2/22]  2: uprobes: Breakground page
 replacement.

> > > > +
> > > > +	/* Read the page with vaddr into memory */
> > > > +	ret = get_user_pages(tsk, tsk->mm, vaddr, 1, 1, 1, &old_page, &vma);
> > >
> > > Sorry if this was already discussed... But why we are using FOLL_WRITE here?
> > > We are not going to write into this page, and this provokes the unnecessary
> > > cow, no?
> >
> > Yes, We are not going to write to the page returned by get_user_pages
> > but a copy of that page.
> 
> Yes I see. But the page returned by get_user_pages(write => 1) is already
> a cow'ed copy (this mapping should be read-only).
> 
> > The idea was if we cow the page then we dont
> > need to cow it at the replace_page time
> 
> Yes, replace_page() shouldn't cow.
> 
> > and since get_user_pages knows
> > the right way to cow the page, we dont have to write another routine to
> > cow the page.
> 
> Confused. write_opcode() allocs another page and does memcpy. This is
> correct, but I don't understand the first cow.
> 

we decided on get_user_pages(FOLL_WRITE|FOLL_FORCE) based on discussions
in these threads https://lkml.org/lkml/2010/4/23/327 and
https://lkml.org/lkml/2010/5/12/119

Summary of those two sub-threads as I understand was to have
get_user_pages do the "real" cow for us.

If I understand correctly, your concern is on the extra overhead added
by the get_user_pages. Other than that is there any side-effect of we
forcing the cow through get_user_pages.

> > I am still not clear on your concern.
> 
> Probably I missed something... but could you please explain why we can't
> 
> 	- ret = get_user_pages(tsk, tsk->mm, vaddr, 1, 1, 1, &old_page, &vma);
> 	+ ret = get_user_pages(tsk, tsk->mm, vaddr, 1, 0, 0, &old_page, &vma);
> 
> ?

I tried the code with this change and it works for regular cases.
I am not sure if it affects cases where programs do mprotect 
So I am okay to not force cow through get_user_pages.

> 
> > > Also. This is called under down_read(mmap_sem), can't we race with
> > > access_process_vm() modifying the same memory?
> >
> > Yes, we could be racing with access_process_vm on the same memory.
> >
> > Do we have any other option other than making write_opcode/read_opcode
> > being called under down_write(mmap_sem)?
> 
> I dunno. Probably we can simply ignore this issue, there are other ways
> to modify this memory.
> 

Okay.

-- 
Thanks and Regards
Srikar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ