From: Stefan Berger Subject: [PATCH][ACM] 3/3: make ACM architecture independent (Application part) Date: Wed, 18 Oct 2006 11:57:22 -0400 Message-ID: <1161187042.25656.69.camel@941e-2.watson.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-UDEuRmQpKBCpuEvqbkiC" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel Cc: sailer@us.ibm.com List-Id: xen-devel@lists.xenproject.org --=-UDEuRmQpKBCpuEvqbkiC Content-Type: text/plain Content-Transfer-Encoding: 7bit The changes for alignment in patches 1 and 2 have an effect on the alignment needed in the application layer when parsing the returned buffer. This patch fixes this requirement. Signed-off-by: Stefan Berger --=-UDEuRmQpKBCpuEvqbkiC Content-Disposition: attachment; filename=xen-acm-archindep_app.diff Content-Type: text/x-patch; name=xen-acm-archindep_app.diff; charset=UTF-8 Content-Transfer-Encoding: 7bit Index: root/xen-unstable.hg/tools/security/secpol_tool.c =================================================================== --- root.orig/xen-unstable.hg/tools/security/secpol_tool.c +++ root/xen-unstable.hg/tools/security/secpol_tool.c @@ -43,6 +43,8 @@ fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a , \ errno, strerror(errno)) +#define ALIGN8(x) (void *)(((long)(x) + 7) & ~7) + void usage(char *progname) { printf("Usage: %s ACTION\n" @@ -182,14 +184,14 @@ void acm_dump_policy_buffer(void *buf, i ntohl(pol->secondary_buffer_offset)); switch (ntohl(pol->primary_policy_code)) { case ACM_CHINESE_WALL_POLICY: - acm_dump_chinesewall_buffer(buf + - ntohl(pol->primary_buffer_offset), + acm_dump_chinesewall_buffer(ALIGN8(buf + + ntohl(pol->primary_buffer_offset)), ntohl(pol->len) - ntohl(pol->primary_buffer_offset)); break; case ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY: - acm_dump_ste_buffer(buf + ntohl(pol->primary_buffer_offset), + acm_dump_ste_buffer(ALIGN8(buf + ntohl(pol->primary_buffer_offset)), ntohl(pol->len) - ntohl(pol->primary_buffer_offset)); break; @@ -204,14 +206,14 @@ void acm_dump_policy_buffer(void *buf, i switch (ntohl(pol->secondary_policy_code)) { case ACM_CHINESE_WALL_POLICY: - acm_dump_chinesewall_buffer(buf + - ntohl(pol->secondary_buffer_offset), + acm_dump_chinesewall_buffer(ALIGN8(buf + + ntohl(pol->secondary_buffer_offset)), ntohl(pol->len) - ntohl(pol->secondary_buffer_offset)); break; case ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY: - acm_dump_ste_buffer(buf + ntohl(pol->secondary_buffer_offset), + acm_dump_ste_buffer(ALIGN8(buf + ntohl(pol->secondary_buffer_offset)), ntohl(pol->len) - ntohl(pol->secondary_buffer_offset)); break; --=-UDEuRmQpKBCpuEvqbkiC Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-UDEuRmQpKBCpuEvqbkiC--