databases/mongodb36 in jail - Failed to mlock: Operation not permitted

Alexander N. Lunev lan at zato.ru
Fri Oct 11 12:24:16 UTC 2019


Hello everybody.

I want to run MongoDB 3.6 in a jail, and stuck in a bug with mlock.

# uname -a
FreeBSD foo.zato.local 12.1-PRERELEASE FreeBSD 12.1-PRERELEASE r352266 
GENERIC  amd64
# pkg install mongodb36
...
# sysrc mongod_enable="YES"
# service mongod start

Then connect to mongo from shell and try to add user like they say in 
tutorial https://docs.mongodb.com/v3.6/tutorial/enable-authentication/ :

# mongo
MongoDB shell version v3.6.13
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
Implicit session: session { "id" : 
UUID("1e9f8ba6-4882-4453-a6ac-89c51edb3269") }
MongoDB server version: 3.6.13
Welcome to the MongoDB shell.
...
skip warnings
...
 > use admin
switched to db admin

 > db.createUser(
...   {
...     user: "newAdmin",
...     pwd: "abc123",
...     roles: [ { role: "userAdminAnyDatabase", db: "admin" }, 
"readWriteAnyDatabase" ]
...   }
... )
Successfully added user: {
         "user" : "newAdmin",
         "roles" : [
                 {
                         "role" : "userAdminAnyDatabase",
                         "db" : "admin"
                 },
                 "readWriteAnyDatabase"
         ]
}
 >
bye

Then try to login using newly created user:

# mongo -u newAdmin -p abc123
MongoDB shell version v3.6.13
connecting to: mongodb://127.0.0.1:27017/?gssapiServiceName=mongodb
2019-10-11T15:17:37.223+0300 F -        [thread1] Failed to mlock: 
Operation not permitted
2019-10-11T15:17:37.224+0300 F -        [thread1] Fatal Assertion 28832 
at src/mongo/base/secure_allocator.cpp 249
2019-10-11T15:17:37.226+0300 F -        [thread1]

***aborting after fassert() failure

2019-10-11T15:17:37.229+0300 F -        [thread1] Got signal: 6 (Abort 
trap).

  0x28a40b9 0x28a397b 0x802fda3c0
----- BEGIN BACKTRACE -----
{"backtrace":[{"b":"1021000","o":"18830B9","s":"_ZN5mongo15printStackTraceERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEE"},{"b":"1021000","o":"188297B","s":"_ZN5mongo29reportOutOfMemoryErrorAndExitEv"},{"b":"802FC6000","o":"143C0","s":"_pthread_sigmask"}],"processInfo":{ 
"mongodbVersion" : "3.6.13", "gitVersion" : 
"db3c76679b7a3d9b443a0e1b3e45ed02b88c539f", "compiledModules" : [], 
"uname" : { "sysname" : "FreeBSD", "release" : "12.1-PRERELEASE", 
"version" : "FreeBSD 12.1-PRERELEASE r352266 GENERIC", "machine" : 
"amd64" } }}
 
mongo(_ZN5mongo15printStackTraceERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEE+0x39) 
[0x28a40b9]
  mongo(_ZN5mongo29reportOutOfMemoryErrorAndExitEv+0x15B) [0x28a397b]
  libthr.so.3(_pthread_sigmask+0x530) [0x802fda3c0]
-----  END BACKTRACE  -----


This will work if not in jail.

mongod is running with --setParameter=disabledSecureAllocatorDomains=*:

/usr/local/bin/mongod --logpath /var/db/mongodb/mongod.log --logappend 
--setParameter=disabledSecureAllocatorDomains=* --config 
/usr/local/etc/mongodb.conf --dbpath /var/db/mongodb --fork

Is it a bug, or I need to tinker with jail parameters somehow?

-- 
Best regards,
Alexander Lunev


More information about the freebsd-jail mailing list