invalid free in grub-mkrelpath

Bug #697493 reported by Scott Moser
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
Fix Released
High
Unassigned
Natty
Fix Released
High
Unassigned

Bug Description

Binary package hint: grub2

during build natty uec image, grub-mkrelpath failed with a invalid free:

+ chroot /tmp/vmbuildern8wsQH/root /bin/sh -c 'grub-install --grub-setup=/bin/true /dev/sda && /usr/sbin/update-grub'
*** glibc detected *** /usr/bin/grub-mkrelpath: free(): invalid pointer: 0x08054180 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6c101)[0xf769d101]
/lib/libc.so.6(+0x6da5b)[0xf769ea5b]
/lib/libc.so.6(cfree+0x6d)[0xf76a1bed]
/usr/bin/grub-mkrelpath[0x804a421]
/usr/bin/grub-mkrelpath[0x804996e]
/lib/libc.so.6(__libc_start_main+0xe6)[0xf7647ce6]
/usr/bin/grub-mkrelpath[0x8049761]
======= Memory map: ========
Aborted

Other info of interest:
 * grub-pc is run from a chroot, and grub-probe has been replaced by a psuedo script which is written by http://bazaar.launchpad.net/%7Eubuntu-on-ec2/vmbuilder/automated-ec2-builds/annotate/head%3A/vmbuilder-uec-ec2-fixes (see psuedo_grub_probe)
 * grub-pc is version 1.99~20110104-1ubuntu1

Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

I saw this again today with natty-server builds.

Changed in grub2 (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Revision history for this message
Scott Moser (smoser) wrote :

Some more info:
  mounting /proc in the chroot "fix"es this.

Revision history for this message
Colin Watson (cjwatson) wrote :

That was the key, thanks. I think I've tracked this down, although it's partly guesswork:

revno: 3002
committer: Colin Watson <email address hidden>
branch nick: butter
timestamp: Fri 2011-01-07 17:24:25 +0000
message:
  Always initialise *relroot in grub_find_root_device_from_mountinfo,
  otherwise we free an uninitialised pointer if /proc is unmounted.
  Reported by: Scott Moser.

I'll include this in the next snapshot.

Changed in grub2 (Ubuntu Natty):
status: Confirmed → Fix Committed
Revision history for this message
Scott Moser (smoser) wrote :

also, only fails in an i386 chroot

Revision history for this message
Colin Watson (cjwatson) wrote :

Since it appears to be caused by freeing an uninitialised pointer, such things as switching architecture could easily permute things enough to tickle it into crashing or not crashing.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub2 - 1.99~20110111-1ubuntu1

---------------
grub2 (1.99~20110111-1ubuntu1) natty; urgency=low

  * Resynchronise with Debian. Remaining changes:
    - Adjust for default Ubuntu boot options ("quiet splash").
    - Default to hiding the menu; holding down Shift at boot will show it.
    - Set a monochromatic theme and an aubergine background for Ubuntu.
    - Apply Ubuntu GRUB Legacy changes to legacy update-grub script: title,
      recovery mode, quiet option, tweak how memtest86+ is displayed, and
      use UUIDs where appropriate.
    - Fix backslash-escaping in merge_debconf_into_conf.
    - Remove "GNU/Linux" from default distributor string.
    - Add crashkernel option.
    - Bypass menu unless other OSes are installed or Shift is pressed.
    - Allow Shift to interrupt 'sleep --interruptible'.
    - Reduce visual clutter in normal mode.
    - Remove verbose messages printed before reading configuration.
    - Suppress kernel/initrd progress messages, except in recovery mode.
    - Handle filesystems loop-mounted on file images.
    - Ignore devices loop-mounted from files in Linux grub.d scripts.
    - Show the boot menu if the previous boot failed.
    - Don't generate device.map during grub-install or grub-mkconfig.
    - Adjust upgrade version checks for Ubuntu.
    - Suppress "GRUB loading" message unless Shift is held down.
    - Adjust versions of grub-doc and grub-legacy-doc conflicts.
    - Fix LVM/RAID probing in the absence of /boot/grub/device.map.
    - Look for .mo files in /usr/share/locale-langpack first.
    - Make sure GRUB_TIMEOUT isn't quoted unnecessarily.
    - Build-depend on qemu-kvm rather than qemu-system for grub-pc tests.
    - Use qemu rather than qemu-system-i386.
    - Add a grub-rescue-efi-amd64 package.
    - On Wubi, don't ask for an install device, but just update wubildr
      using the diverted grub-install.
    - Enable lua from grub-extras.
    - Incorporate the bitop library into lua.
    - Add enum_pci function to grub module in lua.
    - Check hardware support before using gfxpayload=keep.
    - Build part_msdos and vfat into EFI boot images.
    - Put second and subsequent Linux menu entries in a submenu.
    - Preferred resolution detection for VBE.
    - Set vt.handoff=7 for smooth handoff to kernel graphical mode.

grub2 (1.99~20110111-1) experimental; urgency=low

  * New Bazaar snapshot.
    - Don't check amount of low memory, as reportedly INT 12h can be broken
      and if low memory is too low we wouldn't have gotten into
      grub_machine_init anyway (closes: #588293, LP: #513528).
    - Submenu default support (LP: #691878).
    - Fix optimisation-dependent grub-mklayout crash (closes: #609584).
  * branch_butter.patch: Don't free an uninitialised pointer if /proc is
    unmounted (LP: #697493).
  * Add a po/LINGUAS file listing the translations we've synced from the TP
    (closes: #609671).
 -- Colin Watson <email address hidden> Tue, 11 Jan 2011 16:39:18 -0600

Changed in grub2 (Ubuntu Natty):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.