Subject: questions on SIGBUS vs. SIGSEGV
To: help netbsd <netbsd-help@NetBSD.ORG>
From: Ron Minnich <rminnich@mini.sarnoff.com>
List: netbsd-help
Date: 11/22/1994 17:10:44
First question: when you touch a memory region which is mapped but has 
the protection bits set different than the access, you get a SIGBUS. On 
most unices i've used you get a SIGSEGV. I can handle it, i'm just 
curious if anyone knows why. 

I.e. if i have a piece of read-only memory and do a store, on an sgi or
similar system i get a sigsegv (makes sense -- memory's there, but you are
doing something illegal and the MMU caught you); on netbsd it's a sigbus
(which traditionally means you went out on the bus and no memory was there --
i.e. no DTACK :-)). Just curious.

Second question. On the i386, i can't find any way to distinguish sigbus 
due to:
1) load from a memory area with no read or write access
2) store to a memory area with no write access, but read access

doesn't seem to be in the sigcontext for sure, not in the code ... this 
is a problem. Is this an oversight or is it supposed to work this way? 
It's a major performance hit for something i'm doing, and if it's OK to 
change it i will in the kernel, either via a change to 'code' or maybe to 
i don't know what ... 

Oh yeah this is using sigaction. Maybe sigaction is a bad idea, but it's 
the way i've gotten used to 'cause on sgi it's the only signal handler 
that delivers any useful information at all.

ron

Ron Minnich                |"CAMDEN (AP) - The city this year plans to scale
rminnich@earth.sarnoff.com | back its volunteer-led Mischief Night campaign,
(609)-734-3120             | which is aimed at preventing pranksters from 
                           | torching the city ... "
                           | -- and you thought L.A. was a tough town ...