Skip Menu |

This queue is for tickets about the Apache-SizeLimit CPAN distribution.

Report information
The Basics
Id: 73752
Status: open
Priority: 0/
Queue: Apache-SizeLimit

People
Owner: Nobody in particular
Requestors: idl0r [...] qasl.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Wrong unshared memory values when using /proc/self/statm
Date: Thu, 05 Jan 2012 02:09:10 +0100
To: bug-Apache-SizeLimit [...] rt.cpan.org
From: Christian Ruppert <idl0r [...] qasl.de>
Hi everybody, Using Linux::Smaps is not always possible, for example when using Grsecurity patches for the Linux kernel. This ends up in using /proc/self/statm instead of smaps, see attachment for a test case. <snip> % perl test.pl Legacy check: SIZE=20844, SHARE=1720, UNSHARED=19124 Smaps check: SIZE=20848, SHARE=1776, UNSHARED=928 </snip> So assuming unshared is $size - $share seems to be totally wrong, note the huge difference between unshared with smaps and with statm. -- Regards, Christian Ruppert

Message body is not shown because sender requested not to inline it.

Download signature.asc
application/pgp-signature 490b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #73752] Wrong unshared memory values when using /proc/self/statm
Date: Tue, 11 Mar 2014 16:57:32 +0000
To: bug-Apache-SizeLimit [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
The problem is that the "share" value in /proc/self/statm only counts *resident* shared pages. The solution is to instead read the "data" value, which counts all unshared pages (whether resident or not). That gives the correct unshared count directly, and can be subtracted from "size" to get the correct shared count. Attached patch fixes. -zefram

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #73752] Wrong unshared memory values when using /proc/self/statm
Date: Tue, 25 Mar 2014 20:13:38 +0100
To: Zefram via RT <bug-Apache-SizeLimit [...] rt.cpan.org>
From: Christian Ruppert <idl0r [...] qasl.de>
On 03/11/14 at 12:57PM -0400, Zefram via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=73752 > > > The problem is that the "share" value in /proc/self/statm only counts > *resident* shared pages. The solution is to instead read the "data" > value, which counts all unshared pages (whether resident or not). > That gives the correct unshared count directly, and can be subtracted from > "size" to get the correct shared count. Attached patch fixes. > > -zefram >
Show quoted text
> --- a/lib/Apache/SizeLimit/Core.pm 2011-12-22 03:46:44.000000000 +0000 > +++ b/lib/Apache/SizeLimit/Core.pm 2014-03-11 16:52:11.795119567 +0000 > @@ -184,10 +184,10 @@ > sub _linux_size_check { > my $class = shift; > > - my ($size, $share) = (0, 0); > + my ($size, $data) = (0, 0); > > if (open my $fh, '<', '/proc/self/statm') { > - ($size, $share) = (split /\s/, scalar <$fh>)[0,2]; > + ($size, $data) = (split /\s/, scalar <$fh>)[0,5]; > close $fh; > } > else { > @@ -195,7 +195,9 @@ > } > > # linux on intel x86 has 4KB page size... > - return ($size * 4, $share * 4); > + $size <<= 2; > + $data <<= 2; > + return ($size, $size - $data, $data); > } > > sub _solaris_2_6_size_check {
Hm, % perl test.pl Legacy check old: SIZE=22192, SHARE=1932, UNSHARED=20260 Legacy check new: SIZE=22192, SHARE=1580, UNSHARED=20612 Smaps check : SIZE=22196, SHARE=1928, UNSHARED=1344 both values look different than the smaps one. Previously it was just the unshared value. -- Regards, Christian Ruppert

Message body is not shown because sender requested not to inline it.

Download (untitled)
application/pgp-signature 490b

Message body not shown because it is not plain text.