PATCH: nonexec stack for wine libraries
Marcus Meissner
meissner at suse.de
Fri Jan 20 04:59:27 CST 2006
Hi,
This makes our libraries compile marked as not needed an executeable
stack.
Its not yet fully making it non-x, but its a step.
To confirm that behaviour changed, run:
readelf -a foo.dll.so|grep GNU_STACK
It will change from RWE flags to RW flags.
Ciao, Marcus
Changelog:
Add a .note.GNU-stack section to our generated
assembler files to allow non-executable stacks.
Index: configure.ac
===================================================================
RCS file: /home/wine/wine/configure.ac,v
retrieving revision 1.422
diff -u -r1.422 configure.ac
--- configure.ac 14 Jan 2006 17:00:26 -0000 1.422
+++ configure.ac 20 Jan 2006 10:50:50 -0000
@@ -90,6 +90,21 @@
AC_PATH_XTRA
AC_PROG_LEX
+AC_MSG_CHECKING([if $AS can emit a .note.GNU-section]);
+rm -f conf$$.s
+cat > conf$$.s <<EOF
+ .section .note.GNU-stack,"", at progbits
+ .previous
+
+EOF
+if $AS conf$$.s -o conf$$.o; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_GNUSTACK,1,[Define if your assembler understands .section .note.GNU-stack,"", at progbits])
+else
+ AC_MSG_RESULT([no])
+fi
+rm -f conf$$.s conf$$.o
+
dnl **** Just additional warning checks, since AC_PROG just sets 'lex' even
dnl **** without one present.
AC_CHECK_PROGS(XLEX,$LEX flex lex,none)
Index: tools/winebuild/utils.c
===================================================================
RCS file: /home/wine/wine/tools/winebuild/utils.c,v
retrieving revision 1.40
diff -u -r1.40 utils.c
--- tools/winebuild/utils.c 19 Dec 2005 09:24:10 -0000 1.40
+++ tools/winebuild/utils.c 20 Jan 2006 10:50:50 -0000
@@ -202,6 +202,11 @@
fprintf( outfile, "/* File generated automatically; do not edit! */\n" );
fprintf( outfile,
"/* This file can be copied, modified and distributed without restriction. */\n\n" );
+
+#ifdef HAVE_GNUSTACK
+ fprintf (outfile,".section .note.GNU-stack,\"\", at progbits\n");
+ fprintf (outfile,".previous\n");
+#endif
}
/* dump a byte stream into the assembly code */
More information about the wine-patches
mailing list