public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mjtruog at fastmail dot ca" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/42679] RTLD_DEEPBIND dlopen option for shared library that uses libstdc++ std::ostream crashes Date: Sun, 10 Jan 2010 18:16:00 -0000 [thread overview] Message-ID: <20100110181613.6450.qmail@sourceware.org> (raw) In-Reply-To: <bug-42679-13845@http.gcc.gnu.org/bugzilla/> ------- Comment #2 from mjtruog at fastmail dot ca 2010-01-10 18:16 ------- I have been trying to make a simple test case for the ostringstream problem but have not yet found one. However, I have been able to make a test case for the crash when using std::cerr. The problems are probably related in some way, but the std::ostringstream one I found may be harder to recreate. I have the files to replicate the std::cerr crash scenario below: main.cpp: #include <dlfcn.h> #include <iostream> // compile with: g++ -g -O0 main.cpp -ldl int main() { char const * const library_name = "./library.so"; void * handle = dlopen(library_name, RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND); char const * const dlopen_error = dlerror(); if (! handle) { std::cerr << "dlopen error: " << dlopen_error << std::endl; return 1; } typedef void (*library_function_type)(); void * function = dlsym(handle, "library_function"); char const * const dlsym_error = dlerror(); if (dlsym_error) { std::cerr << "dlsym error: " << dlsym_error << std::endl; dlclose(handle); return 1; } reinterpret_cast<library_function_type>(function)(); dlclose(handle); return 0; } library1.cpp: #include <sstream> #include <iostream> // example of SEGFAULT when writing to std::cerr // compile with: // g++ -g -O0 -rdynamic -c -fPIC -o library.o library1.cpp // g++ -shared -Wl,-export-dynamic -o library.so library.o extern "C" { void library_function() { std::clog << "std::cerr will segfault" << std::endl; std::cerr << "crash me"; } } -- mjtruog at fastmail dot ca changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |UNCONFIRMED http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42679
next prev parent reply other threads:[~2010-01-10 18:16 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-01-10 7:26 [Bug libstdc++/42679] New: " mjtruog at fastmail dot ca 2010-01-10 10:42 ` [Bug libstdc++/42679] " paolo dot carlini at oracle dot com 2010-01-10 18:16 ` mjtruog at fastmail dot ca [this message] 2010-01-10 19:18 ` paolo dot carlini at oracle dot com 2010-01-12 15:52 ` paolo dot carlini at oracle dot com 2010-01-22 7:10 ` mjtruog at fastmail dot ca 2010-01-28 3:10 ` paolo dot carlini at oracle dot com 2010-01-28 8:03 ` jakub at gcc dot gnu dot org 2010-01-28 9:50 ` paolo dot carlini at oracle dot com 2010-01-28 20:01 ` jason at gcc dot gnu dot org 2010-01-28 22:07 ` jakub at gcc dot gnu dot org 2010-01-28 22:35 ` paolo dot carlini at oracle dot com 2010-01-28 22:50 ` jakub at gcc dot gnu dot org 2010-01-28 23:00 ` paolo dot carlini at oracle dot com 2010-01-29 0:47 ` paolo dot carlini at oracle dot com 2010-01-29 7:52 ` jakub at gcc dot gnu dot org 2010-01-29 10:08 ` paolo dot carlini at oracle dot com 2010-01-29 17:05 ` mjtruog at fastmail dot ca 2010-03-07 17:53 ` mjtruog at fastmail dot ca [not found] <bug-42679-4@http.gcc.gnu.org/bugzilla/> 2010-12-29 6:25 ` liguanglei at gmail dot com 2010-12-29 23:51 ` redi at gcc dot gnu.org 2013-01-02 1:41 ` gauryogesh.nsit at gmail dot com 2013-01-04 10:58 ` redi at gcc dot gnu.org 2013-02-05 23:47 ` mjtruog at fastmail dot ca 2021-10-15 13:29 ` jeanmichael.celerier at gmail dot com 2021-10-15 13:35 ` jeanmichael.celerier at gmail dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20100110181613.6450.qmail@sourceware.org \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).