[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#231438: locales fails to install due to locale-gen segfault



tags 231438 + patch
thanks

Daniel Jacobowitz <dan@debian.org> writes:

> > localedef uses trampoline in its internal; it may conflict with
> > exec-shield like pax, please see:
> >
> >       http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=198099
> 
> Hmm, Red Hat _must_ have a patch for that by now....

They do.  I've attached a .dpatch below with the relevant patch
extracted from the latest Fedora .src.rpm.  I built and tested this on
i686-linux both with and without exec-shield and got someone else to
do the same.  (There are also no testsuite regressions.)

-- 
James

################################################################################
#! /bin/sh -e

# DP: Description: Fix localedef segfault when run under exec-shield,
#        PaX or similar. (#231438, #198099)
# DP: Author: (probably) Jakub Jelinek <jakub@redhat.com>
# DP: Upstream status: Unknown
# DP: Status Details: Unknown
# DP: Date: 2004-03-16

if [ $# -ne 2 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi
case "$1" in
    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1
esac
exit 0

--- glibc-2.3.3-net/locale/programs/3level.h	16 Jun 2003 07:19:09 -0000	1.1.1.5
+++ glibc-2.3.3-redhat/locale/programs/3level.h	16 Jun 2003 09:32:40 -0000	1.4
@@ -204,6 +204,42 @@ CONCAT(TABLE,_iterate) (struct TABLE *t,
 	}
     }
 }
+
+/* GCC ATM seems to do a poor job with pointers to nested functions passed
+   to inlined functions.  Help it a little bit with this hack.  */
+#define wchead_table_iterate(tp, fn) \
+do									      \
+  {									      \
+    struct wchead_table *t = (tp);					      \
+    uint32_t index1;							      \
+    for (index1 = 0; index1 < t->level1_size; index1++)			      \
+      {									      \
+	uint32_t lookup1 = t->level1[index1];				      \
+	if (lookup1 != ((uint32_t) ~0))					      \
+	  {								      \
+	    uint32_t lookup1_shifted = lookup1 << t->q;			      \
+	    uint32_t index2;						      \
+	    for (index2 = 0; index2 < (1 << t->q); index2++)		      \
+	      {								      \
+		uint32_t lookup2 = t->level2[index2 + lookup1_shifted];	      \
+		if (lookup2 != ((uint32_t) ~0))				      \
+		  {							      \
+		    uint32_t lookup2_shifted = lookup2 << t->p;		      \
+		    uint32_t index3;					      \
+		    for (index3 = 0; index3 < (1 << t->p); index3++)	      \
+		      {							      \
+			struct element_t *lookup3			      \
+			  = t->level3[index3 + lookup2_shifted];	      \
+			if (lookup3 != NULL)				      \
+			  fn ((((index1 << t->q) + index2) << t->p) + index3, \
+			      lookup3);					      \
+		      }							      \
+		  }							      \
+	      }								      \
+	  }								      \
+      }									      \
+  } while (0)
+
 #endif
 
 #ifndef NO_FINALIZE



Reply to: