diff --git a/lib/libpthread/pthread_attr_getguardsize.3 b/lib/libpthread/pthread_attr_getguardsize.3 index 317b9840b8e6..58972222511c 100644 --- a/lib/libpthread/pthread_attr_getguardsize.3 +++ b/lib/libpthread/pthread_attr_getguardsize.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: pthread_attr_getguardsize.3,v 1.5 2017/10/22 16:37:24 abhinav Exp $ +.\" $NetBSD: pthread_attr_getguardsize.3,v 1.6 2023/12/07 16:55:01 riastradh Exp $ .\" .\" Copyright (c) 2010 Jukka Ruohonen .\" All rights reserved. @@ -123,3 +123,27 @@ There was insufficient memory. .Sh STANDARDS Both functions conform to .St -p1003.1-2008 . +.Sh BUGS +Older versions of +.Nx , +prior to 10.0, 9.4, and 8.3, incorrectly adjust the stack address by +the guard size in threads configured with +.Xr pthread_attr_setstack 3 , +instead of ignoring the guard size in that case as +.Tn POSIX +prescribes +.Po +see +.Lk https://gnats.NetBSD.org/57721 "PR lib/57721" +.Pc . +.Pp +Even if you didn't set a nonzero guard size with +.Fn pthread_attr_setguardsize , +the system will choose a nonzero default guard size. +.Pp +To work around this in applications that run on older and newer +versions of +.Nx , +as well as on other operating systems, you can safely set the guard +size to zero: +.Dl "pthread_attr_setguardsize(&attr, 0);" diff --git a/lib/libpthread/pthread_attr_getstack.3 b/lib/libpthread/pthread_attr_getstack.3 index a9b484317aa8..ba003d726b81 100644 --- a/lib/libpthread/pthread_attr_getstack.3 +++ b/lib/libpthread/pthread_attr_getstack.3 @@ -1,4 +1,4 @@ -.\" $NetBSD: pthread_attr_getstack.3,v 1.8 2017/10/23 01:03:23 wiz Exp $ +.\" $NetBSD: pthread_attr_getstack.3,v 1.9 2023/12/07 16:55:01 riastradh Exp $ .\" .\" Copyright (c) 2010 Jukka Ruohonen .\" All rights reserved. @@ -177,3 +177,27 @@ and were however removed from the specification in the .St -p1003.1-2008 revision. +.Sh BUGS +Older versions of +.Nx , +prior to 10.0, 9.4, and 8.3, incorrectly adjust the stack address by +the guard size in threads configured with +.Fn pthread_attr_setstack , +instead of ignoring the guard size in that case as +.Tn POSIX +prescribes +.Po +see +.Lk https://gnats.NetBSD.org/57721 "PR lib/57721" +.Pc . +.Pp +Even if you didn't set a nonzero guard size with +.Xr pthread_attr_setguardsize 3 , +the system will choose a nonzero default guard size. +.Pp +To work around this in applications that run on older and newer +versions of +.Nx , +as well as on other operating systems, you can safely set the guard +size to zero: +.Dl "pthread_attr_setguardsize(&attr, 0);"