Okay. Just exactly what is the difference between a segmentation fault and
a bus error.
A segmentation fault is a tectonic quirk and a bus error results in youQuote:>Okay. Just exactly what is the difference between a segmentation fault and
>a bus error.
My opinions do NOT represent those of Groupe Sobeco. Daniel Chouinard
_-___--- _--__-_- _---_-__ __-_____ _--____- Groupe Sobeco
> A segmentation fault is a tectonic quirk and a bus error results in you
>getting to west 42nd when you intended to go to grandma's house. :-)
The names come from the hardware of the PDP-1/8/10/11/(your guess here)
on which UNIX was first hacked. The actual answer is
dependent on the hackish nature of your system's
The general consensus is that a SIGSEGV is generated when
you ask for (read/write) a segment (or page) that the
system can't find or refuses to find; and a SIGBUS is
generated when you ask for a location that is protected or
otherwise not yours to touch (periperal addresses, et al).
The big difference is that the MMU bolted onto your CPU
should initiate SIGSEGV and something on the bus should
initiate a SIGBUS.
Unless I have this backwards. :-/
"Which side of the plug is neutral?"
You indeed do have it backwards, it is a segmentation fault if you access outside
of that segment of memory that you have permission to access and a bus error if you
attempt to access outside of memory. In practice of course there is no difference,
it's probably a screwed pointer.
Ericsson Telecom AB
That is probably very machine specific.
This is how it was originally, on the pdp11 (from user's point of view):
If you addressed a word with an odd address, you got a "Bus Error",
since that was impossible on the pdp11 architecture (bus). There was
also other conditions which could give this error.
If you addressed memory in a way disallowed by the memory-management
unit, for example, outside of your memory, you got a "Memory
management trap", which named segmentation fault.
These two were different interrupt types on the hardware level. On
other cpu's the meaning of the traps might be something completely
different. But typically I would guess that addressing outside of your
memory areas will give "segmentation fault", and other kind of
hardware exceptions "bus error".
Being new to Unix (BSD), I'm trying to absorb as much as I can. Does
this group have a FAQ?
I read an article about how hackers could take a file owned by root with
777 rights, they could insert /bin/sh, then execute the file and it
would drop them to a shell with root privileges. (I can't find the text
file now, so this might be slightly off).
If this is true, how would you protect against it (Root has to run/own
certain things with these permissions, no?).
Like I said, being new to Unix, I'm still getting use to things like
users, groups, permissions, ex., and their security issues.. If anyone
has any links that would help in this department, please post them.