This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch release/2.25/master updated. glibc-2.25-35-gd215bbd


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, release/2.25/master has been updated
       via  d215bbdff33323854ff5e3a3716459aaf2239f2f (commit)
      from  f40b4e86f5c31560a1073a907943fd619485c74d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d215bbdff33323854ff5e3a3716459aaf2239f2f

commit d215bbdff33323854ff5e3a3716459aaf2239f2f
Author: John David Anglin <danglin@gcc.gnu.org>
Date:   Sat Aug 12 14:39:53 2017 -0400

    Fix guard alignment in allocate_stack when stack grows up.
    
    	* nptl/allocatestack.c (allocate_stack): Align old and new guard
    	addresses to page boundaries when the stack grows up.

diff --git a/ChangeLog b/ChangeLog
index 519ead0..8c03103 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2017-08-12  John David Anglin  <danglin@gcc.gnu.org>
 
+	* nptl/allocatestack.c (allocate_stack): Align old and new guard
+	addresses to page boundaries when the stack grows up.
+
 	* sysdeps/hppa/math-tests.h: New.
 
 	[BZ #21016]
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 8a228ab..368fe3c 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -683,8 +683,14 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 			prot) != 0)
 	    goto mprot_error;
 #elif _STACK_GROWS_UP
-	  if (mprotect ((char *) pd - pd->guardsize,
-			pd->guardsize - guardsize, prot) != 0)
+	  char *new_guard = (char *)(((uintptr_t) pd - guardsize)
+				     & ~pagesize_m1);
+	  char *old_guard = (char *)(((uintptr_t) pd - pd->guardsize)
+				     & ~pagesize_m1);
+	  /* The guard size difference might be > 0, but once rounded
+	     to the nearest page the size difference might be zero.  */
+	  if (new_guard > old_guard
+	      && mprotect (old_guard, new_guard - old_guard, prot) != 0)
 	    goto mprot_error;
 #endif
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog            |    3 +++
 nptl/allocatestack.c |   10 ++++++++--
 2 files changed, 11 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]