[Gluster-devel] Recent dict changes affecting QEMU-GlusterFS patches

Bharata B Rao bharata.rao at gmail.com
Mon Jun 18 04:03:47 UTC 2012


I recently posted patches to integrate GlusterFS with QEMU.
While updating those patches to latest gluster git, I am seeing a
problem and I tracked that down to this commit:

e8eb0a9cb6539a7607d4c134daf331400a93d136 (Optimize for small dicts,
and avoid an overrun).

With this commit, I see an invalid memory reference in _dict_lookup().
Some details from gdb are shown below:

[root at bharata qemu]# gdb ./x86_64-softmmu/qemu-system-x86_64
(gdb) set args --enable-kvm --nographic -m 1024 -smp 4 -drive
-net nic,model=virtio -net user -redir tcp:2000::22
(gdb) r
Starting program: x86_64-softmmu/qemu-system-x86_64 --enable-kvm
--nographic -m 1024 -smp 4 -drive
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff66e8ff6 in __strcmp_sse42 () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install
glib2-2.30.3-1.fc16.x86_64 glibc-2.14.90-24.fc16.7.x86_64
libuuid-2.20.1-2.3.fc16.x86_64 openssl-1.0.0j-1.fc16.x86_64
(gdb) bt
#0  0x00007ffff66e8ff6 in __strcmp_sse42 () from /lib64/libc.so.6
#1  0x00007ffff7241ab1 in _dict_lookup (key=0x5555564e11b0 "directory",
    this=<optimized out>) at dict.c:204
#2  _dict_lookup (this=<optimized out>, key=0x5555564e11b0
"directory") at dict.c:192
#3  0x00007ffff72427ae in _dict_set (value=0x7ffff534302c, key=
    0x5555564e11b0 "directory", this=0x5555564c6c6c) at dict.c:254
#4  dict_set (value=0x7ffff534302c, key=<optimized out>, this=0x5555564c6c6c)
    at dict.c:327
#5  dict_set (this=0x5555564c6c6c, key=<optimized out>, value=0x7ffff534302c)
    at dict.c:313
#6  0x00007ffff728c2a8 in volume_option (value=0x5555564e2470 "/vm", key=
    0x5555564e11b0 "directory") at ./graph.y:249
#7  yyparse () at ./graph.y:76
#8  0x00007ffff728cbbc in glusterfs_graph_construct
(fp=0x5555564dcbe0) at ./graph.y:597

(gdb) up
#1  0x00007ffff7241ab1 in _dict_lookup (key=0x5555564e11b0 "directory",
    this=<optimized out>) at dict.c:204
204                     if (pair->key && !strcmp (pair->key, key))
(gdb) p *pair
$1 = {hash_next = 0x5555564c6ca4, prev = 0x5555564dbbfc, next =
0x3ff00000001, value =
    0x1, key = 0x54 <Address 0x54 out of bounds>}

You can see that pair->key has invalid address.

I am using QEMU in RPC-bypass  mode and the volume file looks like this:
# cat c-qemu-rpcbypass.vol
volume vm
  type storage/posix
  option directory /vm

I am not familiar with this part of the code and hence will need time
to debug this. Meanwhile if anyone else familiar with this part of the
code could give some pointers, it will be useful.

http://bharata.sulekha.com/blog/posts.htm, http://raobharata.wordpress.com/

More information about the Gluster-devel mailing list