Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 17 Jan 2018 10:07:05 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Dan Williams' <dan.j.williams@...el.com>, Al Viro
	<viro@...iv.linux.org.uk>
CC: Linus Torvalds <torvalds@...ux-foundation.org>, Linux Kernel Mailing List
	<linux-kernel@...r.kernel.org>, "linux-arch@...r.kernel.org"
	<linux-arch@...r.kernel.org>, Andi Kleen <ak@...ux.intel.com>, Kees Cook
	<keescook@...omium.org>, "kernel-hardening@...ts.openwall.com"
	<kernel-hardening@...ts.openwall.com>, Greg Kroah-Hartman
	<gregkh@...uxfoundation.org>, the arch/x86 maintainers <x86@...nel.org>,
	"Ingo Molnar" <mingo@...hat.com>, "H. Peter Anvin" <hpa@...or.com>, Thomas
 Gleixner <tglx@...utronix.de>, Andrew Morton <akpm@...ux-foundation.org>,
	Alan Cox <alan@...ux.intel.com>
Subject: RE: [PATCH v3 8/9] x86: use __uaccess_begin_nospec and ASM_IFENCE in
 get_user paths

From: Dan Williams
> Sent: 17 January 2018 06:50
...
> > Anything that open-codes copy_from_user() that way is *ALREADY* fucked if
> > it cares about the overhead - recent x86 boxen will have slowdown from
> > hell on stac()/clac() pairs.  Anything like that on a hot path is already
> > deep in trouble and needs to be found and fixed.  What drivers would those
> > be?
> 
> So I took a closer look and the pattern is not copy_from_user it's
> more like __get_user + write-to-hardware loops. If the performance is
> already expected to be bad for those then perhaps an lfence each loop
> iteration won't be much worse. It's still a waste because the lfence
> is only needed once after the access_ok.

Performance of PCIe writes isn't that back (since they are posted)
adding a synchronising instructions to __get_user() could easily
be noticeable.

Unfortunately you can't use copy_from_user() with a PCIe mapped
target memory address (or even memcpy_to_io()) because on x86
the copy is aliased to memcpy() and that uses 'rep movsb'
which has to do single byte transfers because the address is
uncached.
(This is really bad for PCIe reads.)

	David


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.