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

Subversion リポジトリの参照

Diff of /trunk/1.8.x/ccs-patch/patches/ccs-patch-2.6.25-suse-11.0.diff

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

trunk/1.7.x/ccs-patch/patches/ccs-patch-2.6.25-suse-11.0.diff revision 2950 by kumaneko, Tue Aug 25 04:17:06 2009 UTC trunk/1.8.x/ccs-patch/patches/ccs-patch-2.6.25-suse-11.0.diff revision 4049 by kumaneko, Thu Oct 7 07:14:01 2010 UTC
# Line 1  Line 1 
1  This is TOMOYO Linux patch for openSUSE 11.0.  This is TOMOYO Linux patch for openSUSE 11.0.
2    
3  Source code for this patch is http://download.opensuse.org/update/11.0/rpm/i586/kernel-source-2.6.25.20-0.5.i586.rpm  Source code for this patch is http://download.opensuse.org/update/11.0/rpm/i586/kernel-source-2.6.25.20-0.7.i586.rpm
4  ---  ---
5   arch/ia64/ia32/sys_ia32.c       |    3 +++   arch/ia64/ia32/sys_ia32.c       |    3 +++
6   arch/mips/kernel/ptrace32.c     |    3 +++   arch/mips/kernel/ptrace32.c     |    3 +++
7   arch/s390/kernel/ptrace.c       |    3 +++   arch/s390/kernel/ptrace.c       |    3 +++
8   arch/x86/kernel/ptrace.c        |    3 +++   arch/x86/kernel/ptrace.c        |    3 +++
  fs/attr.c                       |    5 +++++  
9   fs/compat.c                     |    3 ++-   fs/compat.c                     |    3 ++-
10   fs/compat_ioctl.c               |    7 +++++++   fs/compat_ioctl.c               |    3 +++
11   fs/exec.c                       |   12 +++++++++++-   fs/exec.c                       |   12 +++++++++++-
12   fs/fcntl.c                      |    4 ++++   fs/fcntl.c                      |    5 +++++
13   fs/ioctl.c                      |    5 +++++   fs/ioctl.c                      |    3 +++
14   fs/namei.c                      |   35 ++++++++++++++++++++++++++++++++++-   fs/namei.c                      |   34 +++++++++++++++++++++++++++++++++-
15   fs/namespace.c                  |   23 +++++++++++++++++++++++   fs/namespace.c                  |    9 +++++++++
16   fs/open.c                       |   30 ++++++++++++++++++++++++++++++   fs/open.c                       |   27 +++++++++++++++++++++++++++
17   fs/proc/proc_misc.c             |    1 +   fs/proc/proc_misc.c             |    1 +
18   include/linux/init_task.h       |    9 +++++++++   include/linux/init_task.h       |    9 +++++++++
19   include/linux/sched.h           |    6 ++++++   include/linux/sched.h           |    6 ++++++
# Line 31  Source code for this patch is http://dow Line 30  Source code for this patch is http://dow
30   kernel/time/ntp.c               |    3 +++   kernel/time/ntp.c               |    3 +++
31   net/ipv4/inet_connection_sock.c |    3 +++   net/ipv4/inet_connection_sock.c |    3 +++
32   net/ipv4/inet_hashtables.c      |    3 +++   net/ipv4/inet_hashtables.c      |    3 +++
33   net/ipv4/raw.c                  |    4 ++++   net/ipv4/raw.c                  |   12 +++++++++---
34   net/ipv4/udp.c                  |    7 +++++++   net/ipv4/udp.c                  |   12 +++++++++++-
35   net/ipv6/raw.c                  |    4 ++++   net/ipv6/raw.c                  |   12 +++++++++---
36   net/ipv6/udp.c                  |    4 ++++   net/ipv6/udp.c                  |    9 ++++++++-
37   net/socket.c                    |   23 +++++++++++++++++++++++   net/socket.c                    |   22 ++++++++++++++++++++++
38   net/unix/af_unix.c              |    4 ++++   net/unix/af_unix.c              |    9 +++++++++
39   security/Kconfig                |    2 ++   security/Kconfig                |    2 ++
40   security/Makefile               |    3 +++   security/Makefile               |    3 +++
41   37 files changed, 263 insertions(+), 3 deletions(-)   36 files changed, 257 insertions(+), 11 deletions(-)
42    
43  --- linux-2.6.25.20-0.5.orig/arch/ia64/ia32/sys_ia32.c  --- linux-2.6.25.20-0.7.orig/arch/ia64/ia32/sys_ia32.c
44  +++ linux-2.6.25.20-0.5/arch/ia64/ia32/sys_ia32.c  +++ linux-2.6.25.20-0.7/arch/ia64/ia32/sys_ia32.c
45  @@ -50,6 +50,7 @@  @@ -50,6 +50,7 @@
46   #include <asm/types.h>   #include <asm/types.h>
47   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 55  Source code for this patch is http://dow Line 54  Source code for this patch is http://dow
54          struct task_struct *child;          struct task_struct *child;
55          unsigned int value, tmp;          unsigned int value, tmp;
56          long i, ret;          long i, ret;
57  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
58  +               return -EPERM;  +               return -EPERM;
59    
60          lock_kernel();          lock_kernel();
61          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
62  --- linux-2.6.25.20-0.5.orig/arch/mips/kernel/ptrace32.c  --- linux-2.6.25.20-0.7.orig/arch/mips/kernel/ptrace32.c
63  +++ linux-2.6.25.20-0.5/arch/mips/kernel/ptrace32.c  +++ linux-2.6.25.20-0.7/arch/mips/kernel/ptrace32.c
64  @@ -35,6 +35,7 @@  @@ -35,6 +35,7 @@
65   #include <asm/system.h>   #include <asm/system.h>
66   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 74  Source code for this patch is http://dow Line 73  Source code for this patch is http://dow
73   {   {
74          struct task_struct *child;          struct task_struct *child;
75          int ret;          int ret;
76  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
77  +               return -EPERM;  +               return -EPERM;
78    
79   #if 0   #if 0
80          printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",          printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
81  --- linux-2.6.25.20-0.5.orig/arch/s390/kernel/ptrace.c  --- linux-2.6.25.20-0.7.orig/arch/s390/kernel/ptrace.c
82  +++ linux-2.6.25.20-0.5/arch/s390/kernel/ptrace.c  +++ linux-2.6.25.20-0.7/arch/s390/kernel/ptrace.c
83  @@ -41,6 +41,7 @@  @@ -41,6 +41,7 @@
84   #include <asm/system.h>   #include <asm/system.h>
85   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 93  Source code for this patch is http://dow Line 92  Source code for this patch is http://dow
92          struct task_struct *child;          struct task_struct *child;
93          int ret;          int ret;
94    
95  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
96  +               return -EPERM;  +               return -EPERM;
97          lock_kernel();          lock_kernel();
98          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
99                   ret = ptrace_traceme();                   ret = ptrace_traceme();
100  --- linux-2.6.25.20-0.5.orig/arch/x86/kernel/ptrace.c  --- linux-2.6.25.20-0.7.orig/arch/x86/kernel/ptrace.c
101  +++ linux-2.6.25.20-0.5/arch/x86/kernel/ptrace.c  +++ linux-2.6.25.20-0.7/arch/x86/kernel/ptrace.c
102  @@ -32,6 +32,7 @@  @@ -32,6 +32,7 @@
103   #include <asm/prctl.h>   #include <asm/prctl.h>
104   #include <asm/proto.h>   #include <asm/proto.h>
# Line 112  Source code for this patch is http://dow Line 111  Source code for this patch is http://dow
111          void __user *datap = compat_ptr(data);          void __user *datap = compat_ptr(data);
112          int ret;          int ret;
113          __u32 val;          __u32 val;
114  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
115  +               return -EPERM;  +               return -EPERM;
116    
117          switch (request) {          switch (request) {
118          case PTRACE_TRACEME:          case PTRACE_TRACEME:
119  --- linux-2.6.25.20-0.5.orig/fs/attr.c  --- linux-2.6.25.20-0.7.orig/fs/compat.c
120  +++ linux-2.6.25.20-0.5/fs/attr.c  +++ linux-2.6.25.20-0.7/fs/compat.c
 @@ -14,6 +14,7 @@  
  #include <linux/fcntl.h>  
  #include <linux/quotaops.h>  
  #include <linux/security.h>  
 +#include <linux/ccsecurity.h>  
   
  /* Taken over from the old code... */  
   
 @@ -160,6 +161,8 @@ int fnotify_change(struct dentry *dentry  
   
         if (inode->i_op && inode->i_op->setattr) {  
                 error = security_inode_setattr(dentry, mnt, attr);  
 +               if (!error)  
 +                       error = ccs_setattr_permission(dentry, attr);  
                 if (!error) {  
                         if (file && file->f_op && file->f_op->fsetattr)  
                                 error = file->f_op->fsetattr(file, attr);  
 @@ -181,6 +184,8 @@ int fnotify_change(struct dentry *dentry  
                 error = inode_change_ok(inode, attr);  
                 if (!error)  
                         error = security_inode_setattr(dentry, mnt, attr);  
 +               if (!error)  
 +                       error = ccs_setattr_permission(dentry, attr);  
                 if (!error) {  
                         if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||  
                             (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))  
 --- linux-2.6.25.20-0.5.orig/fs/compat.c  
 +++ linux-2.6.25.20-0.5/fs/compat.c  
121  @@ -55,6 +55,7 @@  @@ -55,6 +55,7 @@
122   #include <asm/mmu_context.h>   #include <asm/mmu_context.h>
123   #include <asm/ioctls.h>   #include <asm/ioctls.h>
# Line 164  Source code for this patch is http://dow Line 135  Source code for this patch is http://dow
135          if (retval >= 0) {          if (retval >= 0) {
136                  /* execve success */                  /* execve success */
137                  security_bprm_free(bprm);                  security_bprm_free(bprm);
138  --- linux-2.6.25.20-0.5.orig/fs/compat_ioctl.c  --- linux-2.6.25.20-0.7.orig/fs/compat_ioctl.c
139  +++ linux-2.6.25.20-0.5/fs/compat_ioctl.c  +++ linux-2.6.25.20-0.7/fs/compat_ioctl.c
140  @@ -120,6 +120,7 @@  @@ -120,6 +120,7 @@
141   #include <xen/public/privcmd.h>   #include <xen/public/privcmd.h>
142   #include <xen/compat_ioctl.h>   #include <xen/compat_ioctl.h>
# Line 183  Source code for this patch is http://dow Line 154  Source code for this patch is http://dow
154          if (error)          if (error)
155                  goto out_fput;                  goto out_fput;
156    
157  @@ -2930,6 +2933,10 @@ asmlinkage long compat_sys_ioctl(unsigne  --- linux-2.6.25.20-0.7.orig/fs/exec.c
158                  /*FALL THROUGH*/  +++ linux-2.6.25.20-0.7/fs/exec.c
   
         default:  
 +               if (!ccs_capable(CCS_SYS_IOCTL)) {  
 +                       error = -EPERM;  
 +                       goto out_fput;  
 +               }  
                 if (filp->f_op && filp->f_op->compat_ioctl) {  
                         error = filp->f_op->compat_ioctl(filp, cmd, arg);  
                         if (error != -ENOIOCTLCMD)  
 --- linux-2.6.25.20-0.5.orig/fs/exec.c  
 +++ linux-2.6.25.20-0.5/fs/exec.c  
159  @@ -60,6 +60,8 @@  @@ -60,6 +60,8 @@
160   #include <linux/kmod.h>   #include <linux/kmod.h>
161   #endif   #endif
# Line 227  Source code for this patch is http://dow Line 187  Source code for this patch is http://dow
187                          file = ERR_PTR(err);                          file = ERR_PTR(err);
188                          if (!err) {                          if (!err) {
189                                  file = nameidata_to_filp(&nd,                                  file = nameidata_to_filp(&nd,
190  @@ -1336,7 +1346,7 @@ int do_execve(char * filename,  @@ -1340,7 +1350,7 @@ int do_execve(char * filename,
191                  goto out;                  goto out;
192          bprm->argv_len = env_p - bprm->p;          bprm->argv_len = env_p - bprm->p;
193    
# Line 236  Source code for this patch is http://dow Line 196  Source code for this patch is http://dow
196          if (retval >= 0) {          if (retval >= 0) {
197                  /* execve success */                  /* execve success */
198                  free_arg_pages(bprm);                  free_arg_pages(bprm);
199  --- linux-2.6.25.20-0.5.orig/fs/fcntl.c  --- linux-2.6.25.20-0.7.orig/fs/fcntl.c
200  +++ linux-2.6.25.20-0.5/fs/fcntl.c  +++ linux-2.6.25.20-0.7/fs/fcntl.c
201  @@ -23,6 +23,7 @@  @@ -23,6 +23,7 @@
202   #include <asm/poll.h>   #include <asm/poll.h>
203   #include <asm/siginfo.h>   #include <asm/siginfo.h>
# Line 246  Source code for this patch is http://dow Line 206  Source code for this patch is http://dow
206    
207   void set_close_on_exec(unsigned int fd, int flag)   void set_close_on_exec(unsigned int fd, int flag)
208   {   {
209  @@ -217,6 +218,9 @@ static int setfl(int fd, struct file * f  @@ -397,6 +398,8 @@ asmlinkage long sys_fcntl(unsigned int f
210          if (((arg ^ filp->f_flags) & O_APPEND) && IS_APPEND(inode))                  goto out;
                 return -EPERM;  
211    
212  +       if (((arg ^ filp->f_flags) & O_APPEND) && ccs_rewrite_permission(filp))          err = security_file_fcntl(filp, cmd, arg);
213  +               return -EPERM;  +       if (!err)
214  +  +               err = ccs_fcntl_permission(filp, cmd, arg);
215          /* O_NOATIME can only be set by the owner or superuser */          if (err) {
216          if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME))                  fput(filp);
217                  if (!is_owner_or_cap(inode))                  return err;
218  --- linux-2.6.25.20-0.5.orig/fs/ioctl.c  @@ -421,6 +424,8 @@ asmlinkage long sys_fcntl64(unsigned int
219  +++ linux-2.6.25.20-0.5/fs/ioctl.c                  goto out;
220    
221            err = security_file_fcntl(filp, cmd, arg);
222    +       if (!err)
223    +               err = ccs_fcntl_permission(filp, cmd, arg);
224            if (err) {
225                    fput(filp);
226                    return err;
227    --- linux-2.6.25.20-0.7.orig/fs/ioctl.c
228    +++ linux-2.6.25.20-0.7/fs/ioctl.c
229  @@ -15,6 +15,7 @@  @@ -15,6 +15,7 @@
230   #include <linux/uaccess.h>   #include <linux/uaccess.h>
231    
# Line 266  Source code for this patch is http://dow Line 234  Source code for this patch is http://dow
234    
235   /**   /**
236    * vfs_ioctl - call filesystem specific ioctl methods    * vfs_ioctl - call filesystem specific ioctl methods
237  @@ -35,6 +36,8 @@ long vfs_ioctl(struct file *filp, unsign  @@ -202,6 +203,8 @@ asmlinkage long sys_ioctl(unsigned int f
   
         if (!filp->f_op)  
                 goto out;  
 +       if (!ccs_capable(CCS_SYS_IOCTL))  
 +               return -EPERM;  
   
         if (filp->f_op->unlocked_ioctl) {  
                 error = filp->f_op->unlocked_ioctl(filp, cmd, arg);  
 @@ -202,6 +205,8 @@ asmlinkage long sys_ioctl(unsigned int f  
238                  goto out;                  goto out;
239    
240          error = security_file_ioctl(filp, cmd, arg);          error = security_file_ioctl(filp, cmd, arg);
# Line 284  Source code for this patch is http://dow Line 243  Source code for this patch is http://dow
243          if (error)          if (error)
244                  goto out_fput;                  goto out_fput;
245    
246  --- linux-2.6.25.20-0.5.orig/fs/namei.c  --- linux-2.6.25.20-0.7.orig/fs/namei.c
247  +++ linux-2.6.25.20-0.5/fs/namei.c  +++ linux-2.6.25.20-0.7/fs/namei.c
248  @@ -35,6 +35,8 @@  @@ -35,6 +35,8 @@
249    
250   #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])   #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
# Line 317  Source code for this patch is http://dow Line 276  Source code for this patch is http://dow
276          error = vfs_create(dir->d_inode, path->dentry, mode, nd);          error = vfs_create(dir->d_inode, path->dentry, mode, nd);
277          mutex_unlock(&dir->d_inode->i_mutex);          mutex_unlock(&dir->d_inode->i_mutex);
278          dput(nd->path.dentry);          dput(nd->path.dentry);
279  @@ -1741,6 +1751,7 @@ static int open_namei_create(struct name  @@ -2019,6 +2029,9 @@ asmlinkage long sys_mknodat(int dfd, con
         return may_open(nd, 0, flag & ~O_TRUNC);  
  }  
   
 +#include <linux/ccsecurity_vfs.h>  
  /*  
   *     open_namei()  
   *  
 @@ -2019,6 +2030,9 @@ asmlinkage long sys_mknodat(int dfd, con  
280          if (!IS_POSIXACL(nd.path.dentry->d_inode))          if (!IS_POSIXACL(nd.path.dentry->d_inode))
281                  mode &= ~current->fs->umask;                  mode &= ~current->fs->umask;
282          if (!IS_ERR(dentry)) {          if (!IS_ERR(dentry)) {
# Line 335  Source code for this patch is http://dow Line 286  Source code for this patch is http://dow
286                  switch (mode & S_IFMT) {                  switch (mode & S_IFMT) {
287                  case 0: case S_IFREG:                  case 0: case S_IFREG:
288                          error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);                          error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);
289  @@ -2097,6 +2111,9 @@ asmlinkage long sys_mkdirat(int dfd, con  @@ -2097,6 +2110,9 @@ asmlinkage long sys_mkdirat(int dfd, con
290    
291          if (!IS_POSIXACL(nd.path.dentry->d_inode))          if (!IS_POSIXACL(nd.path.dentry->d_inode))
292                  mode &= ~current->fs->umask;                  mode &= ~current->fs->umask;
# Line 345  Source code for this patch is http://dow Line 296  Source code for this patch is http://dow
296          error = vfs_mkdir(nd.path.dentry->d_inode, dentry, nd.path.mnt, mode);          error = vfs_mkdir(nd.path.dentry->d_inode, dentry, nd.path.mnt, mode);
297          dput(dentry);          dput(dentry);
298   out_unlock:   out_unlock:
299  @@ -2205,6 +2222,9 @@ static long do_rmdir(int dfd, const char  @@ -2205,6 +2221,9 @@ static long do_rmdir(int dfd, const char
300          error = PTR_ERR(dentry);          error = PTR_ERR(dentry);
301          if (IS_ERR(dentry))          if (IS_ERR(dentry))
302                  goto exit2;                  goto exit2;
# Line 355  Source code for this patch is http://dow Line 306  Source code for this patch is http://dow
306          error = vfs_rmdir(nd.path.dentry->d_inode, dentry, nd.path.mnt);          error = vfs_rmdir(nd.path.dentry->d_inode, dentry, nd.path.mnt);
307          dput(dentry);          dput(dentry);
308   exit2:   exit2:
309  @@ -2286,6 +2306,9 @@ static long do_unlinkat(int dfd, const c  @@ -2286,6 +2305,9 @@ static long do_unlinkat(int dfd, const c
310                  inode = dentry->d_inode;                  inode = dentry->d_inode;
311                  if (inode)                  if (inode)
312                          atomic_inc(&inode->i_count);                          atomic_inc(&inode->i_count);
# Line 365  Source code for this patch is http://dow Line 316  Source code for this patch is http://dow
316                  error = vfs_unlink(nd.path.dentry->d_inode, dentry, nd.path.mnt);                  error = vfs_unlink(nd.path.dentry->d_inode, dentry, nd.path.mnt);
317          exit2:          exit2:
318                  dput(dentry);                  dput(dentry);
319  @@ -2368,6 +2391,9 @@ asmlinkage long sys_symlinkat(const char  @@ -2368,6 +2390,9 @@ asmlinkage long sys_symlinkat(const char
320          if (IS_ERR(dentry))          if (IS_ERR(dentry))
321                  goto out_unlock;                  goto out_unlock;
322    
# Line 375  Source code for this patch is http://dow Line 326  Source code for this patch is http://dow
326          error = vfs_symlink(nd.path.dentry->d_inode, dentry, nd.path.mnt, from,          error = vfs_symlink(nd.path.dentry->d_inode, dentry, nd.path.mnt, from,
327                              S_IALLUGO);                              S_IALLUGO);
328          dput(dentry);          dput(dentry);
329  @@ -2465,6 +2491,10 @@ asmlinkage long sys_linkat(int olddfd, c  @@ -2465,6 +2490,10 @@ asmlinkage long sys_linkat(int olddfd, c
330          error = PTR_ERR(new_dentry);          error = PTR_ERR(new_dentry);
331          if (IS_ERR(new_dentry))          if (IS_ERR(new_dentry))
332                  goto out_unlock;                  goto out_unlock;
# Line 386  Source code for this patch is http://dow Line 337  Source code for this patch is http://dow
337          error = vfs_link(old_nd.path.dentry, old_nd.path.mnt, nd.path.dentry->d_inode,          error = vfs_link(old_nd.path.dentry, old_nd.path.mnt, nd.path.dentry->d_inode,
338                           new_dentry, nd.path.mnt);                           new_dentry, nd.path.mnt);
339          dput(new_dentry);          dput(new_dentry);
340  @@ -2698,7 +2728,10 @@ static int do_rename(int olddfd, const c  @@ -2698,7 +2727,10 @@ static int do_rename(int olddfd, const c
341          error = -ENOTEMPTY;          error = -ENOTEMPTY;
342          if (new_dentry == trap)          if (new_dentry == trap)
343                  goto exit5;                  goto exit5;
# Line 398  Source code for this patch is http://dow Line 349  Source code for this patch is http://dow
349          error = vfs_rename(old_dir->d_inode, old_dentry, oldnd.path.mnt,          error = vfs_rename(old_dir->d_inode, old_dentry, oldnd.path.mnt,
350                             new_dir->d_inode, new_dentry, newnd.path.mnt);                             new_dir->d_inode, new_dentry, newnd.path.mnt);
351   exit5:   exit5:
352  --- linux-2.6.25.20-0.5.orig/fs/namespace.c  --- linux-2.6.25.20-0.7.orig/fs/namespace.c
353  +++ linux-2.6.25.20-0.5/fs/namespace.c  +++ linux-2.6.25.20-0.7/fs/namespace.c
354  @@ -30,6 +30,7 @@  @@ -30,6 +30,7 @@
355   #include <asm/unistd.h>   #include <asm/unistd.h>
356   #include "pnode.h"   #include "pnode.h"
# Line 408  Source code for this patch is http://dow Line 359  Source code for this patch is http://dow
359    
360   #define HASH_SHIFT ilog2(PAGE_SIZE / sizeof(struct list_head))   #define HASH_SHIFT ilog2(PAGE_SIZE / sizeof(struct list_head))
361   #define HASH_SIZE (1UL << HASH_SHIFT)   #define HASH_SIZE (1UL << HASH_SHIFT)
362  @@ -591,6 +592,9 @@ static int do_umount(struct vfsmount *mn  @@ -588,6 +589,8 @@ static int do_umount(struct vfsmount *mn
363            LIST_HEAD(umount_list);
364    
365            retval = security_sb_umount(mnt, flags);
366    +       if (!retval)
367    +               retval = ccs_umount_permission(mnt, flags);
368          if (retval)          if (retval)
369                  return retval;                  return retval;
370    
371  +       if (ccs_may_umount(mnt))  @@ -1394,6 +1397,7 @@ int copy_mount_options(const void __user
372  +               return -EPERM;   long do_mount(char *dev_name, char *dir_name, char *type_page,
373  +                    unsigned long flags, void *data_page)
         /*  
          * Allow userspace to request a mountpoint be expired rather than  
          * unmounting unconditionally. Unmount only happens if:  
 @@ -682,6 +686,8 @@ asmlinkage long sys_umount(char __user *  
374   {   {
375    +       const unsigned long original_flags = flags;
376          struct nameidata nd;          struct nameidata nd;
377          int retval;          int retval = 0;
378  +       if (!ccs_capable(CCS_SYS_UMOUNT))          int mnt_flags = 0;
379  +               return -EPERM;  @@ -1435,6 +1439,9 @@ long do_mount(char *dev_name, char *dir_
380                    return retval;
381    
382          retval = __user_walk(name, LOOKUP_FOLLOW, &nd);          retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page);
383    +       if (!retval)
384    +               retval = ccs_mount_permission(dev_name, &nd.path, type_page,
385    +                                             original_flags, data_page);
386          if (retval)          if (retval)
387  @@ -991,6 +997,9 @@ static noinline int do_loopback(struct n                  goto dput_out;
         err = -EINVAL;  
         if (IS_MNT_UNBINDABLE(old_nd.path.mnt))  
                 goto out;  
 +       err = -EPERM;  
 +       if (ccs_may_mount(nd))  
 +               goto out;  
   
         if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))  
                 goto out;  
 @@ -1085,6 +1094,9 @@ static noinline int do_move_mount(struct  
         if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))  
                 goto out;  
388    
389  +       err = -EPERM;  @@ -1696,6 +1703,8 @@ asmlinkage long sys_pivot_root(const cha
 +       if (ccs_may_umount(old_nd.path.mnt) || ccs_may_mount(nd))  
 +               goto out;  
         err = -ENOENT;  
         mutex_lock(&nd->path.dentry->d_inode->i_mutex);  
         if (IS_DEADDIR(nd->path.dentry->d_inode))  
 @@ -1189,6 +1201,9 @@ int do_add_mount(struct vfsmount *newmnt  
         err = -EINVAL;  
         if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))  
                 goto unlock;  
 +       err = -EPERM;  
 +       if (ccs_may_mount(nd))  
 +               goto unlock;  
   
         newmnt->mnt_flags = mnt_flags;  
         if ((err = graft_tree(newmnt, nd)))  
 @@ -1412,6 +1427,10 @@ long do_mount(char *dev_name, char *dir_  
         if (data_page)  
                 ((char *)data_page)[PAGE_SIZE - 1] = 0;  
   
 +       retval = ccs_mount_permission(dev_name, dir_name, type_page, &flags);  
 +       if (retval)  
 +               return retval;  
 +  
         /* Separate the per-mountpoint flags */  
         if (flags & MS_NOSUID)  
                 mnt_flags |= MNT_NOSUID;  
 @@ -1680,6 +1699,8 @@ asmlinkage long sys_pivot_root(const cha  
   
         if (!capable(CAP_SYS_ADMIN))  
                 return -EPERM;  
 +       if (!ccs_capable(CCS_SYS_PIVOT_ROOT))  
 +               return -EPERM;  
   
         lock_kernel();  
   
 @@ -1696,6 +1717,8 @@ asmlinkage long sys_pivot_root(const cha  
390                  goto out1;                  goto out1;
391    
392          error = security_sb_pivotroot(&old_nd, &new_nd);          error = security_sb_pivotroot(&old_nd, &new_nd);
393  +       if (!error)  +       if (!error)
394  +               error = ccs_pivot_root_permission(&old_nd, &new_nd);  +               error = ccs_pivot_root_permission(&old_nd.path, &new_nd.path);
395          if (error) {          if (error) {
396                  path_put(&old_nd.path);                  path_put(&old_nd.path);
397                  goto out1;                  goto out1;
398  --- linux-2.6.25.20-0.5.orig/fs/open.c  --- linux-2.6.25.20-0.7.orig/fs/open.c
399  +++ linux-2.6.25.20-0.5/fs/open.c  +++ linux-2.6.25.20-0.7/fs/open.c
400  @@ -27,6 +27,7 @@  @@ -27,6 +27,7 @@
401   #include <linux/rcupdate.h>   #include <linux/rcupdate.h>
402   #include <linux/audit.h>   #include <linux/audit.h>
# Line 496  Source code for this patch is http://dow Line 405  Source code for this patch is http://dow
405    
406   int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)   int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
407   {   {
408  @@ -267,6 +268,10 @@ static long do_sys_truncate(const char _  @@ -267,6 +268,9 @@ static long do_sys_truncate(const char _
409          if (error)          if (error)
410                  goto put_write_and_out;                  goto put_write_and_out;
411    
412  +       error = ccs_truncate_permission(nd.path.dentry, nd.path.mnt, length,  +       error = ccs_truncate_permission(nd.path.dentry, nd.path.mnt);
 +                                       0);  
413  +       if (error)  +       if (error)
414  +               goto put_write_and_out;  +               goto put_write_and_out;
415          error = locks_verify_truncate(inode, NULL, length);          error = locks_verify_truncate(inode, NULL, length);
416          if (!error) {          if (!error) {
417                  DQUOT_INIT(inode);                  DQUOT_INIT(inode);
418  @@ -321,6 +326,9 @@ static long do_sys_ftruncate(unsigned in  @@ -321,6 +325,9 @@ static long do_sys_ftruncate(unsigned in
419          if (IS_APPEND(inode))          if (IS_APPEND(inode))
420                  goto out_putf;                  goto out_putf;
421    
422  +       error = ccs_truncate_permission(dentry, file->f_vfsmnt, length, 0);  +       error = ccs_truncate_permission(dentry, file->f_vfsmnt);
423  +       if (error)  +       if (error)
424  +               goto out_putf;  +               goto out_putf;
425          error = locks_verify_truncate(inode, file, length);          error = locks_verify_truncate(inode, file, length);
426          if (!error)          if (!error)
427                  error = do_truncate(dentry, file->f_path.mnt, length,                  error = do_truncate(dentry, file->f_path.mnt, length,
428  @@ -539,6 +547,10 @@ asmlinkage long sys_chroot(const char __  @@ -539,6 +546,8 @@ asmlinkage long sys_chroot(const char __
429          error = -EPERM;          error = -EPERM;
430          if (!capable(CAP_SYS_CHROOT))          if (!capable(CAP_SYS_CHROOT))
431                  goto dput_and_out;                  goto dput_and_out;
432  +       if (!ccs_capable(CCS_SYS_CHROOT))  +       if (ccs_chroot_permission(&nd.path))
 +               goto dput_and_out;  
 +       if (ccs_chroot_permission(&nd))  
433  +               goto dput_and_out;  +               goto dput_and_out;
434    
435          set_fs_root(current->fs, &nd.path);          set_fs_root(current->fs, &nd.path);
436          set_fs_altroot();          set_fs_altroot();
437  @@ -572,6 +584,9 @@ asmlinkage long sys_fchmod(unsigned int  @@ -572,6 +581,9 @@ asmlinkage long sys_fchmod(unsigned int
438          err = -EPERM;          err = -EPERM;
439          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
440                  goto out_putf;                  goto out_putf;
# Line 538  Source code for this patch is http://dow Line 444  Source code for this patch is http://dow
444          mutex_lock(&inode->i_mutex);          mutex_lock(&inode->i_mutex);
445          if (mode == (mode_t) -1)          if (mode == (mode_t) -1)
446                  mode = inode->i_mode;                  mode = inode->i_mode;
447  @@ -606,6 +621,9 @@ asmlinkage long sys_fchmodat(int dfd, co  @@ -606,6 +618,9 @@ asmlinkage long sys_fchmodat(int dfd, co
448          error = -EPERM;          error = -EPERM;
449          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
450                  goto dput_and_out;                  goto dput_and_out;
# Line 548  Source code for this patch is http://dow Line 454  Source code for this patch is http://dow
454    
455          mutex_lock(&inode->i_mutex);          mutex_lock(&inode->i_mutex);
456          if (mode == (mode_t) -1)          if (mode == (mode_t) -1)
457  @@ -674,6 +692,8 @@ asmlinkage long sys_chown(const char __u  @@ -674,6 +689,8 @@ asmlinkage long sys_chown(const char __u
458          error = user_path_walk(filename, &nd);          error = user_path_walk(filename, &nd);
459          if (error)          if (error)
460                  goto out;                  goto out;
# Line 557  Source code for this patch is http://dow Line 463  Source code for this patch is http://dow
463          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);
464          path_put(&nd.path);          path_put(&nd.path);
465   out:   out:
466  @@ -694,6 +714,8 @@ asmlinkage long sys_fchownat(int dfd, co  @@ -694,6 +711,8 @@ asmlinkage long sys_fchownat(int dfd, co
467          error = __user_walk_fd(dfd, filename, follow, &nd);          error = __user_walk_fd(dfd, filename, follow, &nd);
468          if (error)          if (error)
469                  goto out;                  goto out;
# Line 566  Source code for this patch is http://dow Line 472  Source code for this patch is http://dow
472          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);
473          path_put(&nd.path);          path_put(&nd.path);
474   out:   out:
475  @@ -708,6 +730,8 @@ asmlinkage long sys_lchown(const char __  @@ -708,6 +727,8 @@ asmlinkage long sys_lchown(const char __
476          error = user_path_walk_link(filename, &nd);          error = user_path_walk_link(filename, &nd);
477          if (error)          if (error)
478                  goto out;                  goto out;
# Line 575  Source code for this patch is http://dow Line 481  Source code for this patch is http://dow
481          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);
482          path_put(&nd.path);          path_put(&nd.path);
483   out:   out:
484  @@ -727,6 +751,8 @@ asmlinkage long sys_fchown(unsigned int  @@ -727,6 +748,8 @@ asmlinkage long sys_fchown(unsigned int
485    
486          dentry = file->f_path.dentry;          dentry = file->f_path.dentry;
487          audit_inode(NULL, dentry);          audit_inode(NULL, dentry);
# Line 584  Source code for this patch is http://dow Line 490  Source code for this patch is http://dow
490          error = chown_common(dentry, file->f_path.mnt, user, group, file);          error = chown_common(dentry, file->f_path.mnt, user, group, file);
491          fput(file);          fput(file);
492   out:   out:
493  @@ -823,7 +849,9 @@ static struct file *do_filp_open(int dfd  @@ -823,7 +846,9 @@ static struct file *do_filp_open(int dfd
494          if ((namei_flags+1) & O_ACCMODE)          if ((namei_flags+1) & O_ACCMODE)
495                  namei_flags++;                  namei_flags++;
496    
# Line 594  Source code for this patch is http://dow Line 500  Source code for this patch is http://dow
500          if (!error)          if (!error)
501                  return nameidata_to_filp(&nd, flags);                  return nameidata_to_filp(&nd, flags);
502    
503  @@ -1172,6 +1200,8 @@ EXPORT_SYMBOL(sys_close);  @@ -1172,6 +1197,8 @@ EXPORT_SYMBOL(sys_close);
504    */    */
505   asmlinkage long sys_vhangup(void)   asmlinkage long sys_vhangup(void)
506   {   {
# Line 603  Source code for this patch is http://dow Line 509  Source code for this patch is http://dow
509          if (capable(CAP_SYS_TTY_CONFIG)) {          if (capable(CAP_SYS_TTY_CONFIG)) {
510                  /* XXX: this needs locking */                  /* XXX: this needs locking */
511                  tty_vhangup(current->signal->tty);                  tty_vhangup(current->signal->tty);
512  --- linux-2.6.25.20-0.5.orig/fs/proc/proc_misc.c  --- linux-2.6.25.20-0.7.orig/fs/proc/proc_misc.c
513  +++ linux-2.6.25.20-0.5/fs/proc/proc_misc.c  +++ linux-2.6.25.20-0.7/fs/proc/proc_misc.c
514  @@ -1021,4 +1021,5 @@ void __init proc_misc_init(void)  @@ -1021,4 +1021,5 @@ void __init proc_misc_init(void)
515                          entry->proc_fops = &proc_sysrq_trigger_operations;                          entry->proc_fops = &proc_sysrq_trigger_operations;
516          }          }
517   #endif   #endif
518  +       printk(KERN_INFO "Hook version: 2.6.25.20-0.5 2009/08/23\n");  +       printk(KERN_INFO "Hook version: 2.6.25.20-0.7 2010/08/23\n");
519   }   }
520  --- linux-2.6.25.20-0.5.orig/include/linux/init_task.h  --- linux-2.6.25.20-0.7.orig/include/linux/init_task.h
521  +++ linux-2.6.25.20-0.5/include/linux/init_task.h  +++ linux-2.6.25.20-0.7/include/linux/init_task.h
522  @@ -133,6 +133,14 @@ extern struct group_info init_groups;  @@ -133,6 +133,14 @@ extern struct group_info init_groups;
523   # define CAP_INIT_BSET  CAP_INIT_EFF_SET   # define CAP_INIT_BSET  CAP_INIT_EFF_SET
524   #endif   #endif
# Line 636  Source code for this patch is http://dow Line 542  Source code for this patch is http://dow
542   }   }
543    
544    
545  --- linux-2.6.25.20-0.5.orig/include/linux/sched.h  --- linux-2.6.25.20-0.7.orig/include/linux/sched.h
546  +++ linux-2.6.25.20-0.5/include/linux/sched.h  +++ linux-2.6.25.20-0.7/include/linux/sched.h
547  @@ -29,6 +29,8 @@  @@ -41,6 +41,8 @@
548   #define CLONE_NEWNET           0x40000000      /* New network namespace */  
549   #define CLONE_IO               0x80000000      /* Clone io context */   #ifdef __KERNEL__
550    
551  +struct ccs_domain_info;  +struct ccs_domain_info;
552  +  +
553   /*   struct sched_param {
554    * Scheduling policies          int sched_priority;
555    */   };
556  @@ -1274,6 +1276,10 @@ struct task_struct {  @@ -1274,6 +1276,10 @@ struct task_struct {
557   #ifndef __GENKSYMS__   #ifndef __GENKSYMS__
558          struct list_head        *scm_work_list;          struct list_head        *scm_work_list;
# Line 658  Source code for this patch is http://dow Line 564  Source code for this patch is http://dow
564   };   };
565    
566   /*   /*
567  --- linux-2.6.25.20-0.5.orig/kernel/compat.c  --- linux-2.6.25.20-0.7.orig/kernel/compat.c
568  +++ linux-2.6.25.20-0.5/kernel/compat.c  +++ linux-2.6.25.20-0.7/kernel/compat.c
569  @@ -25,6 +25,7 @@  @@ -25,6 +25,7 @@
570   #include <linux/posix-timers.h>   #include <linux/posix-timers.h>
571    
# Line 677  Source code for this patch is http://dow Line 583  Source code for this patch is http://dow
583    
584          do_settimeofday(&tv);          do_settimeofday(&tv);
585          return 0;          return 0;
586  --- linux-2.6.25.20-0.5.orig/kernel/kexec.c  --- linux-2.6.25.20-0.7.orig/kernel/kexec.c
587  +++ linux-2.6.25.20-0.5/kernel/kexec.c  +++ linux-2.6.25.20-0.7/kernel/kexec.c
588  @@ -31,6 +31,7 @@  @@ -31,6 +31,7 @@
589   #include <asm/system.h>   #include <asm/system.h>
590   #include <asm/semaphore.h>   #include <asm/semaphore.h>
# Line 696  Source code for this patch is http://dow Line 602  Source code for this patch is http://dow
602    
603          /*          /*
604           * Verify we have a legal set of flags           * Verify we have a legal set of flags
605  --- linux-2.6.25.20-0.5.orig/kernel/kmod.c  --- linux-2.6.25.20-0.7.orig/kernel/kmod.c
606  +++ linux-2.6.25.20-0.5/kernel/kmod.c  +++ linux-2.6.25.20-0.7/kernel/kmod.c
607  @@ -173,6 +173,11 @@ static int ____call_usermodehelper(void  @@ -173,6 +173,11 @@ static int ____call_usermodehelper(void
608           */           */
609          set_user_nice(current, 0);          set_user_nice(current, 0);
# Line 710  Source code for this patch is http://dow Line 616  Source code for this patch is http://dow
616          retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp);          retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp);
617    
618          /* Exec failed? */          /* Exec failed? */
619  --- linux-2.6.25.20-0.5.orig/kernel/module.c  --- linux-2.6.25.20-0.7.orig/kernel/module.c
620  +++ linux-2.6.25.20-0.5/kernel/module.c  +++ linux-2.6.25.20-0.7/kernel/module.c
621  @@ -47,6 +47,7 @@  @@ -47,6 +47,7 @@
622   #include <asm/cacheflush.h>   #include <asm/cacheflush.h>
623   #include <linux/license.h>   #include <linux/license.h>
# Line 738  Source code for this patch is http://dow Line 644  Source code for this patch is http://dow
644    
645          /* Only one module load at a time, please */          /* Only one module load at a time, please */
646          if (mutex_lock_interruptible(&module_mutex) != 0)          if (mutex_lock_interruptible(&module_mutex) != 0)
647  --- linux-2.6.25.20-0.5.orig/kernel/ptrace.c  --- linux-2.6.25.20-0.7.orig/kernel/ptrace.c
648  +++ linux-2.6.25.20-0.5/kernel/ptrace.c  +++ linux-2.6.25.20-0.7/kernel/ptrace.c
649  @@ -24,6 +24,7 @@  @@ -24,6 +24,7 @@
650    
651   #include <asm/pgtable.h>   #include <asm/pgtable.h>
# Line 752  Source code for this patch is http://dow Line 658  Source code for this patch is http://dow
658          /*          /*
659           * This lock_kernel fixes a subtle race with suid exec           * This lock_kernel fixes a subtle race with suid exec
660           */           */
661  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
662  +               return -EPERM;  +               return -EPERM;
663          lock_kernel();          lock_kernel();
664          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
# Line 761  Source code for this patch is http://dow Line 667  Source code for this patch is http://dow
667          /*          /*
668           * This lock_kernel fixes a subtle race with suid exec           * This lock_kernel fixes a subtle race with suid exec
669           */           */
670  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
671  +               return -EPERM;  +               return -EPERM;
672          lock_kernel();          lock_kernel();
673          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
674                  ret = ptrace_traceme();                  ret = ptrace_traceme();
675  --- linux-2.6.25.20-0.5.orig/kernel/sched.c  --- linux-2.6.25.20-0.7.orig/kernel/sched.c
676  +++ linux-2.6.25.20-0.5/kernel/sched.c  +++ linux-2.6.25.20-0.7/kernel/sched.c
677  @@ -69,6 +69,7 @@  @@ -69,6 +69,7 @@
678    
679   #include <asm/tlb.h>   #include <asm/tlb.h>
# Line 785  Source code for this patch is http://dow Line 691  Source code for this patch is http://dow
691    
692          /*          /*
693           * Setpriority might change our priority at the same moment.           * Setpriority might change our priority at the same moment.
694  --- linux-2.6.25.20-0.5.orig/kernel/signal.c  --- linux-2.6.25.20-0.7.orig/kernel/signal.c
695  +++ linux-2.6.25.20-0.5/kernel/signal.c  +++ linux-2.6.25.20-0.7/kernel/signal.c
696  @@ -32,6 +32,7 @@  @@ -32,6 +32,7 @@
697   #include <asm/unistd.h>   #include <asm/unistd.h>
698   #include <asm/siginfo.h>   #include <asm/siginfo.h>
# Line 795  Source code for this patch is http://dow Line 701  Source code for this patch is http://dow
701    
702   /*   /*
703    * SLAB caches for signal bits.    * SLAB caches for signal bits.
704  @@ -2232,6 +2233,8 @@ asmlinkage long  @@ -2233,6 +2234,8 @@ asmlinkage long
705   sys_kill(int pid, int sig)   sys_kill(int pid, int sig)
706   {   {
707          struct siginfo info;          struct siginfo info;
# Line 804  Source code for this patch is http://dow Line 710  Source code for this patch is http://dow
710    
711          info.si_signo = sig;          info.si_signo = sig;
712          info.si_errno = 0;          info.si_errno = 0;
713  @@ -2290,6 +2293,8 @@ asmlinkage long sys_tgkill(int tgid, int  @@ -2291,6 +2294,8 @@ asmlinkage long sys_tgkill(int tgid, int
714          /* This is only valid for single tasks */          /* This is only valid for single tasks */
715          if (pid <= 0 || tgid <= 0)          if (pid <= 0 || tgid <= 0)
716                  return -EINVAL;                  return -EINVAL;
# Line 813  Source code for this patch is http://dow Line 719  Source code for this patch is http://dow
719    
720          return do_tkill(tgid, pid, sig);          return do_tkill(tgid, pid, sig);
721   }   }
722  @@ -2303,6 +2308,8 @@ sys_tkill(int pid, int sig)  @@ -2304,6 +2309,8 @@ sys_tkill(int pid, int sig)
723          /* This is only valid for single tasks */          /* This is only valid for single tasks */
724          if (pid <= 0)          if (pid <= 0)
725                  return -EINVAL;                  return -EINVAL;
# Line 822  Source code for this patch is http://dow Line 728  Source code for this patch is http://dow
728    
729          return do_tkill(0, pid, sig);          return do_tkill(0, pid, sig);
730   }   }
731  @@ -2320,6 +2327,8 @@ sys_rt_sigqueueinfo(int pid, int sig, si  @@ -2321,6 +2328,8 @@ sys_rt_sigqueueinfo(int pid, int sig, si
732          if (info.si_code >= 0)          if (info.si_code >= 0)
733                  return -EPERM;                  return -EPERM;
734          info.si_signo = sig;          info.si_signo = sig;
# Line 831  Source code for this patch is http://dow Line 737  Source code for this patch is http://dow
737    
738          /* POSIX.1b doesn't mention process groups.  */          /* POSIX.1b doesn't mention process groups.  */
739          return kill_proc_info(sig, &info, pid);          return kill_proc_info(sig, &info, pid);
740  --- linux-2.6.25.20-0.5.orig/kernel/sys.c  --- linux-2.6.25.20-0.7.orig/kernel/sys.c
741  +++ linux-2.6.25.20-0.5/kernel/sys.c  +++ linux-2.6.25.20-0.7/kernel/sys.c
742  @@ -42,6 +42,7 @@  @@ -42,6 +42,7 @@
743   #include <asm/uaccess.h>   #include <asm/uaccess.h>
744   #include <asm/io.h>   #include <asm/io.h>
# Line 879  Source code for this patch is http://dow Line 785  Source code for this patch is http://dow
785    
786          down_write(&uts_sem);          down_write(&uts_sem);
787          errno = -EFAULT;          errno = -EFAULT;
788  --- linux-2.6.25.20-0.5.orig/kernel/sysctl.c  --- linux-2.6.25.20-0.7.orig/kernel/sysctl.c
789  +++ linux-2.6.25.20-0.5/kernel/sysctl.c  +++ linux-2.6.25.20-0.7/kernel/sysctl.c
790  @@ -48,6 +48,7 @@  @@ -48,6 +48,7 @@
791    
792   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 907  Source code for this patch is http://dow Line 813  Source code for this patch is http://dow
813                  error = parse_table(name, nlen, oldval, oldlenp,                  error = parse_table(name, nlen, oldval, oldlenp,
814                                          newval, newlen, head->ctl_table);                                          newval, newlen, head->ctl_table);
815                  if (error != -ENOTDIR) {                  if (error != -ENOTDIR) {
816  --- linux-2.6.25.20-0.5.orig/kernel/time.c  --- linux-2.6.25.20-0.7.orig/kernel/time.c
817  +++ linux-2.6.25.20-0.5/kernel/time.c  +++ linux-2.6.25.20-0.7/kernel/time.c
818  @@ -38,6 +38,7 @@  @@ -38,6 +38,7 @@
819    
820   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 935  Source code for this patch is http://dow Line 841  Source code for this patch is http://dow
841    
842          if (tz) {          if (tz) {
843                  /* SMP safe, global irq locking makes it work. */                  /* SMP safe, global irq locking makes it work. */
844  --- linux-2.6.25.20-0.5.orig/kernel/time/ntp.c  --- linux-2.6.25.20-0.7.orig/kernel/time/ntp.c
845  +++ linux-2.6.25.20-0.5/kernel/time/ntp.c  +++ linux-2.6.25.20-0.7/kernel/time/ntp.c
846  @@ -17,6 +17,7 @@  @@ -17,6 +17,7 @@
847   #include <linux/capability.h>   #include <linux/capability.h>
848   #include <asm/div64.h>   #include <asm/div64.h>
# Line 954  Source code for this patch is http://dow Line 860  Source code for this patch is http://dow
860    
861          /* Now we validate the data before disabling interrupts */          /* Now we validate the data before disabling interrupts */
862    
863  --- linux-2.6.25.20-0.5.orig/net/ipv4/inet_connection_sock.c  --- linux-2.6.25.20-0.7.orig/net/ipv4/inet_connection_sock.c
864  +++ linux-2.6.25.20-0.5/net/ipv4/inet_connection_sock.c  +++ linux-2.6.25.20-0.7/net/ipv4/inet_connection_sock.c
865  @@ -23,6 +23,7 @@  @@ -23,6 +23,7 @@
866   #include <net/route.h>   #include <net/route.h>
867   #include <net/tcp_states.h>   #include <net/tcp_states.h>
# Line 973  Source code for this patch is http://dow Line 879  Source code for this patch is http://dow
879                          inet_bind_bucket_for_each(tb, node, &head->chain)                          inet_bind_bucket_for_each(tb, node, &head->chain)
880                                  if (tb->ib_net == net && tb->port == rover)                                  if (tb->ib_net == net && tb->port == rover)
881                                          goto next;                                          goto next;
882  --- linux-2.6.25.20-0.5.orig/net/ipv4/inet_hashtables.c  --- linux-2.6.25.20-0.7.orig/net/ipv4/inet_hashtables.c
883  +++ linux-2.6.25.20-0.5/net/ipv4/inet_hashtables.c  +++ linux-2.6.25.20-0.7/net/ipv4/inet_hashtables.c
884  @@ -22,6 +22,7 @@  @@ -22,6 +22,7 @@
885   #include <net/inet_connection_sock.h>   #include <net/inet_connection_sock.h>
886   #include <net/inet_hashtables.h>   #include <net/inet_hashtables.h>
# Line 992  Source code for this patch is http://dow Line 898  Source code for this patch is http://dow
898                          head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];                          head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];
899                          spin_lock(&head->lock);                          spin_lock(&head->lock);
900    
901  --- linux-2.6.25.20-0.5.orig/net/ipv4/raw.c  --- linux-2.6.25.20-0.7.orig/net/ipv4/raw.c
902  +++ linux-2.6.25.20-0.5/net/ipv4/raw.c  +++ linux-2.6.25.20-0.7/net/ipv4/raw.c
903  @@ -79,6 +79,7 @@  @@ -79,6 +79,7 @@
904   #include <linux/seq_file.h>   #include <linux/seq_file.h>
905   #include <linux/netfilter.h>   #include <linux/netfilter.h>
# Line 1002  Source code for this patch is http://dow Line 908  Source code for this patch is http://dow
908    
909   static struct raw_hashinfo raw_v4_hashinfo = {   static struct raw_hashinfo raw_v4_hashinfo = {
910          .lock = __RW_LOCK_UNLOCKED(),          .lock = __RW_LOCK_UNLOCKED(),
911  @@ -668,6 +669,9 @@ static int raw_recvmsg(struct kiocb *ioc  @@ -665,9 +666,14 @@ static int raw_recvmsg(struct kiocb *ioc
         skb = skb_recv_datagram(sk, flags, noblock, &err);  
         if (!skb)  
912                  goto out;                  goto out;
913  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);          }
914  +       if (err)  
915  +               goto out;  -       skb = skb_recv_datagram(sk, flags, noblock, &err);
916    -       if (!skb)
917    -               goto out;
918    +       for (;;) {
919    +               skb = skb_recv_datagram(sk, flags, noblock, &err);
920    +               if (!skb)
921    +                       goto out;
922    +               if (!ccs_socket_post_recvmsg_permission(sk, skb))
923    +                       break;
924    +               skb_kill_datagram(sk, skb, flags);
925    +       }
926    
927          copied = skb->len;          copied = skb->len;
928          if (len < copied) {          if (len < copied) {
929  --- linux-2.6.25.20-0.5.orig/net/ipv4/udp.c  --- linux-2.6.25.20-0.7.orig/net/ipv4/udp.c
930  +++ linux-2.6.25.20-0.5/net/ipv4/udp.c  +++ linux-2.6.25.20-0.7/net/ipv4/udp.c
931  @@ -105,6 +105,7 @@  @@ -105,6 +105,7 @@
932   #include <net/checksum.h>   #include <net/checksum.h>
933   #include <net/xfrm.h>   #include <net/xfrm.h>
# Line 1039  Source code for this patch is http://dow Line 953  Source code for this patch is http://dow
953                          if (! __udp_lib_lport_inuse(net, rover, udptable))                          if (! __udp_lib_lport_inuse(net, rover, udptable))
954                                  goto gotit;                                  goto gotit;
955                          rover += UDP_HTABLE_SIZE;                          rover += UDP_HTABLE_SIZE;
956  @@ -863,6 +867,9 @@ try_again:  @@ -848,6 +852,7 @@ int udp_recvmsg(struct kiocb *iocb, stru
957            int peeked;
958            int err;
959            int is_udplite = IS_UDPLITE(sk);
960    +       _Bool update_stat;
961    
962            /*
963             *      Check any passed addresses
964    @@ -863,6 +868,11 @@ try_again:
965                                    &peeked, &err);                                    &peeked, &err);
966          if (!skb)          if (!skb)
967                  goto out;                  goto out;
968  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
969  +       if (err)  +               update_stat = 0;
970  +               goto out;  +               goto csum_copy_err;
971    +       }
972    +       update_stat = 1;
973    
974          ulen = skb->len - sizeof(struct udphdr);          ulen = skb->len - sizeof(struct udphdr);
975          copied = len;          copied = len;
976  --- linux-2.6.25.20-0.5.orig/net/ipv6/raw.c  @@ -924,7 +934,7 @@ out:
977  +++ linux-2.6.25.20-0.5/net/ipv6/raw.c  
978     csum_copy_err:
979            lock_sock(sk);
980    -       if (!skb_kill_datagram(sk, skb, flags))
981    +       if (!skb_kill_datagram(sk, skb, flags) && update_stat)
982                    UDP_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
983            release_sock(sk);
984    
985    --- linux-2.6.25.20-0.7.orig/net/ipv6/raw.c
986    +++ linux-2.6.25.20-0.7/net/ipv6/raw.c
987  @@ -60,6 +60,7 @@  @@ -60,6 +60,7 @@
988    
989   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
# Line 1059  Source code for this patch is http://dow Line 992  Source code for this patch is http://dow
992    
993   static struct raw_hashinfo raw_v6_hashinfo = {   static struct raw_hashinfo raw_v6_hashinfo = {
994          .lock = __RW_LOCK_UNLOCKED(),          .lock = __RW_LOCK_UNLOCKED(),
995  @@ -482,6 +483,9 @@ static int rawv6_recvmsg(struct kiocb *i  @@ -479,9 +480,14 @@ static int rawv6_recvmsg(struct kiocb *i
996          skb = skb_recv_datagram(sk, flags, noblock, &err);          if (flags & MSG_ERRQUEUE)
997          if (!skb)                  return ipv6_recv_error(sk, msg, len);
998                  goto out;  
999  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  -       skb = skb_recv_datagram(sk, flags, noblock, &err);
1000  +       if (err)  -       if (!skb)
1001  +               goto out;  -               goto out;
1002    +       for (;;) {
1003    +               skb = skb_recv_datagram(sk, flags, noblock, &err);
1004    +               if (!skb)
1005    +                       goto out;
1006    +               if (!ccs_socket_post_recvmsg_permission(sk, skb))
1007    +                       break;
1008    +               skb_kill_datagram(sk, skb, flags);
1009    +       }
1010    
1011          copied = skb->len;          copied = skb->len;
1012          if (copied > len) {          if (copied > len) {
1013  --- linux-2.6.25.20-0.5.orig/net/ipv6/udp.c  --- linux-2.6.25.20-0.7.orig/net/ipv6/udp.c
1014  +++ linux-2.6.25.20-0.5/net/ipv6/udp.c  +++ linux-2.6.25.20-0.7/net/ipv6/udp.c
1015  @@ -50,6 +50,7 @@  @@ -50,6 +50,7 @@
1016   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
1017   #include <linux/seq_file.h>   #include <linux/seq_file.h>
# Line 1079  Source code for this patch is http://dow Line 1020  Source code for this patch is http://dow
1020    
1021   static inline int udp_v6_get_port(struct sock *sk, unsigned short snum)   static inline int udp_v6_get_port(struct sock *sk, unsigned short snum)
1022   {   {
1023  @@ -137,6 +138,9 @@ try_again:  @@ -125,6 +126,7 @@ int udpv6_recvmsg(struct kiocb *iocb, st
1024            int peeked;
1025            int err;
1026            int is_udplite = IS_UDPLITE(sk);
1027    +       _Bool update_stat;
1028    
1029            if (addr_len)
1030                    *addr_len=sizeof(struct sockaddr_in6);
1031    @@ -137,6 +139,11 @@ try_again:
1032                                    &peeked, &err);                                    &peeked, &err);
1033          if (!skb)          if (!skb)
1034                  goto out;                  goto out;
1035  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
1036  +       if (err)  +               update_stat = 0;
1037  +               goto out;  +               goto csum_copy_err;
1038    +       }
1039    +       update_stat = 1;
1040    
1041          ulen = skb->len - sizeof(struct udphdr);          ulen = skb->len - sizeof(struct udphdr);
1042          copied = len;          copied = len;
1043  --- linux-2.6.25.20-0.5.orig/net/socket.c  @@ -214,7 +221,7 @@ out:
1044  +++ linux-2.6.25.20-0.5/net/socket.c  
1045     csum_copy_err:
1046            lock_sock(sk);
1047    -       if (!skb_kill_datagram(sk, skb, flags))
1048    +       if (!skb_kill_datagram(sk, skb, flags) && update_stat)
1049                    UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
1050            release_sock(sk);
1051    
1052    --- linux-2.6.25.20-0.7.orig/net/socket.c
1053    +++ linux-2.6.25.20-0.7/net/socket.c
1054  @@ -94,6 +94,8 @@  @@ -94,6 +94,8 @@
1055   #include <net/sock.h>   #include <net/sock.h>
1056   #include <linux/netfilter.h>   #include <linux/netfilter.h>
# Line 1100  Source code for this patch is http://dow Line 1060  Source code for this patch is http://dow
1060   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
1061   static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,   static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
1062                           unsigned long nr_segs, loff_t pos);                           unsigned long nr_segs, loff_t pos);
1063  @@ -555,6 +557,10 @@ static inline int __sock_sendmsg(struct  @@ -555,6 +557,8 @@ static inline int __sock_sendmsg(struct
1064          si->size = size;          si->size = size;
1065    
1066          err = security_socket_sendmsg(sock, msg, size);          err = security_socket_sendmsg(sock, msg, size);
1067  +       if (!err)  +       if (!err)
1068  +               err = ccs_socket_sendmsg_permission(sock, (struct sockaddr *)  +               err = ccs_socket_sendmsg_permission(sock, msg, size);
 +                                                   msg->msg_name,  
 +                                                   msg->msg_namelen);  
1069          if (err)          if (err)
1070                  return err;                  return err;
1071    
1072  @@ -1121,6 +1127,8 @@ static int __sock_create(struct net *net  @@ -1121,6 +1125,8 @@ static int __sock_create(struct net *net
1073          }          }
1074    
1075          err = security_socket_create(family, type, protocol, kern);          err = security_socket_create(family, type, protocol, kern);
# Line 1120  Source code for this patch is http://dow Line 1078  Source code for this patch is http://dow
1078          if (err)          if (err)
1079                  return err;                  return err;
1080    
1081  @@ -1352,6 +1360,11 @@ asmlinkage long sys_bind(int fd, struct  @@ -1352,6 +1358,11 @@ asmlinkage long sys_bind(int fd, struct
1082                                                     (struct sockaddr *)address,                                                     (struct sockaddr *)address,
1083                                                     addrlen);                                                     addrlen);
1084                          if (!err)                          if (!err)
# Line 1132  Source code for this patch is http://dow Line 1090  Source code for this patch is http://dow
1090                                  err = sock->ops->bind(sock,                                  err = sock->ops->bind(sock,
1091                                                        (struct sockaddr *)                                                        (struct sockaddr *)
1092                                                        address, addrlen);                                                        address, addrlen);
1093  @@ -1381,6 +1394,8 @@ asmlinkage long sys_listen(int fd, int b  @@ -1381,6 +1392,8 @@ asmlinkage long sys_listen(int fd, int b
1094    
1095                  err = security_socket_listen(sock, backlog);                  err = security_socket_listen(sock, backlog);
1096                  if (!err)                  if (!err)
# Line 1141  Source code for this patch is http://dow Line 1099  Source code for this patch is http://dow
1099                          err = sock->ops->listen(sock, backlog);                          err = sock->ops->listen(sock, backlog);
1100    
1101                  fput_light(sock->file, fput_needed);                  fput_light(sock->file, fput_needed);
1102  @@ -1444,6 +1459,11 @@ asmlinkage long sys_accept(int fd, struc  @@ -1412,6 +1425,7 @@ asmlinkage long sys_accept(int fd, struc
1103            if (!sock)
1104                    goto out;
1105    
1106    +retry:
1107            err = -ENFILE;
1108            if (!(newsock = sock_alloc()))
1109                    goto out_put;
1110    @@ -1444,6 +1458,11 @@ asmlinkage long sys_accept(int fd, struc
1111          if (err < 0)          if (err < 0)
1112                  goto out_fd;                  goto out_fd;
1113    
1114  +       if (ccs_socket_accept_permission(newsock,  +       if (ccs_socket_post_accept_permission(sock, newsock)) {
1115  +                                        (struct sockaddr *) address)) {  +               fput(newfile);
1116  +               err = -ECONNABORTED; /* Hope less harmful than -EPERM. */  +               put_unused_fd(newfd);
1117  +               goto out_fd;  +               goto retry;
1118  +       }  +       }
1119          if (upeer_sockaddr) {          if (upeer_sockaddr) {
1120                  if (newsock->ops->getname(newsock, (struct sockaddr *)address,                  if (newsock->ops->getname(newsock, (struct sockaddr *)address,
1121                                            &len, 2) < 0) {                                            &len, 2) < 0) {
1122  @@ -1506,6 +1526,9 @@ asmlinkage long sys_connect(int fd, stru  @@ -1506,6 +1525,9 @@ asmlinkage long sys_connect(int fd, stru
1123    
1124          err =          err =
1125              security_socket_connect(sock, (struct sockaddr *)address, addrlen);              security_socket_connect(sock, (struct sockaddr *)address, addrlen);
# Line 1163  Source code for this patch is http://dow Line 1129  Source code for this patch is http://dow
1129          if (err)          if (err)
1130                  goto out_put;                  goto out_put;
1131    
1132  --- linux-2.6.25.20-0.5.orig/net/unix/af_unix.c  --- linux-2.6.25.20-0.7.orig/net/unix/af_unix.c
1133  +++ linux-2.6.25.20-0.5/net/unix/af_unix.c  +++ linux-2.6.25.20-0.7/net/unix/af_unix.c
1134  @@ -116,6 +116,7 @@  @@ -116,6 +116,7 @@
1135   #include <linux/mount.h>   #include <linux/mount.h>
1136   #include <net/checksum.h>   #include <net/checksum.h>
# Line 1183  Source code for this patch is http://dow Line 1149  Source code for this patch is http://dow
1149                  err = vfs_mknod(nd.path.dentry->d_inode, dentry, nd.path.mnt,                  err = vfs_mknod(nd.path.dentry->d_inode, dentry, nd.path.mnt,
1150                                  mode, 0);                                  mode, 0);
1151                  if (err)                  if (err)
1152  --- linux-2.6.25.20-0.5.orig/security/Kconfig  @@ -1641,6 +1645,7 @@ static int unix_dgram_recvmsg(struct kio
1153  +++ linux-2.6.25.20-0.5/security/Kconfig  
1154            mutex_lock(&u->readlock);
1155    
1156    +retry:
1157            skb = skb_recv_datagram(sk, flags, noblock, &err);
1158            if (!skb) {
1159                    unix_state_lock(sk);
1160    @@ -1654,6 +1659,10 @@ static int unix_dgram_recvmsg(struct kio
1161    
1162            wake_up_interruptible_sync(&u->peer_wait);
1163    
1164    +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
1165    +               skb_kill_datagram(sk, skb, flags);
1166    +               goto retry;
1167    +       }
1168            if (msg->msg_name)
1169                    unix_copy_addr(msg, skb->sk);
1170    
1171    --- linux-2.6.25.20-0.7.orig/security/Kconfig
1172    +++ linux-2.6.25.20-0.7/security/Kconfig
1173  @@ -126,5 +126,7 @@ source security/selinux/Kconfig  @@ -126,5 +126,7 @@ source security/selinux/Kconfig
1174   source security/smack/Kconfig   source security/smack/Kconfig
1175   source security/apparmor/Kconfig   source security/apparmor/Kconfig
# Line 1193  Source code for this patch is http://dow Line 1178  Source code for this patch is http://dow
1178  +  +
1179   endmenu   endmenu
1180    
1181  --- linux-2.6.25.20-0.5.orig/security/Makefile  --- linux-2.6.25.20-0.7.orig/security/Makefile
1182  +++ linux-2.6.25.20-0.5/security/Makefile  +++ linux-2.6.25.20-0.7/security/Makefile
1183  @@ -19,3 +19,6 @@ obj-$(CONFIG_SECURITY_SMACK)          += commonc  @@ -19,3 +19,6 @@ obj-$(CONFIG_SECURITY_SMACK)          += commonc
1184   obj-$(CONFIG_SECURITY_APPARMOR)                += commoncap.o apparmor/   obj-$(CONFIG_SECURITY_APPARMOR)                += commoncap.o apparmor/
1185   obj-$(CONFIG_SECURITY_CAPABILITIES)    += commoncap.o capability.o   obj-$(CONFIG_SECURITY_CAPABILITIES)    += commoncap.o capability.o

Legend:
Removed from v.2950  
changed lines
  Added in v.4049

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