Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site mordor.UUCP
Path: utzoo!linus!vaxine!wjh12!genrad!grkermit!masscomp!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!floyd!cmcl2!seismo!ut-sally!mordor!jdb
From: jdb@mordor.UUCP
Newsgroups: net.unix-wizards
Subject: XMAGIC: a.out without a valid page 0?
Message-ID: <3732@mordor.UUCP>
Date: Thu, 7-Jun-84 14:23:05 EDT
Article-I.D.: mordor.3732
Posted: Thu Jun  7 14:23:05 1984
Date-Received: Wed, 13-Jun-84 04:50:41 EDT
Organization: S-1 Project, LLNL
Lines: 22

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@mordor.ARPA [jdb@s1-c]	(415) 422-0758
  UUCP: ...!ucbvax!dual!mordor!jdb 	...!decvax!decwrl!mordor!jdb