[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #28392] grub-probe --device-map segfaults

From: Grégoire Sutre
Subject: [bug #28392] grub-probe --device-map segfaults
Date: Wed, 23 Dec 2009 19:05:07 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20091123 Iceweasel/3.5.5 (like Firefox/3.5.5; Debian-3.5.5-1)


                 Summary: grub-probe --device-map segfaults
                 Project: GNU GRUB
            Submitted by: gsutre
            Submitted on: Wed 23 Dec 2009 07:05:03 PM GMT
                Category: Compilation
                Severity: Major
                Priority: 5 - Normal
              Item Group: Software Error
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: Bazaar - trunk
         Reproducibility: Every Time
         Planned Release: None




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

$ ./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
157         if (map[i].drive && hook (map[i].drive))
(gdb) bt
#0  0x08049fd3 in grub_util_biosdisk_iterate (hook=0xbfbfe968) at
#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
#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


File Attachments:

Date: Wed 23 Dec 2009 07:05:03 PM GMT  Name: patch-nested-functions.diff 
Size: 7kB   By: gsutre



Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]