From: Eric Youngdale (eric@tantalus.nrl.navy.mil)
Date: 02/26/93


From: eric@tantalus.nrl.navy.mil (Eric Youngdale)
Subject: Re: Buggy scandir in Libc4.3 (was: Problem with aXe loading files?)
Date: Fri, 26 Feb 1993 16:03:39 GMT

In article <1993Feb26.130945.9034@dcs.warwick.ac.uk> alfie@dcs.warwick.ac.uk (Nick Holloway) writes:
>But, does this mean that dereferencing a null function pointer will _not_
>cause the program to abort? Or is it something magic inside library?
>
>I shall have to try this when I get home:
>
> main ()
> {
> void (*fp)() = 0;
>
> (* fp) ();
> }
>

        I can tell you that this will not do good things for you. The problem
is that there is a design flaw in the a.out binaries, because they are based at
virtual address 0. The startup code in crt0.o will be placed starting at
virtual address 0, and the kernel will start execution at that address. If you
jump off to address 0, you will call the startup code in crt0 all over again,
which will try and reload the sharable libraries, and try and do the fixups all
over again. If I were doing it all over, I would have an unmapped page at
address 0 so that the above program would die with a segmentation fault.

-Eric

--