opnsense-src/share
Dmitry Chagin 72bc1e6806 cpuset: Byte swap cpuset for compat32 on big endian architectures
Summary:
BITSET uses long as its basic underlying type, which is dependent on the
compile type, meaning on 32-bit builds the basic type is 32 bits, but on
64-bit builds it's 64 bits.  On little endian architectures this doesn't
matter, because the LSB is always at the low bit, so the words get
effectively concatenated moving between 32-bit and 64-bit, but on
big-endian architectures it throws a wrench in, as setting bit 0 in
32-bit mode is equivalent to setting bit 32 in 64-bit mode.  To
demonstrate:

32-bit mode:

BIT_SET(foo, 0):        0x00000001

64-bit sees: 0x0000000100000000

cpuset is the only system interface that uses bitsets, so solve this
by swapping the integer sub-components at the copyin/copyout points.

Reviewed by:    kib
Sponsored by:   Juniper Networks, Inc.
Differential Revision:  https://reviews.freebsd.org/D35225

(cherry picked from commit 47a57144af)

Fix the build after 47a57144

(cherry picked from commit 89737eb829)

cpuset: Fix the KASAN and KMSAN builds

Rename the "copyin" and "copyout" fields of struct cpuset_copy_cb to
something less generic, since sanitizers define interceptors for
copyin() and copyout() using #define.

Reported by:    syzbot+2db5d644097fc698fb6f@syzkaller.appspotmail.com
Fixes:  47a57144af ("cpuset: Byte swap cpuset for compat32 on big endian architectures")
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 4a3e51335e)

Use Linux semantics for the thread affinity syscalls.

Linux has more tolerant checks of the user supplied cpuset_t's.

Minimum cpuset_t size that the Linux kernel permits in case of
getaffinity() is the maximum CPU id, present in the system / NBBY,
the maximum size is not limited.
For setaffinity(), Linux does not limit the size of the user-provided
cpuset_t, internally using only the meaningful part of the set, where
the upper bound is the maximum CPU id, present in the system, no larger
than the size of the kernel cpuset_t.
Unlike FreeBSD, Linux ignores high bits if set in the setaffinity(),
so clear it in the sched_setaffinity() and Linuxulator itself.

Reviewed by:            Pau Amma (man pages)
In collaboration with:  jhb
Differential revision:  https://reviews.freebsd.org/D34849
MFC after:              2 weeks

(cherry picked from commit f35093f8d6)
2022-06-17 22:35:14 +03:00
..
colldef Add collation version support to querylocale(3). 2020-11-08 02:50:34 +00:00
ctypedef Fix CTYPE for ja_JP.eucJP and ja_JP.SJIS. 2020-06-29 03:23:13 +00:00
dict Add a number of five letter words to the dictionary 2022-05-03 14:20:44 -04:00
doc rtw88: add man pages and hook up to build 2022-06-03 15:51:16 +00:00
dtrace dtrace: fix ipfw_rule_info_t translator 2021-09-10 13:35:35 +03:00
examples make.conf: Fix a typo in the example file 2022-06-10 14:30:44 +02:00
i18n Remove mkcsmapper_static and mkesdb_static from build-tools 2021-08-05 10:00:56 +01:00
keys pkgbase: Add a FreeBSD-pkg-bootstrap package 2022-01-05 18:23:53 +01:00
man cpuset: Byte swap cpuset for compat32 on big endian architectures 2022-06-17 22:35:14 +03:00
misc bsd-family-tree: macOS 11 and macOS 12 2022-03-31 22:27:36 -06:00
mk src.libnames: Replace redundant += with = 2022-05-25 20:42:53 -07:00
monetdef Add ga_IE.UTF-8 locale. 2018-11-26 19:39:49 +00:00
msgdef Add ga_IE.UTF-8 locale. 2018-11-26 19:39:49 +00:00
numericdef Add ga_IE.UTF-8 locale. 2018-11-26 19:39:49 +00:00
security META MODE: These need object directories to handle staging. 2015-11-26 01:14:27 +00:00
sendmail share: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:26:40 +00:00
skel Make sh(1) support \u in PS1. This removes one fork/exec on interactive 2019-01-24 11:59:46 +00:00
snmp pkgbase: Put the mibs and defs in the bnsmp package 2021-06-30 09:24:33 +02:00
syscons pkgbase: Create a syscons-data package 2022-01-05 18:23:50 +01:00
tabset Add META_MODE support. 2015-06-13 19:20:56 +00:00
termcap Update the screen termcap entries 2020-05-07 12:43:28 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
timedef Finsh readding Big5 in r317204, which was reverting r315568. This commit 2019-06-20 07:17:16 +00:00
vt keymap: Add extra Alt Gr mapping for Brazillian Portuguese ABNT2 keyboards 2022-02-25 21:21:50 -03:00
zoneinfo pkgbase: Put zoneinfo file in their own package 2021-01-04 16:18:36 +01:00
Makefile Convert traditional ${MK_TESTS} conditional idiom for including test 2017-08-02 08:35:51 +00:00
Makefile.inc