]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cpuset_set{affinity,domain}: do not allow empty masks
authorkevans <kevans@FreeBSD.org>
Tue, 8 Dec 2020 18:47:22 +0000 (18:47 +0000)
committerkevans <kevans@FreeBSD.org>
Tue, 8 Dec 2020 18:47:22 +0000 (18:47 +0000)
commit387ed1c633ec2709a7f226434b485bf37cd70290
tree3b1ef66f26d69e4cfa5c392a9eb206328ccfda5c
parent7797617b36d19cb8326460dc357cf354dd599e14
cpuset_set{affinity,domain}: do not allow empty masks

cpuset_modify() would not currently catch this, because it only checks that
the new mask is a subset of the root set and circumvents the EDEADLK check
in cpuset_testupdate().

This change both directly validates the mask coming in since we can
trivially detect an empty mask, and it updates cpuset_testupdate to catch
stuff like this going forward by always ensuring we don't end up with an
empty mask.

The check_mask argument has been renamed because the 'check' verbiage does
not imply to me that it's actually doing a different operation. We're either
augmenting the existing mask, or we are replacing it entirely.

Reported by: syzbot+4e3b1009de98d2fabcda@syzkaller.appspotmail.com
Discussed with: andrew
Reviewed by: andrew, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27511
sys/kern/kern_cpuset.c