[git commit] nptl/allocatestack.c: Fix stack mprotect alignment for STACK_GROWS_UP

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Feb 27 21:16:20 UTC 2013


commit: http://git.uclibc.org/uClibc/commit/?id=60c1fe7f456b1cd17c71ea6a9c4a234d9f147b7b
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master

mprotect() expects the first argument to be aligned to a page boundary.

Signed-off-by: Markos Chandras <markos.chandras at imgtec.com>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
 libpthread/nptl/allocatestack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libpthread/nptl/allocatestack.c b/libpthread/nptl/allocatestack.c
index 9399c2a..3f0586d 100644
--- a/libpthread/nptl/allocatestack.c
+++ b/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


More information about the uClibc-cvs mailing list