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

Subversion リポジトリの参照

Contents of /trunk/1.7.x/ccs-patch/patches/ccs-patch-2.6.27-fedora-9.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3075 - (show annotations) (download) (as text)
Thu Oct 1 03:33:21 2009 UTC (14 years, 8 months ago) by kumaneko
File MIME type: text/x-diff
File size: 35285 byte(s)
Update sendmsg() hook.
1 This is TOMOYO Linux patch for Fedora 9.
2
3 Source code for this patch is http://ftp.riken.jp/Linux/fedora/updates/9/SRPMS.newkey/kernel-2.6.27.25-78.2.56.fc9.src.rpm
4 ---
5 arch/ia64/ia32/sys_ia32.c | 3 +++
6 arch/mips/kernel/ptrace32.c | 3 +++
7 fs/compat.c | 3 ++-
8 fs/compat_ioctl.c | 7 +++++++
9 fs/exec.c | 10 +++++++++-
10 fs/fcntl.c | 4 ++++
11 fs/ioctl.c | 5 +++++
12 fs/namei.c | 37 +++++++++++++++++++++++++++++++++++++
13 fs/namespace.c | 22 ++++++++++++++++++++++
14 fs/open.c | 29 +++++++++++++++++++++++++++++
15 fs/proc/proc_misc.c | 1 +
16 include/linux/init_task.h | 9 +++++++++
17 include/linux/sched.h | 6 ++++++
18 kernel/compat.c | 3 +++
19 kernel/kexec.c | 3 +++
20 kernel/kmod.c | 5 +++++
21 kernel/module.c | 5 +++++
22 kernel/ptrace.c | 5 +++++
23 kernel/sched.c | 3 +++
24 kernel/signal.c | 9 +++++++++
25 kernel/sys.c | 11 +++++++++++
26 kernel/sysctl.c | 4 ++++
27 kernel/time.c | 5 +++++
28 kernel/time/ntp.c | 3 +++
29 net/ipv4/inet_connection_sock.c | 3 +++
30 net/ipv4/inet_hashtables.c | 3 +++
31 net/ipv4/raw.c | 4 ++++
32 net/ipv4/udp.c | 7 +++++++
33 net/ipv6/raw.c | 4 ++++
34 net/ipv6/udp.c | 4 ++++
35 net/socket.c | 21 +++++++++++++++++++++
36 net/unix/af_unix.c | 4 ++++
37 security/Kconfig | 2 ++
38 security/Makefile | 3 +++
39 34 files changed, 248 insertions(+), 2 deletions(-)
40
41 --- linux-2.6.27.25-78.2.56.fc9.orig/arch/ia64/ia32/sys_ia32.c
42 +++ linux-2.6.27.25-78.2.56.fc9/arch/ia64/ia32/sys_ia32.c
43 @@ -51,6 +51,7 @@
44 #include <asm/types.h>
45 #include <asm/uaccess.h>
46 #include <asm/unistd.h>
47 +#include <linux/ccsecurity.h>
48
49 #include "ia32priv.h"
50
51 @@ -1622,6 +1623,8 @@ sys32_ptrace (int request, pid_t pid, un
52 struct task_struct *child;
53 unsigned int value, tmp;
54 long i, ret;
55 + if (!ccs_capable(CCS_SYS_PTRACE))
56 + return -EPERM;
57
58 lock_kernel();
59 if (request == PTRACE_TRACEME) {
60 --- linux-2.6.27.25-78.2.56.fc9.orig/arch/mips/kernel/ptrace32.c
61 +++ linux-2.6.27.25-78.2.56.fc9/arch/mips/kernel/ptrace32.c
62 @@ -35,6 +35,7 @@
63 #include <asm/system.h>
64 #include <asm/uaccess.h>
65 #include <asm/bootinfo.h>
66 +#include <linux/ccsecurity.h>
67
68 int ptrace_getregs(struct task_struct *child, __s64 __user *data);
69 int ptrace_setregs(struct task_struct *child, __s64 __user *data);
70 @@ -50,6 +51,8 @@ asmlinkage int sys32_ptrace(int request,
71 {
72 struct task_struct *child;
73 int ret;
74 + if (!ccs_capable(CCS_SYS_PTRACE))
75 + return -EPERM;
76
77 #if 0
78 printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n",
79 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/compat.c
80 +++ linux-2.6.27.25-78.2.56.fc9/fs/compat.c
81 @@ -56,6 +56,7 @@
82 #include <asm/mmu_context.h>
83 #include <asm/ioctls.h>
84 #include "internal.h"
85 +#include <linux/ccsecurity.h>
86
87 int compat_log = 1;
88
89 @@ -1409,7 +1410,7 @@ int compat_do_execve(char * filename,
90 if (retval < 0)
91 goto out;
92
93 - retval = search_binary_handler(bprm, regs);
94 + retval = ccs_search_binary_handler(bprm, regs);
95 if (retval >= 0) {
96 /* execve success */
97 security_bprm_free(bprm);
98 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/compat_ioctl.c
99 +++ linux-2.6.27.25-78.2.56.fc9/fs/compat_ioctl.c
100 @@ -113,6 +113,7 @@
101 #ifdef CONFIG_SPARC
102 #include <asm/fbio.h>
103 #endif
104 +#include <linux/ccsecurity.h>
105
106 static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd,
107 unsigned long arg, struct file *f)
108 @@ -2788,6 +2789,8 @@ asmlinkage long compat_sys_ioctl(unsigne
109
110 /* RED-PEN how should LSM module know it's handling 32bit? */
111 error = security_file_ioctl(filp, cmd, arg);
112 + if (!error)
113 + error = ccs_ioctl_permission(filp, cmd, arg);
114 if (error)
115 goto out_fput;
116
117 @@ -2812,6 +2815,10 @@ asmlinkage long compat_sys_ioctl(unsigne
118 /*FALL THROUGH*/
119
120 default:
121 + if (!ccs_capable(CCS_SYS_IOCTL)) {
122 + error = -EPERM;
123 + goto out_fput;
124 + }
125 if (filp->f_op && filp->f_op->compat_ioctl) {
126 error = filp->f_op->compat_ioctl(filp, cmd, arg);
127 if (error != -ENOIOCTLCMD)
128 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/exec.c
129 +++ linux-2.6.27.25-78.2.56.fc9/fs/exec.c
130 @@ -64,6 +64,8 @@
131 #include <linux/a.out.h>
132 #endif
133
134 +#include <linux/ccsecurity.h>
135 +
136 int core_uses_pid;
137 char core_pattern[CORENAME_MAX_SIZE] = "core";
138 int suid_dumpable = 0;
139 @@ -132,6 +134,9 @@ SYSCALL_DEFINE1(uselib, const char __use
140 error = vfs_permission(&nd, MAY_READ | MAY_EXEC | MAY_OPEN);
141 if (error)
142 goto exit;
143 + error = ccs_uselib_permission(nd.path.dentry, nd.path.mnt);
144 + if (error)
145 + goto exit;
146
147 file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE);
148 error = PTR_ERR(file);
149 @@ -685,6 +690,9 @@ struct file *open_exec(const char *name)
150 err = vfs_permission(&nd, MAY_EXEC | MAY_OPEN);
151 if (err)
152 goto out_path_put;
153 + err = ccs_open_exec_permission(nd.path.dentry, nd.path.mnt);
154 + if (err)
155 + goto out_path_put;
156
157 file = nameidata_to_filp(&nd, O_RDONLY|O_LARGEFILE);
158 if (IS_ERR(file))
159 @@ -1343,7 +1351,7 @@ int do_execve(char * filename,
160 goto out;
161
162 current->flags &= ~PF_KTHREAD;
163 - retval = search_binary_handler(bprm,regs);
164 + retval = ccs_search_binary_handler(bprm, regs);
165 if (retval >= 0) {
166 /* execve success */
167 security_bprm_free(bprm);
168 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/fcntl.c
169 +++ linux-2.6.27.25-78.2.56.fc9/fs/fcntl.c
170 @@ -24,6 +24,7 @@
171 #include <asm/poll.h>
172 #include <asm/siginfo.h>
173 #include <asm/uaccess.h>
174 +#include <linux/ccsecurity.h>
175
176 void set_close_on_exec(unsigned int fd, int flag)
177 {
178 @@ -157,6 +158,9 @@ static int setfl(int fd, struct file * f
179 if (((arg ^ filp->f_flags) & O_APPEND) && IS_APPEND(inode))
180 return -EPERM;
181
182 + if (((arg ^ filp->f_flags) & O_APPEND) && ccs_rewrite_permission(filp))
183 + return -EPERM;
184 +
185 /* O_NOATIME can only be set by the owner or superuser */
186 if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME))
187 if (!is_owner_or_cap(inode))
188 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/ioctl.c
189 +++ linux-2.6.27.25-78.2.56.fc9/fs/ioctl.c
190 @@ -15,6 +15,7 @@
191 #include <linux/uaccess.h>
192
193 #include <asm/ioctls.h>
194 +#include <linux/ccsecurity.h>
195
196 /**
197 * vfs_ioctl - call filesystem specific ioctl methods
198 @@ -35,6 +36,8 @@ static long vfs_ioctl(struct file *filp,
199
200 if (!filp->f_op)
201 goto out;
202 + if (!ccs_capable(CCS_SYS_IOCTL))
203 + return -EPERM;
204
205 if (filp->f_op->unlocked_ioctl) {
206 error = filp->f_op->unlocked_ioctl(filp, cmd, arg);
207 @@ -206,6 +209,8 @@ SYSCALL_DEFINE3(ioctl, unsigned int, fd,
208 goto out;
209
210 error = security_file_ioctl(filp, cmd, arg);
211 + if (!error)
212 + error = ccs_ioctl_permission(filp, cmd, arg);
213 if (error)
214 goto out_fput;
215
216 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/namei.c
217 +++ linux-2.6.27.25-78.2.56.fc9/fs/namei.c
218 @@ -35,6 +35,8 @@
219
220 #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE])
221
222 +#include <linux/ccsecurity.h>
223 +
224 /* [Feb-1997 T. Schoebel-Theuer]
225 * Fundamental changes in the pathname lookup mechanisms (namei)
226 * were necessary because of omirr. The reason is that omirr needs
227 @@ -1569,6 +1571,11 @@ int may_open(struct nameidata *nd, int a
228 if (!is_owner_or_cap(inode))
229 return -EPERM;
230
231 + /* includes O_APPEND and O_TRUNC checks */
232 + error = ccs_open_permission(dentry, nd->path.mnt, flag);
233 + if (error)
234 + return error;
235 +
236 /*
237 * Ensure there are no outstanding leases on the file.
238 */
239 @@ -1615,6 +1622,9 @@ static int __open_namei_create(struct na
240
241 if (!IS_POSIXACL(dir->d_inode))
242 mode &= ~current->fs->umask;
243 + error = ccs_mknod_permission(dir->d_inode, path->dentry, nd->path.mnt,
244 + mode, 0);
245 + if (!error)
246 error = vfs_create(dir->d_inode, path->dentry, mode, nd);
247 mutex_unlock(&dir->d_inode->i_mutex);
248 dput(nd->path.dentry);
249 @@ -1625,6 +1635,7 @@ static int __open_namei_create(struct na
250 return may_open(nd, 0, flag & ~O_TRUNC);
251 }
252
253 +#include <linux/ccsecurity_vfs.h>
254 /*
255 * Note that while the flag value (low two bits) for sys_open means:
256 * 00 - read-only
257 @@ -1746,7 +1757,9 @@ do_last:
258 error = mnt_want_write(nd.path.mnt);
259 if (error)
260 goto exit_mutex_unlock;
261 + ccs_save_open_mode(open_flag);
262 error = __open_namei_create(&nd, &path, flag, mode);
263 + ccs_clear_open_mode();
264 if (error) {
265 mnt_drop_write(nd.path.mnt);
266 goto exit;
267 @@ -1799,7 +1812,9 @@ ok:
268 if (error)
269 goto exit;
270 }
271 + ccs_save_open_mode(open_flag);
272 error = may_open(&nd, acc_mode, flag);
273 + ccs_clear_open_mode();
274 if (error) {
275 if (will_write)
276 mnt_drop_write(nd.path.mnt);
277 @@ -2018,6 +2033,9 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const
278 error = mnt_want_write(nd.path.mnt);
279 if (error)
280 goto out_dput;
281 + error = ccs_mknod_permission(nd.path.dentry->d_inode, dentry,
282 + nd.path.mnt, mode, dev);
283 + if (!error)
284 switch (mode & S_IFMT) {
285 case 0: case S_IFREG:
286 error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);
287 @@ -2089,6 +2107,9 @@ SYSCALL_DEFINE3(mkdirat, int, dfd, const
288 error = mnt_want_write(nd.path.mnt);
289 if (error)
290 goto out_dput;
291 + error = ccs_mkdir_permission(nd.path.dentry->d_inode, dentry,
292 + nd.path.mnt, mode);
293 + if (!error)
294 error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode);
295 mnt_drop_write(nd.path.mnt);
296 out_dput:
297 @@ -2196,6 +2217,9 @@ static long do_rmdir(int dfd, const char
298 error = mnt_want_write(nd.path.mnt);
299 if (error)
300 goto exit3;
301 + error = ccs_rmdir_permission(nd.path.dentry->d_inode, dentry,
302 + nd.path.mnt);
303 + if (!error)
304 error = vfs_rmdir(nd.path.dentry->d_inode, dentry);
305 mnt_drop_write(nd.path.mnt);
306 exit3:
307 @@ -2278,6 +2302,9 @@ static long do_unlinkat(int dfd, const c
308 error = mnt_want_write(nd.path.mnt);
309 if (error)
310 goto exit2;
311 + error = ccs_unlink_permission(nd.path.dentry->d_inode,
312 + dentry, nd.path.mnt);
313 + if (!error)
314 error = vfs_unlink(nd.path.dentry->d_inode, dentry);
315 mnt_drop_write(nd.path.mnt);
316 exit2:
317 @@ -2359,6 +2386,9 @@ SYSCALL_DEFINE3(symlinkat, const char __
318 error = mnt_want_write(nd.path.mnt);
319 if (error)
320 goto out_dput;
321 + error = ccs_symlink_permission(nd.path.dentry->d_inode, dentry,
322 + nd.path.mnt, from);
323 + if (!error)
324 error = vfs_symlink(nd.path.dentry->d_inode, dentry, from);
325 mnt_drop_write(nd.path.mnt);
326 out_dput:
327 @@ -2455,6 +2485,9 @@ SYSCALL_DEFINE5(linkat, int, olddfd, con
328 error = mnt_want_write(nd.path.mnt);
329 if (error)
330 goto out_dput;
331 + error = ccs_link_permission(old_path.dentry, nd.path.dentry->d_inode,
332 + new_dentry, nd.path.mnt);
333 + if (!error)
334 error = vfs_link(old_path.dentry, nd.path.dentry->d_inode, new_dentry);
335 mnt_drop_write(nd.path.mnt);
336 out_dput:
337 @@ -2687,6 +2720,10 @@ SYSCALL_DEFINE4(renameat, int, olddfd, c
338 error = mnt_want_write(oldnd.path.mnt);
339 if (error)
340 goto exit5;
341 + error = ccs_rename_permission(old_dir->d_inode, old_dentry,
342 + new_dir->d_inode, new_dentry,
343 + newnd.path.mnt);
344 + if (!error)
345 error = vfs_rename(old_dir->d_inode, old_dentry,
346 new_dir->d_inode, new_dentry);
347 mnt_drop_write(oldnd.path.mnt);
348 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/namespace.c
349 +++ linux-2.6.27.25-78.2.56.fc9/fs/namespace.c
350 @@ -31,6 +31,7 @@
351 #include <asm/unistd.h>
352 #include "pnode.h"
353 #include "internal.h"
354 +#include <linux/ccsecurity.h>
355
356 #define HASH_SHIFT ilog2(PAGE_SIZE / sizeof(struct list_head))
357 #define HASH_SIZE (1UL << HASH_SHIFT)
358 @@ -1038,6 +1039,8 @@ static int do_umount(struct vfsmount *mn
359 LIST_HEAD(umount_list);
360
361 retval = security_sb_umount(mnt, flags);
362 + if (!retval)
363 + retval = ccs_umount_permission(mnt, flags);
364 if (retval)
365 return retval;
366
367 @@ -1132,6 +1135,8 @@ SYSCALL_DEFINE2(umount, char __user *, n
368 {
369 struct path path;
370 int retval;
371 + if (!ccs_capable(CCS_SYS_UMOUNT))
372 + return -EPERM;
373
374 retval = user_path(name, &path);
375 if (retval)
376 @@ -1479,6 +1484,9 @@ static noinline int do_loopback(struct n
377 err = -EINVAL;
378 if (IS_MNT_UNBINDABLE(old_nd.path.mnt))
379 goto out;
380 + err = -EPERM;
381 + if (ccs_may_mount(&nd->path))
382 + goto out;
383
384 if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
385 goto out;
386 @@ -1598,6 +1606,9 @@ static noinline int do_move_mount(struct
387 if (!check_mnt(nd->path.mnt) || !check_mnt(old_nd.path.mnt))
388 goto out;
389
390 + err = -EPERM;
391 + if (ccs_may_mount(&nd->path))
392 + goto out;
393 err = -ENOENT;
394 mutex_lock(&nd->path.dentry->d_inode->i_mutex);
395 if (IS_DEADDIR(nd->path.dentry->d_inode))
396 @@ -1702,6 +1713,9 @@ int do_add_mount(struct vfsmount *newmnt
397 err = -EINVAL;
398 if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode))
399 goto unlock;
400 + err = -EPERM;
401 + if (ccs_may_mount(path))
402 + goto unlock;
403
404 newmnt->mnt_flags = mnt_flags;
405 if ((err = graft_tree(newmnt, path)))
406 @@ -1925,6 +1939,7 @@ __setup("default_relatime=", set_default
407 long do_mount(char *dev_name, char *dir_name, char *type_page,
408 unsigned long flags, void *data_page)
409 {
410 + const unsigned long original_flags = flags;
411 struct nameidata nd;
412 int retval = 0;
413 int mnt_flags = 0;
414 @@ -1974,6 +1989,9 @@ long do_mount(char *dev_name, char *dir_
415
416 retval = security_sb_mount(dev_name, &nd.path,
417 type_page, flags, data_page);
418 + if (!retval)
419 + retval = ccs_mount_permission(dev_name, &nd.path, type_page,
420 + original_flags, data_page);
421 if (retval)
422 goto dput_out;
423
424 @@ -2211,6 +2229,8 @@ SYSCALL_DEFINE2(pivot_root, const char _
425
426 if (!capable(CAP_SYS_ADMIN))
427 return -EPERM;
428 + if (!ccs_capable(CCS_SYS_PIVOT_ROOT))
429 + return -EPERM;
430
431 error = user_path_dir(new_root, &new);
432 if (error)
433 @@ -2224,6 +2244,8 @@ SYSCALL_DEFINE2(pivot_root, const char _
434 goto out1;
435
436 error = security_sb_pivotroot(&old, &new);
437 + if (!error)
438 + error = ccs_pivot_root_permission(&old, &new);
439 if (error) {
440 path_put(&old);
441 goto out1;
442 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/open.c
443 +++ linux-2.6.27.25-78.2.56.fc9/fs/open.c
444 @@ -29,6 +29,7 @@
445 #include <linux/rcupdate.h>
446 #include <linux/audit.h>
447 #include <linux/falloc.h>
448 +#include <linux/ccsecurity.h>
449
450 int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
451 {
452 @@ -269,6 +270,9 @@ static long do_sys_truncate(const char _
453 if (error)
454 goto put_write_and_out;
455
456 + error = ccs_truncate_permission(path.dentry, path.mnt, length, 0);
457 + if (error)
458 + goto put_write_and_out;
459 error = locks_verify_truncate(inode, NULL, length);
460 if (!error) {
461 DQUOT_INIT(inode);
462 @@ -325,6 +329,9 @@ static long do_sys_ftruncate(unsigned in
463 if (IS_APPEND(inode))
464 goto out_putf;
465
466 + error = ccs_truncate_permission(dentry, file->f_vfsmnt, length, 0);
467 + if (error)
468 + goto out_putf;
469 error = locks_verify_truncate(inode, file, length);
470 if (!error)
471 error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file);
472 @@ -590,6 +597,10 @@ SYSCALL_DEFINE1(chroot, const char __use
473 error = -EPERM;
474 if (!capable(CAP_SYS_CHROOT))
475 goto dput_and_out;
476 + if (!ccs_capable(CCS_SYS_CHROOT))
477 + goto dput_and_out;
478 + if (ccs_chroot_permission(&path))
479 + goto dput_and_out;
480
481 set_fs_root(current->fs, &path);
482 error = 0;
483 @@ -619,6 +630,9 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd
484 err = mnt_want_write(file->f_path.mnt);
485 if (err)
486 goto out_putf;
487 + err = ccs_chmod_permission(dentry, file->f_vfsmnt, mode);
488 + if (err)
489 + goto out_drop_write;
490 mutex_lock(&inode->i_mutex);
491 if (mode == (mode_t) -1)
492 mode = inode->i_mode;
493 @@ -626,6 +640,7 @@ SYSCALL_DEFINE2(fchmod, unsigned int, fd
494 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
495 err = notify_change(dentry, &newattrs);
496 mutex_unlock(&inode->i_mutex);
497 +out_drop_write:
498 mnt_drop_write(file->f_path.mnt);
499 out_putf:
500 fput(file);
501 @@ -648,6 +663,9 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, cons
502 error = mnt_want_write(path.mnt);
503 if (error)
504 goto dput_and_out;
505 + error = ccs_chmod_permission(path.dentry, path.mnt, mode);
506 + if (error)
507 + goto out_drop_write;
508 mutex_lock(&inode->i_mutex);
509 if (mode == (mode_t) -1)
510 mode = inode->i_mode;
511 @@ -655,6 +673,7 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, cons
512 newattrs.ia_valid = ATTR_MODE | ATTR_CTIME;
513 error = notify_change(path.dentry, &newattrs);
514 mutex_unlock(&inode->i_mutex);
515 +out_drop_write:
516 mnt_drop_write(path.mnt);
517 dput_and_out:
518 path_put(&path);
519 @@ -703,6 +722,8 @@ SYSCALL_DEFINE3(chown, const char __user
520 error = mnt_want_write(path.mnt);
521 if (error)
522 goto out_release;
523 + error = ccs_chown_permission(path.dentry, path.mnt, user, group);
524 + if (!error)
525 error = chown_common(path.dentry, user, group);
526 mnt_drop_write(path.mnt);
527 out_release:
528 @@ -728,6 +749,8 @@ SYSCALL_DEFINE5(fchownat, int, dfd, cons
529 error = mnt_want_write(path.mnt);
530 if (error)
531 goto out_release;
532 + error = ccs_chown_permission(path.dentry, path.mnt, user, group);
533 + if (!error)
534 error = chown_common(path.dentry, user, group);
535 mnt_drop_write(path.mnt);
536 out_release:
537 @@ -747,6 +770,8 @@ SYSCALL_DEFINE3(lchown, const char __use
538 error = mnt_want_write(path.mnt);
539 if (error)
540 goto out_release;
541 + error = ccs_chown_permission(path.dentry, path.mnt, user, group);
542 + if (!error)
543 error = chown_common(path.dentry, user, group);
544 mnt_drop_write(path.mnt);
545 out_release:
546 @@ -770,6 +795,8 @@ SYSCALL_DEFINE3(fchown, unsigned int, fd
547 goto out_fput;
548 dentry = file->f_path.dentry;
549 audit_inode(NULL, dentry);
550 + error = ccs_chown_permission(dentry, file->f_vfsmnt, user, group);
551 + if (!error)
552 error = chown_common(dentry, user, group);
553 mnt_drop_write(file->f_path.mnt);
554 out_fput:
555 @@ -1156,6 +1183,8 @@ EXPORT_SYMBOL(sys_close);
556 */
557 SYSCALL_DEFINE0(vhangup)
558 {
559 + if (!ccs_capable(CCS_SYS_VHANGUP))
560 + return -EPERM;
561 if (capable(CAP_SYS_TTY_CONFIG)) {
562 /* XXX: this needs locking */
563 tty_vhangup(current->signal->tty);
564 --- linux-2.6.27.25-78.2.56.fc9.orig/fs/proc/proc_misc.c
565 +++ linux-2.6.27.25-78.2.56.fc9/fs/proc/proc_misc.c
566 @@ -934,4 +934,5 @@ void __init proc_misc_init(void)
567 #ifdef CONFIG_MAGIC_SYSRQ
568 proc_create("sysrq-trigger", S_IWUSR, NULL, &proc_sysrq_trigger_operations);
569 #endif
570 + printk(KERN_INFO "Hook version: 2.6.27.25-78.2.56.fc9 2009/10/01\n");
571 }
572 --- linux-2.6.27.25-78.2.56.fc9.orig/include/linux/init_task.h
573 +++ linux-2.6.27.25-78.2.56.fc9/include/linux/init_task.h
574 @@ -113,6 +113,14 @@ extern struct group_info init_groups;
575 # define CAP_INIT_BSET CAP_INIT_EFF_SET
576 #endif
577
578 +#ifdef CONFIG_CCSECURITY
579 +#define INIT_CCSECURITY \
580 + .ccs_domain_info = NULL, \
581 + .ccs_flags = 0,
582 +#else
583 +#define INIT_CCSECURITY
584 +#endif
585 +
586 /*
587 * INIT_TASK is used to set up the first task table, touch at
588 * your own risk!. Base=0, limit=0x1fffff (=2MB)
589 @@ -179,6 +187,7 @@ extern struct group_info init_groups;
590 INIT_IDS \
591 INIT_TRACE_IRQFLAGS \
592 INIT_LOCKDEP \
593 + INIT_CCSECURITY \
594 }
595
596
597 --- linux-2.6.27.25-78.2.56.fc9.orig/include/linux/sched.h
598 +++ linux-2.6.27.25-78.2.56.fc9/include/linux/sched.h
599 @@ -29,6 +29,8 @@
600 #define CLONE_NEWNET 0x40000000 /* New network namespace */
601 #define CLONE_IO 0x80000000 /* Clone io context */
602
603 +struct ccs_domain_info;
604 +
605 /*
606 * Scheduling policies
607 */
608 @@ -1320,6 +1322,10 @@ struct task_struct {
609 int latency_record_count;
610 struct latency_record latency_record[LT_SAVECOUNT];
611 #endif
612 +#ifdef CONFIG_CCSECURITY
613 + struct ccs_domain_info *ccs_domain_info;
614 + u32 ccs_flags;
615 +#endif
616 };
617
618 /*
619 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/compat.c
620 +++ linux-2.6.27.25-78.2.56.fc9/kernel/compat.c
621 @@ -25,6 +25,7 @@
622 #include <linux/posix-timers.h>
623
624 #include <asm/uaccess.h>
625 +#include <linux/ccsecurity.h>
626
627 int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts)
628 {
629 @@ -868,6 +869,8 @@ asmlinkage long compat_sys_stime(compat_
630 err = security_settime(&tv, NULL);
631 if (err)
632 return err;
633 + if (!ccs_capable(CCS_SYS_SETTIME))
634 + return -EPERM;
635
636 do_settimeofday(&tv);
637 return 0;
638 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/kexec.c
639 +++ linux-2.6.27.25-78.2.56.fc9/kernel/kexec.c
640 @@ -36,6 +36,7 @@
641 #include <asm/io.h>
642 #include <asm/system.h>
643 #include <asm/sections.h>
644 +#include <linux/ccsecurity.h>
645
646 /* Per cpu memory for storing cpu states in case of system crash. */
647 note_buf_t* crash_notes;
648 @@ -942,6 +943,8 @@ SYSCALL_DEFINE4(kexec_load, unsigned lon
649 /* We only trust the superuser with rebooting the system. */
650 if (!capable(CAP_SYS_BOOT))
651 return -EPERM;
652 + if (!ccs_capable(CCS_SYS_KEXEC_LOAD))
653 + return -EPERM;
654
655 /*
656 * Verify we have a legal set of flags
657 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/kmod.c
658 +++ linux-2.6.27.25-78.2.56.fc9/kernel/kmod.c
659 @@ -174,6 +174,11 @@ static int ____call_usermodehelper(void
660 */
661 set_user_nice(current, 0);
662
663 +#ifdef CONFIG_CCSECURITY
664 + current->ccs_domain_info = NULL;
665 + current->ccs_flags = 0;
666 +#endif
667 +
668 retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp);
669
670 /* Exec failed? */
671 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/module.c
672 +++ linux-2.6.27.25-78.2.56.fc9/kernel/module.c
673 @@ -46,6 +46,7 @@
674 #include <asm/cacheflush.h>
675 #include <linux/license.h>
676 #include <asm/sections.h>
677 +#include <linux/ccsecurity.h>
678
679 #if 0
680 #define DEBUGP printk
681 @@ -724,6 +725,8 @@ SYSCALL_DEFINE2(delete_module, const cha
682
683 if (!capable(CAP_SYS_MODULE))
684 return -EPERM;
685 + if (!ccs_capable(CCS_USE_KERNEL_MODULE))
686 + return -EPERM;
687
688 if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0)
689 return -EFAULT;
690 @@ -2266,6 +2269,8 @@ SYSCALL_DEFINE3(init_module, void __user
691 /* Must have permission */
692 if (!capable(CAP_SYS_MODULE))
693 return -EPERM;
694 + if (!ccs_capable(CCS_USE_KERNEL_MODULE))
695 + return -EPERM;
696
697 /* Only one module load at a time, please */
698 if (mutex_lock_interruptible(&module_mutex) != 0)
699 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/ptrace.c
700 +++ linux-2.6.27.25-78.2.56.fc9/kernel/ptrace.c
701 @@ -25,6 +25,7 @@
702
703 #include <asm/pgtable.h>
704 #include <asm/uaccess.h>
705 +#include <linux/ccsecurity.h>
706
707 /*
708 * ptrace a task: make the debugger its new parent and
709 @@ -1155,6 +1156,8 @@ SYSCALL_DEFINE4(ptrace, long, request, l
710 /*
711 * This lock_kernel fixes a subtle race with suid exec
712 */
713 + if (!ccs_capable(CCS_SYS_PTRACE))
714 + return -EPERM;
715 lock_kernel();
716 if (request == PTRACE_TRACEME) {
717 ret = ptrace_traceme();
718 @@ -1278,6 +1281,8 @@ asmlinkage long compat_sys_ptrace(compat
719 /*
720 * This lock_kernel fixes a subtle race with suid exec
721 */
722 + if (!ccs_capable(CCS_SYS_PTRACE))
723 + return -EPERM;
724 lock_kernel();
725 if (request == PTRACE_TRACEME) {
726 ret = ptrace_traceme();
727 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/sched.c
728 +++ linux-2.6.27.25-78.2.56.fc9/kernel/sched.c
729 @@ -74,6 +74,7 @@
730
731 #include <asm/tlb.h>
732 #include <asm/irq_regs.h>
733 +#include <linux/ccsecurity.h>
734
735 #include "sched_cpupri.h"
736
737 @@ -4945,6 +4946,8 @@ int can_nice(const struct task_struct *p
738 SYSCALL_DEFINE1(nice, int, increment)
739 {
740 long nice, retval;
741 + if (!ccs_capable(CCS_SYS_NICE))
742 + return -EPERM;
743
744 /*
745 * Setpriority might change our priority at the same moment.
746 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/signal.c
747 +++ linux-2.6.27.25-78.2.56.fc9/kernel/signal.c
748 @@ -33,6 +33,7 @@
749 #include <asm/unistd.h>
750 #include <asm/siginfo.h>
751 #include "audit.h" /* audit_signal_info() */
752 +#include <linux/ccsecurity.h>
753
754 /*
755 * SLAB caches for signal bits.
756 @@ -2219,6 +2220,8 @@ SYSCALL_DEFINE4(rt_sigtimedwait, const s
757 SYSCALL_DEFINE2(kill, pid_t, pid, int, sig)
758 {
759 struct siginfo info;
760 + if (ccs_kill_permission(pid, sig))
761 + return -EPERM;
762
763 info.si_signo = sig;
764 info.si_errno = 0;
765 @@ -2280,6 +2283,8 @@ SYSCALL_DEFINE3(tgkill, pid_t, tgid, pid
766 /* This is only valid for single tasks */
767 if (pid <= 0 || tgid <= 0)
768 return -EINVAL;
769 + if (ccs_tgkill_permission(tgid, pid, sig))
770 + return -EPERM;
771
772 return do_tkill(tgid, pid, sig);
773 }
774 @@ -2292,6 +2297,8 @@ SYSCALL_DEFINE2(tkill, pid_t, pid, int,
775 /* This is only valid for single tasks */
776 if (pid <= 0)
777 return -EINVAL;
778 + if (ccs_tkill_permission(pid, sig))
779 + return -EPERM;
780
781 return do_tkill(0, pid, sig);
782 }
783 @@ -2309,6 +2316,8 @@ SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t,
784 if (info.si_code >= 0)
785 return -EPERM;
786 info.si_signo = sig;
787 + if (ccs_sigqueue_permission(pid, sig))
788 + return -EPERM;
789
790 /* POSIX.1b doesn't mention process groups. */
791 return kill_proc_info(sig, &info, pid);
792 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/sys.c
793 +++ linux-2.6.27.25-78.2.56.fc9/kernel/sys.c
794 @@ -42,6 +42,7 @@
795 #include <asm/uaccess.h>
796 #include <asm/io.h>
797 #include <asm/unistd.h>
798 +#include <linux/ccsecurity.h>
799
800 #ifndef SET_UNALIGN_CTL
801 # define SET_UNALIGN_CTL(a,b) (-EINVAL)
802 @@ -146,6 +147,10 @@ SYSCALL_DEFINE3(setpriority, int, which,
803
804 if (which > PRIO_USER || which < PRIO_PROCESS)
805 goto out;
806 + if (!ccs_capable(CCS_SYS_NICE)) {
807 + error = -EPERM;
808 + goto out;
809 + }
810
811 /* normalize: avoid signed division (rounding problems) */
812 error = -ESRCH;
813 @@ -363,6 +368,8 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
814 magic2 != LINUX_REBOOT_MAGIC2B &&
815 magic2 != LINUX_REBOOT_MAGIC2C))
816 return -EINVAL;
817 + if (!ccs_capable(CCS_SYS_REBOOT))
818 + return -EPERM;
819
820 /* Instead of trying to make the power_off code look like
821 * halt when pm_power_off is not set do it the easy way.
822 @@ -1349,6 +1356,8 @@ SYSCALL_DEFINE2(sethostname, char __user
823 return -EPERM;
824 if (len < 0 || len > __NEW_UTS_LEN)
825 return -EINVAL;
826 + if (!ccs_capable(CCS_SYS_SETHOSTNAME))
827 + return -EPERM;
828 down_write(&uts_sem);
829 errno = -EFAULT;
830 if (!copy_from_user(tmp, name, len)) {
831 @@ -1394,6 +1403,8 @@ SYSCALL_DEFINE2(setdomainname, char __us
832 return -EPERM;
833 if (len < 0 || len > __NEW_UTS_LEN)
834 return -EINVAL;
835 + if (!ccs_capable(CCS_SYS_SETHOSTNAME))
836 + return -EPERM;
837
838 down_write(&uts_sem);
839 errno = -EFAULT;
840 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/sysctl.c
841 +++ linux-2.6.27.25-78.2.56.fc9/kernel/sysctl.c
842 @@ -52,6 +52,7 @@
843
844 #include <asm/uaccess.h>
845 #include <asm/processor.h>
846 +#include <linux/ccsecurity.h>
847
848 #ifdef CONFIG_X86
849 #include <asm/nmi.h>
850 @@ -1657,6 +1658,9 @@ int do_sysctl(int __user *name, int nlen
851
852 for (head = sysctl_head_next(NULL); head;
853 head = sysctl_head_next(head)) {
854 + error = ccs_parse_table(name, nlen, oldval, newval,
855 + head->ctl_table);
856 + if (!error)
857 error = parse_table(name, nlen, oldval, oldlenp,
858 newval, newlen,
859 head->root, head->ctl_table);
860 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/time.c
861 +++ linux-2.6.27.25-78.2.56.fc9/kernel/time.c
862 @@ -40,6 +40,7 @@
863
864 #include <asm/uaccess.h>
865 #include <asm/unistd.h>
866 +#include <linux/ccsecurity.h>
867
868 #include "timeconst.h"
869
870 @@ -90,6 +91,8 @@ SYSCALL_DEFINE1(stime, time_t __user *,
871 err = security_settime(&tv, NULL);
872 if (err)
873 return err;
874 + if (!ccs_capable(CCS_SYS_SETTIME))
875 + return -EPERM;
876
877 do_settimeofday(&tv);
878 return 0;
879 @@ -161,6 +164,8 @@ int do_sys_settimeofday(struct timespec
880 error = security_settime(tv, tz);
881 if (error)
882 return error;
883 + if (!ccs_capable(CCS_SYS_SETTIME))
884 + return -EPERM;
885
886 if (tz) {
887 /* SMP safe, global irq locking makes it work. */
888 --- linux-2.6.27.25-78.2.56.fc9.orig/kernel/time/ntp.c
889 +++ linux-2.6.27.25-78.2.56.fc9/kernel/time/ntp.c
890 @@ -18,6 +18,7 @@
891 #include <linux/math64.h>
892 #include <linux/clocksource.h>
893 #include <asm/timex.h>
894 +#include <linux/ccsecurity.h>
895
896 /*
897 * Timekeeping variables
898 @@ -283,6 +284,8 @@ int do_adjtimex(struct timex *txc)
899 /* In order to modify anything, you gotta be super-user! */
900 if (txc->modes && !capable(CAP_SYS_TIME))
901 return -EPERM;
902 + if (txc->modes && !ccs_capable(CCS_SYS_SETTIME))
903 + return -EPERM;
904
905 /* Now we validate the data before disabling interrupts */
906
907 --- linux-2.6.27.25-78.2.56.fc9.orig/net/ipv4/inet_connection_sock.c
908 +++ linux-2.6.27.25-78.2.56.fc9/net/ipv4/inet_connection_sock.c
909 @@ -23,6 +23,7 @@
910 #include <net/route.h>
911 #include <net/tcp_states.h>
912 #include <net/xfrm.h>
913 +#include <linux/ccsecurity.h>
914
915 #ifdef INET_CSK_DEBUG
916 const char inet_csk_timer_bug_msg[] = "inet_csk BUG: unknown timer value\n";
917 @@ -106,6 +107,8 @@ int inet_csk_get_port(struct sock *sk, u
918 head = &hashinfo->bhash[inet_bhashfn(net, rover,
919 hashinfo->bhash_size)];
920 spin_lock(&head->lock);
921 + if (ccs_lport_reserved(rover))
922 + goto next;
923 inet_bind_bucket_for_each(tb, node, &head->chain)
924 if (tb->ib_net == net && tb->port == rover)
925 goto next;
926 --- linux-2.6.27.25-78.2.56.fc9.orig/net/ipv4/inet_hashtables.c
927 +++ linux-2.6.27.25-78.2.56.fc9/net/ipv4/inet_hashtables.c
928 @@ -22,6 +22,7 @@
929 #include <net/inet_connection_sock.h>
930 #include <net/inet_hashtables.h>
931 #include <net/ip.h>
932 +#include <linux/ccsecurity.h>
933
934 /*
935 * Allocate and initialize a new local port bind bucket.
936 @@ -440,6 +441,8 @@ int __inet_hash_connect(struct inet_time
937 local_bh_disable();
938 for (i = 1; i <= remaining; i++) {
939 port = low + (i + offset) % remaining;
940 + if (ccs_lport_reserved(port))
941 + continue;
942 head = &hinfo->bhash[inet_bhashfn(net, port,
943 hinfo->bhash_size)];
944 spin_lock(&head->lock);
945 --- linux-2.6.27.25-78.2.56.fc9.orig/net/ipv4/raw.c
946 +++ linux-2.6.27.25-78.2.56.fc9/net/ipv4/raw.c
947 @@ -77,6 +77,7 @@
948 #include <linux/seq_file.h>
949 #include <linux/netfilter.h>
950 #include <linux/netfilter_ipv4.h>
951 +#include <linux/ccsecurity.h>
952
953 static struct raw_hashinfo raw_v4_hashinfo = {
954 .lock = __RW_LOCK_UNLOCKED(raw_v4_hashinfo.lock),
955 @@ -665,6 +666,9 @@ static int raw_recvmsg(struct kiocb *ioc
956 skb = skb_recv_datagram(sk, flags, noblock, &err);
957 if (!skb)
958 goto out;
959 + err = ccs_socket_recvmsg_permission(sk, skb, flags);
960 + if (err)
961 + goto out;
962
963 copied = skb->len;
964 if (len < copied) {
965 --- linux-2.6.27.25-78.2.56.fc9.orig/net/ipv4/udp.c
966 +++ linux-2.6.27.25-78.2.56.fc9/net/ipv4/udp.c
967 @@ -103,6 +103,7 @@
968 #include <net/checksum.h>
969 #include <net/xfrm.h>
970 #include "udp_impl.h"
971 +#include <linux/ccsecurity.h>
972
973 /*
974 * Snmp MIB for the UDP layer
975 @@ -170,6 +171,8 @@ int udp_lib_get_port(struct sock *sk, un
976 /* 1st pass: look for empty (or shortest) hash chain */
977 for (i = 0; i < UDP_HTABLE_SIZE; i++) {
978 int size = 0;
979 + if (ccs_lport_reserved(rover))
980 + goto next;
981
982 head = &udptable[udp_hashfn(net, rover)];
983 if (hlist_empty(head))
984 @@ -193,6 +196,7 @@ int udp_lib_get_port(struct sock *sk, un
985 /* 2nd pass: find hole in shortest hash chain */
986 rover = best;
987 for (i = 0; i < (1 << 16) / UDP_HTABLE_SIZE; i++) {
988 + if (!ccs_lport_reserved(rover))
989 if (! __udp_lib_lport_inuse(net, rover, udptable))
990 goto gotit;
991 rover += UDP_HTABLE_SIZE;
992 @@ -858,6 +862,9 @@ try_again:
993 &peeked, &err);
994 if (!skb)
995 goto out;
996 + err = ccs_socket_recvmsg_permission(sk, skb, flags);
997 + if (err)
998 + goto out;
999
1000 ulen = skb->len - sizeof(struct udphdr);
1001 copied = len;
1002 --- linux-2.6.27.25-78.2.56.fc9.orig/net/ipv6/raw.c
1003 +++ linux-2.6.27.25-78.2.56.fc9/net/ipv6/raw.c
1004 @@ -59,6 +59,7 @@
1005
1006 #include <linux/proc_fs.h>
1007 #include <linux/seq_file.h>
1008 +#include <linux/ccsecurity.h>
1009
1010 static struct raw_hashinfo raw_v6_hashinfo = {
1011 .lock = __RW_LOCK_UNLOCKED(raw_v6_hashinfo.lock),
1012 @@ -465,6 +466,9 @@ static int rawv6_recvmsg(struct kiocb *i
1013 skb = skb_recv_datagram(sk, flags, noblock, &err);
1014 if (!skb)
1015 goto out;
1016 + err = ccs_socket_recvmsg_permission(sk, skb, flags);
1017 + if (err)
1018 + goto out;
1019
1020 copied = skb->len;
1021 if (copied > len) {
1022 --- linux-2.6.27.25-78.2.56.fc9.orig/net/ipv6/udp.c
1023 +++ linux-2.6.27.25-78.2.56.fc9/net/ipv6/udp.c
1024 @@ -48,6 +48,7 @@
1025 #include <linux/proc_fs.h>
1026 #include <linux/seq_file.h>
1027 #include "udp_impl.h"
1028 +#include <linux/ccsecurity.h>
1029
1030 int udp_v6_get_port(struct sock *sk, unsigned short snum)
1031 {
1032 @@ -135,6 +136,9 @@ try_again:
1033 &peeked, &err);
1034 if (!skb)
1035 goto out;
1036 + err = ccs_socket_recvmsg_permission(sk, skb, flags);
1037 + if (err)
1038 + goto out;
1039
1040 ulen = skb->len - sizeof(struct udphdr);
1041 copied = len;
1042 --- linux-2.6.27.25-78.2.56.fc9.orig/net/socket.c
1043 +++ linux-2.6.27.25-78.2.56.fc9/net/socket.c
1044 @@ -97,6 +97,8 @@
1045 #include <net/sock.h>
1046 #include <linux/netfilter.h>
1047
1048 +#include <linux/ccsecurity.h>
1049 +
1050 static int sock_no_open(struct inode *irrelevant, struct file *dontcare);
1051 static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov,
1052 unsigned long nr_segs, loff_t pos);
1053 @@ -558,6 +560,8 @@ static inline int __sock_sendmsg(struct
1054 si->size = size;
1055
1056 err = security_socket_sendmsg(sock, msg, size);
1057 + if (!err)
1058 + err = ccs_socket_sendmsg_permission(sock, msg, size);
1059 if (err)
1060 return err;
1061
1062 @@ -1124,6 +1128,8 @@ static int __sock_create(struct net *net
1063 }
1064
1065 err = security_socket_create(family, type, protocol, kern);
1066 + if (!err)
1067 + err = ccs_socket_create_permission(family, type, protocol);
1068 if (err)
1069 return err;
1070
1071 @@ -1379,6 +1385,11 @@ SYSCALL_DEFINE3(bind, int, fd, struct so
1072 (struct sockaddr *)&address,
1073 addrlen);
1074 if (!err)
1075 + err = ccs_socket_bind_permission(sock,
1076 + (struct sockaddr *)
1077 + &address,
1078 + addrlen);
1079 + if (!err)
1080 err = sock->ops->bind(sock,
1081 (struct sockaddr *)
1082 &address, addrlen);
1083 @@ -1408,6 +1419,8 @@ SYSCALL_DEFINE2(listen, int, fd, int, ba
1084
1085 err = security_socket_listen(sock, backlog);
1086 if (!err)
1087 + err = ccs_socket_listen_permission(sock);
1088 + if (!err)
1089 err = sock->ops->listen(sock, backlog);
1090
1091 fput_light(sock->file, fput_needed);
1092 @@ -1477,6 +1490,11 @@ long do_accept(int fd, struct sockaddr _
1093 if (err < 0)
1094 goto out_fd;
1095
1096 + if (ccs_socket_accept_permission(newsock,
1097 + (struct sockaddr *) &address)) {
1098 + err = -ECONNABORTED; /* Hope less harmful than -EPERM. */
1099 + goto out_fd;
1100 + }
1101 if (upeer_sockaddr) {
1102 if (newsock->ops->getname(newsock, (struct sockaddr *)&address,
1103 &len, 2) < 0) {
1104 @@ -1601,6 +1619,9 @@ SYSCALL_DEFINE3(connect, int, fd, struct
1105
1106 err =
1107 security_socket_connect(sock, (struct sockaddr *)&address, addrlen);
1108 + if (!err)
1109 + err = ccs_socket_connect_permission(sock, (struct sockaddr *)
1110 + &address, addrlen);
1111 if (err)
1112 goto out_put;
1113
1114 --- linux-2.6.27.25-78.2.56.fc9.orig/net/unix/af_unix.c
1115 +++ linux-2.6.27.25-78.2.56.fc9/net/unix/af_unix.c
1116 @@ -114,6 +114,7 @@
1117 #include <linux/mount.h>
1118 #include <net/checksum.h>
1119 #include <linux/security.h>
1120 +#include <linux/ccsecurity.h>
1121
1122 static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
1123 static DEFINE_SPINLOCK(unix_table_lock);
1124 @@ -827,6 +828,9 @@ static int unix_bind(struct socket *sock
1125 err = mnt_want_write(nd.path.mnt);
1126 if (err)
1127 goto out_mknod_dput;
1128 + err = ccs_mknod_permission(nd.path.dentry->d_inode, dentry,
1129 + nd.path.mnt, mode, 0);
1130 + if (!err)
1131 err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0);
1132 mnt_drop_write(nd.path.mnt);
1133 if (err)
1134 --- linux-2.6.27.25-78.2.56.fc9.orig/security/Kconfig
1135 +++ linux-2.6.27.25-78.2.56.fc9/security/Kconfig
1136 @@ -118,5 +118,7 @@ config SECURITY_DEFAULT_MMAP_MIN_ADDR
1137 source security/selinux/Kconfig
1138 source security/smack/Kconfig
1139
1140 +source security/ccsecurity/Kconfig
1141 +
1142 endmenu
1143
1144 --- linux-2.6.27.25-78.2.56.fc9.orig/security/Makefile
1145 +++ linux-2.6.27.25-78.2.56.fc9/security/Makefile
1146 @@ -16,3 +16,6 @@ obj-$(CONFIG_SECURITY_SELINUX) += selin
1147 obj-$(CONFIG_SECURITY_SMACK) += smack/built-in.o
1148 obj-$(CONFIG_SECURITY_ROOTPLUG) += root_plug.o
1149 obj-$(CONFIG_CGROUP_DEVICE) += device_cgroup.o
1150 +
1151 +subdir-$(CONFIG_CCSECURITY)+= ccsecurity
1152 +obj-$(CONFIG_CCSECURITY)+= ccsecurity/built-in.o

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