Re: Removing NET_NEEDS_GIANT: first patch

From: Robert Watson <rwatson_at_FreeBSD.org>
Date: Fri, 27 Jul 2007 15:28:45 +0100 (BST)
On Wed, 25 Jul 2007, Robert Watson wrote:

> Things this patch doesn't do:
>
> - Address the WITNESS lock order warnings generated when credential rules 
> are
>  used with ipfw/pf.  These are believed to be annoying but non-harmful, as
>  deadlocks are no longer reported.  This view may be revised if evidence to
>  the contrary is presented.

Kris managed to find a report that one of the post-6.0 hangs involved DIVERT 
sockets, and sure enough, there is a call to ip_output() without an inpcb 
pointer, which could cause problems.  The attached patch may fix this and 
another recursion-ish issue involving directly invoking ip_input() rather than 
indirectly via the netisr.  If users of IPDIVERT could give this patch a try 
and make sure breaks, it could be this resolves the reported issues. 
Regardless of whether it fixes things, it should probably be committed anyway.

Robert N M Watson
Computer Laboratory
University of Cambridge

Index: ip_divert.c
===================================================================
RCS file: /data/fbsd-cvs/ncvs/src/sys/netinet/ip_divert.c,v
retrieving revision 1.128
diff -u -r1.128 ip_divert.c
--- ip_divert.c	11 May 2007 10:20:50 -0000	1.128
+++ ip_divert.c	27 Jul 2007 14:25:09 -0000
_at__at_ -61,6 +61,7 _at__at_
  #include <vm/uma.h>

  #include <net/if.h>
+#include <net/netisr.h>
  #include <net/route.h>

  #include <netinet/in.h>
_at__at_ -378,7 +379,7 _at__at_
  				    ((so->so_options & SO_DONTROUTE) ?
  				    IP_ROUTETOIF : 0) |
  				    IP_ALLOWBROADCAST | IP_RAWOUTPUT,
-				    inp->inp_moptions, NULL);
+				    inp->inp_moptions, inp);
  		}
  		INP_UNLOCK(inp);
  		INP_INFO_WUNLOCK(&divcbinfo);
_at__at_ -407,7 +408,7 _at__at_
  		SOCK_UNLOCK(so);
  #endif
  		/* Send packet to input processing */
-		ip_input(m);
+		netisr_queue(NETISR_IP, m);
  	}

  	return error;
Received on Fri Jul 27 2007 - 12:28:46 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:15 UTC