PATCH: nonexec stack for wine libraries

Marcus Meissner meissner at suse.de
Fri Jan 20 06:13:49 CST 2006


On Fri, Jan 20, 2006 at 11:59:27AM +0100, Marcus Meissner wrote:
> 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.

Next try, reducing it to a platform specific check.

I can't really test it on anything but Linux, so if it fails
just add to the case PLATFORM_WINDOWS case.

Ciao, Marcus

Changelog:
	Output a .note.GNU-stack section to allow nonexecutable stack.

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 12:12:20 -0000
@@ -202,6 +202,16 @@
         fprintf( outfile, "/* File generated automatically; do not edit! */\n" );
     fprintf( outfile,
              "/* This file can be copied, modified and distributed without restriction. */\n\n" );
+
+    switch (target_platform) {
+    case PLATFORM_WINDOWS:	/* Working differently on Windows I guess */
+        break;
+    /* not sure about APPLE or SVR4, but they might use gnu utils */
+    default:
+        fprintf (outfile,".section .note.GNU-stack,\"\", at progbits\n");
+        fprintf (outfile,".previous\n");
+	break;
+    }
 }
 
 /* dump a byte stream into the assembly code */



More information about the wine-patches mailing list