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: <1505899525-21443-1-git-send-email-mszeredi@redhat.com>
Date:   Wed, 20 Sep 2017 11:25:25 +0200
From:   Miklos Szeredi <mszeredi@...hat.com>
To:     linux-fsdevel@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, Al Viro <viro@...iv.linux.org.uk>
Subject: [PATCH] proc/locks: getattr dev and ino

/proc/locks reports incorrect device/ino for overlayfs.  Same is true for
several filesystems that use a different value for i_ino as for st_ino.
Also btrfs uses different st_dev values for subvolumes.

Do a getattr for getting the correct dev/ino information.  Make sure
filesystem doesn't start network traffic and does not return fields which
are expensive to calculate.

Signed-off-by: Miklos Szeredi <mszeredi@...hat.com>
---
 fs/locks.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/fs/locks.c b/fs/locks.c
index 1bd71c4d663a..d4caea5268dc 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -2683,11 +2683,20 @@ static void lock_get_status(struct seq_file *f, struct file_lock *fl,
 			       : (fl->fl_type == F_WRLCK) ? "WRITE" : "READ ");
 	}
 	if (inode) {
+		struct kstat st;
+		int err;
+
+		err = vfs_getattr(&fl->fl_file->f_path, &st,
+				  STATX_INO, AT_STATX_DONT_SYNC);
+		if (err)
+			goto nostat;
+
 		/* userspace relies on this representation of dev_t */
-		seq_printf(f, "%d %02x:%02x:%ld ", fl_pid,
-				MAJOR(inode->i_sb->s_dev),
-				MINOR(inode->i_sb->s_dev), inode->i_ino);
+		seq_printf(f, "%d %02x:%02x:%lld ", fl_pid,
+			   MAJOR(st.dev), MINOR(st.dev),
+			   (unsigned long long) st.ino);
 	} else {
+nostat:
 		seq_printf(f, "%d <none>:0 ", fl_pid);
 	}
 	if (IS_POSIX(fl)) {
-- 
2.5.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ