lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=XaDQxrrOivr=m5Rr=3VqsGgU3eg=+0GsMWKWSBDm+Jng@mail.gmail.com>
Date:	Fri, 11 Oct 2013 08:48:14 -0700
From:	Doug Anderson <dianders@...omium.org>
To:	Davidlohr Bueso <davidlohr@...com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jens Axboe <axboe@...nel.dk>, Karel Zak <kzak@...hat.com>,
	Matt Fleming <matt.fleming@...el.com>,
	Sean Paul <seanpaul@...omium.org>,
	Olof Johansson <olof@...om.net>,
	Bill Richardson <wfrichar@...omium.org>,
	Josh Triplett <josh@...htriplett.org>
Subject: Re: [PATCH] partitions/efi: treat size mismatch as a warning, not an error

Davidlohr,

On Thu, Oct 10, 2013 at 5:31 PM, Davidlohr Bueso <davidlohr@...com> wrote:
> On Thu, 2013-10-10 at 16:28 -0700, Doug Anderson wrote:
>> In (27a7c64 partitions/efi: account for pmbr size in lba) we started
>> treating bad sizes in lba field of the partition that has the 0xEE
>> (GPT protective) as errors.  However, we may run into these "bad
>> sizes" in the real world if someone uses dd to copy an image from a
>> smaller disk to a bigger disk.  Since this case used to work (even
>> without using force_gpt), keep it working and treat the size mismatch
>> as a warning instead of an error.
>>
>> Reported-by: Josh Triplett <josh@...htriplett.org>
>> Reported-by: Sean Paul <seanpaul@...omium.org>
>> Signed-off-by: Doug Anderson <dianders@...omium.org>
>> ---
>>  block/partitions/efi.c | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/block/partitions/efi.c b/block/partitions/efi.c
>> index 1eb09ee..ac23dc1 100644
>> --- a/block/partitions/efi.c
>> +++ b/block/partitions/efi.c
>> @@ -222,11 +222,15 @@ check_hybrid:
>>        * the disk size.
>>        *
>>        * Hybrid MBRs do not necessarily comply with this.
>> +      *
>> +      * Consider a bad value here to be a warning to support dd-ing
>
> dd'ing instead?

Done.

>> +      * an image from a smaller disk to a bigger disk.
>
> 'larger' disk sounds better.

Done.

>>        */
>>       if (ret == GPT_MBR_PROTECTIVE) {
>>               sz = le32_to_cpu(mbr->partition_record[part].size_in_lba);
>>               if (sz != (uint32_t) total_sectors - 1 && sz != 0xFFFFFFFF)
>> -                     ret = 0;
>> +                     pr_warn("%s: mbr size mismatch (%u != %u)\n", __func__,
>> +                             sz, (uint32_t)((uint32_t) total_sectors - 1));
>
> How about this instead?
> pr_debug("GPT: mbr size in lba (%d) different than whole disk (%d).\n", sz, min(total_sectors -1, 0xFFFFFFFF));

Done with modifications to avoid kernel compiler warnings (%u vs %d,
min_t vs min).

-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ