From owner-p4-projects@FreeBSD.ORG Wed Aug 5 17:56:18 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CC54C1065670; Wed, 5 Aug 2009 17:56:17 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 56811106566C for ; Wed, 5 Aug 2009 17:56:17 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 430908FC0A for ; Wed, 5 Aug 2009 17:56:17 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n75HuHFV080253 for ; Wed, 5 Aug 2009 17:56:17 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n75HuHku080251 for perforce@freebsd.org; Wed, 5 Aug 2009 17:56:17 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Wed, 5 Aug 2009 17:56:17 GMT Message-Id: <200908051756.n75HuHku080251@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson To: Perforce Change Reviews Cc: Subject: PERFORCE change 167038 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2009 17:56:18 -0000 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_ */