XMAGIC: a.out without a valid page 0?

jdb at mordor.UUCP jdb at mordor.UUCP
Fri Jun 8 04:23:05 AEST 1984


We're running 4.2BSD on a VAX (750).  Too many times we have been bitten by
software that references through NULL pointers.  The evils of this have been
discussed from time to time in this newsgroup, so I won't go into them again.

We are considering the implementation of a new "a.out" format with a new magic
number (XMAGIC).  The text segment would start at 1024 rather than zero, and
the data segment would start at the next page boundary after the text segment.
Page 0 would be unmapped (i.e. a program which tries to touch it will get a
SIGSEGV).

Clearly it is easy to change "ld" to produce XMAGIC-format files.  My current
inclination is to simply start text relocation at 1024, set the a_entry field
of the "a.out" header to 1024, and fill page zero (in the "a.out" file) with
zeros.  Then the page offsets in the file are identical for XMAGIC and ZMAGIC
files, and--aside from the kernel keeping page 0 invalid--the load-on-demand
code for ZMAGIC files should work unchanged.

Has anyone done this (or something similar)?
-- 
  John Bruner (S-1 Project, Lawrence Livermore National Laboratory)
  MILNET: jdb at mordor.ARPA [jdb at s1-c]	(415) 422-0758
  UUCP: ...!ucbvax!dual!mordor!jdb 	...!decvax!decwrl!mordor!jdb



More information about the Comp.unix.wizards mailing list