Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp479859ybn; Thu, 3 Oct 2019 07:49:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqy3x3HSBH/0SwhTsPVTw3eVhLCavuGPIR0PlxqFnmP+oQTkSpavrIkyySMTtEx/iYojFZ+H X-Received: by 2002:aa7:dc4b:: with SMTP id g11mr10123879edu.70.1570114184485; Thu, 03 Oct 2019 07:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570114184; cv=none; d=google.com; s=arc-20160816; b=g1Yg4xDiraDBwx+eVbobfgi4/Bjpu0RawqdgR+z17Oo7535IsnspS7e7wbCRFLHlFz m8uyXtMQq6XZS3p0ceRkivbZONbW0GNZ7jl4v/hgoR9FfLmgzcNvJOP3CR6T/V3gqRL6 YKwocpliUXwmvbLYAe6pmsx9dBGOp8kqfLPTjr0CBwvL0jncI9MSHpM/v2V2vQ80ZXQK wawtyMiNlzc08UF4wR9/VaKRcPkFc41QG/z3bmldsnGQkLReUmorNCTd7uMW1B4Gi43N Qch6O8+nwzHctJG9zGp2XeKKBWmiKO6/CiRS7Fvt2fO7iaq95tNe4+B84yFmsGmJXPnd EpIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bQzJN683dZCArQWtEWKjhWHu+59KWgkuyOh2HrgIXCM=; b=xY84tpx7/MYx5R4v0UGw0rnhFd5glY0uXvxd9J+vw4mPEHuT12dz0SjE0pA3ncspbw dGPSL0MyaWXV+ZglmEZr+YC4rosogryu218Rljqwn8pdr9u7foRiTO2SDQt7HxVahzpb LPsD9dSIOrRDuFiH5KHPxAhGL2Wo39IEHpY16XD1eme+qqLw6pyh6zvKZSxiVOIUzU8s qj6fj4rDCn/jxhFMiB+tbcl2+yxUjvTInWcvueNUOgqZwGyYRGGV/QJ5d7hEHjQZGcvX swE8j90zHZa306zqydJmME6YMdyrLzR/Lv9bmY2mead3A4nKMVqBSpzKsf2pgUwXG+zD sKMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=ZpWRnF1H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id jo19si1415440ejb.271.2019.10.03.07.49.20; Thu, 03 Oct 2019 07:49:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=ZpWRnF1H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730405AbfJCOIj (ORCPT + 99 others); Thu, 3 Oct 2019 10:08:39 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37061 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727611AbfJCOIh (ORCPT ); Thu, 3 Oct 2019 10:08:37 -0400 Received: by mail-pg1-f193.google.com with SMTP id p1so86370pgi.4 for ; Thu, 03 Oct 2019 07:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bQzJN683dZCArQWtEWKjhWHu+59KWgkuyOh2HrgIXCM=; b=ZpWRnF1H8pzxnrmf8sV21CSx+5MEPuj1PYmZ+DcgPvTvtKCdbxcXtMHaGz5YEFeTwV BhkhubM7Zv8Q/F/QvFvL/sv7Is6kR5r1SOBBcqI1MPzgXIGTv9X7srMbKe0EKszjIxe3 oUXKxyRHdlvKDI/d3ZIIAf/7IkaicqdGfS4Jo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bQzJN683dZCArQWtEWKjhWHu+59KWgkuyOh2HrgIXCM=; b=Wnopup21DuEN/TE4BO56qifiqIgAjRBXHJt47QY4zJnPsMuyxyIrHutOnllnoNwhNH DUQN80+3mdxFgNkh6ZoiDV/wNwNYzTlQegGNhjlVgVfvhwhyJGZEXPERUiTHao11/L6g Qn5kRBhyfp8yNCUQTXm6BJ3Xg6EnktodLNoFsWq+EY6oAbflhw0mS7qELn2dw0rxReBy 37Ce8gGkpDRXzXaBofGjlzTVeL82lJY/ZSsDkKNqo6Tw6uKnp8m7pgzXBEO0CHCHoDjn +SjLu4pWn+TUzqucDDGjnvRGfX9nGa1RGV7kU/9D4q5rE13pXpF9JEUqPD0ZyI5w1f+Q YiZA== X-Gm-Message-State: APjAAAW6tPoP4z/6NNTRhCcajv7rgxZyU43FWwDmnkcCjx8TqasThGU/ ECLdrz7ZkjI7TbUMPwK/2fJ+4A== X-Received: by 2002:a65:534a:: with SMTP id w10mr9704936pgr.375.1570111717048; Thu, 03 Oct 2019 07:08:37 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id j24sm3361392pff.71.2019.10.03.07.08.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2019 07:08:36 -0700 (PDT) Date: Thu, 3 Oct 2019 10:08:35 -0400 From: Joel Fernandes To: Masahiro Yamada Cc: Dmitry Goldin , "linux-kernel@vger.kernel.org" , "gregkh@linuxfoundation.org" , Ben Hutchings Subject: Re: [PATCH] kheaders: making headers archive reproducible Message-ID: <20191003140835.GG254942@google.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 03, 2019 at 10:50:06AM +0900, Masahiro Yamada wrote: > Hi Dmitry, > > > (+CC Ben Hutchings, who might be interested) > > > On Sun, Sep 22, 2019 at 10:38 PM Dmitry Goldin wrote: > > > > From: Dmitry Goldin > > > > In commit 43d8ce9d65a5 ("Provide in-kernel headers to make > > extending kernel easier") a new mechanism was introduced, for kernels > > >=5.2, which embeds the kernel headers in the kernel image or a module > > and exposed them in procfs for use by userland tools. > > > > The archive containing the header files has nondeterminism through the > > header files metadata. This patch normalizes the metadata and utilizes > > KBUILD_BUILD_TIMESTAMP if provided and otherwise falls back to the > > default behaviour. > > > > In commit f7b101d33046 ("kheaders: Move from proc to sysfs") it was > > modified to use sysfs and the script for generation of the archive was > > renamed to what is being patched. > > > > Signed-off-by: Dmitry Goldin > > --- > > kernel/gen_kheaders.sh | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > Thanks, this produced the deterministic archive for me. > Reviewed-by: Joel Fernandes (Google) thanks, - Joel > > While you are here, could you also update the following hunk > in Documentation/kbuild/reproducible-builds.rst > > ---------->8--------------- > The kernel embeds a timestamp in two places: > > * The version string exposed by ``uname()`` and included in > ``/proc/version`` > > * File timestamps in the embedded initramfs > ---------->8--------------- > > > With the documentation updated, I will pick it soon. > > Thank you. > > > > > > diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh > > index 9ff449888d9c..2e154741e3b2 100755 > > --- a/kernel/gen_kheaders.sh > > +++ b/kernel/gen_kheaders.sh > > @@ -71,7 +71,10 @@ done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1 > > find $cpio_dir -type f -print0 | > > xargs -0 -P8 -n1 perl -pi -e 'BEGIN {undef $/;}; s/\/\*((?!SPDX).)*?\*\///smg;' > > > > -tar -Jcf $tarfile -C $cpio_dir/ . > /dev/null > > +# Create archive and try to normalized metadata for reproducibility > > +tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \ > > + --owner=0 --group=0 --sort=name --numeric-owner \ > > + -Jcf $tarfile -C $cpio_dir/ . > /dev/null > > > > echo "$src_files_md5" > kernel/kheaders.md5 > > echo "$obj_files_md5" >> kernel/kheaders.md5 > > -- > > 2.19.2 > > > > > > > > > -- > Best Regards > Masahiro Yamada