From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751734AbeAZUhX (ORCPT ); Fri, 26 Jan 2018 15:37:23 -0500 Received: from rcdn-iport-9.cisco.com ([173.37.86.80]:62866 "EHLO rcdn-iport-9.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751363AbeAZUhU (ORCPT ); Fri, 26 Jan 2018 15:37:20 -0500 X-IronPort-AV: E=Sophos;i="5.46,418,1511827200"; d="scan'208";a="342075795" Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 To: "H. Peter Anvin" , Al Viro , Arnd Bergmann , James McMechan , Jonathan Corbet , Mimi Zohar , Rob Landley From: Taras Kondratiuk In-Reply-To: Cc: initramfs@vger.kernel.org, Victor Kamensky , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, xe-linux-external@cisco.com References: <1516850875-25066-1-git-send-email-takondra@cisco.com> <1516850875-25066-12-git-send-email-takondra@cisco.com> Message-ID: <151699903485.21956.15795523878472133751@takondra-t460s> User-Agent: alot/0.6 Subject: Re: [PATCH v2 11/15] gen_init_cpio: add newcx format Date: Fri, 26 Jan 2018 12:37:14 -0800 X-Auto-Response-Suppress: DR, OOF, AutoReply Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id w0QKbSAC017022 Quoting Rob Landley (2018-01-25 18:40:25) > On 01/24/2018 09:27 PM, Taras Kondratiuk wrote: > > diff --git a/usr/gen_init_cpio.c b/usr/gen_init_cpio.c > > index 7a2a6d85345d..78a47a5bdcb1 100644 > > --- a/usr/gen_init_cpio.c > > +++ b/usr/gen_init_cpio.c > > @@ -10,6 +10,7 @@ > > #include > > #include > > #include > > +#include > > You're adding an assert? Really? > > > fputs(s, stdout); > > - offset += 110; > > + assert((offset & 3) == 0); > > + offset += cpio_hdr_size; > > Why? Current code assumes that previous file entry in cpio is padded to 4 byte boundary. The assert just captures this assumption. It should be true unless there is a bug in the code and some padding is missing. Actually this assert should be a part of the next patch (#12) that modifies padding code.