linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc: Make /proc/<pid>/io world readable
@ 2019-11-21 21:09 Daniel Xu
  2019-11-21 21:25 ` Daniel Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Xu @ 2019-11-21 21:09 UTC (permalink / raw)
  To: adobriyan, christian, akpm, tglx, mhocko, keescook, shakeelb,
	casey, khlebnikov, kent.overstreet, linux-kernel, linux-fsdevel
  Cc: Daniel Xu, dschatzberg, htejun, dennis, kernel-team

/proc/<pid>/io is currently only owner readable. This forces monitoring
programs (such as atop) to run with elevated permissions to collect disk
stats. Changing this file to world readable can add a measure of safety to
userspace.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
 fs/proc/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index ebea9501afb8..1d1c1d680e16 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3076,7 +3076,7 @@ static const struct pid_entry tgid_base_stuff[] = {
 	REG("coredump_filter", S_IRUGO|S_IWUSR, proc_coredump_filter_operations),
 #endif
 #ifdef CONFIG_TASK_IO_ACCOUNTING
-	ONE("io",	S_IRUSR, proc_tgid_io_accounting),
+	ONE("io",	S_IRUGO, proc_tgid_io_accounting),
 #endif
 #ifdef CONFIG_USER_NS
 	REG("uid_map",    S_IRUGO|S_IWUSR, proc_uid_map_operations),
@@ -3473,7 +3473,7 @@ static const struct pid_entry tid_base_stuff[] = {
 	REG("fail-nth", 0644, proc_fail_nth_operations),
 #endif
 #ifdef CONFIG_TASK_IO_ACCOUNTING
-	ONE("io",	S_IRUSR, proc_tid_io_accounting),
+	ONE("io",	S_IRUGO, proc_tid_io_accounting),
 #endif
 #ifdef CONFIG_USER_NS
 	REG("uid_map",    S_IRUGO|S_IWUSR, proc_uid_map_operations),
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] proc: Make /proc/<pid>/io world readable
  2019-11-21 21:09 [PATCH] proc: Make /proc/<pid>/io world readable Daniel Xu
@ 2019-11-21 21:25 ` Daniel Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Xu @ 2019-11-21 21:25 UTC (permalink / raw)
  To: adobriyan, christian, akpm, tglx, mhocko, keescook, shakeelb,
	casey, khlebnikov, kent.overstreet, linux-kernel, linux-fsdevel
  Cc: dschatzberg, htejun, dennis, Kernel Team

On Thu, Nov 21, 2019, at 1:09 PM, Daniel Xu wrote:
> /proc/<pid>/io is currently only owner readable. This forces monitoring
> programs (such as atop) to run with elevated permissions to collect disk
> stats. Changing this file to world readable can add a measure of safety to
> userspace.
> 
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---
>  fs/proc/base.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index ebea9501afb8..1d1c1d680e16 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -3076,7 +3076,7 @@ static const struct pid_entry tgid_base_stuff[] = {
>  	REG("coredump_filter", S_IRUGO|S_IWUSR, proc_coredump_filter_operations),
>  #endif
>  #ifdef CONFIG_TASK_IO_ACCOUNTING
> -	ONE("io",	S_IRUSR, proc_tgid_io_accounting),
> +	ONE("io",	S_IRUGO, proc_tgid_io_accounting),
>  #endif
>  #ifdef CONFIG_USER_NS
>  	REG("uid_map",    S_IRUGO|S_IWUSR, proc_uid_map_operations),
> @@ -3473,7 +3473,7 @@ static const struct pid_entry tid_base_stuff[] = {
>  	REG("fail-nth", 0644, proc_fail_nth_operations),
>  #endif
>  #ifdef CONFIG_TASK_IO_ACCOUNTING
> -	ONE("io",	S_IRUSR, proc_tid_io_accounting),
> +	ONE("io",	S_IRUGO, proc_tid_io_accounting),
>  #endif
>  #ifdef CONFIG_USER_NS
>  	REG("uid_map",    S_IRUGO|S_IWUSR, proc_uid_map_operations),
> -- 
> 2.21.0
> 
>

Nevermind, abandoning. Just found 1d1221f375c94ef961b ("proc: restrict access to /proc/PID/io").

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-21 21:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-21 21:09 [PATCH] proc: Make /proc/<pid>/io world readable Daniel Xu
2019-11-21 21:25 ` Daniel Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).