1 |
This is TOMOYO Linux patch for openSUSE 11.0. |
This is TOMOYO Linux patch for openSUSE 11.0. |
2 |
|
|
3 |
Source code for this patch is http://download.opensuse.org/update/11.0/rpm/i586/kernel-source-2.6.25.20-0.1.i586.rpm |
Source code for this patch is http://download.opensuse.org/update/11.0/rpm/i586/kernel-source-2.6.25.20-0.4.i586.rpm |
4 |
--- |
--- |
5 |
arch/ia64/ia32/sys_ia32.c | 7 ++++ |
arch/ia64/ia32/sys_ia32.c | 7 ++++ |
6 |
arch/mips/kernel/ptrace32.c | 7 ++++ |
arch/mips/kernel/ptrace32.c | 7 ++++ |
8 |
arch/x86/kernel/ptrace.c | 7 ++++ |
arch/x86/kernel/ptrace.c | 7 ++++ |
9 |
fs/Kconfig | 2 + |
fs/Kconfig | 2 + |
10 |
fs/Makefile | 2 + |
fs/Makefile | 2 + |
11 |
fs/attr.c | 19 +++++++++++++ |
fs/attr.c | 11 +++++++ |
12 |
fs/compat.c | 5 ++- |
fs/compat.c | 5 ++- |
13 |
fs/compat_ioctl.c | 13 +++++++++ |
fs/compat_ioctl.c | 13 +++++++++ |
14 |
fs/exec.c | 20 +++++++++++++- |
fs/exec.c | 18 +++++++++++- |
15 |
fs/fcntl.c | 9 ++++++ |
fs/fcntl.c | 9 ++++++ |
16 |
fs/ioctl.c | 11 +++++++ |
fs/ioctl.c | 11 +++++++ |
17 |
fs/namei.c | 57 ++++++++++++++++++++++++++++++++++++++++ |
fs/namei.c | 57 ++++++++++++++++++++++++++++++++++++++++ |
32 |
kernel/sysctl.c | 9 ++++++ |
kernel/sysctl.c | 9 ++++++ |
33 |
kernel/time.c | 11 +++++++ |
kernel/time.c | 11 +++++++ |
34 |
kernel/time/ntp.c | 7 ++++ |
kernel/time/ntp.c | 7 ++++ |
|
net/core/datagram.c | 11 +++++++ |
|
35 |
net/ipv4/inet_connection_sock.c | 7 ++++ |
net/ipv4/inet_connection_sock.c | 7 ++++ |
36 |
net/ipv4/inet_hashtables.c | 7 ++++ |
net/ipv4/inet_hashtables.c | 7 ++++ |
37 |
net/ipv4/udp.c | 10 +++++++ |
net/ipv4/raw.c | 8 +++++ |
38 |
|
net/ipv4/udp.c | 18 ++++++++++++ |
39 |
|
net/ipv6/raw.c | 8 +++++ |
40 |
|
net/ipv6/udp.c | 8 +++++ |
41 |
net/socket.c | 41 ++++++++++++++++++++++++++++ |
net/socket.c | 41 ++++++++++++++++++++++++++++ |
42 |
net/unix/af_unix.c | 8 +++++ |
net/unix/af_unix.c | 8 +++++ |
43 |
36 files changed, 464 insertions(+), 2 deletions(-) |
38 files changed, 475 insertions(+), 2 deletions(-) |
44 |
|
|
45 |
--- linux-2.6.25.20-0.1.orig/arch/ia64/ia32/sys_ia32.c |
--- linux-2.6.25.20-0.4.orig/arch/ia64/ia32/sys_ia32.c |
46 |
+++ linux-2.6.25.20-0.1/arch/ia64/ia32/sys_ia32.c |
+++ linux-2.6.25.20-0.4/arch/ia64/ia32/sys_ia32.c |
47 |
@@ -50,6 +50,9 @@ |
@@ -50,6 +50,9 @@ |
48 |
#include <asm/types.h> |
#include <asm/types.h> |
49 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
65 |
|
|
66 |
lock_kernel(); |
lock_kernel(); |
67 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
68 |
--- linux-2.6.25.20-0.1.orig/arch/mips/kernel/ptrace32.c |
--- linux-2.6.25.20-0.4.orig/arch/mips/kernel/ptrace32.c |
69 |
+++ linux-2.6.25.20-0.1/arch/mips/kernel/ptrace32.c |
+++ linux-2.6.25.20-0.4/arch/mips/kernel/ptrace32.c |
70 |
@@ -35,6 +35,9 @@ |
@@ -35,6 +35,9 @@ |
71 |
#include <asm/system.h> |
#include <asm/system.h> |
72 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
88 |
|
|
89 |
#if 0 |
#if 0 |
90 |
printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n", |
printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n", |
91 |
--- linux-2.6.25.20-0.1.orig/arch/s390/kernel/ptrace.c |
--- linux-2.6.25.20-0.4.orig/arch/s390/kernel/ptrace.c |
92 |
+++ linux-2.6.25.20-0.1/arch/s390/kernel/ptrace.c |
+++ linux-2.6.25.20-0.4/arch/s390/kernel/ptrace.c |
93 |
@@ -41,6 +41,9 @@ |
@@ -41,6 +41,9 @@ |
94 |
#include <asm/system.h> |
#include <asm/system.h> |
95 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
111 |
lock_kernel(); |
lock_kernel(); |
112 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
113 |
ret = ptrace_traceme(); |
ret = ptrace_traceme(); |
114 |
--- linux-2.6.25.20-0.1.orig/arch/x86/kernel/ptrace.c |
--- linux-2.6.25.20-0.4.orig/arch/x86/kernel/ptrace.c |
115 |
+++ linux-2.6.25.20-0.1/arch/x86/kernel/ptrace.c |
+++ linux-2.6.25.20-0.4/arch/x86/kernel/ptrace.c |
116 |
@@ -32,6 +32,9 @@ |
@@ -32,6 +32,9 @@ |
117 |
#include <asm/prctl.h> |
#include <asm/prctl.h> |
118 |
#include <asm/proto.h> |
#include <asm/proto.h> |
134 |
|
|
135 |
switch (request) { |
switch (request) { |
136 |
case PTRACE_TRACEME: |
case PTRACE_TRACEME: |
137 |
--- linux-2.6.25.20-0.1.orig/fs/Kconfig |
--- linux-2.6.25.20-0.4.orig/fs/Kconfig |
138 |
+++ linux-2.6.25.20-0.1/fs/Kconfig |
+++ linux-2.6.25.20-0.4/fs/Kconfig |
139 |
@@ -2187,4 +2187,6 @@ endif |
@@ -2187,4 +2187,6 @@ endif |
140 |
source "fs/nls/Kconfig" |
source "fs/nls/Kconfig" |
141 |
source "fs/dlm/Kconfig" |
source "fs/dlm/Kconfig" |
143 |
+source "fs/Kconfig.ccs" |
+source "fs/Kconfig.ccs" |
144 |
+ |
+ |
145 |
endmenu |
endmenu |
146 |
--- linux-2.6.25.20-0.1.orig/fs/Makefile |
--- linux-2.6.25.20-0.4.orig/fs/Makefile |
147 |
+++ linux-2.6.25.20-0.1/fs/Makefile |
+++ linux-2.6.25.20-0.4/fs/Makefile |
148 |
@@ -125,3 +125,5 @@ obj-$(CONFIG_OCFS2_FS) += ocfs2/ |
@@ -125,3 +125,5 @@ obj-$(CONFIG_OCFS2_FS) += ocfs2/ |
149 |
obj-$(CONFIG_GFS2_FS) += gfs2/ |
obj-$(CONFIG_GFS2_FS) += gfs2/ |
150 |
obj-$(CONFIG_NOVFS) += novfs/ |
obj-$(CONFIG_NOVFS) += novfs/ |
151 |
obj-$(CONFIG_SQUASHFS) += squashfs/ |
obj-$(CONFIG_SQUASHFS) += squashfs/ |
152 |
+ |
+ |
153 |
+include $(srctree)/fs/Makefile-2.6.ccs |
+include $(srctree)/fs/Makefile-2.6.ccs |
154 |
--- linux-2.6.25.20-0.1.orig/fs/attr.c |
--- linux-2.6.25.20-0.4.orig/fs/attr.c |
155 |
+++ linux-2.6.25.20-0.1/fs/attr.c |
+++ linux-2.6.25.20-0.4/fs/attr.c |
156 |
@@ -14,6 +14,9 @@ |
@@ -14,6 +14,9 @@ |
157 |
#include <linux/fcntl.h> |
#include <linux/fcntl.h> |
158 |
#include <linux/quotaops.h> |
#include <linux/quotaops.h> |
163 |
|
|
164 |
/* Taken over from the old code... */ |
/* Taken over from the old code... */ |
165 |
|
|
166 |
@@ -160,6 +163,14 @@ int fnotify_change(struct dentry *dentry |
@@ -160,6 +163,10 @@ int fnotify_change(struct dentry *dentry |
167 |
|
|
168 |
if (inode->i_op && inode->i_op->setattr) { |
if (inode->i_op && inode->i_op->setattr) { |
169 |
error = security_inode_setattr(dentry, mnt, attr); |
error = security_inode_setattr(dentry, mnt, attr); |
170 |
+ /***** TOMOYO Linux start. *****/ |
+ /***** TOMOYO Linux start. *****/ |
171 |
+ if (!error && (ia_valid & ATTR_MODE) && |
+ if (!error) |
172 |
+ !ccs_capable(CCS_SYS_CHMOD)) |
+ error = ccs_check_setattr_permission(dentry, attr); |
|
+ error = -EPERM; |
|
|
+ if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) && |
|
|
+ !ccs_capable(CCS_SYS_CHOWN)) |
|
|
+ error = -EPERM; |
|
173 |
+ /***** TOMOYO Linux end. *****/ |
+ /***** TOMOYO Linux end. *****/ |
174 |
if (!error) { |
if (!error) { |
175 |
if (file && file->f_op && file->f_op->fsetattr) |
if (file && file->f_op && file->f_op->fsetattr) |
176 |
error = file->f_op->fsetattr(file, attr); |
error = file->f_op->fsetattr(file, attr); |
177 |
@@ -181,6 +192,14 @@ int fnotify_change(struct dentry *dentry |
@@ -181,6 +188,10 @@ int fnotify_change(struct dentry *dentry |
178 |
error = inode_change_ok(inode, attr); |
error = inode_change_ok(inode, attr); |
179 |
if (!error) |
if (!error) |
180 |
error = security_inode_setattr(dentry, mnt, attr); |
error = security_inode_setattr(dentry, mnt, attr); |
181 |
+ /***** TOMOYO Linux start. *****/ |
+ /***** TOMOYO Linux start. *****/ |
182 |
+ if (!error && (ia_valid & ATTR_MODE) && |
+ if (!error) |
183 |
+ !ccs_capable(CCS_SYS_CHMOD)) |
+ error = ccs_check_setattr_permission(dentry, attr); |
|
+ error = -EPERM; |
|
|
+ if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) && |
|
|
+ !ccs_capable(CCS_SYS_CHOWN)) |
|
|
+ error = -EPERM; |
|
184 |
+ /***** TOMOYO Linux end. *****/ |
+ /***** TOMOYO Linux end. *****/ |
185 |
if (!error) { |
if (!error) { |
186 |
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
187 |
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) |
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) |
188 |
--- linux-2.6.25.20-0.1.orig/fs/compat.c |
--- linux-2.6.25.20-0.4.orig/fs/compat.c |
189 |
+++ linux-2.6.25.20-0.1/fs/compat.c |
+++ linux-2.6.25.20-0.4/fs/compat.c |
190 |
@@ -55,6 +55,9 @@ |
@@ -55,6 +55,9 @@ |
191 |
#include <asm/mmu_context.h> |
#include <asm/mmu_context.h> |
192 |
#include <asm/ioctls.h> |
#include <asm/ioctls.h> |
206 |
if (retval >= 0) { |
if (retval >= 0) { |
207 |
/* execve success */ |
/* execve success */ |
208 |
security_bprm_free(bprm); |
security_bprm_free(bprm); |
209 |
--- linux-2.6.25.20-0.1.orig/fs/compat_ioctl.c |
--- linux-2.6.25.20-0.4.orig/fs/compat_ioctl.c |
210 |
+++ linux-2.6.25.20-0.1/fs/compat_ioctl.c |
+++ linux-2.6.25.20-0.4/fs/compat_ioctl.c |
211 |
@@ -120,6 +120,9 @@ |
@@ -120,6 +120,9 @@ |
212 |
#include <xen/public/privcmd.h> |
#include <xen/public/privcmd.h> |
213 |
#include <xen/compat_ioctl.h> |
#include <xen/compat_ioctl.h> |
242 |
if (filp->f_op && filp->f_op->compat_ioctl) { |
if (filp->f_op && filp->f_op->compat_ioctl) { |
243 |
error = filp->f_op->compat_ioctl(filp, cmd, arg); |
error = filp->f_op->compat_ioctl(filp, cmd, arg); |
244 |
if (error != -ENOIOCTLCMD) |
if (error != -ENOIOCTLCMD) |
245 |
--- linux-2.6.25.20-0.1.orig/fs/exec.c |
--- linux-2.6.25.20-0.4.orig/fs/exec.c |
246 |
+++ linux-2.6.25.20-0.1/fs/exec.c |
+++ linux-2.6.25.20-0.4/fs/exec.c |
247 |
@@ -60,6 +60,10 @@ |
@@ -60,6 +60,10 @@ |
248 |
#include <linux/kmod.h> |
#include <linux/kmod.h> |
249 |
#endif |
#endif |
255 |
int core_uses_pid; |
int core_uses_pid; |
256 |
char core_pattern[CORENAME_MAX_SIZE] = "core"; |
char core_pattern[CORENAME_MAX_SIZE] = "core"; |
257 |
int suid_dumpable = 0; |
int suid_dumpable = 0; |
258 |
@@ -118,6 +122,12 @@ asmlinkage long sys_uselib(const char __ |
@@ -118,6 +122,11 @@ asmlinkage long sys_uselib(const char __ |
259 |
error = vfs_permission(&nd, MAY_READ | MAY_EXEC); |
error = vfs_permission(&nd, MAY_READ | MAY_EXEC); |
260 |
if (error) |
if (error) |
261 |
goto exit; |
goto exit; |
262 |
+ /***** TOMOYO Linux start. *****/ |
+ /***** TOMOYO Linux start. *****/ |
263 |
+ /* 01 means "read". */ |
+ error = ccs_check_uselib_permission(nd.path.dentry, nd.path.mnt); |
|
+ error = ccs_check_open_permission(nd.path.dentry, nd.path.mnt, 01); |
|
264 |
+ if (error) |
+ if (error) |
265 |
+ goto exit; |
+ goto exit; |
266 |
+ /***** TOMOYO Linux end. *****/ |
+ /***** TOMOYO Linux end. *****/ |
267 |
|
|
268 |
file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE); |
file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE); |
269 |
error = PTR_ERR(file); |
error = PTR_ERR(file); |
270 |
@@ -664,6 +674,14 @@ struct file *open_exec(const char *name) |
@@ -664,6 +673,13 @@ struct file *open_exec(const char *name) |
271 |
file = ERR_PTR(-EACCES); |
file = ERR_PTR(-EACCES); |
272 |
if (S_ISREG(inode->i_mode)) { |
if (S_ISREG(inode->i_mode)) { |
273 |
int err = vfs_permission(&nd, MAY_EXEC); |
int err = vfs_permission(&nd, MAY_EXEC); |
274 |
+ /***** TOMOYO Linux start. *****/ |
+ /***** TOMOYO Linux start. *****/ |
275 |
+ if (!err && (current->ccs_flags & |
+ if (!err) |
276 |
+ CCS_CHECK_READ_FOR_OPEN_EXEC)) |
+ err = ccs_check_open_exec_permission(nd.path. |
277 |
+ /* 01 means "read". */ |
+ dentry, |
278 |
+ err = ccs_check_open_permission(nd.path.dentry, |
+ nd.path. |
279 |
+ nd.path.mnt, |
+ mnt); |
|
+ 01); |
|
280 |
+ /***** TOMOYO Linux end. *****/ |
+ /***** TOMOYO Linux end. *****/ |
281 |
file = ERR_PTR(err); |
file = ERR_PTR(err); |
282 |
if (!err) { |
if (!err) { |
283 |
file = nameidata_to_filp(&nd, |
file = nameidata_to_filp(&nd, |
284 |
@@ -1336,7 +1354,7 @@ int do_execve(char * filename, |
@@ -1336,7 +1352,7 @@ int do_execve(char * filename, |
285 |
goto out; |
goto out; |
286 |
bprm->argv_len = env_p - bprm->p; |
bprm->argv_len = env_p - bprm->p; |
287 |
|
|
290 |
if (retval >= 0) { |
if (retval >= 0) { |
291 |
/* execve success */ |
/* execve success */ |
292 |
free_arg_pages(bprm); |
free_arg_pages(bprm); |
293 |
--- linux-2.6.25.20-0.1.orig/fs/fcntl.c |
--- linux-2.6.25.20-0.4.orig/fs/fcntl.c |
294 |
+++ linux-2.6.25.20-0.1/fs/fcntl.c |
+++ linux-2.6.25.20-0.4/fs/fcntl.c |
295 |
@@ -23,6 +23,9 @@ |
@@ -23,6 +23,9 @@ |
296 |
#include <asm/poll.h> |
#include <asm/poll.h> |
297 |
#include <asm/siginfo.h> |
#include <asm/siginfo.h> |
315 |
/* O_NOATIME can only be set by the owner or superuser */ |
/* O_NOATIME can only be set by the owner or superuser */ |
316 |
if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) |
if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) |
317 |
if (!is_owner_or_cap(inode)) |
if (!is_owner_or_cap(inode)) |
318 |
--- linux-2.6.25.20-0.1.orig/fs/ioctl.c |
--- linux-2.6.25.20-0.4.orig/fs/ioctl.c |
319 |
+++ linux-2.6.25.20-0.1/fs/ioctl.c |
+++ linux-2.6.25.20-0.4/fs/ioctl.c |
320 |
@@ -15,6 +15,9 @@ |
@@ -15,6 +15,9 @@ |
321 |
#include <linux/uaccess.h> |
#include <linux/uaccess.h> |
322 |
|
|
349 |
if (error) |
if (error) |
350 |
goto out_fput; |
goto out_fput; |
351 |
|
|
352 |
--- linux-2.6.25.20-0.1.orig/fs/namei.c |
--- linux-2.6.25.20-0.4.orig/fs/namei.c |
353 |
+++ linux-2.6.25.20-0.1/fs/namei.c |
+++ linux-2.6.25.20-0.4/fs/namei.c |
354 |
@@ -35,6 +35,10 @@ |
@@ -35,6 +35,10 @@ |
355 |
|
|
356 |
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) |
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) |
485 |
|
|
486 |
error = vfs_rename(old_dir->d_inode, old_dentry, oldnd.path.mnt, |
error = vfs_rename(old_dir->d_inode, old_dentry, oldnd.path.mnt, |
487 |
new_dir->d_inode, new_dentry, newnd.path.mnt); |
new_dir->d_inode, new_dentry, newnd.path.mnt); |
488 |
--- linux-2.6.25.20-0.1.orig/fs/namespace.c |
--- linux-2.6.25.20-0.4.orig/fs/namespace.c |
489 |
+++ linux-2.6.25.20-0.1/fs/namespace.c |
+++ linux-2.6.25.20-0.4/fs/namespace.c |
490 |
@@ -30,6 +30,12 @@ |
@@ -30,6 +30,12 @@ |
491 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
492 |
#include "pnode.h" |
#include "pnode.h" |
599 |
if (error) { |
if (error) { |
600 |
path_put(&old_nd.path); |
path_put(&old_nd.path); |
601 |
goto out1; |
goto out1; |
602 |
--- linux-2.6.25.20-0.1.orig/fs/open.c |
--- linux-2.6.25.20-0.4.orig/fs/open.c |
603 |
+++ linux-2.6.25.20-0.1/fs/open.c |
+++ linux-2.6.25.20-0.4/fs/open.c |
604 |
@@ -27,6 +27,12 @@ |
@@ -27,6 +27,12 @@ |
605 |
#include <linux/rcupdate.h> |
#include <linux/rcupdate.h> |
606 |
#include <linux/audit.h> |
#include <linux/audit.h> |
666 |
if (capable(CAP_SYS_TTY_CONFIG)) { |
if (capable(CAP_SYS_TTY_CONFIG)) { |
667 |
/* XXX: this needs locking */ |
/* XXX: this needs locking */ |
668 |
tty_vhangup(current->signal->tty); |
tty_vhangup(current->signal->tty); |
669 |
--- linux-2.6.25.20-0.1.orig/fs/proc/Makefile |
--- linux-2.6.25.20-0.4.orig/fs/proc/Makefile |
670 |
+++ linux-2.6.25.20-0.1/fs/proc/Makefile |
+++ linux-2.6.25.20-0.4/fs/proc/Makefile |
671 |
@@ -16,3 +16,6 @@ proc-$(CONFIG_PROC_KCORE) += kcore.o |
@@ -16,3 +16,6 @@ proc-$(CONFIG_PROC_KCORE) += kcore.o |
672 |
proc-$(CONFIG_PROC_VMCORE) += vmcore.o |
proc-$(CONFIG_PROC_VMCORE) += vmcore.o |
673 |
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o |
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o |
675 |
+ |
+ |
676 |
+proc-$(CONFIG_SAKURA) += ccs_proc.o |
+proc-$(CONFIG_SAKURA) += ccs_proc.o |
677 |
+proc-$(CONFIG_TOMOYO) += ccs_proc.o |
+proc-$(CONFIG_TOMOYO) += ccs_proc.o |
678 |
--- linux-2.6.25.20-0.1.orig/fs/proc/proc_misc.c |
--- linux-2.6.25.20-0.4.orig/fs/proc/proc_misc.c |
679 |
+++ linux-2.6.25.20-0.1/fs/proc/proc_misc.c |
+++ linux-2.6.25.20-0.4/fs/proc/proc_misc.c |
680 |
@@ -1021,4 +1021,9 @@ void __init proc_misc_init(void) |
@@ -1021,4 +1021,9 @@ void __init proc_misc_init(void) |
681 |
entry->proc_fops = &proc_sysrq_trigger_operations; |
entry->proc_fops = &proc_sysrq_trigger_operations; |
682 |
} |
} |
683 |
#endif |
#endif |
684 |
+ /***** CCS start. *****/ |
+ /***** CCS start. *****/ |
685 |
+#if defined(CONFIG_SAKURA) || defined(CONFIG_TOMOYO) |
+#if defined(CONFIG_SAKURA) || defined(CONFIG_TOMOYO) |
686 |
+ printk(KERN_INFO "Hook version: 2.6.25.20-0.1 2009/03/18\n"); |
+ printk(KERN_INFO "Hook version: 2.6.25.20-0.4 2009/06/09\n"); |
687 |
+#endif |
+#endif |
688 |
+ /***** CCS end. *****/ |
+ /***** CCS end. *****/ |
689 |
} |
} |
690 |
--- linux-2.6.25.20-0.1.orig/include/linux/init_task.h |
--- linux-2.6.25.20-0.4.orig/include/linux/init_task.h |
691 |
+++ linux-2.6.25.20-0.1/include/linux/init_task.h |
+++ linux-2.6.25.20-0.4/include/linux/init_task.h |
692 |
@@ -196,6 +196,10 @@ extern struct group_info init_groups; |
@@ -196,6 +196,10 @@ extern struct group_info init_groups; |
693 |
INIT_IDS \ |
INIT_IDS \ |
694 |
INIT_TRACE_IRQFLAGS \ |
INIT_TRACE_IRQFLAGS \ |
700 |
} |
} |
701 |
|
|
702 |
|
|
703 |
--- linux-2.6.25.20-0.1.orig/include/linux/sched.h |
--- linux-2.6.25.20-0.4.orig/include/linux/sched.h |
704 |
+++ linux-2.6.25.20-0.1/include/linux/sched.h |
+++ linux-2.6.25.20-0.4/include/linux/sched.h |
705 |
@@ -29,6 +29,10 @@ |
@@ -29,6 +29,10 @@ |
706 |
#define CLONE_NEWNET 0x40000000 /* New network namespace */ |
#define CLONE_NEWNET 0x40000000 /* New network namespace */ |
707 |
#define CLONE_IO 0x80000000 /* Clone io context */ |
#define CLONE_IO 0x80000000 /* Clone io context */ |
724 |
}; |
}; |
725 |
|
|
726 |
/* |
/* |
727 |
--- linux-2.6.25.20-0.1.orig/kernel/compat.c |
--- linux-2.6.25.20-0.4.orig/kernel/compat.c |
728 |
+++ linux-2.6.25.20-0.1/kernel/compat.c |
+++ linux-2.6.25.20-0.4/kernel/compat.c |
729 |
@@ -25,6 +25,9 @@ |
@@ -25,6 +25,9 @@ |
730 |
#include <linux/posix-timers.h> |
#include <linux/posix-timers.h> |
731 |
|
|
747 |
|
|
748 |
do_settimeofday(&tv); |
do_settimeofday(&tv); |
749 |
return 0; |
return 0; |
750 |
--- linux-2.6.25.20-0.1.orig/kernel/kexec.c |
--- linux-2.6.25.20-0.4.orig/kernel/kexec.c |
751 |
+++ linux-2.6.25.20-0.1/kernel/kexec.c |
+++ linux-2.6.25.20-0.4/kernel/kexec.c |
752 |
@@ -31,6 +31,9 @@ |
@@ -31,6 +31,9 @@ |
753 |
#include <asm/system.h> |
#include <asm/system.h> |
754 |
#include <asm/semaphore.h> |
#include <asm/semaphore.h> |
770 |
|
|
771 |
/* |
/* |
772 |
* Verify we have a legal set of flags |
* Verify we have a legal set of flags |
773 |
--- linux-2.6.25.20-0.1.orig/kernel/kmod.c |
--- linux-2.6.25.20-0.4.orig/kernel/kmod.c |
774 |
+++ linux-2.6.25.20-0.1/kernel/kmod.c |
+++ linux-2.6.25.20-0.4/kernel/kmod.c |
775 |
@@ -173,6 +173,11 @@ static int ____call_usermodehelper(void |
@@ -173,6 +173,11 @@ static int ____call_usermodehelper(void |
776 |
*/ |
*/ |
777 |
set_user_nice(current, 0); |
set_user_nice(current, 0); |
784 |
retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp); |
retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp); |
785 |
|
|
786 |
/* Exec failed? */ |
/* Exec failed? */ |
787 |
--- linux-2.6.25.20-0.1.orig/kernel/module.c |
--- linux-2.6.25.20-0.4.orig/kernel/module.c |
788 |
+++ linux-2.6.25.20-0.1/kernel/module.c |
+++ linux-2.6.25.20-0.4/kernel/module.c |
789 |
@@ -47,6 +47,9 @@ |
@@ -47,6 +47,9 @@ |
790 |
#include <asm/cacheflush.h> |
#include <asm/cacheflush.h> |
791 |
#include <linux/license.h> |
#include <linux/license.h> |
818 |
|
|
819 |
/* Only one module load at a time, please */ |
/* Only one module load at a time, please */ |
820 |
if (mutex_lock_interruptible(&module_mutex) != 0) |
if (mutex_lock_interruptible(&module_mutex) != 0) |
821 |
--- linux-2.6.25.20-0.1.orig/kernel/ptrace.c |
--- linux-2.6.25.20-0.4.orig/kernel/ptrace.c |
822 |
+++ linux-2.6.25.20-0.1/kernel/ptrace.c |
+++ linux-2.6.25.20-0.4/kernel/ptrace.c |
823 |
@@ -24,6 +24,9 @@ |
@@ -24,6 +24,9 @@ |
824 |
|
|
825 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
852 |
lock_kernel(); |
lock_kernel(); |
853 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
854 |
ret = ptrace_traceme(); |
ret = ptrace_traceme(); |
855 |
--- linux-2.6.25.20-0.1.orig/kernel/sched.c |
--- linux-2.6.25.20-0.4.orig/kernel/sched.c |
856 |
+++ linux-2.6.25.20-0.1/kernel/sched.c |
+++ linux-2.6.25.20-0.4/kernel/sched.c |
857 |
@@ -69,6 +69,9 @@ |
@@ -69,6 +69,9 @@ |
858 |
|
|
859 |
#include <asm/tlb.h> |
#include <asm/tlb.h> |
875 |
|
|
876 |
/* |
/* |
877 |
* Setpriority might change our priority at the same moment. |
* Setpriority might change our priority at the same moment. |
878 |
--- linux-2.6.25.20-0.1.orig/kernel/signal.c |
--- linux-2.6.25.20-0.4.orig/kernel/signal.c |
879 |
+++ linux-2.6.25.20-0.1/kernel/signal.c |
+++ linux-2.6.25.20-0.4/kernel/signal.c |
880 |
@@ -32,6 +32,9 @@ |
@@ -32,6 +32,9 @@ |
881 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
882 |
#include <asm/siginfo.h> |
#include <asm/siginfo.h> |
926 |
|
|
927 |
return do_tkill(0, pid, sig); |
return do_tkill(0, pid, sig); |
928 |
} |
} |
929 |
--- linux-2.6.25.20-0.1.orig/kernel/sys.c |
--- linux-2.6.25.20-0.4.orig/kernel/sys.c |
930 |
+++ linux-2.6.25.20-0.1/kernel/sys.c |
+++ linux-2.6.25.20-0.4/kernel/sys.c |
931 |
@@ -42,6 +42,9 @@ |
@@ -42,6 +42,9 @@ |
932 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
933 |
#include <asm/io.h> |
#include <asm/io.h> |
984 |
|
|
985 |
down_write(&uts_sem); |
down_write(&uts_sem); |
986 |
errno = -EFAULT; |
errno = -EFAULT; |
987 |
--- linux-2.6.25.20-0.1.orig/kernel/sysctl.c |
--- linux-2.6.25.20-0.4.orig/kernel/sysctl.c |
988 |
+++ linux-2.6.25.20-0.1/kernel/sysctl.c |
+++ linux-2.6.25.20-0.4/kernel/sysctl.c |
989 |
@@ -48,6 +48,9 @@ |
@@ -48,6 +48,9 @@ |
990 |
|
|
991 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
1016 |
error = parse_table(name, nlen, oldval, oldlenp, |
error = parse_table(name, nlen, oldval, oldlenp, |
1017 |
newval, newlen, head->ctl_table); |
newval, newlen, head->ctl_table); |
1018 |
if (error != -ENOTDIR) { |
if (error != -ENOTDIR) { |
1019 |
--- linux-2.6.25.20-0.1.orig/kernel/time.c |
--- linux-2.6.25.20-0.4.orig/kernel/time.c |
1020 |
+++ linux-2.6.25.20-0.1/kernel/time.c |
+++ linux-2.6.25.20-0.4/kernel/time.c |
1021 |
@@ -38,6 +38,9 @@ |
@@ -38,6 +38,9 @@ |
1022 |
|
|
1023 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
1050 |
|
|
1051 |
if (tz) { |
if (tz) { |
1052 |
/* SMP safe, global irq locking makes it work. */ |
/* SMP safe, global irq locking makes it work. */ |
1053 |
--- linux-2.6.25.20-0.1.orig/kernel/time/ntp.c |
--- linux-2.6.25.20-0.4.orig/kernel/time/ntp.c |
1054 |
+++ linux-2.6.25.20-0.1/kernel/time/ntp.c |
+++ linux-2.6.25.20-0.4/kernel/time/ntp.c |
1055 |
@@ -17,6 +17,9 @@ |
@@ -17,6 +17,9 @@ |
1056 |
#include <linux/capability.h> |
#include <linux/capability.h> |
1057 |
#include <asm/div64.h> |
#include <asm/div64.h> |
1073 |
|
|
1074 |
/* Now we validate the data before disabling interrupts */ |
/* Now we validate the data before disabling interrupts */ |
1075 |
|
|
1076 |
--- linux-2.6.25.20-0.1.orig/net/core/datagram.c |
--- linux-2.6.25.20-0.4.orig/net/ipv4/inet_connection_sock.c |
1077 |
+++ linux-2.6.25.20-0.1/net/core/datagram.c |
+++ linux-2.6.25.20-0.4/net/ipv4/inet_connection_sock.c |
|
@@ -56,6 +56,11 @@ |
|
|
#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' ? |
|
|
*/ |
|
|
@@ -179,6 +184,12 @@ struct sk_buff *__skb_recv_datagram(stru |
|
|
} |
|
|
spin_unlock_irqrestore(&sk->sk_receive_queue.lock, cpu_flags); |
|
|
|
|
|
+ /***** 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.25.20-0.1.orig/net/ipv4/inet_connection_sock.c |
|
|
+++ linux-2.6.25.20-0.1/net/ipv4/inet_connection_sock.c |
|
1078 |
@@ -23,6 +23,9 @@ |
@@ -23,6 +23,9 @@ |
1079 |
#include <net/route.h> |
#include <net/route.h> |
1080 |
#include <net/tcp_states.h> |
#include <net/tcp_states.h> |
1096 |
inet_bind_bucket_for_each(tb, node, &head->chain) |
inet_bind_bucket_for_each(tb, node, &head->chain) |
1097 |
if (tb->ib_net == net && tb->port == rover) |
if (tb->ib_net == net && tb->port == rover) |
1098 |
goto next; |
goto next; |
1099 |
--- linux-2.6.25.20-0.1.orig/net/ipv4/inet_hashtables.c |
--- linux-2.6.25.20-0.4.orig/net/ipv4/inet_hashtables.c |
1100 |
+++ linux-2.6.25.20-0.1/net/ipv4/inet_hashtables.c |
+++ linux-2.6.25.20-0.4/net/ipv4/inet_hashtables.c |
1101 |
@@ -22,6 +22,9 @@ |
@@ -22,6 +22,9 @@ |
1102 |
#include <net/inet_connection_sock.h> |
#include <net/inet_connection_sock.h> |
1103 |
#include <net/inet_hashtables.h> |
#include <net/inet_hashtables.h> |
1119 |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
1120 |
spin_lock(&head->lock); |
spin_lock(&head->lock); |
1121 |
|
|
1122 |
--- linux-2.6.25.20-0.1.orig/net/ipv4/udp.c |
--- linux-2.6.25.20-0.4.orig/net/ipv4/raw.c |
1123 |
+++ linux-2.6.25.20-0.1/net/ipv4/udp.c |
+++ linux-2.6.25.20-0.4/net/ipv4/raw.c |
1124 |
@@ -105,6 +105,9 @@ |
@@ -79,6 +79,9 @@ |
1125 |
|
#include <linux/seq_file.h> |
1126 |
|
#include <linux/netfilter.h> |
1127 |
|
#include <linux/netfilter_ipv4.h> |
1128 |
|
+/***** TOMOYO Linux start. *****/ |
1129 |
|
+#include <linux/tomoyo_socket.h> |
1130 |
|
+/***** TOMOYO Linux end. *****/ |
1131 |
|
|
1132 |
|
static struct raw_hashinfo raw_v4_hashinfo = { |
1133 |
|
.lock = __RW_LOCK_UNLOCKED(), |
1134 |
|
@@ -668,6 +671,11 @@ static int raw_recvmsg(struct kiocb *ioc |
1135 |
|
skb = skb_recv_datagram(sk, flags, noblock, &err); |
1136 |
|
if (!skb) |
1137 |
|
goto out; |
1138 |
|
+ /***** TOMOYO Linux start. *****/ |
1139 |
|
+ err = ccs_socket_recvmsg_permission(sk, skb, flags); |
1140 |
|
+ if (err) |
1141 |
|
+ goto out; |
1142 |
|
+ /***** TOMOYO Linux end. *****/ |
1143 |
|
|
1144 |
|
copied = skb->len; |
1145 |
|
if (len < copied) { |
1146 |
|
--- linux-2.6.25.20-0.4.orig/net/ipv4/udp.c |
1147 |
|
+++ linux-2.6.25.20-0.4/net/ipv4/udp.c |
1148 |
|
@@ -105,6 +105,12 @@ |
1149 |
#include <net/checksum.h> |
#include <net/checksum.h> |
1150 |
#include <net/xfrm.h> |
#include <net/xfrm.h> |
1151 |
#include "udp_impl.h" |
#include "udp_impl.h" |
1152 |
+/***** SAKURA Linux start. *****/ |
+/***** SAKURA Linux start. *****/ |
1153 |
+#include <linux/sakura.h> |
+#include <linux/sakura.h> |
1154 |
+/***** SAKURA Linux end. *****/ |
+/***** SAKURA Linux end. *****/ |
1155 |
|
+/***** TOMOYO Linux start. *****/ |
1156 |
|
+#include <linux/tomoyo_socket.h> |
1157 |
|
+/***** TOMOYO Linux end. *****/ |
1158 |
|
|
1159 |
/* |
/* |
1160 |
* Snmp MIB for the UDP layer |
* Snmp MIB for the UDP layer |
1161 |
@@ -176,6 +179,10 @@ int __udp_lib_get_port(struct sock *sk, |
@@ -176,6 +182,10 @@ int __udp_lib_get_port(struct sock *sk, |
1162 |
/* 1st pass: look for empty (or shortest) hash chain */ |
/* 1st pass: look for empty (or shortest) hash chain */ |
1163 |
for (i = 0; i < UDP_HTABLE_SIZE; i++) { |
for (i = 0; i < UDP_HTABLE_SIZE; i++) { |
1164 |
int size = 0; |
int size = 0; |
1169 |
|
|
1170 |
head = &udptable[rover & (UDP_HTABLE_SIZE - 1)]; |
head = &udptable[rover & (UDP_HTABLE_SIZE - 1)]; |
1171 |
if (hlist_empty(head)) |
if (hlist_empty(head)) |
1172 |
@@ -199,6 +206,9 @@ int __udp_lib_get_port(struct sock *sk, |
@@ -199,6 +209,9 @@ int __udp_lib_get_port(struct sock *sk, |
1173 |
/* 2nd pass: find hole in shortest hash chain */ |
/* 2nd pass: find hole in shortest hash chain */ |
1174 |
rover = best; |
rover = best; |
1175 |
for (i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++) { |
for (i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++) { |
1179 |
if (! __udp_lib_lport_inuse(net, rover, udptable)) |
if (! __udp_lib_lport_inuse(net, rover, udptable)) |
1180 |
goto gotit; |
goto gotit; |
1181 |
rover += UDP_HTABLE_SIZE; |
rover += UDP_HTABLE_SIZE; |
1182 |
--- linux-2.6.25.20-0.1.orig/net/socket.c |
@@ -863,6 +876,11 @@ try_again: |
1183 |
+++ linux-2.6.25.20-0.1/net/socket.c |
&peeked, &err); |
1184 |
|
if (!skb) |
1185 |
|
goto out; |
1186 |
|
+ /***** TOMOYO Linux start. *****/ |
1187 |
|
+ err = ccs_socket_recvmsg_permission(sk, skb, flags); |
1188 |
|
+ if (err) |
1189 |
|
+ goto out; |
1190 |
|
+ /***** TOMOYO Linux end. *****/ |
1191 |
|
|
1192 |
|
ulen = skb->len - sizeof(struct udphdr); |
1193 |
|
copied = len; |
1194 |
|
--- linux-2.6.25.20-0.4.orig/net/ipv6/raw.c |
1195 |
|
+++ linux-2.6.25.20-0.4/net/ipv6/raw.c |
1196 |
|
@@ -60,6 +60,9 @@ |
1197 |
|
|
1198 |
|
#include <linux/proc_fs.h> |
1199 |
|
#include <linux/seq_file.h> |
1200 |
|
+/***** TOMOYO Linux start. *****/ |
1201 |
|
+#include <linux/tomoyo_socket.h> |
1202 |
|
+/***** TOMOYO Linux end. *****/ |
1203 |
|
|
1204 |
|
static struct raw_hashinfo raw_v6_hashinfo = { |
1205 |
|
.lock = __RW_LOCK_UNLOCKED(), |
1206 |
|
@@ -482,6 +485,11 @@ static int rawv6_recvmsg(struct kiocb *i |
1207 |
|
skb = skb_recv_datagram(sk, flags, noblock, &err); |
1208 |
|
if (!skb) |
1209 |
|
goto out; |
1210 |
|
+ /***** TOMOYO Linux start. *****/ |
1211 |
|
+ err = ccs_socket_recvmsg_permission(sk, skb, flags); |
1212 |
|
+ if (err) |
1213 |
|
+ goto out; |
1214 |
|
+ /***** TOMOYO Linux end. *****/ |
1215 |
|
|
1216 |
|
copied = skb->len; |
1217 |
|
if (copied > len) { |
1218 |
|
--- linux-2.6.25.20-0.4.orig/net/ipv6/udp.c |
1219 |
|
+++ linux-2.6.25.20-0.4/net/ipv6/udp.c |
1220 |
|
@@ -50,6 +50,9 @@ |
1221 |
|
#include <linux/proc_fs.h> |
1222 |
|
#include <linux/seq_file.h> |
1223 |
|
#include "udp_impl.h" |
1224 |
|
+/***** TOMOYO Linux start. *****/ |
1225 |
|
+#include <linux/tomoyo_socket.h> |
1226 |
|
+/***** TOMOYO Linux end. *****/ |
1227 |
|
|
1228 |
|
static inline int udp_v6_get_port(struct sock *sk, unsigned short snum) |
1229 |
|
{ |
1230 |
|
@@ -137,6 +140,11 @@ try_again: |
1231 |
|
&peeked, &err); |
1232 |
|
if (!skb) |
1233 |
|
goto out; |
1234 |
|
+ /***** TOMOYO Linux start. *****/ |
1235 |
|
+ err = ccs_socket_recvmsg_permission(sk, skb, flags); |
1236 |
|
+ if (err) |
1237 |
|
+ goto out; |
1238 |
|
+ /***** TOMOYO Linux end. *****/ |
1239 |
|
|
1240 |
|
ulen = skb->len - sizeof(struct udphdr); |
1241 |
|
copied = len; |
1242 |
|
--- linux-2.6.25.20-0.4.orig/net/socket.c |
1243 |
|
+++ linux-2.6.25.20-0.4/net/socket.c |
1244 |
@@ -94,6 +94,11 @@ |
@@ -94,6 +94,11 @@ |
1245 |
#include <net/sock.h> |
#include <net/sock.h> |
1246 |
#include <linux/netfilter.h> |
#include <linux/netfilter.h> |
1331 |
|
|
1332 |
err = sock->ops->connect(sock, (struct sockaddr *)address, addrlen, |
err = sock->ops->connect(sock, (struct sockaddr *)address, addrlen, |
1333 |
sock->file->f_flags); |
sock->file->f_flags); |
1334 |
--- linux-2.6.25.20-0.1.orig/net/unix/af_unix.c |
--- linux-2.6.25.20-0.4.orig/net/unix/af_unix.c |
1335 |
+++ linux-2.6.25.20-0.1/net/unix/af_unix.c |
+++ linux-2.6.25.20-0.4/net/unix/af_unix.c |
1336 |
@@ -116,6 +116,9 @@ |
@@ -116,6 +116,9 @@ |
1337 |
#include <linux/mount.h> |
#include <linux/mount.h> |
1338 |
#include <net/checksum.h> |
#include <net/checksum.h> |