Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6960089yba; Tue, 14 May 2019 17:27:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6YeoF6G+b2jJMMMe/JTQxKeksBahkgkECbOALCGtH3aqOb45lJPU2gP/e1WuDwJHdZeoh X-Received: by 2002:a63:8f09:: with SMTP id n9mr12693770pgd.249.1557880048164; Tue, 14 May 2019 17:27:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557880048; cv=none; d=google.com; s=arc-20160816; b=Wvq3QoLzpMkxjY9ly0Q+XQqxbBxp4mcbX/lfOdSNxNFcnCQGIAZFfnzbA84lg8nOnK iAWogjlyhyokWsFMk51PI6UNT1zKqPVuf7oVCT+Gz3gk5faWNgpDetWqWJBtreV1XDG0 NenfPEOp5c5qy+dEIV4L1hrarTZb9DBNIA0qVSuosAp2QIlOSxXhGQS/BbU6mmPwkoU0 H3mJNKKMvy6em3D+WSsrPSIlB57o7zXOCQmBw/CHi5/lqzp1pOLeoKD5w7D2q7UcATZu ouhv5rDCkpHSBmvuFnsCU1l6a2SaQmczGWymz8rso+L3luy12tZsRsXt3Dn6fPW+hi6i X+dw== 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:date:from:dkim-signature; bh=xbEZhhiTM5wPNpwedpHvuoXmY8IRI4IkCvFgEMZLO20=; b=mAmFiasFonARoE9DjPD9ZCKa6WWNpkba+lAIJdY3txBE1Hi/uht50dKB2awrM8yKXc 25juGfyE4arrzdbmnniVCdbVjqtGzrFc0w01jdOQeYqpDxsalbDlOOH71dK77LGqZGuk yfE+yG8P1Xalkzna+A3fHF14APVjnCtAdGU2weqneZYcZwa1TjEhbO4OnDsNn+pcP/rO vMjpZpP1o5Sd1ACyjrqpghTSs9XzTCi9AqnmXITuKNFhCPK7Xnc6w5riUns/lUkiLY22 uH7BwvyLwkT5wxZehLQjjHHglIOxaw0g8a6mOieq6ODkPOMqoiDQhx1PWl7osNowuVh/ Bnhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=n8yIZHng; 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 n63si336806pgn.511.2019.05.14.17.27.13; Tue, 14 May 2019 17:27:28 -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=fail header.i=@gmail.com header.s=20161025 header.b=n8yIZHng; 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 S1726272AbfEOA0B (ORCPT + 99 others); Tue, 14 May 2019 20:26:01 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:44890 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbfEOA0A (ORCPT ); Tue, 14 May 2019 20:26:00 -0400 Received: by mail-qt1-f194.google.com with SMTP id f24so1265195qtk.11; Tue, 14 May 2019 17:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xbEZhhiTM5wPNpwedpHvuoXmY8IRI4IkCvFgEMZLO20=; b=n8yIZHnglVsiT8HXDCM669WIA0nw/n9iXppL/q3GzyAOYP9Y4q7SzKD4rxVRcCTqcJ CZK+uGoT1Dt2X04VI/OkFE1HiFZUVbrQDK7lZBrx7SZ0kG6FfxdH5SYNqBEu7/LCVAg5 +wnmct38kudlNt8EOeaiJB1ihdceeI5u5UKfjcdTjKr7WjAVWrhjfgGpDkBoEDPlPNxP nN3hCl5OPu60Nm1KkdBCo5oIw9KNmw5juEsTFnZjLRfWoAYOO+Cqjeg0DvN6J8Sdzruc CeSKNPwMYtjTsDMu73uP2YdKS5s+gjziyao3h2D+c3MenoM8YaQuJdHIJizEMifYAvq3 qTfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:date:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=xbEZhhiTM5wPNpwedpHvuoXmY8IRI4IkCvFgEMZLO20=; b=qZAP8MEJPmsS/NVsnB10MnLhzBVLCXJi0o+6ArdtsmFMKnMlMkVPtpchJ12pilaQTX A5wiuTADWdBNWKp4ZECy2BsF82l3K31yabBwSKxCg34AubcUuXV79qw4sF1X1cjwsAL/ cb9lRI45+RTdoJcCMCdi6x9QoPMJAedLInYOYOPsfTX0WtMJF7Nd+ersbHRoLMWRPfTf da5kJHNqrcarMUQFzLZVHhrKa7t8xbYg5HllnetbqDygC2cp1+rA5XxbRfJEZ1Phtl4t 3LVrJoNeO0BP9Q23NZ///Meufg2WFSX5ApKnnR/XYjcUNErId0HRuwv8ZDFddoiFJP0a fmKg== X-Gm-Message-State: APjAAAVJ9H1QjgjI48E5gSsIvm3UzyWu2wrmi839ism419vu4KKytWnm ixk6g8NiUojVbSVErmkLMKs= X-Received: by 2002:ac8:34b7:: with SMTP id w52mr32652097qtb.11.1557879959377; Tue, 14 May 2019 17:25:59 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id l12sm398385qta.82.2019.05.14.17.25.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 May 2019 17:25:58 -0700 (PDT) From: Arvind Sankar X-Google-Original-From: Arvind Sankar Date: Tue, 14 May 2019 20:25:57 -0400 To: Roberto Sassu Cc: Greg KH , 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: <20190515002556.GA88615@rani.riverdale.lan> 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> <20190514165842.GC28266@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-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 07:20:15PM +0200, Roberto Sassu wrote: > On 5/14/2019 6:58 PM, Greg KH wrote: > > On Tue, May 14, 2019 at 06:33:29PM +0200, Roberto Sassu wrote: > >> 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. > > Yes, this is how it works now. It couldn't start earlier than > late_initcall, as it has to wait until the TPM driver is initialized. > > Anyway, it is enabled at the time /init is executed. And this would be > an issue because launching /init and reading xattrs from /.xattr-list > would be denied (the signature is missing). > > And /.xattr-list won't have a signature, if initramfs is generated > locally. > > Roberto > > -- > HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 > Managing Director: Bo PENG, Jian LI, Yanli SHI The uevent and firmware loader user mode helpers are both obsolete I believe, so those shouldn't be an issue. There is still the internal firmware loader (CONFIG_FW_LOADER). If this is built-in, there's probably no way to 100% stop it racing with /init if we depend on an embedded /init and a malicious external initramfs image contains /lib/firmware, but it can be built as an external module, in which case there should be no danger until the boot process actually loads it.