Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Register
  • Sign in
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • Kirill Smelkov
  • linux
  • Repository
You need to sign in or sign up before continuing.
  • linux
  • fs
  • proc
  • array.c
Find file BlameHistoryPermalink
  • Richard W.M. Jones's avatar
    procfs: expose umask in /proc/<PID>/status · 3e42979e
    Richard W.M. Jones authored May 20, 2016
    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.
    
    This patch is adapted from one originally written by Pierre Carrier.
    
    The use case is that we have endless trouble with people setting weird
    umask() values (usually on the grounds of "security"), and then
    everything breaking.  I'm on the hook to fix these.  We'd like to add
    debugging to our program so we can dump out the umask in debug reports.
    
    Previous versions of the patch used a syscall so you could only read
    your own umask.  That's all I need.  However there was quite a lot of
    push-back from those, so this new version exports it in /proc.
    
    See:
      https://lkml.org/lkml/2016/4/13/704 [umask2]
      https://lkml.org/lkml/2016/4/13/487
    
     [getumask]
    
    Signed-off-by: default avatarRichard W.M. Jones <rjones@redhat.com>
    Acked-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
    Acked-by: default avatarJerome Marchand <jmarchan@redhat.com>
    Acked-by: default avatarKees Cook <keescook@chromium.org>
    Cc: "Theodore Ts'o" <tytso@mit.edu>
    Cc: Michal Hocko <mhocko@kernel.org>
    Cc: Pierre Carrier <pierre@spotify.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    3e42979e
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7