Date: Sun, 8 Sep 2019 20:39:56 +0000 (UTC) From: Mark Johnston <markj@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352041 - stable/12/sys/kern Message-ID: <201909082039.x88KduwJ034515@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: markj Date: Sun Sep 8 20:39:55 2019 New Revision: 352041 URL: https://svnweb.freebsd.org/changeset/base/352041 Log: MFC r351672: Restrict the input domain set in cpuset_setdomain(2) to all_domains. Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c ============================================================================== --- stable/12/sys/kern/kern_cpuset.c Sun Sep 8 20:38:58 2019 (r352040) +++ stable/12/sys/kern/kern_cpuset.c Sun Sep 8 20:39:55 2019 (r352041) @@ -2156,6 +2156,14 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le DOMAINSET_COPY(mask, &domain.ds_mask); domain.ds_policy = policy; + /* + * Sanitize the provided mask. + */ + if (!DOMAINSET_SUBSET(&all_domains, &domain.ds_mask)) { + error = EINVAL; + goto out; + } + /* Translate preferred policy into a mask and fallback. */ if (policy == DOMAINSET_POLICY_PREFER) { /* Only support a single preferred domain. */ @@ -2165,12 +2173,12 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le } domain.ds_prefer = DOMAINSET_FFS(&domain.ds_mask) - 1; /* This will be constrained by domainset_shadow(). */ - DOMAINSET_FILL(&domain.ds_mask); + DOMAINSET_COPY(&all_domains, &domain.ds_mask); } /* - * When given an impossible policy, fall back to interleaving - * across all domains + * When given an impossible policy, fall back to interleaving + * across all domains. */ if (domainset_empty_vm(&domain)) domainset_copy(&domainset2, &domain);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909082039.x88KduwJ034515>