Lines 674-693
cpuset_modify(struct cpuset *set, cpuset_t *mask)
Link Here
|
674 |
if (error) |
674 |
if (error) |
675 |
return (error); |
675 |
return (error); |
676 |
/* |
676 |
/* |
677 |
* In case we are called from within the jail |
677 |
* In case we are called from within the jail, |
678 |
* we do not allow modifying the dedicated root |
678 |
* we do not allow modifying the dedicated root |
679 |
* cpuset of the jail but may still allow to |
679 |
* cpuset of the jail but may still allow to |
680 |
* change child sets. |
680 |
* change child sets, including subordinate jails' |
|
|
681 |
* roots. |
681 |
*/ |
682 |
*/ |
682 |
if (jailed(curthread->td_ucred) && |
683 |
if ((set->cs_flags & CPU_SET_ROOT) != 0 && |
683 |
set->cs_flags & CPU_SET_ROOT) |
684 |
jailed(curthread->td_ucred) && |
|
|
685 |
set == curthread->td_ucred->cr_prison->pr_cpuset) |
684 |
return (EPERM); |
686 |
return (EPERM); |
685 |
/* |
687 |
/* |
686 |
* Verify that we have access to this set of |
688 |
* Verify that we have access to this set of |
687 |
* cpus. |
689 |
* cpus. |
688 |
*/ |
690 |
*/ |
689 |
root = cpuset_getroot(set); |
|
|
690 |
mtx_lock_spin(&cpuset_lock); |
691 |
mtx_lock_spin(&cpuset_lock); |
|
|
692 |
if ((set->cs_flags & (CPU_SET_ROOT | CPU_SET_RDONLY)) == CPU_SET_ROOT) { |
693 |
KASSERT(set->cs_parent != NULL, |
694 |
("jail.cpuset=%d is not a proper child of parent jail's root.", |
695 |
set->cs_id)); |
696 |
root = cpuset_getroot(set->cs_parent); |
697 |
} else { |
698 |
root = cpuset_getroot(set); |
699 |
} |
691 |
if (root && !CPU_SUBSET(&root->cs_mask, mask)) { |
700 |
if (root && !CPU_SUBSET(&root->cs_mask, mask)) { |
692 |
error = EINVAL; |
701 |
error = EINVAL; |
693 |
goto out; |
702 |
goto out; |