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:   Fri,  3 May 2019 14:10:19 -0400
From:   Joel Savitz <>
Cc:     Joel Savitz <>,
        Thomas Gleixner <>,
        Ingo Molnar <>,
        Masami Hiramatsu <>,
        Waiman Long <>,
        Mauro Carvalho Chehab <>,
        Kristina Martsenko <>,
        Andrew Morton <>,
        Cyrill Gorcunov <>,
        Kees Cook <>,
        "Gustavo A. R. Silva" <>,
        YueHaibing <>,
        Micah Morton <>,
        Yang Shi <>,
        Jann Horn <>,
        Alexey Dobriyan <>,
        Rafael Aquini <>,
        Michael Kerrisk <>,
        Yury Norov <>,
        David Laight <>
Subject: [PATCH v3 0/2] sys/prctl: expose TASK_SIZE value to userspace

In the mainline kernel, there is no quick mechanism to get the virtual
memory size of the current process from userspace.

Despite the current state of affairs, this information is available to the
user through several means, one being a linear search of the entire address
space. This is an inefficient use of cpu cycles.

A component of the libhugetlb kernel test does exactly this, and as
systems' address spaces increase beyond 32-bits, this method becomes
exceedingly tedious.

For example, on a ppc64le system with a 47-bit address space, the linear
search causes the test to hang for some unknown amount of time. I
couldn't give you an exact number because I just ran it for about 10-20
minutes and went to go do something else, probably to get coffee or
something, and when I came back, I just killed the test and patched it
to use this new mechanism. I re-ran my new version of the test using a
kernel with this patch, and of course it passed through the previously
bottlenecking codepath nearly instantaneously.

As such, I propose that the prctl syscall be extended to include the
option to retrieve TASK_SIZE from the kernel.

This patch will allow us to upgrade an O(n) codepath to O(1) in an
architecture-independent manner, and provide a mechanism for future
generations to do the same.

Changes from v2:
 We now account for the case of 32-bit compat userspace on a 64-bit kernel
 More detail about the nature of TASK_SIZE in documentation

Joel Savitz(2):
  sys/prctl: add PR_GET_TASK_SIZE option to prctl(2)
  prctl.2: Document the new PR_GET_TASK_SIZE option

 include/uapi/linux/prctl.h |  3 +++
 kernel/sys.c               | 23 +++++++++++++++++++++++
 2 files changed, 26 insertions(+)

 man2/prctl.2 | 10 ++++++++++
 1 file changed, 10 insertions(+)

Powered by blists - more mailing lists