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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 9 Apr 2009 20:18:20 +0900
From:	Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To:	linux-fsdevel@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org
Subject: [RFC PATCH] fs: register_filesystem: Don't allow '\t' and '\n'.

Is it legal to use '\t' and '\n' in filesystem's name?
If legal, we should use \ooo escape for /proc/filesystems .

----------
[RFC PATCH] fs: register_filesystem: Don't allow '\t' and '\n'.

Registering a filesystem with broken name

  static struct file_system_type dummy_fs_type = {
          .name       = "a\tb\nc",
  };

results in broken output

  # cat /proc/filesystems
  nodev   sysfs
  nodev   rootfs
  nodev   bdev
  nodev   proc
  nodev   debugfs
  nodev   sockfs
  nodev   usbfs
  nodev   pipefs
  nodev   anon_inodefs
  nodev   tmpfs
  nodev   inotifyfs
  nodev   devpts
          ext3
          ext2
          cramfs
  nodev   ramfs
          vfat
          iso9660
  nodev   nfsd
  nodev   smbfs
  nodev   a       b
  c
  nodev   rpc_pipefs

Why not forbid '\t' and '\n'?

Signed-off-by: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
---
 fs/filesystems.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

--- linux-2.6.30-rc1.orig/fs/filesystems.c
+++ linux-2.6.30-rc1/fs/filesystems.c
@@ -65,18 +65,21 @@ static struct file_system_type **find_fi
  *	structures and must not be freed until the file system has been
  *	unregistered.
  */
- 
-int register_filesystem(struct file_system_type * fs)
+
+int register_filesystem(struct file_system_type *fs)
 {
+	const char *fsname = fs->name;
 	int res = 0;
-	struct file_system_type ** p;
+	struct file_system_type **p;
 
-	BUG_ON(strchr(fs->name, '.'));
+	BUG_ON(strchr(fsname, '.'));
+	if (strchr(fsname, '\t') || strchr(fsname, '\n'))
+		return -EINVAL;
 	if (fs->next)
 		return -EBUSY;
 	INIT_LIST_HEAD(&fs->fs_supers);
 	write_lock(&file_systems_lock);
-	p = find_filesystem(fs->name, strlen(fs->name));
+	p = find_filesystem(fsname, strlen(fsname));
 	if (*p)
 		res = -EBUSY;
 	else
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ