Article View: net.bugs
Article #1764BSD VAX loader bug
From: Steven M. Kramer
Date: Thu, 02 Feb 1984 17:43
Date: Thu, 02 Feb 1984 17:43
51 lines
2130 bytes
2130 bytes
I found a bug in the VAX 4.2BSD loader. The bug probably exists
in other systems using the long names stuff. In ldrand(), a
symbol is looked up from a lib to see if it is needed by the
program so far. If not, it's supposed to leave. Well, slookup()
returns a pointer to NULL is the symbol is not defined. Here,
it's checking for a NULL pointer (a subtle difference) instead.
What happends is that a bizzarre reference takes place if *hp=0
that may or may not core dump. The fix below is in a #ifdef AXIOM.
Also, I would suggest changing cfree() to free() in the references
in the loader. (Note cfree() [which is around but not documented]
takes 3 args and free() takes only 1. Only 1 are supplied to cfree().
[cfree:calloc::free:malloc for those who want to know]
--many happy loads
---------------------------------------
ldrand()
{
register struct nlist *sp, **hp;
register struct ranlib *tp, *tplast;
off_t loc;
int nsymt = symx(nextsym);
tplast = &tab[tnum-1];
for (tp = tab; tp <= tplast; tp++) {
if ((hp = slookup(tp->ran_un.ran_name)) == 0)
continue;
sp = *hp;
#ifdef AXIOM
/*
* sp could be NULL. If so, the symbol is not
* defined yet so don't bother with it.
* Steve Kramer 2/2/84 Axiom Technology
*/
if (sp == NULL)
continue;
#endif
if (sp->n_type != N_EXT+N_UNDF)
continue;
step(tp->ran_off);
loc = tp->ran_off;
while (tp < tplast && (tp+1)->ran_off == loc)
tp++;
}
return (symx(nextsym) != nsymt);
}
--
--steve kramer
{allegra,genrad,ihnp4,utzoo,philabs,uw-beaver}!linus!axiom!smk (UUCP)
linus!axiom!smk@mitre-bedford (MIL)
Technical Details
Message-ID:
<474@axiom.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!linus!axiom!smkShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site axiom.UUCP Path: arc1-ca.pugleaf.net!utzoo!linus!axiom!smk From: smk@axiom.UUCP (Steven M. Kramer) Newsgroups: net.bugs,net.bugs.4bsd Subject: 4BSD VAX loader bug Message-ID: <474@axiom.UUCP> Date: Thu, 2-Feb-84 12:43:08 EST Article-I.D.: axiom.474 Posted: Thu Feb 2 12:43:08 1984 Date-Received: Fri, 3-Feb-84 02:22:30 EST Organization: Axiom Technology, Newton MA Lines: 51