Firefox (Spidermonkey) does this to get the stack base (well, on FreeBSD and NetBSD — OpenBSD conveniently has a pthread_stackseg_np thing):
pthread_t thread = pthread_self(); pthread_attr_get_np(thread, &sattr); rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize);
And pthread_attr_get_np (_thr_attr_get_np) does:
ret = cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, TID(pthread), dst->cpusetsize, dst->cpuset);
Whoops, that's not allowed in capability mode, even though we are getting the current thread's attributes, which should be allowed!
(Firefox does work with failing pthread_attr_get_np anyway, but it's better not to have the error :D)