Re: sigbus vs sigsegv on mprotect() exeception?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com -- Terry On Oct 26, 2008, at 4:05 PM, Brad Parker <brad@heeltoe.com> wrote: Hi, I'm running mac os 10.5.5 on an x86 cpu. I noticed that mprotect()'d pages throw SIGBUS for violations. My code (which admittedly started on linux) expects SIGSEGV. -brad _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/tlambert%40apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... Dereference of null pointers causes SIGBUS because we map an inaccessible page at page zero to prevent an accessible page being mapped there instead. For 64 bit programs, we do the same for the low 4G to catch pointer truncations from things like pointer-int-pointer pig tricks. If you don't like it you can always mmap and munmap a page on top of it to get an SIGSEGV instead. Is there any standard document which covers this behavior? I'm guessing that 99.99% of the world would never notice. any thoughts on this? what does freebsd do? or solaris? just curious. This email sent to tlambert@apple.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert