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

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

trunk/1.6.x/ccs-patch/patches/ccs-patch-2.6.15-ubuntu-6.06.diff revision 2297 by kumaneko, Mon Mar 23 00:46:34 2009 UTC trunk/1.7.x/ccs-patch/patches/ccs-patch-2.6.15-ubuntu-6.06.diff revision 3228 by kumaneko, Sat Dec 5 04:59:03 2009 UTC
# Line 2  This is TOMOYO Linux patch for Ubuntu 6. Line 2  This is TOMOYO Linux patch for Ubuntu 6.
2    
3  Source code for this patch is "apt-get install linux-source-2.6.15"  Source code for this patch is "apt-get install linux-source-2.6.15"
4  ---  ---
5   arch/alpha/kernel/ptrace.c      |    7 ++   arch/alpha/kernel/ptrace.c      |    3 +++
6   arch/ia64/ia32/sys_ia32.c       |    7 ++   arch/ia64/ia32/sys_ia32.c       |    3 +++
7   arch/ia64/kernel/ptrace.c       |    7 ++   arch/ia64/kernel/ptrace.c       |    3 +++
8   arch/m32r/kernel/ptrace.c       |    7 ++   arch/m32r/kernel/ptrace.c       |    3 +++
9   arch/mips/kernel/ptrace32.c     |    7 ++   arch/mips/kernel/ptrace32.c     |    3 +++
10   arch/powerpc/kernel/ptrace32.c  |    7 ++   arch/powerpc/kernel/ptrace32.c  |    3 +++
11   arch/s390/kernel/ptrace.c       |    7 ++   arch/s390/kernel/ptrace.c       |    3 +++
12   arch/sparc/kernel/ptrace.c      |    9 +++   arch/sparc/kernel/ptrace.c      |    5 +++++
13   arch/sparc64/kernel/ptrace.c    |    9 +++   arch/sparc64/kernel/ptrace.c    |    5 +++++
14   arch/x86_64/ia32/ptrace32.c     |    7 ++   arch/x86_64/ia32/ptrace32.c     |    3 +++
15   fs/Kconfig                      |    2   fs/compat.c                     |    9 ++++++++-
16   fs/Makefile                     |    2   fs/exec.c                       |   12 +++++++++++-
17   fs/attr.c                       |   19 ++++++   fs/fcntl.c                      |    4 ++++
18   fs/compat.c                     |   15 +++++   fs/ioctl.c                      |    5 +++++
19   fs/exec.c                       |   21 +++++++   fs/namei.c                      |   32 ++++++++++++++++++++++++++++++++
20   fs/fcntl.c                      |    8 ++   fs/namespace.c                  |   23 ++++++++++++++++++++++-
21   fs/ioctl.c                      |   11 +++   fs/open.c                       |   29 ++++++++++++++++++++++++++++-
22   fs/namei.c                      |   60 +++++++++++++++++++++   fs/proc/proc_misc.c             |    1 +
23   fs/namespace.c                  |   50 +++++++++++++++++-   include/linux/init_task.h       |    9 +++++++++
24   fs/open.c                       |   30 ++++++++++   include/linux/sched.h           |    6 ++++++
25   fs/proc/Makefile                |    3 +   kernel/compat.c                 |    3 +++
26   fs/proc/proc_misc.c             |    5 +   kernel/kexec.c                  |    3 +++
27   include/linux/init_task.h       |    4 +   kernel/kmod.c                   |    5 +++++
28   include/linux/sched.h           |    8 ++   kernel/module.c                 |    7 +++++--
29   kernel/compat.c                 |    7 ++   kernel/ptrace.c                 |    3 +++
30   kernel/kexec.c                  |    7 ++   kernel/sched.c                  |    3 +++
31   kernel/kmod.c                   |    5 +   kernel/signal.c                 |    9 +++++++++
32   kernel/module.c                 |   13 +++-   kernel/sys.c                    |   11 +++++++++++
33   kernel/ptrace.c                 |    7 ++   kernel/sysctl.c                 |   11 +++++++++++
34   kernel/sched.c                  |    7 ++   kernel/time.c                   |    7 +++++++
35   kernel/signal.c                 |   21 +++++++   net/ipv4/inet_connection_sock.c |    3 +++
36   kernel/sys.c                    |   21 +++++++   net/ipv4/raw.c                  |    4 ++++
37   kernel/sysctl.c                 |  111 ++++++++++++++++++++++++++++++++++++++++   net/ipv4/tcp_ipv4.c             |    3 +++
38   kernel/time.c                   |   15 +++++   net/ipv4/udp.c                  |   10 +++++++++-
39   net/core/datagram.c             |   11 +++   net/ipv6/raw.c                  |    4 ++++
40   net/ipv4/inet_connection_sock.c |    7 ++   net/ipv6/tcp_ipv6.c             |    5 +++++
41   net/ipv4/tcp_ipv4.c             |    7 ++   net/ipv6/udp.c                  |    8 ++++++++
42   net/ipv4/udp.c                  |   11 +++   net/socket.c                    |   23 ++++++++++++++++++++---
43   net/ipv6/tcp_ipv6.c             |   11 +++   net/unix/af_unix.c              |    4 ++++
44   net/ipv6/udp.c                  |   11 +++   security/Kconfig                |    2 ++
45   net/socket.c                    |   43 ++++++++++++++-   security/Makefile               |    3 +++
46   net/unix/af_unix.c              |    8 ++   41 files changed, 285 insertions(+), 10 deletions(-)
  42 files changed, 626 insertions(+), 9 deletions(-)  
47    
48  --- linux-2.6.15-53.75.orig/arch/alpha/kernel/ptrace.c  --- linux-2.6.15-55.81.orig/arch/alpha/kernel/ptrace.c
49  +++ linux-2.6.15-53.75/arch/alpha/kernel/ptrace.c  +++ linux-2.6.15-55.81/arch/alpha/kernel/ptrace.c
50  @@ -20,6 +20,9 @@  @@ -20,6 +20,7 @@
51   #include <asm/pgtable.h>   #include <asm/pgtable.h>
52   #include <asm/system.h>   #include <asm/system.h>
53   #include <asm/fpu.h>   #include <asm/fpu.h>
54  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
55    
56   #include "proto.h"   #include "proto.h"
57    
58  @@ -261,6 +264,10 @@ do_sys_ptrace(long request, long pid, lo  @@ -261,6 +262,8 @@ do_sys_ptrace(long request, long pid, lo
59          unsigned long tmp;          unsigned long tmp;
60          size_t copied;          size_t copied;
61          long ret;          long ret;
62  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
63  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
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-53.75.orig/arch/ia64/ia32/sys_ia32.c  --- linux-2.6.15-55.81.orig/arch/ia64/ia32/sys_ia32.c
68  +++ linux-2.6.15-53.75/arch/ia64/ia32/sys_ia32.c  +++ linux-2.6.15-55.81/arch/ia64/ia32/sys_ia32.c
69  @@ -57,6 +57,9 @@  @@ -57,6 +57,7 @@
70   #include <asm/types.h>   #include <asm/types.h>
71   #include <asm/uaccess.h>   #include <asm/uaccess.h>
72   #include <asm/unistd.h>   #include <asm/unistd.h>
73  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
74    
75   #include "ia32priv.h"   #include "ia32priv.h"
76    
77  @@ -1758,6 +1761,10 @@ sys32_ptrace (int request, pid_t pid, un  @@ -1758,6 +1759,8 @@ sys32_ptrace (int request, pid_t pid, un
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  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
82  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
83    
84          lock_kernel();          lock_kernel();
85          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
86  --- linux-2.6.15-53.75.orig/arch/ia64/kernel/ptrace.c  --- linux-2.6.15-55.81.orig/arch/ia64/kernel/ptrace.c
87  +++ linux-2.6.15-53.75/arch/ia64/kernel/ptrace.c  +++ linux-2.6.15-55.81/arch/ia64/kernel/ptrace.c
88  @@ -29,6 +29,9 @@  @@ -29,6 +29,7 @@
89   #ifdef CONFIG_PERFMON   #ifdef CONFIG_PERFMON
90   #include <asm/perfmon.h>   #include <asm/perfmon.h>
91   #endif   #endif
92  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
93    
94   #include "entry.h"   #include "entry.h"
95    
96  @@ -1418,6 +1421,10 @@ sys_ptrace (long request, pid_t pid, uns  @@ -1418,6 +1419,8 @@ sys_ptrace (long request, pid_t pid, uns
97          struct task_struct *child;          struct task_struct *child;
98          struct switch_stack *sw;          struct switch_stack *sw;
99          long ret;          long ret;
100  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
101  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
102    
103          lock_kernel();          lock_kernel();
104          ret = -EPERM;          ret = -EPERM;
105  --- linux-2.6.15-53.75.orig/arch/m32r/kernel/ptrace.c  --- linux-2.6.15-55.81.orig/arch/m32r/kernel/ptrace.c
106  +++ linux-2.6.15-53.75/arch/m32r/kernel/ptrace.c  +++ linux-2.6.15-55.81/arch/m32r/kernel/ptrace.c
107  @@ -33,6 +33,9 @@  @@ -33,6 +33,7 @@
108   #include <asm/system.h>   #include <asm/system.h>
109   #include <asm/processor.h>   #include <asm/processor.h>
110   #include <asm/mmu_context.h>   #include <asm/mmu_context.h>
111  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
112    
113   /*   /*
114    * Get the address of the live pt_regs for the specified task.    * Get the address of the live pt_regs for the specified task.
115  @@ -760,6 +763,10 @@ asmlinkage long sys_ptrace(long request,  @@ -760,6 +761,8 @@ asmlinkage long sys_ptrace(long request,
116   {   {
117          struct task_struct *child;          struct task_struct *child;
118          int ret;          int ret;
119  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
120  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
121    
122          lock_kernel();          lock_kernel();
123          ret = -EPERM;          ret = -EPERM;
124  --- linux-2.6.15-53.75.orig/arch/mips/kernel/ptrace32.c  --- linux-2.6.15-55.81.orig/arch/mips/kernel/ptrace32.c
125  +++ linux-2.6.15-53.75/arch/mips/kernel/ptrace32.c  +++ linux-2.6.15-55.81/arch/mips/kernel/ptrace32.c
126  @@ -35,6 +35,9 @@  @@ -35,6 +35,7 @@
127   #include <asm/system.h>   #include <asm/system.h>
128   #include <asm/uaccess.h>   #include <asm/uaccess.h>
129   #include <asm/bootinfo.h>   #include <asm/bootinfo.h>
130  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
131    
132   int ptrace_getregs (struct task_struct *child, __s64 __user *data);   int ptrace_getregs (struct task_struct *child, __s64 __user *data);
133   int ptrace_setregs (struct task_struct *child, __s64 __user *data);   int ptrace_setregs (struct task_struct *child, __s64 __user *data);
134  @@ -50,6 +53,10 @@ asmlinkage int sys32_ptrace(int request,  @@ -50,6 +51,8 @@ asmlinkage int sys32_ptrace(int request,
135   {   {
136          struct task_struct *child;          struct task_struct *child;
137          int ret;          int ret;
138  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
139  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
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-53.75.orig/arch/powerpc/kernel/ptrace32.c  --- linux-2.6.15-55.81.orig/arch/powerpc/kernel/ptrace32.c
144  +++ linux-2.6.15-53.75/arch/powerpc/kernel/ptrace32.c  +++ linux-2.6.15-55.81/arch/powerpc/kernel/ptrace32.c
145  @@ -33,6 +33,9 @@  @@ -33,6 +33,7 @@
146   #include <asm/page.h>   #include <asm/page.h>
147   #include <asm/pgtable.h>   #include <asm/pgtable.h>
148   #include <asm/system.h>   #include <asm/system.h>
149  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
150    
151   #include "ptrace-common.h"   #include "ptrace-common.h"
152    
153  @@ -46,6 +49,10 @@ long compat_sys_ptrace(int request, int  @@ -46,6 +47,8 @@ long compat_sys_ptrace(int request, int
154   {   {
155          struct task_struct *child;          struct task_struct *child;
156          int ret = -EPERM;          int ret = -EPERM;
157  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
158  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
159    
160          lock_kernel();          lock_kernel();
161          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
162  --- linux-2.6.15-53.75.orig/arch/s390/kernel/ptrace.c  --- linux-2.6.15-55.81.orig/arch/s390/kernel/ptrace.c
163  +++ linux-2.6.15-53.75/arch/s390/kernel/ptrace.c  +++ linux-2.6.15-55.81/arch/s390/kernel/ptrace.c
164  @@ -41,6 +41,9 @@  @@ -41,6 +41,7 @@
165   #include <asm/system.h>   #include <asm/system.h>
166   #include <asm/uaccess.h>   #include <asm/uaccess.h>
167   #include <asm/unistd.h>   #include <asm/unistd.h>
168  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
169    
170   #ifdef CONFIG_S390_SUPPORT   #ifdef CONFIG_S390_SUPPORT
171   #include "compat_ptrace.h"   #include "compat_ptrace.h"
172  @@ -711,6 +714,10 @@ sys_ptrace(long request, long pid, long  @@ -711,6 +712,8 @@ sys_ptrace(long request, long pid, long
173          struct task_struct *child;          struct task_struct *child;
174          int ret;          int ret;
175    
176  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
177  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
178          lock_kernel();          lock_kernel();
179    
180          if (request == PTRACE_TRACEME) {          if (request == PTRACE_TRACEME) {
181  --- linux-2.6.15-53.75.orig/arch/sparc/kernel/ptrace.c  --- linux-2.6.15-55.81.orig/arch/sparc/kernel/ptrace.c
182  +++ linux-2.6.15-53.75/arch/sparc/kernel/ptrace.c  +++ linux-2.6.15-55.81/arch/sparc/kernel/ptrace.c
183  @@ -23,6 +23,9 @@  @@ -23,6 +23,7 @@
184   #include <asm/pgtable.h>   #include <asm/pgtable.h>
185   #include <asm/system.h>   #include <asm/system.h>
186   #include <asm/uaccess.h>   #include <asm/uaccess.h>
187  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
188    
189   #define MAGIC_CONSTANT 0x80000000   #define MAGIC_CONSTANT 0x80000000
190    
191  @@ -267,6 +270,12 @@ asmlinkage void do_ptrace(struct pt_regs  @@ -267,6 +268,10 @@ asmlinkage void do_ptrace(struct pt_regs
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  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid)) {
 +       if (!ccs_capable(CCS_SYS_PTRACE)) {  
196  +               pt_error_return(regs, EPERM);  +               pt_error_return(regs, EPERM);
197  +               return;  +               return;
198  +       }  +       }
 +       /***** TOMOYO Linux end. *****/  
199    
200          lock_kernel();          lock_kernel();
201   #ifdef DEBUG_PTRACE   #ifdef DEBUG_PTRACE
202  --- linux-2.6.15-53.75.orig/arch/sparc64/kernel/ptrace.c  --- linux-2.6.15-55.81.orig/arch/sparc64/kernel/ptrace.c
203  +++ linux-2.6.15-53.75/arch/sparc64/kernel/ptrace.c  +++ linux-2.6.15-55.81/arch/sparc64/kernel/ptrace.c
204  @@ -32,6 +32,9 @@  @@ -32,6 +32,7 @@
205   #include <asm/spitfire.h>   #include <asm/spitfire.h>
206   #include <asm/page.h>   #include <asm/page.h>
207   #include <asm/cpudata.h>   #include <asm/cpudata.h>
208  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
209    
210   /* Returning from ptrace is a bit tricky because the syscall return   /* Returning from ptrace is a bit tricky because the syscall return
211    * low level code assumes any value returned which is negative and    * low level code assumes any value returned which is negative and
212  @@ -176,6 +179,12 @@ asmlinkage void do_ptrace(struct pt_regs  @@ -176,6 +177,10 @@ asmlinkage void do_ptrace(struct pt_regs
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  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid)) {
 +       if (!ccs_capable(CCS_SYS_PTRACE)) {  
217  +               pt_error_return(regs, EPERM);  +               pt_error_return(regs, EPERM);
218  +               return;  +               return;
219  +       }  +       }
 +       /***** TOMOYO Linux end. *****/  
220    
221          if (test_thread_flag(TIF_32BIT)) {          if (test_thread_flag(TIF_32BIT)) {
222                  addr &= 0xffffffffUL;                  addr &= 0xffffffffUL;
223  --- linux-2.6.15-53.75.orig/arch/x86_64/ia32/ptrace32.c  --- linux-2.6.15-55.81.orig/arch/x86_64/ia32/ptrace32.c
224  +++ linux-2.6.15-53.75/arch/x86_64/ia32/ptrace32.c  +++ linux-2.6.15-55.81/arch/x86_64/ia32/ptrace32.c
225  @@ -27,6 +27,9 @@  @@ -27,6 +27,7 @@
226   #include <asm/debugreg.h>   #include <asm/debugreg.h>
227   #include <asm/i387.h>   #include <asm/i387.h>
228   #include <asm/fpu32.h>   #include <asm/fpu32.h>
229  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
230    
231   /* determines which flags the user has access to. */   /* determines which flags the user has access to. */
232   /* 1 = access 0 = no access */   /* 1 = access 0 = no access */
233  @@ -233,6 +236,10 @@ asmlinkage long sys32_ptrace(long reques  @@ -233,6 +234,8 @@ asmlinkage long sys32_ptrace(long reques
234          void __user *datap = compat_ptr(data);          void __user *datap = compat_ptr(data);
235          int ret;          int ret;
236          __u32 val;          __u32 val;
237  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
238  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
239    
240          switch (request) {          switch (request) {
241          default:          default:
242  --- linux-2.6.15-53.75.orig/fs/Kconfig  --- linux-2.6.15-55.81.orig/fs/compat.c
243  +++ linux-2.6.15-53.75/fs/Kconfig  +++ linux-2.6.15-55.81/fs/compat.c
244  @@ -1910,5 +1910,7 @@ endmenu  @@ -52,6 +52,7 @@
   
  source "fs/nls/Kconfig"  
   
 +source "fs/Kconfig.ccs"  
 +  
  endmenu  
   
 --- linux-2.6.15-53.75.orig/fs/Makefile  
 +++ linux-2.6.15-53.75/fs/Makefile  
 @@ -108,3 +108,5 @@ obj-$(CONFIG_CONFIGFS_FS)   += configfs/  
  obj-$(CONFIG_OCFS2_FS)         += ocfs2/  
  obj-$(CONFIG_UNION_FS)          += unionfs/  
  obj-$(CONFIG_DAZUKO)           += dazuko/  
 +  
 +include $(srctree)/fs/Makefile-2.6.ccs  
 --- linux-2.6.15-53.75.orig/fs/attr.c  
 +++ linux-2.6.15-53.75/fs/attr.c  
 @@ -15,6 +15,9 @@  
  #include <linux/quotaops.h>  
  #include <linux/security.h>  
  #include <linux/time.h>  
 +/***** TOMOYO Linux start. *****/  
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
   
  /* Taken over from the old code... */  
   
 @@ -153,12 +156,28 @@ int notify_change(struct dentry * dentry  
   
         if (inode->i_op && inode->i_op->setattr) {  
                 error = security_inode_setattr(dentry, attr);  
 +               /***** TOMOYO Linux start. *****/  
 +               if (!error && (ia_valid & ATTR_MODE) &&  
 +                   !ccs_capable(CCS_SYS_CHMOD))  
 +                       error = -EPERM;  
 +               if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) &&  
 +                   !ccs_capable(CCS_SYS_CHOWN))  
 +                       error = -EPERM;  
 +               /***** TOMOYO Linux end. *****/  
                 if (!error)  
                         error = inode->i_op->setattr(dentry, attr);  
         } else {  
                 error = inode_change_ok(inode, attr);  
                 if (!error)  
                         error = security_inode_setattr(dentry, attr);  
 +               /***** TOMOYO Linux start. *****/  
 +               if (!error && (ia_valid & ATTR_MODE) &&  
 +                   !ccs_capable(CCS_SYS_CHMOD))  
 +                       error = -EPERM;  
 +               if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) &&  
 +                   !ccs_capable(CCS_SYS_CHOWN))  
 +                       error = -EPERM;  
 +               /***** TOMOYO Linux end. *****/  
                 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-53.75.orig/fs/compat.c  
 +++ linux-2.6.15-53.75/fs/compat.c  
 @@ -52,6 +52,9 @@  
245   #include <asm/uaccess.h>   #include <asm/uaccess.h>
246   #include <asm/mmu_context.h>   #include <asm/mmu_context.h>
247   #include <asm/ioctls.h>   #include <asm/ioctls.h>
248  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
249    
250   /*   /*
251    * Not all architectures have sys_utime, so implement this in terms    * Not all architectures have sys_utime, so implement this in terms
252  @@ -353,6 +356,10 @@ asmlinkage long compat_sys_ioctl(unsigne  @@ -353,6 +354,8 @@ asmlinkage long compat_sys_ioctl(unsigne
253    
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);
 +       /***** TOMOYO Linux start. *****/  
256  +       if (!error)  +       if (!error)
257  +               error = ccs_check_ioctl_permission(filp, cmd, arg);  +               error = ccs_check_ioctl_permission(filp, cmd, arg);
 +       /***** TOMOYO Linux end. *****/  
258          if (error)          if (error)
259                  goto out_fput;                  goto out_fput;
260    
261  @@ -377,6 +384,12 @@ asmlinkage long compat_sys_ioctl(unsigne  @@ -377,6 +380,10 @@ asmlinkage long compat_sys_ioctl(unsigne
262                  /*FALL THROUGH*/                  /*FALL THROUGH*/
263    
264          default:          default:
 +               /***** TOMOYO Linux start. *****/  
265  +               if (!ccs_capable(CCS_SYS_IOCTL)) {  +               if (!ccs_capable(CCS_SYS_IOCTL)) {
266  +                       error = -EPERM;  +                       error = -EPERM;
267  +                       goto out_fput;  +                       goto out_fput;
268  +               }  +               }
 +               /***** TOMOYO Linux end. *****/  
269                  if (filp->f_op && filp->f_op->compat_ioctl) {                  if (filp->f_op && filp->f_op->compat_ioctl) {
270                          error = filp->f_op->compat_ioctl(filp, cmd, arg);                          error = filp->f_op->compat_ioctl(filp, cmd, arg);
271                          if (error != -ENOIOCTLCMD)                          if (error != -ENOIOCTLCMD)
272  @@ -1480,7 +1493,7 @@ int compat_do_execve(char * filename,  @@ -1480,7 +1487,7 @@ int compat_do_execve(char * filename,
273          if (retval < 0)          if (retval < 0)
274                  goto out;                  goto out;
275    
276  -       retval = search_binary_handler(bprm, regs);  -       retval = search_binary_handler(bprm, regs);
277  +       retval = search_binary_handler_with_transition(bprm, regs);  +       retval = ccs_search_binary_handler(bprm, regs);
278          if (retval >= 0) {          if (retval >= 0) {
279                  free_arg_pages(bprm);                  free_arg_pages(bprm);
280    
281  --- linux-2.6.15-53.75.orig/fs/exec.c  --- linux-2.6.15-55.81.orig/fs/exec.c
282  +++ linux-2.6.15-53.75/fs/exec.c  +++ linux-2.6.15-55.81/fs/exec.c
283  @@ -57,6 +57,10 @@  @@ -57,6 +57,8 @@
284   #include <linux/kmod.h>   #include <linux/kmod.h>
285   #endif   #endif
286    
287  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
288  +  +
289   int core_uses_pid;   int core_uses_pid;
290   char core_pattern[65] = "core";   char core_pattern[65] = "core";
291   int suid_dumpable = 0;   int suid_dumpable = 0;
292  @@ -139,6 +143,13 @@ asmlinkage long sys_uselib(const char __  @@ -139,6 +141,10 @@ SYSCALL_DEFINE1(uselib, const char __use
293          if (error)          if (error)
294                  goto exit;                  goto exit;
295    
296  +       /***** TOMOYO Linux start. *****/  +       error = ccs_uselib_permission(nd.dentry, nd.mnt);
 +       /* 01 means "read". */  
 +       error = ccs_check_open_permission(nd.dentry, nd.mnt, 01);  
297  +       if (error)  +       if (error)
298  +               goto exit;  +               goto exit;
 +       /***** TOMOYO Linux end. *****/  
299  +  +
300          file = nameidata_to_filp(&nd, O_RDONLY);          file = nameidata_to_filp(&nd, O_RDONLY);
301          error = PTR_ERR(file);          error = PTR_ERR(file);
302          if (IS_ERR(file))          if (IS_ERR(file))
303  @@ -488,6 +499,13 @@ struct file *open_exec(const char *name)  @@ -488,6 +494,9 @@ struct file *open_exec(const char *name)
304                          int err = vfs_permission(&nd, MAY_EXEC);                          int err = vfs_permission(&nd, MAY_EXEC);
305                          if (!err && !(inode->i_mode & 0111))                          if (!err && !(inode->i_mode & 0111))
306                                  err = -EACCES;                                  err = -EACCES;
307  +                       /***** TOMOYO Linux start. *****/  +                       if (!err)
308  +                       if (!err && (current->ccs_flags &  +                               err = ccs_open_exec_permission(nd.dentry,
309  +                                    CCS_CHECK_READ_FOR_OPEN_EXEC))  +                                                                    nd.mnt);
 +                               /* 01 means "read". */  
 +                               err = ccs_check_open_permission(nd.dentry,  
 +                                                               nd.mnt, 01);  
 +                       /***** TOMOYO Linux end. *****/  
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 +1215,8 @@ int do_execve(char * filename,  @@ -1197,7 +1206,8 @@ int do_execve(char * filename,
314          if (retval < 0)          if (retval < 0)
315                  goto out;                  goto out;
316    
317  -       retval = search_binary_handler(bprm,regs);  -       retval = search_binary_handler(bprm,regs);
318  +       retval = search_binary_handler_with_transition(bprm, regs);  +       retval = ccs_search_binary_handler(bprm, regs);
319  +  +
320          if (retval >= 0) {          if (retval >= 0) {
321                  free_arg_pages(bprm);                  free_arg_pages(bprm);
322    
323  --- linux-2.6.15-53.75.orig/fs/fcntl.c  --- linux-2.6.15-55.81.orig/fs/fcntl.c
324  +++ linux-2.6.15-53.75/fs/fcntl.c  +++ linux-2.6.15-55.81/fs/fcntl.c
325  @@ -21,6 +21,9 @@  @@ -21,6 +21,7 @@
326   #include <asm/poll.h>   #include <asm/poll.h>
327   #include <asm/siginfo.h>   #include <asm/siginfo.h>
328   #include <asm/uaccess.h>   #include <asm/uaccess.h>
329  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
330    
331   void fastcall set_close_on_exec(unsigned int fd, int flag)   void fastcall set_close_on_exec(unsigned int fd, int flag)
332   {   {
333  @@ -211,6 +214,11 @@ static int setfl(int fd, struct file * f  @@ -211,6 +212,9 @@ static int setfl(int fd, struct file * f
334          if (!(arg & O_APPEND) && IS_APPEND(inode))          if (!(arg & O_APPEND) && IS_APPEND(inode))
335                  return -EPERM;                  return -EPERM;
336    
337  +       /***** TOMOYO Linux start. *****/  +       if (!(arg & O_APPEND) && ccs_rewrite_permission(filp))
 +       if (!(arg & O_APPEND) && ccs_check_rewrite_permission(filp))  
338  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
339  +  +
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-53.75.orig/fs/ioctl.c  --- linux-2.6.15-55.81.orig/fs/ioctl.c
344  +++ linux-2.6.15-53.75/fs/ioctl.c  +++ linux-2.6.15-55.81/fs/ioctl.c
345  @@ -15,6 +15,9 @@  @@ -15,6 +15,7 @@
346    
347   #include <asm/uaccess.h>   #include <asm/uaccess.h>
348   #include <asm/ioctls.h>   #include <asm/ioctls.h>
349  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
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 +26,10 @@ static long do_ioctl(struct file *filp,  @@ -23,6 +24,8 @@ static long do_ioctl(struct file *filp,
354    
355          if (!filp->f_op)          if (!filp->f_op)
356                  goto out;                  goto out;
 +       /***** TOMOYO Linux start. *****/  
357  +       if (!ccs_capable(CCS_SYS_IOCTL))  +       if (!ccs_capable(CCS_SYS_IOCTL))
358  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
359    
360          if (filp->f_op->unlocked_ioctl) {          if (filp->f_op->unlocked_ioctl) {
361                  error = filp->f_op->unlocked_ioctl(filp, cmd, arg);                  error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
362  @@ -167,6 +174,10 @@ asmlinkage long sys_ioctl(unsigned int f  @@ -167,6 +170,8 @@ SYSCALL_DEFINE3(ioctl, unsigned int, fd,
363                  goto out;                  goto out;
364    
365          error = security_file_ioctl(filp, cmd, arg);          error = security_file_ioctl(filp, cmd, arg);
 +       /***** TOMOYO Linux start. *****/  
366  +       if (!error)  +       if (!error)
367  +               error = ccs_check_ioctl_permission(filp, cmd, arg);  +               error = ccs_ioctl_permission(filp, cmd, arg);
 +       /***** TOMOYO Linux end. *****/  
368          if (error)          if (error)
369                  goto out_fput;                  goto out_fput;
370    
371  --- linux-2.6.15-53.75.orig/fs/namei.c  --- linux-2.6.15-55.81.orig/fs/namei.c
372  +++ linux-2.6.15-53.75/fs/namei.c  +++ linux-2.6.15-55.81/fs/namei.c
373  @@ -34,6 +34,10 @@  @@ -34,6 +34,8 @@
374    
375   #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])   #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
376    
377  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
378  +  +
379   /* [Feb-1997 T. Schoebel-Theuer]   /* [Feb-1997 T. Schoebel-Theuer]
380    * Fundamental changes in the pathname lookup mechanisms (namei)    * Fundamental changes in the pathname lookup mechanisms (namei)
381    * were necessary because of omirr.  The reason is that omirr needs    * were necessary because of omirr.  The reason is that omirr needs
382  @@ -1488,6 +1492,13 @@ int may_open(struct nameidata *nd, int a  @@ -1488,6 +1490,11 @@ int may_open(struct nameidata *nd, int a
383                  if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))                  if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER))
384                          return -EPERM;                          return -EPERM;
385    
 +       /***** TOMOYO Linux start. *****/  
386  +       /* includes O_APPEND and O_TRUNC checks */  +       /* includes O_APPEND and O_TRUNC checks */
387  +       error = ccs_check_open_permission(dentry, nd->mnt, flag);  +       error = ccs_open_permission(dentry, nd->mnt, flag);
388  +       if (error)  +       if (error)
389  +               return error;  +               return error;
 +       /***** TOMOYO Linux end. *****/  
390  +  +
391          /*          /*
392           * Ensure there are no outstanding leases on the file.           * Ensure there are no outstanding leases on the file.
393           */           */
394  @@ -1519,6 +1530,9 @@ int may_open(struct nameidata *nd, int a  @@ -1519,6 +1526,7 @@ int may_open(struct nameidata *nd, int a
395          return 0;          return 0;
396   }   }
397    
398  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity_vfs.h>
 +#include <linux/tomoyo_vfs.h>  
 +/***** TOMOYO Linux end. *****/  
399   /*   /*
400    *     open_namei()    *     open_namei()
401    *    *
402  @@ -1594,6 +1608,11 @@ do_last:  @@ -1594,6 +1602,9 @@ do_last:
403          if (!path.dentry->d_inode) {          if (!path.dentry->d_inode) {
404                  if (!IS_POSIXACL(dir->d_inode))                  if (!IS_POSIXACL(dir->d_inode))
405                          mode &= ~current->fs->umask;                          mode &= ~current->fs->umask;
406  +               /***** TOMOYO Linux start. *****/  +               error = ccs_mknod_permission(dir->d_inode, path.dentry,
407  +               error = ccs_check_mknod_permission(dir->d_inode, path.dentry,  +                                            nd->mnt, mode, 0);
 +                                                  nd->path.mnt, mode, 0);  
408  +               if (!error)  +               if (!error)
 +               /***** TOMOYO Linux end. *****/  
409                  error = vfs_create(dir->d_inode, path.dentry, mode, nd);                  error = vfs_create(dir->d_inode, path.dentry, mode, nd);
410                  up(&dir->d_inode->i_sem);                  up(&dir->d_inode->i_sem);
411                  dput(nd->dentry);                  dput(nd->dentry);
412  @@ -1781,6 +1800,12 @@ asmlinkage long sys_mknod(const char __u  @@ -1781,6 +1792,9 @@ SYSCALL_DEFINE3(mknod, const char __user
413          if (!IS_POSIXACL(nd.dentry->d_inode))          if (!IS_POSIXACL(nd.dentry->d_inode))
414                  mode &= ~current->fs->umask;                  mode &= ~current->fs->umask;
415          if (!IS_ERR(dentry)) {          if (!IS_ERR(dentry)) {
416  +               /***** TOMOYO Linux start. *****/  +               error = ccs_mknod_permission(nd.dentry->d_inode, dentry,
417  +               error = ccs_check_mknod_permission(nd.path.dentry->d_inode,  +                                            nd.mnt, mode, dev);
 +                                                  dentry, nd.path.mnt, mode,  
 +                                                  new_decode_dev(dev));  
418  +               if (!error)  +               if (!error)
 +               /***** TOMOYO Linux end. *****/  
419                  switch (mode & S_IFMT) {                  switch (mode & S_IFMT) {
420                  case 0: case S_IFREG:                  case 0: case S_IFREG:
421                          error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);                          error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd);
422  @@ -1849,6 +1874,12 @@ asmlinkage long sys_mkdir(const char __u  @@ -1849,6 +1863,9 @@ SYSCALL_DEFINE2(mkdir, const char __user
423                  if (!IS_ERR(dentry)) {                  if (!IS_ERR(dentry)) {
424                          if (!IS_POSIXACL(nd.dentry->d_inode))                          if (!IS_POSIXACL(nd.dentry->d_inode))
425                                  mode &= ~current->fs->umask;                                  mode &= ~current->fs->umask;
426  +                       /***** TOMOYO Linux start. *****/  +                       error = ccs_mkdir_permission(nd.dentry->d_inode,
427  +                       error = ccs_check_mkdir_permission(nd.dentry->d_inode,  +                                                    dentry, nd.mnt, mode);
 +                                                          dentry, nd.mnt,  
 +                                                          mode);  
428  +                       if (!error)  +                       if (!error)
 +                       /***** TOMOYO Linux end. *****/  
429                          error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);                          error = vfs_mkdir(nd.dentry->d_inode, dentry, mode);
430                          dput(dentry);                          dput(dentry);
431                  }                  }
432  @@ -1952,6 +1983,11 @@ asmlinkage long sys_rmdir(const char __u  @@ -1952,6 +1969,9 @@ SYSCALL_DEFINE1(rmdir, const char __user
433          dentry = lookup_hash(&nd);          dentry = lookup_hash(&nd);
434          error = PTR_ERR(dentry);          error = PTR_ERR(dentry);
435          if (!IS_ERR(dentry)) {          if (!IS_ERR(dentry)) {
436  +               /***** TOMOYO Linux start. *****/  +               error = ccs_rmdir_permission(nd.dentry->d_inode, dentry,
437  +               error = ccs_check_rmdir_permission(nd.dentry->d_inode, dentry,  +                                            nd.mnt);
 +                                                  nd.mnt);  
438  +               if (!error)  +               if (!error)
 +               /***** TOMOYO Linux end. *****/  
439                  error = vfs_rmdir(nd.dentry->d_inode, dentry);                  error = vfs_rmdir(nd.dentry->d_inode, dentry);
440                  dput(dentry);                  dput(dentry);
441          }          }
442  @@ -2027,6 +2063,11 @@ asmlinkage long sys_unlink(const char __  @@ -2027,6 +2047,9 @@ SYSCALL_DEFINE1(unlink, const char __use
443                  inode = dentry->d_inode;                  inode = dentry->d_inode;
444                  if (inode)                  if (inode)
445                          atomic_inc(&inode->i_count);                          atomic_inc(&inode->i_count);
446  +               /***** TOMOYO Linux start. *****/  +               error = ccs_unlink_permission(nd.dentry->d_inode, dentry,
447  +               error = ccs_check_unlink_permission(nd.dentry->d_inode, dentry,  +                                             nd.mnt);
 +                                                   nd.mnt);  
448  +               if (!error)  +               if (!error)
 +               /***** TOMOYO Linux end. *****/  
449                  error = vfs_unlink(nd.dentry->d_inode, dentry);                  error = vfs_unlink(nd.dentry->d_inode, dentry);
450          exit2:          exit2:
451                  dput(dentry);                  dput(dentry);
452  @@ -2088,6 +2129,12 @@ asmlinkage long sys_symlink(const char _  @@ -2089,6 +2112,9 @@ SYSCALL_DEFINE2(symlink, const char __us
453                  dentry = lookup_create(&nd, 0);                  dentry = lookup_create(&nd, 0);
454                  error = PTR_ERR(dentry);                  error = PTR_ERR(dentry);
455                  if (!IS_ERR(dentry)) {                  if (!IS_ERR(dentry)) {
456  +                       /***** TOMOYO Linux start. *****/  +                       error = ccs_symlink_permission(nd.dentry->d_inode,
457  +                       error = ccs_check_symlink_permission(nd.dentry->d_inode,  +                                                      dentry, nd.mnt, from);
 +                                                            dentry, nd.mnt,  
 +                                                            from);  
458  +                       if (!error)  +                       if (!error)
 +                       /***** TOMOYO Linux end. *****/  
459                          error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);                          error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO);
460                          dput(dentry);                          dput(dentry);
461                  }                  }
462  @@ -2170,6 +2217,12 @@ asmlinkage long sys_link(const char __us  @@ -2172,6 +2198,9 @@ SYSCALL_DEFINE2(link, const char __user
463          new_dentry = lookup_create(&nd, 0);          new_dentry = lookup_create(&nd, 0);
464          error = PTR_ERR(new_dentry);          error = PTR_ERR(new_dentry);
465          if (!IS_ERR(new_dentry)) {          if (!IS_ERR(new_dentry)) {
466  +               /***** TOMOYO Linux start. *****/  +               error = ccs_link_permission(old_nd.dentry, nd.dentry->d_inode,
467  +               error = ccs_check_link_permission(old_nd.dentry,  +                                           new_dentry, nd.mnt);
 +                                                 nd.dentry->d_inode,  
 +                                                 new_dentry, nd.mnt);  
468  +               if (!error)  +               if (!error)
 +               /***** TOMOYO Linux end. *****/  
469                  error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);                  error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry);
470                  dput(new_dentry);                  dput(new_dentry);
471          }          }
472  @@ -2390,6 +2443,13 @@ static inline int do_rename(const char *  @@ -2392,6 +2421,9 @@ static inline int do_rename(const char *
473          if (new_dentry == trap)          if (new_dentry == trap)
474                  goto exit5;                  goto exit5;
475    
476  +       /***** TOMOYO Linux start. *****/  +       error = ccs_rename_permission(old_dir->d_inode, old_dentry,
477  +       error = ccs_check_rename_permission(old_dir->d_inode, old_dentry,  +                                     new_dir->d_inode, new_dentry, newnd.mnt);
 +                                           new_dir->d_inode, new_dentry,  
 +                                           newnd.mnt);  
478  +       if (!error)  +       if (!error)
 +       /***** TOMOYO Linux end. *****/  
 +  
479          error = vfs_rename(old_dir->d_inode, old_dentry,          error = vfs_rename(old_dir->d_inode, old_dentry,
480                                     new_dir->d_inode, new_dentry);                                     new_dir->d_inode, new_dentry);
481   exit5:   exit5:
482  --- linux-2.6.15-53.75.orig/fs/namespace.c  --- linux-2.6.15-55.81.orig/fs/namespace.c
483  +++ linux-2.6.15-53.75/fs/namespace.c  +++ linux-2.6.15-55.81/fs/namespace.c
484  @@ -25,6 +25,12 @@  @@ -25,6 +25,7 @@
485   #include <asm/uaccess.h>   #include <asm/uaccess.h>
486   #include <asm/unistd.h>   #include <asm/unistd.h>
487   #include "pnode.h"   #include "pnode.h"
488  +/***** SAKURA Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/sakura.h>  
 +/***** SAKURA Linux end. *****/  
 +/***** TOMOYO Linux start. *****/  
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
489    
490   extern int __init init_rootfs(void);   extern int __init init_rootfs(void);
491    
492  @@ -504,6 +510,11 @@ static int do_umount(struct vfsmount *mn  @@ -501,6 +502,8 @@ static int do_umount(struct vfsmount *mn
493            LIST_HEAD(umount_list);
494    
495            retval = security_sb_umount(mnt, flags);
496    +       if (!retval)
497    +               retval = ccs_umount_permission(mnt, flags);
498          if (retval)          if (retval)
499                  return retval;                  return retval;
500    
501  +       /***** SAKURA Linux start. *****/  @@ -592,6 +595,8 @@ SYSCALL_DEFINE2(umount, char __user *, n
 +       if (ccs_may_umount(mnt))  
 +               return -EPERM;  
 +       /***** SAKURA Linux end. *****/  
 +  
         /*  
          * Allow userspace to request a mountpoint be expired rather than  
          * unmounting unconditionally. Unmount only happens if:  
 @@ -592,6 +603,10 @@ asmlinkage long sys_umount(char __user *  
502   {   {
503          struct nameidata nd;          struct nameidata nd;
504          int retval;          int retval;
 +       /***** TOMOYO Linux start. *****/  
505  +       if (!ccs_capable(CCS_SYS_UMOUNT))  +       if (!ccs_capable(CCS_SYS_UMOUNT))
506  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
507    
508          retval = __user_walk(name, LOOKUP_FOLLOW, &nd);          retval = __user_walk(name, LOOKUP_FOLLOW, &nd);
509          if (retval)          if (retval)
510  @@ -879,6 +894,11 @@ static int do_loopback(struct nameidata  @@ -879,6 +884,9 @@ static int do_loopback(struct nameidata
511    
512          if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))          if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))
513                  goto out;                  goto out;
 +       /***** SAKURA Linux start. *****/  
514  +       err = -EPERM;  +       err = -EPERM;
515  +       if (ccs_may_mount(nd))  +       if (ccs_may_mount(nd))
516  +               goto out;  +               goto out;
 +       /***** SAKURA Linux end. *****/  
517    
518          err = -ENOMEM;          err = -ENOMEM;
519          if (recurse)          if (recurse)
520  @@ -963,7 +983,11 @@ static int do_move_mount(struct nameidat  @@ -963,7 +971,9 @@ static int do_move_mount(struct nameidat
521          err = -EINVAL;          err = -EINVAL;
522          if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))          if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt))
523                  goto out;                  goto out;
524  -  -
 +       /***** SAKURA Linux start. *****/  
525  +       err = -EPERM;  +       err = -EPERM;
526  +       if (ccs_may_umount(old_nd.mnt) || ccs_may_mount(nd))  +       if (ccs_may_mount(nd))
527  +               goto out;  +               goto out;
 +       /***** SAKURA Linux end. *****/  
528          err = -ENOENT;          err = -ENOENT;
529          down(&nd->dentry->d_inode->i_sem);          down(&nd->dentry->d_inode->i_sem);
530          if (IS_DEADDIR(nd->dentry->d_inode))          if (IS_DEADDIR(nd->dentry->d_inode))
531  @@ -1065,6 +1089,11 @@ int do_add_mount(struct vfsmount *newmnt  @@ -1065,6 +1075,9 @@ int do_add_mount(struct vfsmount *newmnt
532          err = -EINVAL;          err = -EINVAL;
533          if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))          if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))
534                  goto unlock;                  goto unlock;
 +       /***** SAKURA Linux start. *****/  
535  +       err = -EPERM;  +       err = -EPERM;
536  +       if (ccs_may_mount(nd))  +       if (ccs_may_mount(nd))
537  +               goto unlock;  +               goto unlock;
 +       /***** SAKURA Linux end. *****/  
538    
539          newmnt->mnt_flags = mnt_flags;          newmnt->mnt_flags = mnt_flags;
540          if ((err = graft_tree(newmnt, nd)))          if ((err = graft_tree(newmnt, nd)))
541  @@ -1282,6 +1311,17 @@ long do_mount(char *dev_name, char *dir_  @@ -1264,6 +1277,7 @@ int copy_mount_options(const void __user
542          if (data_page)   long do_mount(char *dev_name, char *dir_name, char *type_page,
543                  ((char *)data_page)[PAGE_SIZE - 1] = 0;                    unsigned long flags, void *data_page)
544     {
545  +       /***** TOMOYO Linux start. *****/  +       const unsigned long original_flags = flags;
546  +       if (!ccs_capable(CCS_SYS_MOUNT))          struct nameidata nd;
547  +               return -EPERM;          int retval = 0;
548  +       /***** TOMOYO Linux end. *****/          int mnt_flags = 0;
549  +       /***** SAKURA Linux start. *****/  @@ -1297,6 +1311,9 @@ long do_mount(char *dev_name, char *dir_
550  +       retval = ccs_check_mount_permission(dev_name, dir_name, type_page,                  return retval;
551  +                                           &flags);  
552  +       if (retval)          retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page);
553  +               return retval;  +       if (!retval)
554  +       /***** SAKURA Linux end. *****/  +               retval = ccs_mount_permission(dev_name, &nd, type_page,
555  +  +                                             original_flags, data_page);
556          /* Separate the per-mountpoint flags */          if (retval)
557          if (flags & MS_NOSUID)                  goto dput_out;
558                  mnt_flags |= MNT_NOSUID;  
559  @@ -1546,6 +1586,10 @@ asmlinkage long sys_pivot_root(const cha  @@ -1545,6 +1562,8 @@ SYSCALL_DEFINE2(pivot_root, const char _
560    
561          if (!capable(CAP_SYS_ADMIN))          if (!capable(CAP_SYS_ADMIN))
562                  return -EPERM;                  return -EPERM;
 +       /***** TOMOYO Linux start. *****/  
563  +       if (!ccs_capable(CCS_SYS_PIVOT_ROOT))  +       if (!ccs_capable(CCS_SYS_PIVOT_ROOT))
564  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
565    
566          lock_kernel();          lock_kernel();
567    
568  @@ -1562,6 +1606,10 @@ asmlinkage long sys_pivot_root(const cha  @@ -1561,6 +1580,8 @@ SYSCALL_DEFINE2(pivot_root, const char _
569                  goto out1;                  goto out1;
570    
571          error = security_sb_pivotroot(&old_nd, &new_nd);          error = security_sb_pivotroot(&old_nd, &new_nd);
 +       /***** SAKURA Linux start. *****/  
572  +       if (!error)  +       if (!error)
573  +               error = ccs_check_pivot_root_permission(&old_nd, &new_nd);  +               error = ccs_pivot_root_permission(&old_nd, &new_nd);
 +       /***** SAKURA Linux end. *****/  
574          if (error) {          if (error) {
575                  path_release(&old_nd);                  path_release(&old_nd);
576                  goto out1;                  goto out1;
577  --- linux-2.6.15-53.75.orig/fs/open.c  --- linux-2.6.15-55.81.orig/fs/open.c
578  +++ linux-2.6.15-53.75/fs/open.c  +++ linux-2.6.15-55.81/fs/open.c
579  @@ -28,6 +28,13 @@  @@ -28,6 +28,8 @@
580    
581   #include <asm/unistd.h>   #include <asm/unistd.h>
582    
583  +/***** SAKURA Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/sakura.h>  
 +/***** SAKURA Linux end. *****/  
 +/***** TOMOYO Linux start. *****/  
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
584  +  +
585   int vfs_statfs(struct super_block *sb, struct kstatfs *buf)   int vfs_statfs(struct super_block *sb, struct kstatfs *buf)
586   {   {
587          int retval = -ENODEV;          int retval = -ENODEV;
588  @@ -285,6 +292,10 @@ static inline long do_sys_truncate(const  @@ -287,6 +289,8 @@ static inline long do_sys_truncate(const
589          if (error)          if (error)
590                  goto dput_and_out;                  goto dput_and_out;
591    
592  +       /***** TOMOYO Linux start. *****/  +       error = ccs_truncate_permission(nd.dentry, nd.mnt, length, 0);
 +       error = ccs_check_truncate_permission(nd.dentry, nd.mnt, length, 0);  
593  +       if (!error)  +       if (!error)
 +       /***** TOMOYO Linux end. *****/  
594          error = locks_verify_truncate(inode, NULL, length);          error = locks_verify_truncate(inode, NULL, length);
595          if (!error) {          if (!error) {
596                  DQUOT_INIT(inode);                  DQUOT_INIT(inode);
597  @@ -337,7 +348,12 @@ static inline long do_sys_ftruncate(unsi  @@ -339,7 +343,9 @@ static inline long do_sys_ftruncate(unsi
598          error = -EPERM;          error = -EPERM;
599          if (IS_APPEND(inode))          if (IS_APPEND(inode))
600                  goto out_putf;                  goto out_putf;
601  -  -
602  +       /***** TOMOYO Linux start. *****/  +       error = ccs_truncate_permission(dentry, file->f_vfsmnt, length, 0);
 +       error = ccs_check_truncate_permission(dentry, file->f_vfsmnt, length,  
 +                                             0);  
603  +       if (error)  +       if (error)
604  +               goto out_putf;  +               goto out_putf;
 +       /***** TOMOYO Linux end. *****/  
605          error = locks_verify_truncate(inode, file, length);          error = locks_verify_truncate(inode, file, length);
606          if (!error)          if (!error)
607                  error = do_truncate(dentry, length, file);                  error = do_truncate(dentry, length, file);
608  @@ -610,6 +626,14 @@ asmlinkage long sys_chroot(const char __  @@ -627,6 +633,10 @@ SYSCALL_DEFINE1(chroot, const char __use
609          error = -EPERM;          error = -EPERM;
610          if (!capable(CAP_SYS_CHROOT))          if (!capable(CAP_SYS_CHROOT))
611                  goto dput_and_out;                  goto dput_and_out;
 +       /***** TOMOYO Linux start. *****/  
612  +       if (!ccs_capable(CCS_SYS_CHROOT))  +       if (!ccs_capable(CCS_SYS_CHROOT))
613  +               goto dput_and_out;  +               goto dput_and_out;
614  +       /***** TOMOYO Linux end. *****/  +       if (ccs_chroot_permission(&nd))
 +       /***** SAKURA Linux start. *****/  
 +       if (ccs_check_chroot_permission(&nd))  
615  +               goto dput_and_out;  +               goto dput_and_out;
 +       /***** SAKURA Linux end. *****/  
616    
617          set_fs_root(current->fs, nd.mnt, nd.dentry);          set_fs_root(current->fs, nd.mnt, nd.dentry);
618          set_fs_altroot();          set_fs_altroot();
619  @@ -1141,6 +1165,10 @@ EXPORT_SYMBOL(sys_close);  @@ -658,6 +668,9 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd
620            err = -EPERM;
621            if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
622                    goto out_putf;
623    +       err = ccs_chmod_permission(dentry, file->f_vfsmnt, mode);
624    +       if (err)
625    +               goto out_putf;
626            down(&inode->i_sem);
627            if (mode == (mode_t) -1)
628                    mode = inode->i_mode;
629    @@ -691,6 +704,9 @@ SYSCALL_DEFINE2(chmod, const char __user
630            error = -EPERM;
631            if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
632                    goto dput_and_out;
633    +       error = ccs_chmod_permission(nd.dentry, nd.mnt, mode);
634    +       if (error)
635    +               goto dput_and_out;
636    
637            down(&inode->i_sem);
638            if (mode == (mode_t) -1)
639    @@ -748,6 +764,8 @@ SYSCALL_DEFINE3(chown, const char __user
640    
641            error = user_path_walk(filename, &nd);
642            if (!error) {
643    +               error = ccs_chown_permission(nd.dentry, nd.mnt, user, group);
644    +               if (!error)
645                    error = chown_common(nd.dentry, user, group);
646                    path_release(&nd);
647            }
648    @@ -762,6 +780,8 @@ SYSCALL_DEFINE3(lchown, const char __use
649    
650            error = user_path_walk_link(filename, &nd);
651            if (!error) {
652    +               error = ccs_chown_permission(nd.dentry, nd.mnt, user, group);
653    +               if (!error)
654                    error = chown_common(nd.dentry, user, group);
655                    path_release(&nd);
656            }
657    @@ -776,6 +796,9 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd
658    
659            file = fget(fd);
660            if (file) {
661    +               error = ccs_chown_permission(file->f_dentry, file->f_vfsmnt,
662    +                                            user, group);
663    +               if (!error)
664                    error = chown_common(file->f_dentry, user, group);
665                    fput(file);
666            }
667    @@ -867,7 +890,9 @@ struct file *filp_open(const char * file
668            if ((namei_flags+1) & O_ACCMODE)
669                    namei_flags++;
670    
671    +       ccs_save_open_mode(flags);
672            error = open_namei(filename, namei_flags, mode, &nd);
673    +       ccs_clear_open_mode();
674            if (!error)
675                    return nameidata_to_filp(&nd, flags);
676    
677    @@ -1159,6 +1184,8 @@ EXPORT_SYMBOL(sys_close);
678    */    */
679   asmlinkage long sys_vhangup(void)   SYSCALL_DEFINE0(vhangup)
680   {   {
 +       /***** TOMOYO Linux start. *****/  
681  +       if (!ccs_capable(CCS_SYS_VHANGUP))  +       if (!ccs_capable(CCS_SYS_VHANGUP))
682  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
683          if (capable(CAP_SYS_TTY_CONFIG)) {          if (capable(CAP_SYS_TTY_CONFIG)) {
684                  tty_vhangup(current->signal->tty);                  tty_vhangup(current->signal->tty);
685                  return 0;                  return 0;
686  --- linux-2.6.15-53.75.orig/fs/proc/Makefile  --- linux-2.6.15-55.81.orig/fs/proc/proc_misc.c
687  +++ linux-2.6.15-53.75/fs/proc/Makefile  +++ linux-2.6.15-55.81/fs/proc/proc_misc.c
688  @@ -13,3 +13,6 @@ proc-y       += inode.o root.o base.o ge  @@ -629,4 +629,5 @@ void __init proc_misc_init(void)
  proc-$(CONFIG_PROC_KCORE)      += kcore.o  
  proc-$(CONFIG_PROC_VMCORE)     += vmcore.o  
  proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o  
 +  
 +proc-$(CONFIG_SAKURA) += ccs_proc.o  
 +proc-$(CONFIG_TOMOYO) += ccs_proc.o  
 --- linux-2.6.15-53.75.orig/fs/proc/proc_misc.c  
 +++ linux-2.6.15-53.75/fs/proc/proc_misc.c  
 @@ -629,4 +629,9 @@ void __init proc_misc_init(void)  
689          if (entry)          if (entry)
690                  entry->proc_fops = &proc_sysrq_trigger_operations;                  entry->proc_fops = &proc_sysrq_trigger_operations;
691   #endif   #endif
692  +       /***** CCS start. *****/  +       printk(KERN_INFO "Hook version: 2.6.15-55.81 2009/12/05\n");
 +#if defined(CONFIG_SAKURA) || defined(CONFIG_TOMOYO)  
 +       printk(KERN_INFO "Hook version: 2.6.15-53.75 2009/03/18\n");  
 +#endif  
 +       /***** CCS end. *****/  
693   }   }
694  --- linux-2.6.15-53.75.orig/include/linux/init_task.h  --- linux-2.6.15-55.81.orig/include/linux/init_task.h
695  +++ linux-2.6.15-53.75/include/linux/init_task.h  +++ linux-2.6.15-55.81/include/linux/init_task.h
696  @@ -121,6 +121,10 @@ extern struct group_info init_groups;  @@ -72,6 +72,14 @@
697    
698     extern struct group_info init_groups;
699    
700    +#ifdef CONFIG_CCSECURITY
701    +#define INIT_CCSECURITY          \
702    +       .ccs_domain_info = NULL, \
703    +       .ccs_flags = 0,
704    +#else
705    +#define INIT_CCSECURITY
706    +#endif
707    +
708     /*
709      *  INIT_TASK is used to set up the first task table, touch at
710      * your own risk!. Base=0, limit=0x1fffff (=2MB)
711    @@ -121,6 +129,7 @@ extern struct group_info init_groups;
712          .journal_info   = NULL,                                         \          .journal_info   = NULL,                                         \
713          .cpu_timers     = INIT_CPU_TIMERS(tsk.cpu_timers),              \          .cpu_timers     = INIT_CPU_TIMERS(tsk.cpu_timers),              \
714          .fs_excl        = ATOMIC_INIT(0),                               \          .fs_excl        = ATOMIC_INIT(0),                               \
715  +       /***** TOMOYO Linux start. *****/        \  +       INIT_CCSECURITY                                                 \
 +       .ccs_domain_info = NULL,                 \  
 +       .ccs_flags = 0,                          \  
 +       /***** TOMOYO Linux end. *****/          \  
716   }   }
717    
718    
719  --- linux-2.6.15-53.75.orig/include/linux/sched.h  --- linux-2.6.15-55.81.orig/include/linux/sched.h
720  +++ linux-2.6.15-53.75/include/linux/sched.h  +++ linux-2.6.15-55.81/include/linux/sched.h
721  @@ -39,6 +39,10 @@  @@ -165,6 +165,8 @@ struct sched_param {
722    
723   struct exec_domain;   #ifdef __KERNEL__
724    
 +/***** TOMOYO Linux start. *****/  
725  +struct ccs_domain_info;  +struct ccs_domain_info;
 +/***** TOMOYO Linux end. *****/  
726  +  +
727     #include <linux/spinlock.h>
728    
729   /*   /*
730    * cloning flags:  @@ -858,6 +860,10 @@ struct task_struct {
   */  
 @@ -858,6 +862,10 @@ struct task_struct {  
731   #endif   #endif
732          atomic_t fs_excl;       /* holding fs exclusive resources */          atomic_t fs_excl;       /* holding fs exclusive resources */
733          struct list_head        *scm_work_list;          struct list_head        *scm_work_list;
734  +       /***** TOMOYO Linux start. *****/  +#ifdef CONFIG_CCSECURITY
735  +       struct ccs_domain_info *ccs_domain_info;  +       struct ccs_domain_info *ccs_domain_info;
736  +       u32 ccs_flags;  +       u32 ccs_flags;
737  +       /***** TOMOYO Linux end. *****/  +#endif
738   };   };
739    
740   static inline pid_t process_group(struct task_struct *tsk)   static inline pid_t process_group(struct task_struct *tsk)
741  --- linux-2.6.15-53.75.orig/kernel/compat.c  --- linux-2.6.15-55.81.orig/kernel/compat.c
742  +++ linux-2.6.15-53.75/kernel/compat.c  +++ linux-2.6.15-55.81/kernel/compat.c
743  @@ -24,6 +24,9 @@  @@ -24,6 +24,7 @@
744    
745   #include <asm/uaccess.h>   #include <asm/uaccess.h>
746   #include <asm/bug.h>   #include <asm/bug.h>
747  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
748    
749   int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)   int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
750   {   {
751  @@ -849,6 +852,10 @@ asmlinkage long compat_sys_stime(compat_  @@ -849,6 +850,8 @@ asmlinkage long compat_sys_stime(compat_
752          err = security_settime(&tv, NULL);          err = security_settime(&tv, NULL);
753          if (err)          if (err)
754                  return err;                  return err;
 +       /***** TOMOYO Linux start. *****/  
755  +       if (!ccs_capable(CCS_SYS_SETTIME))  +       if (!ccs_capable(CCS_SYS_SETTIME))
756  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
757    
758          do_settimeofday(&tv);          do_settimeofday(&tv);
759          return 0;          return 0;
760  --- linux-2.6.15-53.75.orig/kernel/kexec.c  --- linux-2.6.15-55.81.orig/kernel/kexec.c
761  +++ linux-2.6.15-53.75/kernel/kexec.c  +++ linux-2.6.15-55.81/kernel/kexec.c
762  @@ -25,6 +25,9 @@  @@ -25,6 +25,7 @@
763   #include <asm/io.h>   #include <asm/io.h>
764   #include <asm/system.h>   #include <asm/system.h>
765   #include <asm/semaphore.h>   #include <asm/semaphore.h>
766  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
767    
768   /* Location of the reserved area for the crash kernel */   /* Location of the reserved area for the crash kernel */
769   struct resource crashk_res = {   struct resource crashk_res = {
770  @@ -918,6 +921,10 @@ asmlinkage long sys_kexec_load(unsigned  @@ -917,6 +918,8 @@ SYSCALL_DEFINE4(kexec_load, unsigned lon
771          /* We only trust the superuser with rebooting the system. */          /* We only trust the superuser with rebooting the system. */
772          if (!capable(CAP_SYS_BOOT))          if (!capable(CAP_SYS_BOOT))
773                  return -EPERM;                  return -EPERM;
 +       /***** TOMOYO Linux start. *****/  
774  +       if (!ccs_capable(CCS_SYS_KEXEC_LOAD))  +       if (!ccs_capable(CCS_SYS_KEXEC_LOAD))
775  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
776    
777          /*          /*
778           * Verify we have a legal set of flags           * Verify we have a legal set of flags
779  --- linux-2.6.15-53.75.orig/kernel/kmod.c  --- linux-2.6.15-55.81.orig/kernel/kmod.c
780  +++ linux-2.6.15-53.75/kernel/kmod.c  +++ linux-2.6.15-55.81/kernel/kmod.c
781  @@ -149,6 +149,11 @@ static int ____call_usermodehelper(void  @@ -149,6 +149,11 @@ static int ____call_usermodehelper(void
782          /* We can run anywhere, unlike our parent keventd(). */          /* We can run anywhere, unlike our parent keventd(). */
783          set_cpus_allowed(current, CPU_MASK_ALL);          set_cpus_allowed(current, CPU_MASK_ALL);
784    
785  +       /***** TOMOYO Linux start. *****/  +#ifdef CONFIG_CCSECURITY
786  +       current->ccs_domain_info = NULL;  +       current->ccs_domain_info = NULL;
787  +       current->ccs_flags = 0;  +       current->ccs_flags = 0;
788  +       /***** TOMOYO Linux end. *****/  +#endif
789  +  +
790          retval = -EPERM;          retval = -EPERM;
791          if (current->fs->root)          if (current->fs->root)
792                  retval = execve(sub_info->path, sub_info->argv,sub_info->envp);                  retval = execve(sub_info->path, sub_info->argv,sub_info->envp);
793  --- linux-2.6.15-53.75.orig/kernel/module.c  --- linux-2.6.15-55.81.orig/kernel/module.c
794  +++ linux-2.6.15-53.75/kernel/module.c  +++ linux-2.6.15-55.81/kernel/module.c
795  @@ -41,6 +41,9 @@  @@ -41,6 +41,7 @@
796   #include <asm/uaccess.h>   #include <asm/uaccess.h>
797   #include <asm/semaphore.h>   #include <asm/semaphore.h>
798   #include <asm/cacheflush.h>   #include <asm/cacheflush.h>
799  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
800    
801   #if 0   #if 0
802   #define DEBUGP printk   #define DEBUGP printk
803  @@ -577,7 +580,10 @@ sys_delete_module(const char __user *nam  @@ -577,7 +578,8 @@ SYSCALL_DEFINE2(delete_module, const cha
804    
805          if (!capable(CAP_SYS_MODULE))          if (!capable(CAP_SYS_MODULE))
806                  return -EPERM;                  return -EPERM;
807  -  -
 +       /***** TOMOYO Linux start. *****/  
808  +       if (!ccs_capable(CCS_USE_KERNEL_MODULE))  +       if (!ccs_capable(CCS_USE_KERNEL_MODULE))
809  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
810          if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0)          if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0)
811                  return -EFAULT;                  return -EFAULT;
812          name[MODULE_NAME_LEN-1] = '\0';          name[MODULE_NAME_LEN-1] = '\0';
813  @@ -1886,7 +1892,10 @@ sys_init_module(void __user *umod,  @@ -1884,7 +1886,8 @@ SYSCALL_DEFINE3(init_module, void __user
814          /* Must have permission */          /* Must have permission */
815          if (!capable(CAP_SYS_MODULE))          if (!capable(CAP_SYS_MODULE))
816                  return -EPERM;                  return -EPERM;
817  -  -
 +       /***** TOMOYO Linux start. *****/  
818  +       if (!ccs_capable(CCS_USE_KERNEL_MODULE))  +       if (!ccs_capable(CCS_USE_KERNEL_MODULE))
819  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
820          /* Only one module load at a time, please */          /* Only one module load at a time, please */
821          if (down_interruptible(&module_mutex) != 0)          if (down_interruptible(&module_mutex) != 0)
822                  return -EINTR;                  return -EINTR;
823  --- linux-2.6.15-53.75.orig/kernel/ptrace.c  --- linux-2.6.15-55.81.orig/kernel/ptrace.c
824  +++ linux-2.6.15-53.75/kernel/ptrace.c  +++ linux-2.6.15-55.81/kernel/ptrace.c
825  @@ -20,6 +20,9 @@  @@ -21,6 +21,7 @@
826    
827   #include <asm/pgtable.h>   #include <asm/pgtable.h>
828   #include <asm/uaccess.h>   #include <asm/uaccess.h>
829  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
830    
831   /*   /*
832    * ptrace a task: make the debugger its new parent and    * ptrace a task: make the debugger its new parent and
833  @@ -492,6 +495,10 @@ asmlinkage long sys_ptrace(long request,  @@ -493,6 +494,8 @@ SYSCALL_DEFINE4(ptrace, long, request, l
834          /*          /*
835           * This lock_kernel fixes a subtle race with suid exec           * This lock_kernel fixes a subtle race with suid exec
836           */           */
837  +       /***** TOMOYO Linux start. *****/  +       if (ccs_ptrace_permission(request, pid))
 +       if (!ccs_capable(CCS_SYS_PTRACE))  
838  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
839          lock_kernel();          lock_kernel();
840          ret = ptrace_get_task_struct(request, pid, &child);          ret = ptrace_get_task_struct(request, pid, &child);
841          if (!child)          if (!child)
842  --- linux-2.6.15-53.75.orig/kernel/sched.c  --- linux-2.6.15-55.81.orig/kernel/sched.c
843  +++ linux-2.6.15-53.75/kernel/sched.c  +++ linux-2.6.15-55.81/kernel/sched.c
844  @@ -50,6 +50,9 @@  @@ -50,6 +50,7 @@
845   #include <asm/tlb.h>   #include <asm/tlb.h>
846    
847   #include <asm/unistd.h>   #include <asm/unistd.h>
848  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
849    
850   /*   /*
851    * Convert user-nice values [ -20 ... 0 ... 19 ]    * Convert user-nice values [ -20 ... 0 ... 19 ]
852  @@ -3603,6 +3606,10 @@ asmlinkage long sys_nice(int increment)  @@ -3603,6 +3604,8 @@ SYSCALL_DEFINE1(nice, int, increment)
853   {   {
854          int retval;          int retval;
855          long nice;          long nice;
 +       /***** TOMOYO Linux start. *****/  
856  +       if (!ccs_capable(CCS_SYS_NICE))  +       if (!ccs_capable(CCS_SYS_NICE))
857  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
858    
859          /*          /*
860           * Setpriority might change our priority at the same moment.           * Setpriority might change our priority at the same moment.
861  --- linux-2.6.15-53.75.orig/kernel/signal.c  --- linux-2.6.15-55.81.orig/kernel/signal.c
862  +++ linux-2.6.15-53.75/kernel/signal.c  +++ linux-2.6.15-55.81/kernel/signal.c
863  @@ -29,6 +29,9 @@  @@ -29,6 +29,7 @@
864   #include <asm/uaccess.h>   #include <asm/uaccess.h>
865   #include <asm/unistd.h>   #include <asm/unistd.h>
866   #include <asm/siginfo.h>   #include <asm/siginfo.h>
867  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
868    
869   /*   /*
870    * SLAB caches for signal bits.    * SLAB caches for signal bits.
871  @@ -2241,6 +2244,12 @@ asmlinkage long  @@ -2237,6 +2238,8 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const s
872   sys_kill(int pid, int sig)   SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
873   {   {
874          struct siginfo info;          struct siginfo info;
875  +       /***** TOMOYO Linux start. *****/  +       if (ccs_kill_permission(pid, sig))
 +       if (sig && !ccs_capable(CCS_SYS_KILL))  
 +               return -EPERM;  
 +       if (sig && ccs_check_signal_acl(sig, pid))  
876  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
877    
878          info.si_signo = sig;          info.si_signo = sig;
879          info.si_errno = 0;          info.si_errno = 0;
880  @@ -2299,6 +2308,12 @@ asmlinkage long sys_tgkill(int tgid, int  @@ -2295,6 +2298,8 @@ SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid
881          /* This is only valid for single tasks */          /* This is only valid for single tasks */
882          if (pid <= 0 || tgid <= 0)          if (pid <= 0 || tgid <= 0)
883                  return -EINVAL;                  return -EINVAL;
884  +       /***** TOMOYO Linux start. *****/  +       if (ccs_tgkill_permission(tgid, pid, sig))
 +       if (sig && !ccs_capable(CCS_SYS_KILL))  
885  +               return -EPERM;  +               return -EPERM;
 +       if (sig && ccs_check_signal_acl(sig, pid))  
 +               return -EPERM;  
 +       /***** TOMOYO Linux end. *****/  
886    
887          return do_tkill(tgid, pid, sig);          return do_tkill(tgid, pid, sig);
888   }   }
889  @@ -2312,6 +2327,12 @@ sys_tkill(int pid, int sig)  @@ -2307,6 +2312,8 @@ SYSCALL_DEFINE2(tkill, pid_t, pid, int,
890          /* This is only valid for single tasks */          /* This is only valid for single tasks */
891          if (pid <= 0)          if (pid <= 0)
892                  return -EINVAL;                  return -EINVAL;
893  +       /***** TOMOYO Linux start. *****/  +       if (ccs_tkill_permission(pid, sig))
 +       if (sig && !ccs_capable(CCS_SYS_KILL))  
 +               return -EPERM;  
 +       if (sig && ccs_check_signal_acl(sig, pid))  
894  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
895    
896          return do_tkill(0, pid, sig);          return do_tkill(0, pid, sig);
897   }   }
898  --- linux-2.6.15-53.75.orig/kernel/sys.c  @@ -2324,6 +2331,8 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t,
899  +++ linux-2.6.15-53.75/kernel/sys.c          if (info.si_code >= 0)
900  @@ -37,6 +37,9 @@                  return -EPERM;
901            info.si_signo = sig;
902    +       if (ccs_sigqueue_permission(pid, sig))
903    +               return -EPERM;
904    
905            /* POSIX.1b doesn't mention process groups.  */
906            return kill_proc_info(sig, &info, pid);
907    --- linux-2.6.15-55.81.orig/kernel/sys.c
908    +++ linux-2.6.15-55.81/kernel/sys.c
909    @@ -37,6 +37,7 @@
910   #include <asm/uaccess.h>   #include <asm/uaccess.h>
911   #include <asm/io.h>   #include <asm/io.h>
912   #include <asm/unistd.h>   #include <asm/unistd.h>
913  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
914    
915   #ifndef SET_UNALIGN_CTL   #ifndef SET_UNALIGN_CTL
916   # define SET_UNALIGN_CTL(a,b)  (-EINVAL)   # define SET_UNALIGN_CTL(a,b)  (-EINVAL)
917  @@ -256,6 +259,12 @@ asmlinkage long sys_setpriority(int whic  @@ -256,6 +257,10 @@ SYSCALL_DEFINE3(setpriority, int, which,
918    
919          if (which > 2 || which < 0)          if (which > 2 || which < 0)
920                  goto out;                  goto out;
 +       /***** TOMOYO Linux start. *****/  
921  +       if (!ccs_capable(CCS_SYS_NICE)) {  +       if (!ccs_capable(CCS_SYS_NICE)) {
922  +               error = -EPERM;  +               error = -EPERM;
923  +               goto out;  +               goto out;
924  +       }  +       }
 +       /***** TOMOYO Linux end. *****/  
925    
926          /* normalize: avoid signed division (rounding problems) */          /* normalize: avoid signed division (rounding problems) */
927          error = -ESRCH;          error = -ESRCH;
928  @@ -483,6 +492,10 @@ asmlinkage long sys_reboot(int magic1, i  @@ -484,6 +489,8 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
929                          magic2 != LINUX_REBOOT_MAGIC2B &&                          magic2 != LINUX_REBOOT_MAGIC2B &&
930                          magic2 != LINUX_REBOOT_MAGIC2C))                          magic2 != LINUX_REBOOT_MAGIC2C))
931                  return -EINVAL;                  return -EINVAL;
 +       /***** TOMOYO Linux start. *****/  
932  +       if (!ccs_capable(CCS_SYS_REBOOT))  +       if (!ccs_capable(CCS_SYS_REBOOT))
933  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
934    
935          lock_kernel();          lock_kernel();
936          switch (cmd) {          switch (cmd) {
937  @@ -1515,6 +1528,10 @@ asmlinkage long sys_sethostname(char __u  @@ -1518,6 +1525,8 @@ SYSCALL_DEFINE2(sethostname, char __user
938                  return -EPERM;                  return -EPERM;
939          if (len < 0 || len > __NEW_UTS_LEN)          if (len < 0 || len > __NEW_UTS_LEN)
940                  return -EINVAL;                  return -EINVAL;
 +       /***** TOMOYO Linux start. *****/  
941  +       if (!ccs_capable(CCS_SYS_SETHOSTNAME))  +       if (!ccs_capable(CCS_SYS_SETHOSTNAME))
942  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
943          down_write(&uts_sem);          down_write(&uts_sem);
944          errno = -EFAULT;          errno = -EFAULT;
945          if (!copy_from_user(tmp, name, len)) {          if (!copy_from_user(tmp, name, len)) {
946  @@ -1560,6 +1577,10 @@ asmlinkage long sys_setdomainname(char _  @@ -1563,6 +1572,8 @@ SYSCALL_DEFINE2(setdomainname, char __us
947                  return -EPERM;                  return -EPERM;
948          if (len < 0 || len > __NEW_UTS_LEN)          if (len < 0 || len > __NEW_UTS_LEN)
949                  return -EINVAL;                  return -EINVAL;
 +       /***** TOMOYO Linux start. *****/  
950  +       if (!ccs_capable(CCS_SYS_SETHOSTNAME))  +       if (!ccs_capable(CCS_SYS_SETHOSTNAME))
951  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
952    
953          down_write(&uts_sem);          down_write(&uts_sem);
954          errno = -EFAULT;          errno = -EFAULT;
955  --- linux-2.6.15-53.75.orig/kernel/sysctl.c  --- linux-2.6.15-55.81.orig/kernel/sysctl.c
956  +++ linux-2.6.15-53.75/kernel/sysctl.c  +++ linux-2.6.15-55.81/kernel/sysctl.c
957  @@ -45,6 +45,9 @@  @@ -45,6 +45,7 @@
958    
959   #include <asm/uaccess.h>   #include <asm/uaccess.h>
960   #include <asm/processor.h>   #include <asm/processor.h>
961  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
962    
963   #ifdef CONFIG_ROOT_NFS   #ifdef CONFIG_ROOT_NFS
964   #include <linux/nfs_fs.h>   #include <linux/nfs_fs.h>
965  @@ -1041,6 +1044,100 @@ void __init sysctl_init(void)  @@ -1066,6 +1067,9 @@ int do_sysctl(int __user *name, int nlen
  #endif  
  }  
   
 +/***** TOMOYO Linux start. *****/  
 +static int try_parse_table(int __user *name, int nlen, void __user *oldval,  
 +                          void __user *newval, ctl_table *table)  
 +{  
 +       int n;  
 +       int error = -ENOMEM;  
 +       int op = 0;  
 +       char *buffer = kmalloc(PAGE_SIZE, GFP_KERNEL);  
 +       if (oldval)  
 +               op |= 004;  
 +       if (newval)  
 +               op |= 002;  
 +       if (!op) { /* Neither read nor write */  
 +               error = 0;  
 +               goto out;  
 +       }  
 +       if (!buffer)  
 +               goto out;  
 +       memset(buffer, 0, PAGE_SIZE);  
 +       snprintf(buffer, PAGE_SIZE - 1, "/proc/sys");  
 + repeat:  
 +       if (!nlen) {  
 +               error = -ENOTDIR;  
 +               goto out;  
 +       }  
 +       if (get_user(n, name)) {  
 +               error = -EFAULT;  
 +               goto out;  
 +       }  
 +       for ( ; table->ctl_name; table++) {  
 +               if (n == table->ctl_name || table->ctl_name == CTL_ANY) {  
 +                       int pos = strlen(buffer);  
 +                       const char *cp = table->procname;  
 +                       error = -ENOMEM;  
 +                       if (cp) {  
 +                               if (pos + 1 >= PAGE_SIZE - 1)  
 +                                       goto out;  
 +                               buffer[pos++] = '/';  
 +                               while (*cp) {  
 +                                       const unsigned char c  
 +                                               = *(const unsigned char *) cp;  
 +                                       if (c == '\\') {  
 +                                               if (pos + 2 >= PAGE_SIZE - 1)  
 +                                                       goto out;  
 +                                               buffer[pos++] = '\\';  
 +                                               buffer[pos++] = '\\';  
 +                                       } else if (c > ' ' && c < 127) {  
 +                                               if (pos + 1 >= PAGE_SIZE - 1)  
 +                                                       goto out;  
 +                                               buffer[pos++] = c;  
 +                                       } else {  
 +                                               if (pos + 4 >= PAGE_SIZE - 1)  
 +                                                       goto out;  
 +                                               buffer[pos++] = '\\';  
 +                                               buffer[pos++] = (c >> 6) + '0';  
 +                                               buffer[pos++] = ((c >> 3) & 7)  
 +                                                       + '0';  
 +                                               buffer[pos++] = (c & 7) + '0';  
 +                                       }  
 +                                       cp++;  
 +                               }  
 +                       } else {  
 +                               /* Assume nobody assigns "=\$=" for procname. */  
 +                               snprintf(buffer + pos, PAGE_SIZE - pos - 1,  
 +                                        "/=%d=", table->ctl_name);  
 +                               if (!memchr(buffer, '\0', PAGE_SIZE - 2))  
 +                                       goto out;  
 +                       }  
 +                       if (table->child) {  
 +                               if (table->strategy) {  
 +                                       /* printk("sysctl='%s'\n", buffer); */  
 +                                       if (ccs_check_file_perm(buffer, op,  
 +                                                               "sysctl")) {  
 +                                               error = -EPERM;  
 +                                               goto out;  
 +                                       }  
 +                               }  
 +                               name++;  
 +                               nlen--;  
 +                               table = table->child;  
 +                               goto repeat;  
 +                       }  
 +                       /* printk("sysctl='%s'\n", buffer); */  
 +                       error = ccs_check_file_perm(buffer, op, "sysctl");  
 +                       goto out;  
 +               }  
 +       }  
 +       error = -ENOTDIR;  
 + out:  
 +       kfree(buffer);  
 +       return error;  
 +}  
 +/***** TOMOYO Linux end. *****/  
 +  
  int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp,  
                void __user *newval, size_t newlen)  
  {  
 @@ -1066,6 +1163,11 @@ int do_sysctl(int __user *name, int nlen  
966    
967                  spin_unlock(&sysctl_lock);                  spin_unlock(&sysctl_lock);
968    
969  +               /***** TOMOYO Linux start. *****/  +               error = ccs_parse_table(name, nlen, oldval, newval,
 +               error = try_parse_table(name, nlen, oldval, newval,  
970  +                                       head->ctl_table);  +                                       head->ctl_table);
971  +               if (!error)  +               if (!error)
 +               /***** TOMOYO Linux end. *****/  
972                  error = parse_table(name, nlen, oldval, oldlenp,                  error = parse_table(name, nlen, oldval, oldlenp,
973                                          newval, newlen, head->ctl_table,                                          newval, newlen, head->ctl_table,
974                                          &context);                                          &context);
975  @@ -1138,6 +1240,15 @@ repeat:  @@ -1138,6 +1142,13 @@ repeat:
976                                  if (ctl_perm(table, 001))                                  if (ctl_perm(table, 001))
977                                          return -EPERM;                                          return -EPERM;
978                                  if (table->strategy) {                                  if (table->strategy) {
 +                                       /***** TOMOYO Linux start. *****/  
979  +                                       int op = 0;  +                                       int op = 0;
980  +                                       if (oldval)  +                                       if (oldval)
981  +                                               op |= 004;  +                                               op |= 004;
# Line 1260  Source code for this patch is "apt-get i Line 983  Source code for this patch is "apt-get i
983  +                                               op |= 002;  +                                               op |= 002;
984  +                                       if (ctl_perm(table, op))  +                                       if (ctl_perm(table, op))
985  +                                               return -EPERM;  +                                               return -EPERM;
 +                                       /***** TOMOYO Linux end. *****/  
986                                          error = table->strategy(                                          error = table->strategy(
987                                                  table, name, nlen,                                                  table, name, nlen,
988                                                  oldval, oldlenp,                                                  oldval, oldlenp,
989  --- linux-2.6.15-53.75.orig/kernel/time.c  --- linux-2.6.15-55.81.orig/kernel/time.c
990  +++ linux-2.6.15-53.75/kernel/time.c  +++ linux-2.6.15-55.81/kernel/time.c
991  @@ -38,6 +38,9 @@  @@ -38,6 +38,7 @@
992    
993   #include <asm/uaccess.h>   #include <asm/uaccess.h>
994   #include <asm/unistd.h>   #include <asm/unistd.h>
995  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
996    
997   /*   /*
998    * The timezone where the local system is located.  Used as a default by some    * The timezone where the local system is located.  Used as a default by some
999  @@ -90,6 +93,10 @@ asmlinkage long sys_stime(time_t __user  @@ -90,6 +91,8 @@ SYSCALL_DEFINE1(stime, time_t __user *,
1000          err = security_settime(&tv, NULL);          err = security_settime(&tv, NULL);
1001          if (err)          if (err)
1002                  return err;                  return err;
 +       /***** TOMOYO Linux start. *****/  
1003  +       if (!ccs_capable(CCS_SYS_SETTIME))  +       if (!ccs_capable(CCS_SYS_SETTIME))
1004  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
1005    
1006          do_settimeofday(&tv);          do_settimeofday(&tv);
1007          return 0;          return 0;
1008  @@ -157,6 +164,10 @@ int do_sys_settimeofday(struct timespec  @@ -158,6 +161,8 @@ int do_sys_settimeofday(struct timespec
1009          error = security_settime(tv, tz);          error = security_settime(tv, tz);
1010          if (error)          if (error)
1011                  return error;                  return error;
 +       /***** TOMOYO Linux start. *****/  
1012  +       if (!ccs_capable(CCS_SYS_SETTIME))  +       if (!ccs_capable(CCS_SYS_SETTIME))
1013  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
1014    
1015          if (tz) {          if (tz) {
1016                  /* SMP safe, global irq locking makes it work. */                  /* SMP safe, global irq locking makes it work. */
1017  @@ -235,6 +246,10 @@ int do_adjtimex(struct timex *txc)  @@ -236,6 +241,8 @@ int do_adjtimex(struct timex *txc)
1018          /* In order to modify anything, you gotta be super-user! */          /* In order to modify anything, you gotta be super-user! */
1019          if (txc->modes && !capable(CAP_SYS_TIME))          if (txc->modes && !capable(CAP_SYS_TIME))
1020                  return -EPERM;                  return -EPERM;
 +       /***** TOMOYO Linux start. *****/  
1021  +       if (txc->modes && !ccs_capable(CCS_SYS_SETTIME))  +       if (txc->modes && !ccs_capable(CCS_SYS_SETTIME))
1022  +               return -EPERM;  +               return -EPERM;
 +       /***** TOMOYO Linux end. *****/  
1023                                    
1024          /* Now we validate the data before disabling interrupts */          /* Now we validate the data before disabling interrupts */
1025    
1026  --- linux-2.6.15-53.75.orig/net/core/datagram.c  --- linux-2.6.15-55.81.orig/net/ipv4/inet_connection_sock.c
1027  +++ linux-2.6.15-53.75/net/core/datagram.c  +++ linux-2.6.15-55.81/net/ipv4/inet_connection_sock.c
1028  @@ -55,6 +55,11 @@  @@ -24,6 +24,7 @@
  #include <net/sock.h>  
  #include <net/tcp_states.h>  
   
 +/***** TOMOYO Linux start. *****/  
 +#include <linux/tomoyo.h>  
 +#include <linux/tomoyo_socket.h>  
 +/***** TOMOYO Linux end. *****/  
 +  
  /*  
   *     Is a socket 'connection oriented' ?  
   */  
 @@ -177,6 +182,12 @@ struct sk_buff *skb_recv_datagram(struct  
                 } else  
                         skb = skb_dequeue(&sk->sk_receive_queue);  
   
 +               /***** TOMOYO Linux start. *****/  
 +               error = ccs_socket_recv_datagram_permission(sk, skb, flags);  
 +               if (error)  
 +                       goto no_packet;  
 +               /***** TOMOYO Linux end. *****/  
 +  
                 if (skb)  
                         return skb;  
   
 --- linux-2.6.15-53.75.orig/net/ipv4/inet_connection_sock.c  
 +++ linux-2.6.15-53.75/net/ipv4/inet_connection_sock.c  
 @@ -24,6 +24,9 @@  
1029   #include <net/route.h>   #include <net/route.h>
1030   #include <net/tcp_states.h>   #include <net/tcp_states.h>
1031   #include <net/xfrm.h>   #include <net/xfrm.h>
1032  +/***** SAKURA Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/sakura.h>  
 +/***** SAKURA Linux end. *****/  
1033    
1034   #ifdef INET_CSK_DEBUG   #ifdef INET_CSK_DEBUG
1035   const char inet_csk_timer_bug_msg[] = "inet_csk BUG: unknown timer value\n";   const char inet_csk_timer_bug_msg[] = "inet_csk BUG: unknown timer value\n";
1036  @@ -83,6 +86,10 @@ int inet_csk_get_port(struct inet_hashin  @@ -83,6 +84,8 @@ int inet_csk_get_port(struct inet_hashin
1037                  do {                  do {
1038                          head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)];                          head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)];
1039                          spin_lock(&head->lock);                          spin_lock(&head->lock);
1040  +                       /***** SAKURA Linux start. *****/  +                       if (ccs_lport_reserved(rover))
 +                       if (ccs_may_autobind(rover))  
1041  +                               goto next;  +                               goto next;
 +                       /***** SAKURA Linux end. *****/  
1042                          inet_bind_bucket_for_each(tb, node, &head->chain)                          inet_bind_bucket_for_each(tb, node, &head->chain)
1043                                  if (tb->port == rover)                                  if (tb->port == rover)
1044                                          goto next;                                          goto next;
1045  --- linux-2.6.15-53.75.orig/net/ipv4/tcp_ipv4.c  --- linux-2.6.15-55.81.orig/net/ipv4/raw.c
1046  +++ linux-2.6.15-53.75/net/ipv4/tcp_ipv4.c  +++ linux-2.6.15-55.81/net/ipv4/raw.c
1047  @@ -76,6 +76,9 @@  @@ -79,6 +79,7 @@
1048     #include <linux/seq_file.h>
1049     #include <linux/netfilter.h>
1050     #include <linux/netfilter_ipv4.h>
1051    +#include <linux/ccsecurity.h>
1052    
1053     struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE];
1054     DEFINE_RWLOCK(raw_v4_lock);
1055    @@ -591,6 +592,9 @@ static int raw_recvmsg(struct kiocb *ioc
1056            skb = skb_recv_datagram(sk, flags, noblock, &err);
1057            if (!skb)
1058                    goto out;
1059    +       err = ccs_socket_recvmsg_permission(sk, skb, flags);
1060    +       if (err)
1061    +               goto out;
1062    
1063            copied = skb->len;
1064            if (len < copied) {
1065    --- linux-2.6.15-55.81.orig/net/ipv4/tcp_ipv4.c
1066    +++ linux-2.6.15-55.81/net/ipv4/tcp_ipv4.c
1067    @@ -76,6 +76,7 @@
1068   #include <linux/stddef.h>   #include <linux/stddef.h>
1069   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
1070   #include <linux/seq_file.h>   #include <linux/seq_file.h>
1071  +/***** SAKURA Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/sakura.h>  
 +/***** SAKURA Linux end. *****/  
1072    
1073   int sysctl_tcp_tw_reuse;   int sysctl_tcp_tw_reuse;
1074   int sysctl_tcp_low_latency;   int sysctl_tcp_low_latency;
1075  @@ -243,6 +246,10 @@ static inline int tcp_v4_hash_connect(st  @@ -243,6 +244,8 @@ static inline int tcp_v4_hash_connect(st
1076                  local_bh_disable();                  local_bh_disable();
1077                  for (i = 1; i <= range; i++) {                  for (i = 1; i <= range; i++) {
1078                          port = low + (i + offset) % range;                          port = low + (i + offset) % range;
1079  +                       /***** SAKURA Linux start. *****/  +                       if (ccs_lport_reserved(port))
 +                       if (ccs_may_autobind(port))  
1080  +                               continue;  +                               continue;
 +                       /***** SAKURA Linux end. *****/  
1081                          head = &tcp_hashinfo.bhash[inet_bhashfn(port, tcp_hashinfo.bhash_size)];                          head = &tcp_hashinfo.bhash[inet_bhashfn(port, tcp_hashinfo.bhash_size)];
1082                          spin_lock(&head->lock);                          spin_lock(&head->lock);
1083    
1084  --- linux-2.6.15-53.75.orig/net/ipv4/udp.c  --- linux-2.6.15-55.81.orig/net/ipv4/udp.c
1085  +++ linux-2.6.15-53.75/net/ipv4/udp.c  +++ linux-2.6.15-55.81/net/ipv4/udp.c
1086  @@ -108,6 +108,9 @@  @@ -108,6 +108,7 @@
1087   #include <net/inet_common.h>   #include <net/inet_common.h>
1088   #include <net/checksum.h>   #include <net/checksum.h>
1089   #include <net/xfrm.h>   #include <net/xfrm.h>
1090  +/***** SAKURA Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/sakura.h>  
 +/***** SAKURA Linux end. *****/  
1091    
1092   /*   /*
1093    *     Snmp MIB for the UDP layer    *     Snmp MIB for the UDP layer
1094  @@ -146,6 +149,10 @@ static int udp_v4_get_port(struct sock *  @@ -146,6 +147,8 @@ static int udp_v4_get_port(struct sock *
1095                                          result = sysctl_local_port_range[0] +                                          result = sysctl_local_port_range[0] +
1096                                                  ((result - sysctl_local_port_range[0]) &                                                  ((result - sysctl_local_port_range[0]) &
1097                                                   (UDP_HTABLE_SIZE - 1));                                                   (UDP_HTABLE_SIZE - 1));
1098  +                               /***** SAKURA Linux start. *****/  +                               if (ccs_lport_reserved(result))
 +                               if (ccs_may_autobind(result))  
1099  +                                       continue;  +                                       continue;
 +                               /***** SAKURA Linux end. *****/  
1100                                  goto gotit;                                  goto gotit;
1101                          }                          }
1102                          size = 0;                          size = 0;
1103  @@ -162,6 +169,10 @@ static int udp_v4_get_port(struct sock *  @@ -162,6 +165,8 @@ static int udp_v4_get_port(struct sock *
1104                                  result = sysctl_local_port_range[0]                                  result = sysctl_local_port_range[0]
1105                                          + ((result - sysctl_local_port_range[0]) &                                          + ((result - sysctl_local_port_range[0]) &
1106                                             (UDP_HTABLE_SIZE - 1));                                             (UDP_HTABLE_SIZE - 1));
1107  +                       /***** SAKURA Linux start. *****/  +                       if (ccs_lport_reserved(result))
 +                       if (ccs_may_autobind(result))  
1108  +                               continue;  +                               continue;
 +                       /***** SAKURA Linux end. *****/  
1109                          if (!udp_lport_inuse(result))                          if (!udp_lport_inuse(result))
1110                                  break;                                  break;
1111                  }                  }
1112  --- linux-2.6.15-53.75.orig/net/ipv6/tcp_ipv6.c  @@ -798,7 +803,10 @@ try_again:
1113  +++ linux-2.6.15-53.75/net/ipv6/tcp_ipv6.c          skb = skb_recv_datagram(sk, flags, noblock, &err);
1114  @@ -64,6 +64,9 @@          if (!skb)
1115                    goto out;
1116    -  
1117    +       err = ccs_socket_recvmsg_permission(sk, skb, flags);
1118    +       if (err)
1119    +               goto out;
1120    +
1121            copied = skb->len - sizeof(struct udphdr);
1122            if (copied > len) {
1123                    copied = len;
1124    --- linux-2.6.15-55.81.orig/net/ipv6/raw.c
1125    +++ linux-2.6.15-55.81/net/ipv6/raw.c
1126    @@ -56,6 +56,7 @@
1127    
1128   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
1129   #include <linux/seq_file.h>   #include <linux/seq_file.h>
1130  +/***** SAKURA Linux start. *****/  +#include <linux/ccsecurity.h>
1131  +#include <linux/sakura.h>  
1132  +/***** SAKURA Linux end. *****/   struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE];
1133     DEFINE_RWLOCK(raw_v6_lock);
1134    @@ -387,6 +388,9 @@ static int rawv6_recvmsg(struct kiocb *i
1135            skb = skb_recv_datagram(sk, flags, noblock, &err);
1136            if (!skb)
1137                    goto out;
1138    +       err = ccs_socket_recvmsg_permission(sk, skb, flags);
1139    +       if (err)
1140    +               goto out;
1141    
1142            copied = skb->len;
1143            if (copied > len) {
1144    --- linux-2.6.15-55.81.orig/net/ipv6/tcp_ipv6.c
1145    +++ linux-2.6.15-55.81/net/ipv6/tcp_ipv6.c
1146    @@ -64,6 +64,7 @@
1147    
1148     #include <linux/proc_fs.h>
1149     #include <linux/seq_file.h>
1150    +#include <linux/ccsecurity.h>
1151    
1152   static void    tcp_v6_send_reset(struct sk_buff *skb);   static void    tcp_v6_send_reset(struct sk_buff *skb);
1153   static void    tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req);   static void    tcp_v6_reqsk_send_ack(struct sk_buff *skb, struct request_sock *req);
1154  @@ -119,6 +122,10 @@ static int tcp_v6_get_port(struct sock *  @@ -119,6 +120,8 @@ static int tcp_v6_get_port(struct sock *
1155                  do {                  do {
1156                          head = &tcp_hashinfo.bhash[inet_bhashfn(rover, tcp_hashinfo.bhash_size)];                          head = &tcp_hashinfo.bhash[inet_bhashfn(rover, tcp_hashinfo.bhash_size)];
1157                          spin_lock(&head->lock);                          spin_lock(&head->lock);
1158  +                       /***** SAKURA Linux start. *****/  +                       if (ccs_lport_reserved(rover))
 +                       if (ccs_may_autobind(rover))  
1159  +                               goto next;  +                               goto next;
 +                       /***** SAKURA Linux end. *****/  
1160                          inet_bind_bucket_for_each(tb, node, &head->chain)                          inet_bind_bucket_for_each(tb, node, &head->chain)
1161                                  if (tb->port == rover)                                  if (tb->port == rover)
1162                                          goto next;                                          goto next;
1163  @@ -419,6 +426,10 @@ static int tcp_v6_hash_connect(struct so  @@ -419,6 +422,8 @@ static int tcp_v6_hash_connect(struct so
1164                  local_bh_disable();                  local_bh_disable();
1165                  for (i = 1; i <= range; i++) {                  for (i = 1; i <= range; i++) {
1166                          port = low + (i + offset) % range;                          port = low + (i + offset) % range;
1167  +                       /***** SAKURA Linux start. *****/  +                       if (ccs_lport_reserved(port))
 +                       if (ccs_may_autobind(port))  
1168  +                               continue;  +                               continue;
 +                       /***** SAKURA Linux end. *****/  
1169                          head = &tcp_hashinfo.bhash[inet_bhashfn(port, tcp_hashinfo.bhash_size)];                          head = &tcp_hashinfo.bhash[inet_bhashfn(port, tcp_hashinfo.bhash_size)];
1170                          spin_lock(&head->lock);                          spin_lock(&head->lock);
1171    
1172  --- linux-2.6.15-53.75.orig/net/ipv6/udp.c  --- linux-2.6.15-55.81.orig/net/ipv6/udp.c
1173  +++ linux-2.6.15-53.75/net/ipv6/udp.c  +++ linux-2.6.15-55.81/net/ipv6/udp.c
1174  @@ -58,6 +58,9 @@  @@ -58,6 +58,7 @@
1175    
1176   #include <linux/proc_fs.h>   #include <linux/proc_fs.h>
1177   #include <linux/seq_file.h>   #include <linux/seq_file.h>
1178  +/***** SAKURA Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/sakura.h>  
 +/***** SAKURA Linux end. *****/  
1179    
1180   DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly;   DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly;
1181    
1182  @@ -88,6 +91,10 @@ static int udp_v6_get_port(struct sock *  @@ -88,6 +89,8 @@ static int udp_v6_get_port(struct sock *
1183                                          result = sysctl_local_port_range[0] +                                          result = sysctl_local_port_range[0] +
1184                                                  ((result - sysctl_local_port_range[0]) &                                                  ((result - sysctl_local_port_range[0]) &
1185                                                   (UDP_HTABLE_SIZE - 1));                                                   (UDP_HTABLE_SIZE - 1));
1186  +                               /***** SAKURA Linux start. *****/  +                               if (ccs_lport_reserved(result))
 +                               if (ccs_may_autobind(result))  
1187  +                                       continue;  +                                       continue;
 +                               /***** SAKURA Linux end. *****/  
1188                                  goto gotit;                                  goto gotit;
1189                          }                          }
1190                          size = 0;                          size = 0;
1191  @@ -104,6 +111,10 @@ static int udp_v6_get_port(struct sock *  @@ -104,6 +107,8 @@ static int udp_v6_get_port(struct sock *
1192                                  result = sysctl_local_port_range[0]                                  result = sysctl_local_port_range[0]
1193                                          + ((result - sysctl_local_port_range[0]) &                                          + ((result - sysctl_local_port_range[0]) &
1194                                             (UDP_HTABLE_SIZE - 1));                                             (UDP_HTABLE_SIZE - 1));
1195  +                       /***** SAKURA Linux start. *****/  +                       if (ccs_lport_reserved(result))
 +                       if (ccs_may_autobind(result))  
1196  +                               continue;  +                               continue;
 +                       /***** SAKURA Linux end. *****/  
1197                          if (!udp_lport_inuse(result))                          if (!udp_lport_inuse(result))
1198                                  break;                                  break;
1199                  }                  }
1200  --- linux-2.6.15-53.75.orig/net/socket.c  @@ -237,6 +242,9 @@ try_again:
1201  +++ linux-2.6.15-53.75/net/socket.c          skb = skb_recv_datagram(sk, flags, noblock, &err);
1202  @@ -97,6 +97,11 @@          if (!skb)
1203                    goto out;
1204    +       err = ccs_socket_recvmsg_permission(sk, skb, flags);
1205    +       if (err)
1206    +               goto out;
1207    
1208            copied = skb->len - sizeof(struct udphdr);
1209            if (copied > len) {
1210    --- linux-2.6.15-55.81.orig/net/socket.c
1211    +++ linux-2.6.15-55.81/net/socket.c
1212    @@ -97,6 +97,8 @@
1213   #include <net/sock.h>   #include <net/sock.h>
1214   #include <linux/netfilter.h>   #include <linux/netfilter.h>
1215    
1216  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +#include <linux/tomoyo_socket.h>  
 +/***** TOMOYO Linux end. *****/  
1217  +  +
1218   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);   static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
1219   static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf,   static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf,
1220                           size_t size, loff_t pos);                           size_t size, loff_t pos);
1221  @@ -546,7 +551,12 @@ static inline int __sock_sendmsg(struct  @@ -544,9 +546,10 @@ static inline int __sock_sendmsg(struct
1222            si->size = size;
1223    
1224          err = security_socket_sendmsg(sock, msg, size);          err = security_socket_sendmsg(sock, msg, size);
1225    +       if (!err)
1226    +               err = ccs_socket_sendmsg_permission(sock, msg, size);
1227          if (err)          if (err)
1228                  return err;                  return err;
1229  -  -
 +       /***** TOMOYO Linux start. *****/  
 +       if (ccs_socket_sendmsg_permission(sock,  
 +                                         (struct sockaddr *) msg->msg_name,  
 +                                         msg->msg_namelen))  
 +               return -EPERM;  
 +       /***** TOMOYO Linux end. *****/  
1230          return sock->ops->sendmsg(iocb, sock, msg, size);          return sock->ops->sendmsg(iocb, sock, msg, size);
1231   }   }
1232    
1233  @@ -1099,6 +1109,12 @@ static int __sock_create(int family, int  @@ -1103,6 +1106,8 @@ static int __sock_create(int family, int
                 family = PF_PACKET;  
1234          }          }
1235    
 +       /***** TOMOYO Linux start. *****/  
 +       err = ccs_socket_create_permission(family, type, protocol);  
 +       if (err)  
 +               return err;  
 +       /***** TOMOYO Linux end. *****/  
 +  
1236          err = security_socket_create(family, type, protocol, kern);          err = security_socket_create(family, type, protocol, kern);
1237    +       if (!err)
1238    +               err = ccs_socket_create_permission(family, type, protocol);
1239          if (err)          if (err)
1240                  return err;                  return err;
1241  @@ -1296,6 +1312,12 @@ asmlinkage long sys_bind(int fd, struct                  
1242    @@ -1300,6 +1305,10 @@ SYSCALL_DEFINE3(bind, int, fd, struct so
1243                                  sockfd_put(sock);                                  sockfd_put(sock);
1244                                  return err;                                  return err;
1245                          }                          }
 +                       /***** TOMOYO Linux start. *****/  
1246  +                       err = ccs_socket_bind_permission(sock,  +                       err = ccs_socket_bind_permission(sock,
1247  +                                                        (struct sockaddr *)  +                                                        (struct sockaddr *)
1248  +                                                        address, addrlen);  +                                                        address, addrlen);
1249  +                       if (!err)  +                       if (!err)
 +                       /***** TOMOYO Linux end. *****/  
1250                          err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen);                          err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen);
1251                  }                  }
1252                  sockfd_put(sock);                  sockfd_put(sock);
1253  @@ -1326,7 +1348,10 @@ asmlinkage long sys_listen(int fd, int b  @@ -1330,7 +1339,8 @@ SYSCALL_DEFINE2(listen, int, fd, int, ba
1254                          sockfd_put(sock);                          sockfd_put(sock);
1255                          return err;                          return err;
1256                  }                  }
1257  -  -
 +               /***** TOMOYO Linux start. *****/  
1258  +               err = ccs_socket_listen_permission(sock);  +               err = ccs_socket_listen_permission(sock);
1259  +               if (!err)  +               if (!err)
 +               /***** TOMOYO Linux end. *****/  
1260                  err=sock->ops->listen(sock, backlog);                  err=sock->ops->listen(sock, backlog);
1261                  sockfd_put(sock);                  sockfd_put(sock);
1262          }          }
1263  @@ -1377,6 +1402,13 @@ asmlinkage long sys_accept(int fd, struc  @@ -1382,6 +1392,11 @@ SYSCALL_DEFINE3(accept, int, fd, struct
1264          if (err < 0)          if (err < 0)
1265                  goto out_release;                  goto out_release;
1266    
 +       /***** TOMOYO Linux start. *****/  
1267  +       if (ccs_socket_accept_permission(newsock,  +       if (ccs_socket_accept_permission(newsock,
1268  +                                        (struct sockaddr *) address)) {  +                                        (struct sockaddr *) address)) {
1269  +               err = -ECONNABORTED; /* Hope less harmful than -EPERM. */  +               err = -ECONNABORTED; /* Hope less harmful than -EPERM. */
1270  +               goto out_release;  +               goto out_release;
1271  +       }  +       }
 +       /***** TOMOYO Linux end. *****/  
1272          if (upeer_sockaddr) {          if (upeer_sockaddr) {
1273                  if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) {                  if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) {
1274                          err = -ECONNABORTED;                          err = -ECONNABORTED;
1275  @@ -1432,7 +1464,12 @@ asmlinkage long sys_connect(int fd, stru  @@ -1436,9 +1451,11 @@ SYSCALL_DEFINE3(connect, int, fd, struct
1276                    goto out_put;
1277    
1278          err = security_socket_connect(sock, (struct sockaddr *)address, addrlen);          err = security_socket_connect(sock, (struct sockaddr *)address, addrlen);
1279    +       if (!err)
1280    +               err = ccs_socket_connect_permission(sock, (struct sockaddr *)
1281    +                                                   address, addrlen);
1282          if (err)          if (err)
1283                  goto out_put;                  goto out_put;
1284  -  -
 +       /***** TOMOYO Linux start. *****/  
 +       err = ccs_socket_connect_permission(sock, (struct sockaddr *) address,  
 +                                           addrlen);  
 +       if (err)  
 +               goto out_put;  
 +       /***** TOMOYO Linux end. *****/  
1285          err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen,          err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen,
1286                                   sock->file->f_flags);                                   sock->file->f_flags);
1287   out_put:   out_put:
1288  --- linux-2.6.15-53.75.orig/net/unix/af_unix.c  --- linux-2.6.15-55.81.orig/net/unix/af_unix.c
1289  +++ linux-2.6.15-53.75/net/unix/af_unix.c  +++ linux-2.6.15-55.81/net/unix/af_unix.c
1290  @@ -117,6 +117,9 @@  @@ -117,6 +117,7 @@
1291   #include <linux/mount.h>   #include <linux/mount.h>
1292   #include <net/checksum.h>   #include <net/checksum.h>
1293   #include <linux/security.h>   #include <linux/security.h>
1294  +/***** TOMOYO Linux start. *****/  +#include <linux/ccsecurity.h>
 +#include <linux/tomoyo.h>  
 +/***** TOMOYO Linux end. *****/  
1295    
1296   int sysctl_unix_max_dgram_qlen = 10;   int sysctl_unix_max_dgram_qlen = 10;
1297    
1298  @@ -781,6 +784,11 @@ static int unix_bind(struct socket *sock  @@ -781,6 +782,9 @@ static int unix_bind(struct socket *sock
1299                   */                   */
1300                  mode = S_IFSOCK |                  mode = S_IFSOCK |
1301                         (SOCK_INODE(sock)->i_mode & ~current->fs->umask);                         (SOCK_INODE(sock)->i_mode & ~current->fs->umask);
1302  +               /***** TOMOYO Linux start. *****/  +               err = ccs_mknod_permission(nd.dentry->d_inode, dentry, nd.mnt,
1303  +               err = ccs_check_mknod_permission(nd.dentry->d_inode, dentry,  +                                          mode, 0);
 +                                                nd.mnt, mode, 0);  
1304  +               if (!err)  +               if (!err)
 +               /***** TOMOYO Linux end. *****/  
1305                  err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);                  err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0);
1306                  if (err)                  if (err)
1307                          goto out_mknod_dput;                          goto out_mknod_dput;
1308    --- linux-2.6.15-55.81.orig/security/Kconfig
1309    +++ linux-2.6.15-55.81/security/Kconfig
1310    @@ -94,5 +94,7 @@ config SECURITY_SECLVL
1311    
1312     source security/selinux/Kconfig
1313    
1314    +source security/ccsecurity/Kconfig
1315    +
1316     endmenu
1317    
1318    --- linux-2.6.15-55.81.orig/security/Makefile
1319    +++ linux-2.6.15-55.81/security/Makefile
1320    @@ -19,3 +19,6 @@ obj-$(CONFIG_SECURITY_ROOTPLUG)               += comm
1321     obj-$(CONFIG_SECURITY_REALTIME)                += commoncap.o realcap.o
1322    
1323     obj-$(CONFIG_SECURITY_SECLVL)          += seclvl.o
1324    +
1325    +subdir-$(CONFIG_CCSECURITY)+= ccsecurity
1326    +obj-$(CONFIG_CCSECURITY)+= ccsecurity/built-in.o

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

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