mbox series

[v3,net-next,0/7] arp: Random clean up and RCU conversion for ioctl(SIOCGARP).

Message ID 20240430015813.71143-1-kuniyu@amazon.com (mailing list archive)
Headers show
Series arp: Random clean up and RCU conversion for ioctl(SIOCGARP). | expand

Message

Kuniyuki Iwashima April 30, 2024, 1:58 a.m. UTC
arp_ioctl() holds rtnl_lock() regardless of cmd (SIOCDARP, SIOCSARP,
and SIOCGARP) to get net_device by __dev_get_by_name() and copy
dev->name safely.

In the SIOCGARP path, arp_req_get() calls neigh_lookup(), which looks
up a neighbour entry under RCU.

This series cleans up ioctl() code a bit and extends the RCU section
not to take rtnl_lock() and instead use dev_get_by_name_rcu() and
netdev_copy_name() for SIOCGARP.


Changes:
  v3:
    Add Patch 6 to read dev->name safely under seqlock.

  v2: https://lore.kernel.org/netdev/20240425170002.68160-1-kuniyu@amazon.com/
    Patch 5: s/!IS_ERR/IS_ERR/ in arp_req_delete().

  v1: https://lore.kernel.org/netdev/20240422194755.4221-1-kuniyu@amazon.com/


Kuniyuki Iwashima (7):
  arp: Move ATF_COM setting in arp_req_set().
  arp: Validate netmask earlier for SIOCDARP and SIOCSARP in
    arp_ioctl().
  arp: Factorise ip_route_output() call in arp_req_set() and
    arp_req_delete().
  arp: Remove a nest in arp_req_get().
  arp: Get dev after calling arp_req_(delete|set|get)().
  net: Protect dev->name by seqlock.
  arp: Convert ioctl(SIOCGARP) to RCU.

 include/linux/netdevice.h |   1 +
 net/core/dev.c            |  27 ++++-
 net/ipv4/arp.c            | 203 +++++++++++++++++++++++---------------
 3 files changed, 147 insertions(+), 84 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org May 2, 2024, 1:50 a.m. UTC | #1
Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 29 Apr 2024 18:58:06 -0700 you wrote:
> arp_ioctl() holds rtnl_lock() regardless of cmd (SIOCDARP, SIOCSARP,
> and SIOCGARP) to get net_device by __dev_get_by_name() and copy
> dev->name safely.
> 
> In the SIOCGARP path, arp_req_get() calls neigh_lookup(), which looks
> up a neighbour entry under RCU.
> 
> [...]

Here is the summary with links:
  - [v3,net-next,1/7] arp: Move ATF_COM setting in arp_req_set().
    https://git.kernel.org/netdev/net-next/c/42033d0cfc86
  - [v3,net-next,2/7] arp: Validate netmask earlier for SIOCDARP and SIOCSARP in arp_ioctl().
    https://git.kernel.org/netdev/net-next/c/0592367424bb
  - [v3,net-next,3/7] arp: Factorise ip_route_output() call in arp_req_set() and arp_req_delete().
    https://git.kernel.org/netdev/net-next/c/f8696133f6aa
  - [v3,net-next,4/7] arp: Remove a nest in arp_req_get().
    https://git.kernel.org/netdev/net-next/c/51e9ba48d487
  - [v3,net-next,5/7] arp: Get dev after calling arp_req_(delete|set|get)().
    https://git.kernel.org/netdev/net-next/c/a428bfc77a4d
  - [v3,net-next,6/7] net: Protect dev->name by seqlock.
    https://git.kernel.org/netdev/net-next/c/0840556e5a3a
  - [v3,net-next,7/7] arp: Convert ioctl(SIOCGARP) to RCU.
    https://git.kernel.org/netdev/net-next/c/bf4ea58874df

You are awesome, thank you!