Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3424308rwb; Mon, 19 Sep 2022 22:15:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6mMCrZAW4qrOtOWcL3LwgbTaJ8fURp/FeioQHOdqxJLsffRr0b4saI882tpTi0uby6D/ds X-Received: by 2002:a17:90b:4b03:b0:202:a7e1:2c9a with SMTP id lx3-20020a17090b4b0300b00202a7e12c9amr1880452pjb.195.1663650901869; Mon, 19 Sep 2022 22:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663650901; cv=none; d=google.com; s=arc-20160816; b=wkTU9i8b/hQKiv4MmmtWuTGSax1qcfjUKv6rzTHIv4y/fkBPfW7fANS8W3AV2Heeqw t4qM5LmSIKsUJhjACC1gt6jv65IApzLURyd1qvdwzJlSjMBlbQ6ozj1A+CSXy1jGgw3u 9VYIuLUjhj6CXZtukitN8VlIdNW1v6rj0O9kLRASm6bu4EoaPyDJh/1rnejk4KU92TpN kDUWWvWcIRUugad8rE1/VQcSHnYAa6bdWW/8YBA54AsOh5sURhHwKEULFEkpVvDuSDXh C1bYGookEnHEWinp94QGLso1gDqN2QaViuHz5E2a7yn9VZCD+v+nBhVCD9wOUEebePoY aeTg== 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=Zx0wjnne6w7b9gZvPyI641Sg/bj7y01X9RhJYm2Z1u0=; b=Pl3sd+Kp9Q1kqnr2cxRWpd+HOF51K988IdA9XCkiVa6H5WYuMX8ZcLruY/DlkyQkk8 xQMAXkMBiXsAnxVIVetjfIQpwLGfDErZN1JVLyGHMNGlUOZAfQCCzxMLHxUqmo+dbNsF VxFtXzLcQqsII3hl41uOsY/mCEC8QR8c8Yw3Gc60i8RDAQiuJXlkuChsY+RMGmZQxZwf m9VIPkvYDln/5/4fDvYv12RsGlqy0glYeQLLtNdNpZ464ppSpUNPgONJEXTKISr8636T 23WCgRhxrnrssQ2kPnMUcFd+qkwGCXJyF4AkjzMpFflt58sKGJNiiWjDtS1LNIPVSoNz jRhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HufNmGLX; 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 a5-20020a17090a480500b0020305a31cb9si13144699pjh.84.2022.09.19.22.14.50; Mon, 19 Sep 2022 22:15:01 -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=HufNmGLX; 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 S229760AbiITEhD (ORCPT + 99 others); Tue, 20 Sep 2022 00:37:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbiITEhB (ORCPT ); Tue, 20 Sep 2022 00:37:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30A7A4B0DB; Mon, 19 Sep 2022 21:37:00 -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 ams.source.kernel.org (Postfix) with ESMTPS id E757DB82460; Tue, 20 Sep 2022 04:36:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29B77C433D7; Tue, 20 Sep 2022 04:36:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663648617; bh=SprS5l+6cj+tby4G6xsjKmuaVZo5eaK1B+EgbbCG/Q8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HufNmGLXLG5l4zZgX54JuT3OO5DVsUmGo0twf1HUi8dKTqmO3nTNwxOTdIhF/n8zP NbhxnQR+Scdt6Qmi5J8rzy4kjDuMca1GtkefC86o8Na+wZ46rDRt5el+TjZmgjxsiW 6qI69y/7ywzI4+Evqfou50T/Pg/FtjdleMYeREcN7eFZI4/juLBghUFeysr7ocqQwf S+28eLhPWfduK7iWYmThn7MeIFdEjcHmvOu8MQ0MDvIjSefcqxrl80tUQtMthcxmHR +080LONoXmj9maxTXK1PU28/JxHgKgStdfX/arH9rdgOIGHQdum3G2VTvhXvv908HR Zl96BrELNiMlg== Date: Tue, 20 Sep 2022 07:36:49 +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: <20220504232102.469959-1-evgreen@chromium.org> <20220504161439.6.Ifff11e11797a1bde0297577ecb2f7ebb3f9e2b04@changeid> <96360ec16b21d8b37461a5de083ff794f3604300.camel@linux.ibm.com> <96cfd1f3f084f6d145bd22e0989dc046fe15b66a.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <96cfd1f3f084f6d145bd22e0989dc046fe15b66a.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 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. BR, Jarkko