HomeFreeBSD

cpuset: Byte swap cpuset for compat32 on big endian architectures

Description

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
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D35225

Details

Provenance
jhibbitsAuthored on May 12 2022, 8:38 PM
Reviewer
kib
Differential Revision
D35225: cpuset: Byte swap cpuset for compat32 on big endian architectures
Parents
rG21add93b5818: makefs: Remove execute permission from in-tree test scripts
Branches
Unknown
Tags
Unknown

Event Timeline