Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9960

access violation on getCertificateName

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.1
    • Affects Version/s: 2.5.0
    • Component/s: Security
    • None
    • Environment:
      Windows
    • ALL

      It would appear that calling free() on the pointer returned by X509_NAME_online was not the correct thing to do. In debug mode, the Windows heap checker flags it as an invalid pointer to call free() on (there is a popup stating so). I then clicked on the button to dismiss the dialog and trigger a stack trace:

      D:\slave\Windows_64bit_2008R2+_SSL_Nightly\mongo>mongod.exe --port 27999 --setParameter enableTestCommands=1 --httpinterface --sslOnNormalPorts --sslPEMKeyFile jstests/libs/server.pem --sslCAFile jste
      sts/libs/ca.pem --sslWeakCertificateValidation
      Tue Jun 18 15:21:09.517 *** unhandled exception 0x80000003 at 0x0000000140FF72AD, terminating
      Tue Jun 18 15:21:09.518 *** stack trace for unhandled exception:
      Tue Jun 18 15:21:10.391 mongod.exe    f:\dd\vctools\crt_bld\self_64_amd64\crt\src\dbgheap.c(1322)          _free_dbg_nolock+0x19d
      Tue Jun 18 15:21:10.392 mongod.exe    f:\dd\vctools\crt_bld\self_64_amd64\crt\src\dbgheap.c(1265)          _free_dbg+0x26
      Tue Jun 18 15:21:10.393 mongod.exe    f:\dd\vctools\crt_bld\self_64_amd64\crt\src\dbgfree.c(50)            free+0x18
      Tue Jun 18 15:21:10.394 mongod.exe    ...\src\mongo\util\net\ssl_manager.cpp(263)                          mongo::getCertificateSubjectName+0x9a
      Tue Jun 18 15:21:10.394 mongod.exe    ...\src\mongo\util\net\ssl_manager.cpp(431)                          mongo::`anonymous namespace'::SSLManager::_setupPEM+0x86b
      Tue Jun 18 15:21:10.395 mongod.exe    ...\src\mongo\util\net\ssl_manager.cpp(310)                          mongo::`anonymous namespace'::SSLManager::SSLManager+0x343
      Tue Jun 18 15:21:10.396 mongod.exe    ...\src\mongo\util\net\ssl_manager.cpp(243)                          mongo::_mongoInitializerFunction_SSLManager+0xe4
      Tue Jun 18 15:21:10.397 mongod.exe    ...\src\third_party\boost\boost\function\function_template.hpp(95)   boost::detail::function::function_invoker1<mongo::Status (__cdecl*)(mongo::InitializerContext
       * __ptr64),mongo::Status,mongo::InitializerContext * __ptr64>::invoke+0x54
      Tue Jun 18 15:21:10.398 mongod.exe    ...\src\third_party\boost\boost\function\function_template.hpp(760)  boost::function1<mongo::Status,mongo::InitializerContext * __ptr64>::operator()+0xb8
      Tue Jun 18 15:21:10.399 mongod.exe    ...\src\mongo\base\initializer.cpp(45)                               mongo::Initializer::execute+0x2da
      Tue Jun 18 15:21:10.400 mongod.exe    ...\src\mongo\base\initializer.cpp(58)                               mongo::runGlobalInitializers+0x4c
      Tue Jun 18 15:21:10.401 mongod.exe    ...\src\mongo\base\initializer.cpp(77)                               mongo::runGlobalInitializers+0x25a
      Tue Jun 18 15:21:10.402 mongod.exe    ...\src\mongo\base\initializer.cpp(81)                               mongo::runGlobalInitializersOrDie+0x47
      Tue Jun 18 15:21:10.403 mongod.exe    ...\src\mongo\db\db.cpp(1304)                                        mongoDbMain+0x1bb
      Tue Jun 18 15:21:10.404 mongod.exe    ...\src\mongo\db\db.cpp(742)                                         wmain+0x78
      Tue Jun 18 15:21:10.405 mongod.exe    f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c(278)              __tmainCRTStartup+0xe2
      Tue Jun 18 15:21:10.405 mongod.exe    f:\dd\vctools\crt_bld\self_64_amd64\crt\src\crt0.c(189)              wmainCRTStartup+0xe
      Tue Jun 18 15:21:10.406 kernel32.dll                                                                       BaseThreadInitThunk+0xd
      Tue Jun 18 15:21:10.407 writing minidump diagnostic file mongo.dmp
      Tue Jun 18 15:21:10.559 *** immediate exit due to unhandled exception
      

      I expect Valgrind Memcheck might show a similar issue.

            Assignee:
            andreas.nilsson Andreas Nilsson
            Reporter:
            milkie@mongodb.com Eric Milkie
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: