PERFORCE change 167038 for review

Robert Watson rwatson at FreeBSD.org
Wed Aug 5 17:56:18 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=167038

Change 167038 by rwatson at rwatson_cinnamon on 2009/08/05 17:56:11

	Mark bsm header and trailer structs as packed so that we can cast
	byte sequences to the type -- otherwise the compiler adds padding
	between fields that won't be in the BSM byte stream.
	
	Add an XXX that using struct timespec here has similar issues, we
	should use fixed-length types to avoid struct layout and field
	type problems that will vary by architecture/OS.

Affected files ...

.. //depot/projects/soc2009/marinosi_appaudit/src/sys/bsm/audit_internal.h#5 edit

Differences ...

==== //depot/projects/soc2009/marinosi_appaudit/src/sys/bsm/audit_internal.h#5 (text) ====

@@ -128,6 +128,8 @@
  * event modifier          2 bytes
  * seconds of time         4 bytes/8 bytes (32-bit/64-bit value)
  * milliseconds of time    4 bytes/8 bytes (32-bit/64-bit value)
+ *
+ * XXXRW: Should use fixed-length types here rather than struct timespec.
  */
 struct bsm_rec_hdr {
 	u_char			token_id;
@@ -136,7 +138,7 @@
 	u_int16_t		e_type;
 	u_int16_t		e_mod;
 	struct timespec		tm;
-};
+} __packed;
 
 /*
  * token ID                1 byte
@@ -147,6 +149,6 @@
 	u_char			token_id;
 	u_int16_t		trailer_num;
 	u_int32_t		rec_byte_count;
-};
+} __packed;
 
 #endif /* !_AUDIT_INTERNAL_H_ */


More information about the p4-projects mailing list