>From dd3868deda79c07198bc923d81dbf388e064a48c Mon Sep 17 00:00:00 2001
From: Naveen Narayanan <zerous@nocebo.space>
Date: Mon, 12 Aug 2019 19:29:22 +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.

Signed-off-by: Naveen Narayanan <zerous@nocebo.space>
---
 dlls/ntdll/thread.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 126bf76742..97bd4bfeb4 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -525,6 +525,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.21.0

