From: Tom Hughes Date: Tue, 16 Nov 2004 19:44:06 +0000 (+0000) Subject: The calculation used to round the size of a new thread's stack to a X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8803e1f671f6a87f8fbf6fc60b0e6446ce2ff499;p=thirdparty%2Fvalgrind.git The calculation used to round the size of a new thread's stack to a multiple of the page size had an off by one error. Fixed it to use the PGROUNDUP macro instead of trying to do the calculation itself and then get it wrong. MERGE TO STABLE git-svn-id: svn://svn.valgrind.org/valgrind/branches/VALGRIND_2_2_0_BRANCH@3032 --- diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 12429cee51..733f4845fb 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -1953,8 +1953,7 @@ void do__apply_in_new_thread ( ThreadId parent_tid, /* Consider allocating the child a stack, if the one it already has is inadequate. */ - new_stk_szb = si->size + VG_AR_CLIENT_STACKBASE_REDZONE_SZB + si->guardsize; - new_stk_szb = (new_stk_szb + VKI_BYTES_PER_PAGE - 1) & ~VKI_BYTES_PER_PAGE; + new_stk_szb = PGROUNDUP(si->size + VG_AR_CLIENT_STACKBASE_REDZONE_SZB + si->guardsize); VG_(threads)[tid].stack_guard_size = si->guardsize; diff --git a/none/tests/.cvsignore b/none/tests/.cvsignore index ecc0a99227..5d366a0fa9 100644 --- a/none/tests/.cvsignore +++ b/none/tests/.cvsignore @@ -39,6 +39,7 @@ munmap_exe mremap pluto pth_blockedsig +pth_stackalign rcl_assert rcrl readline1 diff --git a/none/tests/Makefile.am b/none/tests/Makefile.am index 6ddfca3c88..11b393bd9a 100644 --- a/none/tests/Makefile.am +++ b/none/tests/Makefile.am @@ -46,6 +46,8 @@ EXTRA_DIST = $(noinst_SCRIPTS) \ munmap_exe.stderr.exp munmap_exe.vgtest \ pth_blockedsig.stderr.exp \ pth_blockedsig.stdout.exp pth_blockedsig.vgtest \ + pth_stackalign.stderr.exp \ + pth_stackalign.stdout.exp pth_stackalign.vgtest \ pushpopseg.stderr.exp pushpopseg.stdout.exp pushpopseg.vgtest \ rcl_assert.stderr.exp rcl_assert.vgtest \ rcrl.stderr.exp rcrl.stdout.exp rcrl.vgtest \ @@ -74,8 +76,8 @@ check_PROGRAMS = \ fpu_lazy_eflags fucomip $(INSN_TESTS) \ int munmap_exe map_unmap mq mremap rcl_assert rcrl readline1 \ resolv rlimit_nofile seg_override sem semlimit sha1_test \ - shortpush shorts smc1 susphello pth_blockedsig pushpopseg \ - syscall-restart1 syscall-restart2 system \ + shortpush shorts smc1 susphello pth_blockedsig pth_stackalign \ + pushpopseg syscall-restart1 syscall-restart2 system \ coolo_sigaction gxx304 yield AM_CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g -I$(top_srcdir)/include @@ -155,6 +157,8 @@ yield_LDADD = -lpthread # pthread C ones pth_blockedsig_SOURCES = pth_blockedsig.c pth_blockedsig_LDADD = -lpthread +pth_stackalign_SOURCES = pth_stackalign.c +pth_stackalign_LDADD = -lpthread # generic C++ ones coolo_sigaction_SOURCES = coolo_sigaction.cpp