From owner-freebsd-bugs@FreeBSD.ORG Sat Sep 3 16:30:11 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2927A106566C for ; Sat, 3 Sep 2011 16:30:11 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id F22978FC16 for ; Sat, 3 Sep 2011 16:30:10 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p83GUAJo028949 for ; Sat, 3 Sep 2011 16:30:10 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p83GUAKA028946; Sat, 3 Sep 2011 16:30:10 GMT (envelope-from gnats) Resent-Date: Sat, 3 Sep 2011 16:30:10 GMT Resent-Message-Id: <201109031630.p83GUAKA028946@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Ian Lepore Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D71E1065678 for ; Sat, 3 Sep 2011 16:23:46 +0000 (UTC) (envelope-from ilepore@damnhippie.dyndns.org) Received: from qmta07.emeryville.ca.mail.comcast.net (qmta07.emeryville.ca.mail.comcast.net [76.96.30.64]) by mx1.freebsd.org (Postfix) with ESMTP id 03D648FC0A for ; Sat, 3 Sep 2011 16:23:45 +0000 (UTC) Received: from omta14.emeryville.ca.mail.comcast.net ([76.96.30.60]) by qmta07.emeryville.ca.mail.comcast.net with comcast id UG4d1h0081HpZEsA7GAX2v; Sat, 03 Sep 2011 16:10:31 +0000 Received: from damnhippie.dyndns.org ([24.8.232.202]) by omta14.emeryville.ca.mail.comcast.net with comcast id UGAQ1h0034NgCEG8aGAQBo; Sat, 03 Sep 2011 16:10:24 +0000 Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id p83GAYes033930 for ; Sat, 3 Sep 2011 10:10:34 -0600 (MDT) (envelope-from ilepore@damnhippie.dyndns.org) Received: (from ilepore@localhost) by revolution.hippie.lan (8.14.4/8.14.4/Submit) id p83GAYXB098629; Sat, 3 Sep 2011 10:10:34 -0600 (MDT) (envelope-from ilepore) Message-Id: <201109031610.p83GAYXB098629@revolution.hippie.lan> Date: Sat, 3 Sep 2011 10:10:34 -0600 (MDT) From: Ian Lepore To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/160430: [patch] Add __packed to libarchive cpio metadata structs X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Ian Lepore List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Sep 2011 16:30:11 -0000 >Number: 160430 >Category: kern >Synopsis: [patch] Add __packed to libarchive cpio metadata structs >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Sep 03 16:30:10 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Ian Lepore >Release: FreeBSD 8.2-RC3 arm >Organization: none >Environment: FreeBSD dvb 8.2-RC3 FreeBSD 8.2-RC3 #49: Tue Feb 15 22:52:14 UTC 2011 root@revolution.hippie.lan:/usr/obj/arm/usr/src/sys/DVB arm >Description: Some platforms (such as ARM) pad structures to a multiple of the platform's "natural alignment". This causes libarchive to go into an endless loop when processing a cpio archive on such a platform. Adding the __packed attribute fixes the problem. >How-To-Repeat: Create a cpio archive ('newc' format) and attempt to list or extract it on ARM. >Fix: Patch attached. This patch is well-tested; it has been in use at Symmetricom since 2007 for our products that run on both ARM and x86 (32-bit) platforms. --- diff.tmp begins here --- --- archive_read_support_format_cpio.c.orig 2009-12-28 22:50:34.000000000 -0700 +++ archive_read_support_format_cpio.c 2011-09-03 09:50:07.000000000 -0600 @@ -54,7 +54,7 @@ struct cpio_bin_header { unsigned char c_mtime[4]; unsigned char c_namesize[2]; unsigned char c_filesize[4]; -}; +} __packed; /* prevent struct size padding on arm */ struct cpio_odc_header { char c_magic[6]; @@ -68,7 +68,7 @@ struct cpio_odc_header { char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; -}; +} __packed; /* prevent struct size padding on arm */ struct cpio_newc_header { char c_magic[6]; @@ -85,7 +85,7 @@ struct cpio_newc_header { char c_rdevminor[8]; char c_namesize[8]; char c_crc[8]; -}; +} __packed; /* prevent struct size padding on arm */ struct links_entry { struct links_entry *next; --- diff.tmp ends here --- >Release-Note: >Audit-Trail: >Unformatted: