freebsd-dev/usr.sbin/makefs
Jessica Clarke 5b13fa7987 ufs: Rework shortlink handling to avoid subobject overflows
Shortlinks occupy the space of both di_db and di_ib when used. However,
everywhere that wants to read or write a shortlink takes a pointer do
di_db and promptly runs off the end of it into di_ib. 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, clean this up by inserting a union such that a new di_shortlink
can be added with the right size and element type, avoiding the need to
cast and allowing the use of the DIP macro to access the field. This
also mirrors how the ext2fs code implements extents support, with the
exact same structure other than having a uint32_t i_data[] instead of a
char di_shortlink[].

Reviewed by:	mckusick, jhb
Differential Revision:	https://reviews.freebsd.org/D33650
2022-01-02 20:55:36 +00:00
..
cd9660 Fix -Wpointer-sign warnings in makefs and mkimg 2021-01-07 09:26:21 +00:00
ffs ufs: Rework shortlink handling to avoid subobject overflows 2022-01-02 20:55:36 +00:00
msdos makefs: remove set but not used variables 2021-11-21 21:21:34 -05:00
sys Fix makefs bootstrap after d485c77f20 2021-02-22 17:55:45 +00:00
tests Revert r362390, those tests are fixed by r362418 2020-06-23 19:14:38 +00:00
cd9660.c Synchronise with NetBSD's version of EFI handling for El Torito images. 2018-03-31 15:04:41 +00:00
cd9660.h Fix -Wpointer-sign warnings in makefs and mkimg 2021-01-07 09:26:21 +00:00
ffs.c ufs: Rework shortlink handling to avoid subobject overflows 2022-01-02 20:55:36 +00:00
ffs.h Allocate extra inodes in makefs when leaving free space in UFS images. 2021-04-06 13:43:29 -04:00
Makefile Fix makefs bootstrap on macOS after D25563 2020-08-25 13:30:24 +00:00
Makefile.depend Update Makefile.depend files 2019-12-11 17:37:53 +00:00
makefs.8 Allocate extra inodes in makefs when leaving free space in UFS images. 2021-04-06 13:43:29 -04:00
makefs.c makefs: add msdosfs (FAT) support 2019-08-20 18:20:45 +00:00
makefs.h Fix -Wpointer-sign warnings in makefs and mkimg 2021-01-07 09:26:21 +00:00
msdos.c makefs: remove set but not used variables 2021-11-21 21:21:34 -05:00
msdos.h Fix makefs bootstrap after d485c77f20 2021-02-22 17:55:45 +00:00
mtree.c makefs: Ignore the "tags" keyword in mtree manifests 2021-03-23 14:38:40 -04:00
walk.c