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-next>] [day] [month] [year] [list]
Date:   Sat, 18 Jan 2020 17:48:20 +0100
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     LKML <linux-kernel@...r.kernel.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Cyrill Gorcunov <gorcunov@...il.com>,
        Kees Cook <keescook@...omium.org>
Subject: getrusage(RUSAGE_BOTH)

RUSAGE_BOTH exists in the uapi header, but currently sys_getrusage
rejects it with -EINVAL:

SYSCALL_DEFINE2(getrusage, int, who, struct rusage __user *, ru)
{
        struct rusage r;

        if (who != RUSAGE_SELF && who != RUSAGE_CHILDREN &&
            who != RUSAGE_THREAD)
                return -EINVAL;

getrusage(RUSAGE_BOTH) is used by the exit code in various places. But
is there any good reason not to allow userspace to use it? Of course one
can get the same info with two calls using RUSAGE_CHILDREN +
RUSAGE_SELF, but that seems a bit silly when the kernel already has the
code to do the summation.

Apart from the obvious addition above, I think the only thing needed is
to adjust the conditions where mm_highwater_rss gets updated:

        if (who != RUSAGE_CHILDREN && who != RUSAGE_BOTH) {
                struct mm_struct *mm = get_task_mm(p);

                if (mm) {
                        setmax_mm_hiwater_rss(&maxrss, mm);
                        mmput(mm);
                }



If RUSAGE_BOTH is not supposed to be used, perhaps it should be removed
from the uapi header?

Rasmus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ