1 |
kumaneko |
1498 |
This is TOMOYO Linux patch for kernel 2.6.21.7. |
2 |
kumaneko |
869 |
|
3 |
kumaneko |
1498 |
Source code for this patch is http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.21.7.tar.bz2 |
4 |
kumaneko |
862 |
--- |
5 |
kumaneko |
2298 |
arch/alpha/kernel/ptrace.c | 7 +++++ |
6 |
|
|
arch/ia64/ia32/sys_ia32.c | 7 +++++ |
7 |
|
|
arch/ia64/kernel/ptrace.c | 7 +++++ |
8 |
|
|
arch/m32r/kernel/ptrace.c | 7 +++++ |
9 |
|
|
arch/mips/kernel/ptrace32.c | 7 +++++ |
10 |
|
|
arch/powerpc/kernel/ptrace32.c | 7 +++++ |
11 |
|
|
arch/s390/kernel/ptrace.c | 7 +++++ |
12 |
|
|
arch/sparc/kernel/ptrace.c | 9 ++++++ |
13 |
|
|
arch/sparc64/kernel/ptrace.c | 9 ++++++ |
14 |
|
|
arch/x86_64/ia32/ptrace32.c | 7 +++++ |
15 |
|
|
fs/Kconfig | 2 + |
16 |
|
|
fs/Makefile | 2 + |
17 |
|
|
fs/attr.c | 19 +++++++++++++ |
18 |
|
|
fs/compat.c | 15 ++++++++++ |
19 |
|
|
fs/exec.c | 20 +++++++++++++- |
20 |
|
|
fs/fcntl.c | 9 ++++++ |
21 |
|
|
fs/ioctl.c | 11 ++++++++ |
22 |
|
|
fs/namei.c | 55 ++++++++++++++++++++++++++++++++++++++++ |
23 |
|
|
fs/namespace.c | 49 +++++++++++++++++++++++++++++++++++ |
24 |
|
|
fs/open.c | 28 ++++++++++++++++++++ |
25 |
|
|
fs/proc/Makefile | 3 ++ |
26 |
|
|
fs/proc/proc_misc.c | 5 +++ |
27 |
|
|
include/linux/init_task.h | 4 ++ |
28 |
|
|
include/linux/sched.h | 8 +++++ |
29 |
|
|
kernel/compat.c | 7 +++++ |
30 |
|
|
kernel/kexec.c | 7 +++++ |
31 |
|
|
kernel/kmod.c | 5 +++ |
32 |
|
|
kernel/module.c | 11 ++++++++ |
33 |
|
|
kernel/ptrace.c | 7 +++++ |
34 |
|
|
kernel/sched.c | 7 +++++ |
35 |
|
|
kernel/signal.c | 21 +++++++++++++++ |
36 |
|
|
kernel/sys.c | 21 +++++++++++++++ |
37 |
|
|
kernel/sysctl.c | 9 ++++++ |
38 |
|
|
kernel/time.c | 11 ++++++++ |
39 |
|
|
kernel/time/ntp.c | 7 +++++ |
40 |
|
|
net/core/datagram.c | 11 ++++++++ |
41 |
|
|
net/ipv4/inet_connection_sock.c | 7 +++++ |
42 |
|
|
net/ipv4/inet_hashtables.c | 7 +++++ |
43 |
|
|
net/ipv4/udp.c | 11 ++++++++ |
44 |
|
|
net/ipv6/inet6_hashtables.c | 7 +++++ |
45 |
|
|
net/socket.c | 41 +++++++++++++++++++++++++++++ |
46 |
|
|
net/unix/af_unix.c | 8 +++++ |
47 |
|
|
42 files changed, 507 insertions(+), 2 deletions(-) |
48 |
kumaneko |
862 |
|
49 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/alpha/kernel/ptrace.c |
50 |
|
|
+++ linux-2.6.21.7/arch/alpha/kernel/ptrace.c |
51 |
kumaneko |
863 |
@@ -20,6 +20,9 @@ |
52 |
|
|
#include <asm/pgtable.h> |
53 |
|
|
#include <asm/system.h> |
54 |
|
|
#include <asm/fpu.h> |
55 |
|
|
+/***** TOMOYO Linux start. *****/ |
56 |
|
|
+#include <linux/tomoyo.h> |
57 |
|
|
+/***** TOMOYO Linux end. *****/ |
58 |
|
|
|
59 |
|
|
#include "proto.h" |
60 |
|
|
|
61 |
kumaneko |
2278 |
@@ -268,6 +271,10 @@ do_sys_ptrace(long request, long pid, lo |
62 |
kumaneko |
863 |
unsigned long tmp; |
63 |
|
|
size_t copied; |
64 |
|
|
long ret; |
65 |
|
|
+ /***** TOMOYO Linux start. *****/ |
66 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
67 |
kumaneko |
1128 |
+ return -EPERM; |
68 |
kumaneko |
863 |
+ /***** TOMOYO Linux end. *****/ |
69 |
|
|
|
70 |
|
|
lock_kernel(); |
71 |
|
|
DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n", |
72 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/ia64/ia32/sys_ia32.c |
73 |
|
|
+++ linux-2.6.21.7/arch/ia64/ia32/sys_ia32.c |
74 |
kumaneko |
1187 |
@@ -56,6 +56,9 @@ |
75 |
|
|
#include <asm/types.h> |
76 |
|
|
#include <asm/uaccess.h> |
77 |
|
|
#include <asm/unistd.h> |
78 |
|
|
+/***** TOMOYO Linux start. *****/ |
79 |
|
|
+#include <linux/tomoyo.h> |
80 |
|
|
+/***** TOMOYO Linux end. *****/ |
81 |
|
|
|
82 |
|
|
#include "ia32priv.h" |
83 |
|
|
|
84 |
kumaneko |
2278 |
@@ -1758,6 +1761,10 @@ sys32_ptrace (int request, pid_t pid, un |
85 |
kumaneko |
1187 |
struct task_struct *child; |
86 |
|
|
unsigned int value, tmp; |
87 |
|
|
long i, ret; |
88 |
|
|
+ /***** TOMOYO Linux start. *****/ |
89 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
90 |
kumaneko |
1187 |
+ return -EPERM; |
91 |
|
|
+ /***** TOMOYO Linux end. *****/ |
92 |
|
|
|
93 |
|
|
lock_kernel(); |
94 |
|
|
if (request == PTRACE_TRACEME) { |
95 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/ia64/kernel/ptrace.c |
96 |
|
|
+++ linux-2.6.21.7/arch/ia64/kernel/ptrace.c |
97 |
kumaneko |
863 |
@@ -28,6 +28,9 @@ |
98 |
|
|
#ifdef CONFIG_PERFMON |
99 |
|
|
#include <asm/perfmon.h> |
100 |
|
|
#endif |
101 |
|
|
+/***** TOMOYO Linux start. *****/ |
102 |
|
|
+#include <linux/tomoyo.h> |
103 |
|
|
+/***** TOMOYO Linux end. *****/ |
104 |
|
|
|
105 |
|
|
#include "entry.h" |
106 |
|
|
|
107 |
kumaneko |
2278 |
@@ -1418,6 +1421,10 @@ sys_ptrace (long request, pid_t pid, uns |
108 |
kumaneko |
863 |
struct task_struct *child; |
109 |
|
|
struct switch_stack *sw; |
110 |
|
|
long ret; |
111 |
|
|
+ /***** TOMOYO Linux start. *****/ |
112 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
113 |
kumaneko |
1128 |
+ return -EPERM; |
114 |
kumaneko |
863 |
+ /***** TOMOYO Linux end. *****/ |
115 |
|
|
|
116 |
|
|
lock_kernel(); |
117 |
|
|
ret = -EPERM; |
118 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/m32r/kernel/ptrace.c |
119 |
|
|
+++ linux-2.6.21.7/arch/m32r/kernel/ptrace.c |
120 |
kumaneko |
863 |
@@ -32,6 +32,9 @@ |
121 |
|
|
#include <asm/system.h> |
122 |
|
|
#include <asm/processor.h> |
123 |
|
|
#include <asm/mmu_context.h> |
124 |
|
|
+/***** TOMOYO Linux start. *****/ |
125 |
|
|
+#include <linux/tomoyo.h> |
126 |
|
|
+/***** TOMOYO Linux end. *****/ |
127 |
|
|
|
128 |
|
|
/* |
129 |
|
|
* This routine will get a word off of the process kernel stack. |
130 |
kumaneko |
2278 |
@@ -742,6 +745,10 @@ asmlinkage long sys_ptrace(long request, |
131 |
kumaneko |
863 |
{ |
132 |
|
|
struct task_struct *child; |
133 |
|
|
int ret; |
134 |
|
|
+ /***** TOMOYO Linux start. *****/ |
135 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
136 |
kumaneko |
1128 |
+ return -EPERM; |
137 |
kumaneko |
863 |
+ /***** TOMOYO Linux end. *****/ |
138 |
|
|
|
139 |
|
|
lock_kernel(); |
140 |
|
|
if (request == PTRACE_TRACEME) { |
141 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/mips/kernel/ptrace32.c |
142 |
|
|
+++ linux-2.6.21.7/arch/mips/kernel/ptrace32.c |
143 |
kumaneko |
1187 |
@@ -35,6 +35,9 @@ |
144 |
|
|
#include <asm/system.h> |
145 |
|
|
#include <asm/uaccess.h> |
146 |
|
|
#include <asm/bootinfo.h> |
147 |
|
|
+/***** TOMOYO Linux start. *****/ |
148 |
|
|
+#include <linux/tomoyo.h> |
149 |
|
|
+/***** TOMOYO Linux end. *****/ |
150 |
|
|
|
151 |
|
|
int ptrace_getregs (struct task_struct *child, __s64 __user *data); |
152 |
|
|
int ptrace_setregs (struct task_struct *child, __s64 __user *data); |
153 |
kumaneko |
2278 |
@@ -50,6 +53,10 @@ asmlinkage int sys32_ptrace(int request, |
154 |
kumaneko |
1187 |
{ |
155 |
|
|
struct task_struct *child; |
156 |
|
|
int ret; |
157 |
|
|
+ /***** TOMOYO Linux start. *****/ |
158 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
159 |
kumaneko |
1187 |
+ return -EPERM; |
160 |
|
|
+ /***** TOMOYO Linux end. *****/ |
161 |
|
|
|
162 |
|
|
#if 0 |
163 |
|
|
printk("ptrace(r=%d,pid=%d,addr=%08lx,data=%08lx)\n", |
164 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/powerpc/kernel/ptrace32.c |
165 |
|
|
+++ linux-2.6.21.7/arch/powerpc/kernel/ptrace32.c |
166 |
kumaneko |
1187 |
@@ -32,6 +32,9 @@ |
167 |
|
|
#include <asm/page.h> |
168 |
|
|
#include <asm/pgtable.h> |
169 |
|
|
#include <asm/system.h> |
170 |
|
|
+/***** TOMOYO Linux start. *****/ |
171 |
|
|
+#include <linux/tomoyo.h> |
172 |
|
|
+/***** TOMOYO Linux end. *****/ |
173 |
|
|
|
174 |
|
|
#include "ptrace-common.h" |
175 |
|
|
|
176 |
kumaneko |
2278 |
@@ -45,6 +48,10 @@ long compat_sys_ptrace(int request, int |
177 |
kumaneko |
1187 |
{ |
178 |
|
|
struct task_struct *child; |
179 |
|
|
int ret; |
180 |
|
|
+ /***** TOMOYO Linux start. *****/ |
181 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
182 |
kumaneko |
1187 |
+ return -EPERM; |
183 |
|
|
+ /***** TOMOYO Linux end. *****/ |
184 |
|
|
|
185 |
|
|
lock_kernel(); |
186 |
|
|
if (request == PTRACE_TRACEME) { |
187 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/s390/kernel/ptrace.c |
188 |
|
|
+++ linux-2.6.21.7/arch/s390/kernel/ptrace.c |
189 |
kumaneko |
863 |
@@ -41,6 +41,9 @@ |
190 |
|
|
#include <asm/system.h> |
191 |
|
|
#include <asm/uaccess.h> |
192 |
|
|
#include <asm/unistd.h> |
193 |
|
|
+/***** TOMOYO Linux start. *****/ |
194 |
|
|
+#include <linux/tomoyo.h> |
195 |
|
|
+/***** TOMOYO Linux end. *****/ |
196 |
|
|
|
197 |
|
|
#ifdef CONFIG_COMPAT |
198 |
|
|
#include "compat_ptrace.h" |
199 |
kumaneko |
2278 |
@@ -713,6 +716,10 @@ sys_ptrace(long request, long pid, long |
200 |
kumaneko |
863 |
struct task_struct *child; |
201 |
|
|
int ret; |
202 |
|
|
|
203 |
|
|
+ /***** TOMOYO Linux start. *****/ |
204 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
205 |
kumaneko |
1128 |
+ return -EPERM; |
206 |
kumaneko |
863 |
+ /***** TOMOYO Linux end. *****/ |
207 |
|
|
lock_kernel(); |
208 |
|
|
if (request == PTRACE_TRACEME) { |
209 |
|
|
ret = ptrace_traceme(); |
210 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/sparc/kernel/ptrace.c |
211 |
|
|
+++ linux-2.6.21.7/arch/sparc/kernel/ptrace.c |
212 |
kumaneko |
863 |
@@ -23,6 +23,9 @@ |
213 |
|
|
#include <asm/pgtable.h> |
214 |
|
|
#include <asm/system.h> |
215 |
|
|
#include <asm/uaccess.h> |
216 |
|
|
+/***** TOMOYO Linux start. *****/ |
217 |
|
|
+#include <linux/tomoyo.h> |
218 |
|
|
+/***** TOMOYO Linux end. *****/ |
219 |
|
|
|
220 |
|
|
#define MAGIC_CONSTANT 0x80000000 |
221 |
|
|
|
222 |
kumaneko |
2278 |
@@ -267,6 +270,12 @@ asmlinkage void do_ptrace(struct pt_regs |
223 |
kumaneko |
863 |
unsigned long addr2 = regs->u_regs[UREG_I4]; |
224 |
|
|
struct task_struct *child; |
225 |
|
|
int ret; |
226 |
|
|
+ /***** TOMOYO Linux start. *****/ |
227 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) { |
228 |
kumaneko |
877 |
+ pt_error_return(regs, EPERM); |
229 |
|
|
+ return; |
230 |
|
|
+ } |
231 |
kumaneko |
863 |
+ /***** TOMOYO Linux end. *****/ |
232 |
|
|
|
233 |
|
|
lock_kernel(); |
234 |
|
|
#ifdef DEBUG_PTRACE |
235 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/sparc64/kernel/ptrace.c |
236 |
|
|
+++ linux-2.6.21.7/arch/sparc64/kernel/ptrace.c |
237 |
kumaneko |
863 |
@@ -32,6 +32,9 @@ |
238 |
|
|
#include <asm/spitfire.h> |
239 |
|
|
#include <asm/page.h> |
240 |
|
|
#include <asm/cpudata.h> |
241 |
|
|
+/***** TOMOYO Linux start. *****/ |
242 |
|
|
+#include <linux/tomoyo.h> |
243 |
|
|
+/***** TOMOYO Linux end. *****/ |
244 |
|
|
|
245 |
|
|
/* Returning from ptrace is a bit tricky because the syscall return |
246 |
|
|
* low level code assumes any value returned which is negative and |
247 |
kumaneko |
2278 |
@@ -176,6 +179,12 @@ asmlinkage void do_ptrace(struct pt_regs |
248 |
kumaneko |
863 |
unsigned long addr2 = regs->u_regs[UREG_I4]; |
249 |
|
|
struct task_struct *child; |
250 |
|
|
int ret; |
251 |
|
|
+ /***** TOMOYO Linux start. *****/ |
252 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) { |
253 |
kumaneko |
877 |
+ pt_error_return(regs, EPERM); |
254 |
|
|
+ return; |
255 |
|
|
+ } |
256 |
kumaneko |
863 |
+ /***** TOMOYO Linux end. *****/ |
257 |
|
|
|
258 |
|
|
if (test_thread_flag(TIF_32BIT)) { |
259 |
|
|
addr &= 0xffffffffUL; |
260 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/arch/x86_64/ia32/ptrace32.c |
261 |
|
|
+++ linux-2.6.21.7/arch/x86_64/ia32/ptrace32.c |
262 |
kumaneko |
1187 |
@@ -26,6 +26,9 @@ |
263 |
|
|
#include <asm/i387.h> |
264 |
|
|
#include <asm/fpu32.h> |
265 |
|
|
#include <asm/ia32.h> |
266 |
|
|
+/***** TOMOYO Linux start. *****/ |
267 |
|
|
+#include <linux/tomoyo.h> |
268 |
|
|
+/***** TOMOYO Linux end. *****/ |
269 |
|
|
|
270 |
|
|
/* |
271 |
|
|
* Determines which flags the user has access to [1 = access, 0 = no access]. |
272 |
kumaneko |
2278 |
@@ -234,6 +237,10 @@ asmlinkage long sys32_ptrace(long reques |
273 |
kumaneko |
1187 |
void __user *datap = compat_ptr(data); |
274 |
|
|
int ret; |
275 |
|
|
__u32 val; |
276 |
|
|
+ /***** TOMOYO Linux start. *****/ |
277 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
278 |
kumaneko |
1187 |
+ return -EPERM; |
279 |
|
|
+ /***** TOMOYO Linux end. *****/ |
280 |
|
|
|
281 |
|
|
switch (request) { |
282 |
|
|
case PTRACE_TRACEME: |
283 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/Kconfig |
284 |
|
|
+++ linux-2.6.21.7/fs/Kconfig |
285 |
kumaneko |
193 |
@@ -2055,5 +2055,7 @@ endif |
286 |
|
|
source "fs/nls/Kconfig" |
287 |
|
|
source "fs/dlm/Kconfig" |
288 |
|
|
|
289 |
|
|
+source "fs/Kconfig.ccs" |
290 |
|
|
+ |
291 |
|
|
endmenu |
292 |
|
|
|
293 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/Makefile |
294 |
|
|
+++ linux-2.6.21.7/fs/Makefile |
295 |
kumaneko |
193 |
@@ -114,3 +114,5 @@ obj-$(CONFIG_HPPFS) += hppfs/ |
296 |
|
|
obj-$(CONFIG_DEBUG_FS) += debugfs/ |
297 |
|
|
obj-$(CONFIG_OCFS2_FS) += ocfs2/ |
298 |
|
|
obj-$(CONFIG_GFS2_FS) += gfs2/ |
299 |
|
|
+ |
300 |
|
|
+include $(srctree)/fs/Makefile-2.6.ccs |
301 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/attr.c |
302 |
|
|
+++ linux-2.6.21.7/fs/attr.c |
303 |
kumaneko |
193 |
@@ -15,6 +15,9 @@ |
304 |
|
|
#include <linux/fcntl.h> |
305 |
|
|
#include <linux/quotaops.h> |
306 |
|
|
#include <linux/security.h> |
307 |
|
|
+/***** TOMOYO Linux start. *****/ |
308 |
|
|
+#include <linux/tomoyo.h> |
309 |
|
|
+/***** TOMOYO Linux end. *****/ |
310 |
|
|
|
311 |
|
|
/* Taken over from the old code... */ |
312 |
|
|
|
313 |
kumaneko |
1128 |
@@ -145,12 +148,28 @@ int notify_change(struct dentry * dentry |
314 |
kumaneko |
193 |
|
315 |
|
|
if (inode->i_op && inode->i_op->setattr) { |
316 |
|
|
error = security_inode_setattr(dentry, attr); |
317 |
|
|
+ /***** TOMOYO Linux start. *****/ |
318 |
kumaneko |
1128 |
+ if (!error && (ia_valid & ATTR_MODE) && |
319 |
kumaneko |
2282 |
+ !ccs_capable(CCS_SYS_CHMOD)) |
320 |
kumaneko |
1128 |
+ error = -EPERM; |
321 |
|
|
+ if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) && |
322 |
kumaneko |
2282 |
+ !ccs_capable(CCS_SYS_CHOWN)) |
323 |
kumaneko |
1128 |
+ error = -EPERM; |
324 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
325 |
|
|
if (!error) |
326 |
|
|
error = inode->i_op->setattr(dentry, attr); |
327 |
|
|
} else { |
328 |
|
|
error = inode_change_ok(inode, attr); |
329 |
|
|
if (!error) |
330 |
|
|
error = security_inode_setattr(dentry, attr); |
331 |
|
|
+ /***** TOMOYO Linux start. *****/ |
332 |
kumaneko |
1128 |
+ if (!error && (ia_valid & ATTR_MODE) && |
333 |
kumaneko |
2282 |
+ !ccs_capable(CCS_SYS_CHMOD)) |
334 |
kumaneko |
1128 |
+ error = -EPERM; |
335 |
|
|
+ if (!error && (ia_valid & (ATTR_UID | ATTR_GID)) && |
336 |
kumaneko |
2282 |
+ !ccs_capable(CCS_SYS_CHOWN)) |
337 |
kumaneko |
1128 |
+ error = -EPERM; |
338 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
339 |
|
|
if (!error) { |
340 |
|
|
if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) || |
341 |
|
|
(ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) |
342 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/compat.c |
343 |
|
|
+++ linux-2.6.21.7/fs/compat.c |
344 |
kumaneko |
193 |
@@ -56,6 +56,9 @@ |
345 |
|
|
#include <asm/mmu_context.h> |
346 |
|
|
#include <asm/ioctls.h> |
347 |
|
|
#include "internal.h" |
348 |
|
|
+/***** TOMOYO Linux start. *****/ |
349 |
|
|
+#include <linux/tomoyo.h> |
350 |
|
|
+/***** TOMOYO Linux end. *****/ |
351 |
|
|
|
352 |
|
|
int compat_log = 1; |
353 |
|
|
|
354 |
kumaneko |
2279 |
@@ -398,6 +401,10 @@ asmlinkage long compat_sys_ioctl(unsigne |
355 |
|
|
|
356 |
|
|
/* RED-PEN how should LSM module know it's handling 32bit? */ |
357 |
|
|
error = security_file_ioctl(filp, cmd, arg); |
358 |
|
|
+ /***** TOMOYO Linux start. *****/ |
359 |
|
|
+ if (!error) |
360 |
|
|
+ error = ccs_check_ioctl_permission(filp, cmd, arg); |
361 |
|
|
+ /***** TOMOYO Linux end. *****/ |
362 |
|
|
if (error) |
363 |
|
|
goto out_fput; |
364 |
|
|
|
365 |
|
|
@@ -422,6 +429,12 @@ asmlinkage long compat_sys_ioctl(unsigne |
366 |
kumaneko |
193 |
/*FALL THROUGH*/ |
367 |
|
|
|
368 |
|
|
default: |
369 |
|
|
+ /***** TOMOYO Linux start. *****/ |
370 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_IOCTL)) { |
371 |
kumaneko |
1128 |
+ error = -EPERM; |
372 |
|
|
+ goto out_fput; |
373 |
|
|
+ } |
374 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
375 |
|
|
if (filp->f_op && filp->f_op->compat_ioctl) { |
376 |
|
|
error = filp->f_op->compat_ioctl(filp, cmd, arg); |
377 |
|
|
if (error != -ENOIOCTLCMD) |
378 |
kumaneko |
2279 |
@@ -1552,7 +1565,7 @@ int compat_do_execve(char * filename, |
379 |
kumaneko |
193 |
if (retval < 0) |
380 |
|
|
goto out; |
381 |
|
|
|
382 |
|
|
- retval = search_binary_handler(bprm, regs); |
383 |
|
|
+ retval = search_binary_handler_with_transition(bprm, regs); |
384 |
|
|
if (retval >= 0) { |
385 |
|
|
free_arg_pages(bprm); |
386 |
|
|
|
387 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/exec.c |
388 |
|
|
+++ linux-2.6.21.7/fs/exec.c |
389 |
kumaneko |
193 |
@@ -58,6 +58,10 @@ |
390 |
|
|
#include <linux/kmod.h> |
391 |
|
|
#endif |
392 |
|
|
|
393 |
|
|
+/***** TOMOYO Linux start. *****/ |
394 |
|
|
+#include <linux/tomoyo.h> |
395 |
|
|
+/***** TOMOYO Linux end. *****/ |
396 |
|
|
+ |
397 |
|
|
int core_uses_pid; |
398 |
|
|
char core_pattern[128] = "core"; |
399 |
|
|
int suid_dumpable = 0; |
400 |
kumaneko |
1128 |
@@ -140,6 +144,13 @@ asmlinkage long sys_uselib(const char __ |
401 |
kumaneko |
193 |
if (error) |
402 |
|
|
goto exit; |
403 |
|
|
|
404 |
|
|
+ /***** TOMOYO Linux start. *****/ |
405 |
kumaneko |
1128 |
+ /* 01 means "read". */ |
406 |
|
|
+ error = ccs_check_open_permission(nd.dentry, nd.mnt, 01); |
407 |
|
|
+ if (error) |
408 |
|
|
+ goto exit; |
409 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
410 |
|
|
+ |
411 |
|
|
file = nameidata_to_filp(&nd, O_RDONLY); |
412 |
|
|
error = PTR_ERR(file); |
413 |
|
|
if (IS_ERR(file)) |
414 |
kumaneko |
1128 |
@@ -485,6 +496,13 @@ struct file *open_exec(const char *name) |
415 |
kumaneko |
193 |
if (!(nd.mnt->mnt_flags & MNT_NOEXEC) && |
416 |
|
|
S_ISREG(inode->i_mode)) { |
417 |
|
|
int err = vfs_permission(&nd, MAY_EXEC); |
418 |
|
|
+ /***** TOMOYO Linux start. *****/ |
419 |
kumaneko |
2282 |
+ if (!err && (current->ccs_flags & |
420 |
|
|
+ CCS_CHECK_READ_FOR_OPEN_EXEC)) |
421 |
kumaneko |
1128 |
+ /* 01 means "read". */ |
422 |
|
|
+ err = ccs_check_open_permission(nd.dentry, |
423 |
|
|
+ nd.mnt, 01); |
424 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
425 |
|
|
file = ERR_PTR(err); |
426 |
|
|
if (!err) { |
427 |
|
|
file = nameidata_to_filp(&nd, O_RDONLY); |
428 |
kumaneko |
1128 |
@@ -1183,7 +1201,7 @@ int do_execve(char * filename, |
429 |
kumaneko |
193 |
if (retval < 0) |
430 |
|
|
goto out; |
431 |
|
|
|
432 |
|
|
- retval = search_binary_handler(bprm,regs); |
433 |
kumaneko |
1128 |
+ retval = search_binary_handler_with_transition(bprm, regs); |
434 |
kumaneko |
193 |
if (retval >= 0) { |
435 |
|
|
free_arg_pages(bprm); |
436 |
|
|
|
437 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/fcntl.c |
438 |
|
|
+++ linux-2.6.21.7/fs/fcntl.c |
439 |
kumaneko |
193 |
@@ -22,6 +22,9 @@ |
440 |
|
|
#include <asm/poll.h> |
441 |
|
|
#include <asm/siginfo.h> |
442 |
|
|
#include <asm/uaccess.h> |
443 |
|
|
+/***** TOMOYO Linux start. *****/ |
444 |
|
|
+#include <linux/tomoyo.h> |
445 |
|
|
+/***** TOMOYO Linux end. *****/ |
446 |
|
|
|
447 |
|
|
void fastcall set_close_on_exec(unsigned int fd, int flag) |
448 |
|
|
{ |
449 |
kumaneko |
1128 |
@@ -213,6 +216,12 @@ static int setfl(int fd, struct file * f |
450 |
kumaneko |
193 |
if (((arg ^ filp->f_flags) & O_APPEND) && IS_APPEND(inode)) |
451 |
|
|
return -EPERM; |
452 |
|
|
|
453 |
|
|
+ /***** TOMOYO Linux start. *****/ |
454 |
kumaneko |
1128 |
+ if (((arg ^ filp->f_flags) & O_APPEND) && |
455 |
|
|
+ ccs_check_rewrite_permission(filp)) |
456 |
|
|
+ return -EPERM; |
457 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
458 |
|
|
+ |
459 |
|
|
/* O_NOATIME can only be set by the owner or superuser */ |
460 |
|
|
if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME)) |
461 |
|
|
if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER)) |
462 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/ioctl.c |
463 |
|
|
+++ linux-2.6.21.7/fs/ioctl.c |
464 |
kumaneko |
193 |
@@ -15,6 +15,9 @@ |
465 |
|
|
|
466 |
|
|
#include <asm/uaccess.h> |
467 |
|
|
#include <asm/ioctls.h> |
468 |
|
|
+/***** TOMOYO Linux start. *****/ |
469 |
|
|
+#include <linux/tomoyo.h> |
470 |
|
|
+/***** TOMOYO Linux end. *****/ |
471 |
|
|
|
472 |
|
|
static long do_ioctl(struct file *filp, unsigned int cmd, |
473 |
|
|
unsigned long arg) |
474 |
kumaneko |
1128 |
@@ -23,6 +26,10 @@ static long do_ioctl(struct file *filp, |
475 |
kumaneko |
193 |
|
476 |
|
|
if (!filp->f_op) |
477 |
|
|
goto out; |
478 |
|
|
+ /***** TOMOYO Linux start. *****/ |
479 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_IOCTL)) |
480 |
kumaneko |
1128 |
+ return -EPERM; |
481 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
482 |
|
|
|
483 |
|
|
if (filp->f_op->unlocked_ioctl) { |
484 |
|
|
error = filp->f_op->unlocked_ioctl(filp, cmd, arg); |
485 |
kumaneko |
2279 |
@@ -167,6 +174,10 @@ asmlinkage long sys_ioctl(unsigned int f |
486 |
|
|
goto out; |
487 |
|
|
|
488 |
|
|
error = security_file_ioctl(filp, cmd, arg); |
489 |
|
|
+ /***** TOMOYO Linux start. *****/ |
490 |
|
|
+ if (!error) |
491 |
|
|
+ error = ccs_check_ioctl_permission(filp, cmd, arg); |
492 |
|
|
+ /***** TOMOYO Linux end. *****/ |
493 |
|
|
if (error) |
494 |
|
|
goto out_fput; |
495 |
|
|
|
496 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/namei.c |
497 |
|
|
+++ linux-2.6.21.7/fs/namei.c |
498 |
kumaneko |
193 |
@@ -37,6 +37,10 @@ |
499 |
|
|
|
500 |
|
|
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) |
501 |
|
|
|
502 |
|
|
+/***** TOMOYO Linux start. *****/ |
503 |
|
|
+#include <linux/tomoyo.h> |
504 |
|
|
+/***** TOMOYO Linux end. *****/ |
505 |
|
|
+ |
506 |
|
|
/* [Feb-1997 T. Schoebel-Theuer] |
507 |
|
|
* Fundamental changes in the pathname lookup mechanisms (namei) |
508 |
|
|
* were necessary because of omirr. The reason is that omirr needs |
509 |
kumaneko |
2297 |
@@ -1561,6 +1565,13 @@ int may_open(struct nameidata *nd, int a |
510 |
kumaneko |
193 |
if (current->fsuid != inode->i_uid && !capable(CAP_FOWNER)) |
511 |
|
|
return -EPERM; |
512 |
|
|
|
513 |
kumaneko |
449 |
+ /***** TOMOYO Linux start. *****/ |
514 |
kumaneko |
1128 |
+ /* includes O_APPEND and O_TRUNC checks */ |
515 |
|
|
+ error = ccs_check_open_permission(dentry, nd->mnt, flag); |
516 |
|
|
+ if (error) |
517 |
|
|
+ return error; |
518 |
kumaneko |
449 |
+ /***** TOMOYO Linux end. *****/ |
519 |
kumaneko |
193 |
+ |
520 |
|
|
/* |
521 |
|
|
* Ensure there are no outstanding leases on the file. |
522 |
|
|
*/ |
523 |
kumaneko |
2297 |
@@ -1600,6 +1611,11 @@ static int open_namei_create(struct name |
524 |
|
|
|
525 |
|
|
if (!IS_POSIXACL(dir->d_inode)) |
526 |
|
|
mode &= ~current->fs->umask; |
527 |
|
|
+ /***** TOMOYO Linux start. *****/ |
528 |
kumaneko |
2299 |
+ error = ccs_check_mknod_permission(dir->d_inode, path->dentry, nd->mnt, |
529 |
|
|
+ mode, 0); |
530 |
kumaneko |
2297 |
+ if (!error) |
531 |
|
|
+ /***** TOMOYO Linux end. *****/ |
532 |
|
|
error = vfs_create(dir->d_inode, path->dentry, mode, nd); |
533 |
|
|
mutex_unlock(&dir->d_inode->i_mutex); |
534 |
|
|
dput(nd->dentry); |
535 |
|
|
@@ -1610,6 +1626,9 @@ static int open_namei_create(struct name |
536 |
kumaneko |
193 |
return may_open(nd, 0, flag & ~O_TRUNC); |
537 |
|
|
} |
538 |
|
|
|
539 |
|
|
+/***** TOMOYO Linux start. *****/ |
540 |
|
|
+#include <linux/tomoyo_vfs.h> |
541 |
|
|
+/***** TOMOYO Linux end. *****/ |
542 |
|
|
/* |
543 |
|
|
* open_namei() |
544 |
|
|
* |
545 |
kumaneko |
2297 |
@@ -1883,6 +1902,12 @@ asmlinkage long sys_mknodat(int dfd, con |
546 |
|
|
if (!IS_POSIXACL(nd.dentry->d_inode)) |
547 |
|
|
mode &= ~current->fs->umask; |
548 |
|
|
if (!IS_ERR(dentry)) { |
549 |
|
|
+ /***** TOMOYO Linux start. *****/ |
550 |
kumaneko |
2299 |
+ error = ccs_check_mknod_permission(nd.dentry->d_inode, dentry, |
551 |
|
|
+ nd.mnt, mode, |
552 |
kumaneko |
2297 |
+ new_decode_dev(dev)); |
553 |
|
|
+ if (!error) |
554 |
|
|
+ /***** TOMOYO Linux end. *****/ |
555 |
|
|
switch (mode & S_IFMT) { |
556 |
|
|
case 0: case S_IFREG: |
557 |
kumaneko |
193 |
error = vfs_create(nd.dentry->d_inode,dentry,mode,&nd); |
558 |
kumaneko |
2297 |
@@ -1959,6 +1984,11 @@ asmlinkage long sys_mkdirat(int dfd, con |
559 |
kumaneko |
193 |
|
560 |
|
|
if (!IS_POSIXACL(nd.dentry->d_inode)) |
561 |
|
|
mode &= ~current->fs->umask; |
562 |
|
|
+ /***** TOMOYO Linux start. *****/ |
563 |
kumaneko |
2297 |
+ error = ccs_check_mkdir_permission(nd.dentry->d_inode, dentry, nd.mnt, |
564 |
|
|
+ mode); |
565 |
kumaneko |
1128 |
+ if (!error) |
566 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
567 |
|
|
error = vfs_mkdir(nd.dentry->d_inode, dentry, mode); |
568 |
|
|
dput(dentry); |
569 |
|
|
out_unlock: |
570 |
kumaneko |
2297 |
@@ -2066,6 +2096,10 @@ static long do_rmdir(int dfd, const char |
571 |
kumaneko |
193 |
error = PTR_ERR(dentry); |
572 |
|
|
if (IS_ERR(dentry)) |
573 |
|
|
goto exit2; |
574 |
|
|
+ /***** TOMOYO Linux start. *****/ |
575 |
kumaneko |
2297 |
+ error = ccs_check_rmdir_permission(nd.dentry->d_inode, dentry, nd.mnt); |
576 |
kumaneko |
1128 |
+ if (!error) |
577 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
578 |
|
|
error = vfs_rmdir(nd.dentry->d_inode, dentry); |
579 |
|
|
dput(dentry); |
580 |
|
|
exit2: |
581 |
kumaneko |
2297 |
@@ -2146,6 +2180,11 @@ static long do_unlinkat(int dfd, const c |
582 |
kumaneko |
193 |
inode = dentry->d_inode; |
583 |
|
|
if (inode) |
584 |
|
|
atomic_inc(&inode->i_count); |
585 |
|
|
+ /***** TOMOYO Linux start. *****/ |
586 |
kumaneko |
2297 |
+ error = ccs_check_unlink_permission(nd.dentry->d_inode, dentry, |
587 |
|
|
+ nd.mnt); |
588 |
|
|
+ if (!error) |
589 |
kumaneko |
993 |
+ /***** TOMOYO Linux end. *****/ |
590 |
kumaneko |
193 |
error = vfs_unlink(nd.dentry->d_inode, dentry); |
591 |
|
|
exit2: |
592 |
|
|
dput(dentry); |
593 |
kumaneko |
2297 |
@@ -2227,6 +2266,11 @@ asmlinkage long sys_symlinkat(const char |
594 |
kumaneko |
193 |
if (IS_ERR(dentry)) |
595 |
|
|
goto out_unlock; |
596 |
|
|
|
597 |
|
|
+ /***** TOMOYO Linux start. *****/ |
598 |
kumaneko |
2297 |
+ error = ccs_check_symlink_permission(nd.dentry->d_inode, dentry, |
599 |
|
|
+ nd.mnt, from); |
600 |
kumaneko |
1128 |
+ if (!error) |
601 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
602 |
|
|
error = vfs_symlink(nd.dentry->d_inode, dentry, from, S_IALLUGO); |
603 |
|
|
dput(dentry); |
604 |
|
|
out_unlock: |
605 |
kumaneko |
2297 |
@@ -2322,6 +2366,11 @@ asmlinkage long sys_linkat(int olddfd, c |
606 |
kumaneko |
193 |
error = PTR_ERR(new_dentry); |
607 |
|
|
if (IS_ERR(new_dentry)) |
608 |
|
|
goto out_unlock; |
609 |
|
|
+ /***** TOMOYO Linux start. *****/ |
610 |
kumaneko |
2297 |
+ error = ccs_check_link_permission(old_nd.dentry, nd.dentry->d_inode, |
611 |
|
|
+ new_dentry, nd.mnt); |
612 |
kumaneko |
1128 |
+ if (!error) |
613 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
614 |
|
|
error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); |
615 |
|
|
dput(new_dentry); |
616 |
|
|
out_unlock: |
617 |
kumaneko |
2297 |
@@ -2547,6 +2596,12 @@ static int do_rename(int olddfd, const c |
618 |
kumaneko |
193 |
error = -ENOTEMPTY; |
619 |
|
|
if (new_dentry == trap) |
620 |
|
|
goto exit5; |
621 |
|
|
+ /***** TOMOYO Linux start. *****/ |
622 |
kumaneko |
2297 |
+ error = ccs_check_rename_permission(old_dir->d_inode, old_dentry, |
623 |
|
|
+ new_dir->d_inode, new_dentry, |
624 |
|
|
+ newnd.mnt); |
625 |
|
|
+ if (!error) |
626 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
627 |
|
|
|
628 |
|
|
error = vfs_rename(old_dir->d_inode, old_dentry, |
629 |
|
|
new_dir->d_inode, new_dentry); |
630 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/namespace.c |
631 |
|
|
+++ linux-2.6.21.7/fs/namespace.c |
632 |
kumaneko |
193 |
@@ -28,6 +28,12 @@ |
633 |
|
|
#include <asm/uaccess.h> |
634 |
|
|
#include <asm/unistd.h> |
635 |
|
|
#include "pnode.h" |
636 |
|
|
+/***** SAKURA Linux start. *****/ |
637 |
|
|
+#include <linux/sakura.h> |
638 |
|
|
+/***** SAKURA Linux end. *****/ |
639 |
|
|
+/***** TOMOYO Linux start. *****/ |
640 |
|
|
+#include <linux/tomoyo.h> |
641 |
|
|
+/***** TOMOYO Linux end. *****/ |
642 |
|
|
|
643 |
|
|
/* spinlock for vfsmount related operations, inplace of dcache_lock */ |
644 |
|
|
__cacheline_aligned_in_smp DEFINE_SPINLOCK(vfsmount_lock); |
645 |
kumaneko |
1128 |
@@ -545,6 +551,11 @@ static int do_umount(struct vfsmount *mn |
646 |
kumaneko |
193 |
if (retval) |
647 |
|
|
return retval; |
648 |
|
|
|
649 |
|
|
+ /***** SAKURA Linux start. *****/ |
650 |
kumaneko |
1128 |
+ if (ccs_may_umount(mnt)) |
651 |
|
|
+ return -EPERM; |
652 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
653 |
|
|
+ |
654 |
|
|
/* |
655 |
|
|
* Allow userspace to request a mountpoint be expired rather than |
656 |
|
|
* unmounting unconditionally. Unmount only happens if: |
657 |
kumaneko |
1128 |
@@ -633,6 +644,10 @@ asmlinkage long sys_umount(char __user * |
658 |
kumaneko |
193 |
{ |
659 |
|
|
struct nameidata nd; |
660 |
|
|
int retval; |
661 |
|
|
+ /***** TOMOYO Linux start. *****/ |
662 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_UMOUNT)) |
663 |
kumaneko |
1128 |
+ return -EPERM; |
664 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
665 |
|
|
|
666 |
|
|
retval = __user_walk(name, LOOKUP_FOLLOW, &nd); |
667 |
|
|
if (retval) |
668 |
kumaneko |
1128 |
@@ -917,6 +932,11 @@ static int do_loopback(struct nameidata |
669 |
kumaneko |
193 |
|
670 |
|
|
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
671 |
|
|
goto out; |
672 |
|
|
+ /***** SAKURA Linux start. *****/ |
673 |
|
|
+ err = -EPERM; |
674 |
kumaneko |
1128 |
+ if (ccs_may_mount(nd)) |
675 |
|
|
+ goto out; |
676 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
677 |
|
|
|
678 |
|
|
err = -ENOMEM; |
679 |
|
|
if (recurse) |
680 |
kumaneko |
1128 |
@@ -1002,6 +1022,11 @@ static int do_move_mount(struct nameidat |
681 |
kumaneko |
193 |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
682 |
|
|
goto out; |
683 |
|
|
|
684 |
|
|
+ /***** SAKURA Linux start. *****/ |
685 |
|
|
+ err = -EPERM; |
686 |
kumaneko |
1128 |
+ if (ccs_may_umount(old_nd.mnt) || ccs_may_mount(nd)) |
687 |
|
|
+ goto out; |
688 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
689 |
|
|
err = -ENOENT; |
690 |
|
|
mutex_lock(&nd->dentry->d_inode->i_mutex); |
691 |
|
|
if (IS_DEADDIR(nd->dentry->d_inode)) |
692 |
kumaneko |
1128 |
@@ -1103,6 +1128,11 @@ int do_add_mount(struct vfsmount *newmnt |
693 |
kumaneko |
193 |
err = -EINVAL; |
694 |
|
|
if (S_ISLNK(newmnt->mnt_root->d_inode->i_mode)) |
695 |
|
|
goto unlock; |
696 |
|
|
+ /***** SAKURA Linux start. *****/ |
697 |
|
|
+ err = -EPERM; |
698 |
kumaneko |
1128 |
+ if (ccs_may_mount(nd)) |
699 |
|
|
+ goto unlock; |
700 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
701 |
|
|
|
702 |
|
|
newmnt->mnt_flags = mnt_flags; |
703 |
|
|
if ((err = graft_tree(newmnt, nd))) |
704 |
kumaneko |
1128 |
@@ -1394,6 +1424,17 @@ long do_mount(char *dev_name, char *dir_ |
705 |
kumaneko |
193 |
if (data_page) |
706 |
|
|
((char *)data_page)[PAGE_SIZE - 1] = 0; |
707 |
|
|
|
708 |
|
|
+ /***** TOMOYO Linux start. *****/ |
709 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_MOUNT)) |
710 |
kumaneko |
1128 |
+ return -EPERM; |
711 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
712 |
|
|
+ /***** SAKURA Linux start. *****/ |
713 |
kumaneko |
1128 |
+ retval = ccs_check_mount_permission(dev_name, dir_name, type_page, |
714 |
|
|
+ &flags); |
715 |
|
|
+ if (retval) |
716 |
|
|
+ return retval; |
717 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
718 |
|
|
+ |
719 |
|
|
/* Separate the per-mountpoint flags */ |
720 |
|
|
if (flags & MS_NOSUID) |
721 |
|
|
mnt_flags |= MNT_NOSUID; |
722 |
kumaneko |
1128 |
@@ -1686,6 +1727,10 @@ asmlinkage long sys_pivot_root(const cha |
723 |
kumaneko |
193 |
|
724 |
|
|
if (!capable(CAP_SYS_ADMIN)) |
725 |
|
|
return -EPERM; |
726 |
|
|
+ /***** TOMOYO Linux start. *****/ |
727 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PIVOT_ROOT)) |
728 |
kumaneko |
1128 |
+ return -EPERM; |
729 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
730 |
|
|
|
731 |
|
|
lock_kernel(); |
732 |
|
|
|
733 |
kumaneko |
1128 |
@@ -1702,6 +1747,10 @@ asmlinkage long sys_pivot_root(const cha |
734 |
kumaneko |
193 |
goto out1; |
735 |
|
|
|
736 |
|
|
error = security_sb_pivotroot(&old_nd, &new_nd); |
737 |
|
|
+ /***** SAKURA Linux start. *****/ |
738 |
kumaneko |
1128 |
+ if (!error) |
739 |
|
|
+ error = ccs_check_pivot_root_permission(&old_nd, &new_nd); |
740 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
741 |
|
|
if (error) { |
742 |
|
|
path_release(&old_nd); |
743 |
|
|
goto out1; |
744 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/open.c |
745 |
|
|
+++ linux-2.6.21.7/fs/open.c |
746 |
kumaneko |
193 |
@@ -27,6 +27,12 @@ |
747 |
|
|
#include <linux/syscalls.h> |
748 |
|
|
#include <linux/rcupdate.h> |
749 |
|
|
#include <linux/audit.h> |
750 |
|
|
+/***** SAKURA Linux start. *****/ |
751 |
|
|
+#include <linux/sakura.h> |
752 |
|
|
+/***** SAKURA Linux end. *****/ |
753 |
|
|
+/***** TOMOYO Linux start. *****/ |
754 |
|
|
+#include <linux/tomoyo.h> |
755 |
|
|
+/***** TOMOYO Linux end. *****/ |
756 |
|
|
|
757 |
|
|
int vfs_statfs(struct dentry *dentry, struct kstatfs *buf) |
758 |
|
|
{ |
759 |
kumaneko |
1128 |
@@ -264,6 +270,10 @@ static long do_sys_truncate(const char _ |
760 |
kumaneko |
193 |
if (error) |
761 |
|
|
goto dput_and_out; |
762 |
|
|
|
763 |
|
|
+ /***** TOMOYO Linux start. *****/ |
764 |
kumaneko |
2297 |
+ error = ccs_check_truncate_permission(nd.dentry, nd.mnt, length, 0); |
765 |
kumaneko |
1128 |
+ if (!error) |
766 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
767 |
|
|
error = locks_verify_truncate(inode, NULL, length); |
768 |
|
|
if (!error) { |
769 |
|
|
DQUOT_INIT(inode); |
770 |
kumaneko |
2297 |
@@ -317,6 +327,12 @@ static long do_sys_ftruncate(unsigned in |
771 |
kumaneko |
193 |
if (IS_APPEND(inode)) |
772 |
|
|
goto out_putf; |
773 |
|
|
|
774 |
|
|
+ /***** TOMOYO Linux start. *****/ |
775 |
kumaneko |
2297 |
+ error = ccs_check_truncate_permission(dentry, file->f_vfsmnt, length, |
776 |
|
|
+ 0); |
777 |
kumaneko |
1151 |
+ if (error) |
778 |
|
|
+ goto out_putf; |
779 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
780 |
|
|
error = locks_verify_truncate(inode, file, length); |
781 |
|
|
if (!error) |
782 |
|
|
error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); |
783 |
kumaneko |
2297 |
@@ -481,6 +497,14 @@ asmlinkage long sys_chroot(const char __ |
784 |
kumaneko |
193 |
error = -EPERM; |
785 |
|
|
if (!capable(CAP_SYS_CHROOT)) |
786 |
|
|
goto dput_and_out; |
787 |
|
|
+ /***** TOMOYO Linux start. *****/ |
788 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_CHROOT)) |
789 |
kumaneko |
1128 |
+ goto dput_and_out; |
790 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
791 |
|
|
+ /***** SAKURA Linux start. *****/ |
792 |
kumaneko |
1128 |
+ if (ccs_check_chroot_permission(&nd)) |
793 |
|
|
+ goto dput_and_out; |
794 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
795 |
|
|
|
796 |
|
|
set_fs_root(current->fs, nd.mnt, nd.dentry); |
797 |
|
|
set_fs_altroot(); |
798 |
kumaneko |
2297 |
@@ -1085,6 +1109,10 @@ EXPORT_SYMBOL(sys_close); |
799 |
kumaneko |
193 |
*/ |
800 |
|
|
asmlinkage long sys_vhangup(void) |
801 |
|
|
{ |
802 |
|
|
+ /***** TOMOYO Linux start. *****/ |
803 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_VHANGUP)) |
804 |
kumaneko |
1128 |
+ return -EPERM; |
805 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
806 |
|
|
if (capable(CAP_SYS_TTY_CONFIG)) { |
807 |
|
|
/* XXX: this needs locking */ |
808 |
|
|
tty_vhangup(current->signal->tty); |
809 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/proc/Makefile |
810 |
|
|
+++ linux-2.6.21.7/fs/proc/Makefile |
811 |
kumaneko |
193 |
@@ -15,3 +15,6 @@ proc-$(CONFIG_PROC_KCORE) += kcore.o |
812 |
|
|
proc-$(CONFIG_PROC_VMCORE) += vmcore.o |
813 |
|
|
proc-$(CONFIG_PROC_DEVICETREE) += proc_devtree.o |
814 |
|
|
proc-$(CONFIG_PRINTK) += kmsg.o |
815 |
|
|
+ |
816 |
|
|
+proc-$(CONFIG_SAKURA) += ccs_proc.o |
817 |
|
|
+proc-$(CONFIG_TOMOYO) += ccs_proc.o |
818 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/fs/proc/proc_misc.c |
819 |
|
|
+++ linux-2.6.21.7/fs/proc/proc_misc.c |
820 |
kumaneko |
1055 |
@@ -747,4 +747,9 @@ void __init proc_misc_init(void) |
821 |
kumaneko |
193 |
entry->proc_fops = &proc_sysrq_trigger_operations; |
822 |
|
|
} |
823 |
|
|
#endif |
824 |
|
|
+ /***** CCS start. *****/ |
825 |
|
|
+#if defined(CONFIG_SAKURA) || defined(CONFIG_TOMOYO) |
826 |
kumaneko |
2279 |
+ printk(KERN_INFO "Hook version: 2.6.21.7 2009/03/18\n"); |
827 |
kumaneko |
193 |
+#endif |
828 |
|
|
+ /***** CCS end. *****/ |
829 |
|
|
} |
830 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/include/linux/init_task.h |
831 |
|
|
+++ linux-2.6.21.7/include/linux/init_task.h |
832 |
kumaneko |
193 |
@@ -141,6 +141,10 @@ extern struct group_info init_groups; |
833 |
|
|
.pi_lock = SPIN_LOCK_UNLOCKED, \ |
834 |
|
|
INIT_TRACE_IRQFLAGS \ |
835 |
|
|
INIT_LOCKDEP \ |
836 |
|
|
+ /***** TOMOYO Linux start. *****/ \ |
837 |
kumaneko |
2282 |
+ .ccs_domain_info = NULL, \ |
838 |
|
|
+ .ccs_flags = 0, \ |
839 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ \ |
840 |
|
|
} |
841 |
|
|
|
842 |
|
|
|
843 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/include/linux/sched.h |
844 |
|
|
+++ linux-2.6.21.7/include/linux/sched.h |
845 |
kumaneko |
2282 |
@@ -27,6 +27,10 @@ |
846 |
kumaneko |
193 |
#define CLONE_NEWUTS 0x04000000 /* New utsname group? */ |
847 |
|
|
#define CLONE_NEWIPC 0x08000000 /* New ipcs */ |
848 |
|
|
|
849 |
|
|
+/***** TOMOYO Linux start. *****/ |
850 |
kumaneko |
2282 |
+struct ccs_domain_info; |
851 |
kumaneko |
193 |
+/***** TOMOYO Linux end. *****/ |
852 |
|
|
+ |
853 |
|
|
/* |
854 |
|
|
* Scheduling policies |
855 |
|
|
*/ |
856 |
kumaneko |
2282 |
@@ -1052,6 +1056,10 @@ struct task_struct { |
857 |
kumaneko |
193 |
#ifdef CONFIG_FAULT_INJECTION |
858 |
|
|
int make_it_fail; |
859 |
|
|
#endif |
860 |
|
|
+ /***** TOMOYO Linux start. *****/ |
861 |
kumaneko |
2282 |
+ struct ccs_domain_info *ccs_domain_info; |
862 |
|
|
+ u32 ccs_flags; |
863 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
864 |
|
|
}; |
865 |
|
|
|
866 |
|
|
static inline pid_t process_group(struct task_struct *tsk) |
867 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/compat.c |
868 |
|
|
+++ linux-2.6.21.7/kernel/compat.c |
869 |
kumaneko |
290 |
@@ -25,6 +25,9 @@ |
870 |
|
|
#include <linux/posix-timers.h> |
871 |
|
|
|
872 |
|
|
#include <asm/uaccess.h> |
873 |
|
|
+/***** TOMOYO Linux start. *****/ |
874 |
|
|
+#include <linux/tomoyo.h> |
875 |
|
|
+/***** TOMOYO Linux end. *****/ |
876 |
|
|
|
877 |
|
|
int get_compat_timespec(struct timespec *ts, const struct compat_timespec __user *cts) |
878 |
|
|
{ |
879 |
kumaneko |
1128 |
@@ -869,6 +872,10 @@ asmlinkage long compat_sys_stime(compat_ |
880 |
kumaneko |
290 |
err = security_settime(&tv, NULL); |
881 |
|
|
if (err) |
882 |
|
|
return err; |
883 |
|
|
+ /***** TOMOYO Linux start. *****/ |
884 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETTIME)) |
885 |
kumaneko |
1128 |
+ return -EPERM; |
886 |
kumaneko |
290 |
+ /***** TOMOYO Linux end. *****/ |
887 |
|
|
|
888 |
|
|
do_settimeofday(&tv); |
889 |
|
|
return 0; |
890 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/kexec.c |
891 |
|
|
+++ linux-2.6.21.7/kernel/kexec.c |
892 |
kumaneko |
193 |
@@ -28,6 +28,9 @@ |
893 |
|
|
#include <asm/io.h> |
894 |
|
|
#include <asm/system.h> |
895 |
|
|
#include <asm/semaphore.h> |
896 |
|
|
+/***** TOMOYO Linux start. *****/ |
897 |
|
|
+#include <linux/tomoyo.h> |
898 |
|
|
+/***** TOMOYO Linux end. *****/ |
899 |
|
|
|
900 |
|
|
/* Per cpu memory for storing cpu states in case of system crash. */ |
901 |
|
|
note_buf_t* crash_notes; |
902 |
kumaneko |
1128 |
@@ -924,6 +927,10 @@ asmlinkage long sys_kexec_load(unsigned |
903 |
kumaneko |
193 |
/* We only trust the superuser with rebooting the system. */ |
904 |
|
|
if (!capable(CAP_SYS_BOOT)) |
905 |
|
|
return -EPERM; |
906 |
|
|
+ /***** TOMOYO Linux start. *****/ |
907 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_KEXEC_LOAD)) |
908 |
kumaneko |
1128 |
+ return -EPERM; |
909 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
910 |
|
|
|
911 |
|
|
/* |
912 |
|
|
* Verify we have a legal set of flags |
913 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/kmod.c |
914 |
|
|
+++ linux-2.6.21.7/kernel/kmod.c |
915 |
kumaneko |
193 |
@@ -166,6 +166,11 @@ static int ____call_usermodehelper(void |
916 |
|
|
/* We can run anywhere, unlike our parent keventd(). */ |
917 |
|
|
set_cpus_allowed(current, CPU_MASK_ALL); |
918 |
|
|
|
919 |
|
|
+ /***** TOMOYO Linux start. *****/ |
920 |
kumaneko |
2282 |
+ current->ccs_domain_info = NULL; |
921 |
|
|
+ current->ccs_flags = 0; |
922 |
kumaneko |
212 |
+ /***** TOMOYO Linux end. *****/ |
923 |
kumaneko |
193 |
+ |
924 |
|
|
retval = -EPERM; |
925 |
|
|
if (current->fs->root) |
926 |
|
|
retval = kernel_execve(sub_info->path, |
927 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/module.c |
928 |
|
|
+++ linux-2.6.21.7/kernel/module.c |
929 |
kumaneko |
193 |
@@ -44,6 +44,9 @@ |
930 |
|
|
#include <asm/semaphore.h> |
931 |
|
|
#include <asm/cacheflush.h> |
932 |
|
|
#include <linux/license.h> |
933 |
|
|
+/***** TOMOYO Linux start. *****/ |
934 |
|
|
+#include <linux/tomoyo.h> |
935 |
|
|
+/***** TOMOYO Linux end. *****/ |
936 |
|
|
|
937 |
|
|
#if 0 |
938 |
|
|
#define DEBUGP printk |
939 |
kumaneko |
1128 |
@@ -662,6 +665,10 @@ sys_delete_module(const char __user *nam |
940 |
kumaneko |
193 |
|
941 |
|
|
if (!capable(CAP_SYS_MODULE)) |
942 |
|
|
return -EPERM; |
943 |
|
|
+ /***** TOMOYO Linux start. *****/ |
944 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_USE_KERNEL_MODULE)) |
945 |
kumaneko |
1128 |
+ return -EPERM; |
946 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
947 |
|
|
|
948 |
|
|
if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0) |
949 |
|
|
return -EFAULT; |
950 |
kumaneko |
1128 |
@@ -1983,6 +1990,10 @@ sys_init_module(void __user *umod, |
951 |
kumaneko |
193 |
/* Must have permission */ |
952 |
|
|
if (!capable(CAP_SYS_MODULE)) |
953 |
|
|
return -EPERM; |
954 |
|
|
+ /***** TOMOYO Linux start. *****/ |
955 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_USE_KERNEL_MODULE)) |
956 |
kumaneko |
1128 |
+ return -EPERM; |
957 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
958 |
|
|
|
959 |
|
|
/* Only one module load at a time, please */ |
960 |
|
|
if (mutex_lock_interruptible(&module_mutex) != 0) |
961 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/ptrace.c |
962 |
|
|
+++ linux-2.6.21.7/kernel/ptrace.c |
963 |
kumaneko |
863 |
@@ -21,6 +21,9 @@ |
964 |
|
|
|
965 |
|
|
#include <asm/pgtable.h> |
966 |
|
|
#include <asm/uaccess.h> |
967 |
|
|
+/***** TOMOYO Linux start. *****/ |
968 |
|
|
+#include <linux/tomoyo.h> |
969 |
|
|
+/***** TOMOYO Linux end. *****/ |
970 |
|
|
|
971 |
|
|
/* |
972 |
|
|
* ptrace a task: make the debugger its new parent and |
973 |
kumaneko |
2278 |
@@ -456,6 +459,10 @@ asmlinkage long sys_ptrace(long request, |
974 |
kumaneko |
863 |
/* |
975 |
|
|
* This lock_kernel fixes a subtle race with suid exec |
976 |
|
|
*/ |
977 |
|
|
+ /***** TOMOYO Linux start. *****/ |
978 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
979 |
kumaneko |
1128 |
+ return -EPERM; |
980 |
kumaneko |
863 |
+ /***** TOMOYO Linux end. *****/ |
981 |
|
|
lock_kernel(); |
982 |
|
|
if (request == PTRACE_TRACEME) { |
983 |
|
|
ret = ptrace_traceme(); |
984 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/sched.c |
985 |
|
|
+++ linux-2.6.21.7/kernel/sched.c |
986 |
kumaneko |
193 |
@@ -55,6 +55,9 @@ |
987 |
|
|
#include <asm/tlb.h> |
988 |
|
|
|
989 |
|
|
#include <asm/unistd.h> |
990 |
|
|
+/***** TOMOYO Linux start. *****/ |
991 |
|
|
+#include <linux/tomoyo.h> |
992 |
|
|
+/***** TOMOYO Linux end. *****/ |
993 |
|
|
|
994 |
|
|
/* |
995 |
|
|
* Scheduler clock - returns current time in nanosec units. |
996 |
kumaneko |
1498 |
@@ -3964,6 +3967,10 @@ int can_nice(const struct task_struct *p |
997 |
kumaneko |
193 |
asmlinkage long sys_nice(int increment) |
998 |
|
|
{ |
999 |
|
|
long nice, retval; |
1000 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1001 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_NICE)) |
1002 |
kumaneko |
1128 |
+ return -EPERM; |
1003 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1004 |
|
|
|
1005 |
|
|
/* |
1006 |
|
|
* Setpriority might change our priority at the same moment. |
1007 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/signal.c |
1008 |
|
|
+++ linux-2.6.21.7/kernel/signal.c |
1009 |
kumaneko |
193 |
@@ -32,6 +32,9 @@ |
1010 |
|
|
#include <asm/unistd.h> |
1011 |
|
|
#include <asm/siginfo.h> |
1012 |
|
|
#include "audit.h" /* audit_signal_info() */ |
1013 |
|
|
+/***** TOMOYO Linux start. *****/ |
1014 |
|
|
+#include <linux/tomoyo.h> |
1015 |
|
|
+/***** TOMOYO Linux end. *****/ |
1016 |
|
|
|
1017 |
|
|
/* |
1018 |
|
|
* SLAB caches for signal bits. |
1019 |
kumaneko |
1128 |
@@ -2235,6 +2238,12 @@ asmlinkage long |
1020 |
kumaneko |
193 |
sys_kill(int pid, int sig) |
1021 |
|
|
{ |
1022 |
|
|
struct siginfo info; |
1023 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1024 |
kumaneko |
2282 |
+ if (sig && !ccs_capable(CCS_SYS_KILL)) |
1025 |
kumaneko |
1128 |
+ return -EPERM; |
1026 |
|
|
+ if (sig && ccs_check_signal_acl(sig, pid)) |
1027 |
|
|
+ return -EPERM; |
1028 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1029 |
|
|
|
1030 |
|
|
info.si_signo = sig; |
1031 |
|
|
info.si_errno = 0; |
1032 |
kumaneko |
1128 |
@@ -2293,6 +2302,12 @@ asmlinkage long sys_tgkill(int tgid, int |
1033 |
kumaneko |
193 |
/* This is only valid for single tasks */ |
1034 |
|
|
if (pid <= 0 || tgid <= 0) |
1035 |
|
|
return -EINVAL; |
1036 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1037 |
kumaneko |
2282 |
+ if (sig && !ccs_capable(CCS_SYS_KILL)) |
1038 |
kumaneko |
1128 |
+ return -EPERM; |
1039 |
|
|
+ if (sig && ccs_check_signal_acl(sig, pid)) |
1040 |
|
|
+ return -EPERM; |
1041 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1042 |
|
|
|
1043 |
|
|
return do_tkill(tgid, pid, sig); |
1044 |
|
|
} |
1045 |
kumaneko |
1128 |
@@ -2306,6 +2321,12 @@ sys_tkill(int pid, int sig) |
1046 |
kumaneko |
193 |
/* This is only valid for single tasks */ |
1047 |
|
|
if (pid <= 0) |
1048 |
|
|
return -EINVAL; |
1049 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1050 |
kumaneko |
2282 |
+ if (sig && !ccs_capable(CCS_SYS_KILL)) |
1051 |
kumaneko |
1128 |
+ return -EPERM; |
1052 |
|
|
+ if (sig && ccs_check_signal_acl(sig, pid)) |
1053 |
|
|
+ return -EPERM; |
1054 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1055 |
|
|
|
1056 |
|
|
return do_tkill(0, pid, sig); |
1057 |
|
|
} |
1058 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/sys.c |
1059 |
|
|
+++ linux-2.6.21.7/kernel/sys.c |
1060 |
kumaneko |
193 |
@@ -37,6 +37,9 @@ |
1061 |
|
|
#include <asm/uaccess.h> |
1062 |
|
|
#include <asm/io.h> |
1063 |
|
|
#include <asm/unistd.h> |
1064 |
|
|
+/***** TOMOYO Linux start. *****/ |
1065 |
|
|
+#include <linux/tomoyo.h> |
1066 |
|
|
+/***** TOMOYO Linux end. *****/ |
1067 |
|
|
|
1068 |
|
|
#ifndef SET_UNALIGN_CTL |
1069 |
|
|
# define SET_UNALIGN_CTL(a,b) (-EINVAL) |
1070 |
kumaneko |
1151 |
@@ -600,6 +603,12 @@ asmlinkage long sys_setpriority(int whic |
1071 |
kumaneko |
193 |
|
1072 |
|
|
if (which > 2 || which < 0) |
1073 |
|
|
goto out; |
1074 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1075 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_NICE)) { |
1076 |
kumaneko |
1151 |
+ error = -EPERM; |
1077 |
|
|
+ goto out; |
1078 |
|
|
+ } |
1079 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1080 |
|
|
|
1081 |
|
|
/* normalize: avoid signed division (rounding problems) */ |
1082 |
|
|
error = -ESRCH; |
1083 |
kumaneko |
1151 |
@@ -830,6 +839,10 @@ asmlinkage long sys_reboot(int magic1, i |
1084 |
kumaneko |
193 |
magic2 != LINUX_REBOOT_MAGIC2B && |
1085 |
|
|
magic2 != LINUX_REBOOT_MAGIC2C)) |
1086 |
|
|
return -EINVAL; |
1087 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1088 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_REBOOT)) |
1089 |
kumaneko |
1128 |
+ return -EPERM; |
1090 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1091 |
|
|
|
1092 |
|
|
/* Instead of trying to make the power_off code look like |
1093 |
|
|
* halt when pm_power_off is not set do it the easy way. |
1094 |
kumaneko |
1151 |
@@ -1806,6 +1819,10 @@ asmlinkage long sys_sethostname(char __u |
1095 |
kumaneko |
193 |
return -EPERM; |
1096 |
|
|
if (len < 0 || len > __NEW_UTS_LEN) |
1097 |
|
|
return -EINVAL; |
1098 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1099 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETHOSTNAME)) |
1100 |
kumaneko |
1128 |
+ return -EPERM; |
1101 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1102 |
|
|
down_write(&uts_sem); |
1103 |
|
|
errno = -EFAULT; |
1104 |
|
|
if (!copy_from_user(tmp, name, len)) { |
1105 |
kumaneko |
1151 |
@@ -1851,6 +1868,10 @@ asmlinkage long sys_setdomainname(char _ |
1106 |
kumaneko |
193 |
return -EPERM; |
1107 |
|
|
if (len < 0 || len > __NEW_UTS_LEN) |
1108 |
|
|
return -EINVAL; |
1109 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1110 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETHOSTNAME)) |
1111 |
kumaneko |
1128 |
+ return -EPERM; |
1112 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1113 |
|
|
|
1114 |
|
|
down_write(&uts_sem); |
1115 |
|
|
errno = -EFAULT; |
1116 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/sysctl.c |
1117 |
|
|
+++ linux-2.6.21.7/kernel/sysctl.c |
1118 |
kumaneko |
193 |
@@ -48,6 +48,9 @@ |
1119 |
|
|
|
1120 |
|
|
#include <asm/uaccess.h> |
1121 |
|
|
#include <asm/processor.h> |
1122 |
|
|
+/***** TOMOYO Linux start. *****/ |
1123 |
|
|
+#include <linux/tomoyo.h> |
1124 |
|
|
+/***** TOMOYO Linux end. *****/ |
1125 |
|
|
|
1126 |
|
|
extern int proc_nr_files(ctl_table *table, int write, struct file *filp, |
1127 |
|
|
void __user *buffer, size_t *lenp, loff_t *ppos); |
1128 |
kumaneko |
2298 |
@@ -1088,6 +1091,7 @@ struct ctl_table_header *sysctl_head_nex |
1129 |
kumaneko |
193 |
} |
1130 |
|
|
|
1131 |
|
|
#ifdef CONFIG_SYSCTL_SYSCALL |
1132 |
|
|
+ |
1133 |
|
|
int do_sysctl(int __user *name, int nlen, void __user *oldval, size_t __user *oldlenp, |
1134 |
|
|
void __user *newval, size_t newlen) |
1135 |
|
|
{ |
1136 |
kumaneko |
2298 |
@@ -1104,6 +1108,11 @@ int do_sysctl(int __user *name, int nlen |
1137 |
kumaneko |
193 |
|
1138 |
|
|
for (head = sysctl_head_next(NULL); head; |
1139 |
|
|
head = sysctl_head_next(head)) { |
1140 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1141 |
kumaneko |
2298 |
+ error = ccs_parse_table(name, nlen, oldval, newval, |
1142 |
kumaneko |
1128 |
+ head->ctl_table); |
1143 |
|
|
+ if (!error) |
1144 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1145 |
|
|
error = parse_table(name, nlen, oldval, oldlenp, |
1146 |
|
|
newval, newlen, head->ctl_table); |
1147 |
|
|
if (error != -ENOTDIR) { |
1148 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/time.c |
1149 |
|
|
+++ linux-2.6.21.7/kernel/time.c |
1150 |
kumaneko |
193 |
@@ -39,6 +39,9 @@ |
1151 |
|
|
|
1152 |
|
|
#include <asm/uaccess.h> |
1153 |
|
|
#include <asm/unistd.h> |
1154 |
|
|
+/***** TOMOYO Linux start. *****/ |
1155 |
|
|
+#include <linux/tomoyo.h> |
1156 |
|
|
+/***** TOMOYO Linux end. *****/ |
1157 |
|
|
|
1158 |
|
|
/* |
1159 |
|
|
* The timezone where the local system is located. Used as a default by some |
1160 |
kumaneko |
1128 |
@@ -91,6 +94,10 @@ asmlinkage long sys_stime(time_t __user |
1161 |
kumaneko |
193 |
err = security_settime(&tv, NULL); |
1162 |
|
|
if (err) |
1163 |
|
|
return err; |
1164 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1165 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETTIME)) |
1166 |
kumaneko |
1128 |
+ return -EPERM; |
1167 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1168 |
|
|
|
1169 |
|
|
do_settimeofday(&tv); |
1170 |
|
|
return 0; |
1171 |
kumaneko |
1128 |
@@ -161,6 +168,10 @@ int do_sys_settimeofday(struct timespec |
1172 |
kumaneko |
193 |
error = security_settime(tv, tz); |
1173 |
|
|
if (error) |
1174 |
|
|
return error; |
1175 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1176 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETTIME)) |
1177 |
kumaneko |
1128 |
+ return -EPERM; |
1178 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1179 |
|
|
|
1180 |
|
|
if (tz) { |
1181 |
|
|
/* SMP safe, global irq locking makes it work. */ |
1182 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/kernel/time/ntp.c |
1183 |
|
|
+++ linux-2.6.21.7/kernel/time/ntp.c |
1184 |
kumaneko |
862 |
@@ -14,6 +14,9 @@ |
1185 |
|
|
|
1186 |
|
|
#include <asm/div64.h> |
1187 |
|
|
#include <asm/timex.h> |
1188 |
|
|
+/***** TOMOYO Linux start. *****/ |
1189 |
|
|
+#include <linux/tomoyo.h> |
1190 |
|
|
+/***** TOMOYO Linux end. *****/ |
1191 |
|
|
|
1192 |
|
|
/* |
1193 |
|
|
* Timekeeping variables |
1194 |
kumaneko |
1498 |
@@ -201,6 +204,10 @@ int do_adjtimex(struct timex *txc) |
1195 |
kumaneko |
862 |
/* In order to modify anything, you gotta be super-user! */ |
1196 |
|
|
if (txc->modes && !capable(CAP_SYS_TIME)) |
1197 |
|
|
return -EPERM; |
1198 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1199 |
kumaneko |
2282 |
+ if (txc->modes && !ccs_capable(CCS_SYS_SETTIME)) |
1200 |
kumaneko |
1128 |
+ return -EPERM; |
1201 |
kumaneko |
862 |
+ /***** TOMOYO Linux end. *****/ |
1202 |
|
|
|
1203 |
|
|
/* Now we validate the data before disabling interrupts */ |
1204 |
|
|
|
1205 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/net/core/datagram.c |
1206 |
|
|
+++ linux-2.6.21.7/net/core/datagram.c |
1207 |
kumaneko |
352 |
@@ -56,6 +56,11 @@ |
1208 |
|
|
#include <net/sock.h> |
1209 |
|
|
#include <net/tcp_states.h> |
1210 |
|
|
|
1211 |
|
|
+/***** TOMOYO Linux start. *****/ |
1212 |
|
|
+#include <linux/tomoyo.h> |
1213 |
|
|
+#include <linux/tomoyo_socket.h> |
1214 |
|
|
+/***** TOMOYO Linux end. *****/ |
1215 |
|
|
+ |
1216 |
|
|
/* |
1217 |
|
|
* Is a socket 'connection oriented' ? |
1218 |
|
|
*/ |
1219 |
kumaneko |
1128 |
@@ -178,6 +183,12 @@ struct sk_buff *skb_recv_datagram(struct |
1220 |
kumaneko |
352 |
} else |
1221 |
|
|
skb = skb_dequeue(&sk->sk_receive_queue); |
1222 |
|
|
|
1223 |
kumaneko |
449 |
+ /***** TOMOYO Linux start. *****/ |
1224 |
kumaneko |
1128 |
+ error = ccs_socket_recv_datagram_permission(sk, skb, flags); |
1225 |
|
|
+ if (error) |
1226 |
|
|
+ goto no_packet; |
1227 |
kumaneko |
449 |
+ /***** TOMOYO Linux end. *****/ |
1228 |
kumaneko |
352 |
+ |
1229 |
|
|
if (skb) |
1230 |
|
|
return skb; |
1231 |
|
|
|
1232 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/net/ipv4/inet_connection_sock.c |
1233 |
|
|
+++ linux-2.6.21.7/net/ipv4/inet_connection_sock.c |
1234 |
kumaneko |
193 |
@@ -23,6 +23,9 @@ |
1235 |
|
|
#include <net/route.h> |
1236 |
|
|
#include <net/tcp_states.h> |
1237 |
|
|
#include <net/xfrm.h> |
1238 |
|
|
+/***** SAKURA Linux start. *****/ |
1239 |
|
|
+#include <linux/sakura.h> |
1240 |
|
|
+/***** SAKURA Linux end. *****/ |
1241 |
|
|
|
1242 |
|
|
#ifdef INET_CSK_DEBUG |
1243 |
|
|
const char inet_csk_timer_bug_msg[] = "inet_csk BUG: unknown timer value\n"; |
1244 |
kumaneko |
1498 |
@@ -85,6 +88,10 @@ int inet_csk_get_port(struct inet_hashin |
1245 |
kumaneko |
193 |
do { |
1246 |
|
|
head = &hashinfo->bhash[inet_bhashfn(rover, hashinfo->bhash_size)]; |
1247 |
|
|
spin_lock(&head->lock); |
1248 |
|
|
+ /***** SAKURA Linux start. *****/ |
1249 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(rover)) |
1250 |
kumaneko |
1128 |
+ goto next; |
1251 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
1252 |
|
|
inet_bind_bucket_for_each(tb, node, &head->chain) |
1253 |
|
|
if (tb->port == rover) |
1254 |
|
|
goto next; |
1255 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/net/ipv4/inet_hashtables.c |
1256 |
|
|
+++ linux-2.6.21.7/net/ipv4/inet_hashtables.c |
1257 |
kumaneko |
193 |
@@ -22,6 +22,9 @@ |
1258 |
|
|
#include <net/inet_connection_sock.h> |
1259 |
|
|
#include <net/inet_hashtables.h> |
1260 |
|
|
#include <net/ip.h> |
1261 |
|
|
+/***** SAKURA Linux start. *****/ |
1262 |
|
|
+#include <linux/sakura.h> |
1263 |
|
|
+/***** SAKURA Linux end. *****/ |
1264 |
|
|
|
1265 |
|
|
/* |
1266 |
|
|
* Allocate and initialize a new local port bind bucket. |
1267 |
kumaneko |
1128 |
@@ -292,6 +295,10 @@ int inet_hash_connect(struct inet_timewa |
1268 |
kumaneko |
193 |
local_bh_disable(); |
1269 |
|
|
for (i = 1; i <= range; i++) { |
1270 |
|
|
port = low + (i + offset) % range; |
1271 |
|
|
+ /***** SAKURA Linux start. *****/ |
1272 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(port)) |
1273 |
kumaneko |
1128 |
+ continue; |
1274 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
1275 |
|
|
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
1276 |
|
|
spin_lock(&head->lock); |
1277 |
|
|
|
1278 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/net/ipv4/udp.c |
1279 |
|
|
+++ linux-2.6.21.7/net/ipv4/udp.c |
1280 |
kumaneko |
193 |
@@ -102,6 +102,9 @@ |
1281 |
|
|
#include <net/checksum.h> |
1282 |
|
|
#include <net/xfrm.h> |
1283 |
|
|
#include "udp_impl.h" |
1284 |
|
|
+/***** SAKURA Linux start. *****/ |
1285 |
|
|
+#include <linux/sakura.h> |
1286 |
|
|
+/***** SAKURA Linux end. *****/ |
1287 |
|
|
|
1288 |
|
|
/* |
1289 |
|
|
* Snmp MIB for the UDP layer |
1290 |
kumaneko |
1128 |
@@ -162,6 +165,10 @@ int __udp_lib_get_port(struct sock *sk, |
1291 |
kumaneko |
237 |
result = sysctl_local_port_range[0] + |
1292 |
|
|
((result - sysctl_local_port_range[0]) & |
1293 |
|
|
(UDP_HTABLE_SIZE - 1)); |
1294 |
|
|
+ /***** SAKURA Linux start. *****/ |
1295 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(result)) |
1296 |
kumaneko |
1128 |
+ continue; |
1297 |
kumaneko |
237 |
+ /***** SAKURA Linux end. *****/ |
1298 |
|
|
goto gotit; |
1299 |
|
|
} |
1300 |
|
|
size = 0; |
1301 |
kumaneko |
1128 |
@@ -180,6 +187,10 @@ int __udp_lib_get_port(struct sock *sk, |
1302 |
kumaneko |
193 |
result = sysctl_local_port_range[0] |
1303 |
|
|
+ ((result - sysctl_local_port_range[0]) & |
1304 |
|
|
(UDP_HTABLE_SIZE - 1)); |
1305 |
|
|
+ /***** SAKURA Linux start. *****/ |
1306 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(result)) |
1307 |
kumaneko |
1128 |
+ continue; |
1308 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
1309 |
|
|
if (! __udp_lib_lport_inuse(result, udptable)) |
1310 |
|
|
break; |
1311 |
|
|
} |
1312 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/net/ipv6/inet6_hashtables.c |
1313 |
|
|
+++ linux-2.6.21.7/net/ipv6/inet6_hashtables.c |
1314 |
kumaneko |
193 |
@@ -21,6 +21,9 @@ |
1315 |
|
|
#include <net/inet_hashtables.h> |
1316 |
|
|
#include <net/inet6_hashtables.h> |
1317 |
|
|
#include <net/ip.h> |
1318 |
|
|
+/***** SAKURA Linux start. *****/ |
1319 |
|
|
+#include <linux/sakura.h> |
1320 |
|
|
+/***** SAKURA Linux end. *****/ |
1321 |
|
|
|
1322 |
|
|
void __inet6_hash(struct inet_hashinfo *hashinfo, |
1323 |
|
|
struct sock *sk) |
1324 |
kumaneko |
1128 |
@@ -266,6 +269,10 @@ int inet6_hash_connect(struct inet_timew |
1325 |
kumaneko |
193 |
local_bh_disable(); |
1326 |
|
|
for (i = 1; i <= range; i++) { |
1327 |
|
|
port = low + (i + offset) % range; |
1328 |
|
|
+ /***** SAKURA Linux start. *****/ |
1329 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(port)) |
1330 |
kumaneko |
1128 |
+ continue; |
1331 |
kumaneko |
193 |
+ /***** SAKURA Linux end. *****/ |
1332 |
|
|
head = &hinfo->bhash[inet_bhashfn(port, hinfo->bhash_size)]; |
1333 |
|
|
spin_lock(&head->lock); |
1334 |
|
|
|
1335 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/net/socket.c |
1336 |
|
|
+++ linux-2.6.21.7/net/socket.c |
1337 |
kumaneko |
193 |
@@ -93,6 +93,11 @@ |
1338 |
|
|
#include <net/sock.h> |
1339 |
|
|
#include <linux/netfilter.h> |
1340 |
|
|
|
1341 |
|
|
+/***** TOMOYO Linux start. *****/ |
1342 |
|
|
+#include <linux/tomoyo.h> |
1343 |
|
|
+#include <linux/tomoyo_socket.h> |
1344 |
|
|
+/***** TOMOYO Linux end. *****/ |
1345 |
|
|
+ |
1346 |
|
|
static int sock_no_open(struct inode *irrelevant, struct file *dontcare); |
1347 |
|
|
static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov, |
1348 |
|
|
unsigned long nr_segs, loff_t pos); |
1349 |
kumaneko |
1128 |
@@ -549,6 +554,12 @@ static inline int __sock_sendmsg(struct |
1350 |
kumaneko |
193 |
err = security_socket_sendmsg(sock, msg, size); |
1351 |
|
|
if (err) |
1352 |
|
|
return err; |
1353 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1354 |
kumaneko |
1128 |
+ if (ccs_socket_sendmsg_permission(sock, |
1355 |
|
|
+ (struct sockaddr *) msg->msg_name, |
1356 |
|
|
+ msg->msg_namelen)) |
1357 |
|
|
+ return -EPERM; |
1358 |
kumaneko |
435 |
+ /***** TOMOYO Linux end. *****/ |
1359 |
kumaneko |
193 |
|
1360 |
|
|
return sock->ops->sendmsg(iocb, sock, msg, size); |
1361 |
|
|
} |
1362 |
kumaneko |
1128 |
@@ -1070,6 +1081,12 @@ static int __sock_create(int family, int |
1363 |
kumaneko |
193 |
family = PF_PACKET; |
1364 |
|
|
} |
1365 |
|
|
|
1366 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1367 |
kumaneko |
1128 |
+ err = ccs_socket_create_permission(family, type, protocol); |
1368 |
|
|
+ if (err) |
1369 |
|
|
+ return err; |
1370 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1371 |
|
|
+ |
1372 |
|
|
err = security_socket_create(family, type, protocol, kern); |
1373 |
|
|
if (err) |
1374 |
|
|
return err; |
1375 |
kumaneko |
1128 |
@@ -1298,6 +1315,13 @@ asmlinkage long sys_bind(int fd, struct |
1376 |
kumaneko |
193 |
err = security_socket_bind(sock, |
1377 |
|
|
(struct sockaddr *)address, |
1378 |
|
|
addrlen); |
1379 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1380 |
kumaneko |
1128 |
+ if (!err) |
1381 |
|
|
+ err = ccs_socket_bind_permission(sock, |
1382 |
|
|
+ (struct sockaddr *) |
1383 |
|
|
+ address, |
1384 |
|
|
+ addrlen); |
1385 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1386 |
|
|
if (!err) |
1387 |
|
|
err = sock->ops->bind(sock, |
1388 |
|
|
(struct sockaddr *) |
1389 |
kumaneko |
1128 |
@@ -1327,6 +1351,10 @@ asmlinkage long sys_listen(int fd, int b |
1390 |
kumaneko |
193 |
backlog = sysctl_somaxconn; |
1391 |
|
|
|
1392 |
|
|
err = security_socket_listen(sock, backlog); |
1393 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1394 |
kumaneko |
1128 |
+ if (!err) |
1395 |
|
|
+ err = ccs_socket_listen_permission(sock); |
1396 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1397 |
|
|
if (!err) |
1398 |
|
|
err = sock->ops->listen(sock, backlog); |
1399 |
|
|
|
1400 |
kumaneko |
1128 |
@@ -1391,6 +1419,13 @@ asmlinkage long sys_accept(int fd, struc |
1401 |
kumaneko |
193 |
if (err < 0) |
1402 |
|
|
goto out_fd; |
1403 |
|
|
|
1404 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1405 |
kumaneko |
1128 |
+ if (ccs_socket_accept_permission(newsock, |
1406 |
|
|
+ (struct sockaddr *) address)) { |
1407 |
kumaneko |
193 |
+ err = -ECONNABORTED; /* Hope less harmful than -EPERM. */ |
1408 |
|
|
+ goto out_fd; |
1409 |
|
|
+ } |
1410 |
|
|
+ /***** TOMOYO Linux end. *****/ |
1411 |
|
|
if (upeer_sockaddr) { |
1412 |
|
|
if (newsock->ops->getname(newsock, (struct sockaddr *)address, |
1413 |
|
|
&len, 2) < 0) { |
1414 |
kumaneko |
1128 |
@@ -1455,6 +1490,12 @@ asmlinkage long sys_connect(int fd, stru |
1415 |
kumaneko |
193 |
security_socket_connect(sock, (struct sockaddr *)address, addrlen); |
1416 |
|
|
if (err) |
1417 |
|
|
goto out_put; |
1418 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1419 |
kumaneko |
1128 |
+ err = ccs_socket_connect_permission(sock, (struct sockaddr *) address, |
1420 |
|
|
+ addrlen); |
1421 |
|
|
+ if (err) |
1422 |
|
|
+ goto out_put; |
1423 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1424 |
|
|
|
1425 |
|
|
err = sock->ops->connect(sock, (struct sockaddr *)address, addrlen, |
1426 |
|
|
sock->file->f_flags); |
1427 |
kumaneko |
1498 |
--- linux-2.6.21.7.orig/net/unix/af_unix.c |
1428 |
|
|
+++ linux-2.6.21.7/net/unix/af_unix.c |
1429 |
kumaneko |
193 |
@@ -116,6 +116,9 @@ |
1430 |
|
|
#include <linux/mount.h> |
1431 |
|
|
#include <net/checksum.h> |
1432 |
|
|
#include <linux/security.h> |
1433 |
|
|
+/***** TOMOYO Linux start. *****/ |
1434 |
|
|
+#include <linux/tomoyo.h> |
1435 |
|
|
+/***** TOMOYO Linux end. *****/ |
1436 |
|
|
|
1437 |
|
|
int sysctl_unix_max_dgram_qlen __read_mostly = 10; |
1438 |
|
|
|
1439 |
kumaneko |
2297 |
@@ -808,6 +811,11 @@ static int unix_bind(struct socket *sock |
1440 |
kumaneko |
193 |
*/ |
1441 |
|
|
mode = S_IFSOCK | |
1442 |
|
|
(SOCK_INODE(sock)->i_mode & ~current->fs->umask); |
1443 |
|
|
+ /***** TOMOYO Linux start. *****/ |
1444 |
kumaneko |
2297 |
+ err = ccs_check_mknod_permission(nd.dentry->d_inode, dentry, |
1445 |
|
|
+ nd.mnt, mode, 0); |
1446 |
kumaneko |
1128 |
+ if (!err) |
1447 |
kumaneko |
193 |
+ /***** TOMOYO Linux end. *****/ |
1448 |
|
|
err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); |
1449 |
|
|
if (err) |
1450 |
|
|
goto out_mknod_dput; |