bugGNU GRUB - Bugs: bug #31045, parttool performs the wrong...

 
 

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

bug #31045: parttool performs the wrong command when two commands given

Submitted by:  J. Nick Terry <caspin>
Submitted on:  Wed 15 Sep 2010 07:08:05 PM UTC  
 
Category: Disk & PartitionSeverity: Major
Priority: 5 - NormalItem Group: Software Error
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: J. Nick Terry
Open/Closed: ClosedRelease: 
Release: 1.98Reproducibility: Every Time
Planned Release: None

Wed 15 Sep 2010 10:24:05 PM UTC, comment #3:

I fixed the bug in response to your report ;)

Vladimir Serbinenko <phcoder>
Project Administrator
Wed 15 Sep 2010 10:02:53 PM UTC, comment #2:

I build grub from the trunk and problem was resolved.

Has there been work in parttool since 1.98?

or was this a bug introduced by Ubuntu?

J. Nick Terry <caspin>
Wed 15 Sep 2010 07:50:06 PM UTC, comment #1:

Can you retest the bzt trunk?

Vladimir Serbinenko <phcoder>
Project Administrator
Wed 15 Sep 2010 07:08:05 PM UTC, original submission:

parttool doesn't fail every time, but it fails more often than it succeeds.
It only fails with the commands 'hidden' then 'boot'.
It doesn't seem to fail with 'boot' then 'hidden'.
It doesn't seem to fail when either 'boot' or 'hidden' are used alone.
I didn't experiment with the 'type=' command.
It can fail when setting any of the partitions.

My setup:
a small 8GB disk with 4 partitions.
hd0,1 is a DOS partition, id 0x6
hd0,2 is a Windows partition, id 0x7
hd0,3 is a Windows partition, id 0x7
hd0,4 is an Ubuntu partition, id 0x83
Grub was installed from an Ubuntu 10.4 box using package
grub-pc 1.98-1ubuntu7

I wrote function that dumps fields 0 and 4 from the MBR's partition table called partinfo for each partition.

Here is particularly telling example.

grub> parttool hd0,4 hidden+ boot- #1
Setting partition type to 0x93
Cleared active flag on 3.
grub> parttool hd0,4 hidden- boot- #2
Setting partition type to 0x83
Cleared active flag on 3.
grub> parttool hd0,4 hidden- boot- #3
Setting partition type to 0x93
grub> partinfo #4
...
grub> parttool hd0,4 hidden- boot- #5
Setting partition type to 0x93
grub> parttool hd0,4 hidden- boot- #6
Setting partition type to 0x93
grub> parttool hd0,4 hidden- boot+ #7
Setting partition type to 0x93
grub> parttool hd0,4 hidden+ boot+ #8
Setting partition type to 0x93
grub> parttool hd0,4 hidden+ boot- #9
Setting partition type to 0x93

Commands #1 and #2 worked as expected. #3-#9 all failed.

I verified with partinfo at #4 that partition 4 had actually be set to 0x93. When I requested hidden- boot- it performed a hidden+.

I have had parttool set a partition to unhidden as well as hidden when it fails.

Notice that #3-#9 the output only mentions changing the type. parttool is not performing the second command (boot) at all.

For me the most disturbing is that parttool does not fail every time and it does not fail in the same way. That smells like a race (not possible as I don't think grub2 uses threading), reading uninitialized memory, or a stack smash.

J. Nick Terry <caspin>

 

No files currently attached

 

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 caspin (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 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 15 Sep 2010 10:24:05 PM UTCphcoderStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Wed 15 Sep 2010 10:04:03 PM UTCcaspinCarbon-CopyRemoved -unavailable-=>-
    Wed 15 Sep 2010 07:08:05 PM UTCcaspinCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1