>From 6d37d37f1467f0f119ccdff6027dbe452402248b Mon Sep 17 00:00:00 2001
From: Naveen Narayanan <zerous@nocebo.space>
Date: Fri, 31 May 2019 09:24:33 +0200
Subject: [PATCH] Fix Unhandled page fault on write access

pthread_attr_setstack(3) in NetBSD 8.0 and newer sets the guard size
to 65536 but Wine assumes it to be 0 and this results in unhandled
page fault.  Setting the guardsize to 0 fixes it.
---
 dlls/ntdll/thread.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 9f4a08f..243ebcc 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -526,6 +526,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, SECURITY_DESCRIPTOR *descr,
     pthread_attr_init( &attr );
     pthread_attr_setstack( &attr, teb->DeallocationStack,
                          (char *)teb->Tib.StackBase + extra_stack - (char *)teb->DeallocationStack );
+    pthread_attr_setguardsize(&attr, 0);
     pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ); /* force creating a kernel thread */
     interlocked_xchg_add( &nb_threads, 1 );
     if (pthread_create( &pthread_id, &attr, (void * (*)(void *))start_thread, info ))
-- 
2.20.1

