Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1249)

Issue 6871044: Do not advance kernel version in TPM if we are in firmware B trying a new firmware (Closed)

Created:
9 years, 8 months ago by Randall Spangler
Modified:
9 years, 7 months ago
CC:
chromium-os-reviews_chromium.org
Visibility:
Public.

Description

Do not advance kernel version in TPM if we are in firmware B trying a new firmware Change-Id: If5b6390d011d743689cf96e49202358397663651 R=bleung@chromium.org,dlaurie@chromium.org,sumit@chromium.org BUG=chrome-os-partner:3367 TEST=make && make runtests Committed: http://chrome-svn/viewvc/chromeos?view=rev&revision=700fc49

Patch Set 1 #

Total comments: 1

Patch Set 2 : Don't advance kernel version in developer firmware #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -7 lines) Patch
M firmware/lib/vboot_kernel.c View 1 1 chunk +6 lines, -7 lines 3 comments Download

Messages

Total messages: 17 (0 generated)
Randall Spangler
9 years, 8 months ago (2011-04-17 17:03:44 UTC) #1
Sumit
http://codereview.chromium.org/6871044/diff/1/firmware/lib/vboot_kernel.c File firmware/lib/vboot_kernel.c (right): http://codereview.chromium.org/6871044/diff/1/firmware/lib/vboot_kernel.c#newcode600 firmware/lib/vboot_kernel.c:600: if ((kBootRecovery != boot_mode) && Do we need to ...
9 years, 8 months ago (2011-04-17 17:11:12 UTC) #2
Randall Spangler
Good point. We added the developer check to protect root shell users back when developer ...
9 years, 8 months ago (2011-04-17 17:17:22 UTC) #3
Sumit
LGTM This seems reasonable to be. There might be other places where we are using ...
9 years, 8 months ago (2011-04-17 17:35:06 UTC) #4
Benson Leung
On 2011/04/17 17:35:06, Sumit wrote: > LGTM > > This seems reasonable to be. There ...
9 years, 8 months ago (2011-04-17 17:38:49 UTC) #5
Duncan Laurie
LGTM The other uses of dev mode look ok to me.
9 years, 8 months ago (2011-04-17 17:47:27 UTC) #6
Will Drewry
Drive-by LGTM with some questions for future clarity. http://codereview.chromium.org/6871044/diff/3002/firmware/lib/vboot_kernel.c File firmware/lib/vboot_kernel.c (right): http://codereview.chromium.org/6871044/diff/3002/firmware/lib/vboot_kernel.c#newcode601 firmware/lib/vboot_kernel.c:601: !((1 ...
9 years, 8 months ago (2011-04-17 17:53:18 UTC) #7
Will Drewry
On further offline discussion, it makes sense that a new firmware volume may have a ...
9 years, 8 months ago (2011-04-17 18:03:59 UTC) #8
gauravsh
http://codereview.chromium.org/6871044/diff/3002/firmware/lib/vboot_kernel.c File firmware/lib/vboot_kernel.c (right): http://codereview.chromium.org/6871044/diff/3002/firmware/lib/vboot_kernel.c#newcode607 firmware/lib/vboot_kernel.c:607: if ((lowest_version > tpm_version) && Belated comment: I'd really ...
9 years, 8 months ago (2011-04-17 19:32:24 UTC) #9
sumitg
On Sun, Apr 17, 2011 at 12:32 PM, <gauravsh@chromium.org> wrote: > > > http://codereview.chromium.org/6871044/diff/3002/firmware/lib/vboot_kernel.c > ...
9 years, 8 months ago (2011-04-17 19:49:16 UTC) #10
Randall
On Sun, Apr 17, 2011 at 12:49 PM, Sumit Gwalani <sumitg@google.com> wrote: > > > ...
9 years, 8 months ago (2011-04-17 19:53:01 UTC) #11
gauravsh
On 2011/04/17 19:53:01, Randall wrote: > On Sun, Apr 17, 2011 at 12:49 PM, Sumit ...
9 years, 8 months ago (2011-04-17 22:15:28 UTC) #12
Randall
On Sun, Apr 17, 2011 at 3:15 PM, <gauravsh@chromium.org> wrote: > On 2011/04/17 19:53:01, Randall ...
9 years, 8 months ago (2011-04-18 00:03:14 UTC) #13
gauravsh
On Sun, Apr 17, 2011 at 5:03 PM, Randall Spangler <rspangler@google.com>wrote: > > > On ...
9 years, 8 months ago (2011-04-18 00:19:10 UTC) #14
Randall
On Sun, Apr 17, 2011 at 5:19 PM, Gaurav Shah <gauravsh@chromium.org> wrote: > On Sun, ...
9 years, 8 months ago (2011-04-18 00:59:22 UTC) #15
gauravsh
On Sun, Apr 17, 2011 at 5:59 PM, Randall Spangler <rspangler@google.com>wrote: > > > On ...
9 years, 8 months ago (2011-04-18 05:20:40 UTC) #16
Sonny
9 years, 8 months ago (2011-04-18 06:48:54 UTC) #17
Why do we have a third kernel partition anyway? Seems like there's some risk in
having something like that which isn't really used in normal operation
from a security standpoint.

Sonny

On Sun, Apr 17, 2011 at 10:20 PM, Gaurav Shah <gauravsh@chromium.org> wrote:
> On Sun, Apr 17, 2011 at 5:59 PM, Randall Spangler <rspangler@google.com>
> wrote:
>>
>>
>> On Sun, Apr 17, 2011 at 5:19 PM, Gaurav Shah <gauravsh@chromium.org>
>> wrote:
>>>
>>> On Sun, Apr 17, 2011 at 5:03 PM, Randall Spangler <rspangler@google.com>
>>> wrote:
>>>>
>>>>
>>>> On Sun, Apr 17, 2011 at 3:15 PM, <gauravsh@chromium.org> wrote:
>>>>>
>>>>> On 2011/04/17 19:53:01, Randall wrote:
>>>>>>
>>>>>> On Sun, Apr 17, 2011 at 12:49 PM, Sumit Gwalani
>>>>>> <mailto:sumitg@google.com>
>>>>>
>>>>> wrote:
>>>>>
>>>>>> >
>>>>>> >
>>>>>> > On Sun, Apr 17, 2011 at 12:32 PM, <mailto:gauravsh@chromium.org>
>>>>>> > wrote:
>>>>>> >
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>
>>>>>
>>>>>
http://codereview.chromium.org/6871044/diff/3002/firmware/lib/vboot_kernel.c
>>>>>>
>>>>>> >> File firmware/lib/vboot_kernel.c (right):
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>
>>>>>
>>>>>
http://codereview.chromium.org/6871044/diff/3002/firmware/lib/vboot_kernel.c#...
>>>>>>
>>>>>> >> firmware/lib/vboot_kernel.c:607: if ((lowest_version > tpm_version)
>>>>>> >> &&
>>>>>> >> Belated comment: I'd really like to see a check for the following
>>>>>> >> invariant: lowest_version is not valid until it has been compared
>>>>>> >> to
>>>>>> >> both kernel versions. It is not written until it is valid.
>>>>>> >>
>>>>>> >>
>>>>>> > +1 on this
>>>>>> >
>>>>>
>>>>>> By "both" do you mean "/dev/sda2 and /dev/sda4"?  Or "all kernels"?
>>>>>
>>>>> All kernels, of which we only have 2 right now. Basically, my point is
>>>>> that
>>>>> unless there is a good reason to do so, we should have a sanity check
>>>>> just
>>>>> before rollback versions are committed that ensures that
>>>>> lowest_versions really
>>>>> captures the state of all the kernels irrespective of whether or not
>>>>> they failed
>>>>> other checks or are invalid for other reasons.
>>>>
>>>> Doesn't that mean if an attacker puts a kernel preamble in /dev/sda6
>>>> with a key value of 0x00010001, we'll never advance the kernel version in
>>>> the TPM?
>>>
>>> I guess it depends on what is the 3rd kernel meant for? Is it ever meant
>>> to contain an "official" kernel to boot from? If not, then we don't care
>>> what the 3rd kernel says and it is ignored.
>>
>> That was why I'd asked if we're making /dev/sda2 and /dev/sda4 special to
>> the firmware.  We'd need to add checks to see if we've seen good kernels in
>> SSD partitions 2 and 4.  If no, don't update the TPM.
>> The firmware could still boot from any partition, but would never update
>> the TPM unless partitions 2 and 4 are both valid AND bootable (that is, they
>> have a valid preamble signed with the current kernel subkey, non-zero
>> priority, and either (tries>0 or success=1).
>> It's doable; it just means that SSD partition layout would be locked by
>> compatibility with the firmware.  If we later want to change the partition
>> layout - for example, to reorder the partitions, or to add a 3rd kernel as a
>> backup for the current kernel during AU - we'd need to rev the firmware.
>
> That is reasonable. We need a firmware update for kernel key changes anyway.
> So a firmware update for supporting the 3rd kernel partition in the future
> doesn't seem like that much of big deal.
>>
>> - Randall
>>
>>>
>>> The AU client is meant to overwrite the old copy of the kernel once we
>>> are sure that the new kernel is good and bootable. TPM finalization should
>>> not happen until we have reached that stable state.
>>>
>>>>
>>>>
>>>>>
>>>>> Of course, we will only ever commit a version for a kernel that
>>>>> actually
>>>>> verifies. The existing checks already do that.
>>>>>
>>>>> If there are some other considerations or special cases due to which
>>>>> this will
>>>>> not work or is an invalid heuristic, we can discuss it offline.
>>>>>
>>>>> My worry is that the state matrix with tries and other flags, and the
>>>>> combination of multiple firmwares and kernels is complex. So it is
>>>>> rather tricky
>>>>> to get all the code paths exactly right - adding sanity checking
>>>>> heuristics,
>>>>> however explicit, to avoid transitioning to a bad states would be
>>>>> useful. Things
>>>>> like - don't commit version changes if we are in dev mode (which you
>>>>> added), are
>>>>> examples of one such heuristic.
>>>>>
>>>>>
>>>>>> That is, does the firmware now need specific knowledge that /dev/sda2
>>>>>> and
>>>>>> /dev/sda4 are special?  Currently, it treats all kernels equally.
>>>>>
>>>>>> Thanks,
>>>>>>    Randall
>>>>>
>>>>>
>>>>>> >
>>>>>> > Is there any situation where the invariant won't be true?
>>>>>> >>
>>>>>> >> This should, hopefully, catch other code paths where we can run
>>>>>> >> into bad
>>>>>> >> situations.
>>>>>> >>
>>>>>> >>
>>>>>> >> http://codereview.chromium.org/6871044/
>>>>>> >>
>>>>>> >
>>>>>> >
>>>>>
>>>>>
>>>>>
>>>>> http://codereview.chromium.org/6871044/
>>>>
>>>
>>>
>>>
>>> --
>>> -g
>>
>
>
>
> --
> -g
>

Powered by Google App Engine
This is Rietveld 408576698