[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Re: [Sheflug - Sheffield Linux User's Group] Re:Segfaults & ld.so wierditude



On Tue, 2 May 2000, Stephen J. Turnbull wrote:

> >>>>> "Bob" == Bob Ham <u9rah [at] dcs.shef.ac.uk> writes:
> 
>     Bob> Like I say, it's not my instruction that's segfaulting.
> 
> A bogus pointer can point _anywhere_.  The code manipulating the bogus
> pointer doesn't care; the code that gets mashed, does.  Your (bogus)
> code doesn't crash, it's the code that lives in memory that gets
> smashed by the bogus code crashes.  Or code that uses data that gets
> smashed.  Many versions of malloc keep malloc housekeeping data mixed
> with the heap:
> 
> +--------------+
> | malloc parms |
> +--------------+
> |              | <-- aPtr
> |  heap data   |
> |              |
> +--------------+
> 
> Guess what happens to malloc if you do aPtr++ = rand(); ?
> 
> (I don't know if this is true of dlmalloc.)

I was under the impression that a segfault was given when an instruction
tries to write to a piece of memory it's not allowed to. Surely I'm not
allowed to write over malloc()'s hosuekeeping data?


>     >> Have you tried Electric Fence and cousins?
> 
>     Bob> Never heard of it; care to expand on that?
> 
> Standard package in all the distributions AFAIK (Debian and
> TurboLinux, anyway).  Replaces malloc and automatically watches all
> pointers amlloced for evil behavior.

I'll check it out, cheers.

Bob

--
Bob Ham:  bob [at] timecity.org   http://flux.mentaltempt.org/~node/
IRC: 'Bob' on irc.openprojects.net: #Slashdot #TimeCity
ICQ: 4396425 'The Tek' & 27699423 'The Tek.'

Time City Level Designer
Time City: http://www.timecity.org/
My work: http://flux.mentaltempt.org/~node/tc/

This email is Copyright (C) 2000 Robert Ham.  Copyright is protected in law
in the UK and by treaty in other countries. Permission to reproduce is
strictly forbidden.  If you wish to reproduce this email's content, please
apply by email to bob [at] timecity.org.

---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word 
 "unsubscribe" in the body of the message. 

  GNU the choice of a complete generation.