Module Name: src Committed By: ozaki-r Date: Mon Oct 3 11:06:06 UTC 2016
Modified Files: src/sys/net: if.c if.h if_arcsubr.c if_atmsubr.c if_ecosubr.c if_ethersubr.c if_fddisubr.c if_ieee1394subr.c if_mpls.c if_pppoe.c if_spppsubr.c if_tokensubr.c rtsock.c src/sys/netatalk: ddp_input.c ddp_usrreq.c src/sys/netinet: if_arp.c src/sys/netmpls: mpls_proto.c src/sys/netnatm: natm.c natm_proto.c Log Message: Fix race condition on ifqueue used by traditional netisr If a underlying network device driver supports MSI/MSI-X, RX interrupts can be delivered to arbitrary CPUs. This means that Layer 2 subroutines such as ether_input (softint) and subsequent Layer 3 subroutines (softint) which are called via traditional netisr can be dispatched on an arbitrary CPU. Layer 2 subroutines now run without any locks (expected) and so a Layer 2 subroutine and a Layer 3 subroutine can run in parallel. There is a shared data between a Layer 2 routine and a Layer 3 routine, that is ifqueue and IF_ENQUEUE (from L2) and IF_DEQUEUE (from L3) on it are racy now. To fix the race condition, use ifqueue#ifq_lock to protect ifqueue instead of splnet that is meaningless now. The same race condition exists in route_intr. Fix it as well. Reviewed by knakahara@ To generate a diff of this commit: cvs rdiff -u -r1.357 -r1.358 src/sys/net/if.c cvs rdiff -u -r1.226 -r1.227 src/sys/net/if.h cvs rdiff -u -r1.73 -r1.74 src/sys/net/if_arcsubr.c cvs rdiff -u -r1.59 -r1.60 src/sys/net/if_atmsubr.c cvs rdiff -u -r1.48 -r1.49 src/sys/net/if_ecosubr.c cvs rdiff -u -r1.227 -r1.228 src/sys/net/if_ethersubr.c cvs rdiff -u -r1.101 -r1.102 src/sys/net/if_fddisubr.c cvs rdiff -u -r1.57 -r1.58 src/sys/net/if_ieee1394subr.c cvs rdiff -u -r1.27 -r1.28 src/sys/net/if_mpls.c cvs rdiff -u -r1.117 -r1.118 src/sys/net/if_pppoe.c cvs rdiff -u -r1.154 -r1.155 src/sys/net/if_spppsubr.c cvs rdiff -u -r1.77 -r1.78 src/sys/net/if_tokensubr.c cvs rdiff -u -r1.196 -r1.197 src/sys/net/rtsock.c cvs rdiff -u -r1.27 -r1.28 src/sys/netatalk/ddp_input.c cvs rdiff -u -r1.68 -r1.69 src/sys/netatalk/ddp_usrreq.c cvs rdiff -u -r1.227 -r1.228 src/sys/netinet/if_arp.c cvs rdiff -u -r1.29 -r1.30 src/sys/netmpls/mpls_proto.c cvs rdiff -u -r1.52 -r1.53 src/sys/netnatm/natm.c cvs rdiff -u -r1.16 -r1.17 src/sys/netnatm/natm_proto.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.