Project

General

Profile

Actions

Bug #691

closed

librados: Segfault when open_pool is run when not initialized

Added by Wido den Hollander over 13 years ago. Updated over 13 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
librados
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
Severity:
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

While working with phprados I experienced a crash when I tried to open a pool when I did not initialize librados.

Basically it came down to this:

#include "rados/librados.h" 

int main(int argc, char** argv) {
    rados_pool_t p;
    rados_open_pool("libvirt", &p);
    rados_close_pool(p);
}

I know, this is my fault, I should initialize librados before opening a pool, but should we crash here?

Program received signal SIGSEGV, Segmentation fault.
OSDMap::lookup_pg_pool_name (name=0x4007cc "libvirt", pool=<value optimized out>) at osd/OSDMap.h:916
916        if (name_pool.count(name))
(gdb) bt
#0  OSDMap::lookup_pg_pool_name (name=0x4007cc "libvirt", pool=<value optimized out>) at osd/OSDMap.h:916
#1  RadosClient::lookup_pool (name=0x4007cc "libvirt", pool=<value optimized out>) at librados.cc:120
#2  rados_open_pool (name=0x4007cc "libvirt", pool=<value optimized out>) at librados.cc:2318
#3  0x00000000004006c4 in main ()
(gdb)

After checking librados.cc I saw that there is no such a check, not in open_pool or 'client->lookup_pool()'.

I'll fix phprados that it throws an exception when you try to do such and operation, but IMHO librados should not crash either.

Actions #1

Updated by Yehuda Sadeh over 13 years ago

Fixed with commit 2da3ac1499944e7aac358a47a4d5651f3a1257e0.

Actions #2

Updated by Yehuda Sadeh over 13 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF