aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2019-11-06 19:44:44 +0000
committerBrooks Davis <brooks@FreeBSD.org>2019-11-06 19:44:44 +0000
commit89f34d4611aea4dd9d9ad76075e94aead95fa3c4 (patch)
tree2967a9389c9b39ae27e4d3837cdec863827a0a08
parent0b59366325117cff311b389d33626ef7aff3b502 (diff)
downloadsrc-89f34d4611aea4dd9d9ad76075e94aead95fa3c4.tar.gz
src-89f34d4611aea4dd9d9ad76075e94aead95fa3c4.zip
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
Notes
Notes: svn path=/head/; revision=354409
-rw-r--r--sys/kern/subr_stats.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/subr_stats.c b/sys/kern/subr_stats.c
index 10e5eaef4e27..bbdc1039237e 100644
--- a/sys/kern/subr_stats.c
+++ b/sys/kern/subr_stats.c
@@ -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 {