sysctl: Fix data-races around ipv4_net_table (Round 2).
Subsystems (9)
cover sysctl: Fix data-races around ipv4_net_table (Round 2).
This series fixes data-races around 15 knobs after ip_default_ttl in ipv4_net_table.
These two knobs are skipped.
- ip_local_port_range is safe with its own lock.
- ip_local_reserved_ports uses proc_do_large_bitmap(), which will need an additional lock and can be fixed later.
So, the next round will start with igmp_link_local_mcast_reports.
Kuniyuki Iwashima (15):
ip: Fix data-races around sysctl_ip_default_ttl.
ip: Fix data-races around sysctl_ip_no_pmtu_disc.
ip: Fix data-races around sysctl_ip_fwd_use_pmtu.
ip: Fix data-races around sysctl_ip_fwd_update_priority.
ip: Fix data-races around sysctl_ip_nonlocal_bind.
ip: Fix a data-race around sysctl_ip_autobind_reuse.
ip: Fix a data-race around sysctl_fwmark_reflect. tcp/dccp: Fix a data-race around sysctl_tcp_fwmark_accept.
tcp: Fix data-races around sysctl_tcp_l3mdev_accept.
tcp: Fix data-races around sysctl_tcp_mtu_probing.
tcp: Fix data-races around sysctl_tcp_base_mss.
tcp: Fix data-races around sysctl_tcp_min_snd_mss.
tcp: Fix a data-race around sysctl_tcp_mtu_probe_floor.
tcp: Fix a data-race around sysctl_tcp_probe_threshold.
tcp: Fix a data-race around sysctl_tcp_probe_interval.
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 ++- drivers/net/ethernet/netronome/nfp/flower/action.c | 2 +- include/net/inet_hashtables.h | 2 +- include/net/inet_sock.h | 9 +++++---- include/net/ip.h | 4 ++-- include/net/route.h | 2 +- net/ipv4/af_inet.c | 2 +- net/ipv4/icmp.c | 2 +- net/ipv4/inet_connection_sock.c | 2 +- net/ipv4/ip_forward.c | 2 +- net/ipv4/ip_sockglue.c | 2 +- net/ipv4/netfilter/nf_reject_ipv4.c | 4 ++-- net/ipv4/proc.c | 2 +- net/ipv4/route.c | 2 +- net/ipv4/tcp_output.c | 11 ++++++----- net/ipv4/tcp_timer.c | 8 ++++---- net/ipv6/af_inet6.c | 2 +- net/netfilter/nf_synproxy_core.c | 2 +- net/sctp/protocol.c | 2 +- net/xfrm/xfrm_state.c | 2 +- 20 files changed, 35 insertions(+), 32 deletions(-)
Signature · 1 line
2.30.2
PATCH 1/15 ip: Fix data-races around sysctl_ip_default_ttl.
While reading sysctl_ip_default_ttl, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
--- drivers/net/ethernet/netronome/nfp/flower/action.c | 2 +- include/net/route.h | 2 +- net/ipv4/ip_sockglue.c | 2 +- net/ipv4/netfilter/nf_reject_ipv4.c | 4 ++-- net/ipv4/proc.c | 2 +- net/netfilter/nf_synproxy_core.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/ethernet/netronome/nfp/flower/action.c +1 -1
@@ -474,7 +474,7 @@ nfp_fl_set_tun(struct nfp_app *app, struct nfp_fl_set_tun *set_tun, set_tun->ttl =ip4_dst_hoplimit (&rt->dst);ip_rt_put (rt); }else { - set_tun->ttl = net->ipv4.sysctl_ip_default_ttl; + set_tun->ttl =READ_ONCE (net->ipv4.sysctl_ip_default_ttl); } }
include/net/route.h +1 -1
@@ -373,7 +373,7 @@ static inline int ip4_dst_hoplimit(const struct dst_entry *dst)struct net *net =dev_net (dst->dev);if (hoplimit ==0 ) - hoplimit = net->ipv4.sysctl_ip_default_ttl; + hoplimit =READ_ONCE (net->ipv4.sysctl_ip_default_ttl);return hoplimit; }
net/ipv4/ip_sockglue.c +1 -1
@@ -1606,7 +1606,7 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, {struct net *net =sock_net (sk); val = (inet->uc_ttl ==-1 ? - net->ipv4.sysctl_ip_default_ttl : +READ_ONCE (net->ipv4.sysctl_ip_default_ttl) : inet->uc_ttl);break ; }
net/ipv4/netfilter/nf_reject_ipv4.c +2 -2
@@ -62,7 +62,7 @@ struct sk_buff *nf_reject_skb_v4_tcp_reset(struct net *net,skb_reserve (nskb,LL_MAX_HEADER ); niph =nf_reject_iphdr_put (nskb, oldskb,IPPROTO_TCP , - net->ipv4.sysctl_ip_default_ttl); +READ_ONCE (net->ipv4.sysctl_ip_default_ttl));nf_reject_ip_tcphdr_put (nskb, oldskb, oth); niph->tot_len =htons (nskb->len);ip_send_check (niph);
@@ -117,7 +117,7 @@ struct sk_buff *nf_reject_skb_v4_unreach(struct net *net,skb_reserve (nskb,LL_MAX_HEADER ); niph =nf_reject_iphdr_put (nskb, oldskb,IPPROTO_ICMP , - net->ipv4.sysctl_ip_default_ttl); +READ_ONCE (net->ipv4.sysctl_ip_default_ttl));skb_reset_transport_header (nskb); icmph =skb_put_zero (nskb,sizeof (struct icmphdr ));
net/ipv4/proc.c +1 -1
@@ -387,7 +387,7 @@ static int snmp_seq_show_ipstats(struct seq_file *seq, void *v)seq_printf (seq,"\nIp: %d %d" ,IPV4_DEVCONF_ALL (net,FORWARDING ) ?1 :2 , - net->ipv4.sysctl_ip_default_ttl); +READ_ONCE (net->ipv4.sysctl_ip_default_ttl));BUILD_BUG_ON (offsetof(struct ipstats_mib , mibs) !=0 ); snmp_get_cpu_field64_batch(buff64, snmp4_ipstats_list,
net/netfilter/nf_synproxy_core.c +1 -1
@@ -405,7 +405,7 @@ synproxy_build_ip(struct net *net, struct sk_buff *skb, __be32 saddr, iph->tos =0 ; iph->id =0 ; iph->frag_off =htons (IP_DF ); - iph->ttl = net->ipv4.sysctl_ip_default_ttl; + iph->ttl =READ_ONCE (net->ipv4.sysctl_ip_default_ttl); iph->protocol =IPPROTO_TCP ; iph->check =0 ; iph->saddr = saddr;
Signature · 1 line
2.30.2
PATCH 2/15 ip: Fix data-races around sysctl_ip_no_pmtu_disc.
In reply to Kuniyuki IwashimaWhile reading sysctl_ip_no_pmtu_disc, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
--- net/ipv4/af_inet.c | 2 +- net/ipv4/icmp.c | 2 +- net/ipv6/af_inet6.c | 2 +- net/xfrm/xfrm_state.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/af_inet.c +1 -1
@@ -335,7 +335,7 @@ static int inet_create(struct net *net, struct socket *sock, int protocol, inet->hdrincl =1 ; } -if (net->ipv4.sysctl_ip_no_pmtu_disc) +if (READ_ONCE (net->ipv4.sysctl_ip_no_pmtu_disc)) inet->pmtudisc =IP_PMTUDISC_DONT ;else inet->pmtudisc =IP_PMTUDISC_WANT ;
net/ipv4/icmp.c +1 -1
@@ -881,7 +881,7 @@ static enum skb_drop_reason icmp_unreach(struct sk_buff *skb)* values please see * Documentation/networking/ip-sysctl.rst */ -switch (net->ipv4.sysctl_ip_no_pmtu_disc) { +switch (READ_ONCE (net->ipv4.sysctl_ip_no_pmtu_disc)) {default :net_dbg_ratelimited ("%pI4: fragmentation needed and DF set\n" , &iph->daddr);
net/ipv6/af_inet6.c +1 -1
@@ -226,7 +226,7 @@ static int inet6_create(struct net *net, struct socket *sock, int protocol,RCU_INIT_POINTER (inet->mc_list,NULL ); inet->rcv_tos =0 ; -if (net->ipv4.sysctl_ip_no_pmtu_disc) +if (READ_ONCE (net->ipv4.sysctl_ip_no_pmtu_disc)) inet->pmtudisc =IP_PMTUDISC_DONT ;else inet->pmtudisc =IP_PMTUDISC_WANT ;
net/xfrm/xfrm_state.c +1 -1
@@ -2620,7 +2620,7 @@ int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload)int err;if (family ==AF_INET && -xs_net (x)->ipv4.sysctl_ip_no_pmtu_disc) +READ_ONCE (xs_net (x)->ipv4.sysctl_ip_no_pmtu_disc)) x->props.flags |=XFRM_STATE_NOPMTUDISC ; err = -EPROTONOSUPPORT ;
Signature · 1 line
2.30.2
PATCH 3/15 ip: Fix data-races around sysctl_ip_fwd_use_pmtu.
In reply to Kuniyuki IwashimaWhile reading sysctl_ip_fwd_use_pmtu, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
---
CC: Hannes Frederic Sowa <[email protected]>
--- include/net/ip.h | 2 +- net/ipv4/route.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/ip.h +1 -1
@@ -446,7 +446,7 @@ static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,struct net *net =dev_net (dst->dev);unsigned int mtu; -if (net->ipv4.sysctl_ip_fwd_use_pmtu || +if (READ_ONCE (net->ipv4.sysctl_ip_fwd_use_pmtu) ||ip_mtu_locked (dst) || !forwarding) { mtu = rt->rt_pmtu;
net/ipv4/route.c +1 -1
@@ -1398,7 +1398,7 @@ u32 ip_mtu_from_fib_result(struct fib_result *res, __be32 daddr)struct fib_info *fi = res->fi;u32 mtu =0 ; -if (dev_net (dev)->ipv4.sysctl_ip_fwd_use_pmtu || +if (READ_ONCE (dev_net (dev)->ipv4.sysctl_ip_fwd_use_pmtu) || fi->fib_metrics->metrics[RTAX_LOCK -1 ] & (1 <<RTAX_MTU )) mtu = fi->fib_mtu;
Signature · 1 line
2.30.2
PATCH 4/15 ip: Fix data-races around sysctl_ip_fwd_update_priority.
In reply to Kuniyuki IwashimaWhile reading sysctl_ip_fwd_update_priority, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
---
CC: Petr Machata <[email protected]>
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 ++- net/ipv4/ip_forward.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +2 -1
@@ -10523,13 +10523,14 @@ static int mlxsw_sp_dscp_init(struct mlxsw_sp *mlxsw_sp)static int __mlxsw_sp_router_init (struct mlxsw_sp *mlxsw_sp) {struct net *net =mlxsw_sp_net (mlxsw_sp); -bool usp = net->ipv4.sysctl_ip_fwd_update_priority;char rgcr_pl[MLXSW_REG_RGCR_LEN ];u64 max_rifs; +bool usp;if (!MLXSW_CORE_RES_VALID (mlxsw_sp->core,MAX_RIFS ))return -EIO ; max_rifs =MLXSW_CORE_RES_GET (mlxsw_sp->core,MAX_RIFS ); + usp =READ_ONCE (net->ipv4.sysctl_ip_fwd_update_priority);mlxsw_reg_rgcr_pack (rgcr_pl, true, true);mlxsw_reg_rgcr_max_router_interfaces_set (rgcr_pl, max_rifs);
net/ipv4/ip_forward.c +1 -1
@@ -157,7 +157,7 @@ int ip_forward(struct sk_buff *skb) !skb_sec_path(skb))ip_rt_send_redirect (skb); -if (net->ipv4.sysctl_ip_fwd_update_priority) +if (READ_ONCE (net->ipv4.sysctl_ip_fwd_update_priority)) skb->priority =rt_tos2priority (iph->tos); return NF_HOOK(NFPROTO_IPV4, NF_INET_FORWARD,
Signature · 1 line
2.30.2
PATCH 5/15 ip: Fix data-races around sysctl_ip_nonlocal_bind.
In reply to Kuniyuki IwashimaWhile reading sysctl_ip_nonlocal_bind, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
--- include/net/inet_sock.h | 2 +- net/sctp/protocol.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/inet_sock.h +1 -1
@@ -374,7 +374,7 @@ static inline bool inet_get_convert_csum(struct sock *sk)static inline bool inet_can_nonlocal_bind (struct net *net,struct inet_sock *inet) { -return net->ipv4.sysctl_ip_nonlocal_bind || +return READ_ONCE (net->ipv4.sysctl_ip_nonlocal_bind) || inet->freebind || inet->transparent; }
net/sctp/protocol.c +1 -1
@@ -358,7 +358,7 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)if (addr->v4.sin_addr.s_addr !=htonl (INADDR_ANY ) && ret !=RTN_LOCAL && !sp->inet.freebind && - !net->ipv4.sysctl_ip_nonlocal_bind) + !READ_ONCE (net->ipv4.sysctl_ip_nonlocal_bind))return 0 ;if (ipv6_only_sock (sctp_opt2sk (sp)))
Signature · 1 line
2.30.2
PATCH 6/15 ip: Fix a data-race around sysctl_ip_autobind_reuse.
In reply to Kuniyuki IwashimaWhile reading sysctl_ip_autobind_reuse, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader.
--- net/ipv4/inet_connection_sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/inet_connection_sock.c +1 -1
@@ -263,7 +263,7 @@ inet_csk_find_open_port(struct sock *sk, struct inet_bind_bucket **tb_ret, int * goto other_half_scan; } -if (net->ipv4.sysctl_ip_autobind_reuse && !relax) { +if (READ_ONCE (net->ipv4.sysctl_ip_autobind_reuse) && !relax) {/* We still have a chance to connect to different destinations */ relax = true; goto ports_exhausted;
Signature · 1 line
2.30.2
PATCH 7/15 ip: Fix a data-race around sysctl_fwmark_reflect.
In reply to Kuniyuki IwashimaWhile reading sysctl_fwmark_reflect, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader.
---
CC: Lorenzo Colitti <[email protected]>
--- include/net/ip.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/ip.h +1 -1
@@ -384,7 +384,7 @@ void ipfrag_init(void);void ip_static_sysctl_init (void );#define IP4_REPLY_MARK (net, mark) \ - ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0) + (READ_ONCE((net)->ipv4.sysctl_fwmark_reflect) ? (mark) : 0)static inline bool ip_is_fragment (const struct iphdr *iph) {
Signature · 1 line
2.30.2
PATCH 8/15 tcp/dccp: Fix a data-race around sysctl_tcp_fwmark_accept.
In reply to Kuniyuki IwashimaWhile reading sysctl_tcp_fwmark_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader.
---
CC: Lorenzo Colitti <[email protected]>
--- include/net/inet_sock.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/net/inet_sock.h +2 -1
@@ -107,7 +107,8 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)static inline u32 inet_request_mark (const struct sock *sk,struct sk_buff *skb) { -if (!sk->sk_mark &&sock_net (sk)->ipv4.sysctl_tcp_fwmark_accept) +if (!sk->sk_mark && +READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_fwmark_accept))return skb->mark;return sk->sk_mark;
Signature · 1 line
2.30.2
PATCH 9/15 tcp: Fix data-races around sysctl_tcp_l3mdev_accept.
In reply to Kuniyuki IwashimaWhile reading sysctl_tcp_l3mdev_accept, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
--- include/net/inet_hashtables.h | 2 +- include/net/inet_sock.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
include/net/inet_hashtables.h +1 -1
@@ -179,7 +179,7 @@ static inline bool inet_sk_bound_dev_eq(struct net *net, int bound_dev_if, int dif, int sdif) {#if IS_ENABLED (CONFIG_NET_L3_MASTER_DEV ) -return inet_bound_dev_eq (!!net->ipv4.sysctl_tcp_l3mdev_accept, +return inet_bound_dev_eq (!!READ_ONCE (net->ipv4.sysctl_tcp_l3mdev_accept), bound_dev_if, dif, sdif);#else return inet_bound_dev_eq (true, bound_dev_if, dif, sdif);
include/net/inet_sock.h +2 -2
@@ -121,7 +121,7 @@ static inline int inet_request_bound_dev_if(const struct sock *sk,#ifdef CONFIG_NET_L3_MASTER_DEV struct net *net =sock_net (sk); -if (!bound_dev_if && net->ipv4.sysctl_tcp_l3mdev_accept) +if (!bound_dev_if &&READ_ONCE (net->ipv4.sysctl_tcp_l3mdev_accept))return l3mdev_master_ifindex_by_index (net, skb->skb_iif);#endif
@@ -133,7 +133,7 @@ static inline int inet_sk_bound_l3mdev(const struct sock *sk)#ifdef CONFIG_NET_L3_MASTER_DEV struct net *net =sock_net (sk); -if (!net->ipv4.sysctl_tcp_l3mdev_accept) +if (!READ_ONCE (net->ipv4.sysctl_tcp_l3mdev_accept))return l3mdev_master_ifindex_by_index (net, sk->sk_bound_dev_if);#endif
Signature · 1 line
2.30.2
PATCH 10/15 tcp: Fix data-races around sysctl_tcp_mtu_probing.
In reply to Kuniyuki IwashimaWhile reading sysctl_tcp_mtu_probing, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
---
CC: John Heffner <[email protected]>
--- net/ipv4/tcp_output.c | 2 +- net/ipv4/tcp_timer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_output.c +1 -1
@@ -1762,7 +1762,7 @@ void tcp_mtup_init(struct sock *sk)struct inet_connection_sock *icsk =inet_csk (sk);struct net *net =sock_net (sk); - icsk->icsk_mtup.enabled = net->ipv4.sysctl_tcp_mtu_probing >1 ; + icsk->icsk_mtup.enabled =READ_ONCE (net->ipv4.sysctl_tcp_mtu_probing) >1 ; icsk->icsk_mtup.search_high = tp->rx_opt.mss_clamp +sizeof (struct tcphdr ) + icsk->icsk_af_ops->net_header_len; icsk->icsk_mtup.search_low =tcp_mss_to_mtu (sk, net->ipv4.sysctl_tcp_base_mss);
net/ipv4/tcp_timer.c +1 -1
@@ -163,7 +163,7 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk)int mss;/* Black hole detection */ -if (!net->ipv4.sysctl_tcp_mtu_probing) +if (!READ_ONCE (net->ipv4.sysctl_tcp_mtu_probing))return ;if (!icsk->icsk_mtup.enabled) {
Signature · 1 line
2.30.2
PATCH 11/15 tcp: Fix data-races around sysctl_tcp_base_mss.
In reply to Kuniyuki IwashimaWhile reading sysctl_tcp_base_mss, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
---
CC: John Heffner <[email protected]>
--- net/ipv4/tcp_output.c | 2 +- net/ipv4/tcp_timer.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_output.c +1 -1
@@ -1765,7 +1765,7 @@ void tcp_mtup_init(struct sock *sk) icsk->icsk_mtup.enabled =READ_ONCE (net->ipv4.sysctl_tcp_mtu_probing) >1 ; icsk->icsk_mtup.search_high = tp->rx_opt.mss_clamp +sizeof (struct tcphdr ) + icsk->icsk_af_ops->net_header_len; - icsk->icsk_mtup.search_low =tcp_mss_to_mtu (sk, net->ipv4.sysctl_tcp_base_mss); + icsk->icsk_mtup.search_low =tcp_mss_to_mtu (sk,READ_ONCE (net->ipv4.sysctl_tcp_base_mss)); icsk->icsk_mtup.probe_size =0 ;if (icsk->icsk_mtup.enabled) icsk->icsk_mtup.probe_timestamp = tcp_jiffies32;
net/ipv4/tcp_timer.c +1 -1
@@ -171,7 +171,7 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) icsk->icsk_mtup.probe_timestamp = tcp_jiffies32; }else { mss =tcp_mtu_to_mss (sk, icsk->icsk_mtup.search_low) >>1 ; - mss =min (net->ipv4.sysctl_tcp_base_mss, mss); + mss =min (READ_ONCE (net->ipv4.sysctl_tcp_base_mss), mss); mss =max (mss, net->ipv4.sysctl_tcp_mtu_probe_floor); mss =max (mss, net->ipv4.sysctl_tcp_min_snd_mss); icsk->icsk_mtup.search_low =tcp_mss_to_mtu (sk, mss);
Signature · 1 line
2.30.2
PATCH 12/15 tcp: Fix data-races around sysctl_tcp_min_snd_mss.
In reply to Kuniyuki IwashimaWhile reading sysctl_tcp_min_snd_mss, it can be changed concurrently. Thus, we need to add READ_ONCE() to its readers.
--- net/ipv4/tcp_output.c | 3 ++- net/ipv4/tcp_timer.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
net/ipv4/tcp_output.c +2 -1
@@ -1719,7 +1719,8 @@ static inline int __tcp_mtu_to_mss(struct sock *sk, int pmtu) mss_now -= icsk->icsk_ext_hdr_len;/* Then reserve room for full set of TCP options and 8 bytes of data */ - mss_now =max (mss_now,sock_net (sk)->ipv4.sysctl_tcp_min_snd_mss); + mss_now =max (mss_now, +READ_ONCE (sock_net (sk)->ipv4.sysctl_tcp_min_snd_mss));return mss_now; }
net/ipv4/tcp_timer.c +1 -1
@@ -173,7 +173,7 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) mss =tcp_mtu_to_mss (sk, icsk->icsk_mtup.search_low) >>1 ; mss =min (READ_ONCE (net->ipv4.sysctl_tcp_base_mss), mss); mss =max (mss, net->ipv4.sysctl_tcp_mtu_probe_floor); - mss =max (mss, net->ipv4.sysctl_tcp_min_snd_mss); + mss =max (mss,READ_ONCE (net->ipv4.sysctl_tcp_min_snd_mss)); icsk->icsk_mtup.search_low =tcp_mss_to_mtu (sk, mss); }tcp_sync_mss (sk, icsk->icsk_pmtu_cookie);
Signature · 1 line
2.30.2
PATCH 13/15 tcp: Fix a data-race around sysctl_tcp_mtu_probe_floor.
In reply to Kuniyuki IwashimaWhile reading sysctl_tcp_mtu_probe_floor, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader.
---
CC: Josh Hunt <[email protected]>
--- net/ipv4/tcp_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_timer.c +1 -1
@@ -172,7 +172,7 @@ static void tcp_mtu_probing(struct inet_connection_sock *icsk, struct sock *sk) }else { mss =tcp_mtu_to_mss (sk, icsk->icsk_mtup.search_low) >>1 ; mss =min (READ_ONCE (net->ipv4.sysctl_tcp_base_mss), mss); - mss =max (mss, net->ipv4.sysctl_tcp_mtu_probe_floor); + mss =max (mss,READ_ONCE (net->ipv4.sysctl_tcp_mtu_probe_floor)); mss =max (mss,READ_ONCE (net->ipv4.sysctl_tcp_min_snd_mss)); icsk->icsk_mtup.search_low =tcp_mss_to_mtu (sk, mss); }
Signature · 1 line
2.30.2
PATCH 14/15 tcp: Fix a data-race around sysctl_tcp_probe_threshold.
In reply to Kuniyuki IwashimaWhile reading sysctl_tcp_probe_threshold, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader.
---
CC: Fan Du <[email protected]>
--- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_output.c +1 -1
@@ -2367,7 +2367,7 @@ static int tcp_mtu_probe(struct sock *sk)* probing process by not resetting search range to its orignal. */ if (probe_size >tcp_mtu_to_mss (sk, icsk->icsk_mtup.search_high) || - interval < net->ipv4.sysctl_tcp_probe_threshold) { + interval <READ_ONCE (net->ipv4.sysctl_tcp_probe_threshold)) {/* Check whether enough time has elaplased for * another round of probing. */
Signature · 1 line
2.30.2
PATCH 15/15 tcp: Fix a data-race around sysctl_tcp_probe_interval.
In reply to Kuniyuki IwashimaWhile reading sysctl_tcp_probe_interval, it can be changed concurrently. Thus, we need to add READ_ONCE() to its reader.
---
CC: Fan Du <[email protected]>
--- net/ipv4/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_output.c +1 -1
@@ -2283,7 +2283,7 @@ static inline void tcp_mtu_check_reprobe(struct sock *sk)u32 interval;s32 delta; - interval = net->ipv4.sysctl_tcp_probe_interval; + interval =READ_ONCE (net->ipv4.sysctl_tcp_probe_interval); delta = tcp_jiffies32 - icsk->icsk_mtup.probe_timestamp;if (unlikely (delta >= interval *HZ )) {int mss =tcp_current_mss (sk);
Signature · 1 line
2.30.2
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Quoted 9 lines · On Wed, 13 Jul 2022 13:51:50 -0700 you wrote:
This series fixes data-races around 15 knobs after
ip_default_ttlinipv4_net_table.These two knobs are skipped.
-ip_local_port_rangeis safe with its own lock.
-ip_local_reserved_portsusesproc_do_large_bitmap(), which will need an additional lock and can be fixed later.[...]
Here is the summary with links:
- [v1,net,01/15] ip: Fix data-races around sysctl_ip_default_ttl.
https://git.kernel.org/netdev/net/c/8281b7ec5c56 - [v1,net,02/15] ip: Fix data-races around sysctl_ip_no_pmtu_disc. https://git.kernel.org/netdev/net/c/0968d2a441bf - [v1,net,03/15] ip: Fix data-races around sysctl_ip_fwd_use_pmtu. https://git.kernel.org/netdev/net/c/60c158dc7b1f - [v1,net,04/15] ip: Fix data-races around sysctl_ip_fwd_update_priority. https://git.kernel.org/netdev/net/c/7bf9e18d9a5e - [v1,net,05/15] ip: Fix data-races around sysctl_ip_nonlocal_bind. https://git.kernel.org/netdev/net/c/289d3b21fb0b - [v1,net,06/15] ip: Fix a data-race around sysctl_ip_autobind_reuse. https://git.kernel.org/netdev/net/c/0db232765887 - [v1,net,07/15] ip: Fix a data-race around sysctl_fwmark_reflect. https://git.kernel.org/netdev/net/c/85d0b4dbd74b - [v1,net,08/15] tcp/dccp: Fix a data-race around sysctl_tcp_fwmark_accept. https://git.kernel.org/netdev/net/c/1a0008f9df59 - [v1,net,09/15] tcp: Fix data-races around sysctl_tcp_l3mdev_accept. https://git.kernel.org/netdev/net/c/08a75f106794 - [v1,net,10/15] tcp: Fix data-races around sysctl_tcp_mtu_probing. https://git.kernel.org/netdev/net/c/f47d00e077e7 - [v1,net,11/15] tcp: Fix data-races around sysctl_tcp_base_mss. https://git.kernel.org/netdev/net/c/88d78bc097cd - [v1,net,12/15] tcp: Fix data-races around sysctl_tcp_min_snd_mss. https://git.kernel.org/netdev/net/c/78eb166cdefc - [v1,net,13/15] tcp: Fix a data-race around sysctl_tcp_mtu_probe_floor. https://git.kernel.org/netdev/net/c/8e92d4423615 - [v1,net,14/15] tcp: Fix a data-race around sysctl_tcp_probe_threshold. https://git.kernel.org/netdev/net/c/92c0aa417547 - [v1,net,15/15] tcp: Fix a data-race around sysctl_tcp_probe_interval. https://git.kernel.org/netdev/net/c/2a85388f1d94
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html