12 |
arch/sparc/kernel/ptrace.c | 5 +++++ |
arch/sparc/kernel/ptrace.c | 5 +++++ |
13 |
arch/sparc64/kernel/ptrace.c | 5 +++++ |
arch/sparc64/kernel/ptrace.c | 5 +++++ |
14 |
arch/x86_64/ia32/ptrace32.c | 3 +++ |
arch/x86_64/ia32/ptrace32.c | 3 +++ |
|
fs/attr.c | 5 +++++ |
|
15 |
fs/compat.c | 9 ++++++++- |
fs/compat.c | 9 ++++++++- |
16 |
fs/exec.c | 12 +++++++++++- |
fs/exec.c | 12 +++++++++++- |
17 |
fs/fcntl.c | 4 ++++ |
fs/fcntl.c | 4 ++++ |
18 |
fs/ioctl.c | 5 +++++ |
fs/ioctl.c | 5 +++++ |
19 |
fs/namei.c | 32 ++++++++++++++++++++++++++++++++ |
fs/namei.c | 32 ++++++++++++++++++++++++++++++++ |
20 |
fs/namespace.c | 24 +++++++++++++++++++++++- |
fs/namespace.c | 21 ++++++++++++++++++++- |
21 |
fs/open.c | 27 +++++++++++++++++++++++++++ |
fs/open.c | 27 +++++++++++++++++++++++++++ |
22 |
fs/proc/proc_misc.c | 1 + |
fs/proc/proc_misc.c | 1 + |
23 |
include/linux/init_task.h | 2 ++ |
include/linux/init_task.h | 9 +++++++++ |
24 |
include/linux/sched.h | 4 ++++ |
include/linux/sched.h | 6 ++++++ |
25 |
kernel/compat.c | 3 +++ |
kernel/compat.c | 3 +++ |
26 |
kernel/kexec.c | 3 +++ |
kernel/kexec.c | 3 +++ |
27 |
kernel/kmod.c | 3 +++ |
kernel/kmod.c | 5 +++++ |
28 |
kernel/module.c | 7 +++++-- |
kernel/module.c | 7 +++++-- |
29 |
kernel/ptrace.c | 3 +++ |
kernel/ptrace.c | 3 +++ |
30 |
kernel/sched.c | 3 +++ |
kernel/sched.c | 3 +++ |
39 |
net/ipv6/inet6_hashtables.c | 5 ++++- |
net/ipv6/inet6_hashtables.c | 5 ++++- |
40 |
net/ipv6/raw.c | 4 ++++ |
net/ipv6/raw.c | 4 ++++ |
41 |
net/ipv6/udp.c | 8 ++++++++ |
net/ipv6/udp.c | 8 ++++++++ |
42 |
net/socket.c | 25 +++++++++++++++++++++++-- |
net/socket.c | 23 +++++++++++++++++++++-- |
43 |
net/unix/af_unix.c | 4 ++++ |
net/unix/af_unix.c | 4 ++++ |
44 |
security/Kconfig | 2 ++ |
security/Kconfig | 2 ++ |
45 |
security/Makefile | 3 +++ |
security/Makefile | 3 +++ |
46 |
42 files changed, 281 insertions(+), 9 deletions(-) |
41 files changed, 282 insertions(+), 9 deletions(-) |
47 |
|
|
48 |
--- linux-2.6.18-24etch2.orig/arch/alpha/kernel/ptrace.c |
--- linux-2.6.18-26etch2.orig/arch/alpha/kernel/ptrace.c |
49 |
+++ linux-2.6.18-24etch2/arch/alpha/kernel/ptrace.c |
+++ linux-2.6.18-26etch2/arch/alpha/kernel/ptrace.c |
50 |
@@ -20,6 +20,7 @@ |
@@ -20,6 +20,7 @@ |
51 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
52 |
#include <asm/system.h> |
#include <asm/system.h> |
59 |
unsigned long tmp; |
unsigned long tmp; |
60 |
size_t copied; |
size_t copied; |
61 |
long ret; |
long ret; |
62 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
63 |
+ return -EPERM; |
+ return -EPERM; |
64 |
|
|
65 |
lock_kernel(); |
lock_kernel(); |
66 |
DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n", |
DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n", |
67 |
--- linux-2.6.18-24etch2.orig/arch/ia64/ia32/sys_ia32.c |
--- linux-2.6.18-26etch2.orig/arch/ia64/ia32/sys_ia32.c |
68 |
+++ linux-2.6.18-24etch2/arch/ia64/ia32/sys_ia32.c |
+++ linux-2.6.18-26etch2/arch/ia64/ia32/sys_ia32.c |
69 |
@@ -56,6 +56,7 @@ |
@@ -56,6 +56,7 @@ |
70 |
#include <asm/types.h> |
#include <asm/types.h> |
71 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
78 |
struct task_struct *child; |
struct task_struct *child; |
79 |
unsigned int value, tmp; |
unsigned int value, tmp; |
80 |
long i, ret; |
long i, ret; |
81 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
82 |
+ return -EPERM; |
+ return -EPERM; |
83 |
|
|
84 |
lock_kernel(); |
lock_kernel(); |
85 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
86 |
--- linux-2.6.18-24etch2.orig/arch/ia64/kernel/ptrace.c |
--- linux-2.6.18-26etch2.orig/arch/ia64/kernel/ptrace.c |
87 |
+++ linux-2.6.18-24etch2/arch/ia64/kernel/ptrace.c |
+++ linux-2.6.18-26etch2/arch/ia64/kernel/ptrace.c |
88 |
@@ -28,6 +28,7 @@ |
@@ -28,6 +28,7 @@ |
89 |
#ifdef CONFIG_PERFMON |
#ifdef CONFIG_PERFMON |
90 |
#include <asm/perfmon.h> |
#include <asm/perfmon.h> |
97 |
struct task_struct *child; |
struct task_struct *child; |
98 |
struct switch_stack *sw; |
struct switch_stack *sw; |
99 |
long ret; |
long ret; |
100 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
101 |
+ return -EPERM; |
+ return -EPERM; |
102 |
|
|
103 |
lock_kernel(); |
lock_kernel(); |
104 |
ret = -EPERM; |
ret = -EPERM; |
105 |
--- linux-2.6.18-24etch2.orig/arch/m32r/kernel/ptrace.c |
--- linux-2.6.18-26etch2.orig/arch/m32r/kernel/ptrace.c |
106 |
+++ linux-2.6.18-24etch2/arch/m32r/kernel/ptrace.c |
+++ linux-2.6.18-26etch2/arch/m32r/kernel/ptrace.c |
107 |
@@ -32,6 +32,7 @@ |
@@ -32,6 +32,7 @@ |
108 |
#include <asm/system.h> |
#include <asm/system.h> |
109 |
#include <asm/processor.h> |
#include <asm/processor.h> |
116 |
{ |
{ |
117 |
struct task_struct *child; |
struct task_struct *child; |
118 |
int ret; |
int ret; |
119 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
120 |
+ return -EPERM; |
+ return -EPERM; |
121 |
|
|
122 |
lock_kernel(); |
lock_kernel(); |
123 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
124 |
--- linux-2.6.18-24etch2.orig/arch/mips/kernel/ptrace32.c |
--- linux-2.6.18-26etch2.orig/arch/mips/kernel/ptrace32.c |
125 |
+++ linux-2.6.18-24etch2/arch/mips/kernel/ptrace32.c |
+++ linux-2.6.18-26etch2/arch/mips/kernel/ptrace32.c |
126 |
@@ -35,6 +35,7 @@ |
@@ -35,6 +35,7 @@ |
127 |
#include <asm/system.h> |
#include <asm/system.h> |
128 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
135 |
{ |
{ |
136 |
struct task_struct *child; |
struct task_struct *child; |
137 |
int ret; |
int ret; |
138 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
139 |
+ return -EPERM; |
+ return -EPERM; |
140 |
|
|
141 |
#if 0 |
#if 0 |
142 |
printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n", |
printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n", |
143 |
--- linux-2.6.18-24etch2.orig/arch/powerpc/kernel/ptrace32.c |
--- linux-2.6.18-26etch2.orig/arch/powerpc/kernel/ptrace32.c |
144 |
+++ linux-2.6.18-24etch2/arch/powerpc/kernel/ptrace32.c |
+++ linux-2.6.18-26etch2/arch/powerpc/kernel/ptrace32.c |
145 |
@@ -32,6 +32,7 @@ |
@@ -32,6 +32,7 @@ |
146 |
#include <asm/page.h> |
#include <asm/page.h> |
147 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
154 |
{ |
{ |
155 |
struct task_struct *child; |
struct task_struct *child; |
156 |
int ret; |
int ret; |
157 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
158 |
+ return -EPERM; |
+ return -EPERM; |
159 |
|
|
160 |
lock_kernel(); |
lock_kernel(); |
161 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
162 |
--- linux-2.6.18-24etch2.orig/arch/s390/kernel/ptrace.c |
--- linux-2.6.18-26etch2.orig/arch/s390/kernel/ptrace.c |
163 |
+++ linux-2.6.18-24etch2/arch/s390/kernel/ptrace.c |
+++ linux-2.6.18-26etch2/arch/s390/kernel/ptrace.c |
164 |
@@ -41,6 +41,7 @@ |
@@ -41,6 +41,7 @@ |
165 |
#include <asm/system.h> |
#include <asm/system.h> |
166 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
173 |
struct task_struct *child; |
struct task_struct *child; |
174 |
int ret; |
int ret; |
175 |
|
|
176 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
177 |
+ return -EPERM; |
+ return -EPERM; |
178 |
lock_kernel(); |
lock_kernel(); |
179 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
180 |
ret = ptrace_traceme(); |
ret = ptrace_traceme(); |
181 |
--- linux-2.6.18-24etch2.orig/arch/sparc/kernel/ptrace.c |
--- linux-2.6.18-26etch2.orig/arch/sparc/kernel/ptrace.c |
182 |
+++ linux-2.6.18-24etch2/arch/sparc/kernel/ptrace.c |
+++ linux-2.6.18-26etch2/arch/sparc/kernel/ptrace.c |
183 |
@@ -23,6 +23,7 @@ |
@@ -23,6 +23,7 @@ |
184 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
185 |
#include <asm/system.h> |
#include <asm/system.h> |
192 |
unsigned long addr2 = regs->u_regs[UREG_I4]; |
unsigned long addr2 = regs->u_regs[UREG_I4]; |
193 |
struct task_struct *child; |
struct task_struct *child; |
194 |
int ret; |
int ret; |
195 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) { |
+ if (ccs_ptrace_permission(request, pid)) { |
196 |
+ pt_error_return(regs, EPERM); |
+ pt_error_return(regs, EPERM); |
197 |
+ return; |
+ return; |
198 |
+ } |
+ } |
199 |
|
|
200 |
lock_kernel(); |
lock_kernel(); |
201 |
#ifdef DEBUG_PTRACE |
#ifdef DEBUG_PTRACE |
202 |
--- linux-2.6.18-24etch2.orig/arch/sparc64/kernel/ptrace.c |
--- linux-2.6.18-26etch2.orig/arch/sparc64/kernel/ptrace.c |
203 |
+++ linux-2.6.18-24etch2/arch/sparc64/kernel/ptrace.c |
+++ linux-2.6.18-26etch2/arch/sparc64/kernel/ptrace.c |
204 |
@@ -32,6 +32,7 @@ |
@@ -32,6 +32,7 @@ |
205 |
#include <asm/spitfire.h> |
#include <asm/spitfire.h> |
206 |
#include <asm/page.h> |
#include <asm/page.h> |
213 |
unsigned long addr2 = regs->u_regs[UREG_I4]; |
unsigned long addr2 = regs->u_regs[UREG_I4]; |
214 |
struct task_struct *child; |
struct task_struct *child; |
215 |
int ret; |
int ret; |
216 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) { |
+ if (ccs_ptrace_permission(request, pid)) { |
217 |
+ pt_error_return(regs, EPERM); |
+ pt_error_return(regs, EPERM); |
218 |
+ return; |
+ return; |
219 |
+ } |
+ } |
220 |
|
|
221 |
if (test_thread_flag(TIF_32BIT)) { |
if (test_thread_flag(TIF_32BIT)) { |
222 |
addr &= 0xffffffffUL; |
addr &= 0xffffffffUL; |
223 |
--- linux-2.6.18-24etch2.orig/arch/x86_64/ia32/ptrace32.c |
--- linux-2.6.18-26etch2.orig/arch/x86_64/ia32/ptrace32.c |
224 |
+++ linux-2.6.18-24etch2/arch/x86_64/ia32/ptrace32.c |
+++ linux-2.6.18-26etch2/arch/x86_64/ia32/ptrace32.c |
225 |
@@ -26,6 +26,7 @@ |
@@ -26,6 +26,7 @@ |
226 |
#include <asm/i387.h> |
#include <asm/i387.h> |
227 |
#include <asm/fpu32.h> |
#include <asm/fpu32.h> |
234 |
void __user *datap = compat_ptr(data); |
void __user *datap = compat_ptr(data); |
235 |
int ret; |
int ret; |
236 |
__u32 val; |
__u32 val; |
237 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
238 |
+ return -EPERM; |
+ return -EPERM; |
239 |
|
|
240 |
switch (request) { |
switch (request) { |
241 |
case PTRACE_TRACEME: |
case PTRACE_TRACEME: |
242 |
--- linux-2.6.18-24etch2.orig/fs/attr.c |
--- linux-2.6.18-26etch2.orig/fs/compat.c |
243 |
+++ linux-2.6.18-24etch2/fs/attr.c |
+++ linux-2.6.18-26etch2/fs/compat.c |
|
@@ -15,6 +15,7 @@ |
|
|
#include <linux/fcntl.h> |
|
|
#include <linux/quotaops.h> |
|
|
#include <linux/security.h> |
|
|
+#include <linux/ccsecurity.h> |
|
|
|
|
|
/* Taken over from the old code... */ |
|
|
|
|
|
@@ -146,11 +147,15 @@ int notify_change(struct dentry * dentry |
|
|
if (inode->i_op && inode->i_op->setattr) { |
|
|
error = security_inode_setattr(dentry, attr); |
|
|
if (!error) |
|
|
+ error = ccs_setattr_permission(dentry, attr); |
|
|
+ if (!error) |
|
|
error = inode->i_op->setattr(dentry, attr); |
|
|
} else { |
|
|
error = inode_change_ok(inode, attr); |
|
|
if (!error) |
|
|
error = security_inode_setattr(dentry, attr); |
|
|
+ if (!error) |
|
|
+ error = ccs_setattr_permission(dentry, attr); |
|
|
if (!error) { |
|
|
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
|
|
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) |
|
|
--- linux-2.6.18-24etch2.orig/fs/compat.c |
|
|
+++ linux-2.6.18-24etch2/fs/compat.c |
|
244 |
@@ -52,6 +52,7 @@ |
@@ -52,6 +52,7 @@ |
245 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
246 |
#include <asm/mmu_context.h> |
#include <asm/mmu_context.h> |
254 |
/* RED-PEN how should LSM module know it's handling 32bit? */ |
/* RED-PEN how should LSM module know it's handling 32bit? */ |
255 |
error = security_file_ioctl(filp, cmd, arg); |
error = security_file_ioctl(filp, cmd, arg); |
256 |
+ if (!error) |
+ if (!error) |
257 |
+ error = ccs_check_ioctl_permission(filp, cmd, arg); |
+ error = ccs_ioctl_permission(filp, cmd, arg); |
258 |
if (error) |
if (error) |
259 |
goto out_fput; |
goto out_fput; |
260 |
|
|
278 |
if (retval >= 0) { |
if (retval >= 0) { |
279 |
free_arg_pages(bprm); |
free_arg_pages(bprm); |
280 |
|
|
281 |
--- linux-2.6.18-24etch2.orig/fs/exec.c |
--- linux-2.6.18-26etch2.orig/fs/exec.c |
282 |
+++ linux-2.6.18-24etch2/fs/exec.c |
+++ linux-2.6.18-26etch2/fs/exec.c |
283 |
@@ -57,6 +57,8 @@ |
@@ -57,6 +57,8 @@ |
284 |
#include <linux/kmod.h> |
#include <linux/kmod.h> |
285 |
#endif |
#endif |
320 |
if (retval >= 0) { |
if (retval >= 0) { |
321 |
free_arg_pages(bprm); |
free_arg_pages(bprm); |
322 |
|
|
323 |
--- linux-2.6.18-24etch2.orig/fs/fcntl.c |
--- linux-2.6.18-26etch2.orig/fs/fcntl.c |
324 |
+++ linux-2.6.18-24etch2/fs/fcntl.c |
+++ linux-2.6.18-26etch2/fs/fcntl.c |
325 |
@@ -22,6 +22,7 @@ |
@@ -22,6 +22,7 @@ |
326 |
#include <asm/poll.h> |
#include <asm/poll.h> |
327 |
#include <asm/siginfo.h> |
#include <asm/siginfo.h> |
340 |
/* O_NOATIME can only be set by the owner or superuser */ |
/* O_NOATIME can only be set by the owner or superuser */ |
341 |
if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) |
if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) |
342 |
if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER)) |
if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER)) |
343 |
--- linux-2.6.18-24etch2.orig/fs/ioctl.c |
--- linux-2.6.18-26etch2.orig/fs/ioctl.c |
344 |
+++ linux-2.6.18-24etch2/fs/ioctl.c |
+++ linux-2.6.18-26etch2/fs/ioctl.c |
345 |
@@ -15,6 +15,7 @@ |
@@ -15,6 +15,7 @@ |
346 |
|
|
347 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
368 |
if (error) |
if (error) |
369 |
goto out_fput; |
goto out_fput; |
370 |
|
|
371 |
--- linux-2.6.18-24etch2.orig/fs/namei.c |
--- linux-2.6.18-26etch2.orig/fs/namei.c |
372 |
+++ linux-2.6.18-24etch2/fs/namei.c |
+++ linux-2.6.18-26etch2/fs/namei.c |
373 |
@@ -37,6 +37,8 @@ |
@@ -37,6 +37,8 @@ |
374 |
|
|
375 |
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) |
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) |
479 |
error = vfs_rename(old_dir->d_inode, old_dentry, |
error = vfs_rename(old_dir->d_inode, old_dentry, |
480 |
new_dir->d_inode, new_dentry); |
new_dir->d_inode, new_dentry); |
481 |
exit5: |
exit5: |
482 |
--- linux-2.6.18-24etch2.orig/fs/namespace.c |
--- linux-2.6.18-26etch2.orig/fs/namespace.c |
483 |
+++ linux-2.6.18-24etch2/fs/namespace.c |
+++ linux-2.6.18-26etch2/fs/namespace.c |
484 |
@@ -25,6 +25,7 @@ |
@@ -25,6 +25,7 @@ |
485 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
486 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
489 |
|
|
490 |
extern int __init init_rootfs(void); |
extern int __init init_rootfs(void); |
491 |
|
|
492 |
@@ -553,6 +554,9 @@ static int do_umount(struct vfsmount *mn |
@@ -550,6 +551,8 @@ static int do_umount(struct vfsmount *mn |
493 |
|
LIST_HEAD(umount_list); |
494 |
|
|
495 |
|
retval = security_sb_umount(mnt, flags); |
496 |
|
+ if (!retval) |
497 |
|
+ retval = ccs_umount_permission(mnt, flags); |
498 |
if (retval) |
if (retval) |
499 |
return retval; |
return retval; |
500 |
|
|
501 |
+ if (ccs_may_umount(mnt)) |
@@ -641,6 +644,8 @@ asmlinkage long sys_umount(char __user * |
|
+ return -EPERM; |
|
|
+ |
|
|
/* |
|
|
* Allow userspace to request a mountpoint be expired rather than |
|
|
* unmounting unconditionally. Unmount only happens if: |
|
|
@@ -641,6 +645,8 @@ asmlinkage long sys_umount(char __user * |
|
502 |
{ |
{ |
503 |
struct nameidata nd; |
struct nameidata nd; |
504 |
int retval; |
int retval; |
507 |
|
|
508 |
retval = __user_walk(name, LOOKUP_FOLLOW, &nd); |
retval = __user_walk(name, LOOKUP_FOLLOW, &nd); |
509 |
if (retval) |
if (retval) |
510 |
@@ -925,6 +931,9 @@ static int do_loopback(struct nameidata |
@@ -925,6 +930,9 @@ static int do_loopback(struct nameidata |
511 |
|
|
512 |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
513 |
goto out; |
goto out; |
517 |
|
|
518 |
err = -ENOMEM; |
err = -ENOMEM; |
519 |
if (recurse) |
if (recurse) |
520 |
@@ -1009,7 +1018,9 @@ static int do_move_mount(struct nameidat |
@@ -1009,7 +1017,9 @@ static int do_move_mount(struct nameidat |
521 |
err = -EINVAL; |
err = -EINVAL; |
522 |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
523 |
goto out; |
goto out; |
524 |
- |
- |
525 |
+ err = -EPERM; |
+ err = -EPERM; |
526 |
+ if (ccs_may_umount(old_nd.mnt) || ccs_may_mount(nd)) |
+ if (ccs_may_mount(nd)) |
527 |
+ goto out; |
+ goto out; |
528 |
err = -ENOENT; |
err = -ENOENT; |
529 |
mutex_lock(&nd->dentry->d_inode->i_mutex); |
mutex_lock(&nd->dentry->d_inode->i_mutex); |
530 |
if (IS_DEADDIR(nd->dentry->d_inode)) |
if (IS_DEADDIR(nd->dentry->d_inode)) |
531 |
@@ -1111,6 +1122,9 @@ int do_add_mount(struct vfsmount *newmnt |
@@ -1111,6 +1121,9 @@ int do_add_mount(struct vfsmount *newmnt |
532 |
err = -EINVAL; |
err = -EINVAL; |
533 |
if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode)) |
if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode)) |
534 |
goto unlock; |
goto unlock; |
538 |
|
|
539 |
newmnt->mnt_flags = mnt_flags; |
newmnt->mnt_flags = mnt_flags; |
540 |
if ((err = graft_tree(newmnt, nd))) |
if ((err = graft_tree(newmnt, nd))) |
541 |
@@ -1402,6 +1416,10 @@ long do_mount(char *dev_name, char *dir_ |
@@ -1384,6 +1397,7 @@ int copy_mount_options(const void __user |
542 |
if (data_page) |
long do_mount(char *dev_name, char *dir_name, char *type_page, |
543 |
((char *)data_page)[PAGE_SIZE - 1] = 0; |
unsigned long flags, void *data_page) |
544 |
|
{ |
545 |
+ retval = ccs_mount_permission(dev_name, dir_name, type_page, &flags); |
+ const unsigned long original_flags = flags; |
546 |
+ if (retval) |
struct nameidata nd; |
547 |
+ return retval; |
int retval = 0; |
548 |
+ |
int mnt_flags = 0; |
549 |
/* Separate the per-mountpoint flags */ |
@@ -1423,6 +1437,9 @@ long do_mount(char *dev_name, char *dir_ |
550 |
if (flags & MS_NOSUID) |
return retval; |
|
mnt_flags |= MNT_NOSUID; |
|
|
@@ -1691,6 +1709,8 @@ asmlinkage long sys_pivot_root(const cha |
|
|
|
|
|
if (!capable(CAP_SYS_ADMIN)) |
|
|
return -EPERM; |
|
|
+ if (!ccs_capable(CCS_SYS_PIVOT_ROOT)) |
|
|
+ return -EPERM; |
|
551 |
|
|
552 |
lock_kernel(); |
retval = security_sb_mount(dev_name, &nd, type_page, flags, data_page); |
553 |
|
+ if (!retval) |
554 |
|
+ retval = ccs_mount_permission(dev_name, &nd, type_page, |
555 |
|
+ original_flags, data_page); |
556 |
|
if (retval) |
557 |
|
goto dput_out; |
558 |
|
|
559 |
@@ -1707,6 +1727,8 @@ asmlinkage long sys_pivot_root(const cha |
@@ -1707,6 +1724,8 @@ asmlinkage long sys_pivot_root(const cha |
560 |
goto out1; |
goto out1; |
561 |
|
|
562 |
error = security_sb_pivotroot(&old_nd, &new_nd); |
error = security_sb_pivotroot(&old_nd, &new_nd); |
565 |
if (error) { |
if (error) { |
566 |
path_release(&old_nd); |
path_release(&old_nd); |
567 |
goto out1; |
goto out1; |
568 |
--- linux-2.6.18-24etch2.orig/fs/open.c |
--- linux-2.6.18-26etch2.orig/fs/open.c |
569 |
+++ linux-2.6.18-24etch2/fs/open.c |
+++ linux-2.6.18-26etch2/fs/open.c |
570 |
@@ -30,6 +30,7 @@ |
@@ -30,6 +30,7 @@ |
571 |
#include <linux/audit.h> |
#include <linux/audit.h> |
572 |
|
|
594 |
error = locks_verify_truncate(inode, file, length); |
error = locks_verify_truncate(inode, file, length); |
595 |
if (!error) |
if (!error) |
596 |
error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); |
error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); |
597 |
@@ -608,6 +614,10 @@ asmlinkage long sys_chroot(const char __ |
@@ -608,6 +614,8 @@ asmlinkage long sys_chroot(const char __ |
598 |
error = -EPERM; |
error = -EPERM; |
599 |
if (!capable(CAP_SYS_CHROOT)) |
if (!capable(CAP_SYS_CHROOT)) |
600 |
goto dput_and_out; |
goto dput_and_out; |
|
+ if (!ccs_capable(CCS_SYS_CHROOT)) |
|
|
+ goto dput_and_out; |
|
601 |
+ if (ccs_chroot_permission(&nd)) |
+ if (ccs_chroot_permission(&nd)) |
602 |
+ goto dput_and_out; |
+ goto dput_and_out; |
603 |
|
|
604 |
set_fs_root(current->fs, nd.mnt, nd.dentry); |
set_fs_root(current->fs, nd.mnt, nd.dentry); |
605 |
set_fs_altroot(); |
set_fs_altroot(); |
606 |
@@ -641,6 +651,9 @@ asmlinkage long sys_fchmod(unsigned int |
@@ -641,6 +649,9 @@ asmlinkage long sys_fchmod(unsigned int |
607 |
err = -EPERM; |
err = -EPERM; |
608 |
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
609 |
goto out_putf; |
goto out_putf; |
613 |
mutex_lock(&inode->i_mutex); |
mutex_lock(&inode->i_mutex); |
614 |
if (mode == (mode_t) -1) |
if (mode == (mode_t) -1) |
615 |
mode = inode->i_mode; |
mode = inode->i_mode; |
616 |
@@ -675,6 +688,9 @@ asmlinkage long sys_fchmodat(int dfd, co |
@@ -675,6 +686,9 @@ asmlinkage long sys_fchmodat(int dfd, co |
617 |
error = -EPERM; |
error = -EPERM; |
618 |
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
619 |
goto dput_and_out; |
goto dput_and_out; |
623 |
|
|
624 |
mutex_lock(&inode->i_mutex); |
mutex_lock(&inode->i_mutex); |
625 |
if (mode == (mode_t) -1) |
if (mode == (mode_t) -1) |
626 |
@@ -737,6 +753,8 @@ asmlinkage long sys_chown(const char __u |
@@ -737,6 +751,8 @@ asmlinkage long sys_chown(const char __u |
627 |
|
|
628 |
error = user_path_walk(filename, &nd); |
error = user_path_walk(filename, &nd); |
629 |
if (!error) { |
if (!error) { |
632 |
error = chown_common(nd.dentry, user, group); |
error = chown_common(nd.dentry, user, group); |
633 |
path_release(&nd); |
path_release(&nd); |
634 |
} |
} |
635 |
@@ -756,6 +774,8 @@ asmlinkage long sys_fchownat(int dfd, co |
@@ -756,6 +772,8 @@ asmlinkage long sys_fchownat(int dfd, co |
636 |
follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; |
follow = (flag & AT_SYMLINK_NOFOLLOW) ? 0 : LOOKUP_FOLLOW; |
637 |
error = __user_walk_fd(dfd, filename, follow, &nd); |
error = __user_walk_fd(dfd, filename, follow, &nd); |
638 |
if (!error) { |
if (!error) { |
641 |
error = chown_common(nd.dentry, user, group); |
error = chown_common(nd.dentry, user, group); |
642 |
path_release(&nd); |
path_release(&nd); |
643 |
} |
} |
644 |
@@ -770,6 +790,8 @@ asmlinkage long sys_lchown(const char __ |
@@ -770,6 +788,8 @@ asmlinkage long sys_lchown(const char __ |
645 |
|
|
646 |
error = user_path_walk_link(filename, &nd); |
error = user_path_walk_link(filename, &nd); |
647 |
if (!error) { |
if (!error) { |
650 |
error = chown_common(nd.dentry, user, group); |
error = chown_common(nd.dentry, user, group); |
651 |
path_release(&nd); |
path_release(&nd); |
652 |
} |
} |
653 |
@@ -787,6 +809,9 @@ asmlinkage long sys_fchown(unsigned int |
@@ -787,6 +807,9 @@ asmlinkage long sys_fchown(unsigned int |
654 |
struct dentry * dentry; |
struct dentry * dentry; |
655 |
dentry = file->f_dentry; |
dentry = file->f_dentry; |
656 |
audit_inode(NULL, dentry->d_inode); |
audit_inode(NULL, dentry->d_inode); |
660 |
error = chown_common(dentry, user, group); |
error = chown_common(dentry, user, group); |
661 |
fput(file); |
fput(file); |
662 |
} |
} |
663 |
|
@@ -879,7 +902,9 @@ static struct file *do_filp_open(int dfd |
664 |
|
if ((namei_flags+1) & O_ACCMODE) |
665 |
|
namei_flags++; |
666 |
|
|
667 |
|
+ ccs_save_open_mode(flags); |
668 |
|
error = open_namei(dfd, filename, namei_flags, mode, &nd); |
669 |
|
+ ccs_clear_open_mode(); |
670 |
|
if (!error) |
671 |
|
return nameidata_to_filp(&nd, flags); |
672 |
|
|
673 |
@@ -1199,6 +1224,8 @@ EXPORT_SYMBOL(sys_close); |
@@ -1199,6 +1224,8 @@ EXPORT_SYMBOL(sys_close); |
674 |
*/ |
*/ |
675 |
asmlinkage long sys_vhangup(void) |
asmlinkage long sys_vhangup(void) |
679 |
if (capable(CAP_SYS_TTY_CONFIG)) { |
if (capable(CAP_SYS_TTY_CONFIG)) { |
680 |
tty_vhangup(current->signal->tty); |
tty_vhangup(current->signal->tty); |
681 |
return 0; |
return 0; |
682 |
--- linux-2.6.18-24etch2.orig/fs/proc/proc_misc.c |
--- linux-2.6.18-26etch2.orig/fs/proc/proc_misc.c |
683 |
+++ linux-2.6.18-24etch2/fs/proc/proc_misc.c |
+++ linux-2.6.18-26etch2/fs/proc/proc_misc.c |
684 |
@@ -723,4 +723,5 @@ void __init proc_misc_init(void) |
@@ -723,4 +723,5 @@ void __init proc_misc_init(void) |
685 |
if (entry) |
if (entry) |
686 |
entry->proc_fops = &proc_sysrq_trigger_operations; |
entry->proc_fops = &proc_sysrq_trigger_operations; |
687 |
#endif |
#endif |
688 |
+ printk(KERN_INFO "Hook version: 2.6.18-24etch2 2009/08/08\n"); |
+ printk(KERN_INFO "Hook version: 2.6.18-26etch2 2010/04/12\n"); |
689 |
} |
} |
690 |
--- linux-2.6.18-24etch2.orig/include/linux/init_task.h |
--- linux-2.6.18-26etch2.orig/include/linux/init_task.h |
691 |
+++ linux-2.6.18-24etch2/include/linux/init_task.h |
+++ linux-2.6.18-26etch2/include/linux/init_task.h |
692 |
@@ -128,6 +128,8 @@ extern struct group_info init_groups; |
@@ -76,6 +76,14 @@ |
693 |
|
|
694 |
|
extern struct group_info init_groups; |
695 |
|
|
696 |
|
+#ifdef CONFIG_CCSECURITY |
697 |
|
+#define INIT_CCSECURITY \ |
698 |
|
+ .ccs_domain_info = NULL, \ |
699 |
|
+ .ccs_flags = 0, |
700 |
|
+#else |
701 |
|
+#define INIT_CCSECURITY |
702 |
|
+#endif |
703 |
|
+ |
704 |
|
/* |
705 |
|
* INIT_TASK is used to set up the first task table, touch at |
706 |
|
* your own risk!. Base=0, limit=0x1fffff (=2MB) |
707 |
|
@@ -128,6 +136,7 @@ extern struct group_info init_groups; |
708 |
.pi_lock = SPIN_LOCK_UNLOCKED, \ |
.pi_lock = SPIN_LOCK_UNLOCKED, \ |
709 |
INIT_TRACE_IRQFLAGS \ |
INIT_TRACE_IRQFLAGS \ |
710 |
INIT_LOCKDEP \ |
INIT_LOCKDEP \ |
711 |
+ .ccs_domain_info = NULL, \ |
+ INIT_CCSECURITY \ |
|
+ .ccs_flags = 0, \ |
|
712 |
} |
} |
713 |
|
|
714 |
|
|
715 |
--- linux-2.6.18-24etch2.orig/include/linux/sched.h |
--- linux-2.6.18-26etch2.orig/include/linux/sched.h |
716 |
+++ linux-2.6.18-24etch2/include/linux/sched.h |
+++ linux-2.6.18-26etch2/include/linux/sched.h |
717 |
@@ -25,6 +25,8 @@ |
@@ -35,6 +35,8 @@ |
718 |
#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */ |
|
719 |
#define CLONE_STOPPED 0x02000000 /* Start in stopped state */ |
#ifdef __KERNEL__ |
720 |
|
|
721 |
+struct ccs_domain_info; |
+struct ccs_domain_info; |
722 |
+ |
+ |
723 |
/* |
struct sched_param { |
724 |
* Scheduling policies |
int sched_priority; |
725 |
*/ |
}; |
726 |
@@ -996,6 +998,8 @@ struct task_struct { |
@@ -996,6 +998,10 @@ struct task_struct { |
727 |
#ifdef CONFIG_TASK_DELAY_ACCT |
#ifdef CONFIG_TASK_DELAY_ACCT |
728 |
struct task_delay_info *delays; |
struct task_delay_info *delays; |
729 |
#endif |
#endif |
730 |
|
+#ifdef CONFIG_CCSECURITY |
731 |
+ struct ccs_domain_info *ccs_domain_info; |
+ struct ccs_domain_info *ccs_domain_info; |
732 |
+ u32 ccs_flags; |
+ u32 ccs_flags; |
733 |
|
+#endif |
734 |
}; |
}; |
735 |
|
|
736 |
static inline pid_t process_group(struct task_struct *tsk) |
static inline pid_t process_group(struct task_struct *tsk) |
737 |
--- linux-2.6.18-24etch2.orig/kernel/compat.c |
--- linux-2.6.18-26etch2.orig/kernel/compat.c |
738 |
+++ linux-2.6.18-24etch2/kernel/compat.c |
+++ linux-2.6.18-26etch2/kernel/compat.c |
739 |
@@ -24,6 +24,7 @@ |
@@ -24,6 +24,7 @@ |
740 |
#include <linux/migrate.h> |
#include <linux/migrate.h> |
741 |
|
|
753 |
|
|
754 |
do_settimeofday(&tv); |
do_settimeofday(&tv); |
755 |
return 0; |
return 0; |
756 |
--- linux-2.6.18-24etch2.orig/kernel/kexec.c |
--- linux-2.6.18-26etch2.orig/kernel/kexec.c |
757 |
+++ linux-2.6.18-24etch2/kernel/kexec.c |
+++ linux-2.6.18-26etch2/kernel/kexec.c |
758 |
@@ -26,6 +26,7 @@ |
@@ -26,6 +26,7 @@ |
759 |
#include <asm/io.h> |
#include <asm/io.h> |
760 |
#include <asm/system.h> |
#include <asm/system.h> |
772 |
|
|
773 |
/* |
/* |
774 |
* Verify we have a legal set of flags |
* Verify we have a legal set of flags |
775 |
--- linux-2.6.18-24etch2.orig/kernel/kmod.c |
--- linux-2.6.18-26etch2.orig/kernel/kmod.c |
776 |
+++ linux-2.6.18-24etch2/kernel/kmod.c |
+++ linux-2.6.18-26etch2/kernel/kmod.c |
777 |
@@ -148,6 +148,9 @@ static int ____call_usermodehelper(void |
@@ -148,6 +148,11 @@ static int ____call_usermodehelper(void |
778 |
/* We can run anywhere, unlike our parent keventd(). */ |
/* We can run anywhere, unlike our parent keventd(). */ |
779 |
set_cpus_allowed(current, CPU_MASK_ALL); |
set_cpus_allowed(current, CPU_MASK_ALL); |
780 |
|
|
781 |
|
+#ifdef CONFIG_CCSECURITY |
782 |
+ current->ccs_domain_info = NULL; |
+ current->ccs_domain_info = NULL; |
783 |
+ current->ccs_flags = 0; |
+ current->ccs_flags = 0; |
784 |
|
+#endif |
785 |
+ |
+ |
786 |
retval = -EPERM; |
retval = -EPERM; |
787 |
if (current->fs->root) |
if (current->fs->root) |
788 |
retval = execve(sub_info->path, sub_info->argv,sub_info->envp); |
retval = execve(sub_info->path, sub_info->argv,sub_info->envp); |
789 |
--- linux-2.6.18-24etch2.orig/kernel/module.c |
--- linux-2.6.18-26etch2.orig/kernel/module.c |
790 |
+++ linux-2.6.18-24etch2/kernel/module.c |
+++ linux-2.6.18-26etch2/kernel/module.c |
791 |
@@ -44,6 +44,7 @@ |
@@ -44,6 +44,7 @@ |
792 |
#include <asm/semaphore.h> |
#include <asm/semaphore.h> |
793 |
#include <asm/cacheflush.h> |
#include <asm/cacheflush.h> |
816 |
/* Only one module load at a time, please */ |
/* Only one module load at a time, please */ |
817 |
if (mutex_lock_interruptible(&module_mutex) != 0) |
if (mutex_lock_interruptible(&module_mutex) != 0) |
818 |
return -EINTR; |
return -EINTR; |
819 |
--- linux-2.6.18-24etch2.orig/kernel/ptrace.c |
--- linux-2.6.18-26etch2.orig/kernel/ptrace.c |
820 |
+++ linux-2.6.18-24etch2/kernel/ptrace.c |
+++ linux-2.6.18-26etch2/kernel/ptrace.c |
821 |
@@ -21,6 +21,7 @@ |
@@ -21,6 +21,7 @@ |
822 |
|
|
823 |
#include <asm/pgtable.h> |
#include <asm/pgtable.h> |
830 |
/* |
/* |
831 |
* This lock_kernel fixes a subtle race with suid exec |
* This lock_kernel fixes a subtle race with suid exec |
832 |
*/ |
*/ |
833 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
+ if (ccs_ptrace_permission(request, pid)) |
834 |
+ return -EPERM; |
+ return -EPERM; |
835 |
lock_kernel(); |
lock_kernel(); |
836 |
if (request == PTRACE_TRACEME) { |
if (request == PTRACE_TRACEME) { |
837 |
ret = ptrace_traceme(); |
ret = ptrace_traceme(); |
838 |
--- linux-2.6.18-24etch2.orig/kernel/sched.c |
--- linux-2.6.18-26etch2.orig/kernel/sched.c |
839 |
+++ linux-2.6.18-24etch2/kernel/sched.c |
+++ linux-2.6.18-26etch2/kernel/sched.c |
840 |
@@ -55,6 +55,7 @@ |
@@ -55,6 +55,7 @@ |
841 |
#include <asm/tlb.h> |
#include <asm/tlb.h> |
842 |
|
|
854 |
|
|
855 |
/* |
/* |
856 |
* Setpriority might change our priority at the same moment. |
* Setpriority might change our priority at the same moment. |
857 |
--- linux-2.6.18-24etch2.orig/kernel/signal.c |
--- linux-2.6.18-26etch2.orig/kernel/signal.c |
858 |
+++ linux-2.6.18-24etch2/kernel/signal.c |
+++ linux-2.6.18-26etch2/kernel/signal.c |
859 |
@@ -28,6 +28,7 @@ |
@@ -28,6 +28,7 @@ |
860 |
#include <asm/unistd.h> |
#include <asm/unistd.h> |
861 |
#include <asm/siginfo.h> |
#include <asm/siginfo.h> |
900 |
|
|
901 |
/* POSIX.1b doesn't mention process groups. */ |
/* POSIX.1b doesn't mention process groups. */ |
902 |
return kill_proc_info(sig, &info, pid); |
return kill_proc_info(sig, &info, pid); |
903 |
--- linux-2.6.18-24etch2.orig/kernel/sys.c |
--- linux-2.6.18-26etch2.orig/kernel/sys.c |
904 |
+++ linux-2.6.18-24etch2/kernel/sys.c |
+++ linux-2.6.18-26etch2/kernel/sys.c |
905 |
@@ -36,6 +36,7 @@ |
@@ -36,6 +36,7 @@ |
906 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
907 |
#include <asm/io.h> |
#include <asm/io.h> |
948 |
|
|
949 |
down_write(&uts_sem); |
down_write(&uts_sem); |
950 |
errno = -EFAULT; |
errno = -EFAULT; |
951 |
--- linux-2.6.18-24etch2.orig/kernel/sysctl.c |
--- linux-2.6.18-26etch2.orig/kernel/sysctl.c |
952 |
+++ linux-2.6.18-24etch2/kernel/sysctl.c |
+++ linux-2.6.18-26etch2/kernel/sysctl.c |
953 |
@@ -48,6 +48,7 @@ |
@@ -48,6 +48,7 @@ |
954 |
|
|
955 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
982 |
error = table->strategy( |
error = table->strategy( |
983 |
table, name, nlen, |
table, name, nlen, |
984 |
oldval, oldlenp, |
oldval, oldlenp, |
985 |
--- linux-2.6.18-24etch2.orig/kernel/time.c |
--- linux-2.6.18-26etch2.orig/kernel/time.c |
986 |
+++ linux-2.6.18-24etch2/kernel/time.c |
+++ linux-2.6.18-26etch2/kernel/time.c |
987 |
@@ -39,6 +39,7 @@ |
@@ -39,6 +39,7 @@ |
988 |
|
|
989 |
#include <asm/uaccess.h> |
#include <asm/uaccess.h> |
1019 |
|
|
1020 |
/* Now we validate the data before disabling interrupts */ |
/* Now we validate the data before disabling interrupts */ |
1021 |
|
|
1022 |
--- linux-2.6.18-24etch2.orig/net/ipv4/inet_connection_sock.c |
--- linux-2.6.18-26etch2.orig/net/ipv4/inet_connection_sock.c |
1023 |
+++ linux-2.6.18-24etch2/net/ipv4/inet_connection_sock.c |
+++ linux-2.6.18-26etch2/net/ipv4/inet_connection_sock.c |
1024 |
@@ -23,6 +23,7 @@ |
@@ -23,6 +23,7 @@ |
1025 |
#include <net/route.h> |
#include <net/route.h> |
1026 |
#include <net/tcp_states.h> |
#include <net/tcp_states.h> |
1038 |
inet_bind_bucket_for_each(tb, node, &head->chain) |
inet_bind_bucket_for_each(tb, node, &head->chain) |
1039 |
if (tb->port == rover) |
if (tb->port == rover) |
1040 |
goto next; |
goto next; |
1041 |
--- linux-2.6.18-24etch2.orig/net/ipv4/inet_hashtables.c |
--- linux-2.6.18-26etch2.orig/net/ipv4/inet_hashtables.c |
1042 |
+++ linux-2.6.18-24etch2/net/ipv4/inet_hashtables.c |
+++ linux-2.6.18-26etch2/net/ipv4/inet_hashtables.c |
1043 |
@@ -22,6 +22,7 @@ |
@@ -22,6 +22,7 @@ |
1044 |
#include <net/inet_connection_sock.h> |
#include <net/inet_connection_sock.h> |
1045 |
#include <net/inet_hashtables.h> |
#include <net/inet_hashtables.h> |
1057 |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
1058 |
spin_lock(&head->lock); |
spin_lock(&head->lock); |
1059 |
|
|
1060 |
--- linux-2.6.18-24etch2.orig/net/ipv4/raw.c |
--- linux-2.6.18-26etch2.orig/net/ipv4/raw.c |
1061 |
+++ linux-2.6.18-24etch2/net/ipv4/raw.c |
+++ linux-2.6.18-26etch2/net/ipv4/raw.c |
1062 |
@@ -79,6 +79,7 @@ |
@@ -79,6 +79,7 @@ |
1063 |
#include <linux/seq_file.h> |
#include <linux/seq_file.h> |
1064 |
#include <linux/netfilter.h> |
#include <linux/netfilter.h> |
1077 |
|
|
1078 |
copied = skb->len; |
copied = skb->len; |
1079 |
if (len < copied) { |
if (len < copied) { |
1080 |
--- linux-2.6.18-24etch2.orig/net/ipv4/udp.c |
--- linux-2.6.18-26etch2.orig/net/ipv4/udp.c |
1081 |
+++ linux-2.6.18-24etch2/net/ipv4/udp.c |
+++ linux-2.6.18-26etch2/net/ipv4/udp.c |
1082 |
@@ -108,6 +108,7 @@ |
@@ -108,6 +108,7 @@ |
1083 |
#include <net/inet_common.h> |
#include <net/inet_common.h> |
1084 |
#include <net/checksum.h> |
#include <net/checksum.h> |
1117 |
copied = skb->len - sizeof(struct udphdr); |
copied = skb->len - sizeof(struct udphdr); |
1118 |
if (copied > len) { |
if (copied > len) { |
1119 |
copied = len; |
copied = len; |
1120 |
--- linux-2.6.18-24etch2.orig/net/ipv6/inet6_hashtables.c |
--- linux-2.6.18-26etch2.orig/net/ipv6/inet6_hashtables.c |
1121 |
+++ linux-2.6.18-24etch2/net/ipv6/inet6_hashtables.c |
+++ linux-2.6.18-26etch2/net/ipv6/inet6_hashtables.c |
1122 |
@@ -21,6 +21,7 @@ |
@@ -21,6 +21,7 @@ |
1123 |
#include <net/inet_hashtables.h> |
#include <net/inet_hashtables.h> |
1124 |
#include <net/inet6_hashtables.h> |
#include <net/inet6_hashtables.h> |
1145 |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
1146 |
spin_lock(&head->lock); |
spin_lock(&head->lock); |
1147 |
|
|
1148 |
--- linux-2.6.18-24etch2.orig/net/ipv6/raw.c |
--- linux-2.6.18-26etch2.orig/net/ipv6/raw.c |
1149 |
+++ linux-2.6.18-24etch2/net/ipv6/raw.c |
+++ linux-2.6.18-26etch2/net/ipv6/raw.c |
1150 |
@@ -56,6 +56,7 @@ |
@@ -56,6 +56,7 @@ |
1151 |
|
|
1152 |
#include <linux/proc_fs.h> |
#include <linux/proc_fs.h> |
1165 |
|
|
1166 |
copied = skb->len; |
copied = skb->len; |
1167 |
if (copied > len) { |
if (copied > len) { |
1168 |
--- linux-2.6.18-24etch2.orig/net/ipv6/udp.c |
--- linux-2.6.18-26etch2.orig/net/ipv6/udp.c |
1169 |
+++ linux-2.6.18-24etch2/net/ipv6/udp.c |
+++ linux-2.6.18-26etch2/net/ipv6/udp.c |
1170 |
@@ -58,6 +58,7 @@ |
@@ -58,6 +58,7 @@ |
1171 |
|
|
1172 |
#include <linux/proc_fs.h> |
#include <linux/proc_fs.h> |
1203 |
|
|
1204 |
copied = skb->len - sizeof(struct udphdr); |
copied = skb->len - sizeof(struct udphdr); |
1205 |
if (copied > len) { |
if (copied > len) { |
1206 |
--- linux-2.6.18-24etch2.orig/net/socket.c |
--- linux-2.6.18-26etch2.orig/net/socket.c |
1207 |
+++ linux-2.6.18-24etch2/net/socket.c |
+++ linux-2.6.18-26etch2/net/socket.c |
1208 |
@@ -94,6 +94,8 @@ |
@@ -94,6 +94,8 @@ |
1209 |
#include <net/sock.h> |
#include <net/sock.h> |
1210 |
#include <linux/netfilter.h> |
#include <linux/netfilter.h> |
1214 |
static int sock_no_open(struct inode *irrelevant, struct file *dontcare); |
static int sock_no_open(struct inode *irrelevant, struct file *dontcare); |
1215 |
static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf, |
static ssize_t sock_aio_read(struct kiocb *iocb, char __user *buf, |
1216 |
size_t size, loff_t pos); |
size_t size, loff_t pos); |
1217 |
@@ -590,9 +592,12 @@ static inline int __sock_sendmsg(struct |
@@ -590,9 +592,10 @@ static inline int __sock_sendmsg(struct |
1218 |
si->size = size; |
si->size = size; |
1219 |
|
|
1220 |
err = security_socket_sendmsg(sock, msg, size); |
err = security_socket_sendmsg(sock, msg, size); |
1221 |
+ if (!err) |
+ if (!err) |
1222 |
+ err = ccs_socket_sendmsg_permission(sock, (struct sockaddr *) |
+ err = ccs_socket_sendmsg_permission(sock, msg, size); |
|
+ msg->msg_name, |
|
|
+ msg->msg_namelen); |
|
1223 |
if (err) |
if (err) |
1224 |
return err; |
return err; |
1225 |
- |
- |
1226 |
return sock->ops->sendmsg(iocb, sock, msg, size); |
return sock->ops->sendmsg(iocb, sock, msg, size); |
1227 |
} |
} |
1228 |
|
|
1229 |
@@ -1149,6 +1154,8 @@ static int __sock_create(int family, int |
@@ -1149,6 +1152,8 @@ static int __sock_create(int family, int |
1230 |
} |
} |
1231 |
|
|
1232 |
err = security_socket_create(family, type, protocol, kern); |
err = security_socket_create(family, type, protocol, kern); |
1235 |
if (err) |
if (err) |
1236 |
return err; |
return err; |
1237 |
|
|
1238 |
@@ -1343,6 +1350,11 @@ asmlinkage long sys_bind(int fd, struct |
@@ -1343,6 +1348,11 @@ asmlinkage long sys_bind(int fd, struct |
1239 |
if((err=move_addr_to_kernel(umyaddr,addrlen,address))>=0) { |
if((err=move_addr_to_kernel(umyaddr,addrlen,address))>=0) { |
1240 |
err = security_socket_bind(sock, (struct sockaddr *)address, addrlen); |
err = security_socket_bind(sock, (struct sockaddr *)address, addrlen); |
1241 |
if (!err) |
if (!err) |
1247 |
err = sock->ops->bind(sock, |
err = sock->ops->bind(sock, |
1248 |
(struct sockaddr *)address, addrlen); |
(struct sockaddr *)address, addrlen); |
1249 |
} |
} |
1250 |
@@ -1371,6 +1383,8 @@ asmlinkage long sys_listen(int fd, int b |
@@ -1371,6 +1381,8 @@ asmlinkage long sys_listen(int fd, int b |
1251 |
|
|
1252 |
err = security_socket_listen(sock, backlog); |
err = security_socket_listen(sock, backlog); |
1253 |
if (!err) |
if (!err) |
1256 |
err = sock->ops->listen(sock, backlog); |
err = sock->ops->listen(sock, backlog); |
1257 |
|
|
1258 |
fput_light(sock->file, fput_needed); |
fput_light(sock->file, fput_needed); |
1259 |
@@ -1434,6 +1448,11 @@ asmlinkage long sys_accept(int fd, struc |
@@ -1434,6 +1446,11 @@ asmlinkage long sys_accept(int fd, struc |
1260 |
if (err < 0) |
if (err < 0) |
1261 |
goto out_fd; |
goto out_fd; |
1262 |
|
|
1268 |
if (upeer_sockaddr) { |
if (upeer_sockaddr) { |
1269 |
if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) { |
if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) { |
1270 |
err = -ECONNABORTED; |
err = -ECONNABORTED; |
1271 |
@@ -1488,9 +1507,11 @@ asmlinkage long sys_connect(int fd, stru |
@@ -1488,9 +1505,11 @@ asmlinkage long sys_connect(int fd, stru |
1272 |
goto out_put; |
goto out_put; |
1273 |
|
|
1274 |
err = security_socket_connect(sock, (struct sockaddr *)address, addrlen); |
err = security_socket_connect(sock, (struct sockaddr *)address, addrlen); |
1281 |
err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen, |
err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen, |
1282 |
sock->file->f_flags); |
sock->file->f_flags); |
1283 |
out_put: |
out_put: |
1284 |
--- linux-2.6.18-24etch2.orig/net/unix/af_unix.c |
--- linux-2.6.18-26etch2.orig/net/unix/af_unix.c |
1285 |
+++ linux-2.6.18-24etch2/net/unix/af_unix.c |
+++ linux-2.6.18-26etch2/net/unix/af_unix.c |
1286 |
@@ -116,6 +116,7 @@ |
@@ -116,6 +116,7 @@ |
1287 |
#include <linux/mount.h> |
#include <linux/mount.h> |
1288 |
#include <net/checksum.h> |
#include <net/checksum.h> |
1301 |
err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); |
err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); |
1302 |
if (err) |
if (err) |
1303 |
goto out_mknod_dput; |
goto out_mknod_dput; |
1304 |
--- linux-2.6.18-24etch2.orig/security/Kconfig |
--- linux-2.6.18-26etch2.orig/security/Kconfig |
1305 |
+++ linux-2.6.18-24etch2/security/Kconfig |
+++ linux-2.6.18-26etch2/security/Kconfig |
1306 |
@@ -107,5 +107,7 @@ config SECURITY_SECLVL |
@@ -107,5 +107,7 @@ config SECURITY_SECLVL |
1307 |
|
|
1308 |
source security/selinux/Kconfig |
source security/selinux/Kconfig |
1311 |
+ |
+ |
1312 |
endmenu |
endmenu |
1313 |
|
|
1314 |
--- linux-2.6.18-24etch2.orig/security/Makefile |
--- linux-2.6.18-26etch2.orig/security/Makefile |
1315 |
+++ linux-2.6.18-24etch2/security/Makefile |
+++ linux-2.6.18-26etch2/security/Makefile |
1316 |
@@ -17,3 +17,6 @@ obj-$(CONFIG_SECURITY_SELINUX) += selin |
@@ -17,3 +17,6 @@ obj-$(CONFIG_SECURITY_SELINUX) += selin |
1317 |
obj-$(CONFIG_SECURITY_CAPABILITIES) += commoncap.o capability.o |
obj-$(CONFIG_SECURITY_CAPABILITIES) += commoncap.o capability.o |
1318 |
obj-$(CONFIG_SECURITY_ROOTPLUG) += commoncap.o root_plug.o |
obj-$(CONFIG_SECURITY_ROOTPLUG) += commoncap.o root_plug.o |