Current-Users archive

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

Re: PaX ASLR broken due TLS



On Tue, Mar 29, 2011 at 09:02:32PM +0300, Jukka Ruohonen wrote:
> FYI, this appears not to be Emacs-specific. Building for instance math/R
> with ASLR segfaults similarly. Something has regressed.
> 
> ===> Installing for R-2.11.1nb2
> => Generating pre-install file lists
> => Running PRE-INSTALL script actions
> [1]   Segmentation fault (core dumped) /usr/bin/env USE...
> *** Error code 139

I can't reach math/R due to various issues. With the last set of
libpthread changes and the attached hack, it gets a lot further.
Last thing was gmake crashing in getopt_long or so.

Read this as: not all stackid issues are fixed, the code is still left
to be removed.

Joerg
Index: pthread.c
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/libpthread/pthread.c,v
retrieving revision 1.123
diff -u -p -r1.123 pthread.c
--- pthread.c   30 Mar 2011 00:03:26 -0000      1.123
+++ pthread.c   30 Mar 2011 00:04:29 -0000
@@ -1251,11 +1251,18 @@ pthread__initmain(pthread_t *newt)
        }
        size = pthread__stacksize;
 
+#if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
+       { static struct __pthread_st initial_stack;
+       t = &initial_stack;
+       (void)error;
+       }
+#else
        error = pthread__stackid_setup(base, size, &t);
        if (error) {
                /* XXX */
                errx(2, "failed to setup main thread: error=%d", error);
        }
+#endif
 
        *newt = t;
 #if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)


Home | Main Index | Thread Index | Old Index