Received: by 10.223.185.116 with SMTP id b49csp1108153wrg; Fri, 16 Feb 2018 12:36:54 -0800 (PST) X-Google-Smtp-Source: AH8x224TI9XKpan/7FB8TwQN03Z1ozL0ldFTPO6qa8X71a5/ZkpZi3MAoIDG0sHyOKwjj18m9B90 X-Received: by 2002:a17:902:48c8:: with SMTP id u8-v6mr6758618plh.272.1518813414620; Fri, 16 Feb 2018 12:36:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518813414; cv=none; d=google.com; s=arc-20160816; b=g5LnmlbmDr3qQIOlZSOkQmuTrzlEJLeLCzwUP5Pjx9dHOlGhzuLa4BMkSDqKKRw+St kZuFjXiiwUd3cQrL2VWnxNQV3lWedSiAhNUloH39apNeC+vML4F+8EygQMS1A0Q+2bZj DOqB9U7l45oAkUNaYLJEKOfvJI2uFQvLKlM9TPnQ5MZRxme8XBu1QiA3vF+LjwI2emai EDNw6Z3Fs+uUi4MJF0ZOZfQ82a3GZktzxMMbJepLVRzSwIqycnSNif571Mizak2pdPbM sfwyE6Af+SZlQGtJsNtqxVzbbgRw6lkl9gRAZUrYs/cjln3ADqCOVrg97UXAY/Ba9K8i kLoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=uU9CDPzfkHv4kIhlS+FXByyEE7jbCMb3ynoHiiDpXq4=; b=JkMHY28j/RdtWHYICIKxPfszlOlMZwHpjdAnk5XuSwU0+zpB4Qk4Asd05eYD7AZRCs RRQBJnas2mvQEAOHMuz4FlkM1y4k2EcBN29efm+/iwCqeTfjyHrXo+Sgr4QJ0n3J/SHd FuBH7B6azA+hh2F9dcsYKTwNDdU2Z/99NmmCNkgczQSeIOWAhNNl7MrCWxPN0eqgB1f8 POZq0qgilNdYcCPMqdzqe4qT1+8R3CjFDII8SmjVfEaw7Mbxy0aXyQrq1jnIKn1LbJIp aFUAkAze4eorIXnijXZearYxSRbgDL1XAgFtWbcFKtjfRkBpmm7QjEZiAq4bvBEpPGoU yvaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=EsxXnq0F; 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=NONE sp=NONE dis=NONE) header.from=cisco.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y3si1669257pgv.59.2018.02.16.12.36.40; Fri, 16 Feb 2018 12:36:54 -0800 (PST) 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=@cisco.com header.s=iport header.b=EsxXnq0F; 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=NONE sp=NONE dis=NONE) header.from=cisco.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751141AbeBPUeO (ORCPT + 99 others); Fri, 16 Feb 2018 15:34:14 -0500 Received: from alln-iport-4.cisco.com ([173.37.142.91]:4022 "EHLO alln-iport-4.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751073AbeBPUeI (ORCPT ); Fri, 16 Feb 2018 15:34:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3480; q=dns/txt; s=iport; t=1518813248; x=1520022848; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=dQ7LLTRmN2q9Pmp/35oM3M+RAoO+z7MJHtmUq8U+j4Y=; b=EsxXnq0Fii/4wdZoRI1K1Gu1sAuC2GfdlYk5AIcBS6ko/sNNE1EhqjUd oNDDnyAkTB5H9esK4Ed9cjoBOY5fVjgCrS/j4h4yY5/eQCSYsA2PhP486 SmQcEcN6c5q8FeL4Q1QjrEPltIkyi0SKObNUimPUpkZGW+/kdFR4kjaN4 g=; X-IronPort-AV: E=Sophos;i="5.46,520,1511827200"; d="scan'208";a="71929439" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Feb 2018 20:34:07 +0000 Received: from sjc-ads-7132.cisco.com (sjc-ads-7132.cisco.com [10.30.217.207]) (authenticated bits=0) by rcdn-core-6.cisco.com (8.14.5/8.14.5) with ESMTP id w1GKXsMd015412 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NO); Fri, 16 Feb 2018 20:34:06 GMT From: Taras Kondratiuk To: "H. Peter Anvin" , Al Viro , Arnd Bergmann , Rob Landley , Mimi Zohar , Jonathan Corbet , James McMechan 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 Subject: [PATCH v3 13/15] gen_initramfs_list.sh: add -x option to enable newcx format Date: Fri, 16 Feb 2018 20:33:50 +0000 Message-Id: <1518813234-5874-15-git-send-email-takondra@cisco.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1518813234-5874-1-git-send-email-takondra@cisco.com> References: <1518813234-5874-1-git-send-email-takondra@cisco.com> X-Auto-Response-Suppress: DR, OOF, AutoReply X-Authenticated-User: takondra@cisco.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mimi Zohar -x option populates extended attributes in cpio_list file passed to get_init_cpio and selects newcx CPIO format. Signed-off-by: Mimi Zohar Signed-off-by: Taras Kondratiuk --- scripts/gen_initramfs_list.sh | 13 ++++++++++++- usr/Kconfig | 11 +++++++++++ usr/Makefile | 3 ++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 86a3c0e5cfbc..cddb82f093d9 100755 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -24,6 +24,7 @@ $0 [-o ] [-u ] [-g ] {-d | } ... -g Group ID to map to group ID 0 (root). is only meaningful if is a directory. "squash" forces all files to gid 0. + -x include file extended attributes in cpio archive. File list or directory for cpio archive. If is a .cpio file it will be used as direct input to initramfs. @@ -146,6 +147,9 @@ parse() { ;; esac + $include_xattrs && \ + getfattr -h -d -m - -e hex --absolute-names ${location} | \ + sed -e '/^#/d' -e '/^$/d' -e 's/^/xattr /' >> ${output} echo "${str}" >> ${output} return 0 @@ -226,6 +230,8 @@ root_gid=0 dep_list= cpio_file= cpio_list= +cpio_opts= +include_xattrs=false output="/dev/stdout" output_file="" is_cpio_compressed= @@ -283,6 +289,10 @@ while [ $# -gt 0 ]; do default_list="$arg" ${dep_list}default_initramfs ;; + "-x") # include extended attributers + cpio_opts="-x" + include_xattrs=true + ;; "-h") usage exit 0 @@ -312,7 +322,8 @@ if [ ! -z ${output_file} ]; then fi fi cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" - usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} + usr/gen_init_cpio $timestamp ${cpio_opts} ${cpio_list} \ + > ${cpio_tfile} else cpio_tfile=${cpio_file} fi diff --git a/usr/Kconfig b/usr/Kconfig index 43658b8a975e..0cc03bc4614c 100644 --- a/usr/Kconfig +++ b/usr/Kconfig @@ -52,6 +52,17 @@ config INITRAMFS_ROOT_GID If you are not sure, leave it set to "0". +config INITRAMFS_NEWCX + bool "Use newcx CPIO format for initramfs" + depends on INITRAMFS_SOURCE!="" + default n + help + If selected "usr/gen_init_cpio" will generate newcx CPIO archive + format that supports extended attributes. + + See for + more details. + config RD_GZIP bool "Support initial ramdisk/ramfs compressed using gzip" depends on BLK_DEV_INITRD diff --git a/usr/Makefile b/usr/Makefile index 237a028693ce..1106bfd61475 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -29,7 +29,8 @@ ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) ramfs-args := \ $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ - $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) + $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) \ + $(if $(CONFIG_INITRAMFS_NEWCX), -x) # $(datafile_d_y) is used to identify all files included # in initramfs and to detect if any files are added/removed. -- 2.10.3.dirty