Date: Sun, 12 Apr 2026 05:57:05 +0000 From: Dag-Erling=?utf-8?Q? Sm=C3=B8rg?=rav <des@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Konstantin Belousov <kib@FreeBSD.org> Subject: git: 408e20a69900 - stable/14 - sys/abi_compat.h: fix UB for bintime32 handling Message-ID: <69db3431.31276.5006661@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/14 has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=408e20a699006bbe15546052db7b413b21603c2b commit 408e20a699006bbe15546052db7b413b21603c2b Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-01-12 04:46:15 +0000 Commit: Dag-Erling Smørgrav <des@FreeBSD.org> CommitDate: 2026-04-12 05:56:45 +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 (cherry picked from commit be1b2da855cc38531733b5c97891cd4a40a993bc) --- 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 36deb6bd06f2..b5671611c1eb 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_ */home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69db3431.31276.5006661>
