Page MenuHomeFreeBSD

ufs: Avoid subobject overflow in snapshot expunge code
ClosedPublic

Authored by jrtc27 on Dec 24 2021, 4:08 PM.
Tags
None
Referenced Files
F170627409: D33651.id100538.diff
Sat, Sep 5, 5:16 PM
F170615724: D33651.id100538.diff
Sat, Sep 5, 4:00 PM
Unknown Object (File)
Sat, Sep 5, 3:44 AM
Unknown Object (File)
Sat, Sep 5, 3:38 AM
Unknown Object (File)
Fri, Sep 4, 10:44 PM
Unknown Object (File)
Thu, Sep 3, 7:50 PM
Unknown Object (File)
Wed, Sep 2, 10:41 AM
Unknown Object (File)
Wed, Sep 2, 12:21 AM
Subscribers

Details

Summary

The code here tries to be smart and zeroes out both di_db and di_ib with
a single bzero call, thereby overrunning the di_db subobject. This is
fine on most architectures, if a little dodgy. However, on CHERI, the
compiler can optionally restrict the bounds on pointers to subobjects to
just that subobject, in order to mitigate intra-object buffer overflows,
and this is enabled in CheriBSD's pure-capability kernels.

Instead, use separate bzero calls for each array, and let the compiler
optimise it as it sees fit; even if it's not generating inline zeroing
code, Clang will happily optimise two consecutive bzero's to a single
larger call.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable