FreeBSD Bugzilla – Attachment 186278 Details for
Bug 222242
[patch] allow masks smaller than cpuset_t, if large enough for mp_maxid
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to check that mask is actually too small, not just smaller than the kernel compiled type
fbsd11-kern_cpuset_smalltype.patch (text/plain), 1.39 KB, created by
Richard Russo
on 2017-09-11 21:30:18 UTC
(
hide
)
Description:
patch to check that mask is actually too small, not just smaller than the kernel compiled type
Filename:
MIME Type:
Creator:
Richard Russo
Created:
2017-09-11 21:30:18 UTC
Size:
1.39 KB
patch
obsolete
>Index: sys/kern/kern_cpuset.c >=================================================================== >--- sys/kern/kern_cpuset.c (revision 322327) >+++ sys/kern/kern_cpuset.c (working copy) >@@ -1097,7 +1097,7 @@ > int error; > size_t size; > >- if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY) >+ if (cpusetsize < (mp_maxid + NBBY - 1) / NBBY || cpusetsize > CPU_MAXSIZE / NBBY) > return (ERANGE); > /* In Capability mode, you can only get your own CPU set. */ > if (IN_CAPABILITY_MODE(td)) { >@@ -1109,7 +1109,7 @@ > return (ECAPMODE); > } > size = cpusetsize; >- mask = malloc(size, M_TEMP, M_WAITOK | M_ZERO); >+ mask = malloc(size >= sizeof(cpuset_t) ? size : sizeof(cpuset_t), M_TEMP, M_WAITOK | M_ZERO); > error = cpuset_which(which, id, &p, &ttd, &set); > if (error) > goto out; >@@ -1210,7 +1210,7 @@ > cpuset_t *mask; > int error; > >- if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY) >+ if (cpusetsize < (mp_maxid + NBBY - 1) / NBBY || cpusetsize > CPU_MAXSIZE / NBBY) > return (ERANGE); > /* In Capability mode, you can only set your own CPU set. */ > if (IN_CAPABILITY_MODE(td)) { >@@ -1221,7 +1221,7 @@ > if (id != -1) > return (ECAPMODE); > } >- mask = malloc(cpusetsize, M_TEMP, M_WAITOK | M_ZERO); >+ mask = malloc(cpusetsize >= sizeof(cpuset_t) ? cpusetsize : sizeof(cpuset_t), M_TEMP, M_WAITOK | M_ZERO); > error = copyin(maskp, mask, cpusetsize); > if (error) > goto out;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 222242
: 186278