In pthread_attr_setstack fail with EINVAL if the input stack does not
meet the PCS constraints.
#include <limits.h>
#include "pthreadP.h"
#include <shlib-compat.h>
-
+#ifdef __CHERI_PURE_CAPABILITY__
+# include <cheri_perms.h>
+#endif
#ifndef NEW_VERNUM
# define NEW_VERNUM GLIBC_2_3_3
EXTRA_PARAM_CHECKS;
#endif
+#ifdef __CHERI_PURE_CAPABILITY__
+ if (!STACK_CAP_CHECK (stackaddr, stacksize))
+ return EINVAL;
+#endif
+
iattr->stacksize = stacksize;
#if _STACK_GROWS_DOWN
iattr->stackaddr = (char *) stackaddr + stacksize;