Ver Fonte

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 há 11 anos atrás
pai
commit
60c1fe7f45
1 ficheiros alterados com 1 adições e 1 exclusões
  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