public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "nigelenki at comcast dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libffi/28036]  New: libffi executable stack (missing .note.GNU-stack on .o files)
Date: Thu, 15 Jun 2006 04:40:00 -0000	[thread overview]
Message-ID: <bug-28036-8896@http.gcc.gnu.org/bugzilla/> (raw)

I noticed (on ubuntu) that libgcj had an executable stack; tracing this back, I
found that libffi also had an executable stack, and why.  pinskia informs me
that libffi gets linked into libgcj so that solves that!

SCANELF:
bluefox@icebox:/tmp/x$ scanelf -qeRt /usr/lib
RWX --- ---   /usr/lib/libgcj.so.7.0.0


I built gcc and ran a scanelf on the source tree to find out what was up and
located a few .o files missing .note.GNU-stack

SCANELF:
bluefox@icebox:/tmp/x$ scanelf -qeRt .
RWX --- ---   ./gcj-4.1-4.1.0/build/i486-linux-gnu/libffi/.libs/libffi.so.4.0.1
!WX --- ---   ./gcj-4.1-4.1.0/build/i486-linux-gnu/libffi/src/x86/sysv.o
!WX --- ---   ./gcj-4.1-4.1.0/build/i486-linux-gnu/libffi/src/x86/unix64.o
!WX --- ---   ./gcj-4.1-4.1.0/build/i486-linux-gnu/libffi/src/x86/.libs/sysv.o
!WX --- ---  
./gcj-4.1-4.1.0/build/i486-linux-gnu/libffi/src/x86/.libs/unix64.o


sysv.o and unix64.o, find them:

FIND:
bluefox@icebox:/tmp/x$ find . -name sysv.S
./gcj-4.1-4.1.0/src/libffi/src/sh/sysv.S
./gcj-4.1-4.1.0/src/libffi/src/cris/sysv.S
./gcj-4.1-4.1.0/src/libffi/src/s390/sysv.S
./gcj-4.1-4.1.0/src/libffi/src/x86/sysv.S
./gcj-4.1-4.1.0/src/libffi/src/m68k/sysv.S
./gcj-4.1-4.1.0/src/libffi/src/sh64/sysv.S
./gcj-4.1-4.1.0/src/libffi/src/m32r/sysv.S
./gcj-4.1-4.1.0/src/libffi/src/arm/sysv.S
./gcj-4.1-4.1.0/src/libffi/src/powerpc/sysv.S

Let's peek in x86:
bluefox@icebox:/tmp/x$ ls gcj-4.1-4.1.0/src/libffi/src/x86/
ffi64.c  ffi.c  ffitarget.h  sysv.S  unix64.S  win32.S

win32.S can probably be ignored, however...
bluefox@icebox:/tmp/x$ grep -Hnr ".note.GNU-stack" gcj-4.1-4.1.0/src/libffi/
bluefox@icebox:/tmp/x$

The others probably need this block at the end (yanked from [1]):
#ifdef __ELF__
.section .note.GNU-stack,"",%progbits
#endif

No idea if this will clear the executable stack, haven't tested; but it'll
supply a proper .note.GNU-stack segment where it really should be at least.

[1] http://www.gentoo.org/proj/en/hardened/gnu-stack.xml


-- 
           Summary: libffi executable stack (missing .note.GNU-stack on .o
                    files)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libffi
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nigelenki at comcast dot net


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


             reply	other threads:[~2006-06-15  4:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-15  4:40 nigelenki at comcast dot net [this message]
2006-06-15  5:29 ` [Bug libffi/28036] " pinskia at gcc dot gnu dot org
2006-06-15 11:31 ` aph at gcc dot gnu dot org
2006-12-13 15:58 ` debian-gcc at lists dot debian dot org

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=bug-28036-8896@http.gcc.gnu.org/bugzilla/ \
    --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: link
Be 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).