android_kernel_oneplus_msm8998/include/net
Deepa Dinamani f8de5a38cc sock: Make sock->sk_stamp thread-safe
[ Upstream commit 3a0ed3e9619738067214871e9cb826fa23b2ddb9 ]

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 9115e8cd2a0c ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-13 10:05:28 +01:00
..
9p 9p: switch p9_client_read() to passing struct iov_iter * 2015-04-11 22:28:27 -04:00
bluetooth Bluetooth: Fix connection if directed advertising and privacy is used 2018-07-03 11:21:35 +02:00
caif caif: fix a signedness bug in cfpkt_iterate() 2015-02-20 17:35:14 -05:00
irda irda: Convert function pointer arrays and uses to const 2014-12-10 15:33:16 -05:00
iucv s390/iucv: do not use arrays as argument 2015-09-21 16:03:04 -07:00
netfilter netfilter: nf_queue: Make the queue_handler pernet 2018-02-16 20:09:40 +01:00
netns netfilter: ipv6: nf_defrag: reduce struct net memory waste 2018-08-24 13:26:53 +02:00
nfc NFC: Fix the number of pipes 2018-09-29 03:08:51 -07:00
phonet
sctp sctp: potential read out of bounds in sctp_ulpevent_type_enabled() 2017-10-21 17:09:01 +02:00
tc_act act_connmark: Remember the struct net instead of guessing it. 2015-09-18 21:59:31 +02:00
6lowpan.h 6lowpan: remove lowpan_is_addr_broadcast 2015-10-21 00:49:25 +02:00
act_api.h net_sched: make tcf_hash_destroy() static 2015-08-26 11:01:44 -07:00
addrconf.h ipv6: reorder ip6_route_dev_notifier after ipv6_dev_notf 2017-05-14 13:32:58 +02:00
af_ieee802154.h ieee802154: af_ieee802154: fix typo in comment. 2015-09-17 13:20:05 +02:00
af_rxrpc.h
af_unix.h af_unix: split 'u->readlock' into two: 'iolock' and 'bindlock' 2016-09-30 10:18:36 +02:00
af_vsock.h vsock: split dwork to avoid reinitializations 2018-08-22 07:48:35 +02:00
ah.h ipsec: Remove obsolete MAX_AH_AUTH_LEN 2014-09-18 10:54:36 +02:00
arp.h ipv4: Make neigh lookup keys for loopback/point-to-point devices be INADDR_ANY 2018-01-31 12:06:14 +01:00
atmclip.h
ax25.h ax25: Stop using sock->sk_protinfo. 2015-06-28 16:55:44 -07:00
ax88796.h
bond_3ad.h bonding: simplify / unify event handling code for 3ad mode. 2015-11-02 22:52:24 -05:00
bond_alb.h net: Move bonding headers under include/net 2014-11-10 13:27:49 -05:00
bond_options.h bonding: convert num_grat_arp to the new bonding option API 2015-07-27 01:05:24 -07:00
bonding.h bonding: avoid possible dead-lock 2018-10-20 09:52:36 +02:00
busy_poll.h
cfg80211-wext.h
cfg80211.h cfg80211: make RATE_INFO_BW_20 the default 2018-04-13 19:50:00 +02:00
cfg802154.h nl802154: add support for security layer 2015-09-30 13:16:44 +02:00
checksum.h net: Add inet_proto_csum_replace_by_diff utility function 2015-08-17 21:33:06 -07:00
cipso_ipv4.h netlabel: out of bound access in cipso_v4_validate() 2017-02-18 16:39:26 +01:00
cls_cgroup.h cls_cgroup: factor out classid retrieval 2015-07-20 12:41:30 -07:00
codel.h net_sched: update hierarchical backlog too 2016-05-18 17:06:39 -07:00
compat.h net: switch importing msghdr from userland to {compat_,}import_iovec() 2015-04-09 00:02:26 -04:00
datalink.h
dcbevent.h
dcbnl.h net/dcb: Add IEEE QCN attribute 2015-03-06 21:50:02 -05:00
dn.h
dn_dev.h
dn_fib.h
dn_neigh.h netfilter: Pass net into okfn 2015-09-17 17:18:37 -07:00
dn_nsp.h
dn_route.h
dsa.h net: dsa: use switchdev obj for VLAN add/del ops 2015-11-01 15:56:11 -05:00
dsfield.h
dst.h ipv4: add reference counting to metrics 2017-06-07 12:05:59 +02:00
dst_cache.h net: add dst_cache support 2018-02-25 11:03:34 +01:00
dst_metadata.h gro: Make GRO aware of lightweight tunnels. 2016-03-03 15:07:04 -08:00
dst_ops.h ipv4, ipv6: Pass net into __ip_local_out and __ip6_local_out 2015-10-08 04:27:02 -07:00
esp.h
ethoc.h net/ethoc: support big-endian register layout 2015-09-23 15:33:15 -07:00
fib_rules.h net: ipv6: use common fib_default_rule_pref 2015-09-09 14:19:50 -07:00
firewire.h
flow.h net: Rename FLOWI_FLAG_VRFSRC to FLOWI_FLAG_L3MDEV_SRC 2015-10-07 04:27:42 -07:00
flow_dissector.h flow_dissector: Don't use bit fields. 2015-09-01 16:46:08 -07:00
flowcache.h
fou.h ip_tunnel: Ops registration for secondary encap (fou, gue) 2014-11-12 15:01:35 -05:00
garp.h
gen_stats.h net: sched: enable per cpu qstats 2014-09-30 01:02:26 -04:00
genetlink.h netlink: add a start callback for starting a netlink dump 2017-12-05 11:22:49 +01:00
geneve.h geneve: Consolidate Geneve functionality in single module. 2015-08-27 15:42:48 -07:00
gre.h gre: Remove support for sharing GRE protocol hook. 2015-08-10 14:03:54 -07:00
gro_cells.h gro_cell: add napi_disable in gro_cells_destroy 2019-01-13 10:05:28 +01:00
gue.h gue: Protocol constants for remote checksum offload 2014-11-05 16:30:03 -05:00
icmp.h
ieee80211_radiotap.h
ieee802154_netdev.h nl802154: add support for security layer 2015-09-30 13:16:44 +02:00
if_inet6.h ipv6: do retries on stable privacy addresses 2015-03-23 22:12:09 -04:00
inet6_connection_sock.h ipv6: remove obsolete inet6 functions 2015-10-03 04:32:42 -07:00
inet6_hashtables.h ipv6: get rid of __inet6_hash() 2015-03-18 22:00:35 -04:00
inet_common.h net: avoid NULL deref in inet_ctl_sock_destroy() 2015-11-02 22:46:09 -05:00
inet_connection_sock.h tcp/dccp: fix another race at listener dismantle 2016-03-03 15:07:07 -08:00
inet_ecn.h ipv6: suppress sparse warnings in IP6_ECN_set_ce() 2018-11-10 07:41:34 -08:00
inet_frag.h Revert "net: fix percpu memory leaks" 2017-09-27 11:00:11 +02:00
inet_hashtables.h tcp/dccp: fix hashdance race for passive sessions 2015-10-23 05:42:21 -07:00
inet_sock.h tcp/dccp: fix other lockdep splats accessing ireq_opt 2017-11-18 11:11:07 +01:00
inet_timewait_sock.h soreuseport: initialise timewait reuseport field 2018-05-16 10:06:50 +02:00
inetpeer.h inet: tcp: fix inetpeer_set_addr_v4() 2015-12-16 00:14:12 -05:00
ip.h ipv4: lock mtu in fnhe when received PMTU < net.ipv4.route.min_pmtu 2018-05-30 07:49:04 +02:00
ip6_checksum.h net: add gro_compute_pseudo functions 2014-08-24 18:09:23 -07:00
ip6_fib.h ipv6: fix sparse warning on rt6i_node 2017-09-27 11:00:10 +02:00
ip6_route.h net: ipv6: Compare lwstate in detecting duplicate nexthops 2017-07-21 07:44:55 +02:00
ip6_tunnel.h net: replace dst_cache ip6_tunnel implementation with the generic one 2018-02-25 11:03:34 +01:00
ip_fib.h net: ipv4: update fnhe_pmtu when first hop's MTU changes 2018-10-20 09:52:36 +02:00
ip_tunnels.h ip_tunnel: replace dst_cache with generic implementation 2018-02-28 10:17:21 +01:00
ip_vs.h ipvs: drop first packet to redirect conntrack 2016-05-11 11:21:09 +02:00
ipcomp.h
ipconfig.h
ipv6.h ipv6: fix useless rol32 call on hash 2018-07-25 10:18:16 +02:00
ipx.h switch ipxrtr_route_packet() from iovec to msghdr 2014-11-24 04:28:49 -05:00
iw_handler.h wext: handle NULL extra data in iwe_stream_add_point better 2017-08-11 09:08:56 -07:00
l3mdev.h net: Propagate lookup failure in l3mdev_get_saddr to caller 2016-01-04 22:58:30 -05:00
lapb.h
lib80211.h lib80211: remove unused print_ssid() 2014-10-14 02:18:27 +02:00
llc.h llc: use refcount_inc_not_zero() for llc_sap_find() 2018-08-22 07:48:35 +02:00
llc_c_ac.h
llc_c_ev.h
llc_c_st.h llc: Make llc_conn_ev_qfyr_t function pointer arrays const 2014-12-10 15:21:24 -05:00
llc_conn.h llc: properly handle dev_queue_xmit() return value 2018-05-30 07:49:06 +02:00
llc_if.h
llc_pdu.h
llc_s_ac.h
llc_s_ev.h
llc_s_st.h llc: Make llc_sap_action_t function pointer arrays const 2014-12-10 15:21:24 -05:00
llc_sap.h
lwtunnel.h dst: Pass net into dst->output 2015-10-08 04:27:03 -07:00
mac80211.h mac80211: round IEEE80211_TX_STATUS_HEADROOM up to multiple of 4 2018-05-30 07:48:59 +02:00
mac802154.h 6lowpan: cleanup lowpan_header_decompress 2015-10-21 00:49:24 +02:00
mip6.h
mld.h ipv6: mld: answer mldv2 queries with mldv1 reports in mldv1 fallback 2014-09-22 16:23:15 -04:00
mpls.h openvswitch: Add basic MPLS support to kernel 2014-11-05 23:52:33 -08:00
mpls_iptunnel.h mpls: multipath route support 2015-10-23 06:26:42 -07:00
mrp.h
ndisc.h Revert "ipv6: ndisc: inherit metadata dst when creating ndisc requests" 2015-12-01 15:07:59 -05:00
neighbour.h neighbour: Avoid writing before skb->head in neigh_hh_output() 2018-12-17 21:55:09 +01:00
net_namespace.h netfilter: ipv6: nf_defrag: reduce struct net memory waste 2018-08-24 13:26:53 +02:00
net_ratelimit.h
netevent.h
netlabel.h netlabel: fix the netlbl_catmap_setlong() dummy function 2014-08-07 20:55:21 -04:00
netlink.h netlink: fix nla_put_{u8,u16,u32} for KASAN 2018-02-25 11:03:51 +01:00
netprio_cgroup.h
netrom.h
nexthop.h net: fix rtnh_ok() 2018-05-16 10:06:50 +02:00
nl802154.h nl802154: add support for security layer 2015-09-30 13:16:44 +02:00
p8022.h
ping.h net: Remove iocb argument from sendmsg and recvmsg 2015-03-02 13:06:31 -05:00
pkt_cls.h net: sched: remove tcf_proto from ematch calls 2014-10-06 18:02:32 -04:00
pkt_sched.h net: sched: consolidate tc_classify{,_compat} 2015-08-27 14:18:48 -07:00
protocol.h net: Eliminate no_check from protosw 2014-05-23 16:28:53 -04:00
psnap.h
raw.h
rawv6.h
red.h net_sched: red: Avoid illegal values 2018-02-25 11:03:40 +01:00
regulatory.h regulatory: add NUL to request alpha2 2018-05-30 07:49:00 +02:00
request_sock.h tcp/dccp: fix race at listener dismantle phase 2015-10-16 00:52:19 -07:00
rose.h
route.h ipv4: lock mtu in fnhe when received PMTU < net.ipv4.route.min_pmtu 2018-05-30 07:49:04 +02:00
rtnetlink.h netlink: Rightsize IFLA_AF_SPEC size calculation 2015-10-21 19:15:20 -07:00
sch_generic.h net_sched: fix order of queue length updates in qdisc_replace() 2017-08-30 10:19:21 +02:00
scm.h unix: correctly track in-flight fds in sending process user_struct 2016-03-03 15:07:05 -08:00
secure_seq.h inetpeer: get rid of ip_id_count 2014-06-02 11:00:41 -07:00
slhc_vj.h slip: Check if rstate is initialized before uncompressing 2018-04-24 09:32:04 +02:00
snmp.h Merge branch 'for-3.18-consistent-ops' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2014-10-15 07:48:18 +02:00
sock.h sock: Make sock->sk_stamp thread-safe 2019-01-13 10:05:28 +01:00
Space.h
stp.h
switchdev.h switchdev: pass pointer to fib_info instead of copy 2016-06-24 10:18:16 -07:00
tcp.h tcp: use an RB tree for ooo receive queue 2018-10-13 09:11:34 +02:00
tcp_memcontrol.h
tcp_states.h inet: add TCP_NEW_SYN_RECV state 2015-03-12 22:58:12 -04:00
timewait_sock.h inet: remove BUG_ON() in twsk_destructor() 2015-07-09 15:12:20 -07:00
transp_v6.h
tso.h net: tso: add support for IPv6 2015-10-26 22:24:22 -07:00
udp.h net: Remove iocb argument from sendmsg and recvmsg 2015-03-02 13:06:31 -05:00
udp_tunnel.h vxlan: do not receive IPv4 packets on IPv6 socket 2015-08-29 13:07:54 -07:00
udplite.h udplite: fix partial checksum initialization 2018-03-11 16:19:46 +01:00
vsock_addr.h
vxlan.h vxlan: fix incorrect RCO bit in VXLAN header 2015-12-05 18:15:29 -05:00
wext.h
wimax.h net: treewide: Fix typo found in DocBook/networking.xml 2014-09-05 17:35:28 -07:00
x25.h net: x25: fix one potential use-after-free issue 2018-04-13 19:50:07 +02:00
x25device.h
xfrm.h xfrm: fix stack access out of bounds with CONFIG_XFRM_SUB_POLICY 2017-07-05 14:37:21 +02:00