Subject: Re: What is difference between SIGSEGV and SIGBUS
To: None <>
From: Greg Troxel <>
List: current-users
Date: 08/05/1995 11:11:08
Back in the days of PDP-11s, Version 6 and 7 and BSD 2.8, I believe
these were meant to correspond to processor traps.
There are two reasons (at least) on an 11 that a memory reference can
 segmentation violation: The memory map for the process does not
	map that address (8 segments, each with length, protection
	and physical address).
 bus error:  The memory map maps that address, but the bus access
        timed out.

A segmentation violation occurs when you access memory that the OS has
not set up for you to access.  A bus error happens when the memory
doesn't respond.  More commonly, it happens when the 'memory' is
really IO space, where only a few locations are valid.

In BSD today, with programs that have not mmap()'ed IO space, I would
argue that dereferencing a bogus pointer should in most cases get you

 This is the only thing that can explain why I get a SIGBUS when
 doing something which amounts to "fprintf(0, string, arg, arg2);", and
 get a SEGV when doing something which amounts to 
 "fprintf((FILE *)some-other-weird-but-undefined-addr, string, arg, arg2);"

Or perhaps the kernel explicitly delivers SIGBUS for NULL pointer,
because user programs should never normally get this, and thus it's a
hint that you did this.