Bug 677412

Summary: test version segfaults in constructor
Product: [Fedora] Fedora Reporter: Jim Meyering <meyering>
Component: mongodbAssignee: Ionuț Arțăriși <ionut>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ionut, nathaniel
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mongodb-1.7.5-5.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-03 03:32:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
avoid segfault due to NULL-dereference of _devrandom none

Description Jim Meyering 2011-02-14 17:16:17 UTC
Description of problem: test version segfaults very early


Version-Release number of selected component (if applicable):
Note: this is not yet in rawhide: mongodb-1.7.5-4.fc15
http://koji.fedoraproject.org/koji/buildinfo?buildID=228448

How reproducible: always


Steps to Reproduce:
1. install those RPMs, and then run this:
2. mkdir mongod \
  && gdb --args mongod --port 27018 --pidfilepath mongod/pid --dbpath mongod
3. type "run"
  
Actual results:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7934549 in std::basic_istream<char, std::char_traits<char> >::read(cha
r*, long) () from /usr/lib64/libstdc++.so.6
Missing separate debuginfos, use: debuginfo-install boost-filesystem-1.46.0-0.1.b
eta1.fc15.x86_64 boost-program-options-1.46.0-0.1.beta1.fc15.x86_64 boost-system-
1.46.0-0.1.beta1.fc15.x86_64 boost-thread-1.46.0-0.1.beta1.fc15.x86_64 glibc-2.13
.90-3.x86_64 js-1.70-13.fc15.x86_64 libgcc-4.6.0-0.6.fc15.1.x86_64 libstdc++-4.6.
0-0.6.fc15.1.x86_64 nspr-4.8.7-2.fc15.x86_64 pcre-8.12-2.fc15.x86_64
(gdb) l 
604                     if (old_arbiter == "-" || old_arbiter.substr(0, 1) != "-"
) {
605                         return "Specifying arbiter using --pairwith is no lon
ger supported, please use --arbiter";
606                     }
607                 }
608             }
609         }
610         return "";
611     }
612
613     int main(int argc, char* argv[]) {
(gdb) up
#1  0x000000000052229a in mongo::Security::getNonce (this=0xad1500)
    at db/nonce.cpp:63
63              _devrandom->read((char*)&n, sizeof(n));
(gdb) bt
#0  0x00007ffff7934549 in std::basic_istream<char, std::char_traits<char> >::read
(char*, long) () from /usr/lib64/libstdc++.so.6
#1  0x000000000052229a in mongo::Security::getNonce (this=0xad1500)
    at db/nonce.cpp:63
#2  0x000000000050dc0a in mongo::OID::genMachineAndPid () at bson/oid.cpp:56
#3  0x00000000004e54ca in __static_initialization_and_destruction_0 (
    __priority=65535, __initialize_p=1) at bson/oid.cpp:69
#4  _GLOBAL__sub_I_oid.cpp(void) () at bson/oid.cpp:154
#5  0x00000000007bf31d in __libc_csu_init ()
#6  0x00007ffff60ef290 in __libc_start_main () from /lib64/libc.so.6
#7  0x00000000004f2ff1 in _start () at ./util/log.h:445
(gdb) p _devrandom
$1 = (std::ifstream *) 0x0

Expected results:

no segfault

Additional info:

I rebuilt using the attached patch (to call 'init()' before using _devrandom)
and the resulting tools worked fine as used by iwhd, which then passed its "make check" tests.

Comment 1 Jim Meyering 2011-02-14 17:17:24 UTC
Created attachment 478670 [details]
avoid segfault due to NULL-dereference of _devrandom

Comment 2 Fedora Update System 2011-02-16 20:46:40 UTC
mongodb-1.7.5-5.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/mongodb-1.7.5-5.fc15

Comment 3 Fedora Update System 2011-02-16 21:29:14 UTC
mongodb-1.7.5-5.fc15 has been pushed to the Fedora 15 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update mongodb'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/mongodb-1.7.5-5.fc15

Comment 4 Fedora Update System 2011-03-03 03:32:19 UTC
mongodb-1.7.5-5.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.