HomeFreeBSD

libsa: smbios: Detect less-than-64-bit platforms via __SIZEOF_SIZE_T__

Description

libsa: smbios: Detect less-than-64-bit platforms via SIZEOF_SIZE_T

What we really want here is to know if pointers can refer to 64-bit
addresses, regardless of whether they also hold other information (such
as capabilities in CHERI). SIZEOF_SIZE_T is probably the closest
indication to that piece of information, so let's use it. ILP32
wasn't wrong in practice though, as we don't support 32-bit CHERI
hardware (and likely never will).

Consistently with this change, test whether we can actually address the
64-bit SMBIOS's structure table by converting the end address to
'size_t' and checking whether its value is preserved.

Suggested by: jhb (for the ILP32 => SIZEOF_SIZE_T part)
Reviewed by: jhb, imp
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49318

Details

Provenance
olceAuthored on Mar 11 2025, 4:56 PM
Reviewer
jhb
Differential Revision
D49318: libsa: smbios: Detect less-than-64-bit platforms via __SIZEOF_SIZE_T__
Parents
rG488718ff4234: netlink: in snl_init_writer() don't overwrite error in case of failure
Branches
Unknown
Tags
Unknown