[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <202209232130.ED110D8F7D@keescook>
Date: Fri, 23 Sep 2022 21:31:56 -0700
From: Kees Cook <keescook@...omium.org>
To: Evan Green <evgreen@...omium.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Gwendal Grignou <gwendal@...omium.org>,
Eric Biggers <ebiggers@...nel.org>,
Matthew Garrett <mgarrett@...ora.tech>,
Jarkko Sakkinen <jarkko@...nel.org>,
Mimi Zohar <zohar@...ux.ibm.com>,
linux-integrity@...r.kernel.org, Pavel Machek <pavel@....cz>,
apronin@...omium.org, Daniil Lunev <dlunev@...gle.com>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Linux PM <linux-pm@...r.kernel.org>,
Jonathan Corbet <corbet@....net>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Len Brown <len.brown@...el.com>,
"Rafael J. Wysocki" <rafael@...nel.org>
Subject: Re: [PATCH v2 07/10] PM: hibernate: Use TPM-backed keys to encrypt
image
On Fri, Sep 23, 2022 at 03:23:43PM -0700, Evan Green wrote:
> On Tue, Sep 20, 2022 at 4:16 PM Kees Cook <keescook@...omium.org> wrote:
> > On Tue, Aug 23, 2022 at 03:25:23PM -0700, Evan Green wrote:
> > > [...]
> > > + ret = key_instantiate_and_link(key, keyinfo, strlen(keyinfo) + 1, NULL,
> > > + NULL);
> >
> > You want to keep the trailing NUL byte here so it's easier to read back
> > later? Reading it back will need to verify the trailing NUL regardless.
> > (Does this get read back?)
>
> Are you referring to the trailing nul on keyinfo? The keyinfo string
> is only used within this function, as key_instantiate_and_link()
> receives it as a parameter string. I can see that
> trusted_instantiate() also null-terminates the buffer defensively for
> itself, but it still seemed prudent to hand in a terminated string. I
> can remove the + 1 if you think it's better.
No, I like having the trailing NUL byte -- it seems more robust that
way. I just wanted to understand who the consumer was going to be. I'm
clear now; thank you! :)
--
Kees Cook
Powered by blists - more mailing lists