The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=be1b2da855cc38531733b5c97891cd4a40a993bc
commit be1b2da855cc38531733b5c97891cd4a40a993bc Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-01-12 04:46:15 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-01-20 14:42:35 +0000 sys/abi_compat.h: fix UB for bintime32 handling Do not cast and then access potentially unaligned uint64_t in the BT_CP() macro. Use freebsd32_uint64_t type and FU64_CP() for the frac member. Noted by: des Reviewed by: des, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54663 --- sys/compat/freebsd32/freebsd32.h | 2 +- sys/sys/abi_compat.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 7324f9adf70c..7d21a5be5570 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -70,7 +70,7 @@ struct itimerspec32 { struct bintime32 { time32_t sec; - uint32_t frac[2]; + freebsd32_uint64_t frac; }; struct ffclock_estimate32 { diff --git a/sys/sys/abi_compat.h b/sys/sys/abi_compat.h index 0a7110191430..bd99a21d8e23 100644 --- a/sys/sys/abi_compat.h +++ b/sys/sys/abi_compat.h @@ -77,7 +77,7 @@ #define BT_CP(src, dst, fld) do { \ CP((src).fld, (dst).fld, sec); \ - *(uint64_t *)&(dst).fld.frac[0] = (src).fld.frac; \ + FU64_CP((src).fld, (dst).fld, frac); \ } while (0) #endif /* !_COMPAT_H_ */
