From: Jeremy Fitzhardinge <jeremy@goop.org>
To: pmeda@akamai.com
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: /proc/self/maps still not right in 2.6.10-mm3
Date: Thu, 13 Jan 2005 13:43:12 -0800 [thread overview]
Message-ID: <1105652592.1208.14.camel@localhost> (raw)
[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]
Looks like there's another problem. If you read /proc/self/maps with
>4k chunks, the reads are always truncated to < 4k. However, at those
points, it misses an entry. If you read in smaller chunks, the results
look good.
For example (tm.c is attached):
$ ./tm &
$ dd bs=80 < /proc/$!/maps > 1
$ dd bs=100k < /proc/$!/maps > 2
$ diff -u 1 2
@@ -96,7 +96,6 @@
b7b43000-b7b44000 ---p b7b43000 00:00 0
b7b44000-b7b45000 r-xp b7b44000 00:00 0
b7b45000-b7b46000 ---p b7b45000 00:00 0
-b7b46000-b7b47000 r-xp b7b46000 00:00 0
b7b47000-b7b48000 ---p b7b47000 00:00 0
b7b48000-b7b49000 r-xp b7b48000 00:00 0
b7b49000-b7b4a000 ---p b7b49000 00:00 0
@@ -196,7 +195,6 @@
b7ba7000-b7ba8000 ---p b7ba7000 00:00 0
b7ba8000-b7ba9000 r-xp b7ba8000 00:00 0
b7ba9000-b7baa000 ---p b7ba9000 00:00 0
-b7baa000-b7bab000 r-xp b7baa000 00:00 0
b7bab000-b7bac000 ---p b7bab000 00:00 0
b7bac000-b7bad000 r-xp b7bac000 00:00 0
b7bad000-b7bae000 ---p b7bad000 00:00 0
[...]
Strace shows that the mapping at 0xb7b46000 is skipped because it
straddles the read boundary:
[...]
b7b3f000-b7b40000 ---p b7b3f000 00:00 0 \n
b7b40000-b7b41000 r-xp b7b40000 00:00 0 \n
b7b41000-b7b42000 ---p b7b41000 00:00 0 \n
b7b42000-b7b43000 r-xp b7b42000 00:00 0 \n
b7b43000-b7b44000 ---p b7b43000 00:00 0 \n
b7b44000-b7b45000 r-xp b7b44000 00:00 0 \n
b7b45000-b7b46000 ---p b7b45000 00:00 0 \n", 102400) = 4092
^^^^^^^^
read(0, "b7b47000-b7b48000 ---p b7b47000 00:00 0 \n
^^^^^^^^
b7b48000-b7b49000 r-xp b7b48000 00:00 0 \n
b7b49000-b7b4a000 ---p b7b49000 00:00 0 \n
b7b4a000-b7b4b000 r-xp b7b4a000 00:00 0 \n
[...]
J
[-- Attachment #2: tm.c --]
[-- Type: text/x-csrc, Size: 257 bytes --]
#include <sys/mman.h>
#include <unistd.h>
int main()
{
int i;
char *m = mmap(0, 1000*4096, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
char *p = m;
for(i = 0; i < 1000; i+=2) {
mprotect(p, 4096, PROT_READ);
p += 8192;
}
pause();
return 0;
}
next reply other threads:[~2005-01-14 0:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-13 21:43 Jeremy Fitzhardinge [this message]
2005-01-14 0:58 ` /proc/self/maps still not right in 2.6.10-mm3 Prasanna Meda
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=1105652592.1208.14.camel@localhost \
--to=jeremy@goop.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeda@akamai.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