debugfs: more tightly restrict default mount mode
authorKees Cook <keescook@chromium.org>
Mon, 27 Aug 2012 20:32:15 +0000 (13:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 27 Aug 2012 20:42:02 +0000 (13:42 -0700)
Since the debugfs is mostly only used by root, make the default mount
mode 0700. Most system owners do not need a more permissive value,
but they can choose to weaken the restrictions via their fstab.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/filesystems/debugfs.txt
fs/debugfs/inode.c

index 7a34f82..3a863f6 100644 (file)
@@ -15,8 +15,8 @@ Debugfs is typically mounted with a command like:
     mount -t debugfs none /sys/kernel/debug
 
 (Or an equivalent /etc/fstab line).
-The debugfs root directory is accessible by anyone by default. To
-restrict access to the tree the "uid", "gid" and "mode" mount
+The debugfs root directory is accessible only to the root user by
+default. To change access to the tree the "uid", "gid" and "mode" mount
 options can be used.
 
 Note that the debugfs API is exported GPL-only to modules.
index 2c9fafb..6393fd6 100644 (file)
@@ -28,7 +28,7 @@
 #include <linux/magic.h>
 #include <linux/slab.h>
 
-#define DEBUGFS_DEFAULT_MODE   0755
+#define DEBUGFS_DEFAULT_MODE   0700
 
 static struct vfsmount *debugfs_mount;
 static int debugfs_mount_count;