linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko@kernel.org>
To: Mimi Zohar <zohar@linux.ibm.com>
Cc: Evan Green <evgreen@chromium.org>,
	Matthew Garrett <mgarrett@aurora.tech>,
	Ken Goldman <kgold@linux.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Daniil Lunev <dlunev@google.com>,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	linux-integrity@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Gwendal Grignou <gwendal@chromium.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	"Rafael J. Wysocki" <rafael@kernel.org>
Subject: Re: TPM: hibernate with IMA PCR 10
Date: Tue, 20 Sep 2022 07:36:49 +0300	[thread overview]
Message-ID: <YylDYU+KTX/KJpqU@kernel.org> (raw)
In-Reply-To: <96cfd1f3f084f6d145bd22e0989dc046fe15b66a.camel@linux.ibm.com>

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 <jarkko@kernel.org> 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 <kgold@linux.ibm.com> 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


  reply	other threads:[~2022-09-20  4:37 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-04 23:20 [PATCH 00/10] Encrypted Hibernation Evan Green
2022-05-04 23:20 ` [PATCH 01/10] tpm: Add support for in-kernel resetting of PCRs Evan Green
2022-05-04 23:20 ` [PATCH 02/10] tpm: Allow PCR 23 to be restricted to kernel-only use Evan Green
2022-05-04 23:20 ` [PATCH 03/10] security: keys: trusted: Parse out individual components of the key blob Evan Green
2022-05-04 23:20 ` [PATCH 04/10] security: keys: trusted: Allow storage of PCR values in creation data Evan Green
2022-08-02 23:00   ` Eric Biggers
2022-08-03 20:48     ` Evan Green
2022-05-04 23:20 ` [PATCH 05/10] security: keys: trusted: Verify " Evan Green
2022-05-04 23:20 ` [PATCH 06/10] PM: hibernate: Add kernel-based encryption Evan Green
2022-08-29 21:45   ` TPM: hibernate with IMA PCR 10 Ken Goldman
2022-08-29 21:51     ` Matthew Garrett
2022-08-31  2:48       ` Jarkko Sakkinen
2022-09-07 20:47         ` Evan Green
2022-09-07 23:57           ` Mimi Zohar
2022-09-08  5:25             ` Jarkko Sakkinen
2022-09-11  2:40               ` Mimi Zohar
2022-09-20  4:36                 ` Jarkko Sakkinen [this message]
2022-09-21 20:15                   ` Mimi Zohar
2022-09-23 13:30                     ` Jarkko Sakkinen
2022-09-27 16:03                       ` Evan Green
2022-09-28  9:42                         ` Jonathan McDowell
2022-05-04 23:20 ` [PATCH 07/10] PM: hibernate: Use TPM-backed keys to encrypt image Evan Green
2022-05-04 23:21 ` [PATCH 08/10] PM: hibernate: Mix user key in encrypted hibernate Evan Green
2022-05-06 16:08   ` Pavel Machek
2022-05-09 16:44     ` Evan Green
2022-05-10 12:29       ` Pavel Machek
2022-05-10 16:02         ` Evan Green
2022-08-02 22:48   ` Eric Biggers
2022-08-03 20:48     ` Evan Green
2022-05-04 23:21 ` [PATCH 09/10] PM: hibernate: Verify the digest encryption key Evan Green
2022-08-02 22:51   ` Eric Biggers
2022-05-04 23:21 ` [PATCH 10/10] PM: hibernate: seal the encryption key with a PCR policy Evan Green
2022-05-06 16:08 ` [PATCH 00/10] Encrypted Hibernation Pavel Machek
2022-05-09 16:43   ` Evan Green
2022-05-17 16:06     ` Rafael J. Wysocki
2022-05-17 17:34       ` Evan Green
2022-06-16 15:42         ` Evan Green
2022-08-01 22:32           ` Evan Green
2022-08-02 18:36             ` Matthew Garrett
2022-08-04  0:59               ` Jarkko Sakkinen
2022-08-04 21:55                 ` Evan Green
2022-08-06 18:21                   ` Jarkko Sakkinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YylDYU+KTX/KJpqU@kernel.org \
    --to=jarkko@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dlunev@google.com \
    --cc=evgreen@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=jejb@linux.ibm.com \
    --cc=kgold@linux.ibm.com \
    --cc=len.brown@intel.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mgarrett@aurora.tech \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).