]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
freebsd32_sendmsg: fix control message ABI
authorBrooks Davis <brooks@FreeBSD.org>
Wed, 24 Aug 2022 17:34:39 +0000 (18:34 +0100)
committerBrooks Davis <brooks@FreeBSD.org>
Mon, 30 Jan 2023 19:22:30 +0000 (19:22 +0000)
commit435a2e04f06b4cb74f41a9805d1eb0f4c30bee00
tree5a1fa68b5835092357acee77124fa2b0c1d1ab10
parent8497b431f19efac28a1f1f64f78037f37d7c671e
freebsd32_sendmsg: fix control message ABI

When a freebsd32 caller uses all or most allowed space for control
messages (MCLBYTES == 2K) then the message may no longer fit when
the messages are padded for 64-bit alignment.  Historically we've just
shrugged and said there is no ABI guarantee.  We ran into this on
CheriBSD where a capsicumized 64-bit nm would fail when called with more
than 64 files.

Fix this by not gratutiously capping size of mbuf data we'll allocate
to MCLBYTES and let m_get2 allocate up to MJUMPAGESIZE (4K or larger).
Instead of hard-coding a length check, let m_get2 do it and check for a
NULL return.

Reviewed by: markj, jhb, emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D36322

(cherry picked from commit c46697b9cb97a14f61ac0a58758aab081b9e48c5)
sys/compat/freebsd32/freebsd32_misc.c