OSDN Git Service

nptl/allocatestack.c: Fix stack mprotect alignment for STACK_GROWS_UP
authorMarkos Chandras <markos.chandras@imgtec.com>
Tue, 12 Feb 2013 13:44:25 +0000 (13:44 +0000)
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Wed, 27 Feb 2013 21:16:20 +0000 (22:16 +0100)
mprotect() expects the first argument to be aligned to a page boundary.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
libpthread/nptl/allocatestack.c

index 9399c2a..3f0586d 100644 (file)
@@ -645,7 +645,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
                        prot) != 0)
            goto mprot_error;
 #elif defined _STACK_GROWS_UP
-         if (mprotect ((char *) pd - pd->guardsize,
+         if (mprotect ((char *) (((uintptr_t) pd - pd->guardsize) & ~pagesize_m1),
                        pd->guardsize - guardsize, prot) != 0)
            goto mprot_error;
 #endif