Re: Problem doing a read...

Albert Cahalan (albert@ccs.neu.edu)
Sun, 4 Aug 1996 01:05:46 -0400 (EDT)


From: "Michael J. Greger" <greger@f182-137.net.wisc.edu>

> Under 2.0.4, I have a program that gives the following under /proc/pid/maps:
>
> 0x8048000 0x8054000 r-xp 0x0 16:1 368915
> 0x8054000 0x8055000 rw-p 0xb000 16:1 368915
> 0x8055000 0x8069000 rwxp 0x0 0:0 0
> 0x40000000 0x40005000 rwxp 0x0 16:1 16473
> 0x40005000 0x40006000 rw-p 0x4000 16:1 16473
> 0x40006000 0x40009000 rw-p 0x0 0:0 0 ****
> 0x40009000 0x40082000 r-xp 0x0 16:1 16419
> 0x40082000 0x40088000 rw-p 0x78000 16:1 16419
> 0x40088000 0x400ba000 rw-p 0x0 0:0 0
> 0xbfffc000 0xc0000000 rwxp 0xffffd000 0:0 0
>
> I'm tring to read the segment of memory marked above with the ***'s.
> When I read to about 0x40008000, I get a segfault. According to the
> protection bits, I should have read access. Well, why do I get a segfault??

Which reminds me... Those numbers are ranges, right?
I think I see an off-by-one error. Shouldn't that be:

0x08048000 0x08053fff r-xp 0x00000000 16:1 368915
0x08054000 0x08054fff rw-p 0x0000b000 16:1 368915
0x08055000 0x08068fff rwxp 0x00000000 0:0 0
0x40000000 0x40004fff rwxp 0x00000000 16:1 16473
0x40005000 0x40005fff rw-p 0x00004000 16:1 16473
0x40006000 0x40008fff rw-p 0x00000000 0:0 0
0x40009000 0x40081fff r-xp 0x00000000 16:1 16419
0x40082000 0x40087fff rw-p 0x00078000 16:1 16419
0x40088000 0x400b9fff rw-p 0x00000000 0:0 0
0xbfffc000 0xbfffffff rwxp 0xffffd000 0:0 0