[OpenAFS] 1.4.x fileserver crashes on amd64_linux2X when tracing turned on

Rainer Toebbicke rtb@pclella.cern.ch
Tue, 14 Mar 2006 16:03:25 +0100


This is a multi-part message in MIME format.
--------------080403060507010408040608
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

The fileserver crashes on amd64_linux2[46] (and probably also 
ia64_linux2[46]) when tracing is turned on (TSTP signal).

The reason: inet_ntoa() is not declared anywhere and therefore assumed 
returning an int, but the format string in ViceLog expects a char * 
(which on some architectures are not the same thing).
Judging from what gets included in the various .c files calling 
inet_ntoa() I suspect the vlserver could choke on that as well.

The attached patch #includes <arpa/inet.h> in afsutil.h which covers 
all cases where that file is not included directly and looks like a 
reasonable place given that it defines ViceLog et al. This is also 
what happens in other places where inet_ntoa() is called.

Given that there is an afs_inet_ntoa, one might alternatively
#define inet_ntoa(x) afs_inet_ntoa((proper typecast) x)
at that point. It has to be done *after* including arpa/inet.h so that 
the #define does not interfere with a later declaration.

I actually wonder why hardly anybody uses the '%I' format instead 
which util/snprintf.c understands - perhaps because a move to IPv6 (if 
ever) would be more complicated?

(Bcc'ed to openafs-bugs)
-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Rainer Toebbicke
European Laboratory for Particle Physics(CERN) - Geneva, Switzerland
Phone: +41 22 767 8985       Fax: +41 22 767 7155

--------------080403060507010408040608
Content-Type: text/plain;
 name="patch_inet_ntoa"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="patch_inet_ntoa"

--- openafs/src/util/afsutil.h.o141	2005-07-11 21:08:49.000000000 +0200
+++ openafs/src/util/afsutil.h	2006-03-08 11:25:47.000000000 +0100
@@ -30,6 +30,7 @@
 extern int serverLogSyslog;
 extern int serverLogSyslogFacility;
 extern char *serverLogSyslogTag;
+#include <arpa/inet.h>		/* for inet_ntoa() */
 #endif
 extern void vFSLog(const char *format, va_list args);
 extern void SetLogThreadNumProgram(int (*func) () );

--------------080403060507010408040608--