Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp94627imu; Mon, 26 Nov 2018 08:21:23 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wj9CG/gJZl63Qb41m9b7Vj+M87m3vDSRLYvDx3w4kQN/ht90rQTPHgOM6xX6+vVPqfDTUU X-Received: by 2002:a63:e445:: with SMTP id i5mr25529763pgk.307.1543249283358; Mon, 26 Nov 2018 08:21:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543249283; cv=none; d=google.com; s=arc-20160816; b=eIPrfN9PpG7bzcVt/EN9ecrjxm/7EYy0cmdN9b3i6l+WijUy5vJsmvqhKIp/RTgJXf SSfsnVTMf9s0BprvqEGj6AhhAu1vsTz6mQIY/on6f8l0km34G6eL/JqONm3OsY2Wi0Us XDD+SdlE3bN7MgiDDo+HvSW0EoSg3QwBtkEN49opxnZRkmP4/c4x8ygVQz24czwFCn+Q O2Kl0reb1fe2dSbDfe0mJ1vLGq5PQOJFQJ1/LJqbWG647fRouxVi6Jl5UASu0tJDJTn5 PBu69fczDCTIMCLH+4lZMlJErUqLf0EXmeW0qSzDtdSY09U9xx0vZ1gDNhGIN4AEBxjV ImrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=u5gn/nmg74thKaY1zkY926hhudkk1aWQ0sk3fvpX9gM=; b=Ydf4z800/8Xu2jvDLIR3lOCI5JnjE4++lboQf8TnVsvY0Ceq6QOlgYyWwW9fduQAYM DwigVDXvyQAoj+O3Uwq8XU+d0maLF4TPMZqG2qi1RE8n7wxXrVUtIuTgWF/3d5UcW3yX OlS+9m3pGOwmc9J1hCzYSYmW12vCdDIMonBhEJ4NiD9p6kmPdwLyx277FemzKbwlSqwo JjbB8l2yWTYLDFh7tbVq2hQPOxmjC9XxGOYsbrvkLrtfLrJAYjLgqvpc+0nvdPua0GqN 0VGYSjh3OIb+nm3u5C7q2fj23hqaCk1c4S8hTJm/IR0JIdYOipdZAb3PM4mSbofSF9YH BzyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=A0g4G2GC; 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 u11si843785plm.8.2018.11.26.08.20.02; Mon, 26 Nov 2018 08:21:23 -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=@yahoo.com header.s=s2048 header.b=A0g4G2GC; 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 S1726357AbeK0DMk (ORCPT + 99 others); Mon, 26 Nov 2018 22:12:40 -0500 Received: from sonic312-28.consmr.mail.ne1.yahoo.com ([66.163.191.209]:42588 "EHLO sonic312-28.consmr.mail.ne1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbeK0DMk (ORCPT ); Mon, 26 Nov 2018 22:12:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1543249085; bh=u5gn/nmg74thKaY1zkY926hhudkk1aWQ0sk3fvpX9gM=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=A0g4G2GCWrEcynw12z+dbkKToHJxhMhgWfu3wAH8HPOkptQctdZM66lgV9c0wQ/AQfpUJKaZimsF/39GHuaONz//SKB66CuAjfvZNKSkhHJU3FNLdekzOjEiyqef95acdk2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q8DBwHtBl19nSwnvJjdgobmyUC.kOJbtWwwktkdZjU3oRJlG8UxSa3BFy Gxw6HO5zGmfKIKY0znupT6y2Gl4wVzl0Zy5WP4otvLCCaABCpT.fK8WKUcynHqw6dSQ9fbXhslux oVGp6cG5BnsN9_84cUvjbYDDAFGdhMTTBy6GXqdvBeZXH4tmbbrAKjr7LO1KwMaW_4aHKOFne7dj NPBfzZ8_rzmza51l0LA6djuvEtEEmxYyJTOAQn6AdmSgRIuvYjlJh2fkxnO6qvrfB2HjwmnIJ0i0 s5P9isYJVFX4- Received: from sonic.gate.mail.ne1.yahoo.com by sonic312.consmr.mail.ne1.yahoo.com with HTTP; Mon, 26 Nov 2018 16:18:05 +0000 Received: from c-67-169-65-224.hsd1.ca.comcast.net (EHLO [192.168.0.105]) ([67.169.65.224]) by smtp425.mail.ne1.yahoo.com (Oath Hermes SMTP Server) with ESMTPA ID 7b445b9a823569247dc9ab6cbf832fd3; Mon, 26 Nov 2018 16:18:01 +0000 (UTC) Subject: Re: [RFC][PATCH] fs: set xattrs in initramfs from regular files To: Mimi Zohar , Roberto Sassu , viro@zeniv.linux.org.uk Cc: linux-fsdevel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, initramfs@vger.kernel.org, linux-kernel@vger.kernel.org, silviu.vlasceanu@huawei.com, dmitry.kasatkin@huawei.com, takondra@cisco.com, kamensky@cisco.com, hpa@zytor.com, arnd@arndb.de, rob@landley.net, james.w.mcmechan@gmail.com, Greg KH , Andrew Morton References: <20181122154942.18262-1-roberto.sassu@huawei.com> <3d1bfbd7-7d45-4cf1-32d6-7f6985b42393@schaufler-ca.com> <1543001453.4298.23.camel@linux.ibm.com> <6d6f3a60-7c80-4107-6d9b-be3d53cefefc@schaufler-ca.com> <1543236710.3902.43.camel@linux.ibm.com> From: Casey Schaufler Message-ID: <9b289ef7-473b-5e39-57c0-11a06ca3be65@schaufler-ca.com> Date: Mon, 26 Nov 2018 08:17:58 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1543236710.3902.43.camel@linux.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/26/2018 4:51 AM, Mimi Zohar wrote: > On Fri, 2018-11-23 at 18:07 -0800, Casey Schaufler wrote: >> On 11/23/2018 11:30 AM, Mimi Zohar wrote: >>> On Fri, 2018-11-23 at 11:03 -0800, Casey Schaufler wrote: >>>> On 11/22/2018 7: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. >>>>> >>>>> 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 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-). >>>>> >>>>> Example: >>>>> >>>>> '/bin/cat.xattr-security.ima' is the name of a file containing the value of >>>>> the security.ima xattr to be added to /bin/cat. >>>>> >>>>> At kernel initialization time, the kernel iterates over the rootfs >>>>> filesystem, and if it encounters files with the '.xattr-' separator, it >>>>> reads the content and adds the xattr to the file without the suffix. >>>> No. >>>> >>>> Really, no. >>>> >>>> It would be incredibly easy to use this mechanism to break >>>> into systems. > Assuming that the initramfs itself was signed, how? I don't share your faith in signatures. >>>>> This proposal requires that LSMs and IMA allow the read and setxattr >>>>> operations. This should not be a concern since: files with xattr values >>>>> are not parsed by the kernel; user space processes are not yet executed. >>>>> >>>>> It would be possible to include all xattrs in the same file, but this >>>>> increases the risk of the kernel being compromised by parsing the content. >>>> The kernel mustn't do this. >>> Mustn't do what?  Store the xattr as separate detached files,  >>> include all the xattrs in a single or per security/LSM xattr attribute >>> file(s), or either? >> Any and all of the above. The proposed behavior is a kludge >> around making the installation tools work correctly. Sure, it >> may be easier to change the kernel than to change the utilities. >> That's doesn't make it right. > Modifying userspace tools, as Rob Landley pointed out in terms of > toybox, isn't difficult.  The difficulty has been in reviewing and > upstreaming the kernel CPIO changes. No sympathy from me there. And why wouldn't this scheme require just as much review? > This patch was posted in order to address the lack of xattr support in > the initramfs.  Before totally dismissing this or a similar solution, > is there a safe method for including the xattrs? The extension to CPIO sounds right to me. > Would defining an LSM hook here help?  Each LSM would define its own > method for storing and applying, or restoring, xattr labels. I'm more concerned about how this could be used with file capabilities than I am with access control attributes. I don't see how adding a hook for this special case would help. > Mimi