Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp3022325ybj; Mon, 23 Sep 2019 13:22:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWEf2hQPXwoRVkd+1Gmx9TU/qqaCu4WOVbQ3Xea5mG4mAJ/31k6jk9MeOBK/ysOYqNQVsA X-Received: by 2002:aa7:ce88:: with SMTP id y8mr2068243edv.145.1569270171975; Mon, 23 Sep 2019 13:22:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569270171; cv=none; d=google.com; s=arc-20160816; b=iqtRnLdr8iUetmFnfa/k8yc9YiyX8X5BTl4+lyZCmHr1qdbKNHPiV7in9Rrmr8eOsj MUpDchVDnWB/TKhairyDcGp0QC9c4B0xX3ev62D4YQtEyTOUfP8lixnuhjJZD06JgmQ6 maY5725b7n1m8meZHaTe6Y888TNGJkR3/txWh0ImjKkDxrebS77LRTJt32GjaBle8Zok cl5RbpqrQi9u0v+4mdSvUKgLUGkcjzYJrBoJp4fDk6Wjwha5u8J91Aeyzog6o5e7NrLf uTx9UTKHeUWDi5BZMJ66elU8AUpeAop5Q4J1LnGTwUoNNPApjDiijMQR9xJE7vO8emH7 nmnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :feedback-id:message-id:subject:reply-to:cc:from:to:dkim-signature :date; bh=qHs4PYKGN4gucVzg/OdVbyMsjMNs4bE10O7osfBic2Y=; b=p1FIkbjCMajc5FRDwupHdGg5QicLDGPkz4vcG5gv1mtVsZMoZbUMGxJkDx6K7dqVwi SqJmkjPztcleevlJLq31g/5cQvVHbJiSGw7pwNheIY6lcAqRogMABsnjw8qY+gpe3U46 Ex9LRY1uVi3KeleTKpSgkcB6e2sV98bpgSYqt6q4JOATcK4qm/pKPz9ba7I2Zg2YLAm8 ipAwRtxPeV/wC98yYX/5JM6YG/xblst0GqyPGWVnlhhpR9Yncu8wZiVXGSpOqh1K9q2T yhK7SYxqcc4/lZkySScZbnivvkIY42OcaAcY0XGoAYzCuqiFz4yDKawq2TbE9737z2ix bXxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@protonmail.ch header.s=default header.b=yOD7bzGR; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.ch Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y19si5679390ejp.196.2019.09.23.13.22.28; Mon, 23 Sep 2019 13:22:51 -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=@protonmail.ch header.s=default header.b=yOD7bzGR; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=protonmail.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728916AbfIVNhd (ORCPT + 99 others); Sun, 22 Sep 2019 09:37:33 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:63970 "EHLO mail2.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728696AbfIVNhd (ORCPT ); Sun, 22 Sep 2019 09:37:33 -0400 Date: Sun, 22 Sep 2019 13:37:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.ch; s=default; t=1569159450; bh=qHs4PYKGN4gucVzg/OdVbyMsjMNs4bE10O7osfBic2Y=; h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From; b=yOD7bzGR9+SB7NLTdQxdxzNk5Isgui/8q1M6CWuldKxCzCfhvrXqTzQZ4dJZotOSx KAH0cIIsmAJISjDnJ4tAC6xRsV/2wVy+FlyA5u80u0N7bXYbgNHs9crb2MDcXnRFn1 LiHC9bItMbKER2jNM5eD0AwjKA09Mj9faAagVTMQ= To: "linux-kernel@vger.kernel.org" From: Dmitry Goldin Cc: "joel@joelfernandes.org" , "yamada.masahiro@socionext.com" , "gregkh@linuxfoundation.org" Reply-To: Dmitry Goldin Subject: [PATCH] kheaders: making headers archive reproducible Message-ID: Feedback-ID: Z14zYPZ70AFJyYagXjx-jk2Vw9RTvF5p9C9xp4Pq6DJAMFg9PDsfB7GoMmtR_dfa0BaFgToZb9Q4V0UiY2YiMQ==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Goldin In commit 43d8ce9d65a5 ("Provide in-kernel headers to make extending kernel easier") a new mechanism was introduced, for kernels >=3D5.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(-) 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 | =09xargs -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=3D$KBUILD_BUILD_TIMESTAMP}" \ + --owner=3D0 --group=3D0 --sort=3Dname --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