svn commit: r354409 - head/sys/kern

Brooks Davis brooks at FreeBSD.org
Wed Nov 6 19:44:45 UTC 2019


Author: brooks
Date: Wed Nov  6 19:44:44 2019
New Revision: 354409
URL: https://svnweb.freebsd.org/changeset/base/354409

Log:
  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

Modified:
  head/sys/kern/subr_stats.c

Modified: head/sys/kern/subr_stats.c
==============================================================================
--- head/sys/kern/subr_stats.c	Wed Nov  6 18:54:04 2019	(r354408)
+++ head/sys/kern/subr_stats.c	Wed Nov  6 19:44:44 2019	(r354409)
@@ -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 {


More information about the svn-src-all mailing list