Bug 44679 - [4.5/4.6 regression] 30_threads/condition_variable_any/cons/1.cc fails with -fstack-protector (built with 4.4, run with 4.5)
Summary: [4.5/4.6 regression] 30_threads/condition_variable_any/cons/1.cc fails with -...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 4.5.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-26 10:19 UTC by Matthias Klose
Modified: 2010-06-28 16:14 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2010-06-26 10:19:31 UTC
building 30_threads/condition_variable_any/cons/1.cc with the 4.4 branch

g++ -fstack-protector -std=c++0x any.cc -o any

and running the binary on a system with the shared libstdc++.so installed from the 4.5 branch aborts.

#include <condition_variable>
#include <system_error>

int main()
{
  bool test __attribute__((unused)) = true;

  try 
    {
      std::condition_variable_any c1;
    }
  catch (const std::system_error& e)
    {
      perror("system_error");
      exit(1);
    }
  catch (...)
    {
      perror("system_error");
      exit(2);
    }

  return 0;
}


*** stack smashing detected ***: ./any terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7fae2e3c3947]
/lib/libc.so.6(__fortify_fail+0x0)[0x7fae2e3c3910]
./any[0x4009b7]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7fae2e2e2d8d]
./any[0x400839]
======= Memory map: ========
00400000-00401000 r-xp 00000000 09:01 8172845                            /scratch/packages/gcc/4.4/u/any
00600000-00601000 rw-p 00000000 09:01 8172845                            /scratch/packages/gcc/4.4/u/any
00748000-00769000 rw-p 00000000 00:00 0                                  [heap]
7fae2e2c4000-7fae2e43e000 r-xp 00000000 09:00 919600                     /lib/libc-2.12.so
7fae2e43e000-7fae2e63e000 ---p 0017a000 09:00 919600                     /lib/libc-2.12.so
7fae2e63e000-7fae2e642000 r--p 0017a000 09:00 919600                     /lib/libc-2.12.so
7fae2e642000-7fae2e643000 rw-p 0017e000 09:00 919600                     /lib/libc-2.12.so
7fae2e643000-7fae2e648000 rw-p 00000000 00:00 0
7fae2e648000-7fae2e65d000 r-xp 00000000 09:00 2888799                    /usr/lib/gcc-snapshot/lib/libgcc_s.so.1
7fae2e65d000-7fae2e85c000 ---p 00015000 09:00 2888799                    /usr/lib/gcc-snapshot/lib/libgcc_s.so.1
7fae2e85c000-7fae2e85d000 rw-p 00014000 09:00 2888799                    /usr/lib/gcc-snapshot/lib/libgcc_s.so.1
7fae2e85d000-7fae2e8df000 r-xp 00000000 09:00 922106                     /lib/libm-2.12.so
7fae2e8df000-7fae2eade000 ---p 00082000 09:00 922106                     /lib/libm-2.12.so
7fae2eade000-7fae2eadf000 r--p 00081000 09:00 922106                     /lib/libm-2.12.so
7fae2eadf000-7fae2eae0000 rw-p 00082000 09:00 922106                     /lib/libm-2.12.so
7fae2eae0000-7fae2ebc4000 r-xp 00000000 09:00 2888785                    /usr/lib/gcc-snapshot/lib/libstdc++.so.6.0.15
7fae2ebc4000-7fae2edc3000 ---p 000e4000 09:00 2888785                    /usr/lib/gcc-snapshot/lib/libstdc++.so.6.0.15
7fae2edc3000-7fae2edcb000 r--p 000e3000 09:00 2888785                    /usr/lib/gcc-snapshot/lib/libstdc++.so.6.0.15
7fae2edcb000-7fae2edcd000 rw-p 000eb000 09:00 2888785                    /usr/lib/gcc-snapshot/lib/libstdc++.so.6.0.15
7fae2edcd000-7fae2ede2000 rw-p 00000000 00:00 0
7fae2ede2000-7fae2ee03000 r-xp 00000000 09:00 918062                     /lib/ld-2.12.so
7fae2eff3000-7fae2eff8000 rw-p 00000000 00:00 0
7fae2f000000-7fae2f002000 rw-p 00000000 00:00 0
7fae2f002000-7fae2f003000 r--p 00020000 09:00 918062                     /lib/ld-2.12.so
7fae2f003000-7fae2f004000 rw-p 00021000 09:00 918062                     /lib/ld-2.12.so
7fae2f004000-7fae2f005000 rw-p 00000000 00:00 0
7fff0acec000-7fff0ad01000 rw-p 00000000 00:00 0                          [stack]
7fff0ad9f000-7fff0ada0000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
Aborted
Comment 1 Paolo Carlini 2010-06-26 11:27:05 UTC
Jon, can you have a quick look to this? Thanks in advance
Comment 2 Jonathan Wakely 2010-06-26 14:01:18 UTC
condition_variable_any was completely broken in 4.4 and its ABi changed when we implemented it for real. Obviously we can't preserve ABI between a broken, incomplete implementation and a working one, so I'm not really worried about this "bug". If anyone was able to use the condition_variable_any in 4.4 I'd like to know how they did it!
Comment 3 Jonathan Wakely 2010-06-26 14:51:45 UTC
closing for the reasons given above
Comment 4 Richard Biener 2010-06-28 16:03:27 UTC
(In reply to comment #2)
> condition_variable_any was completely broken in 4.4 and its ABi changed when we
> implemented it for real. Obviously we can't preserve ABI between a broken,
> incomplete implementation and a working one, so I'm not really worried about
> this "bug". If anyone was able to use the condition_variable_any in 4.4 I'd
> like to know how they did it!

We should avoid exporting symbols for something that is broken or supposed
to change its ABI.  I think this is what was done in the past, why wasn't
it done here?
Comment 5 Paolo Carlini 2010-06-28 16:12:50 UTC
A (small) mistake? I think the hope at the time was that Chris Fairles would soon contribute the rest of the work and the complete facility shipped the next major release series. That didn't happen, unfortunately, and instead of reverting all the first changes, we shipped just very few unusable bits, among which a couple exported. Finally, 4.6 will be fine.
Comment 6 Paolo Carlini 2010-06-28 16:14:46 UTC
Actually 4.5 is fine too ;)