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:	Sat, 6 Oct 2012 14:48:39 -0700 (PDT)
From:	Hugh Dickins <hughd@...gle.com>
To:	Kamran Amini <kamran.amini.eng@...il.com>
cc:	linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: PROBLEM: It seems that /usr/bin/time program reports a wrong
 value for MaxRSS.

On Thu, 4 Oct 2012, Kamran Amini wrote:
> 
> It seems that /usr/bin/time program reports a wrong value for MaxRSS.
> The report shows MaxRSS, about 4 times the
> actual allocated memory by a process and its children. MaxRSS (Maximum
> Resident Set Size) is assumed to be maximum
> allocated memory by a process and its children. This bug report talks
> about this problem. More descriptions are provided in
> time-problem.tar.gz file attached to this mail.

You are right.

Well, time-problem.tar.gz goes into more detail than I had time
to read, so I cannot promise that everything you say is right.

But you're right that /usr/bin/time is reporting MaxRSS 4 times too much
on x86, and many other architectures.  It expects rusage.ru_maxrss to be
a count of pages, so mistakenly uses to ptok() upon it; whereas the Linux
kernel supplies that number already in kilobytes (as "man 2 getrusage"
makes clear).

I see this was mentioned when 2.6.32's commit 1f10206cf8e9 "getrusage:
fill ru_maxrss value" started putting the number there instead of zero: 
    
    Make ->ru_maxrss value in struct rusage filled accordingly to rss hiwater
    mark.  This struct is filled as a parameter to getrusage syscall.
    ->ru_maxrss value is set to KBs which is the way it is done in BSD
    systems.  /usr/bin/time (gnu time) application converts ->ru_maxrss to KBs
    which seems to be incorrect behavior.  Maintainer of this util was
    notified by me with the patch which corrects it and cc'ed.

It looks as if we were naive to expect a change in /usr/bin/time then:
so far as I can see, time has stood still at time-1.7 ever since 1996.
Its README does say:

    Mail suggestions and bug reports for GNU time to
    bug-gnu-utils@...p.ai.mit.edu.  Please include the version of
    `time', which you can get by running `time --version', and the
    operating system and C compiler you used.

Please do so, if you have a chance, or let me know if you cannot and
I'll do so: though I suspect the mail address is out-of-date by now,
and that it should say bug-gnu-utils@....org.

You might also like to raise a bug with the distros you care about:
maybe some already apply their own fix, or will do before time-1.8.

But it does look as if you're the first in three years to notice and
care!  So don't be surprised if it's not a high priority for anyone.

And I don't think you need attach a .tar.gz: just explain in a few
lines that Linux 2.6.32 and later fill ru_maxrss, but in kilobytes
not pages: so /usr/bin/time displays 4 times the right number when
it multiplies that up with ptok().  (I don't have a BSD system to
confirm whether it's indeed wrong for BSD too.)

Thanks,
Hugh
--
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