Messing with 0 ptr on m68020 & sys V / 68

Bjorn Engsig bengsig at orcenl.uucp
Mon Nov 28 19:21:35 AEST 1988


In article <784 at clinet.FI>, riku at clinet.FI (Riku Kalinen) writes:
> Questions:
>   1) Why? This causes reference thru 0 ptr to return 0 instead of core dump.
>      (Of course, if I try to write something there, everything crashes as it
>       should.)
>   2) Who sets up process's memory when it is started? Kernel?
>   3) Is there any good reasons to do this.
This "bug" has to be present for many of the utilities to run.  In e.g.
the SCCS, lots of programs has a chain of pointers, which end by just
referencing (xxx *)0 for reading.  That's just the way it is coded.  Your
OS vendor the has to allow you to read from address 0, whatever is there,
but you can of course not count on the contents, and (as you point out)
writing there gives you a bus-error (or segmentation violation).
-- 
Bjorn Engsig, ORACLE Europe      \ /    "Hofstaedter's Law:  It always takes
 ..!uunet!mcvax!orcenl!bengsig    X      longer than you expect, even if you
phone:  +31 21 59 56 411         / \     take into account Hofstaedter's Law"



More information about the Comp.lang.c mailing list