Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6587885yba; Tue, 14 May 2019 10:00:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqy6MIIPAjDEHYrLvcjONr5Rso/Rn1si0r2ac7vM4eYl7LcHgjvzMhivpyRHgruDB75uG8Wb X-Received: by 2002:a17:902:b614:: with SMTP id b20mr37133100pls.200.1557853231535; Tue, 14 May 2019 10:00:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557853231; cv=none; d=google.com; s=arc-20160816; b=QPom1i93Sh/Q0j6rxbugaFq6knXIsQ88ndx5rcpw8a1fukLi0HgcRYvhipiUOU7iu5 YrVQgpfYUpXN5/74a7ACetoKJd2d5folzREOGjZrMwsvFjRVNgiISQ8XzxDZKx8dXMLM zeVgpzPSO25OjQieXrvxoZ5CIbbwm45GAM5xSDou2Yj+0fDbWHq1QNwYSUR3jlbehqD9 ewODNd4xGfvWH8ubJuN/dpQVaM0O2gDTHZcY9nST4Hp6NvPuFwwJgaoeXzjk6eT/llb4 5u59GBzqn6FI0FYWcgB6Njkp/v/DM/rNYlA15rR/fAToxELVlIW3p39/XOYXneNbEk2z bT2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hgf9y4AIMkshlmYOELfvt5AhaFfoIIYp8wlYIov1e4M=; b=XW+8a6SjyiWRw5Czqm6gzFsRhJHfiSy4RMu9qzh48nCJEgJoPz7nuWEmLRIa1Sx53W eQwwG3RnDUzbNs02M5H2gwc4pQW748SyPiG8//hQ0ptcGf6stzKcgdjaQ02j9rIQq3dk lJR9ox6c9THvLl0/VGd4fqeIlF+FFC6irVi09s/NbsOoXGtdeOQxEikE+m5m2dlSzxoK y8Te5AP5MziilpIFhmoe10za3+Gb0MHjIxNpiotKcK8ZXzZaAPet5nkg9I0lqmJ6vWRx GSDNKJISOthFMwvXJtI3rNpwPh+yj89s/wzHXH8gms2ITrWnEzrXiuW2CzXjBvi3p0Vu 5IEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GWfQx6Bh; 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 q13si20671435pll.162.2019.05.14.10.00.15; Tue, 14 May 2019 10:00:31 -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=@kernel.org header.s=default header.b=GWfQx6Bh; 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 S1726547AbfENQ6q (ORCPT + 99 others); Tue, 14 May 2019 12:58:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:60894 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfENQ6q (ORCPT ); Tue, 14 May 2019 12:58:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4D9CF20862; Tue, 14 May 2019 16:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557853124; bh=vZrVtbCUX6dggZK1MCKb1QmhR0TnG8X/jC10a/jknoY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GWfQx6BhQXYOtHcudh8WJOkO1ZtPTYbINPokZvBCiDuqpvZaM8BbafSL5z9yQSGBJ Elkq32ligc7tetyF6G61dglAdlmJaNJe/2KCVtw6b2KBUetm2GXhAfR7eGNS+upOPe /R35Ntnpn9dI6tUlz6gIHsvS5XLKuHKVlurDj7qY= Date: Tue, 14 May 2019 18:58:42 +0200 From: Greg KH To: Roberto Sassu Cc: Andy Lutomirski , Rob Landley , Arvind Sankar , LKML , Linux API , Linux FS Devel , linux-integrity , initramfs@vger.kernel.org Subject: Re: [PATCH v2 0/3] initramfs: add support for xattrs in the initial ram disk Message-ID: <20190514165842.GC28266@kroah.com> References: <20190512194322.GA71658@rani.riverdale.lan> <3fe0e74b-19ca-6081-3afe-e05921b1bfe6@huawei.com> <4f522e28-29c8-5930-5d90-e0086b503613@landley.net> <9357cb32-3803-2a7e-4949-f9e4554c1ee9@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9357cb32-3803-2a7e-4949-f9e4554c1ee9@huawei.com> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 14, 2019 at 06:33:29PM +0200, Roberto Sassu wrote: > On 5/14/2019 5:19 PM, Andy Lutomirski wrote: > > On Mon, May 13, 2019 at 5:47 AM Roberto Sassu wrote: > > > > > > On 5/13/2019 11:07 AM, Rob Landley wrote: > > > > > > > > > > > > On 5/13/19 2:49 AM, Roberto Sassu wrote: > > > > > On 5/12/2019 9:43 PM, Arvind Sankar wrote: > > > > > > On Sun, May 12, 2019 at 05:05:48PM +0000, Rob Landley wrote: > > > > > > > On 5/12/19 7:52 AM, Mimi Zohar wrote: > > > > > > > > On Sun, 2019-05-12 at 11:17 +0200, Dominik Brodowski wrote: > > > > > > > > > On Thu, May 09, 2019 at 01:24:17PM +0200, Roberto Sassu wrote: > > > > > > > > > > This proposal consists in marshaling pathnames and xattrs in a file called > > > > > > > > > > .xattr-list. They are unmarshaled by the CPIO parser after all files have > > > > > > > > > > been extracted. > > > > > > > > > > > > > > > > > > Couldn't this parsing of the .xattr-list file and the setting of the xattrs > > > > > > > > > be done equivalently by the initramfs' /init? Why is kernel involvement > > > > > > > > > actually required here? > > > > > > > > > > > > > > > > It's too late. The /init itself should be signed and verified. > > > > > > > > > > > > > > If the initramfs cpio.gz image was signed and verified by the extractor, how is > > > > > > > the init in it _not_ verified? > > > > > > > > > > > > > > Ro > > > > > > > > > > > > Wouldn't the below work even before enforcing signatures on external > > > > > > initramfs: > > > > > > 1. Create an embedded initramfs with an /init that does the xattr > > > > > > parsing/setting. This will be verified as part of the kernel image > > > > > > signature, so no new code required. > > > > > > 2. Add a config option/boot parameter to panic the kernel if an external > > > > > > initramfs attempts to overwrite anything in the embedded initramfs. This > > > > > > prevents overwriting the embedded /init even if the external initramfs > > > > > > is unverified. > > > > > > > > > > Unfortunately, it wouldn't work. IMA is already initialized and it would > > > > > verify /init in the embedded initial ram disk. > > > > > > > > So you made broken infrastructure that's causing you problems. Sounds unfortunate. > > > > > > The idea is to be able to verify anything that is accessed, as soon as > > > rootfs is available, without distinction between embedded or external > > > initial ram disk. > > > > > > Also, requiring an embedded initramfs for xattrs would be an issue for > > > systems that use it for other purposes. > > > > > > > > > > > The only reason why > > > > > opening .xattr-list works is that IMA is not yet initialized > > > > > (late_initcall vs rootfs_initcall). > > > > > > > > Launching init before enabling ima is bad because... you didn't think of it? > > > > > > No, because /init can potentially compromise the integrity of the > > > system. > > > > I think Rob is right here. If /init was statically built into the > > kernel image, it has no more ability to compromise the kernel than > > anything else in the kernel. What's the problem here? > > Right, the measurement/signature verification of the kernel image is > sufficient. > > Now, assuming that we defer the IMA initialization until /init in the > embedded initramfs has been executed, the problem is how to handle > processes launched with the user mode helper or files directly read by > the kernel (if it can happen before /init is executed). If IMA is not > yet enabled, these operations will be performed without measurement and > signature verification. If you really care about this, don't launch any user mode helper programs (hint, you have the kernel option to control this and funnel everything into one, or no, binaries). And don't allow the kernel to read any files either, again, you have control over this. Or start IMA earlier if you need/want/care about this. thanks, greg k-h