[uClibc-cvs] svn commit: branches/uClibc-nptl/libpthread/nptl
sjhill at uclibc.org
sjhill at uclibc.org
Fri Jun 3 02:43:47 UTC 2005
Author: sjhill
Date: 2005-06-02 20:43:46 -0600 (Thu, 02 Jun 2005)
New Revision: 10457
Log:
Prevent the stack from being executable. This will prevent some NPTL tests
from passing, but it will require some intrustive changes.
Modified:
branches/uClibc-nptl/libpthread/nptl/allocatestack.c
Changeset:
Modified: branches/uClibc-nptl/libpthread/nptl/allocatestack.c
===================================================================
--- branches/uClibc-nptl/libpthread/nptl/allocatestack.c 2005-06-03 02:32:55 UTC (rev 10456)
+++ branches/uClibc-nptl/libpthread/nptl/allocatestack.c 2005-06-03 02:43:46 UTC (rev 10457)
@@ -29,6 +29,10 @@
#include <tls.h>
#include <lowlevellock.h>
+#ifdef __UCLIBC__
+#include <link.h>
+#define __getpagesize getpagesize
+#endif
#ifndef NEED_SEPARATE_REGISTER_STACK
@@ -389,7 +393,11 @@
size_t reqsize;
void *mem;
const int prot = (PROT_READ | PROT_WRITE
+#ifdef __UCLIBC__
+ );
+#else
| ((GL(dl_stack_flags) & PF_X) ? PROT_EXEC : 0));
+#endif
#if COLORING_INCREMENT != 0
/* Add one more page for stack coloring. Don't do it for stacks
@@ -524,6 +532,7 @@
caused the stacks to get exec permission while this new
stack was prepared. Detect if this was possible and
change the permission if necessary. */
+#ifndef __UCLIBC__
if (__builtin_expect ((GL(dl_stack_flags) & PF_X) != 0
&& (prot & PROT_EXEC) == 0, 0))
{
@@ -540,6 +549,7 @@
return err;
}
}
+#endif
/* Note that all of the stack and the thread descriptor is
@@ -671,7 +681,11 @@
__make_stacks_executable (void **stack_endp)
{
/* First the main thread's stack. */
+#ifdef __UCLIBC__
+ int err = EPERM;
+#else
int err = _dl_make_stack_executable (stack_endp);
+#endif
if (err != 0)
return err;
@@ -910,6 +924,10 @@
static inline void __attribute__((always_inline))
init_one_static_tls (struct pthread *curp, struct link_map *map)
{
+#ifdef __UCLIBC__
+ extern void *__mempcpy (void *dstpp, const void *srcpp, size_t len);
+#endif
+
dtv_t *dtv = GET_DTV (TLS_TPADJ (curp));
# if TLS_TCB_AT_TP
void *dest = (char *) curp - map->l_tls_offset;
@@ -924,7 +942,11 @@
dtv[map->l_tls_modid].pointer.is_static = true;
/* Initialize the memory. */
+#ifdef __UCLIBC__
+ memset ((void *) __mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
+#else
memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
+#endif
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}
More information about the uClibc-cvs
mailing list