libstats: Improve ABI assertion.

On platforms where pointers are larger than 64-bits, struct statsblob
may be harmlessly padded out such that opaque[] always has some included
space.  Make the assertion more general by comparing to the offset of
opaque rather than the size of struct statsblob.

Discussed with:	jhb, James Clarke
Reviewed by:	trasz, lstewart
Obtained from:	CheriBSD
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D22188
This commit is contained in:
brooks 2019-11-06 19:44:44 +00:00
parent d7e766f7a8
commit 325c38b94e

View File

@ -124,7 +124,8 @@ struct statsblobv1 {
struct voi vois[]; /* Array indexed by [voi_id]. */
} __aligned(sizeof(void *));
_Static_assert(offsetof(struct statsblobv1, cursz) +
SIZEOF_MEMBER(struct statsblobv1, cursz) == sizeof(struct statsblob),
SIZEOF_MEMBER(struct statsblobv1, cursz) ==
offsetof(struct statsblob, opaque),
"statsblobv1 ABI mismatch");
struct statsblobv1_tpl {