emil-e/rapidcheck

Double free of `rc::detail::ImplicitScope::m_scopes`

Ericson2314 opened this issue · 3 comments

Hi I tried moving some of my arbitrary "instances" to some separate *.so, and then I get a double free running global destructors twice:

Breakpoint 1, 0x00007ffff7f05ba0 in __do_global_dtors_aux () from ..../unit/libstore/libnixstore-tests.so
(gdb) c
Continuing.

Breakpoint 2, 0x00007ffff74ade50 in free () from /nix/store/whypqfa83z4bsn43n4byvmw80n4mg3r8-glibc-2.37-45/lib/libc.so.6
(gdb) p (void*) $rcx
$9 = (void *) 0x5dbfc0 <rc::detail::ImplicitScope::m_scopes>
(gdb) c
Continuing.

Breakpoint 1, 0x00007ffff7ea9480 in __do_global_dtors_aux () from ..../unit/libutil/libnixutil-tests.so
(gdb) c
Continuing.

Breakpoint 2, 0x00007ffff74ade50 in free () from /nix/store/whypqfa83z4bsn43n4byvmw80n4mg3r8-glibc-2.37-45/lib/libc.so.6
(gdb) p (void*) $rcx
$10 = (void *) 0x5dbfc0 <rc::detail::ImplicitScope::m_scopes>
(gdb) c
Continuing.
double free or corruption (fasttop)

Program received signal SIGABRT, Aborted.

What's going on? How can I avoid having these globals in my libraries, and instead let the final executable provide them?

Oh it is because the library is statically linked.

NixOS/nixpkgs#269064 I think this will end up solving it for me.

Yeah that fixed it.