1. 12 Feb, 2009 2 commits
    • Kentaro Takeda's avatar
      Memory and pathname management functions. · c73bd6d4
      Kentaro Takeda authored
      TOMOYO Linux performs pathname based access control.
      To remove factors that make pathname based access control difficult
      (e.g. symbolic links, "..", "//" etc.), TOMOYO Linux derives realpath
      of requested pathname from "struct dentry" and "struct vfsmount".
      
      The maximum length of string data is limited to 4000 including trailing '\0'.
      Since TOMOYO Linux uses '\ooo' style representation for non ASCII printable
      characters, maybe TOMOYO Linux should be able to support 16336 (which means
      (NAME_MAX * (PATH_MAX / (NAME_MAX + 1)) * 4 + (PATH_MAX / (NAME_MAX + 1)))
      including trailing '\0'), but I think 4000 is enough for practical use.
      
      TOMOYO uses only 0x21 - 0x7E (as printable characters) and 0x20 (as word
      delimiter) and 0x0A (as line delimiter).
      0x01 - 0x20 and 0x80 - 0xFF is handled in \ooo style representation.
      The reason to use \ooo is to guarantee that "%s" won't damage logs.
      Userland program can request
      
       open("/tmp/file granted.\nAccess /tmp/file ", O_WRONLY | O_CREAT, 0600)
      
      and logging such crazy pathname using "Access %s denied.\n" format will cause
      "fabrication of logs" like
      
       Access /tmp/file granted.
       Access /tmp/file denied.
      
      TOMOYO converts such characters to \ooo so that the logs will become
      
       Access /tmp/file\040granted.\012Access\040/tmp/file denied.
      
      and the administrator can read the logs safely using /bin/cat .
      Likewise, a crazy request like
      
       open("/tmp/\x01\x02\x03\x04\x05\x06\x07\x08\x09", O_WRONLY | O_CREAT, 0600)
      
      will be processed safely by converting to
      
       Access /tmp/\001\002\003\004\005\006\007\010\011 denied.
      Signed-off-by: default avatarKentaro Takeda <takedakn@nttdata.co.jp>
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarToshiharu Harada <haradats@nttdata.co.jp>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      c73bd6d4
    • Kentaro Takeda's avatar
      Add in_execve flag into task_struct. · f9ce1f1c
      Kentaro Takeda authored
      This patch allows LSM modules to determine whether current process is in an
      execve operation or not so that they can behave differently while an execve
      operation is in progress.
      
      This patch is needed by TOMOYO. Please see another patch titled "LSM adapter
      functions." for backgrounds.
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      f9ce1f1c
  2. 11 Feb, 2009 2 commits
  3. 06 Feb, 2009 1 commit
    • James Morris's avatar
      Merge branch 'master' into next · cb5629b1
      James Morris authored
      Conflicts:
      	fs/namei.c
      
      Manually merged per:
      
      diff --cc fs/namei.c
      index 734f2b5,bbc15c2..0000000
      --- a/fs/namei.c
      +++ b/fs/namei.c
      @@@ -860,9 -848,8 +849,10 @@@ static int __link_path_walk(const char
        		nd->flags |= LOOKUP_CONTINUE;
        		err = exec_permission_lite(inode);
        		if (err == -EAGAIN)
      - 			err = vfs_permission(nd, MAY_EXEC);
      + 			err = inode_permission(nd->path.dentry->d_inode,
      + 					       MAY_EXEC);
       +		if (!err)
       +			err = ima_path_check(&nd->path, MAY_EXEC);
         		if (err)
        			break;
      
      @@@ -1525,14 -1506,9 +1509,14 @@@ int may_open(struct path *path, int acc
        		flag &= ~O_TRUNC;
        	}
      
      - 	error = vfs_permission(nd, acc_mode);
      + 	error = inode_permission(inode, acc_mode);
        	if (error)
        		return error;
       +
      - 	error = ima_path_check(&nd->path,
      ++	error = ima_path_check(path,
       +			       acc_mode & (MAY_READ | MAY_WRITE | MAY_EXEC));
       +	if (error)
       +		return error;
        	/*
        	 * An append-only file must be opened in append mode for writing.
        	 */
      Signed-off-by: default avatarJames Morris <jmorris@namei.org>
      cb5629b1
  4. 05 Feb, 2009 34 commits
  5. 04 Feb, 2009 1 commit