Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Aug 2009 17:56:17 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 167038 for review
Message-ID:  <200908051756.n75HuHku080251@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=167038

Change 167038 by rwatson@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_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908051756.n75HuHku080251>