Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1030518rwb; Fri, 23 Sep 2022 07:22:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6V28aQulMpJ7Zg0en8xnt+XeBfvxkOla8rWzestGU25RtxiM8msgB3zH0jgJsAG119Mtbg X-Received: by 2002:a05:6402:14cb:b0:452:f1b4:7e52 with SMTP id f11-20020a05640214cb00b00452f1b47e52mr8476242edx.177.1663942977948; Fri, 23 Sep 2022 07:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663942977; cv=none; d=google.com; s=arc-20160816; b=yq4k1FUR9/JtOr/QSZDq9+HI09lm4txJJkMcZJdd81T8KW5snXPKHECto7A1xQx4oH uiozxQ9E2Fj3CHyFnMMD4rz8RV8HWyjNhc5fpqlkfKr/Iurs4Er0OjWu/8ZPyP8OuFM8 gEW/278cxXcRtDrHaQlymgTGsFe3VLku9w7oN6B9COMoNE/2NJ3/NWIZ1O52N2oZrgsi 44Xvn6sxdZ/5c3NUETGz0THkG8p9tNhmnyiOZz+227+ECiABr1K6AP8YoUUOTg9NVey5 UYBtRWX6aKLgX4BWtak94erT5ROYC7+5yn7B20lVAKXsj4POtUBOAVrxsfeijZfQDA5r jeqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mo6wHiNGstnQSb5EFdF+2rm8eevR9NKWX1RLpOcxZLQ=; b=GwC07/0RIMYxM+idLU/OGNSnMPYtaEEhjm6J4pBgZeE3zNHBe7B13RHki/m07ZZxgD w2V4abx0vQT+PGUP+IzXr2DrXUdlFp/cNd5lDwgU0167FN8IhOiLlVpfyaosOXTYFmJd xUroOZHUrjXe3jmhB2AvkwT3F1zgYxd9M04n0LYq515O73laa4NFvOfbYzKqEAfk/2ks d6DoyLX6hPMLO3VUTGgxQEYcmUs/J+DREQaojrnriZdmw725yrB6XMlFFoDeezT/EUWx wjtHcBUSAFxNj/3oJJBjfJVLxnhWYg8dzhjsVxSxYV8PwID26sHAaX0XIDVUkbWmIEOc rCYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TB2uLYC0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a056402520900b0044eb3af536bsi9913514edd.160.2022.09.23.07.22.30; Fri, 23 Sep 2022 07:22:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TB2uLYC0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229507AbiIWNbE (ORCPT + 99 others); Fri, 23 Sep 2022 09:31:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230076AbiIWNay (ORCPT ); Fri, 23 Sep 2022 09:30:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1E22E6DE9; Fri, 23 Sep 2022 06:30:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7F4FD62510; Fri, 23 Sep 2022 13:30:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6481AC433D6; Fri, 23 Sep 2022 13:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663939851; bh=l1JlluurWiwvkKH7l5/tNNLVpHEQly8opDz1dsRJSOo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TB2uLYC0uWJqGmCUafRtEj3CAiR5CnJiMB8w1NeQkeoHgEHqP4OJSUMGbgzYSqwO5 8TNpqzkzimHavz8/puunVuqIGDKx5UmmX6UCMlpDOO2wAJMKp0+eKgdlaAdAxHpeFp foSM3FT9zvDgoCxL4DTMddeQ+W1J2Ncya5pastOM+lGnRQl84Xfrl9VNCFemqaP5bm RRrhmGijiYJ3/Z1Yc8Rh+2UtbgP+IGSbESZVkhwOuT3fOWN0zLNLx1zs/msuBmMbVq Ra0s/Jg/4XvF+oSrV9qxB3UrlTpuQ0mBAg1cGbEn7rOSCLyi2WSZAlPZhgfsxbc1Jx ytbGFRjQTJjeA== Date: Fri, 23 Sep 2022 16:30:47 +0300 From: Jarkko Sakkinen To: Mimi Zohar Cc: Evan Green , Matthew Garrett , Ken Goldman , LKML , Daniil Lunev , "James E.J. Bottomley" , linux-integrity@vger.kernel.org, Jonathan Corbet , "Rafael J. Wysocki" , Gwendal Grignou , Linux PM , Len Brown , Pavel Machek , "Rafael J. Wysocki" Subject: Re: TPM: hibernate with IMA PCR 10 Message-ID: References: <20220504161439.6.Ifff11e11797a1bde0297577ecb2f7ebb3f9e2b04@changeid> <96360ec16b21d8b37461a5de083ff794f3604300.camel@linux.ibm.com> <96cfd1f3f084f6d145bd22e0989dc046fe15b66a.camel@linux.ibm.com> <2bc656bf67af52e0b9a68e91c5b574e0ab4ffa8e.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2bc656bf67af52e0b9a68e91c5b574e0ab4ffa8e.camel@linux.ibm.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 21, 2022 at 04:15:20PM -0400, Mimi Zohar wrote: > On Tue, 2022-09-20 at 07:36 +0300, Jarkko Sakkinen wrote: > > On Sat, Sep 10, 2022 at 10:40:05PM -0400, Mimi Zohar wrote: > > > On Thu, 2022-09-08 at 08:25 +0300, Jarkko Sakkinen wrote: > > > > On Wed, Sep 07, 2022 at 07:57:27PM -0400, Mimi Zohar wrote: > > > > > On Wed, 2022-09-07 at 13:47 -0700, Evan Green wrote: > > > > > > On Tue, Aug 30, 2022 at 7:48 PM Jarkko Sakkinen wrote: > > > > > > > > > > > > > > On Mon, Aug 29, 2022 at 02:51:50PM -0700, Matthew Garrett wrote: > > > > > > > > On Mon, Aug 29, 2022 at 2:45 PM Ken Goldman wrote: > > > > > > > > > > > > > > > > > > On 5/4/2022 7:20 PM, Evan Green wrote: > > > > > > > > > > Enabling the kernel to be able to do encryption and integrity checks on > > > > > > > > > > the hibernate image prevents a malicious userspace from escalating to > > > > > > > > > > kernel execution via hibernation resume. [snip] > > > > > > > > > > > > > > > > > > I have a related question. > > > > > > > > > > > > > > > > > > When a TPM powers up from hibernation, PCR 10 is reset. When a > > > > > > > > > hibernate image is restored: > > > > > > > > > > > > > > > > > > 1. Is there a design for how PCR 10 is restored? > > > > > > > > > > > > > > > > I don't see anything that does that at present. > > > > > > > > > > > > > > > > > 2. How are /sys/kernel/security/ima/[pseudofiles] saved and > > > > > > > > > restored? > > > > > > > > > > > > > > > > They're part of the running kernel state, so should re-appear without > > > > > > > > any special casing. However, in the absence of anything repopulating > > > > > > > > PCR 10, they'll no longer match the in-TPM value. > > > > > > > > > > > > > > This feature could still be supported, if IMA is disabled > > > > > > > in the kernel configuration, which I see a non-issue as > > > > > > > long as config flag checks are there. > > > > > > > > > > > > Right, from what I understand about IMA, the TPM's PCR getting out of > > > > > > sync with the in-kernel measurement list across a hibernate (because > > > > > > TPM is reset) or kexec() (because in-memory list gets reset) is > > > > > > already a problem. This series doesn't really address that, in that it > > > > > > doesn't really make that situation better or worse. > > > > > > > > > > For kexec, the PCRs are not reset, so the IMA measurment list needs to > > > > > be carried across kexec and restored. This is now being done on most > > > > > architectures. Afterwards, the IMA measurement list does match the > > > > > PCRs. > > > > > > > > > > Hibernation introduces a different situation, where the the PCRs are > > > > > reset, but the measurement list is restored, resulting in their not > > > > > matching. > > > > > > > > As I said earlier the feature still can be supported if > > > > kernel does not use IMA but obviously needs to be flagged. > > > > > > Jumping to the conclusion that "hibernate" is acceptable for non-IMA > > > enabled kernels misses the security implications of mixing (kexec) non- > > > IMA and IMA enabled kernels. > > > I would prefer some sort of hibernate marker, the equivalent of a > > > "boot_aggregate" record. > > > > Not sure if this matters. If you run a kernel, which is not aware > > of IMA, it's your choice. I don't undestand why here is so important > > to protect user from doing illogical decisions. > > > > If you want non-IMA kernels to support IMA, CONFIG_IMA should not > > probably even exist because you are essentially saying that any > > kernel play well with IMA. > > That will never happen, nor am I suggesting it should. > > Enabling hibernate or IMA shouldn't be an either-or decision, if at all > possible. The main concern is that attestation servers be able to > detect hibernation and possibly the loss of measurement > history. Luckily, although the PCRs are reset, the TPM > pcrUpdateCounter is not. > > I would appreciate including a "hibernate" marker, similar to the > "boot_aggregate". Yeah, I guess that would not do harm. BR, Jarkko