public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/29231]  New: powerpc libgcc writes code to the stack
@ 2006-09-25 23:21 debian-gcc at lists dot debian dot org
  2006-09-25 23:53 ` [Bug middle-end/29231] need a way to produce trampolines not on " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2006-09-25 23:21 UTC (permalink / raw)
  To: gcc-bugs

[forwarded from http://bugs.debian.org/382746]

reported for 4.1 SVN 20060608,

  Matthias

__trampoline_setup in /lib/libgcc_s.so.1 puts code on the stack.

This contributes to insecurity on powerpc.

A half-way fix is to mmap a page for this evil crud.
This still violates good practice, needing the OS to
allow either write+execute or a dangerous transition
from write to execute. It'd be an improvement though.
Doing write+execute may be better, allowing the OS
to locate the page within a segment (256 MiB chunk
on PowerPC) which already has executable pages.

A better method would be to supply a page full of
trampoline functions in libgcc. Each function would:

1. examine its own address
2. map from the page of code to a page of data
3. use that data to implement the trampoline

Trampoline setup would thus involve filling in the
data and choosing the matching function to use.

Once libgcc stops putting code on the stack, gcc
needs to mark all executables as not requiring an
executable stack.


-- 
           Summary: powerpc libgcc writes code to the stack
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: debian-gcc at lists dot debian dot org
GCC target triplet: powerpc-linux-gnu


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


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

* [Bug middle-end/29231] need a way to produce trampolines not on the stack
  2006-09-25 23:21 [Bug target/29231] New: powerpc libgcc writes code to the stack debian-gcc at lists dot debian dot org
@ 2006-09-25 23:53 ` pinskia at gcc dot gnu dot org
  2006-09-26  0:44 ` geoffk at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-25 23:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-09-25 23:53 -------
Really there is no way to fix this without compiler help.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
          Component|target                      |middle-end
 GCC target triplet|powerpc-linux-gnu           |
            Summary|powerpc libgcc writes code  |need a way to produce
                   |to the stack                |trampolines not on the stack


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


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

* [Bug middle-end/29231] need a way to produce trampolines not on the stack
  2006-09-25 23:21 [Bug target/29231] New: powerpc libgcc writes code to the stack debian-gcc at lists dot debian dot org
  2006-09-25 23:53 ` [Bug middle-end/29231] need a way to produce trampolines not on " pinskia at gcc dot gnu dot org
@ 2006-09-26  0:44 ` geoffk at gcc dot gnu dot org
  2006-09-26  4:06 ` acahalan at gmail dot com
  2009-01-01 21:25 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: geoffk at gcc dot gnu dot org @ 2006-09-26  0:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from geoffk at gcc dot gnu dot org  2006-09-26 00:44 -------
If you tried the page-of-functions idea, what would you do if you'd used all
the functions on the page and needed another one?


-- 

geoffk at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug middle-end/29231] need a way to produce trampolines not on the stack
  2006-09-25 23:21 [Bug target/29231] New: powerpc libgcc writes code to the stack debian-gcc at lists dot debian dot org
  2006-09-25 23:53 ` [Bug middle-end/29231] need a way to produce trampolines not on " pinskia at gcc dot gnu dot org
  2006-09-26  0:44 ` geoffk at gcc dot gnu dot org
@ 2006-09-26  4:06 ` acahalan at gmail dot com
  2009-01-01 21:25 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: acahalan at gmail dot com @ 2006-09-26  4:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from acahalan at gmail dot com  2006-09-26 04:06 -------
(In reply to comment #2)
> If you tried the page-of-functions idea, what would you do if you'd used all
> the functions on the page and needed another one?
> 

You'd do the same as if you'd used up all the stack space.
The existing method doesn't handle running out of room,
and I don't see why the requirements would be any different
for this method.


-- 

acahalan at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acahalan at gmail dot com


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


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

* [Bug middle-end/29231] need a way to produce trampolines not on the stack
  2006-09-25 23:21 [Bug target/29231] New: powerpc libgcc writes code to the stack debian-gcc at lists dot debian dot org
                   ` (2 preceding siblings ...)
  2006-09-26  4:06 ` acahalan at gmail dot com
@ 2009-01-01 21:25 ` pinskia at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-01-01 21:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-01-01 21:22 -------
This is why the PowerOpen ABI is good, it does not require stack based
trampolines.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|patch                       |


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


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

end of thread, other threads:[~2009-01-01 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-25 23:21 [Bug target/29231] New: powerpc libgcc writes code to the stack debian-gcc at lists dot debian dot org
2006-09-25 23:53 ` [Bug middle-end/29231] need a way to produce trampolines not on " pinskia at gcc dot gnu dot org
2006-09-26  0:44 ` geoffk at gcc dot gnu dot org
2006-09-26  4:06 ` acahalan at gmail dot com
2009-01-01 21:25 ` pinskia at gcc dot gnu dot 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).