From d12ca30ab330b7974c5a6e367269d2fc371b1c95 Mon Sep 17 00:00:00 2001 From: Sergejs Lukanihins Date: Fri, 25 May 2018 17:27:21 +0100 Subject: [PATCH] Cygwin: Fixing the math behind rounding down ch.stacklimit to page size. --- winsup/cygwin/fork.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index bcbef12d8..c6fef6755 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -316,7 +316,7 @@ frok::parent (volatile char * volatile stack_here) on whether we're running on a pthread or not. If pthread, we fetch the guardpage size from the pthread attribs, otherwise we use the system default. */ - ch.stacklimit = (void *) ((uintptr_t) stack_here & ~wincap.page_size ()); + ch.stacklimit = (void *) ((uintptr_t) stack_here & ~(wincap.page_size () - 1)); ch.guardsize = (&_my_tls != _main_tls && _my_tls.tid) ? _my_tls.tid->attr.guardsize : wincap.def_guard_page_size (); -- 2.17.0.windows.1