12 |
arch/sparc/kernel/ptrace.c | 5 +++++ |
arch/sparc/kernel/ptrace.c | 5 +++++ |
13 |
arch/sparc64/kernel/ptrace.c | 5 +++++ |
arch/sparc64/kernel/ptrace.c | 5 +++++ |
14 |
arch/x86_64/ia32/ptrace32.c | 3 +++ |
arch/x86_64/ia32/ptrace32.c | 3 +++ |
|
fs/Kconfig | 2 ++ |
|
|
fs/Makefile | 2 ++ |
|
15 |
fs/attr.c | 5 +++++ |
fs/attr.c | 5 +++++ |
16 |
fs/compat.c | 9 ++++++++- |
fs/compat.c | 9 ++++++++- |
17 |
fs/exec.c | 12 +++++++++++- |
fs/exec.c | 12 +++++++++++- |
18 |
fs/fcntl.c | 5 +++++ |
fs/fcntl.c | 5 +++++ |
19 |
fs/ioctl.c | 5 +++++ |
fs/ioctl.c | 5 +++++ |
20 |
fs/namei.c | 38 ++++++++++++++++++++++++++++++++++++++ |
fs/namei.c | 38 ++++++++++++++++++++++++++++++++++++++ |
21 |
fs/namespace.c | 28 +++++++++++++++++++++++++++- |
fs/namespace.c | 25 ++++++++++++++++++++++++- |
22 |
fs/open.c | 16 +++++++++++++++- |
fs/open.c | 30 +++++++++++++++++++++++++++++- |
|
fs/proc/Makefile | 3 +++ |
|
23 |
fs/proc/proc_misc.c | 1 + |
fs/proc/proc_misc.c | 1 + |
24 |
include/linux/init_task.h | 2 ++ |
include/linux/init_task.h | 2 ++ |
25 |
include/linux/sched.h | 4 ++++ |
include/linux/sched.h | 4 ++++ |
29 |
kernel/module.c | 7 +++++-- |
kernel/module.c | 7 +++++-- |
30 |
kernel/ptrace.c | 3 +++ |
kernel/ptrace.c | 3 +++ |
31 |
kernel/sched.c | 3 +++ |
kernel/sched.c | 3 +++ |
32 |
kernel/signal.c | 7 +++++++ |
kernel/signal.c | 9 +++++++++ |
33 |
kernel/sys.c | 11 +++++++++++ |
kernel/sys.c | 11 +++++++++++ |
34 |
kernel/sysctl.c | 11 +++++++++++ |
kernel/sysctl.c | 11 +++++++++++ |
35 |
kernel/time.c | 7 +++++++ |
kernel/time.c | 7 +++++++ |
36 |
net/ipv4/inet_connection_sock.c | 3 +++ |
net/ipv4/inet_connection_sock.c | 3 +++ |
37 |
net/ipv4/inet_hashtables.c | 3 +++ |
net/ipv4/inet_hashtables.c | 3 +++ |
38 |
net/ipv4/raw.c | 4 ++++ |
net/ipv4/raw.c | 4 ++++ |
39 |
net/ipv4/udp.c | 11 ++++++++++- |
net/ipv4/udp.c | 10 +++++++++- |
40 |
net/ipv6/inet6_hashtables.c | 5 ++++- |
net/ipv6/inet6_hashtables.c | 5 ++++- |
41 |
net/ipv6/raw.c | 4 ++++ |
net/ipv6/raw.c | 4 ++++ |
42 |
net/ipv6/udp.c | 9 +++++++++ |
net/ipv6/udp.c | 8 ++++++++ |
43 |
net/socket.c | 26 +++++++++++++++++++++++--- |
net/socket.c | 25 ++++++++++++++++++++++--- |
44 |
net/unix/af_unix.c | 4 ++++ |
net/unix/af_unix.c | 4 ++++ |
45 |
43 files changed, 282 insertions(+), 11 deletions(-) |
security/Kconfig | 2 ++ |
46 |
|
security/Makefile | 3 +++ |
47 |
|
42 files changed, 290 insertions(+), 11 deletions(-) |
48 |
|
|
49 |
--- linux-2.6.16-76.49vl4.orig/arch/alpha/kernel/ptrace.c |
--- linux-2.6.16-76.51vl4.orig/arch/alpha/kernel/ptrace.c |
50 |
+++ linux-2.6.16-76.49vl4/arch/alpha/kernel/ptrace.c |
+++ linux-2.6.16-76.51vl4/arch/alpha/kernel/ptrace.c |
51 |
@@ -20,6 +20,7 @@ |
@@ -20,6 +20,7 @@ |
52 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
53 |
#include <asm/system.h> |
#include <asm/system.h> |
54 |
#include <asm/fpu.h> |
#include <asm/fpu.h> |
55 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
56 |
|
|
57 |
#include "proto.h" |
#include "proto.h" |
58 |
|
|
65 |
|
|
66 |
lock_kernel(); |
lock_kernel(); |
67 |
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", |
68 |
--- linux-2.6.16-76.49vl4.orig/arch/ia64/ia32/sys_ia32.c |
--- linux-2.6.16-76.51vl4.orig/arch/ia64/ia32/sys_ia32.c |
69 |
+++ linux-2.6.16-76.49vl4/arch/ia64/ia32/sys_ia32.c |
+++ linux-2.6.16-76.51vl4/arch/ia64/ia32/sys_ia32.c |
70 |
@@ -58,6 +58,7 @@ |
@@ -58,6 +58,7 @@ |
71 |
#include <asm/types.h> |
#include <asm/types.h> |
72 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
73 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
74 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
75 |
|
|
76 |
#include "ia32priv.h" |
#include "ia32priv.h" |
77 |
|
|
84 |
|
|
85 |
lock_kernel(); |
lock_kernel(); |
86 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
87 |
--- linux-2.6.16-76.49vl4.orig/arch/ia64/kernel/ptrace.c |
--- linux-2.6.16-76.51vl4.orig/arch/ia64/kernel/ptrace.c |
88 |
+++ linux-2.6.16-76.49vl4/arch/ia64/kernel/ptrace.c |
+++ linux-2.6.16-76.51vl4/arch/ia64/kernel/ptrace.c |
89 |
@@ -29,6 +29,7 @@ |
@@ -29,6 +29,7 @@ |
90 |
#ifdef CONFIG_PERFMON |
#ifdef CONFIG_PERFMON |
91 |
#include <asm/perfmon.h> |
#include <asm/perfmon.h> |
92 |
#endif |
#endif |
93 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
94 |
|
|
95 |
#include "entry.h" |
#include "entry.h" |
96 |
|
|
103 |
|
|
104 |
lock_kernel(); |
lock_kernel(); |
105 |
ret = -EPERM; |
ret = -EPERM; |
106 |
--- linux-2.6.16-76.49vl4.orig/arch/m32r/kernel/ptrace.c |
--- linux-2.6.16-76.51vl4.orig/arch/m32r/kernel/ptrace.c |
107 |
+++ linux-2.6.16-76.49vl4/arch/m32r/kernel/ptrace.c |
+++ linux-2.6.16-76.51vl4/arch/m32r/kernel/ptrace.c |
108 |
@@ -33,6 +33,7 @@ |
@@ -33,6 +33,7 @@ |
109 |
#include <asm/system.h> |
#include <asm/system.h> |
110 |
#include <asm/processor.h> |
#include <asm/processor.h> |
111 |
#include <asm/mmu_context.h> |
#include <asm/mmu_context.h> |
112 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
113 |
|
|
114 |
/* |
/* |
115 |
* This routine will get a word off of the process kernel stack. |
* This routine will get a word off of the process kernel stack. |
122 |
|
|
123 |
lock_kernel(); |
lock_kernel(); |
124 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
125 |
--- linux-2.6.16-76.49vl4.orig/arch/mips/kernel/ptrace32.c |
--- linux-2.6.16-76.51vl4.orig/arch/mips/kernel/ptrace32.c |
126 |
+++ linux-2.6.16-76.49vl4/arch/mips/kernel/ptrace32.c |
+++ linux-2.6.16-76.51vl4/arch/mips/kernel/ptrace32.c |
127 |
@@ -35,6 +35,7 @@ |
@@ -35,6 +35,7 @@ |
128 |
#include <asm/system.h> |
#include <asm/system.h> |
129 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
130 |
#include <asm/bootinfo.h> |
#include <asm/bootinfo.h> |
131 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
132 |
|
|
133 |
int ptrace_getregs (struct task_struct *child, __s64 __user *data); |
int ptrace_getregs (struct task_struct *child, __s64 __user *data); |
134 |
int ptrace_setregs (struct task_struct *child, __s64 __user *data); |
int ptrace_setregs (struct task_struct *child, __s64 __user *data); |
141 |
|
|
142 |
#if 0 |
#if 0 |
143 |
printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n", |
printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n", |
144 |
--- linux-2.6.16-76.49vl4.orig/arch/powerpc/kernel/ptrace32.c |
--- linux-2.6.16-76.51vl4.orig/arch/powerpc/kernel/ptrace32.c |
145 |
+++ linux-2.6.16-76.49vl4/arch/powerpc/kernel/ptrace32.c |
+++ linux-2.6.16-76.51vl4/arch/powerpc/kernel/ptrace32.c |
146 |
@@ -33,6 +33,7 @@ |
@@ -33,6 +33,7 @@ |
147 |
#include <asm/page.h> |
#include <asm/page.h> |
148 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
149 |
#include <asm/system.h> |
#include <asm/system.h> |
150 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
151 |
|
|
152 |
#include "ptrace-common.h" |
#include "ptrace-common.h" |
153 |
|
|
160 |
|
|
161 |
lock_kernel(); |
lock_kernel(); |
162 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
163 |
--- linux-2.6.16-76.49vl4.orig/arch/s390/kernel/ptrace.c |
--- linux-2.6.16-76.51vl4.orig/arch/s390/kernel/ptrace.c |
164 |
+++ linux-2.6.16-76.49vl4/arch/s390/kernel/ptrace.c |
+++ linux-2.6.16-76.51vl4/arch/s390/kernel/ptrace.c |
165 |
@@ -41,6 +41,7 @@ |
@@ -41,6 +41,7 @@ |
166 |
#include <asm/system.h> |
#include <asm/system.h> |
167 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
168 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
169 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
170 |
|
|
171 |
#ifdef CONFIG_COMPAT |
#ifdef CONFIG_COMPAT |
172 |
#include "compat_ptrace.h" |
#include "compat_ptrace.h" |
179 |
lock_kernel(); |
lock_kernel(); |
180 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
181 |
ret = ptrace_traceme(); |
ret = ptrace_traceme(); |
182 |
--- linux-2.6.16-76.49vl4.orig/arch/sparc/kernel/ptrace.c |
--- linux-2.6.16-76.51vl4.orig/arch/sparc/kernel/ptrace.c |
183 |
+++ linux-2.6.16-76.49vl4/arch/sparc/kernel/ptrace.c |
+++ linux-2.6.16-76.51vl4/arch/sparc/kernel/ptrace.c |
184 |
@@ -23,6 +23,7 @@ |
@@ -23,6 +23,7 @@ |
185 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
186 |
#include <asm/system.h> |
#include <asm/system.h> |
187 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
188 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
189 |
|
|
190 |
#define MAGIC_CONSTANT 0x80000000 |
#define MAGIC_CONSTANT 0x80000000 |
191 |
|
|
200 |
|
|
201 |
lock_kernel(); |
lock_kernel(); |
202 |
#ifdef DEBUG_PTRACE |
#ifdef DEBUG_PTRACE |
203 |
--- linux-2.6.16-76.49vl4.orig/arch/sparc64/kernel/ptrace.c |
--- linux-2.6.16-76.51vl4.orig/arch/sparc64/kernel/ptrace.c |
204 |
+++ linux-2.6.16-76.49vl4/arch/sparc64/kernel/ptrace.c |
+++ linux-2.6.16-76.51vl4/arch/sparc64/kernel/ptrace.c |
205 |
@@ -32,6 +32,7 @@ |
@@ -32,6 +32,7 @@ |
206 |
#include <asm/spitfire.h> |
#include <asm/spitfire.h> |
207 |
#include <asm/page.h> |
#include <asm/page.h> |
208 |
#include <asm/cpudata.h> |
#include <asm/cpudata.h> |
209 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
210 |
|
|
211 |
/* Returning from ptrace is a bit tricky because the syscall return |
/* Returning from ptrace is a bit tricky because the syscall return |
212 |
* low level code assumes any value returned which is negative and |
* low level code assumes any value returned which is negative and |
221 |
|
|
222 |
if (test_thread_flag(TIF_32BIT)) { |
if (test_thread_flag(TIF_32BIT)) { |
223 |
addr &= 0xffffffffUL; |
addr &= 0xffffffffUL; |
224 |
--- linux-2.6.16-76.49vl4.orig/arch/x86_64/ia32/ptrace32.c |
--- linux-2.6.16-76.51vl4.orig/arch/x86_64/ia32/ptrace32.c |
225 |
+++ linux-2.6.16-76.49vl4/arch/x86_64/ia32/ptrace32.c |
+++ linux-2.6.16-76.51vl4/arch/x86_64/ia32/ptrace32.c |
226 |
@@ -27,6 +27,7 @@ |
@@ -27,6 +27,7 @@ |
227 |
#include <asm/debugreg.h> |
#include <asm/debugreg.h> |
228 |
#include <asm/i387.h> |
#include <asm/i387.h> |
229 |
#include <asm/fpu32.h> |
#include <asm/fpu32.h> |
230 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
231 |
|
|
232 |
/* |
/* |
233 |
* Determines which flags the user has access to [1 = access, 0 = no access]. |
* Determines which flags the user has access to [1 = access, 0 = no access]. |
240 |
|
|
241 |
switch (request) { |
switch (request) { |
242 |
default: |
default: |
243 |
--- linux-2.6.16-76.49vl4.orig/fs/Kconfig |
--- linux-2.6.16-76.51vl4.orig/fs/attr.c |
244 |
+++ linux-2.6.16-76.49vl4/fs/Kconfig |
+++ linux-2.6.16-76.51vl4/fs/attr.c |
|
@@ -1906,5 +1906,7 @@ endmenu |
|
|
|
|
|
source "fs/nls/Kconfig" |
|
|
|
|
|
+source "fs/Kconfig.ccs" |
|
|
+ |
|
|
endmenu |
|
|
|
|
|
--- linux-2.6.16-76.49vl4.orig/fs/Makefile |
|
|
+++ linux-2.6.16-76.49vl4/fs/Makefile |
|
|
@@ -106,3 +106,5 @@ obj-$(CONFIG_CONFIGFS_FS) += configfs/ |
|
|
obj-$(CONFIG_OCFS2_FS) += ocfs2/ |
|
|
obj-$(CONFIG_SUPERMOUNT) += supermount/ |
|
|
obj-$(CONFIG_UNION_FS) += unionfs/ |
|
|
+ |
|
|
+include $(srctree)/fs/Makefile-2.6.ccs |
|
|
--- linux-2.6.16-76.49vl4.orig/fs/attr.c |
|
|
+++ linux-2.6.16-76.49vl4/fs/attr.c |
|
245 |
@@ -15,6 +15,7 @@ |
@@ -15,6 +15,7 @@ |
246 |
#include <linux/fcntl.h> |
#include <linux/fcntl.h> |
247 |
#include <linux/quotaops.h> |
#include <linux/quotaops.h> |
248 |
#include <linux/security.h> |
#include <linux/security.h> |
249 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
250 |
|
|
251 |
/* Taken over from the old code... */ |
/* Taken over from the old code... */ |
252 |
|
|
266 |
if (!error) { |
if (!error) { |
267 |
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
268 |
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) |
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) |
269 |
--- linux-2.6.16-76.49vl4.orig/fs/compat.c |
--- linux-2.6.16-76.51vl4.orig/fs/compat.c |
270 |
+++ linux-2.6.16-76.49vl4/fs/compat.c |
+++ linux-2.6.16-76.51vl4/fs/compat.c |
271 |
@@ -52,6 +52,7 @@ |
@@ -52,6 +52,7 @@ |
272 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
273 |
#include <asm/mmu_context.h> |
#include <asm/mmu_context.h> |
274 |
#include <asm/ioctls.h> |
#include <asm/ioctls.h> |
275 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
276 |
|
|
277 |
extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); |
extern void sigset_from_compat(sigset_t *set, compat_sigset_t *compat); |
278 |
|
|
305 |
if (retval >= 0) { |
if (retval >= 0) { |
306 |
free_arg_pages(bprm); |
free_arg_pages(bprm); |
307 |
|
|
308 |
--- linux-2.6.16-76.49vl4.orig/fs/exec.c |
--- linux-2.6.16-76.51vl4.orig/fs/exec.c |
309 |
+++ linux-2.6.16-76.49vl4/fs/exec.c |
+++ linux-2.6.16-76.51vl4/fs/exec.c |
310 |
@@ -57,6 +57,8 @@ |
@@ -57,6 +57,8 @@ |
311 |
#include <linux/kmod.h> |
#include <linux/kmod.h> |
312 |
#endif |
#endif |
313 |
|
|
314 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
315 |
+ |
+ |
316 |
int core_uses_pid; |
int core_uses_pid; |
317 |
char core_pattern[65] = "core"; |
char core_pattern[65] = "core"; |
347 |
if (retval >= 0) { |
if (retval >= 0) { |
348 |
free_arg_pages(bprm); |
free_arg_pages(bprm); |
349 |
|
|
350 |
--- linux-2.6.16-76.49vl4.orig/fs/fcntl.c |
--- linux-2.6.16-76.51vl4.orig/fs/fcntl.c |
351 |
+++ linux-2.6.16-76.49vl4/fs/fcntl.c |
+++ linux-2.6.16-76.51vl4/fs/fcntl.c |
352 |
@@ -22,6 +22,7 @@ |
@@ -22,6 +22,7 @@ |
353 |
#include <asm/poll.h> |
#include <asm/poll.h> |
354 |
#include <asm/siginfo.h> |
#include <asm/siginfo.h> |
355 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
356 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
357 |
|
|
358 |
void fastcall set_close_on_exec(unsigned int fd, int flag) |
void fastcall set_close_on_exec(unsigned int fd, int flag) |
359 |
{ |
{ |
368 |
/* O_NOATIME can only be set by the owner or superuser */ |
/* O_NOATIME can only be set by the owner or superuser */ |
369 |
if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) |
if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) |
370 |
if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER)) |
if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER)) |
371 |
--- linux-2.6.16-76.49vl4.orig/fs/ioctl.c |
--- linux-2.6.16-76.51vl4.orig/fs/ioctl.c |
372 |
+++ linux-2.6.16-76.49vl4/fs/ioctl.c |
+++ linux-2.6.16-76.51vl4/fs/ioctl.c |
373 |
@@ -16,6 +16,7 @@ |
@@ -16,6 +16,7 @@ |
374 |
|
|
375 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
376 |
#include <asm/ioctls.h> |
#include <asm/ioctls.h> |
377 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
378 |
|
|
379 |
static long do_ioctl(struct file *filp, unsigned int cmd, |
static long do_ioctl(struct file *filp, unsigned int cmd, |
380 |
unsigned long arg) |
unsigned long arg) |
396 |
if (error) |
if (error) |
397 |
goto out_fput; |
goto out_fput; |
398 |
|
|
399 |
--- linux-2.6.16-76.49vl4.orig/fs/namei.c |
--- linux-2.6.16-76.51vl4.orig/fs/namei.c |
400 |
+++ linux-2.6.16-76.49vl4/fs/namei.c |
+++ linux-2.6.16-76.51vl4/fs/namei.c |
401 |
@@ -37,6 +37,8 @@ |
@@ -37,6 +37,8 @@ |
402 |
|
|
403 |
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) |
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) |
404 |
|
|
405 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
406 |
+ |
+ |
407 |
/* [Feb-1997 T. Schoebel-Theuer] |
/* [Feb-1997 T. Schoebel-Theuer] |
408 |
* Fundamental changes in the pathname lookup mechanisms (namei) |
* Fundamental changes in the pathname lookup mechanisms (namei) |
423 |
return 0; |
return 0; |
424 |
} |
} |
425 |
|
|
426 |
+#include <linux/tomoyo_vfs.h> |
+#include <linux/ccsecurity_vfs.h> |
427 |
/* |
/* |
428 |
* open_namei() |
* open_namei() |
429 |
* |
* |
513 |
error = vfs_rename(old_dir->d_inode, old_dentry, |
error = vfs_rename(old_dir->d_inode, old_dentry, |
514 |
new_dir->d_inode, new_dentry); |
new_dir->d_inode, new_dentry); |
515 |
exit5: |
exit5: |
516 |
--- linux-2.6.16-76.49vl4.orig/fs/namespace.c |
--- linux-2.6.16-76.51vl4.orig/fs/namespace.c |
517 |
+++ linux-2.6.16-76.49vl4/fs/namespace.c |
+++ linux-2.6.16-76.51vl4/fs/namespace.c |
518 |
@@ -26,6 +26,8 @@ |
@@ -26,6 +26,7 @@ |
519 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
520 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
521 |
#include "pnode.h" |
#include "pnode.h" |
522 |
+#include <linux/sakura.h> |
+#include <linux/ccsecurity.h> |
|
+#include <linux/tomoyo.h> |
|
523 |
|
|
524 |
extern int __init init_rootfs(void); |
extern int __init init_rootfs(void); |
525 |
|
|
526 |
@@ -509,6 +511,9 @@ static int do_umount(struct vfsmount *mn |
@@ -509,6 +510,9 @@ static int do_umount(struct vfsmount *mn |
527 |
if (retval) |
if (retval) |
528 |
return retval; |
return retval; |
529 |
|
|
533 |
/* |
/* |
534 |
* Allow userspace to request a mountpoint be expired rather than |
* Allow userspace to request a mountpoint be expired rather than |
535 |
* unmounting unconditionally. Unmount only happens if: |
* unmounting unconditionally. Unmount only happens if: |
536 |
@@ -597,6 +602,8 @@ asmlinkage long sys_umount(char __user * |
@@ -597,6 +601,8 @@ asmlinkage long sys_umount(char __user * |
537 |
{ |
{ |
538 |
struct nameidata nd; |
struct nameidata nd; |
539 |
int retval; |
int retval; |
542 |
|
|
543 |
retval = __user_walk(name, LOOKUP_FOLLOW, &nd); |
retval = __user_walk(name, LOOKUP_FOLLOW, &nd); |
544 |
if (retval) |
if (retval) |
545 |
@@ -884,6 +891,9 @@ static int do_loopback(struct nameidata |
@@ -884,6 +890,9 @@ static int do_loopback(struct nameidata |
546 |
|
|
547 |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
548 |
goto out; |
goto out; |
552 |
|
|
553 |
err = -ENOMEM; |
err = -ENOMEM; |
554 |
if (recurse) |
if (recurse) |
555 |
@@ -968,7 +978,9 @@ static int do_move_mount(struct nameidat |
@@ -968,7 +977,9 @@ static int do_move_mount(struct nameidat |
556 |
err = -EINVAL; |
err = -EINVAL; |
557 |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
558 |
goto out; |
goto out; |
563 |
err = -ENOENT; |
err = -ENOENT; |
564 |
mutex_lock(&nd->dentry->d_inode->i_mutex); |
mutex_lock(&nd->dentry->d_inode->i_mutex); |
565 |
if (IS_DEADDIR(nd->dentry->d_inode)) |
if (IS_DEADDIR(nd->dentry->d_inode)) |
566 |
@@ -1070,6 +1082,9 @@ int do_add_mount(struct vfsmount *newmnt |
@@ -1070,6 +1081,9 @@ int do_add_mount(struct vfsmount *newmnt |
567 |
err = -EINVAL; |
err = -EINVAL; |
568 |
if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode)) |
if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode)) |
569 |
goto unlock; |
goto unlock; |
573 |
|
|
574 |
newmnt->mnt_flags = mnt_flags; |
newmnt->mnt_flags = mnt_flags; |
575 |
if ((err = graft_tree(newmnt, nd))) |
if ((err = graft_tree(newmnt, nd))) |
576 |
@@ -1287,6 +1302,13 @@ long do_mount(char *dev_name, char *dir_ |
@@ -1287,6 +1301,11 @@ long do_mount(char *dev_name, char *dir_ |
577 |
if (data_page) |
if (data_page) |
578 |
((char *)data_page)[PAGE_SIZE - 1] = 0; |
((char *)data_page)[PAGE_SIZE - 1] = 0; |
579 |
|
|
|
+ if (!ccs_capable(CCS_SYS_MOUNT)) |
|
|
+ return -EPERM; |
|
580 |
+ retval = ccs_check_mount_permission(dev_name, dir_name, type_page, |
+ retval = ccs_check_mount_permission(dev_name, dir_name, type_page, |
581 |
+ &flags); |
+ &flags); |
582 |
+ if (retval) |
+ if (retval) |
585 |
/* Separate the per-mountpoint flags */ |
/* Separate the per-mountpoint flags */ |
586 |
if (flags & MS_NOSUID) |
if (flags & MS_NOSUID) |
587 |
mnt_flags |= MNT_NOSUID; |
mnt_flags |= MNT_NOSUID; |
588 |
@@ -1585,6 +1607,8 @@ asmlinkage long sys_pivot_root(const cha |
@@ -1585,6 +1604,8 @@ asmlinkage long sys_pivot_root(const cha |
589 |
|
|
590 |
if (!capable(CAP_SYS_ADMIN)) |
if (!capable(CAP_SYS_ADMIN)) |
591 |
return -EPERM; |
return -EPERM; |
594 |
|
|
595 |
lock_kernel(); |
lock_kernel(); |
596 |
|
|
597 |
@@ -1601,6 +1625,8 @@ asmlinkage long sys_pivot_root(const cha |
@@ -1601,6 +1622,8 @@ asmlinkage long sys_pivot_root(const cha |
598 |
goto out1; |
goto out1; |
599 |
|
|
600 |
error = security_sb_pivotroot(&old_nd, &new_nd); |
error = security_sb_pivotroot(&old_nd, &new_nd); |
603 |
if (error) { |
if (error) { |
604 |
path_release(&old_nd); |
path_release(&old_nd); |
605 |
goto out1; |
goto out1; |
606 |
--- linux-2.6.16-76.49vl4.orig/fs/open.c |
--- linux-2.6.16-76.51vl4.orig/fs/open.c |
607 |
+++ linux-2.6.16-76.49vl4/fs/open.c |
+++ linux-2.6.16-76.51vl4/fs/open.c |
608 |
@@ -30,6 +30,9 @@ |
@@ -30,6 +30,8 @@ |
609 |
|
|
610 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
611 |
|
|
612 |
+#include <linux/sakura.h> |
+#include <linux/ccsecurity.h> |
|
+#include <linux/tomoyo.h> |
|
613 |
+ |
+ |
614 |
int vfs_statfs(struct super_block *sb, struct kstatfs *buf) |
int vfs_statfs(struct super_block *sb, struct kstatfs *buf) |
615 |
{ |
{ |
616 |
int retval = -ENODEV; |
int retval = -ENODEV; |
617 |
@@ -269,6 +272,8 @@ static long do_sys_truncate(const char _ |
@@ -269,6 +271,8 @@ static long do_sys_truncate(const char _ |
618 |
if (error) |
if (error) |
619 |
goto dput_and_out; |
goto dput_and_out; |
620 |
|
|
623 |
error = locks_verify_truncate(inode, NULL, length); |
error = locks_verify_truncate(inode, NULL, length); |
624 |
if (!error) { |
if (!error) { |
625 |
DQUOT_INIT(inode); |
DQUOT_INIT(inode); |
626 |
@@ -321,7 +326,10 @@ static long do_sys_ftruncate(unsigned in |
@@ -321,7 +325,10 @@ static long do_sys_ftruncate(unsigned in |
627 |
error = -EPERM; |
error = -EPERM; |
628 |
if (IS_APPEND(inode)) |
if (IS_APPEND(inode)) |
629 |
goto out_putf; |
goto out_putf; |
635 |
error = locks_verify_truncate(inode, file, length); |
error = locks_verify_truncate(inode, file, length); |
636 |
if (!error) |
if (!error) |
637 |
error = do_truncate(dentry, length, 0, file); |
error = do_truncate(dentry, length, 0, file); |
638 |
@@ -610,6 +618,10 @@ asmlinkage long sys_chroot(const char __ |
@@ -610,6 +617,10 @@ asmlinkage long sys_chroot(const char __ |
639 |
error = -EPERM; |
error = -EPERM; |
640 |
if (!capable(CAP_SYS_CHROOT)) |
if (!capable(CAP_SYS_CHROOT)) |
641 |
goto dput_and_out; |
goto dput_and_out; |
646 |
|
|
647 |
set_fs_root(current->fs, nd.mnt, nd.dentry); |
set_fs_root(current->fs, nd.mnt, nd.dentry); |
648 |
set_fs_altroot(); |
set_fs_altroot(); |
649 |
@@ -1192,6 +1204,8 @@ EXPORT_SYMBOL(sys_close); |
@@ -641,6 +652,9 @@ asmlinkage long sys_fchmod(unsigned int |
650 |
|
err = -EPERM; |
651 |
|
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
652 |
|
goto out_putf; |
653 |
|
+ err = ccs_chmod_permission(dentry, file->f_vfsmnt, mode); |
654 |
|
+ if (err) |
655 |
|
+ goto out_putf; |
656 |
|
mutex_lock(&inode->i_mutex); |
657 |
|
if (mode == (mode_t) -1) |
658 |
|
mode = inode->i_mode; |
659 |
|
@@ -675,6 +689,9 @@ asmlinkage long sys_fchmodat(int dfd, co |
660 |
|
error = -EPERM; |
661 |
|
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
662 |
|
goto dput_and_out; |
663 |
|
+ error = ccs_chmod_permission(nd.dentry, nd.mnt, mode); |
664 |
|
+ if (error) |
665 |
|
+ goto dput_and_out; |
666 |
|
|
667 |
|
mutex_lock(&inode->i_mutex); |
668 |
|
if (mode == (mode_t) -1) |
669 |
|
@@ -737,6 +754,8 @@ asmlinkage long sys_chown(const char __u |
670 |
|
|
671 |
|
error = user_path_walk(filename, &nd); |
672 |
|
if (!error) { |
673 |
|
+ error = ccs_chown_permission(nd.dentry, nd.mnt, user, group); |
674 |
|
+ if (!error) |
675 |
|
error = chown_common(nd.dentry, user, group); |
676 |
|
path_release(&nd); |
677 |
|
} |
678 |
|
@@ -756,6 +775,8 @@ asmlinkage long sys_fchownat(int dfd, co |
679 |
|
follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; |
680 |
|
error = __user_walk_fd(dfd, filename, follow, &nd); |
681 |
|
if (!error) { |
682 |
|
+ error = ccs_chown_permission(nd.dentry, nd.mnt, user, group); |
683 |
|
+ if (!error) |
684 |
|
error = chown_common(nd.dentry, user, group); |
685 |
|
path_release(&nd); |
686 |
|
} |
687 |
|
@@ -770,6 +791,8 @@ asmlinkage long sys_lchown(const char __ |
688 |
|
|
689 |
|
error = user_path_walk_link(filename, &nd); |
690 |
|
if (!error) { |
691 |
|
+ error = ccs_chown_permission(nd.dentry, nd.mnt, user, group); |
692 |
|
+ if (!error) |
693 |
|
error = chown_common(nd.dentry, user, group); |
694 |
|
path_release(&nd); |
695 |
|
} |
696 |
|
@@ -784,6 +807,9 @@ asmlinkage long sys_fchown(unsigned int |
697 |
|
|
698 |
|
file = fget(fd); |
699 |
|
if (file) { |
700 |
|
+ error = ccs_chown_permission(file->f_dentry, file->f_vfsmnt, |
701 |
|
+ user, group); |
702 |
|
+ if (!error) |
703 |
|
error = chown_common(file->f_dentry, user, group); |
704 |
|
fput(file); |
705 |
|
} |
706 |
|
@@ -1192,6 +1218,8 @@ EXPORT_SYMBOL(sys_close); |
707 |
*/ |
*/ |
708 |
asmlinkage long sys_vhangup(void) |
asmlinkage long sys_vhangup(void) |
709 |
{ |
{ |
712 |
if (capable(CAP_SYS_TTY_CONFIG)) { |
if (capable(CAP_SYS_TTY_CONFIG)) { |
713 |
tty_vhangup(current->signal->tty); |
tty_vhangup(current->signal->tty); |
714 |
return 0; |
return 0; |
715 |
--- linux-2.6.16-76.49vl4.orig/fs/proc/Makefile |
--- linux-2.6.16-76.51vl4.orig/fs/proc/proc_misc.c |
716 |
+++ linux-2.6.16-76.49vl4/fs/proc/Makefile |
+++ linux-2.6.16-76.51vl4/fs/proc/proc_misc.c |
|
@@ -13,3 +13,6 @@ proc-y += inode.o root.o base.o ge |
|
|
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.16-76.49vl4.orig/fs/proc/proc_misc.c |
|
|
+++ linux-2.6.16-76.49vl4/fs/proc/proc_misc.c |
|
717 |
@@ -682,4 +682,5 @@ void __init proc_misc_init(void) |
@@ -682,4 +682,5 @@ void __init proc_misc_init(void) |
718 |
if (entry) |
if (entry) |
719 |
entry->proc_fops = &proc_sysrq_trigger_operations; |
entry->proc_fops = &proc_sysrq_trigger_operations; |
720 |
#endif |
#endif |
721 |
+ printk(KERN_INFO "Hook version: 2.6.16-76.49vl4 2009/08/05\n"); |
+ printk(KERN_INFO "Hook version: 2.6.16-76.51vl4 2009/08/09\n"); |
722 |
} |
} |
723 |
--- linux-2.6.16-76.49vl4.orig/include/linux/init_task.h |
--- linux-2.6.16-76.51vl4.orig/include/linux/init_task.h |
724 |
+++ linux-2.6.16-76.49vl4/include/linux/init_task.h |
+++ linux-2.6.16-76.51vl4/include/linux/init_task.h |
725 |
@@ -121,6 +121,8 @@ extern struct group_info init_groups; |
@@ -121,6 +121,8 @@ extern struct group_info init_groups; |
726 |
.journal_info = NULL, \ |
.journal_info = NULL, \ |
727 |
.cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ |
.cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ |
731 |
} |
} |
732 |
|
|
733 |
|
|
734 |
--- linux-2.6.16-76.49vl4.orig/include/linux/sched.h |
--- linux-2.6.16-76.51vl4.orig/include/linux/sched.h |
735 |
+++ linux-2.6.16-76.49vl4/include/linux/sched.h |
+++ linux-2.6.16-76.51vl4/include/linux/sched.h |
736 |
@@ -40,6 +40,8 @@ |
@@ -40,6 +40,8 @@ |
737 |
|
|
738 |
struct exec_domain; |
struct exec_domain; |
751 |
}; |
}; |
752 |
|
|
753 |
static inline pid_t process_group(struct task_struct *tsk) |
static inline pid_t process_group(struct task_struct *tsk) |
754 |
--- linux-2.6.16-76.49vl4.orig/kernel/compat.c |
--- linux-2.6.16-76.51vl4.orig/kernel/compat.c |
755 |
+++ linux-2.6.16-76.49vl4/kernel/compat.c |
+++ linux-2.6.16-76.51vl4/kernel/compat.c |
756 |
@@ -23,6 +23,7 @@ |
@@ -23,6 +23,7 @@ |
757 |
#include <linux/security.h> |
#include <linux/security.h> |
758 |
|
|
759 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
760 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
761 |
|
|
762 |
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) |
763 |
{ |
{ |
770 |
|
|
771 |
do_settimeofday(&tv); |
do_settimeofday(&tv); |
772 |
return 0; |
return 0; |
773 |
--- linux-2.6.16-76.49vl4.orig/kernel/kexec.c |
--- linux-2.6.16-76.51vl4.orig/kernel/kexec.c |
774 |
+++ linux-2.6.16-76.49vl4/kernel/kexec.c |
+++ linux-2.6.16-76.51vl4/kernel/kexec.c |
775 |
@@ -26,6 +26,7 @@ |
@@ -26,6 +26,7 @@ |
776 |
#include <asm/io.h> |
#include <asm/io.h> |
777 |
#include <asm/system.h> |
#include <asm/system.h> |
778 |
#include <asm/semaphore.h> |
#include <asm/semaphore.h> |
779 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
780 |
|
|
781 |
/* Per cpu memory for storing cpu states in case of system crash. */ |
/* Per cpu memory for storing cpu states in case of system crash. */ |
782 |
note_buf_t* crash_notes; |
note_buf_t* crash_notes; |
789 |
|
|
790 |
/* |
/* |
791 |
* Verify we have a legal set of flags |
* Verify we have a legal set of flags |
792 |
--- linux-2.6.16-76.49vl4.orig/kernel/kmod.c |
--- linux-2.6.16-76.51vl4.orig/kernel/kmod.c |
793 |
+++ linux-2.6.16-76.49vl4/kernel/kmod.c |
+++ linux-2.6.16-76.51vl4/kernel/kmod.c |
794 |
@@ -150,6 +150,9 @@ static int ____call_usermodehelper(void |
@@ -150,6 +150,9 @@ static int ____call_usermodehelper(void |
795 |
/* We can run anywhere, unlike our parent keventd(). */ |
/* We can run anywhere, unlike our parent keventd(). */ |
796 |
set_cpus_allowed(current, CPU_MASK_ALL); |
set_cpus_allowed(current, CPU_MASK_ALL); |
801 |
retval = -EPERM; |
retval = -EPERM; |
802 |
if (current->fs->root) |
if (current->fs->root) |
803 |
retval = execve(sub_info->path, sub_info->argv,sub_info->envp); |
retval = execve(sub_info->path, sub_info->argv,sub_info->envp); |
804 |
--- linux-2.6.16-76.49vl4.orig/kernel/module.c |
--- linux-2.6.16-76.51vl4.orig/kernel/module.c |
805 |
+++ linux-2.6.16-76.49vl4/kernel/module.c |
+++ linux-2.6.16-76.51vl4/kernel/module.c |
806 |
@@ -42,6 +42,7 @@ |
@@ -42,6 +42,7 @@ |
807 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
808 |
#include <asm/semaphore.h> |
#include <asm/semaphore.h> |
809 |
#include <asm/cacheflush.h> |
#include <asm/cacheflush.h> |
810 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
811 |
|
|
812 |
#if 0 |
#if 0 |
813 |
#define DEBUGP printk |
#define DEBUGP printk |
831 |
/* Only one module load at a time, please */ |
/* Only one module load at a time, please */ |
832 |
if (down_interruptible(&module_mutex) != 0) |
if (down_interruptible(&module_mutex) != 0) |
833 |
return -EINTR; |
return -EINTR; |
834 |
--- linux-2.6.16-76.49vl4.orig/kernel/ptrace.c |
--- linux-2.6.16-76.51vl4.orig/kernel/ptrace.c |
835 |
+++ linux-2.6.16-76.49vl4/kernel/ptrace.c |
+++ linux-2.6.16-76.51vl4/kernel/ptrace.c |
836 |
@@ -21,6 +21,7 @@ |
@@ -21,6 +21,7 @@ |
837 |
|
|
838 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
839 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
840 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
841 |
|
|
842 |
/* |
/* |
843 |
* ptrace a task: make the debugger its new parent and |
* ptrace a task: make the debugger its new parent and |
850 |
lock_kernel(); |
lock_kernel(); |
851 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
852 |
ret = ptrace_traceme(); |
ret = ptrace_traceme(); |
853 |
--- linux-2.6.16-76.49vl4.orig/kernel/sched.c |
--- linux-2.6.16-76.51vl4.orig/kernel/sched.c |
854 |
+++ linux-2.6.16-76.49vl4/kernel/sched.c |
+++ linux-2.6.16-76.51vl4/kernel/sched.c |
855 |
@@ -52,6 +52,7 @@ |
@@ -52,6 +52,7 @@ |
856 |
#include <asm/tlb.h> |
#include <asm/tlb.h> |
857 |
|
|
858 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
859 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
860 |
|
|
861 |
/* |
/* |
862 |
* Convert user-nice values [ -20 ... 0 ... 19 ] |
* Convert user-nice values [ -20 ... 0 ... 19 ] |
869 |
|
|
870 |
/* |
/* |
871 |
* Setpriority might change our priority at the same moment. |
* Setpriority might change our priority at the same moment. |
872 |
--- linux-2.6.16-76.49vl4.orig/kernel/signal.c |
--- linux-2.6.16-76.51vl4.orig/kernel/signal.c |
873 |
+++ linux-2.6.16-76.49vl4/kernel/signal.c |
+++ linux-2.6.16-76.51vl4/kernel/signal.c |
874 |
@@ -30,6 +30,7 @@ |
@@ -30,6 +30,7 @@ |
875 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
876 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
877 |
#include <asm/siginfo.h> |
#include <asm/siginfo.h> |
878 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
879 |
|
|
880 |
/* |
/* |
881 |
* SLAB caches for signal bits. |
* SLAB caches for signal bits. |
906 |
|
|
907 |
return do_tkill(0, pid, sig); |
return do_tkill(0, pid, sig); |
908 |
} |
} |
909 |
--- linux-2.6.16-76.49vl4.orig/kernel/sys.c |
@@ -2424,6 +2431,8 @@ sys_rt_sigqueueinfo(int pid, int sig, si |
910 |
+++ linux-2.6.16-76.49vl4/kernel/sys.c |
if (info.si_code >= 0) |
911 |
|
return -EPERM; |
912 |
|
info.si_signo = sig; |
913 |
|
+ if (ccs_sigqueue_permission(pid, sig)) |
914 |
|
+ return -EPERM; |
915 |
|
|
916 |
|
/* POSIX.1b doesn't mention process groups. */ |
917 |
|
return kill_proc_info(sig, &info, pid); |
918 |
|
--- linux-2.6.16-76.51vl4.orig/kernel/sys.c |
919 |
|
+++ linux-2.6.16-76.51vl4/kernel/sys.c |
920 |
@@ -38,6 +38,7 @@ |
@@ -38,6 +38,7 @@ |
921 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
922 |
#include <asm/io.h> |
#include <asm/io.h> |
923 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
924 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
925 |
|
|
926 |
#ifndef SET_UNALIGN_CTL |
#ifndef SET_UNALIGN_CTL |
927 |
# define SET_UNALIGN_CTL(a,b) (-EINVAL) |
# define SET_UNALIGN_CTL(a,b) (-EINVAL) |
963 |
|
|
964 |
down_write(&uts_sem); |
down_write(&uts_sem); |
965 |
errno = -EFAULT; |
errno = -EFAULT; |
966 |
--- linux-2.6.16-76.49vl4.orig/kernel/sysctl.c |
--- linux-2.6.16-76.51vl4.orig/kernel/sysctl.c |
967 |
+++ linux-2.6.16-76.49vl4/kernel/sysctl.c |
+++ linux-2.6.16-76.51vl4/kernel/sysctl.c |
968 |
@@ -49,6 +49,7 @@ |
@@ -49,6 +49,7 @@ |
969 |
|
|
970 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
971 |
#include <asm/processor.h> |
#include <asm/processor.h> |
972 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
973 |
|
|
974 |
extern int proc_nr_files(ctl_table *table, int write, struct file *filp, |
extern int proc_nr_files(ctl_table *table, int write, struct file *filp, |
975 |
void __user *buffer, size_t *lenp, loff_t *ppos); |
void __user *buffer, size_t *lenp, loff_t *ppos); |
997 |
error = table->strategy( |
error = table->strategy( |
998 |
table, name, nlen, |
table, name, nlen, |
999 |
oldval, oldlenp, |
oldval, oldlenp, |
1000 |
--- linux-2.6.16-76.49vl4.orig/kernel/time.c |
--- linux-2.6.16-76.51vl4.orig/kernel/time.c |
1001 |
+++ linux-2.6.16-76.49vl4/kernel/time.c |
+++ linux-2.6.16-76.51vl4/kernel/time.c |
1002 |
@@ -39,6 +39,7 @@ |
@@ -39,6 +39,7 @@ |
1003 |
|
|
1004 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
1005 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
1006 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
1007 |
|
|
1008 |
/* |
/* |
1009 |
* 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 |
1034 |
|
|
1035 |
/* Now we validate the data before disabling interrupts */ |
/* Now we validate the data before disabling interrupts */ |
1036 |
|
|
1037 |
--- linux-2.6.16-76.49vl4.orig/net/ipv4/inet_connection_sock.c |
--- linux-2.6.16-76.51vl4.orig/net/ipv4/inet_connection_sock.c |
1038 |
+++ linux-2.6.16-76.49vl4/net/ipv4/inet_connection_sock.c |
+++ linux-2.6.16-76.51vl4/net/ipv4/inet_connection_sock.c |
1039 |
@@ -24,6 +24,7 @@ |
@@ -24,6 +24,7 @@ |
1040 |
#include <net/route.h> |
#include <net/route.h> |
1041 |
#include <net/tcp_states.h> |
#include <net/tcp_states.h> |
1042 |
#include <net/xfrm.h> |
#include <net/xfrm.h> |
1043 |
+#include <linux/sakura.h> |
+#include <linux/ccsecurity.h> |
1044 |
|
|
1045 |
#ifdef INET_CSK_DEBUG |
#ifdef INET_CSK_DEBUG |
1046 |
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"; |
1053 |
inet_bind_bucket_for_each(tb, node, &head->chain) |
inet_bind_bucket_for_each(tb, node, &head->chain) |
1054 |
if (tb->port == rover) |
if (tb->port == rover) |
1055 |
goto next; |
goto next; |
1056 |
--- linux-2.6.16-76.49vl4.orig/net/ipv4/inet_hashtables.c |
--- linux-2.6.16-76.51vl4.orig/net/ipv4/inet_hashtables.c |
1057 |
+++ linux-2.6.16-76.49vl4/net/ipv4/inet_hashtables.c |
+++ linux-2.6.16-76.51vl4/net/ipv4/inet_hashtables.c |
1058 |
@@ -23,6 +23,7 @@ |
@@ -23,6 +23,7 @@ |
1059 |
#include <net/inet_connection_sock.h> |
#include <net/inet_connection_sock.h> |
1060 |
#include <net/inet_hashtables.h> |
#include <net/inet_hashtables.h> |
1061 |
#include <net/ip.h> |
#include <net/ip.h> |
1062 |
+#include <linux/sakura.h> |
+#include <linux/ccsecurity.h> |
1063 |
|
|
1064 |
/* |
/* |
1065 |
* Allocate and initialize a new local port bind bucket. |
* Allocate and initialize a new local port bind bucket. |
1072 |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
1073 |
spin_lock(&head->lock); |
spin_lock(&head->lock); |
1074 |
|
|
1075 |
--- linux-2.6.16-76.49vl4.orig/net/ipv4/raw.c |
--- linux-2.6.16-76.51vl4.orig/net/ipv4/raw.c |
1076 |
+++ linux-2.6.16-76.49vl4/net/ipv4/raw.c |
+++ linux-2.6.16-76.51vl4/net/ipv4/raw.c |
1077 |
@@ -79,6 +79,7 @@ |
@@ -79,6 +79,7 @@ |
1078 |
#include <linux/seq_file.h> |
#include <linux/seq_file.h> |
1079 |
#include <linux/netfilter.h> |
#include <linux/netfilter.h> |
1080 |
#include <linux/netfilter_ipv4.h> |
#include <linux/netfilter_ipv4.h> |
1081 |
+#include <linux/tomoyo_socket.h> |
+#include <linux/ccsecurity.h> |
1082 |
|
|
1083 |
struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE]; |
struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE]; |
1084 |
DEFINE_RWLOCK(raw_v4_lock); |
DEFINE_RWLOCK(raw_v4_lock); |
1092 |
|
|
1093 |
copied = skb->len; |
copied = skb->len; |
1094 |
if (len < copied) { |
if (len < copied) { |
1095 |
--- linux-2.6.16-76.49vl4.orig/net/ipv4/udp.c |
--- linux-2.6.16-76.51vl4.orig/net/ipv4/udp.c |
1096 |
+++ linux-2.6.16-76.49vl4/net/ipv4/udp.c |
+++ linux-2.6.16-76.51vl4/net/ipv4/udp.c |
1097 |
@@ -109,6 +109,8 @@ |
@@ -109,6 +109,7 @@ |
1098 |
#include <net/inet_common.h> |
#include <net/inet_common.h> |
1099 |
#include <net/checksum.h> |
#include <net/checksum.h> |
1100 |
#include <net/xfrm.h> |
#include <net/xfrm.h> |
1101 |
+#include <linux/sakura.h> |
+#include <linux/ccsecurity.h> |
|
+#include <linux/tomoyo_socket.h> |
|
1102 |
|
|
1103 |
/* |
/* |
1104 |
* Snmp MIB for the UDP layer |
* Snmp MIB for the UDP layer |
1105 |
@@ -147,6 +149,8 @@ static int udp_v4_get_port(struct sock * |
@@ -147,6 +148,8 @@ static int udp_v4_get_port(struct sock * |
1106 |
result = sysctl_local_port_range[0] + |
result = sysctl_local_port_range[0] + |
1107 |
((result - sysctl_local_port_range[0]) & |
((result - sysctl_local_port_range[0]) & |
1108 |
(UDP_HTABLE_SIZE - 1)); |
(UDP_HTABLE_SIZE - 1)); |
1111 |
goto gotit; |
goto gotit; |
1112 |
} |
} |
1113 |
size = 0; |
size = 0; |
1114 |
@@ -163,6 +167,8 @@ static int udp_v4_get_port(struct sock * |
@@ -163,6 +166,8 @@ static int udp_v4_get_port(struct sock * |
1115 |
result = sysctl_local_port_range[0] |
result = sysctl_local_port_range[0] |
1116 |
+ ((result - sysctl_local_port_range[0]) & |
+ ((result - sysctl_local_port_range[0]) & |
1117 |
(UDP_HTABLE_SIZE - 1)); |
(UDP_HTABLE_SIZE - 1)); |
1120 |
if (!udp_lport_inuse(result)) |
if (!udp_lport_inuse(result)) |
1121 |
break; |
break; |
1122 |
} |
} |
1123 |
@@ -797,7 +803,10 @@ try_again: |
@@ -797,7 +802,10 @@ try_again: |
1124 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
1125 |
if (!skb) |
if (!skb) |
1126 |
goto out; |
goto out; |
1132 |
copied = skb->len - sizeof(struct udphdr); |
copied = skb->len - sizeof(struct udphdr); |
1133 |
if (copied > len) { |
if (copied > len) { |
1134 |
copied = len; |
copied = len; |
1135 |
--- linux-2.6.16-76.49vl4.orig/net/ipv6/inet6_hashtables.c |
--- linux-2.6.16-76.51vl4.orig/net/ipv6/inet6_hashtables.c |
1136 |
+++ linux-2.6.16-76.49vl4/net/ipv6/inet6_hashtables.c |
+++ linux-2.6.16-76.51vl4/net/ipv6/inet6_hashtables.c |
1137 |
@@ -22,6 +22,7 @@ |
@@ -22,6 +22,7 @@ |
1138 |
#include <net/inet_hashtables.h> |
#include <net/inet_hashtables.h> |
1139 |
#include <net/inet6_hashtables.h> |
#include <net/inet6_hashtables.h> |
1140 |
#include <net/ip.h> |
#include <net/ip.h> |
1141 |
+#include <linux/sakura.h> |
+#include <linux/ccsecurity.h> |
1142 |
|
|
1143 |
struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, |
struct sock *inet6_lookup_listener(struct inet_hashinfo *hashinfo, |
1144 |
const struct in6_addr *daddr, |
const struct in6_addr *daddr, |
1160 |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
1161 |
spin_lock(&head->lock); |
spin_lock(&head->lock); |
1162 |
|
|
1163 |
--- linux-2.6.16-76.49vl4.orig/net/ipv6/raw.c |
--- linux-2.6.16-76.51vl4.orig/net/ipv6/raw.c |
1164 |
+++ linux-2.6.16-76.49vl4/net/ipv6/raw.c |
+++ linux-2.6.16-76.51vl4/net/ipv6/raw.c |
1165 |
@@ -56,6 +56,7 @@ |
@@ -56,6 +56,7 @@ |
1166 |
|
|
1167 |
#include <linux/proc_fs.h> |
#include <linux/proc_fs.h> |
1168 |
#include <linux/seq_file.h> |
#include <linux/seq_file.h> |
1169 |
+#include <linux/tomoyo_socket.h> |
+#include <linux/ccsecurity.h> |
1170 |
|
|
1171 |
struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE]; |
struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE]; |
1172 |
DEFINE_RWLOCK(raw_v6_lock); |
DEFINE_RWLOCK(raw_v6_lock); |
1180 |
|
|
1181 |
copied = skb->len; |
copied = skb->len; |
1182 |
if (copied > len) { |
if (copied > len) { |
1183 |
--- linux-2.6.16-76.49vl4.orig/net/ipv6/udp.c |
--- linux-2.6.16-76.51vl4.orig/net/ipv6/udp.c |
1184 |
+++ linux-2.6.16-76.49vl4/net/ipv6/udp.c |
+++ linux-2.6.16-76.51vl4/net/ipv6/udp.c |
1185 |
@@ -59,6 +59,8 @@ |
@@ -59,6 +59,7 @@ |
1186 |
|
|
1187 |
#include <linux/proc_fs.h> |
#include <linux/proc_fs.h> |
1188 |
#include <linux/seq_file.h> |
#include <linux/seq_file.h> |
1189 |
+#include <linux/sakura.h> |
+#include <linux/ccsecurity.h> |
|
+#include <linux/tomoyo_socket.h> |
|
1190 |
|
|
1191 |
DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; |
DEFINE_SNMP_STAT(struct udp_mib, udp_stats_in6) __read_mostly; |
1192 |
|
|
1193 |
@@ -89,6 +91,8 @@ static int udp_v6_get_port(struct sock * |
@@ -89,6 +90,8 @@ static int udp_v6_get_port(struct sock * |
1194 |
result = sysctl_local_port_range[0] + |
result = sysctl_local_port_range[0] + |
1195 |
((result - sysctl_local_port_range[0]) & |
((result - sysctl_local_port_range[0]) & |
1196 |
(UDP_HTABLE_SIZE - 1)); |
(UDP_HTABLE_SIZE - 1)); |
1199 |
goto gotit; |
goto gotit; |
1200 |
} |
} |
1201 |
size = 0; |
size = 0; |
1202 |
@@ -105,6 +109,8 @@ static int udp_v6_get_port(struct sock * |
@@ -105,6 +108,8 @@ static int udp_v6_get_port(struct sock * |
1203 |
result = sysctl_local_port_range[0] |
result = sysctl_local_port_range[0] |
1204 |
+ ((result - sysctl_local_port_range[0]) & |
+ ((result - sysctl_local_port_range[0]) & |
1205 |
(UDP_HTABLE_SIZE - 1)); |
(UDP_HTABLE_SIZE - 1)); |
1208 |
if (!udp_lport_inuse(result)) |
if (!udp_lport_inuse(result)) |
1209 |
break; |
break; |
1210 |
} |
} |
1211 |
@@ -238,6 +244,9 @@ try_again: |
@@ -238,6 +243,9 @@ try_again: |
1212 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
1213 |
if (!skb) |
if (!skb) |
1214 |
goto out; |
goto out; |
1218 |
|
|
1219 |
copied = skb->len - sizeof(struct udphdr); |
copied = skb->len - sizeof(struct udphdr); |
1220 |
if (copied > len) { |
if (copied > len) { |
1221 |
--- linux-2.6.16-76.49vl4.orig/net/socket.c |
--- linux-2.6.16-76.51vl4.orig/net/socket.c |
1222 |
+++ linux-2.6.16-76.49vl4/net/socket.c |
+++ linux-2.6.16-76.51vl4/net/socket.c |
1223 |
@@ -97,6 +97,9 @@ |
@@ -97,6 +97,8 @@ |
1224 |
#include <net/sock.h> |
#include <net/sock.h> |
1225 |
#include <linux/netfilter.h> |
#include <linux/netfilter.h> |
1226 |
|
|
1227 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
|
+#include <linux/tomoyo_socket.h> |
|
1228 |
+ |
+ |
1229 |
static int sock_no_open(struct inode *irrelevant, struct file *dontcare); |
static int sock_no_open(struct inode *irrelevant, struct file *dontcare); |
1230 |
static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf, |
static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf, |
1231 |
size_t size, loff_t pos); |
size_t size, loff_t pos); |
1232 |
@@ -544,9 +547,12 @@ static inline int __sock_sendmsg(struct |
@@ -544,9 +546,12 @@ static inline int __sock_sendmsg(struct |
1233 |
si->size = size; |
si->size = size; |
1234 |
|
|
1235 |
err = security_socket_sendmsg(sock, msg, size); |
err = security_socket_sendmsg(sock, msg, size); |
1243 |
return sock->ops->sendmsg(iocb, sock, msg, size); |
return sock->ops->sendmsg(iocb, sock, msg, size); |
1244 |
} |
} |
1245 |
|
|
1246 |
@@ -1103,6 +1109,8 @@ static int __sock_create(int family, int |
@@ -1103,6 +1108,8 @@ static int __sock_create(int family, int |
1247 |
} |
} |
1248 |
|
|
1249 |
err = security_socket_create(family, type, protocol, kern); |
err = security_socket_create(family, type, protocol, kern); |
1252 |
if (err) |
if (err) |
1253 |
return err; |
return err; |
1254 |
|
|
1255 |
@@ -1299,6 +1307,10 @@ asmlinkage long sys_bind(int fd, struct |
@@ -1299,6 +1306,10 @@ asmlinkage long sys_bind(int fd, struct |
1256 |
sockfd_put(sock); |
sockfd_put(sock); |
1257 |
return err; |
return err; |
1258 |
} |
} |
1263 |
err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen); |
err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen); |
1264 |
} |
} |
1265 |
sockfd_put(sock); |
sockfd_put(sock); |
1266 |
@@ -1329,7 +1341,8 @@ asmlinkage long sys_listen(int fd, int b |
@@ -1329,7 +1340,8 @@ asmlinkage long sys_listen(int fd, int b |
1267 |
sockfd_put(sock); |
sockfd_put(sock); |
1268 |
return err; |
return err; |
1269 |
} |
} |
1273 |
err=sock->ops->listen(sock, backlog); |
err=sock->ops->listen(sock, backlog); |
1274 |
sockfd_put(sock); |
sockfd_put(sock); |
1275 |
} |
} |
1276 |
@@ -1380,6 +1393,11 @@ asmlinkage long sys_accept(int fd, struc |
@@ -1380,6 +1392,11 @@ asmlinkage long sys_accept(int fd, struc |
1277 |
if (err < 0) |
if (err < 0) |
1278 |
goto out_release; |
goto out_release; |
1279 |
|
|
1285 |
if (upeer_sockaddr) { |
if (upeer_sockaddr) { |
1286 |
if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) { |
if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) { |
1287 |
err = -ECONNABORTED; |
err = -ECONNABORTED; |
1288 |
@@ -1433,9 +1451,11 @@ asmlinkage long sys_connect(int fd, stru |
@@ -1433,9 +1450,11 @@ asmlinkage long sys_connect(int fd, stru |
1289 |
goto out_put; |
goto out_put; |
1290 |
|
|
1291 |
err = security_socket_connect(sock, (struct sockaddr *)address, addrlen); |
err = security_socket_connect(sock, (struct sockaddr *)address, addrlen); |
1298 |
err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen, |
err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen, |
1299 |
sock->file->f_flags); |
sock->file->f_flags); |
1300 |
out_put: |
out_put: |
1301 |
--- linux-2.6.16-76.49vl4.orig/net/unix/af_unix.c |
--- linux-2.6.16-76.51vl4.orig/net/unix/af_unix.c |
1302 |
+++ linux-2.6.16-76.49vl4/net/unix/af_unix.c |
+++ linux-2.6.16-76.51vl4/net/unix/af_unix.c |
1303 |
@@ -117,6 +117,7 @@ |
@@ -117,6 +117,7 @@ |
1304 |
#include <linux/mount.h> |
#include <linux/mount.h> |
1305 |
#include <net/checksum.h> |
#include <net/checksum.h> |
1306 |
#include <linux/security.h> |
#include <linux/security.h> |
1307 |
+#include <linux/tomoyo.h> |
+#include <linux/ccsecurity.h> |
1308 |
|
|
1309 |
int sysctl_unix_max_dgram_qlen = 10; |
int sysctl_unix_max_dgram_qlen = 10; |
1310 |
|
|
1318 |
err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); |
err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); |
1319 |
if (err) |
if (err) |
1320 |
goto out_mknod_dput; |
goto out_mknod_dput; |
1321 |
|
--- linux-2.6.16-76.51vl4.orig/security/Kconfig |
1322 |
|
+++ linux-2.6.16-76.51vl4/security/Kconfig |
1323 |
|
@@ -101,5 +101,7 @@ config SECURITY_SECLVL |
1324 |
|
|
1325 |
|
source security/selinux/Kconfig |
1326 |
|
|
1327 |
|
+source security/ccsecurity/Kconfig |
1328 |
|
+ |
1329 |
|
endmenu |
1330 |
|
|
1331 |
|
--- linux-2.6.16-76.51vl4.orig/security/Makefile |
1332 |
|
+++ linux-2.6.16-76.51vl4/security/Makefile |
1333 |
|
@@ -17,3 +17,6 @@ obj-$(CONFIG_SECURITY_SELINUX) += selin |
1334 |
|
obj-$(CONFIG_SECURITY_CAPABILITIES) += commoncap.o capability.o |
1335 |
|
obj-$(CONFIG_SECURITY_ROOTPLUG) += commoncap.o root_plug.o |
1336 |
|
obj-$(CONFIG_SECURITY_SECLVL) += seclvl.o |
1337 |
|
+ |
1338 |
|
+subdir-$(CONFIG_CCSECURITY)+= ccsecurity |
1339 |
|
+obj-$(CONFIG_CCSECURITY)+= ccsecurity/built-in.o |