This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libffi/28036] New: libffi executable stack (missing .note.GNU-stack on .o files)
- From: "nigelenki at comcast dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Jun 2006 04:37:20 -0000
- Subject: [Bug libffi/28036] New: libffi executable stack (missing .note.GNU-stack on .o files)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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