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

Subversion リポジトリの参照

Diff of /trunk/1.8.x/ccs-patch/patches/ccs-patch-2.6.15-ubuntu-6.06.diff

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

revision 2927 by kumaneko, Thu Aug 20 06:56:14 2009 UTC revision 3856 by kumaneko, Mon Jul 26 06:55:22 2010 UTC
# Line 12  Source code for this patch is "apt-get i Line 12  Source code for this patch is "apt-get i
12   arch/sparc/kernel/ptrace.c      |    5 +++++   arch/sparc/kernel/ptrace.c      |    5 +++++
13   arch/sparc64/kernel/ptrace.c    |    5 +++++   arch/sparc64/kernel/ptrace.c    |    5 +++++
14   arch/x86_64/ia32/ptrace32.c     |    3 +++   arch/x86_64/ia32/ptrace32.c     |    3 +++
  fs/attr.c                       |    5 +++++  
15   fs/compat.c                     |    9 ++++++++-   fs/compat.c                     |    9 ++++++++-
16   fs/exec.c                       |   12 +++++++++++-   fs/exec.c                       |   12 +++++++++++-
17   fs/fcntl.c                      |    4 ++++   fs/fcntl.c                      |    4 ++++
18   fs/ioctl.c                      |    5 +++++   fs/ioctl.c                      |    3 +++
19   fs/namei.c                      |   32 ++++++++++++++++++++++++++++++++   fs/namei.c                      |   31 +++++++++++++++++++++++++++++++
20   fs/namespace.c                  |   24 +++++++++++++++++++++++-   fs/namespace.c                  |    9 +++++++++
21   fs/open.c                       |   27 ++++++++++++++++++++++++++-   fs/open.c                       |   27 ++++++++++++++++++++++++++-
22   fs/proc/proc_misc.c             |    1 +   fs/proc/proc_misc.c             |    1 +
23   include/linux/init_task.h       |    9 +++++++++   include/linux/init_task.h       |    9 +++++++++
# Line 34  Source code for this patch is "apt-get i Line 33  Source code for this patch is "apt-get i
33   kernel/sysctl.c                 |   11 +++++++++++   kernel/sysctl.c                 |   11 +++++++++++
34   kernel/time.c                   |    7 +++++++   kernel/time.c                   |    7 +++++++
35   net/ipv4/inet_connection_sock.c |    3 +++   net/ipv4/inet_connection_sock.c |    3 +++
36   net/ipv4/raw.c                  |    4 ++++   net/ipv4/raw.c                  |   12 +++++++++---
37   net/ipv4/tcp_ipv4.c             |    3 +++   net/ipv4/tcp_ipv4.c             |    3 +++
38   net/ipv4/udp.c                  |   10 +++++++++-   net/ipv4/udp.c                  |   16 ++++++++++++++--
39   net/ipv6/raw.c                  |    4 ++++   net/ipv6/raw.c                  |   12 +++++++++---
40   net/ipv6/tcp_ipv6.c             |    5 +++++   net/ipv6/tcp_ipv6.c             |    5 +++++
41   net/ipv6/udp.c                  |    8 ++++++++   net/ipv6/udp.c                  |   14 +++++++++++++-
42   net/socket.c                    |   25 ++++++++++++++++++++++---   net/socket.c                    |   23 ++++++++++++++++++++---
43   net/unix/af_unix.c              |    4 ++++   net/unix/af_unix.c              |    4 ++++
44   security/Kconfig                |    2 ++   security/Kconfig                |    2 ++
45   security/Makefile               |    3 +++   security/Makefile               |    3 +++
46   42 files changed, 291 insertions(+), 10 deletions(-)   41 files changed, 287 insertions(+), 17 deletions(-)
47    
48  --- linux-2.6.15-54.79.orig/arch/alpha/kernel/ptrace.c  --- linux-2.6.15-55.84.orig/arch/alpha/kernel/ptrace.c
49  +++ linux-2.6.15-54.79/arch/alpha/kernel/ptrace.c  +++ linux-2.6.15-55.84/arch/alpha/kernel/ptrace.c
50  @@ -20,6 +20,7 @@  @@ -20,6 +20,7 @@
51   #include <asm/pgtable.h>   #include <asm/pgtable.h>
52   #include <asm/system.h>   #include <asm/system.h>
# Line 60  Source code for this patch is "apt-get i Line 59  Source code for this patch is "apt-get i
59          unsigned long tmp;          unsigned long tmp;
60          size_t copied;          size_t copied;
61          long ret;          long ret;
62  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
63  +               return -EPERM;  +               return -EPERM;
64    
65          lock_kernel();          lock_kernel();
66          DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n",          DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n",
67  --- linux-2.6.15-54.79.orig/arch/ia64/ia32/sys_ia32.c  --- linux-2.6.15-55.84.orig/arch/ia64/ia32/sys_ia32.c
68  +++ linux-2.6.15-54.79/arch/ia64/ia32/sys_ia32.c  +++ linux-2.6.15-55.84/arch/ia64/ia32/sys_ia32.c
69  @@ -57,6 +57,7 @@  @@ -57,6 +57,7 @@
70   #include <asm/types.h>   #include <asm/types.h>
71   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 79  Source code for this patch is "apt-get i Line 78  Source code for this patch is "apt-get i
78          struct task_struct *child;          struct task_struct *child;
79          unsigned int value, tmp;          unsigned int value, tmp;
80          long i, ret;          long i, ret;
81  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
82  +               return -EPERM;  +               return -EPERM;
83    
84          lock_kernel();          lock_kernel();
85          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
86  --- linux-2.6.15-54.79.orig/arch/ia64/kernel/ptrace.c  --- linux-2.6.15-55.84.orig/arch/ia64/kernel/ptrace.c
87  +++ linux-2.6.15-54.79/arch/ia64/kernel/ptrace.c  +++ linux-2.6.15-55.84/arch/ia64/kernel/ptrace.c
88  @@ -29,6 +29,7 @@  @@ -29,6 +29,7 @@
89   #ifdef CONFIG_PERFMON   #ifdef CONFIG_PERFMON
90   #include <asm/perfmon.h>   #include <asm/perfmon.h>
# Line 98  Source code for this patch is "apt-get i Line 97  Source code for this patch is "apt-get i
97          struct task_struct *child;          struct task_struct *child;
98          struct switch_stack *sw;          struct switch_stack *sw;
99          long ret;          long ret;
100  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
101  +               return -EPERM;  +               return -EPERM;
102    
103          lock_kernel();          lock_kernel();
104          ret = -EPERM;          ret = -EPERM;
105  --- linux-2.6.15-54.79.orig/arch/m32r/kernel/ptrace.c  --- linux-2.6.15-55.84.orig/arch/m32r/kernel/ptrace.c
106  +++ linux-2.6.15-54.79/arch/m32r/kernel/ptrace.c  +++ linux-2.6.15-55.84/arch/m32r/kernel/ptrace.c
107  @@ -33,6 +33,7 @@  @@ -33,6 +33,7 @@
108   #include <asm/system.h>   #include <asm/system.h>
109   #include <asm/processor.h>   #include <asm/processor.h>
# Line 117  Source code for this patch is "apt-get i Line 116  Source code for this patch is "apt-get i
116   {   {
117          struct task_struct *child;          struct task_struct *child;
118          int ret;          int ret;
119  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
120  +               return -EPERM;  +               return -EPERM;
121    
122          lock_kernel();          lock_kernel();
123          ret = -EPERM;          ret = -EPERM;
124  --- linux-2.6.15-54.79.orig/arch/mips/kernel/ptrace32.c  --- linux-2.6.15-55.84.orig/arch/mips/kernel/ptrace32.c
125  +++ linux-2.6.15-54.79/arch/mips/kernel/ptrace32.c  +++ linux-2.6.15-55.84/arch/mips/kernel/ptrace32.c
126  @@ -35,6 +35,7 @@  @@ -35,6 +35,7 @@
127   #include <asm/system.h>   #include <asm/system.h>
128   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 136  Source code for this patch is "apt-get i Line 135  Source code for this patch is "apt-get i
135   {   {
136          struct task_struct *child;          struct task_struct *child;
137          int ret;          int ret;
138  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
139  +               return -EPERM;  +               return -EPERM;
140    
141   #if 0   #if 0
142          printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",          printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
143  --- linux-2.6.15-54.79.orig/arch/powerpc/kernel/ptrace32.c  --- linux-2.6.15-55.84.orig/arch/powerpc/kernel/ptrace32.c
144  +++ linux-2.6.15-54.79/arch/powerpc/kernel/ptrace32.c  +++ linux-2.6.15-55.84/arch/powerpc/kernel/ptrace32.c
145  @@ -33,6 +33,7 @@  @@ -33,6 +33,7 @@
146   #include <asm/page.h>   #include <asm/page.h>
147   #include <asm/pgtable.h>   #include <asm/pgtable.h>
# Line 155  Source code for this patch is "apt-get i Line 154  Source code for this patch is "apt-get i
154   {   {
155          struct task_struct *child;          struct task_struct *child;
156          int ret = -EPERM;          int ret = -EPERM;
157  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
158  +               return -EPERM;  +               return -EPERM;
159    
160          lock_kernel();          lock_kernel();
161          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
162  --- linux-2.6.15-54.79.orig/arch/s390/kernel/ptrace.c  --- linux-2.6.15-55.84.orig/arch/s390/kernel/ptrace.c
163  +++ linux-2.6.15-54.79/arch/s390/kernel/ptrace.c  +++ linux-2.6.15-55.84/arch/s390/kernel/ptrace.c
164  @@ -41,6 +41,7 @@  @@ -41,6 +41,7 @@
165   #include <asm/system.h>   #include <asm/system.h>
166   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 174  Source code for this patch is "apt-get i Line 173  Source code for this patch is "apt-get i
173          struct task_struct *child;          struct task_struct *child;
174          int ret;          int ret;
175    
176  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
177  +               return -EPERM;  +               return -EPERM;
178          lock_kernel();          lock_kernel();
179    
180          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
181  --- linux-2.6.15-54.79.orig/arch/sparc/kernel/ptrace.c  --- linux-2.6.15-55.84.orig/arch/sparc/kernel/ptrace.c
182  +++ linux-2.6.15-54.79/arch/sparc/kernel/ptrace.c  +++ linux-2.6.15-55.84/arch/sparc/kernel/ptrace.c
183  @@ -23,6 +23,7 @@  @@ -23,6 +23,7 @@
184   #include <asm/pgtable.h>   #include <asm/pgtable.h>
185   #include <asm/system.h>   #include <asm/system.h>
# Line 193  Source code for this patch is "apt-get i Line 192  Source code for this patch is "apt-get i
192          unsigned long addr2 = regs->u_regs[UREG_I4];          unsigned long addr2 = regs->u_regs[UREG_I4];
193          struct task_struct *child;          struct task_struct *child;
194          int ret;          int ret;
195  +       if (!ccs_capable(CCS_SYS_PTRACE)) {  +       if (ccs_ptrace_permission(request, pid)) {
196  +               pt_error_return(regs, EPERM);  +               pt_error_return(regs, EPERM);
197  +               return;  +               return;
198  +       }  +       }
199    
200          lock_kernel();          lock_kernel();
201   #ifdef DEBUG_PTRACE   #ifdef DEBUG_PTRACE
202  --- linux-2.6.15-54.79.orig/arch/sparc64/kernel/ptrace.c  --- linux-2.6.15-55.84.orig/arch/sparc64/kernel/ptrace.c
203  +++ linux-2.6.15-54.79/arch/sparc64/kernel/ptrace.c  +++ linux-2.6.15-55.84/arch/sparc64/kernel/ptrace.c
204  @@ -32,6 +32,7 @@  @@ -32,6 +32,7 @@
205   #include <asm/spitfire.h>   #include <asm/spitfire.h>
206   #include <asm/page.h>   #include <asm/page.h>
# Line 214  Source code for this patch is "apt-get i Line 213  Source code for this patch is "apt-get i
213          unsigned long addr2 = regs->u_regs[UREG_I4];          unsigned long addr2 = regs->u_regs[UREG_I4];
214          struct task_struct *child;          struct task_struct *child;
215          int ret;          int ret;
216  +       if (!ccs_capable(CCS_SYS_PTRACE)) {  +       if (ccs_ptrace_permission(request, pid)) {
217  +               pt_error_return(regs, EPERM);  +               pt_error_return(regs, EPERM);
218  +               return;  +               return;
219  +       }  +       }
220    
221          if (test_thread_flag(TIF_32BIT)) {          if (test_thread_flag(TIF_32BIT)) {
222                  addr &= 0xffffffffUL;                  addr &= 0xffffffffUL;
223  --- linux-2.6.15-54.79.orig/arch/x86_64/ia32/ptrace32.c  --- linux-2.6.15-55.84.orig/arch/x86_64/ia32/ptrace32.c
224  +++ linux-2.6.15-54.79/arch/x86_64/ia32/ptrace32.c  +++ linux-2.6.15-55.84/arch/x86_64/ia32/ptrace32.c
225  @@ -27,6 +27,7 @@  @@ -27,6 +27,7 @@
226   #include <asm/debugreg.h>   #include <asm/debugreg.h>
227   #include <asm/i387.h>   #include <asm/i387.h>
# Line 235  Source code for this patch is "apt-get i Line 234  Source code for this patch is "apt-get i
234          void __user *datap = compat_ptr(data);          void __user *datap = compat_ptr(data);
235          int ret;          int ret;
236          __u32 val;          __u32 val;
237  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
238  +               return -EPERM;  +               return -EPERM;
239    
240          switch (request) {          switch (request) {
241          default:          default:
242  --- linux-2.6.15-54.79.orig/fs/attr.c  --- linux-2.6.15-55.84.orig/fs/compat.c
243  +++ linux-2.6.15-54.79/fs/attr.c  +++ linux-2.6.15-55.84/fs/compat.c
 @@ -15,6 +15,7 @@  
  #include <linux/quotaops.h>  
  #include <linux/security.h>  
  #include <linux/time.h>  
 +#include <linux/ccsecurity.h>  
   
  /* Taken over from the old code... */  
   
 @@ -154,11 +155,15 @@ int notify_change(struct dentry * dentry  
         if (inode->i_op && inode->i_op->setattr) {  
                 error = security_inode_setattr(dentry, attr);  
                 if (!error)  
 +                       error = ccs_setattr_permission(dentry, attr);  
 +               if (!error)  
                         error = inode->i_op->setattr(dentry, attr);  
         } else {  
                 error = inode_change_ok(inode, attr);  
                 if (!error)  
                         error = security_inode_setattr(dentry, 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.15-54.79.orig/fs/compat.c  
 +++ linux-2.6.15-54.79/fs/compat.c  
244  @@ -52,6 +52,7 @@  @@ -52,6 +52,7 @@
245   #include <asm/uaccess.h>   #include <asm/uaccess.h>
246   #include <asm/mmu_context.h>   #include <asm/mmu_context.h>
# Line 281  Source code for this patch is "apt-get i Line 254  Source code for this patch is "apt-get i
254          /* RED-PEN how should LSM module know it's handling 32bit? */          /* RED-PEN how should LSM module know it's handling 32bit? */
255          error = security_file_ioctl(filp, cmd, arg);          error = security_file_ioctl(filp, cmd, arg);
256  +       if (!error)  +       if (!error)
257  +               error = ccs_check_ioctl_permission(filp, cmd, arg);  +               error = ccs_ioctl_permission(filp, cmd, arg);
258          if (error)          if (error)
259                  goto out_fput;                  goto out_fput;
260    
# Line 305  Source code for this patch is "apt-get i Line 278  Source code for this patch is "apt-get i
278          if (retval >= 0) {          if (retval >= 0) {
279                  free_arg_pages(bprm);                  free_arg_pages(bprm);
280    
281  --- linux-2.6.15-54.79.orig/fs/exec.c  --- linux-2.6.15-55.84.orig/fs/exec.c
282  +++ linux-2.6.15-54.79/fs/exec.c  +++ linux-2.6.15-55.84/fs/exec.c
283  @@ -57,6 +57,8 @@  @@ -57,6 +57,8 @@
284   #include <linux/kmod.h>   #include <linux/kmod.h>
285   #endif   #endif
# Line 337  Source code for this patch is "apt-get i Line 310  Source code for this patch is "apt-get i
310                          file = ERR_PTR(err);                          file = ERR_PTR(err);
311                          if (!err) {                          if (!err) {
312                                  file = nameidata_to_filp(&nd, O_RDONLY);                                  file = nameidata_to_filp(&nd, O_RDONLY);
313  @@ -1197,7 +1206,8 @@ int do_execve(char * filename,  @@ -1204,7 +1213,8 @@ int do_execve(char * filename,
314          if (retval < 0)          if (retval < 0)
315                  goto out;                  goto out;
316    
# Line 347  Source code for this patch is "apt-get i Line 320  Source code for this patch is "apt-get i
320          if (retval >= 0) {          if (retval >= 0) {
321                  free_arg_pages(bprm);                  free_arg_pages(bprm);
322    
323  --- linux-2.6.15-54.79.orig/fs/fcntl.c  --- linux-2.6.15-55.84.orig/fs/fcntl.c
324  +++ linux-2.6.15-54.79/fs/fcntl.c  +++ linux-2.6.15-55.84/fs/fcntl.c
325  @@ -21,6 +21,7 @@  @@ -21,6 +21,7 @@
326   #include <asm/poll.h>   #include <asm/poll.h>
327   #include <asm/siginfo.h>   #include <asm/siginfo.h>
# Line 367  Source code for this patch is "apt-get i Line 340  Source code for this patch is "apt-get i
340          /* O_NOATIME can only be set by the owner or superuser */          /* O_NOATIME can only be set by the owner or superuser */
341          if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME))          if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME))
342                  if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))                  if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))
343  --- linux-2.6.15-54.79.orig/fs/ioctl.c  --- linux-2.6.15-55.84.orig/fs/ioctl.c
344  +++ linux-2.6.15-54.79/fs/ioctl.c  +++ linux-2.6.15-55.84/fs/ioctl.c
345  @@ -15,6 +15,7 @@  @@ -15,6 +15,7 @@
346    
347   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 377  Source code for this patch is "apt-get i Line 350  Source code for this patch is "apt-get i
350    
351   static long do_ioctl(struct file *filp, unsigned int cmd,   static long do_ioctl(struct file *filp, unsigned int cmd,
352                  unsigned long arg)                  unsigned long arg)
353  @@ -23,6 +24,8 @@ static long do_ioctl(struct file *filp,  @@ -167,6 +168,8 @@ SYSCALL_DEFINE3(ioctl, unsigned int, fd,
   
         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);  
 @@ -167,6 +170,8 @@ SYSCALL_DEFINE3(ioctl, unsigned int, fd,  
354                  goto out;                  goto out;
355    
356          error = security_file_ioctl(filp, cmd, arg);          error = security_file_ioctl(filp, cmd, arg);
# Line 395  Source code for this patch is "apt-get i Line 359  Source code for this patch is "apt-get i
359          if (error)          if (error)
360                  goto out_fput;                  goto out_fput;
361    
362  --- linux-2.6.15-54.79.orig/fs/namei.c  --- linux-2.6.15-55.84.orig/fs/namei.c
363  +++ linux-2.6.15-54.79/fs/namei.c  +++ linux-2.6.15-55.84/fs/namei.c
364  @@ -34,6 +34,8 @@  @@ -34,6 +34,8 @@
365    
366   #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])   #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
# Line 418  Source code for this patch is "apt-get i Line 382  Source code for this patch is "apt-get i
382          /*          /*
383           * Ensure there are no outstanding leases on the file.           * Ensure there are no outstanding leases on the file.
384           */           */
385  @@ -1519,6 +1526,7 @@ int may_open(struct nameidata *nd, int a  @@ -1594,6 +1601,9 @@ do_last:
         return 0;  
  }  
   
 +#include <linux/ccsecurity_vfs.h>  
  /*  
   *     open_namei()  
   *  
 @@ -1594,6 +1602,9 @@ do_last:  
386          if (!path.dentry->d_inode) {          if (!path.dentry->d_inode) {
387                  if (!IS_POSIXACL(dir->d_inode))                  if (!IS_POSIXACL(dir->d_inode))
388                          mode &= ~current->fs->umask;                          mode &= ~current->fs->umask;
# Line 436  Source code for this patch is "apt-get i Line 392  Source code for this patch is "apt-get i
392                  error = vfs_create(dir->d_inode, path.dentry, mode, nd);                  error = vfs_create(dir->d_inode, path.dentry, mode, nd);
393                  up(&dir->d_inode->i_sem);                  up(&dir->d_inode->i_sem);
394                  dput(nd->dentry);                  dput(nd->dentry);
395  @@ -1781,6 +1792,9 @@ SYSCALL_DEFINE3(mknod, const char __user  @@ -1781,6 +1791,9 @@ SYSCALL_DEFINE3(mknod, const char __user
396          if (!IS_POSIXACL(nd.dentry->d_inode))          if (!IS_POSIXACL(nd.dentry->d_inode))
397                  mode &= ~current->fs->umask;                  mode &= ~current->fs->umask;
398          if (!IS_ERR(dentry)) {          if (!IS_ERR(dentry)) {
# Line 446  Source code for this patch is "apt-get i Line 402  Source code for this patch is "apt-get i
402                  switch (mode & S_IFMT) {                  switch (mode & S_IFMT) {
403                  case 0: case S_IFREG:                  case 0: case S_IFREG:
404                          error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);                          error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
405  @@ -1849,6 +1863,9 @@ SYSCALL_DEFINE2(mkdir, const char __user  @@ -1849,6 +1862,9 @@ SYSCALL_DEFINE2(mkdir, const char __user
406                  if (!IS_ERR(dentry)) {                  if (!IS_ERR(dentry)) {
407                          if (!IS_POSIXACL(nd.dentry->d_inode))                          if (!IS_POSIXACL(nd.dentry->d_inode))
408                                  mode &= ~current->fs->umask;                                  mode &= ~current->fs->umask;
# Line 456  Source code for this patch is "apt-get i Line 412  Source code for this patch is "apt-get i
412                          error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);                          error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
413                          dput(dentry);                          dput(dentry);
414                  }                  }
415  @@ -1952,6 +1969,9 @@ SYSCALL_DEFINE1(rmdir, const char __user  @@ -1952,6 +1968,9 @@ SYSCALL_DEFINE1(rmdir, const char __user
416          dentry = lookup_hash(&nd);          dentry = lookup_hash(&nd);
417          error = PTR_ERR(dentry);          error = PTR_ERR(dentry);
418          if (!IS_ERR(dentry)) {          if (!IS_ERR(dentry)) {
# Line 466  Source code for this patch is "apt-get i Line 422  Source code for this patch is "apt-get i
422                  error = vfs_rmdir(nd.dentry->d_inode, dentry);                  error = vfs_rmdir(nd.dentry->d_inode, dentry);
423                  dput(dentry);                  dput(dentry);
424          }          }
425  @@ -2027,6 +2047,9 @@ SYSCALL_DEFINE1(unlink, const char __use  @@ -2027,6 +2046,9 @@ SYSCALL_DEFINE1(unlink, const char __use
426                  inode = dentry->d_inode;                  inode = dentry->d_inode;
427                  if (inode)                  if (inode)
428                          atomic_inc(&inode->i_count);                          atomic_inc(&inode->i_count);
# Line 476  Source code for this patch is "apt-get i Line 432  Source code for this patch is "apt-get i
432                  error = vfs_unlink(nd.dentry->d_inode, dentry);                  error = vfs_unlink(nd.dentry->d_inode, dentry);
433          exit2:          exit2:
434                  dput(dentry);                  dput(dentry);
435  @@ -2089,6 +2112,9 @@ SYSCALL_DEFINE2(symlink, const char __us  @@ -2089,6 +2111,9 @@ SYSCALL_DEFINE2(symlink, const char __us
436                  dentry = lookup_create(&nd, 0);                  dentry = lookup_create(&nd, 0);
437                  error = PTR_ERR(dentry);                  error = PTR_ERR(dentry);
438                  if (!IS_ERR(dentry)) {                  if (!IS_ERR(dentry)) {
# Line 486  Source code for this patch is "apt-get i Line 442  Source code for this patch is "apt-get i
442                          error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);                          error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
443                          dput(dentry);                          dput(dentry);
444                  }                  }
445  @@ -2172,6 +2198,9 @@ SYSCALL_DEFINE2(link, const char __user  @@ -2172,6 +2197,9 @@ SYSCALL_DEFINE2(link, const char __user
446          new_dentry = lookup_create(&nd, 0);          new_dentry = lookup_create(&nd, 0);
447          error = PTR_ERR(new_dentry);          error = PTR_ERR(new_dentry);
448          if (!IS_ERR(new_dentry)) {          if (!IS_ERR(new_dentry)) {
# Line 496  Source code for this patch is "apt-get i Line 452  Source code for this patch is "apt-get i
452                  error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);                  error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
453                  dput(new_dentry);                  dput(new_dentry);
454          }          }
455  @@ -2392,6 +2421,9 @@ static inline int do_rename(const char *  @@ -2392,6 +2420,9 @@ static inline int do_rename(const char *
456          if (new_dentry == trap)          if (new_dentry == trap)
457                  goto exit5;                  goto exit5;
458    
# Line 506  Source code for this patch is "apt-get i Line 462  Source code for this patch is "apt-get i
462          error = vfs_rename(old_dir->d_inode, old_dentry,          error = vfs_rename(old_dir->d_inode, old_dentry,
463                                     new_dir->d_inode, new_dentry);                                     new_dir->d_inode, new_dentry);
464   exit5:   exit5:
465  --- linux-2.6.15-54.79.orig/fs/namespace.c  --- linux-2.6.15-55.84.orig/fs/namespace.c
466  +++ linux-2.6.15-54.79/fs/namespace.c  +++ linux-2.6.15-55.84/fs/namespace.c
467  @@ -25,6 +25,7 @@  @@ -25,6 +25,7 @@
468   #include <asm/uaccess.h>   #include <asm/uaccess.h>
469   #include <asm/unistd.h>   #include <asm/unistd.h>
# Line 516  Source code for this patch is "apt-get i Line 472  Source code for this patch is "apt-get i
472    
473   extern int __init init_rootfs(void);   extern int __init init_rootfs(void);
474    
475  @@ -504,6 +505,9 @@ static int do_umount(struct vfsmount *mn  @@ -501,6 +502,8 @@ static int do_umount(struct vfsmount *mn
476            LIST_HEAD(umount_list);
477    
478            retval = security_sb_umount(mnt, flags);
479    +       if (!retval)
480    +               retval = ccs_umount_permission(mnt, flags);
481          if (retval)          if (retval)
482                  return retval;                  return retval;
483    
484  +       if (ccs_may_umount(mnt))  @@ -1264,6 +1267,7 @@ int copy_mount_options(const void __user
485  +               return -EPERM;   long do_mount(char *dev_name, char *dir_name, char *type_page,
486  +                    unsigned long flags, void *data_page)
         /*  
          * Allow userspace to request a mountpoint be expired rather than  
          * unmounting unconditionally. Unmount only happens if:  
 @@ -592,6 +596,8 @@ SYSCALL_DEFINE2(umount, char __user *, n  
487   {   {
488    +       const unsigned long original_flags = flags;
489          struct nameidata nd;          struct nameidata nd;
490          int retval;          int retval = 0;
491  +       if (!ccs_capable(CCS_SYS_UMOUNT))          int mnt_flags = 0;
492  +               return -EPERM;  @@ -1297,6 +1301,9 @@ long do_mount(char *dev_name, char *dir_
493                    return retval;
494    
495          retval = __user_walk(name, LOOKUP_FOLLOW, &nd);          retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page);
496    +       if (!retval)
497    +               retval = ccs_mount_permission(dev_name, &nd, type_page,
498    +                                             original_flags, data_page);
499          if (retval)          if (retval)
500  @@ -879,6 +885,9 @@ static int do_loopback(struct nameidata                  goto dput_out;
   
         if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))  
                 goto out;  
 +       err = -EPERM;  
 +       if (ccs_may_mount(nd))  
 +               goto out;  
   
         err = -ENOMEM;  
         if (recurse)  
 @@ -963,7 +972,9 @@ static int do_move_mount(struct nameidat  
         err = -EINVAL;  
         if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))  
                 goto out;  
 -  
 +       err = -EPERM;  
 +       if (ccs_may_umount(old_nd.mnt) || ccs_may_mount(nd))  
 +               goto out;  
         err = -ENOENT;  
         down(&nd->dentry->d_inode->i_sem);  
         if (IS_DEADDIR(nd->dentry->d_inode))  
 @@ -1065,6 +1076,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)))  
 @@ -1282,6 +1296,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;  
 @@ -1545,6 +1563,8 @@ SYSCALL_DEFINE2(pivot_root, const char _  
   
         if (!capable(CAP_SYS_ADMIN))  
                 return -EPERM;  
 +       if (!ccs_capable(CCS_SYS_PIVOT_ROOT))  
 +               return -EPERM;  
   
         lock_kernel();  
501    
502  @@ -1561,6 +1581,8 @@ SYSCALL_DEFINE2(pivot_root, const char _  @@ -1561,6 +1568,8 @@ SYSCALL_DEFINE2(pivot_root, const char _
503                  goto out1;                  goto out1;
504    
505          error = security_sb_pivotroot(&old_nd, &new_nd);          error = security_sb_pivotroot(&old_nd, &new_nd);
# Line 595  Source code for this patch is "apt-get i Line 508  Source code for this patch is "apt-get i
508          if (error) {          if (error) {
509                  path_release(&old_nd);                  path_release(&old_nd);
510                  goto out1;                  goto out1;
511  --- linux-2.6.15-54.79.orig/fs/open.c  --- linux-2.6.15-55.84.orig/fs/open.c
512  +++ linux-2.6.15-54.79/fs/open.c  +++ linux-2.6.15-55.84/fs/open.c
513  @@ -28,6 +28,8 @@  @@ -28,6 +28,8 @@
514    
515   #include <asm/unistd.h>   #include <asm/unistd.h>
# Line 610  Source code for this patch is "apt-get i Line 523  Source code for this patch is "apt-get i
523          if (error)          if (error)
524                  goto dput_and_out;                  goto dput_and_out;
525    
526  +       error = ccs_truncate_permission(nd.dentry, nd.mnt, length, 0);  +       error = ccs_truncate_permission(nd.dentry, nd.mnt);
527  +       if (!error)  +       if (!error)
528          error = locks_verify_truncate(inode, NULL, length);          error = locks_verify_truncate(inode, NULL, length);
529          if (!error) {          if (!error) {
# Line 620  Source code for this patch is "apt-get i Line 533  Source code for this patch is "apt-get i
533          if (IS_APPEND(inode))          if (IS_APPEND(inode))
534                  goto out_putf;                  goto out_putf;
535  -  -
536  +       error = ccs_truncate_permission(dentry, file->f_vfsmnt, length, 0);  +       error = ccs_truncate_permission(dentry, file->f_vfsmnt);
537  +       if (error)  +       if (error)
538  +               goto out_putf;  +               goto out_putf;
539          error = locks_verify_truncate(inode, file, length);          error = locks_verify_truncate(inode, file, length);
540          if (!error)          if (!error)
541                  error = do_truncate(dentry, length, file);                  error = do_truncate(dentry, length, file);
542  @@ -627,6 +633,10 @@ SYSCALL_DEFINE1(chroot, const char __use  @@ -627,6 +633,8 @@ SYSCALL_DEFINE1(chroot, const char __use
543          error = -EPERM;          error = -EPERM;
544          if (!capable(CAP_SYS_CHROOT))          if (!capable(CAP_SYS_CHROOT))
545                  goto dput_and_out;                  goto dput_and_out;
 +       if (!ccs_capable(CCS_SYS_CHROOT))  
 +               goto dput_and_out;  
546  +       if (ccs_chroot_permission(&nd))  +       if (ccs_chroot_permission(&nd))
547  +               goto dput_and_out;  +               goto dput_and_out;
548    
549          set_fs_root(current->fs, nd.mnt, nd.dentry);          set_fs_root(current->fs, nd.mnt, nd.dentry);
550          set_fs_altroot();          set_fs_altroot();
551  @@ -658,6 +668,9 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd  @@ -658,6 +666,9 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd
552          err = -EPERM;          err = -EPERM;
553          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
554                  goto out_putf;                  goto out_putf;
# Line 647  Source code for this patch is "apt-get i Line 558  Source code for this patch is "apt-get i
558          down(&inode->i_sem);          down(&inode->i_sem);
559          if (mode == (mode_t) -1)          if (mode == (mode_t) -1)
560                  mode = inode->i_mode;                  mode = inode->i_mode;
561  @@ -691,6 +704,9 @@ SYSCALL_DEFINE2(chmod, const char __user  @@ -691,6 +702,9 @@ SYSCALL_DEFINE2(chmod, const char __user
562          error = -EPERM;          error = -EPERM;
563          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
564                  goto dput_and_out;                  goto dput_and_out;
# Line 657  Source code for this patch is "apt-get i Line 568  Source code for this patch is "apt-get i
568    
569          down(&inode->i_sem);          down(&inode->i_sem);
570          if (mode == (mode_t) -1)          if (mode == (mode_t) -1)
571  @@ -748,6 +764,8 @@ SYSCALL_DEFINE3(chown, const char __user  @@ -748,6 +762,8 @@ SYSCALL_DEFINE3(chown, const char __user
572    
573          error = user_path_walk(filename, &nd);          error = user_path_walk(filename, &nd);
574          if (!error) {          if (!error) {
# Line 666  Source code for this patch is "apt-get i Line 577  Source code for this patch is "apt-get i
577                  error = chown_common(nd.dentry, user, group);                  error = chown_common(nd.dentry, user, group);
578                  path_release(&nd);                  path_release(&nd);
579          }          }
580  @@ -762,6 +780,8 @@ SYSCALL_DEFINE3(lchown, const char __use  @@ -762,6 +778,8 @@ SYSCALL_DEFINE3(lchown, const char __use
581    
582          error = user_path_walk_link(filename, &nd);          error = user_path_walk_link(filename, &nd);
583          if (!error) {          if (!error) {
# Line 675  Source code for this patch is "apt-get i Line 586  Source code for this patch is "apt-get i
586                  error = chown_common(nd.dentry, user, group);                  error = chown_common(nd.dentry, user, group);
587                  path_release(&nd);                  path_release(&nd);
588          }          }
589  @@ -776,6 +796,9 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd  @@ -776,6 +794,9 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd
590    
591          file = fget(fd);          file = fget(fd);
592          if (file) {          if (file) {
# Line 685  Source code for this patch is "apt-get i Line 596  Source code for this patch is "apt-get i
596                  error = chown_common(file->f_dentry, user, group);                  error = chown_common(file->f_dentry, user, group);
597                  fput(file);                  fput(file);
598          }          }
599    @@ -867,7 +888,9 @@ struct file *filp_open(const char * file
600            if ((namei_flags+1) & O_ACCMODE)
601                    namei_flags++;
602    
603    +       ccs_save_open_mode(flags);
604            error = open_namei(filename, namei_flags, mode, &nd);
605    +       ccs_clear_open_mode();
606            if (!error)
607                    return nameidata_to_filp(&nd, flags);
608    
609  @@ -1159,6 +1182,8 @@ EXPORT_SYMBOL(sys_close);  @@ -1159,6 +1182,8 @@ EXPORT_SYMBOL(sys_close);
610    */    */
611   SYSCALL_DEFINE0(vhangup)   SYSCALL_DEFINE0(vhangup)
# Line 694  Source code for this patch is "apt-get i Line 615  Source code for this patch is "apt-get i
615          if (capable(CAP_SYS_TTY_CONFIG)) {          if (capable(CAP_SYS_TTY_CONFIG)) {
616                  tty_vhangup(current->signal->tty);                  tty_vhangup(current->signal->tty);
617                  return 0;                  return 0;
618  --- linux-2.6.15-54.79.orig/fs/proc/proc_misc.c  --- linux-2.6.15-55.84.orig/fs/proc/proc_misc.c
619  +++ linux-2.6.15-54.79/fs/proc/proc_misc.c  +++ linux-2.6.15-55.84/fs/proc/proc_misc.c
620  @@ -629,4 +629,5 @@ void __init proc_misc_init(void)  @@ -629,4 +629,5 @@ void __init proc_misc_init(void)
621          if (entry)          if (entry)
622                  entry->proc_fops = &proc_sysrq_trigger_operations;                  entry->proc_fops = &proc_sysrq_trigger_operations;
623   #endif   #endif
624  +       printk(KERN_INFO "Hook version: 2.6.15-54.79 2009/08/20\n");  +       printk(KERN_INFO "Hook version: 2.6.15-55.84 2010/07/26\n");
625   }   }
626  --- linux-2.6.15-54.79.orig/include/linux/init_task.h  --- linux-2.6.15-55.84.orig/include/linux/init_task.h
627  +++ linux-2.6.15-54.79/include/linux/init_task.h  +++ linux-2.6.15-55.84/include/linux/init_task.h
628  @@ -72,6 +72,14 @@  @@ -72,6 +72,14 @@
629    
630   extern struct group_info init_groups;   extern struct group_info init_groups;
# Line 727  Source code for this patch is "apt-get i Line 648  Source code for this patch is "apt-get i
648   }   }
649    
650    
651  --- linux-2.6.15-54.79.orig/include/linux/sched.h  --- linux-2.6.15-55.84.orig/include/linux/sched.h
652  +++ linux-2.6.15-54.79/include/linux/sched.h  +++ linux-2.6.15-55.84/include/linux/sched.h
653  @@ -39,6 +39,8 @@  @@ -165,6 +165,8 @@ struct sched_param {
654    
655   struct exec_domain;   #ifdef __KERNEL__
656    
657  +struct ccs_domain_info;  +struct ccs_domain_info;
658  +  +
659     #include <linux/spinlock.h>
660    
661   /*   /*
   * cloning flags:  
   */  
662  @@ -858,6 +860,10 @@ struct task_struct {  @@ -858,6 +860,10 @@ struct task_struct {
663   #endif   #endif
664          atomic_t fs_excl;       /* holding fs exclusive resources */          atomic_t fs_excl;       /* holding fs exclusive resources */
# Line 749  Source code for this patch is "apt-get i Line 670  Source code for this patch is "apt-get i
670   };   };
671    
672   static inline pid_t process_group(struct task_struct *tsk)   static inline pid_t process_group(struct task_struct *tsk)
673  --- linux-2.6.15-54.79.orig/kernel/compat.c  --- linux-2.6.15-55.84.orig/kernel/compat.c
674  +++ linux-2.6.15-54.79/kernel/compat.c  +++ linux-2.6.15-55.84/kernel/compat.c
675  @@ -24,6 +24,7 @@  @@ -24,6 +24,7 @@
676    
677   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 768  Source code for this patch is "apt-get i Line 689  Source code for this patch is "apt-get i
689    
690          do_settimeofday(&tv);          do_settimeofday(&tv);
691          return 0;          return 0;
692  --- linux-2.6.15-54.79.orig/kernel/kexec.c  --- linux-2.6.15-55.84.orig/kernel/kexec.c
693  +++ linux-2.6.15-54.79/kernel/kexec.c  +++ linux-2.6.15-55.84/kernel/kexec.c
694  @@ -25,6 +25,7 @@  @@ -25,6 +25,7 @@
695   #include <asm/io.h>   #include <asm/io.h>
696   #include <asm/system.h>   #include <asm/system.h>
# Line 787  Source code for this patch is "apt-get i Line 708  Source code for this patch is "apt-get i
708    
709          /*          /*
710           * Verify we have a legal set of flags           * Verify we have a legal set of flags
711  --- linux-2.6.15-54.79.orig/kernel/kmod.c  --- linux-2.6.15-55.84.orig/kernel/kmod.c
712  +++ linux-2.6.15-54.79/kernel/kmod.c  +++ linux-2.6.15-55.84/kernel/kmod.c
713  @@ -149,6 +149,11 @@ static int ____call_usermodehelper(void  @@ -149,6 +149,11 @@ static int ____call_usermodehelper(void
714          /* We can run anywhere, unlike our parent keventd(). */          /* We can run anywhere, unlike our parent keventd(). */
715          set_cpus_allowed(current, CPU_MASK_ALL);          set_cpus_allowed(current, CPU_MASK_ALL);
# Line 801  Source code for this patch is "apt-get i Line 722  Source code for this patch is "apt-get i
722          retval = -EPERM;          retval = -EPERM;
723          if (current->fs->root)          if (current->fs->root)
724                  retval = execve(sub_info->path, sub_info->argv,sub_info->envp);                  retval = execve(sub_info->path, sub_info->argv,sub_info->envp);
725  --- linux-2.6.15-54.79.orig/kernel/module.c  --- linux-2.6.15-55.84.orig/kernel/module.c
726  +++ linux-2.6.15-54.79/kernel/module.c  +++ linux-2.6.15-55.84/kernel/module.c
727  @@ -41,6 +41,7 @@  @@ -41,6 +41,7 @@
728   #include <asm/uaccess.h>   #include <asm/uaccess.h>
729   #include <asm/semaphore.h>   #include <asm/semaphore.h>
# Line 831  Source code for this patch is "apt-get i Line 752  Source code for this patch is "apt-get i
752          /* Only one module load at a time, please */          /* Only one module load at a time, please */
753          if (down_interruptible(&module_mutex) != 0)          if (down_interruptible(&module_mutex) != 0)
754                  return -EINTR;                  return -EINTR;
755  --- linux-2.6.15-54.79.orig/kernel/ptrace.c  --- linux-2.6.15-55.84.orig/kernel/ptrace.c
756  +++ linux-2.6.15-54.79/kernel/ptrace.c  +++ linux-2.6.15-55.84/kernel/ptrace.c
757  @@ -21,6 +21,7 @@  @@ -21,6 +21,7 @@
758    
759   #include <asm/pgtable.h>   #include <asm/pgtable.h>
# Line 845  Source code for this patch is "apt-get i Line 766  Source code for this patch is "apt-get i
766          /*          /*
767           * This lock_kernel fixes a subtle race with suid exec           * This lock_kernel fixes a subtle race with suid exec
768           */           */
769  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
770  +               return -EPERM;  +               return -EPERM;
771          lock_kernel();          lock_kernel();
772          ret = ptrace_get_task_struct(request, pid, &child);          ret = ptrace_get_task_struct(request, pid, &child);
773          if (!child)          if (!child)
774  --- linux-2.6.15-54.79.orig/kernel/sched.c  --- linux-2.6.15-55.84.orig/kernel/sched.c
775  +++ linux-2.6.15-54.79/kernel/sched.c  +++ linux-2.6.15-55.84/kernel/sched.c
776  @@ -50,6 +50,7 @@  @@ -50,6 +50,7 @@
777   #include <asm/tlb.h>   #include <asm/tlb.h>
778    
# Line 869  Source code for this patch is "apt-get i Line 790  Source code for this patch is "apt-get i
790    
791          /*          /*
792           * Setpriority might change our priority at the same moment.           * Setpriority might change our priority at the same moment.
793  --- linux-2.6.15-54.79.orig/kernel/signal.c  --- linux-2.6.15-55.84.orig/kernel/signal.c
794  +++ linux-2.6.15-54.79/kernel/signal.c  +++ linux-2.6.15-55.84/kernel/signal.c
795  @@ -29,6 +29,7 @@  @@ -29,6 +29,7 @@
796   #include <asm/uaccess.h>   #include <asm/uaccess.h>
797   #include <asm/unistd.h>   #include <asm/unistd.h>
# Line 915  Source code for this patch is "apt-get i Line 836  Source code for this patch is "apt-get i
836    
837          /* POSIX.1b doesn't mention process groups.  */          /* POSIX.1b doesn't mention process groups.  */
838          return kill_proc_info(sig, &info, pid);          return kill_proc_info(sig, &info, pid);
839  --- linux-2.6.15-54.79.orig/kernel/sys.c  --- linux-2.6.15-55.84.orig/kernel/sys.c
840  +++ linux-2.6.15-54.79/kernel/sys.c  +++ linux-2.6.15-55.84/kernel/sys.c
841  @@ -37,6 +37,7 @@  @@ -37,6 +37,7 @@
842   #include <asm/uaccess.h>   #include <asm/uaccess.h>
843   #include <asm/io.h>   #include <asm/io.h>
# Line 963  Source code for this patch is "apt-get i Line 884  Source code for this patch is "apt-get i
884    
885          down_write(&uts_sem);          down_write(&uts_sem);
886          errno = -EFAULT;          errno = -EFAULT;
887  --- linux-2.6.15-54.79.orig/kernel/sysctl.c  --- linux-2.6.15-55.84.orig/kernel/sysctl.c
888  +++ linux-2.6.15-54.79/kernel/sysctl.c  +++ linux-2.6.15-55.84/kernel/sysctl.c
889  @@ -45,6 +45,7 @@  @@ -45,6 +45,7 @@
890    
891   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 997  Source code for this patch is "apt-get i Line 918  Source code for this patch is "apt-get i
918                                          error = table->strategy(                                          error = table->strategy(
919                                                  table, name, nlen,                                                  table, name, nlen,
920                                                  oldval, oldlenp,                                                  oldval, oldlenp,
921  --- linux-2.6.15-54.79.orig/kernel/time.c  --- linux-2.6.15-55.84.orig/kernel/time.c
922  +++ linux-2.6.15-54.79/kernel/time.c  +++ linux-2.6.15-55.84/kernel/time.c
923  @@ -38,6 +38,7 @@  @@ -38,6 +38,7 @@
924    
925   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 1034  Source code for this patch is "apt-get i Line 955  Source code for this patch is "apt-get i
955                                    
956          /* Now we validate the data before disabling interrupts */          /* Now we validate the data before disabling interrupts */
957    
958  --- linux-2.6.15-54.79.orig/net/ipv4/inet_connection_sock.c  --- linux-2.6.15-55.84.orig/net/ipv4/inet_connection_sock.c
959  +++ linux-2.6.15-54.79/net/ipv4/inet_connection_sock.c  +++ linux-2.6.15-55.84/net/ipv4/inet_connection_sock.c
960  @@ -24,6 +24,7 @@  @@ -24,6 +24,7 @@
961   #include <net/route.h>   #include <net/route.h>
962   #include <net/tcp_states.h>   #include <net/tcp_states.h>
# Line 1053  Source code for this patch is "apt-get i Line 974  Source code for this patch is "apt-get i
974                          inet_bind_bucket_for_each(tb, node, &head->chain)                          inet_bind_bucket_for_each(tb, node, &head->chain)
975                                  if (tb->port == rover)                                  if (tb->port == rover)
976                                          goto next;                                          goto next;
977  --- linux-2.6.15-54.79.orig/net/ipv4/raw.c  --- linux-2.6.15-55.84.orig/net/ipv4/raw.c
978  +++ linux-2.6.15-54.79/net/ipv4/raw.c  +++ linux-2.6.15-55.84/net/ipv4/raw.c
979  @@ -79,6 +79,7 @@  @@ -79,6 +79,7 @@
980   #include <linux/seq_file.h>   #include <linux/seq_file.h>
981   #include <linux/netfilter.h>   #include <linux/netfilter.h>
# Line 1063  Source code for this patch is "apt-get i Line 984  Source code for this patch is "apt-get i
984    
985   struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE];   struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE];
986   DEFINE_RWLOCK(raw_v4_lock);   DEFINE_RWLOCK(raw_v4_lock);
987  @@ -591,6 +592,9 @@ static int raw_recvmsg(struct kiocb *ioc  @@ -588,9 +589,14 @@ static int raw_recvmsg(struct kiocb *ioc
         skb = skb_recv_datagram(sk, flags, noblock, &err);  
         if (!skb)  
988                  goto out;                  goto out;
989  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);          }
990  +       if (err)  
991  +               goto out;  -       skb = skb_recv_datagram(sk, flags, noblock, &err);
992    -       if (!skb)
993    -               goto out;
994    +       for (;;) {
995    +               skb = skb_recv_datagram(sk, flags, noblock, &err);
996    +               if (!skb)
997    +                       goto out;
998    +               if (!ccs_socket_post_recvmsg_permission(sk, skb))
999    +                       break;
1000    +               skb_kill_datagram(sk, skb, flags);
1001    +       }
1002    
1003          copied = skb->len;          copied = skb->len;
1004          if (len < copied) {          if (len < copied) {
1005  --- linux-2.6.15-54.79.orig/net/ipv4/tcp_ipv4.c  --- linux-2.6.15-55.84.orig/net/ipv4/tcp_ipv4.c
1006  +++ linux-2.6.15-54.79/net/ipv4/tcp_ipv4.c  +++ linux-2.6.15-55.84/net/ipv4/tcp_ipv4.c
1007  @@ -76,6 +76,7 @@  @@ -76,6 +76,7 @@
1008   #include <linux/stddef.h>   #include <linux/stddef.h>
1009   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
# Line 1092  Source code for this patch is "apt-get i Line 1021  Source code for this patch is "apt-get i
1021                          head = &tcp_hashinfo.bhash[inet_bhashfn(port, tcp_hashinfo.bhash_size)];                          head = &tcp_hashinfo.bhash[inet_bhashfn(port, tcp_hashinfo.bhash_size)];
1022                          spin_lock(&head->lock);                          spin_lock(&head->lock);
1023    
1024  --- linux-2.6.15-54.79.orig/net/ipv4/udp.c  --- linux-2.6.15-55.84.orig/net/ipv4/udp.c
1025  +++ linux-2.6.15-54.79/net/ipv4/udp.c  +++ linux-2.6.15-55.84/net/ipv4/udp.c
1026  @@ -108,6 +108,7 @@  @@ -108,6 +108,7 @@
1027   #include <net/inet_common.h>   #include <net/inet_common.h>
1028   #include <net/checksum.h>   #include <net/checksum.h>
# Line 1120  Source code for this patch is "apt-get i Line 1049  Source code for this patch is "apt-get i
1049                          if (!udp_lport_inuse(result))                          if (!udp_lport_inuse(result))
1050                                  break;                                  break;
1051                  }                  }
1052  @@ -796,7 +801,10 @@ try_again:  @@ -784,6 +789,7 @@ static int udp_recvmsg(struct kiocb *ioc
1053            struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name;
1054            struct sk_buff *skb;
1055            int copied, err;
1056    +       _Bool update_stat;
1057    
1058            /*
1059             *      Check any passed addresses
1060    @@ -798,7 +804,12 @@ try_again:
1061          skb = skb_recv_datagram(sk, flags, noblock, &err);          skb = skb_recv_datagram(sk, flags, noblock, &err);
1062          if (!skb)          if (!skb)
1063                  goto out;                  goto out;
1064  -    -  
1065  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
1066  +       if (err)  +               update_stat = 0;
1067  +               goto out;  +               goto csum_copy_err;
1068    +       }
1069    +       update_stat = 1;
1070  +  +
1071          copied = skb->len - sizeof(struct udphdr);          copied = skb->len - sizeof(struct udphdr);
1072          if (copied > len) {          if (copied > len) {
1073                  copied = len;                  copied = len;
1074  --- linux-2.6.15-54.79.orig/net/ipv6/raw.c  @@ -846,7 +857,8 @@ out:
1075  +++ linux-2.6.15-54.79/net/ipv6/raw.c          return err;
1076    
1077     csum_copy_err:
1078    -       UDP_INC_STATS_BH(UDP_MIB_INERRORS);
1079    +       if (update_stat)
1080    +               UDP_INC_STATS_BH(UDP_MIB_INERRORS);
1081    
1082            /* Clear queue. */
1083            if (flags&MSG_PEEK) {
1084    --- linux-2.6.15-55.84.orig/net/ipv6/raw.c
1085    +++ linux-2.6.15-55.84/net/ipv6/raw.c
1086  @@ -56,6 +56,7 @@  @@ -56,6 +56,7 @@
1087    
1088   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
# Line 1142  Source code for this patch is "apt-get i Line 1091  Source code for this patch is "apt-get i
1091    
1092   struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE];   struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE];
1093   DEFINE_RWLOCK(raw_v6_lock);   DEFINE_RWLOCK(raw_v6_lock);
1094  @@ -387,6 +388,9 @@ static int rawv6_recvmsg(struct kiocb *i  @@ -384,9 +385,14 @@ static int rawv6_recvmsg(struct kiocb *i
1095          skb = skb_recv_datagram(sk, flags, noblock, &err);          if (flags & MSG_ERRQUEUE)
1096          if (!skb)                  return ipv6_recv_error(sk, msg, len);
1097                  goto out;  
1098  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  -       skb = skb_recv_datagram(sk, flags, noblock, &err);
1099  +       if (err)  -       if (!skb)
1100  +               goto out;  -               goto out;
1101    +       for (;;) {
1102    +               skb = skb_recv_datagram(sk, flags, noblock, &err);
1103    +               if (!skb)
1104    +                       goto out;
1105    +               if (!ccs_socket_post_recvmsg_permission(sk, skb))
1106    +                       break;
1107    +               skb_kill_datagram(sk, skb, flags);
1108    +       }
1109    
1110          copied = skb->len;          copied = skb->len;
1111          if (copied > len) {          if (copied > len) {
1112  --- linux-2.6.15-54.79.orig/net/ipv6/tcp_ipv6.c  --- linux-2.6.15-55.84.orig/net/ipv6/tcp_ipv6.c
1113  +++ linux-2.6.15-54.79/net/ipv6/tcp_ipv6.c  +++ linux-2.6.15-55.84/net/ipv6/tcp_ipv6.c
1114  @@ -64,6 +64,7 @@  @@ -64,6 +64,7 @@
1115    
1116   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
# Line 1180  Source code for this patch is "apt-get i Line 1137  Source code for this patch is "apt-get i
1137                          head = &tcp_hashinfo.bhash[inet_bhashfn(port, tcp_hashinfo.bhash_size)];                          head = &tcp_hashinfo.bhash[inet_bhashfn(port, tcp_hashinfo.bhash_size)];
1138                          spin_lock(&head->lock);                          spin_lock(&head->lock);
1139    
1140  --- linux-2.6.15-54.79.orig/net/ipv6/udp.c  --- linux-2.6.15-55.84.orig/net/ipv6/udp.c
1141  +++ linux-2.6.15-54.79/net/ipv6/udp.c  +++ linux-2.6.15-55.84/net/ipv6/udp.c
1142  @@ -58,6 +58,7 @@  @@ -58,6 +58,7 @@
1143    
1144   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
# Line 1208  Source code for this patch is "apt-get i Line 1165  Source code for this patch is "apt-get i
1165                          if (!udp_lport_inuse(result))                          if (!udp_lport_inuse(result))
1166                                  break;                                  break;
1167                  }                  }
1168  @@ -237,6 +242,9 @@ try_again:  @@ -226,6 +231,7 @@ static int udpv6_recvmsg(struct kiocb *i
1169            struct sk_buff *skb;
1170            size_t copied;
1171            int err;
1172    +       _Bool update_stat;
1173    
1174            if (addr_len)
1175                    *addr_len=sizeof(struct sockaddr_in6);
1176    @@ -237,6 +243,11 @@ try_again:
1177          skb = skb_recv_datagram(sk, flags, noblock, &err);          skb = skb_recv_datagram(sk, flags, noblock, &err);
1178          if (!skb)          if (!skb)
1179                  goto out;                  goto out;
1180  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
1181  +       if (err)  +               update_stat = 0;
1182  +               goto out;  +               goto csum_copy_err;
1183    +       }
1184    +       update_stat = 1;
1185    
1186          copied = skb->len - sizeof(struct udphdr);          copied = skb->len - sizeof(struct udphdr);
1187          if (copied > len) {          if (copied > len) {
1188  --- linux-2.6.15-54.79.orig/net/socket.c  @@ -316,7 +327,8 @@ csum_copy_err:
1189  +++ linux-2.6.15-54.79/net/socket.c          skb_free_datagram(sk, skb);
1190    
1191            if (flags & MSG_DONTWAIT) {
1192    -               UDP6_INC_STATS_USER(UDP_MIB_INERRORS);
1193    +               if (update_stat)
1194    +                       UDP6_INC_STATS_USER(UDP_MIB_INERRORS);
1195                    return -EAGAIN;
1196            }
1197            goto try_again;
1198    --- linux-2.6.15-55.84.orig/net/socket.c
1199    +++ linux-2.6.15-55.84/net/socket.c
1200  @@ -97,6 +97,8 @@  @@ -97,6 +97,8 @@
1201   #include <net/sock.h>   #include <net/sock.h>
1202   #include <linux/netfilter.h>   #include <linux/netfilter.h>
# Line 1229  Source code for this patch is "apt-get i Line 1206  Source code for this patch is "apt-get i
1206   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
1207   static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf,   static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf,
1208                           size_t size, loff_t pos);                           size_t size, loff_t pos);
1209  @@ -544,9 +546,12 @@ static inline int __sock_sendmsg(struct  @@ -544,9 +546,10 @@ static inline int __sock_sendmsg(struct
1210          si->size = size;          si->size = size;
1211    
1212          err = security_socket_sendmsg(sock, msg, size);          err = security_socket_sendmsg(sock, msg, size);
1213  +       if (!err)  +       if (!err)
1214  +               err = ccs_socket_sendmsg_permission(sock, (struct sockaddr *)  +               err = ccs_socket_sendmsg_permission(sock, msg, size);
 +                                                   msg->msg_name,  
 +                                                   msg->msg_namelen);  
1215          if (err)          if (err)
1216                  return err;                  return err;
1217  -  -
1218          return sock->ops->sendmsg(iocb, sock, msg, size);          return sock->ops->sendmsg(iocb, sock, msg, size);
1219   }   }
1220    
1221  @@ -1103,6 +1108,8 @@ static int __sock_create(int family, int  @@ -1103,6 +1106,8 @@ static int __sock_create(int family, int
1222          }          }
1223    
1224          err = security_socket_create(family, type, protocol, kern);          err = security_socket_create(family, type, protocol, kern);
# Line 1252  Source code for this patch is "apt-get i Line 1227  Source code for this patch is "apt-get i
1227          if (err)          if (err)
1228                  return err;                  return err;
1229                                    
1230  @@ -1300,6 +1307,10 @@ SYSCALL_DEFINE3(bind, int, fd, struct so  @@ -1300,6 +1305,10 @@ SYSCALL_DEFINE3(bind, int, fd, struct so
1231                                  sockfd_put(sock);                                  sockfd_put(sock);
1232                                  return err;                                  return err;
1233                          }                          }
# Line 1263  Source code for this patch is "apt-get i Line 1238  Source code for this patch is "apt-get i
1238                          err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen);                          err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen);
1239                  }                  }
1240                  sockfd_put(sock);                  sockfd_put(sock);
1241  @@ -1330,7 +1341,8 @@ SYSCALL_DEFINE2(listen, int, fd, int, ba  @@ -1330,7 +1339,8 @@ SYSCALL_DEFINE2(listen, int, fd, int, ba
1242                          sockfd_put(sock);                          sockfd_put(sock);
1243                          return err;                          return err;
1244                  }                  }
# Line 1273  Source code for this patch is "apt-get i Line 1248  Source code for this patch is "apt-get i
1248                  err=sock->ops->listen(sock, backlog);                  err=sock->ops->listen(sock, backlog);
1249                  sockfd_put(sock);                  sockfd_put(sock);
1250          }          }
1251  @@ -1382,6 +1394,11 @@ SYSCALL_DEFINE3(accept, int, fd, struct  @@ -1361,6 +1371,7 @@ SYSCALL_DEFINE3(accept, int, fd, struct
1252            if (!sock)
1253                    goto out;
1254    
1255    +retry:
1256            err = -ENFILE;
1257            if (!(newsock = sock_alloc()))
1258                    goto out_put;
1259    @@ -1382,6 +1393,10 @@ SYSCALL_DEFINE3(accept, int, fd, struct
1260          if (err < 0)          if (err < 0)
1261                  goto out_release;                  goto out_release;
1262    
1263  +       if (ccs_socket_accept_permission(newsock,  +       if (ccs_socket_post_accept_permission(sock, newsock)) {
1264  +                                        (struct sockaddr *) address)) {  +               sock_release(newsock);
1265  +               err = -ECONNABORTED; /* Hope less harmful than -EPERM. */  +               goto retry;
 +               goto out_release;  
1266  +       }  +       }
1267          if (upeer_sockaddr) {          if (upeer_sockaddr) {
1268                  if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) {                  if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) {
1269                          err = -ECONNABORTED;                          err = -ECONNABORTED;
1270  @@ -1436,9 +1453,11 @@ SYSCALL_DEFINE3(connect, int, fd, struct  @@ -1436,9 +1451,11 @@ SYSCALL_DEFINE3(connect, int, fd, struct
1271                  goto out_put;                  goto out_put;
1272    
1273          err = security_socket_connect(sock, (struct sockaddr *)address, addrlen);          err = security_socket_connect(sock, (struct sockaddr *)address, addrlen);
# Line 1298  Source code for this patch is "apt-get i Line 1280  Source code for this patch is "apt-get i
1280          err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen,          err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen,
1281                                   sock->file->f_flags);                                   sock->file->f_flags);
1282   out_put:   out_put:
1283  --- linux-2.6.15-54.79.orig/net/unix/af_unix.c  --- linux-2.6.15-55.84.orig/net/unix/af_unix.c
1284  +++ linux-2.6.15-54.79/net/unix/af_unix.c  +++ linux-2.6.15-55.84/net/unix/af_unix.c
1285  @@ -117,6 +117,7 @@  @@ -117,6 +117,7 @@
1286   #include <linux/mount.h>   #include <linux/mount.h>
1287   #include <net/checksum.h>   #include <net/checksum.h>
# Line 1318  Source code for this patch is "apt-get i Line 1300  Source code for this patch is "apt-get i
1300                  err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);                  err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);
1301                  if (err)                  if (err)
1302                          goto out_mknod_dput;                          goto out_mknod_dput;
1303  --- linux-2.6.15-54.79.orig/security/Kconfig  --- linux-2.6.15-55.84.orig/security/Kconfig
1304  +++ linux-2.6.15-54.79/security/Kconfig  +++ linux-2.6.15-55.84/security/Kconfig
1305  @@ -94,5 +94,7 @@ config SECURITY_SECLVL  @@ -94,5 +94,7 @@ config SECURITY_SECLVL
1306    
1307   source security/selinux/Kconfig   source security/selinux/Kconfig
# Line 1328  Source code for this patch is "apt-get i Line 1310  Source code for this patch is "apt-get i
1310  +  +
1311   endmenu   endmenu
1312    
1313  --- linux-2.6.15-54.79.orig/security/Makefile  --- linux-2.6.15-55.84.orig/security/Makefile
1314  +++ linux-2.6.15-54.79/security/Makefile  +++ linux-2.6.15-55.84/security/Makefile
1315  @@ -19,3 +19,6 @@ obj-$(CONFIG_SECURITY_ROOTPLUG)               += comm  @@ -19,3 +19,6 @@ obj-$(CONFIG_SECURITY_ROOTPLUG)               += comm
1316   obj-$(CONFIG_SECURITY_REALTIME)                += commoncap.o realcap.o   obj-$(CONFIG_SECURITY_REALTIME)                += commoncap.o realcap.o
1317    

Legend:
Removed from v.2927  
changed lines
  Added in v.3856

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