zfsonlinux / grub

GRUB enhancements for ZFS on Linux
16 stars 18 forks source link

grub-probe segfaults if linked with libzfs2 #9

Closed FransUrbo closed 10 years ago

FransUrbo commented 10 years ago
debian:~# /usr/sbin/grub-probe --target=device /
Segmentation fault
debian:~# gdb -q /usr/sbin/grub-probe 
Reading symbols from /usr/sbin/grub-probe...(no debugging symbols found)...done.
(gdb) run --target=device /
Starting program: /usr/sbin/grub-probe --target=device /
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff796bd8f in zpool_get_config () from /lib/libzfs.so.2
(gdb) bt
#0  0x00007ffff796bd8f in zpool_get_config () from /lib/libzfs.so.2
#1  0x00000000004618c1 in ?? ()
#2  0x0000000000462498 in ?? ()
#3  0x00000000004040a9 in ?? ()
#4  0x0000000000403512 in ?? ()
#5  0x00007ffff71c9ead in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00000000004035f5 in ?? ()
#7  0x00007fffffffec38 in ?? ()
#8  0x000000000000001c in ?? ()
#9  0x0000000000000003 in ?? ()
#10 0x00007fffffffee40 in ?? ()
#11 0x00007fffffffee55 in ?? ()
#12 0x00007fffffffee65 in ?? ()
#13 0x0000000000000000 in ?? ()
FransUrbo commented 10 years ago

Hmm, maybe not...

debian:~# ldd /usr/sbin/grub-probe | grep libzfs
        libzfs.so.2 => /lib/libzfs.so.2 (0x00007f5ed485b000)
        libzfs_core.so.1 => /lib/libzfs_core.so.1 (0x00007f5ed3a6d000)
debian:~# /usr/sbin/grub-probe --target=device /
/dev/sdb1
/dev/sdc1
FransUrbo commented 10 years ago

The first is a clean install with 0.6.2, upgraded to pre0.6.3 from the daily.

The second have been upgraded several times back and forth and latest with the same packages as the 0.6.2->pre0.6.3 packages.

And now it doesn't work on the later either!

The end of an strace shows:

access("/sys/module/zfs", F_OK)         = 0
open("/dev/zfs", O_RDWR)                = 3
open("/etc/mtab", O_RDONLY)             = 4
open("/etc/dfs/sharetab", O_RDONLY)     = 5
open("/dev/zfs", O_RDWR)                = 6
ioctl(3, 0x5a05, 0x7fff4dda4180)        = -1 ENOMEM (Cannot allocate memory)
ioctl(3, 0x5a05, 0x7fff4dda4180)        = -1 EFAULT (Bad address)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Segmentation fault
FransUrbo commented 10 years ago

Ok, this seems to be bogus. I accidentally saw that for some reason the upgrade of ZoL 'ejected' (!?!) the pool (old module, new binaries ?). That is, 'zpool status' gave "no pools available". A reboot later, and pool is there and grub-probe worked.

The "no pools available" needs to be investigated, but there is no problem with grub...