Bug 200802 - MAXCPU bump to 256 breaks ABI for cpuset_getaffinity/setaffinity
Summary: MAXCPU bump to 256 breaks ABI for cpuset_getaffinity/setaffinity
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.1-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
Depends on:
Reported: 2015-06-12 01:31 UTC by rr
Modified: 2015-07-07 17:09 UTC (History)
3 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description rr 2015-06-12 01:31:17 UTC
The bump to MAXCPU 256 makes cpuset_t larger, so minimum setsize checks in cpuset_* fail for binaries compiled against earlier versions (with MAXCPU 64).
Comment 1 Andrey V. Elsukov freebsd_committer 2015-06-19 21:58:12 UTC
I seen one report that 10.1-STABLE instantly reboots after updating to r283303. Could this be the cause of that?
Comment 2 John Baldwin freebsd_committer freebsd_triage 2015-06-20 11:53:28 UTC
Hmm, the simplest change is to revert MAXCPU for now.  Longer term it might be nice to rework the cpusetsize changes so that they only fail if there are CPU IDs that don't fit in the requested size.

I think doing that would involve:

1) Replacing 'sizeof(cpuset_t)' with something like '(mp_maxid + NBBY - 1) / NBBY'
2) When working with a cpuset internally rounding up the size to 'sizeof(cpuset_t)' to pass around internally and then truncating to the requested size when doing a copyout.
Comment 3 commit-hook freebsd_committer 2015-06-23 06:30:53 UTC
A commit references this bug:

Author: kib
Date: Tue Jun 23 06:30:37 UTC 2015
New revision: 284720
URL: https://svnweb.freebsd.org/changeset/base/284720

  Revert part of the r283303 (by jhb):

  Revert MFC of r270223, which bumped MAXCPU on amd64 from 64 to 256.
  The cpuset_getaffinity(2) and cpuset_setaffinity(2) check minimum set
  size, which now fails for binaries compiled on 10.0 with MAXCPU == 64.

  Submitted by:	jhb
  PR:	  200802

_U  stable/10/
Comment 4 Adrian Chadd freebsd_committer 2015-06-23 13:59:58 UTC
Shouldn't cpuset users be querying the cpuset size from sysctl and using that as their allocation base?
Comment 5 Glen Barber freebsd_committer 2015-07-07 17:09:44 UTC
Offending commit has been reverted.