linux-stable/net/rds
Linus Torvalds 8e0ab4091c De-pessimize rds_page_copy_user
commit 799c10559d upstream.

Don't try to "optimize" rds_page_copy_user() by using kmap_atomic() and
the unsafe atomic user mode accessor functions.  It's actually slower
than the straightforward code on any reasonable modern CPU.

Back when the code was written (although probably not by the time it was
actually merged, though), 32-bit x86 may have been the dominant
architecture.  And there kmap_atomic() can be a lot faster than kmap()
(unless you have very good locality, in which case the virtual address
caching by kmap() can overcome all the downsides).

But these days, x86-64 may not be more populous, but it's getting there
(and if you care about performance, it's definitely already there -
you'd have upgraded your CPU's already in the last few years).  And on
x86-64, the non-kmap_atomic() version is faster, simply because the code
is simpler and doesn't have the "re-try page fault" case.

People with old hardware are not likely to care about RDS anyway, and
the optimization for the 32-bit case is simply buggy, since it doesn't
verify the user addresses properly.

Reported-by: Dan Rosenberg <drosenberg@vsecurity.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-28 21:44:05 -07:00
..
af_rds.c net: Make setsockopt() optlen be unsigned. 2009-09-30 16:12:20 -07:00
bind.c RDS: Add a debug message suggesting to load transport modules 2009-08-23 19:13:14 -07:00
cong.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
connection.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
ib_cm.c RDS/IB: Drop connection when a fatal QP event is received 2009-07-20 08:03:11 -07:00
ib_rdma.c RDS/IB: Always use PAGE_SIZE for FMR page size 2009-07-20 08:03:13 -07:00
ib_recv.c RDS/IB: Rename byte_len to data_len to enhance readability 2009-07-20 08:03:07 -07:00
ib_ring.c RDS/IW+IB: Set recv ring low water mark to 1/2 full. 2009-04-09 17:21:14 -07:00
ib_send.c RDS/IW+IB: Allow max credit advertise window. 2009-04-09 17:21:17 -07:00
ib_stats.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2009-09-15 09:39:44 -07:00
ib_sysctl.c RDS/IB: Disable flow control in sysctl and explain why 2009-07-20 08:03:10 -07:00
ib.c RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
ib.h RDS/IB: Always use PAGE_SIZE for FMR page size 2009-07-20 08:03:13 -07:00
info.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
info.h RDS: Info and stats 2009-02-26 23:39:25 -08:00
iw_cm.c RDS: Use spinlock to protect 64b value update on 32b archs 2009-04-02 00:52:22 -07:00
iw_rdma.c RDS/IW: Remove page_shift variable from iwarp transport 2009-07-20 08:03:14 -07:00
iw_recv.c RDS/IW+IB: Allow max credit advertise window. 2009-04-09 17:21:17 -07:00
iw_ring.c RDS/IW+IB: Set recv ring low water mark to 1/2 full. 2009-04-09 17:21:14 -07:00
iw_send.c RDS/IW: Remove page_shift variable from iwarp transport 2009-07-20 08:03:14 -07:00
iw_stats.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2009-09-15 09:39:44 -07:00
iw_sysctl.c RDS: Add iWARP support 2009-02-26 23:39:33 -08:00
iw.c RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
iw.h RDS/IW: Remove page_shift variable from iwarp transport 2009-07-20 08:03:14 -07:00
Kconfig RDS: Modularize RDMA and TCP transports 2009-08-23 19:13:09 -07:00
loop.c RDS: loopback 2009-02-26 23:39:26 -08:00
loop.h RDS: loopback 2009-02-26 23:39:26 -08:00
Makefile RDS: Modularize RDMA and TCP transports 2009-08-23 19:13:09 -07:00
message.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
page.c De-pessimize rds_page_copy_user 2010-10-28 21:44:05 -07:00
rdma_transport.c RDS: Modularize RDMA and TCP transports 2009-08-23 19:13:09 -07:00
rdma_transport.h RDS: Common RDMA transport code 2009-02-26 23:39:33 -08:00
rdma.c RDS: use get_user_pages_fast() 2009-04-09 17:21:20 -07:00
rdma.h RDS: RDMA support 2009-02-26 23:39:29 -08:00
rds.h RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
recv.c rds: fix a leak of kernel memory 2010-09-26 17:21:20 -07:00
send.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
stats.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
sysctl.c RDS: sysctls 2009-02-26 23:39:26 -08:00
tcp_connect.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_listen.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_recv.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_send.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp_stats.c RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
tcp.c RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00
tcp.h RDS: Add TCP transport to RDS 2009-08-23 19:13:02 -07:00
threads.c RDS: Export symbols from core RDS 2009-08-23 19:13:07 -07:00
transport.c RDS: Track transports via an array, not a list 2009-08-23 19:13:12 -07:00