Subject: siginfo & no-exec permission - please test
To: None <port-sparc64@netbsd.org>
From: Matthias Drochner <M.Drochner@fz-juelich.de>
List: port-sparc64
Date: 02/19/2004 19:35:32
This is a multipart MIME message.

--==_Exmh_66463301759790
Content-Type: text/plain; charset=us-ascii


Hi -
I don't have a ppc box to test with atm, but I've done
related fixes to other architectures, and from code
inspection it appears to me that a little fix should be
applied to the sparc64 as well.
Desired behaviour is that a SIGSEGV is delivered to a
process, with a siginfo si_code of SEGV_ACCERR if code
execution is attempted from virtual memory mapped without
execution permission (especially the stack).
The appended patched should implement this.

The regression test in regress/sys/uvm/stack_noexec
should be sufficient to verify.

best regards
Matthias



--==_Exmh_66463301759790
Content-Type: text/plain ; name="sparc64nox.txt"; charset=us-ascii
Content-Description: sparc64nox.txt
Content-Disposition: attachment; filename="sparc64nox.txt"

Index: sparc64/sparc64/trap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc64/sparc64/trap.c,v
retrieving revision 1.114
diff -u -r1.114 trap.c
--- sparc64/sparc64/trap.c	18 Jan 2004 19:41:07 -0000	1.114
+++ sparc64/sparc64/trap.c	19 Feb 2004 18:27:49 -0000
@@ -1562,8 +1562,7 @@
 			segsz_t nss = btoc(p->p_vmspace->vm_minsaddr - va);
 			if (nss > vm->vm_ssize)
 				vm->vm_ssize = nss;
-		} else if (rv == EACCES)
-			rv = EFAULT;
+		}
 	}
 	if (rv != 0) {
 

--==_Exmh_66463301759790--