Subject: Re: gdb over ktrace
To: Manuel Bouyer <firstname.lastname@example.org>
From: None <email@example.com>
Date: 04/17/2000 00:35:08
On 04/15/2000 03:13:00 PM GMT Manuel Bouyer wrote:
>Linux has page 0 mapped R/W for userland. This is a real pain, because you
>can write programs that use invalid pointers and still work !!
>I'm teaching C programming to students under linux, and this is a problem:
>me: "if you use and uninitialised pointers it'll segfault"
>student: "but my program use a uninitialised pointer pointer to store a
> string, it works !"
Hmm, which Linux version are you referring to?
When I try this program
char * myptr = NULL;
x = *myptr;
printf("after, x = %d\n",x);
it crashes as expected:
gibbon:/tmp$ cc -o null null.c
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
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
stack and reference memory in a mapped region?