Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2001 11:54:06 -0800 (PST)
From:      John Polstra <jdp@polstra.com>
To:        hackers@freebsd.org
Cc:        zzhang@cs.binghamton.edu
Subject:   Re: Process virtual memory question
Message-ID:  <200101111954.f0BJs6T10330@vashon.polstra.com>
In-Reply-To: <Pine.SOL.4.21.0101111352290.24593-100000@jade>
References:  <Pine.SOL.4.21.0101111352290.24593-100000@jade>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <Pine.SOL.4.21.0101111352290.24593-100000@jade>,
Zhiui Zhang  <zzhang@cs.binghamton.edu> wrote:
> 
> Thanks.  It just occurs to me that Linux kernel used to have something
> like this in routine BUG():
> 
>  * ((char *) 0) = 0;
> 
> It is called when there is a kernel bug.  So address 0 should not be
> mapped writable, otherwise all C statements " char * p = NULL; * p =
> value; " would be legal.

Right.  Address 0 is not mapped writable in FreeBSD.

> The book "Unix Internals - A Practical Approach" by S.D. Pate has a
> figure showing in ELF format, the stack lies BELOW the code segment
> and grows downwards.  This might have something to do with code
> starting from 0x8048000.

Yes, I think you are right, now that my memory is returning. :-) In
SVR4 the stack grew downwards from 0x8000000.  I think that libc and
the dynamic linker (all together in one shared library) were mapped
between 0x8000000 and 0x8048000.  But that is just a guess.  Most
modern libcs wouldn't fit in that amount of space these days.

John
-- 
  John Polstra                                               jdp@polstra.com
  John D. Polstra & Co., Inc.                        Seattle, Washington USA
  "Disappointment is a good sign of basic intelligence."  -- Chögyam Trungpa



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101111954.f0BJs6T10330>