[Gc] gc: bug leads to segfault in prelinked binaries

Moritz Barsnick moritz at barsnick.net
Tue Feb 17 00:42:45 PST 2004


I'm a non-subscriber, but I hope you'll accept my report anyway.

Recently, I discovered a segfault in my favorite web browser, w3m
(https://w3m.sf.net/). This was on a relatively new Fedora Linux
distribution (ex-RedHat, https://fedora.redhat.com/). I pretty quickly
cornered it down to the new prelink mechanism, which is now enabled by
default in Fedora, and I suppose many distributions will follow (check

I reported this bug against Fedora in the RedHat bug tracking system
under https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=115201 .
There, the maintainer of the w3m package pointed out that this is a bug
in gc. "It makes assumptions about __libc_stack_end which it certainly
should not do."

This bug is present both in 6.2 and in 6.3alpha4 (the newest I could
find) and will be very critical for all apps which use gc on such
prelink-aware systems.

I've attached the patch provided by RedHat, and hope it is correct and
is included soon. "It works for me." ;-)

best regards,
-------------- next part --------------
diff -ruN gc6.2.orig/os_dep.c gc6.2/os_dep.c
--- gc6.2.orig/os_dep.c	2003-06-14 04:11:00.000000000 +0900
+++ gc6.2/os_dep.c	2004-02-10 15:31:47.877570742 +0900
@@ -903,7 +903,7 @@
     size_t i, buf_offset = 0;
     /* First try the easy way.  This should work for glibc 2.2	*/
-      if (0 != &__libc_stack_end) {
+      if (0 != &__libc_stack_end && __libc_stack_end != 0) {
 #       ifdef IA64
 	  /* Some versions of glibc set the address 16 bytes too	*/
 	  /* low while the initialization code is running.		*/

More information about the Gc mailing list