diff options
author | Ryan Case <ryandcase@chromium.org> | 2019-04-17 11:05:34 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-04-24 15:51:42 -0700 |
commit | 54adeadadd4973c18bca0ea7e15961e4c25ea30e (patch) | |
tree | 595c8260af7f7ed292f1b03ed7cca87dd45dd0ad /cgpt/cgpt_create.c | |
parent | 266ec6ba6c86be22a998265a610da0513c0bb2b0 (diff) | |
download | vboot-54adeadadd4973c18bca0ea7e15961e4c25ea30e.tar.gz |
cgpt: create: Don't modify existing IGNOREME headers
Respect any existing IGNOREME signatures and do not attempt to make any
modifications until a user has explicitly removed this flag via cgpt
legacy or other method.
BRANCH=None
BUG=chromium:948742
TEST=chromeos-install on veyron_minnie with 4.19 kernel
Change-Id: I110a95ee0c136ebbe2274139deebcaacde712e80
Signed-off-by: Ryan Case <ryandcase@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1572440
Commit-Ready: Ryan Case <ryandcase@google.com>
Tested-by: Ryan Case <ryandcase@google.com>
Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'cgpt/cgpt_create.c')
-rw-r--r-- | cgpt/cgpt_create.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cgpt/cgpt_create.c b/cgpt/cgpt_create.c index a56a9762..4e3bb77d 100644 --- a/cgpt/cgpt_create.c +++ b/cgpt/cgpt_create.c @@ -22,6 +22,19 @@ static void AllocAndClear(uint8_t **buf, uint64_t size) { } static int GptCreate(struct drive *drive, CgptCreateParams *params) { + // Do not replace any existing IGNOREME GPT headers. + if (!memcmp(((GptHeader*)drive->gpt.primary_header)->signature, + GPT_HEADER_SIGNATURE_IGNORED, GPT_HEADER_SIGNATURE_SIZE)) { + drive->gpt.ignored |= MASK_PRIMARY; + Warning("Primary GPT was marked ignored, will not overwrite.\n"); + } + + if (!memcmp(((GptHeader*)drive->gpt.secondary_header)->signature, + GPT_HEADER_SIGNATURE_IGNORED, GPT_HEADER_SIGNATURE_SIZE)) { + drive->gpt.ignored |= MASK_SECONDARY; + Warning("Secondary GPT was marked ignored, will not overwrite.\n"); + } + // Allocate and/or erase the data. // We cannot assume the GPT headers or entry arrays have been allocated // by GptLoad() because those fields might have failed validation checks. |