[PATCH 2/2] mm: restrict access to /proc/meminfo

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

 



/proc/meminfo stores information related to memory pages usage, which
may be used to monitor the number of objects in specific caches (and/or
the changes of these numbers).  This might reveal private information
similar to /proc/slabinfo infoleaks.  To remove the infoleak, just
restrict meminfo to root.  If it is used by unprivileged daemons,
meminfo permissions can be altered the same way as slabinfo:

    groupadd meminfo
    usermod -a -G meminfo $MONITOR_USER
    chmod g+r /proc/meminfo
    chgrp meminfo /proc/meminfo

Signed-off-by: Vasiliy Kulikov <segoon@xxxxxxxxxxxx>
CC: Kees Cook <kees@xxxxxxxxxx>
CC: Dave Hansen <dave@xxxxxxxxxxxxxxxxxx>
CC: Christoph Lameter <cl@xxxxxxxxxx>
CC: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
CC: Valdis.Kletnieks@xxxxxx
CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
CC: David Rientjes <rientjes@xxxxxxxxxx>
CC: Alan Cox <alan@xxxxxxxxxxxxxxx>
---
 fs/proc/meminfo.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

--
diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 5861741..949bdee 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -187,7 +187,7 @@ static const struct file_operations meminfo_proc_fops = {
 
 static int __init proc_meminfo_init(void)
 {
-	proc_create("meminfo", 0, NULL, &meminfo_proc_fops);
+	proc_create("meminfo", S_IFREG | S_IRUSR, NULL, &meminfo_proc_fops);
 	return 0;
 }
 module_init(proc_meminfo_init);

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
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]