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

Issue 1241002: VBoot Reference: Add version checking to for preventing rollbacks. (Closed)

Created:
10 years, 9 months ago by gauravsh
Modified:
9 years, 6 months ago
CC:
chromium-os-reviews_chromium.org, gauravsh
Visibility:
Public.

Description

VBoot Reference: Add version checking to for preventing rollbacks. This CL adds a new function VerifyFirmwareDriver_f() means to be a part of the RO firmware which determine which copy of the firmware to boot from. It is meant to ensure that a particular firmware is only booted if 1) it verifies successfully, 2) its version is newer or equal to current stored version. In addition, the driver function also updates the stored version if needed. Currently I am using the TLCL API with stub calls, (in fact, most of the TPM interaction is done in rollback_index.c which implements the actual version query/update API) used by the firmware.

Patch Set 1 #

Total comments: 42

Patch Set 2 : Add tests. Review fixes. #

Total comments: 1

Patch Set 3 : Review fixes. #

Patch Set 4 : Move common functions to test_common.c #

Total comments: 15

Patch Set 5 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+726 lines, -82 lines) Patch
M src/platform/vboot_reference/common/Makefile View 1 chunk +2 lines, -2 lines 0 comments Download
A src/platform/vboot_reference/common/tlcl_stub.c View 1 1 chunk +28 lines, -0 lines 0 comments Download
M src/platform/vboot_reference/include/firmware_image.h View 1 2 3 chunks +27 lines, -2 lines 0 comments Download
A src/platform/vboot_reference/include/rollback_index.h View 1 chunk +36 lines, -0 lines 0 comments Download
M src/platform/vboot_reference/include/utility.h View 1 1 chunk +8 lines, -0 lines 0 comments Download
M src/platform/vboot_reference/tests/Makefile View 1 2 3 2 chunks +31 lines, -20 lines 0 comments Download
M src/platform/vboot_reference/tests/firmware_image_tests.c View 2 3 4 8 chunks +39 lines, -29 lines 0 comments Download
A src/platform/vboot_reference/tests/firmware_rollback_tests.c View 2 3 4 1 chunk +145 lines, -0 lines 0 comments Download
A src/platform/vboot_reference/tests/rollback_index_mock.c View 1 chunk +61 lines, -0 lines 0 comments Download
A src/platform/vboot_reference/tests/test_common.h View 1 chunk +13 lines, -0 lines 0 comments Download
A src/platform/vboot_reference/tests/test_common.c View 1 chunk +30 lines, -0 lines 0 comments Download
M src/platform/vboot_reference/utils/Makefile View 1 2 chunks +10 lines, -8 lines 0 comments Download
M src/platform/vboot_reference/utils/firmware_image.c View 1 2 12 chunks +148 lines, -21 lines 0 comments Download
A src/platform/vboot_reference/utils/rollback_index.c View 1 1 chunk +148 lines, -0 lines 0 comments Download

Messages

Total messages: 15 (0 generated)
gauravsh
Sending this out now to get some initial feedback. Randall: have a look at VerifyFirmwareDriver_f() ...
10 years, 9 months ago (2010-03-23 23:41:48 UTC) #1
gauravsh
10 years, 9 months ago (2010-03-23 23:42:37 UTC) #2
gauravsh
To be clear, you should review it Luigi. Randall should look at the VerifyFirmwareDriver_f() function.
10 years, 9 months ago (2010-03-23 23:43:48 UTC) #3
Luigi Semenzato
Thanks for the clarification! On Tue, Mar 23, 2010 at 4:43 PM, <gauravsh@chromium.org> wrote: > ...
10 years, 9 months ago (2010-03-24 00:20:25 UTC) #4
Luigi Semenzato
Gaurav, looks good. Most comments are nit. There are a couple of slightly more substantive ...
10 years, 9 months ago (2010-03-24 03:34:47 UTC) #5
Luigi Semenzato
I forgot to mention: another reason to minimize the number of locking operations is that ...
10 years, 9 months ago (2010-03-24 05:01:54 UTC) #6
gauravsh
I have addressed all your comments so far. I also uploaded a new patch set ...
10 years, 9 months ago (2010-03-24 05:04:32 UTC) #7
gauravsh
On Tue, Mar 23, 2010 at 10:01 PM, Luigi Semenzato <semenzato@chromium.org> wrote: > I forgot ...
10 years, 9 months ago (2010-03-24 05:07:21 UTC) #8
Luigi Semenzato
LGTM after you address these issues, pretty please and with sugar on top (quote from ...
10 years, 9 months ago (2010-03-24 06:01:52 UTC) #9
Randall Spangler
lgtm
10 years, 9 months ago (2010-03-24 17:33:28 UTC) #10
gauravsh
BTW, did you also review the tests that I added with my last patchset? http://codereview.chromium.org/1241002/diff/1/9 ...
10 years, 9 months ago (2010-03-24 19:20:33 UTC) #11
Luigi Semenzato
Thank you for pointing out I missed a couple of files. LGTM after fixing some ...
10 years, 9 months ago (2010-03-24 20:41:59 UTC) #12
gauravsh
Fixed and submitted. http://codereview.chromium.org/1241002/diff/22001/23007 File src/platform/vboot_reference/tests/firmware_image_tests.c (right): http://codereview.chromium.org/1241002/diff/22001/23007#newcode19 src/platform/vboot_reference/tests/firmware_image_tests.c:19: #define COL_RED "\e[0;31m]" On 2010/03/24 20:42:00, ...
10 years, 9 months ago (2010-03-24 20:49:01 UTC) #13
Luigi Semenzato
There were other places where you used COL_RED and COL_GREEN, you may want to check ...
10 years, 9 months ago (2010-03-24 20:50:47 UTC) #14
gauravsh
10 years, 9 months ago (2010-03-24 20:51:47 UTC) #15
On Wed, Mar 24, 2010 at 1:50 PM, Luigi Semenzato <semenzato@chromium.org> wrote:
> There were other places where you used COL_RED and COL_GREEN, you may
> want to check those too if you haven't already.  Sorry I didn't
> mention it earlier.
I am moving a lot of common functionality to test_common.c. So await a
new CL in a few.

>
> On Wed, Mar 24, 2010 at 1:49 PM,  <gauravsh@chromium.org> wrote:
>> Fixed and submitted.
>>
>>
>> http://codereview.chromium.org/1241002/diff/22001/23007
>> File src/platform/vboot_reference/tests/firmware_image_tests.c (right):
>>
>> http://codereview.chromium.org/1241002/diff/22001/23007#newcode19
>> src/platform/vboot_reference/tests/firmware_image_tests.c:19: #define
>> COL_RED "\e[0;31m]"
>> On 2010/03/24 20:42:00, Luigi Semenzato wrote:
>>>
>>> This looks a bit strange: RED ends with a bracket and GREEN doesn't?
>>
>> Ahh, fixed.
>>
>> http://codereview.chromium.org/1241002/diff/22001/23007#newcode22
>> src/platform/vboot_reference/tests/firmware_image_tests.c:22: int
>> TEST_EQ(int result, int expected_result, char* testname) {
>> On 2010/03/24 20:42:00, Luigi Semenzato wrote:
>>>
>>> Do google conventions allow this function name?
>>
>> Well, since we are not using gtest, this is fine. Ideally, this would be
>> implemented as a macro.
>>
>> http://codereview.chromium.org/1241002/diff/22001/23007#newcode24
>> src/platform/vboot_reference/tests/firmware_image_tests.c:24:
>> fprintf(stderr, "%s Test " COL_GREEN " PASSED\n" COL_STOP, testname);
>> On 2010/03/24 20:42:00, Luigi Semenzato wrote:
>>>
>>> Is it OK to change color after the newline?
>>
>> Yes, doesn't make a difference.
>>
>> http://codereview.chromium.org/1241002/diff/22001/23007#newcode26
>> src/platform/vboot_reference/tests/firmware_image_tests.c:26: }
>> On 2010/03/24 20:42:00, Luigi Semenzato wrote:
>>>
>>> Do google conventions allow breaking the "else" this way?
>>
>> I think it's fine as long as it's consistent. But I have move it up.
>>
>> http://codereview.chromium.org/1241002/diff/22001/23007#newcode78
>> src/platform/vboot_reference/tests/firmware_image_tests.c:78:
>> On 2010/03/24 20:42:00, Luigi Semenzato wrote:
>>>
>>> Delete blank line?
>>
>> Done.
>>
>> http://codereview.chromium.org/1241002/diff/22001/23008
>> File src/platform/vboot_reference/tests/firmware_rollback_tests.c
>> (right):
>>
>> http://codereview.chromium.org/1241002/diff/22001/23008#newcode20
>> src/platform/vboot_reference/tests/firmware_rollback_tests.c:20: * then
>> the image has a invalid signatures and will fail verification. */
>> On 2010/03/24 20:42:00, Luigi Semenzato wrote:
>>>
>>> "an invalid signature"
>>
>> Done.
>>
>> http://codereview.chromium.org/1241002/diff/22001/23008#newcode112
>> src/platform/vboot_reference/tests/firmware_rollback_tests.c:112:
>> "Firmware A (Corrupt with current version), FirmwareB (Valid with
>> current version)");
>> On 2010/03/24 20:42:00, Luigi Semenzato wrote:
>>>
>>> Line too long.  Also below.
>>
>> Done.
>>
>> http://codereview.chromium.org/1241002
>>
>



-- 
-g

Powered by Google App Engine
This is Rietveld 408576698