mbox series

[net-next,00/10] udp: round of data-races fixes

Message ID 20230912091730.1591459-1-edumazet@google.com (mailing list archive)
Headers show
Series udp: round of data-races fixes | expand

Message

Eric Dumazet Sept. 12, 2023, 9:17 a.m. UTC
This series is inspired by multiple syzbot reports.

Many udp fields reads or writes are racy.

Add a proper udp->udp_flags and move there all
flags needing atomic safety.

Also add missing READ_ONCE()/WRITE_ONCE() when
lockless readers need access to specific fields.

Eric Dumazet (10):
  udp: introduce udp->udp_flags
  udp: move udp->no_check6_tx to udp->udp_flags
  udp: move udp->no_check6_rx to udp->udp_flags
  udp: move udp->gro_enabled to udp->udp_flags
  udp: add missing WRITE_ONCE() around up->encap_rcv
  udp: move udp->accept_udp_{l4|fraglist} to udp->udp_flags
  udp: lockless UDP_ENCAP_L2TPINUDP / UDP_GRO
  udp: annotate data-races around udp->encap_type
  udplite: remove UDPLITE_BIT
  udplite: fix various data-races

 drivers/net/gtp.c          |  4 +--
 include/linux/udp.h        | 66 ++++++++++++++++++++--------------
 include/net/udp_tunnel.h   |  9 ++---
 include/net/udplite.h      | 14 +++++---
 net/ipv4/udp.c             | 74 +++++++++++++++++++-------------------
 net/ipv4/udp_offload.c     |  4 +--
 net/ipv4/udp_tunnel_core.c |  2 +-
 net/ipv4/udplite.c         |  1 -
 net/ipv4/xfrm4_input.c     |  4 +--
 net/ipv6/udp.c             | 34 +++++++++---------
 net/ipv6/udplite.c         |  1 -
 net/ipv6/xfrm6_input.c     |  4 +--
 net/l2tp/l2tp_core.c       |  6 ++--
 13 files changed, 118 insertions(+), 105 deletions(-)

Comments

Willem de Bruijn Sept. 12, 2023, 1:25 p.m. UTC | #1
Eric Dumazet wrote:
> This series is inspired by multiple syzbot reports.
> 
> Many udp fields reads or writes are racy.
> 
> Add a proper udp->udp_flags and move there all
> flags needing atomic safety.
> 
> Also add missing READ_ONCE()/WRITE_ONCE() when
> lockless readers need access to specific fields.
> 
> Eric Dumazet (10):
>   udp: introduce udp->udp_flags
>   udp: move udp->no_check6_tx to udp->udp_flags
>   udp: move udp->no_check6_rx to udp->udp_flags
>   udp: move udp->gro_enabled to udp->udp_flags
>   udp: add missing WRITE_ONCE() around up->encap_rcv
>   udp: move udp->accept_udp_{l4|fraglist} to udp->udp_flags
>   udp: lockless UDP_ENCAP_L2TPINUDP / UDP_GRO
>   udp: annotate data-races around udp->encap_type
>   udplite: remove UDPLITE_BIT
>   udplite: fix various data-races
> 
>  drivers/net/gtp.c          |  4 +--
>  include/linux/udp.h        | 66 ++++++++++++++++++++--------------
>  include/net/udp_tunnel.h   |  9 ++---
>  include/net/udplite.h      | 14 +++++---
>  net/ipv4/udp.c             | 74 +++++++++++++++++++-------------------
>  net/ipv4/udp_offload.c     |  4 +--
>  net/ipv4/udp_tunnel_core.c |  2 +-
>  net/ipv4/udplite.c         |  1 -
>  net/ipv4/xfrm4_input.c     |  4 +--
>  net/ipv6/udp.c             | 34 +++++++++---------
>  net/ipv6/udplite.c         |  1 -
>  net/ipv6/xfrm6_input.c     |  4 +--
>  net/l2tp/l2tp_core.c       |  6 ++--
>  13 files changed, 118 insertions(+), 105 deletions(-)

For the series:

Reviewed-by: Willem de Bruijn <willemb@google.com>
patchwork-bot+netdevbpf@kernel.org Sept. 14, 2023, 2:30 p.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Tue, 12 Sep 2023 09:17:20 +0000 you wrote:
> This series is inspired by multiple syzbot reports.
> 
> Many udp fields reads or writes are racy.
> 
> Add a proper udp->udp_flags and move there all
> flags needing atomic safety.
> 
> [...]

Here is the summary with links:
  - [net-next,01/10] udp: introduce udp->udp_flags
    https://git.kernel.org/netdev/net-next/c/81b36803ac13
  - [net-next,02/10] udp: move udp->no_check6_tx to udp->udp_flags
    https://git.kernel.org/netdev/net-next/c/a0002127cd74
  - [net-next,03/10] udp: move udp->no_check6_rx to udp->udp_flags
    https://git.kernel.org/netdev/net-next/c/bcbc1b1de884
  - [net-next,04/10] udp: move udp->gro_enabled to udp->udp_flags
    https://git.kernel.org/netdev/net-next/c/e1dc0615c6b0
  - [net-next,05/10] udp: add missing WRITE_ONCE() around up->encap_rcv
    https://git.kernel.org/netdev/net-next/c/6d5a12eb9122
  - [net-next,06/10] udp: move udp->accept_udp_{l4|fraglist} to udp->udp_flags
    https://git.kernel.org/netdev/net-next/c/f5f52f0884a5
  - [net-next,07/10] udp: lockless UDP_ENCAP_L2TPINUDP / UDP_GRO
    https://git.kernel.org/netdev/net-next/c/ac9a7f4ce5dd
  - [net-next,08/10] udp: annotate data-races around udp->encap_type
    https://git.kernel.org/netdev/net-next/c/70a36f571362
  - [net-next,09/10] udplite: remove UDPLITE_BIT
    https://git.kernel.org/netdev/net-next/c/729549aa350c
  - [net-next,10/10] udplite: fix various data-races
    https://git.kernel.org/netdev/net-next/c/882af43a0fc3

You are awesome, thank you!