1 |
kumaneko |
2901 |
This is TOMOYO Linux patch for kernel 2.4.37.5. |
2 |
kumaneko |
1603 |
|
3 |
kumaneko |
2901 |
Source code for this patch is http://www.kernel.org/pub/linux/kernel/v2.4/linux-2.4.37.5.tar.bz2 |
4 |
kumaneko |
1603 |
--- |
5 |
kumaneko |
2858 |
arch/alpha/kernel/ptrace.c | 3 ++ |
6 |
|
|
arch/arm/kernel/ptrace.c | 3 ++ |
7 |
|
|
arch/cris/kernel/ptrace.c | 3 ++ |
8 |
|
|
arch/i386/kernel/ptrace.c | 3 ++ |
9 |
|
|
arch/ia64/ia32/sys_ia32.c | 3 ++ |
10 |
|
|
arch/ia64/kernel/ptrace.c | 3 ++ |
11 |
|
|
arch/m68k/kernel/ptrace.c | 3 ++ |
12 |
|
|
arch/mips/kernel/ptrace.c | 3 ++ |
13 |
|
|
arch/mips64/kernel/ptrace.c | 5 ++++ |
14 |
|
|
arch/parisc/kernel/ptrace.c | 3 ++ |
15 |
|
|
arch/ppc/kernel/ptrace.c | 3 ++ |
16 |
|
|
arch/ppc64/kernel/ptrace.c | 3 ++ |
17 |
|
|
arch/ppc64/kernel/ptrace32.c | 3 ++ |
18 |
|
|
arch/s390/kernel/ptrace.c | 3 ++ |
19 |
|
|
arch/s390x/kernel/ptrace.c | 3 ++ |
20 |
|
|
arch/sh/kernel/ptrace.c | 3 ++ |
21 |
|
|
arch/sh64/kernel/ptrace.c | 3 ++ |
22 |
|
|
arch/sparc/kernel/ptrace.c | 5 ++++ |
23 |
|
|
arch/sparc64/kernel/ptrace.c | 5 ++++ |
24 |
|
|
arch/x86_64/ia32/ptrace32.c | 3 ++ |
25 |
|
|
arch/x86_64/kernel/ptrace.c | 3 ++ |
26 |
|
|
fs/Config.in | 3 ++ |
27 |
|
|
fs/Makefile | 2 + |
28 |
|
|
fs/attr.c | 4 +++ |
29 |
|
|
fs/exec.c | 12 ++++++++++- |
30 |
|
|
fs/fcntl.c | 4 +++ |
31 |
|
|
fs/ioctl.c | 10 +++++++++ |
32 |
|
|
fs/namei.c | 45 +++++++++++++++++++++++++++++++++++++++++++ |
33 |
kumaneko |
2866 |
fs/namespace.c | 31 ++++++++++++++++++++++++++++- |
34 |
kumaneko |
2869 |
fs/open.c | 28 ++++++++++++++++++++++++++ |
35 |
kumaneko |
2796 |
fs/proc/proc_misc.c | 1 |
36 |
kumaneko |
2858 |
include/linux/sched.h | 6 +++++ |
37 |
|
|
kernel/kmod.c | 3 ++ |
38 |
|
|
kernel/module.c | 7 ++++++ |
39 |
|
|
kernel/sched.c | 3 ++ |
40 |
kumaneko |
2869 |
kernel/signal.c | 7 ++++++ |
41 |
kumaneko |
2858 |
kernel/sys.c | 9 ++++++++ |
42 |
|
|
kernel/sysctl.c | 13 +++++++++++- |
43 |
|
|
kernel/time.c | 7 ++++++ |
44 |
|
|
net/ipv4/raw.c | 4 +++ |
45 |
|
|
net/ipv4/tcp_ipv4.c | 5 ++++ |
46 |
kumaneko |
2859 |
net/ipv4/udp.c | 8 +++++++ |
47 |
kumaneko |
2858 |
net/ipv6/raw.c | 4 +++ |
48 |
|
|
net/ipv6/tcp_ipv6.c | 3 ++ |
49 |
kumaneko |
2859 |
net/ipv6/udp.c | 8 +++++++ |
50 |
|
|
net/socket.c | 25 +++++++++++++++++++++-- |
51 |
kumaneko |
2858 |
net/unix/af_unix.c | 4 +++ |
52 |
kumaneko |
2869 |
47 files changed, 320 insertions(+), 5 deletions(-) |
53 |
kumaneko |
1603 |
|
54 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/alpha/kernel/ptrace.c |
55 |
|
|
+++ linux-2.4.37.5/arch/alpha/kernel/ptrace.c |
56 |
kumaneko |
2796 |
@@ -18,6 +18,7 @@ |
57 |
kumaneko |
1603 |
#include <asm/pgtable.h> |
58 |
|
|
#include <asm/system.h> |
59 |
|
|
#include <asm/fpu.h> |
60 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
61 |
kumaneko |
1603 |
|
62 |
|
|
#include "proto.h" |
63 |
|
|
|
64 |
kumaneko |
2796 |
@@ -251,6 +252,8 @@ sys_ptrace(long request, long pid, long |
65 |
kumaneko |
1603 |
{ |
66 |
|
|
struct task_struct *child; |
67 |
|
|
long ret; |
68 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
69 |
kumaneko |
1603 |
+ return -EPERM; |
70 |
|
|
|
71 |
|
|
lock_kernel(); |
72 |
|
|
DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n", |
73 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/arm/kernel/ptrace.c |
74 |
|
|
+++ linux-2.4.37.5/arch/arm/kernel/ptrace.c |
75 |
kumaneko |
2796 |
@@ -22,6 +22,7 @@ |
76 |
kumaneko |
1603 |
#include <asm/uaccess.h> |
77 |
|
|
#include <asm/pgtable.h> |
78 |
|
|
#include <asm/system.h> |
79 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
80 |
kumaneko |
1603 |
|
81 |
|
|
#include "ptrace.h" |
82 |
|
|
|
83 |
kumaneko |
2796 |
@@ -695,6 +696,8 @@ asmlinkage int sys_ptrace(long request, |
84 |
kumaneko |
1603 |
{ |
85 |
|
|
struct task_struct *child; |
86 |
|
|
int ret; |
87 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
88 |
kumaneko |
1603 |
+ return -EPERM; |
89 |
|
|
|
90 |
|
|
lock_kernel(); |
91 |
|
|
ret = -EPERM; |
92 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/cris/kernel/ptrace.c |
93 |
|
|
+++ linux-2.4.37.5/arch/cris/kernel/ptrace.c |
94 |
kumaneko |
2796 |
@@ -48,6 +48,7 @@ |
95 |
kumaneko |
1603 |
#include <asm/pgtable.h> |
96 |
|
|
#include <asm/system.h> |
97 |
|
|
#include <asm/processor.h> |
98 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
99 |
kumaneko |
1603 |
|
100 |
|
|
/* |
101 |
|
|
* does not yet catch signals sent when the child dies. |
102 |
kumaneko |
2796 |
@@ -104,6 +105,8 @@ asmlinkage int sys_ptrace(long request, |
103 |
kumaneko |
1603 |
{ |
104 |
|
|
struct task_struct *child; |
105 |
|
|
int ret; |
106 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
107 |
kumaneko |
1603 |
+ return -EPERM; |
108 |
|
|
|
109 |
|
|
lock_kernel(); |
110 |
|
|
ret = -EPERM; |
111 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/i386/kernel/ptrace.c |
112 |
|
|
+++ linux-2.4.37.5/arch/i386/kernel/ptrace.c |
113 |
kumaneko |
2796 |
@@ -20,6 +20,7 @@ |
114 |
kumaneko |
1603 |
#include <asm/processor.h> |
115 |
|
|
#include <asm/i387.h> |
116 |
|
|
#include <asm/debugreg.h> |
117 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
118 |
kumaneko |
1603 |
|
119 |
|
|
/* |
120 |
|
|
* does not yet catch signals sent when the child dies. |
121 |
kumaneko |
2796 |
@@ -152,6 +153,8 @@ asmlinkage int sys_ptrace(long request, |
122 |
kumaneko |
1603 |
struct task_struct *child; |
123 |
|
|
struct user * dummy = NULL; |
124 |
|
|
int i, ret; |
125 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
126 |
kumaneko |
1603 |
+ return -EPERM; |
127 |
|
|
|
128 |
|
|
lock_kernel(); |
129 |
|
|
ret = -EPERM; |
130 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/ia64/ia32/sys_ia32.c |
131 |
|
|
+++ linux-2.4.37.5/arch/ia64/ia32/sys_ia32.c |
132 |
kumaneko |
2796 |
@@ -57,6 +57,7 @@ |
133 |
kumaneko |
1603 |
#include <net/scm.h> |
134 |
|
|
#include <net/sock.h> |
135 |
|
|
#include <asm/ia32.h> |
136 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
137 |
kumaneko |
1603 |
|
138 |
|
|
#define DEBUG 0 |
139 |
|
|
|
140 |
kumaneko |
2796 |
@@ -3131,6 +3132,8 @@ sys32_ptrace (int request, pid_t pid, un |
141 |
kumaneko |
1603 |
struct task_struct *child; |
142 |
|
|
unsigned int value, tmp; |
143 |
|
|
long i, ret; |
144 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
145 |
kumaneko |
1603 |
+ return -EPERM; |
146 |
|
|
|
147 |
|
|
lock_kernel(); |
148 |
|
|
if (request == PTRACE_TRACEME) { |
149 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/ia64/kernel/ptrace.c |
150 |
|
|
+++ linux-2.4.37.5/arch/ia64/kernel/ptrace.c |
151 |
kumaneko |
2796 |
@@ -27,6 +27,7 @@ |
152 |
kumaneko |
1603 |
#ifdef CONFIG_PERFMON |
153 |
|
|
#include <asm/perfmon.h> |
154 |
|
|
#endif |
155 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
156 |
kumaneko |
1603 |
|
157 |
|
|
#define offsetof(type,field) ((unsigned long) &((type *) 0)->field) |
158 |
|
|
|
159 |
kumaneko |
2796 |
@@ -1273,6 +1274,8 @@ sys_ptrace (long request, pid_t pid, uns |
160 |
kumaneko |
1603 |
struct task_struct *child; |
161 |
|
|
struct switch_stack *sw; |
162 |
|
|
long ret; |
163 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
164 |
kumaneko |
1603 |
+ return -EPERM; |
165 |
|
|
|
166 |
|
|
lock_kernel(); |
167 |
|
|
ret = -EPERM; |
168 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/m68k/kernel/ptrace.c |
169 |
|
|
+++ linux-2.4.37.5/arch/m68k/kernel/ptrace.c |
170 |
kumaneko |
2796 |
@@ -25,6 +25,7 @@ |
171 |
kumaneko |
1603 |
#include <asm/pgtable.h> |
172 |
|
|
#include <asm/system.h> |
173 |
|
|
#include <asm/processor.h> |
174 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
175 |
kumaneko |
1603 |
|
176 |
|
|
/* |
177 |
|
|
* does not yet catch signals sent when the child dies. |
178 |
kumaneko |
2796 |
@@ -104,6 +105,8 @@ asmlinkage int sys_ptrace(long request, |
179 |
kumaneko |
1603 |
{ |
180 |
|
|
struct task_struct *child; |
181 |
|
|
int ret; |
182 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
183 |
kumaneko |
1603 |
+ return -EPERM; |
184 |
|
|
|
185 |
|
|
lock_kernel(); |
186 |
|
|
ret = -EPERM; |
187 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/mips/kernel/ptrace.c |
188 |
|
|
+++ linux-2.4.37.5/arch/mips/kernel/ptrace.c |
189 |
kumaneko |
2796 |
@@ -28,6 +28,7 @@ |
190 |
kumaneko |
1603 |
#include <asm/bootinfo.h> |
191 |
|
|
#include <asm/cpu.h> |
192 |
|
|
#include <asm/fpu.h> |
193 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
194 |
kumaneko |
1603 |
|
195 |
|
|
/* |
196 |
|
|
* Called by kernel/ptrace.c when detaching.. |
197 |
kumaneko |
2796 |
@@ -43,6 +44,8 @@ asmlinkage int sys_ptrace(long request, |
198 |
kumaneko |
1603 |
{ |
199 |
|
|
struct task_struct *child; |
200 |
|
|
int ret; |
201 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
202 |
kumaneko |
1603 |
+ return -EPERM; |
203 |
|
|
|
204 |
|
|
lock_kernel(); |
205 |
|
|
#if 0 |
206 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/mips64/kernel/ptrace.c |
207 |
|
|
+++ linux-2.4.37.5/arch/mips64/kernel/ptrace.c |
208 |
kumaneko |
2796 |
@@ -30,6 +30,7 @@ |
209 |
kumaneko |
1603 |
#include <asm/system.h> |
210 |
|
|
#include <asm/uaccess.h> |
211 |
|
|
#include <asm/bootinfo.h> |
212 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
213 |
kumaneko |
1603 |
|
214 |
|
|
/* |
215 |
|
|
* Called by kernel/ptrace.c when detaching.. |
216 |
kumaneko |
2796 |
@@ -49,6 +50,8 @@ asmlinkage int sys32_ptrace(int request, |
217 |
kumaneko |
1603 |
{ |
218 |
|
|
struct task_struct *child; |
219 |
|
|
int ret; |
220 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
221 |
kumaneko |
1603 |
+ return -EPERM; |
222 |
|
|
|
223 |
|
|
lock_kernel(); |
224 |
|
|
ret = -EPERM; |
225 |
kumaneko |
2796 |
@@ -288,6 +291,8 @@ asmlinkage int sys_ptrace(long request, |
226 |
kumaneko |
1603 |
{ |
227 |
|
|
struct task_struct *child; |
228 |
|
|
int ret; |
229 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
230 |
kumaneko |
1603 |
+ return -EPERM; |
231 |
|
|
|
232 |
|
|
lock_kernel(); |
233 |
|
|
#if 0 |
234 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/parisc/kernel/ptrace.c |
235 |
|
|
+++ linux-2.4.37.5/arch/parisc/kernel/ptrace.c |
236 |
kumaneko |
2796 |
@@ -21,6 +21,7 @@ |
237 |
kumaneko |
1603 |
#include <asm/system.h> |
238 |
|
|
#include <asm/processor.h> |
239 |
|
|
#include <asm/offset.h> |
240 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
241 |
kumaneko |
1603 |
|
242 |
|
|
/* These are used in entry.S, syscall_restore_rfi. We need to record the |
243 |
|
|
* current stepping mode somewhere other than in PSW, because there is no |
244 |
kumaneko |
2796 |
@@ -94,6 +95,8 @@ long sys_ptrace(long request, pid_t pid, |
245 |
kumaneko |
1603 |
#ifdef DEBUG_PTRACE |
246 |
|
|
long oaddr=addr, odata=data; |
247 |
|
|
#endif |
248 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
249 |
kumaneko |
1603 |
+ return -EPERM; |
250 |
|
|
|
251 |
|
|
lock_kernel(); |
252 |
|
|
ret = -EPERM; |
253 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/ppc/kernel/ptrace.c |
254 |
|
|
+++ linux-2.4.37.5/arch/ppc/kernel/ptrace.c |
255 |
kumaneko |
2796 |
@@ -29,6 +29,7 @@ |
256 |
kumaneko |
1603 |
#include <asm/page.h> |
257 |
|
|
#include <asm/pgtable.h> |
258 |
|
|
#include <asm/system.h> |
259 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
260 |
kumaneko |
1603 |
|
261 |
|
|
/* |
262 |
|
|
* Set of msr bits that gdb can change on behalf of a process. |
263 |
kumaneko |
2796 |
@@ -171,6 +172,8 @@ int sys_ptrace(long request, long pid, l |
264 |
kumaneko |
1603 |
{ |
265 |
|
|
struct task_struct *child; |
266 |
|
|
int ret = -EPERM; |
267 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
268 |
kumaneko |
1603 |
+ return -EPERM; |
269 |
|
|
|
270 |
|
|
lock_kernel(); |
271 |
|
|
if (request == PTRACE_TRACEME) { |
272 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/ppc64/kernel/ptrace.c |
273 |
|
|
+++ linux-2.4.37.5/arch/ppc64/kernel/ptrace.c |
274 |
kumaneko |
2796 |
@@ -30,6 +30,7 @@ |
275 |
kumaneko |
1603 |
#include <asm/page.h> |
276 |
|
|
#include <asm/pgtable.h> |
277 |
|
|
#include <asm/system.h> |
278 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
279 |
kumaneko |
1603 |
|
280 |
|
|
/* |
281 |
|
|
* Set of msr bits that gdb can change on behalf of a process. |
282 |
kumaneko |
2796 |
@@ -120,6 +121,8 @@ int sys_ptrace(long request, long pid, l |
283 |
kumaneko |
1603 |
{ |
284 |
|
|
struct task_struct *child; |
285 |
|
|
int ret = -EPERM; |
286 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
287 |
kumaneko |
1603 |
+ return -EPERM; |
288 |
|
|
|
289 |
|
|
lock_kernel(); |
290 |
|
|
if (request == PTRACE_TRACEME) { |
291 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/ppc64/kernel/ptrace32.c |
292 |
|
|
+++ linux-2.4.37.5/arch/ppc64/kernel/ptrace32.c |
293 |
kumaneko |
2796 |
@@ -30,6 +30,7 @@ |
294 |
kumaneko |
1603 |
#include <asm/page.h> |
295 |
|
|
#include <asm/pgtable.h> |
296 |
|
|
#include <asm/system.h> |
297 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
298 |
kumaneko |
1603 |
|
299 |
|
|
#ifdef CONFIG_ALTIVEC |
300 |
|
|
/* |
301 |
kumaneko |
2796 |
@@ -121,6 +122,8 @@ int sys32_ptrace(long request, long pid, |
302 |
kumaneko |
1603 |
{ |
303 |
|
|
struct task_struct *child; |
304 |
|
|
int ret = -EPERM; |
305 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
306 |
kumaneko |
1603 |
+ return -EPERM; |
307 |
|
|
|
308 |
|
|
lock_kernel(); |
309 |
|
|
if (request == PTRACE_TRACEME) { |
310 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/s390/kernel/ptrace.c |
311 |
|
|
+++ linux-2.4.37.5/arch/s390/kernel/ptrace.c |
312 |
kumaneko |
2796 |
@@ -37,6 +37,7 @@ |
313 |
kumaneko |
1603 |
#include <asm/pgalloc.h> |
314 |
|
|
#include <asm/system.h> |
315 |
|
|
#include <asm/uaccess.h> |
316 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
317 |
kumaneko |
1603 |
|
318 |
|
|
|
319 |
|
|
void FixPerRegisters(struct task_struct *task) |
320 |
kumaneko |
2796 |
@@ -221,6 +222,8 @@ asmlinkage int sys_ptrace(long request, |
321 |
kumaneko |
1603 |
unsigned long tmp; |
322 |
|
|
int copied; |
323 |
|
|
ptrace_area parea; |
324 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
325 |
kumaneko |
1603 |
+ return -EPERM; |
326 |
|
|
|
327 |
|
|
lock_kernel(); |
328 |
|
|
if (request == PTRACE_TRACEME) |
329 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/s390x/kernel/ptrace.c |
330 |
|
|
+++ linux-2.4.37.5/arch/s390x/kernel/ptrace.c |
331 |
kumaneko |
2796 |
@@ -43,6 +43,7 @@ |
332 |
kumaneko |
1603 |
#else |
333 |
|
|
#define parent_31bit 0 |
334 |
|
|
#endif |
335 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
336 |
kumaneko |
1603 |
|
337 |
|
|
|
338 |
|
|
void FixPerRegisters(struct task_struct *task) |
339 |
kumaneko |
2796 |
@@ -431,6 +432,8 @@ asmlinkage int sys_ptrace(long request, |
340 |
kumaneko |
1603 |
#define sizeof_parent_long 8 |
341 |
|
|
#define dataptr (u8 *)&data |
342 |
|
|
#endif |
343 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
344 |
kumaneko |
1603 |
+ return -EPERM; |
345 |
|
|
lock_kernel(); |
346 |
|
|
if (request == PTRACE_TRACEME) |
347 |
|
|
{ |
348 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/sh/kernel/ptrace.c |
349 |
|
|
+++ linux-2.4.37.5/arch/sh/kernel/ptrace.c |
350 |
kumaneko |
2796 |
@@ -26,6 +26,7 @@ |
351 |
kumaneko |
1603 |
#include <asm/system.h> |
352 |
|
|
#include <asm/processor.h> |
353 |
|
|
#include <asm/mmu_context.h> |
354 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
355 |
kumaneko |
1603 |
|
356 |
|
|
/* |
357 |
|
|
* does not yet catch signals sent when the child dies. |
358 |
kumaneko |
2796 |
@@ -144,6 +145,8 @@ asmlinkage int sys_ptrace(long request, |
359 |
kumaneko |
1603 |
struct task_struct *child, *tsk = current; |
360 |
|
|
struct user * dummy = NULL; |
361 |
|
|
int ret; |
362 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
363 |
kumaneko |
1603 |
+ return -EPERM; |
364 |
|
|
|
365 |
|
|
lock_kernel(); |
366 |
|
|
ret = -EPERM; |
367 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/sh64/kernel/ptrace.c |
368 |
|
|
+++ linux-2.4.37.5/arch/sh64/kernel/ptrace.c |
369 |
kumaneko |
2796 |
@@ -32,6 +32,7 @@ |
370 |
kumaneko |
1603 |
#include <asm/system.h> |
371 |
|
|
#include <asm/processor.h> |
372 |
|
|
#include <asm/mmu_context.h> |
373 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
374 |
kumaneko |
1603 |
|
375 |
|
|
/* This mask defines the bits of the SR which the user is not allowed to |
376 |
|
|
change, which are everything except S, Q, M, PR, SZ, FR. */ |
377 |
kumaneko |
2796 |
@@ -122,6 +123,8 @@ asmlinkage int sys_ptrace(long request, |
378 |
kumaneko |
1603 |
{ |
379 |
|
|
struct task_struct *child, *tsk = current; |
380 |
|
|
int ret; |
381 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
382 |
kumaneko |
1603 |
+ return -EPERM; |
383 |
|
|
|
384 |
|
|
lock_kernel(); |
385 |
|
|
ret = -EPERM; |
386 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/sparc/kernel/ptrace.c |
387 |
|
|
+++ linux-2.4.37.5/arch/sparc/kernel/ptrace.c |
388 |
kumaneko |
2796 |
@@ -21,6 +21,7 @@ |
389 |
kumaneko |
1603 |
#include <asm/pgtable.h> |
390 |
|
|
#include <asm/system.h> |
391 |
|
|
#include <asm/uaccess.h> |
392 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
393 |
kumaneko |
1603 |
|
394 |
|
|
#define MAGIC_CONSTANT 0x80000000 |
395 |
|
|
|
396 |
kumaneko |
2796 |
@@ -262,6 +263,10 @@ asmlinkage void do_ptrace(struct pt_regs |
397 |
kumaneko |
1603 |
unsigned long data = regs->u_regs[UREG_I3]; |
398 |
|
|
unsigned long addr2 = regs->u_regs[UREG_I4]; |
399 |
|
|
struct task_struct *child; |
400 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) { |
401 |
kumaneko |
1603 |
+ pt_error_return(regs, EPERM); |
402 |
|
|
+ return; |
403 |
|
|
+ } |
404 |
|
|
|
405 |
|
|
lock_kernel(); |
406 |
|
|
#ifdef DEBUG_PTRACE |
407 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/sparc64/kernel/ptrace.c |
408 |
|
|
+++ linux-2.4.37.5/arch/sparc64/kernel/ptrace.c |
409 |
kumaneko |
2796 |
@@ -26,6 +26,7 @@ |
410 |
kumaneko |
1603 |
#include <asm/psrcompat.h> |
411 |
|
|
#include <asm/visasm.h> |
412 |
|
|
#include <asm/spitfire.h> |
413 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
414 |
kumaneko |
1603 |
|
415 |
|
|
#define MAGIC_CONSTANT 0x80000000 |
416 |
|
|
|
417 |
kumaneko |
2796 |
@@ -108,6 +109,10 @@ asmlinkage void do_ptrace(struct pt_regs |
418 |
kumaneko |
1603 |
unsigned long data = regs->u_regs[UREG_I3]; |
419 |
|
|
unsigned long addr2 = regs->u_regs[UREG_I4]; |
420 |
|
|
struct task_struct *child; |
421 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) { |
422 |
kumaneko |
1603 |
+ pt_error_return(regs, EPERM); |
423 |
|
|
+ return; |
424 |
|
|
+ } |
425 |
|
|
|
426 |
|
|
if (current->thread.flags & SPARC_FLAG_32BIT) { |
427 |
|
|
addr &= 0xffffffffUL; |
428 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/x86_64/ia32/ptrace32.c |
429 |
|
|
+++ linux-2.4.37.5/arch/x86_64/ia32/ptrace32.c |
430 |
kumaneko |
2796 |
@@ -24,6 +24,7 @@ |
431 |
kumaneko |
1603 |
#include <asm/i387.h> |
432 |
|
|
#include <asm/fpu32.h> |
433 |
|
|
#include <linux/mm.h> |
434 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
435 |
kumaneko |
1603 |
|
436 |
|
|
/* determines which flags the user has access to. */ |
437 |
|
|
/* 1 = access 0 = no access */ |
438 |
kumaneko |
2796 |
@@ -203,6 +204,8 @@ asmlinkage long sys32_ptrace(long reques |
439 |
kumaneko |
1603 |
struct pt_regs *childregs; |
440 |
|
|
int ret; |
441 |
|
|
__u32 val; |
442 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
443 |
kumaneko |
1603 |
+ return -EPERM; |
444 |
|
|
|
445 |
|
|
switch (request) { |
446 |
|
|
case PTRACE_TRACEME: |
447 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/arch/x86_64/kernel/ptrace.c |
448 |
|
|
+++ linux-2.4.37.5/arch/x86_64/kernel/ptrace.c |
449 |
kumaneko |
2796 |
@@ -22,6 +22,7 @@ |
450 |
kumaneko |
1603 |
#include <asm/processor.h> |
451 |
|
|
#include <asm/i387.h> |
452 |
|
|
#include <asm/debugreg.h> |
453 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
454 |
kumaneko |
1603 |
|
455 |
|
|
/* |
456 |
|
|
* does not yet catch signals sent when the child dies. |
457 |
kumaneko |
2796 |
@@ -180,6 +181,8 @@ asmlinkage long sys_ptrace(long request, |
458 |
kumaneko |
1603 |
struct task_struct *child; |
459 |
|
|
struct user * dummy = NULL; |
460 |
|
|
long i, ret; |
461 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PTRACE)) |
462 |
kumaneko |
1603 |
+ return -EPERM; |
463 |
|
|
|
464 |
|
|
/* This lock_kernel fixes a subtle race with suid exec */ |
465 |
|
|
lock_kernel(); |
466 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/Config.in |
467 |
|
|
+++ linux-2.4.37.5/fs/Config.in |
468 |
kumaneko |
1603 |
@@ -176,4 +176,7 @@ comment 'Partition Types' |
469 |
|
|
source fs/partitions/Config.in |
470 |
|
|
endmenu |
471 |
|
|
source fs/nls/Config.in |
472 |
|
|
+ |
473 |
kumaneko |
2886 |
endmenu |
474 |
|
|
+ |
475 |
kumaneko |
2858 |
+source security/ccsecurity/Config.in |
476 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/Makefile |
477 |
|
|
+++ linux-2.4.37.5/fs/Makefile |
478 |
kumaneko |
2858 |
@@ -77,6 +77,8 @@ obj-y += binfmt_script.o |
479 |
|
|
|
480 |
|
|
obj-$(CONFIG_BINFMT_ELF) += binfmt_elf.o |
481 |
|
|
|
482 |
|
|
+subdir-$(CONFIG_CCSECURITY) += ccsecurity |
483 |
|
|
+ |
484 |
kumaneko |
1603 |
# persistent filesystems |
485 |
|
|
obj-y += $(join $(subdir-y),$(subdir-y:%=/%.o)) |
486 |
|
|
|
487 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/attr.c |
488 |
|
|
+++ linux-2.4.37.5/fs/attr.c |
489 |
kumaneko |
2796 |
@@ -12,6 +12,7 @@ |
490 |
kumaneko |
1603 |
#include <linux/dnotify.h> |
491 |
|
|
#include <linux/fcntl.h> |
492 |
|
|
#include <linux/quotaops.h> |
493 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
494 |
kumaneko |
1603 |
|
495 |
|
|
/* Taken over from the old code... */ |
496 |
|
|
|
497 |
kumaneko |
2796 |
@@ -127,6 +128,9 @@ int notify_change(struct dentry * dentry |
498 |
kumaneko |
1603 |
attr->ia_atime = now; |
499 |
|
|
if (!(ia_valid & ATTR_MTIME_SET)) |
500 |
|
|
attr->ia_mtime = now; |
501 |
kumaneko |
2794 |
+ error = ccs_check_setattr_permission(dentry, attr); |
502 |
|
|
+ if (error) |
503 |
|
|
+ return error; |
504 |
kumaneko |
1603 |
|
505 |
|
|
lock_kernel(); |
506 |
|
|
if (inode->i_op && inode->i_op->setattr) |
507 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/exec.c |
508 |
|
|
+++ linux-2.4.37.5/fs/exec.c |
509 |
kumaneko |
2796 |
@@ -48,6 +48,8 @@ |
510 |
kumaneko |
1603 |
#include <linux/kmod.h> |
511 |
|
|
#endif |
512 |
|
|
|
513 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
514 |
kumaneko |
1603 |
+ |
515 |
|
|
int core_uses_pid; |
516 |
|
|
char core_pattern[65] = "core"; |
517 |
|
|
int core_setuid_ok = 0; |
518 |
kumaneko |
2796 |
@@ -125,6 +127,10 @@ asmlinkage long sys_uselib(const char * |
519 |
kumaneko |
1603 |
if (error) |
520 |
|
|
goto exit; |
521 |
|
|
|
522 |
kumaneko |
2306 |
+ error = ccs_check_uselib_permission(nd.dentry, nd.mnt); |
523 |
kumaneko |
1603 |
+ if (error) |
524 |
|
|
+ goto exit; |
525 |
|
|
+ |
526 |
|
|
file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); |
527 |
|
|
error = PTR_ERR(file); |
528 |
|
|
if (IS_ERR(file)) |
529 |
kumaneko |
2796 |
@@ -389,6 +395,9 @@ struct file *open_exec(const char *name) |
530 |
kumaneko |
1603 |
int err = permission(inode, MAY_EXEC); |
531 |
|
|
if (!err && !(inode->i_mode & 0111)) |
532 |
|
|
err = -EACCES; |
533 |
kumaneko |
2306 |
+ if (!err) |
534 |
|
|
+ err = ccs_check_open_exec_permission(nd.dentry, |
535 |
|
|
+ nd.mnt); |
536 |
kumaneko |
1603 |
file = ERR_PTR(err); |
537 |
|
|
if (!err) { |
538 |
|
|
file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); |
539 |
kumaneko |
2822 |
@@ -989,7 +998,8 @@ int do_execve(char * filename, char ** a |
540 |
kumaneko |
1603 |
if (retval < 0) |
541 |
|
|
goto out; |
542 |
|
|
|
543 |
|
|
- retval = search_binary_handler(&bprm,regs); |
544 |
kumaneko |
2300 |
+ retval = ccs_search_binary_handler(&bprm, regs); |
545 |
kumaneko |
1603 |
+ |
546 |
|
|
if (retval >= 0) |
547 |
|
|
/* execve success */ |
548 |
|
|
return retval; |
549 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/fcntl.c |
550 |
|
|
+++ linux-2.4.37.5/fs/fcntl.c |
551 |
kumaneko |
2796 |
@@ -16,6 +16,7 @@ |
552 |
kumaneko |
1603 |
#include <asm/poll.h> |
553 |
|
|
#include <asm/siginfo.h> |
554 |
|
|
#include <asm/uaccess.h> |
555 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
556 |
kumaneko |
1603 |
|
557 |
|
|
extern int sock_fcntl (struct file *, unsigned int cmd, unsigned long arg); |
558 |
|
|
extern int fcntl_setlease(unsigned int fd, struct file *filp, long arg); |
559 |
kumaneko |
2796 |
@@ -214,6 +215,9 @@ static int setfl(int fd, struct file * f |
560 |
kumaneko |
1603 |
if (!(arg & O_APPEND) && IS_APPEND(inode)) |
561 |
|
|
return -EPERM; |
562 |
|
|
|
563 |
|
|
+ if (!(arg & O_APPEND) && ccs_check_rewrite_permission(filp)) |
564 |
|
|
+ return -EPERM; |
565 |
|
|
+ |
566 |
|
|
/* Did FASYNC state change? */ |
567 |
|
|
if ((arg ^ filp->f_flags) & FASYNC) { |
568 |
|
|
if (filp->f_op && filp->f_op->fasync) { |
569 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/ioctl.c |
570 |
|
|
+++ linux-2.4.37.5/fs/ioctl.c |
571 |
kumaneko |
2796 |
@@ -10,6 +10,7 @@ |
572 |
kumaneko |
1603 |
|
573 |
|
|
#include <asm/uaccess.h> |
574 |
|
|
#include <asm/ioctls.h> |
575 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
576 |
kumaneko |
1603 |
|
577 |
|
|
static int file_ioctl(struct file *filp,unsigned int cmd,unsigned long arg) |
578 |
|
|
{ |
579 |
kumaneko |
2796 |
@@ -55,6 +56,11 @@ asmlinkage long sys_ioctl(unsigned int f |
580 |
kumaneko |
2279 |
filp = fget(fd); |
581 |
|
|
if (!filp) |
582 |
|
|
goto out; |
583 |
|
|
+ error = ccs_check_ioctl_permission(filp, cmd, arg); |
584 |
kumaneko |
2283 |
+ if (error) { |
585 |
|
|
+ fput(filp); |
586 |
kumaneko |
2279 |
+ goto out; |
587 |
kumaneko |
2283 |
+ } |
588 |
kumaneko |
2279 |
error = 0; |
589 |
|
|
lock_kernel(); |
590 |
|
|
switch (cmd) { |
591 |
kumaneko |
2796 |
@@ -112,6 +118,10 @@ asmlinkage long sys_ioctl(unsigned int f |
592 |
kumaneko |
1603 |
error = -ENOTTY; |
593 |
|
|
break; |
594 |
|
|
default: |
595 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_IOCTL)) { |
596 |
kumaneko |
1603 |
+ error = -EPERM; |
597 |
|
|
+ break; |
598 |
|
|
+ } |
599 |
|
|
error = -ENOTTY; |
600 |
|
|
if (S_ISREG(filp->f_dentry->d_inode->i_mode)) |
601 |
|
|
error = file_ioctl(filp, cmd, arg); |
602 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/namei.c |
603 |
|
|
+++ linux-2.4.37.5/fs/namei.c |
604 |
kumaneko |
2796 |
@@ -28,6 +28,9 @@ |
605 |
kumaneko |
1603 |
|
606 |
|
|
#define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) |
607 |
|
|
|
608 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
609 |
kumaneko |
1603 |
+#include <linux/module.h> |
610 |
|
|
+ |
611 |
|
|
/* [Feb-1997 T. Schoebel-Theuer] |
612 |
|
|
* Fundamental changes in the pathname lookup mechanisms (namei) |
613 |
|
|
* were necessary because of omirr. The reason is that omirr needs |
614 |
kumaneko |
2796 |
@@ -1003,6 +1006,7 @@ exit_lock: |
615 |
kumaneko |
1603 |
return error; |
616 |
|
|
} |
617 |
|
|
|
618 |
kumaneko |
2859 |
+#include <linux/ccsecurity_vfs.h> |
619 |
kumaneko |
1603 |
/* |
620 |
|
|
* open_namei() |
621 |
|
|
* |
622 |
kumaneko |
2796 |
@@ -1068,6 +1072,11 @@ do_last: |
623 |
kumaneko |
1603 |
|
624 |
|
|
/* Negative dentry, just create the file */ |
625 |
|
|
if (!dentry->d_inode) { |
626 |
kumaneko |
2290 |
+ error = ccs_check_mknod_permission(dir->d_inode, dentry, |
627 |
|
|
+ nd->mnt, |
628 |
|
|
+ mode & ~current->fs->umask, |
629 |
|
|
+ 0); |
630 |
kumaneko |
1603 |
+ if (!error) |
631 |
|
|
error = vfs_create(dir->d_inode, dentry, |
632 |
|
|
mode & ~current->fs->umask); |
633 |
|
|
up(&dir->d_inode->i_sem); |
634 |
kumaneko |
2796 |
@@ -1154,6 +1163,11 @@ ok: |
635 |
kumaneko |
1603 |
goto exit; |
636 |
|
|
} |
637 |
|
|
|
638 |
|
|
+ /* includes O_APPEND and O_TRUNC checks */ |
639 |
|
|
+ error = ccs_check_open_permission(dentry, nd->mnt, flag); |
640 |
|
|
+ if (error) |
641 |
|
|
+ goto exit; |
642 |
|
|
+ |
643 |
|
|
/* |
644 |
|
|
* Ensure there are no outstanding leases on the file. |
645 |
|
|
*/ |
646 |
kumaneko |
2796 |
@@ -1292,6 +1306,7 @@ asmlinkage long sys_mknod(const char * f |
647 |
kumaneko |
1603 |
|
648 |
|
|
if (S_ISDIR(mode)) |
649 |
|
|
return -EPERM; |
650 |
|
|
+ |
651 |
|
|
tmp = getname(filename); |
652 |
|
|
if (IS_ERR(tmp)) |
653 |
|
|
return PTR_ERR(tmp); |
654 |
kumaneko |
2796 |
@@ -1304,6 +1319,10 @@ asmlinkage long sys_mknod(const char * f |
655 |
kumaneko |
2290 |
|
656 |
|
|
mode &= ~current->fs->umask; |
657 |
kumaneko |
1603 |
if (!IS_ERR(dentry)) { |
658 |
kumaneko |
2290 |
+ error = ccs_check_mknod_permission(nd.dentry->d_inode, dentry, |
659 |
|
|
+ nd.mnt, mode, dev); |
660 |
kumaneko |
2297 |
+ if (error) |
661 |
|
|
+ goto out_dput; |
662 |
kumaneko |
1603 |
switch (mode & S_IFMT) { |
663 |
|
|
case 0: case S_IFREG: |
664 |
|
|
error = vfs_create(nd.dentry->d_inode,dentry,mode); |
665 |
kumaneko |
2796 |
@@ -1317,6 +1336,7 @@ asmlinkage long sys_mknod(const char * f |
666 |
kumaneko |
2297 |
default: |
667 |
|
|
error = -EINVAL; |
668 |
|
|
} |
669 |
|
|
+out_dput: |
670 |
|
|
dput(dentry); |
671 |
|
|
} |
672 |
|
|
up(&nd.dentry->d_inode->i_sem); |
673 |
kumaneko |
2796 |
@@ -1370,6 +1390,10 @@ asmlinkage long sys_mkdir(const char * p |
674 |
kumaneko |
1603 |
dentry = lookup_create(&nd, 1); |
675 |
|
|
error = PTR_ERR(dentry); |
676 |
|
|
if (!IS_ERR(dentry)) { |
677 |
kumaneko |
2290 |
+ error = ccs_check_mkdir_permission(nd.dentry->d_inode, |
678 |
|
|
+ dentry, nd.mnt, |
679 |
|
|
+ mode); |
680 |
kumaneko |
1603 |
+ if (!error) |
681 |
|
|
error = vfs_mkdir(nd.dentry->d_inode, dentry, |
682 |
|
|
mode & ~current->fs->umask); |
683 |
|
|
dput(dentry); |
684 |
kumaneko |
2796 |
@@ -1479,6 +1503,9 @@ asmlinkage long sys_rmdir(const char * p |
685 |
kumaneko |
1603 |
dentry = lookup_hash(&nd.last, nd.dentry); |
686 |
|
|
error = PTR_ERR(dentry); |
687 |
|
|
if (!IS_ERR(dentry)) { |
688 |
kumaneko |
2290 |
+ error = ccs_check_rmdir_permission(nd.dentry->d_inode, dentry, |
689 |
|
|
+ nd.mnt); |
690 |
kumaneko |
1603 |
+ if (!error) |
691 |
|
|
error = vfs_rmdir(nd.dentry->d_inode, dentry); |
692 |
|
|
dput(dentry); |
693 |
|
|
} |
694 |
kumaneko |
2796 |
@@ -1548,6 +1575,10 @@ asmlinkage long sys_unlink(const char * |
695 |
kumaneko |
1603 |
/* Why not before? Because we want correct error value */ |
696 |
|
|
if (nd.last.name[nd.last.len]) |
697 |
|
|
goto slashes; |
698 |
kumaneko |
2290 |
+ error = ccs_check_unlink_permission(nd.dentry->d_inode, dentry, |
699 |
|
|
+ nd.mnt); |
700 |
kumaneko |
2297 |
+ if (error) |
701 |
|
|
+ goto exit2; |
702 |
kumaneko |
1603 |
error = vfs_unlink(nd.dentry->d_inode, dentry); |
703 |
|
|
exit2: |
704 |
|
|
dput(dentry); |
705 |
kumaneko |
2796 |
@@ -1612,6 +1643,10 @@ asmlinkage long sys_symlink(const char * |
706 |
kumaneko |
1603 |
dentry = lookup_create(&nd, 0); |
707 |
|
|
error = PTR_ERR(dentry); |
708 |
|
|
if (!IS_ERR(dentry)) { |
709 |
kumaneko |
2290 |
+ error = ccs_check_symlink_permission(nd.dentry->d_inode, |
710 |
|
|
+ dentry, nd.mnt, |
711 |
|
|
+ from); |
712 |
kumaneko |
1603 |
+ if (!error) |
713 |
|
|
error = vfs_symlink(nd.dentry->d_inode, dentry, from); |
714 |
|
|
dput(dentry); |
715 |
|
|
} |
716 |
kumaneko |
2796 |
@@ -1698,6 +1733,10 @@ asmlinkage long sys_link(const char * ol |
717 |
kumaneko |
1603 |
new_dentry = lookup_create(&nd, 0); |
718 |
|
|
error = PTR_ERR(new_dentry); |
719 |
|
|
if (!IS_ERR(new_dentry)) { |
720 |
kumaneko |
2290 |
+ error = ccs_check_link_permission(old_nd.dentry, |
721 |
|
|
+ nd.dentry->d_inode, |
722 |
|
|
+ new_dentry, nd.mnt); |
723 |
kumaneko |
1603 |
+ if (!error) |
724 |
|
|
error = vfs_link(old_nd.dentry, nd.dentry->d_inode, new_dentry); |
725 |
|
|
dput(new_dentry); |
726 |
|
|
} |
727 |
kumaneko |
2796 |
@@ -1928,12 +1967,18 @@ static inline int do_rename(const char * |
728 |
kumaneko |
1603 |
error = PTR_ERR(new_dentry); |
729 |
|
|
if (IS_ERR(new_dentry)) |
730 |
|
|
goto exit4; |
731 |
kumaneko |
2290 |
+ error = ccs_check_rename_permission(old_dir->d_inode, old_dentry, |
732 |
|
|
+ new_dir->d_inode, new_dentry, |
733 |
|
|
+ newnd.mnt); |
734 |
|
|
+ if (error) |
735 |
|
|
+ goto exit5; |
736 |
kumaneko |
1603 |
|
737 |
|
|
lock_kernel(); |
738 |
|
|
error = vfs_rename(old_dir->d_inode, old_dentry, |
739 |
kumaneko |
2290 |
new_dir->d_inode, new_dentry); |
740 |
|
|
unlock_kernel(); |
741 |
|
|
|
742 |
|
|
+exit5: |
743 |
|
|
dput(new_dentry); |
744 |
|
|
exit4: |
745 |
|
|
dput(old_dentry); |
746 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/namespace.c |
747 |
|
|
+++ linux-2.4.37.5/fs/namespace.c |
748 |
kumaneko |
2859 |
@@ -21,6 +21,8 @@ |
749 |
kumaneko |
1603 |
#include <linux/seq_file.h> |
750 |
|
|
#include <linux/namespace.h> |
751 |
|
|
|
752 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
753 |
kumaneko |
1603 |
+ |
754 |
|
|
struct vfsmount *do_kern_mount(const char *type, int flags, char *name, void *data); |
755 |
|
|
int do_remount_sb(struct super_block *sb, int flags, void * data); |
756 |
|
|
void kill_super(struct super_block *sb); |
757 |
kumaneko |
2859 |
@@ -290,6 +292,8 @@ static int do_umount(struct vfsmount *mn |
758 |
kumaneko |
1603 |
{ |
759 |
|
|
struct super_block * sb = mnt->mnt_sb; |
760 |
|
|
int retval = 0; |
761 |
|
|
+ if (ccs_may_umount(mnt)) |
762 |
|
|
+ return -EPERM; |
763 |
|
|
|
764 |
|
|
/* |
765 |
|
|
* If we may have to abort operations to get out of this |
766 |
kumaneko |
2859 |
@@ -365,6 +369,8 @@ asmlinkage long sys_umount(char * name, |
767 |
kumaneko |
1603 |
{ |
768 |
|
|
struct nameidata nd; |
769 |
|
|
int retval; |
770 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_UMOUNT)) |
771 |
kumaneko |
1603 |
+ return -EPERM; |
772 |
|
|
|
773 |
|
|
retval = __user_walk(name, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &nd); |
774 |
|
|
if (retval) |
775 |
kumaneko |
2859 |
@@ -500,6 +506,9 @@ static int do_loopback(struct nameidata |
776 |
kumaneko |
1603 |
down_write(¤t->namespace->sem); |
777 |
|
|
err = -EINVAL; |
778 |
|
|
if (check_mnt(nd->mnt) && (!recurse || check_mnt(old_nd.mnt))) { |
779 |
|
|
+ err = -EPERM; |
780 |
|
|
+ if (ccs_may_mount(nd)) |
781 |
|
|
+ goto out; |
782 |
|
|
err = -ENOMEM; |
783 |
|
|
if (recurse) |
784 |
|
|
mnt = copy_tree(old_nd.mnt, old_nd.dentry); |
785 |
kumaneko |
2859 |
@@ -516,7 +525,7 @@ static int do_loopback(struct nameidata |
786 |
kumaneko |
1603 |
} else |
787 |
|
|
mntput(mnt); |
788 |
|
|
} |
789 |
|
|
- |
790 |
|
|
+ out: |
791 |
|
|
up_write(¤t->namespace->sem); |
792 |
|
|
path_release(&old_nd); |
793 |
|
|
return err; |
794 |
kumaneko |
2859 |
@@ -570,6 +579,10 @@ static int do_move_mount(struct nameidat |
795 |
kumaneko |
1603 |
if (!check_mnt(nd->mnt) || !check_mnt(old_nd.mnt)) |
796 |
|
|
goto out; |
797 |
|
|
|
798 |
|
|
+ err = -EPERM; |
799 |
|
|
+ if (ccs_may_umount(old_nd.mnt) || ccs_may_mount(nd)) |
800 |
|
|
+ goto out; |
801 |
|
|
+ |
802 |
|
|
err = -ENOENT; |
803 |
|
|
down(&nd->dentry->d_inode->i_zombie); |
804 |
|
|
if (IS_DEADDIR(nd->dentry->d_inode)) |
805 |
kumaneko |
2859 |
@@ -641,6 +654,10 @@ static int do_add_mount(struct nameidata |
806 |
kumaneko |
1603 |
if (nd->mnt->mnt_sb == mnt->mnt_sb && nd->mnt->mnt_root == nd->dentry) |
807 |
|
|
goto unlock; |
808 |
|
|
|
809 |
|
|
+ err = -EPERM; |
810 |
|
|
+ if (ccs_may_mount(nd)) |
811 |
|
|
+ goto unlock; |
812 |
|
|
+ |
813 |
|
|
mnt->mnt_flags = mnt_flags; |
814 |
|
|
err = graft_tree(mnt, nd); |
815 |
|
|
unlock: |
816 |
kumaneko |
2866 |
@@ -718,6 +735,11 @@ long do_mount(char * dev_name, char * di |
817 |
kumaneko |
1603 |
if (data_page) |
818 |
|
|
((char *)data_page)[PAGE_SIZE - 1] = 0; |
819 |
|
|
|
820 |
|
|
+ retval = ccs_check_mount_permission(dev_name, dir_name, type_page, |
821 |
|
|
+ &flags); |
822 |
|
|
+ if (retval) |
823 |
|
|
+ return retval; |
824 |
|
|
+ |
825 |
|
|
/* Separate the per-mountpoint flags */ |
826 |
|
|
if (flags & MS_NOSUID) |
827 |
|
|
mnt_flags |= MNT_NOSUID; |
828 |
kumaneko |
2866 |
@@ -911,6 +933,8 @@ asmlinkage long sys_pivot_root(const cha |
829 |
kumaneko |
1603 |
|
830 |
|
|
if (!capable(CAP_SYS_ADMIN)) |
831 |
|
|
return -EPERM; |
832 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_PIVOT_ROOT)) |
833 |
kumaneko |
1603 |
+ return -EPERM; |
834 |
|
|
|
835 |
|
|
lock_kernel(); |
836 |
|
|
|
837 |
kumaneko |
2866 |
@@ -925,6 +949,11 @@ asmlinkage long sys_pivot_root(const cha |
838 |
kumaneko |
1603 |
if (error) |
839 |
|
|
goto out1; |
840 |
|
|
|
841 |
|
|
+ error = ccs_check_pivot_root_permission(&old_nd, &new_nd); |
842 |
|
|
+ if (error) { |
843 |
|
|
+ path_release(&old_nd); |
844 |
|
|
+ goto out1; |
845 |
|
|
+ } |
846 |
|
|
read_lock(¤t->fs->lock); |
847 |
|
|
user_nd.mnt = mntget(current->fs->rootmnt); |
848 |
|
|
user_nd.dentry = dget(current->fs->root); |
849 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/open.c |
850 |
|
|
+++ linux-2.4.37.5/fs/open.c |
851 |
kumaneko |
2859 |
@@ -20,6 +20,8 @@ |
852 |
kumaneko |
1603 |
|
853 |
|
|
#define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) |
854 |
|
|
|
855 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
856 |
kumaneko |
1603 |
+ |
857 |
|
|
int vfs_statfs(struct super_block *sb, struct statfs *buf) |
858 |
|
|
{ |
859 |
|
|
int retval = -ENODEV; |
860 |
kumaneko |
2859 |
@@ -164,6 +166,9 @@ static inline long do_sys_truncate(const |
861 |
kumaneko |
1603 |
if (error) |
862 |
|
|
goto dput_and_out; |
863 |
|
|
|
864 |
kumaneko |
2290 |
+ error = ccs_check_truncate_permission(nd.dentry, nd.mnt, length, 0); |
865 |
kumaneko |
1603 |
+ if (!error) |
866 |
|
|
+ |
867 |
|
|
error = locks_verify_truncate(inode, NULL, length); |
868 |
|
|
if (!error) { |
869 |
|
|
DQUOT_INIT(inode); |
870 |
kumaneko |
2859 |
@@ -217,6 +222,10 @@ static inline long do_sys_ftruncate(unsi |
871 |
kumaneko |
1603 |
if (IS_APPEND(inode)) |
872 |
|
|
goto out_putf; |
873 |
|
|
|
874 |
kumaneko |
2290 |
+ error = ccs_check_truncate_permission(dentry, file->f_vfsmnt, length, |
875 |
|
|
+ 0); |
876 |
kumaneko |
1603 |
+ if (error) |
877 |
|
|
+ goto out_putf; |
878 |
|
|
error = locks_verify_truncate(inode, file, length); |
879 |
|
|
if (!error) |
880 |
|
|
error = do_truncate(dentry, length); |
881 |
kumaneko |
2859 |
@@ -466,6 +475,10 @@ asmlinkage long sys_chroot(const char * |
882 |
kumaneko |
1603 |
error = -EPERM; |
883 |
|
|
if (!capable(CAP_SYS_CHROOT)) |
884 |
|
|
goto dput_and_out; |
885 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_CHROOT)) |
886 |
kumaneko |
1603 |
+ goto dput_and_out; |
887 |
|
|
+ if (ccs_check_chroot_permission(&nd)) |
888 |
|
|
+ goto dput_and_out; |
889 |
|
|
|
890 |
|
|
set_fs_root(current->fs, nd.mnt, nd.dentry); |
891 |
|
|
set_fs_altroot(); |
892 |
kumaneko |
2869 |
@@ -497,6 +510,9 @@ asmlinkage long sys_fchmod(unsigned int |
893 |
|
|
err = -EPERM; |
894 |
|
|
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
895 |
|
|
goto out_putf; |
896 |
|
|
+ err = ccs_chmod_permission(dentry, file->f_vfsmnt, mode); |
897 |
|
|
+ if (err) |
898 |
|
|
+ goto out_putf; |
899 |
|
|
if (mode == (mode_t) -1) |
900 |
|
|
mode = inode->i_mode; |
901 |
|
|
newattrs.ia_mode = (mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO); |
902 |
|
|
@@ -528,6 +544,9 @@ asmlinkage long sys_chmod(const char * f |
903 |
|
|
error = -EPERM; |
904 |
|
|
if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) |
905 |
|
|
goto dput_and_out; |
906 |
|
|
+ error = ccs_chmod_permission(nd.dentry, nd.mnt, mode); |
907 |
|
|
+ if (error) |
908 |
|
|
+ goto dput_and_out; |
909 |
|
|
|
910 |
|
|
if (mode == (mode_t) -1) |
911 |
|
|
mode = inode->i_mode; |
912 |
|
|
@@ -608,6 +627,8 @@ asmlinkage long sys_chown(const char * f |
913 |
|
|
|
914 |
|
|
error = user_path_walk(filename, &nd); |
915 |
|
|
if (!error) { |
916 |
|
|
+ error = ccs_chown_permission(nd.dentry, nd.mnt, user, group); |
917 |
|
|
+ if (!error) |
918 |
|
|
error = chown_common(nd.dentry, user, group); |
919 |
|
|
path_release(&nd); |
920 |
|
|
} |
921 |
|
|
@@ -621,6 +642,8 @@ asmlinkage long sys_lchown(const char * |
922 |
|
|
|
923 |
|
|
error = user_path_walk_link(filename, &nd); |
924 |
|
|
if (!error) { |
925 |
|
|
+ error = ccs_chown_permission(nd.dentry, nd.mnt, user, group); |
926 |
|
|
+ if (!error) |
927 |
|
|
error = chown_common(nd.dentry, user, group); |
928 |
|
|
path_release(&nd); |
929 |
|
|
} |
930 |
|
|
@@ -635,6 +658,9 @@ asmlinkage long sys_fchown(unsigned int |
931 |
|
|
|
932 |
|
|
file = fget(fd); |
933 |
|
|
if (file) { |
934 |
|
|
+ error = ccs_chown_permission(file->f_dentry, file->f_vfsmnt, |
935 |
|
|
+ user, group); |
936 |
|
|
+ if (!error) |
937 |
|
|
error = chown_common(file->f_dentry, user, group); |
938 |
|
|
fput(file); |
939 |
|
|
} |
940 |
|
|
@@ -897,6 +923,8 @@ out_unlock: |
941 |
kumaneko |
1603 |
*/ |
942 |
|
|
asmlinkage long sys_vhangup(void) |
943 |
|
|
{ |
944 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_VHANGUP)) |
945 |
kumaneko |
1603 |
+ return -EPERM; |
946 |
|
|
if (capable(CAP_SYS_TTY_CONFIG)) { |
947 |
|
|
tty_vhangup(current->tty); |
948 |
|
|
return 0; |
949 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/fs/proc/proc_misc.c |
950 |
|
|
+++ linux-2.4.37.5/fs/proc/proc_misc.c |
951 |
kumaneko |
2796 |
@@ -670,4 +670,5 @@ void __init proc_misc_init(void) |
952 |
kumaneko |
1603 |
entry->proc_fops = &ppc_htab_operations; |
953 |
|
|
} |
954 |
|
|
#endif |
955 |
kumaneko |
2901 |
+ printk(KERN_INFO "Hook version: 2.4.37.5 2009/08/14\n"); |
956 |
kumaneko |
1603 |
} |
957 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/include/linux/sched.h |
958 |
|
|
+++ linux-2.4.37.5/include/linux/sched.h |
959 |
kumaneko |
2796 |
@@ -29,6 +29,8 @@ extern unsigned long event; |
960 |
kumaneko |
1603 |
|
961 |
|
|
struct exec_domain; |
962 |
|
|
|
963 |
kumaneko |
2282 |
+struct ccs_domain_info; |
964 |
kumaneko |
1603 |
+ |
965 |
|
|
/* |
966 |
|
|
* cloning flags: |
967 |
|
|
*/ |
968 |
kumaneko |
2796 |
@@ -417,6 +419,8 @@ struct task_struct { |
969 |
kumaneko |
1811 |
void *journal_info; |
970 |
kumaneko |
1603 |
|
971 |
kumaneko |
1811 |
struct list_head *scm_work_list; |
972 |
kumaneko |
2282 |
+ struct ccs_domain_info *ccs_domain_info; |
973 |
|
|
+ u32 ccs_flags; |
974 |
kumaneko |
1603 |
}; |
975 |
|
|
|
976 |
|
|
/* |
977 |
kumaneko |
2796 |
@@ -512,6 +516,8 @@ extern struct exec_domain default_exec_d |
978 |
kumaneko |
1603 |
blocked: {{0}}, \ |
979 |
|
|
alloc_lock: SPIN_LOCK_UNLOCKED, \ |
980 |
|
|
journal_info: NULL, \ |
981 |
kumaneko |
2282 |
+ ccs_domain_info: NULL, \ |
982 |
|
|
+ ccs_flags: 0 \ |
983 |
kumaneko |
1603 |
} |
984 |
|
|
|
985 |
|
|
|
986 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/kernel/kmod.c |
987 |
|
|
+++ linux-2.4.37.5/kernel/kmod.c |
988 |
kumaneko |
2796 |
@@ -134,6 +134,9 @@ int exec_usermodehelper(char *program_pa |
989 |
kumaneko |
1603 |
/* Allow execve args to be in kernel space. */ |
990 |
|
|
set_fs(KERNEL_DS); |
991 |
|
|
|
992 |
kumaneko |
2282 |
+ current->ccs_domain_info = NULL; |
993 |
|
|
+ current->ccs_flags = 0; |
994 |
kumaneko |
1603 |
+ |
995 |
|
|
/* Go, go, go... */ |
996 |
|
|
if (execve(program_path, argv, envp) < 0) |
997 |
|
|
return -errno; |
998 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/kernel/module.c |
999 |
|
|
+++ linux-2.4.37.5/kernel/module.c |
1000 |
kumaneko |
2796 |
@@ -10,6 +10,7 @@ |
1001 |
kumaneko |
1603 |
#include <linux/slab.h> |
1002 |
|
|
#include <linux/kmod.h> |
1003 |
|
|
#include <linux/seq_file.h> |
1004 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1005 |
kumaneko |
1603 |
|
1006 |
|
|
/* |
1007 |
|
|
* Originally by Anonymous (as far as I know...) |
1008 |
kumaneko |
2796 |
@@ -298,6 +299,8 @@ sys_create_module(const char *name_user, |
1009 |
kumaneko |
1603 |
|
1010 |
|
|
if (!capable(CAP_SYS_MODULE)) |
1011 |
|
|
return -EPERM; |
1012 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_USE_KERNEL_MODULE)) |
1013 |
kumaneko |
1603 |
+ return -EPERM; |
1014 |
|
|
lock_kernel(); |
1015 |
|
|
if ((namelen = get_mod_name(name_user, &name)) < 0) { |
1016 |
|
|
error = namelen; |
1017 |
kumaneko |
2796 |
@@ -353,6 +356,8 @@ sys_init_module(const char *name_user, s |
1018 |
kumaneko |
1603 |
|
1019 |
|
|
if (!capable(CAP_SYS_MODULE)) |
1020 |
|
|
return -EPERM; |
1021 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_USE_KERNEL_MODULE)) |
1022 |
kumaneko |
1603 |
+ return -EPERM; |
1023 |
|
|
lock_kernel(); |
1024 |
|
|
if ((namelen = get_mod_name(name_user, &name)) < 0) { |
1025 |
|
|
error = namelen; |
1026 |
kumaneko |
2796 |
@@ -614,6 +619,8 @@ sys_delete_module(const char *name_user) |
1027 |
kumaneko |
1603 |
|
1028 |
|
|
if (!capable(CAP_SYS_MODULE)) |
1029 |
|
|
return -EPERM; |
1030 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_USE_KERNEL_MODULE)) |
1031 |
kumaneko |
1603 |
+ return -EPERM; |
1032 |
|
|
|
1033 |
|
|
lock_kernel(); |
1034 |
|
|
if (name_user) { |
1035 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/kernel/sched.c |
1036 |
|
|
+++ linux-2.4.37.5/kernel/sched.c |
1037 |
kumaneko |
2796 |
@@ -32,6 +32,7 @@ |
1038 |
kumaneko |
1603 |
|
1039 |
|
|
#include <asm/uaccess.h> |
1040 |
|
|
#include <asm/mmu_context.h> |
1041 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1042 |
kumaneko |
1603 |
|
1043 |
|
|
extern void timer_bh(void); |
1044 |
|
|
extern void tqueue_bh(void); |
1045 |
kumaneko |
2796 |
@@ -899,6 +900,8 @@ void set_cpus_allowed(struct task_struct |
1046 |
kumaneko |
1603 |
asmlinkage long sys_nice(int increment) |
1047 |
|
|
{ |
1048 |
|
|
long newprio; |
1049 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_NICE)) |
1050 |
kumaneko |
1603 |
+ return -EPERM; |
1051 |
|
|
|
1052 |
|
|
/* |
1053 |
|
|
* Setpriority might change our priority at the same moment. |
1054 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/kernel/signal.c |
1055 |
|
|
+++ linux-2.4.37.5/kernel/signal.c |
1056 |
kumaneko |
2796 |
@@ -15,6 +15,7 @@ |
1057 |
kumaneko |
1603 |
#include <linux/sched.h> |
1058 |
|
|
|
1059 |
|
|
#include <asm/uaccess.h> |
1060 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1061 |
kumaneko |
1603 |
|
1062 |
|
|
/* |
1063 |
|
|
* SLAB caches for signal bits. |
1064 |
kumaneko |
2851 |
@@ -1025,6 +1026,8 @@ asmlinkage long |
1065 |
kumaneko |
1603 |
sys_kill(int pid, int sig) |
1066 |
|
|
{ |
1067 |
|
|
struct siginfo info; |
1068 |
kumaneko |
2851 |
+ if (ccs_kill_permission(pid, sig)) |
1069 |
kumaneko |
1603 |
+ return -EPERM; |
1070 |
|
|
|
1071 |
|
|
info.si_signo = sig; |
1072 |
|
|
info.si_errno = 0; |
1073 |
kumaneko |
2851 |
@@ -1048,6 +1051,8 @@ sys_tkill(int pid, int sig) |
1074 |
|
|
/* This is only valid for single tasks */ |
1075 |
kumaneko |
1603 |
if (pid <= 0) |
1076 |
|
|
return -EINVAL; |
1077 |
kumaneko |
2851 |
+ if (ccs_tkill_permission(pid, sig)) |
1078 |
|
|
+ return -EPERM; |
1079 |
kumaneko |
1603 |
|
1080 |
|
|
info.si_signo = sig; |
1081 |
|
|
info.si_errno = 0; |
1082 |
kumaneko |
2869 |
@@ -1078,6 +1083,8 @@ sys_rt_sigqueueinfo(int pid, int sig, si |
1083 |
|
|
if (info.si_code >= 0) |
1084 |
|
|
return -EPERM; |
1085 |
|
|
info.si_signo = sig; |
1086 |
|
|
+ if (ccs_sigqueue_permission(pid, sig)) |
1087 |
|
|
+ return -EPERM; |
1088 |
|
|
|
1089 |
|
|
/* POSIX.1b doesn't mention process groups. */ |
1090 |
|
|
return kill_proc_info(sig, &info, pid); |
1091 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/kernel/sys.c |
1092 |
|
|
+++ linux-2.4.37.5/kernel/sys.c |
1093 |
kumaneko |
2796 |
@@ -17,6 +17,7 @@ |
1094 |
kumaneko |
1603 |
|
1095 |
|
|
#include <asm/uaccess.h> |
1096 |
|
|
#include <asm/io.h> |
1097 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1098 |
kumaneko |
1603 |
|
1099 |
|
|
#ifndef SET_UNALIGN_CTL |
1100 |
|
|
# define SET_UNALIGN_CTL(a,b) (-EINVAL) |
1101 |
kumaneko |
2796 |
@@ -220,6 +221,8 @@ asmlinkage long sys_setpriority(int whic |
1102 |
kumaneko |
1603 |
|
1103 |
|
|
if (which > 2 || which < 0) |
1104 |
|
|
return -EINVAL; |
1105 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_NICE)) |
1106 |
kumaneko |
1603 |
+ return -EPERM; |
1107 |
|
|
|
1108 |
|
|
/* normalize: avoid signed division (rounding problems) */ |
1109 |
|
|
error = -ESRCH; |
1110 |
kumaneko |
2796 |
@@ -299,6 +302,8 @@ asmlinkage long sys_reboot(int magic1, i |
1111 |
kumaneko |
1603 |
(magic2 != LINUX_REBOOT_MAGIC2 && magic2 != LINUX_REBOOT_MAGIC2A && |
1112 |
|
|
magic2 != LINUX_REBOOT_MAGIC2B)) |
1113 |
|
|
return -EINVAL; |
1114 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_REBOOT)) |
1115 |
kumaneko |
1603 |
+ return -EPERM; |
1116 |
|
|
|
1117 |
|
|
lock_kernel(); |
1118 |
|
|
switch (cmd) { |
1119 |
kumaneko |
2796 |
@@ -1042,6 +1047,8 @@ asmlinkage long sys_sethostname(char *na |
1120 |
kumaneko |
1603 |
return -EPERM; |
1121 |
|
|
if (len < 0 || len > __NEW_UTS_LEN) |
1122 |
|
|
return -EINVAL; |
1123 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETHOSTNAME)) |
1124 |
kumaneko |
1603 |
+ return -EPERM; |
1125 |
|
|
down_write(&uts_sem); |
1126 |
|
|
errno = -EFAULT; |
1127 |
|
|
if (!copy_from_user(tmp, name, len)) { |
1128 |
kumaneko |
2796 |
@@ -1083,6 +1090,8 @@ asmlinkage long sys_setdomainname(char * |
1129 |
kumaneko |
1603 |
return -EPERM; |
1130 |
|
|
if (len < 0 || len > __NEW_UTS_LEN) |
1131 |
|
|
return -EINVAL; |
1132 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETHOSTNAME)) |
1133 |
kumaneko |
1603 |
+ return -EPERM; |
1134 |
|
|
|
1135 |
|
|
down_write(&uts_sem); |
1136 |
|
|
errno = -EFAULT; |
1137 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/kernel/sysctl.c |
1138 |
|
|
+++ linux-2.4.37.5/kernel/sysctl.c |
1139 |
kumaneko |
2796 |
@@ -33,6 +33,7 @@ |
1140 |
kumaneko |
1603 |
#include <linux/swap.h> |
1141 |
|
|
|
1142 |
|
|
#include <asm/uaccess.h> |
1143 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1144 |
kumaneko |
1603 |
|
1145 |
|
|
#ifdef CONFIG_ROOT_NFS |
1146 |
|
|
#include <linux/nfs_fs.h> |
1147 |
kumaneko |
2796 |
@@ -439,6 +440,9 @@ int do_sysctl(int *name, int nlen, void |
1148 |
kumaneko |
1603 |
|
1149 |
|
|
spin_unlock(&sysctl_lock); |
1150 |
|
|
|
1151 |
kumaneko |
2298 |
+ error = ccs_parse_table(name, nlen, oldval, newval, |
1152 |
kumaneko |
1603 |
+ head->ctl_table); |
1153 |
|
|
+ if (!error) |
1154 |
|
|
error = parse_table(name, nlen, oldval, oldlenp, |
1155 |
|
|
newval, newlen, head->ctl_table, |
1156 |
|
|
&context); |
1157 |
kumaneko |
2796 |
@@ -508,6 +512,13 @@ repeat: |
1158 |
kumaneko |
1603 |
if (ctl_perm(table, 001)) |
1159 |
|
|
return -EPERM; |
1160 |
|
|
if (table->strategy) { |
1161 |
|
|
+ int op = 0; |
1162 |
|
|
+ if (oldval) |
1163 |
|
|
+ op |= 004; |
1164 |
|
|
+ if (newval) |
1165 |
|
|
+ op |= 002; |
1166 |
|
|
+ if (ctl_perm(table, op)) |
1167 |
|
|
+ return -EPERM; |
1168 |
|
|
error = table->strategy( |
1169 |
|
|
table, name, nlen, |
1170 |
|
|
oldval, oldlenp, |
1171 |
kumaneko |
2796 |
@@ -1456,7 +1467,7 @@ int sysctl_string(ctl_table *table, int |
1172 |
kumaneko |
1603 |
len--; |
1173 |
|
|
((char *) table->data)[len] = 0; |
1174 |
|
|
} |
1175 |
|
|
- return 0; |
1176 |
|
|
+ return 1; |
1177 |
|
|
} |
1178 |
|
|
|
1179 |
|
|
/* |
1180 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/kernel/time.c |
1181 |
|
|
+++ linux-2.4.37.5/kernel/time.c |
1182 |
kumaneko |
2796 |
@@ -29,6 +29,7 @@ |
1183 |
kumaneko |
1603 |
#include <linux/smp_lock.h> |
1184 |
|
|
|
1185 |
|
|
#include <asm/uaccess.h> |
1186 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1187 |
kumaneko |
1603 |
|
1188 |
|
|
/* |
1189 |
|
|
* The timezone where the local system is located. Used as a default by some |
1190 |
kumaneko |
2796 |
@@ -77,6 +78,8 @@ asmlinkage long sys_stime(int * tptr) |
1191 |
kumaneko |
1603 |
|
1192 |
|
|
if (!capable(CAP_SYS_TIME)) |
1193 |
|
|
return -EPERM; |
1194 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETTIME)) |
1195 |
kumaneko |
1603 |
+ return -EPERM; |
1196 |
|
|
if (get_user(value, tptr)) |
1197 |
|
|
return -EFAULT; |
1198 |
|
|
write_lock_irq(&xtime_lock); |
1199 |
kumaneko |
2796 |
@@ -151,6 +154,8 @@ int do_sys_settimeofday(struct timeval * |
1200 |
kumaneko |
1603 |
|
1201 |
|
|
if (!capable(CAP_SYS_TIME)) |
1202 |
|
|
return -EPERM; |
1203 |
kumaneko |
2282 |
+ if (!ccs_capable(CCS_SYS_SETTIME)) |
1204 |
kumaneko |
1603 |
+ return -EPERM; |
1205 |
|
|
|
1206 |
|
|
if (tz) { |
1207 |
|
|
/* SMP safe, global irq locking makes it work. */ |
1208 |
kumaneko |
2796 |
@@ -217,6 +222,8 @@ int do_adjtimex(struct timex *txc) |
1209 |
kumaneko |
1603 |
/* In order to modify anything, you gotta be super-user! */ |
1210 |
|
|
if (txc->modes && !capable(CAP_SYS_TIME)) |
1211 |
|
|
return -EPERM; |
1212 |
kumaneko |
2282 |
+ if (txc->modes && !ccs_capable(CCS_SYS_SETTIME)) |
1213 |
kumaneko |
1603 |
+ return -EPERM; |
1214 |
|
|
|
1215 |
|
|
/* Now we validate the data before disabling interrupts */ |
1216 |
|
|
|
1217 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/net/ipv4/raw.c |
1218 |
|
|
+++ linux-2.4.37.5/net/ipv4/raw.c |
1219 |
kumaneko |
2796 |
@@ -64,6 +64,7 @@ |
1220 |
kumaneko |
2459 |
#include <net/raw.h> |
1221 |
|
|
#include <net/inet_common.h> |
1222 |
kumaneko |
1603 |
#include <net/checksum.h> |
1223 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1224 |
kumaneko |
1603 |
|
1225 |
kumaneko |
2459 |
struct sock *raw_v4_htable[RAWV4_HTABLE_SIZE]; |
1226 |
|
|
rwlock_t raw_v4_lock = RW_LOCK_UNLOCKED; |
1227 |
kumaneko |
2796 |
@@ -503,6 +504,9 @@ int raw_recvmsg(struct sock *sk, struct |
1228 |
kumaneko |
2459 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
1229 |
|
|
if (!skb) |
1230 |
|
|
goto out; |
1231 |
|
|
+ err = ccs_socket_recvmsg_permission(sk, skb, flags); |
1232 |
|
|
+ if (err) |
1233 |
|
|
+ goto out; |
1234 |
kumaneko |
1603 |
|
1235 |
kumaneko |
2459 |
copied = skb->len; |
1236 |
|
|
if (len < copied) { |
1237 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/net/ipv4/tcp_ipv4.c |
1238 |
|
|
+++ linux-2.4.37.5/net/ipv4/tcp_ipv4.c |
1239 |
kumaneko |
2796 |
@@ -67,6 +67,7 @@ |
1240 |
kumaneko |
1603 |
#include <linux/inet.h> |
1241 |
|
|
#include <linux/stddef.h> |
1242 |
|
|
#include <linux/ipsec.h> |
1243 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1244 |
kumaneko |
1603 |
|
1245 |
|
|
extern int sysctl_ip_dynaddr; |
1246 |
|
|
extern int sysctl_ip_default_ttl; |
1247 |
kumaneko |
2796 |
@@ -228,6 +229,8 @@ static int tcp_v4_get_port(struct sock * |
1248 |
kumaneko |
1603 |
rover = low; |
1249 |
|
|
head = &tcp_bhash[tcp_bhashfn(rover)]; |
1250 |
|
|
spin_lock(&head->lock); |
1251 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(rover)) |
1252 |
kumaneko |
1603 |
+ goto next; |
1253 |
|
|
for (tb = head->chain; tb; tb = tb->next) |
1254 |
|
|
if (tb->port == rover) |
1255 |
|
|
goto next; |
1256 |
kumaneko |
2796 |
@@ -688,6 +691,8 @@ static int tcp_v4_hash_connect(struct so |
1257 |
kumaneko |
1603 |
rover = low; |
1258 |
|
|
head = &tcp_bhash[tcp_bhashfn(rover)]; |
1259 |
|
|
spin_lock(&head->lock); |
1260 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(rover)) |
1261 |
kumaneko |
1603 |
+ goto next_port; |
1262 |
|
|
|
1263 |
|
|
/* Does not bother with rcv_saddr checks, |
1264 |
|
|
* because the established check is already |
1265 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/net/ipv4/udp.c |
1266 |
|
|
+++ linux-2.4.37.5/net/ipv4/udp.c |
1267 |
kumaneko |
2859 |
@@ -97,6 +97,7 @@ |
1268 |
kumaneko |
1603 |
#include <net/route.h> |
1269 |
|
|
#include <net/inet_common.h> |
1270 |
|
|
#include <net/checksum.h> |
1271 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1272 |
kumaneko |
1603 |
|
1273 |
|
|
/* |
1274 |
|
|
* Snmp MIB for the UDP layer |
1275 |
kumaneko |
2859 |
@@ -131,6 +132,8 @@ static int udp_v4_get_port(struct sock * |
1276 |
kumaneko |
1603 |
result = sysctl_local_port_range[0] + |
1277 |
|
|
((result - sysctl_local_port_range[0]) & |
1278 |
|
|
(UDP_HTABLE_SIZE - 1)); |
1279 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(result)) |
1280 |
kumaneko |
1603 |
+ continue; |
1281 |
|
|
goto gotit; |
1282 |
|
|
} |
1283 |
|
|
size = 0; |
1284 |
kumaneko |
2859 |
@@ -148,6 +151,8 @@ static int udp_v4_get_port(struct sock * |
1285 |
kumaneko |
1603 |
result = sysctl_local_port_range[0] |
1286 |
|
|
+ ((result - sysctl_local_port_range[0]) & |
1287 |
|
|
(UDP_HTABLE_SIZE - 1)); |
1288 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(result)) |
1289 |
kumaneko |
1603 |
+ continue; |
1290 |
|
|
if (!udp_lport_inuse(result)) |
1291 |
|
|
break; |
1292 |
|
|
} |
1293 |
kumaneko |
2859 |
@@ -711,6 +716,9 @@ try_again: |
1294 |
kumaneko |
2459 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
1295 |
|
|
if (!skb) |
1296 |
|
|
goto out; |
1297 |
|
|
+ err = ccs_socket_recvmsg_permission(sk, skb, flags); |
1298 |
|
|
+ if (err) |
1299 |
|
|
+ goto out; |
1300 |
|
|
|
1301 |
|
|
copied = skb->len - sizeof(struct udphdr); |
1302 |
|
|
if (copied > len) { |
1303 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/net/ipv6/raw.c |
1304 |
|
|
+++ linux-2.4.37.5/net/ipv6/raw.c |
1305 |
kumaneko |
2796 |
@@ -45,6 +45,7 @@ |
1306 |
kumaneko |
2459 |
#include <net/inet_common.h> |
1307 |
|
|
|
1308 |
|
|
#include <net/rawv6.h> |
1309 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1310 |
kumaneko |
2459 |
|
1311 |
|
|
struct sock *raw_v6_htable[RAWV6_HTABLE_SIZE]; |
1312 |
|
|
rwlock_t raw_v6_lock = RW_LOCK_UNLOCKED; |
1313 |
kumaneko |
2796 |
@@ -369,6 +370,9 @@ int rawv6_recvmsg(struct sock *sk, struc |
1314 |
kumaneko |
2459 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
1315 |
|
|
if (!skb) |
1316 |
|
|
goto out; |
1317 |
|
|
+ err = ccs_socket_recvmsg_permission(sk, skb, flags); |
1318 |
|
|
+ if (err) |
1319 |
|
|
+ goto out; |
1320 |
|
|
|
1321 |
|
|
copied = skb->len; |
1322 |
|
|
if (copied > len) { |
1323 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/net/ipv6/tcp_ipv6.c |
1324 |
|
|
+++ linux-2.4.37.5/net/ipv6/tcp_ipv6.c |
1325 |
kumaneko |
2796 |
@@ -52,6 +52,7 @@ |
1326 |
kumaneko |
1603 |
#include <net/inet_ecn.h> |
1327 |
|
|
|
1328 |
|
|
#include <asm/uaccess.h> |
1329 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1330 |
kumaneko |
1603 |
|
1331 |
|
|
static void tcp_v6_send_reset(struct sk_buff *skb); |
1332 |
|
|
static void tcp_v6_or_send_ack(struct sk_buff *skb, struct open_request *req); |
1333 |
kumaneko |
2796 |
@@ -110,6 +111,8 @@ static int tcp_v6_get_port(struct sock * |
1334 |
kumaneko |
1603 |
rover = low; |
1335 |
|
|
head = &tcp_bhash[tcp_bhashfn(rover)]; |
1336 |
|
|
spin_lock(&head->lock); |
1337 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(rover)) |
1338 |
kumaneko |
1603 |
+ goto next; |
1339 |
|
|
for (tb = head->chain; tb; tb = tb->next) |
1340 |
|
|
if (tb->port == rover) |
1341 |
|
|
goto next; |
1342 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/net/ipv6/udp.c |
1343 |
|
|
+++ linux-2.4.37.5/net/ipv6/udp.c |
1344 |
kumaneko |
2859 |
@@ -50,6 +50,7 @@ |
1345 |
kumaneko |
1603 |
#include <net/inet_common.h> |
1346 |
|
|
|
1347 |
|
|
#include <net/checksum.h> |
1348 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1349 |
kumaneko |
1603 |
|
1350 |
|
|
struct udp_mib udp_stats_in6[NR_CPUS*2]; |
1351 |
|
|
|
1352 |
kumaneko |
2859 |
@@ -77,6 +78,8 @@ static int udp_v6_get_port(struct sock * |
1353 |
kumaneko |
1603 |
result = sysctl_local_port_range[0] + |
1354 |
|
|
((result - sysctl_local_port_range[0]) & |
1355 |
|
|
(UDP_HTABLE_SIZE - 1)); |
1356 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(result)) |
1357 |
kumaneko |
1603 |
+ continue; |
1358 |
|
|
goto gotit; |
1359 |
|
|
} |
1360 |
|
|
size = 0; |
1361 |
kumaneko |
2859 |
@@ -94,6 +97,8 @@ static int udp_v6_get_port(struct sock * |
1362 |
kumaneko |
1603 |
result = sysctl_local_port_range[0] |
1363 |
|
|
+ ((result - sysctl_local_port_range[0]) & |
1364 |
|
|
(UDP_HTABLE_SIZE - 1)); |
1365 |
kumaneko |
2299 |
+ if (ccs_lport_reserved(result)) |
1366 |
kumaneko |
1603 |
+ continue; |
1367 |
|
|
if (!udp_lport_inuse(result)) |
1368 |
|
|
break; |
1369 |
|
|
} |
1370 |
kumaneko |
2859 |
@@ -406,6 +411,9 @@ try_again: |
1371 |
kumaneko |
2459 |
skb = skb_recv_datagram(sk, flags, noblock, &err); |
1372 |
|
|
if (!skb) |
1373 |
|
|
goto out; |
1374 |
|
|
+ err = ccs_socket_recvmsg_permission(sk, skb, flags); |
1375 |
|
|
+ if (err) |
1376 |
|
|
+ goto out; |
1377 |
|
|
|
1378 |
|
|
copied = skb->len - sizeof(struct udphdr); |
1379 |
|
|
if (copied > len) { |
1380 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/net/socket.c |
1381 |
|
|
+++ linux-2.4.37.5/net/socket.c |
1382 |
kumaneko |
2859 |
@@ -84,6 +84,7 @@ |
1383 |
kumaneko |
1603 |
#include <net/sock.h> |
1384 |
|
|
#include <net/scm.h> |
1385 |
|
|
#include <linux/netfilter.h> |
1386 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1387 |
kumaneko |
1603 |
|
1388 |
|
|
static int sock_no_open(struct inode *irrelevant, struct file *dontcare); |
1389 |
|
|
static ssize_t sock_read(struct file *file, char *buf, |
1390 |
kumaneko |
2859 |
@@ -501,7 +502,10 @@ int sock_sendmsg(struct socket *sock, st |
1391 |
kumaneko |
1603 |
{ |
1392 |
|
|
int err; |
1393 |
|
|
struct scm_cookie scm; |
1394 |
|
|
- |
1395 |
|
|
+ err = ccs_socket_sendmsg_permission(sock, |
1396 |
|
|
+ (struct sockaddr *) msg->msg_name, |
1397 |
|
|
+ msg->msg_namelen); |
1398 |
|
|
+ if (!err) |
1399 |
|
|
err = scm_send(sock, msg, &scm); |
1400 |
|
|
if (err >= 0) { |
1401 |
|
|
err = sock->ops->sendmsg(sock, msg, size, &scm); |
1402 |
kumaneko |
2901 |
@@ -850,7 +854,9 @@ int sock_create(int family, int type, in |
1403 |
kumaneko |
1603 |
} |
1404 |
|
|
family = PF_PACKET; |
1405 |
|
|
} |
1406 |
|
|
- |
1407 |
|
|
+ i = ccs_socket_create_permission(family, type, protocol); |
1408 |
|
|
+ if (i) |
1409 |
|
|
+ return i; |
1410 |
|
|
#if defined(CONFIG_KMOD) && defined(CONFIG_NET) |
1411 |
|
|
/* Attempt to load a protocol module if the find failed. |
1412 |
|
|
* |
1413 |
kumaneko |
2901 |
@@ -1006,6 +1012,10 @@ asmlinkage long sys_bind(int fd, struct |
1414 |
kumaneko |
1603 |
if((sock = sockfd_lookup(fd,&err))!=NULL) |
1415 |
|
|
{ |
1416 |
|
|
if((err=move_addr_to_kernel(umyaddr,addrlen,address))>=0) |
1417 |
|
|
+ err = ccs_socket_bind_permission(sock, |
1418 |
|
|
+ (struct sockaddr *) |
1419 |
|
|
+ address, addrlen); |
1420 |
|
|
+ if (!err) |
1421 |
|
|
err = sock->ops->bind(sock, (struct sockaddr *)address, addrlen); |
1422 |
|
|
sockfd_put(sock); |
1423 |
|
|
} |
1424 |
kumaneko |
2901 |
@@ -1029,6 +1039,8 @@ asmlinkage long sys_listen(int fd, int b |
1425 |
kumaneko |
1603 |
if ((sock = sockfd_lookup(fd, &err)) != NULL) { |
1426 |
|
|
if ((unsigned) backlog > sysctl_somaxconn) |
1427 |
|
|
backlog = sysctl_somaxconn; |
1428 |
|
|
+ err = ccs_socket_listen_permission(sock); |
1429 |
|
|
+ if (!err) |
1430 |
|
|
err=sock->ops->listen(sock, backlog); |
1431 |
|
|
sockfd_put(sock); |
1432 |
|
|
} |
1433 |
kumaneko |
2901 |
@@ -1069,6 +1081,11 @@ asmlinkage long sys_accept(int fd, struc |
1434 |
kumaneko |
1603 |
if (err < 0) |
1435 |
|
|
goto out_release; |
1436 |
|
|
|
1437 |
|
|
+ if (ccs_socket_accept_permission(newsock, |
1438 |
|
|
+ (struct sockaddr *) address)) { |
1439 |
|
|
+ err = -ECONNABORTED; /* Hope less harmful than -EPERM. */ |
1440 |
|
|
+ goto out_release; |
1441 |
|
|
+ } |
1442 |
|
|
if (upeer_sockaddr) { |
1443 |
|
|
if(newsock->ops->getname(newsock, (struct sockaddr *)address, &len, 2)<0) { |
1444 |
|
|
err = -ECONNABORTED; |
1445 |
kumaneko |
2901 |
@@ -1119,6 +1136,10 @@ asmlinkage long sys_connect(int fd, stru |
1446 |
kumaneko |
1603 |
err = move_addr_to_kernel(uservaddr, addrlen, address); |
1447 |
|
|
if (err < 0) |
1448 |
|
|
goto out_put; |
1449 |
|
|
+ err = ccs_socket_connect_permission(sock, (struct sockaddr *) address, |
1450 |
|
|
+ addrlen); |
1451 |
|
|
+ if (err) |
1452 |
|
|
+ goto out_put; |
1453 |
|
|
err = sock->ops->connect(sock, (struct sockaddr *) address, addrlen, |
1454 |
|
|
sock->file->f_flags); |
1455 |
|
|
out_put: |
1456 |
kumaneko |
2901 |
--- linux-2.4.37.5.orig/net/unix/af_unix.c |
1457 |
|
|
+++ linux-2.4.37.5/net/unix/af_unix.c |
1458 |
kumaneko |
2796 |
@@ -111,6 +111,7 @@ |
1459 |
kumaneko |
1603 |
#include <linux/rtnetlink.h> |
1460 |
|
|
|
1461 |
|
|
#include <asm/checksum.h> |
1462 |
kumaneko |
2859 |
+#include <linux/ccsecurity.h> |
1463 |
kumaneko |
1603 |
|
1464 |
|
|
int sysctl_unix_max_dgram_qlen = 10; |
1465 |
|
|
|
1466 |
kumaneko |
2796 |
@@ -710,6 +711,9 @@ static int unix_bind(struct socket *sock |
1467 |
kumaneko |
1603 |
* All right, let's create it. |
1468 |
|
|
*/ |
1469 |
|
|
mode = S_IFSOCK | (sock->inode->i_mode & ~current->fs->umask); |
1470 |
kumaneko |
2290 |
+ err = ccs_check_mknod_permission(nd.dentry->d_inode, dentry, |
1471 |
|
|
+ nd.mnt, mode, 0); |
1472 |
kumaneko |
1603 |
+ if (!err) |
1473 |
|
|
err = vfs_mknod(nd.dentry->d_inode, dentry, mode, 0); |
1474 |
|
|
if (err) |
1475 |
|
|
goto out_mknod_dput; |