Received: by 10.223.185.116 with SMTP id b49csp1107752wrg; Fri, 16 Feb 2018 12:36:24 -0800 (PST) X-Google-Smtp-Source: AH8x225ZZzD8KNWPpnvUT6BhhvbJvWhOo31RknX6e0dILg6hqRXSKo8DHwWcFMgwZlv4EuAUPJGq X-Received: by 2002:a17:902:428:: with SMTP id 37-v6mr6798143ple.63.1518813384297; Fri, 16 Feb 2018 12:36:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518813384; cv=none; d=google.com; s=arc-20160816; b=N6lb3PRkZiEXsIjdXZO+kCnMS4FbkbSjR3zhyb7g/sHEas/+Pofyx4kfpN3NWpbOBR Lth/5kAOFT4kpF9i40Uj9P1JUTq6Fc1ywIDW+J9X3k2H6w18NTvjpDoGGa5PgrVfqj+E 9smhixGuxuF7KXglsRdhVVPh32WoT2BrdIQEYw8QiZWlb8nvPQA0IFZ0JS/Ojte/0A8/ XGK6VRy4fJQQde76d2zyvLMKju9ovA8h63tbRAOB9BSwQNYBLHi00Y4R2cwtqOaxZiHe kujuf4QOeZTi4ZAtbj5dzcMGjkz8i40y2Gd/SKJGCqcwSBWNzGAEkDzIaVI7jUQ1Ddjt tAXw== 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=G+E5AER9Cra/Ahc71ewCe4B2rom+b3dw/cMWq5BLvLOKEi4zApo8LUaa4d0PPC0+K2 /M3OSWytXVZO1Yt5NEw25ZCWDgzO/VSpSzuq27vNX/7LOMc758OofglSQEjKbJZ2/I4m bJhDbSlaV0rYaI/m7dHsCr4wDwuwFfhTKfqvmeS4vUPq22fwvovrIuJ8u7e8VyEZplFH sVqDTF/8hyr/VyD+88s4yXl6v6QU0DxJW01MtSAEi1q9WdSxwQeSiU/NEPWQ8EAUVPqN bR3+AE2aH0NmFG2SVW+3tv2AzBz0HJZRLlnlwWWIny9bZsgGTgM53UDGEHa+FfB/0tJp 3l7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cisco.com header.s=iport header.b=Yn8beohq; 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 g2-v6si1727346plt.810.2018.02.16.12.36.10; Fri, 16 Feb 2018 12:36:24 -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=Yn8beohq; 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 S1751156AbeBPUeQ (ORCPT + 99 others); Fri, 16 Feb 2018 15:34:16 -0500 Received: from alln-iport-1.cisco.com ([173.37.142.88]:6710 "EHLO alln-iport-1.cisco.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751058AbeBPUeH (ORCPT ); Fri, 16 Feb 2018 15:34:07 -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=1518813247; x=1520022847; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=dQ7LLTRmN2q9Pmp/35oM3M+RAoO+z7MJHtmUq8U+j4Y=; b=Yn8beohqbGrQFVoXs1a5Tq9CcAfXXsP8TxZJ/RVHaBgbCovKtOwJ9Hkc eauEVIw8vJkvuCzEX99Rs66YoZN7RekfFUV2QF9SeOwALBT6zB8K8es9w xgV4CTnNSoMcyRaCOyHrHLtDOWVqN7CoSiJCtZFSa+m9GRcb7dGBcmJE5 o=; X-IronPort-AV: E=Sophos;i="5.46,520,1511827200"; d="scan'208";a="71904794" Received: from rcdn-core-6.cisco.com ([173.37.93.157]) by alln-iport-1.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Feb 2018 20:34:06 +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 w1GKXsMc015412 (version=TLSv1/SSLv3 cipher=AES128-SHA256 bits=128 verify=NO); Fri, 16 Feb 2018 20:34:05 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 12/14] gen_initramfs_list.sh: add -x option to enable newcx format Date: Fri, 16 Feb 2018 20:33:49 +0000 Message-Id: <1518813234-5874-14-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