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, siddhesh/getattr, updated. glibc-2.16-ports-merge-88-g04088d2


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, siddhesh/getattr has been updated
       via  04088d2221ffbd8f718b779c7d05401061d9f548 (commit)
      from  b3c84b775dacf293b65b3370d4e302eecacb0d0d (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://sources.redhat.com/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=04088d2221ffbd8f718b779c7d05401061d9f548

commit 04088d2221ffbd8f718b779c7d05401061d9f548
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
Date:   Fri Jul 27 22:45:09 2012 +0530

    Use sysconf for page size

diff --git a/nptl/tst-pthread-getattr.c b/nptl/tst-pthread-getattr.c
index 8b6ca1b..77aee45 100644
--- a/nptl/tst-pthread-getattr.c
+++ b/nptl/tst-pthread-getattr.c
@@ -24,6 +24,7 @@
 #include <pthread.h>
 #include <alloca.h>
 #include <assert.h>
+#include <unistd.h>
 
 /* There is an obscure bug in the kernel due to which RLIMIT_STACK is sometimes
    returned as unlimited when it is not, which may cause this test to fail.
@@ -38,6 +39,8 @@
 
 #define _MIN(l,o) ((l) < (o) ? (l) : (o))
 
+static long pagesize;
+
 /* Check if the page in which TARGET lies is accessible.  This will segfault
    if it fails.  */
 static void *
@@ -83,6 +86,7 @@ check_stack_top (void)
   void *stackaddr, *mem;
   size_t stacksize = 0;
   int ret;
+  uintptr_t pagemask = ~(pagesize - 1);
 
   puts ("Verifying that stack top is accessible");
 
@@ -106,7 +110,7 @@ check_stack_top (void)
      stack is limited by the vma below it and not by the rlimit because the
      stacksize returned in that case is computed from the end of that vma and is
      hence safe.  */
-  stack_limit.rlim_cur = _MIN(stacksize - 4095, MAX_STACK_SIZE);
+  stack_limit.rlim_cur = _MIN(stacksize - pagesize + 1, MAX_STACK_SIZE);
   printf ("Adjusting RLIMIT_STACK to %zu\n", stack_limit.rlim_cur);
   if ((ret = setrlimit (RLIMIT_STACK, &stack_limit)))
     {
@@ -125,14 +129,14 @@ check_stack_top (void)
      stack and test access there.  It is however sufficient to simply check if
      the top page is accessible, so we target our access halfway up the top
      page.  Thanks Chris Metcalf for this idea.  */
-  mem = allocate_and_test (stackaddr + 2048);
+  mem = allocate_and_test (stackaddr + pagesize / 2);
 
   /* Before we celebrate, make sure we actually did test the same page.  */
-  if (((uintptr_t) stackaddr & ~0xfff ) != ((uintptr_t) mem & ~0xfff))
+  if (((uintptr_t) stackaddr & pagemask ) != ((uintptr_t) mem & pagemask))
     {
       printf ("We successfully wrote into the wrong page. ");
-      printf ("Expected %lx, but got %lx\n", (uintptr_t) stackaddr & ~0xfff,
-	      (uintptr_t) mem & ~0xfff);
+      printf ("Expected %lx, but got %lx\n", (uintptr_t) stackaddr & pagemask,
+	      (uintptr_t) mem & pagemask);
 
       return 1;
     }
@@ -147,6 +151,13 @@ check_stack_top (void)
 static int
 do_test (void)
 {
+  pagesize = sysconf (_SC_PAGESIZE);
+
+  if (pagesize < 0)
+    {
+      perror ("could not get page size");
+      return 1;
+    }
   return check_stack_top ();
 }
 

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

Summary of changes:
 nptl/tst-pthread-getattr.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 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]