Re: mprotect with PROT_NONE throws SIGBUS, not SIGSEGV
Re: mprotect with PROT_NONE throws SIGBUS, not SIGSEGV
- Subject: Re: mprotect with PROT_NONE throws SIGBUS, not SIGSEGV
- From: Andre Pang <email@hidden>
- Date: Wed, 2 Apr 2003 23:05:09 +1000
On Wednesday, April 2, 2003, at 01:59 AM, Steven Bytnar wrote:
On Tue, Apr 01, 2003 at 11:05:19PM +1000, Andre Pang wrote:
I have feeling that the following diff to xnu-10 is a start to solving
the problem, and may even be sufficient:
--- ./bsd/uxkern/ux_exception.c.old Tue Apr 1 22:52:52 2003
+++ ./bsd/uxkern/ux_exception.c Tue Apr 1 22:53:39 2003
@@ -277,7 +277,8 @@
switch(exception) {
case EXC_BAD_ACCESS:
- if (code == KERN_INVALID_ADDRESS)
+ if (code == KERN_INVALID_ADDRESS ||
+ code == KERN_PROTECTION_FAILURE)
*ux_signal = SIGSEGV;
else
*ux_signal = SIGBUS;
However, I can't actually test this because I'm running Mac OS X
10.2.4, and the 10.2.4 kernel (xnu-344.26) isn't up on the Apple CVS
servers yet :(.
You could always do a binary patch to your kernel! B)
[... snip ...]
This binary patch assumes that it's ok to return SIGSEGV for
code == KERN_SUCCESS, when before, it would return SIGBUS.
I tried doing a binary patch on the kernel (I just twiddled the word so
that it now returns a SIGSEGV instead of a SIGBUS), and while that
worked, it didn't really fix things because the SIGSEGV signal handler
doesn't get the faulting address. Oh well! Thanks very much for the
suggestion anyway, Steven.
--
% Andre Pang : trust.in.love.to.save
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.