Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5758976imu; Mon, 26 Nov 2018 04:59:43 -0800 (PST) X-Google-Smtp-Source: AFSGD/XrEO33exSHqY54JYnuW2yRifN8pBUtNF1mUZjpHmku9FXcxFEwyIalyTsiGYzvkcQtkZta X-Received: by 2002:a63:a611:: with SMTP id t17mr24546186pge.338.1543237182965; Mon, 26 Nov 2018 04:59:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543237182; cv=none; d=google.com; s=arc-20160816; b=m+KJWZ/R4xfg6xEexbqxfMcUsB3wj92CRkhL/q38LgtlunX9C6B1UaeRj35Nb+aG1K s8aU8pNXdYF1rHylXk6f52u90XQpqbVUfMdr5A0oeMQ1VRz5AdCkm1Nnf/G3ljCBd8AX 7R+LjcOxLWf0DcCZQEEXmJSKpP8FxuXyB0ZhlZGob0F8iIrq0lIzmBeNUXWujU90bNMg NFi8iqrYDfqm/Kzk0J5qxXLpq27ghTuG7GpctRfTC5p5LXBf3GxlQtbZMLEay+VU10sg MMnEFIUttgZPIBchWnP5NF1PndFYxqKciCCZWcvhZtKWWJQyKyog5LqD5Y8W7SgZrJ8U gAPw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=jLSgUuLoLuW9IccdExXaghF1rCq11YEn76G+/R/AvDI=; b=ixJHfdsvV1+SscfwR+1imvjuAV3iU0dFxNLzclphv9zpdLPCusGhEci22EqlflCIef M10j6J2BI9tPLNcZ25HihgYvg7Mi+s8WGO4J89qlsqypU0b6pFI0g1mTBjjN6VQJ17T8 BBS12IReutcfzZznpnK2nnGppgb5kt5LqMo+kFPxmH01v3KmYWvccM4fO1kOCffhXrPu 7Mca2cwDeyJhUjAk4x05Wv/JNZAPJ6E6pge6yH13C2TCda5/1gy4lVRWFBlTFtFXG236 gDan1pFkQ4E/o/Ynm8UOLe0YnSBseM9rHhT/kDvGOUFwKexfS/EJNT54Bo7q6XSARUh0 gI8Q== ARC-Authentication-Results: i=1; mx.google.com; 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 l1si234909pld.324.2018.11.26.04.59.15; Mon, 26 Nov 2018 04:59:42 -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; 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 S1726958AbeKZXvT (ORCPT + 99 others); Mon, 26 Nov 2018 18:51:19 -0500 Received: from lhrrgout.huawei.com ([185.176.76.210]:32782 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726276AbeKZXvS (ORCPT ); Mon, 26 Nov 2018 18:51:18 -0500 Received: from LHREML712-CAH.china.huawei.com (unknown [172.18.7.108]) by Forcepoint Email with ESMTP id D41FD2EB36DB4; Mon, 26 Nov 2018 12:57:11 +0000 (GMT) Received: from [10.204.65.144] (10.204.65.144) by smtpsuk.huawei.com (10.201.108.35) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 26 Nov 2018 12:57:06 +0000 Subject: Re: [RFC][PATCH] fs: set xattrs in initramfs from regular files To: Rob Landley , CC: , , , , , , , , , , , , References: <20181122154942.18262-1-roberto.sassu@huawei.com> <7f2b0288-a173-e2bb-70ee-d552610bfc1e@landley.net> From: Roberto Sassu Message-ID: Date: Mon, 26 Nov 2018 13:56:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <7f2b0288-a173-e2bb-70ee-d552610bfc1e@landley.net> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.204.65.144] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/23/2018 9:21 PM, Rob Landley wrote: > On 11/22/18 9:49 AM, Roberto Sassu wrote: >> Although rootfs (tmpfs) supports xattrs, they are not set due to the >> limitation of the cpio format. A new format called 'newcx' was proposed to >> overcome this limitation. > > I got email about that format the day before you posted this, by the way. > >> However, it looks like that adding a new format is not simple: 15 kernel >> patches; user space tools must support the new format; mistakes made in the >> past should be avoided; it is unclear whether the kernel should switch from >> cpio to tar. > > The kernel _can't_ switch from cpio to tar without breaking backwards > compatability, it could only add tar as a second format it supported (remember > cpio images can be sideloaded so a new rootfs can be used with an existing > initramfs, plus existing build systems generate them and would still need to if > they wanted to keep supporting older kernels), and then once you've got two > formats somebody will propose zip support, and let's just not go there please. > > The changes to the userspace tools are trivial (I say that as the maintainer of > toybox, which has a cpio). The argument was about things like 64 bit timestamps > (y2038 problem), nanosecond support, sparse files, etc. And I think the argument > had largely died down? > > Keep in mind the squashfs guy spent 5 years trying to get his filesystem merged > (https://lwn.net/Articles/563578/), I spent several years trying to get my perl > removal patch merged (and only work up the enthusiasm to resubmit > http://lists.busybox.net/pipermail/buildroot/2015-March/123385.html > https://patchwork.kernel.org/patch/9193529/ https://lkml.org/lkml/2017/9/13/651 > about once a year because dealing with linux-kernel is just no fun for hobbyists > anymore). > >> The aim of this patch is to provide the same functionality without >> introducing a new format. The value of xattrs is placed in regular files >> having the same file name as the files xattrs are added to, plus a >> separator and the xattr name (.xattr-). > > I think you're solving the wrong problem, but that's just my opinion. Instead of iterating over rootfs, would it be better to detect files with extended attributes (from the file name) when the cpio image is parsed by the kernel, and call sys_lsetxattr() in do_copy()? This part can be turned on by introducing a new type in the existing format (if possible). The impact of this alternative is very low, and LSMs/IMA would be able, with minimum effort, to enforce policies on files in the initial ram disk. Roberto > Rob > -- HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Bo PENG, Jian LI, Yanli SHI