🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs.4bsd
Article #1622

spl botch in MCLGET FIX

#1622
From: Glenn C. Skinner
Date: Tue, 05 Aug 1986 17:45
40 lines
1993 bytes
Index:	/sys/h/mbuf.h 4.3BSD

Description:
	The MCLGET macro defined in /sys/h/mbuf.h invokes the m_clalloc
	routine defined in /sys/sys/uipc_mbuf.c.  This latter routine
	expects to be called at splimp, but the macro makes no provisions
	to do so.  Moreover, the macro is invoked in sosend(), defined in
	/sys/sys/uipc_socket.c, while the processor level is at spl0.
Repeat-By:
	I haven't (yet) observed crashes due to this problem.  However,
	one would expect to see it manifest during periods of intense
	network activity when processes are sending sufficiently many
	large packets back and forth to exceed the initial cluster mbuf
	allocation.
Fix:
	An obvious patch is to modify MCLGET's definition to surround
	the m_clalloc call with the proper spl calls:

  #define	MCLGET(m) \
  	{ struct mbuf *p; \
+ 	  int ms = splimp(); \
  	  if (mclfree == 0) \
  		(void)m_clalloc(1, MPG_CLUSTERS, M_DONTWAIT); \
+	  splx(ms); \
  	  MCLALLOC(p, 1); \
  	  if (p) { \
  		(m)->m_off = (int)p - (int)(m); \
  		(m)->m_len = CLBYTES; \
  	  } \
  	}

	However, this fix isn't very satisfactory, because the MCLALLOC
	macro is called immediately afterward, and the first thing it
	does is to go to splimp.  Better would be to revise the definitions
	of both macros to have MCLGET go to splimp immediately and not
	splx until after the MCLALLOC invocation.  MCLALLOC itself then
	would refrain from spl calls.  Other callers would have to take
	this change into account.

		-- Glenn Skinner, SMI
Technical Details
Message-ID: <5844@sun.uucp>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!im4u!ut-sally!pyramid!decwrl!sun!glenn

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!caip!im4u!ut-sally!pyramid!decwrl!sun!glenn
From: glenn@sun.uucp (Glenn C. Skinner)
Newsgroups: net.bugs.4bsd
Subject: spl botch in MCLGET  FIX
Message-ID: <5844@sun.uucp>
Date: Tue, 5-Aug-86 13:45:32 EDT
Article-I.D.: sun.5844
Posted: Tue Aug  5 13:45:32 1986
Date-Received: Sat, 9-Aug-86 04:16:13 EDT
Distribution: net
Organization: Sun Microsystems, Inc.
Lines: 38