This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/24469] Possible race condition in mt_allocator causing SIGSEGV
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Oct 2005 10:16:18 -0000
- Subject: [Bug libstdc++/24469] Possible race condition in mt_allocator causing SIGSEGV
- References: <bug-24469-9884@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from pcarlini at suse dot de 2005-10-27 10:16 -------
I can see a few possible strategies:
1- Arches supporting the new __sync_fetch_and_add (at least, i686, x86_64,
powerpc
ia64, s390), could simply use it on the existing __bin._M_used.
2- Otherwise, a lock in _M_reclaim_block only when __block->_M_thread_id !=
__thread_id. At the same time has to be changed _M_reserve_block too,
however,
and it's tricky to do that without locking at every single allocation:
maybe,
changing slightly the algorithm, an entire pool of blocks can be marked as
used when obtained from operator new or the global list (at the beginning of
_M_reserve_block).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24469