*BSD News Article 63312


Return to BSD News archive

Newsgroups: comp.bugs.2bsd
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!newshost.telstra.net!act.news.telstra.net!psgrain!iafrica.com!peacenjoy.mikom.csir.co.za!news.uoregon.edu!news.dacom.co.kr!nntp.coast.net!frankensun.altair.com!wlbr!sms
From: sms@wlv.iipo.gtegsc.com (Steven M. Schultz)
Subject: Interoverlay use of static functions causes sendmail to bomb (#308)
Sender: news@wlbr.iipo.gtegsc.com (System Administrator)
Organization: GTE Government Systems, Thousand Oaks CA USA
Message-ID: <Do36FM.HAq@wlbr.iipo.gtegsc.com>
X-Nntp-Posting-Host: wlv.iipo.gtegsc.com
Date: Mon, 11 Mar 1996 04:42:57 GMT
Lines: 188

Subject: Interoverlay use of static functions causes sendmail to bomb (#308)
Index:	usr.lib/sendmail/{conf,util,usersmtp}.c 2.11BSD

Description:
	Sendmail mysteriously dies when performing timer related
	activities such as running the queue or timing out a response
	from a remote system.

Repeat-By:
	Very difficult.  If sendmail infrequently simply disappears at
	random infrequent intervals then it is likely to be caused by
	this problem.

Fix:
	Apply the fix below, recompile, reinstall and restart sendmail.  
	Remember to refreeze the configuration file before restarting
	sendmail.

	The problem was caused by passing the address of 'static' functions
	between overlays.  This caused the address of the actual (overlay
	specific) function to be passed rather than the address of the 'thunk'
	(intermediate transfer vector).   Declaring a function static inhibits
	the linker from generating a thunk for the function.  Thus 'static'
	functions must _not_ be referenced outside the overlay in which they
	reside.

	Removing the 'static' declarations fixes the problem.

	Cut where indicated, saving to a file (/tmp/308).  Then:

		patch -p0 < /tmp/308
		cd /usr/src/usr.lib/sendmail/src
		make
		make install
		make clean

		Then kill the old sendmail process if one is running.

		/usr/lib/sendmail -bz
		/usr/lib/sendmail -bd -q30m

		(adjust the queue run interval to suit local preferences)

----------------------cut here--------------------
*** /usr/src/usr.lib/sendmail/src/clock.c.old	Wed Feb 10 15:26:09 1988
--- /usr/src/usr.lib/sendmail/src/clock.c	Sun Mar 10 19:56:34 1996
***************
*** 9,15 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)clock.c	5.4 (Berkeley) 12/17/85";
  #endif
  
  # include "sendmail.h"
--- 9,15 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)clock.c	5.4.1 (2.11BSD) 1996/3/10";
  #endif
  
  # include "sendmail.h"
***************
*** 228,234 ****
  		pause();
  }
  
- static
  endsleep()
  {
  	SleepDone = TRUE;
--- 228,233 ----
*** /usr/src/usr.lib/sendmail/src/usersmtp.c.old	Fri Jul 15 14:38:05 1994
--- /usr/src/usr.lib/sendmail/src/usersmtp.c	Sun Mar 10 19:58:51 1996
***************
*** 16,27 ****
  
  # ifndef SMTP
  #if !defined(lint) && !defined(NOSCCS)
! static char SccsId[] = "@(#)usersmtp.c	5.7.1 (2.11BSD GTE) 7/15/94 (no SMTP)";
  # endif
  # else SMTP
  
  #if !defined(lint) && !defined(NOSCCS)
! static char SccsId[] = "@(#)usersmtp.c	5.7.1 (2.11BSD GTE) 7/15/94";
  # endif
  
  
--- 16,27 ----
  
  # ifndef SMTP
  #if !defined(lint) && !defined(NOSCCS)
! static char SccsId[] = "@(#)usersmtp.c	5.7.2 (2.11BSD GTE) 1996/3/10(no SMTP)";
  # endif
  # else SMTP
  
  #if !defined(lint) && !defined(NOSCCS)
! static char SccsId[] = "@(#)usersmtp.c	5.7.2 (2.11BSD GTE) 1996/3/10";
  # endif
  
  
***************
*** 75,81 ****
  	register int r;
  	EVENT *gte;
  	char buf[MAXNAME];
! 	extern greettimeout();
  
  	/*
  	**  Open the connection to the mailer.
--- 75,81 ----
  	register int r;
  	EVENT *gte;
  	char buf[MAXNAME];
! 	int greettimeout();
  
  	/*
  	**  Open the connection to the mailer.
***************
*** 213,219 ****
  }
  
  
- static
  greettimeout()
  {
  	/* timeout reading the greeting message */
--- 213,218 ----
*** /usr/src/usr.lib/sendmail/src/util.c.old	Tue Mar  7 21:29:24 1995
--- /usr/src/usr.lib/sendmail/src/util.c	Sun Mar 10 19:59:58 1996
***************
*** 9,15 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)util.c	5.8.1 (2.11BSD GTE) 3/07/95";
  #endif
  
  # include <stdio.h>
--- 9,15 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)util.c	5.8.2 (2.11BSD GTE) 1996/3/10";
  #endif
  
  # include <stdio.h>
***************
*** 615,621 ****
  {
  	register EVENT *ev = NULL;
  	register char *p;
! 	extern readtimeout();
  
  	/* set the timeout */
  	if (ReadTimeout != 0)
--- 615,621 ----
  {
  	register EVENT *ev = NULL;
  	register char *p;
! 	int readtimeout();
  
  	/* set the timeout */
  	if (ReadTimeout != 0)
***************
*** 655,661 ****
  	return (buf);
  }
  
- static
  readtimeout()
  {
  	longjmp(CtxReadTimeout, 1);
--- 655,660 ----
*** /VERSION.old	Fri Mar  8 22:54:36 1996
--- /VERSION	Sun Mar 10 20:00:16 1996
***************
*** 1,4 ****
! Current Patch Level: 307
  
  2.11 BSD
  ============
--- 1,4 ----
! Current Patch Level: 308
  
  2.11 BSD
  ============