lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu,  3 Mar 2011 10:30:19 +0900 (JST)
From:	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To:	Aaro Koskinen <aaro.koskinen@...ia.com>
Cc:	kosaki.motohiro@...fujitsu.com, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	stable@...nel.org
Subject: Re: [PATCH] procfs: fix /proc/<pid>/maps heap check

> 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@...ia.com>
> > Cc: stable@...nel.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 from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ