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]
Message-Id: <1460632095-434-1-git-send-email-rjones@redhat.com>
Date:	Thu, 14 Apr 2016 12:08:14 +0100
From:	"Richard W.M. Jones" <rjones@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	corbet@....net, akpm@...ux-foundation.org, vbabka@...e.cz,
	mhocko@...e.com, hughd@...gle.com, koct9i@...il.com,
	chenhanxiao@...fujitsu.com, n-horiguchi@...jp.nec.com,
	ross.zwisler@...ux.intel.com, john.stultz@...aro.org,
	minchan@...nel.org, jmarchan@...hat.com, hannes@...xchg.org,
	nathans@...hat.com, andriy.shevchenko@...ux.intel.com,
	keescook@...omium.org, gorcunov@...nvz.org, joe@...ches.com,
	linux@...musvillemoes.dk, mingo@...nel.org, cmetcalf@...hip.com,
	iago@...ocode.com, luto@...nel.org, linux-doc@...r.kernel.org,
	gorcunov@...il.com, fw@...eb.enyo.de, walters@...bum.org
Subject: [PATCH v2] procfs: expose umask in /proc/<PID>/status

v1 -> v2:

 - Change printf format to %#04o.

 - Retest and update examples accordingly.

----------

It's not possible to read the process umask without also modifying it,
which is what umask(2) does.  A library cannot read umask safely,
especially if the main program might be multithreaded.

Add a new status line ("Umask") in /proc/<PID>/status.  It contains
the file mode creation mask (umask) in octal.  It is only shown for
tasks which have task->fs.

For the library this allows me to read the umask from
/proc/self/status.

This patch is adapted from one originally written by Pierre Carrier:
https://lkml.org/lkml/2012/5/4/451

Example usage:

$ grep Umask /proc/1/status 
Umask:	0022
$ grep Umask /proc/2/status 
Umask:	0022
$ grep Umask /proc/self/status 
Umask:	0022
$ umask 002
$ grep Umask /proc/self/status 
Umask:	0002

Rich.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ