From: David Chandler <chandler@grammatech.com>
To: root@chaos.analogic.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: Bug Report: Dereferencing a bad pointer
Date: Thu, 08 Nov 2001 12:17:05 -0500 [thread overview]
Message-ID: <3BEABE11.AFF00CF0@grammatech.com> (raw)
In-Reply-To: <Pine.LNX.3.95.1011108103553.22138A-100000@chaos.analogic.com>
Dick,
You're right that the one-liner below may not necessarily produce a seg
fault, but shouldn't it terminate normally if it doesn't? After all,
the program just *reads*. Hanging does not seem to be an option!
BTW, your example program produces very similar output for the 2.4 and
2.2 kernels to which I have access. I apologize for any confusion my
original report created -- 0xc0000000 was chosen because of its relation
to the start of the stack frame, and indeed it has nothing
to do with the size of virtual address space.
David Chandler
"Richard B. Johnson" wrote:
>
> > > On Wed, Nov 07, 2001 at 06:23:13PM -0500, David Chandler wrote:
> > > > The following one-line C program, when compiled by gcc 2.96 without
> > > > optimization, should produce a SIGSEGV segmentation fault (on a machine
> > > > with 3 or less gigabytes of virtual memory, at least):
> > > >
> > > > int main() { int k = *(int *)0xc0000000; }
> > > >
>
> This may not necessarily produce a seg-fault! If this virtual
> address is mapped within the current process (.bss .stack, etc.),
> It's perfectly all right to write to it although you probably
> broke malloc() by doing it. The actual value of the number in
> the pointer depends upon PAGE_OFFSET and other kernel variables.
> If you change the kernel, this number may change. It has nothing
> to do with the size of virtual address space, really.
>
> All this stuff you "own". You can write to most all of it because
> the kernel has allocated it for you. Whether or not 'const' is
> really read-only is "implementation dependent".
>
> In your case, it looks as though you scribbled over the top of
> your user stack, in some harmless place.
> Cheers,
> Dick Johnson
--
_____
David L. Chandler. GrammaTech, Inc.
mailto:chandler@grammatech.com http://www.grammatech.com
next prev parent reply other threads:[~2001-11-08 17:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-11-07 23:23 Bug Report: Dereferencing a bad pointer David Chandler
2001-11-07 23:40 ` Benjamin LaHaise
2001-11-08 15:29 ` David Chandler
2001-11-08 16:02 ` Richard B. Johnson
2001-11-08 17:17 ` David Chandler [this message]
2001-11-08 21:32 ` Richard B. Johnson
2001-11-08 21:57 ` David Chandler
2001-11-08 22:39 ` Brian Gerst
2001-11-08 23:15 ` David Chandler
2001-11-09 13:33 ` Richard B. Johnson
2001-11-08 17:53 ` Tahar
2001-11-08 16:27 ` Benjamin LaHaise
2001-11-08 18:02 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3BEABE11.AFF00CF0@grammatech.com \
--to=chandler@grammatech.com \
--cc=linux-kernel@vger.kernel.org \
--cc=root@chaos.analogic.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox