[Differential] D12457: Complete INADDR_HASH lock protection

eugen_grosbein.net (Eugene Grosbein) phabric-noreply at FreeBSD.org
Fri Sep 22 11:12:00 UTC 2017


eugen_grosbein.net created this revision.
Herald added a subscriber: imp.

REVISION SUMMARY
  If a system has dynamic ever changing set of IP addresses, it can panic due to unprotected access to global INADDR_HASH in several kernel subsystems: ip_input.c, in_mcast.c, if_stf(4).
  
  There was also similar problem in ip_fw2.c fixed recently in head by ae at .
  kgdb showed "(struct in_ifaddr *) 0xdeadc0dedeadc0de" for a panic in INVARIANTS-enabled kernel (PR #220078).
  
  I could provoke such panic in ipfw with my stress-test for net/mpd5 creating/deleting hundreds of ngXXX interfaces having distinct IP addresses.
  
  Proposed change makes use of existing IN_IFADDR_[RW]LOCK macros to protect access to the set as they are already used in the ip_icmp.c, if_ether.c and in.c.

TEST PLAN
  The nature of the race makes it hard to reproduce the bug, but it can happen using high loaded (or stress-tested) net/mpd5 installation.
  
  1. Apply the patch.
  2. Rebuild a kernel.
  3. Run busy mpd5 server with hundreds of users reconnecting very often.

REPOSITORY
  rS FreeBSD src repository

REVISION DETAIL
  https://reviews.freebsd.org/D12457

AFFECTED FILES
  sys/net/if_stf.c
  sys/netinet/in_mcast.c
  sys/netinet/ip_input.c

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: eugen_grosbein.net, ae, avg, mav, rwatson
Cc: imp, freebsd-net-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12457.33312.patch
Type: text/x-patch
Size: 3990 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-net/attachments/20170922/ed4aa6ee/attachment.bin>


More information about the freebsd-net mailing list