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]
Message-Id: <20200810145852.9330-6-elubarsky.linux@gmail.com>
Date:   Tue, 11 Aug 2020 00:58:52 +1000
From:   Eugene Lubarsky <elubarsky.linux@...il.com>
To:     linux-api@...r.kernel.org, linux-fsdevel@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, adobriyan@...il.com,
        avagin@...il.com, dsahern@...il.com
Subject: [RFC PATCH 5/5] fs/proc: Introduce /proc/all/statx

Gathers info from stat, statm and io files.

The purpose is not so much to reduce syscall numbers but to help
userspace not have to store data in e.g. hashtables in order to
gather it from separate /proc/all files.

The format starts with an unchanged stat line and begins the
statm & io lines with "m" or "io", repeating these for each process.

e.g.
...
25 (cat) R 1 1 0 0 -1 4194304 185 0 16 0 2 0 0 0 20 ...
m 662 188 167 5 0 112 0
io 4292 0 12 0 0 0 0
...

Signed-off-by: Eugene Lubarsky <elubarsky.linux@...il.com>
---
 fs/proc/base.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 03d48225b6d1..5c6010c2ea1c 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3944,6 +3944,31 @@ static int proc_all_io(struct seq_file *m, void *v)
 }
 #endif
 
+static int proc_all_statx(struct seq_file *m, void *v)
+{
+	struct all_iter *iter = (struct all_iter *) v;
+	struct pid_namespace *ns = iter->ns;
+	struct pid *pid = iter->tgid_iter.task->thread_pid;
+	struct task_struct *task = iter->tgid_iter.task;
+	int err;
+
+	err = proc_tgid_stat(m, ns, pid, task);
+	if (err)
+		return err;
+
+	seq_puts(m, "m ");
+	err = proc_pid_statm(m, ns, pid, task);
+	if (err)
+		return err;
+
+#ifdef CONFIG_TASK_IO_ACCOUNTING
+	seq_puts(m, "io ");
+	err = proc_all_io_print_one(m, task);
+#endif
+
+	return err;
+}
+
 static int proc_all_status(struct seq_file *m, void *v)
 {
 	struct all_iter *iter = (struct all_iter *) v;
@@ -3960,6 +3985,7 @@ static int proc_all_status(struct seq_file *m, void *v)
 
 PROC_ALL_OPS(stat);
 PROC_ALL_OPS(statm);
+PROC_ALL_OPS(statx);
 PROC_ALL_OPS(status);
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 	PROC_ALL_OPS(io);
@@ -3980,6 +4006,7 @@ void __init proc_all_init(void)
 
 	PROC_ALL_CREATE(stat);
 	PROC_ALL_CREATE(statm);
+	PROC_ALL_CREATE(statx);
 	PROC_ALL_CREATE(status);
 #ifdef CONFIG_TASK_IO_ACCOUNTING
 	PROC_ALL_CREATE(io);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ