Xref: utzoo comp.unix.wizards:22790 comp.unix.i386:6598 Path: utzoo!attcan!uunet!mcsun!ukc!dcl-cs!aber-cs!odin!pcg From: pcg@cs.aber.ac.uk (Piercarlo Grandi) Newsgroups: comp.unix.wizards,comp.unix.i386 Subject: Re: Implementing NULL trapping on AT&T SVR3.2(.2) Message-ID: Date: 7 Jul 90 16:25:36 GMT References: <412@minya.UUCP> <13291@smoke.BRL.MIL> <1990Jul5.174608.17336@eci386.uucp> <1990Jul6.115941.11096@cbnews.att.com> Sender: pcg@aber-cs.UUCP Organization: Coleg Prifysgol Cymru Lines: 39 In-reply-to: junk1@cbnews.att.com's message of 6 Jul 90 11:59:41 GMT Posting-Front-End: GNU Emacs 18.55.4 of Thu Nov 23 1989 on athene (berkeley-unix) In article <1990Jul5.174608.17336@eci386.uucp> clewis@eci386.UUCP (Chris Lewis) writes: On System V (I'm 386/ix 1.0.6), the memory layout of an executable program is controlled by a default loader control file ("ifile"), ... 386 one uses the "defaults" built into "ld"'s binary, which I can't seem to be able to reconstruct from the 386/ix Guide entries for the loader. You cannot. The example assumes a linker primtive that is not actually there. This one is the one that tells you how long is the COFF header; without this you must waste almost a pageful in the executable... 2) Has anybody got a working ifile for 386 UNIX systems that explicitly maps *out* at least the first couple of pages at virtual 0 so that null dereferences fault? Is this possible? (does the 386/ix execution model memory requirements forbid this?) That is pretty easy. All you have to do is to read as a preliminary the Unix Papers (SAMS) article on the port of System V to the 386, as there are a couple of non obvious tricks: you must make the data begin at the same within the page offset where the code ends, and you must make the code begin -- within the loadable file itself -- at a page boundary. I had posted some months ago a full set of patches to g++ 1.36.x that contained this ifile, and the ifile itself separately. If any kind soul has saved, they might want to repost it (should go in the frequently asked questions writeup) or send it to Chris Lewis (my copy is on my home machine, i.e. not handy here). Another alternative is to use the gdb patches that enable watchpoints, and set a watchpoint on address 0. -- Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcsun!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk