public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible
@ 2012-01-29 17:28 howarth at nitro dot med.uc.edu
  2012-01-30 18:52 ` [Bug libitm/52042] " howarth at nitro dot med.uc.edu
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-01-29 17:28 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

             Bug #: 52042
           Summary: libitm.c/clone-1.c and libitm.c/stackundo.c execution
                    tests are not pie compatible
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libitm
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: howarth@nitro.med.uc.edu


On x86_64-apple-darwin11, the libitm testsuite failures...

FAIL: libitm.c/clone-1.c execution test
FAIL: libitm.c/stackundo.c execution test

are seen at both -m32/-m64. These test cases don't fail within
Apple gdb due to its default disabling of aslr. If aslr is enabled within gdb,
the following backtraces are seen...

gdb ./stackundo.exe
GNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov  3 21:59:02 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared
libraries .... done

(gdb) set disable-aslr off
(gdb) r
Starting program:
/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/libitm/testsuite/stackundo.exe 
Reading symbols for shared libraries + done
Reading symbols for shared libraries ++++........................ done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000001000010b0
clone_entry_compare (a=0x1000010a0, b=0x1000010b0) at
../../../gcc-4.7-20120126/libitm/clone.cc:105
105      if (aa->orig < bb->orig)
(gdb) bt
#0  clone_entry_compare (a=0x1000010a0, b=0x1000010b0) at
../../../gcc-4.7-20120126/libitm/clone.cc:105
#1  0x00007fff8ddd4894 in _qsort ()
#2  0x00000001016948c6 in _ITM_registerTMCloneTable (xent=0x1000010a0, size=2)
at ../../../gcc-4.7-20120126/libitm/clone.cc:155
Current language:  auto; currently c++


gdb ./clone-1.exeGNU gdb 6.3.50-20050815 (Apple version gdb-1708) (Thu Nov  3
21:59:02 UTC 2011)Copyright 2004 Free Software Foundation, Inc.GDB is free
software, covered by the GNU General Public License, and you arewelcome to
change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared
libraries .... done

(gdb) set disable-aslr off
(gdb) r
Starting program:
/sw/src/fink.build/gcc47-4.7.0-1/darwin_objdir/x86_64-apple-darwin11.2.0/libitm/testsuite/clone-1.exe 
Reading symbols for shared libraries + done
Reading symbols for shared libraries ++++........................ done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000001000010a8
clone_entry_compare (a=0x100001098, b=0x1000010a8) at
../../../gcc-4.7-20120126/libitm/clone.cc:105
105      if (aa->orig < bb->orig)
(gdb) bt
#0  clone_entry_compare (a=0x100001098, b=0x1000010a8) at
../../../gcc-4.7-20120126/libitm/clone.cc:105
#1  0x00007fff8ddd4894 in _qsort ()
#2  0x000000010299a8c6 in _ITM_registerTMCloneTable (xent=0x100001098, size=2)
at ../../../gcc-4.7-20120126/libitm/clone.cc:155
Current language:  auto; currently c++

Using built-in specs.
COLLECT_GCC=gcc-fsf-4.7
COLLECT_LTO_WRAPPER=/sw/lib/gcc4.7/libexec/gcc/x86_64-apple-darwin11.2.0/4.7.0/lto-wrapper
Target: x86_64-apple-darwin11.2.0
Configured with: ../gcc-4.7-20120126/configure --prefix=/sw
--prefix=/sw/lib/gcc4.7 --mandir=/sw/share/man --infodir=/sw/lib/gcc4.7/info
--with-build-config=bootstrap-lto --enable-stage1-languages=c,lto
--enable-languages=c,c++,fortran,lto,objc,obj-c++,java --with-gmp=/sw
--with-libiconv-prefix=/sw --with-ppl=/sw --with-cloog=/sw --with-mpc=/sw
--with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib
--program-suffix=-fsf-4.7 --enable-checking=yes --enable-cloog-backend=isl
Thread model: posix
gcc version 4.7.0 20120126 (experimental) (GCC)


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
@ 2012-01-30 18:52 ` howarth at nitro dot med.uc.edu
  2012-01-30 19:38 ` mrs at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-01-30 18:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

--- Comment #1 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-01-30 18:21:09 UTC ---
Note that darwin11 leverages the PIC default on darwin to create pie
executables by defaulting the linker to -pie when targeting 10.7 or later. The
question is whether, like gcc.dg/darwin-segaddr.c, that libitm.c/clone-1.c and
libitm.c/stackundo.c are meaningless for pie executables. If so, we should just
append -Wl,-no_pie to the flags on those tests as has been done for
gcc.dg/darwin-segaddr.c.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
  2012-01-30 18:52 ` [Bug libitm/52042] " howarth at nitro dot med.uc.edu
@ 2012-01-30 19:38 ` mrs at gcc dot gnu.org
  2012-01-31  9:48 ` iains at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mrs at gcc dot gnu.org @ 2012-01-30 19:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

mrs@gcc.gnu.org <mrs at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrs at gcc dot gnu.org

--- Comment #2 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> 2012-01-30 19:05:03 UTC ---
Patch using dg-additional-options pre-approved if these testcases are pie
incompatible.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
  2012-01-30 18:52 ` [Bug libitm/52042] " howarth at nitro dot med.uc.edu
  2012-01-30 19:38 ` mrs at gcc dot gnu.org
@ 2012-01-31  9:48 ` iains at gcc dot gnu.org
  2012-01-31 14:16 ` [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie iains at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: iains at gcc dot gnu.org @ 2012-01-31  9:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-01-31
     Ever Confirmed|0                           |1

--- Comment #3 from Iain Sandoe <iains at gcc dot gnu.org> 2012-01-31 08:34:33 UTC ---
on i686-darwin9:
 make check-target-libitm RUNTESTFLAGS="--target_board=unix/-fpie\{-m32,-m64\}"

clone-1 fails (m32, m64), but stackundo passes on both.

I don't know whether clone is incompatible with the concept of a slidable image
- or whether we just have a bug to chase down. 

Richard?


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
                   ` (2 preceding siblings ...)
  2012-01-31  9:48 ` iains at gcc dot gnu.org
@ 2012-01-31 14:16 ` iains at gcc dot gnu.org
  2012-01-31 18:42 ` howarth at nitro dot med.uc.edu
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: iains at gcc dot gnu.org @ 2012-01-31 14:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|x86_64-apple-darwin11       |*-apple-darwin*
               Host|x86_64-apple-darwin11       |*-apple-darwin*
            Summary|libitm.c/clone-1.c and      |libitm.c/clone-1.c (all
                   |libitm.c/stackundo.c        |darwin) and
                   |execution tests are not pie |libitm.c/stackundo.c
                   |compatible                  |(darwin 11) execution tests
                   |                            |fail with -fpie
              Build|x86_64-apple-darwin11       |*-apple-darwin*

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> 2012-01-31 13:55:44 UTC ---
(In reply to comment #3)
> on i686-darwin9:
>  make check-target-libitm RUNTESTFLAGS="--target_board=unix/-fpie\{-m32,-m64\}"
> 
> clone-1 fails (m32, m64), but stackundo passes on both.

this is repeated on {i686,x86-64,powerpc-darwin{9,10}

but clone-1.c passes -fpie on i686-linux (F14) ... I assume that the flag is
not ignored.

so, this seems to be a bug  ...


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
                   ` (3 preceding siblings ...)
  2012-01-31 14:16 ` [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie iains at gcc dot gnu.org
@ 2012-01-31 18:42 ` howarth at nitro dot med.uc.edu
  2012-02-07  4:02 ` patrick.marlier at gmail dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-01-31 18:42 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

--- Comment #5 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-01-31 17:54:09 UTC ---
(In reply to comment #3)
> on i686-darwin9:
>  make check-target-libitm RUNTESTFLAGS="--target_board=unix/-fpie\{-m32,-m64\}"
> 
> clone-1 fails (m32, m64), but stackundo passes on both.
> 

Same results on x86_64 darwin10. Note however that the alsr in Lion is supposed
to be
more exhaustive than that in previous releases. It seems from the discussion
at...

http://www.0xcafebabe.it/2011/10/15/on-macos-10-7-dyld-randomization/
http://gdtr.wordpress.com/tag/aslr/

that prior to Lion, the dyld image base wasn't randomized for -pie.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
                   ` (4 preceding siblings ...)
  2012-01-31 18:42 ` howarth at nitro dot med.uc.edu
@ 2012-02-07  4:02 ` patrick.marlier at gmail dot com
  2012-02-07 18:17 ` mrs at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: patrick.marlier at gmail dot com @ 2012-02-07  4:02 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

--- Comment #6 from Patrick Marlier <patrick.marlier at gmail dot com> 2012-02-07 04:02:08 UTC ---
Created attachment 26595
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26595
patch that seems to work for clone-1.c

Hi guys,

In fact, the problem is that getsectdata doesn't take into account the PIE. We
can use _dyld_get_image_vmaddr_slide(0) but it should not be correct in case of
many dynamic libraries I guess. What do you think? Should I propose this patch?

Patrick Marlier.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
                   ` (5 preceding siblings ...)
  2012-02-07  4:02 ` patrick.marlier at gmail dot com
@ 2012-02-07 18:17 ` mrs at gcc dot gnu.org
  2012-02-07 21:15 ` howarth at nitro dot med.uc.edu
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mrs at gcc dot gnu.org @ 2012-02-07 18:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

--- Comment #7 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> 2012-02-07 18:17:33 UTC ---
Yes, love to see a patch.  I think the argument is important to get right, as
otherwise the next bug to track down will be much harder to find (I call this
bug pushing).  If you can only do part of the job, that's fine, but, please add
an assert so that we don't get silently wrong data in cases that aren't handled
yet.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
                   ` (6 preceding siblings ...)
  2012-02-07 18:17 ` mrs at gcc dot gnu.org
@ 2012-02-07 21:15 ` howarth at nitro dot med.uc.edu
  2012-02-08  3:39 ` patrick.marlier at gmail dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: howarth at nitro dot med.uc.edu @ 2012-02-07 21:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

--- Comment #8 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-02-07 21:15:00 UTC ---
(In reply to comment #7)
While I haven't done a full bootstrap, applying the patch from comment 6 and
remaking the current build reduces the libitm failures to just...

FAIL: libitm.c++/eh-1.C execution test

at -m32/-m64 on x86_64-apple-darwin11 so this patch also eliminates the
stackundo.c execution failure.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
                   ` (7 preceding siblings ...)
  2012-02-07 21:15 ` howarth at nitro dot med.uc.edu
@ 2012-02-08  3:39 ` patrick.marlier at gmail dot com
  2012-02-15 19:24 ` pmarlier at gcc dot gnu.org
  2012-02-28 20:38 ` mrs at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: patrick.marlier at gmail dot com @ 2012-02-08  3:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

--- Comment #9 from Patrick Marlier <patrick.marlier at gmail dot com> 2012-02-08 03:38:24 UTC ---
Proposed fix here:
http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00321.html

All comments (and tests) are welcome!

Thanks.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
                   ` (8 preceding siblings ...)
  2012-02-08  3:39 ` patrick.marlier at gmail dot com
@ 2012-02-15 19:24 ` pmarlier at gcc dot gnu.org
  2012-02-28 20:38 ` mrs at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: pmarlier at gcc dot gnu.org @ 2012-02-15 19:24 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

--- Comment #10 from pmarlier at gcc dot gnu.org 2012-02-15 19:17:47 UTC ---
Author: pmarlier
Date: Wed Feb 15 19:17:42 2012
New Revision: 184281

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184281
Log:
2012-02-15  Iain Sandoe  <iains@gcc.gnu.org>
        Patrick Marlier  <patrick.marlier@gmail.com>

    PR libitm/52042
    * config/darwin-crt-tm.c (getTMCloneTable): New function.
    (__doTMRegistrations): Call it.
    (__doTMdeRegistrations): Likewise. 


Modified:
    trunk/libgcc/ChangeLog
    trunk/libgcc/config/darwin-crt-tm.c


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie
  2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
                   ` (9 preceding siblings ...)
  2012-02-15 19:24 ` pmarlier at gcc dot gnu.org
@ 2012-02-28 20:38 ` mrs at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: mrs at gcc dot gnu.org @ 2012-02-28 20:38 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52042

mrs@gcc.gnu.org <mrs at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #11 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> 2012-02-28 20:27:47 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-02-28 20:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-29 17:28 [Bug libitm/52042] New: libitm.c/clone-1.c and libitm.c/stackundo.c execution tests are not pie compatible howarth at nitro dot med.uc.edu
2012-01-30 18:52 ` [Bug libitm/52042] " howarth at nitro dot med.uc.edu
2012-01-30 19:38 ` mrs at gcc dot gnu.org
2012-01-31  9:48 ` iains at gcc dot gnu.org
2012-01-31 14:16 ` [Bug libitm/52042] libitm.c/clone-1.c (all darwin) and libitm.c/stackundo.c (darwin 11) execution tests fail with -fpie iains at gcc dot gnu.org
2012-01-31 18:42 ` howarth at nitro dot med.uc.edu
2012-02-07  4:02 ` patrick.marlier at gmail dot com
2012-02-07 18:17 ` mrs at gcc dot gnu.org
2012-02-07 21:15 ` howarth at nitro dot med.uc.edu
2012-02-08  3:39 ` patrick.marlier at gmail dot com
2012-02-15 19:24 ` pmarlier at gcc dot gnu.org
2012-02-28 20:38 ` mrs at gcc dot gnu.org

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).