[Mono-bugs] [Bug 49499][Cri] Changed - mono:: segfaults under Fedora Linux

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 20 Oct 2003 12:20:10 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by tds00mahi@thn.htu.se.

http://bugzilla.ximian.com/show_bug.cgi?id=49499

--- shadow/49499	2003-10-20 09:36:02.000000000 -0400
+++ shadow/49499.tmp.27980	2003-10-20 12:20:10.000000000 -0400
@@ -314,6 +314,27 @@
 is enough? Doing another syscall is expensive, and it should really be
 no different. Still, this is weird, since we don't execute code from
 the PE binaries: there must be some other bug (maybe in RH's kernel).
 Do you get the same backtrace for the segfaults as Raphael? Can you
 print in gdb the variables accessed on the segfault line (method->name
 and klass)?
+
+------- Additional Comments From tds00mahi@thn.htu.se  2003-10-20 12:20 -------
+I had myself confused here for a while why the patch actually worked,
+I think I might have a better solution than mprotect - mostly because
+the mprotect one is downright confusing.
+
+Adding the PROT_EXEC to the mmap call did not work, honestly I don't
+know why but from what I understand of exec-shield it moves mappings
+around and only allows execution rights within certain memory areas
+(or, I'm way off, in which case you may now start to point and laugh :-).
+
+Eventually I came across the exec-shield notes here:
+http://distro.ibiblio.org/pub/Linux/distributions/redhat/rawhide/i386/RELEASE-NOTES
+. And by doing an 'export LDFLAGS=-Wl,-z,execstack' to mark the
+binaries as having executable stacks (I reckon exec-shield also
+prevents exec rights on mmap()ed areas and malloc()ed heap, but I'm
+not sure if this flag revokes those rights as well?) I get successful
+results. So I guess this is the preferred way to do it? I don't know
+if this should be passed all the time or if we only should do it if it
+is compiled with a toolchain that specifies the .note.GNU-stack and
+PT_GNU_STACK.