[net.unix-wizards] Zero Based Program Query

jim@hp-pcd.UUCP (09/22/83)

#N:hp-pcd:19500003:000:749
hp-pcd!jim    Sep 19 14:17:00 1983



	Should all user programs be mapped so that they are
	zero based?

	We have noticed a problem with an application program (fsck)
	when it is run in an address map that is non-zero based.
	By non-zero based I mean the program is linked to be based at
	a non-zero logical address, i.e. 0x800000.  When fsck attempts
	to allocate a working buffer, the first thing is does is
	an sbrk to find out how big it is.  The number returned
	in the non-zero based case is 0x800000+(size of fsck).
	When fsck attempts to compare this number with an arbitrary
	max size, it gets confused.

	Are there other programs which expect to be zero based,
	or is fsck an isolated example?

	Thanks for your help,
	Jim Andreas
	hp-pcd\!jim
	(ucbvax\!harpo\!hp-pcd\!jim)

guy@rlgvax.UUCP (Guy Harris) (09/23/83)

Our Power 5 machines (MC68000-based) start the user's address space at
0x800000, and run all the System III utilities except for a few like
the system activities package and the error logging code, so none of those
utilities cannot be fixed to work in such an address space.  In fact, I would
vote that any system which can start the user's address space at a point
higher than zero and which have enough address space that this isn't wasteful
should do so in order to trap nasty programs which attempt to dereference
null pointers (a lot of UNIX utilities assume that 0 points to a null string,
which is nasty beyond belief, and many of those that don't still don't check
that a pointer which may be null isn't before dereferencing it).  I could
dig up what we did to "fsck" if you want.

	Guy Harris
	{seismo,mcnc,we13,brl-bmd,allegra}!rlgvax!guy