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-next>] [day] [month] [year] [list]
Date:	Thu, 13 Mar 2014 17:36:32 +0100
From:	Oleg Nesterov <oleg@...hat.com>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Davidlohr Bueso <davi@...hat.com>,
	Davidlohr Bueso <davidlohr@...com>,
	KOSAKI Motohiro <kosaki.motohiro@...il.com>,
	Rik van Riel <riel@...hat.com>, Mel Gorman <mgorman@...e.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Michel Lespinasse <walken@...gle.com>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH -next] mm,vmacache: also flush cache for VM_CLONE

On 03/13, Linus Torvalds wrote:
>
> On Mar 13, 2014 8:11 AM, "Oleg Nesterov" <oleg@...hat.com> wrote:
> >
> > Suppose that a kernel thread T does, say,
> >
> >         use_mm(foreign_mm);
> >         get_user(...);
> >         unuse_mm();
>
> That would be a major bug. Kernel threads cannot access use memory.

Unless a kernel thread does use_mm() ;)

> Has
> somebody added anything that crazy?

Hmm. aio no longer uses use_mm()... But there are other users:

	drivers/usb/gadget/inode.c  582   use_mm(mm);
	drivers/vhost/vhost.c       211   use_mm(dev->mm);
	virt/kvm/async_pf.c          68   use_mm(mm);

And yes, they do copy_to/from_user().

Hmm, but at first glance async_pf_execute() doesn't need use_mm() at all.
And perhaps other callers can use get_user_pages() too.

> The kernel thread "use_mm" is to avoid unnecessary context switches of the
> tlb when switching to a kennel thread, exactly *because* a kernel thread is
> never supposed to access use space, so it cannot care what user memory is
> attached.

It seems that you are talking about switch_mm-like things or I misunderstood.
use_mm() actually changes ->mm, not only ->active_mm.

> So I object vet much to making kernel threads special on this context,
> unless the "special" bit is some VM_BUG_ON() or similar.

See above. Perhaps we can kill use_mm() (personally I don't think we should),
but until then vmacache needs this check afaics.

Oleg.

--
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