[Boost-bugs] [Boost C++ Libraries] #11724: managed_shared_memory constructor crash

Subject: [Boost-bugs] [Boost C++ Libraries] #11724: managed_shared_memory constructor crash
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-10-13 20:22:58


#11724: managed_shared_memory constructor crash
------------------------------+--------------------------
 Reporter: john.saxton@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: interprocess
  Version: Boost 1.59.0 | Severity: Problem
 Keywords: |
------------------------------+--------------------------
 If my system has zero shared memory available and I invoke the
 managed_shared_memory constructor, the constructor will crash. I am able
 to consistently reproduce this on Centos 6.5 using g++ 4.4.7 and Boost
 v1.59.

 My repro case is very Linux-specific:
 1: rm /dev/shm/foobar
 2: dd if=/dev/zero of=/dev/shm/fill (the command will terminate once all
 shared memory on the system is exhausted)
 3: Build the attached C++ file (I used g++ -g -I/path/to/boost/ -lpthread
 -lrt shm.cpp)
 4: Run the resulting executable, it should crash

 {{{
 (gdb) where
 #0 0x0000000000402186 in boost::interprocess::ipcdetail::atomic_cas32
 (mem=0x7ffff7ee3000, with=1, cmp=0) at
 /home/elemental/boost_1_5_9/boost_1_59_0/boost/interprocess/detail/atomic.hpp:141
 #1 0x000000000040389c in
 boost::interprocess::ipcdetail::managed_open_or_create_impl<boost::interprocess::shared_memory_object,
 16ul, true,
 false>::priv_open_or_create<boost::interprocess::ipcdetail::create_open_func<boost::interprocess:
 :ipcdetail::basic_managed_memory_impl<char,
 boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
 boost::interprocess::offset_ptr<void, long, unsigned long, 0u>, 0ul>,
 boost::interprocess::iset_index, 16ul> > > (this=
     0x7fffffffe0f8, type=boost::interprocess::ipcdetail::DoCreate,
 id=@0x7fffffffe090, size=1048576, mode=boost::interprocess::read_write,
 addr=0x0, perm=..., construct_func=...)
     at
 /home/elemental/boost_1_5_9/boost_1_59_0/boost/interprocess/detail/managed_open_or_create_impl.hpp:409
 #2 0x0000000000403163 in
 boost::interprocess::ipcdetail::managed_open_or_create_impl<boost::interprocess::shared_memory_object,
 16ul, true,
 false>::managed_open_or_create_impl<boost::interprocess::ipcdetail::create_open_func<boost::inter
 process::ipcdetail::basic_managed_memory_impl<char,
 boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
 boost::interprocess::offset_ptr<void, long, unsigned long, 0u>, 0ul>,
 boost::interprocess::iset_index, 16ul> > >
     (this=0x7fffffffe0f8, id=@0x7fffffffe090, size=1048576,
 mode=boost::interprocess::read_write, addr=0x0, construct_func=...,
 perm=...)
     at
 /home/elemental/boost_1_5_9/boost_1_59_0/boost/interprocess/detail/managed_open_or_create_impl.hpp:184
 #3 0x0000000000402f2b in
 boost::interprocess::basic_managed_shared_memory<char,
 boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
 boost::interprocess::offset_ptr<void, long, unsigned long, 0u>, 0ul>,
 boost::interprocess::iset_index>::basic_managed_shared_memory
 (this=0x7fffffffe0f0, name=0x4077fb "foobar", size=1048576, addr=0x0,
 perm=...) at
 /home/elemental/boost_1_5_9/boost_1_59_0/boost/interprocess/managed_shared_memory.hpp:106
 #4 0x00000000004016a2 in main (argc=1, argv=0x7fffffffe228) at shm.cpp:23
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11724>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:19 UTC