From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Aaro Koskinen <aaro.koskinen@nokia.com>
Cc: kosaki.motohiro@jp.fujitsu.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
stable@kernel.org
Subject: Re: [PATCH] procfs: fix /proc/<pid>/maps heap check
Date: Thu, 3 Mar 2011 10:30:19 +0900 (JST) [thread overview]
Message-ID: <20110303102631.B939.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1103021449000.27610@esdhcp041196.research.nokia.com>
> Hi,
>
> On Tue, 1 Mar 2011, Aaro Koskinen wrote:
> > The current check looks wrong and prints "[heap]" only if the mapping
> > matches exactly the heap. However, the heap may be merged with some
> > other mappings, and there may be also be multiple mappings.
> >
> > Signed-off-by: Aaro Koskinen <aaro.koskinen@nokia.com>
> > Cc: stable@kernel.org
>
> Below is a test program and an example output showing the problem,
> and the correct output with the patch:
>
> Without the patch:
>
> # ./a.out &
> # cat /proc/$!/maps | head -4
> 00008000-00009000 r-xp 00000000 01:00 9224 /a.out
> 00010000-00011000 rw-p 00000000 01:00 9224 /a.out
> 00011000-00012000 rw-p 00000000 00:00 0
> 00012000-00013000 rw-p 00000000 00:00 0
>
> With the patch:
>
> # ./a.out &
> # cat /proc/$!/maps | head -4
> 00008000-00009000 r-xp 00000000 01:00 9228 /a.out
> 00010000-00011000 rw-p 00000000 01:00 9228 /a.out
> 00011000-00012000 rw-p 00000000 00:00 0 [heap]
> 00012000-00013000 rw-p 00000000 00:00 0 [heap]
>
> The test program:
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <sys/mman.h>
>
> int main (void)
> {
> if (sbrk(4096) == (void *)-1) {
> perror("first sbrk(): ");
> return EXIT_FAILURE;
> }
>
> if (mlockall(MCL_FUTURE)) {
> perror("mlockall(): ");
> return EXIT_FAILURE;
> }
>
> if (sbrk(4096) == (void *)-1) {
> perror("second sbrk(): ");
> return EXIT_FAILURE;
> }
Your description said,
the heap may be merged with some other mappings,
^^^^^^
but your example is splitting case. not merge. In other words, your
patch care splitting case but break merge case.
Ok, we have no obvious correct behavior. This is debatable. So,
Why do you think vma splitting case is important than merge?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-03-03 1:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-01 16:26 Aaro Koskinen
2011-03-02 12:55 ` Aaro Koskinen
2011-03-03 1:30 ` KOSAKI Motohiro [this message]
2011-03-03 11:37 ` Aaro Koskinen
2011-03-03 12:22 ` Aaro Koskinen
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=20110303102631.B939.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=aaro.koskinen@nokia.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@kernel.org \
/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