Re: + procfs-expose-umask-in-proc-pid-status.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon 25-04-16 13:12:19, Richard W.M. Jones wrote:
> On Mon, Apr 25, 2016 at 11:31:55AM +0200, Michal Hocko wrote:
> > On Fri 22-04-16 13:54:36, Andrew Morton wrote:
> > > From: "Richard W.M. Jones" <rjones@xxxxxxxxxx>
> > > Subject: procfs: expose umask in /proc/<PID>/status
> > > 
> > > 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:
> > > 
> > 
> > lkmlo.org links tend to be rather unstable from my experience. Please
> > try to use lkml.kernel.org/[rg]/$msg_id as much as possible
> > 
> > > https://lkml.org/lkml/2016/4/13/704 [umask2]
> > 
> > http://lkml.kernel.org/r/1460574336-18930-1-git-send-email-rjones@xxxxxxxxxx
> > 
> > > https://lkml.org/lkml/2016/4/13/487 [getumask]
> > 
> > http://lkml.kernel.org/r/1460547786-16766-1-git-send-email-rjones@xxxxxxxxxx
> 
> FWIW this was heavily edited from my original commit message.  My
> original commit message (minus the Signed-off-by etc) was:
> 
>     procfs: expose umask in /proc/<PID>/status
>     
>     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.

I guess Andrew added the remaining and I agree that part is really
useful. Any API to the userspace should document the use case. We have
added just way too many of those in the past without proper
justification. It is hard (close to impossible for some) to find out
what was the original reason why they were introduce and whether a small
change might break anything. Reference to discussions which shape the
API is useful as well.

Just my 2c
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]