Problems with 3.1 and domain-search and gcc 4.2?

David W. Hankins David_Hankins at isc.org
Fri May 2 15:12:26 UTC 2008


On Fri, May 02, 2008 at 04:22:14PM +1000, Andrew Pollock wrote:
> I've been receiving numerous reports of segfaults with DHCP 3.1 and the
> domain-search option in particular. The other possibly common factor is
> 64-bit hosts (the amd64 architecture in particular).
> 
> There's a reasonable amount of information accumulating in
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=464082 but it's all a bit
> beyond my abilities.
> 
> Anyone have any thoughts on if it's a bug in the code, or just a compiler
> bug?

i'm not aware of any problems with gcc 4.2.  i do know that gcc 4.1.1
can tend to cause some havoc (i haven't looked to see if this is our
sources not playing nice with some "correct" optimization strategy, or
a bug in the compiler).

we did just change related code in this area (pretty_print_option(),
same line numbers as the backtrace), and it's the kind of fix where
one wonders why it ever appeared to work at all.  the patch from
3.1.1rc2 to correct it is actually quite small (and an annoying
rememberance of C operator precedence), so if someone wanted to
experiment to see if the problem evaporates with these changes;



Index: DHCP/common/options.c
diff -u DHCP/common/options.c:1.98.2.14 DHCP/common/options.c:1.98.2.15
--- DHCP/common/options.c:1.98.2.14	Tue Jan 22 19:02:50 2008
+++ DHCP/common/options.c	Fri Apr  4 21:36:29 2008
@@ -3003,7 +3003,7 @@
 		return -1;
 
 	**dst = '"';
-	*dst++;
+	(*dst)++;
 
 	do {
 		/* Continue loop until end of src buffer. */
@@ -3012,13 +3012,13 @@
 
 		/* Consume tag size. */
 		tsiz = **src;
-		*src++;
+		(*src)++;
 
 		/* At root, finis. */
 		if (tsiz == 0)
 			break;
 
-		tend = *src + tsiz;
+		tend = (*src) + tsiz;
 
 		/* If the tag exceeds the source buffer, it's illegal.
 		 * This should also trap compression pointers (which should
@@ -3034,13 +3034,13 @@
 			return -1;
 
 		**dst = '.';
-		*dst++;
+		(*dst)++;
 		count += status + 1;
 	}
 	while(1);
 
 	**dst = '"';
-	*dst++;
+	(*dst)++;
 
 	return count;
 }

-- 
David W. Hankins	"If you don't do it right the first time,
Software Engineer		you'll just have to do it again."
Internet Systems Consortium, Inc.	-- Jack T. Hankins


More information about the dhcp-hackers mailing list