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

Submitter:  Grégoire Sutre <gsutre>
Submitted:  Wed 23 Dec 2009 07:05:03 PM UTC
   
 
Category:  Compilation Severity:  Major
Priority:  5 - Normal Item Group:  Software Error
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name: 
Open/Closed:  Closed Release:  Bazaar - trunk
Release:  Reproducibility:  Every Time
Planned Release:  None

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

Fixed in trunk.

Grégoire Sutre <gsutre>
Group Member
Sun 27 Dec 2009 12:50:55 AM UTC, comment #1: 
Grégoire Sutre <gsutre>
Group 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>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gsutre (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-04-17 gsutre StatusNone Fixed
    2010-04-17 gsutre Open/ClosedOpen Closed
    2009-12-23 gsutre Attached File- Added patch-nested-functions.diff, #19344

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code