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

Subversion リポジトリの参照

Diff of /trunk/1.8.x/ccs-patch/patches/ccs-patch-2.6.18-debian-etch.diff

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

trunk/1.7.x/ccs-patch/patches/ccs-patch-2.6.18-debian-etch.diff revision 3009 by kumaneko, Thu Sep 10 05:40:52 2009 UTC branches/ccs-patch/patches/ccs-patch-2.6.18-debian-etch.diff revision 3854 by kumaneko, Mon Jul 26 05:27:36 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                  |   10 +++++++++-
21   fs/open.c                       |   29 +++++++++++++++++++++++++++++   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 +++++++++
24   include/linux/sched.h           |    6 ++++++   include/linux/sched.h           |    6 ++++++
# Line 35  Source code for this patch is "apt-get i Line 34  Source code for this patch is "apt-get i
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/inet_hashtables.c      |    3 +++   net/ipv4/inet_hashtables.c      |    3 +++
37   net/ipv4/raw.c                  |    4 ++++   net/ipv4/raw.c                  |   12 +++++++++---
38   net/ipv4/udp.c                  |   10 +++++++++-   net/ipv4/udp.c                  |   16 ++++++++++++++--
39   net/ipv6/inet6_hashtables.c     |    5 ++++-   net/ipv6/inet6_hashtables.c     |    5 ++++-
40   net/ipv6/raw.c                  |    4 ++++   net/ipv6/raw.c                  |   12 +++++++++---
41   net/ipv6/udp.c                  |    8 ++++++++   net/ipv6/udp.c                  |   14 +++++++++++++-
42   net/socket.c                    |   25 +++++++++++++++++++++++--   net/socket.c                    |   24 ++++++++++++++++++++++--
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, 294 insertions(+), 9 deletions(-)   41 files changed, 289 insertions(+), 17 deletions(-)
47    
48  --- linux-2.6.18-24etch4.orig/arch/alpha/kernel/ptrace.c  --- linux-2.6.18-26etch2.orig/arch/alpha/kernel/ptrace.c
49  +++ linux-2.6.18-24etch4/arch/alpha/kernel/ptrace.c  +++ linux-2.6.18-26etch2/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.18-24etch4.orig/arch/ia64/ia32/sys_ia32.c  --- linux-2.6.18-26etch2.orig/arch/ia64/ia32/sys_ia32.c
68  +++ linux-2.6.18-24etch4/arch/ia64/ia32/sys_ia32.c  +++ linux-2.6.18-26etch2/arch/ia64/ia32/sys_ia32.c
69  @@ -56,6 +56,7 @@  @@ -56,6 +56,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.18-24etch4.orig/arch/ia64/kernel/ptrace.c  --- linux-2.6.18-26etch2.orig/arch/ia64/kernel/ptrace.c
87  +++ linux-2.6.18-24etch4/arch/ia64/kernel/ptrace.c  +++ linux-2.6.18-26etch2/arch/ia64/kernel/ptrace.c
88  @@ -28,6 +28,7 @@  @@ -28,6 +28,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.18-24etch4.orig/arch/m32r/kernel/ptrace.c  --- linux-2.6.18-26etch2.orig/arch/m32r/kernel/ptrace.c
106  +++ linux-2.6.18-24etch4/arch/m32r/kernel/ptrace.c  +++ linux-2.6.18-26etch2/arch/m32r/kernel/ptrace.c
107  @@ -32,6 +32,7 @@  @@ -32,6 +32,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          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
124  --- linux-2.6.18-24etch4.orig/arch/mips/kernel/ptrace32.c  --- linux-2.6.18-26etch2.orig/arch/mips/kernel/ptrace32.c
125  +++ linux-2.6.18-24etch4/arch/mips/kernel/ptrace32.c  +++ linux-2.6.18-26etch2/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.18-24etch4.orig/arch/powerpc/kernel/ptrace32.c  --- linux-2.6.18-26etch2.orig/arch/powerpc/kernel/ptrace32.c
144  +++ linux-2.6.18-24etch4/arch/powerpc/kernel/ptrace32.c  +++ linux-2.6.18-26etch2/arch/powerpc/kernel/ptrace32.c
145  @@ -32,6 +32,7 @@  @@ -32,6 +32,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;          int ret;
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.18-24etch4.orig/arch/s390/kernel/ptrace.c  --- linux-2.6.18-26etch2.orig/arch/s390/kernel/ptrace.c
163  +++ linux-2.6.18-24etch4/arch/s390/kernel/ptrace.c  +++ linux-2.6.18-26etch2/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          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
180                   ret = ptrace_traceme();                   ret = ptrace_traceme();
181  --- linux-2.6.18-24etch4.orig/arch/sparc/kernel/ptrace.c  --- linux-2.6.18-26etch2.orig/arch/sparc/kernel/ptrace.c
182  +++ linux-2.6.18-24etch4/arch/sparc/kernel/ptrace.c  +++ linux-2.6.18-26etch2/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.18-24etch4.orig/arch/sparc64/kernel/ptrace.c  --- linux-2.6.18-26etch2.orig/arch/sparc64/kernel/ptrace.c
203  +++ linux-2.6.18-24etch4/arch/sparc64/kernel/ptrace.c  +++ linux-2.6.18-26etch2/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.18-24etch4.orig/arch/x86_64/ia32/ptrace32.c  --- linux-2.6.18-26etch2.orig/arch/x86_64/ia32/ptrace32.c
224  +++ linux-2.6.18-24etch4/arch/x86_64/ia32/ptrace32.c  +++ linux-2.6.18-26etch2/arch/x86_64/ia32/ptrace32.c
225  @@ -26,6 +26,7 @@  @@ -26,6 +26,7 @@
226   #include <asm/i387.h>   #include <asm/i387.h>
227   #include <asm/fpu32.h>   #include <asm/fpu32.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          case PTRACE_TRACEME:          case PTRACE_TRACEME:
242  --- linux-2.6.18-24etch4.orig/fs/attr.c  --- linux-2.6.18-26etch2.orig/fs/compat.c
243  +++ linux-2.6.18-24etch4/fs/attr.c  +++ linux-2.6.18-26etch2/fs/compat.c
 @@ -15,6 +15,7 @@  
  #include <linux/fcntl.h>  
  #include <linux/quotaops.h>  
  #include <linux/security.h>  
 +#include <linux/ccsecurity.h>  
   
  /* Taken over from the old code... */  
   
 @@ -146,11 +147,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.18-24etch4.orig/fs/compat.c  
 +++ linux-2.6.18-24etch4/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.18-24etch4.orig/fs/exec.c  --- linux-2.6.18-26etch2.orig/fs/exec.c
282  +++ linux-2.6.18-24etch4/fs/exec.c  +++ linux-2.6.18-26etch2/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 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.18-24etch4.orig/fs/fcntl.c  --- linux-2.6.18-26etch2.orig/fs/fcntl.c
324  +++ linux-2.6.18-24etch4/fs/fcntl.c  +++ linux-2.6.18-26etch2/fs/fcntl.c
325  @@ -22,6 +22,7 @@  @@ -22,6 +22,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.18-24etch4.orig/fs/ioctl.c  --- linux-2.6.18-26etch2.orig/fs/ioctl.c
344  +++ linux-2.6.18-24etch4/fs/ioctl.c  +++ linux-2.6.18-26etch2/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 @@ asmlinkage long sys_ioctl(unsigned int f
   
         if (!filp->f_op)  
                 goto out;  
 +       if (!ccs_capable(CCS_SYS_IOCTL))  
 +               return -EPERM;  
   
         if (filp->f_op->unlocked_ioctl) {  
                 error = filp->f_op->unlocked_ioctl(filp, cmd, arg);  
 @@ -167,6 +170,8 @@ asmlinkage long sys_ioctl(unsigned int f  
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.18-24etch4.orig/fs/namei.c  --- linux-2.6.18-26etch2.orig/fs/namei.c
363  +++ linux-2.6.18-24etch4/fs/namei.c  +++ linux-2.6.18-26etch2/fs/namei.c
364  @@ -37,6 +37,8 @@  @@ -37,6 +37,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  @@ -1567,6 +1574,7 @@ int may_open(struct nameidata *nd, int a  @@ -1650,6 +1657,9 @@ do_last:
         return 0;  
  }  
   
 +#include <linux/ccsecurity_vfs.h>  
  /*  
   *     open_namei()  
   *  
 @@ -1650,6 +1658,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                  mutex_unlock(&dir->d_inode->i_mutex);                  mutex_unlock(&dir->d_inode->i_mutex);
394                  dput(nd->dentry);                  dput(nd->dentry);
395  @@ -1848,6 +1859,9 @@ asmlinkage long sys_mknodat(int dfd, con  @@ -1848,6 +1858,9 @@ asmlinkage long sys_mknodat(int dfd, con
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  @@ -1921,6 +1935,9 @@ asmlinkage long sys_mkdirat(int dfd, con  @@ -1921,6 +1934,9 @@ asmlinkage long sys_mkdirat(int dfd, con
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  @@ -2029,6 +2046,9 @@ static long do_rmdir(int dfd, const char  @@ -2029,6 +2045,9 @@ static long do_rmdir(int dfd, const char
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  @@ -2109,6 +2129,9 @@ static long do_unlinkat(int dfd, const c  @@ -2109,6 +2128,9 @@ static long do_unlinkat(int dfd, const c
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  @@ -2187,6 +2210,9 @@ asmlinkage long sys_symlinkat(const char  @@ -2187,6 +2209,9 @@ asmlinkage long sys_symlinkat(const char
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  @@ -2281,6 +2307,9 @@ asmlinkage long sys_linkat(int olddfd, c  @@ -2281,6 +2306,9 @@ asmlinkage long sys_linkat(int olddfd, c
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  @@ -2507,6 +2536,9 @@ static int do_rename(int olddfd, const c  @@ -2507,6 +2535,9 @@ static int do_rename(int olddfd, const c
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.18-24etch4.orig/fs/namespace.c  --- linux-2.6.18-26etch2.orig/fs/namespace.c
466  +++ linux-2.6.18-24etch4/fs/namespace.c  +++ linux-2.6.18-26etch2/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  @@ -553,6 +554,9 @@ static int do_umount(struct vfsmount *mn  @@ -550,6 +551,8 @@ static int do_umount(struct vfsmount *mn
476          if (retval)          LIST_HEAD(umount_list);
                 return retval;  
477    
478  +       if (ccs_may_umount(mnt))          retval = security_sb_umount(mnt, flags);
479  +               return -EPERM;  +       if (!retval)
480  +  +               retval = ccs_umount_permission(mnt, flags);
         /*  
          * Allow userspace to request a mountpoint be expired rather than  
          * unmounting unconditionally. Unmount only happens if:  
 @@ -641,6 +645,8 @@ asmlinkage long sys_umount(char __user *  
  {  
         struct nameidata nd;  
         int retval;  
 +       if (!ccs_capable(CCS_SYS_UMOUNT))  
 +               return -EPERM;  
   
         retval = __user_walk(name, LOOKUP_FOLLOW, &nd);  
481          if (retval)          if (retval)
482  @@ -925,6 +931,9 @@ static int do_loopback(struct nameidata                  return retval;
   
         if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))  
                 goto out;  
 +       err = -EPERM;  
 +       if (ccs_may_mount(nd))  
 +               goto out;  
483    
484          err = -ENOMEM;  @@ -1009,7 +1012,6 @@ static int do_move_mount(struct nameidat
         if (recurse)  
 @@ -1009,7 +1018,9 @@ static int do_move_mount(struct nameidat  
485          err = -EINVAL;          err = -EINVAL;
486          if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))          if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))
487                  goto out;                  goto out;
488  -  -
 +       err = -EPERM;  
 +       if (ccs_may_mount(nd))  
 +               goto out;  
489          err = -ENOENT;          err = -ENOENT;
490          mutex_lock(&nd->dentry->d_inode->i_mutex);          mutex_lock(&nd->dentry->d_inode->i_mutex);
491          if (IS_DEADDIR(nd->dentry->d_inode))          if (IS_DEADDIR(nd->dentry->d_inode))
492  @@ -1111,6 +1122,9 @@ int do_add_mount(struct vfsmount *newmnt  @@ -1384,6 +1386,7 @@ int copy_mount_options(const void __user
493          err = -EINVAL;   long do_mount(char *dev_name, char *dir_name, char *type_page,
494          if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))                    unsigned long flags, void *data_page)
495                  goto unlock;   {
496  +       err = -EPERM;  +       const unsigned long original_flags = flags;
497  +       if (ccs_may_mount(nd))          struct nameidata nd;
498  +               goto unlock;          int retval = 0;
499            int mnt_flags = 0;
500          newmnt->mnt_flags = mnt_flags;  @@ -1423,6 +1426,9 @@ long do_mount(char *dev_name, char *dir_
501          if ((err = graft_tree(newmnt, nd)))                  return retval;
 @@ -1402,6 +1416,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;  
 @@ -1691,6 +1709,8 @@ asmlinkage long sys_pivot_root(const cha  
   
         if (!capable(CAP_SYS_ADMIN))  
                 return -EPERM;  
 +       if (!ccs_capable(CCS_SYS_PIVOT_ROOT))  
 +               return -EPERM;  
502    
503          lock_kernel();          retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page);
504    +       if (!retval)
505    +               retval = ccs_mount_permission(dev_name, &nd, type_page,
506    +                                             original_flags, data_page);
507            if (retval)
508                    goto dput_out;
509    
510  @@ -1707,6 +1727,8 @@ asmlinkage long sys_pivot_root(const cha  @@ -1707,6 +1713,8 @@ asmlinkage long sys_pivot_root(const cha
511                  goto out1;                  goto out1;
512    
513          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 516  Source code for this patch is "apt-get i
516          if (error) {          if (error) {
517                  path_release(&old_nd);                  path_release(&old_nd);
518                  goto out1;                  goto out1;
519  --- linux-2.6.18-24etch4.orig/fs/open.c  --- linux-2.6.18-26etch2.orig/fs/open.c
520  +++ linux-2.6.18-24etch4/fs/open.c  +++ linux-2.6.18-26etch2/fs/open.c
521  @@ -30,6 +30,7 @@  @@ -30,6 +30,7 @@
522   #include <linux/audit.h>   #include <linux/audit.h>
523    
# Line 609  Source code for this patch is "apt-get i Line 530  Source code for this patch is "apt-get i
530          if (error)          if (error)
531                  goto dput_and_out;                  goto dput_and_out;
532    
533  +       error = ccs_truncate_permission(nd.dentry, nd.mnt, length, 0);  +       error = ccs_truncate_permission(nd.dentry, nd.mnt);
534  +       if (!error)  +       if (!error)
535          error = locks_verify_truncate(inode, NULL, length);          error = locks_verify_truncate(inode, NULL, length);
536          if (!error) {          if (!error) {
# Line 618  Source code for this patch is "apt-get i Line 539  Source code for this patch is "apt-get i
539          if (IS_APPEND(inode))          if (IS_APPEND(inode))
540                  goto out_putf;                  goto out_putf;
541    
542  +       error = ccs_truncate_permission(dentry, file->f_vfsmnt, length, 0);  +       error = ccs_truncate_permission(dentry, file->f_vfsmnt);
543  +       if (error)  +       if (error)
544  +               goto out_putf;  +               goto out_putf;
545          error = locks_verify_truncate(inode, file, length);          error = locks_verify_truncate(inode, file, length);
546          if (!error)          if (!error)
547                  error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);                  error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
548  @@ -608,6 +614,10 @@ asmlinkage long sys_chroot(const char __  @@ -608,6 +614,8 @@ asmlinkage long sys_chroot(const char __
549          error = -EPERM;          error = -EPERM;
550          if (!capable(CAP_SYS_CHROOT))          if (!capable(CAP_SYS_CHROOT))
551                  goto dput_and_out;                  goto dput_and_out;
 +       if (!ccs_capable(CCS_SYS_CHROOT))  
 +               goto dput_and_out;  
552  +       if (ccs_chroot_permission(&nd))  +       if (ccs_chroot_permission(&nd))
553  +               goto dput_and_out;  +               goto dput_and_out;
554    
555          set_fs_root(current->fs, nd.mnt, nd.dentry);          set_fs_root(current->fs, nd.mnt, nd.dentry);
556          set_fs_altroot();          set_fs_altroot();
557  @@ -641,6 +651,9 @@ asmlinkage long sys_fchmod(unsigned int  @@ -641,6 +649,9 @@ asmlinkage long sys_fchmod(unsigned int
558          err = -EPERM;          err = -EPERM;
559          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
560                  goto out_putf;                  goto out_putf;
# Line 645  Source code for this patch is "apt-get i Line 564  Source code for this patch is "apt-get i
564          mutex_lock(&inode->i_mutex);          mutex_lock(&inode->i_mutex);
565          if (mode == (mode_t) -1)          if (mode == (mode_t) -1)
566                  mode = inode->i_mode;                  mode = inode->i_mode;
567  @@ -675,6 +688,9 @@ asmlinkage long sys_fchmodat(int dfd, co  @@ -675,6 +686,9 @@ asmlinkage long sys_fchmodat(int dfd, co
568          error = -EPERM;          error = -EPERM;
569          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))          if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
570                  goto dput_and_out;                  goto dput_and_out;
# Line 655  Source code for this patch is "apt-get i Line 574  Source code for this patch is "apt-get i
574    
575          mutex_lock(&inode->i_mutex);          mutex_lock(&inode->i_mutex);
576          if (mode == (mode_t) -1)          if (mode == (mode_t) -1)
577  @@ -737,6 +753,8 @@ asmlinkage long sys_chown(const char __u  @@ -737,6 +751,8 @@ asmlinkage long sys_chown(const char __u
578    
579          error = user_path_walk(filename, &nd);          error = user_path_walk(filename, &nd);
580          if (!error) {          if (!error) {
# Line 664  Source code for this patch is "apt-get i Line 583  Source code for this patch is "apt-get i
583                  error = chown_common(nd.dentry, user, group);                  error = chown_common(nd.dentry, user, group);
584                  path_release(&nd);                  path_release(&nd);
585          }          }
586  @@ -756,6 +774,8 @@ asmlinkage long sys_fchownat(int dfd, co  @@ -756,6 +772,8 @@ asmlinkage long sys_fchownat(int dfd, co
587          follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;          follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW;
588          error = __user_walk_fd(dfd, filename, follow, &nd);          error = __user_walk_fd(dfd, filename, follow, &nd);
589          if (!error) {          if (!error) {
# Line 673  Source code for this patch is "apt-get i Line 592  Source code for this patch is "apt-get i
592                  error = chown_common(nd.dentry, user, group);                  error = chown_common(nd.dentry, user, group);
593                  path_release(&nd);                  path_release(&nd);
594          }          }
595  @@ -770,6 +790,8 @@ asmlinkage long sys_lchown(const char __  @@ -770,6 +788,8 @@ asmlinkage long sys_lchown(const char __
596    
597          error = user_path_walk_link(filename, &nd);          error = user_path_walk_link(filename, &nd);
598          if (!error) {          if (!error) {
# Line 682  Source code for this patch is "apt-get i Line 601  Source code for this patch is "apt-get i
601                  error = chown_common(nd.dentry, user, group);                  error = chown_common(nd.dentry, user, group);
602                  path_release(&nd);                  path_release(&nd);
603          }          }
604  @@ -787,6 +809,9 @@ asmlinkage long sys_fchown(unsigned int  @@ -787,6 +807,9 @@ asmlinkage long sys_fchown(unsigned int
605                  struct dentry * dentry;                  struct dentry * dentry;
606                  dentry = file->f_dentry;                  dentry = file->f_dentry;
607                  audit_inode(NULL, dentry->d_inode);                  audit_inode(NULL, dentry->d_inode);
# Line 692  Source code for this patch is "apt-get i Line 611  Source code for this patch is "apt-get i
611                  error = chown_common(dentry, user, group);                  error = chown_common(dentry, user, group);
612                  fput(file);                  fput(file);
613          }          }
614  @@ -879,7 +904,9 @@ static struct file *do_filp_open(int dfd  @@ -879,7 +902,9 @@ static struct file *do_filp_open(int dfd
615          if ((namei_flags+1) & O_ACCMODE)          if ((namei_flags+1) & O_ACCMODE)
616                  namei_flags++;                  namei_flags++;
617    
# Line 702  Source code for this patch is "apt-get i Line 621  Source code for this patch is "apt-get i
621          if (!error)          if (!error)
622                  return nameidata_to_filp(&nd, flags);                  return nameidata_to_filp(&nd, flags);
623    
624  @@ -1199,6 +1226,8 @@ EXPORT_SYMBOL(sys_close);  @@ -1199,6 +1224,8 @@ EXPORT_SYMBOL(sys_close);
625    */    */
626   asmlinkage long sys_vhangup(void)   asmlinkage long sys_vhangup(void)
627   {   {
# Line 711  Source code for this patch is "apt-get i Line 630  Source code for this patch is "apt-get i
630          if (capable(CAP_SYS_TTY_CONFIG)) {          if (capable(CAP_SYS_TTY_CONFIG)) {
631                  tty_vhangup(current->signal->tty);                  tty_vhangup(current->signal->tty);
632                  return 0;                  return 0;
633  --- linux-2.6.18-24etch4.orig/fs/proc/proc_misc.c  --- linux-2.6.18-26etch2.orig/fs/proc/proc_misc.c
634  +++ linux-2.6.18-24etch4/fs/proc/proc_misc.c  +++ linux-2.6.18-26etch2/fs/proc/proc_misc.c
635  @@ -723,4 +723,5 @@ void __init proc_misc_init(void)  @@ -723,4 +723,5 @@ void __init proc_misc_init(void)
636          if (entry)          if (entry)
637                  entry->proc_fops = &proc_sysrq_trigger_operations;                  entry->proc_fops = &proc_sysrq_trigger_operations;
638   #endif   #endif
639  +       printk(KERN_INFO "Hook version: 2.6.18-24etch4 2009/09/10\n");  +       printk(KERN_INFO "Hook version: 2.6.18-26etch2 2010/07/26\n");
640   }   }
641  --- linux-2.6.18-24etch4.orig/include/linux/init_task.h  --- linux-2.6.18-26etch2.orig/include/linux/init_task.h
642  +++ linux-2.6.18-24etch4/include/linux/init_task.h  +++ linux-2.6.18-26etch2/include/linux/init_task.h
643  @@ -76,6 +76,14 @@  @@ -76,6 +76,14 @@
644    
645   extern struct group_info init_groups;   extern struct group_info init_groups;
# Line 744  Source code for this patch is "apt-get i Line 663  Source code for this patch is "apt-get i
663   }   }
664    
665    
666  --- linux-2.6.18-24etch4.orig/include/linux/sched.h  --- linux-2.6.18-26etch2.orig/include/linux/sched.h
667  +++ linux-2.6.18-24etch4/include/linux/sched.h  +++ linux-2.6.18-26etch2/include/linux/sched.h
668  @@ -25,6 +25,8 @@  @@ -35,6 +35,8 @@
669   #define CLONE_CHILD_SETTID     0x01000000      /* set the TID in the child */  
670   #define CLONE_STOPPED          0x02000000      /* Start in stopped state */   #ifdef __KERNEL__
671    
672  +struct ccs_domain_info;  +struct ccs_domain_info;
673  +  +
674   /*   struct sched_param {
675    * Scheduling policies          int sched_priority;
676    */   };
677  @@ -996,6 +998,10 @@ struct task_struct {  @@ -996,6 +998,10 @@ struct task_struct {
678   #ifdef CONFIG_TASK_DELAY_ACCT   #ifdef CONFIG_TASK_DELAY_ACCT
679          struct task_delay_info *delays;          struct task_delay_info *delays;
# Line 766  Source code for this patch is "apt-get i Line 685  Source code for this patch is "apt-get i
685   };   };
686    
687   static inline pid_t process_group(struct task_struct *tsk)   static inline pid_t process_group(struct task_struct *tsk)
688  --- linux-2.6.18-24etch4.orig/kernel/compat.c  --- linux-2.6.18-26etch2.orig/kernel/compat.c
689  +++ linux-2.6.18-24etch4/kernel/compat.c  +++ linux-2.6.18-26etch2/kernel/compat.c
690  @@ -24,6 +24,7 @@  @@ -24,6 +24,7 @@
691   #include <linux/migrate.h>   #include <linux/migrate.h>
692    
# Line 785  Source code for this patch is "apt-get i Line 704  Source code for this patch is "apt-get i
704    
705          do_settimeofday(&tv);          do_settimeofday(&tv);
706          return 0;          return 0;
707  --- linux-2.6.18-24etch4.orig/kernel/kexec.c  --- linux-2.6.18-26etch2.orig/kernel/kexec.c
708  +++ linux-2.6.18-24etch4/kernel/kexec.c  +++ linux-2.6.18-26etch2/kernel/kexec.c
709  @@ -26,6 +26,7 @@  @@ -26,6 +26,7 @@
710   #include <asm/io.h>   #include <asm/io.h>
711   #include <asm/system.h>   #include <asm/system.h>
# Line 804  Source code for this patch is "apt-get i Line 723  Source code for this patch is "apt-get i
723    
724          /*          /*
725           * Verify we have a legal set of flags           * Verify we have a legal set of flags
726  --- linux-2.6.18-24etch4.orig/kernel/kmod.c  --- linux-2.6.18-26etch2.orig/kernel/kmod.c
727  +++ linux-2.6.18-24etch4/kernel/kmod.c  +++ linux-2.6.18-26etch2/kernel/kmod.c
728  @@ -148,6 +148,11 @@ static int ____call_usermodehelper(void  @@ -148,6 +148,11 @@ static int ____call_usermodehelper(void
729          /* We can run anywhere, unlike our parent keventd(). */          /* We can run anywhere, unlike our parent keventd(). */
730          set_cpus_allowed(current, CPU_MASK_ALL);          set_cpus_allowed(current, CPU_MASK_ALL);
# Line 818  Source code for this patch is "apt-get i Line 737  Source code for this patch is "apt-get i
737          retval = -EPERM;          retval = -EPERM;
738          if (current->fs->root)          if (current->fs->root)
739                  retval = execve(sub_info->path, sub_info->argv,sub_info->envp);                  retval = execve(sub_info->path, sub_info->argv,sub_info->envp);
740  --- linux-2.6.18-24etch4.orig/kernel/module.c  --- linux-2.6.18-26etch2.orig/kernel/module.c
741  +++ linux-2.6.18-24etch4/kernel/module.c  +++ linux-2.6.18-26etch2/kernel/module.c
742  @@ -44,6 +44,7 @@  @@ -44,6 +44,7 @@
743   #include <asm/semaphore.h>   #include <asm/semaphore.h>
744   #include <asm/cacheflush.h>   #include <asm/cacheflush.h>
# Line 848  Source code for this patch is "apt-get i Line 767  Source code for this patch is "apt-get i
767          /* Only one module load at a time, please */          /* Only one module load at a time, please */
768          if (mutex_lock_interruptible(&module_mutex) != 0)          if (mutex_lock_interruptible(&module_mutex) != 0)
769                  return -EINTR;                  return -EINTR;
770  --- linux-2.6.18-24etch4.orig/kernel/ptrace.c  --- linux-2.6.18-26etch2.orig/kernel/ptrace.c
771  +++ linux-2.6.18-24etch4/kernel/ptrace.c  +++ linux-2.6.18-26etch2/kernel/ptrace.c
772  @@ -21,6 +21,7 @@  @@ -21,6 +21,7 @@
773    
774   #include <asm/pgtable.h>   #include <asm/pgtable.h>
# Line 862  Source code for this patch is "apt-get i Line 781  Source code for this patch is "apt-get i
781          /*          /*
782           * This lock_kernel fixes a subtle race with suid exec           * This lock_kernel fixes a subtle race with suid exec
783           */           */
784  +       if (!ccs_capable(CCS_SYS_PTRACE))  +       if (ccs_ptrace_permission(request, pid))
785  +               return -EPERM;  +               return -EPERM;
786          lock_kernel();          lock_kernel();
787          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
788                  ret = ptrace_traceme();                  ret = ptrace_traceme();
789  --- linux-2.6.18-24etch4.orig/kernel/sched.c  --- linux-2.6.18-26etch2.orig/kernel/sched.c
790  +++ linux-2.6.18-24etch4/kernel/sched.c  +++ linux-2.6.18-26etch2/kernel/sched.c
791  @@ -55,6 +55,7 @@  @@ -55,6 +55,7 @@
792   #include <asm/tlb.h>   #include <asm/tlb.h>
793    
# Line 886  Source code for this patch is "apt-get i Line 805  Source code for this patch is "apt-get i
805    
806          /*          /*
807           * Setpriority might change our priority at the same moment.           * Setpriority might change our priority at the same moment.
808  --- linux-2.6.18-24etch4.orig/kernel/signal.c  --- linux-2.6.18-26etch2.orig/kernel/signal.c
809  +++ linux-2.6.18-24etch4/kernel/signal.c  +++ linux-2.6.18-26etch2/kernel/signal.c
810  @@ -28,6 +28,7 @@  @@ -28,6 +28,7 @@
811   #include <asm/unistd.h>   #include <asm/unistd.h>
812   #include <asm/siginfo.h>   #include <asm/siginfo.h>
# Line 932  Source code for this patch is "apt-get i Line 851  Source code for this patch is "apt-get i
851    
852          /* POSIX.1b doesn't mention process groups.  */          /* POSIX.1b doesn't mention process groups.  */
853          return kill_proc_info(sig, &info, pid);          return kill_proc_info(sig, &info, pid);
854  --- linux-2.6.18-24etch4.orig/kernel/sys.c  --- linux-2.6.18-26etch2.orig/kernel/sys.c
855  +++ linux-2.6.18-24etch4/kernel/sys.c  +++ linux-2.6.18-26etch2/kernel/sys.c
856  @@ -36,6 +36,7 @@  @@ -36,6 +36,7 @@
857   #include <asm/uaccess.h>   #include <asm/uaccess.h>
858   #include <asm/io.h>   #include <asm/io.h>
# Line 980  Source code for this patch is "apt-get i Line 899  Source code for this patch is "apt-get i
899    
900          down_write(&uts_sem);          down_write(&uts_sem);
901          errno = -EFAULT;          errno = -EFAULT;
902  --- linux-2.6.18-24etch4.orig/kernel/sysctl.c  --- linux-2.6.18-26etch2.orig/kernel/sysctl.c
903  +++ linux-2.6.18-24etch4/kernel/sysctl.c  +++ linux-2.6.18-26etch2/kernel/sysctl.c
904  @@ -48,6 +48,7 @@  @@ -48,6 +48,7 @@
905    
906   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 1014  Source code for this patch is "apt-get i Line 933  Source code for this patch is "apt-get i
933                                          error = table->strategy(                                          error = table->strategy(
934                                                  table, name, nlen,                                                  table, name, nlen,
935                                                  oldval, oldlenp,                                                  oldval, oldlenp,
936  --- linux-2.6.18-24etch4.orig/kernel/time.c  --- linux-2.6.18-26etch2.orig/kernel/time.c
937  +++ linux-2.6.18-24etch4/kernel/time.c  +++ linux-2.6.18-26etch2/kernel/time.c
938  @@ -39,6 +39,7 @@  @@ -39,6 +39,7 @@
939    
940   #include <asm/uaccess.h>   #include <asm/uaccess.h>
# Line 1051  Source code for this patch is "apt-get i Line 970  Source code for this patch is "apt-get i
970                                    
971          /* Now we validate the data before disabling interrupts */          /* Now we validate the data before disabling interrupts */
972    
973  --- linux-2.6.18-24etch4.orig/net/ipv4/inet_connection_sock.c  --- linux-2.6.18-26etch2.orig/net/ipv4/inet_connection_sock.c
974  +++ linux-2.6.18-24etch4/net/ipv4/inet_connection_sock.c  +++ linux-2.6.18-26etch2/net/ipv4/inet_connection_sock.c
975  @@ -23,6 +23,7 @@  @@ -23,6 +23,7 @@
976   #include <net/route.h>   #include <net/route.h>
977   #include <net/tcp_states.h>   #include <net/tcp_states.h>
# Line 1070  Source code for this patch is "apt-get i Line 989  Source code for this patch is "apt-get i
989                          inet_bind_bucket_for_each(tb, node, &head->chain)                          inet_bind_bucket_for_each(tb, node, &head->chain)
990                                  if (tb->port == rover)                                  if (tb->port == rover)
991                                          goto next;                                          goto next;
992  --- linux-2.6.18-24etch4.orig/net/ipv4/inet_hashtables.c  --- linux-2.6.18-26etch2.orig/net/ipv4/inet_hashtables.c
993  +++ linux-2.6.18-24etch4/net/ipv4/inet_hashtables.c  +++ linux-2.6.18-26etch2/net/ipv4/inet_hashtables.c
994  @@ -22,6 +22,7 @@  @@ -22,6 +22,7 @@
995   #include <net/inet_connection_sock.h>   #include <net/inet_connection_sock.h>
996   #include <net/inet_hashtables.h>   #include <net/inet_hashtables.h>
# Line 1089  Source code for this patch is "apt-get i Line 1008  Source code for this patch is "apt-get i
1008                          head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];                          head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];
1009                          spin_lock(&head->lock);                          spin_lock(&head->lock);
1010    
1011  --- linux-2.6.18-24etch4.orig/net/ipv4/raw.c  --- linux-2.6.18-26etch2.orig/net/ipv4/raw.c
1012  +++ linux-2.6.18-24etch4/net/ipv4/raw.c  +++ linux-2.6.18-26etch2/net/ipv4/raw.c
1013  @@ -79,6 +79,7 @@  @@ -79,6 +79,7 @@
1014   #include <linux/seq_file.h>   #include <linux/seq_file.h>
1015   #include <linux/netfilter.h>   #include <linux/netfilter.h>
# Line 1099  Source code for this patch is "apt-get i Line 1018  Source code for this patch is "apt-get i
1018    
1019   struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE];   struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE];
1020   DEFINE_RWLOCK(raw_v4_lock);   DEFINE_RWLOCK(raw_v4_lock);
1021  @@ -592,6 +593,9 @@ static int raw_recvmsg(struct kiocb *ioc  @@ -589,9 +590,14 @@ static int raw_recvmsg(struct kiocb *ioc
         skb = skb_recv_datagram(sk, flags, noblock, &err);  
         if (!skb)  
1022                  goto out;                  goto out;
1023  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);          }
1024  +       if (err)  
1025  +               goto out;  -       skb = skb_recv_datagram(sk, flags, noblock, &err);
1026    -       if (!skb)
1027    -               goto out;
1028    +       for (;;) {
1029    +               skb = skb_recv_datagram(sk, flags, noblock, &err);
1030    +               if (!skb)
1031    +                       goto out;
1032    +               if (!ccs_socket_post_recvmsg_permission(sk, skb))
1033    +                       break;
1034    +               skb_kill_datagram(sk, skb, flags);
1035    +       }
1036    
1037          copied = skb->len;          copied = skb->len;
1038          if (len < copied) {          if (len < copied) {
1039  --- linux-2.6.18-24etch4.orig/net/ipv4/udp.c  --- linux-2.6.18-26etch2.orig/net/ipv4/udp.c
1040  +++ linux-2.6.18-24etch4/net/ipv4/udp.c  +++ linux-2.6.18-26etch2/net/ipv4/udp.c
1041  @@ -108,6 +108,7 @@  @@ -108,6 +108,7 @@
1042   #include <net/inet_common.h>   #include <net/inet_common.h>
1043   #include <net/checksum.h>   #include <net/checksum.h>
# Line 1137  Source code for this patch is "apt-get i Line 1064  Source code for this patch is "apt-get i
1064                          if (!udp_lport_inuse(result))                          if (!udp_lport_inuse(result))
1065                                  break;                                  break;
1066                  }                  }
1067  @@ -796,7 +801,10 @@ try_again:  @@ -782,6 +787,7 @@ static int udp_recvmsg(struct kiocb *ioc
1068            struct sockaddr_in *sin = (struct sockaddr_in *)msg->msg_name;
1069            struct sk_buff *skb;
1070            int copied, err;
1071    +       _Bool update_stat;
1072    
1073            /*
1074             *      Check any passed addresses
1075    @@ -796,7 +802,12 @@ try_again:
1076          skb = skb_recv_datagram(sk, flags, noblock, &err);          skb = skb_recv_datagram(sk, flags, noblock, &err);
1077          if (!skb)          if (!skb)
1078                  goto out;                  goto out;
1079  -    -  
1080  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
1081  +       if (err)  +               update_stat = 0;
1082  +               goto out;  +               goto csum_copy_err;
1083    +       }
1084    +       update_stat = 1;
1085  +  +
1086          copied = skb->len - sizeof(struct udphdr);          copied = skb->len - sizeof(struct udphdr);
1087          if (copied > len) {          if (copied > len) {
1088                  copied = len;                  copied = len;
1089  --- linux-2.6.18-24etch4.orig/net/ipv6/inet6_hashtables.c  @@ -844,7 +855,8 @@ out:
1090  +++ linux-2.6.18-24etch4/net/ipv6/inet6_hashtables.c          return err;
1091    
1092     csum_copy_err:
1093    -       UDP_INC_STATS_BH(UDP_MIB_INERRORS);
1094    +       if (update_stat)
1095    +               UDP_INC_STATS_BH(UDP_MIB_INERRORS);
1096    
1097            skb_kill_datagram(sk, skb, flags);
1098    
1099    --- linux-2.6.18-26etch2.orig/net/ipv6/inet6_hashtables.c
1100    +++ linux-2.6.18-26etch2/net/ipv6/inet6_hashtables.c
1101  @@ -21,6 +21,7 @@  @@ -21,6 +21,7 @@
1102   #include <net/inet_hashtables.h>   #include <net/inet_hashtables.h>
1103   #include <net/inet6_hashtables.h>   #include <net/inet6_hashtables.h>
# Line 1177  Source code for this patch is "apt-get i Line 1124  Source code for this patch is "apt-get i
1124                          head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];                          head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)];
1125                          spin_lock(&head->lock);                          spin_lock(&head->lock);
1126    
1127  --- linux-2.6.18-24etch4.orig/net/ipv6/raw.c  --- linux-2.6.18-26etch2.orig/net/ipv6/raw.c
1128  +++ linux-2.6.18-24etch4/net/ipv6/raw.c  +++ linux-2.6.18-26etch2/net/ipv6/raw.c
1129  @@ -56,6 +56,7 @@  @@ -56,6 +56,7 @@
1130    
1131   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
# Line 1187  Source code for this patch is "apt-get i Line 1134  Source code for this patch is "apt-get i
1134    
1135   struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE];   struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE];
1136   DEFINE_RWLOCK(raw_v6_lock);   DEFINE_RWLOCK(raw_v6_lock);
1137  @@ -387,6 +388,9 @@ static int rawv6_recvmsg(struct kiocb *i  @@ -384,9 +385,14 @@ static int rawv6_recvmsg(struct kiocb *i
1138          skb = skb_recv_datagram(sk, flags, noblock, &err);          if (flags & MSG_ERRQUEUE)
1139          if (!skb)                  return ipv6_recv_error(sk, msg, len);
1140                  goto out;  
1141  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  -       skb = skb_recv_datagram(sk, flags, noblock, &err);
1142  +       if (err)  -       if (!skb)
1143  +               goto out;  -               goto out;
1144    +       for (;;) {
1145    +               skb = skb_recv_datagram(sk, flags, noblock, &err);
1146    +               if (!skb)
1147    +                       goto out;
1148    +               if (!ccs_socket_post_recvmsg_permission(sk, skb))
1149    +                       break;
1150    +               skb_kill_datagram(sk, skb, flags);
1151    +       }
1152    
1153          copied = skb->len;          copied = skb->len;
1154          if (copied > len) {          if (copied > len) {
1155  --- linux-2.6.18-24etch4.orig/net/ipv6/udp.c  --- linux-2.6.18-26etch2.orig/net/ipv6/udp.c
1156  +++ linux-2.6.18-24etch4/net/ipv6/udp.c  +++ linux-2.6.18-26etch2/net/ipv6/udp.c
1157  @@ -58,6 +58,7 @@  @@ -58,6 +58,7 @@
1158    
1159   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
# Line 1225  Source code for this patch is "apt-get i Line 1180  Source code for this patch is "apt-get i
1180                          if (!udp_lport_inuse(result))                          if (!udp_lport_inuse(result))
1181                                  break;                                  break;
1182                  }                  }
1183  @@ -237,6 +242,9 @@ try_again:  @@ -226,6 +231,7 @@ static int udpv6_recvmsg(struct kiocb *i
1184            struct sk_buff *skb;
1185            size_t copied;
1186            int err;
1187    +       _Bool update_stat;
1188    
1189            if (addr_len)
1190                    *addr_len=sizeof(struct sockaddr_in6);
1191    @@ -237,6 +243,11 @@ try_again:
1192          skb = skb_recv_datagram(sk, flags, noblock, &err);          skb = skb_recv_datagram(sk, flags, noblock, &err);
1193          if (!skb)          if (!skb)
1194                  goto out;                  goto out;
1195  +       err = ccs_socket_recvmsg_permission(sk, skb, flags);  +       if (ccs_socket_post_recvmsg_permission(sk, skb)) {
1196  +       if (err)  +               update_stat = 0;
1197  +               goto out;  +               goto csum_copy_err;
1198    +       }
1199    +       update_stat = 1;
1200    
1201          copied = skb->len - sizeof(struct udphdr);          copied = skb->len - sizeof(struct udphdr);
1202          if (copied > len) {          if (copied > len) {
1203  --- linux-2.6.18-24etch4.orig/net/socket.c  @@ -303,7 +314,8 @@ csum_copy_err:
1204  +++ linux-2.6.18-24etch4/net/socket.c          skb_kill_datagram(sk, skb, flags);
1205    
1206            if (flags & MSG_DONTWAIT) {
1207    -               UDP6_INC_STATS_USER(UDP_MIB_INERRORS);
1208    +               if (update_stat)
1209    +                       UDP6_INC_STATS_USER(UDP_MIB_INERRORS);
1210                    return -EAGAIN;
1211            }
1212            goto try_again;
1213    --- linux-2.6.18-26etch2.orig/net/socket.c
1214    +++ linux-2.6.18-26etch2/net/socket.c
1215  @@ -94,6 +94,8 @@  @@ -94,6 +94,8 @@
1216   #include <net/sock.h>   #include <net/sock.h>
1217   #include <linux/netfilter.h>   #include <linux/netfilter.h>
# Line 1246  Source code for this patch is "apt-get i Line 1221  Source code for this patch is "apt-get i
1221   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
1222   static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf,   static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf,
1223                           size_t size, loff_t pos);                           size_t size, loff_t pos);
1224  @@ -590,9 +592,12 @@ static inline int __sock_sendmsg(struct  @@ -590,9 +592,10 @@ static inline int __sock_sendmsg(struct
1225          si->size = size;          si->size = size;
1226    
1227          err = security_socket_sendmsg(sock, msg, size);          err = security_socket_sendmsg(sock, msg, size);
1228  +       if (!err)  +       if (!err)
1229  +               err = ccs_socket_sendmsg_permission(sock, (struct sockaddr *)  +               err = ccs_socket_sendmsg_permission(sock, msg, size);
 +                                                   msg->msg_name,  
 +                                                   msg->msg_namelen);  
1230          if (err)          if (err)
1231                  return err;                  return err;
1232  -  -
1233          return sock->ops->sendmsg(iocb, sock, msg, size);          return sock->ops->sendmsg(iocb, sock, msg, size);
1234   }   }
1235    
1236  @@ -1149,6 +1154,8 @@ static int __sock_create(int family, int  @@ -1149,6 +1152,8 @@ static int __sock_create(int family, int
1237          }          }
1238    
1239          err = security_socket_create(family, type, protocol, kern);          err = security_socket_create(family, type, protocol, kern);
# Line 1269  Source code for this patch is "apt-get i Line 1242  Source code for this patch is "apt-get i
1242          if (err)          if (err)
1243                  return err;                  return err;
1244                                    
1245  @@ -1343,6 +1350,11 @@ asmlinkage long sys_bind(int fd, struct  @@ -1343,6 +1348,11 @@ asmlinkage long sys_bind(int fd, struct
1246                  if((err=move_addr_to_kernel(umyaddr,addrlen,address))>=0) {                  if((err=move_addr_to_kernel(umyaddr,addrlen,address))>=0) {
1247                          err = security_socket_bind(sock, (struct sockaddr *)address, addrlen);                          err = security_socket_bind(sock, (struct sockaddr *)address, addrlen);
1248                          if (!err)                          if (!err)
# Line 1281  Source code for this patch is "apt-get i Line 1254  Source code for this patch is "apt-get i
1254                                  err = sock->ops->bind(sock,                                  err = sock->ops->bind(sock,
1255                                          (struct sockaddr *)address, addrlen);                                          (struct sockaddr *)address, addrlen);
1256                  }                  }
1257  @@ -1371,6 +1383,8 @@ asmlinkage long sys_listen(int fd, int b  @@ -1371,6 +1381,8 @@ asmlinkage long sys_listen(int fd, int b
1258    
1259                  err = security_socket_listen(sock, backlog);                  err = security_socket_listen(sock, backlog);
1260                  if (!err)                  if (!err)
# Line 1290  Source code for this patch is "apt-get i Line 1263  Source code for this patch is "apt-get i
1263                          err = sock->ops->listen(sock, backlog);                          err = sock->ops->listen(sock, backlog);
1264    
1265                  fput_light(sock->file, fput_needed);                  fput_light(sock->file, fput_needed);
1266  @@ -1434,6 +1448,11 @@ asmlinkage long sys_accept(int fd, struc  @@ -1402,6 +1414,7 @@ asmlinkage long sys_accept(int fd, struc
1267            if (!sock)
1268                    goto out;
1269    
1270    +retry:
1271            err = -ENFILE;
1272            if (!(newsock = sock_alloc()))
1273                    goto out_put;
1274    @@ -1434,6 +1447,11 @@ asmlinkage long sys_accept(int fd, struc
1275          if (err < 0)          if (err < 0)
1276                  goto out_fd;                  goto out_fd;
1277    
1278  +       if (ccs_socket_accept_permission(newsock,  +       if (ccs_socket_post_accept_permission(sock, newsock)) {
1279  +                                        (struct sockaddr *) address)) {  +               fput(newfile);
1280  +               err = -ECONNABORTED; /* Hope less harmful than -EPERM. */  +               put_unused_fd(newfd);
1281  +               goto out_fd;  +               goto retry;
1282  +       }  +       }
1283          if (upeer_sockaddr) {          if (upeer_sockaddr) {
1284                  if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) {                  if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) {
1285                          err = -ECONNABORTED;                          err = -ECONNABORTED;
1286  @@ -1488,9 +1507,11 @@ asmlinkage long sys_connect(int fd, stru  @@ -1488,9 +1506,11 @@ asmlinkage long sys_connect(int fd, stru
1287                  goto out_put;                  goto out_put;
1288    
1289          err = security_socket_connect(sock, (struct sockaddr *)address, addrlen);          err = security_socket_connect(sock, (struct sockaddr *)address, addrlen);
# Line 1315  Source code for this patch is "apt-get i Line 1296  Source code for this patch is "apt-get i
1296          err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen,          err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen,
1297                                   sock->file->f_flags);                                   sock->file->f_flags);
1298   out_put:   out_put:
1299  --- linux-2.6.18-24etch4.orig/net/unix/af_unix.c  --- linux-2.6.18-26etch2.orig/net/unix/af_unix.c
1300  +++ linux-2.6.18-24etch4/net/unix/af_unix.c  +++ linux-2.6.18-26etch2/net/unix/af_unix.c
1301  @@ -116,6 +116,7 @@  @@ -116,6 +116,7 @@
1302   #include <linux/mount.h>   #include <linux/mount.h>
1303   #include <net/checksum.h>   #include <net/checksum.h>
# Line 1335  Source code for this patch is "apt-get i Line 1316  Source code for this patch is "apt-get i
1316                  err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);                  err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);
1317                  if (err)                  if (err)
1318                          goto out_mknod_dput;                          goto out_mknod_dput;
1319  --- linux-2.6.18-24etch4.orig/security/Kconfig  --- linux-2.6.18-26etch2.orig/security/Kconfig
1320  +++ linux-2.6.18-24etch4/security/Kconfig  +++ linux-2.6.18-26etch2/security/Kconfig
1321  @@ -107,5 +107,7 @@ config SECURITY_SECLVL  @@ -107,5 +107,7 @@ config SECURITY_SECLVL
1322    
1323   source security/selinux/Kconfig   source security/selinux/Kconfig
# Line 1345  Source code for this patch is "apt-get i Line 1326  Source code for this patch is "apt-get i
1326  +  +
1327   endmenu   endmenu
1328    
1329  --- linux-2.6.18-24etch4.orig/security/Makefile  --- linux-2.6.18-26etch2.orig/security/Makefile
1330  +++ linux-2.6.18-24etch4/security/Makefile  +++ linux-2.6.18-26etch2/security/Makefile
1331  @@ -17,3 +17,6 @@ obj-$(CONFIG_SECURITY_SELINUX)                += selin  @@ -17,3 +17,6 @@ obj-$(CONFIG_SECURITY_SELINUX)                += selin
1332   obj-$(CONFIG_SECURITY_CAPABILITIES)    += commoncap.o capability.o   obj-$(CONFIG_SECURITY_CAPABILITIES)    += commoncap.o capability.o
1333   obj-$(CONFIG_SECURITY_ROOTPLUG)                += commoncap.o root_plug.o   obj-$(CONFIG_SECURITY_ROOTPLUG)                += commoncap.o root_plug.o

Legend:
Removed from v.3009  
changed lines
  Added in v.3854

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