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

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 3053 by kumaneko, Thu Sep 17 07:09:58 2009 UTC branches/ccs-patch/patches/ccs-patch-2.6.25-suse-11.0.diff revision 3838 by kumaneko, Fri Jul 23 03:20:04 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               |    7 +++++++
11   fs/exec.c                       |   12 +++++++++++-   fs/exec.c                       |   12 +++++++++++-
12   fs/fcntl.c                      |    4 ++++   fs/fcntl.c                      |    4 ++++
13   fs/ioctl.c                      |    5 +++++   fs/ioctl.c                      |    5 +++++
14   fs/namei.c                      |   35 ++++++++++++++++++++++++++++++++++-   fs/namei.c                      |   35 ++++++++++++++++++++++++++++++++++-
15   fs/namespace.c                  |   22 ++++++++++++++++++++++   fs/namespace.c                  |   20 ++++++++++++++++++++
16   fs/open.c                       |   30 ++++++++++++++++++++++++++++++   fs/open.c                       |   28 ++++++++++++++++++++++++++++
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              |    4 ++++
39   security/Kconfig                |    2 ++   security/Kconfig                |    2 ++
40   security/Makefile               |    3 +++   security/Makefile               |    3 +++
41   37 files changed, 262 insertions(+), 3 deletions(-)   36 files changed, 270 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 194  Source code for this patch is http://dow Line 165  Source code for this patch is http://dow
165                  if (filp->f_op && filp->f_op->compat_ioctl) {                  if (filp->f_op && filp->f_op->compat_ioctl) {
166                          error = filp->f_op->compat_ioctl(filp, cmd, arg);                          error = filp->f_op->compat_ioctl(filp, cmd, arg);
167                          if (error != -ENOIOCTLCMD)                          if (error != -ENOIOCTLCMD)
168  --- linux-2.6.25.20-0.5.orig/fs/exec.c  --- linux-2.6.25.20-0.7.orig/fs/exec.c
169  +++ linux-2.6.25.20-0.5/fs/exec.c  +++ linux-2.6.25.20-0.7/fs/exec.c
170  @@ -60,6 +60,8 @@  @@ -60,6 +60,8 @@
171   #include <linux/kmod.h>   #include <linux/kmod.h>
172   #endif   #endif
# Line 227  Source code for this patch is http://dow Line 198  Source code for this patch is http://dow
198                          file = ERR_PTR(err);                          file = ERR_PTR(err);
199                          if (!err) {                          if (!err) {
200                                  file = nameidata_to_filp(&nd,                                  file = nameidata_to_filp(&nd,
201  @@ -1336,7 +1346,7 @@ int do_execve(char * filename,  @@ -1340,7 +1350,7 @@ int do_execve(char * filename,
202                  goto out;                  goto out;
203          bprm->argv_len = env_p - bprm->p;          bprm->argv_len = env_p - bprm->p;
204    
# Line 236  Source code for this patch is http://dow Line 207  Source code for this patch is http://dow
207          if (retval >= 0) {          if (retval >= 0) {
208                  /* execve success */                  /* execve success */
209                  free_arg_pages(bprm);                  free_arg_pages(bprm);
210  --- linux-2.6.25.20-0.5.orig/fs/fcntl.c  --- linux-2.6.25.20-0.7.orig/fs/fcntl.c
211  +++ linux-2.6.25.20-0.5/fs/fcntl.c  +++ linux-2.6.25.20-0.7/fs/fcntl.c
212  @@ -23,6 +23,7 @@  @@ -23,6 +23,7 @@
213   #include <asm/poll.h>   #include <asm/poll.h>
214   #include <asm/siginfo.h>   #include <asm/siginfo.h>
# Line 256  Source code for this patch is http://dow Line 227  Source code for this patch is http://dow
227          /* O_NOATIME can only be set by the owner or superuser */          /* O_NOATIME can only be set by the owner or superuser */
228          if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME))          if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME))
229                  if (!is_owner_or_cap(inode))                  if (!is_owner_or_cap(inode))
230  --- linux-2.6.25.20-0.5.orig/fs/ioctl.c  --- linux-2.6.25.20-0.7.orig/fs/ioctl.c
231  +++ linux-2.6.25.20-0.5/fs/ioctl.c  +++ linux-2.6.25.20-0.7/fs/ioctl.c
232  @@ -15,6 +15,7 @@  @@ -15,6 +15,7 @@
233   #include <linux/uaccess.h>   #include <linux/uaccess.h>
234    
# Line 284  Source code for this patch is http://dow Line 255  Source code for this patch is http://dow
255          if (error)          if (error)
256                  goto out_fput;                  goto out_fput;
257    
258  --- linux-2.6.25.20-0.5.orig/fs/namei.c  --- linux-2.6.25.20-0.7.orig/fs/namei.c
259  +++ linux-2.6.25.20-0.5/fs/namei.c  +++ linux-2.6.25.20-0.7/fs/namei.c
260  @@ -35,6 +35,8 @@  @@ -35,6 +35,8 @@
261    
262   #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])   #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
# Line 398  Source code for this patch is http://dow Line 369  Source code for this patch is http://dow
369          error = vfs_rename(old_dir->d_inode, old_dentry, oldnd.path.mnt,          error = vfs_rename(old_dir->d_inode, old_dentry, oldnd.path.mnt,
370                             new_dir->d_inode, new_dentry, newnd.path.mnt);                             new_dir->d_inode, new_dentry, newnd.path.mnt);
371   exit5:   exit5:
372  --- linux-2.6.25.20-0.5.orig/fs/namespace.c  --- linux-2.6.25.20-0.7.orig/fs/namespace.c
373  +++ linux-2.6.25.20-0.5/fs/namespace.c  +++ linux-2.6.25.20-0.7/fs/namespace.c
374  @@ -30,6 +30,7 @@  @@ -30,6 +30,7 @@
375   #include <asm/unistd.h>   #include <asm/unistd.h>
376   #include "pnode.h"   #include "pnode.h"
# Line 431  Source code for this patch is http://dow Line 402  Source code for this patch is http://dow
402          if (IS_MNT_UNBINDABLE(old_nd.path.mnt))          if (IS_MNT_UNBINDABLE(old_nd.path.mnt))
403                  goto out;                  goto out;
404  +       err = -EPERM;  +       err = -EPERM;
405  +       if (ccs_may_mount(nd))  +       if (ccs_may_mount(&nd->path))
406  +               goto out;  +               goto out;
407    
408          if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))          if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
# Line 441  Source code for this patch is http://dow Line 412  Source code for this patch is http://dow
412                  goto out;                  goto out;
413    
414  +       err = -EPERM;  +       err = -EPERM;
415  +       if (ccs_may_mount(nd))  +       if (ccs_may_mount(&nd->path))
416  +               goto out;  +               goto out;
417          err = -ENOENT;          err = -ENOENT;
418          mutex_lock(&nd->path.dentry->d_inode->i_mutex);          mutex_lock(&nd->path.dentry->d_inode->i_mutex);
# Line 451  Source code for this patch is http://dow Line 422  Source code for this patch is http://dow
422          if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))          if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))
423                  goto unlock;                  goto unlock;
424  +       err = -EPERM;  +       err = -EPERM;
425  +       if (ccs_may_mount(nd))  +       if (ccs_may_mount(&nd->path))
426  +               goto unlock;  +               goto unlock;
427    
428          newmnt->mnt_flags = mnt_flags;          newmnt->mnt_flags = mnt_flags;
# Line 469  Source code for this patch is http://dow Line 440  Source code for this patch is http://dow
440    
441          retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page);          retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page);
442  +       if (!retval)  +       if (!retval)
443  +               retval = ccs_mount_permission(dev_name, &nd, type_page,  +               retval = ccs_mount_permission(dev_name, &nd.path, type_page,
444  +                                             original_flags, data_page);  +                                             original_flags, data_page);
445          if (retval)          if (retval)
446                  goto dput_out;                  goto dput_out;
447    
448  @@ -1680,6 +1698,8 @@ asmlinkage long sys_pivot_root(const cha  @@ -1696,6 +1714,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 +1716,8 @@ asmlinkage long sys_pivot_root(const cha  
449                  goto out1;                  goto out1;
450    
451          error = security_sb_pivotroot(&old_nd, &new_nd);          error = security_sb_pivotroot(&old_nd, &new_nd);
452  +       if (!error)  +       if (!error)
453  +               error = ccs_pivot_root_permission(&old_nd, &new_nd);  +               error = ccs_pivot_root_permission(&old_nd.path, &new_nd.path);
454          if (error) {          if (error) {
455                  path_put(&old_nd.path);                  path_put(&old_nd.path);
456                  goto out1;                  goto out1;
457  --- linux-2.6.25.20-0.5.orig/fs/open.c  --- linux-2.6.25.20-0.7.orig/fs/open.c
458  +++ linux-2.6.25.20-0.5/fs/open.c  +++ linux-2.6.25.20-0.7/fs/open.c
459  @@ -27,6 +27,7 @@  @@ -27,6 +27,7 @@
460   #include <linux/rcupdate.h>   #include <linux/rcupdate.h>
461   #include <linux/audit.h>   #include <linux/audit.h>
# Line 523  Source code for this patch is http://dow Line 485  Source code for this patch is http://dow
485          error = locks_verify_truncate(inode, file, length);          error = locks_verify_truncate(inode, file, length);
486          if (!error)          if (!error)
487                  error = do_truncate(dentry, file->f_path.mnt, length,                  error = do_truncate(dentry, file->f_path.mnt, length,
488  @@ -539,6 +547,10 @@ asmlinkage long sys_chroot(const char __  @@ -539,6 +547,8 @@ asmlinkage long sys_chroot(const char __
489          error = -EPERM;          error = -EPERM;
490          if (!capable(CAP_SYS_CHROOT))          if (!capable(CAP_SYS_CHROOT))
491                  goto dput_and_out;                  goto dput_and_out;
492  +       if (!ccs_capable(CCS_SYS_CHROOT))  +       if (ccs_chroot_permission(&nd.path))
 +               goto dput_and_out;  
 +       if (ccs_chroot_permission(&nd))  
493  +               goto dput_and_out;  +               goto dput_and_out;
494    
495          set_fs_root(current->fs, &nd.path);          set_fs_root(current->fs, &nd.path);
496          set_fs_altroot();          set_fs_altroot();
497  @@ -572,6 +584,9 @@ asmlinkage long sys_fchmod(unsigned int  @@ -572,6 +582,9 @@ asmlinkage long sys_fchmod(unsigned int
498          err = -EPERM;          err = -EPERM;
499          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
500                  goto out_putf;                  goto out_putf;
# Line 544  Source code for this patch is http://dow Line 504  Source code for this patch is http://dow
504          mutex_lock(&inode->i_mutex);          mutex_lock(&inode->i_mutex);
505          if (mode == (mode_t) -1)          if (mode == (mode_t) -1)
506                  mode = inode->i_mode;                  mode = inode->i_mode;
507  @@ -606,6 +621,9 @@ asmlinkage long sys_fchmodat(int dfd, co  @@ -606,6 +619,9 @@ asmlinkage long sys_fchmodat(int dfd, co
508          error = -EPERM;          error = -EPERM;
509          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
510                  goto dput_and_out;                  goto dput_and_out;
# Line 554  Source code for this patch is http://dow Line 514  Source code for this patch is http://dow
514    
515          mutex_lock(&inode->i_mutex);          mutex_lock(&inode->i_mutex);
516          if (mode == (mode_t) -1)          if (mode == (mode_t) -1)
517  @@ -674,6 +692,8 @@ asmlinkage long sys_chown(const char __u  @@ -674,6 +690,8 @@ asmlinkage long sys_chown(const char __u
518          error = user_path_walk(filename, &nd);          error = user_path_walk(filename, &nd);
519          if (error)          if (error)
520                  goto out;                  goto out;
# Line 563  Source code for this patch is http://dow Line 523  Source code for this patch is http://dow
523          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);
524          path_put(&nd.path);          path_put(&nd.path);
525   out:   out:
526  @@ -694,6 +714,8 @@ asmlinkage long sys_fchownat(int dfd, co  @@ -694,6 +712,8 @@ asmlinkage long sys_fchownat(int dfd, co
527          error = __user_walk_fd(dfd, filename, follow, &nd);          error = __user_walk_fd(dfd, filename, follow, &nd);
528          if (error)          if (error)
529                  goto out;                  goto out;
# Line 572  Source code for this patch is http://dow Line 532  Source code for this patch is http://dow
532          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);
533          path_put(&nd.path);          path_put(&nd.path);
534   out:   out:
535  @@ -708,6 +730,8 @@ asmlinkage long sys_lchown(const char __  @@ -708,6 +728,8 @@ asmlinkage long sys_lchown(const char __
536          error = user_path_walk_link(filename, &nd);          error = user_path_walk_link(filename, &nd);
537          if (error)          if (error)
538                  goto out;                  goto out;
# Line 581  Source code for this patch is http://dow Line 541  Source code for this patch is http://dow
541          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);          error = chown_common(nd.path.dentry, nd.path.mnt, user, group, NULL);
542          path_put(&nd.path);          path_put(&nd.path);
543   out:   out:
544  @@ -727,6 +751,8 @@ asmlinkage long sys_fchown(unsigned int  @@ -727,6 +749,8 @@ asmlinkage long sys_fchown(unsigned int
545    
546          dentry = file->f_path.dentry;          dentry = file->f_path.dentry;
547          audit_inode(NULL, dentry);          audit_inode(NULL, dentry);
# Line 590  Source code for this patch is http://dow Line 550  Source code for this patch is http://dow
550          error = chown_common(dentry, file->f_path.mnt, user, group, file);          error = chown_common(dentry, file->f_path.mnt, user, group, file);
551          fput(file);          fput(file);
552   out:   out:
553  @@ -823,7 +849,9 @@ static struct file *do_filp_open(int dfd  @@ -823,7 +847,9 @@ static struct file *do_filp_open(int dfd
554          if ((namei_flags+1) & O_ACCMODE)          if ((namei_flags+1) & O_ACCMODE)
555                  namei_flags++;                  namei_flags++;
556    
# Line 600  Source code for this patch is http://dow Line 560  Source code for this patch is http://dow
560          if (!error)          if (!error)
561                  return nameidata_to_filp(&nd, flags);                  return nameidata_to_filp(&nd, flags);
562    
563  @@ -1172,6 +1200,8 @@ EXPORT_SYMBOL(sys_close);  @@ -1172,6 +1198,8 @@ EXPORT_SYMBOL(sys_close);
564    */    */
565   asmlinkage long sys_vhangup(void)   asmlinkage long sys_vhangup(void)
566   {   {
# Line 609  Source code for this patch is http://dow Line 569  Source code for this patch is http://dow
569          if (capable(CAP_SYS_TTY_CONFIG)) {          if (capable(CAP_SYS_TTY_CONFIG)) {
570                  /* XXX: this needs locking */                  /* XXX: this needs locking */
571                  tty_vhangup(current->signal->tty);                  tty_vhangup(current->signal->tty);
572  --- 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
573  +++ linux-2.6.25.20-0.5/fs/proc/proc_misc.c  +++ linux-2.6.25.20-0.7/fs/proc/proc_misc.c
574  @@ -1021,4 +1021,5 @@ void __init proc_misc_init(void)  @@ -1021,4 +1021,5 @@ void __init proc_misc_init(void)
575                          entry->proc_fops = &proc_sysrq_trigger_operations;                          entry->proc_fops = &proc_sysrq_trigger_operations;
576          }          }
577   #endif   #endif
578  +       printk(KERN_INFO "Hook version: 2.6.25.20-0.5 2009/09/17\n);  +       printk(KERN_INFO "Hook version: 2.6.25.20-0.7 2010/07/21\n");
579   }   }
580  --- 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
581  +++ linux-2.6.25.20-0.5/include/linux/init_task.h  +++ linux-2.6.25.20-0.7/include/linux/init_task.h
582  @@ -133,6 +133,14 @@ extern struct group_info init_groups;  @@ -133,6 +133,14 @@ extern struct group_info init_groups;
583   # define CAP_INIT_BSET  CAP_INIT_EFF_SET   # define CAP_INIT_BSET  CAP_INIT_EFF_SET
584   #endif   #endif
# Line 642  Source code for this patch is http://dow Line 602  Source code for this patch is http://dow
602   }   }
603    
604    
605  --- linux-2.6.25.20-0.5.orig/include/linux/sched.h  --- linux-2.6.25.20-0.7.orig/include/linux/sched.h
606  +++ linux-2.6.25.20-0.5/include/linux/sched.h  +++ linux-2.6.25.20-0.7/include/linux/sched.h
607  @@ -29,6 +29,8 @@  @@ -41,6 +41,8 @@
608   #define CLONE_NEWNET           0x40000000      /* New network namespace */  
609   #define CLONE_IO               0x80000000      /* Clone io context */   #ifdef __KERNEL__
610    
611  +struct ccs_domain_info;  +struct ccs_domain_info;
612  +  +
613   /*   struct sched_param {
614    * Scheduling policies          int sched_priority;
615    */   };
616  @@ -1274,6 +1276,10 @@ struct task_struct {  @@ -1274,6 +1276,10 @@ struct task_struct {
617   #ifndef __GENKSYMS__   #ifndef __GENKSYMS__
618          struct list_head        *scm_work_list;          struct list_head        *scm_work_list;
# Line 664  Source code for this patch is http://dow Line 624  Source code for this patch is http://dow
624   };   };
625    
626   /*   /*
627  --- linux-2.6.25.20-0.5.orig/kernel/compat.c  --- linux-2.6.25.20-0.7.orig/kernel/compat.c
628  +++ linux-2.6.25.20-0.5/kernel/compat.c  +++ linux-2.6.25.20-0.7/kernel/compat.c
629  @@ -25,6 +25,7 @@  @@ -25,6 +25,7 @@
630   #include <linux/posix-timers.h>   #include <linux/posix-timers.h>
631    
# Line 683  Source code for this patch is http://dow Line 643  Source code for this patch is http://dow
643    
644          do_settimeofday(&tv);          do_settimeofday(&tv);
645          return 0;          return 0;
646  --- linux-2.6.25.20-0.5.orig/kernel/kexec.c  --- linux-2.6.25.20-0.7.orig/kernel/kexec.c
647  +++ linux-2.6.25.20-0.5/kernel/kexec.c  +++ linux-2.6.25.20-0.7/kernel/kexec.c
648  @@ -31,6 +31,7 @@  @@ -31,6 +31,7 @@
649   #include <asm/system.h>   #include <asm/system.h>
650   #include <asm/semaphore.h>   #include <asm/semaphore.h>
# Line 702  Source code for this patch is http://dow Line 662  Source code for this patch is http://dow
662    
663          /*          /*
664           * Verify we have a legal set of flags           * Verify we have a legal set of flags
665  --- linux-2.6.25.20-0.5.orig/kernel/kmod.c  --- linux-2.6.25.20-0.7.orig/kernel/kmod.c
666  +++ linux-2.6.25.20-0.5/kernel/kmod.c  +++ linux-2.6.25.20-0.7/kernel/kmod.c
667  @@ -173,6 +173,11 @@ static int ____call_usermodehelper(void  @@ -173,6 +173,11 @@ static int ____call_usermodehelper(void
668           */           */
669          set_user_nice(current, 0);          set_user_nice(current, 0);
# Line 716  Source code for this patch is http://dow Line 676  Source code for this patch is http://dow
676          retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp);          retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp);
677    
678          /* Exec failed? */          /* Exec failed? */
679  --- linux-2.6.25.20-0.5.orig/kernel/module.c  --- linux-2.6.25.20-0.7.orig/kernel/module.c
680  +++ linux-2.6.25.20-0.5/kernel/module.c  +++ linux-2.6.25.20-0.7/kernel/module.c
681  @@ -47,6 +47,7 @@  @@ -47,6 +47,7 @@
682   #include <asm/cacheflush.h>   #include <asm/cacheflush.h>
683   #include <linux/license.h>   #include <linux/license.h>
# Line 744  Source code for this patch is http://dow Line 704  Source code for this patch is http://dow
704    
705          /* Only one module load at a time, please */          /* Only one module load at a time, please */
706          if (mutex_lock_interruptible(&module_mutex) != 0)          if (mutex_lock_interruptible(&module_mutex) != 0)
707  --- linux-2.6.25.20-0.5.orig/kernel/ptrace.c  --- linux-2.6.25.20-0.7.orig/kernel/ptrace.c
708  +++ linux-2.6.25.20-0.5/kernel/ptrace.c  +++ linux-2.6.25.20-0.7/kernel/ptrace.c
709  @@ -24,6 +24,7 @@  @@ -24,6 +24,7 @@
710    
711   #include <asm/pgtable.h>   #include <asm/pgtable.h>
# Line 758  Source code for this patch is http://dow Line 718  Source code for this patch is http://dow
718          /*          /*
719           * This lock_kernel fixes a subtle race with suid exec           * This lock_kernel fixes a subtle race with suid exec
720           */           */
721  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
722  +               return -EPERM;  +               return -EPERM;
723          lock_kernel();          lock_kernel();
724          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
# Line 767  Source code for this patch is http://dow Line 727  Source code for this patch is http://dow
727          /*          /*
728           * This lock_kernel fixes a subtle race with suid exec           * This lock_kernel fixes a subtle race with suid exec
729           */           */
730  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
731  +               return -EPERM;  +               return -EPERM;
732          lock_kernel();          lock_kernel();
733          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
734                  ret = ptrace_traceme();                  ret = ptrace_traceme();
735  --- linux-2.6.25.20-0.5.orig/kernel/sched.c  --- linux-2.6.25.20-0.7.orig/kernel/sched.c
736  +++ linux-2.6.25.20-0.5/kernel/sched.c  +++ linux-2.6.25.20-0.7/kernel/sched.c
737  @@ -69,6 +69,7 @@  @@ -69,6 +69,7 @@
738    
739   #include <asm/tlb.h>   #include <asm/tlb.h>
# Line 791  Source code for this patch is http://dow Line 751  Source code for this patch is http://dow
751    
752          /*          /*
753           * Setpriority might change our priority at the same moment.           * Setpriority might change our priority at the same moment.
754  --- linux-2.6.25.20-0.5.orig/kernel/signal.c  --- linux-2.6.25.20-0.7.orig/kernel/signal.c
755  +++ linux-2.6.25.20-0.5/kernel/signal.c  +++ linux-2.6.25.20-0.7/kernel/signal.c
756  @@ -32,6 +32,7 @@  @@ -32,6 +32,7 @@
757   #include <asm/unistd.h>   #include <asm/unistd.h>
758   #include <asm/siginfo.h>   #include <asm/siginfo.h>
# Line 801  Source code for this patch is http://dow Line 761  Source code for this patch is http://dow
761    
762   /*   /*
763    * SLAB caches for signal bits.    * SLAB caches for signal bits.
764  @@ -2232,6 +2233,8 @@ asmlinkage long  @@ -2233,6 +2234,8 @@ asmlinkage long
765   sys_kill(int pid, int sig)   sys_kill(int pid, int sig)
766   {   {
767          struct siginfo info;          struct siginfo info;
# Line 810  Source code for this patch is http://dow Line 770  Source code for this patch is http://dow
770    
771          info.si_signo = sig;          info.si_signo = sig;
772          info.si_errno = 0;          info.si_errno = 0;
773  @@ -2290,6 +2293,8 @@ asmlinkage long sys_tgkill(int tgid, int  @@ -2291,6 +2294,8 @@ asmlinkage long sys_tgkill(int tgid, int
774          /* This is only valid for single tasks */          /* This is only valid for single tasks */
775          if (pid <= 0 || tgid <= 0)          if (pid <= 0 || tgid <= 0)
776                  return -EINVAL;                  return -EINVAL;
# Line 819  Source code for this patch is http://dow Line 779  Source code for this patch is http://dow
779    
780          return do_tkill(tgid, pid, sig);          return do_tkill(tgid, pid, sig);
781   }   }
782  @@ -2303,6 +2308,8 @@ sys_tkill(int pid, int sig)  @@ -2304,6 +2309,8 @@ sys_tkill(int pid, int sig)
783          /* This is only valid for single tasks */          /* This is only valid for single tasks */
784          if (pid <= 0)          if (pid <= 0)
785                  return -EINVAL;                  return -EINVAL;
# Line 828  Source code for this patch is http://dow Line 788  Source code for this patch is http://dow
788    
789          return do_tkill(0, pid, sig);          return do_tkill(0, pid, sig);
790   }   }
791  @@ -2320,6 +2327,8 @@ sys_rt_sigqueueinfo(int pid, int sig, si  @@ -2321,6 +2328,8 @@ sys_rt_sigqueueinfo(int pid, int sig, si
792          if (info.si_code >= 0)          if (info.si_code >= 0)
793                  return -EPERM;                  return -EPERM;
794          info.si_signo = sig;          info.si_signo = sig;
# Line 837  Source code for this patch is http://dow Line 797  Source code for this patch is http://dow
797    
798          /* POSIX.1b doesn't mention process groups.  */          /* POSIX.1b doesn't mention process groups.  */
799          return kill_proc_info(sig, &info, pid);          return kill_proc_info(sig, &info, pid);
800  --- linux-2.6.25.20-0.5.orig/kernel/sys.c  --- linux-2.6.25.20-0.7.orig/kernel/sys.c
801  +++ linux-2.6.25.20-0.5/kernel/sys.c  +++ linux-2.6.25.20-0.7/kernel/sys.c
802  @@ -42,6 +42,7 @@  @@ -42,6 +42,7 @@
803   #include <asm/uaccess.h>   #include <asm/uaccess.h>
804   #include <asm/io.h>   #include <asm/io.h>
# Line 885  Source code for this patch is http://dow Line 845  Source code for this patch is http://dow
845    
846          down_write(&uts_sem);          down_write(&uts_sem);
847          errno = -EFAULT;          errno = -EFAULT;
848  --- linux-2.6.25.20-0.5.orig/kernel/sysctl.c  --- linux-2.6.25.20-0.7.orig/kernel/sysctl.c
849  +++ linux-2.6.25.20-0.5/kernel/sysctl.c  +++ linux-2.6.25.20-0.7/kernel/sysctl.c
850  @@ -48,6 +48,7 @@  @@ -48,6 +48,7 @@
851    
852   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 913  Source code for this patch is http://dow Line 873  Source code for this patch is http://dow
873                  error = parse_table(name, nlen, oldval, oldlenp,                  error = parse_table(name, nlen, oldval, oldlenp,
874                                          newval, newlen, head->ctl_table);                                          newval, newlen, head->ctl_table);
875                  if (error != -ENOTDIR) {                  if (error != -ENOTDIR) {
876  --- linux-2.6.25.20-0.5.orig/kernel/time.c  --- linux-2.6.25.20-0.7.orig/kernel/time.c
877  +++ linux-2.6.25.20-0.5/kernel/time.c  +++ linux-2.6.25.20-0.7/kernel/time.c
878  @@ -38,6 +38,7 @@  @@ -38,6 +38,7 @@
879    
880   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 941  Source code for this patch is http://dow Line 901  Source code for this patch is http://dow
901    
902          if (tz) {          if (tz) {
903                  /* SMP safe, global irq locking makes it work. */                  /* SMP safe, global irq locking makes it work. */
904  --- linux-2.6.25.20-0.5.orig/kernel/time/ntp.c  --- linux-2.6.25.20-0.7.orig/kernel/time/ntp.c
905  +++ linux-2.6.25.20-0.5/kernel/time/ntp.c  +++ linux-2.6.25.20-0.7/kernel/time/ntp.c
906  @@ -17,6 +17,7 @@  @@ -17,6 +17,7 @@
907   #include <linux/capability.h>   #include <linux/capability.h>
908   #include <asm/div64.h>   #include <asm/div64.h>
# Line 960  Source code for this patch is http://dow Line 920  Source code for this patch is http://dow
920    
921          /* Now we validate the data before disabling interrupts */          /* Now we validate the data before disabling interrupts */
922    
923  --- 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
924  +++ 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
925  @@ -23,6 +23,7 @@  @@ -23,6 +23,7 @@
926   #include <net/route.h>   #include <net/route.h>
927   #include <net/tcp_states.h>   #include <net/tcp_states.h>
# Line 979  Source code for this patch is http://dow Line 939  Source code for this patch is http://dow
939                          inet_bind_bucket_for_each(tb, node, &head->chain)                          inet_bind_bucket_for_each(tb, node, &head->chain)
940                                  if (tb->ib_net == net && tb->port == rover)                                  if (tb->ib_net == net && tb->port == rover)
941                                          goto next;                                          goto next;
942  --- 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
943  +++ linux-2.6.25.20-0.5/net/ipv4/inet_hashtables.c  +++ linux-2.6.25.20-0.7/net/ipv4/inet_hashtables.c
944  @@ -22,6 +22,7 @@  @@ -22,6 +22,7 @@
945   #include <net/inet_connection_sock.h>   #include <net/inet_connection_sock.h>
946   #include <net/inet_hashtables.h>   #include <net/inet_hashtables.h>
# Line 998  Source code for this patch is http://dow Line 958  Source code for this patch is http://dow
958                          head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];                          head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];
959                          spin_lock(&head->lock);                          spin_lock(&head->lock);
960    
961  --- linux-2.6.25.20-0.5.orig/net/ipv4/raw.c  --- linux-2.6.25.20-0.7.orig/net/ipv4/raw.c
962  +++ linux-2.6.25.20-0.5/net/ipv4/raw.c  +++ linux-2.6.25.20-0.7/net/ipv4/raw.c
963  @@ -79,6 +79,7 @@  @@ -79,6 +79,7 @@
964   #include <linux/seq_file.h>   #include <linux/seq_file.h>
965   #include <linux/netfilter.h>   #include <linux/netfilter.h>
# Line 1008  Source code for this patch is http://dow Line 968  Source code for this patch is http://dow
968    
969   static struct raw_hashinfo raw_v4_hashinfo = {   static struct raw_hashinfo raw_v4_hashinfo = {
970          .lock = __RW_LOCK_UNLOCKED(),          .lock = __RW_LOCK_UNLOCKED(),
971  @@ -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)  
972                  goto out;                  goto out;
973  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);          }
974  +       if (err)  
975  +               goto out;  -       skb = skb_recv_datagram(sk, flags, noblock, &err);
976    -       if (!skb)
977    -               goto out;
978    +       for (;;) {
979    +               skb = skb_recv_datagram(sk, flags, noblock, &err);
980    +               if (!skb)
981    +                       goto out;
982    +               if (!ccs_socket_post_recvmsg_permission(sk, skb))
983    +                       break;
984    +               skb_kill_datagram(sk, skb, flags);
985    +       }
986    
987          copied = skb->len;          copied = skb->len;
988          if (len < copied) {          if (len < copied) {
989  --- linux-2.6.25.20-0.5.orig/net/ipv4/udp.c  --- linux-2.6.25.20-0.7.orig/net/ipv4/udp.c
990  +++ linux-2.6.25.20-0.5/net/ipv4/udp.c  +++ linux-2.6.25.20-0.7/net/ipv4/udp.c
991  @@ -105,6 +105,7 @@  @@ -105,6 +105,7 @@
992   #include <net/checksum.h>   #include <net/checksum.h>
993   #include <net/xfrm.h>   #include <net/xfrm.h>
# Line 1045  Source code for this patch is http://dow Line 1013  Source code for this patch is http://dow
1013                          if (! __udp_lib_lport_inuse(net, rover, udptable))                          if (! __udp_lib_lport_inuse(net, rover, udptable))
1014                                  goto gotit;                                  goto gotit;
1015                          rover += UDP_HTABLE_SIZE;                          rover += UDP_HTABLE_SIZE;
1016  @@ -863,6 +867,9 @@ try_again:  @@ -848,6 +852,7 @@ int udp_recvmsg(struct kiocb *iocb, stru
1017            int peeked;
1018            int err;
1019            int is_udplite = IS_UDPLITE(sk);
1020    +       _Bool update_stat;
1021    
1022            /*
1023             *      Check any passed addresses
1024    @@ -863,6 +868,11 @@ try_again:
1025                                    &peeked, &err);                                    &peeked, &err);
1026          if (!skb)          if (!skb)
1027                  goto out;                  goto out;
1028  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
1029  +       if (err)  +               update_stat = 0;
1030  +               goto out;  +               goto csum_copy_err;
1031    +       }
1032    +       update_stat = 1;
1033    
1034          ulen = skb->len - sizeof(struct udphdr);          ulen = skb->len - sizeof(struct udphdr);
1035          copied = len;          copied = len;
1036  --- linux-2.6.25.20-0.5.orig/net/ipv6/raw.c  @@ -924,7 +934,7 @@ out:
1037  +++ linux-2.6.25.20-0.5/net/ipv6/raw.c  
1038     csum_copy_err:
1039            lock_sock(sk);
1040    -       if (!skb_kill_datagram(sk, skb, flags))
1041    +       if (!skb_kill_datagram(sk, skb, flags) && update_stat)
1042                    UDP_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
1043            release_sock(sk);
1044    
1045    --- linux-2.6.25.20-0.7.orig/net/ipv6/raw.c
1046    +++ linux-2.6.25.20-0.7/net/ipv6/raw.c
1047  @@ -60,6 +60,7 @@  @@ -60,6 +60,7 @@
1048    
1049   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
# Line 1065  Source code for this patch is http://dow Line 1052  Source code for this patch is http://dow
1052    
1053   static struct raw_hashinfo raw_v6_hashinfo = {   static struct raw_hashinfo raw_v6_hashinfo = {
1054          .lock = __RW_LOCK_UNLOCKED(),          .lock = __RW_LOCK_UNLOCKED(),
1055  @@ -482,6 +483,9 @@ static int rawv6_recvmsg(struct kiocb *i  @@ -479,9 +480,14 @@ static int rawv6_recvmsg(struct kiocb *i
1056          skb = skb_recv_datagram(sk, flags, noblock, &err);          if (flags & MSG_ERRQUEUE)
1057          if (!skb)                  return ipv6_recv_error(sk, msg, len);
1058                  goto out;  
1059  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  -       skb = skb_recv_datagram(sk, flags, noblock, &err);
1060  +       if (err)  -       if (!skb)
1061  +               goto out;  -               goto out;
1062    +       for (;;) {
1063    +               skb = skb_recv_datagram(sk, flags, noblock, &err);
1064    +               if (!skb)
1065    +                       goto out;
1066    +               if (!ccs_socket_post_recvmsg_permission(sk, skb))
1067    +                       break;
1068    +               skb_kill_datagram(sk, skb, flags);
1069    +       }
1070    
1071          copied = skb->len;          copied = skb->len;
1072          if (copied > len) {          if (copied > len) {
1073  --- linux-2.6.25.20-0.5.orig/net/ipv6/udp.c  --- linux-2.6.25.20-0.7.orig/net/ipv6/udp.c
1074  +++ linux-2.6.25.20-0.5/net/ipv6/udp.c  +++ linux-2.6.25.20-0.7/net/ipv6/udp.c
1075  @@ -50,6 +50,7 @@  @@ -50,6 +50,7 @@
1076   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
1077   #include <linux/seq_file.h>   #include <linux/seq_file.h>
# Line 1085  Source code for this patch is http://dow Line 1080  Source code for this patch is http://dow
1080    
1081   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)
1082   {   {
1083  @@ -137,6 +138,9 @@ try_again:  @@ -125,6 +126,7 @@ int udpv6_recvmsg(struct kiocb *iocb, st
1084            int peeked;
1085            int err;
1086            int is_udplite = IS_UDPLITE(sk);
1087    +       _Bool update_stat;
1088    
1089            if (addr_len)
1090                    *addr_len=sizeof(struct sockaddr_in6);
1091    @@ -137,6 +139,11 @@ try_again:
1092                                    &peeked, &err);                                    &peeked, &err);
1093          if (!skb)          if (!skb)
1094                  goto out;                  goto out;
1095  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
1096  +       if (err)  +               update_stat = 0;
1097  +               goto out;  +               goto csum_copy_err;
1098    +       }
1099    +       update_stat = 1;
1100    
1101          ulen = skb->len - sizeof(struct udphdr);          ulen = skb->len - sizeof(struct udphdr);
1102          copied = len;          copied = len;
1103  --- linux-2.6.25.20-0.5.orig/net/socket.c  @@ -214,7 +221,7 @@ out:
1104  +++ linux-2.6.25.20-0.5/net/socket.c  
1105     csum_copy_err:
1106            lock_sock(sk);
1107    -       if (!skb_kill_datagram(sk, skb, flags))
1108    +       if (!skb_kill_datagram(sk, skb, flags) && update_stat)
1109                    UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
1110            release_sock(sk);
1111    
1112    --- linux-2.6.25.20-0.7.orig/net/socket.c
1113    +++ linux-2.6.25.20-0.7/net/socket.c
1114  @@ -94,6 +94,8 @@  @@ -94,6 +94,8 @@
1115   #include <net/sock.h>   #include <net/sock.h>
1116   #include <linux/netfilter.h>   #include <linux/netfilter.h>
# Line 1106  Source code for this patch is http://dow Line 1120  Source code for this patch is http://dow
1120   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
1121   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,
1122                           unsigned long nr_segs, loff_t pos);                           unsigned long nr_segs, loff_t pos);
1123  @@ -555,6 +557,10 @@ static inline int __sock_sendmsg(struct  @@ -555,6 +557,8 @@ static inline int __sock_sendmsg(struct
1124          si->size = size;          si->size = size;
1125    
1126          err = security_socket_sendmsg(sock, msg, size);          err = security_socket_sendmsg(sock, msg, size);
1127  +       if (!err)  +       if (!err)
1128  +               err = ccs_socket_sendmsg_permission(sock, (struct sockaddr *)  +               err = ccs_socket_sendmsg_permission(sock, msg, size);
 +                                                   msg->msg_name,  
 +                                                   msg->msg_namelen);  
1129          if (err)          if (err)
1130                  return err;                  return err;
1131    
1132  @@ -1121,6 +1127,8 @@ static int __sock_create(struct net *net  @@ -1121,6 +1125,8 @@ static int __sock_create(struct net *net
1133          }          }
1134    
1135          err = security_socket_create(family, type, protocol, kern);          err = security_socket_create(family, type, protocol, kern);
# Line 1126  Source code for this patch is http://dow Line 1138  Source code for this patch is http://dow
1138          if (err)          if (err)
1139                  return err;                  return err;
1140    
1141  @@ -1352,6 +1360,11 @@ asmlinkage long sys_bind(int fd, struct  @@ -1352,6 +1358,11 @@ asmlinkage long sys_bind(int fd, struct
1142                                                     (struct sockaddr *)address,                                                     (struct sockaddr *)address,
1143                                                     addrlen);                                                     addrlen);
1144                          if (!err)                          if (!err)
# Line 1138  Source code for this patch is http://dow Line 1150  Source code for this patch is http://dow
1150                                  err = sock->ops->bind(sock,                                  err = sock->ops->bind(sock,
1151                                                        (struct sockaddr *)                                                        (struct sockaddr *)
1152                                                        address, addrlen);                                                        address, addrlen);
1153  @@ -1381,6 +1394,8 @@ asmlinkage long sys_listen(int fd, int b  @@ -1381,6 +1392,8 @@ asmlinkage long sys_listen(int fd, int b
1154    
1155                  err = security_socket_listen(sock, backlog);                  err = security_socket_listen(sock, backlog);
1156                  if (!err)                  if (!err)
# Line 1147  Source code for this patch is http://dow Line 1159  Source code for this patch is http://dow
1159                          err = sock->ops->listen(sock, backlog);                          err = sock->ops->listen(sock, backlog);
1160    
1161                  fput_light(sock->file, fput_needed);                  fput_light(sock->file, fput_needed);
1162  @@ -1444,6 +1459,11 @@ asmlinkage long sys_accept(int fd, struc  @@ -1412,6 +1425,7 @@ asmlinkage long sys_accept(int fd, struc
1163            if (!sock)
1164                    goto out;
1165    
1166    +retry:
1167            err = -ENFILE;
1168            if (!(newsock = sock_alloc()))
1169                    goto out_put;
1170    @@ -1444,6 +1458,11 @@ asmlinkage long sys_accept(int fd, struc
1171          if (err < 0)          if (err < 0)
1172                  goto out_fd;                  goto out_fd;
1173    
1174  +       if (ccs_socket_accept_permission(newsock,  +       if (ccs_socket_post_accept_permission(sock, newsock)) {
1175  +                                        (struct sockaddr *) address)) {  +               fput(newfile);
1176  +               err = -ECONNABORTED; /* Hope less harmful than -EPERM. */  +               put_unused_fd(newfd);
1177  +               goto out_fd;  +               goto retry;
1178  +       }  +       }
1179          if (upeer_sockaddr) {          if (upeer_sockaddr) {
1180                  if (newsock->ops->getname(newsock, (struct sockaddr *)address,                  if (newsock->ops->getname(newsock, (struct sockaddr *)address,
1181                                            &len, 2) < 0) {                                            &len, 2) < 0) {
1182  @@ -1506,6 +1526,9 @@ asmlinkage long sys_connect(int fd, stru  @@ -1506,6 +1525,9 @@ asmlinkage long sys_connect(int fd, stru
1183    
1184          err =          err =
1185              security_socket_connect(sock, (struct sockaddr *)address, addrlen);              security_socket_connect(sock, (struct sockaddr *)address, addrlen);
# Line 1169  Source code for this patch is http://dow Line 1189  Source code for this patch is http://dow
1189          if (err)          if (err)
1190                  goto out_put;                  goto out_put;
1191    
1192  --- 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
1193  +++ linux-2.6.25.20-0.5/net/unix/af_unix.c  +++ linux-2.6.25.20-0.7/net/unix/af_unix.c
1194  @@ -116,6 +116,7 @@  @@ -116,6 +116,7 @@
1195   #include <linux/mount.h>   #include <linux/mount.h>
1196   #include <net/checksum.h>   #include <net/checksum.h>
# Line 1189  Source code for this patch is http://dow Line 1209  Source code for this patch is http://dow
1209                  err = vfs_mknod(nd.path.dentry->d_inode, dentry, nd.path.mnt,                  err = vfs_mknod(nd.path.dentry->d_inode, dentry, nd.path.mnt,
1210                                  mode, 0);                                  mode, 0);
1211                  if (err)                  if (err)
1212  --- linux-2.6.25.20-0.5.orig/security/Kconfig  --- linux-2.6.25.20-0.7.orig/security/Kconfig
1213  +++ linux-2.6.25.20-0.5/security/Kconfig  +++ linux-2.6.25.20-0.7/security/Kconfig
1214  @@ -126,5 +126,7 @@ source security/selinux/Kconfig  @@ -126,5 +126,7 @@ source security/selinux/Kconfig
1215   source security/smack/Kconfig   source security/smack/Kconfig
1216   source security/apparmor/Kconfig   source security/apparmor/Kconfig
# Line 1199  Source code for this patch is http://dow Line 1219  Source code for this patch is http://dow
1219  +  +
1220   endmenu   endmenu
1221    
1222  --- linux-2.6.25.20-0.5.orig/security/Makefile  --- linux-2.6.25.20-0.7.orig/security/Makefile
1223  +++ linux-2.6.25.20-0.5/security/Makefile  +++ linux-2.6.25.20-0.7/security/Makefile
1224  @@ -19,3 +19,6 @@ obj-$(CONFIG_SECURITY_SMACK)          += commonc  @@ -19,3 +19,6 @@ obj-$(CONFIG_SECURITY_SMACK)          += commonc
1225   obj-$(CONFIG_SECURITY_APPARMOR)                += commoncap.o apparmor/   obj-$(CONFIG_SECURITY_APPARMOR)                += commoncap.o apparmor/
1226   obj-$(CONFIG_SECURITY_CAPABILITIES)    += commoncap.o capability.o   obj-$(CONFIG_SECURITY_CAPABILITIES)    += commoncap.o capability.o

Legend:
Removed from v.3053  
changed lines
  Added in v.3838

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