bugGNU GRUB - Bugs: bug #28392, grub-probe --device-map segfaults

 
 

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

bug #28392: grub-probe --device-map segfaults

Submitted by:  Grégoire Sutre <gsutre>
Submitted on:  Wed 23 Dec 2009 07:05:03 PM UTC  
 
Category: CompilationSeverity: 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

Sat 17 Apr 2010 02:23:15 PM UTC, comment #2:

Fixed in trunk.

Grégoire Sutre <gsutre>
Project Member
Sun 27 Dec 2009 12:50:55 AM UTC, comment #1:

See:

http://lists.gnu.org/archive/html/grub-devel/2009-12/msg00421.html

Grégoire Sutre <gsutre>
Project Member
Wed 23 Dec 2009 07:05:03 PM UTC, original submission:

Hi,

On my NetBSD 5.0 box, grub-probe systematically segfaults when given a device map.

$ ./grub-mkdevicemap -m /tmp/device.map
$ cat /tmp/device.map
(fd0) /dev/rfd0a
(hd0) /dev/rsd0d
$ ./grub-probe --verbose -m /tmp/device.map --target=device /dev/sd0e
Segmentation fault

Replacing rsd0d by sd0d in the device map does not seem to change anything.

$ gdb ./grub-probe
(gdb) run --verbose -m /tmp/device.map --target=device /dev/sd0e
Starting program: /usr/tmp/GREG/tmp/grub2_2009-12-22/grub-probe --verbose -m /tmp/device.map --target=device /dev/sd0e

Program received signal SIGSEGV, Segmentation fault.
0x08049fd3 in grub_util_biosdisk_iterate (hook=0xbfbfe968) at util/hostdisk.c:157
157 if (map[i].drive && hook (map[i].drive))
(gdb) bt
#0 0x08049fd3 in grub_util_biosdisk_iterate (hook=0xbfbfe968) at util/hostdisk.c:157
#1 0x0804c591 in grub_disk_dev_iterate (hook=0xbfbfe968) at kern/disk.c:212
#2 0x0804c0cf in grub_device_iterate (hook=0x806e1d3 <hook.2683>) at kern/device.c:159
#3 0x0806e2d0 in grub_raid_register (raid=0x8079844) at disk/raid.c:652
#4 0x0806e5d5 in grub_mod_init (mod=0x0) at disk/mdraid_linux.c:227
#5 0x0806e5bd in grub_mdraid_init () at disk/mdraid_linux.c:225
#6 0x0806f842 in grub_init_all () at grub_probe_init.c:52
#7 0x08049ec0 in main (argc=6, argv=0xbfbfea64) at util/grub-probe.c:423
(gdb) quit

This problem is solved if I apply the attached patch, which basically makes sure that all variables accessed by pointers to nested functions are declared static. The patch focuses on a subpart of the sources. I'm no C expert, and I must say I don't really understand what's hapening here.

Sources : bazaar trunk, 22 dec 2009 (rev 1977).

Build command : ./autogen.sh && ./configure CC=/usr/pkg/gcc44/bin/gcc CPPFLAGS=-DHAVE_OPENDISK CFLAGS=-g LDFLAGS="-lintl -lutil" && gmake grub-probe grub-mkdevicemap

Grégoire Sutre <gsutre>
Project Member

 

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by gsutre (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
    Sat 17 Apr 2010 02:24:35 PM UTCgsutreStatusNone=>Fixed
    Sat 17 Apr 2010 02:23:15 PM UTCgsutreOpen/ClosedOpen=>Closed
    Wed 23 Dec 2009 07:05:03 PM UTCgsutreAttached File-=>Added patch-nested-functions.diff, #19344

    Back to the top


    Powered by Savane 3.1-cleanup1