Subject: Re: gdb over ktrace
To: None <cpg@aladdin.de>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 04/17/2000 08:58:53
On Mon, Apr 17, 2000 at 12:35:08AM +0100, cpg@aladdin.de wrote:
> Hmm, which Linux version are you referring to?
>
> When I try this program
>
> ------------ null.c
> #include <stdio.h>
>
> int main(void)
> {
> char * myptr = NULL;
> char x;
>
> printf("before....\n"); fflush(stdout);
> x = *myptr;
> printf("after, x = %d\n",x);
> return(0);
> }
> ------------
>
> it crashes as expected:
>
> gibbon:/tmp$ cc -o null null.c
> gibbon:/tmp$ ./null
> before....
> Segmentation fault (core dumped)
> gibbon:/tmp$ uname -a
> Linux gibbon.cnet.aladdin.de 2.3.99-pre5 #3 SMP Sat Apr 15 00:58:25 CEST
> 2000 i686 unknown
> gibbon:/tmp$
>
> A check on a 2.0.29 and a 2.2.14 machine gives the same result (all i386),
>
> Maybe the uninitialized pointers of your student's are automatic variables
> on the
> stack and reference memory in a mapped region?
Hum, can't remember. It was last year so I guess it was 2.0.something
although it could also have been a devel version).
I tested on 2.2.14 and sure it crashes now.
So maybe the pointer was not null, but just uninitialised and pointed
to a mapped page. But as far as I remember I analysed this and found the
pointer was null, but I may be misremembering, or mix with another problem.
Ok, I have to apologize, I should have checked before claiming this.
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--