オープンソース・ソフトウェアの開発とダウンロード

Subversion リポジトリの参照

Diff of /trunk/1.8.x/ccs-patch/patches/ccs-patch-2.6.21.diff

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2278 by kumaneko, Wed Mar 18 08:12:58 2009 UTC revision 2297 by kumaneko, Mon Mar 23 00:46:34 2009 UTC
# Line 14  Source code for this patch is http://www Line 14  Source code for this patch is http://www
14   arch/x86_64/ia32/ptrace32.c     |    7 ++   arch/x86_64/ia32/ptrace32.c     |    7 ++
15   fs/Kconfig                      |    2   fs/Kconfig                      |    2
16   fs/Makefile                     |    2   fs/Makefile                     |    2
17   fs/attr.c                       |   19 ++++++   fs/attr.c                       |   19 ++++++++
18   fs/compat.c                     |   11 +++   fs/compat.c                     |   15 +++++-
19   fs/exec.c                       |   20 ++++++-   fs/exec.c                       |   20 ++++++++
20   fs/fcntl.c                      |    9 +++   fs/fcntl.c                      |    9 +++
21   fs/ioctl.c                      |    7 ++   fs/ioctl.c                      |   11 ++++
22   fs/namei.c                      |  112 ++++++++++++++++++++++++++++++++++++++++   fs/namei.c                      |   55 +++++++++++++++++++++++
23   fs/namespace.c                  |   49 +++++++++++++++++   fs/namespace.c                  |   49 ++++++++++++++++++++
24   fs/open.c                       |   27 +++++++++   fs/open.c                       |   28 +++++++++++
25   fs/proc/Makefile                |    3 +   fs/proc/Makefile                |    3 +
26   fs/proc/proc_misc.c             |    5 +   fs/proc/proc_misc.c             |    5 ++
27   include/linux/init_task.h       |    4 +   include/linux/init_task.h       |    4 +
28   include/linux/sched.h           |    9 +++   include/linux/sched.h           |    8 +++
29   kernel/compat.c                 |    7 ++   kernel/compat.c                 |    7 ++
30   kernel/kexec.c                  |    7 ++   kernel/kexec.c                  |    7 ++
31   kernel/kmod.c                   |    5 +   kernel/kmod.c                   |    5 ++
32   kernel/module.c                 |   11 +++   kernel/module.c                 |   11 ++++
33   kernel/ptrace.c                 |    7 ++   kernel/ptrace.c                 |    7 ++
34   kernel/sched.c                  |    7 ++   kernel/sched.c                  |    7 ++
35   kernel/signal.c                 |   21 +++++++   kernel/signal.c                 |   21 ++++++++
36   kernel/sys.c                    |   21 +++++++   kernel/sys.c                    |   21 ++++++++
37   kernel/sysctl.c                 |   95 +++++++++++++++++++++++++++++++++   kernel/sysctl.c                 |   95 ++++++++++++++++++++++++++++++++++++++++
38   kernel/time.c                   |   11 +++   kernel/time.c                   |   11 ++++
39   kernel/time/ntp.c               |    7 ++   kernel/time/ntp.c               |    7 ++
40   net/core/datagram.c             |   11 +++   net/core/datagram.c             |   11 ++++
41   net/ipv4/inet_connection_sock.c |    7 ++   net/ipv4/inet_connection_sock.c |    7 ++
42   net/ipv4/inet_hashtables.c      |    7 ++   net/ipv4/inet_hashtables.c      |    7 ++
43   net/ipv4/udp.c                  |   11 +++   net/ipv4/udp.c                  |   11 ++++
44   net/ipv6/inet6_hashtables.c     |    7 ++   net/ipv6/inet6_hashtables.c     |    7 ++
45   net/socket.c                    |   41 ++++++++++++++   net/socket.c                    |   41 +++++++++++++++++
46   net/unix/af_unix.c              |   15 +++++   net/unix/af_unix.c              |    8 +++
47   42 files changed, 649 insertions(+), 2 deletions(-)   42 files changed, 593 insertions(+), 2 deletions(-)
48    
49  --- linux-2.6.21.7.orig/arch/alpha/kernel/ptrace.c  --- linux-2.6.21.7.orig/arch/alpha/kernel/ptrace.c
50  +++ linux-2.6.21.7/arch/alpha/kernel/ptrace.c  +++ linux-2.6.21.7/arch/alpha/kernel/ptrace.c
# Line 63  Source code for this patch is http://www Line 63  Source code for this patch is http://www
63          size_t copied;          size_t copied;
64          long ret;          long ret;
65  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
66  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
67  +               return -EPERM;  +               return -EPERM;
68  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
69    
# Line 86  Source code for this patch is http://www Line 86  Source code for this patch is http://www
86          unsigned int value, tmp;          unsigned int value, tmp;
87          long i, ret;          long i, ret;
88  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
89  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
90  +               return -EPERM;  +               return -EPERM;
91  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
92    
# Line 109  Source code for this patch is http://www Line 109  Source code for this patch is http://www
109          struct switch_stack *sw;          struct switch_stack *sw;
110          long ret;          long ret;
111  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
112  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
113  +               return -EPERM;  +               return -EPERM;
114  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
115    
# Line 132  Source code for this patch is http://www Line 132  Source code for this patch is http://www
132          struct task_struct *child;          struct task_struct *child;
133          int ret;          int ret;
134  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
135  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
136  +               return -EPERM;  +               return -EPERM;
137  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
138    
# Line 155  Source code for this patch is http://www Line 155  Source code for this patch is http://www
155          struct task_struct *child;          struct task_struct *child;
156          int ret;          int ret;
157  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
158  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
159  +               return -EPERM;  +               return -EPERM;
160  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
161    
# Line 178  Source code for this patch is http://www Line 178  Source code for this patch is http://www
178          struct task_struct *child;          struct task_struct *child;
179          int ret;          int ret;
180  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
181  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
182  +               return -EPERM;  +               return -EPERM;
183  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
184    
# Line 201  Source code for this patch is http://www Line 201  Source code for this patch is http://www
201          int ret;          int ret;
202    
203  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
204  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
205  +               return -EPERM;  +               return -EPERM;
206  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
207          lock_kernel();          lock_kernel();
# Line 224  Source code for this patch is http://www Line 224  Source code for this patch is http://www
224          struct task_struct *child;          struct task_struct *child;
225          int ret;          int ret;
226  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
227  +       if (!ccs_capable(TOMOYO_SYS_PTRACE)) {  +       if (!ccs_capable(CCS_SYS_PTRACE)) {
228  +               pt_error_return(regs, EPERM);  +               pt_error_return(regs, EPERM);
229  +               return;  +               return;
230  +       }  +       }
# Line 249  Source code for this patch is http://www Line 249  Source code for this patch is http://www
249          struct task_struct *child;          struct task_struct *child;
250          int ret;          int ret;
251  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
252  +       if (!ccs_capable(TOMOYO_SYS_PTRACE)) {  +       if (!ccs_capable(CCS_SYS_PTRACE)) {
253  +               pt_error_return(regs, EPERM);  +               pt_error_return(regs, EPERM);
254  +               return;  +               return;
255  +       }  +       }
# Line 274  Source code for this patch is http://www Line 274  Source code for this patch is http://www
274          int ret;          int ret;
275          __u32 val;          __u32 val;
276  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
277  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
278  +               return -EPERM;  +               return -EPERM;
279  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
280    
# Line 316  Source code for this patch is http://www Line 316  Source code for this patch is http://www
316                  error = security_inode_setattr(dentry, attr);                  error = security_inode_setattr(dentry, attr);
317  +               /***** TOMOYO Linux start. *****/  +               /***** TOMOYO Linux start. *****/
318  +               if (!error && (ia_valid & ATTR_MODE) &&  +               if (!error && (ia_valid & ATTR_MODE) &&
319  +                   !ccs_capable(TOMOYO_SYS_CHMOD))  +                   !ccs_capable(CCS_SYS_CHMOD))
320  +                       error = -EPERM;  +                       error = -EPERM;
321  +               if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) &&  +               if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) &&
322  +                   !ccs_capable(TOMOYO_SYS_CHOWN))  +                   !ccs_capable(CCS_SYS_CHOWN))
323  +                       error = -EPERM;  +                       error = -EPERM;
324  +               /***** TOMOYO Linux end. *****/  +               /***** TOMOYO Linux end. *****/
325                  if (!error)                  if (!error)
# Line 330  Source code for this patch is http://www Line 330  Source code for this patch is http://www
330                          error = security_inode_setattr(dentry, attr);                          error = security_inode_setattr(dentry, attr);
331  +               /***** TOMOYO Linux start. *****/  +               /***** TOMOYO Linux start. *****/
332  +               if (!error && (ia_valid & ATTR_MODE) &&  +               if (!error && (ia_valid & ATTR_MODE) &&
333  +                   !ccs_capable(TOMOYO_SYS_CHMOD))  +                   !ccs_capable(CCS_SYS_CHMOD))
334  +                       error = -EPERM;  +                       error = -EPERM;
335  +               if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) &&  +               if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) &&
336  +                   !ccs_capable(TOMOYO_SYS_CHOWN))  +                   !ccs_capable(CCS_SYS_CHOWN))
337  +                       error = -EPERM;  +                       error = -EPERM;
338  +               /***** TOMOYO Linux end. *****/  +               /***** TOMOYO Linux end. *****/
339                  if (!error) {                  if (!error) {
# Line 351  Source code for this patch is http://www Line 351  Source code for this patch is http://www
351    
352   int compat_log = 1;   int compat_log = 1;
353    
354  @@ -422,6 +425,12 @@ asmlinkage long compat_sys_ioctl(unsigne  @@ -398,6 +401,10 @@ asmlinkage long compat_sys_ioctl(unsigne
355    
356            /* RED-PEN how should LSM module know it's handling 32bit? */
357            error = security_file_ioctl(filp, cmd, arg);
358    +       /***** TOMOYO Linux start. *****/
359    +       if (!error)
360    +               error = ccs_check_ioctl_permission(filp, cmd, arg);
361    +       /***** TOMOYO Linux end. *****/
362            if (error)
363                    goto out_fput;
364    
365    @@ -422,6 +429,12 @@ asmlinkage long compat_sys_ioctl(unsigne
366                  /*FALL THROUGH*/                  /*FALL THROUGH*/
367    
368          default:          default:
369  +               /***** TOMOYO Linux start. *****/  +               /***** TOMOYO Linux start. *****/
370  +               if (!ccs_capable(TOMOYO_SYS_IOCTL)) {  +               if (!ccs_capable(CCS_SYS_IOCTL)) {
371  +                       error = -EPERM;  +                       error = -EPERM;
372  +                       goto out_fput;  +                       goto out_fput;
373  +               }  +               }
# Line 364  Source code for this patch is http://www Line 375  Source code for this patch is http://www
375                  if (filp->f_op && filp->f_op->compat_ioctl) {                  if (filp->f_op && filp->f_op->compat_ioctl) {
376                          error = filp->f_op->compat_ioctl(filp, cmd, arg);                          error = filp->f_op->compat_ioctl(filp, cmd, arg);
377                          if (error != -ENOIOCTLCMD)                          if (error != -ENOIOCTLCMD)
378  @@ -1552,7 +1561,7 @@ int compat_do_execve(char * filename,  @@ -1552,7 +1565,7 @@ int compat_do_execve(char * filename,
379          if (retval < 0)          if (retval < 0)
380                  goto out;                  goto out;
381    
# Line 405  Source code for this patch is http://www Line 416  Source code for this patch is http://www
416                      S_ISREG(inode->i_mode)) {                      S_ISREG(inode->i_mode)) {
417                          int err = vfs_permission(&nd, MAY_EXEC);                          int err = vfs_permission(&nd, MAY_EXEC);
418  +                       /***** TOMOYO Linux start. *****/  +                       /***** TOMOYO Linux start. *****/
419  +                       if (!err && (current->tomoyo_flags &  +                       if (!err && (current->ccs_flags &
420  +                                    TOMOYO_CHECK_READ_FOR_OPEN_EXEC))  +                                    CCS_CHECK_READ_FOR_OPEN_EXEC))
421  +                               /* 01 means "read". */  +                               /* 01 means "read". */
422  +                               err = ccs_check_open_permission(nd.dentry,  +                               err = ccs_check_open_permission(nd.dentry,
423  +                                                               nd.mnt, 01);  +                                                               nd.mnt, 01);
# Line 465  Source code for this patch is http://www Line 476  Source code for this patch is http://www
476          if (!filp->f_op)          if (!filp->f_op)
477                  goto out;                  goto out;
478  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
479  +       if (!ccs_capable(TOMOYO_SYS_IOCTL))  +       if (!ccs_capable(CCS_SYS_IOCTL))
480  +               return -EPERM;  +               return -EPERM;
481  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
482    
483          if (filp->f_op->unlocked_ioctl) {          if (filp->f_op->unlocked_ioctl) {
484                  error = filp->f_op->unlocked_ioctl(filp, cmd, arg);                  error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
485    @@ -167,6 +174,10 @@ asmlinkage long sys_ioctl(unsigned int f
486                    goto out;
487    
488            error = security_file_ioctl(filp, cmd, arg);
489    +       /***** TOMOYO Linux start. *****/
490    +       if (!error)
491    +               error = ccs_check_ioctl_permission(filp, cmd, arg);
492    +       /***** TOMOYO Linux end. *****/
493            if (error)
494                    goto out_fput;
495    
496  --- linux-2.6.21.7.orig/fs/namei.c  --- linux-2.6.21.7.orig/fs/namei.c
497  +++ linux-2.6.21.7/fs/namei.c  +++ linux-2.6.21.7/fs/namei.c
498  @@ -37,6 +37,10 @@  @@ -37,6 +37,10 @@
# Line 484  Source code for this patch is http://www Line 506  Source code for this patch is http://www
506   /* [Feb-1997 T. Schoebel-Theuer]   /* [Feb-1997 T. Schoebel-Theuer]
507    * Fundamental changes in the pathname lookup mechanisms (namei)    * Fundamental changes in the pathname lookup mechanisms (namei)
508    * were necessary because of omirr.  The reason is that omirr needs    * were necessary because of omirr.  The reason is that omirr needs
509  @@ -1506,6 +1510,13 @@ int vfs_create(struct inode *dir, struct  @@ -1561,6 +1565,13 @@ int may_open(struct nameidata *nd, int a
         error = security_inode_create(dir, dentry, mode);  
         if (error)  
                 return error;  
 +       /***** TOMOYO Linux start. *****/  
 +       if (nd) {  
 +               error = ccs_check_1path_perm(TYPE_CREATE_ACL, dentry, nd->mnt);  
 +               if (error)  
 +                       return error;  
 +       }  
 +       /***** TOMOYO Linux end. *****/  
         DQUOT_INIT(dir);  
         error = dir->i_op->create(dir, dentry, mode, nd);  
         if (!error)  
 @@ -1561,6 +1572,13 @@ int may_open(struct nameidata *nd, int a  
510                  if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))                  if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))
511                          return -EPERM;                          return -EPERM;
512    
# Line 512  Source code for this patch is http://www Line 520  Source code for this patch is http://www
520          /*          /*
521           * Ensure there are no outstanding leases on the file.           * Ensure there are no outstanding leases on the file.
522           */           */
523  @@ -1610,6 +1628,9 @@ static int open_namei_create(struct name  @@ -1600,6 +1611,11 @@ static int open_namei_create(struct name
524    
525            if (!IS_POSIXACL(dir->d_inode))
526                    mode &= ~current->fs->umask;
527    +       /***** TOMOYO Linux start. *****/
528    +       error = ccs_check_mknod_permission(dir->d_inode, path->dentry,
529    +                                          nd->path.mnt, mode, 0);
530    +       if (!error)
531    +       /***** TOMOYO Linux end. *****/
532            error = vfs_create(dir->d_inode, path->dentry, mode, nd);
533            mutex_unlock(&dir->d_inode->i_mutex);
534            dput(nd->dentry);
535    @@ -1610,6 +1626,9 @@ static int open_namei_create(struct name
536          return may_open(nd, 0, flag & ~O_TRUNC);          return may_open(nd, 0, flag & ~O_TRUNC);
537   }   }
538    
# Line 522  Source code for this patch is http://www Line 542  Source code for this patch is http://www
542   /*   /*
543    *     open_namei()    *     open_namei()
544    *    *
545  @@ -1870,6 +1891,16 @@ asmlinkage long sys_mknodat(int dfd, con  @@ -1883,6 +1902,12 @@ asmlinkage long sys_mknodat(int dfd, con
546            if (!IS_POSIXACL(nd.dentry->d_inode))
547          if (S_ISDIR(mode))                  mode &= ~current->fs->umask;
548                  return -EPERM;          if (!IS_ERR(dentry)) {
549  +       /***** TOMOYO Linux start. *****/  +               /***** TOMOYO Linux start. *****/
550  +       if (S_ISCHR(mode) && !ccs_capable(TOMOYO_CREATE_CHAR_DEV))  +               error = ccs_check_mknod_permission(nd.path.dentry->d_inode,
551  +               return -EPERM;  +                                                  dentry, nd.path.mnt, mode,
552  +       if (S_ISBLK(mode) && !ccs_capable(TOMOYO_CREATE_BLOCK_DEV))  +                                                  new_decode_dev(dev));
553  +               return -EPERM;  +               if (!error)
554  +       if (S_ISFIFO(mode) && !ccs_capable(TOMOYO_CREATE_FIFO))  +               /***** TOMOYO Linux end. *****/
555  +               return -EPERM;                  switch (mode & S_IFMT) {
556  +       if (S_ISSOCK(mode) && !ccs_capable(TOMOYO_CREATE_UNIX_SOCKET))                  case 0: case S_IFREG:
 +               return -EPERM;  
 +       /***** TOMOYO Linux end. *****/  
         tmp = getname(filename);  
         if (IS_ERR(tmp))  
                 return PTR_ERR(tmp);  
 @@ -1888,10 +1919,32 @@ asmlinkage long sys_mknodat(int dfd, con  
557                          error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);                          error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
558                          break;  @@ -1959,6 +1984,11 @@ asmlinkage long sys_mkdirat(int dfd, con
                 case S_IFCHR: case S_IFBLK:  
 +                       /***** TOMOYO Linux start. *****/  
 +                       error = pre_vfs_mknod(nd.dentry->d_inode, dentry, mode);  
 +                       if (error)  
 +                               break;  
 +                       error = ccs_check_1path_perm(S_ISCHR(mode) ?  
 +                                                    TYPE_MKCHAR_ACL :  
 +                                                    TYPE_MKBLOCK_ACL,  
 +                                                    dentry, nd.mnt);  
 +                       if (error)  
 +                               break;  
 +                       /***** TOMOYO Linux end. *****/  
                         error = vfs_mknod(nd.dentry->d_inode,dentry,mode,  
                                         new_decode_dev(dev));  
                         break;  
                 case S_IFIFO: case S_IFSOCK:  
 +                       /***** TOMOYO Linux start. *****/  
 +                       error = pre_vfs_mknod(nd.dentry->d_inode, dentry, mode);  
 +                       if (error)  
 +                               break;  
 +                       error = ccs_check_1path_perm(S_ISFIFO(mode) ?  
 +                                                    TYPE_MKFIFO_ACL :  
 +                                                    TYPE_MKSOCK_ACL,  
 +                                                    dentry, nd.mnt);  
 +                       if (error)  
 +                               break;  
 +                       /***** TOMOYO Linux end. *****/  
                         error = vfs_mknod(nd.dentry->d_inode,dentry,mode,0);  
                         break;  
                 case S_IFDIR:  
 @@ -1959,6 +2012,12 @@ asmlinkage long sys_mkdirat(int dfd, con  
559    
560          if (!IS_POSIXACL(nd.dentry->d_inode))          if (!IS_POSIXACL(nd.dentry->d_inode))
561                  mode &= ~current->fs->umask;                  mode &= ~current->fs->umask;
562  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
563  +       error = pre_vfs_mkdir(nd.dentry->d_inode, dentry);  +       error = ccs_check_mkdir_permission(nd.dentry->d_inode, dentry, nd.mnt,
564  +       if (!error)  +                                          mode);
 +               error = ccs_check_1path_perm(TYPE_MKDIR_ACL, dentry, nd.mnt);  
565  +       if (!error)  +       if (!error)
566  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
567          error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);          error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
568          dput(dentry);          dput(dentry);
569   out_unlock:   out_unlock:
570  @@ -2066,6 +2125,12 @@ static long do_rmdir(int dfd, const char  @@ -2066,6 +2096,10 @@ static long do_rmdir(int dfd, const char
571          error = PTR_ERR(dentry);          error = PTR_ERR(dentry);
572          if (IS_ERR(dentry))          if (IS_ERR(dentry))
573                  goto exit2;                  goto exit2;
574  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
575  +       error = pre_vfs_rmdir(nd.dentry->d_inode, dentry);  +       error = ccs_check_rmdir_permission(nd.dentry->d_inode, dentry, nd.mnt);
 +       if (!error)  
 +               error = ccs_check_1path_perm(TYPE_RMDIR_ACL, dentry, nd.mnt);  
576  +       if (!error)  +       if (!error)
577  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
578          error = vfs_rmdir(nd.dentry->d_inode, dentry);          error = vfs_rmdir(nd.dentry->d_inode, dentry);
579          dput(dentry);          dput(dentry);
580   exit2:   exit2:
581  @@ -2125,6 +2190,10 @@ static long do_unlinkat(int dfd, const c  @@ -2146,6 +2180,11 @@ static long do_unlinkat(int dfd, const c
         struct dentry *dentry;  
         struct nameidata nd;  
         struct inode *inode = NULL;  
 +       /***** TOMOYO Linux start. *****/  
 +       if (!ccs_capable(TOMOYO_SYS_UNLINK))  
 +               return -EPERM;  
 +       /***** TOMOYO Linux end. *****/  
   
         name = getname(pathname);  
         if(IS_ERR(name))  
 @@ -2146,6 +2215,14 @@ static long do_unlinkat(int dfd, const c  
582                  inode = dentry->d_inode;                  inode = dentry->d_inode;
583                  if (inode)                  if (inode)
584                          atomic_inc(&inode->i_count);                          atomic_inc(&inode->i_count);
585  +               /***** TOMOYO Linux start. *****/  +               /***** TOMOYO Linux start. *****/
586  +               error = pre_vfs_unlink(nd.dentry->d_inode, dentry);  +               error = ccs_check_unlink_permission(nd.dentry->d_inode, dentry,
587  +               if (error)  +                                                   nd.mnt);
588  +                       goto exit2;  +               if (!error)
 +               error = ccs_check_1path_perm(TYPE_UNLINK_ACL, dentry, nd.mnt);  
 +               if (error)  
 +                       goto exit2;  
589  +               /***** TOMOYO Linux end. *****/  +               /***** TOMOYO Linux end. *****/
590                  error = vfs_unlink(nd.dentry->d_inode, dentry);                  error = vfs_unlink(nd.dentry->d_inode, dentry);
591          exit2:          exit2:
592                  dput(dentry);                  dput(dentry);
593  @@ -2210,6 +2287,10 @@ asmlinkage long sys_symlinkat(const char  @@ -2227,6 +2266,11 @@ asmlinkage long sys_symlinkat(const char
         char * to;  
         struct dentry *dentry;  
         struct nameidata nd;  
 +       /***** TOMOYO Linux start. *****/  
 +       if (!ccs_capable(TOMOYO_SYS_SYMLINK))  
 +               return -EPERM;  
 +       /***** TOMOYO Linux end. *****/  
   
         from = getname(oldname);  
         if(IS_ERR(from))  
 @@ -2227,6 +2308,12 @@ asmlinkage long sys_symlinkat(const char  
594          if (IS_ERR(dentry))          if (IS_ERR(dentry))
595                  goto out_unlock;                  goto out_unlock;
596    
597  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
598  +       error = pre_vfs_symlink(nd.dentry->d_inode, dentry);  +       error = ccs_check_symlink_permission(nd.dentry->d_inode, dentry,
599  +       if (!error)  +                                            nd.mnt, from);
 +               error = ccs_check_1path_perm(TYPE_SYMLINK_ACL, dentry, nd.mnt);  
600  +       if (!error)  +       if (!error)
601  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
602          error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);          error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
603          dput(dentry);          dput(dentry);
604   out_unlock:   out_unlock:
605  @@ -2299,6 +2386,10 @@ asmlinkage long sys_linkat(int olddfd, c  @@ -2322,6 +2366,11 @@ asmlinkage long sys_linkat(int olddfd, c
         struct nameidata nd, old_nd;  
         int error;  
         char * to;  
 +       /***** TOMOYO Linux start. *****/  
 +       if (!ccs_capable(TOMOYO_SYS_LINK))  
 +               return -EPERM;  
 +       /***** TOMOYO Linux end. *****/  
   
         if ((flags & ~AT_SYMLINK_FOLLOW) != 0)  
                 return -EINVAL;  
 @@ -2322,6 +2413,13 @@ asmlinkage long sys_linkat(int olddfd, c  
606          error = PTR_ERR(new_dentry);          error = PTR_ERR(new_dentry);
607          if (IS_ERR(new_dentry))          if (IS_ERR(new_dentry))
608                  goto out_unlock;                  goto out_unlock;
609  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
610  +       error = pre_vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);  +       error = ccs_check_link_permission(old_nd.dentry, nd.dentry->d_inode,
611  +       if (!error)  +                                         new_dentry, nd.mnt);
 +               error = ccs_check_2path_perm(TYPE_LINK_ACL, old_nd.dentry,  
 +                                            old_nd.mnt, new_dentry, nd.mnt);  
612  +       if (!error)  +       if (!error)
613  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
614          error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);          error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
615          dput(new_dentry);          dput(new_dentry);
616   out_unlock:   out_unlock:
617  @@ -2547,6 +2645,16 @@ static int do_rename(int olddfd, const c  @@ -2547,6 +2596,12 @@ static int do_rename(int olddfd, const c
618          error = -ENOTEMPTY;          error = -ENOTEMPTY;
619          if (new_dentry == trap)          if (new_dentry == trap)
620                  goto exit5;                  goto exit5;
621  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
622  +       error = pre_vfs_rename(old_dir->d_inode, old_dentry,  +       error = ccs_check_rename_permission(old_dir->d_inode, old_dentry,
623  +                              new_dir->d_inode, new_dentry);  +                                           new_dir->d_inode, new_dentry,
624  +       if (error)  +                                           newnd.mnt);
625  +               goto exit5;  +       if (!error)
 +       error = ccs_check_2path_perm(TYPE_RENAME_ACL, old_dentry, oldnd.mnt,  
 +                                    new_dentry, newnd.mnt);  
 +       if (error)  
 +               goto exit5;  
626  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
627    
628          error = vfs_rename(old_dir->d_inode, old_dentry,          error = vfs_rename(old_dir->d_inode, old_dentry,
629                                     new_dir->d_inode, new_dentry);                                     new_dir->d_inode, new_dentry);
 @@ -2570,6 +2678,10 @@ asmlinkage long sys_renameat(int olddfd,  
         int error;  
         char * from;  
         char * to;  
 +       /***** TOMOYO Linux start. *****/  
 +       if (!ccs_capable(TOMOYO_SYS_RENAME))  
 +               return -EPERM;  
 +       /***** TOMOYO Linux end. *****/  
   
         from = getname(oldname);  
         if(IS_ERR(from))  
630  --- linux-2.6.21.7.orig/fs/namespace.c  --- linux-2.6.21.7.orig/fs/namespace.c
631  +++ linux-2.6.21.7/fs/namespace.c  +++ linux-2.6.21.7/fs/namespace.c
632  @@ -28,6 +28,12 @@  @@ -28,6 +28,12 @@
# Line 733  Source code for this patch is http://www Line 659  Source code for this patch is http://www
659          struct nameidata nd;          struct nameidata nd;
660          int retval;          int retval;
661  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
662  +       if (!ccs_capable(TOMOYO_SYS_UMOUNT))  +       if (!ccs_capable(CCS_SYS_UMOUNT))
663  +               return -EPERM;  +               return -EPERM;
664  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
665    
# Line 780  Source code for this patch is http://www Line 706  Source code for this patch is http://www
706                  ((char *)data_page)[PAGE_SIZE - 1] = 0;                  ((char *)data_page)[PAGE_SIZE - 1] = 0;
707    
708  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
709  +       if (!ccs_capable(TOMOYO_SYS_MOUNT))  +       if (!ccs_capable(CCS_SYS_MOUNT))
710  +               return -EPERM;  +               return -EPERM;
711  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
712  +       /***** SAKURA Linux start. *****/  +       /***** SAKURA Linux start. *****/
# Line 798  Source code for this patch is http://www Line 724  Source code for this patch is http://www
724          if (!capable(CAP_SYS_ADMIN))          if (!capable(CAP_SYS_ADMIN))
725                  return -EPERM;                  return -EPERM;
726  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
727  +       if (!ccs_capable(TOMOYO_SYS_PIVOT_ROOT))  +       if (!ccs_capable(CCS_SYS_PIVOT_ROOT))
728  +               return -EPERM;  +               return -EPERM;
729  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
730    
# Line 835  Source code for this patch is http://www Line 761  Source code for this patch is http://www
761                  goto dput_and_out;                  goto dput_and_out;
762    
763  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
764  +       error = ccs_check_1path_perm(TYPE_TRUNCATE_ACL, nd.dentry, nd.mnt);  +       error = ccs_check_truncate_permission(nd.dentry, nd.mnt, length, 0);
765  +       if (!error)  +       if (!error)
766  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
767          error = locks_verify_truncate(inode, NULL, length);          error = locks_verify_truncate(inode, NULL, length);
768          if (!error) {          if (!error) {
769                  DQUOT_INIT(inode);                  DQUOT_INIT(inode);
770  @@ -317,6 +327,11 @@ static long do_sys_ftruncate(unsigned in  @@ -317,6 +327,12 @@ static long do_sys_ftruncate(unsigned in
771          if (IS_APPEND(inode))          if (IS_APPEND(inode))
772                  goto out_putf;                  goto out_putf;
773    
774  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
775  +       error = ccs_check_1path_perm(TYPE_TRUNCATE_ACL, dentry, file->f_vfsmnt);  +       error = ccs_check_truncate_permission(dentry, file->f_vfsmnt, length,
776    +                                             0);
777  +       if (error)  +       if (error)
778  +               goto out_putf;  +               goto out_putf;
779  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
780          error = locks_verify_truncate(inode, file, length);          error = locks_verify_truncate(inode, file, length);
781          if (!error)          if (!error)
782                  error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);                  error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
783  @@ -481,6 +496,14 @@ asmlinkage long sys_chroot(const char __  @@ -481,6 +497,14 @@ asmlinkage long sys_chroot(const char __
784          error = -EPERM;          error = -EPERM;
785          if (!capable(CAP_SYS_CHROOT))          if (!capable(CAP_SYS_CHROOT))
786                  goto dput_and_out;                  goto dput_and_out;
787  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
788  +       if (!ccs_capable(TOMOYO_SYS_CHROOT))  +       if (!ccs_capable(CCS_SYS_CHROOT))
789  +               goto dput_and_out;  +               goto dput_and_out;
790  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
791  +       /***** SAKURA Linux start. *****/  +       /***** SAKURA Linux start. *****/
# Line 868  Source code for this patch is http://www Line 795  Source code for this patch is http://www
795    
796          set_fs_root(current->fs, nd.mnt, nd.dentry);          set_fs_root(current->fs, nd.mnt, nd.dentry);
797          set_fs_altroot();          set_fs_altroot();
798  @@ -1085,6 +1108,10 @@ EXPORT_SYMBOL(sys_close);  @@ -1085,6 +1109,10 @@ EXPORT_SYMBOL(sys_close);
799    */    */
800   asmlinkage long sys_vhangup(void)   asmlinkage long sys_vhangup(void)
801   {   {
802  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
803  +       if (!ccs_capable(TOMOYO_SYS_VHANGUP))  +       if (!ccs_capable(CCS_SYS_VHANGUP))
804  +               return -EPERM;  +               return -EPERM;
805  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
806          if (capable(CAP_SYS_TTY_CONFIG)) {          if (capable(CAP_SYS_TTY_CONFIG)) {
# Line 896  Source code for this patch is http://www Line 823  Source code for this patch is http://www
823   #endif   #endif
824  +       /***** CCS start. *****/  +       /***** CCS start. *****/
825  +#if defined(CONFIG_SAKURA) || defined(CONFIG_TOMOYO)  +#if defined(CONFIG_SAKURA) || defined(CONFIG_TOMOYO)
826  +       printk(KERN_INFO "Hook version: 2.6.21.7 2008/10/30\n");  +       printk(KERN_INFO "Hook version: 2.6.21.7 2009/03/18\n");
827  +#endif  +#endif
828  +       /***** CCS end. *****/  +       /***** CCS end. *****/
829   }   }
# Line 907  Source code for this patch is http://www Line 834  Source code for this patch is http://www
834          INIT_TRACE_IRQFLAGS                                             \          INIT_TRACE_IRQFLAGS                                             \
835          INIT_LOCKDEP                                                    \          INIT_LOCKDEP                                                    \
836  +       /***** TOMOYO Linux start. *****/        \  +       /***** TOMOYO Linux start. *****/        \
837  +       .domain_info = &KERNEL_DOMAIN,           \  +       .ccs_domain_info = NULL,                 \
838  +       .tomoyo_flags = 0,                       \  +       .ccs_flags = 0,                          \
839  +       /***** TOMOYO Linux end. *****/          \  +       /***** TOMOYO Linux end. *****/          \
840   }   }
841    
842    
843  --- linux-2.6.21.7.orig/include/linux/sched.h  --- linux-2.6.21.7.orig/include/linux/sched.h
844  +++ linux-2.6.21.7/include/linux/sched.h  +++ linux-2.6.21.7/include/linux/sched.h
845  @@ -27,6 +27,11 @@  @@ -27,6 +27,10 @@
846   #define CLONE_NEWUTS           0x04000000      /* New utsname group? */   #define CLONE_NEWUTS           0x04000000      /* New utsname group? */
847   #define CLONE_NEWIPC           0x08000000      /* New ipcs */   #define CLONE_NEWIPC           0x08000000      /* New ipcs */
848    
849  +/***** TOMOYO Linux start. *****/  +/***** TOMOYO Linux start. *****/
850  +struct domain_info;  +struct ccs_domain_info;
 +extern struct domain_info KERNEL_DOMAIN;  
851  +/***** TOMOYO Linux end. *****/  +/***** TOMOYO Linux end. *****/
852  +  +
853   /*   /*
854    * Scheduling policies    * Scheduling policies
855    */    */
856  @@ -1052,6 +1057,10 @@ struct task_struct {  @@ -1052,6 +1056,10 @@ struct task_struct {
857   #ifdef CONFIG_FAULT_INJECTION   #ifdef CONFIG_FAULT_INJECTION
858          int make_it_fail;          int make_it_fail;
859   #endif   #endif
860  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
861  +       struct domain_info *domain_info;  +       struct ccs_domain_info *ccs_domain_info;
862  +       u32 tomoyo_flags;  +       u32 ccs_flags;
863  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
864   };   };
865    
# Line 955  Source code for this patch is http://www Line 881  Source code for this patch is http://www
881          if (err)          if (err)
882                  return err;                  return err;
883  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
884  +       if (!ccs_capable(TOMOYO_SYS_SETTIME))  +       if (!ccs_capable(CCS_SYS_SETTIME))
885  +               return -EPERM;  +               return -EPERM;
886  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
887    
# Line 978  Source code for this patch is http://www Line 904  Source code for this patch is http://www
904          if (!capable(CAP_SYS_BOOT))          if (!capable(CAP_SYS_BOOT))
905                  return -EPERM;                  return -EPERM;
906  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
907  +       if (!ccs_capable(TOMOYO_SYS_KEXEC_LOAD))  +       if (!ccs_capable(CCS_SYS_KEXEC_LOAD))
908  +               return -EPERM;  +               return -EPERM;
909  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
910    
# Line 991  Source code for this patch is http://www Line 917  Source code for this patch is http://www
917          set_cpus_allowed(current, CPU_MASK_ALL);          set_cpus_allowed(current, CPU_MASK_ALL);
918    
919  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
920  +       current->domain_info = &KERNEL_DOMAIN;  +       current->ccs_domain_info = NULL;
921  +       current->tomoyo_flags = 0;  +       current->ccs_flags = 0;
922  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
923  +  +
924          retval = -EPERM;          retval = -EPERM;
# Line 1015  Source code for this patch is http://www Line 941  Source code for this patch is http://www
941          if (!capable(CAP_SYS_MODULE))          if (!capable(CAP_SYS_MODULE))
942                  return -EPERM;                  return -EPERM;
943  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
944  +       if (!ccs_capable(TOMOYO_USE_KERNEL_MODULE))  +       if (!ccs_capable(CCS_USE_KERNEL_MODULE))
945  +               return -EPERM;  +               return -EPERM;
946  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
947    
# Line 1026  Source code for this patch is http://www Line 952  Source code for this patch is http://www
952          if (!capable(CAP_SYS_MODULE))          if (!capable(CAP_SYS_MODULE))
953                  return -EPERM;                  return -EPERM;
954  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
955  +       if (!ccs_capable(TOMOYO_USE_KERNEL_MODULE))  +       if (!ccs_capable(CCS_USE_KERNEL_MODULE))
956  +               return -EPERM;  +               return -EPERM;
957  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
958    
# Line 1049  Source code for this patch is http://www Line 975  Source code for this patch is http://www
975           * This lock_kernel fixes a subtle race with suid exec           * This lock_kernel fixes a subtle race with suid exec
976           */           */
977  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
978  +       if (!ccs_capable(TOMOYO_SYS_PTRACE))  +       if (!ccs_capable(CCS_SYS_PTRACE))
979  +               return -EPERM;  +               return -EPERM;
980  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
981          lock_kernel();          lock_kernel();
# Line 1072  Source code for this patch is http://www Line 998  Source code for this patch is http://www
998   {   {
999          long nice, retval;          long nice, retval;
1000  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1001  +       if (!ccs_capable(TOMOYO_SYS_NICE))  +       if (!ccs_capable(CCS_SYS_NICE))
1002  +               return -EPERM;  +               return -EPERM;
1003  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
1004    
# Line 1095  Source code for this patch is http://www Line 1021  Source code for this patch is http://www
1021   {   {
1022          struct siginfo info;          struct siginfo info;
1023  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1024  +       if (sig && !ccs_capable(TOMOYO_SYS_KILL))  +       if (sig && !ccs_capable(CCS_SYS_KILL))
1025  +               return -EPERM;  +               return -EPERM;
1026  +       if (sig && ccs_check_signal_acl(sig, pid))  +       if (sig && ccs_check_signal_acl(sig, pid))
1027  +               return -EPERM;  +               return -EPERM;
# Line 1108  Source code for this patch is http://www Line 1034  Source code for this patch is http://www
1034          if (pid <= 0 || tgid <= 0)          if (pid <= 0 || tgid <= 0)
1035                  return -EINVAL;                  return -EINVAL;
1036  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1037  +       if (sig && !ccs_capable(TOMOYO_SYS_KILL))  +       if (sig && !ccs_capable(CCS_SYS_KILL))
1038  +               return -EPERM;  +               return -EPERM;
1039  +       if (sig && ccs_check_signal_acl(sig, pid))  +       if (sig && ccs_check_signal_acl(sig, pid))
1040  +               return -EPERM;  +               return -EPERM;
# Line 1121  Source code for this patch is http://www Line 1047  Source code for this patch is http://www
1047          if (pid <= 0)          if (pid <= 0)
1048                  return -EINVAL;                  return -EINVAL;
1049  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1050  +       if (sig && !ccs_capable(TOMOYO_SYS_KILL))  +       if (sig && !ccs_capable(CCS_SYS_KILL))
1051  +               return -EPERM;  +               return -EPERM;
1052  +       if (sig && ccs_check_signal_acl(sig, pid))  +       if (sig && ccs_check_signal_acl(sig, pid))
1053  +               return -EPERM;  +               return -EPERM;
# Line 1146  Source code for this patch is http://www Line 1072  Source code for this patch is http://www
1072          if (which > 2 || which < 0)          if (which > 2 || which < 0)
1073                  goto out;                  goto out;
1074  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1075  +       if (!ccs_capable(TOMOYO_SYS_NICE)) {  +       if (!ccs_capable(CCS_SYS_NICE)) {
1076  +               error = -EPERM;  +               error = -EPERM;
1077  +               goto out;  +               goto out;
1078  +       }  +       }
# Line 1159  Source code for this patch is http://www Line 1085  Source code for this patch is http://www
1085                          magic2 != LINUX_REBOOT_MAGIC2C))                          magic2 != LINUX_REBOOT_MAGIC2C))
1086                  return -EINVAL;                  return -EINVAL;
1087  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1088  +       if (!ccs_capable(TOMOYO_SYS_REBOOT))  +       if (!ccs_capable(CCS_SYS_REBOOT))
1089  +               return -EPERM;  +               return -EPERM;
1090  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
1091    
# Line 1170  Source code for this patch is http://www Line 1096  Source code for this patch is http://www
1096          if (len < 0 || len > __NEW_UTS_LEN)          if (len < 0 || len > __NEW_UTS_LEN)
1097                  return -EINVAL;                  return -EINVAL;
1098  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1099  +       if (!ccs_capable(TOMOYO_SYS_SETHOSTNAME))  +       if (!ccs_capable(CCS_SYS_SETHOSTNAME))
1100  +               return -EPERM;  +               return -EPERM;
1101  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
1102          down_write(&uts_sem);          down_write(&uts_sem);
# Line 1181  Source code for this patch is http://www Line 1107  Source code for this patch is http://www
1107          if (len < 0 || len > __NEW_UTS_LEN)          if (len < 0 || len > __NEW_UTS_LEN)
1108                  return -EINVAL;                  return -EINVAL;
1109  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1110  +       if (!ccs_capable(TOMOYO_SYS_SETHOSTNAME))  +       if (!ccs_capable(CCS_SYS_SETHOSTNAME))
1111  +               return -EPERM;  +               return -EPERM;
1112  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
1113    
# Line 1322  Source code for this patch is http://www Line 1248  Source code for this patch is http://www
1248          if (err)          if (err)
1249                  return err;                  return err;
1250  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1251  +       if (!ccs_capable(TOMOYO_SYS_SETTIME))  +       if (!ccs_capable(CCS_SYS_SETTIME))
1252  +               return -EPERM;  +               return -EPERM;
1253  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
1254    
# Line 1333  Source code for this patch is http://www Line 1259  Source code for this patch is http://www
1259          if (error)          if (error)
1260                  return error;                  return error;
1261  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1262  +       if (!ccs_capable(TOMOYO_SYS_SETTIME))  +       if (!ccs_capable(CCS_SYS_SETTIME))
1263  +               return -EPERM;  +               return -EPERM;
1264  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
1265    
# Line 1356  Source code for this patch is http://www Line 1282  Source code for this patch is http://www
1282          if (txc->modes && !capable(CAP_SYS_TIME))          if (txc->modes && !capable(CAP_SYS_TIME))
1283                  return -EPERM;                  return -EPERM;
1284  +       /***** TOMOYO Linux start. *****/  +       /***** TOMOYO Linux start. *****/
1285  +       if (txc->modes && !ccs_capable(TOMOYO_SYS_SETTIME))  +       if (txc->modes && !ccs_capable(CCS_SYS_SETTIME))
1286  +               return -EPERM;  +               return -EPERM;
1287  +       /***** TOMOYO Linux end. *****/  +       /***** TOMOYO Linux end. *****/
1288    
# Line 1596  Source code for this patch is http://www Line 1522  Source code for this patch is http://www
1522    
1523   int sysctl_unix_max_dgram_qlen __read_mostly = 10;   int sysctl_unix_max_dgram_qlen __read_mostly = 10;
1524    
1525  @@ -765,6 +768,11 @@ static int unix_bind(struct socket *sock  @@ -808,6 +811,11 @@ static int unix_bind(struct socket *sock
                 err = unix_autobind(sock);  
                 goto out;  
         }  
 +       /***** TOMOYO Linux start. *****/  
 +       err = -EPERM;  
 +       if (sunaddr->sun_path[0] && !ccs_capable(TOMOYO_CREATE_UNIX_SOCKET))  
 +               goto out;  
 +       /***** TOMOYO Linux end. *****/  
   
         err = unix_mkname(sunaddr, addr_len, &hash);  
         if (err < 0)  
 @@ -808,6 +816,13 @@ static int unix_bind(struct socket *sock  
1526                   */                   */
1527                  mode = S_IFSOCK |                  mode = S_IFSOCK |
1528                         (SOCK_INODE(sock)->i_mode & ~current->fs->umask);                         (SOCK_INODE(sock)->i_mode & ~current->fs->umask);
1529  +               /***** TOMOYO Linux start. *****/  +               /***** TOMOYO Linux start. *****/
1530  +               err = pre_vfs_mknod(nd.dentry->d_inode, dentry, mode);  +               err = ccs_check_mknod_permission(nd.dentry->d_inode, dentry,
1531  +               if (!err)  +                                                nd.mnt, mode, 0);
 +                       err = ccs_check_1path_perm(TYPE_MKSOCK_ACL, dentry,  
 +                                                  nd.mnt);  
1532  +               if (!err)  +               if (!err)
1533  +               /***** TOMOYO Linux end. *****/  +               /***** TOMOYO Linux end. *****/
1534                  err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);                  err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);

Legend:
Removed from v.2278  
changed lines
  Added in v.2297

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26