Page MenuHomeFreeBSD

Make Linux sched_getaffinity(2) and sched_setaffinity(2) accept short masks
AbandonedPublic

Authored by dchagin on Jul 16 2020, 3:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 22 2024, 1:56 AM
Unknown Object (File)
Jan 30 2024, 8:05 PM
Unknown Object (File)
Dec 31 2023, 9:32 PM
Unknown Object (File)
Dec 10 2023, 5:26 PM
Unknown Object (File)
Nov 7 2023, 9:32 PM
Unknown Object (File)
Oct 19 2023, 7:32 PM
Unknown Object (File)
Oct 16 2023, 5:54 PM
Unknown Object (File)
Oct 13 2023, 6:30 AM
Subscribers

Details

Reviewers
kib
trasz
Group Reviewers
Linux Emulation
Summary

Make Linux sched_getaffinity(2)/sched_setaffinity() , and also our native cpuset_getaffinity(2)/cpuset_setaffinity(2), accept short masks. Fixes Linux Python regression test, and possibly some real applications.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32367
Build 29848: arc lint + arc unit

Event Timeline

trasz requested review of this revision.Jul 16 2020, 3:35 PM
emaste added inline comments.
sys/kern/kern_cpuset.c
1884

we still copyin cpusetsize?

sys/compat/linux/linux_misc.c
2077

cpuset *) args-> remove space

sys/kern/kern_cpuset.c
1877

cpusetsize cannot be < 0.

1882–1883

How can cpusetsize be >= sizeof(cpuset_t) ?

1884

Don't you need to initialize not-copied in bits ?

sys/kern/kern_cpuset.c
1882–1883

No idea, but the existing code (if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY) suggests it can be variable in size?

1884

We copy as much data as the userspace is willing to give us. The rest is initialized to zero just above (M_ZERO).

Also handle sched_getaffinity().

trasz retitled this revision from Make Linux kern_cpuset(4) accept short masks to Make Linux sched_getaffinity(2) and sched_setaffinity(2) accept short masks.Jul 16 2020, 7:45 PM
trasz edited the summary of this revision. (Show Details)
trasz marked an inline comment as done.
sys/kern/kern_cpuset.c
1877

This still not handled. Also, CPU_MAXSIZE in your formula should really be CPU_SETSIZE.

1882–1883

Look at the definitions of cpuset_t and CPU_MAXSIZE/CPU_SETSIZE. After the check at the start of the function, it is never can be larger then cpuset_t. In fact it is shorter.

dchagin abandoned this revision.
dchagin added a reviewer: trasz.

already done