linux/net/sunrpc
Deepa Dinamani 3a0ed3e961 sock: Make sock->sk_stamp thread-safe
Al Viro mentioned (Message-ID
<20170626041334.GZ10672@ZenIV.linux.org.uk>)
that there is probably a race condition
lurking in accesses of sk_stamp on 32-bit machines.

sock->sk_stamp is of type ktime_t which is always an s64.
On a 32 bit architecture, we might run into situations of
unsafe access as the access to the field becomes non atomic.

Use seqlocks for synchronization.
This allows us to avoid using spinlocks for readers as
readers do not need mutual exclusion.

Another approach to solve this is to require sk_lock for all
modifications of the timestamps. The current approach allows
for timestamps to have their own lock: sk_stamp_lock.
This allows for the patch to not compete with already
existing critical sections, and side effects are limited
to the paths in the patch.

The addition of the new field maintains the data locality
optimizations from
commit 9115e8cd2a ("net: reorganize struct sock for better data
locality")

Note that all the instances of the sk_stamp accesses
are either through the ioctl or the syscall recvmsg.

Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-01-01 09:47:59 -08:00
..
auth_gss SUNRPC: Fix leak of krb5p encode pages 2018-12-02 09:43:56 -05:00
xprtrdma Olga added support for the NFSv4.2 asynchronous copy protocol. We 2018-10-30 13:03:29 -07:00
addr.c replace strict_strto calls 2014-07-12 18:45:49 -04:00
auth_generic.c SUNRPC: Fix a bogus get/put in generic_key_to_expire() 2018-11-12 16:39:13 -05:00
auth_null.c SUNRPC: Convert the auth cred cache to use refcount_t 2018-10-23 12:24:33 -04:00
auth_unix.c SUNRPC: Convert the auth cred cache to use refcount_t 2018-10-23 12:24:33 -04:00
auth.c SUNRPC: Convert the auth cred cache to use refcount_t 2018-10-23 12:24:33 -04:00
backchannel_rqst.c SUNRPC: Refactor xprt_transmit() to remove the reply queue code 2018-09-30 15:35:14 -04:00
cache.c SUNRPC: Replace the cache_detail->hash_lock with a regular spinlock 2018-10-29 16:58:04 -04:00
clnt.c SUNRPC: Fix disconnection races 2018-12-18 11:03:57 -05:00
debugfs.c net: Use octal not symbolic permissions 2018-03-26 12:07:48 -04:00
Kconfig IB: Revert "remove redundant INFINIBAND kconfig dependencies" 2018-05-28 10:40:16 -06:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
netns.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rpc_pipe.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-06-04 10:14:28 -07:00
rpcb_clnt.c sunrpc: whitespace fixes 2018-07-31 12:53:40 -04:00
sched.c SUNRPC: Fix priority queue fairness 2018-09-30 15:35:16 -04:00
socklib.c net: dump more useful information in netdev_rx_csum_fault() 2018-11-15 11:37:04 -08:00
stats.c sunrpc: whitespace fixes 2018-07-31 12:53:40 -04:00
sunrpc_syms.c net: Drop pernet_operations::async 2018-03-27 13:18:09 -04:00
sunrpc.h sunrpc: whitespace fixes 2018-07-31 12:53:40 -04:00
svc_xprt.c Olga added support for the NFSv4.2 asynchronous copy protocol. We 2018-10-30 13:03:29 -07:00
svc.c NFSD: Handle full-length symlinks 2018-08-09 16:11:21 -04:00
svcauth_unix.c SUNRPC: Make server side AUTH_UNIX use lockless lookups 2018-10-29 16:58:04 -04:00
svcauth.c SUNRPC: Add lockless lookup of the server's auth domain 2018-10-03 11:32:59 -04:00
svcsock.c sock: Make sock->sk_stamp thread-safe 2019-01-01 09:47:59 -08:00
sysctl.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
timer.c
xdr.c SUNRPC: drop pointless static qualifier in xdr_get_next_encode_buffer() 2018-11-08 12:12:23 -05:00
xprt.c SUNRPC: Remove xprt_connect_status() 2018-12-18 11:04:10 -05:00
xprtmultipath.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
xprtsock.c SUNRPC: Fix a race with XPRT_CONNECTING 2018-12-18 11:04:03 -05:00