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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 6 Mar 2015 17:19:48 +0300
From:	Andrew Vagin <avagin@...allels.com>
To:	Jeff Layton <jlayton@...chiereds.net>,
	Andrew Morton <akpm@...ux-foundation.org>
CC:	Andrey Vagin <avagin@...nvz.org>, <linux-kernel@...r.kernel.org>,
	<linux-fsdevel@...r.kernel.org>, <linux-doc@...r.kernel.org>,
	Jonathan Corbet <corbet@....net>,
	Alexander Viro <viro@...iv.linux.org.uk>,
	"J. Bruce Fields" <bfields@...ldses.org>,
	Cyrill Gorcunov <gorcunov@...nvz.org>,
	Pavel Emelyanov <xemul@...allels.com>
Subject: Re: [PATCH] proc: show locks in /proc/pid/fdinfo/X

On Thu, Mar 05, 2015 at 02:11:40PM -0500, Jeff Layton wrote:
> On Thu,  5 Mar 2015 18:37:18 +0300
> Andrey Vagin <avagin@...nvz.org> wrote:
> 
> > Let's show locks which are associated with a file descriptor in
> > its fdinfo file.
> > 
> > Currently we don't have a reliable way to determine who holds a lock.
> > We can find some information in /proc/locks, but PID which is reported
> > there can be wrong. For example, a process takes a lock, then forks a
> > child and dies. In this case /proc/locks contains the parent pid, which
> > can be reused by another process.
> > 
> > $ cat /proc/locks
> > ...
> > 6: FLOCK  ADVISORY  WRITE 324 00:13:13431 0 EOF
> > ...
> > 
> > $ ps -C rpcbind
> >   PID TTY          TIME CMD
> >   332 ?        00:00:00 rpcbind
> > 
> > $ cat /proc/332/fdinfo/4
> > pos:	0
> > flags:	0100000
> > mnt_id:	22
> > lock:	1: FLOCK  ADVISORY  WRITE 324 00:13:13431 0 EOF
> > 
> > $ ls -l /proc/332/fd/4
> > lr-x------ 1 root root 64 Mar  5 14:43 /proc/332/fd/4 -> /run/rpcbind.lock
> > 
> > $ ls -l /proc/324/fd/
> > total 0
> > lrwx------ 1 root root 64 Feb 27 14:50 0 -> /dev/pts/0
> > lrwx------ 1 root root 64 Feb 27 14:50 1 -> /dev/pts/0
> > lrwx------ 1 root root 64 Feb 27 14:49 2 -> /dev/pts/0
> > 
> > You can see that the process with the 324 pid doesn't hold the lock.
> > 
> > This information is required for proper dumping and restoring file
> > locks.
> > 
> > Cc: Jonathan Corbet <corbet@....net>
> > Cc: Alexander Viro <viro@...iv.linux.org.uk>
> > Cc: Jeff Layton <jlayton@...chiereds.net>
> > Cc: "J. Bruce Fields" <bfields@...ldses.org>
> > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > Cc: Cyrill Gorcunov <gorcunov@...nvz.org>
> > Cc: Pavel Emelyanov <xemul@...allels.com>
> > Signed-off-by: Andrey Vagin <avagin@...nvz.org>
> > ---
> >  Documentation/filesystems/proc.txt |  4 ++++
> >  fs/locks.c                         | 38 ++++++++++++++++++++++++++++++++++++++
> >  fs/proc/fd.c                       | 27 ++++++++++++++++++---------
> >  include/linux/fs.h                 |  7 +++++++
> >  4 files changed, 67 insertions(+), 9 deletions(-)
> > 

...

> > +struct files_struct;
> > +static inline void show_fd_locks(struct seq_file *f,
> > +			struct file *filp, struct files_struct *files) {}
> >  #endif /* !CONFIG_FILE_LOCKING */
> >  
> >  
> 
> Looks reasonably sane to me. Via what tree should this go in?

I don't know. I think all previous patches about fdinfo went through
linux-mm. Andrew, what do you think?

> 
> Acked-by: Jeff Layton <jlayton@...chiereds.net>

Thanks,
Andrey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ