Browse Source

nptl/allocatestack.c: Fix stack mprotect alignment for STACK_GROWS_UP

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>
Markos Chandras 11 years ago
parent
commit
60c1fe7f45
1 changed files with 1 additions and 1 deletions
  1. 1 1
      libpthread/nptl/allocatestack.c

+ 1 - 1
libpthread/nptl/allocatestack.c

@@ -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