Index: sys/kern/kern_cpuset.c =================================================================== --- sys/kern/kern_cpuset.c +++ sys/kern/kern_cpuset.c @@ -1745,7 +1745,9 @@ return (ECAPMODE); if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) return (ECAPMODE); - if (id != -1) + if (id != -1 && + !(which == CPU_WHICH_TID && id == curthread->td_tid) && + !(which == CPU_WHICH_PID && id == curproc->p_pid)) return (ECAPMODE); } size = cpusetsize; @@ -1862,7 +1864,9 @@ return (ECAPMODE); if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) return (ECAPMODE); - if (id != -1) + if (id != -1 && + !(which == CPU_WHICH_TID && id == curthread->td_tid) && + !(which == CPU_WHICH_PID && id == curproc->p_pid)) return (ECAPMODE); } mask = malloc(cpusetsize, M_TEMP, M_WAITOK | M_ZERO); @@ -1993,7 +1997,9 @@ return (ECAPMODE); if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) return (ECAPMODE); - if (id != -1) + if (id != -1 && + !(which == CPU_WHICH_TID && id == curthread->td_tid) && + !(which == CPU_WHICH_PID && id == curproc->p_pid)) return (ECAPMODE); } mask = malloc(domainsetsize, M_TEMP, M_WAITOK | M_ZERO); @@ -2128,7 +2134,9 @@ return (ECAPMODE); if (which != CPU_WHICH_TID && which != CPU_WHICH_PID) return (ECAPMODE); - if (id != -1) + if (id != -1 && + !(which == CPU_WHICH_TID && id == curthread->td_tid) && + !(which == CPU_WHICH_PID && id == curproc->p_pid)) return (ECAPMODE); } memset(&domain, 0, sizeof(domain));