bugGNU GRUB - Bugs: bug #38035, Off by one error in enumerating...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

bug #38035: Off by one error in enumerating MSDOS partitions

Submitted by:  Andrey Borzenkov <arvidjaar>
Submitted on:  Mon 07 Jan 2013 02:24:39 PM UTC  
 
Category: Disk & PartitionSeverity: Major
Priority: 5 - NormalItem Group: Software Error
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: 
Open/Closed: ClosedRelease: 
Release: Bazaar - trunkReproducibility: Every Time
Planned Release: None

(Jump to the original submission Jump to the original submission)

Wed 27 Feb 2013 09:01:39 AM UTC, comment #6:

Well doesn't look like OpenSuSe is going to solve their bugs but w/e it's their problems. I apply here only the fix for smaller problem.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed 09 Jan 2013 09:31:13 PM UTC, comment #5:

I will commit the patch but I want first to be sure that bigger problem behind this patch is adressed. There are other cases when the numbering doesn't match e.g. in presence of solaris or BSD partitions.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed 09 Jan 2013 09:27:53 PM UTC, comment #4:

So while there is a cosmetic problem in GRUB, the real problem is that yast uses 'hdX,Y' rather than giving device.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed 09 Jan 2013 09:25:26 PM UTC, comment #3:

And never call grub-install with '(hd0,X)' notation. It's wrong and if it still works it would be because nobody cared to remove it.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed 09 Jan 2013 09:23:59 PM UTC, comment #2:

And please remove --skip-fs-probe. It's not intended to be used automatically. It's only after huan intervention and check that it can be used or you risk overwriting data.

Vladimir Serbinenko <phcoder>
Project Administrator
Wed 09 Jan 2013 09:10:57 PM UTC, comment #1:

Why and where do you rely on partition numbers at all? They are not guaranteed to match Linux or any other OS numbering scheme.

Vladimir Serbinenko <phcoder>
Project Administrator
Mon 07 Jan 2013 02:24:39 PM UTC, original submission:

As reported in https://bugzilla.novell.com/show_bug.cgi?id=779534#c19 under some conditions GRUB2 includes extended partition in total partition numbering causing wrong numbers to be assigned. This happens under following conditions

- extended primary partition exists
- the very first next extended boot record has extended partition as the first entry (usually first entry points to normal partition)

Depending on number of primary partitions, it could also possibly happen for next EBR as well.

Full partitions dump is available as https://bugzilla.novell.com/attachment.cgi?id=519076

The reason is off by one error in grub_partition_msdos_iterate(). p.number starts counting partitions with 0, so primary partitions have number 0..3 and at the point p.number is incremented it still points to previous partition. So it should be p.number < 3 to apply to primary partitions only.

Patch against trunk attached. It is confirmed as working by original reporter.

Andrey Borzenkov <arvidjaar>
Project Member

 

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by phcoder (Posted a comment)
  • -unavailable- added by arvidjaar (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 27 Feb 2013 09:01:39 AM UTCphcoderStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon 07 Jan 2013 02:24:39 PM UTCarvidjaarAttached File-=>Added grub2-fix-enumeration-of-extended-partition.patch, #27215

    Back to the top


    Powered by Savane 3.1-cleanup