1 diff -NurpP --minimal linux-2.6.35.2/arch/alpha/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/Kconfig
2 --- linux-2.6.35.2/arch/alpha/Kconfig 2010-08-02 16:51:53.000000000 +0200
3 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/Kconfig 2010-08-02 17:05:05.000000000 +0200
4 @@ -681,6 +681,8 @@ config DUMMY_CONSOLE
8 +source "kernel/vserver/Kconfig"
10 source "security/Kconfig"
12 source "crypto/Kconfig"
13 diff -NurpP --minimal linux-2.6.35.2/arch/alpha/kernel/entry.S linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/entry.S
14 --- linux-2.6.35.2/arch/alpha/kernel/entry.S 2009-06-11 17:11:46.000000000 +0200
15 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/entry.S 2010-08-02 17:05:05.000000000 +0200
16 @@ -874,24 +874,15 @@ sys_getxgid:
25 - /* See linux/kernel/timer.c sys_getppid for discussion
27 - ldq $3, TASK_GROUP_LEADER($2)
28 - ldq $4, TASK_REAL_PARENT($3)
29 - ldl $0, TASK_TGID($2)
30 -1: ldl $1, TASK_TGID($4)
34 - ldq $3, TASK_GROUP_LEADER($2)
35 - ldq $4, TASK_REAL_PARENT($3)
48 diff -NurpP --minimal linux-2.6.35.2/arch/alpha/kernel/osf_sys.c linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/osf_sys.c
49 --- linux-2.6.35.2/arch/alpha/kernel/osf_sys.c 2010-07-07 18:30:51.000000000 +0200
50 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/osf_sys.c 2010-08-02 17:05:05.000000000 +0200
51 @@ -866,7 +866,7 @@ SYSCALL_DEFINE2(osf_gettimeofday, struct
55 - do_gettimeofday(&ktv);
56 + vx_gettimeofday(&ktv);
57 if (put_tv32(tv, &ktv))
60 diff -NurpP --minimal linux-2.6.35.2/arch/alpha/kernel/ptrace.c linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/ptrace.c
61 --- linux-2.6.35.2/arch/alpha/kernel/ptrace.c 2010-07-07 18:30:51.000000000 +0200
62 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/ptrace.c 2010-08-02 17:05:05.000000000 +0200
64 #include <linux/user.h>
65 #include <linux/security.h>
66 #include <linux/signal.h>
67 +#include <linux/vs_base.h>
69 #include <asm/uaccess.h>
70 #include <asm/pgtable.h>
71 diff -NurpP --minimal linux-2.6.35.2/arch/alpha/kernel/systbls.S linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/systbls.S
72 --- linux-2.6.35.2/arch/alpha/kernel/systbls.S 2010-02-25 11:51:19.000000000 +0100
73 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/systbls.S 2010-08-02 17:05:05.000000000 +0200
74 @@ -446,7 +446,7 @@ sys_call_table:
75 .quad sys_stat64 /* 425 */
78 - .quad sys_ni_syscall /* sys_vserver */
79 + .quad sys_vserver /* sys_vserver */
80 .quad sys_ni_syscall /* sys_mbind */
81 .quad sys_ni_syscall /* sys_get_mempolicy */
82 .quad sys_ni_syscall /* sys_set_mempolicy */
83 diff -NurpP --minimal linux-2.6.35.2/arch/alpha/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/traps.c
84 --- linux-2.6.35.2/arch/alpha/kernel/traps.c 2010-07-07 18:30:51.000000000 +0200
85 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/alpha/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
86 @@ -184,7 +184,8 @@ die_if_kernel(char * str, struct pt_regs
88 printk("CPU %d ", hard_smp_processor_id());
90 - printk("%s(%d): %s %ld\n", current->comm, task_pid_nr(current), str, err);
91 + printk("%s(%d[#%u]): %s %ld\n", current->comm,
92 + task_pid_nr(current), current->xid, str, err);
93 dik_show_regs(regs, r9_15);
95 dik_show_trace((unsigned long *)(regs+1));
96 diff -NurpP --minimal linux-2.6.35.2/arch/arm/include/asm/tlb.h linux-2.6.35.2-vs2.3.0.36.31/arch/arm/include/asm/tlb.h
97 --- linux-2.6.35.2/arch/arm/include/asm/tlb.h 2009-09-10 15:25:15.000000000 +0200
98 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/arm/include/asm/tlb.h 2010-08-02 17:05:05.000000000 +0200
101 #else /* !CONFIG_MMU */
103 +#include <linux/vs_memory.h>
104 #include <asm/pgalloc.h>
107 diff -NurpP --minimal linux-2.6.35.2/arch/arm/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/arm/Kconfig
108 --- linux-2.6.35.2/arch/arm/Kconfig 2010-08-14 18:16:58.000000000 +0200
109 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/arm/Kconfig 2010-08-14 18:19:32.000000000 +0200
110 @@ -1685,6 +1685,8 @@ source "fs/Kconfig"
112 source "arch/arm/Kconfig.debug"
114 +source "kernel/vserver/Kconfig"
116 source "security/Kconfig"
118 source "crypto/Kconfig"
119 diff -NurpP --minimal linux-2.6.35.2/arch/arm/kernel/calls.S linux-2.6.35.2-vs2.3.0.36.31/arch/arm/kernel/calls.S
120 --- linux-2.6.35.2/arch/arm/kernel/calls.S 2010-07-07 18:30:52.000000000 +0200
121 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/arm/kernel/calls.S 2010-08-02 17:05:05.000000000 +0200
123 /* 310 */ CALL(sys_request_key)
125 CALL(ABI(sys_semtimedop, sys_oabi_semtimedop))
126 -/* vserver */ CALL(sys_ni_syscall)
129 /* 315 */ CALL(sys_ioprio_get)
130 CALL(sys_inotify_init)
131 diff -NurpP --minimal linux-2.6.35.2/arch/arm/kernel/process.c linux-2.6.35.2-vs2.3.0.36.31/arch/arm/kernel/process.c
132 --- linux-2.6.35.2/arch/arm/kernel/process.c 2010-08-02 16:51:55.000000000 +0200
133 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/arm/kernel/process.c 2010-08-02 17:05:05.000000000 +0200
134 @@ -269,7 +269,8 @@ void __show_regs(struct pt_regs *regs)
135 void show_regs(struct pt_regs * regs)
138 - printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
139 + printk("Pid: %d[#%u], comm: %20s\n",
140 + task_pid_nr(current), current->xid, current->comm);
144 diff -NurpP --minimal linux-2.6.35.2/arch/arm/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/arm/kernel/traps.c
145 --- linux-2.6.35.2/arch/arm/kernel/traps.c 2010-07-07 18:30:52.000000000 +0200
146 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/arm/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
147 @@ -243,8 +243,8 @@ static int __die(const char *str, int er
151 - printk(KERN_EMERG "Process %.*s (pid: %d, stack limit = 0x%p)\n",
152 - TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1);
153 + printk(KERN_EMERG "Process %.*s (pid: %d:#%u, stack limit = 0x%p)\n",
154 + TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), tsk->xid, thread + 1);
156 if (!user_mode(regs) || in_interrupt()) {
157 dump_mem(KERN_EMERG, "Stack: ", regs->ARM_sp,
158 diff -NurpP --minimal linux-2.6.35.2/arch/avr32/mm/fault.c linux-2.6.35.2-vs2.3.0.36.31/arch/avr32/mm/fault.c
159 --- linux-2.6.35.2/arch/avr32/mm/fault.c 2009-09-10 15:25:20.000000000 +0200
160 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/avr32/mm/fault.c 2010-08-02 17:05:05.000000000 +0200
161 @@ -216,7 +216,8 @@ out_of_memory:
162 down_read(&mm->mmap_sem);
165 - printk("VM: Killing process %s\n", tsk->comm);
166 + printk("VM: Killing process %s(%d:#%u)\n",
167 + tsk->comm, task_pid_nr(tsk), tsk->xid);
169 do_group_exit(SIGKILL);
171 diff -NurpP --minimal linux-2.6.35.2/arch/cris/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/cris/Kconfig
172 --- linux-2.6.35.2/arch/cris/Kconfig 2010-08-02 16:52:03.000000000 +0200
173 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/cris/Kconfig 2010-08-02 17:05:05.000000000 +0200
174 @@ -694,6 +694,8 @@ source "drivers/staging/Kconfig"
176 source "arch/cris/Kconfig.debug"
178 +source "kernel/vserver/Kconfig"
180 source "security/Kconfig"
182 source "crypto/Kconfig"
183 diff -NurpP --minimal linux-2.6.35.2/arch/cris/mm/fault.c linux-2.6.35.2-vs2.3.0.36.31/arch/cris/mm/fault.c
184 --- linux-2.6.35.2/arch/cris/mm/fault.c 2010-02-25 11:51:26.000000000 +0100
185 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/cris/mm/fault.c 2010-08-02 17:05:05.000000000 +0200
186 @@ -245,7 +245,8 @@ do_page_fault(unsigned long address, str
189 up_read(&mm->mmap_sem);
190 - printk("VM: killing process %s\n", tsk->comm);
191 + printk("VM: killing process %s(%d:#%u)\n",
192 + tsk->comm, task_pid_nr(tsk), tsk->xid);
196 diff -NurpP --minimal linux-2.6.35.2/arch/frv/kernel/kernel_thread.S linux-2.6.35.2-vs2.3.0.36.31/arch/frv/kernel/kernel_thread.S
197 --- linux-2.6.35.2/arch/frv/kernel/kernel_thread.S 2008-12-25 00:26:37.000000000 +0100
198 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/frv/kernel/kernel_thread.S 2010-08-02 17:05:05.000000000 +0200
199 @@ -37,7 +37,7 @@ kernel_thread:
201 # start by forking the current process, but with shared VM
202 setlos.p #__NR_clone,gr7 ; syscall number
203 - ori gr10,#CLONE_VM,gr8 ; first syscall arg [clone_flags]
204 + ori gr10,#CLONE_KT,gr8 ; first syscall arg [clone_flags]
205 sethi.p #0xe4e4,gr9 ; second syscall arg [newsp]
207 setlos.p #0,gr10 ; third syscall arg [parent_tidptr]
208 diff -NurpP --minimal linux-2.6.35.2/arch/h8300/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/h8300/Kconfig
209 --- linux-2.6.35.2/arch/h8300/Kconfig 2010-02-25 11:51:26.000000000 +0100
210 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/h8300/Kconfig 2010-08-02 17:05:05.000000000 +0200
211 @@ -230,6 +230,8 @@ source "fs/Kconfig"
213 source "arch/h8300/Kconfig.debug"
215 +source "kernel/vserver/Kconfig"
217 source "security/Kconfig"
219 source "crypto/Kconfig"
220 diff -NurpP --minimal linux-2.6.35.2/arch/ia64/include/asm/tlb.h linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/include/asm/tlb.h
221 --- linux-2.6.35.2/arch/ia64/include/asm/tlb.h 2010-02-25 11:51:26.000000000 +0100
222 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/include/asm/tlb.h 2010-08-02 17:05:05.000000000 +0200
224 #include <linux/mm.h>
225 #include <linux/pagemap.h>
226 #include <linux/swap.h>
227 +#include <linux/vs_memory.h>
229 #include <asm/pgalloc.h>
230 #include <asm/processor.h>
231 diff -NurpP --minimal linux-2.6.35.2/arch/ia64/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/Kconfig
232 --- linux-2.6.35.2/arch/ia64/Kconfig 2010-08-02 16:52:03.000000000 +0200
233 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/Kconfig 2010-08-02 17:05:05.000000000 +0200
234 @@ -676,6 +676,8 @@ source "fs/Kconfig"
236 source "arch/ia64/Kconfig.debug"
238 +source "kernel/vserver/Kconfig"
240 source "security/Kconfig"
242 source "crypto/Kconfig"
243 diff -NurpP --minimal linux-2.6.35.2/arch/ia64/kernel/entry.S linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/entry.S
244 --- linux-2.6.35.2/arch/ia64/kernel/entry.S 2010-07-07 18:31:01.000000000 +0200
245 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/entry.S 2010-08-02 17:05:05.000000000 +0200
246 @@ -1714,7 +1714,7 @@ sys_call_table:
248 data8 sys_mq_getsetattr
250 - data8 sys_ni_syscall // reserved for vserver
252 data8 sys_waitid // 1270
254 data8 sys_request_key
255 diff -NurpP --minimal linux-2.6.35.2/arch/ia64/kernel/perfmon.c linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/perfmon.c
256 --- linux-2.6.35.2/arch/ia64/kernel/perfmon.c 2010-07-07 18:31:01.000000000 +0200
257 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/perfmon.c 2010-08-02 17:05:05.000000000 +0200
259 #include <linux/completion.h>
260 #include <linux/tracehook.h>
261 #include <linux/slab.h>
262 +#include <linux/vs_memory.h>
264 #include <asm/errno.h>
265 #include <asm/intrinsics.h>
266 diff -NurpP --minimal linux-2.6.35.2/arch/ia64/kernel/process.c linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/process.c
267 --- linux-2.6.35.2/arch/ia64/kernel/process.c 2010-07-07 18:31:01.000000000 +0200
268 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/process.c 2010-08-02 17:05:05.000000000 +0200
269 @@ -113,8 +113,8 @@ show_regs (struct pt_regs *regs)
270 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
273 - printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
274 - smp_processor_id(), current->comm);
275 + printk("\nPid: %d[#%u], CPU %d, comm: %20s\n", task_pid_nr(current),
276 + current->xid, smp_processor_id(), current->comm);
277 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n",
278 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
279 init_utsname()->release);
280 diff -NurpP --minimal linux-2.6.35.2/arch/ia64/kernel/ptrace.c linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/ptrace.c
281 --- linux-2.6.35.2/arch/ia64/kernel/ptrace.c 2010-08-02 16:52:04.000000000 +0200
282 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/ptrace.c 2010-08-02 17:05:05.000000000 +0200
284 #include <linux/regset.h>
285 #include <linux/elf.h>
286 #include <linux/tracehook.h>
287 +#include <linux/vs_base.h>
289 #include <asm/pgtable.h>
290 #include <asm/processor.h>
291 diff -NurpP --minimal linux-2.6.35.2/arch/ia64/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/traps.c
292 --- linux-2.6.35.2/arch/ia64/kernel/traps.c 2010-07-07 18:31:01.000000000 +0200
293 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
294 @@ -59,8 +59,9 @@ die (const char *str, struct pt_regs *re
297 if (++die.lock_owner_depth < 3) {
298 - printk("%s[%d]: %s %ld [%d]\n",
299 - current->comm, task_pid_nr(current), str, err, ++die_counter);
300 + printk("%s[%d[#%u]]: %s %ld [%d]\n",
301 + current->comm, task_pid_nr(current), current->xid,
302 + str, err, ++die_counter);
303 if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV)
306 @@ -323,8 +324,9 @@ handle_fpu_swa (int fp_fault, struct pt_
307 if ((last.count & 15) < 5 && (ia64_fetchadd(1, &last.count, acq) & 15) < 5) {
308 last.time = current_jiffies + 5 * HZ;
310 - "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
311 - current->comm, task_pid_nr(current), regs->cr_iip + ia64_psr(regs)->ri, isr);
312 + "%s(%d[#%u]): floating-point assist fault at ip %016lx, isr %016lx\n",
313 + current->comm, task_pid_nr(current), current->xid,
314 + regs->cr_iip + ia64_psr(regs)->ri, isr);
318 diff -NurpP --minimal linux-2.6.35.2/arch/ia64/mm/fault.c linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/mm/fault.c
319 --- linux-2.6.35.2/arch/ia64/mm/fault.c 2010-08-02 16:52:04.000000000 +0200
320 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/ia64/mm/fault.c 2010-08-02 17:05:05.000000000 +0200
322 #include <linux/interrupt.h>
323 #include <linux/kprobes.h>
324 #include <linux/kdebug.h>
325 +#include <linux/vs_memory.h>
327 #include <asm/pgtable.h>
328 #include <asm/processor.h>
329 diff -NurpP --minimal linux-2.6.35.2/arch/m32r/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/m32r/kernel/traps.c
330 --- linux-2.6.35.2/arch/m32r/kernel/traps.c 2009-12-03 20:01:57.000000000 +0100
331 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/m32r/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
332 @@ -196,8 +196,9 @@ static void show_registers(struct pt_reg
334 printk("SPI: %08lx\n", sp);
336 - printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)",
337 - current->comm, task_pid_nr(current), 0xffff & i, 4096+(unsigned long)current);
338 + printk("Process %s (pid: %d[#%u], process nr: %d, stackpage=%08lx)",
339 + current->comm, task_pid_nr(current), current->xid,
340 + 0xffff & i, 4096+(unsigned long)current);
343 * When in-kernel, we also print out the stack and code at the
344 diff -NurpP --minimal linux-2.6.35.2/arch/m68k/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/m68k/Kconfig
345 --- linux-2.6.35.2/arch/m68k/Kconfig 2010-08-02 16:52:04.000000000 +0200
346 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/m68k/Kconfig 2010-08-02 17:05:05.000000000 +0200
347 @@ -619,6 +619,8 @@ source "fs/Kconfig"
349 source "arch/m68k/Kconfig.debug"
351 +source "kernel/vserver/Kconfig"
353 source "security/Kconfig"
355 source "crypto/Kconfig"
356 diff -NurpP --minimal linux-2.6.35.2/arch/m68k/kernel/ptrace.c linux-2.6.35.2-vs2.3.0.36.31/arch/m68k/kernel/ptrace.c
357 --- linux-2.6.35.2/arch/m68k/kernel/ptrace.c 2010-07-07 18:31:02.000000000 +0200
358 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/m68k/kernel/ptrace.c 2010-08-02 17:05:05.000000000 +0200
360 #include <linux/ptrace.h>
361 #include <linux/user.h>
362 #include <linux/signal.h>
363 +#include <linux/vs_base.h>
365 #include <asm/uaccess.h>
366 #include <asm/page.h>
367 @@ -254,6 +255,8 @@ long arch_ptrace(struct task_struct *chi
368 ret = ptrace_request(child, request, addr, data);
371 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
376 diff -NurpP --minimal linux-2.6.35.2/arch/m68k/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/m68k/kernel/traps.c
377 --- linux-2.6.35.2/arch/m68k/kernel/traps.c 2010-08-02 16:52:04.000000000 +0200
378 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/m68k/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
379 @@ -906,8 +906,8 @@ void show_registers(struct pt_regs *regs
380 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
381 regs->d4, regs->d5, regs->a0, regs->a1);
383 - printk("Process %s (pid: %d, task=%p)\n",
384 - current->comm, task_pid_nr(current), current);
385 + printk("Process %s (pid: %d[#%u], task=%p)\n",
386 + current->comm, task_pid_nr(current), current->xid, current);
387 addr = (unsigned long)&fp->un;
388 printk("Frame format=%X ", regs->format);
389 switch (regs->format) {
390 diff -NurpP --minimal linux-2.6.35.2/arch/m68knommu/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/m68knommu/Kconfig
391 --- linux-2.6.35.2/arch/m68knommu/Kconfig 2010-08-02 16:52:04.000000000 +0200
392 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/m68knommu/Kconfig 2010-08-02 17:05:05.000000000 +0200
393 @@ -734,6 +734,8 @@ source "fs/Kconfig"
395 source "arch/m68knommu/Kconfig.debug"
397 +source "kernel/vserver/Kconfig"
399 source "security/Kconfig"
401 source "crypto/Kconfig"
402 diff -NurpP --minimal linux-2.6.35.2/arch/m68knommu/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/m68knommu/kernel/traps.c
403 --- linux-2.6.35.2/arch/m68knommu/kernel/traps.c 2009-09-10 15:25:23.000000000 +0200
404 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/m68knommu/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
405 @@ -78,8 +78,9 @@ void die_if_kernel(char *str, struct pt_
406 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
407 fp->d4, fp->d5, fp->a0, fp->a1);
409 - printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
410 - current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
411 + printk(KERN_EMERG "Process %s (pid: %d[#%u], stackpage=%08lx)\n",
412 + current->comm, task_pid_nr(current), current->xid,
413 + PAGE_SIZE+(unsigned long)current);
414 show_stack(NULL, (unsigned long *)(fp + 1));
415 add_taint(TAINT_DIE);
417 diff -NurpP --minimal linux-2.6.35.2/arch/mips/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/mips/Kconfig
418 --- linux-2.6.35.2/arch/mips/Kconfig 2010-08-02 16:52:05.000000000 +0200
419 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/mips/Kconfig 2010-08-02 17:05:05.000000000 +0200
420 @@ -2253,6 +2253,8 @@ source "fs/Kconfig"
422 source "arch/mips/Kconfig.debug"
424 +source "kernel/vserver/Kconfig"
426 source "security/Kconfig"
428 source "crypto/Kconfig"
429 diff -NurpP --minimal linux-2.6.35.2/arch/mips/kernel/ptrace.c linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/ptrace.c
430 --- linux-2.6.35.2/arch/mips/kernel/ptrace.c 2010-07-07 18:31:04.000000000 +0200
431 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/ptrace.c 2010-08-02 17:05:05.000000000 +0200
433 #include <linux/security.h>
434 #include <linux/audit.h>
435 #include <linux/seccomp.h>
436 +#include <linux/vs_base.h>
438 #include <asm/byteorder.h>
440 @@ -259,6 +260,9 @@ long arch_ptrace(struct task_struct *chi
444 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
448 /* when I and D space are separate, these will need to be fixed. */
449 case PTRACE_PEEKTEXT: /* read word at location addr. */
450 diff -NurpP --minimal linux-2.6.35.2/arch/mips/kernel/scall32-o32.S linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/scall32-o32.S
451 --- linux-2.6.35.2/arch/mips/kernel/scall32-o32.S 2010-02-25 11:51:28.000000000 +0100
452 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/scall32-o32.S 2010-08-02 17:05:05.000000000 +0200
453 @@ -525,7 +525,7 @@ einval: li v0, -ENOSYS
454 sys sys_mq_timedreceive 5
455 sys sys_mq_notify 2 /* 4275 */
456 sys sys_mq_getsetattr 3
457 - sys sys_ni_syscall 0 /* sys_vserver */
460 sys sys_ni_syscall 0 /* available, was setaltroot */
461 sys sys_add_key 5 /* 4280 */
462 diff -NurpP --minimal linux-2.6.35.2/arch/mips/kernel/scall64-64.S linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/scall64-64.S
463 --- linux-2.6.35.2/arch/mips/kernel/scall64-64.S 2010-02-25 11:51:28.000000000 +0100
464 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/scall64-64.S 2010-08-02 17:05:05.000000000 +0200
465 @@ -362,7 +362,7 @@ sys_call_table:
466 PTR sys_mq_timedreceive
468 PTR sys_mq_getsetattr /* 5235 */
469 - PTR sys_ni_syscall /* sys_vserver */
472 PTR sys_ni_syscall /* available, was setaltroot */
474 diff -NurpP --minimal linux-2.6.35.2/arch/mips/kernel/scall64-n32.S linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/scall64-n32.S
475 --- linux-2.6.35.2/arch/mips/kernel/scall64-n32.S 2010-08-02 16:52:05.000000000 +0200
476 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/scall64-n32.S 2010-08-02 17:05:05.000000000 +0200
477 @@ -360,7 +360,7 @@ EXPORT(sysn32_call_table)
478 PTR compat_sys_mq_timedreceive
479 PTR compat_sys_mq_notify
480 PTR compat_sys_mq_getsetattr
481 - PTR sys_ni_syscall /* 6240, sys_vserver */
482 + PTR sys32_vserver /* 6240 */
483 PTR compat_sys_waitid
484 PTR sys_ni_syscall /* available, was setaltroot */
486 diff -NurpP --minimal linux-2.6.35.2/arch/mips/kernel/scall64-o32.S linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/scall64-o32.S
487 --- linux-2.6.35.2/arch/mips/kernel/scall64-o32.S 2010-07-07 18:31:04.000000000 +0200
488 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/scall64-o32.S 2010-08-02 17:05:05.000000000 +0200
489 @@ -480,7 +480,7 @@ sys_call_table:
490 PTR compat_sys_mq_timedreceive
491 PTR compat_sys_mq_notify /* 4275 */
492 PTR compat_sys_mq_getsetattr
493 - PTR sys_ni_syscall /* sys_vserver */
496 PTR sys_ni_syscall /* available, was setaltroot */
497 PTR sys_add_key /* 4280 */
498 diff -NurpP --minimal linux-2.6.35.2/arch/mips/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/traps.c
499 --- linux-2.6.35.2/arch/mips/kernel/traps.c 2010-08-02 16:52:05.000000000 +0200
500 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/mips/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
501 @@ -340,9 +340,10 @@ void show_registers(const struct pt_regs
505 - printk("Process %s (pid: %d, threadinfo=%p, task=%p, tls=%0*lx)\n",
506 - current->comm, current->pid, current_thread_info(), current,
507 - field, current_thread_info()->tp_value);
508 + printk("Process %s (pid: %d:#%u, threadinfo=%p, task=%p, tls=%0*lx)\n",
509 + current->comm, task_pid_nr(current), current->xid,
510 + current_thread_info(), current,
511 + field, current_thread_info()->tp_value);
512 if (cpu_has_userlocal) {
515 diff -NurpP --minimal linux-2.6.35.2/arch/parisc/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/parisc/Kconfig
516 --- linux-2.6.35.2/arch/parisc/Kconfig 2010-08-02 16:52:06.000000000 +0200
517 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/parisc/Kconfig 2010-08-02 17:05:05.000000000 +0200
518 @@ -299,6 +299,8 @@ source "fs/Kconfig"
520 source "arch/parisc/Kconfig.debug"
522 +source "kernel/vserver/Kconfig"
524 source "security/Kconfig"
526 source "crypto/Kconfig"
527 diff -NurpP --minimal linux-2.6.35.2/arch/parisc/kernel/syscall_table.S linux-2.6.35.2-vs2.3.0.36.31/arch/parisc/kernel/syscall_table.S
528 --- linux-2.6.35.2/arch/parisc/kernel/syscall_table.S 2010-07-07 18:31:04.000000000 +0200
529 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/parisc/kernel/syscall_table.S 2010-08-02 17:05:05.000000000 +0200
531 ENTRY_COMP(mbind) /* 260 */
532 ENTRY_COMP(get_mempolicy)
533 ENTRY_COMP(set_mempolicy)
534 - ENTRY_SAME(ni_syscall) /* 263: reserved for vserver */
535 + ENTRY_DIFF(vserver)
537 ENTRY_SAME(request_key) /* 265 */
539 diff -NurpP --minimal linux-2.6.35.2/arch/parisc/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/parisc/kernel/traps.c
540 --- linux-2.6.35.2/arch/parisc/kernel/traps.c 2009-09-10 15:25:40.000000000 +0200
541 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/parisc/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
542 @@ -236,8 +236,9 @@ void die_if_kernel(char *str, struct pt_
546 - printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
547 - current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
548 + printk(KERN_CRIT "%s (pid %d:#%u): %s (code %ld) at " RFMT "\n",
549 + current->comm, task_pid_nr(current), current->xid,
550 + str, err, regs->iaoq[0]);
551 #ifdef PRINT_USER_FAULTS
552 /* XXX for debugging only */
554 @@ -270,8 +271,8 @@ void die_if_kernel(char *str, struct pt_
555 pdc_console_restart();
558 - printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
559 - current->comm, task_pid_nr(current), str, err);
560 + printk(KERN_CRIT "%s (pid %d:#%u): %s (code %ld)\n",
561 + current->comm, task_pid_nr(current), current->xid, str, err);
563 /* Wot's wrong wif bein' racy? */
564 if (current->thread.flags & PARISC_KERNEL_DEATH) {
565 diff -NurpP --minimal linux-2.6.35.2/arch/parisc/mm/fault.c linux-2.6.35.2-vs2.3.0.36.31/arch/parisc/mm/fault.c
566 --- linux-2.6.35.2/arch/parisc/mm/fault.c 2010-08-02 16:52:06.000000000 +0200
567 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/parisc/mm/fault.c 2010-08-02 17:05:05.000000000 +0200
568 @@ -237,8 +237,9 @@ bad_area:
570 #ifdef PRINT_USER_FAULTS
571 printk(KERN_DEBUG "\n");
572 - printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
573 - task_pid_nr(tsk), tsk->comm, code, address);
574 + printk(KERN_DEBUG "do_page_fault() pid=%d:#%u "
575 + "command='%s' type=%lu address=0x%08lx\n",
576 + task_pid_nr(tsk), tsk->xid, tsk->comm, code, address);
578 printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
579 vma->vm_start, vma->vm_end);
580 diff -NurpP --minimal linux-2.6.35.2/arch/powerpc/include/asm/unistd.h linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/include/asm/unistd.h
581 --- linux-2.6.35.2/arch/powerpc/include/asm/unistd.h 2010-07-07 18:31:05.000000000 +0200
582 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/include/asm/unistd.h 2010-08-02 17:05:05.000000000 +0200
585 #define __NR_rtas 255
586 #define __NR_sys_debug_setcontext 256
587 -/* Number 257 is reserved for vserver */
588 +#define __NR_vserver 257
589 #define __NR_migrate_pages 258
590 #define __NR_mbind 259
591 #define __NR_get_mempolicy 260
592 diff -NurpP --minimal linux-2.6.35.2/arch/powerpc/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/Kconfig
593 --- linux-2.6.35.2/arch/powerpc/Kconfig 2010-08-02 16:52:06.000000000 +0200
594 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/Kconfig 2010-08-02 17:05:05.000000000 +0200
595 @@ -990,6 +990,8 @@ source "lib/Kconfig"
597 source "arch/powerpc/Kconfig.debug"
599 +source "kernel/vserver/Kconfig"
601 source "security/Kconfig"
604 diff -NurpP --minimal linux-2.6.35.2/arch/powerpc/kernel/process.c linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/kernel/process.c
605 --- linux-2.6.35.2/arch/powerpc/kernel/process.c 2010-08-02 16:52:07.000000000 +0200
606 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/kernel/process.c 2010-08-02 17:05:05.000000000 +0200
607 @@ -605,8 +605,9 @@ void show_regs(struct pt_regs * regs)
609 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
611 - printk("TASK = %p[%d] '%s' THREAD: %p",
612 - current, task_pid_nr(current), current->comm, task_thread_info(current));
613 + printk("TASK = %p[%d,#%u] '%s' THREAD: %p",
614 + current, task_pid_nr(current), current->xid,
615 + current->comm, task_thread_info(current));
618 printk(" CPU: %d", raw_smp_processor_id());
619 diff -NurpP --minimal linux-2.6.35.2/arch/powerpc/kernel/traps.c linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/kernel/traps.c
620 --- linux-2.6.35.2/arch/powerpc/kernel/traps.c 2010-08-02 16:52:07.000000000 +0200
621 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/kernel/traps.c 2010-08-02 17:05:05.000000000 +0200
622 @@ -1053,8 +1053,9 @@ void nonrecoverable_exception(struct pt_
624 void trace_syscall(struct pt_regs *regs)
626 - printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
627 - current, task_pid_nr(current), regs->nip, regs->link, regs->gpr[0],
628 + printk("Task: %p(%d[#%u]), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
629 + current, task_pid_nr(current), current->xid,
630 + regs->nip, regs->link, regs->gpr[0],
631 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
634 diff -NurpP --minimal linux-2.6.35.2/arch/powerpc/kernel/vdso.c linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/kernel/vdso.c
635 --- linux-2.6.35.2/arch/powerpc/kernel/vdso.c 2010-08-02 16:52:07.000000000 +0200
636 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/powerpc/kernel/vdso.c 2010-08-02 17:43:41.000000000 +0200
638 #include <linux/security.h>
639 #include <linux/bootmem.h>
640 #include <linux/memblock.h>
641 +#include <linux/vs_memory.h>
643 #include <asm/pgtable.h>
644 #include <asm/system.h>
645 diff -NurpP --minimal linux-2.6.35.2/arch/s390/include/asm/tlb.h linux-2.6.35.2-vs2.3.0.36.31/arch/s390/include/asm/tlb.h
646 --- linux-2.6.35.2/arch/s390/include/asm/tlb.h 2009-09-10 15:25:43.000000000 +0200
647 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/s390/include/asm/tlb.h 2010-08-02 17:05:05.000000000 +0200
650 #include <linux/mm.h>
651 #include <linux/swap.h>
652 +#include <linux/vs_memory.h>
654 #include <asm/processor.h>
655 #include <asm/pgalloc.h>
657 diff -NurpP --minimal linux-2.6.35.2/arch/s390/include/asm/unistd.h linux-2.6.35.2-vs2.3.0.36.31/arch/s390/include/asm/unistd.h
658 --- linux-2.6.35.2/arch/s390/include/asm/unistd.h 2010-07-07 18:31:06.000000000 +0200
659 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/s390/include/asm/unistd.h 2010-08-02 17:05:05.000000000 +0200
661 #define __NR_clock_gettime (__NR_timer_create+6)
662 #define __NR_clock_getres (__NR_timer_create+7)
663 #define __NR_clock_nanosleep (__NR_timer_create+8)
664 -/* Number 263 is reserved for vserver */
665 +#define __NR_vserver 263
666 #define __NR_statfs64 265
667 #define __NR_fstatfs64 266
668 #define __NR_remap_file_pages 267
669 diff -NurpP --minimal linux-2.6.35.2/arch/s390/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/s390/Kconfig
670 --- linux-2.6.35.2/arch/s390/Kconfig 2010-08-02 16:52:08.000000000 +0200
671 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/s390/Kconfig 2010-08-02 17:05:05.000000000 +0200
672 @@ -623,6 +623,8 @@ source "fs/Kconfig"
674 source "arch/s390/Kconfig.debug"
676 +source "kernel/vserver/Kconfig"
678 source "security/Kconfig"
680 source "crypto/Kconfig"
681 diff -NurpP --minimal linux-2.6.35.2/arch/s390/kernel/ptrace.c linux-2.6.35.2-vs2.3.0.36.31/arch/s390/kernel/ptrace.c
682 --- linux-2.6.35.2/arch/s390/kernel/ptrace.c 2010-08-02 16:52:09.000000000 +0200
683 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/s390/kernel/ptrace.c 2010-08-02 17:05:05.000000000 +0200
685 #include <linux/regset.h>
686 #include <linux/tracehook.h>
687 #include <linux/seccomp.h>
688 +#include <linux/vs_base.h>
689 #include <trace/syscall.h>
690 #include <asm/compat.h>
691 #include <asm/segment.h>
692 diff -NurpP --minimal linux-2.6.35.2/arch/s390/kernel/syscalls.S linux-2.6.35.2-vs2.3.0.36.31/arch/s390/kernel/syscalls.S
693 --- linux-2.6.35.2/arch/s390/kernel/syscalls.S 2010-07-07 18:31:07.000000000 +0200
694 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/s390/kernel/syscalls.S 2010-08-02 17:05:05.000000000 +0200
695 @@ -271,7 +271,7 @@ SYSCALL(sys_clock_settime,sys_clock_sett
696 SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */
697 SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
698 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
699 -NI_SYSCALL /* reserved for vserver */
700 +SYSCALL(sys_vserver,sys_vserver,sys32_vserver)
701 SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
702 SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
703 SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
704 diff -NurpP --minimal linux-2.6.35.2/arch/sh/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/sh/Kconfig
705 --- linux-2.6.35.2/arch/sh/Kconfig 2010-08-02 16:52:09.000000000 +0200
706 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/sh/Kconfig 2010-08-02 17:05:05.000000000 +0200
707 @@ -881,6 +881,8 @@ source "fs/Kconfig"
709 source "arch/sh/Kconfig.debug"
711 +source "kernel/vserver/Kconfig"
713 source "security/Kconfig"
715 source "crypto/Kconfig"
716 diff -NurpP --minimal linux-2.6.35.2/arch/sh/kernel/irq.c linux-2.6.35.2-vs2.3.0.36.31/arch/sh/kernel/irq.c
717 --- linux-2.6.35.2/arch/sh/kernel/irq.c 2010-08-02 16:52:10.000000000 +0200
718 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/sh/kernel/irq.c 2010-08-02 17:41:50.000000000 +0200
720 #include <linux/seq_file.h>
721 #include <linux/ftrace.h>
722 #include <linux/delay.h>
723 +// #include <linux/vs_context.h>
724 #include <asm/processor.h>
725 #include <asm/machvec.h>
726 #include <asm/uaccess.h>
727 diff -NurpP --minimal linux-2.6.35.2/arch/sh/kernel/vsyscall/vsyscall.c linux-2.6.35.2-vs2.3.0.36.31/arch/sh/kernel/vsyscall/vsyscall.c
728 --- linux-2.6.35.2/arch/sh/kernel/vsyscall/vsyscall.c 2010-07-07 18:31:10.000000000 +0200
729 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/sh/kernel/vsyscall/vsyscall.c 2010-08-02 17:05:05.000000000 +0200
731 #include <linux/elf.h>
732 #include <linux/sched.h>
733 #include <linux/err.h>
734 +#include <linux/vs_memory.h>
737 * Should the kernel map a VDSO page into processes and pass its
738 diff -NurpP --minimal linux-2.6.35.2/arch/sparc/include/asm/tlb_64.h linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/include/asm/tlb_64.h
739 --- linux-2.6.35.2/arch/sparc/include/asm/tlb_64.h 2009-09-10 15:25:45.000000000 +0200
740 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/include/asm/tlb_64.h 2010-08-02 17:05:05.000000000 +0200
743 #include <linux/swap.h>
744 #include <linux/pagemap.h>
745 +#include <linux/vs_memory.h>
746 #include <asm/pgalloc.h>
747 #include <asm/tlbflush.h>
748 #include <asm/mmu_context.h>
749 diff -NurpP --minimal linux-2.6.35.2/arch/sparc/include/asm/unistd.h linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/include/asm/unistd.h
750 --- linux-2.6.35.2/arch/sparc/include/asm/unistd.h 2010-07-07 18:31:10.000000000 +0200
751 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/include/asm/unistd.h 2010-08-02 17:05:05.000000000 +0200
753 #define __NR_timer_getoverrun 264
754 #define __NR_timer_delete 265
755 #define __NR_timer_create 266
756 -/* #define __NR_vserver 267 Reserved for VSERVER */
757 +#define __NR_vserver 267
758 #define __NR_io_setup 268
759 #define __NR_io_destroy 269
760 #define __NR_io_submit 270
761 diff -NurpP --minimal linux-2.6.35.2/arch/sparc/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/Kconfig
762 --- linux-2.6.35.2/arch/sparc/Kconfig 2010-08-02 16:52:10.000000000 +0200
763 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/Kconfig 2010-08-02 17:05:05.000000000 +0200
764 @@ -570,6 +570,8 @@ source "fs/Kconfig"
766 source "arch/sparc/Kconfig.debug"
768 +source "kernel/vserver/Kconfig"
770 source "security/Kconfig"
772 source "crypto/Kconfig"
773 diff -NurpP --minimal linux-2.6.35.2/arch/sparc/kernel/systbls_32.S linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/kernel/systbls_32.S
774 --- linux-2.6.35.2/arch/sparc/kernel/systbls_32.S 2010-02-25 11:51:34.000000000 +0100
775 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/kernel/systbls_32.S 2010-08-02 17:05:05.000000000 +0200
776 @@ -70,7 +70,7 @@ sys_call_table:
777 /*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
778 /*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
779 /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
780 -/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
781 +/*265*/ .long sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
782 /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
783 /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
784 /*280*/ .long sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
785 diff -NurpP --minimal linux-2.6.35.2/arch/sparc/kernel/systbls_64.S linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/kernel/systbls_64.S
786 --- linux-2.6.35.2/arch/sparc/kernel/systbls_64.S 2010-07-07 18:31:10.000000000 +0200
787 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/sparc/kernel/systbls_64.S 2010-08-02 17:05:05.000000000 +0200
788 @@ -71,7 +71,7 @@ sys_call_table32:
789 /*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
790 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
791 /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
792 - .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
793 + .word sys_timer_delete, compat_sys_timer_create, sys32_vserver, compat_sys_io_setup, sys_io_destroy
794 /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
795 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
796 /*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
797 @@ -146,7 +146,7 @@ sys_call_table:
798 /*250*/ .word sys_64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
799 .word sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
800 /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
801 - .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
802 + .word sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
803 /*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
804 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
805 /*280*/ .word sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
806 diff -NurpP --minimal linux-2.6.35.2/arch/um/include/asm/tlb.h linux-2.6.35.2-vs2.3.0.36.31/arch/um/include/asm/tlb.h
807 --- linux-2.6.35.2/arch/um/include/asm/tlb.h 2009-09-10 15:25:46.000000000 +0200
808 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/um/include/asm/tlb.h 2010-08-02 17:05:05.000000000 +0200
811 #include <linux/pagemap.h>
812 #include <linux/swap.h>
813 +#include <linux/vs_memory.h>
814 #include <asm/percpu.h>
815 #include <asm/pgalloc.h>
816 #include <asm/tlbflush.h>
817 diff -NurpP --minimal linux-2.6.35.2/arch/um/include/shared/kern_constants.h linux-2.6.35.2-vs2.3.0.36.31/arch/um/include/shared/kern_constants.h
818 --- linux-2.6.35.2/arch/um/include/shared/kern_constants.h 1970-01-01 01:00:00.000000000 +0100
819 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/um/include/shared/kern_constants.h 2010-08-02 17:05:05.000000000 +0200
821 +#include "../../../../include/generated/asm-offsets.h"
822 diff -NurpP --minimal linux-2.6.35.2/arch/um/include/shared/user_constants.h linux-2.6.35.2-vs2.3.0.36.31/arch/um/include/shared/user_constants.h
823 --- linux-2.6.35.2/arch/um/include/shared/user_constants.h 1970-01-01 01:00:00.000000000 +0100
824 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/um/include/shared/user_constants.h 2010-08-02 17:05:05.000000000 +0200
829 + * This file was generated by arch/um/Makefile
833 +#define HOST_SC_CR2 176 /* offsetof(struct sigcontext, cr2) # */
834 +#define HOST_SC_ERR 152 /* offsetof(struct sigcontext, err) # */
835 +#define HOST_SC_TRAPNO 160 /* offsetof(struct sigcontext, trapno) # */
836 +#define HOST_FP_SIZE 64 /* sizeof(struct _fpstate) / sizeof(unsigned long) # */
837 +#define HOST_RBX 5 /* RBX # */
838 +#define HOST_RCX 11 /* RCX # */
839 +#define HOST_RDI 14 /* RDI # */
840 +#define HOST_RSI 13 /* RSI # */
841 +#define HOST_RDX 12 /* RDX # */
842 +#define HOST_RBP 4 /* RBP # */
843 +#define HOST_RAX 10 /* RAX # */
844 +#define HOST_R8 9 /* R8 # */
845 +#define HOST_R9 8 /* R9 # */
846 +#define HOST_R10 7 /* R10 # */
847 +#define HOST_R11 6 /* R11 # */
848 +#define HOST_R12 3 /* R12 # */
849 +#define HOST_R13 2 /* R13 # */
850 +#define HOST_R14 1 /* R14 # */
851 +#define HOST_R15 0 /* R15 # */
852 +#define HOST_ORIG_RAX 15 /* ORIG_RAX # */
853 +#define HOST_CS 17 /* CS # */
854 +#define HOST_SS 20 /* SS # */
855 +#define HOST_EFLAGS 18 /* EFLAGS # */
856 +#define HOST_IP 16 /* RIP # */
857 +#define HOST_SP 19 /* RSP # */
858 +#define UM_FRAME_SIZE 216 /* sizeof(struct user_regs_struct) # */
859 +#define UM_POLLIN 1 /* POLLIN # */
860 +#define UM_POLLPRI 2 /* POLLPRI # */
861 +#define UM_POLLOUT 4 /* POLLOUT # */
862 +#define UM_PROT_READ 1 /* PROT_READ # */
863 +#define UM_PROT_WRITE 2 /* PROT_WRITE # */
864 +#define UM_PROT_EXEC 4 /* PROT_EXEC # */
866 diff -NurpP --minimal linux-2.6.35.2/arch/um/Kconfig.rest linux-2.6.35.2-vs2.3.0.36.31/arch/um/Kconfig.rest
867 --- linux-2.6.35.2/arch/um/Kconfig.rest 2009-06-11 17:12:19.000000000 +0200
868 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/um/Kconfig.rest 2010-08-02 17:05:05.000000000 +0200
869 @@ -18,6 +18,8 @@ source "drivers/connector/Kconfig"
873 +source "kernel/vserver/Kconfig"
875 source "security/Kconfig"
877 source "crypto/Kconfig"
878 diff -NurpP --minimal linux-2.6.35.2/arch/um/kernel/config.c linux-2.6.35.2-vs2.3.0.36.31/arch/um/kernel/config.c
879 --- linux-2.6.35.2/arch/um/kernel/config.c 1970-01-01 01:00:00.000000000 +0100
880 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/um/kernel/config.c 2010-08-02 17:05:05.000000000 +0200
883 + * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
884 + * Licensed under the GPL
891 +static __initdata const char *config[] = {
894 +"# Automatically generated make config: don't edit\n",
895 +"# Linux kernel version: 2.6.33-vs2.3.0.36.29.1\n",
896 +"# Wed Mar 10 20:29:46 2010\n",
898 +"CONFIG_DEFCONFIG_LIST=\"arch/$ARCH/defconfig\"\n",
899 +"CONFIG_GENERIC_HARDIRQS=y\n",
902 +"CONFIG_NO_IOMEM=y\n",
903 +"# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set\n",
904 +"CONFIG_LOCKDEP_SUPPORT=y\n",
905 +"# CONFIG_STACKTRACE_SUPPORT is not set\n",
906 +"CONFIG_GENERIC_CALIBRATE_DELAY=y\n",
907 +"CONFIG_GENERIC_BUG=y\n",
908 +"CONFIG_GENERIC_TIME=y\n",
909 +"CONFIG_GENERIC_CLOCKEVENTS=y\n",
910 +"CONFIG_IRQ_RELEASE_METHOD=y\n",
914 +"# UML-specific options\n",
918 +"# Host processor type and features\n",
920 +"# CONFIG_M386 is not set\n",
921 +"# CONFIG_M486 is not set\n",
922 +"# CONFIG_M586 is not set\n",
923 +"# CONFIG_M586TSC is not set\n",
924 +"# CONFIG_M586MMX is not set\n",
925 +"# CONFIG_M686 is not set\n",
926 +"# CONFIG_MPENTIUMII is not set\n",
927 +"# CONFIG_MPENTIUMIII is not set\n",
928 +"# CONFIG_MPENTIUMM is not set\n",
929 +"# CONFIG_MPENTIUM4 is not set\n",
930 +"# CONFIG_MK6 is not set\n",
931 +"# CONFIG_MK7 is not set\n",
933 +"# CONFIG_MCRUSOE is not set\n",
934 +"# CONFIG_MEFFICEON is not set\n",
935 +"# CONFIG_MWINCHIPC6 is not set\n",
936 +"# CONFIG_MWINCHIP3D is not set\n",
937 +"# CONFIG_MGEODEGX1 is not set\n",
938 +"# CONFIG_MGEODE_LX is not set\n",
939 +"# CONFIG_MCYRIXIII is not set\n",
940 +"# CONFIG_MVIAC3_2 is not set\n",
941 +"# CONFIG_MVIAC7 is not set\n",
942 +"# CONFIG_MPSC is not set\n",
943 +"# CONFIG_MCORE2 is not set\n",
944 +"# CONFIG_MATOM is not set\n",
945 +"# CONFIG_GENERIC_CPU is not set\n",
946 +"CONFIG_X86_CPU=y\n",
947 +"CONFIG_X86_INTERNODE_CACHE_SHIFT=6\n",
948 +"# CONFIG_X86_CMPXCHG is not set\n",
949 +"CONFIG_X86_L1_CACHE_SHIFT=6\n",
950 +"CONFIG_X86_WP_WORKS_OK=y\n",
951 +"CONFIG_X86_INTEL_USERCOPY=y\n",
952 +"CONFIG_X86_USE_PPRO_CHECKSUM=y\n",
953 +"CONFIG_X86_TSC=y\n",
954 +"CONFIG_X86_CMOV=y\n",
955 +"CONFIG_X86_MINIMUM_CPU_FAMILY=3\n",
956 +"CONFIG_CPU_SUP_INTEL=y\n",
957 +"CONFIG_CPU_SUP_AMD=y\n",
958 +"CONFIG_CPU_SUP_CENTAUR=y\n",
959 +"CONFIG_UML_X86=y\n",
961 +"# CONFIG_X86_32 is not set\n",
962 +"# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set\n",
963 +"CONFIG_RWSEM_GENERIC_SPINLOCK=y\n",
964 +"# CONFIG_ARCH_HAS_SC_SIGNALS is not set\n",
965 +"# CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA is not set\n",
966 +"CONFIG_SMP_BROKEN=y\n",
967 +"CONFIG_GENERIC_HWEIGHT=y\n",
968 +"# CONFIG_STATIC_LINK is not set\n",
969 +"CONFIG_FLATMEM=y\n",
970 +"CONFIG_FLAT_NODE_MEM_MAP=y\n",
971 +"CONFIG_PAGEFLAGS_EXTENDED=y\n",
972 +"CONFIG_SPLIT_PTLOCK_CPUS=4\n",
973 +"CONFIG_PHYS_ADDR_T_64BIT=y\n",
974 +"CONFIG_ZONE_DMA_FLAG=0\n",
975 +"CONFIG_VIRT_TO_BUS=y\n",
976 +"# CONFIG_KSM is not set\n",
977 +"CONFIG_DEFAULT_MMAP_MIN_ADDR=4096\n",
978 +"# CONFIG_NO_HZ is not set\n",
979 +"# CONFIG_HIGH_RES_TIMERS is not set\n",
980 +"CONFIG_GENERIC_CLOCKEVENTS_BUILD=y\n",
981 +"CONFIG_LD_SCRIPT_DYN=y\n",
982 +"# CONFIG_BINFMT_ELF is not set\n",
983 +"# CONFIG_HAVE_AOUT is not set\n",
984 +"# CONFIG_BINFMT_MISC is not set\n",
985 +"# CONFIG_HOSTFS is not set\n",
986 +"# CONFIG_MCONSOLE is not set\n",
987 +"CONFIG_KERNEL_STACK_ORDER=1\n",
990 +"# General setup\n",
992 +"# CONFIG_EXPERIMENTAL is not set\n",
993 +"CONFIG_BROKEN_ON_SMP=y\n",
994 +"CONFIG_INIT_ENV_ARG_LIMIT=128\n",
995 +"CONFIG_LOCALVERSION=\"\"\n",
996 +"# CONFIG_LOCALVERSION_AUTO is not set\n",
997 +"# CONFIG_SWAP is not set\n",
998 +"CONFIG_SYSVIPC=y\n",
999 +"CONFIG_SYSVIPC_SYSCTL=y\n",
1000 +"# CONFIG_BSD_PROCESS_ACCT is not set\n",
1003 +"# RCU Subsystem\n",
1005 +"CONFIG_TREE_RCU=y\n",
1006 +"# CONFIG_TREE_PREEMPT_RCU is not set\n",
1007 +"# CONFIG_TINY_RCU is not set\n",
1008 +"# CONFIG_RCU_TRACE is not set\n",
1009 +"CONFIG_RCU_FANOUT=64\n",
1010 +"# CONFIG_RCU_FANOUT_EXACT is not set\n",
1011 +"# CONFIG_TREE_RCU_TRACE is not set\n",
1012 +"# CONFIG_IKCONFIG is not set\n",
1013 +"CONFIG_LOG_BUF_SHIFT=17\n",
1014 +"# CONFIG_CGROUPS is not set\n",
1015 +"# CONFIG_SYSFS_DEPRECATED_V2 is not set\n",
1016 +"# CONFIG_RELAY is not set\n",
1017 +"CONFIG_NAMESPACES=y\n",
1018 +"CONFIG_UTS_NS=y\n",
1019 +"CONFIG_IPC_NS=y\n",
1020 +"CONFIG_USER_NS=y\n",
1021 +"# CONFIG_BLK_DEV_INITRD is not set\n",
1022 +"# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set\n",
1023 +"CONFIG_SYSCTL=y\n",
1024 +"CONFIG_ANON_INODES=y\n",
1025 +"# CONFIG_EMBEDDED is not set\n",
1026 +"CONFIG_UID16=y\n",
1027 +"CONFIG_SYSCTL_SYSCALL=y\n",
1028 +"CONFIG_KALLSYMS=y\n",
1029 +"# CONFIG_KALLSYMS_EXTRA_PASS is not set\n",
1030 +"CONFIG_HOTPLUG=y\n",
1031 +"CONFIG_PRINTK=y\n",
1033 +"CONFIG_ELF_CORE=y\n",
1034 +"CONFIG_BASE_FULL=y\n",
1035 +"CONFIG_FUTEX=y\n",
1036 +"CONFIG_EPOLL=y\n",
1037 +"CONFIG_SIGNALFD=y\n",
1038 +"CONFIG_TIMERFD=y\n",
1039 +"CONFIG_EVENTFD=y\n",
1040 +"CONFIG_SHMEM=y\n",
1044 +"# Kernel Performance Events And Counters\n",
1046 +"CONFIG_VM_EVENT_COUNTERS=y\n",
1047 +"CONFIG_SLUB_DEBUG=y\n",
1048 +"# CONFIG_COMPAT_BRK is not set\n",
1049 +"# CONFIG_SLAB is not set\n",
1051 +"# CONFIG_SLOB is not set\n",
1052 +"# CONFIG_PROFILING is not set\n",
1055 +"# GCOV-based kernel profiling\n",
1057 +"# CONFIG_SLOW_WORK is not set\n",
1058 +"# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set\n",
1059 +"CONFIG_SLABINFO=y\n",
1060 +"CONFIG_RT_MUTEXES=y\n",
1061 +"CONFIG_BASE_SMALL=0\n",
1062 +"# CONFIG_MODULES is not set\n",
1063 +"CONFIG_BLOCK=y\n",
1064 +"# CONFIG_BLK_DEV_BSG is not set\n",
1065 +"# CONFIG_BLK_DEV_INTEGRITY is not set\n",
1068 +"# IO Schedulers\n",
1070 +"CONFIG_IOSCHED_NOOP=y\n",
1071 +"# CONFIG_IOSCHED_DEADLINE is not set\n",
1072 +"# CONFIG_IOSCHED_CFQ is not set\n",
1073 +"# CONFIG_DEFAULT_DEADLINE is not set\n",
1074 +"# CONFIG_DEFAULT_CFQ is not set\n",
1075 +"CONFIG_DEFAULT_NOOP=y\n",
1076 +"CONFIG_DEFAULT_IOSCHED=\"noop\"\n",
1077 +"# CONFIG_INLINE_SPIN_TRYLOCK is not set\n",
1078 +"# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set\n",
1079 +"# CONFIG_INLINE_SPIN_LOCK is not set\n",
1080 +"# CONFIG_INLINE_SPIN_LOCK_BH is not set\n",
1081 +"# CONFIG_INLINE_SPIN_LOCK_IRQ is not set\n",
1082 +"# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set\n",
1083 +"CONFIG_INLINE_SPIN_UNLOCK=y\n",
1084 +"# CONFIG_INLINE_SPIN_UNLOCK_BH is not set\n",
1085 +"CONFIG_INLINE_SPIN_UNLOCK_IRQ=y\n",
1086 +"# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set\n",
1087 +"# CONFIG_INLINE_READ_TRYLOCK is not set\n",
1088 +"# CONFIG_INLINE_READ_LOCK is not set\n",
1089 +"# CONFIG_INLINE_READ_LOCK_BH is not set\n",
1090 +"# CONFIG_INLINE_READ_LOCK_IRQ is not set\n",
1091 +"# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set\n",
1092 +"CONFIG_INLINE_READ_UNLOCK=y\n",
1093 +"# CONFIG_INLINE_READ_UNLOCK_BH is not set\n",
1094 +"CONFIG_INLINE_READ_UNLOCK_IRQ=y\n",
1095 +"# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set\n",
1096 +"# CONFIG_INLINE_WRITE_TRYLOCK is not set\n",
1097 +"# CONFIG_INLINE_WRITE_LOCK is not set\n",
1098 +"# CONFIG_INLINE_WRITE_LOCK_BH is not set\n",
1099 +"# CONFIG_INLINE_WRITE_LOCK_IRQ is not set\n",
1100 +"# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set\n",
1101 +"CONFIG_INLINE_WRITE_UNLOCK=y\n",
1102 +"# CONFIG_INLINE_WRITE_UNLOCK_BH is not set\n",
1103 +"CONFIG_INLINE_WRITE_UNLOCK_IRQ=y\n",
1104 +"# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set\n",
1105 +"# CONFIG_MUTEX_SPIN_ON_OWNER is not set\n",
1106 +"# CONFIG_FREEZER is not set\n",
1107 +"# CONFIG_BLK_DEV is not set\n",
1110 +"# Character Devices\n",
1112 +"# CONFIG_STDERR_CONSOLE is not set\n",
1113 +"CONFIG_STDIO_CONSOLE=y\n",
1114 +"# CONFIG_SSL is not set\n",
1115 +"# CONFIG_NULL_CHAN is not set\n",
1116 +"# CONFIG_PORT_CHAN is not set\n",
1117 +"# CONFIG_PTY_CHAN is not set\n",
1118 +"# CONFIG_TTY_CHAN is not set\n",
1119 +"# CONFIG_XTERM_CHAN is not set\n",
1120 +"CONFIG_NOCONFIG_CHAN=y\n",
1121 +"CONFIG_CON_ZERO_CHAN=\"fd:0,fd:1\"\n",
1122 +"CONFIG_CON_CHAN=\"xterm\"\n",
1123 +"CONFIG_SSL_CHAN=\"pty\"\n",
1124 +"# CONFIG_UNIX98_PTYS is not set\n",
1125 +"# CONFIG_LEGACY_PTYS is not set\n",
1126 +"# CONFIG_RAW_DRIVER is not set\n",
1127 +"# CONFIG_WATCHDOG is not set\n",
1128 +"# CONFIG_UML_SOUND is not set\n",
1129 +"# CONFIG_SOUND is not set\n",
1130 +"# CONFIG_SOUND_OSS_CORE is not set\n",
1131 +"# CONFIG_HOSTAUDIO is not set\n",
1132 +"# CONFIG_HW_RANDOM is not set\n",
1133 +"# CONFIG_UML_RANDOM is not set\n",
1134 +"# CONFIG_MMAPPER is not set\n",
1137 +"# Generic Driver Options\n",
1139 +"CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\"\n",
1140 +"CONFIG_STANDALONE=y\n",
1141 +"# CONFIG_PREVENT_FIRMWARE_BUILD is not set\n",
1142 +"CONFIG_FW_LOADER=y\n",
1143 +"# CONFIG_FIRMWARE_IN_KERNEL is not set\n",
1144 +"CONFIG_EXTRA_FIRMWARE=\"\"\n",
1145 +"# CONFIG_SYS_HYPERVISOR is not set\n",
1146 +"# CONFIG_NET is not set\n",
1149 +"# File systems\n",
1151 +"# CONFIG_EXT2_FS is not set\n",
1152 +"# CONFIG_EXT3_FS is not set\n",
1153 +"# CONFIG_EXT4_FS is not set\n",
1154 +"# CONFIG_REISERFS_FS is not set\n",
1155 +"# CONFIG_JFS_FS is not set\n",
1156 +"# CONFIG_FS_POSIX_ACL is not set\n",
1157 +"# CONFIG_XFS_FS is not set\n",
1158 +"CONFIG_FILE_LOCKING=y\n",
1159 +"# CONFIG_FSNOTIFY is not set\n",
1160 +"# CONFIG_DNOTIFY is not set\n",
1161 +"# CONFIG_INOTIFY is not set\n",
1162 +"# CONFIG_INOTIFY_USER is not set\n",
1163 +"# CONFIG_QUOTA is not set\n",
1164 +"# CONFIG_AUTOFS_FS is not set\n",
1165 +"# CONFIG_AUTOFS4_FS is not set\n",
1166 +"# CONFIG_FUSE_FS is not set\n",
1173 +"# CD-ROM/DVD Filesystems\n",
1175 +"# CONFIG_ISO9660_FS is not set\n",
1176 +"# CONFIG_UDF_FS is not set\n",
1179 +"# DOS/FAT/NT Filesystems\n",
1181 +"# CONFIG_MSDOS_FS is not set\n",
1182 +"# CONFIG_VFAT_FS is not set\n",
1183 +"# CONFIG_NTFS_FS is not set\n",
1186 +"# Pseudo filesystems\n",
1188 +"CONFIG_PROC_FS=y\n",
1189 +"# CONFIG_PROC_KCORE is not set\n",
1190 +"CONFIG_PROC_SYSCTL=y\n",
1191 +"CONFIG_PROC_PAGE_MONITOR=y\n",
1192 +"CONFIG_SYSFS=y\n",
1193 +"# CONFIG_TMPFS is not set\n",
1194 +"# CONFIG_HUGETLB_PAGE is not set\n",
1195 +"# CONFIG_CONFIGFS_FS is not set\n",
1196 +"# CONFIG_MISC_FILESYSTEMS is not set\n",
1199 +"# Partition Types\n",
1201 +"# CONFIG_PARTITION_ADVANCED is not set\n",
1202 +"CONFIG_MSDOS_PARTITION=y\n",
1203 +"# CONFIG_NLS is not set\n",
1206 +"# Linux VServer\n",
1208 +"# CONFIG_VSERVER_AUTO_LBACK is not set\n",
1209 +"# CONFIG_VSERVER_COWBL is not set\n",
1210 +"# CONFIG_VSERVER_PROC_SECURE is not set\n",
1211 +"# CONFIG_VSERVER_HARDCPU is not set\n",
1212 +"# CONFIG_TAGGING_NONE is not set\n",
1213 +"# CONFIG_TAGGING_UID16 is not set\n",
1214 +"# CONFIG_TAGGING_GID16 is not set\n",
1215 +"CONFIG_TAGGING_ID24=y\n",
1216 +"# CONFIG_TAGGING_INTERN is not set\n",
1217 +"# CONFIG_TAG_NFSD is not set\n",
1218 +"# CONFIG_VSERVER_PRIVACY is not set\n",
1219 +"CONFIG_VSERVER_CONTEXTS=768\n",
1220 +"# CONFIG_VSERVER_WARN is not set\n",
1221 +"# CONFIG_VSERVER_DEBUG is not set\n",
1222 +"CONFIG_VSERVER=y\n",
1225 +"# Security options\n",
1227 +"# CONFIG_KEYS is not set\n",
1228 +"# CONFIG_SECURITY is not set\n",
1229 +"# CONFIG_SECURITYFS is not set\n",
1230 +"# CONFIG_DEFAULT_SECURITY_SELINUX is not set\n",
1231 +"# CONFIG_DEFAULT_SECURITY_SMACK is not set\n",
1232 +"# CONFIG_DEFAULT_SECURITY_TOMOYO is not set\n",
1233 +"CONFIG_DEFAULT_SECURITY_DAC=y\n",
1234 +"CONFIG_DEFAULT_SECURITY=\"\"\n",
1235 +"# CONFIG_CRYPTO is not set\n",
1236 +"# CONFIG_BINARY_PRINTF is not set\n",
1239 +"# Library routines\n",
1241 +"CONFIG_GENERIC_FIND_FIRST_BIT=y\n",
1242 +"CONFIG_GENERIC_FIND_NEXT_BIT=y\n",
1243 +"CONFIG_GENERIC_FIND_LAST_BIT=y\n",
1244 +"# CONFIG_CRC_CCITT is not set\n",
1245 +"# CONFIG_CRC16 is not set\n",
1246 +"# CONFIG_CRC_T10DIF is not set\n",
1247 +"# CONFIG_CRC_ITU_T is not set\n",
1248 +"# CONFIG_CRC32 is not set\n",
1249 +"# CONFIG_CRC7 is not set\n",
1250 +"# CONFIG_LIBCRC32C is not set\n",
1251 +"CONFIG_HAS_DMA=y\n",
1254 +"# SCSI device support\n",
1256 +"# CONFIG_RAID_ATTRS is not set\n",
1257 +"# CONFIG_SCSI is not set\n",
1258 +"# CONFIG_SCSI_DMA is not set\n",
1259 +"# CONFIG_SCSI_NETLINK is not set\n",
1260 +"# CONFIG_MD is not set\n",
1261 +"# CONFIG_NEW_LEDS is not set\n",
1262 +"# CONFIG_INPUT is not set\n",
1265 +"# Kernel hacking\n",
1267 +"# CONFIG_PRINTK_TIME is not set\n",
1268 +"# CONFIG_ENABLE_WARN_DEPRECATED is not set\n",
1269 +"# CONFIG_ENABLE_MUST_CHECK is not set\n",
1270 +"CONFIG_FRAME_WARN=2048\n",
1271 +"# CONFIG_STRIP_ASM_SYMS is not set\n",
1272 +"# CONFIG_UNUSED_SYMBOLS is not set\n",
1273 +"# CONFIG_DEBUG_FS is not set\n",
1274 +"# CONFIG_DEBUG_KERNEL is not set\n",
1275 +"# CONFIG_SLUB_DEBUG_ON is not set\n",
1276 +"# CONFIG_SLUB_STATS is not set\n",
1277 +"CONFIG_DEBUG_BUGVERBOSE=y\n",
1278 +"CONFIG_DEBUG_MEMORY_INIT=y\n",
1279 +"# CONFIG_RCU_CPU_STALL_DETECTOR is not set\n",
1280 +"# CONFIG_SYSCTL_SYSCALL_CHECK is not set\n",
1281 +"# CONFIG_SAMPLES is not set\n",
1282 +"# CONFIG_DEBUG_STACK_USAGE is not set\n",
1286 +static int __init print_config(char *line, int *add)
1289 + for (i = 0; i < sizeof(config)/sizeof(config[0]); i++)
1290 + printf("%s", config[i]);
1294 +__uml_setup("--showconfig", print_config,
1296 +" Prints the config file that this UML binary was generated from.\n\n"
1299 diff -NurpP --minimal linux-2.6.35.2/arch/um/kernel/config.tmp linux-2.6.35.2-vs2.3.0.36.31/arch/um/kernel/config.tmp
1300 --- linux-2.6.35.2/arch/um/kernel/config.tmp 1970-01-01 01:00:00.000000000 +0100
1301 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/um/kernel/config.tmp 2010-08-02 17:05:05.000000000 +0200
1304 +"# Automatically generated make config: don't edit\n",
1305 +"# Linux kernel version: 2.6.33-vs2.3.0.36.29.1\n",
1306 +"# Wed Mar 10 20:29:46 2010\n",
1308 +"CONFIG_DEFCONFIG_LIST=\"arch/$ARCH/defconfig\"\n",
1309 +"CONFIG_GENERIC_HARDIRQS=y\n",
1312 +"CONFIG_NO_IOMEM=y\n",
1313 +"# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set\n",
1314 +"CONFIG_LOCKDEP_SUPPORT=y\n",
1315 +"# CONFIG_STACKTRACE_SUPPORT is not set\n",
1316 +"CONFIG_GENERIC_CALIBRATE_DELAY=y\n",
1317 +"CONFIG_GENERIC_BUG=y\n",
1318 +"CONFIG_GENERIC_TIME=y\n",
1319 +"CONFIG_GENERIC_CLOCKEVENTS=y\n",
1320 +"CONFIG_IRQ_RELEASE_METHOD=y\n",
1324 +"# UML-specific options\n",
1328 +"# Host processor type and features\n",
1330 +"# CONFIG_M386 is not set\n",
1331 +"# CONFIG_M486 is not set\n",
1332 +"# CONFIG_M586 is not set\n",
1333 +"# CONFIG_M586TSC is not set\n",
1334 +"# CONFIG_M586MMX is not set\n",
1335 +"# CONFIG_M686 is not set\n",
1336 +"# CONFIG_MPENTIUMII is not set\n",
1337 +"# CONFIG_MPENTIUMIII is not set\n",
1338 +"# CONFIG_MPENTIUMM is not set\n",
1339 +"# CONFIG_MPENTIUM4 is not set\n",
1340 +"# CONFIG_MK6 is not set\n",
1341 +"# CONFIG_MK7 is not set\n",
1343 +"# CONFIG_MCRUSOE is not set\n",
1344 +"# CONFIG_MEFFICEON is not set\n",
1345 +"# CONFIG_MWINCHIPC6 is not set\n",
1346 +"# CONFIG_MWINCHIP3D is not set\n",
1347 +"# CONFIG_MGEODEGX1 is not set\n",
1348 +"# CONFIG_MGEODE_LX is not set\n",
1349 +"# CONFIG_MCYRIXIII is not set\n",
1350 +"# CONFIG_MVIAC3_2 is not set\n",
1351 +"# CONFIG_MVIAC7 is not set\n",
1352 +"# CONFIG_MPSC is not set\n",
1353 +"# CONFIG_MCORE2 is not set\n",
1354 +"# CONFIG_MATOM is not set\n",
1355 +"# CONFIG_GENERIC_CPU is not set\n",
1356 +"CONFIG_X86_CPU=y\n",
1357 +"CONFIG_X86_INTERNODE_CACHE_SHIFT=6\n",
1358 +"# CONFIG_X86_CMPXCHG is not set\n",
1359 +"CONFIG_X86_L1_CACHE_SHIFT=6\n",
1360 +"CONFIG_X86_WP_WORKS_OK=y\n",
1361 +"CONFIG_X86_INTEL_USERCOPY=y\n",
1362 +"CONFIG_X86_USE_PPRO_CHECKSUM=y\n",
1363 +"CONFIG_X86_TSC=y\n",
1364 +"CONFIG_X86_CMOV=y\n",
1365 +"CONFIG_X86_MINIMUM_CPU_FAMILY=3\n",
1366 +"CONFIG_CPU_SUP_INTEL=y\n",
1367 +"CONFIG_CPU_SUP_AMD=y\n",
1368 +"CONFIG_CPU_SUP_CENTAUR=y\n",
1369 +"CONFIG_UML_X86=y\n",
1370 +"CONFIG_64BIT=y\n",
1371 +"# CONFIG_X86_32 is not set\n",
1372 +"# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set\n",
1373 +"CONFIG_RWSEM_GENERIC_SPINLOCK=y\n",
1374 +"# CONFIG_ARCH_HAS_SC_SIGNALS is not set\n",
1375 +"# CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA is not set\n",
1376 +"CONFIG_SMP_BROKEN=y\n",
1377 +"CONFIG_GENERIC_HWEIGHT=y\n",
1378 +"# CONFIG_STATIC_LINK is not set\n",
1379 +"CONFIG_FLATMEM=y\n",
1380 +"CONFIG_FLAT_NODE_MEM_MAP=y\n",
1381 +"CONFIG_PAGEFLAGS_EXTENDED=y\n",
1382 +"CONFIG_SPLIT_PTLOCK_CPUS=4\n",
1383 +"CONFIG_PHYS_ADDR_T_64BIT=y\n",
1384 +"CONFIG_ZONE_DMA_FLAG=0\n",
1385 +"CONFIG_VIRT_TO_BUS=y\n",
1386 +"# CONFIG_KSM is not set\n",
1387 +"CONFIG_DEFAULT_MMAP_MIN_ADDR=4096\n",
1388 +"# CONFIG_NO_HZ is not set\n",
1389 +"# CONFIG_HIGH_RES_TIMERS is not set\n",
1390 +"CONFIG_GENERIC_CLOCKEVENTS_BUILD=y\n",
1391 +"CONFIG_LD_SCRIPT_DYN=y\n",
1392 +"# CONFIG_BINFMT_ELF is not set\n",
1393 +"# CONFIG_HAVE_AOUT is not set\n",
1394 +"# CONFIG_BINFMT_MISC is not set\n",
1395 +"# CONFIG_HOSTFS is not set\n",
1396 +"# CONFIG_MCONSOLE is not set\n",
1397 +"CONFIG_KERNEL_STACK_ORDER=1\n",
1400 +"# General setup\n",
1402 +"# CONFIG_EXPERIMENTAL is not set\n",
1403 +"CONFIG_BROKEN_ON_SMP=y\n",
1404 +"CONFIG_INIT_ENV_ARG_LIMIT=128\n",
1405 +"CONFIG_LOCALVERSION=\"\"\n",
1406 +"# CONFIG_LOCALVERSION_AUTO is not set\n",
1407 +"# CONFIG_SWAP is not set\n",
1408 +"CONFIG_SYSVIPC=y\n",
1409 +"CONFIG_SYSVIPC_SYSCTL=y\n",
1410 +"# CONFIG_BSD_PROCESS_ACCT is not set\n",
1413 +"# RCU Subsystem\n",
1415 +"CONFIG_TREE_RCU=y\n",
1416 +"# CONFIG_TREE_PREEMPT_RCU is not set\n",
1417 +"# CONFIG_TINY_RCU is not set\n",
1418 +"# CONFIG_RCU_TRACE is not set\n",
1419 +"CONFIG_RCU_FANOUT=64\n",
1420 +"# CONFIG_RCU_FANOUT_EXACT is not set\n",
1421 +"# CONFIG_TREE_RCU_TRACE is not set\n",
1422 +"# CONFIG_IKCONFIG is not set\n",
1423 +"CONFIG_LOG_BUF_SHIFT=17\n",
1424 +"# CONFIG_CGROUPS is not set\n",
1425 +"# CONFIG_SYSFS_DEPRECATED_V2 is not set\n",
1426 +"# CONFIG_RELAY is not set\n",
1427 +"CONFIG_NAMESPACES=y\n",
1428 +"CONFIG_UTS_NS=y\n",
1429 +"CONFIG_IPC_NS=y\n",
1430 +"CONFIG_USER_NS=y\n",
1431 +"# CONFIG_BLK_DEV_INITRD is not set\n",
1432 +"# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set\n",
1433 +"CONFIG_SYSCTL=y\n",
1434 +"CONFIG_ANON_INODES=y\n",
1435 +"# CONFIG_EMBEDDED is not set\n",
1436 +"CONFIG_UID16=y\n",
1437 +"CONFIG_SYSCTL_SYSCALL=y\n",
1438 +"CONFIG_KALLSYMS=y\n",
1439 +"# CONFIG_KALLSYMS_EXTRA_PASS is not set\n",
1440 +"CONFIG_HOTPLUG=y\n",
1441 +"CONFIG_PRINTK=y\n",
1443 +"CONFIG_ELF_CORE=y\n",
1444 +"CONFIG_BASE_FULL=y\n",
1445 +"CONFIG_FUTEX=y\n",
1446 +"CONFIG_EPOLL=y\n",
1447 +"CONFIG_SIGNALFD=y\n",
1448 +"CONFIG_TIMERFD=y\n",
1449 +"CONFIG_EVENTFD=y\n",
1450 +"CONFIG_SHMEM=y\n",
1454 +"# Kernel Performance Events And Counters\n",
1456 +"CONFIG_VM_EVENT_COUNTERS=y\n",
1457 +"CONFIG_SLUB_DEBUG=y\n",
1458 +"# CONFIG_COMPAT_BRK is not set\n",
1459 +"# CONFIG_SLAB is not set\n",
1461 +"# CONFIG_SLOB is not set\n",
1462 +"# CONFIG_PROFILING is not set\n",
1465 +"# GCOV-based kernel profiling\n",
1467 +"# CONFIG_SLOW_WORK is not set\n",
1468 +"# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set\n",
1469 +"CONFIG_SLABINFO=y\n",
1470 +"CONFIG_RT_MUTEXES=y\n",
1471 +"CONFIG_BASE_SMALL=0\n",
1472 +"# CONFIG_MODULES is not set\n",
1473 +"CONFIG_BLOCK=y\n",
1474 +"# CONFIG_BLK_DEV_BSG is not set\n",
1475 +"# CONFIG_BLK_DEV_INTEGRITY is not set\n",
1478 +"# IO Schedulers\n",
1480 +"CONFIG_IOSCHED_NOOP=y\n",
1481 +"# CONFIG_IOSCHED_DEADLINE is not set\n",
1482 +"# CONFIG_IOSCHED_CFQ is not set\n",
1483 +"# CONFIG_DEFAULT_DEADLINE is not set\n",
1484 +"# CONFIG_DEFAULT_CFQ is not set\n",
1485 +"CONFIG_DEFAULT_NOOP=y\n",
1486 +"CONFIG_DEFAULT_IOSCHED=\"noop\"\n",
1487 +"# CONFIG_INLINE_SPIN_TRYLOCK is not set\n",
1488 +"# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set\n",
1489 +"# CONFIG_INLINE_SPIN_LOCK is not set\n",
1490 +"# CONFIG_INLINE_SPIN_LOCK_BH is not set\n",
1491 +"# CONFIG_INLINE_SPIN_LOCK_IRQ is not set\n",
1492 +"# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set\n",
1493 +"CONFIG_INLINE_SPIN_UNLOCK=y\n",
1494 +"# CONFIG_INLINE_SPIN_UNLOCK_BH is not set\n",
1495 +"CONFIG_INLINE_SPIN_UNLOCK_IRQ=y\n",
1496 +"# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set\n",
1497 +"# CONFIG_INLINE_READ_TRYLOCK is not set\n",
1498 +"# CONFIG_INLINE_READ_LOCK is not set\n",
1499 +"# CONFIG_INLINE_READ_LOCK_BH is not set\n",
1500 +"# CONFIG_INLINE_READ_LOCK_IRQ is not set\n",
1501 +"# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set\n",
1502 +"CONFIG_INLINE_READ_UNLOCK=y\n",
1503 +"# CONFIG_INLINE_READ_UNLOCK_BH is not set\n",
1504 +"CONFIG_INLINE_READ_UNLOCK_IRQ=y\n",
1505 +"# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set\n",
1506 +"# CONFIG_INLINE_WRITE_TRYLOCK is not set\n",
1507 +"# CONFIG_INLINE_WRITE_LOCK is not set\n",
1508 +"# CONFIG_INLINE_WRITE_LOCK_BH is not set\n",
1509 +"# CONFIG_INLINE_WRITE_LOCK_IRQ is not set\n",
1510 +"# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set\n",
1511 +"CONFIG_INLINE_WRITE_UNLOCK=y\n",
1512 +"# CONFIG_INLINE_WRITE_UNLOCK_BH is not set\n",
1513 +"CONFIG_INLINE_WRITE_UNLOCK_IRQ=y\n",
1514 +"# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set\n",
1515 +"# CONFIG_MUTEX_SPIN_ON_OWNER is not set\n",
1516 +"# CONFIG_FREEZER is not set\n",
1517 +"# CONFIG_BLK_DEV is not set\n",
1520 +"# Character Devices\n",
1522 +"# CONFIG_STDERR_CONSOLE is not set\n",
1523 +"CONFIG_STDIO_CONSOLE=y\n",
1524 +"# CONFIG_SSL is not set\n",
1525 +"# CONFIG_NULL_CHAN is not set\n",
1526 +"# CONFIG_PORT_CHAN is not set\n",
1527 +"# CONFIG_PTY_CHAN is not set\n",
1528 +"# CONFIG_TTY_CHAN is not set\n",
1529 +"# CONFIG_XTERM_CHAN is not set\n",
1530 +"CONFIG_NOCONFIG_CHAN=y\n",
1531 +"CONFIG_CON_ZERO_CHAN=\"fd:0,fd:1\"\n",
1532 +"CONFIG_CON_CHAN=\"xterm\"\n",
1533 +"CONFIG_SSL_CHAN=\"pty\"\n",
1534 +"# CONFIG_UNIX98_PTYS is not set\n",
1535 +"# CONFIG_LEGACY_PTYS is not set\n",
1536 +"# CONFIG_RAW_DRIVER is not set\n",
1537 +"# CONFIG_WATCHDOG is not set\n",
1538 +"# CONFIG_UML_SOUND is not set\n",
1539 +"# CONFIG_SOUND is not set\n",
1540 +"# CONFIG_SOUND_OSS_CORE is not set\n",
1541 +"# CONFIG_HOSTAUDIO is not set\n",
1542 +"# CONFIG_HW_RANDOM is not set\n",
1543 +"# CONFIG_UML_RANDOM is not set\n",
1544 +"# CONFIG_MMAPPER is not set\n",
1547 +"# Generic Driver Options\n",
1549 +"CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\"\n",
1550 +"CONFIG_STANDALONE=y\n",
1551 +"# CONFIG_PREVENT_FIRMWARE_BUILD is not set\n",
1552 +"CONFIG_FW_LOADER=y\n",
1553 +"# CONFIG_FIRMWARE_IN_KERNEL is not set\n",
1554 +"CONFIG_EXTRA_FIRMWARE=\"\"\n",
1555 +"# CONFIG_SYS_HYPERVISOR is not set\n",
1556 +"# CONFIG_NET is not set\n",
1559 +"# File systems\n",
1561 +"# CONFIG_EXT2_FS is not set\n",
1562 +"# CONFIG_EXT3_FS is not set\n",
1563 +"# CONFIG_EXT4_FS is not set\n",
1564 +"# CONFIG_REISERFS_FS is not set\n",
1565 +"# CONFIG_JFS_FS is not set\n",
1566 +"# CONFIG_FS_POSIX_ACL is not set\n",
1567 +"# CONFIG_XFS_FS is not set\n",
1568 +"CONFIG_FILE_LOCKING=y\n",
1569 +"# CONFIG_FSNOTIFY is not set\n",
1570 +"# CONFIG_DNOTIFY is not set\n",
1571 +"# CONFIG_INOTIFY is not set\n",
1572 +"# CONFIG_INOTIFY_USER is not set\n",
1573 +"# CONFIG_QUOTA is not set\n",
1574 +"# CONFIG_AUTOFS_FS is not set\n",
1575 +"# CONFIG_AUTOFS4_FS is not set\n",
1576 +"# CONFIG_FUSE_FS is not set\n",
1583 +"# CD-ROM/DVD Filesystems\n",
1585 +"# CONFIG_ISO9660_FS is not set\n",
1586 +"# CONFIG_UDF_FS is not set\n",
1589 +"# DOS/FAT/NT Filesystems\n",
1591 +"# CONFIG_MSDOS_FS is not set\n",
1592 +"# CONFIG_VFAT_FS is not set\n",
1593 +"# CONFIG_NTFS_FS is not set\n",
1596 +"# Pseudo filesystems\n",
1598 +"CONFIG_PROC_FS=y\n",
1599 +"# CONFIG_PROC_KCORE is not set\n",
1600 +"CONFIG_PROC_SYSCTL=y\n",
1601 +"CONFIG_PROC_PAGE_MONITOR=y\n",
1602 +"CONFIG_SYSFS=y\n",
1603 +"# CONFIG_TMPFS is not set\n",
1604 +"# CONFIG_HUGETLB_PAGE is not set\n",
1605 +"# CONFIG_CONFIGFS_FS is not set\n",
1606 +"# CONFIG_MISC_FILESYSTEMS is not set\n",
1609 +"# Partition Types\n",
1611 +"# CONFIG_PARTITION_ADVANCED is not set\n",
1612 +"CONFIG_MSDOS_PARTITION=y\n",
1613 +"# CONFIG_NLS is not set\n",
1616 +"# Linux VServer\n",
1618 +"# CONFIG_VSERVER_AUTO_LBACK is not set\n",
1619 +"# CONFIG_VSERVER_COWBL is not set\n",
1620 +"# CONFIG_VSERVER_PROC_SECURE is not set\n",
1621 +"# CONFIG_VSERVER_HARDCPU is not set\n",
1622 +"# CONFIG_TAGGING_NONE is not set\n",
1623 +"# CONFIG_TAGGING_UID16 is not set\n",
1624 +"# CONFIG_TAGGING_GID16 is not set\n",
1625 +"CONFIG_TAGGING_ID24=y\n",
1626 +"# CONFIG_TAGGING_INTERN is not set\n",
1627 +"# CONFIG_TAG_NFSD is not set\n",
1628 +"# CONFIG_VSERVER_PRIVACY is not set\n",
1629 +"CONFIG_VSERVER_CONTEXTS=768\n",
1630 +"# CONFIG_VSERVER_WARN is not set\n",
1631 +"# CONFIG_VSERVER_DEBUG is not set\n",
1632 +"CONFIG_VSERVER=y\n",
1635 +"# Security options\n",
1637 +"# CONFIG_KEYS is not set\n",
1638 +"# CONFIG_SECURITY is not set\n",
1639 +"# CONFIG_SECURITYFS is not set\n",
1640 +"# CONFIG_DEFAULT_SECURITY_SELINUX is not set\n",
1641 +"# CONFIG_DEFAULT_SECURITY_SMACK is not set\n",
1642 +"# CONFIG_DEFAULT_SECURITY_TOMOYO is not set\n",
1643 +"CONFIG_DEFAULT_SECURITY_DAC=y\n",
1644 +"CONFIG_DEFAULT_SECURITY=\"\"\n",
1645 +"# CONFIG_CRYPTO is not set\n",
1646 +"# CONFIG_BINARY_PRINTF is not set\n",
1649 +"# Library routines\n",
1651 +"CONFIG_GENERIC_FIND_FIRST_BIT=y\n",
1652 +"CONFIG_GENERIC_FIND_NEXT_BIT=y\n",
1653 +"CONFIG_GENERIC_FIND_LAST_BIT=y\n",
1654 +"# CONFIG_CRC_CCITT is not set\n",
1655 +"# CONFIG_CRC16 is not set\n",
1656 +"# CONFIG_CRC_T10DIF is not set\n",
1657 +"# CONFIG_CRC_ITU_T is not set\n",
1658 +"# CONFIG_CRC32 is not set\n",
1659 +"# CONFIG_CRC7 is not set\n",
1660 +"# CONFIG_LIBCRC32C is not set\n",
1661 +"CONFIG_HAS_DMA=y\n",
1664 +"# SCSI device support\n",
1666 +"# CONFIG_RAID_ATTRS is not set\n",
1667 +"# CONFIG_SCSI is not set\n",
1668 +"# CONFIG_SCSI_DMA is not set\n",
1669 +"# CONFIG_SCSI_NETLINK is not set\n",
1670 +"# CONFIG_MD is not set\n",
1671 +"# CONFIG_NEW_LEDS is not set\n",
1672 +"# CONFIG_INPUT is not set\n",
1675 +"# Kernel hacking\n",
1677 +"# CONFIG_PRINTK_TIME is not set\n",
1678 +"# CONFIG_ENABLE_WARN_DEPRECATED is not set\n",
1679 +"# CONFIG_ENABLE_MUST_CHECK is not set\n",
1680 +"CONFIG_FRAME_WARN=2048\n",
1681 +"# CONFIG_STRIP_ASM_SYMS is not set\n",
1682 +"# CONFIG_UNUSED_SYMBOLS is not set\n",
1683 +"# CONFIG_DEBUG_FS is not set\n",
1684 +"# CONFIG_DEBUG_KERNEL is not set\n",
1685 +"# CONFIG_SLUB_DEBUG_ON is not set\n",
1686 +"# CONFIG_SLUB_STATS is not set\n",
1687 +"CONFIG_DEBUG_BUGVERBOSE=y\n",
1688 +"CONFIG_DEBUG_MEMORY_INIT=y\n",
1689 +"# CONFIG_RCU_CPU_STALL_DETECTOR is not set\n",
1690 +"# CONFIG_SYSCTL_SYSCALL_CHECK is not set\n",
1691 +"# CONFIG_SAMPLES is not set\n",
1692 +"# CONFIG_DEBUG_STACK_USAGE is not set\n",
1693 diff -NurpP --minimal linux-2.6.35.2/arch/um/kernel/vmlinux.lds linux-2.6.35.2-vs2.3.0.36.31/arch/um/kernel/vmlinux.lds
1694 --- linux-2.6.35.2/arch/um/kernel/vmlinux.lds 1970-01-01 01:00:00.000000000 +0100
1695 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/um/kernel/vmlinux.lds 2010-08-02 17:05:05.000000000 +0200
1700 + * Automatically generated C config: don't edit
1701 + * Linux kernel version: 2.6.33-vs2.3.0.36.29.1
1702 + * Wed Mar 10 20:12:10 2010
1704 +KERNEL_STACK_SIZE = 4096 * (1 << 1);
1706 + * Helper macros to support writing architecture specific
1709 + * A minimal linker scripts has following content:
1710 + * [This is a sample, architectures may have special requiriements]
1712 + * OUTPUT_FORMAT(...)
1713 + * OUTPUT_ARCH(...)
1718 + * __init_begin = .;
1719 + * HEAD_TEXT_SECTION
1720 + * INIT_TEXT_SECTION(PAGE_SIZE)
1721 + * INIT_DATA_SECTION(...)
1722 + * PERCPU(PAGE_SIZE)
1726 + * TEXT_SECTION = 0
1730 + * RO_DATA_SECTION(PAGE_SIZE)
1731 + * RW_DATA_SECTION(...)
1734 + * EXCEPTION_TABLE(...)
1737 + * BSS_SECTION(0, 0, 0)
1743 + * DISCARDS // must be the last
1746 + * [__init_begin, __init_end] is the init section that may be freed after init
1747 + * [_stext, _etext] is the text section
1748 + * [_sdata, _edata] is the data section
1750 + * Some of the included output section have their own set of constants.
1751 + * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
1752 + * [__nosave_begin, __nosave_end] for the nosave data
1761 +/* Align . to a 8 byte boundary equals to maximum function alignment. */
1764 +/* The actual configuration determine if the init/exit sections
1765 + * are handled as text/data or they can be discarded (which
1766 + * often happens at runtime)
1768 +/* .data section */
1770 + * Data section helpers
1775 +/* RODATA & RO_DATA provided for backward compatibility.
1776 + * All archs are supposed to use RO_DATA() */
1777 +/* .text section. Map to function alignment to avoid address changes
1778 + * during second ld run in second ld pass when generating System.map */
1779 +/* sched.text is aling to function alignment to secure we have same
1780 + * address even at second ld pass when generating System.map */
1781 +/* spinlock.text is aling to function alignment to secure we have same
1782 + * address even at second ld pass when generating System.map */
1783 +/* Section used for early init (in .S files) */
1790 +/* init and exit section handling */
1792 + * bss (Block Started by Symbol) - uninitialized data
1793 + * zeroed during startup
1796 + * DWARF debug sections.
1797 + * Symbols in the DWARF debugging sections are relative to
1798 + * the beginning of the section so we begin them at 0.
1800 + /* Stabs debugging sections. */
1802 + * Default discarded sections.
1804 + * Some archs want to discard exit text/data at runtime rather than
1805 + * link time due to cross-section references such as alt instructions,
1806 + * bug table, eh_frame, etc. DISCARDS must be the last of output
1807 + * section definitions so that such archs put those in earlier section
1811 + * PERCPU_VADDR - define output section for percpu area
1812 + * @vaddr: explicit base address (optional)
1813 + * @phdr: destination PHDR (optional)
1815 + * Macro which expands to output section for percpu area. If @vaddr
1816 + * is not blank, it specifies explicit base address and all percpu
1817 + * symbols will be offset from the given address. If blank, @vaddr
1818 + * always equals @laddr + LOAD_OFFSET.
1820 + * @phdr defines the output PHDR to use if not blank. Be warned that
1821 + * output PHDR is sticky. If @phdr is specified, the next output
1822 + * section in the linker script will go there too. @phdr should have
1823 + * a leading colon.
1825 + * Note that this macros defines __per_cpu_load as an absolute symbol.
1826 + * If there is no need to put the percpu section at a predetermined
1827 + * address, use PERCPU().
1830 + * PERCPU - define output section for percpu area, simple version
1831 + * @align: required alignment
1833 + * Align to @align and outputs output section for percpu area. This
1834 + * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
1835 + * __per_cpu_start will be identical.
1837 + * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
1838 + * that __per_cpu_load is defined as a relative symbol against
1839 + * .data.percpu which is required for relocatable x86_32
1843 + * Definition of the high level *_SECTION macros
1844 + * They will fit only a subset of the architectures
1848 + * All sections are combined in a single .data section.
1849 + * The sections following CONSTRUCTORS are arranged so their
1850 + * typical alignment matches.
1851 + * A cacheline is typical/always less than a PAGE_SIZE so
1852 + * the sections that has this restriction (or similar)
1853 + * is located before the ones requiring PAGE_SIZE alignment.
1854 + * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
1855 + * matches the requirment of PAGE_ALIGNED_DATA.
1857 + * use 0 as page_align if page_aligned data is not used */
1859 + * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
1860 + * Copyright 2003 PathScale, Inc.
1861 + * Licensed under the GPL
1863 +/* const.h: Macros for dealing with constants. */
1864 +/* Some constant macros are used in both assembler and
1865 + * C code. Therefore we cannot annotate them always with
1866 + * 'UL' and other type specifiers unilaterally. We
1867 + * use the following macros to deal with this.
1869 + * Similarly, _AT() will cast an expression with a type in C, but
1870 + * leave it unchanged in asm.
1872 +/* PAGE_SHIFT determines the page size */
1873 +OUTPUT_FORMAT(elf64-x86-64)
1874 +OUTPUT_ARCH(i386:x86-64)
1876 +jiffies = jiffies_64;
1879 + PROVIDE (__executable_start = 0x60000000);
1880 + . = 0x60000000 + SIZEOF_HEADERS;
1881 + .interp : { *(.interp) }
1882 + __binary_start = .;
1883 + . = ALIGN(4096); /* Init code and data */
1887 + . = ALIGN((1 << 12)); .init.text : AT(ADDR(.init.text) - 0) { _sinittext = .; *(.init.text) *(.cpuinit.text) *(.meminit.text) _einittext = .; }
1888 + . = ALIGN((1 << 12));
1889 + /* Read-only sections, merged into text segment: */
1890 + .hash : { *(.hash) }
1891 + .gnu.hash : { *(.gnu.hash) }
1892 + .dynsym : { *(.dynsym) }
1893 + .dynstr : { *(.dynstr) }
1894 + .gnu.version : { *(.gnu.version) }
1895 + .gnu.version_d : { *(.gnu.version_d) }
1896 + .gnu.version_r : { *(.gnu.version_r) }
1897 + .rel.init : { *(.rel.init) }
1898 + .rela.init : { *(.rela.init) }
1899 + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
1900 + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
1901 + .rel.fini : { *(.rel.fini) }
1902 + .rela.fini : { *(.rela.fini) }
1903 + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
1904 + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
1905 + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
1906 + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
1907 + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
1908 + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
1909 + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
1910 + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
1911 + .rel.ctors : { *(.rel.ctors) }
1912 + .rela.ctors : { *(.rela.ctors) }
1913 + .rel.dtors : { *(.rel.dtors) }
1914 + .rela.dtors : { *(.rela.dtors) }
1915 + .rel.got : { *(.rel.got) }
1916 + .rela.got : { *(.rela.got) }
1917 + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
1918 + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
1919 + .rel.plt : { *(.rel.plt) }
1920 + .rela.plt : { *(.rela.plt) }
1924 + .plt : { *(.plt) }
1926 + . = ALIGN(8); *(.text.hot) *(.text) *(.ref.text) *(.devinit.text) *(.devexit.text) *(.text.unlikely)
1927 + . = ALIGN(8); __sched_text_start = .; *(.sched.text) __sched_text_end = .;
1928 + . = ALIGN(8); __lock_text_start = .; *(.spinlock.text) __lock_text_end = .;
1930 + *(.stub .text.* .gnu.linkonce.t.*)
1931 + /* .gnu.warning sections are handled specially by elf32.em. */
1933 + . = ALIGN((1 << 12));
1935 + . = ALIGN((1 << 12));
1937 + __syscall_stub_start = .;
1938 + *(.__syscall_stub*)
1939 + __syscall_stub_end = .;
1944 + .kstrtab : { *(.kstrtab) }
1946 + * Helper macros to support writing architecture specific
1949 + * A minimal linker scripts has following content:
1950 + * [This is a sample, architectures may have special requiriements]
1952 + * OUTPUT_FORMAT(...)
1953 + * OUTPUT_ARCH(...)
1958 + * __init_begin = .;
1959 + * HEAD_TEXT_SECTION
1960 + * INIT_TEXT_SECTION(PAGE_SIZE)
1961 + * INIT_DATA_SECTION(...)
1962 + * PERCPU(PAGE_SIZE)
1966 + * TEXT_SECTION = 0
1970 + * RO_DATA_SECTION(PAGE_SIZE)
1971 + * RW_DATA_SECTION(...)
1974 + * EXCEPTION_TABLE(...)
1977 + * BSS_SECTION(0, 0, 0)
1983 + * DISCARDS // must be the last
1986 + * [__init_begin, __init_end] is the init section that may be freed after init
1987 + * [_stext, _etext] is the text section
1988 + * [_sdata, _edata] is the data section
1990 + * Some of the included output section have their own set of constants.
1991 + * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
1992 + * [__nosave_begin, __nosave_end] for the nosave data
1994 +/* Align . to a 8 byte boundary equals to maximum function alignment. */
1995 +/* The actual configuration determine if the init/exit sections
1996 + * are handled as text/data or they can be discarded (which
1997 + * often happens at runtime)
1999 +/* .data section */
2001 + * Data section helpers
2006 +/* RODATA & RO_DATA provided for backward compatibility.
2007 + * All archs are supposed to use RO_DATA() */
2008 +/* .text section. Map to function alignment to avoid address changes
2009 + * during second ld run in second ld pass when generating System.map */
2010 +/* sched.text is aling to function alignment to secure we have same
2011 + * address even at second ld pass when generating System.map */
2012 +/* spinlock.text is aling to function alignment to secure we have same
2013 + * address even at second ld pass when generating System.map */
2014 +/* Section used for early init (in .S files) */
2021 +/* init and exit section handling */
2023 + * bss (Block Started by Symbol) - uninitialized data
2024 + * zeroed during startup
2027 + * DWARF debug sections.
2028 + * Symbols in the DWARF debugging sections are relative to
2029 + * the beginning of the section so we begin them at 0.
2031 + /* Stabs debugging sections. */
2033 + * Default discarded sections.
2035 + * Some archs want to discard exit text/data at runtime rather than
2036 + * link time due to cross-section references such as alt instructions,
2037 + * bug table, eh_frame, etc. DISCARDS must be the last of output
2038 + * section definitions so that such archs put those in earlier section
2042 + * PERCPU_VADDR - define output section for percpu area
2043 + * @vaddr: explicit base address (optional)
2044 + * @phdr: destination PHDR (optional)
2046 + * Macro which expands to output section for percpu area. If @vaddr
2047 + * is not blank, it specifies explicit base address and all percpu
2048 + * symbols will be offset from the given address. If blank, @vaddr
2049 + * always equals @laddr + LOAD_OFFSET.
2051 + * @phdr defines the output PHDR to use if not blank. Be warned that
2052 + * output PHDR is sticky. If @phdr is specified, the next output
2053 + * section in the linker script will go there too. @phdr should have
2054 + * a leading colon.
2056 + * Note that this macros defines __per_cpu_load as an absolute symbol.
2057 + * If there is no need to put the percpu section at a predetermined
2058 + * address, use PERCPU().
2061 + * PERCPU - define output section for percpu area, simple version
2062 + * @align: required alignment
2064 + * Align to @align and outputs output section for percpu area. This
2065 + * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
2066 + * __per_cpu_start will be identical.
2068 + * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
2069 + * that __per_cpu_load is defined as a relative symbol against
2070 + * .data.percpu which is required for relocatable x86_32
2074 + * Definition of the high level *_SECTION macros
2075 + * They will fit only a subset of the architectures
2079 + * All sections are combined in a single .data section.
2080 + * The sections following CONSTRUCTORS are arranged so their
2081 + * typical alignment matches.
2082 + * A cacheline is typical/always less than a PAGE_SIZE so
2083 + * the sections that has this restriction (or similar)
2084 + * is located before the ones requiring PAGE_SIZE alignment.
2085 + * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
2086 + * matches the requirment of PAGE_ALIGNED_DATA.
2088 + * use 0 as page_align if page_aligned data is not used */
2089 + .fini : { *(.fini) } =0x9090
2091 + PROVIDE (etext = .);
2094 + PROVIDE (sdata = .);
2095 + . = ALIGN((4096)); .rodata : AT(ADDR(.rodata) - 0) { __start_rodata = .; *(.rodata) *(.rodata.*) *(__vermagic) *(__markers_strings) *(__tracepoints_strings) } .rodata1 : AT(ADDR(.rodata1) - 0) { *(.rodata1) } . = ALIGN(8); __bug_table : AT(ADDR(__bug_table) - 0) { __start___bug_table = .; *(__bug_table) __stop___bug_table = .; } .pci_fixup : AT(ADDR(.pci_fixup) - 0) { __start_pci_fixups_early = .; *(.pci_fixup_early) __end_pci_fixups_early = .; __start_pci_fixups_header = .; *(.pci_fixup_header) __end_pci_fixups_header = .; __start_pci_fixups_final = .; *(.pci_fixup_final) __end_pci_fixups_final = .; __start_pci_fixups_enable = .; *(.pci_fixup_enable) __end_pci_fixups_enable = .; __start_pci_fixups_resume = .; *(.pci_fixup_resume) __end_pci_fixups_resume = .; __start_pci_fixups_resume_early = .; *(.pci_fixup_resume_early) __end_pci_fixups_resume_early = .; __start_pci_fixups_suspend = .; *(.pci_fixup_suspend) __end_pci_fixups_suspend = .; } .builtin_fw : AT(ADDR(.builtin_fw) - 0) { __start_builtin_fw = .; *(.builtin_fw) __end_builtin_fw = .; } .rio_route : AT(ADDR(.rio_route) - 0) { __start_rio_route_ops = .; *(.rio_route_ops) __end_rio_route_ops = .; } __ksymtab : AT(ADDR(__ksymtab) - 0) { __start___ksymtab = .; *(__ksymtab) __stop___ksymtab = .; } __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - 0) { __start___ksymtab_gpl = .; *(__ksymtab_gpl) __stop___ksymtab_gpl = .; } __ksymtab_unused : AT(ADDR(__ksymtab_unused) - 0) { __start___ksymtab_unused = .; *(__ksymtab_unused) __stop___ksymtab_unused = .; } __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - 0) { __start___ksymtab_unused_gpl = .; *(__ksymtab_unused_gpl) __stop___ksymtab_unused_gpl = .; } __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - 0) { __start___ksymtab_gpl_future = .; *(__ksymtab_gpl_future) __stop___ksymtab_gpl_future = .; } __kcrctab : AT(ADDR(__kcrctab) - 0) { __start___kcrctab = .; *(__kcrctab) __stop___kcrctab = .; } __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - 0) { __start___kcrctab_gpl = .; *(__kcrctab_gpl) __stop___kcrctab_gpl = .; } __kcrctab_unused : AT(ADDR(__kcrctab_unused) - 0) { __start___kcrctab_unused = .; *(__kcrctab_unused) __stop___kcrctab_unused = .; } __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - 0) { __start___kcrctab_unused_gpl = .; *(__kcrctab_unused_gpl) __stop___kcrctab_unused_gpl = .; } __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - 0) { __start___kcrctab_gpl_future = .; *(__kcrctab_gpl_future) __stop___kcrctab_gpl_future = .; } __ksymtab_strings : AT(ADDR(__ksymtab_strings) - 0) { *(__ksymtab_strings) } __init_rodata : AT(ADDR(__init_rodata) - 0) { *(.ref.rodata) *(.devinit.rodata) *(.devexit.rodata) } __param : AT(ADDR(__param) - 0) { __start___param = .; *(__param) __stop___param = .; . = ALIGN((4096)); __end_rodata = .; } . = ALIGN((4096));
2096 + .unprotected : { *(.unprotected) }
2098 + PROVIDE (_unprotected_end = .);
2100 + .note : { *(.note.*) }
2101 + . = ALIGN(0); __ex_table : AT(ADDR(__ex_table) - 0) { __start___ex_table = .; *(__ex_table) __stop___ex_table = .; }
2102 + . = ALIGN(8); __bug_table : AT(ADDR(__bug_table) - 0) { __start___bug_table = .; *(__bug_table) __stop___bug_table = .; }
2103 + .uml.setup.init : {
2104 + __uml_setup_start = .;
2105 + *(.uml.setup.init)
2106 + __uml_setup_end = .;
2108 + .uml.help.init : {
2109 + __uml_help_start = .;
2111 + __uml_help_end = .;
2113 + .uml.postsetup.init : {
2114 + __uml_postsetup_start = .;
2115 + *(.uml.postsetup.init)
2116 + __uml_postsetup_end = .;
2119 + . = ALIGN(0); __setup_start = .; *(.init.setup) __setup_end = .;
2121 + . = ALIGN(32); .data.percpu : AT(ADDR(.data.percpu) - 0) { __per_cpu_load = .; __per_cpu_start = .; *(.data.percpu.first) *(.data.percpu.page_aligned) *(.data.percpu) *(.data.percpu.shared_aligned) __per_cpu_end = .; }
2122 + .initcall.init : {
2123 + __initcall_start = .; *(.initcallearly.init) __early_initcall_end = .; *(.initcall0.init) *(.initcall0s.init) *(.initcall1.init) *(.initcall1s.init) *(.initcall2.init) *(.initcall2s.init) *(.initcall3.init) *(.initcall3s.init) *(.initcall4.init) *(.initcall4s.init) *(.initcall5.init) *(.initcall5s.init) *(.initcallrootfs.init) *(.initcall6.init) *(.initcall6s.init) *(.initcall7.init) *(.initcall7s.init) __initcall_end = .;
2125 + .con_initcall.init : {
2126 + __con_initcall_start = .; *(.con_initcall.init) __con_initcall_end = .;
2128 + .uml.initcall.init : {
2129 + __uml_initcall_start = .;
2130 + *(.uml.initcall.init)
2131 + __uml_initcall_end = .;
2134 + .security_initcall.init : AT(ADDR(.security_initcall.init) - 0) { __security_initcall_start = .; *(.security_initcall.init) __security_initcall_end = .; }
2136 + __exitcall_begin = .;
2138 + __exitcall_end = .;
2141 + __uml_exitcall_begin = .;
2142 + *(.uml.exitcall.exit)
2143 + __uml_exitcall_end = .;
2146 + .altinstructions : {
2147 + __alt_instructions = .;
2148 + *(.altinstructions)
2149 + __alt_instructions_end = .;
2151 + .altinstr_replacement : { *(.altinstr_replacement) }
2152 + /* .exit.text is discard at runtime, not link time, to deal with references
2153 + from .altinstructions and .eh_frame */
2154 + .exit.text : { *(.exit.text) }
2155 + .exit.data : { *(.exit.data) }
2156 + .preinit_array : {
2157 + __preinit_array_start = .;
2159 + __preinit_array_end = .;
2162 + __init_array_start = .;
2164 + __init_array_end = .;
2167 + __fini_array_start = .;
2169 + __fini_array_end = .;
2175 + init.data : { *(.init.data) *(.cpuinit.data) *(.meminit.data) *(.init.rodata) *(.cpuinit.rodata) *(.meminit.rodata) }
2176 + /* Ensure the __preinit_array_start label is properly aligned. We
2177 + could instead move the label definition inside the section, but
2178 + the linker would then create the section even if it turns out to
2179 + be empty, which isn't pretty. */
2180 + . = ALIGN(32 / 8);
2181 + .preinit_array : { *(.preinit_array) }
2182 + .init_array : { *(.init_array) }
2183 + .fini_array : { *(.fini_array) }
2185 + . = ALIGN(KERNEL_STACK_SIZE); *(.data.init_task)
2186 + . = ALIGN(KERNEL_STACK_SIZE);
2187 + *(.data.init_irqstack)
2188 + *(.data) *(.ref.data) *(.devinit.data) *(.devexit.data) . = ALIGN(8); __start___markers = .; *(__markers) __stop___markers = .; . = ALIGN(32); __start___tracepoints = .; *(__tracepoints) __stop___tracepoints = .; . = ALIGN(8); __start___verbose = .; *(__verbose) __stop___verbose = .;
2189 + *(.data.* .gnu.linkonce.d.*)
2190 + SORT(CONSTRUCTORS)
2192 + .data1 : { *(.data1) }
2193 + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
2194 + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
2195 + .eh_frame : { KEEP (*(.eh_frame)) }
2196 + .gcc_except_table : { *(.gcc_except_table) }
2197 + .dynamic : { *(.dynamic) }
2199 + /* gcc uses crtbegin.o to find the start of
2200 + the constructors, so we make sure it is
2201 + first. Because this is a wildcard, it
2202 + doesn't matter if the user does not
2203 + actually link against crtbegin.o; the
2204 + linker won't look for a file to match a
2205 + wildcard. The wildcard also means that it
2206 + doesn't matter which directory crtbegin.o
2208 + KEEP (*crtbegin.o(.ctors))
2209 + /* We don't want to include the .ctor section from
2210 + from the crtend.o file until after the sorted ctors.
2211 + The .ctor section from the crtend file contains the
2212 + end of ctors marker and it must be last */
2213 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
2214 + KEEP (*(SORT(.ctors.*)))
2218 + KEEP (*crtbegin.o(.dtors))
2219 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
2220 + KEEP (*(SORT(.dtors.*)))
2223 + .jcr : { KEEP (*(.jcr)) }
2224 + .got : { *(.got.plt) *(.got) }
2226 + PROVIDE (edata = .);
2230 + *(.bss .bss.* .gnu.linkonce.b.*)
2232 + /* Align here to ensure that the .bss section occupies space up to
2233 + _end. Align after .bss to ensure correct alignment even if the
2234 + .bss section disappears because there are no input sections. */
2235 + . = ALIGN(32 / 8);
2236 + . = ALIGN(32 / 8);
2239 + PROVIDE (end = .);
2240 + .stab 0 : { *(.stab) } .stabstr 0 : { *(.stabstr) } .stab.excl 0 : { *(.stab.excl) } .stab.exclstr 0 : { *(.stab.exclstr) } .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) }
2241 + .debug 0 : { *(.debug) } .line 0 : { *(.line) } .debug_srcinfo 0 : { *(.debug_srcinfo) } .debug_sfnames 0 : { *(.debug_sfnames) } .debug_aranges 0 : { *(.debug_aranges) } .debug_pubnames 0 : { *(.debug_pubnames) } .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } .debug_abbrev 0 : { *(.debug_abbrev) } .debug_line 0 : { *(.debug_line) } .debug_frame 0 : { *(.debug_frame) } .debug_str 0 : { *(.debug_str) } .debug_loc 0 : { *(.debug_loc) } .debug_macinfo 0 : { *(.debug_macinfo) } .debug_weaknames 0 : { *(.debug_weaknames) } .debug_funcnames 0 : { *(.debug_funcnames) } .debug_typenames 0 : { *(.debug_typenames) } .debug_varnames 0 : { *(.debug_varnames) }
2242 + /DISCARD/ : { *(.exit.text) *(.cpuexit.text) *(.memexit.text) *(.exit.data) *(.cpuexit.data) *(.cpuexit.rodata) *(.memexit.data) *(.memexit.rodata) *(.exitcall.exit) *(.discard) }
2244 diff -NurpP --minimal linux-2.6.35.2/arch/x86/ia32/ia32entry.S linux-2.6.35.2-vs2.3.0.36.31/arch/x86/ia32/ia32entry.S
2245 --- linux-2.6.35.2/arch/x86/ia32/ia32entry.S 2010-07-07 18:31:11.000000000 +0200
2246 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/x86/ia32/ia32entry.S 2010-08-02 17:05:05.000000000 +0200
2247 @@ -777,7 +777,7 @@ ia32_sys_call_table:
2248 .quad sys_tgkill /* 270 */
2249 .quad compat_sys_utimes
2250 .quad sys32_fadvise64_64
2251 - .quad quiet_ni_syscall /* sys_vserver */
2252 + .quad sys32_vserver
2254 .quad compat_sys_get_mempolicy /* 275 */
2255 .quad sys_set_mempolicy
2256 diff -NurpP --minimal linux-2.6.35.2/arch/x86/include/asm/unistd_64.h linux-2.6.35.2-vs2.3.0.36.31/arch/x86/include/asm/unistd_64.h
2257 --- linux-2.6.35.2/arch/x86/include/asm/unistd_64.h 2010-07-07 18:31:11.000000000 +0200
2258 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/x86/include/asm/unistd_64.h 2010-08-02 17:05:05.000000000 +0200
2259 @@ -535,7 +535,7 @@ __SYSCALL(__NR_tgkill, sys_tgkill)
2260 #define __NR_utimes 235
2261 __SYSCALL(__NR_utimes, sys_utimes)
2262 #define __NR_vserver 236
2263 -__SYSCALL(__NR_vserver, sys_ni_syscall)
2264 +__SYSCALL(__NR_vserver, sys_vserver)
2265 #define __NR_mbind 237
2266 __SYSCALL(__NR_mbind, sys_mbind)
2267 #define __NR_set_mempolicy 238
2268 diff -NurpP --minimal linux-2.6.35.2/arch/x86/Kconfig linux-2.6.35.2-vs2.3.0.36.31/arch/x86/Kconfig
2269 --- linux-2.6.35.2/arch/x86/Kconfig 2010-08-02 16:52:11.000000000 +0200
2270 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/x86/Kconfig 2010-08-02 17:05:05.000000000 +0200
2271 @@ -2123,6 +2123,8 @@ source "fs/Kconfig"
2273 source "arch/x86/Kconfig.debug"
2275 +source "kernel/vserver/Kconfig"
2277 source "security/Kconfig"
2279 source "crypto/Kconfig"
2280 diff -NurpP --minimal linux-2.6.35.2/arch/x86/kernel/syscall_table_32.S linux-2.6.35.2-vs2.3.0.36.31/arch/x86/kernel/syscall_table_32.S
2281 --- linux-2.6.35.2/arch/x86/kernel/syscall_table_32.S 2010-07-07 18:31:12.000000000 +0200
2282 +++ linux-2.6.35.2-vs2.3.0.36.31/arch/x86/kernel/syscall_table_32.S 2010-08-02 17:05:05.000000000 +0200
2283 @@ -272,7 +272,7 @@ ENTRY(sys_call_table)
2284 .long sys_tgkill /* 270 */
2286 .long sys_fadvise64_64
2287 - .long sys_ni_syscall /* sys_vserver */
2290 .long sys_get_mempolicy
2291 .long sys_set_mempolicy
2292 diff -NurpP --minimal linux-2.6.35.2/Documentation/vserver/debug.txt linux-2.6.35.2-vs2.3.0.36.31/Documentation/vserver/debug.txt
2293 --- linux-2.6.35.2/Documentation/vserver/debug.txt 1970-01-01 01:00:00.000000000 +0100
2294 +++ linux-2.6.35.2-vs2.3.0.36.31/Documentation/vserver/debug.txt 2010-08-02 17:05:05.000000000 +0200
2299 + 2 4 "vx_map_tgid: %p/%llx: %d -> %d"
2300 + "vx_rmap_tgid: %p/%llx: %d -> %d"
2304 + 0 1 "ALLOC (%p,#%d)%c inode (%d)"
2305 + "FREE (%p,#%d)%c inode"
2306 + 1 2 "ALLOC (%p,#%d)%c %lld bytes (%d)"
2307 + "FREE (%p,#%d)%c %lld bytes"
2308 + 2 4 "ADJUST: %lld,%lld on %ld,%ld [mult=%d]"
2309 + 3 8 "ext3_has_free_blocks(%p): %lu<%lu+1, %c, %u!=%u r=%d"
2310 + "ext3_has_free_blocks(%p): free=%lu, root=%lu"
2311 + "rcu_free_dl_info(%p)"
2312 + 4 10 "alloc_dl_info(%p,%d) = %p"
2313 + "dealloc_dl_info(%p)"
2314 + "get_dl_info(%p[#%d.%d])"
2315 + "put_dl_info(%p[#%d.%d])"
2316 + 5 20 "alloc_dl_info(%p,%d)*"
2317 + 6 40 "__hash_dl_info: %p[#%d]"
2318 + "__unhash_dl_info: %p[#%d]"
2319 + 7 80 "locate_dl_info(%p,#%d) = %p"
2323 + 0 1 "destroy_dqhash: %p [#0x%08x] c=%d"
2324 + "new_dqhash: %p [#0x%08x]"
2325 + "vroot[%d]_clr_dev: dev=%p[%lu,%d:%d]"
2326 + "vroot[%d]_get_real_bdev: dev=%p[%lu,%d:%d]"
2327 + "vroot[%d]_set_dev: dev=%p[%lu,%d:%d]"
2328 + "vroot_get_real_bdev not set"
2329 + 1 2 "cow_break_link(»%s«)"
2330 + "temp copy »%s«"
2331 + 2 4 "dentry_open(new): %p"
2332 + "dentry_open(old): %p"
2333 + "lookup_create(new): %p"
2335 + "path_lookup(old): %d"
2336 + "vfs_create(new): %d"
2338 + "vfs_sendfile: %d"
2339 + 3 8 "fput(new_file=%p[#%d])"
2340 + "fput(old_file=%p[#%d])"
2341 + 4 10 "vx_info_kill(%p[#%d],%d,%d) = %d"
2342 + "vx_info_kill(%p[#%d],%d,%d)*"
2343 + 5 20 "vs_reboot(%p[#%d],%d)"
2344 + 6 40 "dropping task %p[#%u,%u] for %p[#%u,%u]"
2348 + 2 4 "nx_addr_conflict(%p,%p) %d.%d,%d.%d"
2349 + 3 8 "inet_bind(%p) %d.%d.%d.%d, %d.%d.%d.%d, %d.%d.%d.%d"
2350 + "inet_bind(%p)* %p,%p;%lx %d.%d.%d.%d"
2351 + 4 10 "ip_route_connect(%p) %p,%p;%lx"
2352 + 5 20 "__addr_in_socket(%p,%d.%d.%d.%d) %p:%d.%d.%d.%d %p;%lx"
2353 + 6 40 "sk,egf: %p [#%d] (from %d)"
2354 + "sk,egn: %p [#%d] (from %d)"
2355 + "sk,req: %p [#%d] (from %d)"
2356 + "sk: %p [#%d] (from %d)"
2357 + "tw: %p [#%d] (from %d)"
2358 + 7 80 "__sock_recvmsg: %p[%p,%p,%p;%d]:%d/%d"
2359 + "__sock_sendmsg: %p[%p,%p,%p;%d]:%d/%d"
2363 + 0 1 "__lookup_nx_info(#%u): %p[#%u]"
2364 + "alloc_nx_info(%d) = %p"
2365 + "create_nx_info(%d) (dynamic rejected)"
2366 + "create_nx_info(%d) = %p (already there)"
2367 + "create_nx_info(%d) = %p (new)"
2368 + "dealloc_nx_info(%p)"
2369 + 1 2 "alloc_nx_info(%d)*"
2370 + "create_nx_info(%d)*"
2371 + 2 4 "get_nx_info(%p[#%d.%d])"
2372 + "put_nx_info(%p[#%d.%d])"
2373 + 3 8 "claim_nx_info(%p[#%d.%d.%d]) %p"
2374 + "clr_nx_info(%p[#%d.%d])"
2375 + "init_nx_info(%p[#%d.%d])"
2376 + "release_nx_info(%p[#%d.%d.%d]) %p"
2377 + "set_nx_info(%p[#%d.%d])"
2378 + 4 10 "__hash_nx_info: %p[#%d]"
2379 + "__nx_dynamic_id: [#%d]"
2380 + "__unhash_nx_info: %p[#%d.%d.%d]"
2381 + 5 20 "moved task %p into nxi:%p[#%d]"
2382 + "nx_migrate_task(%p,%p[#%d.%d.%d])"
2383 + "task_get_nx_info(%p)"
2384 + 6 40 "nx_clear_persistent(%p[#%d])"
2388 + 0 1 "quota_sync_dqh(%p,%d) discard inode %p"
2389 + 1 2 "quota_sync_dqh(%p,%d)"
2390 + "sync_dquots(%p,%d)"
2391 + "sync_dquots_dqh(%p,%d)"
2392 + 3 8 "do_quotactl(%p,%d,cmd=%d,id=%d,%p)"
2396 + 0 1 "vc: VCMD_%02d_%d[%d], %d,%p [%d,%d,%x,%x]"
2397 + 1 2 "vc: VCMD_%02d_%d[%d] = %08lx(%ld) [%d,%d]"
2398 + 4 10 "%s: (%s %s) returned %s with %d"
2402 + 7 80 "dx_parse_tag(»%s«): %d:#%d"
2403 + "dx_propagate_tag(%p[#%lu.%d]): %d,%d"
2407 + 0 1 "__lookup_vx_info(#%u): %p[#%u]"
2408 + "alloc_vx_info(%d) = %p"
2409 + "alloc_vx_info(%d)*"
2410 + "create_vx_info(%d) (dynamic rejected)"
2411 + "create_vx_info(%d) = %p (already there)"
2412 + "create_vx_info(%d) = %p (new)"
2413 + "dealloc_vx_info(%p)"
2414 + "loc_vx_info(%d) = %p (found)"
2415 + "loc_vx_info(%d) = %p (new)"
2416 + "loc_vx_info(%d) = %p (not available)"
2417 + 1 2 "create_vx_info(%d)*"
2418 + "loc_vx_info(%d)*"
2419 + 2 4 "get_vx_info(%p[#%d.%d])"
2420 + "put_vx_info(%p[#%d.%d])"
2421 + 3 8 "claim_vx_info(%p[#%d.%d.%d]) %p"
2422 + "clr_vx_info(%p[#%d.%d])"
2423 + "init_vx_info(%p[#%d.%d])"
2424 + "release_vx_info(%p[#%d.%d.%d]) %p"
2425 + "set_vx_info(%p[#%d.%d])"
2426 + 4 10 "__hash_vx_info: %p[#%d]"
2427 + "__unhash_vx_info: %p[#%d.%d.%d]"
2428 + "__vx_dynamic_id: [#%d]"
2429 + 5 20 "enter_vx_info(%p[#%d],%p) %p[#%d,%p]"
2430 + "leave_vx_info(%p[#%d,%p]) %p[#%d,%p]"
2431 + "moved task %p into vxi:%p[#%d]"
2432 + "task_get_vx_info(%p)"
2433 + "vx_migrate_task(%p,%p[#%d.%d])"
2434 + 6 40 "vx_clear_persistent(%p[#%d])"
2435 + "vx_exit_init(%p[#%d],%p[#%d,%d,%d])"
2436 + "vx_set_init(%p[#%d],%p[#%d,%d,%d])"
2437 + "vx_set_persistent(%p[#%d])"
2438 + "vx_set_reaper(%p[#%d],%p[#%d,%d])"
2439 + 7 80 "vx_child_reaper(%p[#%u,%u]) = %p[#%u,%u]"
2444 + n 2^n "vx_acc_cres[%5d,%s,%2d]: %5d%s"
2445 + "vx_cres_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
2447 + m 2^m "vx_acc_page[%5d,%s,%2d]: %5d%s"
2448 + "vx_acc_pages[%5d,%s,%2d]: %5d += %5d"
2449 + "vx_pages_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
2450 diff -NurpP --minimal linux-2.6.35.2/drivers/block/Kconfig linux-2.6.35.2-vs2.3.0.36.31/drivers/block/Kconfig
2451 --- linux-2.6.35.2/drivers/block/Kconfig 2010-08-02 16:52:14.000000000 +0200
2452 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/block/Kconfig 2010-08-02 17:05:05.000000000 +0200
2453 @@ -273,6 +273,13 @@ config BLK_DEV_CRYPTOLOOP
2455 source "drivers/block/drbd/Kconfig"
2457 +config BLK_DEV_VROOT
2458 + tristate "Virtual Root device support"
2459 + depends on QUOTACTL
2461 + Saying Y here will allow you to use quota/fs ioctls on a shared
2462 + partition within a virtual server without compromising security.
2465 tristate "Network block device support"
2467 diff -NurpP --minimal linux-2.6.35.2/drivers/block/loop.c linux-2.6.35.2-vs2.3.0.36.31/drivers/block/loop.c
2468 --- linux-2.6.35.2/drivers/block/loop.c 2010-08-02 16:52:14.000000000 +0200
2469 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/block/loop.c 2010-08-02 17:05:05.000000000 +0200
2471 #include <linux/highmem.h>
2472 #include <linux/kthread.h>
2473 #include <linux/splice.h>
2474 +#include <linux/vs_context.h>
2476 #include <asm/uaccess.h>
2478 @@ -813,6 +814,7 @@ static int loop_set_fd(struct loop_devic
2479 lo->lo_blocksize = lo_blocksize;
2480 lo->lo_device = bdev;
2481 lo->lo_flags = lo_flags;
2482 + lo->lo_xid = vx_current_xid();
2483 lo->lo_backing_file = file;
2484 lo->transfer = transfer_none;
2486 @@ -941,6 +943,7 @@ static int loop_clr_fd(struct loop_devic
2487 lo->lo_encrypt_key_size = 0;
2489 lo->lo_thread = NULL;
2491 memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
2492 memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
2493 memset(lo->lo_file_name, 0, LO_NAME_SIZE);
2494 @@ -978,7 +981,7 @@ loop_set_status(struct loop_device *lo,
2496 if (lo->lo_encrypt_key_size &&
2497 lo->lo_key_owner != uid &&
2498 - !capable(CAP_SYS_ADMIN))
2499 + !vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_CLOOP))
2501 if (lo->lo_state != Lo_bound)
2503 @@ -1062,7 +1065,8 @@ loop_get_status(struct loop_device *lo,
2504 memcpy(info->lo_crypt_name, lo->lo_crypt_name, LO_NAME_SIZE);
2505 info->lo_encrypt_type =
2506 lo->lo_encryption ? lo->lo_encryption->number : 0;
2507 - if (lo->lo_encrypt_key_size && capable(CAP_SYS_ADMIN)) {
2508 + if (lo->lo_encrypt_key_size &&
2509 + vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_CLOOP)) {
2510 info->lo_encrypt_key_size = lo->lo_encrypt_key_size;
2511 memcpy(info->lo_encrypt_key, lo->lo_encrypt_key,
2512 lo->lo_encrypt_key_size);
2513 @@ -1408,6 +1412,9 @@ static int lo_open(struct block_device *
2515 struct loop_device *lo = bdev->bd_disk->private_data;
2517 + if (!vx_check(lo->lo_xid, VS_IDENT|VS_HOSTID|VS_ADMIN_P))
2520 mutex_lock(&lo->lo_ctl_mutex);
2522 mutex_unlock(&lo->lo_ctl_mutex);
2523 diff -NurpP --minimal linux-2.6.35.2/drivers/block/Makefile linux-2.6.35.2-vs2.3.0.36.31/drivers/block/Makefile
2524 --- linux-2.6.35.2/drivers/block/Makefile 2010-02-25 11:51:36.000000000 +0100
2525 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/block/Makefile 2010-08-02 17:05:05.000000000 +0200
2526 @@ -34,6 +34,7 @@ obj-$(CONFIG_VIODASD) += viodasd.o
2527 obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
2528 obj-$(CONFIG_BLK_DEV_UB) += ub.o
2529 obj-$(CONFIG_BLK_DEV_HD) += hd.o
2530 +obj-$(CONFIG_BLK_DEV_VROOT) += vroot.o
2532 obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o
2533 obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
2534 diff -NurpP --minimal linux-2.6.35.2/drivers/block/vroot.c linux-2.6.35.2-vs2.3.0.36.31/drivers/block/vroot.c
2535 --- linux-2.6.35.2/drivers/block/vroot.c 1970-01-01 01:00:00.000000000 +0100
2536 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/block/vroot.c 2010-08-02 17:05:05.000000000 +0200
2539 + * linux/drivers/block/vroot.c
2541 + * written by Herbert Pötzl, 9/11/2002
2542 + * ported to 2.6.10 by Herbert Pötzl, 30/12/2004
2544 + * based on the loop.c code by Theodore Ts'o.
2546 + * Copyright (C) 2002-2007 by Herbert Pötzl.
2547 + * Redistribution of this file is permitted under the
2548 + * GNU General Public License.
2552 +#include <linux/module.h>
2553 +#include <linux/moduleparam.h>
2554 +#include <linux/file.h>
2555 +#include <linux/major.h>
2556 +#include <linux/blkdev.h>
2557 +#include <linux/slab.h>
2559 +#include <linux/vroot.h>
2560 +#include <linux/vs_context.h>
2563 +static int max_vroot = 8;
2565 +static struct vroot_device *vroot_dev;
2566 +static struct gendisk **disks;
2569 +static int vroot_set_dev(
2570 + struct vroot_device *vr,
2571 + struct block_device *bdev,
2574 + struct block_device *real_bdev;
2575 + struct file *file;
2576 + struct inode *inode;
2580 + if (vr->vr_state != Vr_unbound)
2589 + inode = file->f_dentry->d_inode;
2592 + if (S_ISBLK(inode->i_mode)) {
2593 + real_bdev = inode->i_bdev;
2594 + vr->vr_device = real_bdev;
2595 + __iget(real_bdev->bd_inode);
2599 + vxdprintk(VXD_CBIT(misc, 0),
2600 + "vroot[%d]_set_dev: dev=" VXF_DEV,
2601 + vr->vr_number, VXD_DEV(real_bdev));
2603 + vr->vr_state = Vr_bound;
2612 +static int vroot_clr_dev(
2613 + struct vroot_device *vr,
2614 + struct block_device *bdev)
2616 + struct block_device *real_bdev;
2618 + if (vr->vr_state != Vr_bound)
2620 + if (vr->vr_refcnt > 1) /* we needed one fd for the ioctl */
2623 + real_bdev = vr->vr_device;
2625 + vxdprintk(VXD_CBIT(misc, 0),
2626 + "vroot[%d]_clr_dev: dev=" VXF_DEV,
2627 + vr->vr_number, VXD_DEV(real_bdev));
2630 + vr->vr_state = Vr_unbound;
2631 + vr->vr_device = NULL;
2636 +static int vr_ioctl(struct block_device *bdev, fmode_t mode,
2637 + unsigned int cmd, unsigned long arg)
2639 + struct vroot_device *vr = bdev->bd_disk->private_data;
2642 + down(&vr->vr_ctl_mutex);
2644 + case VROOT_SET_DEV:
2645 + err = vroot_set_dev(vr, bdev, arg);
2647 + case VROOT_CLR_DEV:
2648 + err = vroot_clr_dev(vr, bdev);
2654 + up(&vr->vr_ctl_mutex);
2658 +static int vr_open(struct block_device *bdev, fmode_t mode)
2660 + struct vroot_device *vr = bdev->bd_disk->private_data;
2662 + down(&vr->vr_ctl_mutex);
2664 + up(&vr->vr_ctl_mutex);
2668 +static int vr_release(struct gendisk *disk, fmode_t mode)
2670 + struct vroot_device *vr = disk->private_data;
2672 + down(&vr->vr_ctl_mutex);
2674 + up(&vr->vr_ctl_mutex);
2678 +static struct block_device_operations vr_fops = {
2679 + .owner = THIS_MODULE,
2681 + .release = vr_release,
2682 + .ioctl = vr_ioctl,
2685 +struct block_device *__vroot_get_real_bdev(struct block_device *bdev)
2687 + struct inode *inode = bdev->bd_inode;
2688 + struct vroot_device *vr;
2689 + struct block_device *real_bdev;
2690 + int minor = iminor(inode);
2692 + vr = &vroot_dev[minor];
2693 + real_bdev = vr->vr_device;
2695 + vxdprintk(VXD_CBIT(misc, 0),
2696 + "vroot[%d]_get_real_bdev: dev=" VXF_DEV,
2697 + vr->vr_number, VXD_DEV(real_bdev));
2699 + if (vr->vr_state != Vr_bound)
2700 + return ERR_PTR(-ENXIO);
2702 + __iget(real_bdev->bd_inode);
2707 + * And now the modules code and kernel interface.
2710 +module_param(max_vroot, int, 0);
2712 +MODULE_PARM_DESC(max_vroot, "Maximum number of vroot devices (1-256)");
2713 +MODULE_LICENSE("GPL");
2714 +MODULE_ALIAS_BLOCKDEV_MAJOR(VROOT_MAJOR);
2716 +MODULE_AUTHOR ("Herbert Pötzl");
2717 +MODULE_DESCRIPTION ("Virtual Root Device Mapper");
2720 +int __init vroot_init(void)
2724 + if (max_vroot < 1 || max_vroot > 256) {
2725 + max_vroot = MAX_VROOT_DEFAULT;
2726 + printk(KERN_WARNING "vroot: invalid max_vroot "
2727 + "(must be between 1 and 256), "
2728 + "using default (%d)\n", max_vroot);
2731 + if (register_blkdev(VROOT_MAJOR, "vroot"))
2735 + vroot_dev = kmalloc(max_vroot * sizeof(struct vroot_device), GFP_KERNEL);
2738 + memset(vroot_dev, 0, max_vroot * sizeof(struct vroot_device));
2740 + disks = kmalloc(max_vroot * sizeof(struct gendisk *), GFP_KERNEL);
2744 + for (i = 0; i < max_vroot; i++) {
2745 + disks[i] = alloc_disk(1);
2748 + disks[i]->queue = blk_alloc_queue(GFP_KERNEL);
2749 + if (!disks[i]->queue)
2753 + for (i = 0; i < max_vroot; i++) {
2754 + struct vroot_device *vr = &vroot_dev[i];
2755 + struct gendisk *disk = disks[i];
2757 + memset(vr, 0, sizeof(*vr));
2758 + init_MUTEX(&vr->vr_ctl_mutex);
2759 + vr->vr_number = i;
2760 + disk->major = VROOT_MAJOR;
2761 + disk->first_minor = i;
2762 + disk->fops = &vr_fops;
2763 + sprintf(disk->disk_name, "vroot%d", i);
2764 + disk->private_data = vr;
2767 + err = register_vroot_grb(&__vroot_get_real_bdev);
2771 + for (i = 0; i < max_vroot; i++)
2772 + add_disk(disks[i]);
2773 + printk(KERN_INFO "vroot: loaded (max %d devices)\n", max_vroot);
2778 + put_disk(disks[i]);
2783 + unregister_blkdev(VROOT_MAJOR, "vroot");
2784 + printk(KERN_ERR "vroot: ran out of memory\n");
2788 +void vroot_exit(void)
2792 + if (unregister_vroot_grb(&__vroot_get_real_bdev))
2793 + printk(KERN_WARNING "vroot: cannot unregister grb\n");
2795 + for (i = 0; i < max_vroot; i++) {
2796 + del_gendisk(disks[i]);
2797 + put_disk(disks[i]);
2799 + unregister_blkdev(VROOT_MAJOR, "vroot");
2805 +module_init(vroot_init);
2806 +module_exit(vroot_exit);
2810 +static int __init max_vroot_setup(char *str)
2812 + max_vroot = simple_strtol(str, NULL, 0);
2816 +__setup("max_vroot=", max_vroot_setup);
2820 diff -NurpP --minimal linux-2.6.35.2/drivers/char/sysrq.c linux-2.6.35.2-vs2.3.0.36.31/drivers/char/sysrq.c
2821 --- linux-2.6.35.2/drivers/char/sysrq.c 2010-08-02 16:52:15.000000000 +0200
2822 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/char/sysrq.c 2010-08-02 17:39:50.000000000 +0200
2824 #include <linux/oom.h>
2825 #include <linux/slab.h>
2826 #include <linux/input.h>
2827 +#include <linux/vserver/debug.h>
2829 #include <asm/ptrace.h>
2830 #include <asm/irq_regs.h>
2831 @@ -396,6 +397,21 @@ static struct sysrq_key_op sysrq_unrt_op
2832 .enable_mask = SYSRQ_ENABLE_RTNICE,
2836 +#ifdef CONFIG_VSERVER_DEBUG
2837 +static void sysrq_handle_vxinfo(int key, struct tty_struct *tty)
2839 + dump_vx_info_inactive((key == 'x')?0:1);
2842 +static struct sysrq_key_op sysrq_showvxinfo_op = {
2843 + .handler = sysrq_handle_vxinfo,
2844 + .help_msg = "conteXt",
2845 + .action_msg = "Show Context Info",
2846 + .enable_mask = SYSRQ_ENABLE_DUMP,
2850 /* Key Operations table and lock */
2851 static DEFINE_SPINLOCK(sysrq_key_table_lock);
2853 @@ -450,7 +466,11 @@ static struct sysrq_key_op *sysrq_key_ta
2855 &sysrq_showstate_blocked_op, /* w */
2856 /* x: May be registered on ppc/powerpc for xmon */
2857 +#ifdef CONFIG_VSERVER_DEBUG
2858 + &sysrq_showvxinfo_op, /* x */
2862 /* y: May be registered on sparc64 for global register dump */
2864 &sysrq_ftrace_dump_op, /* z */
2865 @@ -465,6 +485,8 @@ static int sysrq_key_table_key2index(int
2867 else if ((key >= 'a') && (key <= 'z'))
2868 retval = key + 10 - 'a';
2869 + else if ((key >= 'A') && (key <= 'Z'))
2870 + retval = key + 10 - 'A';
2874 diff -NurpP --minimal linux-2.6.35.2/drivers/char/tty_io.c linux-2.6.35.2-vs2.3.0.36.31/drivers/char/tty_io.c
2875 --- linux-2.6.35.2/drivers/char/tty_io.c 2010-07-07 18:31:15.000000000 +0200
2876 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/char/tty_io.c 2010-08-02 17:05:05.000000000 +0200
2879 #include <linux/kmod.h>
2880 #include <linux/nsproxy.h>
2881 +#include <linux/vs_pid.h>
2883 #undef TTY_DEBUG_HANGUP
2885 @@ -1992,7 +1993,8 @@ static int tiocsti(struct tty_struct *tt
2887 struct tty_ldisc *ld;
2889 - if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
2890 + if (((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN)) ||
2891 + !vx_ccaps(VXC_TIOCSTI))
2893 if (get_user(ch, p))
2895 @@ -2280,6 +2282,7 @@ static int tiocspgrp(struct tty_struct *
2897 if (get_user(pgrp_nr, p))
2899 + pgrp_nr = vx_rmap_pid(pgrp_nr);
2903 diff -NurpP --minimal linux-2.6.35.2/drivers/gpu/drm/radeon/r100_reg_safe.h linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/r100_reg_safe.h
2904 --- linux-2.6.35.2/drivers/gpu/drm/radeon/r100_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
2905 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/r100_reg_safe.h 2010-08-02 17:05:05.000000000 +0200
2907 +static const unsigned r100_reg_safe_bm[102] = {
2908 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2909 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2910 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2911 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2912 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2913 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2914 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2915 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2916 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2917 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2918 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
2919 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
2920 + 0xFFFFFFCF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2921 + 0xFFFFFF9F, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2922 + 0x38E7FE1F, 0xFFC3FF8E, 0x7FF8FFFF, 0xFFFF803C,
2923 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2924 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFEFFFF, 0xFFFFFFFF,
2925 + 0x00000000, 0xFFFFFFFD, 0xFFFFFFFF, 0xFFFFFFFF,
2926 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2927 + 0xFFFFFFFF, 0xFFFCFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2928 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2929 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2930 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2931 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2932 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2933 + 0xFFFFFFFF, 0xFFFFFFEF,
2935 diff -NurpP --minimal linux-2.6.35.2/drivers/gpu/drm/radeon/r200_reg_safe.h linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/r200_reg_safe.h
2936 --- linux-2.6.35.2/drivers/gpu/drm/radeon/r200_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
2937 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/r200_reg_safe.h 2010-08-02 17:05:05.000000000 +0200
2939 +static const unsigned r200_reg_safe_bm[102] = {
2940 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2941 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2942 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2943 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2944 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2945 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2946 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2947 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2948 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2949 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2950 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
2951 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
2952 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2953 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2954 + 0xFFE7FE1F, 0xF003FFFF, 0x7EFFFFFF, 0xFFFF803C,
2955 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2956 + 0xFFFFFFFF, 0xFFFFEFCE, 0xFFFEFFFF, 0xFFFFFFFE,
2957 + 0x020E0FF0, 0xFFCC83FD, 0xFFFFFFFF, 0xFFFFFFFF,
2958 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2959 + 0xFFFBFFFF, 0xEFFCFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2960 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2961 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2962 + 0xDFDFDFDF, 0x3FFDDFDF, 0xFFFFFFFF, 0xFFFFFF7F,
2963 + 0xFFFFFFFF, 0x00FFFFFF, 0x00000000, 0x00000000,
2964 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2965 + 0xFFFFFE3F, 0xFFFFFFEF,
2967 diff -NurpP --minimal linux-2.6.35.2/drivers/gpu/drm/radeon/r300_reg_safe.h linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/r300_reg_safe.h
2968 --- linux-2.6.35.2/drivers/gpu/drm/radeon/r300_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
2969 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/r300_reg_safe.h 2010-08-02 17:05:05.000000000 +0200
2971 +static const unsigned r300_reg_safe_bm[159] = {
2972 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2973 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2974 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2975 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2976 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2977 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2978 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2979 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2980 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2981 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2982 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
2983 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
2984 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2985 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2986 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
2987 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2988 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
2989 + 0xF0000078, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
2990 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2991 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2992 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2993 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2994 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2995 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2996 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2997 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2998 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
2999 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3000 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3001 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3002 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3003 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3004 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3005 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3006 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3007 + 0x00000000, 0x0000C100, 0x00000000, 0x00000000,
3008 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3009 + 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFF80FFFF,
3010 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3011 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19,
3013 diff -NurpP --minimal linux-2.6.35.2/drivers/gpu/drm/radeon/r420_reg_safe.h linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/r420_reg_safe.h
3014 --- linux-2.6.35.2/drivers/gpu/drm/radeon/r420_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3015 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/r420_reg_safe.h 2010-08-02 17:05:05.000000000 +0200
3017 +static const unsigned r420_reg_safe_bm[159] = {
3018 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3019 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3020 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3021 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3022 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3023 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3024 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3025 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3026 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3027 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3028 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3029 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3030 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3031 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3032 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3033 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3034 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3035 + 0xF0000078, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3036 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3037 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3038 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3039 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3040 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3041 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3042 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3043 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3044 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3045 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3046 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3047 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3048 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3049 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3050 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3051 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3052 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3053 + 0x00000000, 0x00000100, 0x00000000, 0x00000000,
3054 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3055 + 0x00000000, 0x00000000, 0x00000000, 0xFF800000,
3056 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3057 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19,
3059 diff -NurpP --minimal linux-2.6.35.2/drivers/gpu/drm/radeon/rn50_reg_safe.h linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/rn50_reg_safe.h
3060 --- linux-2.6.35.2/drivers/gpu/drm/radeon/rn50_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3061 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/rn50_reg_safe.h 2010-08-02 17:05:05.000000000 +0200
3063 +static const unsigned rn50_reg_safe_bm[102] = {
3064 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3065 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3066 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3067 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3068 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3069 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3070 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3071 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3072 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3073 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3074 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3075 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3076 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3077 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3078 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3079 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3080 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3081 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3082 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3083 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3084 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3085 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3086 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3087 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3088 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3089 + 0xFFFFFFFF, 0xFFFFFFFF,
3091 diff -NurpP --minimal linux-2.6.35.2/drivers/gpu/drm/radeon/rs600_reg_safe.h linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/rs600_reg_safe.h
3092 --- linux-2.6.35.2/drivers/gpu/drm/radeon/rs600_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3093 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/rs600_reg_safe.h 2010-08-02 17:05:05.000000000 +0200
3095 +static const unsigned rs600_reg_safe_bm[219] = {
3096 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3097 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3098 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3099 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3100 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3101 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3102 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3103 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3104 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3105 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3106 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3107 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3108 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3109 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3110 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3111 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3112 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3113 + 0xF0000078, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3114 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3115 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3116 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3117 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3118 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3119 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3120 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3121 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3122 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3123 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3124 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3125 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3126 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3127 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3128 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3129 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3130 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3131 + 0x00000000, 0x00000100, 0x00000000, 0x00000000,
3132 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3133 + 0x00000000, 0x00000000, 0x00000000, 0xFF800000,
3134 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3135 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19, 0xFFFFFFFF,
3136 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3137 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3138 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3139 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3140 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3141 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3142 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3143 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3144 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3145 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3146 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3147 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3148 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3149 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3150 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3152 diff -NurpP --minimal linux-2.6.35.2/drivers/gpu/drm/radeon/rv515_reg_safe.h linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/rv515_reg_safe.h
3153 --- linux-2.6.35.2/drivers/gpu/drm/radeon/rv515_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3154 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/gpu/drm/radeon/rv515_reg_safe.h 2010-08-02 17:05:05.000000000 +0200
3156 +static const unsigned rv515_reg_safe_bm[219] = {
3157 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3158 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3159 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3160 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3161 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3162 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3163 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3164 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3165 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3166 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3167 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3168 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3169 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3170 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3171 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3172 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3173 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3174 + 0xF0000038, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3175 + 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF,
3176 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3177 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3178 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3179 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3180 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3181 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3182 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3183 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3184 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3185 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3186 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3187 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3188 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3189 + 0x1FFFF878, 0xFFFFE000, 0xFFFFFE1E, 0xFFFFFFFF,
3190 + 0x388F8F50, 0xFFF88082, 0xFF0000FC, 0xFAE009FF,
3191 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3192 + 0xFFFF8CFC, 0xFFFFC1FF, 0xFFFFFFFF, 0xFFFFFFFF,
3193 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3194 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF80FFFF,
3195 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3196 + 0x0003FC01, 0x3FFFFCF8, 0xFF800B19, 0xFFDFFFFF,
3197 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3198 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3199 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3200 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3201 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3202 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3203 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3204 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3205 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3206 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3207 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3208 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3209 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3210 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3211 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3213 diff -NurpP --minimal linux-2.6.35.2/drivers/infiniband/core/addr.c linux-2.6.35.2-vs2.3.0.36.31/drivers/infiniband/core/addr.c
3214 --- linux-2.6.35.2/drivers/infiniband/core/addr.c 2010-07-07 18:31:18.000000000 +0200
3215 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/infiniband/core/addr.c 2010-08-02 17:05:05.000000000 +0200
3216 @@ -252,7 +252,7 @@ static int addr6_resolve(struct sockaddr
3218 if (ipv6_addr_any(&fl.fl6_src)) {
3219 ret = ipv6_dev_get_saddr(&init_net, ip6_dst_idev(dst)->dev,
3220 - &fl.fl6_dst, 0, &fl.fl6_src);
3221 + &fl.fl6_dst, 0, &fl.fl6_src, NULL);
3225 diff -NurpP --minimal linux-2.6.35.2/drivers/infiniband/hw/ipath/ipath_user_pages.c linux-2.6.35.2-vs2.3.0.36.31/drivers/infiniband/hw/ipath/ipath_user_pages.c
3226 --- linux-2.6.35.2/drivers/infiniband/hw/ipath/ipath_user_pages.c 2010-07-07 18:31:19.000000000 +0200
3227 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/infiniband/hw/ipath/ipath_user_pages.c 2010-08-02 17:05:05.000000000 +0200
3229 #include <linux/device.h>
3230 #include <linux/slab.h>
3231 #include <linux/sched.h>
3232 +#include <linux/vs_memory.h>
3234 #include "ipath_kernel.h"
3236 diff -NurpP --minimal linux-2.6.35.2/drivers/md/dm.c linux-2.6.35.2-vs2.3.0.36.31/drivers/md/dm.c
3237 --- linux-2.6.35.2/drivers/md/dm.c 2010-07-07 18:31:21.000000000 +0200
3238 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/md/dm.c 2010-08-02 17:05:05.000000000 +0200
3240 #include <linux/slab.h>
3241 #include <linux/idr.h>
3242 #include <linux/hdreg.h>
3243 +#include <linux/vs_base.h>
3245 #include <trace/events/block.h>
3247 @@ -119,6 +120,7 @@ struct mapped_device {
3250 atomic_t open_count;
3253 unsigned long flags;
3255 @@ -337,6 +339,7 @@ int dm_deleting_md(struct mapped_device
3256 static int dm_blk_open(struct block_device *bdev, fmode_t mode)
3258 struct mapped_device *md;
3261 spin_lock(&_minor_lock);
3263 @@ -345,18 +348,19 @@ static int dm_blk_open(struct block_devi
3266 if (test_bit(DMF_FREEING, &md->flags) ||
3267 - dm_deleting_md(md)) {
3269 + dm_deleting_md(md))
3273 + if (!vx_check(md->xid, VS_IDENT|VS_HOSTID))
3278 atomic_inc(&md->open_count);
3282 spin_unlock(&_minor_lock);
3284 - return md ? 0 : -ENXIO;
3288 static int dm_blk_close(struct gendisk *disk, fmode_t mode)
3289 @@ -574,6 +578,14 @@ int dm_set_geometry(struct mapped_device
3294 + * Get the xid associated with a dm device
3296 +xid_t dm_get_xid(struct mapped_device *md)
3301 /*-----------------------------------------------------------------
3303 * A more elegant soln is in the works that uses the queue
3304 @@ -1886,6 +1898,7 @@ static struct mapped_device *alloc_dev(i
3305 INIT_LIST_HEAD(&md->uevent_list);
3306 spin_lock_init(&md->uevent_lock);
3308 + md->xid = vx_current_xid();
3309 md->queue = blk_init_queue(dm_request_fn, NULL);
3312 diff -NurpP --minimal linux-2.6.35.2/drivers/md/dm.h linux-2.6.35.2-vs2.3.0.36.31/drivers/md/dm.h
3313 --- linux-2.6.35.2/drivers/md/dm.h 2010-07-07 18:31:21.000000000 +0200
3314 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/md/dm.h 2010-08-02 17:05:05.000000000 +0200
3315 @@ -41,6 +41,8 @@ struct dm_dev_internal {
3317 struct dm_md_mempools;
3319 +xid_t dm_get_xid(struct mapped_device *md);
3321 /*-----------------------------------------------------------------
3322 * Internal table functions.
3323 *---------------------------------------------------------------*/
3324 diff -NurpP --minimal linux-2.6.35.2/drivers/md/dm-ioctl.c linux-2.6.35.2-vs2.3.0.36.31/drivers/md/dm-ioctl.c
3325 --- linux-2.6.35.2/drivers/md/dm-ioctl.c 2010-07-07 18:31:21.000000000 +0200
3326 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/md/dm-ioctl.c 2010-08-02 17:05:05.000000000 +0200
3328 #include <linux/dm-ioctl.h>
3329 #include <linux/hdreg.h>
3330 #include <linux/compat.h>
3331 +#include <linux/vs_context.h>
3333 #include <asm/uaccess.h>
3335 @@ -106,7 +107,8 @@ static struct hash_cell *__get_name_cell
3336 unsigned int h = hash_str(str);
3338 list_for_each_entry (hc, _name_buckets + h, name_list)
3339 - if (!strcmp(hc->name, str)) {
3340 + if (vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT) &&
3341 + !strcmp(hc->name, str)) {
3345 @@ -120,7 +122,8 @@ static struct hash_cell *__get_uuid_cell
3346 unsigned int h = hash_str(str);
3348 list_for_each_entry (hc, _uuid_buckets + h, uuid_list)
3349 - if (!strcmp(hc->uuid, str)) {
3350 + if (vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT) &&
3351 + !strcmp(hc->uuid, str)) {
3355 @@ -365,6 +368,9 @@ typedef int (*ioctl_fn)(struct dm_ioctl
3357 static int remove_all(struct dm_ioctl *param, size_t param_size)
3359 + if (!vx_check(0, VS_ADMIN))
3362 dm_hash_remove_all(1);
3363 param->data_size = 0;
3365 @@ -412,6 +418,8 @@ static int list_devices(struct dm_ioctl
3367 for (i = 0; i < NUM_BUCKETS; i++) {
3368 list_for_each_entry (hc, _name_buckets + i, name_list) {
3369 + if (!vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT))
3371 needed += sizeof(struct dm_name_list);
3372 needed += strlen(hc->name) + 1;
3373 needed += ALIGN_MASK;
3374 @@ -435,6 +443,8 @@ static int list_devices(struct dm_ioctl
3376 for (i = 0; i < NUM_BUCKETS; i++) {
3377 list_for_each_entry (hc, _name_buckets + i, name_list) {
3378 + if (!vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT))
3381 old_nl->next = (uint32_t) ((void *) nl -
3383 @@ -669,10 +679,11 @@ static struct hash_cell *__find_device_h
3387 - mdptr = dm_get_mdptr(md);
3388 + if (vx_check(dm_get_xid(md), VS_WATCH_P | VS_IDENT))
3389 + mdptr = dm_get_mdptr(md);
3397 @@ -1514,8 +1525,8 @@ static int ctl_ioctl(uint command, struc
3401 - /* only root can play with this */
3402 - if (!capable(CAP_SYS_ADMIN))
3403 + /* only root and certain contexts can play with this */
3404 + if (!vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_MAPPER))
3407 if (_IOC_TYPE(command) != DM_IOCTL)
3408 diff -NurpP --minimal linux-2.6.35.2/drivers/net/tun.c linux-2.6.35.2-vs2.3.0.36.31/drivers/net/tun.c
3409 --- linux-2.6.35.2/drivers/net/tun.c 2010-08-02 16:52:27.000000000 +0200
3410 +++ linux-2.6.35.2-vs2.3.0.36.31/drivers/net/tun.c 2010-08-02 17:05:05.000000000 +0200
3412 #include <linux/nsproxy.h>
3413 #include <linux/virtio_net.h>
3414 #include <linux/rcupdate.h>
3415 +#include <linux/vs_network.h>
3416 #include <net/net_namespace.h>
3417 #include <net/netns/generic.h>
3418 #include <net/rtnetlink.h>
3419 @@ -103,6 +104,7 @@ struct tun_struct {
3425 struct net_device *dev;
3426 struct fasync_struct *fasync;
3427 @@ -851,6 +853,7 @@ static void tun_setup(struct net_device
3431 + tun->nid = current->nid;
3433 dev->ethtool_ops = &tun_ethtool_ops;
3434 dev->destructor = tun_free_netdev;
3435 @@ -1001,7 +1004,7 @@ static int tun_set_iff(struct net *net,
3437 if (((tun->owner != -1 && cred->euid != tun->owner) ||
3438 (tun->group != -1 && !in_egroup_p(tun->group))) &&
3439 - !capable(CAP_NET_ADMIN))
3440 + !cap_raised(current_cap(), CAP_NET_ADMIN))
3442 err = security_tun_dev_attach(tun->socket.sk);
3444 @@ -1015,7 +1018,7 @@ static int tun_set_iff(struct net *net,
3446 unsigned long flags = 0;
3448 - if (!capable(CAP_NET_ADMIN))
3449 + if (!nx_capable(CAP_NET_ADMIN, NXC_TUN_CREATE))
3451 err = security_tun_dev_create();
3453 @@ -1085,6 +1088,9 @@ static int tun_set_iff(struct net *net,
3455 sk->sk_destruct = tun_sock_destruct;
3457 + if (!nx_check(tun->nid, VS_IDENT | VS_HOSTID | VS_ADMIN_P))
3460 err = tun_attach(tun, file);
3463 @@ -1276,6 +1282,16 @@ static long __tun_chr_ioctl(struct file
3464 DBG(KERN_INFO "%s: group set to %d\n", tun->dev->name, tun->group);
3468 + if (!capable(CAP_CONTEXT))
3471 + /* Set nid owner of the device */
3472 + tun->nid = (nid_t) arg;
3474 + DBG(KERN_INFO "%s: nid owner set to %u\n", tun->dev->name, tun->nid);
3478 /* Only allow setting the type when the interface is down */
3479 if (tun->dev->flags & IFF_UP) {
3480 diff -NurpP --minimal linux-2.6.35.2/fs/attr.c linux-2.6.35.2-vs2.3.0.36.31/fs/attr.c
3481 --- linux-2.6.35.2/fs/attr.c 2010-08-02 16:52:47.000000000 +0200
3482 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/attr.c 2010-08-02 21:00:32.000000000 +0200
3484 #include <linux/fsnotify.h>
3485 #include <linux/fcntl.h>
3486 #include <linux/security.h>
3487 +#include <linux/proc_fs.h>
3488 +#include <linux/devpts_fs.h>
3489 +#include <linux/vs_tag.h>
3491 /* Taken over from the old code... */
3493 @@ -54,6 +57,10 @@ int inode_change_ok(const struct inode *
3494 if (!is_owner_or_cap(inode))
3498 + if (dx_permission(inode, MAY_WRITE))
3504 @@ -127,6 +134,8 @@ void generic_setattr(struct inode *inode
3505 inode->i_uid = attr->ia_uid;
3506 if (ia_valid & ATTR_GID)
3507 inode->i_gid = attr->ia_gid;
3508 + if ((ia_valid & ATTR_TAG) && IS_TAGGED(inode))
3509 + inode->i_tag = attr->ia_tag;
3510 if (ia_valid & ATTR_ATIME)
3511 inode->i_atime = timespec_trunc(attr->ia_atime,
3512 inode->i_sb->s_time_gran);
3513 @@ -179,7 +188,8 @@ int notify_change(struct dentry * dentry
3514 struct timespec now;
3515 unsigned int ia_valid = attr->ia_valid;
3517 - if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_TIMES_SET)) {
3518 + if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID |
3519 + ATTR_TAG | ATTR_TIMES_SET)) {
3520 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
3523 diff -NurpP --minimal linux-2.6.35.2/fs/binfmt_aout.c linux-2.6.35.2-vs2.3.0.36.31/fs/binfmt_aout.c
3524 --- linux-2.6.35.2/fs/binfmt_aout.c 2010-07-07 18:31:50.000000000 +0200
3525 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/binfmt_aout.c 2010-08-02 17:05:05.000000000 +0200
3527 #include <linux/init.h>
3528 #include <linux/coredump.h>
3529 #include <linux/slab.h>
3530 +#include <linux/vs_memory.h>
3532 #include <asm/system.h>
3533 #include <asm/uaccess.h>
3534 diff -NurpP --minimal linux-2.6.35.2/fs/binfmt_elf.c linux-2.6.35.2-vs2.3.0.36.31/fs/binfmt_elf.c
3535 --- linux-2.6.35.2/fs/binfmt_elf.c 2010-07-07 18:31:50.000000000 +0200
3536 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/binfmt_elf.c 2010-08-02 17:05:05.000000000 +0200
3538 #include <linux/elf.h>
3539 #include <linux/utsname.h>
3540 #include <linux/coredump.h>
3541 +#include <linux/vs_memory.h>
3542 #include <asm/uaccess.h>
3543 #include <asm/param.h>
3544 #include <asm/page.h>
3545 diff -NurpP --minimal linux-2.6.35.2/fs/binfmt_flat.c linux-2.6.35.2-vs2.3.0.36.31/fs/binfmt_flat.c
3546 --- linux-2.6.35.2/fs/binfmt_flat.c 2010-08-02 16:52:47.000000000 +0200
3547 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/binfmt_flat.c 2010-08-02 17:05:05.000000000 +0200
3549 #include <linux/init.h>
3550 #include <linux/flat.h>
3551 #include <linux/syscalls.h>
3552 +#include <linux/vs_memory.h>
3554 #include <asm/byteorder.h>
3555 #include <asm/system.h>
3556 diff -NurpP --minimal linux-2.6.35.2/fs/binfmt_som.c linux-2.6.35.2-vs2.3.0.36.31/fs/binfmt_som.c
3557 --- linux-2.6.35.2/fs/binfmt_som.c 2010-02-25 11:52:04.000000000 +0100
3558 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/binfmt_som.c 2010-08-02 17:05:05.000000000 +0200
3560 #include <linux/shm.h>
3561 #include <linux/personality.h>
3562 #include <linux/init.h>
3563 +#include <linux/vs_memory.h>
3565 #include <asm/uaccess.h>
3566 #include <asm/pgtable.h>
3567 diff -NurpP --minimal linux-2.6.35.2/fs/block_dev.c linux-2.6.35.2-vs2.3.0.36.31/fs/block_dev.c
3568 --- linux-2.6.35.2/fs/block_dev.c 2010-08-14 18:16:59.000000000 +0200
3569 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/block_dev.c 2010-08-14 18:19:32.000000000 +0200
3571 #include <linux/namei.h>
3572 #include <linux/log2.h>
3573 #include <linux/kmemleak.h>
3574 +#include <linux/vs_device.h>
3575 #include <asm/uaccess.h>
3576 #include "internal.h"
3578 @@ -529,6 +530,7 @@ struct block_device *bdget(dev_t dev)
3579 bdev->bd_invalidated = 0;
3580 inode->i_mode = S_IFBLK;
3581 inode->i_rdev = dev;
3582 + inode->i_mdev = dev;
3583 inode->i_bdev = bdev;
3584 inode->i_data.a_ops = &def_blk_aops;
3585 mapping_set_gfp_mask(&inode->i_data, GFP_USER);
3586 @@ -575,6 +577,11 @@ EXPORT_SYMBOL(bdput);
3587 static struct block_device *bd_acquire(struct inode *inode)
3589 struct block_device *bdev;
3592 + if (!vs_map_blkdev(inode->i_rdev, &mdev, DATTR_OPEN))
3594 + inode->i_mdev = mdev;
3596 spin_lock(&bdev_lock);
3597 bdev = inode->i_bdev;
3598 @@ -585,7 +592,7 @@ static struct block_device *bd_acquire(s
3600 spin_unlock(&bdev_lock);
3602 - bdev = bdget(inode->i_rdev);
3603 + bdev = bdget(mdev);
3605 spin_lock(&bdev_lock);
3606 if (!inode->i_bdev) {
3607 diff -NurpP --minimal linux-2.6.35.2/fs/btrfs/ctree.h linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/ctree.h
3608 --- linux-2.6.35.2/fs/btrfs/ctree.h 2010-08-02 16:52:47.000000000 +0200
3609 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/ctree.h 2010-08-02 17:05:05.000000000 +0200
3610 @@ -551,11 +551,14 @@ struct btrfs_inode_item {
3611 /* modification sequence number for NFS */
3616 * a little future expansion, for more than this we can
3617 * just grow the inode item and version it
3619 - __le64 reserved[4];
3620 + __le16 reserved16;
3621 + __le32 reserved32;
3622 + __le64 reserved[3];
3623 struct btrfs_timespec atime;
3624 struct btrfs_timespec ctime;
3625 struct btrfs_timespec mtime;
3626 @@ -1193,6 +1196,8 @@ struct btrfs_root {
3627 #define BTRFS_MOUNT_DISCARD (1 << 10)
3628 #define BTRFS_MOUNT_FORCE_COMPRESS (1 << 11)
3630 +#define BTRFS_MOUNT_TAGGED (1 << 24)
3632 #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
3633 #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
3634 #define btrfs_test_opt(root, opt) ((root)->fs_info->mount_opt & \
3635 @@ -1413,6 +1418,7 @@ BTRFS_SETGET_FUNCS(inode_block_group, st
3636 BTRFS_SETGET_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
3637 BTRFS_SETGET_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
3638 BTRFS_SETGET_FUNCS(inode_gid, struct btrfs_inode_item, gid, 32);
3639 +BTRFS_SETGET_FUNCS(inode_tag, struct btrfs_inode_item, tag, 16);
3640 BTRFS_SETGET_FUNCS(inode_mode, struct btrfs_inode_item, mode, 32);
3641 BTRFS_SETGET_FUNCS(inode_rdev, struct btrfs_inode_item, rdev, 64);
3642 BTRFS_SETGET_FUNCS(inode_flags, struct btrfs_inode_item, flags, 64);
3643 @@ -1474,6 +1480,10 @@ BTRFS_SETGET_FUNCS(extent_flags, struct
3645 BTRFS_SETGET_FUNCS(extent_refs_v0, struct btrfs_extent_item_v0, refs, 32);
3647 +#define BTRFS_INODE_IXUNLINK (1 << 24)
3648 +#define BTRFS_INODE_BARRIER (1 << 25)
3649 +#define BTRFS_INODE_COW (1 << 26)
3652 BTRFS_SETGET_FUNCS(tree_block_level, struct btrfs_tree_block_info, level, 8);
3654 @@ -2432,6 +2442,7 @@ extern const struct dentry_operations bt
3655 long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
3656 void btrfs_update_iflags(struct inode *inode);
3657 void btrfs_inherit_iflags(struct inode *inode, struct inode *dir);
3658 +int btrfs_sync_flags(struct inode *inode, int, int);
3661 int btrfs_sync_file(struct file *file, int datasync);
3662 diff -NurpP --minimal linux-2.6.35.2/fs/btrfs/disk-io.c linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/disk-io.c
3663 --- linux-2.6.35.2/fs/btrfs/disk-io.c 2010-08-02 16:52:47.000000000 +0200
3664 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/disk-io.c 2010-08-02 17:05:05.000000000 +0200
3665 @@ -1707,6 +1707,9 @@ struct btrfs_root *open_ctree(struct sup
3669 + if (btrfs_test_opt(tree_root, TAGGED))
3670 + sb->s_flags |= MS_TAGGED;
3672 features = btrfs_super_incompat_flags(disk_super) &
3673 ~BTRFS_FEATURE_INCOMPAT_SUPP;
3675 diff -NurpP --minimal linux-2.6.35.2/fs/btrfs/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/inode.c
3676 --- linux-2.6.35.2/fs/btrfs/inode.c 2010-08-02 16:52:47.000000000 +0200
3677 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/inode.c 2010-08-02 17:05:05.000000000 +0200
3679 #include <linux/posix_acl.h>
3680 #include <linux/falloc.h>
3681 #include <linux/slab.h>
3682 +#include <linux/vs_tag.h>
3686 #include "disk-io.h"
3687 @@ -2415,6 +2417,8 @@ static void btrfs_read_locked_inode(stru
3689 u64 alloc_group_block;
3695 path = btrfs_alloc_path();
3696 @@ -2431,8 +2435,13 @@ static void btrfs_read_locked_inode(stru
3698 inode->i_mode = btrfs_inode_mode(leaf, inode_item);
3699 inode->i_nlink = btrfs_inode_nlink(leaf, inode_item);
3700 - inode->i_uid = btrfs_inode_uid(leaf, inode_item);
3701 - inode->i_gid = btrfs_inode_gid(leaf, inode_item);
3703 + uid = btrfs_inode_uid(leaf, inode_item);
3704 + gid = btrfs_inode_gid(leaf, inode_item);
3705 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
3706 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
3707 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
3708 + btrfs_inode_tag(leaf, inode_item));
3709 btrfs_i_size_write(inode, btrfs_inode_size(leaf, inode_item));
3711 tspec = btrfs_inode_atime(inode_item);
3712 @@ -2514,8 +2523,15 @@ static void fill_inode_item(struct btrfs
3713 struct btrfs_inode_item *item,
3714 struct inode *inode)
3716 - btrfs_set_inode_uid(leaf, item, inode->i_uid);
3717 - btrfs_set_inode_gid(leaf, item, inode->i_gid);
3718 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
3719 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
3721 + btrfs_set_inode_uid(leaf, item, uid);
3722 + btrfs_set_inode_gid(leaf, item, gid);
3723 +#ifdef CONFIG_TAGGING_INTERN
3724 + btrfs_set_inode_tag(leaf, item, inode->i_tag);
3727 btrfs_set_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size);
3728 btrfs_set_inode_mode(leaf, item, inode->i_mode);
3729 btrfs_set_inode_nlink(leaf, item, inode->i_nlink);
3730 @@ -6940,6 +6956,7 @@ static const struct inode_operations btr
3731 .listxattr = btrfs_listxattr,
3732 .removexattr = btrfs_removexattr,
3733 .permission = btrfs_permission,
3734 + .sync_flags = btrfs_sync_flags,
3736 static const struct inode_operations btrfs_dir_ro_inode_operations = {
3737 .lookup = btrfs_lookup,
3738 @@ -7015,6 +7032,7 @@ static const struct inode_operations btr
3739 .permission = btrfs_permission,
3740 .fallocate = btrfs_fallocate,
3741 .fiemap = btrfs_fiemap,
3742 + .sync_flags = btrfs_sync_flags,
3744 static const struct inode_operations btrfs_special_inode_operations = {
3745 .getattr = btrfs_getattr,
3746 diff -NurpP --minimal linux-2.6.35.2/fs/btrfs/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/ioctl.c
3747 --- linux-2.6.35.2/fs/btrfs/ioctl.c 2010-08-02 16:52:47.000000000 +0200
3748 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/ioctl.c 2010-08-02 17:05:05.000000000 +0200
3749 @@ -68,10 +68,13 @@ static unsigned int btrfs_flags_to_ioctl
3751 unsigned int iflags = 0;
3753 - if (flags & BTRFS_INODE_SYNC)
3754 - iflags |= FS_SYNC_FL;
3755 if (flags & BTRFS_INODE_IMMUTABLE)
3756 iflags |= FS_IMMUTABLE_FL;
3757 + if (flags & BTRFS_INODE_IXUNLINK)
3758 + iflags |= FS_IXUNLINK_FL;
3760 + if (flags & BTRFS_INODE_SYNC)
3761 + iflags |= FS_SYNC_FL;
3762 if (flags & BTRFS_INODE_APPEND)
3763 iflags |= FS_APPEND_FL;
3764 if (flags & BTRFS_INODE_NODUMP)
3765 @@ -81,28 +84,78 @@ static unsigned int btrfs_flags_to_ioctl
3766 if (flags & BTRFS_INODE_DIRSYNC)
3767 iflags |= FS_DIRSYNC_FL;
3769 + if (flags & BTRFS_INODE_BARRIER)
3770 + iflags |= FS_BARRIER_FL;
3771 + if (flags & BTRFS_INODE_COW)
3772 + iflags |= FS_COW_FL;
3777 - * Update inode->i_flags based on the btrfs internal flags.
3778 + * Update inode->i_(v)flags based on the btrfs internal flags.
3780 void btrfs_update_iflags(struct inode *inode)
3782 struct btrfs_inode *ip = BTRFS_I(inode);
3784 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
3785 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
3786 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
3788 - if (ip->flags & BTRFS_INODE_SYNC)
3789 - inode->i_flags |= S_SYNC;
3790 if (ip->flags & BTRFS_INODE_IMMUTABLE)
3791 inode->i_flags |= S_IMMUTABLE;
3792 + if (ip->flags & BTRFS_INODE_IXUNLINK)
3793 + inode->i_flags |= S_IXUNLINK;
3795 + if (ip->flags & BTRFS_INODE_SYNC)
3796 + inode->i_flags |= S_SYNC;
3797 if (ip->flags & BTRFS_INODE_APPEND)
3798 inode->i_flags |= S_APPEND;
3799 if (ip->flags & BTRFS_INODE_NOATIME)
3800 inode->i_flags |= S_NOATIME;
3801 if (ip->flags & BTRFS_INODE_DIRSYNC)
3802 inode->i_flags |= S_DIRSYNC;
3804 + inode->i_vflags &= ~(V_BARRIER | V_COW);
3806 + if (ip->flags & BTRFS_INODE_BARRIER)
3807 + inode->i_vflags |= V_BARRIER;
3808 + if (ip->flags & BTRFS_INODE_COW)
3809 + inode->i_vflags |= V_COW;
3813 + * Update btrfs internal flags from inode->i_(v)flags.
3815 +void btrfs_update_flags(struct inode *inode)
3817 + struct btrfs_inode *ip = BTRFS_I(inode);
3819 + unsigned int flags = inode->i_flags;
3820 + unsigned int vflags = inode->i_vflags;
3822 + ip->flags &= ~(BTRFS_INODE_SYNC | BTRFS_INODE_APPEND |
3823 + BTRFS_INODE_IMMUTABLE | BTRFS_INODE_IXUNLINK |
3824 + BTRFS_INODE_NOATIME | BTRFS_INODE_DIRSYNC |
3825 + BTRFS_INODE_BARRIER | BTRFS_INODE_COW);
3827 + if (flags & S_IMMUTABLE)
3828 + ip->flags |= BTRFS_INODE_IMMUTABLE;
3829 + if (flags & S_IXUNLINK)
3830 + ip->flags |= BTRFS_INODE_IXUNLINK;
3832 + if (flags & S_SYNC)
3833 + ip->flags |= BTRFS_INODE_SYNC;
3834 + if (flags & S_APPEND)
3835 + ip->flags |= BTRFS_INODE_APPEND;
3836 + if (flags & S_NOATIME)
3837 + ip->flags |= BTRFS_INODE_NOATIME;
3838 + if (flags & S_DIRSYNC)
3839 + ip->flags |= BTRFS_INODE_DIRSYNC;
3841 + if (vflags & V_BARRIER)
3842 + ip->flags |= BTRFS_INODE_BARRIER;
3843 + if (vflags & V_COW)
3844 + ip->flags |= BTRFS_INODE_COW;
3848 @@ -120,7 +173,7 @@ void btrfs_inherit_iflags(struct inode *
3849 flags = BTRFS_I(dir)->flags;
3851 if (S_ISREG(inode->i_mode))
3852 - flags &= ~BTRFS_INODE_DIRSYNC;
3853 + flags &= ~(BTRFS_INODE_DIRSYNC | BTRFS_INODE_BARRIER);
3854 else if (!S_ISDIR(inode->i_mode))
3855 flags &= (BTRFS_INODE_NODUMP | BTRFS_INODE_NOATIME);
3857 @@ -128,6 +181,30 @@ void btrfs_inherit_iflags(struct inode *
3858 btrfs_update_iflags(inode);
3861 +int btrfs_sync_flags(struct inode *inode, int flags, int vflags)
3863 + struct btrfs_inode *ip = BTRFS_I(inode);
3864 + struct btrfs_root *root = ip->root;
3865 + struct btrfs_trans_handle *trans;
3868 + trans = btrfs_join_transaction(root, 1);
3871 + inode->i_flags = flags;
3872 + inode->i_vflags = vflags;
3873 + btrfs_update_flags(inode);
3875 + ret = btrfs_update_inode(trans, root, inode);
3878 + btrfs_update_iflags(inode);
3879 + inode->i_ctime = CURRENT_TIME;
3880 + btrfs_end_transaction(trans, root);
3885 static int btrfs_ioctl_getflags(struct file *file, void __user *arg)
3887 struct btrfs_inode *ip = BTRFS_I(file->f_path.dentry->d_inode);
3888 @@ -150,6 +227,7 @@ static int btrfs_ioctl_setflags(struct f
3889 if (copy_from_user(&flags, arg, sizeof(flags)))
3892 + /* maybe add FS_IXUNLINK_FL ? */
3893 if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
3894 FS_NOATIME_FL | FS_NODUMP_FL | \
3895 FS_SYNC_FL | FS_DIRSYNC_FL))
3896 @@ -162,7 +240,8 @@ static int btrfs_ioctl_setflags(struct f
3898 flags = btrfs_mask_flags(inode->i_mode, flags);
3899 oldflags = btrfs_flags_to_ioctl(ip->flags);
3900 - if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) {
3901 + if ((flags ^ oldflags) & (FS_APPEND_FL |
3902 + FS_IMMUTABLE_FL | FS_IXUNLINK_FL)) {
3903 if (!capable(CAP_LINUX_IMMUTABLE)) {
3906 @@ -173,14 +252,19 @@ static int btrfs_ioctl_setflags(struct f
3910 - if (flags & FS_SYNC_FL)
3911 - ip->flags |= BTRFS_INODE_SYNC;
3913 - ip->flags &= ~BTRFS_INODE_SYNC;
3914 if (flags & FS_IMMUTABLE_FL)
3915 ip->flags |= BTRFS_INODE_IMMUTABLE;
3917 ip->flags &= ~BTRFS_INODE_IMMUTABLE;
3918 + if (flags & FS_IXUNLINK_FL)
3919 + ip->flags |= BTRFS_INODE_IXUNLINK;
3921 + ip->flags &= ~BTRFS_INODE_IXUNLINK;
3923 + if (flags & FS_SYNC_FL)
3924 + ip->flags |= BTRFS_INODE_SYNC;
3926 + ip->flags &= ~BTRFS_INODE_SYNC;
3927 if (flags & FS_APPEND_FL)
3928 ip->flags |= BTRFS_INODE_APPEND;
3930 diff -NurpP --minimal linux-2.6.35.2/fs/btrfs/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/super.c
3931 --- linux-2.6.35.2/fs/btrfs/super.c 2010-08-02 16:52:47.000000000 +0200
3932 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/btrfs/super.c 2010-08-02 17:05:05.000000000 +0200
3933 @@ -68,7 +68,7 @@ enum {
3934 Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd,
3935 Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress,
3936 Opt_compress_force, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
3937 - Opt_discard, Opt_err,
3938 + Opt_tag, Opt_notag, Opt_tagid, Opt_discard, Opt_err,
3941 static match_table_t tokens = {
3942 @@ -92,6 +92,9 @@ static match_table_t tokens = {
3943 {Opt_flushoncommit, "flushoncommit"},
3944 {Opt_ratio, "metadata_ratio=%d"},
3945 {Opt_discard, "discard"},
3947 + {Opt_notag, "notag"},
3948 + {Opt_tagid, "tagid=%u"},
3952 @@ -235,6 +238,22 @@ int btrfs_parse_options(struct btrfs_roo
3954 btrfs_set_opt(info->mount_opt, DISCARD);
3956 +#ifndef CONFIG_TAGGING_NONE
3958 + printk(KERN_INFO "btrfs: use tagging\n");
3959 + btrfs_set_opt(info->mount_opt, TAGGED);
3962 + printk(KERN_INFO "btrfs: disabled tagging\n");
3963 + btrfs_clear_opt(info->mount_opt, TAGGED);
3966 +#ifdef CONFIG_PROPAGATE
3969 + btrfs_set_opt(info->mount_opt, TAGGED);
3973 printk(KERN_INFO "btrfs: unrecognized mount option "
3975 @@ -681,6 +700,12 @@ static int btrfs_remount(struct super_bl
3979 + if (btrfs_test_opt(root, TAGGED) && !(sb->s_flags & MS_TAGGED)) {
3980 + printk("btrfs: %s: tagging not permitted on remount.\n",
3985 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
3988 diff -NurpP --minimal linux-2.6.35.2/fs/char_dev.c linux-2.6.35.2-vs2.3.0.36.31/fs/char_dev.c
3989 --- linux-2.6.35.2/fs/char_dev.c 2009-12-03 20:02:51.000000000 +0100
3990 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/char_dev.c 2010-08-02 17:05:05.000000000 +0200
3992 #include <linux/cdev.h>
3993 #include <linux/mutex.h>
3994 #include <linux/backing-dev.h>
3995 +#include <linux/vs_context.h>
3996 +#include <linux/vs_device.h>
3998 #include "internal.h"
4000 @@ -368,14 +370,21 @@ static int chrdev_open(struct inode *ino
4002 struct cdev *new = NULL;
4006 + if (!vs_map_chrdev(inode->i_rdev, &mdev, DATTR_OPEN))
4008 + inode->i_mdev = mdev;
4010 spin_lock(&cdev_lock);
4013 struct kobject *kobj;
4016 spin_unlock(&cdev_lock);
4017 - kobj = kobj_lookup(cdev_map, inode->i_rdev, &idx);
4019 + kobj = kobj_lookup(cdev_map, mdev, &idx);
4022 new = container_of(kobj, struct cdev, kobj);
4023 diff -NurpP --minimal linux-2.6.35.2/fs/dcache.c linux-2.6.35.2-vs2.3.0.36.31/fs/dcache.c
4024 --- linux-2.6.35.2/fs/dcache.c 2010-08-02 16:52:48.000000000 +0200
4025 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/dcache.c 2010-08-02 17:05:05.000000000 +0200
4027 #include <linux/bootmem.h>
4028 #include <linux/fs_struct.h>
4029 #include <linux/hardirq.h>
4030 +#include <linux/vs_limit.h>
4031 #include "internal.h"
4033 int sysctl_vfs_cache_pressure __read_mostly = 100;
4034 @@ -230,6 +231,8 @@ repeat:
4038 + vx_dentry_dec(dentry);
4041 * AV: ->d_delete() is _NOT_ allowed to block now.
4043 @@ -323,6 +326,7 @@ static inline struct dentry * __dget_loc
4045 atomic_inc(&dentry->d_count);
4046 dentry_lru_del_init(dentry);
4047 + vx_dentry_inc(dentry);
4051 @@ -926,6 +930,9 @@ struct dentry *d_alloc(struct dentry * p
4052 struct dentry *dentry;
4055 + if (!vx_dentry_avail(1))
4058 dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
4061 @@ -971,6 +978,7 @@ struct dentry *d_alloc(struct dentry * p
4063 list_add(&dentry->d_u.d_child, &parent->d_subdirs);
4064 dentry_stat.nr_dentry++;
4065 + vx_dentry_inc(dentry);
4066 spin_unlock(&dcache_lock);
4069 @@ -1420,6 +1428,7 @@ struct dentry * __d_lookup(struct dentry
4072 atomic_inc(&dentry->d_count);
4073 + vx_dentry_inc(dentry);
4075 spin_unlock(&dentry->d_lock);
4077 diff -NurpP --minimal linux-2.6.35.2/fs/devpts/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/devpts/inode.c
4078 --- linux-2.6.35.2/fs/devpts/inode.c 2010-08-02 16:52:48.000000000 +0200
4079 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/devpts/inode.c 2010-08-02 17:05:05.000000000 +0200
4081 #include <linux/parser.h>
4082 #include <linux/fsnotify.h>
4083 #include <linux/seq_file.h>
4084 +#include <linux/vs_base.h>
4086 #define DEVPTS_DEFAULT_MODE 0600
4089 #define DEVPTS_DEFAULT_PTMX_MODE 0000
4090 #define PTMX_MINOR 2
4092 +static int devpts_permission(struct inode *inode, int mask)
4094 + int ret = -EACCES;
4096 + /* devpts is xid tagged */
4097 + if (vx_check((xid_t)inode->i_tag, VS_WATCH_P | VS_IDENT))
4098 + ret = generic_permission(inode, mask, NULL);
4102 +static struct inode_operations devpts_file_inode_operations = {
4103 + .permission = devpts_permission,
4106 extern int pty_limit; /* Config limit on Unix98 ptys */
4107 static DEFINE_MUTEX(allocated_ptys_lock);
4109 @@ -263,6 +278,25 @@ static int devpts_show_options(struct se
4113 +static int devpts_filter(struct dentry *de)
4115 + /* devpts is xid tagged */
4116 + return vx_check((xid_t)de->d_inode->i_tag, VS_WATCH_P | VS_IDENT);
4119 +static int devpts_readdir(struct file * filp, void * dirent, filldir_t filldir)
4121 + return dcache_readdir_filter(filp, dirent, filldir, devpts_filter);
4124 +static struct file_operations devpts_dir_operations = {
4125 + .open = dcache_dir_open,
4126 + .release = dcache_dir_close,
4127 + .llseek = dcache_dir_lseek,
4128 + .read = generic_read_dir,
4129 + .readdir = devpts_readdir,
4132 static const struct super_operations devpts_sops = {
4133 .statfs = simple_statfs,
4134 .remount_fs = devpts_remount,
4135 @@ -302,12 +336,15 @@ devpts_fill_super(struct super_block *s,
4136 inode = new_inode(s);
4141 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
4142 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
4143 inode->i_op = &simple_dir_inode_operations;
4144 - inode->i_fop = &simple_dir_operations;
4145 + inode->i_fop = &devpts_dir_operations;
4147 + /* devpts is xid tagged */
4148 + inode->i_tag = (tag_t)vx_current_xid();
4150 s->s_root = d_alloc_root(inode);
4152 @@ -495,6 +532,9 @@ int devpts_pty_new(struct inode *ptmx_in
4153 inode->i_gid = opts->setgid ? opts->gid : current_fsgid();
4154 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
4155 init_special_inode(inode, S_IFCHR|opts->mode, device);
4156 + /* devpts is xid tagged */
4157 + inode->i_tag = (tag_t)vx_current_xid();
4158 + inode->i_op = &devpts_file_inode_operations;
4159 inode->i_private = tty;
4160 tty->driver_data = inode;
4162 diff -NurpP --minimal linux-2.6.35.2/fs/exec.c linux-2.6.35.2-vs2.3.0.36.31/fs/exec.c
4163 --- linux-2.6.35.2/fs/exec.c 2010-08-02 16:52:48.000000000 +0200
4164 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/exec.c 2010-08-02 17:05:05.000000000 +0200
4165 @@ -1506,7 +1506,7 @@ static int format_corename(char *corenam
4166 /* UNIX time of coredump */
4169 - do_gettimeofday(&tv);
4170 + vx_gettimeofday(&tv);
4171 rc = snprintf(out_ptr, out_end - out_ptr,
4173 if (rc > out_end - out_ptr)
4174 diff -NurpP --minimal linux-2.6.35.2/fs/ext2/balloc.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/balloc.c
4175 --- linux-2.6.35.2/fs/ext2/balloc.c 2010-08-02 16:52:48.000000000 +0200
4176 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/balloc.c 2010-08-02 17:05:05.000000000 +0200
4177 @@ -702,7 +702,6 @@ ext2_try_to_allocate(struct super_block
4179 end = EXT2_BLOCKS_PER_GROUP(sb);
4182 BUG_ON(start > EXT2_BLOCKS_PER_GROUP(sb));
4185 diff -NurpP --minimal linux-2.6.35.2/fs/ext2/ext2.h linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/ext2.h
4186 --- linux-2.6.35.2/fs/ext2/ext2.h 2010-08-02 16:52:48.000000000 +0200
4187 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/ext2.h 2010-08-02 17:05:05.000000000 +0200
4188 @@ -130,6 +130,7 @@ extern int ext2_fiemap(struct inode *ino
4189 int __ext2_write_begin(struct file *file, struct address_space *mapping,
4190 loff_t pos, unsigned len, unsigned flags,
4191 struct page **pagep, void **fsdata);
4192 +extern int ext2_sync_flags(struct inode *, int, int);
4195 extern long ext2_ioctl(struct file *, unsigned int, unsigned long);
4196 diff -NurpP --minimal linux-2.6.35.2/fs/ext2/file.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/file.c
4197 --- linux-2.6.35.2/fs/ext2/file.c 2010-08-02 16:52:48.000000000 +0200
4198 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/file.c 2010-08-02 17:05:05.000000000 +0200
4199 @@ -104,4 +104,5 @@ const struct inode_operations ext2_file_
4200 .setattr = ext2_setattr,
4201 .check_acl = ext2_check_acl,
4202 .fiemap = ext2_fiemap,
4203 + .sync_flags = ext2_sync_flags,
4205 diff -NurpP --minimal linux-2.6.35.2/fs/ext2/ialloc.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/ialloc.c
4206 --- linux-2.6.35.2/fs/ext2/ialloc.c 2010-08-02 16:52:48.000000000 +0200
4207 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/ialloc.c 2010-08-02 18:15:12.000000000 +0200
4209 #include <linux/backing-dev.h>
4210 #include <linux/buffer_head.h>
4211 #include <linux/random.h>
4212 +#include <linux/vs_tag.h>
4216 @@ -553,6 +554,7 @@ got:
4217 inode->i_mode = mode;
4218 inode->i_uid = current_fsuid();
4219 inode->i_gid = dir->i_gid;
4220 + inode->i_tag = dx_current_fstag(sb);
4222 inode_init_owner(inode, dir, mode);
4224 diff -NurpP --minimal linux-2.6.35.2/fs/ext2/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/inode.c
4225 --- linux-2.6.35.2/fs/ext2/inode.c 2010-08-02 16:52:48.000000000 +0200
4226 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/inode.c 2010-08-02 17:05:05.000000000 +0200
4228 #include <linux/mpage.h>
4229 #include <linux/fiemap.h>
4230 #include <linux/namei.h>
4231 +#include <linux/vs_tag.h>
4235 @@ -1164,7 +1165,7 @@ static void ext2_truncate_blocks(struct
4237 if (ext2_inode_is_fast_symlink(inode))
4239 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
4240 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
4242 __ext2_truncate_blocks(inode, offset);
4244 @@ -1261,36 +1262,61 @@ void ext2_set_inode_flags(struct inode *
4246 unsigned int flags = EXT2_I(inode)->i_flags;
4248 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4249 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
4250 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
4253 + if (flags & EXT2_IMMUTABLE_FL)
4254 + inode->i_flags |= S_IMMUTABLE;
4255 + if (flags & EXT2_IXUNLINK_FL)
4256 + inode->i_flags |= S_IXUNLINK;
4258 if (flags & EXT2_SYNC_FL)
4259 inode->i_flags |= S_SYNC;
4260 if (flags & EXT2_APPEND_FL)
4261 inode->i_flags |= S_APPEND;
4262 - if (flags & EXT2_IMMUTABLE_FL)
4263 - inode->i_flags |= S_IMMUTABLE;
4264 if (flags & EXT2_NOATIME_FL)
4265 inode->i_flags |= S_NOATIME;
4266 if (flags & EXT2_DIRSYNC_FL)
4267 inode->i_flags |= S_DIRSYNC;
4269 + inode->i_vflags &= ~(V_BARRIER | V_COW);
4271 + if (flags & EXT2_BARRIER_FL)
4272 + inode->i_vflags |= V_BARRIER;
4273 + if (flags & EXT2_COW_FL)
4274 + inode->i_vflags |= V_COW;
4277 /* Propagate flags from i_flags to EXT2_I(inode)->i_flags */
4278 void ext2_get_inode_flags(struct ext2_inode_info *ei)
4280 unsigned int flags = ei->vfs_inode.i_flags;
4281 + unsigned int vflags = ei->vfs_inode.i_vflags;
4283 + ei->i_flags &= ~(EXT2_SYNC_FL | EXT2_APPEND_FL |
4284 + EXT2_IMMUTABLE_FL | EXT2_IXUNLINK_FL |
4285 + EXT2_NOATIME_FL | EXT2_DIRSYNC_FL |
4286 + EXT2_BARRIER_FL | EXT2_COW_FL);
4288 + if (flags & S_IMMUTABLE)
4289 + ei->i_flags |= EXT2_IMMUTABLE_FL;
4290 + if (flags & S_IXUNLINK)
4291 + ei->i_flags |= EXT2_IXUNLINK_FL;
4293 - ei->i_flags &= ~(EXT2_SYNC_FL|EXT2_APPEND_FL|
4294 - EXT2_IMMUTABLE_FL|EXT2_NOATIME_FL|EXT2_DIRSYNC_FL);
4296 ei->i_flags |= EXT2_SYNC_FL;
4297 if (flags & S_APPEND)
4298 ei->i_flags |= EXT2_APPEND_FL;
4299 - if (flags & S_IMMUTABLE)
4300 - ei->i_flags |= EXT2_IMMUTABLE_FL;
4301 if (flags & S_NOATIME)
4302 ei->i_flags |= EXT2_NOATIME_FL;
4303 if (flags & S_DIRSYNC)
4304 ei->i_flags |= EXT2_DIRSYNC_FL;
4306 + if (vflags & V_BARRIER)
4307 + ei->i_flags |= EXT2_BARRIER_FL;
4308 + if (vflags & V_COW)
4309 + ei->i_flags |= EXT2_COW_FL;
4312 struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
4313 @@ -1300,6 +1326,8 @@ struct inode *ext2_iget (struct super_bl
4314 struct ext2_inode *raw_inode;
4315 struct inode *inode;
4321 inode = iget_locked(sb, ino);
4322 @@ -1318,12 +1346,17 @@ struct inode *ext2_iget (struct super_bl
4325 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
4326 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4327 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4328 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4329 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4330 if (!(test_opt (inode->i_sb, NO_UID32))) {
4331 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4332 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4333 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4334 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4336 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
4337 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
4338 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
4339 + le16_to_cpu(raw_inode->i_raw_tag));
4341 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
4342 inode->i_size = le32_to_cpu(raw_inode->i_size);
4343 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
4344 @@ -1421,8 +1454,8 @@ static int __ext2_write_inode(struct ino
4345 struct ext2_inode_info *ei = EXT2_I(inode);
4346 struct super_block *sb = inode->i_sb;
4347 ino_t ino = inode->i_ino;
4348 - uid_t uid = inode->i_uid;
4349 - gid_t gid = inode->i_gid;
4350 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
4351 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
4352 struct buffer_head * bh;
4353 struct ext2_inode * raw_inode = ext2_get_inode(sb, ino, &bh);
4355 @@ -1458,6 +1491,9 @@ static int __ext2_write_inode(struct ino
4356 raw_inode->i_uid_high = 0;
4357 raw_inode->i_gid_high = 0;
4359 +#ifdef CONFIG_TAGGING_INTERN
4360 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
4362 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
4363 raw_inode->i_size = cpu_to_le32(inode->i_size);
4364 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
4365 @@ -1547,7 +1583,8 @@ int ext2_setattr(struct dentry *dentry,
4366 if (is_quota_modification(inode, iattr))
4367 dquot_initialize(inode);
4368 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
4369 - (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
4370 + (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
4371 + (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
4372 error = dquot_transfer(inode, iattr);
4375 diff -NurpP --minimal linux-2.6.35.2/fs/ext2/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/ioctl.c
4376 --- linux-2.6.35.2/fs/ext2/ioctl.c 2009-09-10 15:26:21.000000000 +0200
4377 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/ioctl.c 2010-08-02 17:05:05.000000000 +0200
4379 #include <asm/uaccess.h>
4382 +int ext2_sync_flags(struct inode *inode, int flags, int vflags)
4384 + inode->i_flags = flags;
4385 + inode->i_vflags = vflags;
4386 + ext2_get_inode_flags(EXT2_I(inode));
4387 + inode->i_ctime = CURRENT_TIME_SEC;
4388 + mark_inode_dirty(inode);
4392 long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
4394 struct inode *inode = filp->f_dentry->d_inode;
4395 @@ -51,6 +61,11 @@ long ext2_ioctl(struct file *filp, unsig
4397 flags = ext2_mask_flags(inode->i_mode, flags);
4399 + if (IS_BARRIER(inode)) {
4400 + vxwprintk_task(1, "messing with the barrier.");
4404 mutex_lock(&inode->i_mutex);
4405 /* Is it quota file? Do not allow user to mess with it */
4406 if (IS_NOQUOTA(inode)) {
4407 @@ -66,7 +81,9 @@ long ext2_ioctl(struct file *filp, unsig
4409 * This test looks nicer. Thanks to Pauline Middelink
4411 - if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) {
4412 + if ((oldflags & EXT2_IMMUTABLE_FL) ||
4413 + ((flags ^ oldflags) & (EXT2_APPEND_FL |
4414 + EXT2_IMMUTABLE_FL | EXT2_IXUNLINK_FL))) {
4415 if (!capable(CAP_LINUX_IMMUTABLE)) {
4416 mutex_unlock(&inode->i_mutex);
4418 @@ -74,7 +91,7 @@ long ext2_ioctl(struct file *filp, unsig
4422 - flags = flags & EXT2_FL_USER_MODIFIABLE;
4423 + flags &= EXT2_FL_USER_MODIFIABLE;
4424 flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE;
4425 ei->i_flags = flags;
4426 mutex_unlock(&inode->i_mutex);
4427 diff -NurpP --minimal linux-2.6.35.2/fs/ext2/namei.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/namei.c
4428 --- linux-2.6.35.2/fs/ext2/namei.c 2010-07-07 18:31:51.000000000 +0200
4429 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/namei.c 2010-08-02 17:05:05.000000000 +0200
4432 #include <linux/pagemap.h>
4433 #include <linux/quotaops.h>
4434 +#include <linux/vs_tag.h>
4438 @@ -75,6 +76,7 @@ static struct dentry *ext2_lookup(struct
4439 return ERR_PTR(-EIO);
4441 return ERR_CAST(inode);
4442 + dx_propagate_tag(nd, inode);
4446 @@ -418,6 +420,7 @@ const struct inode_operations ext2_dir_i
4448 .setattr = ext2_setattr,
4449 .check_acl = ext2_check_acl,
4450 + .sync_flags = ext2_sync_flags,
4453 const struct inode_operations ext2_special_inode_operations = {
4454 diff -NurpP --minimal linux-2.6.35.2/fs/ext2/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/super.c
4455 --- linux-2.6.35.2/fs/ext2/super.c 2010-08-02 16:52:48.000000000 +0200
4456 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext2/super.c 2010-08-02 17:05:05.000000000 +0200
4457 @@ -390,7 +390,8 @@ enum {
4458 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
4459 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
4460 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
4461 - Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
4462 + Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation,
4463 + Opt_tag, Opt_notag, Opt_tagid
4466 static const match_table_t tokens = {
4467 @@ -418,6 +419,9 @@ static const match_table_t tokens = {
4469 {Opt_noacl, "noacl"},
4472 + {Opt_notag, "notag"},
4473 + {Opt_tagid, "tagid=%u"},
4474 {Opt_grpquota, "grpquota"},
4475 {Opt_ignore, "noquota"},
4476 {Opt_quota, "quota"},
4477 @@ -488,6 +492,20 @@ static int parse_options(char *options,
4479 set_opt (sbi->s_mount_opt, NO_UID32);
4481 +#ifndef CONFIG_TAGGING_NONE
4483 + set_opt (sbi->s_mount_opt, TAGGED);
4486 + clear_opt (sbi->s_mount_opt, TAGGED);
4489 +#ifdef CONFIG_PROPAGATE
4492 + set_opt (sbi->s_mount_opt, TAGGED);
4496 clear_opt (sbi->s_mount_opt, CHECK);
4498 @@ -845,6 +863,8 @@ static int ext2_fill_super(struct super_
4499 if (!parse_options((char *) data, sb))
4502 + if (EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_TAGGED)
4503 + sb->s_flags |= MS_TAGGED;
4504 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4505 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ?
4507 @@ -1217,6 +1237,14 @@ static int ext2_remount (struct super_bl
4511 + if ((sbi->s_mount_opt & EXT2_MOUNT_TAGGED) &&
4512 + !(sb->s_flags & MS_TAGGED)) {
4513 + printk("EXT2-fs: %s: tagging not permitted on remount.\n",
4516 + goto restore_opts;
4519 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4520 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
4522 diff -NurpP --minimal linux-2.6.35.2/fs/ext3/file.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/file.c
4523 --- linux-2.6.35.2/fs/ext3/file.c 2010-07-07 18:31:51.000000000 +0200
4524 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/file.c 2010-08-02 17:05:05.000000000 +0200
4525 @@ -81,5 +81,6 @@ const struct inode_operations ext3_file_
4527 .check_acl = ext3_check_acl,
4528 .fiemap = ext3_fiemap,
4529 + .sync_flags = ext3_sync_flags,
4532 diff -NurpP --minimal linux-2.6.35.2/fs/ext3/ialloc.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/ialloc.c
4533 --- linux-2.6.35.2/fs/ext3/ialloc.c 2010-08-02 16:52:48.000000000 +0200
4534 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/ialloc.c 2010-08-02 18:14:48.000000000 +0200
4536 #include <linux/buffer_head.h>
4537 #include <linux/random.h>
4538 #include <linux/bitops.h>
4539 +#include <linux/vs_tag.h>
4541 #include <asm/byteorder.h>
4543 @@ -543,6 +544,7 @@ got:
4544 inode->i_mode = mode;
4545 inode->i_uid = current_fsuid();
4546 inode->i_gid = dir->i_gid;
4547 + inode->i_tag = dx_current_fstag(sb);
4549 inode_init_owner(inode, dir, mode);
4551 diff -NurpP --minimal linux-2.6.35.2/fs/ext3/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/inode.c
4552 --- linux-2.6.35.2/fs/ext3/inode.c 2010-08-02 16:52:48.000000000 +0200
4553 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/inode.c 2010-08-02 17:05:05.000000000 +0200
4555 #include <linux/bio.h>
4556 #include <linux/fiemap.h>
4557 #include <linux/namei.h>
4558 +#include <linux/vs_tag.h>
4562 @@ -2354,7 +2355,7 @@ static void ext3_free_branches(handle_t
4564 int ext3_can_truncate(struct inode *inode)
4566 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
4567 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
4569 if (S_ISREG(inode->i_mode))
4571 @@ -2739,36 +2740,60 @@ void ext3_set_inode_flags(struct inode *
4573 unsigned int flags = EXT3_I(inode)->i_flags;
4575 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4576 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
4577 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
4579 + if (flags & EXT3_IMMUTABLE_FL)
4580 + inode->i_flags |= S_IMMUTABLE;
4581 + if (flags & EXT3_IXUNLINK_FL)
4582 + inode->i_flags |= S_IXUNLINK;
4584 if (flags & EXT3_SYNC_FL)
4585 inode->i_flags |= S_SYNC;
4586 if (flags & EXT3_APPEND_FL)
4587 inode->i_flags |= S_APPEND;
4588 - if (flags & EXT3_IMMUTABLE_FL)
4589 - inode->i_flags |= S_IMMUTABLE;
4590 if (flags & EXT3_NOATIME_FL)
4591 inode->i_flags |= S_NOATIME;
4592 if (flags & EXT3_DIRSYNC_FL)
4593 inode->i_flags |= S_DIRSYNC;
4595 + inode->i_vflags &= ~(V_BARRIER | V_COW);
4597 + if (flags & EXT3_BARRIER_FL)
4598 + inode->i_vflags |= V_BARRIER;
4599 + if (flags & EXT3_COW_FL)
4600 + inode->i_vflags |= V_COW;
4603 /* Propagate flags from i_flags to EXT3_I(inode)->i_flags */
4604 void ext3_get_inode_flags(struct ext3_inode_info *ei)
4606 unsigned int flags = ei->vfs_inode.i_flags;
4607 + unsigned int vflags = ei->vfs_inode.i_vflags;
4609 + ei->i_flags &= ~(EXT3_SYNC_FL | EXT3_APPEND_FL |
4610 + EXT3_IMMUTABLE_FL | EXT3_IXUNLINK_FL |
4611 + EXT3_NOATIME_FL | EXT3_DIRSYNC_FL |
4612 + EXT3_BARRIER_FL | EXT3_COW_FL);
4614 + if (flags & S_IMMUTABLE)
4615 + ei->i_flags |= EXT3_IMMUTABLE_FL;
4616 + if (flags & S_IXUNLINK)
4617 + ei->i_flags |= EXT3_IXUNLINK_FL;
4619 - ei->i_flags &= ~(EXT3_SYNC_FL|EXT3_APPEND_FL|
4620 - EXT3_IMMUTABLE_FL|EXT3_NOATIME_FL|EXT3_DIRSYNC_FL);
4622 ei->i_flags |= EXT3_SYNC_FL;
4623 if (flags & S_APPEND)
4624 ei->i_flags |= EXT3_APPEND_FL;
4625 - if (flags & S_IMMUTABLE)
4626 - ei->i_flags |= EXT3_IMMUTABLE_FL;
4627 if (flags & S_NOATIME)
4628 ei->i_flags |= EXT3_NOATIME_FL;
4629 if (flags & S_DIRSYNC)
4630 ei->i_flags |= EXT3_DIRSYNC_FL;
4632 + if (vflags & V_BARRIER)
4633 + ei->i_flags |= EXT3_BARRIER_FL;
4634 + if (vflags & V_COW)
4635 + ei->i_flags |= EXT3_COW_FL;
4638 struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
4639 @@ -2782,6 +2807,8 @@ struct inode *ext3_iget(struct super_blo
4640 transaction_t *transaction;
4646 inode = iget_locked(sb, ino);
4648 @@ -2798,12 +2825,17 @@ struct inode *ext3_iget(struct super_blo
4650 raw_inode = ext3_raw_inode(&iloc);
4651 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
4652 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4653 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4654 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4655 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4656 if(!(test_opt (inode->i_sb, NO_UID32))) {
4657 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4658 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4659 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4660 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4662 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
4663 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
4664 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
4665 + le16_to_cpu(raw_inode->i_raw_tag));
4667 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
4668 inode->i_size = le32_to_cpu(raw_inode->i_size);
4669 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
4670 @@ -2958,6 +2990,8 @@ static int ext3_do_update_inode(handle_t
4671 struct ext3_inode *raw_inode = ext3_raw_inode(iloc);
4672 struct ext3_inode_info *ei = EXT3_I(inode);
4673 struct buffer_head *bh = iloc->bh;
4674 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
4675 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
4676 int err = 0, rc, block;
4679 @@ -2972,29 +3006,32 @@ again:
4680 ext3_get_inode_flags(ei);
4681 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
4682 if(!(test_opt(inode->i_sb, NO_UID32))) {
4683 - raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
4684 - raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
4685 + raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
4686 + raw_inode->i_gid_low = cpu_to_le16(low_16_bits(gid));
4688 * Fix up interoperability with old kernels. Otherwise, old inodes get
4689 * re-used with the upper 16 bits of the uid/gid intact
4692 raw_inode->i_uid_high =
4693 - cpu_to_le16(high_16_bits(inode->i_uid));
4694 + cpu_to_le16(high_16_bits(uid));
4695 raw_inode->i_gid_high =
4696 - cpu_to_le16(high_16_bits(inode->i_gid));
4697 + cpu_to_le16(high_16_bits(gid));
4699 raw_inode->i_uid_high = 0;
4700 raw_inode->i_gid_high = 0;
4703 raw_inode->i_uid_low =
4704 - cpu_to_le16(fs_high2lowuid(inode->i_uid));
4705 + cpu_to_le16(fs_high2lowuid(uid));
4706 raw_inode->i_gid_low =
4707 - cpu_to_le16(fs_high2lowgid(inode->i_gid));
4708 + cpu_to_le16(fs_high2lowgid(gid));
4709 raw_inode->i_uid_high = 0;
4710 raw_inode->i_gid_high = 0;
4712 +#ifdef CONFIG_TAGGING_INTERN
4713 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
4715 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
4716 raw_inode->i_size = cpu_to_le32(ei->i_disksize);
4717 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
4718 @@ -3154,7 +3191,8 @@ int ext3_setattr(struct dentry *dentry,
4719 if (is_quota_modification(inode, attr))
4720 dquot_initialize(inode);
4721 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
4722 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
4723 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
4724 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
4727 /* (user+group)*(old+new) structure, inode write (sb,
4728 @@ -3176,6 +3214,8 @@ int ext3_setattr(struct dentry *dentry,
4729 inode->i_uid = attr->ia_uid;
4730 if (attr->ia_valid & ATTR_GID)
4731 inode->i_gid = attr->ia_gid;
4732 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
4733 + inode->i_tag = attr->ia_tag;
4734 error = ext3_mark_inode_dirty(handle, inode);
4735 ext3_journal_stop(handle);
4737 diff -NurpP --minimal linux-2.6.35.2/fs/ext3/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/ioctl.c
4738 --- linux-2.6.35.2/fs/ext3/ioctl.c 2009-06-11 17:13:03.000000000 +0200
4739 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/ioctl.c 2010-08-02 17:05:05.000000000 +0200
4743 #include <linux/fs.h>
4744 +#include <linux/mount.h>
4745 #include <linux/jbd.h>
4746 #include <linux/capability.h>
4747 #include <linux/ext3_fs.h>
4749 #include <linux/compat.h>
4750 #include <asm/uaccess.h>
4753 +int ext3_sync_flags(struct inode *inode, int flags, int vflags)
4755 + handle_t *handle = NULL;
4756 + struct ext3_iloc iloc;
4759 + handle = ext3_journal_start(inode, 1);
4760 + if (IS_ERR(handle))
4761 + return PTR_ERR(handle);
4763 + if (IS_SYNC(inode))
4764 + handle->h_sync = 1;
4765 + err = ext3_reserve_inode_write(handle, inode, &iloc);
4769 + inode->i_flags = flags;
4770 + inode->i_vflags = vflags;
4771 + ext3_get_inode_flags(EXT3_I(inode));
4772 + inode->i_ctime = CURRENT_TIME_SEC;
4774 + err = ext3_mark_iloc_dirty(handle, inode, &iloc);
4776 + ext3_journal_stop(handle);
4780 long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
4782 struct inode *inode = filp->f_dentry->d_inode;
4783 @@ -50,6 +79,11 @@ long ext3_ioctl(struct file *filp, unsig
4785 flags = ext3_mask_flags(inode->i_mode, flags);
4787 + if (IS_BARRIER(inode)) {
4788 + vxwprintk_task(1, "messing with the barrier.");
4792 mutex_lock(&inode->i_mutex);
4794 /* Is it quota file? Do not allow user to mess with it */
4795 @@ -68,7 +102,9 @@ long ext3_ioctl(struct file *filp, unsig
4797 * This test looks nicer. Thanks to Pauline Middelink
4799 - if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) {
4800 + if ((oldflags & EXT3_IMMUTABLE_FL) ||
4801 + ((flags ^ oldflags) & (EXT3_APPEND_FL |
4802 + EXT3_IMMUTABLE_FL | EXT3_IXUNLINK_FL))) {
4803 if (!capable(CAP_LINUX_IMMUTABLE))
4806 @@ -93,7 +129,7 @@ long ext3_ioctl(struct file *filp, unsig
4810 - flags = flags & EXT3_FL_USER_MODIFIABLE;
4811 + flags &= EXT3_FL_USER_MODIFIABLE;
4812 flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
4813 ei->i_flags = flags;
4815 diff -NurpP --minimal linux-2.6.35.2/fs/ext3/namei.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/namei.c
4816 --- linux-2.6.35.2/fs/ext3/namei.c 2010-07-07 18:31:51.000000000 +0200
4817 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/namei.c 2010-08-02 17:05:05.000000000 +0200
4819 #include <linux/quotaops.h>
4820 #include <linux/buffer_head.h>
4821 #include <linux/bio.h>
4822 +#include <linux/vs_tag.h>
4826 @@ -912,6 +913,7 @@ restart:
4828 ll_rw_block(READ_META, 1, &bh);
4830 + dx_propagate_tag(nd, inode);
4832 if ((bh = bh_use[ra_ptr++]) == NULL)
4834 @@ -2466,6 +2468,7 @@ const struct inode_operations ext3_dir_i
4835 .removexattr = generic_removexattr,
4837 .check_acl = ext3_check_acl,
4838 + .sync_flags = ext3_sync_flags,
4841 const struct inode_operations ext3_special_inode_operations = {
4842 diff -NurpP --minimal linux-2.6.35.2/fs/ext3/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/super.c
4843 --- linux-2.6.35.2/fs/ext3/super.c 2010-08-02 16:52:48.000000000 +0200
4844 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext3/super.c 2010-08-02 18:14:19.000000000 +0200
4845 @@ -817,7 +817,8 @@ enum {
4846 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
4847 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
4848 Opt_noquota, Opt_ignore, Opt_barrier, Opt_nobarrier, Opt_err,
4849 - Opt_resize, Opt_usrquota, Opt_grpquota
4850 + Opt_resize, Opt_usrquota, Opt_grpquota,
4851 + Opt_tag, Opt_notag, Opt_tagid
4854 static const match_table_t tokens = {
4855 @@ -874,6 +875,9 @@ static const match_table_t tokens = {
4856 {Opt_barrier, "barrier"},
4857 {Opt_nobarrier, "nobarrier"},
4858 {Opt_resize, "resize"},
4860 + {Opt_notag, "notag"},
4861 + {Opt_tagid, "tagid=%u"},
4865 @@ -1026,6 +1030,20 @@ static int parse_options (char *options,
4867 set_opt (sbi->s_mount_opt, NO_UID32);
4869 +#ifndef CONFIG_TAGGING_NONE
4871 + set_opt (sbi->s_mount_opt, TAGGED);
4874 + clear_opt (sbi->s_mount_opt, TAGGED);
4877 +#ifdef CONFIG_PROPAGATE
4880 + set_opt (sbi->s_mount_opt, TAGGED);
4884 clear_opt (sbi->s_mount_opt, CHECK);
4886 @@ -1712,6 +1730,9 @@ static int ext3_fill_super (struct super
4890 + if (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_TAGGED)
4891 + sb->s_flags |= MS_TAGGED;
4893 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4894 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
4896 @@ -2585,6 +2606,14 @@ static int ext3_remount (struct super_bl
4897 if (test_opt(sb, ABORT))
4898 ext3_abort(sb, __func__, "Abort forced by user");
4900 + if ((sbi->s_mount_opt & EXT3_MOUNT_TAGGED) &&
4901 + !(sb->s_flags & MS_TAGGED)) {
4902 + printk("EXT3-fs: %s: tagging not permitted on remount.\n",
4905 + goto restore_opts;
4908 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4909 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
4911 diff -NurpP --minimal linux-2.6.35.2/fs/ext4/ext4.h linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/ext4.h
4912 --- linux-2.6.35.2/fs/ext4/ext4.h 2010-08-02 16:52:48.000000000 +0200
4913 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/ext4.h 2010-08-02 17:05:05.000000000 +0200
4914 @@ -318,8 +318,12 @@ struct flex_groups {
4915 #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
4916 #define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */
4917 #define EXT4_EOFBLOCKS_FL 0x00400000 /* Blocks allocated beyond EOF */
4918 +#define EXT4_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
4919 #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
4921 +#define EXT4_BARRIER_FL 0x04000000 /* Barrier for chroot() */
4922 +#define EXT4_COW_FL 0x20000000 /* Copy on Write marker */
4924 #define EXT4_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */
4925 #define EXT4_FL_USER_MODIFIABLE 0x004B80FF /* User modifiable flags */
4927 @@ -588,7 +592,8 @@ struct ext4_inode {
4928 __le16 l_i_file_acl_high;
4929 __le16 l_i_uid_high; /* these 2 fields */
4930 __le16 l_i_gid_high; /* were reserved2[0] */
4931 - __u32 l_i_reserved2;
4932 + __le16 l_i_tag; /* Context Tag */
4933 + __u16 l_i_reserved2;
4936 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
4937 @@ -702,6 +707,7 @@ do { \
4938 #define i_gid_low i_gid
4939 #define i_uid_high osd2.linux2.l_i_uid_high
4940 #define i_gid_high osd2.linux2.l_i_gid_high
4941 +#define i_raw_tag osd2.linux2.l_i_tag
4942 #define i_reserved2 osd2.linux2.l_i_reserved2
4944 #elif defined(__GNU__)
4945 @@ -881,6 +887,7 @@ struct ext4_inode_info {
4946 #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
4947 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
4948 #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
4949 +#define EXT4_MOUNT_TAGGED 0x4000000 /* Enable Context Tags */
4950 #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */
4951 #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */
4952 #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */
4953 @@ -1910,6 +1917,7 @@ extern int ext4_get_blocks(handle_t *han
4954 struct buffer_head *bh, int flags);
4955 extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
4956 __u64 start, __u64 len);
4957 +extern int ext4_sync_flags(struct inode *, int, int);
4959 extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
4960 __u64 start_orig, __u64 start_donor,
4961 diff -NurpP --minimal linux-2.6.35.2/fs/ext4/file.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/file.c
4962 --- linux-2.6.35.2/fs/ext4/file.c 2010-08-02 16:52:48.000000000 +0200
4963 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/file.c 2010-08-02 17:05:05.000000000 +0200
4964 @@ -160,5 +160,6 @@ const struct inode_operations ext4_file_
4965 .check_acl = ext4_check_acl,
4966 .fallocate = ext4_fallocate,
4967 .fiemap = ext4_fiemap,
4968 + .sync_flags = ext4_sync_flags,
4971 diff -NurpP --minimal linux-2.6.35.2/fs/ext4/ialloc.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/ialloc.c
4972 --- linux-2.6.35.2/fs/ext4/ialloc.c 2010-08-02 16:52:48.000000000 +0200
4973 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/ialloc.c 2010-08-02 18:12:48.000000000 +0200
4975 #include <linux/random.h>
4976 #include <linux/bitops.h>
4977 #include <linux/blkdev.h>
4978 +#include <linux/vs_tag.h>
4979 #include <asm/byteorder.h>
4982 @@ -976,6 +977,7 @@ got:
4983 inode->i_mode = mode;
4984 inode->i_uid = current_fsuid();
4985 inode->i_gid = dir->i_gid;
4986 + inode->i_tag = dx_current_fstag(sb);
4988 inode_init_owner(inode, dir, mode);
4990 diff -NurpP --minimal linux-2.6.35.2/fs/ext4/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/inode.c
4991 --- linux-2.6.35.2/fs/ext4/inode.c 2010-08-02 16:52:48.000000000 +0200
4992 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/inode.c 2010-08-02 18:11:10.000000000 +0200
4994 #include <linux/workqueue.h>
4995 #include <linux/kernel.h>
4996 #include <linux/slab.h>
4997 +#include <linux/vs_tag.h>
4999 #include "ext4_jbd2.h"
5001 @@ -4575,7 +4576,7 @@ static void ext4_free_branches(handle_t
5003 int ext4_can_truncate(struct inode *inode)
5005 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
5006 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
5008 if (S_ISREG(inode->i_mode))
5010 @@ -4926,41 +4927,64 @@ void ext4_set_inode_flags(struct inode *
5012 unsigned int flags = EXT4_I(inode)->i_flags;
5014 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
5015 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
5016 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
5018 + if (flags & EXT4_IMMUTABLE_FL)
5019 + inode->i_flags |= S_IMMUTABLE;
5020 + if (flags & EXT4_IXUNLINK_FL)
5021 + inode->i_flags |= S_IXUNLINK;
5023 if (flags & EXT4_SYNC_FL)
5024 inode->i_flags |= S_SYNC;
5025 if (flags & EXT4_APPEND_FL)
5026 inode->i_flags |= S_APPEND;
5027 - if (flags & EXT4_IMMUTABLE_FL)
5028 - inode->i_flags |= S_IMMUTABLE;
5029 if (flags & EXT4_NOATIME_FL)
5030 inode->i_flags |= S_NOATIME;
5031 if (flags & EXT4_DIRSYNC_FL)
5032 inode->i_flags |= S_DIRSYNC;
5034 + inode->i_vflags &= ~(V_BARRIER | V_COW);
5036 + if (flags & EXT4_BARRIER_FL)
5037 + inode->i_vflags |= V_BARRIER;
5038 + if (flags & EXT4_COW_FL)
5039 + inode->i_vflags |= V_COW;
5042 /* Propagate flags from i_flags to EXT4_I(inode)->i_flags */
5043 void ext4_get_inode_flags(struct ext4_inode_info *ei)
5045 - unsigned int vfs_fl;
5046 + unsigned int vfs_fl, vfs_vf;
5047 unsigned long old_fl, new_fl;
5050 vfs_fl = ei->vfs_inode.i_flags;
5051 + vfs_vf = ei->vfs_inode.i_vflags;
5052 old_fl = ei->i_flags;
5053 new_fl = old_fl & ~(EXT4_SYNC_FL|EXT4_APPEND_FL|
5054 EXT4_IMMUTABLE_FL|EXT4_NOATIME_FL|
5056 + EXT4_DIRSYNC_FL|EXT4_BARRIER_FL|
5059 + if (vfs_fl & S_IMMUTABLE)
5060 + new_fl |= EXT4_IMMUTABLE_FL;
5061 + if (vfs_fl & S_IXUNLINK)
5062 + new_fl |= EXT4_IXUNLINK_FL;
5064 if (vfs_fl & S_SYNC)
5065 new_fl |= EXT4_SYNC_FL;
5066 if (vfs_fl & S_APPEND)
5067 new_fl |= EXT4_APPEND_FL;
5068 - if (vfs_fl & S_IMMUTABLE)
5069 - new_fl |= EXT4_IMMUTABLE_FL;
5070 if (vfs_fl & S_NOATIME)
5071 new_fl |= EXT4_NOATIME_FL;
5072 if (vfs_fl & S_DIRSYNC)
5073 new_fl |= EXT4_DIRSYNC_FL;
5075 + if (vfs_vf & V_BARRIER)
5076 + new_fl |= EXT4_BARRIER_FL;
5077 + if (vfs_vf & V_COW)
5078 + new_fl |= EXT4_COW_FL;
5079 } while (cmpxchg(&ei->i_flags, old_fl, new_fl) != old_fl);
5082 @@ -4996,6 +5020,8 @@ struct inode *ext4_iget(struct super_blo
5083 journal_t *journal = EXT4_SB(sb)->s_journal;
5089 inode = iget_locked(sb, ino);
5091 @@ -5011,12 +5037,16 @@ struct inode *ext4_iget(struct super_blo
5093 raw_inode = ext4_raw_inode(&iloc);
5094 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
5095 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
5096 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
5097 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
5098 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
5099 if (!(test_opt(inode->i_sb, NO_UID32))) {
5100 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
5101 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
5102 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
5103 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
5105 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
5106 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
5107 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
5108 + le16_to_cpu(raw_inode->i_raw_tag));
5109 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
5111 ei->i_state_flags = 0;
5112 @@ -5235,6 +5265,8 @@ static int ext4_do_update_inode(handle_t
5113 struct ext4_inode *raw_inode = ext4_raw_inode(iloc);
5114 struct ext4_inode_info *ei = EXT4_I(inode);
5115 struct buffer_head *bh = iloc->bh;
5116 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
5117 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
5118 int err = 0, rc, block;
5120 /* For fields not not tracking in the in-memory inode,
5121 @@ -5245,29 +5277,32 @@ static int ext4_do_update_inode(handle_t
5122 ext4_get_inode_flags(ei);
5123 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
5124 if (!(test_opt(inode->i_sb, NO_UID32))) {
5125 - raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
5126 - raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
5127 + raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
5128 + raw_inode->i_gid_low = cpu_to_le16(low_16_bits(gid));
5130 * Fix up interoperability with old kernels. Otherwise, old inodes get
5131 * re-used with the upper 16 bits of the uid/gid intact
5134 raw_inode->i_uid_high =
5135 - cpu_to_le16(high_16_bits(inode->i_uid));
5136 + cpu_to_le16(high_16_bits(uid));
5137 raw_inode->i_gid_high =
5138 - cpu_to_le16(high_16_bits(inode->i_gid));
5139 + cpu_to_le16(high_16_bits(gid));
5141 raw_inode->i_uid_high = 0;
5142 raw_inode->i_gid_high = 0;
5145 raw_inode->i_uid_low =
5146 - cpu_to_le16(fs_high2lowuid(inode->i_uid));
5147 + cpu_to_le16(fs_high2lowuid(uid));
5148 raw_inode->i_gid_low =
5149 - cpu_to_le16(fs_high2lowgid(inode->i_gid));
5150 + cpu_to_le16(fs_high2lowgid(gid));
5151 raw_inode->i_uid_high = 0;
5152 raw_inode->i_gid_high = 0;
5154 +#ifdef CONFIG_TAGGING_INTERN
5155 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
5157 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
5159 EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
5160 @@ -5453,7 +5488,8 @@ int ext4_setattr(struct dentry *dentry,
5161 if (is_quota_modification(inode, attr))
5162 dquot_initialize(inode);
5163 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
5164 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
5165 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
5166 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
5169 /* (user+group)*(old+new) structure, inode write (sb,
5170 @@ -5475,6 +5511,8 @@ int ext4_setattr(struct dentry *dentry,
5171 inode->i_uid = attr->ia_uid;
5172 if (attr->ia_valid & ATTR_GID)
5173 inode->i_gid = attr->ia_gid;
5174 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
5175 + inode->i_tag = attr->ia_tag;
5176 error = ext4_mark_inode_dirty(handle, inode);
5177 ext4_journal_stop(handle);
5179 diff -NurpP --minimal linux-2.6.35.2/fs/ext4/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/ioctl.c
5180 --- linux-2.6.35.2/fs/ext4/ioctl.c 2010-08-02 16:52:48.000000000 +0200
5181 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/ioctl.c 2010-08-02 17:05:05.000000000 +0200
5183 #include <linux/compat.h>
5184 #include <linux/mount.h>
5185 #include <linux/file.h>
5186 +#include <linux/vs_tag.h>
5187 #include <asm/uaccess.h>
5188 #include "ext4_jbd2.h"
5192 +int ext4_sync_flags(struct inode *inode, int flags, int vflags)
5194 + handle_t *handle = NULL;
5195 + struct ext4_iloc iloc;
5198 + handle = ext4_journal_start(inode, 1);
5199 + if (IS_ERR(handle))
5200 + return PTR_ERR(handle);
5202 + if (IS_SYNC(inode))
5203 + ext4_handle_sync(handle);
5204 + err = ext4_reserve_inode_write(handle, inode, &iloc);
5208 + inode->i_flags = flags;
5209 + inode->i_vflags = vflags;
5210 + ext4_get_inode_flags(EXT4_I(inode));
5211 + inode->i_ctime = ext4_current_time(inode);
5213 + err = ext4_mark_iloc_dirty(handle, inode, &iloc);
5215 + ext4_journal_stop(handle);
5219 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5221 struct inode *inode = filp->f_dentry->d_inode;
5222 @@ -50,6 +79,11 @@ long ext4_ioctl(struct file *filp, unsig
5224 flags = ext4_mask_flags(inode->i_mode, flags);
5226 + if (IS_BARRIER(inode)) {
5227 + vxwprintk_task(1, "messing with the barrier.");
5232 mutex_lock(&inode->i_mutex);
5233 /* Is it quota file? Do not allow user to mess with it */
5234 @@ -67,7 +101,9 @@ long ext4_ioctl(struct file *filp, unsig
5236 * This test looks nicer. Thanks to Pauline Middelink
5238 - if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) {
5239 + if ((oldflags & EXT4_IMMUTABLE_FL) ||
5240 + ((flags ^ oldflags) & (EXT4_APPEND_FL |
5241 + EXT4_IMMUTABLE_FL | EXT4_IXUNLINK_FL))) {
5242 if (!capable(CAP_LINUX_IMMUTABLE))
5245 diff -NurpP --minimal linux-2.6.35.2/fs/ext4/namei.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/namei.c
5246 --- linux-2.6.35.2/fs/ext4/namei.c 2010-08-02 16:52:48.000000000 +0200
5247 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/namei.c 2010-08-02 17:05:05.000000000 +0200
5249 #include <linux/quotaops.h>
5250 #include <linux/buffer_head.h>
5251 #include <linux/bio.h>
5252 +#include <linux/vs_tag.h>
5254 #include "ext4_jbd2.h"
5256 @@ -937,6 +938,7 @@ restart:
5258 ll_rw_block(READ_META, 1, &bh);
5260 + dx_propagate_tag(nd, inode);
5262 if ((bh = bh_use[ra_ptr++]) == NULL)
5264 @@ -2550,6 +2552,7 @@ const struct inode_operations ext4_dir_i
5266 .check_acl = ext4_check_acl,
5267 .fiemap = ext4_fiemap,
5268 + .sync_flags = ext4_sync_flags,
5271 const struct inode_operations ext4_special_inode_operations = {
5272 diff -NurpP --minimal linux-2.6.35.2/fs/ext4/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/super.c
5273 --- linux-2.6.35.2/fs/ext4/super.c 2010-08-14 18:16:59.000000000 +0200
5274 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ext4/super.c 2010-08-14 18:19:32.000000000 +0200
5275 @@ -1161,6 +1161,7 @@ enum {
5276 Opt_inode_readahead_blks, Opt_journal_ioprio,
5277 Opt_dioread_nolock, Opt_dioread_lock,
5278 Opt_discard, Opt_nodiscard,
5279 + Opt_tag, Opt_notag, Opt_tagid
5282 static const match_table_t tokens = {
5283 @@ -1231,6 +1232,9 @@ static const match_table_t tokens = {
5284 {Opt_dioread_lock, "dioread_lock"},
5285 {Opt_discard, "discard"},
5286 {Opt_nodiscard, "nodiscard"},
5288 + {Opt_notag, "notag"},
5289 + {Opt_tagid, "tagid=%u"},
5293 @@ -1399,6 +1403,20 @@ static int parse_options(char *options,
5295 set_opt(sbi->s_mount_opt, NO_UID32);
5297 +#ifndef CONFIG_TAGGING_NONE
5299 + set_opt (sbi->s_mount_opt, TAGGED);
5302 + clear_opt (sbi->s_mount_opt, TAGGED);
5305 +#ifdef CONFIG_PROPAGATE
5308 + set_opt (sbi->s_mount_opt, TAGGED);
5312 set_opt(sbi->s_mount_opt, DEBUG);
5314 @@ -2566,6 +2584,9 @@ static int ext4_fill_super(struct super_
5315 &journal_ioprio, NULL, 0))
5318 + if (EXT4_SB(sb)->s_mount_opt & EXT4_MOUNT_TAGGED)
5319 + sb->s_flags |= MS_TAGGED;
5321 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5322 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
5324 @@ -3618,6 +3639,14 @@ static int ext4_remount(struct super_blo
5325 if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
5326 ext4_abort(sb, __func__, "Abort forced by user");
5328 + if ((sbi->s_mount_opt & EXT4_MOUNT_TAGGED) &&
5329 + !(sb->s_flags & MS_TAGGED)) {
5330 + printk("EXT4-fs: %s: tagging not permitted on remount.\n",
5333 + goto restore_opts;
5336 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5337 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
5339 diff -NurpP --minimal linux-2.6.35.2/fs/fcntl.c linux-2.6.35.2-vs2.3.0.36.31/fs/fcntl.c
5340 --- linux-2.6.35.2/fs/fcntl.c 2010-08-02 16:52:49.000000000 +0200
5341 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/fcntl.c 2010-08-02 17:05:06.000000000 +0200
5343 #include <linux/signal.h>
5344 #include <linux/rcupdate.h>
5345 #include <linux/pid_namespace.h>
5346 +#include <linux/vs_limit.h>
5348 #include <asm/poll.h>
5349 #include <asm/siginfo.h>
5350 @@ -103,6 +104,8 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldf
5353 filp_close(tofree, files);
5355 + vx_openfd_inc(newfd); /* fd was unused */
5359 @@ -434,6 +437,8 @@ SYSCALL_DEFINE3(fcntl, unsigned int, fd,
5363 + if (!vx_files_avail(1))
5366 err = security_file_fcntl(filp, cmd, arg);
5368 diff -NurpP --minimal linux-2.6.35.2/fs/file.c linux-2.6.35.2-vs2.3.0.36.31/fs/file.c
5369 --- linux-2.6.35.2/fs/file.c 2010-07-07 18:31:51.000000000 +0200
5370 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/file.c 2010-08-02 17:05:06.000000000 +0200
5372 #include <linux/spinlock.h>
5373 #include <linux/rcupdate.h>
5374 #include <linux/workqueue.h>
5375 +#include <linux/vs_limit.h>
5377 struct fdtable_defer {
5379 @@ -368,6 +369,8 @@ struct files_struct *dup_fd(struct files
5380 struct file *f = *old_fds++;
5383 + /* TODO: sum it first for check and performance */
5384 + vx_openfd_inc(open_files - i);
5387 * The fd may be claimed in the fd bitmap but not yet
5388 @@ -476,6 +479,7 @@ repeat:
5390 FD_CLR(fd, fdt->close_on_exec);
5392 + vx_openfd_inc(fd);
5395 if (rcu_dereference_raw(fdt->fd[fd]) != NULL) {
5396 diff -NurpP --minimal linux-2.6.35.2/fs/file_table.c linux-2.6.35.2-vs2.3.0.36.31/fs/file_table.c
5397 --- linux-2.6.35.2/fs/file_table.c 2010-08-02 16:52:49.000000000 +0200
5398 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/file_table.c 2010-08-02 17:05:06.000000000 +0200
5400 #include <linux/sysctl.h>
5401 #include <linux/percpu_counter.h>
5402 #include <linux/ima.h>
5403 +#include <linux/vs_limit.h>
5404 +#include <linux/vs_context.h>
5406 #include <asm/atomic.h>
5408 @@ -133,6 +135,8 @@ struct file *get_empty_filp(void)
5409 spin_lock_init(&f->f_lock);
5410 eventpoll_init_file(f);
5411 /* f->f_version: 0 */
5412 + f->f_xid = vx_current_xid();
5417 @@ -249,6 +253,8 @@ static void __fput(struct file *file)
5418 cdev_put(inode->i_cdev);
5419 fops_put(file->f_op);
5420 put_pid(file->f_owner.pid);
5421 + vx_files_dec(file);
5424 if (file->f_mode & FMODE_WRITE)
5425 drop_file_write_access(file);
5426 @@ -324,6 +330,8 @@ void put_filp(struct file *file)
5428 if (atomic_long_dec_and_test(&file->f_count)) {
5429 security_file_free(file);
5430 + vx_files_dec(file);
5435 diff -NurpP --minimal linux-2.6.35.2/fs/fs_struct.c linux-2.6.35.2-vs2.3.0.36.31/fs/fs_struct.c
5436 --- linux-2.6.35.2/fs/fs_struct.c 2009-06-11 17:13:04.000000000 +0200
5437 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/fs_struct.c 2010-08-02 17:05:06.000000000 +0200
5439 #include <linux/path.h>
5440 #include <linux/slab.h>
5441 #include <linux/fs_struct.h>
5442 +#include <linux/vserver/global.h>
5445 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
5446 @@ -77,6 +78,7 @@ void free_fs_struct(struct fs_struct *fs
5448 path_put(&fs->root);
5450 + atomic_dec(&vs_global_fs);
5451 kmem_cache_free(fs_cachep, fs);
5454 @@ -112,6 +114,7 @@ struct fs_struct *copy_fs_struct(struct
5456 path_get(&old->pwd);
5457 read_unlock(&old->lock);
5458 + atomic_inc(&vs_global_fs);
5462 diff -NurpP --minimal linux-2.6.35.2/fs/gfs2/file.c linux-2.6.35.2-vs2.3.0.36.31/fs/gfs2/file.c
5463 --- linux-2.6.35.2/fs/gfs2/file.c 2010-08-02 16:52:49.000000000 +0200
5464 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/gfs2/file.c 2010-08-02 17:05:06.000000000 +0200
5465 @@ -132,6 +132,9 @@ static const u32 fsflags_to_gfs2[32] = {
5466 [7] = GFS2_DIF_NOATIME,
5467 [12] = GFS2_DIF_EXHASH,
5468 [14] = GFS2_DIF_INHERIT_JDATA,
5469 + [27] = GFS2_DIF_IXUNLINK,
5470 + [26] = GFS2_DIF_BARRIER,
5471 + [29] = GFS2_DIF_COW,
5474 static const u32 gfs2_to_fsflags[32] = {
5475 @@ -141,6 +144,9 @@ static const u32 gfs2_to_fsflags[32] = {
5476 [gfs2fl_NoAtime] = FS_NOATIME_FL,
5477 [gfs2fl_ExHash] = FS_INDEX_FL,
5478 [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL,
5479 + [gfs2fl_IXUnlink] = FS_IXUNLINK_FL,
5480 + [gfs2fl_Barrier] = FS_BARRIER_FL,
5481 + [gfs2fl_Cow] = FS_COW_FL,
5484 static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
5485 @@ -171,10 +177,16 @@ void gfs2_set_inode_flags(struct inode *
5487 struct gfs2_inode *ip = GFS2_I(inode);
5488 unsigned int flags = inode->i_flags;
5489 + unsigned int vflags = inode->i_vflags;
5491 + flags &= ~(S_IMMUTABLE | S_IXUNLINK |
5492 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
5494 - flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
5495 if (ip->i_diskflags & GFS2_DIF_IMMUTABLE)
5496 flags |= S_IMMUTABLE;
5497 + if (ip->i_diskflags & GFS2_DIF_IXUNLINK)
5498 + flags |= S_IXUNLINK;
5500 if (ip->i_diskflags & GFS2_DIF_APPENDONLY)
5502 if (ip->i_diskflags & GFS2_DIF_NOATIME)
5503 @@ -182,6 +194,43 @@ void gfs2_set_inode_flags(struct inode *
5504 if (ip->i_diskflags & GFS2_DIF_SYNC)
5506 inode->i_flags = flags;
5508 + vflags &= ~(V_BARRIER | V_COW);
5510 + if (ip->i_diskflags & GFS2_DIF_BARRIER)
5511 + vflags |= V_BARRIER;
5512 + if (ip->i_diskflags & GFS2_DIF_COW)
5514 + inode->i_vflags = vflags;
5517 +void gfs2_get_inode_flags(struct inode *inode)
5519 + struct gfs2_inode *ip = GFS2_I(inode);
5520 + unsigned int flags = inode->i_flags;
5521 + unsigned int vflags = inode->i_vflags;
5523 + ip->i_diskflags &= ~(GFS2_DIF_APPENDONLY |
5524 + GFS2_DIF_NOATIME | GFS2_DIF_SYNC |
5525 + GFS2_DIF_IMMUTABLE | GFS2_DIF_IXUNLINK |
5526 + GFS2_DIF_BARRIER | GFS2_DIF_COW);
5528 + if (flags & S_IMMUTABLE)
5529 + ip->i_diskflags |= GFS2_DIF_IMMUTABLE;
5530 + if (flags & S_IXUNLINK)
5531 + ip->i_diskflags |= GFS2_DIF_IXUNLINK;
5533 + if (flags & S_APPEND)
5534 + ip->i_diskflags |= GFS2_DIF_APPENDONLY;
5535 + if (flags & S_NOATIME)
5536 + ip->i_diskflags |= GFS2_DIF_NOATIME;
5537 + if (flags & S_SYNC)
5538 + ip->i_diskflags |= GFS2_DIF_SYNC;
5540 + if (vflags & V_BARRIER)
5541 + ip->i_diskflags |= GFS2_DIF_BARRIER;
5542 + if (vflags & V_COW)
5543 + ip->i_diskflags |= GFS2_DIF_COW;
5546 /* Flags that can be set by user space */
5547 @@ -293,6 +342,37 @@ static int gfs2_set_flags(struct file *f
5548 return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_JDATA);
5551 +int gfs2_sync_flags(struct inode *inode, int flags, int vflags)
5553 + struct gfs2_inode *ip = GFS2_I(inode);
5554 + struct gfs2_sbd *sdp = GFS2_SB(inode);
5555 + struct buffer_head *bh;
5556 + struct gfs2_holder gh;
5559 + error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
5562 + error = gfs2_trans_begin(sdp, RES_DINODE, 0);
5565 + error = gfs2_meta_inode_buffer(ip, &bh);
5567 + goto out_trans_end;
5568 + gfs2_trans_add_bh(ip->i_gl, bh, 1);
5569 + inode->i_flags = flags;
5570 + inode->i_vflags = vflags;
5571 + gfs2_get_inode_flags(inode);
5572 + gfs2_dinode_out(ip, bh->b_data);
5574 + gfs2_set_aops(inode);
5576 + gfs2_trans_end(sdp);
5578 + gfs2_glock_dq_uninit(&gh);
5582 static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5585 diff -NurpP --minimal linux-2.6.35.2/fs/gfs2/inode.h linux-2.6.35.2-vs2.3.0.36.31/fs/gfs2/inode.h
5586 --- linux-2.6.35.2/fs/gfs2/inode.h 2010-08-02 16:52:49.000000000 +0200
5587 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/gfs2/inode.h 2010-08-02 17:05:06.000000000 +0200
5588 @@ -109,6 +109,7 @@ extern const struct file_operations gfs2
5589 extern const struct file_operations gfs2_dir_fops_nolock;
5591 extern void gfs2_set_inode_flags(struct inode *inode);
5592 +extern int gfs2_sync_flags(struct inode *inode, int flags, int vflags);
5594 #ifdef CONFIG_GFS2_FS_LOCKING_DLM
5595 extern const struct file_operations gfs2_file_fops;
5596 diff -NurpP --minimal linux-2.6.35.2/fs/gfs2/ops_inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/gfs2/ops_inode.c
5597 --- linux-2.6.35.2/fs/gfs2/ops_inode.c 2010-08-02 16:52:49.000000000 +0200
5598 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/gfs2/ops_inode.c 2010-08-02 17:05:06.000000000 +0200
5599 @@ -1346,6 +1346,7 @@ const struct inode_operations gfs2_file_
5600 .listxattr = gfs2_listxattr,
5601 .removexattr = gfs2_removexattr,
5602 .fiemap = gfs2_fiemap,
5603 + .sync_flags = gfs2_sync_flags,
5606 const struct inode_operations gfs2_dir_iops = {
5607 @@ -1366,6 +1367,7 @@ const struct inode_operations gfs2_dir_i
5608 .listxattr = gfs2_listxattr,
5609 .removexattr = gfs2_removexattr,
5610 .fiemap = gfs2_fiemap,
5611 + .sync_flags = gfs2_sync_flags,
5614 const struct inode_operations gfs2_symlink_iops = {
5615 diff -NurpP --minimal linux-2.6.35.2/fs/hfsplus/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/hfsplus/ioctl.c
5616 --- linux-2.6.35.2/fs/hfsplus/ioctl.c 2010-08-02 16:52:49.000000000 +0200
5617 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/hfsplus/ioctl.c 2010-08-02 17:48:55.000000000 +0200
5619 #include <linux/sched.h>
5620 #include <linux/xattr.h>
5621 #include <linux/smp_lock.h>
5622 +// #include <linux/mount.h>
5623 #include <asm/uaccess.h>
5624 #include "hfsplus_fs.h"
5626 diff -NurpP --minimal linux-2.6.35.2/fs/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/inode.c
5627 --- linux-2.6.35.2/fs/inode.c 2010-08-02 16:52:49.000000000 +0200
5628 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/inode.c 2010-08-02 19:08:57.000000000 +0200
5630 #include <linux/mount.h>
5631 #include <linux/async.h>
5632 #include <linux/posix_acl.h>
5633 +#include <linux/vs_tag.h>
5636 * This is needed for the following functions:
5637 @@ -131,6 +132,9 @@ int inode_init_always(struct super_block
5638 struct address_space *const mapping = &inode->i_data;
5642 + /* essential because of inode slab reuse */
5644 inode->i_blkbits = sb->s_blocksize_bits;
5646 atomic_set(&inode->i_count, 1);
5647 @@ -151,6 +155,7 @@ int inode_init_always(struct super_block
5648 inode->i_bdev = NULL;
5649 inode->i_cdev = NULL;
5651 + inode->i_mdev = 0;
5652 inode->dirtied_when = 0;
5654 if (security_inode_alloc(inode))
5655 @@ -294,6 +299,8 @@ void __iget(struct inode *inode)
5656 inodes_stat.nr_unused--;
5659 +EXPORT_SYMBOL_GPL(__iget);
5662 * clear_inode - clear an inode
5663 * @inode: inode to clear
5664 @@ -1593,9 +1600,11 @@ void init_special_inode(struct inode *in
5665 if (S_ISCHR(mode)) {
5666 inode->i_fop = &def_chr_fops;
5667 inode->i_rdev = rdev;
5668 + inode->i_mdev = rdev;
5669 } else if (S_ISBLK(mode)) {
5670 inode->i_fop = &def_blk_fops;
5671 inode->i_rdev = rdev;
5672 + inode->i_mdev = rdev;
5673 } else if (S_ISFIFO(mode))
5674 inode->i_fop = &def_fifo_fops;
5675 else if (S_ISSOCK(mode))
5676 @@ -1624,5 +1633,6 @@ void inode_init_owner(struct inode *inod
5678 inode->i_gid = current_fsgid();
5679 inode->i_mode = mode;
5680 + inode->i_tag = dx_current_fstag(inode->i_sb);
5682 EXPORT_SYMBOL(inode_init_owner);
5683 diff -NurpP --minimal linux-2.6.35.2/fs/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/ioctl.c
5684 --- linux-2.6.35.2/fs/ioctl.c 2010-08-02 16:52:49.000000000 +0200
5685 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ioctl.c 2010-08-02 17:05:06.000000000 +0200
5687 #include <linux/writeback.h>
5688 #include <linux/buffer_head.h>
5689 #include <linux/falloc.h>
5690 +#include <linux/proc_fs.h>
5691 +#include <linux/vserver/inode.h>
5692 +#include <linux/vs_tag.h>
5694 #include <asm/ioctls.h>
5696 diff -NurpP --minimal linux-2.6.35.2/fs/ioprio.c linux-2.6.35.2-vs2.3.0.36.31/fs/ioprio.c
5697 --- linux-2.6.35.2/fs/ioprio.c 2010-07-07 18:31:52.000000000 +0200
5698 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ioprio.c 2010-08-02 17:05:06.000000000 +0200
5700 #include <linux/syscalls.h>
5701 #include <linux/security.h>
5702 #include <linux/pid_namespace.h>
5703 +#include <linux/vs_base.h>
5705 int set_task_ioprio(struct task_struct *task, int ioprio)
5707 @@ -124,6 +125,8 @@ SYSCALL_DEFINE3(ioprio_set, int, which,
5709 pgrp = find_vpid(who);
5710 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
5711 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
5713 ret = set_task_ioprio(p, ioprio);
5716 @@ -213,6 +216,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which,
5718 pgrp = find_vpid(who);
5719 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
5720 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
5722 tmpio = get_task_ioprio(p);
5725 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/file.c linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/file.c
5726 --- linux-2.6.35.2/fs/jfs/file.c 2010-08-02 16:52:49.000000000 +0200
5727 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/file.c 2010-08-02 17:05:06.000000000 +0200
5728 @@ -101,7 +101,8 @@ int jfs_setattr(struct dentry *dentry, s
5729 if (is_quota_modification(inode, iattr))
5730 dquot_initialize(inode);
5731 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
5732 - (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
5733 + (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
5734 + (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
5735 rc = dquot_transfer(inode, iattr);
5738 @@ -125,6 +126,7 @@ const struct inode_operations jfs_file_i
5739 #ifdef CONFIG_JFS_POSIX_ACL
5740 .check_acl = jfs_check_acl,
5742 + .sync_flags = jfs_sync_flags,
5745 const struct file_operations jfs_file_operations = {
5746 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/ioctl.c
5747 --- linux-2.6.35.2/fs/jfs/ioctl.c 2008-12-25 00:26:37.000000000 +0100
5748 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/ioctl.c 2010-08-02 17:05:06.000000000 +0200
5750 #include <linux/mount.h>
5751 #include <linux/time.h>
5752 #include <linux/sched.h>
5753 +#include <linux/mount.h>
5754 #include <asm/current.h>
5755 #include <asm/uaccess.h>
5757 @@ -52,6 +53,16 @@ static long jfs_map_ext2(unsigned long f
5761 +int jfs_sync_flags(struct inode *inode, int flags, int vflags)
5763 + inode->i_flags = flags;
5764 + inode->i_vflags = vflags;
5765 + jfs_get_inode_flags(JFS_IP(inode));
5766 + inode->i_ctime = CURRENT_TIME_SEC;
5767 + mark_inode_dirty(inode);
5771 long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5773 struct inode *inode = filp->f_dentry->d_inode;
5774 @@ -85,6 +96,11 @@ long jfs_ioctl(struct file *filp, unsign
5775 if (!S_ISDIR(inode->i_mode))
5776 flags &= ~JFS_DIRSYNC_FL;
5778 + if (IS_BARRIER(inode)) {
5779 + vxwprintk_task(1, "messing with the barrier.");
5783 /* Is it quota file? Do not allow user to mess with it */
5784 if (IS_NOQUOTA(inode)) {
5786 @@ -102,8 +118,8 @@ long jfs_ioctl(struct file *filp, unsign
5787 * the relevant capability.
5789 if ((oldflags & JFS_IMMUTABLE_FL) ||
5790 - ((flags ^ oldflags) &
5791 - (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) {
5792 + ((flags ^ oldflags) & (JFS_APPEND_FL |
5793 + JFS_IMMUTABLE_FL | JFS_IXUNLINK_FL))) {
5794 if (!capable(CAP_LINUX_IMMUTABLE)) {
5795 mutex_unlock(&inode->i_mutex);
5797 @@ -111,7 +127,7 @@ long jfs_ioctl(struct file *filp, unsign
5801 - flags = flags & JFS_FL_USER_MODIFIABLE;
5802 + flags &= JFS_FL_USER_MODIFIABLE;
5803 flags |= oldflags & ~JFS_FL_USER_MODIFIABLE;
5804 jfs_inode->mode2 = flags;
5806 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/jfs_dinode.h linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_dinode.h
5807 --- linux-2.6.35.2/fs/jfs/jfs_dinode.h 2008-12-25 00:26:37.000000000 +0100
5808 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_dinode.h 2010-08-02 17:05:06.000000000 +0200
5809 @@ -161,9 +161,13 @@ struct dinode {
5811 #define JFS_APPEND_FL 0x01000000 /* writes to file may only append */
5812 #define JFS_IMMUTABLE_FL 0x02000000 /* Immutable file */
5813 +#define JFS_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
5815 -#define JFS_FL_USER_VISIBLE 0x03F80000
5816 -#define JFS_FL_USER_MODIFIABLE 0x03F80000
5817 +#define JFS_BARRIER_FL 0x04000000 /* Barrier for chroot() */
5818 +#define JFS_COW_FL 0x20000000 /* Copy on Write marker */
5820 +#define JFS_FL_USER_VISIBLE 0x07F80000
5821 +#define JFS_FL_USER_MODIFIABLE 0x07F80000
5822 #define JFS_FL_INHERIT 0x03C80000
5824 /* These are identical to EXT[23]_IOC_GETFLAGS/SETFLAGS */
5825 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/jfs_filsys.h linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_filsys.h
5826 --- linux-2.6.35.2/fs/jfs/jfs_filsys.h 2008-12-25 00:26:37.000000000 +0100
5827 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_filsys.h 2010-08-02 17:05:06.000000000 +0200
5829 #define JFS_NAME_MAX 255
5830 #define JFS_PATH_MAX BPSIZE
5832 +#define JFS_TAGGED 0x00800000 /* Context Tagging */
5835 * file system state (superblock state)
5836 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/jfs_imap.c linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_imap.c
5837 --- linux-2.6.35.2/fs/jfs/jfs_imap.c 2010-07-07 18:31:52.000000000 +0200
5838 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_imap.c 2010-08-02 17:05:06.000000000 +0200
5840 #include <linux/pagemap.h>
5841 #include <linux/quotaops.h>
5842 #include <linux/slab.h>
5843 +#include <linux/vs_tag.h>
5845 #include "jfs_incore.h"
5846 #include "jfs_inode.h"
5847 @@ -3060,6 +3061,8 @@ static int copy_from_dinode(struct dinod
5849 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
5850 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
5854 jfs_ip->fileset = le32_to_cpu(dip->di_fileset);
5855 jfs_ip->mode2 = le32_to_cpu(dip->di_mode);
5856 @@ -3080,14 +3083,18 @@ static int copy_from_dinode(struct dinod
5858 ip->i_nlink = le32_to_cpu(dip->di_nlink);
5860 - jfs_ip->saved_uid = le32_to_cpu(dip->di_uid);
5861 + uid = le32_to_cpu(dip->di_uid);
5862 + gid = le32_to_cpu(dip->di_gid);
5863 + ip->i_tag = INOTAG_TAG(DX_TAG(ip), uid, gid, 0);
5865 + jfs_ip->saved_uid = INOTAG_UID(DX_TAG(ip), uid, gid);
5867 ip->i_uid = jfs_ip->saved_uid;
5869 ip->i_uid = sbi->uid;
5872 - jfs_ip->saved_gid = le32_to_cpu(dip->di_gid);
5873 + jfs_ip->saved_gid = INOTAG_GID(DX_TAG(ip), uid, gid);
5875 ip->i_gid = jfs_ip->saved_gid;
5877 @@ -3152,14 +3159,12 @@ static void copy_to_dinode(struct dinode
5878 dip->di_size = cpu_to_le64(ip->i_size);
5879 dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks));
5880 dip->di_nlink = cpu_to_le32(ip->i_nlink);
5881 - if (sbi->uid == -1)
5882 - dip->di_uid = cpu_to_le32(ip->i_uid);
5884 - dip->di_uid = cpu_to_le32(jfs_ip->saved_uid);
5885 - if (sbi->gid == -1)
5886 - dip->di_gid = cpu_to_le32(ip->i_gid);
5888 - dip->di_gid = cpu_to_le32(jfs_ip->saved_gid);
5890 + dip->di_uid = cpu_to_le32(TAGINO_UID(DX_TAG(ip),
5891 + (sbi->uid == -1) ? ip->i_uid : jfs_ip->saved_uid, ip->i_tag));
5892 + dip->di_gid = cpu_to_le32(TAGINO_GID(DX_TAG(ip),
5893 + (sbi->gid == -1) ? ip->i_gid : jfs_ip->saved_gid, ip->i_tag));
5895 jfs_get_inode_flags(jfs_ip);
5897 * mode2 is only needed for storing the higher order bits.
5898 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/jfs_inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_inode.c
5899 --- linux-2.6.35.2/fs/jfs/jfs_inode.c 2010-08-02 16:52:49.000000000 +0200
5900 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_inode.c 2010-08-02 17:05:06.000000000 +0200
5903 #include <linux/fs.h>
5904 #include <linux/quotaops.h>
5905 +#include <linux/vs_tag.h>
5906 #include "jfs_incore.h"
5907 #include "jfs_inode.h"
5908 #include "jfs_filsys.h"
5909 @@ -30,29 +31,46 @@ void jfs_set_inode_flags(struct inode *i
5911 unsigned int flags = JFS_IP(inode)->mode2;
5913 - inode->i_flags &= ~(S_IMMUTABLE | S_APPEND |
5914 - S_NOATIME | S_DIRSYNC | S_SYNC);
5915 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
5916 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
5918 if (flags & JFS_IMMUTABLE_FL)
5919 inode->i_flags |= S_IMMUTABLE;
5920 + if (flags & JFS_IXUNLINK_FL)
5921 + inode->i_flags |= S_IXUNLINK;
5923 + if (flags & JFS_SYNC_FL)
5924 + inode->i_flags |= S_SYNC;
5925 if (flags & JFS_APPEND_FL)
5926 inode->i_flags |= S_APPEND;
5927 if (flags & JFS_NOATIME_FL)
5928 inode->i_flags |= S_NOATIME;
5929 if (flags & JFS_DIRSYNC_FL)
5930 inode->i_flags |= S_DIRSYNC;
5931 - if (flags & JFS_SYNC_FL)
5932 - inode->i_flags |= S_SYNC;
5934 + inode->i_vflags &= ~(V_BARRIER | V_COW);
5936 + if (flags & JFS_BARRIER_FL)
5937 + inode->i_vflags |= V_BARRIER;
5938 + if (flags & JFS_COW_FL)
5939 + inode->i_vflags |= V_COW;
5942 void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip)
5944 unsigned int flags = jfs_ip->vfs_inode.i_flags;
5945 + unsigned int vflags = jfs_ip->vfs_inode.i_vflags;
5947 + jfs_ip->mode2 &= ~(JFS_IMMUTABLE_FL | JFS_IXUNLINK_FL |
5948 + JFS_APPEND_FL | JFS_NOATIME_FL |
5949 + JFS_DIRSYNC_FL | JFS_SYNC_FL |
5950 + JFS_BARRIER_FL | JFS_COW_FL);
5952 - jfs_ip->mode2 &= ~(JFS_IMMUTABLE_FL | JFS_APPEND_FL | JFS_NOATIME_FL |
5953 - JFS_DIRSYNC_FL | JFS_SYNC_FL);
5954 if (flags & S_IMMUTABLE)
5955 jfs_ip->mode2 |= JFS_IMMUTABLE_FL;
5956 + if (flags & S_IXUNLINK)
5957 + jfs_ip->mode2 |= JFS_IXUNLINK_FL;
5959 if (flags & S_APPEND)
5960 jfs_ip->mode2 |= JFS_APPEND_FL;
5961 if (flags & S_NOATIME)
5962 @@ -61,6 +79,11 @@ void jfs_get_inode_flags(struct jfs_inod
5963 jfs_ip->mode2 |= JFS_DIRSYNC_FL;
5965 jfs_ip->mode2 |= JFS_SYNC_FL;
5967 + if (vflags & V_BARRIER)
5968 + jfs_ip->mode2 |= JFS_BARRIER_FL;
5969 + if (vflags & V_COW)
5970 + jfs_ip->mode2 |= JFS_COW_FL;
5974 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/jfs_inode.h linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_inode.h
5975 --- linux-2.6.35.2/fs/jfs/jfs_inode.h 2010-08-02 16:52:49.000000000 +0200
5976 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/jfs_inode.h 2010-08-02 17:05:06.000000000 +0200
5977 @@ -39,6 +39,7 @@ extern struct dentry *jfs_fh_to_dentry(s
5978 extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
5979 int fh_len, int fh_type);
5980 extern void jfs_set_inode_flags(struct inode *);
5981 +extern int jfs_sync_flags(struct inode *, int, int);
5982 extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
5983 extern int jfs_setattr(struct dentry *, struct iattr *);
5985 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/namei.c linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/namei.c
5986 --- linux-2.6.35.2/fs/jfs/namei.c 2010-07-07 18:31:52.000000000 +0200
5987 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/namei.c 2010-08-02 17:05:06.000000000 +0200
5989 #include <linux/ctype.h>
5990 #include <linux/quotaops.h>
5991 #include <linux/exportfs.h>
5992 +#include <linux/vs_tag.h>
5993 #include "jfs_incore.h"
5994 #include "jfs_superblock.h"
5995 #include "jfs_inode.h"
5996 @@ -1491,6 +1492,7 @@ static struct dentry *jfs_lookup(struct
5997 return ERR_CAST(ip);
6000 + dx_propagate_tag(nd, ip);
6001 dentry = d_splice_alias(ip, dentry);
6003 if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2))
6004 @@ -1560,6 +1562,7 @@ const struct inode_operations jfs_dir_in
6005 #ifdef CONFIG_JFS_POSIX_ACL
6006 .check_acl = jfs_check_acl,
6008 + .sync_flags = jfs_sync_flags,
6011 const struct file_operations jfs_dir_operations = {
6012 diff -NurpP --minimal linux-2.6.35.2/fs/jfs/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/super.c
6013 --- linux-2.6.35.2/fs/jfs/super.c 2010-08-02 16:52:49.000000000 +0200
6014 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/jfs/super.c 2010-08-02 17:05:06.000000000 +0200
6015 @@ -200,7 +200,8 @@ static void jfs_put_super(struct super_b
6017 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
6018 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
6019 - Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask
6020 + Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask,
6021 + Opt_tag, Opt_notag, Opt_tagid
6024 static const match_table_t tokens = {
6025 @@ -210,6 +211,10 @@ static const match_table_t tokens = {
6026 {Opt_resize, "resize=%u"},
6027 {Opt_resize_nosize, "resize"},
6028 {Opt_errors, "errors=%s"},
6030 + {Opt_notag, "notag"},
6031 + {Opt_tagid, "tagid=%u"},
6032 + {Opt_tag, "tagxid"},
6033 {Opt_ignore, "noquota"},
6034 {Opt_ignore, "quota"},
6035 {Opt_usrquota, "usrquota"},
6036 @@ -344,6 +349,20 @@ static int parse_options(char *options,
6040 +#ifndef CONFIG_TAGGING_NONE
6042 + *flag |= JFS_TAGGED;
6045 + *flag &= JFS_TAGGED;
6048 +#ifdef CONFIG_PROPAGATE
6051 + *flag |= JFS_TAGGED;
6055 printk("jfs: Unrecognized mount option \"%s\" "
6056 " or missing value\n", p);
6057 @@ -374,6 +393,12 @@ static int jfs_remount(struct super_bloc
6058 if (!parse_options(data, sb, &newLVSize, &flag)) {
6061 + if ((flag & JFS_TAGGED) && !(sb->s_flags & MS_TAGGED)) {
6062 + printk(KERN_ERR "JFS: %s: tagging not permitted on remount.\n",
6069 if (sb->s_flags & MS_RDONLY) {
6070 @@ -465,6 +490,9 @@ static int jfs_fill_super(struct super_b
6071 #ifdef CONFIG_JFS_POSIX_ACL
6072 sb->s_flags |= MS_POSIXACL;
6074 + /* map mount option tagxid */
6075 + if (sbi->flag & JFS_TAGGED)
6076 + sb->s_flags |= MS_TAGGED;
6079 printk(KERN_ERR "resize option for remount only\n");
6080 diff -NurpP --minimal linux-2.6.35.2/fs/libfs.c linux-2.6.35.2-vs2.3.0.36.31/fs/libfs.c
6081 --- linux-2.6.35.2/fs/libfs.c 2010-08-02 16:52:49.000000000 +0200
6082 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/libfs.c 2010-08-02 17:05:06.000000000 +0200
6083 @@ -124,7 +124,8 @@ static inline unsigned char dt_type(stru
6084 * both impossible due to the lock on directory.
6087 -int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
6088 +static inline int do_dcache_readdir_filter(struct file *filp,
6089 + void *dirent, filldir_t filldir, int (*filter)(struct dentry *dentry))
6091 struct dentry *dentry = filp->f_path.dentry;
6092 struct dentry *cursor = filp->private_data;
6093 @@ -157,6 +158,8 @@ int dcache_readdir(struct file * filp, v
6094 next = list_entry(p, struct dentry, d_u.d_child);
6095 if (d_unhashed(next) || !next->d_inode)
6097 + if (filter && !filter(next))
6100 spin_unlock(&dcache_lock);
6101 if (filldir(dirent, next->d_name.name,
6102 @@ -175,6 +178,18 @@ int dcache_readdir(struct file * filp, v
6106 +int dcache_readdir(struct file *filp, void *dirent, filldir_t filldir)
6108 + return do_dcache_readdir_filter(filp, dirent, filldir, NULL);
6111 +int dcache_readdir_filter(struct file *filp, void *dirent, filldir_t filldir,
6112 + int (*filter)(struct dentry *))
6114 + return do_dcache_readdir_filter(filp, dirent, filldir, filter);
6118 ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
6121 @@ -967,6 +982,7 @@ EXPORT_SYMBOL(dcache_dir_close);
6122 EXPORT_SYMBOL(dcache_dir_lseek);
6123 EXPORT_SYMBOL(dcache_dir_open);
6124 EXPORT_SYMBOL(dcache_readdir);
6125 +EXPORT_SYMBOL(dcache_readdir_filter);
6126 EXPORT_SYMBOL(generic_read_dir);
6127 EXPORT_SYMBOL(get_sb_pseudo);
6128 EXPORT_SYMBOL(simple_write_begin);
6129 diff -NurpP --minimal linux-2.6.35.2/fs/locks.c linux-2.6.35.2-vs2.3.0.36.31/fs/locks.c
6130 --- linux-2.6.35.2/fs/locks.c 2010-07-07 18:31:52.000000000 +0200
6131 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/locks.c 2010-08-02 17:05:06.000000000 +0200
6133 #include <linux/time.h>
6134 #include <linux/rcupdate.h>
6135 #include <linux/pid_namespace.h>
6136 +#include <linux/vs_base.h>
6137 +#include <linux/vs_limit.h>
6139 #include <asm/uaccess.h>
6141 @@ -148,6 +150,8 @@ static struct kmem_cache *filelock_cache
6142 /* Allocate an empty lock structure. */
6143 static struct file_lock *locks_alloc_lock(void)
6145 + if (!vx_locks_avail(1))
6147 return kmem_cache_alloc(filelock_cache, GFP_KERNEL);
6150 @@ -174,6 +178,7 @@ static void locks_free_lock(struct file_
6151 BUG_ON(!list_empty(&fl->fl_block));
6152 BUG_ON(!list_empty(&fl->fl_link));
6155 locks_release_private(fl);
6156 kmem_cache_free(filelock_cache, fl);
6158 @@ -194,6 +199,7 @@ void locks_init_lock(struct file_lock *f
6159 fl->fl_start = fl->fl_end = 0;
6161 fl->fl_lmops = NULL;
6165 EXPORT_SYMBOL(locks_init_lock);
6166 @@ -248,6 +254,7 @@ void locks_copy_lock(struct file_lock *n
6167 new->fl_file = fl->fl_file;
6168 new->fl_ops = fl->fl_ops;
6169 new->fl_lmops = fl->fl_lmops;
6170 + new->fl_xid = fl->fl_xid;
6172 locks_copy_private(new, fl);
6174 @@ -286,6 +293,11 @@ static int flock_make_lock(struct file *
6175 fl->fl_flags = FL_FLOCK;
6177 fl->fl_end = OFFSET_MAX;
6179 + vxd_assert(filp->f_xid == vx_current_xid(),
6180 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6181 + fl->fl_xid = filp->f_xid;
6186 @@ -451,6 +463,7 @@ static int lease_init(struct file *filp,
6188 fl->fl_owner = current->files;
6189 fl->fl_pid = current->tgid;
6190 + fl->fl_xid = vx_current_xid();
6193 fl->fl_flags = FL_LEASE;
6194 @@ -470,6 +483,11 @@ static struct file_lock *lease_alloc(str
6196 return ERR_PTR(error);
6198 + fl->fl_xid = vx_current_xid();
6200 + vxd_assert(filp->f_xid == fl->fl_xid,
6201 + "f_xid(%d) == fl_xid(%d)", filp->f_xid, fl->fl_xid);
6203 error = lease_init(filp, type, fl);
6205 locks_free_lock(fl);
6206 @@ -770,6 +788,7 @@ static int flock_lock_file(struct file *
6210 + new_fl->fl_xid = -1;
6212 for_each_lock(inode, before) {
6213 struct file_lock *fl = *before;
6214 @@ -790,6 +809,7 @@ find_conflict:
6216 locks_copy_lock(new_fl, request);
6217 locks_insert_lock(before, new_fl);
6218 + vx_locks_inc(new_fl);
6222 @@ -800,7 +820,8 @@ out:
6226 -static int __posix_lock_file(struct inode *inode, struct file_lock *request, struct file_lock *conflock)
6227 +static int __posix_lock_file(struct inode *inode, struct file_lock *request,
6228 + struct file_lock *conflock, xid_t xid)
6230 struct file_lock *fl;
6231 struct file_lock *new_fl = NULL;
6232 @@ -810,6 +831,8 @@ static int __posix_lock_file(struct inod
6233 struct file_lock **before;
6234 int error, added = 0;
6236 + vxd_assert(xid == vx_current_xid(),
6237 + "xid(%d) == current(%d)", xid, vx_current_xid());
6239 * We may need two file_lock structures for this operation,
6240 * so we get them in advance to avoid races.
6241 @@ -820,7 +843,11 @@ static int __posix_lock_file(struct inod
6242 (request->fl_type != F_UNLCK ||
6243 request->fl_start != 0 || request->fl_end != OFFSET_MAX)) {
6244 new_fl = locks_alloc_lock();
6245 + new_fl->fl_xid = xid;
6246 + vx_locks_inc(new_fl);
6247 new_fl2 = locks_alloc_lock();
6248 + new_fl2->fl_xid = xid;
6249 + vx_locks_inc(new_fl2);
6253 @@ -1019,7 +1046,8 @@ static int __posix_lock_file(struct inod
6254 int posix_lock_file(struct file *filp, struct file_lock *fl,
6255 struct file_lock *conflock)
6257 - return __posix_lock_file(filp->f_path.dentry->d_inode, fl, conflock);
6258 + return __posix_lock_file(filp->f_path.dentry->d_inode,
6259 + fl, conflock, filp->f_xid);
6261 EXPORT_SYMBOL(posix_lock_file);
6263 @@ -1109,7 +1137,7 @@ int locks_mandatory_area(int read_write,
6264 fl.fl_end = offset + count - 1;
6267 - error = __posix_lock_file(inode, &fl, NULL);
6268 + error = __posix_lock_file(inode, &fl, NULL, filp->f_xid);
6269 if (error != FILE_LOCK_DEFERRED)
6271 error = wait_event_interruptible(fl.fl_wait, !fl.fl_next);
6272 @@ -1425,6 +1453,7 @@ int generic_setlease(struct file *filp,
6274 locks_copy_lock(new_fl, lease);
6275 locks_insert_lock(before, new_fl);
6276 + vx_locks_inc(new_fl);
6280 @@ -1780,6 +1809,11 @@ int fcntl_setlk(unsigned int fd, struct
6281 if (file_lock == NULL)
6284 + vxd_assert(filp->f_xid == vx_current_xid(),
6285 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6286 + file_lock->fl_xid = filp->f_xid;
6287 + vx_locks_inc(file_lock);
6290 * This might block, so we do it before checking the inode.
6292 @@ -1898,6 +1932,11 @@ int fcntl_setlk64(unsigned int fd, struc
6293 if (file_lock == NULL)
6296 + vxd_assert(filp->f_xid == vx_current_xid(),
6297 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6298 + file_lock->fl_xid = filp->f_xid;
6299 + vx_locks_inc(file_lock);
6302 * This might block, so we do it before checking the inode.
6304 @@ -2163,8 +2202,11 @@ static int locks_show(struct seq_file *f
6306 lock_get_status(f, fl, (long)f->private, "");
6308 - list_for_each_entry(bfl, &fl->fl_block, fl_block)
6309 + list_for_each_entry(bfl, &fl->fl_block, fl_block) {
6310 + if (!vx_check(fl->fl_xid, VS_WATCH_P | VS_IDENT))
6312 lock_get_status(f, bfl, (long)f->private, " ->");
6317 diff -NurpP --minimal linux-2.6.35.2/fs/namei.c linux-2.6.35.2-vs2.3.0.36.31/fs/namei.c
6318 --- linux-2.6.35.2/fs/namei.c 2010-08-02 16:52:50.000000000 +0200
6319 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/namei.c 2010-08-14 17:03:20.000000000 +0200
6321 #include <linux/fcntl.h>
6322 #include <linux/device_cgroup.h>
6323 #include <linux/fs_struct.h>
6324 +#include <linux/proc_fs.h>
6325 +#include <linux/vserver/inode.h>
6326 +#include <linux/vs_base.h>
6327 +#include <linux/vs_tag.h>
6328 +#include <linux/vs_cowbl.h>
6329 +#include <linux/vs_device.h>
6330 +#include <linux/vs_context.h>
6331 +#include <linux/pid_namespace.h>
6332 #include <asm/uaccess.h>
6334 #include "internal.h"
6335 @@ -166,6 +174,77 @@ void putname(const char *name)
6336 EXPORT_SYMBOL(putname);
6339 +static inline int dx_barrier(const struct inode *inode)
6341 + if (IS_BARRIER(inode) && !vx_check(0, VS_ADMIN | VS_WATCH)) {
6342 + vxwprintk_task(1, "did hit the barrier.");
6348 +static int __dx_permission(const struct inode *inode, int mask)
6350 + if (dx_barrier(inode))
6353 + if (inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC) {
6354 + /* devpts is xid tagged */
6355 + if (S_ISDIR(inode->i_mode) ||
6356 + vx_check((xid_t)inode->i_tag, VS_IDENT | VS_WATCH_P))
6359 + else if (inode->i_sb->s_magic == PROC_SUPER_MAGIC) {
6360 + struct proc_dir_entry *de = PDE(inode);
6362 + if (de && !vx_hide_check(0, de->vx_flags))
6365 + if ((mask & (MAY_WRITE | MAY_APPEND))) {
6367 + struct task_struct *tsk;
6369 + if (vx_check(0, VS_ADMIN | VS_WATCH_P) ||
6370 + vx_flags(VXF_STATE_SETUP, 0))
6373 + pid = PROC_I(inode)->pid;
6377 + tsk = pid_task(pid, PIDTYPE_PID);
6378 + vxdprintk(VXD_CBIT(tag, 0), "accessing %p[#%u]",
6379 + tsk, (tsk ? vx_task_xid(tsk) : 0));
6380 + if (tsk && vx_check(vx_task_xid(tsk), VS_IDENT | VS_WATCH_P))
6384 + /* FIXME: Should we block some entries here? */
6389 + if (dx_notagcheck(inode->i_sb) ||
6390 + dx_check(inode->i_tag, DX_HOSTID | DX_ADMIN | DX_WATCH |
6399 +int dx_permission(const struct inode *inode, int mask)
6401 + int ret = __dx_permission(inode, mask);
6402 + if (unlikely(ret)) {
6403 + vxwprintk_task(1, "denied %x access to %s:%p[#%d,%lu]",
6404 + mask, inode->i_sb->s_id, inode, inode->i_tag,
6411 * This does basic POSIX ACL permission checking
6413 @@ -266,10 +345,14 @@ int inode_permission(struct inode *inode
6415 * Nobody gets write access to an immutable file.
6417 - if (IS_IMMUTABLE(inode))
6418 + if (IS_IMMUTABLE(inode) && !IS_COW(inode))
6422 + retval = dx_permission(inode, mask);
6426 if (inode->i_op->permission)
6427 retval = inode->i_op->permission(inode, mask);
6429 @@ -464,6 +547,9 @@ static int exec_permission(struct inode
6433 + if (dx_barrier(inode))
6436 if (inode->i_op->permission) {
6437 ret = inode->i_op->permission(inode, MAY_EXEC);
6439 @@ -677,7 +763,8 @@ static __always_inline void follow_dotdo
6441 if (nd->path.dentry == nd->root.dentry &&
6442 nd->path.mnt == nd->root.mnt) {
6444 + /* for sane '/' avoid follow_mount() */
6447 if (nd->path.dentry != nd->path.mnt->mnt_root) {
6448 /* rare case of legitimate dget_parent()... */
6449 @@ -701,7 +788,7 @@ static int do_lookup(struct nameidata *n
6451 struct vfsmount *mnt = nd->path.mnt;
6452 struct dentry *dentry, *parent;
6453 - struct inode *dir;
6454 + struct inode *dir, *inode;
6456 * See if the low-level filesystem might want
6457 * to use its own hash..
6458 @@ -717,12 +804,26 @@ static int do_lookup(struct nameidata *n
6460 if (dentry->d_op && dentry->d_op->d_revalidate)
6461 goto need_revalidate;
6463 + inode = dentry->d_inode;
6467 + if (__dx_permission(inode, MAY_ACCESS))
6471 path->dentry = dentry;
6472 __follow_mount(path);
6476 + vxwprintk_task(1, "did lookup hidden %s:%p[#%d,%lu] »%s/%.*s«.",
6477 + inode->i_sb->s_id, inode, inode->i_tag, inode->i_ino,
6478 + vxd_path(&nd->path), name->len, name->name);
6483 parent = nd->path.dentry;
6484 dir = parent->d_inode;
6485 @@ -1326,7 +1427,7 @@ static int may_delete(struct inode *dir,
6488 if (check_sticky(dir, victim->d_inode)||IS_APPEND(victim->d_inode)||
6489 - IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode))
6490 + IS_IXORUNLINK(victim->d_inode) || IS_SWAPFILE(victim->d_inode))
6493 if (!S_ISDIR(victim->d_inode->i_mode))
6494 @@ -1449,6 +1550,14 @@ int may_open(struct path *path, int acc_
6498 +#ifdef CONFIG_VSERVER_COWBL
6499 + if (IS_COW(inode) && (flag & FMODE_WRITE)) {
6500 + if (IS_COW_LINK(inode))
6502 + inode->i_flags &= ~(S_IXUNLINK|S_IMMUTABLE);
6503 + mark_inode_dirty(inode);
6506 error = inode_permission(inode, acc_mode);
6509 @@ -1558,7 +1667,8 @@ static int open_will_truncate(int flag,
6512 static struct file *finish_open(struct nameidata *nd,
6513 - int open_flag, int acc_mode)
6514 + int open_flag, int acc_mode,
6515 + const char *pathname)
6519 @@ -1571,6 +1681,23 @@ static struct file *finish_open(struct n
6522 error = may_open(&nd->path, acc_mode, open_flag);
6523 +#ifdef CONFIG_VSERVER_COWBL
6524 + if (error == -EMLINK) {
6525 + struct dentry *dentry;
6526 + dentry = cow_break_link(pathname);
6527 + if (IS_ERR(dentry)) {
6528 + error = PTR_ERR(dentry);
6532 + if (will_truncate)
6533 + mnt_drop_write(nd->path.mnt);
6534 + release_open_intent(nd);
6535 + path_put(&nd->path);
6536 + return ERR_PTR(-EMLINK);
6542 mnt_drop_write(nd->path.mnt);
6543 @@ -1739,7 +1866,7 @@ static struct file *do_last(struct namei
6544 if (S_ISDIR(path->dentry->d_inode->i_mode))
6547 - filp = finish_open(nd, open_flag, acc_mode);
6548 + filp = finish_open(nd, open_flag, acc_mode, pathname);
6552 @@ -1768,7 +1895,11 @@ struct file *do_filp_open(int dfd, const
6554 int flag = open_to_namei_flags(open_flag);
6555 int force_reval = 0;
6557 +#ifdef CONFIG_VSERVER_COWBL
6562 if (!(open_flag & O_CREAT))
6565 @@ -1834,6 +1965,13 @@ reval:
6566 if (!(open_flag & O_NOFOLLOW))
6567 nd.flags |= LOOKUP_FOLLOW;
6568 filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
6569 +#ifdef CONFIG_VSERVER_COWBL
6570 + if (unlikely(IS_ERR(filp) && PTR_ERR(filp) == -EMLINK)) {
6576 while (unlikely(!filp)) { /* trailing symlink */
6578 struct inode *inode = path.dentry->d_inode;
6579 @@ -1872,6 +2010,13 @@ reval:
6581 nd.flags &= ~LOOKUP_PARENT;
6582 filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
6583 +#ifdef CONFIG_VSERVER_COWBL
6584 + if (unlikely(IS_ERR(filp) && PTR_ERR(filp) == -EMLINK)) {
6590 if (inode->i_op->put_link)
6591 inode->i_op->put_link(holder.dentry, &nd, cookie);
6593 @@ -1972,9 +2117,17 @@ int vfs_mknod(struct inode *dir, struct
6597 - if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
6598 + if (!(S_ISCHR(mode) || S_ISBLK(mode)))
6601 + if (!capable(CAP_MKNOD))
6604 + if (S_ISCHR(mode) && !vs_chrdev_perm(dev, DATTR_CREATE))
6606 + if (S_ISBLK(mode) && !vs_blkdev_perm(dev, DATTR_CREATE))
6609 if (!dir->i_op->mknod)
6612 @@ -2439,7 +2592,7 @@ int vfs_link(struct dentry *old_dentry,
6614 * A link to an append-only or immutable file cannot be created.
6616 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
6617 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
6619 if (!dir->i_op->link)
6621 @@ -2811,6 +2964,219 @@ int vfs_follow_link(struct nameidata *nd
6622 return __vfs_follow_link(nd, link);
6626 +#ifdef CONFIG_VSERVER_COWBL
6628 +#include <linux/file.h>
6631 +long do_cow_splice(struct file *in, struct file *out, size_t len)
6635 + return do_splice_direct(in, &ppos, out, len, 0);
6638 +struct dentry *cow_break_link(const char *pathname)
6640 + int ret, mode, pathlen, redo = 0;
6641 + struct nameidata old_nd, dir_nd;
6642 + struct path old_path, new_path;
6643 + struct dentry *dir, *res = NULL;
6644 + struct file *old_file;
6645 + struct file *new_file;
6646 + char *to, *path, pad='\251';
6649 + vxdprintk(VXD_CBIT(misc, 1), "cow_break_link(»%s«)", pathname);
6650 + path = kmalloc(PATH_MAX, GFP_KERNEL);
6655 + /* old_nd will have refs to dentry and mnt */
6656 + ret = path_lookup(pathname, LOOKUP_FOLLOW, &old_nd);
6657 + vxdprintk(VXD_CBIT(misc, 2), "path_lookup(old): %d", ret);
6659 + goto out_free_path;
6661 + old_path = old_nd.path;
6662 + mode = old_path.dentry->d_inode->i_mode;
6664 + to = d_path(&old_path, path, PATH_MAX-2);
6665 + pathlen = strlen(to);
6666 + vxdprintk(VXD_CBIT(misc, 2), "old path »%s« [»%.*s«:%d]", to,
6667 + old_path.dentry->d_name.len, old_path.dentry->d_name.name,
6668 + old_path.dentry->d_name.len);
6670 + to[pathlen + 1] = 0;
6672 + to[pathlen] = pad--;
6674 + if (pad <= '\240')
6677 + vxdprintk(VXD_CBIT(misc, 1), "temp copy »%s«", to);
6678 + /* dir_nd will have refs to dentry and mnt */
6679 + ret = path_lookup(to,
6680 + LOOKUP_PARENT | LOOKUP_OPEN | LOOKUP_CREATE, &dir_nd);
6681 + vxdprintk(VXD_CBIT(misc, 2),
6682 + "path_lookup(new): %d", ret);
6686 + /* this puppy downs the inode mutex */
6687 + new_path.dentry = lookup_create(&dir_nd, 0);
6688 + if (!new_path.dentry || IS_ERR(new_path.dentry)) {
6689 + vxdprintk(VXD_CBIT(misc, 2),
6690 + "lookup_create(new): %p", new_path.dentry);
6691 + mutex_unlock(&dir_nd.path.dentry->d_inode->i_mutex);
6692 + path_put(&dir_nd.path);
6695 + vxdprintk(VXD_CBIT(misc, 2),
6696 + "lookup_create(new): %p [»%.*s«:%d]", new_path.dentry,
6697 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
6698 + new_path.dentry->d_name.len);
6699 + dir = dir_nd.path.dentry;
6701 + ret = vfs_create(dir_nd.path.dentry->d_inode, new_path.dentry, mode, &dir_nd);
6702 + vxdprintk(VXD_CBIT(misc, 2),
6703 + "vfs_create(new): %d", ret);
6704 + if (ret == -EEXIST) {
6705 + mutex_unlock(&dir->d_inode->i_mutex);
6706 + dput(new_path.dentry);
6707 + path_put(&dir_nd.path);
6711 + goto out_unlock_new;
6713 + /* drop out early, ret passes ENOENT */
6715 + if ((redo = d_unhashed(old_path.dentry)))
6716 + goto out_unlock_new;
6718 + new_path.mnt = dir_nd.path.mnt;
6719 + dget(old_path.dentry);
6720 + mntget(old_path.mnt);
6721 + /* this one cleans up the dentry/mnt in case of failure */
6722 + old_file = dentry_open(old_path.dentry, old_path.mnt,
6723 + O_RDONLY, current_cred());
6724 + vxdprintk(VXD_CBIT(misc, 2),
6725 + "dentry_open(old): %p", old_file);
6726 + if (!old_file || IS_ERR(old_file)) {
6727 + res = IS_ERR(old_file) ? (void *) old_file : res;
6728 + goto out_unlock_new;
6731 + dget(new_path.dentry);
6732 + mntget(new_path.mnt);
6733 + /* this one cleans up the dentry/mnt in case of failure */
6734 + new_file = dentry_open(new_path.dentry, new_path.mnt,
6735 + O_WRONLY, current_cred());
6736 + vxdprintk(VXD_CBIT(misc, 2),
6737 + "dentry_open(new): %p", new_file);
6739 + ret = IS_ERR(new_file) ? PTR_ERR(new_file) : -ENOENT;
6740 + if (!new_file || IS_ERR(new_file))
6741 + goto out_fput_old;
6743 + size = i_size_read(old_file->f_dentry->d_inode);
6744 + ret = do_cow_splice(old_file, new_file, size);
6745 + vxdprintk(VXD_CBIT(misc, 2), "do_splice_direct: %d", ret);
6747 + goto out_fput_both;
6748 + } else if (ret < size) {
6750 + goto out_fput_both;
6752 + struct inode *old_inode = old_path.dentry->d_inode;
6753 + struct inode *new_inode = new_path.dentry->d_inode;
6754 + struct iattr attr = {
6755 + .ia_uid = old_inode->i_uid,
6756 + .ia_gid = old_inode->i_gid,
6757 + .ia_valid = ATTR_UID | ATTR_GID
6760 + ret = inode_setattr(new_inode, &attr);
6762 + goto out_fput_both;
6765 + mutex_lock(&old_path.dentry->d_inode->i_sb->s_vfs_rename_mutex);
6767 + /* drop out late */
6769 + if ((redo = d_unhashed(old_path.dentry)))
6772 + vxdprintk(VXD_CBIT(misc, 2),
6773 + "vfs_rename: [»%*s«:%d] -> [»%*s«:%d]",
6774 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
6775 + new_path.dentry->d_name.len,
6776 + old_path.dentry->d_name.len, old_path.dentry->d_name.name,
6777 + old_path.dentry->d_name.len);
6778 + ret = vfs_rename(dir_nd.path.dentry->d_inode, new_path.dentry,
6779 + old_nd.path.dentry->d_parent->d_inode, old_path.dentry);
6780 + vxdprintk(VXD_CBIT(misc, 2), "vfs_rename: %d", ret);
6781 + res = new_path.dentry;
6784 + mutex_unlock(&old_path.dentry->d_inode->i_sb->s_vfs_rename_mutex);
6787 + vxdprintk(VXD_CBIT(misc, 3),
6788 + "fput(new_file=%p[#%ld])", new_file,
6789 + atomic_long_read(&new_file->f_count));
6793 + vxdprintk(VXD_CBIT(misc, 3),
6794 + "fput(old_file=%p[#%ld])", old_file,
6795 + atomic_long_read(&old_file->f_count));
6799 + mutex_unlock(&dir->d_inode->i_mutex);
6803 + /* error path cleanup */
6804 + vfs_unlink(dir->d_inode, new_path.dentry);
6805 + dput(new_path.dentry);
6809 + goto out_rel_both;
6810 + /* lookup dentry once again */
6811 + path_put(&old_nd.path);
6812 + ret = path_lookup(pathname, LOOKUP_FOLLOW, &old_nd);
6814 + goto out_rel_both;
6816 + new_path.dentry = old_nd.path.dentry;
6817 + vxdprintk(VXD_CBIT(misc, 2),
6818 + "path_lookup(redo): %p [»%.*s«:%d]", new_path.dentry,
6819 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
6820 + new_path.dentry->d_name.len);
6821 + dget(new_path.dentry);
6822 + res = new_path.dentry;
6825 + path_put(&dir_nd.path);
6827 + path_put(&old_nd.path);
6832 + res = ERR_PTR(ret);
6838 /* get the link contents into pagecache */
6839 static char *page_getlink(struct dentry * dentry, struct page **ppage)
6841 diff -NurpP --minimal linux-2.6.35.2/fs/namespace.c linux-2.6.35.2-vs2.3.0.36.31/fs/namespace.c
6842 --- linux-2.6.35.2/fs/namespace.c 2010-08-14 18:16:59.000000000 +0200
6843 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/namespace.c 2010-08-14 18:21:13.000000000 +0200
6845 #include <linux/log2.h>
6846 #include <linux/idr.h>
6847 #include <linux/fs_struct.h>
6848 +#include <linux/vs_base.h>
6849 +#include <linux/vs_context.h>
6850 +#include <linux/vs_tag.h>
6851 +#include <linux/vserver/space.h>
6852 +#include <linux/vserver/global.h>
6853 #include <asm/uaccess.h>
6854 #include <asm/unistd.h>
6856 @@ -567,6 +572,7 @@ static struct vfsmount *clone_mnt(struct
6857 mnt->mnt_root = dget(root);
6858 mnt->mnt_mountpoint = mnt->mnt_root;
6859 mnt->mnt_parent = mnt;
6860 + mnt->mnt_tag = old->mnt_tag;
6862 if (flag & CL_SLAVE) {
6863 list_add(&mnt->mnt_slave, &old->mnt_slave_list);
6864 @@ -660,6 +666,31 @@ static inline void mangle(struct seq_fil
6865 seq_escape(m, s, " \t\n\\");
6868 +static int mnt_is_reachable(struct vfsmount *mnt)
6871 + struct dentry *point;
6874 + if (mnt == mnt->mnt_ns->root)
6877 + spin_lock(&vfsmount_lock);
6878 + root = current->fs->root;
6879 + point = root.dentry;
6881 + while ((mnt != mnt->mnt_parent) && (mnt != root.mnt)) {
6882 + point = mnt->mnt_mountpoint;
6883 + mnt = mnt->mnt_parent;
6886 + ret = (mnt == root.mnt) && is_subdir(point, root.dentry);
6888 + spin_unlock(&vfsmount_lock);
6894 * Simple .show_options callback for filesystems which don't want to
6895 * implement more complex mount option showing.
6896 @@ -762,6 +793,8 @@ static int show_sb_opts(struct seq_file
6897 { MS_SYNCHRONOUS, ",sync" },
6898 { MS_DIRSYNC, ",dirsync" },
6899 { MS_MANDLOCK, ",mand" },
6900 + { MS_TAGGED, ",tag" },
6901 + { MS_NOTAGCHECK, ",notagcheck" },
6904 const struct proc_fs_info *fs_infop;
6905 @@ -809,10 +842,20 @@ static int show_vfsmnt(struct seq_file *
6907 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
6909 - mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
6911 - seq_path(m, &mnt_path, " \t\n\\");
6913 + if (vx_flags(VXF_HIDE_MOUNT, 0))
6915 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
6918 + if (!vx_check(0, VS_ADMIN|VS_WATCH) &&
6919 + mnt == current->fs->root.mnt) {
6920 + seq_puts(m, "/dev/root / ");
6922 + mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
6924 + seq_path(m, &mnt_path, " \t\n\\");
6927 show_type(m, mnt->mnt_sb);
6928 seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
6929 err = show_sb_opts(m, mnt->mnt_sb);
6930 @@ -842,6 +885,11 @@ static int show_mountinfo(struct seq_fil
6931 struct path root = p->root;
6934 + if (vx_flags(VXF_HIDE_MOUNT, 0))
6936 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
6939 seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id,
6940 MAJOR(sb->s_dev), MINOR(sb->s_dev));
6941 seq_dentry(m, mnt->mnt_root, " \t\n\\");
6942 @@ -900,17 +948,27 @@ static int show_vfsstat(struct seq_file
6943 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
6947 - if (mnt->mnt_devname) {
6948 - seq_puts(m, "device ");
6949 - mangle(m, mnt->mnt_devname);
6951 - seq_puts(m, "no device");
6952 + if (vx_flags(VXF_HIDE_MOUNT, 0))
6954 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
6958 - seq_puts(m, " mounted on ");
6959 - seq_path(m, &mnt_path, " \t\n\\");
6961 + if (!vx_check(0, VS_ADMIN|VS_WATCH) &&
6962 + mnt == current->fs->root.mnt) {
6963 + seq_puts(m, "device /dev/root mounted on / ");
6966 + if (mnt->mnt_devname) {
6967 + seq_puts(m, "device ");
6968 + mangle(m, mnt->mnt_devname);
6970 + seq_puts(m, "no device");
6973 + seq_puts(m, " mounted on ");
6974 + seq_path(m, &mnt_path, " \t\n\\");
6978 /* file system type */
6979 seq_puts(m, "with fstype ");
6980 @@ -1151,7 +1209,7 @@ SYSCALL_DEFINE2(umount, char __user *, n
6984 - if (!capable(CAP_SYS_ADMIN))
6985 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
6988 retval = do_umount(path.mnt, flags);
6989 @@ -1177,7 +1235,7 @@ SYSCALL_DEFINE1(oldumount, char __user *
6991 static int mount_is_safe(struct path *path)
6993 - if (capable(CAP_SYS_ADMIN))
6994 + if (vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
6998 @@ -1449,7 +1507,7 @@ static int do_change_type(struct path *p
6999 int type = flag & ~MS_REC;
7002 - if (!capable(CAP_SYS_ADMIN))
7003 + if (!vx_capable(CAP_SYS_ADMIN, VXC_NAMESPACE))
7006 if (path->dentry != path->mnt->mnt_root)
7007 @@ -1476,11 +1534,13 @@ static int do_change_type(struct path *p
7008 * do loopback mount.
7010 static int do_loopback(struct path *path, char *old_name,
7012 + tag_t tag, unsigned long flags, int mnt_flags)
7014 struct path old_path;
7015 struct vfsmount *mnt = NULL;
7016 int err = mount_is_safe(path);
7017 + int recurse = flags & MS_REC;
7021 if (!old_name || !*old_name)
7022 @@ -1514,6 +1574,7 @@ static int do_loopback(struct path *path
7023 spin_unlock(&vfsmount_lock);
7024 release_mounts(&umount_list);
7026 + mnt->mnt_flags = mnt_flags;
7029 up_write(&namespace_sem);
7030 @@ -1544,12 +1605,12 @@ static int change_mount_flags(struct vfs
7031 * on it - tough luck.
7033 static int do_remount(struct path *path, int flags, int mnt_flags,
7035 + void *data, xid_t xid)
7038 struct super_block *sb = path->mnt->mnt_sb;
7040 - if (!capable(CAP_SYS_ADMIN))
7041 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_REMOUNT))
7044 if (!check_mnt(path->mnt))
7045 @@ -1593,7 +1654,7 @@ static int do_move_mount(struct path *pa
7046 struct path old_path, parent_path;
7049 - if (!capable(CAP_SYS_ADMIN))
7050 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7052 if (!old_name || !*old_name)
7054 @@ -1675,7 +1736,7 @@ static int do_new_mount(struct path *pat
7057 /* we need capabilities... */
7058 - if (!capable(CAP_SYS_ADMIN))
7059 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7063 @@ -1941,6 +2002,7 @@ long do_mount(char *dev_name, char *dir_
7070 if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
7071 @@ -1968,6 +2030,12 @@ long do_mount(char *dev_name, char *dir_
7072 if (!(flags & MS_NOATIME))
7073 mnt_flags |= MNT_RELATIME;
7075 + if (dx_parse_tag(data_page, &tag, 1, &mnt_flags, &flags)) {
7076 + /* FIXME: bind and re-mounts get the tag flag? */
7077 + if (flags & (MS_BIND|MS_REMOUNT))
7078 + flags |= MS_TAGID;
7081 /* Separate the per-mountpoint flags */
7082 if (flags & MS_NOSUID)
7083 mnt_flags |= MNT_NOSUID;
7084 @@ -1984,15 +2052,17 @@ long do_mount(char *dev_name, char *dir_
7085 if (flags & MS_RDONLY)
7086 mnt_flags |= MNT_READONLY;
7088 + if (!capable(CAP_SYS_ADMIN))
7089 + mnt_flags |= MNT_NODEV;
7090 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE | MS_BORN |
7091 MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
7094 if (flags & MS_REMOUNT)
7095 retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
7098 else if (flags & MS_BIND)
7099 - retval = do_loopback(&path, dev_name, flags & MS_REC);
7100 + retval = do_loopback(&path, dev_name, tag, flags, mnt_flags);
7101 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
7102 retval = do_change_type(&path, flags);
7103 else if (flags & MS_MOVE)
7104 @@ -2071,6 +2141,7 @@ static struct mnt_namespace *dup_mnt_ns(
7105 q = next_mnt(q, new_ns->root);
7107 up_write(&namespace_sem);
7108 + atomic_inc(&vs_global_mnt_ns);
7112 @@ -2215,9 +2286,10 @@ SYSCALL_DEFINE2(pivot_root, const char _
7113 down_write(&namespace_sem);
7114 mutex_lock(&old.dentry->d_inode->i_mutex);
7116 - if (IS_MNT_SHARED(old.mnt) ||
7117 + if ((IS_MNT_SHARED(old.mnt) ||
7118 IS_MNT_SHARED(new.mnt->mnt_parent) ||
7119 - IS_MNT_SHARED(root.mnt->mnt_parent))
7120 + IS_MNT_SHARED(root.mnt->mnt_parent)) &&
7121 + !vx_flags(VXF_STATE_SETUP, 0))
7123 if (!check_mnt(root.mnt))
7125 @@ -2348,6 +2420,7 @@ void put_mnt_ns(struct mnt_namespace *ns
7126 spin_unlock(&vfsmount_lock);
7127 up_write(&namespace_sem);
7128 release_mounts(&umount_list);
7129 + atomic_dec(&vs_global_mnt_ns);
7132 EXPORT_SYMBOL(put_mnt_ns);
7133 diff -NurpP --minimal linux-2.6.35.2/fs/nfs/client.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/client.c
7134 --- linux-2.6.35.2/fs/nfs/client.c 2010-08-02 16:52:50.000000000 +0200
7135 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/client.c 2010-08-02 17:05:06.000000000 +0200
7136 @@ -739,6 +739,9 @@ static int nfs_init_server_rpcclient(str
7137 if (server->flags & NFS_MOUNT_SOFT)
7138 server->client->cl_softrtry = 1;
7140 + server->client->cl_tag = 0;
7141 + if (server->flags & NFS_MOUNT_TAGGED)
7142 + server->client->cl_tag = 1;
7146 @@ -910,6 +913,10 @@ static void nfs_server_set_fsinfo(struct
7147 server->acdirmin = server->acdirmax = 0;
7150 + /* FIXME: needs fsinfo
7151 + if (server->flags & NFS_MOUNT_TAGGED)
7152 + sb->s_flags |= MS_TAGGED; */
7154 server->maxfilesize = fsinfo->maxfilesize;
7156 /* We're airborne Set socket buffersize */
7157 diff -NurpP --minimal linux-2.6.35.2/fs/nfs/dir.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/dir.c
7158 --- linux-2.6.35.2/fs/nfs/dir.c 2010-08-02 16:52:50.000000000 +0200
7159 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/dir.c 2010-08-02 17:05:06.000000000 +0200
7161 #include <linux/namei.h>
7162 #include <linux/mount.h>
7163 #include <linux/sched.h>
7164 +#include <linux/vs_tag.h>
7166 #include "nfs4_fs.h"
7167 #include "delegation.h"
7168 @@ -979,6 +980,7 @@ static struct dentry *nfs_lookup(struct
7170 goto out_unblock_sillyrename;
7172 + dx_propagate_tag(nd, inode);
7174 res = d_materialise_unique(dentry, inode);
7176 diff -NurpP --minimal linux-2.6.35.2/fs/nfs/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/inode.c
7177 --- linux-2.6.35.2/fs/nfs/inode.c 2010-08-02 16:52:50.000000000 +0200
7178 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/inode.c 2010-08-02 17:05:06.000000000 +0200
7180 #include <linux/inet.h>
7181 #include <linux/nfs_xdr.h>
7182 #include <linux/slab.h>
7183 +#include <linux/vs_tag.h>
7185 #include <asm/system.h>
7186 #include <asm/uaccess.h>
7187 @@ -260,6 +261,8 @@ nfs_fhget(struct super_block *sb, struct
7188 if (inode->i_state & I_NEW) {
7189 struct nfs_inode *nfsi = NFS_I(inode);
7190 unsigned long now = jiffies;
7194 /* We set i_ino for the few things that still rely on it,
7195 * such as stat(2) */
7196 @@ -308,8 +311,8 @@ nfs_fhget(struct super_block *sb, struct
7197 nfsi->change_attr = 0;
7200 - inode->i_uid = -2;
7201 - inode->i_gid = -2;
7204 inode->i_blocks = 0;
7205 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
7207 @@ -346,13 +349,13 @@ nfs_fhget(struct super_block *sb, struct
7208 else if (nfs_server_capable(inode, NFS_CAP_NLINK))
7209 nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
7210 if (fattr->valid & NFS_ATTR_FATTR_OWNER)
7211 - inode->i_uid = fattr->uid;
7213 else if (nfs_server_capable(inode, NFS_CAP_OWNER))
7214 nfsi->cache_validity |= NFS_INO_INVALID_ATTR
7215 | NFS_INO_INVALID_ACCESS
7216 | NFS_INO_INVALID_ACL;
7217 if (fattr->valid & NFS_ATTR_FATTR_GROUP)
7218 - inode->i_gid = fattr->gid;
7220 else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP))
7221 nfsi->cache_validity |= NFS_INO_INVALID_ATTR
7222 | NFS_INO_INVALID_ACCESS
7223 @@ -365,6 +368,11 @@ nfs_fhget(struct super_block *sb, struct
7225 inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used);
7227 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
7228 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
7229 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid, 0);
7230 + /* maybe fattr->xid someday */
7232 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
7233 nfsi->attrtimeo_timestamp = now;
7234 nfsi->access_cache = RB_ROOT;
7235 @@ -483,6 +491,8 @@ void nfs_setattr_update_inode(struct ino
7236 inode->i_uid = attr->ia_uid;
7237 if ((attr->ia_valid & ATTR_GID) != 0)
7238 inode->i_gid = attr->ia_gid;
7239 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
7240 + inode->i_tag = attr->ia_tag;
7241 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7242 spin_unlock(&inode->i_lock);
7244 @@ -856,6 +866,9 @@ static int nfs_check_inode_attributes(st
7245 struct nfs_inode *nfsi = NFS_I(inode);
7246 loff_t cur_size, new_isize;
7247 unsigned long invalid = 0;
7253 /* Has the inode gone and changed behind our back? */
7254 @@ -879,13 +892,18 @@ static int nfs_check_inode_attributes(st
7255 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
7258 + uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
7259 + gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
7260 + tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
7262 /* Have any file permissions changed? */
7263 if ((fattr->valid & NFS_ATTR_FATTR_MODE) && (inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO))
7264 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7265 - if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && inode->i_uid != fattr->uid)
7266 + if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && uid != fattr->uid)
7267 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7268 - if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && inode->i_gid != fattr->gid)
7269 + if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && gid != fattr->gid)
7270 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7271 + /* maybe check for tag too? */
7273 /* Has the link count changed? */
7274 if ((fattr->valid & NFS_ATTR_FATTR_NLINK) && inode->i_nlink != fattr->nlink)
7275 @@ -1120,6 +1138,9 @@ static int nfs_update_inode(struct inode
7276 unsigned long invalid = 0;
7277 unsigned long now = jiffies;
7278 unsigned long save_cache_validity;
7283 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n",
7284 __func__, inode->i_sb->s_id, inode->i_ino,
7285 @@ -1222,6 +1243,9 @@ static int nfs_update_inode(struct inode
7286 | NFS_INO_REVAL_PAGECACHE
7287 | NFS_INO_REVAL_FORCED);
7289 + uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
7290 + gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
7291 + tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
7293 if (fattr->valid & NFS_ATTR_FATTR_ATIME)
7294 memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
7295 @@ -1243,9 +1267,9 @@ static int nfs_update_inode(struct inode
7296 | NFS_INO_REVAL_FORCED);
7298 if (fattr->valid & NFS_ATTR_FATTR_OWNER) {
7299 - if (inode->i_uid != fattr->uid) {
7300 + if (uid != fattr->uid) {
7301 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7302 - inode->i_uid = fattr->uid;
7305 } else if (server->caps & NFS_CAP_OWNER)
7306 invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
7307 @@ -1254,9 +1278,9 @@ static int nfs_update_inode(struct inode
7308 | NFS_INO_REVAL_FORCED);
7310 if (fattr->valid & NFS_ATTR_FATTR_GROUP) {
7311 - if (inode->i_gid != fattr->gid) {
7312 + if (gid != fattr->gid) {
7313 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7314 - inode->i_gid = fattr->gid;
7317 } else if (server->caps & NFS_CAP_OWNER_GROUP)
7318 invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
7319 @@ -1264,6 +1288,10 @@ static int nfs_update_inode(struct inode
7320 | NFS_INO_INVALID_ACL
7321 | NFS_INO_REVAL_FORCED);
7323 + inode->i_uid = uid;
7324 + inode->i_gid = gid;
7325 + inode->i_tag = tag;
7327 if (fattr->valid & NFS_ATTR_FATTR_NLINK) {
7328 if (inode->i_nlink != fattr->nlink) {
7329 invalid |= NFS_INO_INVALID_ATTR;
7330 diff -NurpP --minimal linux-2.6.35.2/fs/nfs/nfs3xdr.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/nfs3xdr.c
7331 --- linux-2.6.35.2/fs/nfs/nfs3xdr.c 2010-08-02 16:52:50.000000000 +0200
7332 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/nfs3xdr.c 2010-08-02 17:05:06.000000000 +0200
7334 #include <linux/nfs3.h>
7335 #include <linux/nfs_fs.h>
7336 #include <linux/nfsacl.h>
7337 +#include <linux/vs_tag.h>
7338 #include "internal.h"
7340 #define NFSDBG_FACILITY NFSDBG_XDR
7341 @@ -175,7 +176,7 @@ xdr_decode_fattr(__be32 *p, struct nfs_f
7344 static inline __be32 *
7345 -xdr_encode_sattr(__be32 *p, struct iattr *attr)
7346 +xdr_encode_sattr(__be32 *p, struct iattr *attr, int tag)
7348 if (attr->ia_valid & ATTR_MODE) {
7350 @@ -183,15 +184,17 @@ xdr_encode_sattr(__be32 *p, struct iattr
7354 - if (attr->ia_valid & ATTR_UID) {
7355 + if (attr->ia_valid & ATTR_UID ||
7356 + (tag && (attr->ia_valid & ATTR_TAG))) {
7358 - *p++ = htonl(attr->ia_uid);
7359 + *p++ = htonl(TAGINO_UID(tag, attr->ia_uid, attr->ia_tag));
7363 - if (attr->ia_valid & ATTR_GID) {
7364 + if (attr->ia_valid & ATTR_GID ||
7365 + (tag && (attr->ia_valid & ATTR_TAG))) {
7367 - *p++ = htonl(attr->ia_gid);
7368 + *p++ = htonl(TAGINO_GID(tag, attr->ia_gid, attr->ia_tag));
7372 @@ -278,7 +281,8 @@ static int
7373 nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args)
7375 p = xdr_encode_fhandle(p, args->fh);
7376 - p = xdr_encode_sattr(p, args->sattr);
7377 + p = xdr_encode_sattr(p, args->sattr,
7378 + req->rq_task->tk_client->cl_tag);
7379 *p++ = htonl(args->guard);
7381 p = xdr_encode_time3(p, &args->guardtime);
7382 @@ -383,7 +387,8 @@ nfs3_xdr_createargs(struct rpc_rqst *req
7383 *p++ = args->verifier[0];
7384 *p++ = args->verifier[1];
7386 - p = xdr_encode_sattr(p, args->sattr);
7387 + p = xdr_encode_sattr(p, args->sattr,
7388 + req->rq_task->tk_client->cl_tag);
7390 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7392 @@ -397,7 +402,8 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req,
7394 p = xdr_encode_fhandle(p, args->fh);
7395 p = xdr_encode_array(p, args->name, args->len);
7396 - p = xdr_encode_sattr(p, args->sattr);
7397 + p = xdr_encode_sattr(p, args->sattr,
7398 + req->rq_task->tk_client->cl_tag);
7399 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7402 @@ -410,7 +416,8 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *re
7404 p = xdr_encode_fhandle(p, args->fromfh);
7405 p = xdr_encode_array(p, args->fromname, args->fromlen);
7406 - p = xdr_encode_sattr(p, args->sattr);
7407 + p = xdr_encode_sattr(p, args->sattr,
7408 + req->rq_task->tk_client->cl_tag);
7409 *p++ = htonl(args->pathlen);
7410 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7412 @@ -428,7 +435,8 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req,
7413 p = xdr_encode_fhandle(p, args->fh);
7414 p = xdr_encode_array(p, args->name, args->len);
7415 *p++ = htonl(args->type);
7416 - p = xdr_encode_sattr(p, args->sattr);
7417 + p = xdr_encode_sattr(p, args->sattr,
7418 + req->rq_task->tk_client->cl_tag);
7419 if (args->type == NF3CHR || args->type == NF3BLK) {
7420 *p++ = htonl(MAJOR(args->rdev));
7421 *p++ = htonl(MINOR(args->rdev));
7422 diff -NurpP --minimal linux-2.6.35.2/fs/nfs/nfsroot.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/nfsroot.c
7423 --- linux-2.6.35.2/fs/nfs/nfsroot.c 2010-08-02 16:52:50.000000000 +0200
7424 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/nfsroot.c 2010-08-02 17:05:06.000000000 +0200
7425 @@ -122,12 +122,12 @@ static int mount_port __initdata = 0; /
7427 /* Options that take integer arguments */
7428 Opt_port, Opt_rsize, Opt_wsize, Opt_timeo, Opt_retrans, Opt_acregmin,
7429 - Opt_acregmax, Opt_acdirmin, Opt_acdirmax,
7430 + Opt_acregmax, Opt_acdirmin, Opt_acdirmax, Opt_tagid,
7431 /* Options that take no arguments */
7432 Opt_soft, Opt_hard, Opt_intr,
7433 Opt_nointr, Opt_posix, Opt_noposix, Opt_cto, Opt_nocto, Opt_ac,
7434 Opt_noac, Opt_lock, Opt_nolock, Opt_v2, Opt_v3, Opt_udp, Opt_tcp,
7435 - Opt_acl, Opt_noacl,
7436 + Opt_acl, Opt_noacl, Opt_tag, Opt_notag,
7440 @@ -164,6 +164,9 @@ static const match_table_t tokens __init
7443 {Opt_noacl, "noacl"},
7445 + {Opt_notag, "notag"},
7446 + {Opt_tagid, "tagid=%u"},
7450 @@ -275,6 +278,20 @@ static int __init root_nfs_parse(char *n
7452 nfs_data.flags |= NFS_MOUNT_NOACL;
7454 +#ifndef CONFIG_TAGGING_NONE
7456 + nfs_data.flags |= NFS_MOUNT_TAGGED;
7459 + nfs_data.flags &= ~NFS_MOUNT_TAGGED;
7462 +#ifdef CONFIG_PROPAGATE
7465 + nfs_data.flags |= NFS_MOUNT_TAGGED;
7469 printk(KERN_WARNING "Root-NFS: unknown "
7471 diff -NurpP --minimal linux-2.6.35.2/fs/nfs/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/super.c
7472 --- linux-2.6.35.2/fs/nfs/super.c 2010-08-02 16:52:50.000000000 +0200
7473 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfs/super.c 2010-08-02 17:05:06.000000000 +0200
7475 #include <linux/nfs_xdr.h>
7476 #include <linux/magic.h>
7477 #include <linux/parser.h>
7478 +#include <linux/vs_tag.h>
7480 #include <asm/system.h>
7481 #include <asm/uaccess.h>
7482 @@ -606,6 +607,7 @@ static void nfs_show_mount_options(struc
7483 { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
7484 { NFS_MOUNT_UNSHARED, ",nosharecache", "" },
7485 { NFS_MOUNT_NORESVPORT, ",noresvport", "" },
7486 + { NFS_MOUNT_TAGGED, ",tag", "" },
7489 const struct proc_nfs_info *nfs_infop;
7490 diff -NurpP --minimal linux-2.6.35.2/fs/nfsd/auth.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfsd/auth.c
7491 --- linux-2.6.35.2/fs/nfsd/auth.c 2010-02-25 11:52:05.000000000 +0100
7492 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfsd/auth.c 2010-08-02 17:05:06.000000000 +0200
7494 /* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */
7496 #include <linux/sched.h>
7497 +#include <linux/vs_tag.h>
7501 @@ -36,6 +37,9 @@ int nfsd_setuser(struct svc_rqst *rqstp,
7503 new->fsuid = rqstp->rq_cred.cr_uid;
7504 new->fsgid = rqstp->rq_cred.cr_gid;
7505 + /* FIXME: this desperately needs a tag :)
7506 + new->xid = (xid_t)INOTAG_TAG(DX_TAG_NFSD, cred.cr_uid, cred.cr_gid, 0);
7509 rqgi = rqstp->rq_cred.cr_group_info;
7511 diff -NurpP --minimal linux-2.6.35.2/fs/nfsd/nfs3xdr.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfsd/nfs3xdr.c
7512 --- linux-2.6.35.2/fs/nfsd/nfs3xdr.c 2010-02-25 11:52:05.000000000 +0100
7513 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfsd/nfs3xdr.c 2010-08-02 17:05:06.000000000 +0200
7517 #include <linux/namei.h>
7518 +#include <linux/vs_tag.h>
7522 @@ -95,6 +96,8 @@ static __be32 *
7523 decode_sattr3(__be32 *p, struct iattr *iap)
7531 @@ -104,12 +107,15 @@ decode_sattr3(__be32 *p, struct iattr *i
7534 iap->ia_valid |= ATTR_UID;
7535 - iap->ia_uid = ntohl(*p++);
7536 + uid = ntohl(*p++);
7539 iap->ia_valid |= ATTR_GID;
7540 - iap->ia_gid = ntohl(*p++);
7541 + gid = ntohl(*p++);
7543 + iap->ia_uid = INOTAG_UID(DX_TAG_NFSD, uid, gid);
7544 + iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid);
7545 + iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0);
7549 @@ -165,8 +171,12 @@ encode_fattr3(struct svc_rqst *rqstp, __
7550 *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
7551 *p++ = htonl((u32) stat->mode);
7552 *p++ = htonl((u32) stat->nlink);
7553 - *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
7554 - *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
7555 + *p++ = htonl((u32) nfsd_ruid(rqstp,
7556 + TAGINO_UID(0 /* FIXME: DX_TAG(dentry->d_inode) */,
7557 + stat->uid, stat->tag)));
7558 + *p++ = htonl((u32) nfsd_rgid(rqstp,
7559 + TAGINO_GID(0 /* FIXME: DX_TAG(dentry->d_inode) */,
7560 + stat->gid, stat->tag)));
7561 if (S_ISLNK(stat->mode) && stat->size > NFS3_MAXPATHLEN) {
7562 p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
7564 diff -NurpP --minimal linux-2.6.35.2/fs/nfsd/nfs4xdr.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfsd/nfs4xdr.c
7565 --- linux-2.6.35.2/fs/nfsd/nfs4xdr.c 2010-08-02 16:52:50.000000000 +0200
7566 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfsd/nfs4xdr.c 2010-08-02 17:05:06.000000000 +0200
7568 #include <linux/nfsd_idmap.h>
7569 #include <linux/nfs4_acl.h>
7570 #include <linux/sunrpc/svcauth_gss.h>
7571 +#include <linux/vs_tag.h>
7575 @@ -2053,14 +2054,18 @@ out_acl:
7576 WRITE32(stat.nlink);
7578 if (bmval1 & FATTR4_WORD1_OWNER) {
7579 - status = nfsd4_encode_user(rqstp, stat.uid, &p, &buflen);
7580 + status = nfsd4_encode_user(rqstp,
7581 + TAGINO_UID(DX_TAG(dentry->d_inode),
7582 + stat.uid, stat.tag), &p, &buflen);
7583 if (status == nfserr_resource)
7588 if (bmval1 & FATTR4_WORD1_OWNER_GROUP) {
7589 - status = nfsd4_encode_group(rqstp, stat.gid, &p, &buflen);
7590 + status = nfsd4_encode_group(rqstp,
7591 + TAGINO_GID(DX_TAG(dentry->d_inode),
7592 + stat.gid, stat.tag), &p, &buflen);
7593 if (status == nfserr_resource)
7596 diff -NurpP --minimal linux-2.6.35.2/fs/nfsd/nfsxdr.c linux-2.6.35.2-vs2.3.0.36.31/fs/nfsd/nfsxdr.c
7597 --- linux-2.6.35.2/fs/nfsd/nfsxdr.c 2010-02-25 11:52:05.000000000 +0100
7598 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/nfsd/nfsxdr.c 2010-08-02 17:05:06.000000000 +0200
7603 +#include <linux/vs_tag.h>
7605 #define NFSDDBG_FACILITY NFSDDBG_XDR
7607 @@ -88,6 +89,8 @@ static __be32 *
7608 decode_sattr(__be32 *p, struct iattr *iap)
7616 @@ -101,12 +104,15 @@ decode_sattr(__be32 *p, struct iattr *ia
7618 if ((tmp = ntohl(*p++)) != (u32)-1) {
7619 iap->ia_valid |= ATTR_UID;
7620 - iap->ia_uid = tmp;
7623 if ((tmp = ntohl(*p++)) != (u32)-1) {
7624 iap->ia_valid |= ATTR_GID;
7625 - iap->ia_gid = tmp;
7628 + iap->ia_uid = INOTAG_UID(DX_TAG_NFSD, uid, gid);
7629 + iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid);
7630 + iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0);
7631 if ((tmp = ntohl(*p++)) != (u32)-1) {
7632 iap->ia_valid |= ATTR_SIZE;
7634 @@ -151,8 +157,10 @@ encode_fattr(struct svc_rqst *rqstp, __b
7635 *p++ = htonl(nfs_ftypes[type >> 12]);
7636 *p++ = htonl((u32) stat->mode);
7637 *p++ = htonl((u32) stat->nlink);
7638 - *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
7639 - *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
7640 + *p++ = htonl((u32) nfsd_ruid(rqstp,
7641 + TAGINO_UID(DX_TAG(dentry->d_inode), stat->uid, stat->tag)));
7642 + *p++ = htonl((u32) nfsd_rgid(rqstp,
7643 + TAGINO_GID(DX_TAG(dentry->d_inode), stat->gid, stat->tag)));
7645 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
7646 *p++ = htonl(NFS_MAXPATHLEN);
7647 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/dlmglue.c linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/dlmglue.c
7648 --- linux-2.6.35.2/fs/ocfs2/dlmglue.c 2010-08-02 16:52:51.000000000 +0200
7649 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/dlmglue.c 2010-08-02 17:05:06.000000000 +0200
7650 @@ -2114,6 +2114,7 @@ static void __ocfs2_stuff_meta_lvb(struc
7651 lvb->lvb_iclusters = cpu_to_be32(oi->ip_clusters);
7652 lvb->lvb_iuid = cpu_to_be32(inode->i_uid);
7653 lvb->lvb_igid = cpu_to_be32(inode->i_gid);
7654 + lvb->lvb_itag = cpu_to_be16(inode->i_tag);
7655 lvb->lvb_imode = cpu_to_be16(inode->i_mode);
7656 lvb->lvb_inlink = cpu_to_be16(inode->i_nlink);
7657 lvb->lvb_iatime_packed =
7658 @@ -2168,6 +2169,7 @@ static void ocfs2_refresh_inode_from_lvb
7660 inode->i_uid = be32_to_cpu(lvb->lvb_iuid);
7661 inode->i_gid = be32_to_cpu(lvb->lvb_igid);
7662 + inode->i_tag = be16_to_cpu(lvb->lvb_itag);
7663 inode->i_mode = be16_to_cpu(lvb->lvb_imode);
7664 inode->i_nlink = be16_to_cpu(lvb->lvb_inlink);
7665 ocfs2_unpack_timespec(&inode->i_atime,
7666 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/dlmglue.h linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/dlmglue.h
7667 --- linux-2.6.35.2/fs/ocfs2/dlmglue.h 2009-12-03 20:02:53.000000000 +0100
7668 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/dlmglue.h 2010-08-02 17:05:06.000000000 +0200
7669 @@ -46,7 +46,8 @@ struct ocfs2_meta_lvb {
7672 __be32 lvb_igeneration;
7673 - __be32 lvb_reserved2;
7675 + __be16 lvb_reserved2;
7678 #define OCFS2_QINFO_LVB_VERSION 1
7679 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/file.c linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/file.c
7680 --- linux-2.6.35.2/fs/ocfs2/file.c 2010-08-02 16:52:51.000000000 +0200
7681 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/file.c 2010-08-02 17:05:06.000000000 +0200
7682 @@ -1129,13 +1129,15 @@ int ocfs2_setattr(struct dentry *dentry,
7683 mlog(0, "uid change: %d\n", attr->ia_uid);
7684 if (attr->ia_valid & ATTR_GID)
7685 mlog(0, "gid change: %d\n", attr->ia_gid);
7686 + if (attr->ia_valid & ATTR_TAG)
7687 + mlog(0, "tag change: %d\n", attr->ia_tag);
7688 if (attr->ia_valid & ATTR_SIZE)
7689 mlog(0, "size change...\n");
7690 if (attr->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME))
7691 mlog(0, "time change...\n");
7693 #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \
7694 - | ATTR_GID | ATTR_UID | ATTR_MODE)
7695 + | ATTR_GID | ATTR_UID | ATTR_TAG | ATTR_MODE)
7696 if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) {
7697 mlog(0, "can't handle attrs: 0x%x\n", attr->ia_valid);
7699 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/inode.c
7700 --- linux-2.6.35.2/fs/ocfs2/inode.c 2010-08-02 16:52:51.000000000 +0200
7701 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/inode.c 2010-08-02 17:05:06.000000000 +0200
7703 #include <linux/highmem.h>
7704 #include <linux/pagemap.h>
7705 #include <linux/quotaops.h>
7706 +#include <linux/vs_tag.h>
7708 #include <asm/byteorder.h>
7710 @@ -78,11 +79,13 @@ void ocfs2_set_inode_flags(struct inode
7712 unsigned int flags = OCFS2_I(inode)->ip_attr;
7714 - inode->i_flags &= ~(S_IMMUTABLE |
7715 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
7716 S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
7718 if (flags & OCFS2_IMMUTABLE_FL)
7719 inode->i_flags |= S_IMMUTABLE;
7720 + if (flags & OCFS2_IXUNLINK_FL)
7721 + inode->i_flags |= S_IXUNLINK;
7723 if (flags & OCFS2_SYNC_FL)
7724 inode->i_flags |= S_SYNC;
7725 @@ -92,25 +95,44 @@ void ocfs2_set_inode_flags(struct inode
7726 inode->i_flags |= S_NOATIME;
7727 if (flags & OCFS2_DIRSYNC_FL)
7728 inode->i_flags |= S_DIRSYNC;
7730 + inode->i_vflags &= ~(V_BARRIER | V_COW);
7732 + if (flags & OCFS2_BARRIER_FL)
7733 + inode->i_vflags |= V_BARRIER;
7734 + if (flags & OCFS2_COW_FL)
7735 + inode->i_vflags |= V_COW;
7738 /* Propagate flags from i_flags to OCFS2_I(inode)->ip_attr */
7739 void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi)
7741 unsigned int flags = oi->vfs_inode.i_flags;
7742 + unsigned int vflags = oi->vfs_inode.i_vflags;
7744 + oi->ip_attr &= ~(OCFS2_SYNC_FL | OCFS2_APPEND_FL |
7745 + OCFS2_IMMUTABLE_FL | OCFS2_IXUNLINK_FL |
7746 + OCFS2_NOATIME_FL | OCFS2_DIRSYNC_FL |
7747 + OCFS2_BARRIER_FL | OCFS2_COW_FL);
7749 + if (flags & S_IMMUTABLE)
7750 + oi->ip_attr |= OCFS2_IMMUTABLE_FL;
7751 + if (flags & S_IXUNLINK)
7752 + oi->ip_attr |= OCFS2_IXUNLINK_FL;
7754 - oi->ip_attr &= ~(OCFS2_SYNC_FL|OCFS2_APPEND_FL|
7755 - OCFS2_IMMUTABLE_FL|OCFS2_NOATIME_FL|OCFS2_DIRSYNC_FL);
7757 oi->ip_attr |= OCFS2_SYNC_FL;
7758 if (flags & S_APPEND)
7759 oi->ip_attr |= OCFS2_APPEND_FL;
7760 - if (flags & S_IMMUTABLE)
7761 - oi->ip_attr |= OCFS2_IMMUTABLE_FL;
7762 if (flags & S_NOATIME)
7763 oi->ip_attr |= OCFS2_NOATIME_FL;
7764 if (flags & S_DIRSYNC)
7765 oi->ip_attr |= OCFS2_DIRSYNC_FL;
7767 + if (vflags & V_BARRIER)
7768 + oi->ip_attr |= OCFS2_BARRIER_FL;
7769 + if (vflags & V_COW)
7770 + oi->ip_attr |= OCFS2_COW_FL;
7773 struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno)
7774 @@ -245,6 +267,8 @@ void ocfs2_populate_inode(struct inode *
7775 struct super_block *sb;
7776 struct ocfs2_super *osb;
7781 mlog_entry("(0x%p, size:%llu)\n", inode,
7782 (unsigned long long)le64_to_cpu(fe->i_size));
7783 @@ -276,8 +300,12 @@ void ocfs2_populate_inode(struct inode *
7784 inode->i_generation = le32_to_cpu(fe->i_generation);
7785 inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
7786 inode->i_mode = le16_to_cpu(fe->i_mode);
7787 - inode->i_uid = le32_to_cpu(fe->i_uid);
7788 - inode->i_gid = le32_to_cpu(fe->i_gid);
7789 + uid = le32_to_cpu(fe->i_uid);
7790 + gid = le32_to_cpu(fe->i_gid);
7791 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
7792 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
7793 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
7794 + /* le16_to_cpu(raw_inode->i_raw_tag)i */ 0);
7796 /* Fast symlinks will have i_size but no allocated clusters. */
7797 if (S_ISLNK(inode->i_mode) && !fe->i_clusters)
7798 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/inode.h linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/inode.h
7799 --- linux-2.6.35.2/fs/ocfs2/inode.h 2010-08-02 16:52:51.000000000 +0200
7800 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/inode.h 2010-08-02 17:05:06.000000000 +0200
7801 @@ -154,6 +154,7 @@ struct buffer_head *ocfs2_bread(struct i
7803 void ocfs2_set_inode_flags(struct inode *inode);
7804 void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi);
7805 +int ocfs2_sync_flags(struct inode *inode, int, int);
7807 static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode)
7809 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/ioctl.c
7810 --- linux-2.6.35.2/fs/ocfs2/ioctl.c 2010-02-25 11:52:06.000000000 +0100
7811 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/ioctl.c 2010-08-02 17:05:06.000000000 +0200
7812 @@ -43,7 +43,41 @@ static int ocfs2_get_inode_attr(struct i
7816 -static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
7817 +int ocfs2_sync_flags(struct inode *inode, int flags, int vflags)
7819 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
7820 + struct buffer_head *bh = NULL;
7821 + handle_t *handle = NULL;
7824 + status = ocfs2_inode_lock(inode, &bh, 1);
7826 + mlog_errno(status);
7829 + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
7830 + if (IS_ERR(handle)) {
7831 + status = PTR_ERR(handle);
7832 + mlog_errno(status);
7836 + inode->i_flags = flags;
7837 + inode->i_vflags = vflags;
7838 + ocfs2_get_inode_flags(OCFS2_I(inode));
7840 + status = ocfs2_mark_inode_dirty(handle, inode, bh);
7842 + mlog_errno(status);
7844 + ocfs2_commit_trans(osb, handle);
7846 + ocfs2_inode_unlock(inode, 1);
7851 +int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
7854 struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode);
7855 @@ -68,6 +102,11 @@ static int ocfs2_set_inode_attr(struct i
7856 if (!S_ISDIR(inode->i_mode))
7857 flags &= ~OCFS2_DIRSYNC_FL;
7859 + if (IS_BARRIER(inode)) {
7860 + vxwprintk_task(1, "messing with the barrier.");
7864 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
7865 if (IS_ERR(handle)) {
7866 status = PTR_ERR(handle);
7867 @@ -109,6 +148,7 @@ bail:
7872 long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
7874 struct inode *inode = filp->f_path.dentry->d_inode;
7875 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/namei.c linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/namei.c
7876 --- linux-2.6.35.2/fs/ocfs2/namei.c 2010-08-02 16:52:51.000000000 +0200
7877 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/namei.c 2010-08-02 17:05:06.000000000 +0200
7879 #include <linux/slab.h>
7880 #include <linux/highmem.h>
7881 #include <linux/quotaops.h>
7882 +#include <linux/vs_tag.h>
7884 #define MLOG_MASK_PREFIX ML_NAMEI
7885 #include <cluster/masklog.h>
7886 @@ -487,6 +488,7 @@ static int ocfs2_mknod_locked(struct ocf
7887 u64 suballoc_loc, fe_blkno = 0;
7894 @@ -532,8 +534,11 @@ static int ocfs2_mknod_locked(struct ocf
7895 fe->i_suballoc_loc = cpu_to_le64(suballoc_loc);
7896 fe->i_suballoc_bit = cpu_to_le16(suballoc_bit);
7897 fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot);
7898 - fe->i_uid = cpu_to_le32(inode->i_uid);
7899 - fe->i_gid = cpu_to_le32(inode->i_gid);
7901 + tag = dx_current_fstag(osb->sb);
7902 + fe->i_uid = cpu_to_le32(TAGINO_UID(DX_TAG(inode), inode->i_uid, tag));
7903 + fe->i_gid = cpu_to_le32(TAGINO_GID(DX_TAG(inode), inode->i_gid, tag));
7904 + inode->i_tag = tag;
7905 fe->i_mode = cpu_to_le16(inode->i_mode);
7906 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
7907 fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev));
7908 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/ocfs2_fs.h linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/ocfs2_fs.h
7909 --- linux-2.6.35.2/fs/ocfs2/ocfs2_fs.h 2010-08-02 16:52:51.000000000 +0200
7910 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/ocfs2_fs.h 2010-08-02 17:05:06.000000000 +0200
7911 @@ -235,18 +235,23 @@
7912 #define OCFS2_HAS_REFCOUNT_FL (0x0010)
7914 /* Inode attributes, keep in sync with EXT2 */
7915 -#define OCFS2_SECRM_FL (0x00000001) /* Secure deletion */
7916 -#define OCFS2_UNRM_FL (0x00000002) /* Undelete */
7917 -#define OCFS2_COMPR_FL (0x00000004) /* Compress file */
7918 -#define OCFS2_SYNC_FL (0x00000008) /* Synchronous updates */
7919 -#define OCFS2_IMMUTABLE_FL (0x00000010) /* Immutable file */
7920 -#define OCFS2_APPEND_FL (0x00000020) /* writes to file may only append */
7921 -#define OCFS2_NODUMP_FL (0x00000040) /* do not dump file */
7922 -#define OCFS2_NOATIME_FL (0x00000080) /* do not update atime */
7923 -#define OCFS2_DIRSYNC_FL (0x00010000) /* dirsync behaviour (directories only) */
7924 +#define OCFS2_SECRM_FL FS_SECRM_FL /* Secure deletion */
7925 +#define OCFS2_UNRM_FL FS_UNRM_FL /* Undelete */
7926 +#define OCFS2_COMPR_FL FS_COMPR_FL /* Compress file */
7927 +#define OCFS2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
7928 +#define OCFS2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
7929 +#define OCFS2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
7930 +#define OCFS2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
7931 +#define OCFS2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
7933 -#define OCFS2_FL_VISIBLE (0x000100FF) /* User visible flags */
7934 -#define OCFS2_FL_MODIFIABLE (0x000100FF) /* User modifiable flags */
7935 +#define OCFS2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
7936 +#define OCFS2_IXUNLINK_FL FS_IXUNLINK_FL /* Immutable invert on unlink */
7938 +#define OCFS2_BARRIER_FL FS_BARRIER_FL /* Barrier for chroot() */
7939 +#define OCFS2_COW_FL FS_COW_FL /* Copy on Write marker */
7941 +#define OCFS2_FL_VISIBLE (0x010300FF) /* User visible flags */
7942 +#define OCFS2_FL_MODIFIABLE (0x010300FF) /* User modifiable flags */
7945 * Extent record flags (e_node.leaf.flags)
7946 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/ocfs2.h linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/ocfs2.h
7947 --- linux-2.6.35.2/fs/ocfs2/ocfs2.h 2010-08-02 16:52:51.000000000 +0200
7948 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/ocfs2.h 2010-08-02 17:05:06.000000000 +0200
7949 @@ -256,6 +256,7 @@ enum ocfs2_mount_options
7951 OCFS2_MOUNT_USRQUOTA = 1 << 10, /* We support user quotas */
7952 OCFS2_MOUNT_GRPQUOTA = 1 << 11, /* We support group quotas */
7953 + OCFS2_MOUNT_TAGGED = 1 << 12, /* use tagging */
7956 #define OCFS2_OSB_SOFT_RO 0x0001
7957 diff -NurpP --minimal linux-2.6.35.2/fs/ocfs2/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/super.c
7958 --- linux-2.6.35.2/fs/ocfs2/super.c 2010-08-02 16:52:51.000000000 +0200
7959 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/ocfs2/super.c 2010-08-02 18:00:11.000000000 +0200
7960 @@ -180,6 +180,7 @@ enum {
7964 + Opt_tag, Opt_notag, Opt_tagid,
7968 @@ -208,6 +209,9 @@ static const match_table_t tokens = {
7969 {Opt_grpquota, "grpquota"},
7970 {Opt_resv_level, "resv_level=%u"},
7971 {Opt_dir_resv_level, "dir_resv_level=%u"},
7973 + {Opt_notag, "notag"},
7974 + {Opt_tagid, "tagid=%u"},
7978 @@ -618,6 +622,13 @@ static int ocfs2_remount(struct super_bl
7982 + if ((osb->s_mount_opt & OCFS2_MOUNT_TAGGED) !=
7983 + (parsed_options.mount_opt & OCFS2_MOUNT_TAGGED)) {
7985 + mlog(ML_ERROR, "Cannot change tagging on remount\n");
7989 if ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) !=
7990 (parsed_options.mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
7992 @@ -1154,6 +1165,9 @@ static int ocfs2_fill_super(struct super
7994 ocfs2_complete_mount_recovery(osb);
7996 + if (osb->s_mount_opt & OCFS2_MOUNT_TAGGED)
7997 + sb->s_flags |= MS_TAGGED;
7999 if (ocfs2_mount_local(osb))
8000 snprintf(nodestr, sizeof(nodestr), "local");
8002 @@ -1469,6 +1483,20 @@ static int ocfs2_parse_options(struct su
8003 option < OCFS2_MAX_RESV_LEVEL)
8004 mopt->dir_resv_level = option;
8006 +#ifndef CONFIG_TAGGING_NONE
8008 + mopt->mount_opt |= OCFS2_MOUNT_TAGGED;
8011 + mopt->mount_opt &= ~OCFS2_MOUNT_TAGGED;
8014 +#ifdef CONFIG_PROPAGATE
8017 + mopt->mount_opt |= OCFS2_MOUNT_TAGGED;
8022 "Unrecognized mount option \"%s\" "
8023 diff -NurpP --minimal linux-2.6.35.2/fs/open.c linux-2.6.35.2-vs2.3.0.36.31/fs/open.c
8024 --- linux-2.6.35.2/fs/open.c 2010-08-02 16:52:51.000000000 +0200
8025 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/open.c 2010-08-02 21:36:22.000000000 +0200
8027 #include <linux/falloc.h>
8028 #include <linux/fs_struct.h>
8029 #include <linux/ima.h>
8030 +#include <linux/vs_base.h>
8031 +#include <linux/vs_limit.h>
8032 +#include <linux/vs_tag.h>
8033 +#include <linux/vs_cowbl.h>
8034 +#include <linux/vserver/dlimit.h>
8036 #include "internal.h"
8038 @@ -481,6 +486,12 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, cons
8039 error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);
8043 +#ifdef CONFIG_VSERVER_COWBL
8044 + error = cow_check_and_break(&path);
8046 + goto dput_and_out;
8048 inode = path.dentry->d_inode;
8050 error = mnt_want_write(path.mnt);
8051 @@ -518,11 +529,11 @@ static int chown_common(struct path *pat
8052 newattrs.ia_valid = ATTR_CTIME;
8053 if (user != (uid_t) -1) {
8054 newattrs.ia_valid |= ATTR_UID;
8055 - newattrs.ia_uid = user;
8056 + newattrs.ia_uid = dx_map_uid(user);
8058 if (group != (gid_t) -1) {
8059 newattrs.ia_valid |= ATTR_GID;
8060 - newattrs.ia_gid = group;
8061 + newattrs.ia_gid = dx_map_gid(group);
8063 if (!S_ISDIR(inode->i_mode))
8064 newattrs.ia_valid |=
8065 @@ -547,6 +558,10 @@ SYSCALL_DEFINE3(chown, const char __user
8066 error = mnt_want_write(path.mnt);
8069 +#ifdef CONFIG_VSERVER_COWBL
8070 + error = cow_check_and_break(&path);
8073 error = chown_common(&path, user, group);
8074 mnt_drop_write(path.mnt);
8076 @@ -572,6 +587,10 @@ SYSCALL_DEFINE5(fchownat, int, dfd, cons
8077 error = mnt_want_write(path.mnt);
8080 +#ifdef CONFIG_VSERVER_COWBL
8081 + error = cow_check_and_break(&path);
8084 error = chown_common(&path, user, group);
8085 mnt_drop_write(path.mnt);
8087 @@ -591,6 +610,10 @@ SYSCALL_DEFINE3(lchown, const char __use
8088 error = mnt_want_write(path.mnt);
8091 +#ifdef CONFIG_VSERVER_COWBL
8092 + error = cow_check_and_break(&path);
8095 error = chown_common(&path, user, group);
8096 mnt_drop_write(path.mnt);
8098 @@ -837,6 +860,7 @@ static void __put_unused_fd(struct files
8099 __FD_CLR(fd, fdt->open_fds);
8100 if (fd < files->next_fd)
8101 files->next_fd = fd;
8102 + vx_openfd_dec(fd);
8105 void put_unused_fd(unsigned int fd)
8106 diff -NurpP --minimal linux-2.6.35.2/fs/proc/array.c linux-2.6.35.2-vs2.3.0.36.31/fs/proc/array.c
8107 --- linux-2.6.35.2/fs/proc/array.c 2010-08-02 16:52:51.000000000 +0200
8108 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/array.c 2010-08-02 17:05:06.000000000 +0200
8110 #include <linux/pid_namespace.h>
8111 #include <linux/ptrace.h>
8112 #include <linux/tracehook.h>
8113 +#include <linux/vs_context.h>
8114 +#include <linux/vs_network.h>
8116 #include <asm/pgtable.h>
8117 #include <asm/processor.h>
8118 @@ -170,6 +172,9 @@ static inline void task_state(struct seq
8120 ppid = pid_alive(p) ?
8121 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
8122 + if (unlikely(vx_current_initpid(p->pid)))
8127 struct task_struct *tracer = tracehook_tracer_task(p);
8128 @@ -287,7 +292,7 @@ static inline void task_sig(struct seq_f
8131 static void render_cap_t(struct seq_file *m, const char *header,
8133 + struct vx_info *vxi, kernel_cap_t *a)
8137 @@ -312,10 +317,11 @@ static inline void task_cap(struct seq_f
8138 cap_bset = cred->cap_bset;
8141 - render_cap_t(m, "CapInh:\t", &cap_inheritable);
8142 - render_cap_t(m, "CapPrm:\t", &cap_permitted);
8143 - render_cap_t(m, "CapEff:\t", &cap_effective);
8144 - render_cap_t(m, "CapBnd:\t", &cap_bset);
8145 + /* FIXME: maybe move the p->vx_info masking to __task_cred() ? */
8146 + render_cap_t(m, "CapInh:\t", p->vx_info, &cap_inheritable);
8147 + render_cap_t(m, "CapPrm:\t", p->vx_info, &cap_permitted);
8148 + render_cap_t(m, "CapEff:\t", p->vx_info, &cap_effective);
8149 + render_cap_t(m, "CapBnd:\t", p->vx_info, &cap_bset);
8152 static inline void task_context_switch_counts(struct seq_file *m,
8153 @@ -337,6 +343,42 @@ static void task_cpus_allowed(struct seq
8154 seq_printf(m, "\n");
8157 +int proc_pid_nsproxy(struct seq_file *m, struct pid_namespace *ns,
8158 + struct pid *pid, struct task_struct *task)
8160 + seq_printf(m, "Proxy:\t%p(%c)\n"
8168 + (task->nsproxy == init_task.nsproxy ? 'I' : '-'),
8169 + atomic_read(&task->nsproxy->count),
8170 + task->nsproxy->uts_ns,
8171 + (task->nsproxy->uts_ns == init_task.nsproxy->uts_ns ? 'I' : '-'),
8172 + task->nsproxy->ipc_ns,
8173 + (task->nsproxy->ipc_ns == init_task.nsproxy->ipc_ns ? 'I' : '-'),
8174 + task->nsproxy->mnt_ns,
8175 + (task->nsproxy->mnt_ns == init_task.nsproxy->mnt_ns ? 'I' : '-'),
8176 + task->nsproxy->pid_ns,
8177 + (task->nsproxy->pid_ns == init_task.nsproxy->pid_ns ? 'I' : '-'),
8178 + task->nsproxy->net_ns,
8179 + (task->nsproxy->net_ns == init_task.nsproxy->net_ns ? 'I' : '-'));
8183 +void task_vs_id(struct seq_file *m, struct task_struct *task)
8185 + if (task_vx_flags(task, VXF_HIDE_VINFO, 0))
8188 + seq_printf(m, "VxID: %d\n", vx_task_xid(task));
8189 + seq_printf(m, "NxID: %d\n", nx_task_nid(task));
8193 int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
8194 struct pid *pid, struct task_struct *task)
8196 @@ -353,6 +395,7 @@ int proc_pid_status(struct seq_file *m,
8198 task_cpus_allowed(m, task);
8199 cpuset_task_status_allowed(m, task);
8200 + task_vs_id(m, task);
8201 #if defined(CONFIG_S390)
8202 task_show_regs(m, task);
8204 @@ -465,6 +508,17 @@ static int do_task_stat(struct seq_file
8205 /* convert nsec -> ticks */
8206 start_time = nsec_to_clock_t(start_time);
8208 + /* fixup start time for virt uptime */
8209 + if (vx_flags(VXF_VIRT_UPTIME, 0)) {
8210 + unsigned long long bias =
8211 + current->vx_info->cvirt.bias_clock;
8213 + if (start_time > bias)
8214 + start_time -= bias;
8219 seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \
8220 %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
8221 %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n",
8222 diff -NurpP --minimal linux-2.6.35.2/fs/proc/base.c linux-2.6.35.2-vs2.3.0.36.31/fs/proc/base.c
8223 --- linux-2.6.35.2/fs/proc/base.c 2010-08-02 16:52:51.000000000 +0200
8224 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/base.c 2010-08-02 17:05:06.000000000 +0200
8226 #include <linux/pid_namespace.h>
8227 #include <linux/fs_struct.h>
8228 #include <linux/slab.h>
8229 +#include <linux/vs_context.h>
8230 +#include <linux/vs_network.h>
8231 #include "internal.h"
8234 @@ -1033,12 +1035,17 @@ static ssize_t oom_adjust_write(struct f
8238 - if (oom_adjust < task->signal->oom_adj && !capable(CAP_SYS_RESOURCE)) {
8239 + if (oom_adjust < task->signal->oom_adj &&
8240 + !vx_capable(CAP_SYS_RESOURCE, VXC_OOM_ADJUST)) {
8241 unlock_task_sighand(task, &flags);
8242 put_task_struct(task);
8246 + /* prevent guest processes from circumventing the oom killer */
8247 + if (vx_current_xid() && (oom_adjust == OOM_DISABLE))
8248 + oom_adjust = OOM_ADJUST_MIN;
8250 task->signal->oom_adj = oom_adjust;
8252 unlock_task_sighand(task, &flags);
8253 @@ -1079,7 +1086,7 @@ static ssize_t proc_loginuid_write(struc
8257 - if (!capable(CAP_AUDIT_CONTROL))
8258 + if (!vx_capable(CAP_AUDIT_CONTROL, VXC_AUDIT_CONTROL))
8262 @@ -1517,6 +1524,8 @@ static struct inode *proc_pid_make_inode
8263 inode->i_gid = cred->egid;
8266 + /* procfs is xid tagged */
8267 + inode->i_tag = (tag_t)vx_task_xid(task);
8268 security_task_to_inode(task, inode);
8271 @@ -2067,6 +2076,13 @@ static struct dentry *proc_pident_lookup
8275 + /* TODO: maybe we can come up with a generic approach? */
8276 + if (task_vx_flags(task, VXF_HIDE_VINFO, 0) &&
8277 + (dentry->d_name.len == 5) &&
8278 + (!memcmp(dentry->d_name.name, "vinfo", 5) ||
8279 + !memcmp(dentry->d_name.name, "ninfo", 5)))
8283 * Yes, it does not scale. And it should not. Don't add
8284 * new entries into /proc/<tgid>/ without very good reasons.
8285 @@ -2474,7 +2490,7 @@ out_iput:
8286 static struct dentry *proc_base_lookup(struct inode *dir, struct dentry *dentry)
8288 struct dentry *error;
8289 - struct task_struct *task = get_proc_task(dir);
8290 + struct task_struct *task = get_proc_task_real(dir);
8291 const struct pid_entry *p, *last;
8293 error = ERR_PTR(-ENOENT);
8294 @@ -2564,6 +2580,9 @@ static int proc_pid_personality(struct s
8295 static const struct file_operations proc_task_operations;
8296 static const struct inode_operations proc_task_inode_operations;
8298 +extern int proc_pid_vx_info(struct task_struct *, char *);
8299 +extern int proc_pid_nx_info(struct task_struct *, char *);
8301 static const struct pid_entry tgid_base_stuff[] = {
8302 DIR("task", S_IRUGO|S_IXUGO, proc_task_inode_operations, proc_task_operations),
8303 DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
8304 @@ -2623,6 +2642,8 @@ static const struct pid_entry tgid_base_
8305 #ifdef CONFIG_CGROUPS
8306 REG("cgroup", S_IRUGO, proc_cgroup_operations),
8308 + INF("vinfo", S_IRUGO, proc_pid_vx_info),
8309 + INF("ninfo", S_IRUGO, proc_pid_nx_info),
8310 INF("oom_score", S_IRUGO, proc_oom_score),
8311 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_operations),
8312 #ifdef CONFIG_AUDITSYSCALL
8313 @@ -2638,6 +2659,7 @@ static const struct pid_entry tgid_base_
8314 #ifdef CONFIG_TASK_IO_ACCOUNTING
8315 INF("io", S_IRUGO, proc_tgid_io_accounting),
8317 + ONE("nsproxy", S_IRUGO, proc_pid_nsproxy),
8320 static int proc_tgid_base_readdir(struct file * filp,
8321 @@ -2829,7 +2851,7 @@ retry:
8323 pid = find_ge_pid(iter.tgid, ns);
8325 - iter.tgid = pid_nr_ns(pid, ns);
8326 + iter.tgid = pid_unmapped_nr_ns(pid, ns);
8327 iter.task = pid_task(pid, PIDTYPE_PID);
8328 /* What we to know is if the pid we have find is the
8329 * pid of a thread_group_leader. Testing for task
8330 @@ -2859,7 +2881,7 @@ static int proc_pid_fill_cache(struct fi
8331 struct tgid_iter iter)
8333 char name[PROC_NUMBUF];
8334 - int len = snprintf(name, sizeof(name), "%d", iter.tgid);
8335 + int len = snprintf(name, sizeof(name), "%d", vx_map_tgid(iter.tgid));
8336 return proc_fill_cache(filp, dirent, filldir, name, len,
8337 proc_pid_instantiate, iter.task, NULL);
8339 @@ -2868,7 +2890,7 @@ static int proc_pid_fill_cache(struct fi
8340 int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
8342 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
8343 - struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
8344 + struct task_struct *reaper = get_proc_task_real(filp->f_path.dentry->d_inode);
8345 struct tgid_iter iter;
8346 struct pid_namespace *ns;
8348 @@ -2888,6 +2910,8 @@ int proc_pid_readdir(struct file * filp,
8350 iter.tgid += 1, iter = next_tgid(ns, iter)) {
8351 filp->f_pos = iter.tgid + TGID_OFFSET;
8352 + if (!vx_proc_task_visible(iter.task))
8354 if (proc_pid_fill_cache(filp, dirent, filldir, iter) < 0) {
8355 put_task_struct(iter.task);
8357 @@ -3035,6 +3059,8 @@ static struct dentry *proc_task_lookup(s
8358 tid = name_to_int(dentry);
8361 + if (vx_current_initpid(tid))
8364 ns = dentry->d_sb->s_fs_info;
8366 diff -NurpP --minimal linux-2.6.35.2/fs/proc/generic.c linux-2.6.35.2-vs2.3.0.36.31/fs/proc/generic.c
8367 --- linux-2.6.35.2/fs/proc/generic.c 2010-08-02 16:52:51.000000000 +0200
8368 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/generic.c 2010-08-02 17:05:06.000000000 +0200
8370 #include <linux/bitops.h>
8371 #include <linux/spinlock.h>
8372 #include <linux/completion.h>
8373 +#include <linux/vserver/inode.h>
8374 #include <asm/uaccess.h>
8376 #include "internal.h"
8377 @@ -418,6 +419,8 @@ struct dentry *proc_lookup_de(struct pro
8378 for (de = de->subdir; de ; de = de->next) {
8379 if (de->namelen != dentry->d_name.len)
8381 + if (!vx_hide_check(0, de->vx_flags))
8383 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
8386 @@ -426,6 +429,8 @@ struct dentry *proc_lookup_de(struct pro
8387 spin_unlock(&proc_subdir_lock);
8389 inode = proc_get_inode(dir->i_sb, ino, de);
8390 + /* generic proc entries belong to the host */
8395 @@ -503,6 +508,8 @@ int proc_readdir_de(struct proc_dir_entr
8397 /* filldir passes info to user space */
8399 + if (!vx_hide_check(0, de->vx_flags))
8401 spin_unlock(&proc_subdir_lock);
8402 if (filldir(dirent, de->name, de->namelen, filp->f_pos,
8403 de->low_ino, de->mode >> 12) < 0) {
8404 @@ -510,6 +517,7 @@ int proc_readdir_de(struct proc_dir_entr
8407 spin_lock(&proc_subdir_lock);
8412 @@ -624,6 +632,7 @@ static struct proc_dir_entry *__proc_cre
8414 atomic_set(&ent->count, 1);
8416 + ent->vx_flags = IATTR_PROC_DEFAULT;
8417 spin_lock_init(&ent->pde_unload_lock);
8418 ent->pde_unload_completion = NULL;
8419 INIT_LIST_HEAD(&ent->pde_openers);
8420 @@ -647,7 +656,8 @@ struct proc_dir_entry *proc_symlink(cons
8426 + ent->vx_flags = IATTR_PROC_SYMLINK;
8430 diff -NurpP --minimal linux-2.6.35.2/fs/proc/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/proc/inode.c
8431 --- linux-2.6.35.2/fs/proc/inode.c 2010-08-02 16:52:51.000000000 +0200
8432 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/inode.c 2010-08-02 17:05:06.000000000 +0200
8433 @@ -437,6 +437,8 @@ struct inode *proc_get_inode(struct supe
8434 inode->i_uid = de->uid;
8435 inode->i_gid = de->gid;
8438 + PROC_I(inode)->vx_flags = de->vx_flags;
8440 inode->i_size = de->size;
8442 diff -NurpP --minimal linux-2.6.35.2/fs/proc/internal.h linux-2.6.35.2-vs2.3.0.36.31/fs/proc/internal.h
8443 --- linux-2.6.35.2/fs/proc/internal.h 2010-02-25 11:52:06.000000000 +0100
8444 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/internal.h 2010-08-02 17:05:06.000000000 +0200
8448 #include <linux/proc_fs.h>
8449 +#include <linux/vs_pid.h>
8451 extern struct proc_dir_entry proc_root;
8452 #ifdef CONFIG_PROC_SYSCTL
8453 @@ -51,6 +52,9 @@ extern int proc_pid_status(struct seq_fi
8454 struct pid *pid, struct task_struct *task);
8455 extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
8456 struct pid *pid, struct task_struct *task);
8457 +extern int proc_pid_nsproxy(struct seq_file *m, struct pid_namespace *ns,
8458 + struct pid *pid, struct task_struct *task);
8460 extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
8462 extern const struct file_operations proc_maps_operations;
8463 @@ -68,11 +72,16 @@ static inline struct pid *proc_pid(struc
8464 return PROC_I(inode)->pid;
8467 -static inline struct task_struct *get_proc_task(struct inode *inode)
8468 +static inline struct task_struct *get_proc_task_real(struct inode *inode)
8470 return get_pid_task(proc_pid(inode), PIDTYPE_PID);
8473 +static inline struct task_struct *get_proc_task(struct inode *inode)
8475 + return vx_get_proc_task(inode, proc_pid(inode));
8478 static inline int proc_fd(struct inode *inode)
8480 return PROC_I(inode)->fd;
8481 diff -NurpP --minimal linux-2.6.35.2/fs/proc/loadavg.c linux-2.6.35.2-vs2.3.0.36.31/fs/proc/loadavg.c
8482 --- linux-2.6.35.2/fs/proc/loadavg.c 2009-09-10 15:26:23.000000000 +0200
8483 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/loadavg.c 2010-08-02 17:05:06.000000000 +0200
8486 static int loadavg_proc_show(struct seq_file *m, void *v)
8488 + unsigned long running;
8489 + unsigned int threads;
8490 unsigned long avnrun[3];
8492 get_avenrun(avnrun, FIXED_1/200, 0);
8494 + if (vx_flags(VXF_VIRT_LOAD, 0)) {
8495 + struct vx_info *vxi = current_vx_info();
8497 + running = atomic_read(&vxi->cvirt.nr_running);
8498 + threads = atomic_read(&vxi->cvirt.nr_threads);
8500 + running = nr_running();
8501 + threads = nr_threads;
8504 seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %ld/%d %d\n",
8505 LOAD_INT(avnrun[0]), LOAD_FRAC(avnrun[0]),
8506 LOAD_INT(avnrun[1]), LOAD_FRAC(avnrun[1]),
8507 LOAD_INT(avnrun[2]), LOAD_FRAC(avnrun[2]),
8508 - nr_running(), nr_threads,
8510 task_active_pid_ns(current)->last_pid);
8513 diff -NurpP --minimal linux-2.6.35.2/fs/proc/meminfo.c linux-2.6.35.2-vs2.3.0.36.31/fs/proc/meminfo.c
8514 --- linux-2.6.35.2/fs/proc/meminfo.c 2009-12-03 20:02:53.000000000 +0100
8515 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/meminfo.c 2010-08-02 17:05:06.000000000 +0200
8516 @@ -39,7 +39,8 @@ static int meminfo_proc_show(struct seq_
8517 allowed = ((totalram_pages - hugetlb_total_pages())
8518 * sysctl_overcommit_ratio / 100) + total_swap_pages;
8520 - cached = global_page_state(NR_FILE_PAGES) -
8521 + cached = vx_flags(VXF_VIRT_MEM, 0) ?
8522 + vx_vsi_cached(&i) : global_page_state(NR_FILE_PAGES) -
8523 total_swapcache_pages - i.bufferram;
8526 diff -NurpP --minimal linux-2.6.35.2/fs/proc/root.c linux-2.6.35.2-vs2.3.0.36.31/fs/proc/root.c
8527 --- linux-2.6.35.2/fs/proc/root.c 2010-08-02 16:52:51.000000000 +0200
8528 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/root.c 2010-08-02 17:05:06.000000000 +0200
8530 #include <linux/bitops.h>
8531 #include <linux/mount.h>
8532 #include <linux/pid_namespace.h>
8533 +#include <linux/vserver/inode.h>
8535 #include "internal.h"
8537 +struct proc_dir_entry *proc_virtual;
8539 +extern void proc_vx_init(void);
8541 static int proc_test_super(struct super_block *sb, void *data)
8543 return sb->s_fs_info == data;
8544 @@ -135,6 +140,7 @@ void __init proc_root_init(void)
8546 proc_mkdir("bus", NULL);
8551 static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
8552 @@ -202,6 +208,7 @@ struct proc_dir_entry proc_root = {
8553 .proc_iops = &proc_root_inode_operations,
8554 .proc_fops = &proc_root_operations,
8555 .parent = &proc_root,
8556 + .vx_flags = IATTR_ADMIN | IATTR_WATCH,
8559 int pid_ns_prepare_proc(struct pid_namespace *ns)
8560 diff -NurpP --minimal linux-2.6.35.2/fs/proc/uptime.c linux-2.6.35.2-vs2.3.0.36.31/fs/proc/uptime.c
8561 --- linux-2.6.35.2/fs/proc/uptime.c 2009-12-03 20:02:53.000000000 +0100
8562 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/proc/uptime.c 2010-08-02 17:05:06.000000000 +0200
8564 #include <linux/sched.h>
8565 #include <linux/seq_file.h>
8566 #include <linux/time.h>
8567 -#include <linux/kernel_stat.h>
8568 +#include <linux/vserver/cvirt.h>
8569 #include <asm/cputime.h>
8571 static int uptime_proc_show(struct seq_file *m, void *v)
8573 struct timespec uptime;
8574 struct timespec idle;
8576 - cputime_t idletime = cputime_zero;
8578 - for_each_possible_cpu(i)
8579 - idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle);
8580 + cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
8582 do_posix_clock_monotonic_gettime(&uptime);
8583 monotonic_to_bootbased(&uptime);
8584 cputime_to_timespec(idletime, &idle);
8586 + if (vx_flags(VXF_VIRT_UPTIME, 0))
8587 + vx_vsi_uptime(&uptime, &idle);
8589 seq_printf(m, "%lu.%02lu %lu.%02lu\n",
8590 (unsigned long) uptime.tv_sec,
8591 (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
8592 diff -NurpP --minimal linux-2.6.35.2/fs/quota/dquot.c linux-2.6.35.2-vs2.3.0.36.31/fs/quota/dquot.c
8593 --- linux-2.6.35.2/fs/quota/dquot.c 2010-08-02 16:52:51.000000000 +0200
8594 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/quota/dquot.c 2010-08-02 22:36:48.000000000 +0200
8595 @@ -1503,6 +1503,9 @@ int __dquot_alloc_space(struct inode *in
8596 int reserve = flags & DQUOT_SPACE_RESERVE;
8597 int nofail = flags & DQUOT_SPACE_NOFAIL;
8599 + if ((ret = dl_alloc_space(inode, number)))
8603 * First test before acquiring mutex - solves deadlocks when we
8604 * re-enter the quota code and are already holding the mutex
8605 @@ -1557,6 +1560,9 @@ int dquot_alloc_inode(const struct inode
8607 char warntype[MAXQUOTAS];
8609 + if ((ret = dl_alloc_inode(inode)))
8612 /* First test before acquiring mutex - solves deadlocks when we
8613 * re-enter the quota code and are already holding the mutex */
8614 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode))
8615 @@ -1627,6 +1633,8 @@ void __dquot_free_space(struct inode *in
8616 char warntype[MAXQUOTAS];
8617 int reserve = flags & DQUOT_SPACE_RESERVE;
8619 + dl_free_space(inode, number);
8621 /* First test before acquiring mutex - solves deadlocks when we
8622 * re-enter the quota code and are already holding the mutex */
8623 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode)) {
8624 @@ -1665,6 +1673,8 @@ void dquot_free_inode(const struct inode
8626 char warntype[MAXQUOTAS];
8628 + dl_free_inode(inode);
8630 /* First test before acquiring mutex - solves deadlocks when we
8631 * re-enter the quota code and are already holding the mutex */
8632 if (!sb_any_quota_active(inode->i_sb) || IS_NOQUOTA(inode))
8633 diff -NurpP --minimal linux-2.6.35.2/fs/quota/quota.c linux-2.6.35.2-vs2.3.0.36.31/fs/quota/quota.c
8634 --- linux-2.6.35.2/fs/quota/quota.c 2010-08-02 16:52:51.000000000 +0200
8635 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/quota/quota.c 2010-08-02 17:05:06.000000000 +0200
8637 #include <linux/fs.h>
8638 #include <linux/namei.h>
8639 #include <linux/slab.h>
8640 +#include <linux/vs_context.h>
8641 #include <asm/current.h>
8642 #include <asm/uaccess.h>
8643 #include <linux/kernel.h>
8644 @@ -38,7 +39,7 @@ static int check_quotactl_permission(str
8648 - if (!capable(CAP_SYS_ADMIN))
8649 + if (!vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
8653 @@ -296,6 +297,46 @@ static int do_quotactl(struct super_bloc
8657 +#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
8659 +#include <linux/vroot.h>
8660 +#include <linux/major.h>
8661 +#include <linux/module.h>
8662 +#include <linux/kallsyms.h>
8663 +#include <linux/vserver/debug.h>
8665 +static vroot_grb_func *vroot_get_real_bdev = NULL;
8667 +static spinlock_t vroot_grb_lock = SPIN_LOCK_UNLOCKED;
8669 +int register_vroot_grb(vroot_grb_func *func) {
8672 + spin_lock(&vroot_grb_lock);
8673 + if (!vroot_get_real_bdev) {
8674 + vroot_get_real_bdev = func;
8677 + spin_unlock(&vroot_grb_lock);
8680 +EXPORT_SYMBOL(register_vroot_grb);
8682 +int unregister_vroot_grb(vroot_grb_func *func) {
8683 + int ret = -EINVAL;
8685 + spin_lock(&vroot_grb_lock);
8686 + if (vroot_get_real_bdev) {
8687 + vroot_get_real_bdev = NULL;
8690 + spin_unlock(&vroot_grb_lock);
8693 +EXPORT_SYMBOL(unregister_vroot_grb);
8698 * look up a superblock on which quota ops will be performed
8699 * - use the name of a block device to find the superblock thereon
8700 @@ -313,6 +354,22 @@ static struct super_block *quotactl_bloc
8703 return ERR_CAST(bdev);
8704 +#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
8705 + if (bdev && bdev->bd_inode &&
8706 + imajor(bdev->bd_inode) == VROOT_MAJOR) {
8707 + struct block_device *bdnew = (void *)-EINVAL;
8709 + if (vroot_get_real_bdev)
8710 + bdnew = vroot_get_real_bdev(bdev);
8712 + vxdprintk(VXD_CBIT(misc, 0),
8713 + "vroot_get_real_bdev not set");
8715 + if (IS_ERR(bdnew))
8716 + return ERR_PTR(PTR_ERR(bdnew));
8720 sb = get_super(bdev);
8723 diff -NurpP --minimal linux-2.6.35.2/fs/reiserfs/file.c linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/file.c
8724 --- linux-2.6.35.2/fs/reiserfs/file.c 2010-08-02 16:52:52.000000000 +0200
8725 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/file.c 2010-08-02 17:05:06.000000000 +0200
8726 @@ -307,4 +307,5 @@ const struct inode_operations reiserfs_f
8727 .listxattr = reiserfs_listxattr,
8728 .removexattr = reiserfs_removexattr,
8729 .permission = reiserfs_permission,
8730 + .sync_flags = reiserfs_sync_flags,
8732 diff -NurpP --minimal linux-2.6.35.2/fs/reiserfs/inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/inode.c
8733 --- linux-2.6.35.2/fs/reiserfs/inode.c 2010-08-02 16:52:52.000000000 +0200
8734 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/inode.c 2010-08-02 17:05:06.000000000 +0200
8736 #include <linux/writeback.h>
8737 #include <linux/quotaops.h>
8738 #include <linux/swap.h>
8739 +#include <linux/vs_tag.h>
8741 int reiserfs_commit_write(struct file *f, struct page *page,
8742 unsigned from, unsigned to);
8743 @@ -1125,6 +1126,8 @@ static void init_inode(struct inode *ino
8744 struct buffer_head *bh;
8745 struct item_head *ih;
8749 //int version = ITEM_VERSION_1;
8751 bh = PATH_PLAST_BUFFER(path);
8752 @@ -1146,12 +1149,13 @@ static void init_inode(struct inode *ino
8753 (struct stat_data_v1 *)B_I_PITEM(bh, ih);
8754 unsigned long blocks;
8756 + uid = sd_v1_uid(sd);
8757 + gid = sd_v1_gid(sd);
8759 set_inode_item_key_version(inode, KEY_FORMAT_3_5);
8760 set_inode_sd_version(inode, STAT_DATA_V1);
8761 inode->i_mode = sd_v1_mode(sd);
8762 inode->i_nlink = sd_v1_nlink(sd);
8763 - inode->i_uid = sd_v1_uid(sd);
8764 - inode->i_gid = sd_v1_gid(sd);
8765 inode->i_size = sd_v1_size(sd);
8766 inode->i_atime.tv_sec = sd_v1_atime(sd);
8767 inode->i_mtime.tv_sec = sd_v1_mtime(sd);
8768 @@ -1193,11 +1197,12 @@ static void init_inode(struct inode *ino
8769 // (directories and symlinks)
8770 struct stat_data *sd = (struct stat_data *)B_I_PITEM(bh, ih);
8772 + uid = sd_v2_uid(sd);
8773 + gid = sd_v2_gid(sd);
8775 inode->i_mode = sd_v2_mode(sd);
8776 inode->i_nlink = sd_v2_nlink(sd);
8777 - inode->i_uid = sd_v2_uid(sd);
8778 inode->i_size = sd_v2_size(sd);
8779 - inode->i_gid = sd_v2_gid(sd);
8780 inode->i_mtime.tv_sec = sd_v2_mtime(sd);
8781 inode->i_atime.tv_sec = sd_v2_atime(sd);
8782 inode->i_ctime.tv_sec = sd_v2_ctime(sd);
8783 @@ -1227,6 +1232,10 @@ static void init_inode(struct inode *ino
8784 sd_attrs_to_i_attrs(sd_v2_attrs(sd), inode);
8787 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
8788 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
8789 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid, 0);
8792 if (S_ISREG(inode->i_mode)) {
8793 inode->i_op = &reiserfs_file_inode_operations;
8794 @@ -1249,13 +1258,15 @@ static void init_inode(struct inode *ino
8795 static void inode2sd(void *sd, struct inode *inode, loff_t size)
8797 struct stat_data *sd_v2 = (struct stat_data *)sd;
8798 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
8799 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
8802 + set_sd_v2_uid(sd_v2, uid);
8803 + set_sd_v2_gid(sd_v2, gid);
8804 set_sd_v2_mode(sd_v2, inode->i_mode);
8805 set_sd_v2_nlink(sd_v2, inode->i_nlink);
8806 - set_sd_v2_uid(sd_v2, inode->i_uid);
8807 set_sd_v2_size(sd_v2, size);
8808 - set_sd_v2_gid(sd_v2, inode->i_gid);
8809 set_sd_v2_mtime(sd_v2, inode->i_mtime.tv_sec);
8810 set_sd_v2_atime(sd_v2, inode->i_atime.tv_sec);
8811 set_sd_v2_ctime(sd_v2, inode->i_ctime.tv_sec);
8812 @@ -2856,14 +2867,19 @@ int reiserfs_commit_write(struct file *f
8813 void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode)
8815 if (reiserfs_attrs(inode->i_sb)) {
8816 - if (sd_attrs & REISERFS_SYNC_FL)
8817 - inode->i_flags |= S_SYNC;
8819 - inode->i_flags &= ~S_SYNC;
8820 if (sd_attrs & REISERFS_IMMUTABLE_FL)
8821 inode->i_flags |= S_IMMUTABLE;
8823 inode->i_flags &= ~S_IMMUTABLE;
8824 + if (sd_attrs & REISERFS_IXUNLINK_FL)
8825 + inode->i_flags |= S_IXUNLINK;
8827 + inode->i_flags &= ~S_IXUNLINK;
8829 + if (sd_attrs & REISERFS_SYNC_FL)
8830 + inode->i_flags |= S_SYNC;
8832 + inode->i_flags &= ~S_SYNC;
8833 if (sd_attrs & REISERFS_APPEND_FL)
8834 inode->i_flags |= S_APPEND;
8836 @@ -2876,6 +2892,15 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs,
8837 REISERFS_I(inode)->i_flags |= i_nopack_mask;
8839 REISERFS_I(inode)->i_flags &= ~i_nopack_mask;
8841 + if (sd_attrs & REISERFS_BARRIER_FL)
8842 + inode->i_vflags |= V_BARRIER;
8844 + inode->i_vflags &= ~V_BARRIER;
8845 + if (sd_attrs & REISERFS_COW_FL)
8846 + inode->i_vflags |= V_COW;
8848 + inode->i_vflags &= ~V_COW;
8852 @@ -2886,6 +2911,11 @@ void i_attrs_to_sd_attrs(struct inode *i
8853 *sd_attrs |= REISERFS_IMMUTABLE_FL;
8855 *sd_attrs &= ~REISERFS_IMMUTABLE_FL;
8856 + if (inode->i_flags & S_IXUNLINK)
8857 + *sd_attrs |= REISERFS_IXUNLINK_FL;
8859 + *sd_attrs &= ~REISERFS_IXUNLINK_FL;
8861 if (inode->i_flags & S_SYNC)
8862 *sd_attrs |= REISERFS_SYNC_FL;
8864 @@ -2898,6 +2928,15 @@ void i_attrs_to_sd_attrs(struct inode *i
8865 *sd_attrs |= REISERFS_NOTAIL_FL;
8867 *sd_attrs &= ~REISERFS_NOTAIL_FL;
8869 + if (inode->i_vflags & V_BARRIER)
8870 + *sd_attrs |= REISERFS_BARRIER_FL;
8872 + *sd_attrs &= ~REISERFS_BARRIER_FL;
8873 + if (inode->i_vflags & V_COW)
8874 + *sd_attrs |= REISERFS_COW_FL;
8876 + *sd_attrs &= ~REISERFS_COW_FL;
8880 @@ -3122,9 +3161,11 @@ int reiserfs_setattr(struct dentry *dent
8883 error = inode_change_ok(inode, attr);
8886 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
8887 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
8888 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
8889 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
8890 error = reiserfs_chown_xattrs(inode, attr);
8893 @@ -3153,6 +3194,9 @@ int reiserfs_setattr(struct dentry *dent
8894 inode->i_uid = attr->ia_uid;
8895 if (attr->ia_valid & ATTR_GID)
8896 inode->i_gid = attr->ia_gid;
8897 + if ((attr->ia_valid & ATTR_TAG) &&
8899 + inode->i_tag = attr->ia_tag;
8900 mark_inode_dirty(inode);
8902 journal_end(&th, inode->i_sb, jbegin_count);
8903 diff -NurpP --minimal linux-2.6.35.2/fs/reiserfs/ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/ioctl.c
8904 --- linux-2.6.35.2/fs/reiserfs/ioctl.c 2010-02-25 11:52:06.000000000 +0100
8905 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/ioctl.c 2010-08-02 17:05:06.000000000 +0200
8907 #include <linux/mount.h>
8908 #include <linux/reiserfs_fs.h>
8909 #include <linux/time.h>
8910 +#include <linux/mount.h>
8911 #include <asm/uaccess.h>
8912 #include <linux/pagemap.h>
8913 #include <linux/smp_lock.h>
8914 #include <linux/compat.h>
8917 +int reiserfs_sync_flags(struct inode *inode, int flags, int vflags)
8919 + __u16 sd_attrs = 0;
8921 + inode->i_flags = flags;
8922 + inode->i_vflags = vflags;
8924 + i_attrs_to_sd_attrs(inode, &sd_attrs);
8925 + REISERFS_I(inode)->i_attrs = sd_attrs;
8926 + inode->i_ctime = CURRENT_TIME_SEC;
8927 + mark_inode_dirty(inode);
8932 * reiserfs_ioctl - handler for ioctl for inode
8933 * supported commands:
8935 long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
8937 struct inode *inode = filp->f_path.dentry->d_inode;
8938 - unsigned int flags;
8939 + unsigned int flags, oldflags;
8942 reiserfs_write_lock(inode->i_sb);
8943 @@ -48,6 +64,7 @@ long reiserfs_ioctl(struct file *filp, u
8945 flags = REISERFS_I(inode)->i_attrs;
8946 i_attrs_to_sd_attrs(inode, (__u16 *) & flags);
8947 + flags &= REISERFS_FL_USER_VISIBLE;
8948 err = put_user(flags, (int __user *)arg);
8950 case REISERFS_IOC_SETFLAGS:{
8951 @@ -68,6 +85,10 @@ long reiserfs_ioctl(struct file *filp, u
8955 + if (IS_BARRIER(inode)) {
8956 + vxwprintk_task(1, "messing with the barrier.");
8960 * Is it quota file? Do not allow user to mess with it
8962 @@ -92,6 +113,10 @@ long reiserfs_ioctl(struct file *filp, u
8967 + oldflags = REISERFS_I(inode)->i_attrs;
8968 + flags &= REISERFS_FL_USER_MODIFIABLE;
8969 + flags |= oldflags & ~REISERFS_FL_USER_MODIFIABLE;
8970 sd_attrs_to_i_attrs(flags, inode);
8971 REISERFS_I(inode)->i_attrs = flags;
8972 inode->i_ctime = CURRENT_TIME_SEC;
8973 diff -NurpP --minimal linux-2.6.35.2/fs/reiserfs/namei.c linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/namei.c
8974 --- linux-2.6.35.2/fs/reiserfs/namei.c 2010-08-02 16:52:52.000000000 +0200
8975 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/namei.c 2010-08-02 17:05:06.000000000 +0200
8977 #include <linux/reiserfs_acl.h>
8978 #include <linux/reiserfs_xattr.h>
8979 #include <linux/quotaops.h>
8980 +#include <linux/vs_tag.h>
8982 #define INC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) { inc_nlink(i); if (i->i_nlink >= REISERFS_LINK_MAX) i->i_nlink=1; }
8983 #define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i);
8984 @@ -362,6 +363,7 @@ static struct dentry *reiserfs_lookup(st
8985 if (retval == IO_ERROR) {
8986 return ERR_PTR(-EIO);
8988 + dx_propagate_tag(nd, inode);
8990 return d_splice_alias(inode, dentry);
8992 @@ -1532,6 +1534,7 @@ const struct inode_operations reiserfs_d
8993 .listxattr = reiserfs_listxattr,
8994 .removexattr = reiserfs_removexattr,
8995 .permission = reiserfs_permission,
8996 + .sync_flags = reiserfs_sync_flags,
9000 diff -NurpP --minimal linux-2.6.35.2/fs/reiserfs/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/super.c
9001 --- linux-2.6.35.2/fs/reiserfs/super.c 2010-08-02 16:52:52.000000000 +0200
9002 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/super.c 2010-08-02 17:05:06.000000000 +0200
9003 @@ -897,6 +897,14 @@ static int reiserfs_parse_options(struct
9004 {"user_xattr",.setmask = 1 << REISERFS_UNSUPPORTED_OPT},
9005 {"nouser_xattr",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT},
9007 +#ifndef CONFIG_TAGGING_NONE
9008 + {"tagxid",.setmask = 1 << REISERFS_TAGGED},
9009 + {"tag",.setmask = 1 << REISERFS_TAGGED},
9010 + {"notag",.clrmask = 1 << REISERFS_TAGGED},
9012 +#ifdef CONFIG_PROPAGATE
9013 + {"tag",.arg_required = 'T',.values = NULL},
9015 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
9016 {"acl",.setmask = 1 << REISERFS_POSIXACL},
9017 {"noacl",.clrmask = 1 << REISERFS_POSIXACL},
9018 @@ -1206,6 +1214,14 @@ static int reiserfs_remount(struct super
9019 handle_quota_files(s, qf_names, &qfmt);
9022 + if ((mount_options & (1 << REISERFS_TAGGED)) &&
9023 + !(s->s_flags & MS_TAGGED)) {
9024 + reiserfs_warning(s, "super-vs01",
9025 + "reiserfs: tagging not permitted on remount.");
9032 /* Add options that are safe here */
9033 @@ -1688,6 +1704,10 @@ static int reiserfs_fill_super(struct su
9037 + /* map mount option tagxid */
9038 + if (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TAGGED))
9039 + s->s_flags |= MS_TAGGED;
9041 rs = SB_DISK_SUPER_BLOCK(s);
9042 /* Let's do basic sanity check to verify that underlying device is not
9043 smaller than the filesystem. If the check fails then abort and scream,
9044 diff -NurpP --minimal linux-2.6.35.2/fs/reiserfs/xattr.c linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/xattr.c
9045 --- linux-2.6.35.2/fs/reiserfs/xattr.c 2010-08-02 16:52:52.000000000 +0200
9046 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/reiserfs/xattr.c 2010-08-02 17:05:06.000000000 +0200
9048 #include <linux/errno.h>
9049 #include <linux/gfp.h>
9050 #include <linux/fs.h>
9051 +#include <linux/mount.h>
9052 #include <linux/file.h>
9053 #include <linux/pagemap.h>
9054 #include <linux/xattr.h>
9055 diff -NurpP --minimal linux-2.6.35.2/fs/stat.c linux-2.6.35.2-vs2.3.0.36.31/fs/stat.c
9056 --- linux-2.6.35.2/fs/stat.c 2010-02-25 11:52:06.000000000 +0100
9057 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/stat.c 2010-08-02 17:05:06.000000000 +0200
9058 @@ -26,6 +26,7 @@ void generic_fillattr(struct inode *inod
9059 stat->nlink = inode->i_nlink;
9060 stat->uid = inode->i_uid;
9061 stat->gid = inode->i_gid;
9062 + stat->tag = inode->i_tag;
9063 stat->rdev = inode->i_rdev;
9064 stat->atime = inode->i_atime;
9065 stat->mtime = inode->i_mtime;
9066 diff -NurpP --minimal linux-2.6.35.2/fs/statfs.c linux-2.6.35.2-vs2.3.0.36.31/fs/statfs.c
9067 --- linux-2.6.35.2/fs/statfs.c 2010-08-02 16:52:52.000000000 +0200
9068 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/statfs.c 2010-08-02 19:10:27.000000000 +0200
9070 #include <linux/statfs.h>
9071 #include <linux/security.h>
9072 #include <linux/uaccess.h>
9073 +#include <linux/vs_base.h>
9074 +#include <linux/vs_dlimit.h>
9076 int vfs_statfs(struct dentry *dentry, struct kstatfs *buf)
9078 int retval = -ENODEV;
9081 + struct super_block *sb = dentry->d_sb;
9084 - if (dentry->d_sb->s_op->statfs) {
9085 + if (sb->s_op->statfs) {
9086 memset(buf, 0, sizeof(*buf));
9087 retval = security_sb_statfs(dentry);
9090 - retval = dentry->d_sb->s_op->statfs(dentry, buf);
9091 + retval = sb->s_op->statfs(dentry, buf);
9092 if (retval == 0 && buf->f_frsize == 0)
9093 buf->f_frsize = buf->f_bsize;
9095 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
9096 + vx_vsi_statfs(sb, buf);
9100 diff -NurpP --minimal linux-2.6.35.2/fs/super.c linux-2.6.35.2-vs2.3.0.36.31/fs/super.c
9101 --- linux-2.6.35.2/fs/super.c 2010-08-14 18:16:59.000000000 +0200
9102 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/super.c 2010-08-14 18:20:34.000000000 +0200
9104 #include <linux/idr.h>
9105 #include <linux/mutex.h>
9106 #include <linux/backing-dev.h>
9107 +#include <linux/devpts_fs.h>
9108 +#include <linux/proc_fs.h>
9109 +#include <linux/vs_context.h>
9110 #include "internal.h"
9113 @@ -885,12 +888,18 @@ struct vfsmount *
9114 vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
9116 struct vfsmount *mnt;
9117 + struct super_block *sb;
9118 char *secdata = NULL;
9122 return ERR_PTR(-ENODEV);
9125 + if ((type->fs_flags & FS_BINARY_MOUNTDATA) &&
9126 + !vx_capable(CAP_SYS_ADMIN, VXC_BINARY_MOUNT))
9130 mnt = alloc_vfsmnt(name);
9132 @@ -912,11 +921,19 @@ vfs_kern_mount(struct file_system_type *
9133 error = type->get_sb(type, flags, name, data, mnt);
9135 goto out_free_secdata;
9136 - BUG_ON(!mnt->mnt_sb);
9137 - WARN_ON(!mnt->mnt_sb->s_bdi);
9141 + WARN_ON(!sb->s_bdi);
9142 mnt->mnt_sb->s_flags |= MS_BORN;
9144 - error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
9146 + if (!vx_capable(CAP_SYS_ADMIN, VXC_BINARY_MOUNT) && !sb->s_bdev &&
9147 + (sb->s_magic != PROC_SUPER_MAGIC) &&
9148 + (sb->s_magic != DEVPTS_SUPER_MAGIC))
9151 + error = security_sb_kern_mount(sb, flags, secdata);
9155 diff -NurpP --minimal linux-2.6.35.2/fs/sysfs/mount.c linux-2.6.35.2-vs2.3.0.36.31/fs/sysfs/mount.c
9156 --- linux-2.6.35.2/fs/sysfs/mount.c 2010-08-02 16:52:52.000000000 +0200
9157 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/sysfs/mount.c 2010-08-02 17:05:06.000000000 +0200
9158 @@ -47,7 +47,7 @@ static int sysfs_fill_super(struct super
9160 sb->s_blocksize = PAGE_CACHE_SIZE;
9161 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
9162 - sb->s_magic = SYSFS_MAGIC;
9163 + sb->s_magic = SYSFS_SUPER_MAGIC;
9164 sb->s_op = &sysfs_ops;
9165 sb->s_time_gran = 1;
9167 diff -NurpP --minimal linux-2.6.35.2/fs/utimes.c linux-2.6.35.2-vs2.3.0.36.31/fs/utimes.c
9168 --- linux-2.6.35.2/fs/utimes.c 2009-03-24 14:22:37.000000000 +0100
9169 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/utimes.c 2010-08-02 22:52:28.000000000 +0200
9171 #include <linux/stat.h>
9172 #include <linux/utime.h>
9173 #include <linux/syscalls.h>
9174 +#include <linux/mount.h>
9175 +#include <linux/vs_cowbl.h>
9176 #include <asm/uaccess.h>
9177 #include <asm/unistd.h>
9179 @@ -52,12 +54,18 @@ static int utimes_common(struct path *pa
9182 struct iattr newattrs;
9183 - struct inode *inode = path->dentry->d_inode;
9184 + struct inode *inode;
9186 error = mnt_want_write(path->mnt);
9190 + error = cow_check_and_break(path);
9192 + goto mnt_drop_write_and_out;
9194 + inode = path->dentry->d_inode;
9196 if (times && times[0].tv_nsec == UTIME_NOW &&
9197 times[1].tv_nsec == UTIME_NOW)
9199 diff -NurpP --minimal linux-2.6.35.2/fs/xattr.c linux-2.6.35.2-vs2.3.0.36.31/fs/xattr.c
9200 --- linux-2.6.35.2/fs/xattr.c 2010-08-02 16:52:52.000000000 +0200
9201 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xattr.c 2010-08-02 17:05:06.000000000 +0200
9203 #include <linux/module.h>
9204 #include <linux/fsnotify.h>
9205 #include <linux/audit.h>
9206 +#include <linux/mount.h>
9207 #include <asm/uaccess.h>
9210 @@ -49,7 +50,7 @@ xattr_permission(struct inode *inode, co
9211 * The trusted.* namespace can only be accessed by a privileged user.
9213 if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
9214 - return (capable(CAP_SYS_ADMIN) ? 0 : -EPERM);
9215 + return (vx_capable(CAP_SYS_ADMIN, VXC_FS_TRUSTED) ? 0 : -EPERM);
9217 /* In user.* namespace, only regular files and directories can have
9218 * extended attributes. For sticky directories, only the owner and
9219 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_ioctl.c
9220 --- linux-2.6.35.2/fs/xfs/linux-2.6/xfs_ioctl.c 2010-08-02 16:52:52.000000000 +0200
9221 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_ioctl.c 2010-08-02 17:05:06.000000000 +0200
9223 #include "xfs_dir2_sf.h"
9224 #include "xfs_dinode.h"
9225 #include "xfs_inode.h"
9226 -#include "xfs_ioctl.h"
9227 #include "xfs_btree.h"
9228 #include "xfs_ialloc.h"
9229 #include "xfs_rtalloc.h"
9230 @@ -747,6 +746,10 @@ xfs_merge_ioc_xflags(
9231 xflags |= XFS_XFLAG_IMMUTABLE;
9233 xflags &= ~XFS_XFLAG_IMMUTABLE;
9234 + if (flags & FS_IXUNLINK_FL)
9235 + xflags |= XFS_XFLAG_IXUNLINK;
9237 + xflags &= ~XFS_XFLAG_IXUNLINK;
9238 if (flags & FS_APPEND_FL)
9239 xflags |= XFS_XFLAG_APPEND;
9241 @@ -775,6 +778,8 @@ xfs_di2lxflags(
9243 if (di_flags & XFS_DIFLAG_IMMUTABLE)
9244 flags |= FS_IMMUTABLE_FL;
9245 + if (di_flags & XFS_DIFLAG_IXUNLINK)
9246 + flags |= FS_IXUNLINK_FL;
9247 if (di_flags & XFS_DIFLAG_APPEND)
9248 flags |= FS_APPEND_FL;
9249 if (di_flags & XFS_DIFLAG_SYNC)
9250 @@ -833,6 +838,8 @@ xfs_set_diflags(
9251 di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC);
9252 if (xflags & XFS_XFLAG_IMMUTABLE)
9253 di_flags |= XFS_DIFLAG_IMMUTABLE;
9254 + if (xflags & XFS_XFLAG_IXUNLINK)
9255 + di_flags |= XFS_DIFLAG_IXUNLINK;
9256 if (xflags & XFS_XFLAG_APPEND)
9257 di_flags |= XFS_DIFLAG_APPEND;
9258 if (xflags & XFS_XFLAG_SYNC)
9259 @@ -875,6 +882,10 @@ xfs_diflags_to_linux(
9260 inode->i_flags |= S_IMMUTABLE;
9262 inode->i_flags &= ~S_IMMUTABLE;
9263 + if (xflags & XFS_XFLAG_IXUNLINK)
9264 + inode->i_flags |= S_IXUNLINK;
9266 + inode->i_flags &= ~S_IXUNLINK;
9267 if (xflags & XFS_XFLAG_APPEND)
9268 inode->i_flags |= S_APPEND;
9270 @@ -1351,10 +1362,18 @@ xfs_file_ioctl(
9271 case XFS_IOC_FSGETXATTRA:
9272 return xfs_ioc_fsgetxattr(ip, 1, arg);
9273 case XFS_IOC_FSSETXATTR:
9274 + if (IS_BARRIER(inode)) {
9275 + vxwprintk_task(1, "messing with the barrier.");
9276 + return -XFS_ERROR(EACCES);
9278 return xfs_ioc_fssetxattr(ip, filp, arg);
9279 case XFS_IOC_GETXFLAGS:
9280 return xfs_ioc_getxflags(ip, arg);
9281 case XFS_IOC_SETXFLAGS:
9282 + if (IS_BARRIER(inode)) {
9283 + vxwprintk_task(1, "messing with the barrier.");
9284 + return -XFS_ERROR(EACCES);
9286 return xfs_ioc_setxflags(ip, filp, arg);
9288 case XFS_IOC_FSSETDM: {
9289 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/linux-2.6/xfs_ioctl.h linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_ioctl.h
9290 --- linux-2.6.35.2/fs/xfs/linux-2.6/xfs_ioctl.h 2010-07-07 18:31:54.000000000 +0200
9291 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_ioctl.h 2010-08-02 17:05:06.000000000 +0200
9292 @@ -70,6 +70,12 @@ xfs_handle_to_dentry(
9293 void __user *uhandle,
9298 + struct inode *inode,
9305 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_iops.c
9306 --- linux-2.6.35.2/fs/xfs/linux-2.6/xfs_iops.c 2010-08-02 16:52:52.000000000 +0200
9307 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_iops.c 2010-08-02 17:05:06.000000000 +0200
9309 #include "xfs_attr_sf.h"
9310 #include "xfs_dinode.h"
9311 #include "xfs_inode.h"
9312 +#include "xfs_ioctl.h"
9313 #include "xfs_bmap.h"
9314 #include "xfs_btree.h"
9315 #include "xfs_ialloc.h"
9317 #include <linux/falloc.h>
9318 #include <linux/fiemap.h>
9319 #include <linux/slab.h>
9320 +#include <linux/vs_tag.h>
9323 * Bring the timestamps in the XFS inode uptodate.
9324 @@ -507,6 +509,7 @@ xfs_vn_getattr(
9325 stat->nlink = ip->i_d.di_nlink;
9326 stat->uid = ip->i_d.di_uid;
9327 stat->gid = ip->i_d.di_gid;
9328 + stat->tag = ip->i_d.di_tag;
9329 stat->ino = ip->i_ino;
9330 stat->atime = inode->i_atime;
9331 stat->mtime = inode->i_mtime;
9332 @@ -711,6 +714,7 @@ static const struct inode_operations xfs
9333 .listxattr = xfs_vn_listxattr,
9334 .fallocate = xfs_vn_fallocate,
9335 .fiemap = xfs_vn_fiemap,
9336 + .sync_flags = xfs_sync_flags,
9339 static const struct inode_operations xfs_dir_inode_operations = {
9340 @@ -736,6 +740,7 @@ static const struct inode_operations xfs
9341 .getxattr = generic_getxattr,
9342 .removexattr = generic_removexattr,
9343 .listxattr = xfs_vn_listxattr,
9344 + .sync_flags = xfs_sync_flags,
9347 static const struct inode_operations xfs_dir_ci_inode_operations = {
9348 @@ -785,6 +790,10 @@ xfs_diflags_to_iflags(
9349 inode->i_flags |= S_IMMUTABLE;
9351 inode->i_flags &= ~S_IMMUTABLE;
9352 + if (ip->i_d.di_flags & XFS_DIFLAG_IXUNLINK)
9353 + inode->i_flags |= S_IXUNLINK;
9355 + inode->i_flags &= ~S_IXUNLINK;
9356 if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
9357 inode->i_flags |= S_APPEND;
9359 @@ -797,6 +806,15 @@ xfs_diflags_to_iflags(
9360 inode->i_flags |= S_NOATIME;
9362 inode->i_flags &= ~S_NOATIME;
9364 + if (ip->i_d.di_vflags & XFS_DIVFLAG_BARRIER)
9365 + inode->i_vflags |= V_BARRIER;
9367 + inode->i_vflags &= ~V_BARRIER;
9368 + if (ip->i_d.di_vflags & XFS_DIVFLAG_COW)
9369 + inode->i_vflags |= V_COW;
9371 + inode->i_vflags &= ~V_COW;
9375 @@ -825,6 +843,7 @@ xfs_setup_inode(
9376 inode->i_nlink = ip->i_d.di_nlink;
9377 inode->i_uid = ip->i_d.di_uid;
9378 inode->i_gid = ip->i_d.di_gid;
9379 + inode->i_tag = ip->i_d.di_tag;
9381 switch (inode->i_mode & S_IFMT) {
9383 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/linux-2.6/xfs_linux.h linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_linux.h
9384 --- linux-2.6.35.2/fs/xfs/linux-2.6/xfs_linux.h 2010-07-07 18:31:54.000000000 +0200
9385 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_linux.h 2010-08-02 17:05:06.000000000 +0200
9388 #define current_cpu() (raw_smp_processor_id())
9389 #define current_pid() (current->pid)
9390 +#define current_fstag(cred,vp) (dx_current_fstag((vp)->i_sb))
9391 #define current_test_flags(f) (current->flags & (f))
9392 #define current_set_flags_nested(sp, f) \
9393 (*(sp) = current->flags, current->flags |= (f))
9394 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/linux-2.6/xfs_super.c linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_super.c
9395 --- linux-2.6.35.2/fs/xfs/linux-2.6/xfs_super.c 2010-08-02 16:52:52.000000000 +0200
9396 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/linux-2.6/xfs_super.c 2010-08-02 18:00:35.000000000 +0200
9397 @@ -121,6 +121,9 @@ mempool_t *xfs_ioend_pool;
9398 #define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */
9399 #define MNTOPT_DELAYLOG "delaylog" /* Delayed loging enabled */
9400 #define MNTOPT_NODELAYLOG "nodelaylog" /* Delayed loging disabled */
9401 +#define MNTOPT_TAGXID "tagxid" /* context tagging for inodes */
9402 +#define MNTOPT_TAGGED "tag" /* context tagging for inodes */
9403 +#define MNTOPT_NOTAGTAG "notag" /* do not use context tagging */
9406 * Table driven mount option parser.
9407 @@ -129,10 +132,14 @@ mempool_t *xfs_ioend_pool;
9408 * in the future, too.
9411 + Opt_tag, Opt_notag,
9412 Opt_barrier, Opt_nobarrier, Opt_err
9415 static const match_table_t tokens = {
9416 + {Opt_tag, "tagxid"},
9418 + {Opt_notag, "notag"},
9419 {Opt_barrier, "barrier"},
9420 {Opt_nobarrier, "nobarrier"},
9422 @@ -393,6 +400,19 @@ xfs_parseargs(
9423 } else if (!strcmp(this_char, "irixsgid")) {
9425 "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
9426 +#ifndef CONFIG_TAGGING_NONE
9427 + } else if (!strcmp(this_char, MNTOPT_TAGGED)) {
9428 + mp->m_flags |= XFS_MOUNT_TAGGED;
9429 + } else if (!strcmp(this_char, MNTOPT_NOTAGTAG)) {
9430 + mp->m_flags &= ~XFS_MOUNT_TAGGED;
9431 + } else if (!strcmp(this_char, MNTOPT_TAGXID)) {
9432 + mp->m_flags |= XFS_MOUNT_TAGGED;
9434 +#ifdef CONFIG_PROPAGATE
9435 + } else if (!strcmp(this_char, MNTOPT_TAGGED)) {
9437 + mp->m_flags |= XFS_MOUNT_TAGGED;
9441 "XFS: unknown mount option [%s].", this_char);
9442 @@ -1376,6 +1396,16 @@ xfs_fs_remount(
9444 mp->m_flags &= ~XFS_MOUNT_BARRIER;
9447 + if (!(sb->s_flags & MS_TAGGED)) {
9449 + "XFS: %s: tagging not permitted on remount.\n",
9458 * Logically we would return an error here to prevent
9459 @@ -1610,6 +1640,9 @@ xfs_fs_fill_super(
9461 XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, mtpt, mp->m_fsname);
9463 + if (mp->m_flags & XFS_MOUNT_TAGGED)
9464 + sb->s_flags |= MS_TAGGED;
9466 sb->s_magic = XFS_SB_MAGIC;
9467 sb->s_blocksize = mp->m_sb.sb_blocksize;
9468 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1;
9469 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_dinode.h linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_dinode.h
9470 --- linux-2.6.35.2/fs/xfs/xfs_dinode.h 2009-06-11 17:13:09.000000000 +0200
9471 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_dinode.h 2010-08-02 17:05:06.000000000 +0200
9472 @@ -50,7 +50,9 @@ typedef struct xfs_dinode {
9473 __be32 di_gid; /* owner's group id */
9474 __be32 di_nlink; /* number of links to file */
9475 __be16 di_projid; /* owner's project id */
9476 - __u8 di_pad[8]; /* unused, zeroed space */
9477 + __be16 di_tag; /* context tagging */
9478 + __be16 di_vflags; /* vserver specific flags */
9479 + __u8 di_pad[4]; /* unused, zeroed space */
9480 __be16 di_flushiter; /* incremented on flush */
9481 xfs_timestamp_t di_atime; /* time last accessed */
9482 xfs_timestamp_t di_mtime; /* time last modified */
9483 @@ -183,6 +185,8 @@ static inline void xfs_dinode_put_rdev(s
9484 #define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
9485 #define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */
9486 #define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */
9487 +#define XFS_DIFLAG_IXUNLINK_BIT 15 /* Immutable inver on unlink */
9489 #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
9490 #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
9491 #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
9492 @@ -198,6 +202,7 @@ static inline void xfs_dinode_put_rdev(s
9493 #define XFS_DIFLAG_EXTSZINHERIT (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
9494 #define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT)
9495 #define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT)
9496 +#define XFS_DIFLAG_IXUNLINK (1 << XFS_DIFLAG_IXUNLINK_BIT)
9498 #ifdef CONFIG_XFS_RT
9499 #define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
9500 @@ -210,6 +215,10 @@ static inline void xfs_dinode_put_rdev(s
9501 XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
9502 XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
9503 XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
9504 - XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM)
9505 + XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM | \
9506 + XFS_DIFLAG_IXUNLINK)
9508 +#define XFS_DIVFLAG_BARRIER 0x01
9509 +#define XFS_DIVFLAG_COW 0x02
9511 #endif /* __XFS_DINODE_H__ */
9512 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_fs.h linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_fs.h
9513 --- linux-2.6.35.2/fs/xfs/xfs_fs.h 2010-07-07 18:31:54.000000000 +0200
9514 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_fs.h 2010-08-02 17:05:06.000000000 +0200
9515 @@ -67,6 +67,9 @@ struct fsxattr {
9516 #define XFS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
9517 #define XFS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
9518 #define XFS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
9519 +#define XFS_XFLAG_IXUNLINK 0x00008000 /* immutable invert on unlink */
9520 +#define XFS_XFLAG_BARRIER 0x10000000 /* chroot() barrier */
9521 +#define XFS_XFLAG_COW 0x20000000 /* copy on write mark */
9522 #define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
9525 @@ -293,7 +296,8 @@ typedef struct xfs_bstat {
9526 __u32 bs_gen; /* generation count */
9527 __u16 bs_projid; /* project id */
9528 __u16 bs_forkoff; /* inode fork offset in bytes */
9529 - unsigned char bs_pad[12]; /* pad space, unused */
9530 + __u16 bs_tag; /* context tagging */
9531 + unsigned char bs_pad[10]; /* pad space, unused */
9532 __u32 bs_dmevmask; /* DMIG event mask */
9533 __u16 bs_dmstate; /* DMIG state info */
9534 __u16 bs_aextents; /* attribute number of extents */
9535 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_ialloc.c linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_ialloc.c
9536 --- linux-2.6.35.2/fs/xfs/xfs_ialloc.c 2010-08-02 16:52:53.000000000 +0200
9537 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_ialloc.c 2010-08-02 17:05:06.000000000 +0200
9539 #include "xfs_error.h"
9540 #include "xfs_bmap.h"
9544 * Allocation group level functions.
9546 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_inode.c linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_inode.c
9547 --- linux-2.6.35.2/fs/xfs/xfs_inode.c 2010-08-02 16:52:53.000000000 +0200
9548 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_inode.c 2010-08-02 17:05:06.000000000 +0200
9549 @@ -249,6 +249,7 @@ xfs_inotobp(
9553 +#include <linux/vs_tag.h>
9556 * This routine is called to map an inode to the buffer containing
9557 @@ -654,15 +655,25 @@ xfs_iformat_btree(
9559 xfs_dinode_from_disk(
9561 - xfs_dinode_t *from)
9562 + xfs_dinode_t *from,
9565 + uint32_t uid, gid, tag;
9567 to->di_magic = be16_to_cpu(from->di_magic);
9568 to->di_mode = be16_to_cpu(from->di_mode);
9569 to->di_version = from ->di_version;
9570 to->di_format = from->di_format;
9571 to->di_onlink = be16_to_cpu(from->di_onlink);
9572 - to->di_uid = be32_to_cpu(from->di_uid);
9573 - to->di_gid = be32_to_cpu(from->di_gid);
9575 + uid = be32_to_cpu(from->di_uid);
9576 + gid = be32_to_cpu(from->di_gid);
9577 + tag = be16_to_cpu(from->di_tag);
9579 + to->di_uid = INOTAG_UID(tagged, uid, gid);
9580 + to->di_gid = INOTAG_GID(tagged, uid, gid);
9581 + to->di_tag = INOTAG_TAG(tagged, uid, gid, tag);
9583 to->di_nlink = be32_to_cpu(from->di_nlink);
9584 to->di_projid = be16_to_cpu(from->di_projid);
9585 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
9586 @@ -683,21 +694,26 @@ xfs_dinode_from_disk(
9587 to->di_dmevmask = be32_to_cpu(from->di_dmevmask);
9588 to->di_dmstate = be16_to_cpu(from->di_dmstate);
9589 to->di_flags = be16_to_cpu(from->di_flags);
9590 + to->di_vflags = be16_to_cpu(from->di_vflags);
9591 to->di_gen = be32_to_cpu(from->di_gen);
9597 - xfs_icdinode_t *from)
9598 + xfs_icdinode_t *from,
9601 to->di_magic = cpu_to_be16(from->di_magic);
9602 to->di_mode = cpu_to_be16(from->di_mode);
9603 to->di_version = from ->di_version;
9604 to->di_format = from->di_format;
9605 to->di_onlink = cpu_to_be16(from->di_onlink);
9606 - to->di_uid = cpu_to_be32(from->di_uid);
9607 - to->di_gid = cpu_to_be32(from->di_gid);
9609 + to->di_uid = cpu_to_be32(TAGINO_UID(tagged, from->di_uid, from->di_tag));
9610 + to->di_gid = cpu_to_be32(TAGINO_GID(tagged, from->di_gid, from->di_tag));
9611 + to->di_tag = cpu_to_be16(TAGINO_TAG(tagged, from->di_tag));
9613 to->di_nlink = cpu_to_be32(from->di_nlink);
9614 to->di_projid = cpu_to_be16(from->di_projid);
9615 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
9616 @@ -718,12 +734,14 @@ xfs_dinode_to_disk(
9617 to->di_dmevmask = cpu_to_be32(from->di_dmevmask);
9618 to->di_dmstate = cpu_to_be16(from->di_dmstate);
9619 to->di_flags = cpu_to_be16(from->di_flags);
9620 + to->di_vflags = cpu_to_be16(from->di_vflags);
9621 to->di_gen = cpu_to_be32(from->di_gen);
9626 - __uint16_t di_flags)
9627 + __uint16_t di_flags,
9628 + __uint16_t di_vflags)
9632 @@ -734,6 +752,8 @@ _xfs_dic2xflags(
9633 flags |= XFS_XFLAG_PREALLOC;
9634 if (di_flags & XFS_DIFLAG_IMMUTABLE)
9635 flags |= XFS_XFLAG_IMMUTABLE;
9636 + if (di_flags & XFS_DIFLAG_IXUNLINK)
9637 + flags |= XFS_XFLAG_IXUNLINK;
9638 if (di_flags & XFS_DIFLAG_APPEND)
9639 flags |= XFS_XFLAG_APPEND;
9640 if (di_flags & XFS_DIFLAG_SYNC)
9641 @@ -758,6 +778,10 @@ _xfs_dic2xflags(
9642 flags |= XFS_XFLAG_FILESTREAM;
9645 + if (di_vflags & XFS_DIVFLAG_BARRIER)
9646 + flags |= FS_BARRIER_FL;
9647 + if (di_vflags & XFS_DIVFLAG_COW)
9648 + flags |= FS_COW_FL;
9652 @@ -767,7 +791,7 @@ xfs_ip2xflags(
9654 xfs_icdinode_t *dic = &ip->i_d;
9656 - return _xfs_dic2xflags(dic->di_flags) |
9657 + return _xfs_dic2xflags(dic->di_flags, dic->di_vflags) |
9658 (XFS_IFORK_Q(ip) ? XFS_XFLAG_HASATTR : 0);
9661 @@ -775,7 +799,8 @@ uint
9665 - return _xfs_dic2xflags(be16_to_cpu(dip->di_flags)) |
9666 + return _xfs_dic2xflags(be16_to_cpu(dip->di_flags),
9667 + be16_to_cpu(dip->di_vflags)) |
9668 (XFS_DFORK_Q(dip) ? XFS_XFLAG_HASATTR : 0);
9671 @@ -808,7 +833,6 @@ xfs_iread(
9674 dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);
9677 * If we got something that isn't an inode it means someone
9678 * (nfs or dmi) has a stale handle.
9679 @@ -833,7 +857,8 @@ xfs_iread(
9680 * Otherwise, just get the truly permanent information.
9683 - xfs_dinode_from_disk(&ip->i_d, dip);
9684 + xfs_dinode_from_disk(&ip->i_d, dip,
9685 + mp->m_flags & XFS_MOUNT_TAGGED);
9686 error = xfs_iformat(ip, dip);
9689 @@ -1033,6 +1058,7 @@ xfs_ialloc(
9690 ASSERT(ip->i_d.di_nlink == nlink);
9691 ip->i_d.di_uid = current_fsuid();
9692 ip->i_d.di_gid = current_fsgid();
9693 + ip->i_d.di_tag = current_fstag(cr, &ip->i_vnode);
9694 ip->i_d.di_projid = prid;
9695 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
9697 @@ -1093,6 +1119,7 @@ xfs_ialloc(
9698 ip->i_d.di_dmevmask = 0;
9699 ip->i_d.di_dmstate = 0;
9700 ip->i_d.di_flags = 0;
9701 + ip->i_d.di_vflags = 0;
9702 flags = XFS_ILOG_CORE;
9703 switch (mode & S_IFMT) {
9705 @@ -2116,6 +2143,7 @@ xfs_ifree(
9707 ip->i_d.di_mode = 0; /* mark incore inode as free */
9708 ip->i_d.di_flags = 0;
9709 + ip->i_d.di_vflags = 0;
9710 ip->i_d.di_dmevmask = 0;
9711 ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */
9712 ip->i_df.if_ext_max =
9713 @@ -2985,7 +3013,8 @@ xfs_iflush_int(
9714 * because if the inode is dirty at all the core must
9717 - xfs_dinode_to_disk(dip, &ip->i_d);
9718 + xfs_dinode_to_disk(dip, &ip->i_d,
9719 + mp->m_flags & XFS_MOUNT_TAGGED);
9721 /* Wrap, we never let the log put out DI_MAX_FLUSH */
9722 if (ip->i_d.di_flushiter == DI_MAX_FLUSH)
9723 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_inode.h linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_inode.h
9724 --- linux-2.6.35.2/fs/xfs/xfs_inode.h 2010-08-02 16:52:53.000000000 +0200
9725 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_inode.h 2010-08-02 17:05:06.000000000 +0200
9726 @@ -135,7 +135,9 @@ typedef struct xfs_icdinode {
9727 __uint32_t di_gid; /* owner's group id */
9728 __uint32_t di_nlink; /* number of links to file */
9729 __uint16_t di_projid; /* owner's project id */
9730 - __uint8_t di_pad[8]; /* unused, zeroed space */
9731 + __uint16_t di_tag; /* context tagging */
9732 + __uint16_t di_vflags; /* vserver specific flags */
9733 + __uint8_t di_pad[4]; /* unused, zeroed space */
9734 __uint16_t di_flushiter; /* incremented on flush */
9735 xfs_ictimestamp_t di_atime; /* time last accessed */
9736 xfs_ictimestamp_t di_mtime; /* time last modified */
9737 @@ -511,7 +513,7 @@ int xfs_itobp(struct xfs_mount *, struc
9738 int xfs_iread(struct xfs_mount *, struct xfs_trans *,
9739 struct xfs_inode *, uint);
9740 void xfs_dinode_to_disk(struct xfs_dinode *,
9741 - struct xfs_icdinode *);
9742 + struct xfs_icdinode *, int);
9743 void xfs_idestroy_fork(struct xfs_inode *, int);
9744 void xfs_idata_realloc(struct xfs_inode *, int, int);
9745 void xfs_iroot_realloc(struct xfs_inode *, int, int);
9746 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_itable.c linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_itable.c
9747 --- linux-2.6.35.2/fs/xfs/xfs_itable.c 2010-08-02 16:52:53.000000000 +0200
9748 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_itable.c 2010-08-02 17:05:06.000000000 +0200
9749 @@ -100,6 +100,7 @@ xfs_bulkstat_one_int(
9750 buf->bs_mode = dic->di_mode;
9751 buf->bs_uid = dic->di_uid;
9752 buf->bs_gid = dic->di_gid;
9753 + buf->bs_tag = dic->di_tag;
9754 buf->bs_size = dic->di_size;
9757 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_log_recover.c linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_log_recover.c
9758 --- linux-2.6.35.2/fs/xfs/xfs_log_recover.c 2010-08-02 16:52:53.000000000 +0200
9759 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_log_recover.c 2010-08-02 17:05:06.000000000 +0200
9760 @@ -2461,7 +2461,8 @@ xlog_recover_do_inode_trans(
9763 /* The core is in in-core format */
9764 - xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr);
9765 + xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr,
9766 + mp->m_flags & XFS_MOUNT_TAGGED);
9768 /* the rest is in on-disk format */
9769 if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) {
9770 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_mount.h linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_mount.h
9771 --- linux-2.6.35.2/fs/xfs/xfs_mount.h 2010-08-02 16:52:53.000000000 +0200
9772 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_mount.h 2010-08-02 17:05:06.000000000 +0200
9773 @@ -302,6 +302,7 @@ typedef struct xfs_mount {
9775 #define XFS_MOUNT_NOATTR2 (1ULL << 25) /* disable use of attr2 format */
9777 +#define XFS_MOUNT_TAGGED (1ULL << 31) /* context tagging */
9780 * Default minimum read and write sizes.
9781 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_vnodeops.c linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_vnodeops.c
9782 --- linux-2.6.35.2/fs/xfs/xfs_vnodeops.c 2010-08-02 16:52:53.000000000 +0200
9783 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_vnodeops.c 2010-08-02 17:05:06.000000000 +0200
9785 #include "xfs_vnodeops.h"
9786 #include "xfs_trace.h"
9790 +xfs_get_inode_flags(
9793 + struct inode *inode = VFS_I(ip);
9794 + unsigned int flags = inode->i_flags;
9795 + unsigned int vflags = inode->i_vflags;
9797 + if (flags & S_IMMUTABLE)
9798 + ip->i_d.di_flags |= XFS_DIFLAG_IMMUTABLE;
9800 + ip->i_d.di_flags &= ~XFS_DIFLAG_IMMUTABLE;
9801 + if (flags & S_IXUNLINK)
9802 + ip->i_d.di_flags |= XFS_DIFLAG_IXUNLINK;
9804 + ip->i_d.di_flags &= ~XFS_DIFLAG_IXUNLINK;
9806 + if (vflags & V_BARRIER)
9807 + ip->i_d.di_vflags |= XFS_DIVFLAG_BARRIER;
9809 + ip->i_d.di_vflags &= ~XFS_DIVFLAG_BARRIER;
9810 + if (vflags & V_COW)
9811 + ip->i_d.di_vflags |= XFS_DIVFLAG_COW;
9813 + ip->i_d.di_vflags &= ~XFS_DIVFLAG_COW;
9818 + struct inode *inode,
9822 + struct xfs_inode *ip = XFS_I(inode);
9823 + struct xfs_mount *mp = ip->i_mount;
9824 + struct xfs_trans *tp;
9825 + unsigned int lock_flags = 0;
9828 + tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
9829 + code = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0);
9833 + lock_flags = XFS_ILOCK_EXCL;
9834 + xfs_ilock(ip, lock_flags);
9836 + xfs_trans_ijoin(tp, ip, lock_flags);
9837 + xfs_trans_ihold(tp, ip);
9839 + inode->i_flags = flags;
9840 + inode->i_vflags = vflags;
9841 + xfs_get_inode_flags(ip);
9843 + xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
9844 + xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
9846 + XFS_STATS_INC(xs_ig_attrchg);
9848 + if (mp->m_flags & XFS_MOUNT_WSYNC)
9849 + xfs_trans_set_sync(tp);
9850 + code = xfs_trans_commit(tp, 0);
9851 + xfs_iunlock(ip, lock_flags);
9855 + xfs_trans_cancel(tp, 0);
9857 + xfs_iunlock(ip, lock_flags);
9864 struct xfs_inode *ip,
9865 @@ -70,6 +144,7 @@ xfs_setattr(
9866 uint commit_flags=0;
9867 uid_t uid=0, iuid=0;
9868 gid_t gid=0, igid=0;
9869 + tag_t tag=0, itag=0;
9870 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
9871 int need_iolock = 1;
9873 @@ -162,7 +237,7 @@ xfs_setattr(
9875 * Change file ownership. Must be the owner or privileged.
9877 - if (mask & (ATTR_UID|ATTR_GID)) {
9878 + if (mask & (ATTR_UID|ATTR_GID|ATTR_TAG)) {
9880 * These IDs could have changed since we last looked at them.
9881 * But, we're assured that if the ownership did change
9882 @@ -171,8 +246,10 @@ xfs_setattr(
9884 iuid = ip->i_d.di_uid;
9885 igid = ip->i_d.di_gid;
9886 + itag = ip->i_d.di_tag;
9887 gid = (mask & ATTR_GID) ? iattr->ia_gid : igid;
9888 uid = (mask & ATTR_UID) ? iattr->ia_uid : iuid;
9889 + tag = (mask & ATTR_TAG) ? iattr->ia_tag : itag;
9892 * Do a quota reservation only if uid/gid is actually
9893 @@ -180,7 +257,8 @@ xfs_setattr(
9895 if (XFS_IS_QUOTA_RUNNING(mp) &&
9896 ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
9897 - (XFS_IS_GQUOTA_ON(mp) && igid != gid))) {
9898 + (XFS_IS_GQUOTA_ON(mp) && igid != gid) ||
9899 + (XFS_IS_GQUOTA_ON(mp) && itag != tag))) {
9901 code = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp,
9902 capable(CAP_FOWNER) ?
9903 @@ -341,7 +419,7 @@ xfs_setattr(
9905 * Change file ownership. Must be the owner or privileged.
9907 - if (mask & (ATTR_UID|ATTR_GID)) {
9908 + if (mask & (ATTR_UID|ATTR_GID|ATTR_TAG)) {
9910 * CAP_FSETID overrides the following restrictions:
9912 @@ -357,6 +435,10 @@ xfs_setattr(
9913 * Change the ownerships and register quota modifications
9914 * in the transaction.
9916 + if (itag != tag) {
9917 + ip->i_d.di_tag = tag;
9918 + inode->i_tag = tag;
9921 if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_UQUOTA_ON(mp)) {
9922 ASSERT(mask & ATTR_UID);
9923 diff -NurpP --minimal linux-2.6.35.2/fs/xfs/xfs_vnodeops.h linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_vnodeops.h
9924 --- linux-2.6.35.2/fs/xfs/xfs_vnodeops.h 2010-07-07 18:31:54.000000000 +0200
9925 +++ linux-2.6.35.2-vs2.3.0.36.31/fs/xfs/xfs_vnodeops.h 2010-08-02 17:05:06.000000000 +0200
9926 @@ -14,6 +14,7 @@ struct xfs_inode;
9930 +int xfs_sync_xflags(struct xfs_inode *ip);
9931 int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags);
9932 #define XFS_ATTR_DMI 0x01 /* invocation from a DMI function */
9933 #define XFS_ATTR_NONBLOCK 0x02 /* return EAGAIN if operation would block */
9934 diff -NurpP --minimal linux-2.6.35.2/include/asm-generic/tlb.h linux-2.6.35.2-vs2.3.0.36.31/include/asm-generic/tlb.h
9935 --- linux-2.6.35.2/include/asm-generic/tlb.h 2009-09-10 15:26:24.000000000 +0200
9936 +++ linux-2.6.35.2-vs2.3.0.36.31/include/asm-generic/tlb.h 2010-08-02 17:05:06.000000000 +0200
9938 #define _ASM_GENERIC__TLB_H
9940 #include <linux/swap.h>
9941 +#include <linux/vs_memory.h>
9942 #include <asm/pgalloc.h>
9943 #include <asm/tlbflush.h>
9945 diff -NurpP --minimal linux-2.6.35.2/include/linux/capability.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/capability.h
9946 --- linux-2.6.35.2/include/linux/capability.h 2010-02-25 11:52:07.000000000 +0100
9947 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/capability.h 2010-08-02 17:05:06.000000000 +0200
9948 @@ -283,6 +283,7 @@ struct cpu_vfs_cap_data {
9949 arbitrary SCSI commands */
9950 /* Allow setting encryption key on loopback filesystem */
9951 /* Allow setting zone reclaim policy */
9952 +/* Allow the selection of a security context */
9954 #define CAP_SYS_ADMIN 21
9956 @@ -355,7 +356,13 @@ struct cpu_vfs_cap_data {
9958 #define CAP_MAC_ADMIN 33
9960 -#define CAP_LAST_CAP CAP_MAC_ADMIN
9961 +/* Allow context manipulations */
9962 +/* Allow changing context info on files */
9964 +#define CAP_CONTEXT 34
9967 +#define CAP_LAST_CAP CAP_CONTEXT
9969 #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
9971 diff -NurpP --minimal linux-2.6.35.2/include/linux/devpts_fs.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/devpts_fs.h
9972 --- linux-2.6.35.2/include/linux/devpts_fs.h 2008-12-25 00:26:37.000000000 +0100
9973 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/devpts_fs.h 2010-08-02 17:05:06.000000000 +0200
9974 @@ -45,5 +45,4 @@ static inline void devpts_pty_kill(struc
9979 #endif /* _LINUX_DEVPTS_FS_H */
9980 diff -NurpP --minimal linux-2.6.35.2/include/linux/ext2_fs.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/ext2_fs.h
9981 --- linux-2.6.35.2/include/linux/ext2_fs.h 2010-02-25 11:52:07.000000000 +0100
9982 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/ext2_fs.h 2010-08-02 17:05:06.000000000 +0200
9983 @@ -189,8 +189,12 @@ struct ext2_group_desc
9984 #define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
9985 #define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
9986 #define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
9987 +#define EXT2_IXUNLINK_FL FS_IXUNLINK_FL /* Immutable invert on unlink */
9988 #define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
9990 +#define EXT2_BARRIER_FL FS_BARRIER_FL /* Barrier for chroot() */
9991 +#define EXT2_COW_FL FS_COW_FL /* Copy on Write marker */
9993 #define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
9994 #define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
9996 @@ -274,7 +278,8 @@ struct ext2_inode {
9998 __le16 l_i_uid_high; /* these 2 fields */
9999 __le16 l_i_gid_high; /* were reserved2[0] */
10000 - __u32 l_i_reserved2;
10001 + __le16 l_i_tag; /* Context Tag */
10002 + __u16 l_i_reserved2;
10005 __u8 h_i_frag; /* Fragment number */
10006 @@ -303,6 +308,7 @@ struct ext2_inode {
10007 #define i_gid_low i_gid
10008 #define i_uid_high osd2.linux2.l_i_uid_high
10009 #define i_gid_high osd2.linux2.l_i_gid_high
10010 +#define i_raw_tag osd2.linux2.l_i_tag
10011 #define i_reserved2 osd2.linux2.l_i_reserved2
10014 @@ -347,6 +353,7 @@ struct ext2_inode {
10015 #define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
10016 #define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
10017 #define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
10018 +#define EXT2_MOUNT_TAGGED (1<<24) /* Enable Context Tags */
10021 #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
10022 diff -NurpP --minimal linux-2.6.35.2/include/linux/ext3_fs.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/ext3_fs.h
10023 --- linux-2.6.35.2/include/linux/ext3_fs.h 2010-08-02 16:52:54.000000000 +0200
10024 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/ext3_fs.h 2010-08-02 17:05:06.000000000 +0200
10025 @@ -173,10 +173,14 @@ struct ext3_group_desc
10026 #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
10027 #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
10028 #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
10029 +#define EXT3_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
10030 #define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */
10032 -#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
10033 -#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
10034 +#define EXT3_BARRIER_FL 0x04000000 /* Barrier for chroot() */
10035 +#define EXT3_COW_FL 0x20000000 /* Copy on Write marker */
10037 +#define EXT3_FL_USER_VISIBLE 0x0103DFFF /* User visible flags */
10038 +#define EXT3_FL_USER_MODIFIABLE 0x010380FF /* User modifiable flags */
10040 /* Flags that should be inherited by new inodes from their parent. */
10041 #define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
10042 @@ -312,7 +316,8 @@ struct ext3_inode {
10044 __le16 l_i_uid_high; /* these 2 fields */
10045 __le16 l_i_gid_high; /* were reserved2[0] */
10046 - __u32 l_i_reserved2;
10047 + __le16 l_i_tag; /* Context Tag */
10048 + __u16 l_i_reserved2;
10051 __u8 h_i_frag; /* Fragment number */
10052 @@ -343,6 +348,7 @@ struct ext3_inode {
10053 #define i_gid_low i_gid
10054 #define i_uid_high osd2.linux2.l_i_uid_high
10055 #define i_gid_high osd2.linux2.l_i_gid_high
10056 +#define i_raw_tag osd2.linux2.l_i_tag
10057 #define i_reserved2 osd2.linux2.l_i_reserved2
10059 #elif defined(__GNU__)
10060 @@ -406,6 +412,7 @@ struct ext3_inode {
10061 #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
10062 #define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write
10063 * error in ordered mode */
10064 +#define EXT3_MOUNT_TAGGED (1<<24) /* Enable Context Tags */
10066 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
10067 #ifndef _LINUX_EXT2_FS_H
10068 @@ -909,6 +916,7 @@ extern void ext3_get_inode_flags(struct
10069 extern void ext3_set_aops(struct inode *inode);
10070 extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
10071 u64 start, u64 len);
10072 +extern int ext3_sync_flags(struct inode *, int, int);
10075 extern long ext3_ioctl(struct file *, unsigned int, unsigned long);
10076 diff -NurpP --minimal linux-2.6.35.2/include/linux/fs.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/fs.h
10077 --- linux-2.6.35.2/include/linux/fs.h 2010-08-14 18:16:59.000000000 +0200
10078 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/fs.h 2010-08-14 18:21:44.000000000 +0200
10079 @@ -209,6 +209,9 @@ struct inodes_stat_t {
10080 #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
10081 #define MS_I_VERSION (1<<23) /* Update inode I_version field */
10082 #define MS_STRICTATIME (1<<24) /* Always perform atime updates */
10083 +#define MS_TAGGED (1<<25) /* use generic inode tagging */
10084 +#define MS_TAGID (1<<26) /* use specific tag for this mount */
10085 +#define MS_NOTAGCHECK (1<<27) /* don't check tags */
10086 #define MS_BORN (1<<29)
10087 #define MS_ACTIVE (1<<30)
10088 #define MS_NOUSER (1<<31)
10089 @@ -236,6 +239,14 @@ struct inodes_stat_t {
10090 #define S_NOCMTIME 128 /* Do not update file c/mtime */
10091 #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
10092 #define S_PRIVATE 512 /* Inode is fs-internal */
10093 +#define S_IXUNLINK 1024 /* Immutable Invert on unlink */
10095 +/* Linux-VServer related Inode flags */
10099 +#define V_BARRIER 4 /* Barrier for chroot() */
10100 +#define V_COW 8 /* Copy on Write */
10103 * Note that nosuid etc flags are inode-specific: setting some file-system
10104 @@ -258,12 +269,15 @@ struct inodes_stat_t {
10105 #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
10106 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
10107 #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
10108 -#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
10109 -#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
10110 +#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
10111 +#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
10112 +#define IS_TAGGED(inode) __IS_FLG(inode, MS_TAGGED)
10114 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
10115 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
10116 #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
10117 +#define IS_IXUNLINK(inode) ((inode)->i_flags & S_IXUNLINK)
10118 +#define IS_IXORUNLINK(inode) ((IS_IXUNLINK(inode) ? S_IMMUTABLE : 0) ^ IS_IMMUTABLE(inode))
10119 #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
10121 #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
10122 @@ -271,6 +285,16 @@ struct inodes_stat_t {
10123 #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
10124 #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
10126 +#define IS_BARRIER(inode) (S_ISDIR((inode)->i_mode) && ((inode)->i_vflags & V_BARRIER))
10128 +#ifdef CONFIG_VSERVER_COWBL
10129 +# define IS_COW(inode) (IS_IXUNLINK(inode) && IS_IMMUTABLE(inode))
10130 +# define IS_COW_LINK(inode) (S_ISREG((inode)->i_mode) && ((inode)->i_nlink > 1))
10132 +# define IS_COW(inode) (0)
10133 +# define IS_COW_LINK(inode) (0)
10136 /* the read-only stuff doesn't really belong here, but any other place is
10137 probably as bad and I don't want to create yet another include file. */
10139 @@ -353,11 +377,14 @@ struct inodes_stat_t {
10140 #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
10141 #define FS_EXTENT_FL 0x00080000 /* Extents */
10142 #define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
10143 +#define FS_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
10144 #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
10146 -#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
10147 -#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
10148 +#define FS_BARRIER_FL 0x04000000 /* Barrier for chroot() */
10149 +#define FS_COW_FL 0x20000000 /* Copy on Write marker */
10151 +#define FS_FL_USER_VISIBLE 0x0103DFFF /* User visible flags */
10152 +#define FS_FL_USER_MODIFIABLE 0x010380FF /* User modifiable flags */
10154 #define SYNC_FILE_RANGE_WAIT_BEFORE 1
10155 #define SYNC_FILE_RANGE_WRITE 2
10156 @@ -439,6 +466,7 @@ typedef void (dio_iodone_t)(struct kiocb
10157 #define ATTR_KILL_PRIV (1 << 14)
10158 #define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
10159 #define ATTR_TIMES_SET (1 << 16)
10160 +#define ATTR_TAG (1 << 17)
10163 * This is the Inode Attributes structure, used for notify_change(). It
10164 @@ -454,6 +482,7 @@ struct iattr {
10170 struct timespec ia_atime;
10171 struct timespec ia_mtime;
10172 @@ -467,6 +496,9 @@ struct iattr {
10173 struct file *ia_file;
10176 +#define ATTR_FLAG_BARRIER 512 /* Barrier for chroot() */
10177 +#define ATTR_FLAG_IXUNLINK 1024 /* Immutable invert on unlink */
10180 * Includes for diskquotas.
10182 @@ -733,7 +765,9 @@ struct inode {
10183 unsigned int i_nlink;
10189 unsigned int i_blkbits;
10192 @@ -780,7 +814,8 @@ struct inode {
10193 unsigned long i_state;
10194 unsigned long dirtied_when; /* jiffies of first dirtying */
10196 - unsigned int i_flags;
10197 + unsigned short i_flags;
10198 + unsigned short i_vflags;
10200 atomic_t i_writecount;
10201 #ifdef CONFIG_SECURITY
10202 @@ -868,12 +903,12 @@ static inline void i_size_write(struct i
10204 static inline unsigned iminor(const struct inode *inode)
10206 - return MINOR(inode->i_rdev);
10207 + return MINOR(inode->i_mdev);
10210 static inline unsigned imajor(const struct inode *inode)
10212 - return MAJOR(inode->i_rdev);
10213 + return MAJOR(inode->i_mdev);
10216 extern struct block_device *I_BDEV(struct inode *inode);
10217 @@ -932,6 +967,7 @@ struct file {
10219 struct fown_struct f_owner;
10220 const struct cred *f_cred;
10222 struct file_ra_state f_ra;
10225 @@ -1074,6 +1110,7 @@ struct file_lock {
10226 struct file *fl_file;
10231 struct fasync_struct * fl_fasync; /* for lease break notifications */
10232 unsigned long fl_break_time; /* for nonblocking lease breaks */
10233 @@ -1535,6 +1572,7 @@ struct inode_operations {
10234 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
10235 ssize_t (*listxattr) (struct dentry *, char *, size_t);
10236 int (*removexattr) (struct dentry *, const char *);
10237 + int (*sync_flags) (struct inode *, int, int);
10238 void (*truncate_range)(struct inode *, loff_t, loff_t);
10239 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
10241 @@ -1555,6 +1593,7 @@ extern ssize_t vfs_readv(struct file *,
10242 unsigned long, loff_t *);
10243 extern ssize_t vfs_writev(struct file *, const struct iovec __user *,
10244 unsigned long, loff_t *);
10245 +ssize_t vfs_sendfile(struct file *, struct file *, loff_t *, size_t, loff_t);
10247 struct super_operations {
10248 struct inode *(*alloc_inode)(struct super_block *sb);
10249 @@ -2378,6 +2417,7 @@ extern int dcache_dir_open(struct inode
10250 extern int dcache_dir_close(struct inode *, struct file *);
10251 extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
10252 extern int dcache_readdir(struct file *, void *, filldir_t);
10253 +extern int dcache_readdir_filter(struct file *, void *, filldir_t, int (*)(struct dentry *));
10254 extern int simple_setattr(struct dentry *, struct iattr *);
10255 extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
10256 extern int simple_statfs(struct dentry *, struct kstatfs *);
10257 diff -NurpP --minimal linux-2.6.35.2/include/linux/gfs2_ondisk.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/gfs2_ondisk.h
10258 --- linux-2.6.35.2/include/linux/gfs2_ondisk.h 2010-07-07 18:31:55.000000000 +0200
10259 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/gfs2_ondisk.h 2010-08-02 17:05:06.000000000 +0200
10260 @@ -211,6 +211,9 @@ enum {
10261 gfs2fl_NoAtime = 7,
10264 + gfs2fl_IXUnlink = 16,
10265 + gfs2fl_Barrier = 17,
10267 gfs2fl_TruncInProg = 29,
10268 gfs2fl_InheritDirectio = 30,
10269 gfs2fl_InheritJdata = 31,
10270 @@ -227,6 +230,9 @@ enum {
10271 #define GFS2_DIF_NOATIME 0x00000080
10272 #define GFS2_DIF_SYNC 0x00000100
10273 #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */
10274 +#define GFS2_DIF_IXUNLINK 0x00010000
10275 +#define GFS2_DIF_BARRIER 0x00020000
10276 +#define GFS2_DIF_COW 0x00040000
10277 #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */
10278 #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000
10279 #define GFS2_DIF_INHERIT_JDATA 0x80000000
10280 diff -NurpP --minimal linux-2.6.35.2/include/linux/if_tun.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/if_tun.h
10281 --- linux-2.6.35.2/include/linux/if_tun.h 2010-08-02 16:52:54.000000000 +0200
10282 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/if_tun.h 2010-08-02 18:17:46.000000000 +0200
10284 #define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
10285 #define TUNGETVNETHDRSZ _IOR('T', 215, int)
10286 #define TUNSETVNETHDRSZ _IOW('T', 216, int)
10287 +#define TUNSETNID _IOW('T', 217, int)
10289 /* TUNSETIFF ifr flags */
10290 #define IFF_TUN 0x0001
10291 diff -NurpP --minimal linux-2.6.35.2/include/linux/init_task.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/init_task.h
10292 --- linux-2.6.35.2/include/linux/init_task.h 2010-08-02 16:52:54.000000000 +0200
10293 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/init_task.h 2010-08-02 17:05:06.000000000 +0200
10294 @@ -172,6 +172,10 @@ extern struct cred init_cred;
10295 INIT_FTRACE_GRAPH \
10296 INIT_TRACE_RECURSION \
10297 INIT_TASK_RCU_PREEMPT(tsk) \
10299 + .vx_info = NULL, \
10301 + .nx_info = NULL, \
10305 diff -NurpP --minimal linux-2.6.35.2/include/linux/ipc.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/ipc.h
10306 --- linux-2.6.35.2/include/linux/ipc.h 2009-12-03 20:02:55.000000000 +0100
10307 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/ipc.h 2010-08-02 17:05:06.000000000 +0200
10308 @@ -91,6 +91,7 @@ struct kern_ipc_perm
10316 diff -NurpP --minimal linux-2.6.35.2/include/linux/Kbuild linux-2.6.35.2-vs2.3.0.36.31/include/linux/Kbuild
10317 --- linux-2.6.35.2/include/linux/Kbuild 2010-08-14 18:16:59.000000000 +0200
10318 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/Kbuild 2010-08-14 18:19:32.000000000 +0200
10319 @@ -388,5 +388,8 @@ unifdef-y += xattr.h
10320 unifdef-y += xfrm.h
10322 objhdr-y += version.h
10324 +header-y += vserver/
10325 header-y += wimax.h
10328 diff -NurpP --minimal linux-2.6.35.2/include/linux/loop.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/loop.h
10329 --- linux-2.6.35.2/include/linux/loop.h 2009-09-10 15:26:25.000000000 +0200
10330 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/loop.h 2010-08-02 17:05:06.000000000 +0200
10331 @@ -45,6 +45,7 @@ struct loop_device {
10332 struct loop_func_table *lo_encryption;
10334 uid_t lo_key_owner; /* Who set the key */
10336 int (*ioctl)(struct loop_device *, int cmd,
10337 unsigned long arg);
10339 diff -NurpP --minimal linux-2.6.35.2/include/linux/magic.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/magic.h
10340 --- linux-2.6.35.2/include/linux/magic.h 2010-07-07 18:31:55.000000000 +0200
10341 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/magic.h 2010-08-02 17:05:06.000000000 +0200
10344 #define ADFS_SUPER_MAGIC 0xadf5
10345 #define AFFS_SUPER_MAGIC 0xadff
10346 -#define AFS_SUPER_MAGIC 0x5346414F
10347 +#define AFS_SUPER_MAGIC 0x5346414F
10348 #define AUTOFS_SUPER_MAGIC 0x0187
10349 #define CODA_SUPER_MAGIC 0x73757245
10350 #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
10352 #define NFS_SUPER_MAGIC 0x6969
10353 #define OPENPROM_SUPER_MAGIC 0x9fa1
10354 #define PROC_SUPER_MAGIC 0x9fa0
10355 +#define DEVPTS_SUPER_MAGIC 0x1cd1
10356 #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
10358 #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */
10359 diff -NurpP --minimal linux-2.6.35.2/include/linux/major.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/major.h
10360 --- linux-2.6.35.2/include/linux/major.h 2009-09-10 15:26:25.000000000 +0200
10361 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/major.h 2010-08-02 17:05:06.000000000 +0200
10363 #define HD_MAJOR IDE0_MAJOR
10364 #define PTY_SLAVE_MAJOR 3
10365 #define TTY_MAJOR 4
10366 +#define VROOT_MAJOR 4
10367 #define TTYAUX_MAJOR 5
10369 #define VCS_MAJOR 7
10370 diff -NurpP --minimal linux-2.6.35.2/include/linux/memcontrol.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/memcontrol.h
10371 --- linux-2.6.35.2/include/linux/memcontrol.h 2010-08-02 16:52:54.000000000 +0200
10372 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/memcontrol.h 2010-08-02 17:05:06.000000000 +0200
10373 @@ -77,6 +77,13 @@ int task_in_mem_cgroup(struct task_struc
10374 extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
10375 extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
10377 +extern u64 mem_cgroup_res_read_u64(struct mem_cgroup *mem, int member);
10378 +extern u64 mem_cgroup_memsw_read_u64(struct mem_cgroup *mem, int member);
10380 +extern s64 mem_cgroup_stat_read_cache(struct mem_cgroup *mem);
10381 +extern s64 mem_cgroup_stat_read_anon(struct mem_cgroup *mem);
10382 +extern s64 mem_cgroup_stat_read_mapped(struct mem_cgroup *mem);
10385 int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
10387 diff -NurpP --minimal linux-2.6.35.2/include/linux/mm_types.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/mm_types.h
10388 --- linux-2.6.35.2/include/linux/mm_types.h 2010-07-07 18:31:55.000000000 +0200
10389 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/mm_types.h 2010-08-02 17:05:06.000000000 +0200
10390 @@ -269,6 +269,7 @@ struct mm_struct {
10392 /* Architecture-specific MM context */
10393 mm_context_t context;
10394 + struct vx_info *mm_vx_info;
10396 /* Swap token stuff */
10398 diff -NurpP --minimal linux-2.6.35.2/include/linux/mount.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/mount.h
10399 --- linux-2.6.35.2/include/linux/mount.h 2010-07-07 18:31:56.000000000 +0200
10400 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/mount.h 2010-08-02 17:05:06.000000000 +0200
10401 @@ -47,6 +47,9 @@ struct mnt_namespace;
10403 #define MNT_INTERNAL 0x4000
10405 +#define MNT_TAGID 0x10000
10406 +#define MNT_NOTAG 0x20000
10409 struct list_head mnt_hash;
10410 struct vfsmount *mnt_parent; /* fs we are mounted on */
10411 @@ -81,6 +84,7 @@ struct vfsmount {
10415 + tag_t mnt_tag; /* tagging used for vfsmount */
10418 static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
10419 diff -NurpP --minimal linux-2.6.35.2/include/linux/net.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/net.h
10420 --- linux-2.6.35.2/include/linux/net.h 2010-08-02 16:52:55.000000000 +0200
10421 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/net.h 2010-08-02 17:05:06.000000000 +0200
10422 @@ -71,6 +71,7 @@ struct net;
10423 #define SOCK_NOSPACE 2
10424 #define SOCK_PASSCRED 3
10425 #define SOCK_PASSSEC 4
10426 +#define SOCK_USER_SOCKET 5
10428 #ifndef ARCH_HAS_SOCKET_TYPES
10430 diff -NurpP --minimal linux-2.6.35.2/include/linux/nfs_mount.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/nfs_mount.h
10431 --- linux-2.6.35.2/include/linux/nfs_mount.h 2009-03-24 14:22:43.000000000 +0100
10432 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/nfs_mount.h 2010-08-02 17:05:06.000000000 +0200
10433 @@ -63,7 +63,8 @@ struct nfs_mount_data {
10434 #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
10435 #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */
10436 #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */
10437 -#define NFS_MOUNT_FLAGMASK 0xFFFF
10438 +#define NFS_MOUNT_TAGGED 0x10000 /* context tagging */
10439 +#define NFS_MOUNT_FLAGMASK 0x1FFFF
10441 /* The following are for internal use only */
10442 #define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
10443 diff -NurpP --minimal linux-2.6.35.2/include/linux/nsproxy.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/nsproxy.h
10444 --- linux-2.6.35.2/include/linux/nsproxy.h 2009-06-11 17:13:17.000000000 +0200
10445 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/nsproxy.h 2010-08-02 17:05:06.000000000 +0200
10448 #include <linux/spinlock.h>
10449 #include <linux/sched.h>
10450 +#include <linux/vserver/debug.h>
10452 struct mnt_namespace;
10453 struct uts_namespace;
10454 @@ -63,22 +64,33 @@ static inline struct nsproxy *task_nspro
10457 int copy_namespaces(unsigned long flags, struct task_struct *tsk);
10458 +struct nsproxy *copy_nsproxy(struct nsproxy *orig);
10459 void exit_task_namespaces(struct task_struct *tsk);
10460 void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
10461 void free_nsproxy(struct nsproxy *ns);
10462 int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
10463 struct fs_struct *);
10465 -static inline void put_nsproxy(struct nsproxy *ns)
10466 +#define get_nsproxy(n) __get_nsproxy(n, __FILE__, __LINE__)
10468 +static inline void __get_nsproxy(struct nsproxy *ns,
10469 + const char *_file, int _line)
10471 - if (atomic_dec_and_test(&ns->count)) {
10472 - free_nsproxy(ns);
10474 + vxlprintk(VXD_CBIT(space, 0), "get_nsproxy(%p[%u])",
10475 + ns, atomic_read(&ns->count), _file, _line);
10476 + atomic_inc(&ns->count);
10479 -static inline void get_nsproxy(struct nsproxy *ns)
10480 +#define put_nsproxy(n) __put_nsproxy(n, __FILE__, __LINE__)
10482 +static inline void __put_nsproxy(struct nsproxy *ns,
10483 + const char *_file, int _line)
10485 - atomic_inc(&ns->count);
10486 + vxlprintk(VXD_CBIT(space, 0), "put_nsproxy(%p[%u])",
10487 + ns, atomic_read(&ns->count), _file, _line);
10488 + if (atomic_dec_and_test(&ns->count)) {
10489 + free_nsproxy(ns);
10493 #ifdef CONFIG_CGROUP_NS
10494 diff -NurpP --minimal linux-2.6.35.2/include/linux/pid.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/pid.h
10495 --- linux-2.6.35.2/include/linux/pid.h 2009-03-24 14:22:43.000000000 +0100
10496 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/pid.h 2010-08-02 17:05:06.000000000 +0200
10497 @@ -8,7 +8,8 @@ enum pid_type
10507 @@ -160,6 +161,7 @@ static inline pid_t pid_nr(struct pid *p
10510 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
10511 +pid_t pid_unmapped_nr_ns(struct pid *pid, struct pid_namespace *ns);
10512 pid_t pid_vnr(struct pid *pid);
10514 #define do_each_pid_task(pid, type, task) \
10515 diff -NurpP --minimal linux-2.6.35.2/include/linux/proc_fs.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/proc_fs.h
10516 --- linux-2.6.35.2/include/linux/proc_fs.h 2009-12-03 20:02:56.000000000 +0100
10517 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/proc_fs.h 2010-08-02 17:05:06.000000000 +0200
10518 @@ -56,6 +56,7 @@ struct proc_dir_entry {
10524 const struct inode_operations *proc_iops;
10526 @@ -250,12 +251,18 @@ kclist_add(struct kcore_list *new, void
10527 extern void kclist_add(struct kcore_list *, void *, size_t, int type);
10534 int (*proc_get_link)(struct inode *, struct path *);
10535 int (*proc_read)(struct task_struct *task, char *page);
10536 int (*proc_show)(struct seq_file *m,
10537 struct pid_namespace *ns, struct pid *pid,
10538 struct task_struct *task);
10539 + int (*proc_vs_read)(char *page);
10540 + int (*proc_vxi_read)(struct vx_info *vxi, char *page);
10541 + int (*proc_nxi_read)(struct nx_info *nxi, char *page);
10544 struct ctl_table_header;
10545 @@ -263,6 +270,7 @@ struct ctl_table;
10547 struct proc_inode {
10552 struct proc_dir_entry *pde;
10553 diff -NurpP --minimal linux-2.6.35.2/include/linux/quotaops.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/quotaops.h
10554 --- linux-2.6.35.2/include/linux/quotaops.h 2010-08-02 16:52:55.000000000 +0200
10555 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/quotaops.h 2010-08-02 22:35:47.000000000 +0200
10557 #define _LINUX_QUOTAOPS_
10559 #include <linux/fs.h>
10560 +#include <linux/vs_dlimit.h>
10562 #define DQUOT_SPACE_WARN 0x1
10563 #define DQUOT_SPACE_RESERVE 0x2
10564 @@ -209,11 +210,12 @@ static inline void dquot_drop(struct ino
10566 static inline int dquot_alloc_inode(const struct inode *inode)
10569 + return dl_alloc_inode(inode);
10572 static inline void dquot_free_inode(const struct inode *inode)
10574 + dl_free_inode(inode);
10577 static inline int dquot_transfer(struct inode *inode, struct iattr *iattr)
10578 @@ -224,6 +226,10 @@ static inline int dquot_transfer(struct
10579 static inline int __dquot_alloc_space(struct inode *inode, qsize_t number,
10584 + if ((ret = dl_alloc_space(inode, number)))
10586 if (!(flags & DQUOT_SPACE_RESERVE))
10587 inode_add_bytes(inode, number);
10589 @@ -234,6 +240,7 @@ static inline void __dquot_free_space(st
10591 if (!(flags & DQUOT_SPACE_RESERVE))
10592 inode_sub_bytes(inode, number);
10593 + dl_free_space(inode, number);
10596 static inline int dquot_claim_space_nodirty(struct inode *inode, qsize_t number)
10597 diff -NurpP --minimal linux-2.6.35.2/include/linux/reboot.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/reboot.h
10598 --- linux-2.6.35.2/include/linux/reboot.h 2010-07-07 18:31:56.000000000 +0200
10599 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/reboot.h 2010-08-02 17:05:06.000000000 +0200
10601 #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
10602 #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
10603 #define LINUX_REBOOT_CMD_KEXEC 0x45584543
10604 +#define LINUX_REBOOT_CMD_OOM 0xDEADBEEF
10608 diff -NurpP --minimal linux-2.6.35.2/include/linux/reiserfs_fs.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/reiserfs_fs.h
10609 --- linux-2.6.35.2/include/linux/reiserfs_fs.h 2010-07-07 18:31:56.000000000 +0200
10610 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/reiserfs_fs.h 2010-08-02 17:05:06.000000000 +0200
10611 @@ -977,6 +977,11 @@ struct stat_data_v1 {
10612 #define REISERFS_COMPR_FL FS_COMPR_FL
10613 #define REISERFS_NOTAIL_FL FS_NOTAIL_FL
10615 +/* unfortunately reiserfs sdattr is only 16 bit */
10616 +#define REISERFS_IXUNLINK_FL (FS_IXUNLINK_FL >> 16)
10617 +#define REISERFS_BARRIER_FL (FS_BARRIER_FL >> 16)
10618 +#define REISERFS_COW_FL (FS_COW_FL >> 16)
10620 /* persistent flags that file inherits from the parent directory */
10621 #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \
10622 REISERFS_SYNC_FL | \
10623 @@ -986,6 +991,9 @@ struct stat_data_v1 {
10624 REISERFS_COMPR_FL | \
10625 REISERFS_NOTAIL_FL )
10627 +#define REISERFS_FL_USER_VISIBLE 0x80FF
10628 +#define REISERFS_FL_USER_MODIFIABLE 0x80FF
10630 /* Stat Data on disk (reiserfs version of UFS disk inode minus the
10633 @@ -2071,6 +2079,7 @@ static inline void reiserfs_update_sd(st
10634 void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
10635 void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
10636 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
10637 +int reiserfs_sync_flags(struct inode *inode, int, int);
10640 void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
10641 diff -NurpP --minimal linux-2.6.35.2/include/linux/reiserfs_fs_sb.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/reiserfs_fs_sb.h
10642 --- linux-2.6.35.2/include/linux/reiserfs_fs_sb.h 2010-02-25 11:52:07.000000000 +0100
10643 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/reiserfs_fs_sb.h 2010-08-02 17:05:06.000000000 +0200
10644 @@ -476,6 +476,7 @@ enum reiserfs_mount_options {
10645 REISERFS_EXPOSE_PRIVROOT,
10646 REISERFS_BARRIER_NONE,
10647 REISERFS_BARRIER_FLUSH,
10650 /* Actions on error */
10651 REISERFS_ERROR_PANIC,
10652 diff -NurpP --minimal linux-2.6.35.2/include/linux/sched.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/sched.h
10653 --- linux-2.6.35.2/include/linux/sched.h 2010-08-14 18:16:59.000000000 +0200
10654 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/sched.h 2010-08-14 18:19:32.000000000 +0200
10655 @@ -1343,6 +1343,14 @@ struct task_struct {
10659 +/* vserver context data */
10660 + struct vx_info *vx_info;
10661 + struct nx_info *nx_info;
10667 /* Thread group tracking */
10668 u32 parent_exec_id;
10670 @@ -1577,6 +1585,11 @@ struct pid_namespace;
10671 pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
10672 struct pid_namespace *ns);
10674 +#include <linux/vserver/base.h>
10675 +#include <linux/vserver/context.h>
10676 +#include <linux/vserver/debug.h>
10677 +#include <linux/vserver/pid.h>
10679 static inline pid_t task_pid_nr(struct task_struct *tsk)
10682 @@ -1590,7 +1603,8 @@ static inline pid_t task_pid_nr_ns(struc
10684 static inline pid_t task_pid_vnr(struct task_struct *tsk)
10686 - return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
10687 + // return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
10688 + return vx_map_pid(__task_pid_nr_ns(tsk, PIDTYPE_PID, NULL));
10692 @@ -1603,7 +1617,7 @@ pid_t task_tgid_nr_ns(struct task_struct
10694 static inline pid_t task_tgid_vnr(struct task_struct *tsk)
10696 - return pid_vnr(task_tgid(tsk));
10697 + return vx_map_tgid(pid_vnr(task_tgid(tsk)));
10701 diff -NurpP --minimal linux-2.6.35.2/include/linux/shmem_fs.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/shmem_fs.h
10702 --- linux-2.6.35.2/include/linux/shmem_fs.h 2010-02-25 11:52:08.000000000 +0100
10703 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/shmem_fs.h 2010-08-02 17:05:06.000000000 +0200
10706 #define SHMEM_NR_DIRECT 16
10708 +#define TMPFS_SUPER_MAGIC 0x01021994
10711 struct shmem_inode_info {
10713 unsigned long flags;
10714 diff -NurpP --minimal linux-2.6.35.2/include/linux/stat.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/stat.h
10715 --- linux-2.6.35.2/include/linux/stat.h 2008-12-25 00:26:37.000000000 +0100
10716 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/stat.h 2010-08-02 17:05:06.000000000 +0200
10717 @@ -66,6 +66,7 @@ struct kstat {
10718 unsigned int nlink;
10724 struct timespec atime;
10725 diff -NurpP --minimal linux-2.6.35.2/include/linux/sunrpc/auth.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/sunrpc/auth.h
10726 --- linux-2.6.35.2/include/linux/sunrpc/auth.h 2010-08-02 16:52:56.000000000 +0200
10727 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/sunrpc/auth.h 2010-08-02 17:05:06.000000000 +0200
10733 struct group_info *group_info;
10734 unsigned char machine_cred : 1;
10736 diff -NurpP --minimal linux-2.6.35.2/include/linux/sunrpc/clnt.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/sunrpc/clnt.h
10737 --- linux-2.6.35.2/include/linux/sunrpc/clnt.h 2009-12-03 20:02:56.000000000 +0100
10738 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/sunrpc/clnt.h 2010-08-02 17:05:06.000000000 +0200
10739 @@ -49,7 +49,8 @@ struct rpc_clnt {
10740 unsigned int cl_softrtry : 1,/* soft timeouts */
10741 cl_discrtry : 1,/* disconnect before retry */
10742 cl_autobind : 1,/* use getport() */
10743 - cl_chatty : 1;/* be verbose */
10744 + cl_chatty : 1,/* be verbose */
10745 + cl_tag : 1;/* context tagging */
10747 struct rpc_rtt * cl_rtt; /* RTO estimator data */
10748 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
10749 diff -NurpP --minimal linux-2.6.35.2/include/linux/syscalls.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/syscalls.h
10750 --- linux-2.6.35.2/include/linux/syscalls.h 2010-08-02 16:52:56.000000000 +0200
10751 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/syscalls.h 2010-08-02 17:05:06.000000000 +0200
10752 @@ -479,6 +479,8 @@ asmlinkage long sys_symlink(const char _
10753 asmlinkage long sys_unlink(const char __user *pathname);
10754 asmlinkage long sys_rename(const char __user *oldname,
10755 const char __user *newname);
10756 +asmlinkage long sys_copyfile(const char __user *from, const char __user *to,
10758 asmlinkage long sys_chmod(const char __user *filename, mode_t mode);
10759 asmlinkage long sys_fchmod(unsigned int fd, mode_t mode);
10761 diff -NurpP --minimal linux-2.6.35.2/include/linux/sysctl.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/sysctl.h
10762 --- linux-2.6.35.2/include/linux/sysctl.h 2010-08-02 16:52:56.000000000 +0200
10763 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/sysctl.h 2010-08-02 17:05:06.000000000 +0200
10764 @@ -60,6 +60,7 @@ enum
10765 CTL_ABI=9, /* Binary emulation */
10766 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
10767 CTL_ARLAN=254, /* arlan wireless driver */
10768 + CTL_VSERVER=4242, /* Linux-VServer debug */
10769 CTL_S390DBF=5677, /* s390 debug */
10770 CTL_SUNRPC=7249, /* sunrpc debug */
10771 CTL_PM=9899, /* frv power management */
10772 @@ -94,6 +95,7 @@ enum
10774 KERN_PANIC=15, /* int: panic timeout */
10775 KERN_REALROOTDEV=16, /* real root device to mount after initrd */
10776 + KERN_VSHELPER=17, /* string: path to vshelper policy agent */
10778 KERN_SPARC_REBOOT=21, /* reboot command on Sparc */
10779 KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
10780 diff -NurpP --minimal linux-2.6.35.2/include/linux/sysfs.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/sysfs.h
10781 --- linux-2.6.35.2/include/linux/sysfs.h 2010-08-02 16:52:56.000000000 +0200
10782 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/sysfs.h 2010-08-02 17:05:06.000000000 +0200
10784 #include <linux/lockdep.h>
10785 #include <asm/atomic.h>
10787 +#define SYSFS_SUPER_MAGIC 0x62656572
10792 diff -NurpP --minimal linux-2.6.35.2/include/linux/time.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/time.h
10793 --- linux-2.6.35.2/include/linux/time.h 2010-08-02 16:52:56.000000000 +0200
10794 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/time.h 2010-08-02 17:05:06.000000000 +0200
10795 @@ -237,6 +237,9 @@ static __always_inline void timespec_add
10796 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
10800 +#include <linux/vs_time.h>
10802 #endif /* __KERNEL__ */
10804 #define NFDBITS __NFDBITS
10805 diff -NurpP --minimal linux-2.6.35.2/include/linux/types.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/types.h
10806 --- linux-2.6.35.2/include/linux/types.h 2010-08-02 16:52:56.000000000 +0200
10807 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/types.h 2010-08-02 17:05:06.000000000 +0200
10808 @@ -37,6 +37,9 @@ typedef __kernel_uid32_t uid_t;
10809 typedef __kernel_gid32_t gid_t;
10810 typedef __kernel_uid16_t uid16_t;
10811 typedef __kernel_gid16_t gid16_t;
10812 +typedef unsigned int xid_t;
10813 +typedef unsigned int nid_t;
10814 +typedef unsigned int tag_t;
10816 typedef unsigned long uintptr_t;
10818 diff -NurpP --minimal linux-2.6.35.2/include/linux/vroot.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vroot.h
10819 --- linux-2.6.35.2/include/linux/vroot.h 1970-01-01 01:00:00.000000000 +0100
10820 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vroot.h 2010-08-02 17:05:06.000000000 +0200
10824 + * include/linux/vroot.h
10826 + * written by Herbert Pötzl, 9/11/2002
10827 + * ported to 2.6 by Herbert Pötzl, 30/12/2004
10829 + * Copyright (C) 2002-2007 by Herbert Pötzl.
10830 + * Redistribution of this file is permitted under the
10831 + * GNU General Public License.
10834 +#ifndef _LINUX_VROOT_H
10835 +#define _LINUX_VROOT_H
10840 +/* Possible states of device */
10846 +struct vroot_device {
10850 + struct semaphore vr_ctl_mutex;
10851 + struct block_device *vr_device;
10856 +typedef struct block_device *(vroot_grb_func)(struct block_device *);
10858 +extern int register_vroot_grb(vroot_grb_func *);
10859 +extern int unregister_vroot_grb(vroot_grb_func *);
10861 +#endif /* __KERNEL__ */
10863 +#define MAX_VROOT_DEFAULT 8
10866 + * IOCTL commands --- we will commandeer 0x56 ('V')
10869 +#define VROOT_SET_DEV 0x5600
10870 +#define VROOT_CLR_DEV 0x5601
10872 +#endif /* _LINUX_VROOT_H */
10873 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_base.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_base.h
10874 --- linux-2.6.35.2/include/linux/vs_base.h 1970-01-01 01:00:00.000000000 +0100
10875 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_base.h 2010-08-02 17:05:06.000000000 +0200
10877 +#ifndef _VS_BASE_H
10878 +#define _VS_BASE_H
10880 +#include "vserver/base.h"
10881 +#include "vserver/check.h"
10882 +#include "vserver/debug.h"
10885 +#warning duplicate inclusion
10887 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_context.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_context.h
10888 --- linux-2.6.35.2/include/linux/vs_context.h 1970-01-01 01:00:00.000000000 +0100
10889 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_context.h 2010-08-02 17:05:06.000000000 +0200
10891 +#ifndef _VS_CONTEXT_H
10892 +#define _VS_CONTEXT_H
10894 +#include "vserver/base.h"
10895 +#include "vserver/check.h"
10896 +#include "vserver/context.h"
10897 +#include "vserver/history.h"
10898 +#include "vserver/debug.h"
10900 +#include <linux/sched.h>
10903 +#define get_vx_info(i) __get_vx_info(i, __FILE__, __LINE__, __HERE__)
10905 +static inline struct vx_info *__get_vx_info(struct vx_info *vxi,
10906 + const char *_file, int _line, void *_here)
10911 + vxlprintk(VXD_CBIT(xid, 2), "get_vx_info(%p[#%d.%d])",
10912 + vxi, vxi ? vxi->vx_id : 0,
10913 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
10915 + __vxh_get_vx_info(vxi, _here);
10917 + atomic_inc(&vxi->vx_usecnt);
10922 +extern void free_vx_info(struct vx_info *);
10924 +#define put_vx_info(i) __put_vx_info(i, __FILE__, __LINE__, __HERE__)
10926 +static inline void __put_vx_info(struct vx_info *vxi,
10927 + const char *_file, int _line, void *_here)
10932 + vxlprintk(VXD_CBIT(xid, 2), "put_vx_info(%p[#%d.%d])",
10933 + vxi, vxi ? vxi->vx_id : 0,
10934 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
10936 + __vxh_put_vx_info(vxi, _here);
10938 + if (atomic_dec_and_test(&vxi->vx_usecnt))
10939 + free_vx_info(vxi);
10943 +#define init_vx_info(p, i) \
10944 + __init_vx_info(p, i, __FILE__, __LINE__, __HERE__)
10946 +static inline void __init_vx_info(struct vx_info **vxp, struct vx_info *vxi,
10947 + const char *_file, int _line, void *_here)
10950 + vxlprintk(VXD_CBIT(xid, 3),
10951 + "init_vx_info(%p[#%d.%d])",
10952 + vxi, vxi ? vxi->vx_id : 0,
10953 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
10955 + __vxh_init_vx_info(vxi, vxp, _here);
10957 + atomic_inc(&vxi->vx_usecnt);
10963 +#define set_vx_info(p, i) \
10964 + __set_vx_info(p, i, __FILE__, __LINE__, __HERE__)
10966 +static inline void __set_vx_info(struct vx_info **vxp, struct vx_info *vxi,
10967 + const char *_file, int _line, void *_here)
10969 + struct vx_info *vxo;
10974 + vxlprintk(VXD_CBIT(xid, 3), "set_vx_info(%p[#%d.%d])",
10975 + vxi, vxi ? vxi->vx_id : 0,
10976 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
10978 + __vxh_set_vx_info(vxi, vxp, _here);
10980 + atomic_inc(&vxi->vx_usecnt);
10981 + vxo = xchg(vxp, vxi);
10986 +#define clr_vx_info(p) __clr_vx_info(p, __FILE__, __LINE__, __HERE__)
10988 +static inline void __clr_vx_info(struct vx_info **vxp,
10989 + const char *_file, int _line, void *_here)
10991 + struct vx_info *vxo;
10993 + vxo = xchg(vxp, NULL);
10997 + vxlprintk(VXD_CBIT(xid, 3), "clr_vx_info(%p[#%d.%d])",
10998 + vxo, vxo ? vxo->vx_id : 0,
10999 + vxo ? atomic_read(&vxo->vx_usecnt) : 0,
11001 + __vxh_clr_vx_info(vxo, vxp, _here);
11003 + if (atomic_dec_and_test(&vxo->vx_usecnt))
11004 + free_vx_info(vxo);
11008 +#define claim_vx_info(v, p) \
11009 + __claim_vx_info(v, p, __FILE__, __LINE__, __HERE__)
11011 +static inline void __claim_vx_info(struct vx_info *vxi,
11012 + struct task_struct *task,
11013 + const char *_file, int _line, void *_here)
11015 + vxlprintk(VXD_CBIT(xid, 3), "claim_vx_info(%p[#%d.%d.%d]) %p",
11016 + vxi, vxi ? vxi->vx_id : 0,
11017 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11018 + vxi ? atomic_read(&vxi->vx_tasks) : 0,
11019 + task, _file, _line);
11020 + __vxh_claim_vx_info(vxi, task, _here);
11022 + atomic_inc(&vxi->vx_tasks);
11026 +extern void unhash_vx_info(struct vx_info *);
11028 +#define release_vx_info(v, p) \
11029 + __release_vx_info(v, p, __FILE__, __LINE__, __HERE__)
11031 +static inline void __release_vx_info(struct vx_info *vxi,
11032 + struct task_struct *task,
11033 + const char *_file, int _line, void *_here)
11035 + vxlprintk(VXD_CBIT(xid, 3), "release_vx_info(%p[#%d.%d.%d]) %p",
11036 + vxi, vxi ? vxi->vx_id : 0,
11037 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11038 + vxi ? atomic_read(&vxi->vx_tasks) : 0,
11039 + task, _file, _line);
11040 + __vxh_release_vx_info(vxi, task, _here);
11044 + if (atomic_dec_and_test(&vxi->vx_tasks))
11045 + unhash_vx_info(vxi);
11049 +#define task_get_vx_info(p) \
11050 + __task_get_vx_info(p, __FILE__, __LINE__, __HERE__)
11052 +static inline struct vx_info *__task_get_vx_info(struct task_struct *p,
11053 + const char *_file, int _line, void *_here)
11055 + struct vx_info *vxi;
11058 + vxlprintk(VXD_CBIT(xid, 5), "task_get_vx_info(%p)",
11059 + p, _file, _line);
11060 + vxi = __get_vx_info(p->vx_info, _file, _line, _here);
11066 +static inline void __wakeup_vx_info(struct vx_info *vxi)
11068 + if (waitqueue_active(&vxi->vx_wait))
11069 + wake_up_interruptible(&vxi->vx_wait);
11073 +#define enter_vx_info(v, s) __enter_vx_info(v, s, __FILE__, __LINE__)
11075 +static inline void __enter_vx_info(struct vx_info *vxi,
11076 + struct vx_info_save *vxis, const char *_file, int _line)
11078 + vxlprintk(VXD_CBIT(xid, 5), "enter_vx_info(%p[#%d],%p) %p[#%d,%p]",
11079 + vxi, vxi ? vxi->vx_id : 0, vxis, current,
11080 + current->xid, current->vx_info, _file, _line);
11081 + vxis->vxi = xchg(¤t->vx_info, vxi);
11082 + vxis->xid = current->xid;
11083 + current->xid = vxi ? vxi->vx_id : 0;
11086 +#define leave_vx_info(s) __leave_vx_info(s, __FILE__, __LINE__)
11088 +static inline void __leave_vx_info(struct vx_info_save *vxis,
11089 + const char *_file, int _line)
11091 + vxlprintk(VXD_CBIT(xid, 5), "leave_vx_info(%p[#%d,%p]) %p[#%d,%p]",
11092 + vxis, vxis->xid, vxis->vxi, current,
11093 + current->xid, current->vx_info, _file, _line);
11094 + (void)xchg(¤t->vx_info, vxis->vxi);
11095 + current->xid = vxis->xid;
11099 +static inline void __enter_vx_admin(struct vx_info_save *vxis)
11101 + vxis->vxi = xchg(¤t->vx_info, NULL);
11102 + vxis->xid = xchg(¤t->xid, (xid_t)0);
11105 +static inline void __leave_vx_admin(struct vx_info_save *vxis)
11107 + (void)xchg(¤t->xid, vxis->xid);
11108 + (void)xchg(¤t->vx_info, vxis->vxi);
11111 +#define task_is_init(p) \
11112 + __task_is_init(p, __FILE__, __LINE__, __HERE__)
11114 +static inline int __task_is_init(struct task_struct *p,
11115 + const char *_file, int _line, void *_here)
11117 + int is_init = is_global_init(p);
11121 + is_init = p->vx_info->vx_initpid == p->pid;
11126 +extern void exit_vx_info(struct task_struct *, int);
11127 +extern void exit_vx_info_early(struct task_struct *, int);
11131 +#warning duplicate inclusion
11133 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_cowbl.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_cowbl.h
11134 --- linux-2.6.35.2/include/linux/vs_cowbl.h 1970-01-01 01:00:00.000000000 +0100
11135 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_cowbl.h 2010-08-02 21:01:17.000000000 +0200
11137 +#ifndef _VS_COWBL_H
11138 +#define _VS_COWBL_H
11140 +#include <linux/fs.h>
11141 +#include <linux/dcache.h>
11142 +#include <linux/namei.h>
11143 +#include <linux/slab.h>
11145 +extern struct dentry *cow_break_link(const char *pathname);
11147 +static inline int cow_check_and_break(struct path *path)
11149 + struct inode *inode = path->dentry->d_inode;
11152 + /* do we need this check? */
11153 + if (IS_RDONLY(inode))
11156 + if (IS_COW(inode)) {
11157 + if (IS_COW_LINK(inode)) {
11158 + struct dentry *new_dentry, *old_dentry = path->dentry;
11161 + buf = kmalloc(PATH_MAX, GFP_KERNEL);
11165 + pp = d_path(path, buf, PATH_MAX);
11166 + new_dentry = cow_break_link(pp);
11168 + if (!IS_ERR(new_dentry)) {
11169 + path->dentry = new_dentry;
11170 + dput(old_dentry);
11172 + error = PTR_ERR(new_dentry);
11174 + inode->i_flags &= ~(S_IXUNLINK | S_IMMUTABLE);
11175 + inode->i_ctime = CURRENT_TIME;
11176 + mark_inode_dirty(inode);
11183 +#warning duplicate inclusion
11185 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_cvirt.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_cvirt.h
11186 --- linux-2.6.35.2/include/linux/vs_cvirt.h 1970-01-01 01:00:00.000000000 +0100
11187 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_cvirt.h 2010-08-02 17:05:06.000000000 +0200
11189 +#ifndef _VS_CVIRT_H
11190 +#define _VS_CVIRT_H
11192 +#include "vserver/cvirt.h"
11193 +#include "vserver/context.h"
11194 +#include "vserver/base.h"
11195 +#include "vserver/check.h"
11196 +#include "vserver/debug.h"
11199 +static inline void vx_activate_task(struct task_struct *p)
11201 + struct vx_info *vxi;
11203 + if ((vxi = p->vx_info)) {
11204 + vx_update_load(vxi);
11205 + atomic_inc(&vxi->cvirt.nr_running);
11209 +static inline void vx_deactivate_task(struct task_struct *p)
11211 + struct vx_info *vxi;
11213 + if ((vxi = p->vx_info)) {
11214 + vx_update_load(vxi);
11215 + atomic_dec(&vxi->cvirt.nr_running);
11219 +static inline void vx_uninterruptible_inc(struct task_struct *p)
11221 + struct vx_info *vxi;
11223 + if ((vxi = p->vx_info))
11224 + atomic_inc(&vxi->cvirt.nr_uninterruptible);
11227 +static inline void vx_uninterruptible_dec(struct task_struct *p)
11229 + struct vx_info *vxi;
11231 + if ((vxi = p->vx_info))
11232 + atomic_dec(&vxi->cvirt.nr_uninterruptible);
11237 +#warning duplicate inclusion
11239 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_device.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_device.h
11240 --- linux-2.6.35.2/include/linux/vs_device.h 1970-01-01 01:00:00.000000000 +0100
11241 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_device.h 2010-08-02 17:05:06.000000000 +0200
11243 +#ifndef _VS_DEVICE_H
11244 +#define _VS_DEVICE_H
11246 +#include "vserver/base.h"
11247 +#include "vserver/device.h"
11248 +#include "vserver/debug.h"
11251 +#ifdef CONFIG_VSERVER_DEVICE
11253 +int vs_map_device(struct vx_info *, dev_t, dev_t *, umode_t);
11255 +#define vs_device_perm(v, d, m, p) \
11256 + ((vs_map_device(current_vx_info(), d, NULL, m) & (p)) == (p))
11261 +int vs_map_device(struct vx_info *vxi,
11262 + dev_t device, dev_t *target, umode_t mode)
11265 + *target = device;
11269 +#define vs_device_perm(v, d, m, p) ((p) == (p))
11274 +#define vs_map_chrdev(d, t, p) \
11275 + ((vs_map_device(current_vx_info(), d, t, S_IFCHR) & (p)) == (p))
11276 +#define vs_map_blkdev(d, t, p) \
11277 + ((vs_map_device(current_vx_info(), d, t, S_IFBLK) & (p)) == (p))
11279 +#define vs_chrdev_perm(d, p) \
11280 + vs_device_perm(current_vx_info(), d, S_IFCHR, p)
11281 +#define vs_blkdev_perm(d, p) \
11282 + vs_device_perm(current_vx_info(), d, S_IFBLK, p)
11286 +#warning duplicate inclusion
11288 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_dlimit.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_dlimit.h
11289 --- linux-2.6.35.2/include/linux/vs_dlimit.h 1970-01-01 01:00:00.000000000 +0100
11290 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_dlimit.h 2010-08-02 22:21:17.000000000 +0200
11292 +#ifndef _VS_DLIMIT_H
11293 +#define _VS_DLIMIT_H
11295 +#include <linux/fs.h>
11297 +#include "vserver/dlimit.h"
11298 +#include "vserver/base.h"
11299 +#include "vserver/debug.h"
11302 +#define get_dl_info(i) __get_dl_info(i, __FILE__, __LINE__)
11304 +static inline struct dl_info *__get_dl_info(struct dl_info *dli,
11305 + const char *_file, int _line)
11309 + vxlprintk(VXD_CBIT(dlim, 4), "get_dl_info(%p[#%d.%d])",
11310 + dli, dli ? dli->dl_tag : 0,
11311 + dli ? atomic_read(&dli->dl_usecnt) : 0,
11313 + atomic_inc(&dli->dl_usecnt);
11318 +#define free_dl_info(i) \
11319 + call_rcu(&(i)->dl_rcu, rcu_free_dl_info)
11321 +#define put_dl_info(i) __put_dl_info(i, __FILE__, __LINE__)
11323 +static inline void __put_dl_info(struct dl_info *dli,
11324 + const char *_file, int _line)
11328 + vxlprintk(VXD_CBIT(dlim, 4), "put_dl_info(%p[#%d.%d])",
11329 + dli, dli ? dli->dl_tag : 0,
11330 + dli ? atomic_read(&dli->dl_usecnt) : 0,
11332 + if (atomic_dec_and_test(&dli->dl_usecnt))
11333 + free_dl_info(dli);
11337 +#define __dlimit_char(d) ((d) ? '*' : ' ')
11339 +static inline int __dl_alloc_space(struct super_block *sb,
11340 + tag_t tag, dlsize_t nr, const char *file, int line)
11342 + struct dl_info *dli = NULL;
11347 + dli = locate_dl_info(sb, tag);
11351 + spin_lock(&dli->dl_lock);
11352 + ret = (dli->dl_space_used + nr > dli->dl_space_total);
11354 + dli->dl_space_used += nr;
11355 + spin_unlock(&dli->dl_lock);
11356 + put_dl_info(dli);
11358 + vxlprintk(VXD_CBIT(dlim, 1),
11359 + "ALLOC (%p,#%d)%c %lld bytes (%d)",
11360 + sb, tag, __dlimit_char(dli), (long long)nr,
11361 + ret, file, line);
11362 + return ret ? -ENOSPC : 0;
11365 +static inline void __dl_free_space(struct super_block *sb,
11366 + tag_t tag, dlsize_t nr, const char *_file, int _line)
11368 + struct dl_info *dli = NULL;
11372 + dli = locate_dl_info(sb, tag);
11376 + spin_lock(&dli->dl_lock);
11377 + if (dli->dl_space_used > nr)
11378 + dli->dl_space_used -= nr;
11380 + dli->dl_space_used = 0;
11381 + spin_unlock(&dli->dl_lock);
11382 + put_dl_info(dli);
11384 + vxlprintk(VXD_CBIT(dlim, 1),
11385 + "FREE (%p,#%d)%c %lld bytes",
11386 + sb, tag, __dlimit_char(dli), (long long)nr,
11390 +static inline int __dl_alloc_inode(struct super_block *sb,
11391 + tag_t tag, const char *_file, int _line)
11393 + struct dl_info *dli;
11396 + dli = locate_dl_info(sb, tag);
11400 + spin_lock(&dli->dl_lock);
11401 + dli->dl_inodes_used++;
11402 + ret = (dli->dl_inodes_used > dli->dl_inodes_total);
11403 + spin_unlock(&dli->dl_lock);
11404 + put_dl_info(dli);
11406 + vxlprintk(VXD_CBIT(dlim, 0),
11407 + "ALLOC (%p,#%d)%c inode (%d)",
11408 + sb, tag, __dlimit_char(dli), ret, _file, _line);
11409 + return ret ? -ENOSPC : 0;
11412 +static inline void __dl_free_inode(struct super_block *sb,
11413 + tag_t tag, const char *_file, int _line)
11415 + struct dl_info *dli;
11417 + dli = locate_dl_info(sb, tag);
11421 + spin_lock(&dli->dl_lock);
11422 + if (dli->dl_inodes_used > 1)
11423 + dli->dl_inodes_used--;
11425 + dli->dl_inodes_used = 0;
11426 + spin_unlock(&dli->dl_lock);
11427 + put_dl_info(dli);
11429 + vxlprintk(VXD_CBIT(dlim, 0),
11430 + "FREE (%p,#%d)%c inode",
11431 + sb, tag, __dlimit_char(dli), _file, _line);
11434 +static inline void __dl_adjust_block(struct super_block *sb, tag_t tag,
11435 + unsigned long long *free_blocks, unsigned long long *root_blocks,
11436 + const char *_file, int _line)
11438 + struct dl_info *dli;
11439 + uint64_t broot, bfree;
11441 + dli = locate_dl_info(sb, tag);
11445 + spin_lock(&dli->dl_lock);
11446 + broot = (dli->dl_space_total -
11447 + (dli->dl_space_total >> 10) * dli->dl_nrlmult)
11448 + >> sb->s_blocksize_bits;
11449 + bfree = (dli->dl_space_total - dli->dl_space_used)
11450 + >> sb->s_blocksize_bits;
11451 + spin_unlock(&dli->dl_lock);
11453 + vxlprintk(VXD_CBIT(dlim, 2),
11454 + "ADJUST: %lld,%lld on %lld,%lld [mult=%d]",
11455 + (long long)bfree, (long long)broot,
11456 + *free_blocks, *root_blocks, dli->dl_nrlmult,
11458 + if (free_blocks) {
11459 + if (*free_blocks > bfree)
11460 + *free_blocks = bfree;
11462 + if (root_blocks) {
11463 + if (*root_blocks > broot)
11464 + *root_blocks = broot;
11466 + put_dl_info(dli);
11469 +#define dl_prealloc_space(in, bytes) \
11470 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11471 + __FILE__, __LINE__ )
11473 +#define dl_alloc_space(in, bytes) \
11474 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11475 + __FILE__, __LINE__ )
11477 +#define dl_reserve_space(in, bytes) \
11478 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11479 + __FILE__, __LINE__ )
11481 +#define dl_claim_space(in, bytes) (0)
11483 +#define dl_release_space(in, bytes) \
11484 + __dl_free_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11485 + __FILE__, __LINE__ )
11487 +#define dl_free_space(in, bytes) \
11488 + __dl_free_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11489 + __FILE__, __LINE__ )
11493 +#define dl_alloc_inode(in) \
11494 + __dl_alloc_inode((in)->i_sb, (in)->i_tag, __FILE__, __LINE__ )
11496 +#define dl_free_inode(in) \
11497 + __dl_free_inode((in)->i_sb, (in)->i_tag, __FILE__, __LINE__ )
11500 +#define dl_adjust_block(sb, tag, fb, rb) \
11501 + __dl_adjust_block(sb, tag, fb, rb, __FILE__, __LINE__ )
11505 +#warning duplicate inclusion
11507 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/base.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/base.h
11508 --- linux-2.6.35.2/include/linux/vserver/base.h 1970-01-01 01:00:00.000000000 +0100
11509 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/base.h 2010-08-02 17:05:06.000000000 +0200
11511 +#ifndef _VX_BASE_H
11512 +#define _VX_BASE_H
11515 +/* context state changes */
11527 +#define vx_task_xid(t) ((t)->xid)
11529 +#define vx_current_xid() vx_task_xid(current)
11531 +#define current_vx_info() (current->vx_info)
11534 +#define nx_task_nid(t) ((t)->nid)
11536 +#define nx_current_nid() nx_task_nid(current)
11538 +#define current_nx_info() (current->nx_info)
11541 +/* generic flag merging */
11543 +#define vs_check_flags(v, m, f) (((v) & (m)) ^ (f))
11545 +#define vs_mask_flags(v, f, m) (((v) & ~(m)) | ((f) & (m)))
11547 +#define vs_mask_mask(v, f, m) (((v) & ~(m)) | ((v) & (f) & (m)))
11549 +#define vs_check_bit(v, n) ((v) & (1LL << (n)))
11552 +/* context flags */
11554 +#define __vx_flags(v) ((v) ? (v)->vx_flags : 0)
11556 +#define vx_current_flags() __vx_flags(current_vx_info())
11558 +#define vx_info_flags(v, m, f) \
11559 + vs_check_flags(__vx_flags(v), m, f)
11561 +#define task_vx_flags(t, m, f) \
11562 + ((t) && vx_info_flags((t)->vx_info, m, f))
11564 +#define vx_flags(m, f) vx_info_flags(current_vx_info(), m, f)
11567 +/* context caps */
11569 +#define __vx_ccaps(v) ((v) ? (v)->vx_ccaps : 0)
11571 +#define vx_current_ccaps() __vx_ccaps(current_vx_info())
11573 +#define vx_info_ccaps(v, c) (__vx_ccaps(v) & (c))
11575 +#define vx_ccaps(c) vx_info_ccaps(current_vx_info(), (c))
11579 +/* network flags */
11581 +#define __nx_flags(n) ((n) ? (n)->nx_flags : 0)
11583 +#define nx_current_flags() __nx_flags(current_nx_info())
11585 +#define nx_info_flags(n, m, f) \
11586 + vs_check_flags(__nx_flags(n), m, f)
11588 +#define task_nx_flags(t, m, f) \
11589 + ((t) && nx_info_flags((t)->nx_info, m, f))
11591 +#define nx_flags(m, f) nx_info_flags(current_nx_info(), m, f)
11594 +/* network caps */
11596 +#define __nx_ncaps(n) ((n) ? (n)->nx_ncaps : 0)
11598 +#define nx_current_ncaps() __nx_ncaps(current_nx_info())
11600 +#define nx_info_ncaps(n, c) (__nx_ncaps(n) & (c))
11602 +#define nx_ncaps(c) nx_info_ncaps(current_nx_info(), c)
11605 +/* context mask capabilities */
11607 +#define __vx_mcaps(v) ((v) ? (v)->vx_ccaps >> 32UL : ~0 )
11609 +#define vx_info_mcaps(v, c) (__vx_mcaps(v) & (c))
11611 +#define vx_mcaps(c) vx_info_mcaps(current_vx_info(), c)
11614 +/* context bcap mask */
11616 +#define __vx_bcaps(v) ((v)->vx_bcaps)
11618 +#define vx_current_bcaps() __vx_bcaps(current_vx_info())
11621 +/* mask given bcaps */
11623 +#define vx_info_mbcaps(v, c) ((v) ? cap_intersect(__vx_bcaps(v), c) : c)
11625 +#define vx_mbcaps(c) vx_info_mbcaps(current_vx_info(), c)
11628 +/* masked cap_bset */
11630 +#define vx_info_cap_bset(v) vx_info_mbcaps(v, current->cap_bset)
11632 +#define vx_current_cap_bset() vx_info_cap_bset(current_vx_info())
11635 +#define vx_info_mbcap(v, b) \
11636 + (!vx_info_flags(v, VXF_STATE_SETUP, 0) ? \
11637 + vx_info_bcaps(v, b) : (b))
11639 +#define task_vx_mbcap(t, b) \
11640 + vx_info_mbcap((t)->vx_info, (t)->b)
11642 +#define vx_mbcap(b) task_vx_mbcap(current, b)
11645 +#define vx_cap_raised(v, c, f) cap_raised(vx_info_mbcaps(v, c), f)
11647 +#define vx_capable(b, c) (capable(b) || \
11648 + (cap_raised(current_cap(), b) && vx_ccaps(c)))
11650 +#define nx_capable(b, c) (capable(b) || \
11651 + (cap_raised(current_cap(), b) && nx_ncaps(c)))
11653 +#define vx_task_initpid(t, n) \
11654 + ((t)->vx_info && \
11655 + ((t)->vx_info->vx_initpid == (n)))
11657 +#define vx_current_initpid(n) vx_task_initpid(current, n)
11660 +/* context unshare mask */
11662 +#define __vx_umask(v) ((v)->vx_umask)
11664 +#define vx_current_umask() __vx_umask(current_vx_info())
11666 +#define vx_can_unshare(b, f) (capable(b) || \
11667 + (cap_raised(current_cap(), b) && \
11668 + !((f) & ~vx_current_umask())))
11671 +#define __vx_state(v) ((v) ? ((v)->vx_state) : 0)
11673 +#define vx_info_state(v, m) (__vx_state(v) & (m))
11676 +#define __nx_state(n) ((n) ? ((n)->nx_state) : 0)
11678 +#define nx_info_state(n, m) (__nx_state(n) & (m))
11681 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/cacct_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cacct_cmd.h
11682 --- linux-2.6.35.2/include/linux/vserver/cacct_cmd.h 1970-01-01 01:00:00.000000000 +0100
11683 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cacct_cmd.h 2010-08-02 17:05:06.000000000 +0200
11685 +#ifndef _VX_CACCT_CMD_H
11686 +#define _VX_CACCT_CMD_H
11689 +/* virtual host info name commands */
11691 +#define VCMD_sock_stat VC_CMD(VSTAT, 5, 0)
11693 +struct vcmd_sock_stat_v0 {
11695 + uint32_t count[3];
11696 + uint64_t total[3];
11702 +#include <linux/compiler.h>
11704 +extern int vc_sock_stat(struct vx_info *, void __user *);
11706 +#endif /* __KERNEL__ */
11707 +#endif /* _VX_CACCT_CMD_H */
11708 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/cacct_def.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cacct_def.h
11709 --- linux-2.6.35.2/include/linux/vserver/cacct_def.h 1970-01-01 01:00:00.000000000 +0100
11710 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cacct_def.h 2010-08-02 17:05:06.000000000 +0200
11712 +#ifndef _VX_CACCT_DEF_H
11713 +#define _VX_CACCT_DEF_H
11715 +#include <asm/atomic.h>
11716 +#include <linux/vserver/cacct.h>
11719 +struct _vx_sock_acc {
11720 + atomic_long_t count;
11721 + atomic_long_t total;
11724 +/* context sub struct */
11726 +struct _vx_cacct {
11727 + struct _vx_sock_acc sock[VXA_SOCK_SIZE][3];
11728 + atomic_t slab[8];
11729 + atomic_t page[6][8];
11732 +#ifdef CONFIG_VSERVER_DEBUG
11734 +static inline void __dump_vx_cacct(struct _vx_cacct *cacct)
11738 + printk("\t_vx_cacct:");
11739 + for (i = 0; i < 6; i++) {
11740 + struct _vx_sock_acc *ptr = cacct->sock[i];
11742 + printk("\t [%d] =", i);
11743 + for (j = 0; j < 3; j++) {
11744 + printk(" [%d] = %8lu, %8lu", j,
11745 + atomic_long_read(&ptr[j].count),
11746 + atomic_long_read(&ptr[j].total));
11754 +#endif /* _VX_CACCT_DEF_H */
11755 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/cacct.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cacct.h
11756 --- linux-2.6.35.2/include/linux/vserver/cacct.h 1970-01-01 01:00:00.000000000 +0100
11757 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cacct.h 2010-08-02 17:05:06.000000000 +0200
11759 +#ifndef _VX_CACCT_H
11760 +#define _VX_CACCT_H
11763 +enum sock_acc_field {
11764 + VXA_SOCK_UNSPEC = 0,
11770 + VXA_SOCK_SIZE /* array size */
11773 +#endif /* _VX_CACCT_H */
11774 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/cacct_int.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cacct_int.h
11775 --- linux-2.6.35.2/include/linux/vserver/cacct_int.h 1970-01-01 01:00:00.000000000 +0100
11776 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cacct_int.h 2010-08-02 17:05:06.000000000 +0200
11778 +#ifndef _VX_CACCT_INT_H
11779 +#define _VX_CACCT_INT_H
11785 +unsigned long vx_sock_count(struct _vx_cacct *cacct, int type, int pos)
11787 + return atomic_long_read(&cacct->sock[type][pos].count);
11792 +unsigned long vx_sock_total(struct _vx_cacct *cacct, int type, int pos)
11794 + return atomic_long_read(&cacct->sock[type][pos].total);
11797 +#endif /* __KERNEL__ */
11798 +#endif /* _VX_CACCT_INT_H */
11799 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/check.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/check.h
11800 --- linux-2.6.35.2/include/linux/vserver/check.h 1970-01-01 01:00:00.000000000 +0100
11801 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/check.h 2010-08-02 17:05:06.000000000 +0200
11803 +#ifndef _VS_CHECK_H
11804 +#define _VS_CHECK_H
11807 +#define MAX_S_CONTEXT 65535 /* Arbitrary limit */
11809 +#ifdef CONFIG_VSERVER_DYNAMIC_IDS
11810 +#define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
11812 +#define MIN_D_CONTEXT 65536
11815 +/* check conditions */
11817 +#define VS_ADMIN 0x0001
11818 +#define VS_WATCH 0x0002
11819 +#define VS_HIDE 0x0004
11820 +#define VS_HOSTID 0x0008
11822 +#define VS_IDENT 0x0010
11823 +#define VS_EQUIV 0x0020
11824 +#define VS_PARENT 0x0040
11825 +#define VS_CHILD 0x0080
11827 +#define VS_ARG_MASK 0x00F0
11829 +#define VS_DYNAMIC 0x0100
11830 +#define VS_STATIC 0x0200
11832 +#define VS_ATR_MASK 0x0F00
11834 +#ifdef CONFIG_VSERVER_PRIVACY
11835 +#define VS_ADMIN_P (0)
11836 +#define VS_WATCH_P (0)
11838 +#define VS_ADMIN_P VS_ADMIN
11839 +#define VS_WATCH_P VS_WATCH
11842 +#define VS_HARDIRQ 0x1000
11843 +#define VS_SOFTIRQ 0x2000
11844 +#define VS_IRQ 0x4000
11846 +#define VS_IRQ_MASK 0xF000
11848 +#include <linux/hardirq.h>
11851 + * check current context for ADMIN/WATCH and
11852 + * optionally against supplied argument
11854 +static inline int __vs_check(int cid, int id, unsigned int mode)
11856 + if (mode & VS_ARG_MASK) {
11857 + if ((mode & VS_IDENT) && (id == cid))
11860 + if (mode & VS_ATR_MASK) {
11861 + if ((mode & VS_DYNAMIC) &&
11862 + (id >= MIN_D_CONTEXT) &&
11863 + (id <= MAX_S_CONTEXT))
11865 + if ((mode & VS_STATIC) &&
11866 + (id > 1) && (id < MIN_D_CONTEXT))
11869 + if (mode & VS_IRQ_MASK) {
11870 + if ((mode & VS_IRQ) && unlikely(in_interrupt()))
11872 + if ((mode & VS_HARDIRQ) && unlikely(in_irq()))
11874 + if ((mode & VS_SOFTIRQ) && unlikely(in_softirq()))
11877 + return (((mode & VS_ADMIN) && (cid == 0)) ||
11878 + ((mode & VS_WATCH) && (cid == 1)) ||
11879 + ((mode & VS_HOSTID) && (id == 0)));
11882 +#define vx_check(c, m) __vs_check(vx_current_xid(), c, (m) | VS_IRQ)
11884 +#define vx_weak_check(c, m) ((m) ? vx_check(c, m) : 1)
11887 +#define nx_check(c, m) __vs_check(nx_current_nid(), c, m)
11889 +#define nx_weak_check(c, m) ((m) ? nx_check(c, m) : 1)
11892 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/context_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/context_cmd.h
11893 --- linux-2.6.35.2/include/linux/vserver/context_cmd.h 1970-01-01 01:00:00.000000000 +0100
11894 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/context_cmd.h 2010-08-02 17:05:06.000000000 +0200
11896 +#ifndef _VX_CONTEXT_CMD_H
11897 +#define _VX_CONTEXT_CMD_H
11900 +/* vinfo commands */
11902 +#define VCMD_task_xid VC_CMD(VINFO, 1, 0)
11905 +extern int vc_task_xid(uint32_t);
11907 +#endif /* __KERNEL__ */
11909 +#define VCMD_vx_info VC_CMD(VINFO, 5, 0)
11911 +struct vcmd_vx_info_v0 {
11913 + uint32_t initpid;
11914 + /* more to come */
11918 +extern int vc_vx_info(struct vx_info *, void __user *);
11920 +#endif /* __KERNEL__ */
11922 +#define VCMD_ctx_stat VC_CMD(VSTAT, 0, 0)
11924 +struct vcmd_ctx_stat_v0 {
11927 + /* more to come */
11931 +extern int vc_ctx_stat(struct vx_info *, void __user *);
11933 +#endif /* __KERNEL__ */
11935 +/* context commands */
11937 +#define VCMD_ctx_create_v0 VC_CMD(VPROC, 1, 0)
11938 +#define VCMD_ctx_create VC_CMD(VPROC, 1, 1)
11940 +struct vcmd_ctx_create {
11941 + uint64_t flagword;
11944 +#define VCMD_ctx_migrate_v0 VC_CMD(PROCMIG, 1, 0)
11945 +#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 1)
11947 +struct vcmd_ctx_migrate {
11948 + uint64_t flagword;
11952 +extern int vc_ctx_create(uint32_t, void __user *);
11953 +extern int vc_ctx_migrate(struct vx_info *, void __user *);
11955 +#endif /* __KERNEL__ */
11958 +/* flag commands */
11960 +#define VCMD_get_cflags VC_CMD(FLAGS, 1, 0)
11961 +#define VCMD_set_cflags VC_CMD(FLAGS, 2, 0)
11963 +struct vcmd_ctx_flags_v0 {
11964 + uint64_t flagword;
11969 +extern int vc_get_cflags(struct vx_info *, void __user *);
11970 +extern int vc_set_cflags(struct vx_info *, void __user *);
11972 +#endif /* __KERNEL__ */
11975 +/* context caps commands */
11977 +#define VCMD_get_ccaps VC_CMD(FLAGS, 3, 1)
11978 +#define VCMD_set_ccaps VC_CMD(FLAGS, 4, 1)
11980 +struct vcmd_ctx_caps_v1 {
11986 +extern int vc_get_ccaps(struct vx_info *, void __user *);
11987 +extern int vc_set_ccaps(struct vx_info *, void __user *);
11989 +#endif /* __KERNEL__ */
11992 +/* bcaps commands */
11994 +#define VCMD_get_bcaps VC_CMD(FLAGS, 9, 0)
11995 +#define VCMD_set_bcaps VC_CMD(FLAGS, 10, 0)
11997 +struct vcmd_bcaps {
12003 +extern int vc_get_bcaps(struct vx_info *, void __user *);
12004 +extern int vc_set_bcaps(struct vx_info *, void __user *);
12006 +#endif /* __KERNEL__ */
12009 +/* umask commands */
12011 +#define VCMD_get_umask VC_CMD(FLAGS, 13, 0)
12012 +#define VCMD_set_umask VC_CMD(FLAGS, 14, 0)
12014 +struct vcmd_umask {
12020 +extern int vc_get_umask(struct vx_info *, void __user *);
12021 +extern int vc_set_umask(struct vx_info *, void __user *);
12023 +#endif /* __KERNEL__ */
12028 +#define VCMD_get_badness VC_CMD(MEMCTRL, 5, 0)
12029 +#define VCMD_set_badness VC_CMD(MEMCTRL, 6, 0)
12031 +struct vcmd_badness_v0 {
12036 +extern int vc_get_badness(struct vx_info *, void __user *);
12037 +extern int vc_set_badness(struct vx_info *, void __user *);
12039 +#endif /* __KERNEL__ */
12040 +#endif /* _VX_CONTEXT_CMD_H */
12041 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/context.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/context.h
12042 --- linux-2.6.35.2/include/linux/vserver/context.h 1970-01-01 01:00:00.000000000 +0100
12043 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/context.h 2010-08-02 17:05:06.000000000 +0200
12045 +#ifndef _VX_CONTEXT_H
12046 +#define _VX_CONTEXT_H
12048 +#include <linux/types.h>
12049 +#include <linux/capability.h>
12052 +/* context flags */
12054 +#define VXF_INFO_SCHED 0x00000002
12055 +#define VXF_INFO_NPROC 0x00000004
12056 +#define VXF_INFO_PRIVATE 0x00000008
12058 +#define VXF_INFO_INIT 0x00000010
12059 +#define VXF_INFO_HIDE 0x00000020
12060 +#define VXF_INFO_ULIMIT 0x00000040
12061 +#define VXF_INFO_NSPACE 0x00000080
12063 +#define VXF_SCHED_HARD 0x00000100
12064 +#define VXF_SCHED_PRIO 0x00000200
12065 +#define VXF_SCHED_PAUSE 0x00000400
12067 +#define VXF_VIRT_MEM 0x00010000
12068 +#define VXF_VIRT_UPTIME 0x00020000
12069 +#define VXF_VIRT_CPU 0x00040000
12070 +#define VXF_VIRT_LOAD 0x00080000
12071 +#define VXF_VIRT_TIME 0x00100000
12073 +#define VXF_HIDE_MOUNT 0x01000000
12074 +/* was VXF_HIDE_NETIF 0x02000000 */
12075 +#define VXF_HIDE_VINFO 0x04000000
12077 +#define VXF_STATE_SETUP (1ULL << 32)
12078 +#define VXF_STATE_INIT (1ULL << 33)
12079 +#define VXF_STATE_ADMIN (1ULL << 34)
12081 +#define VXF_SC_HELPER (1ULL << 36)
12082 +#define VXF_REBOOT_KILL (1ULL << 37)
12083 +#define VXF_PERSISTENT (1ULL << 38)
12085 +#define VXF_FORK_RSS (1ULL << 48)
12086 +#define VXF_PROLIFIC (1ULL << 49)
12088 +#define VXF_IGNEG_NICE (1ULL << 52)
12090 +#define VXF_ONE_TIME (0x0007ULL << 32)
12092 +#define VXF_INIT_SET (VXF_STATE_SETUP | VXF_STATE_INIT | VXF_STATE_ADMIN)
12095 +/* context migration */
12097 +#define VXM_SET_INIT 0x00000001
12098 +#define VXM_SET_REAPER 0x00000002
12100 +/* context caps */
12102 +#define VXC_CAP_MASK 0x00000000
12104 +#define VXC_SET_UTSNAME 0x00000001
12105 +#define VXC_SET_RLIMIT 0x00000002
12106 +#define VXC_FS_SECURITY 0x00000004
12107 +#define VXC_FS_TRUSTED 0x00000008
12108 +#define VXC_TIOCSTI 0x00000010
12110 +/* was VXC_RAW_ICMP 0x00000100 */
12111 +#define VXC_SYSLOG 0x00001000
12112 +#define VXC_OOM_ADJUST 0x00002000
12113 +#define VXC_AUDIT_CONTROL 0x00004000
12115 +#define VXC_SECURE_MOUNT 0x00010000
12116 +#define VXC_SECURE_REMOUNT 0x00020000
12117 +#define VXC_BINARY_MOUNT 0x00040000
12119 +#define VXC_QUOTA_CTL 0x00100000
12120 +#define VXC_ADMIN_MAPPER 0x00200000
12121 +#define VXC_ADMIN_CLOOP 0x00400000
12123 +#define VXC_KTHREAD 0x01000000
12124 +#define VXC_NAMESPACE 0x02000000
12129 +#include <linux/list.h>
12130 +#include <linux/spinlock.h>
12131 +#include <linux/rcupdate.h>
12133 +#include "limit_def.h"
12134 +#include "sched_def.h"
12135 +#include "cvirt_def.h"
12136 +#include "cacct_def.h"
12137 +#include "device_def.h"
12139 +#define VX_SPACES 2
12141 +struct _vx_info_pc {
12142 + struct _vx_sched_pc sched_pc;
12143 + struct _vx_cvirt_pc cvirt_pc;
12147 + struct hlist_node vx_hlist; /* linked list of contexts */
12148 + xid_t vx_id; /* context id */
12149 + atomic_t vx_usecnt; /* usage count */
12150 + atomic_t vx_tasks; /* tasks count */
12151 + struct vx_info *vx_parent; /* parent context */
12152 + int vx_state; /* context state */
12154 + unsigned long vx_nsmask[VX_SPACES]; /* assignment mask */
12155 + struct nsproxy *vx_nsproxy[VX_SPACES]; /* private namespaces */
12156 + struct fs_struct *vx_fs[VX_SPACES]; /* private namespace fs */
12158 + uint64_t vx_flags; /* context flags */
12159 + uint64_t vx_ccaps; /* context caps (vserver) */
12160 + kernel_cap_t vx_bcaps; /* bounding caps (system) */
12161 + unsigned long vx_umask; /* unshare mask (guest) */
12163 + struct task_struct *vx_reaper; /* guest reaper process */
12164 + pid_t vx_initpid; /* PID of guest init */
12165 + int64_t vx_badness_bias; /* OOM points bias */
12167 + struct _vx_limit limit; /* vserver limits */
12168 + struct _vx_sched sched; /* vserver scheduler */
12169 + struct _vx_cvirt cvirt; /* virtual/bias stuff */
12170 + struct _vx_cacct cacct; /* context accounting */
12172 + struct _vx_device dmap; /* default device map targets */
12174 +#ifndef CONFIG_SMP
12175 + struct _vx_info_pc info_pc; /* per cpu data */
12177 + struct _vx_info_pc *ptr_pc; /* per cpu array */
12180 + wait_queue_head_t vx_wait; /* context exit waitqueue */
12181 + int reboot_cmd; /* last sys_reboot() cmd */
12182 + int exit_code; /* last process exit code */
12184 + char vx_name[65]; /* vserver name */
12187 +#ifndef CONFIG_SMP
12188 +#define vx_ptr_pc(vxi) (&(vxi)->info_pc)
12189 +#define vx_per_cpu(vxi, v, id) vx_ptr_pc(vxi)->v
12191 +#define vx_ptr_pc(vxi) ((vxi)->ptr_pc)
12192 +#define vx_per_cpu(vxi, v, id) per_cpu_ptr(vx_ptr_pc(vxi), id)->v
12195 +#define vx_cpu(vxi, v) vx_per_cpu(vxi, v, smp_processor_id())
12198 +struct vx_info_save {
12199 + struct vx_info *vxi;
12204 +/* status flags */
12206 +#define VXS_HASHED 0x0001
12207 +#define VXS_PAUSED 0x0010
12208 +#define VXS_SHUTDOWN 0x0100
12209 +#define VXS_HELPER 0x1000
12210 +#define VXS_RELEASED 0x8000
12213 +extern void claim_vx_info(struct vx_info *, struct task_struct *);
12214 +extern void release_vx_info(struct vx_info *, struct task_struct *);
12216 +extern struct vx_info *lookup_vx_info(int);
12217 +extern struct vx_info *lookup_or_create_vx_info(int);
12219 +extern int get_xid_list(int, unsigned int *, int);
12220 +extern int xid_is_hashed(xid_t);
12222 +extern int vx_migrate_task(struct task_struct *, struct vx_info *, int);
12224 +extern long vs_state_change(struct vx_info *, unsigned int);
12227 +#endif /* __KERNEL__ */
12228 +#endif /* _VX_CONTEXT_H */
12229 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/cvirt_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cvirt_cmd.h
12230 --- linux-2.6.35.2/include/linux/vserver/cvirt_cmd.h 1970-01-01 01:00:00.000000000 +0100
12231 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cvirt_cmd.h 2010-08-02 17:05:06.000000000 +0200
12233 +#ifndef _VX_CVIRT_CMD_H
12234 +#define _VX_CVIRT_CMD_H
12237 +/* virtual host info name commands */
12239 +#define VCMD_set_vhi_name VC_CMD(VHOST, 1, 0)
12240 +#define VCMD_get_vhi_name VC_CMD(VHOST, 2, 0)
12242 +struct vcmd_vhi_name_v0 {
12248 +enum vhi_name_field {
12249 + VHIN_CONTEXT = 0,
12261 +#include <linux/compiler.h>
12263 +extern int vc_set_vhi_name(struct vx_info *, void __user *);
12264 +extern int vc_get_vhi_name(struct vx_info *, void __user *);
12266 +#endif /* __KERNEL__ */
12268 +#define VCMD_virt_stat VC_CMD(VSTAT, 3, 0)
12270 +struct vcmd_virt_stat_v0 {
12273 + uint32_t nr_threads;
12274 + uint32_t nr_running;
12275 + uint32_t nr_uninterruptible;
12276 + uint32_t nr_onhold;
12277 + uint32_t nr_forks;
12278 + uint32_t load[3];
12282 +extern int vc_virt_stat(struct vx_info *, void __user *);
12284 +#endif /* __KERNEL__ */
12285 +#endif /* _VX_CVIRT_CMD_H */
12286 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/cvirt_def.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cvirt_def.h
12287 --- linux-2.6.35.2/include/linux/vserver/cvirt_def.h 1970-01-01 01:00:00.000000000 +0100
12288 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cvirt_def.h 2010-08-02 17:05:06.000000000 +0200
12290 +#ifndef _VX_CVIRT_DEF_H
12291 +#define _VX_CVIRT_DEF_H
12293 +#include <linux/jiffies.h>
12294 +#include <linux/spinlock.h>
12295 +#include <linux/wait.h>
12296 +#include <linux/time.h>
12297 +#include <asm/atomic.h>
12300 +struct _vx_usage_stat {
12304 + uint64_t softirq;
12310 +struct _vx_syslog {
12311 + wait_queue_head_t log_wait;
12312 + spinlock_t logbuf_lock; /* lock for the log buffer */
12314 + unsigned long log_start; /* next char to be read by syslog() */
12315 + unsigned long con_start; /* next char to be sent to consoles */
12316 + unsigned long log_end; /* most-recently-written-char + 1 */
12317 + unsigned long logged_chars; /* #chars since last read+clear operation */
12319 + char log_buf[1024];
12323 +/* context sub struct */
12325 +struct _vx_cvirt {
12326 + atomic_t nr_threads; /* number of current threads */
12327 + atomic_t nr_running; /* number of running threads */
12328 + atomic_t nr_uninterruptible; /* number of uninterruptible threads */
12330 + atomic_t nr_onhold; /* processes on hold */
12331 + uint32_t onhold_last; /* jiffies when put on hold */
12333 + struct timeval bias_tv; /* time offset to the host */
12334 + struct timespec bias_idle;
12335 + struct timespec bias_uptime; /* context creation point */
12336 + uint64_t bias_clock; /* offset in clock_t */
12338 + spinlock_t load_lock; /* lock for the load averages */
12339 + atomic_t load_updates; /* nr of load updates done so far */
12340 + uint32_t load_last; /* last time load was calculated */
12341 + uint32_t load[3]; /* load averages 1,5,15 */
12343 + atomic_t total_forks; /* number of forks so far */
12345 + struct _vx_syslog syslog;
12348 +struct _vx_cvirt_pc {
12349 + struct _vx_usage_stat cpustat;
12353 +#ifdef CONFIG_VSERVER_DEBUG
12355 +static inline void __dump_vx_cvirt(struct _vx_cvirt *cvirt)
12357 + printk("\t_vx_cvirt:\n");
12358 + printk("\t threads: %4d, %4d, %4d, %4d\n",
12359 + atomic_read(&cvirt->nr_threads),
12360 + atomic_read(&cvirt->nr_running),
12361 + atomic_read(&cvirt->nr_uninterruptible),
12362 + atomic_read(&cvirt->nr_onhold));
12363 + /* add rest here */
12364 + printk("\t total_forks = %d\n", atomic_read(&cvirt->total_forks));
12369 +#endif /* _VX_CVIRT_DEF_H */
12370 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/cvirt.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cvirt.h
12371 --- linux-2.6.35.2/include/linux/vserver/cvirt.h 1970-01-01 01:00:00.000000000 +0100
12372 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/cvirt.h 2010-08-02 17:05:06.000000000 +0200
12374 +#ifndef _VX_CVIRT_H
12375 +#define _VX_CVIRT_H
12382 +void vx_vsi_uptime(struct timespec *, struct timespec *);
12387 +void vx_update_load(struct vx_info *);
12390 +int vx_do_syslog(int, char __user *, int);
12392 +#endif /* __KERNEL__ */
12393 +#endif /* _VX_CVIRT_H */
12394 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/debug_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/debug_cmd.h
12395 --- linux-2.6.35.2/include/linux/vserver/debug_cmd.h 1970-01-01 01:00:00.000000000 +0100
12396 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/debug_cmd.h 2010-08-02 17:05:06.000000000 +0200
12398 +#ifndef _VX_DEBUG_CMD_H
12399 +#define _VX_DEBUG_CMD_H
12402 +/* debug commands */
12404 +#define VCMD_dump_history VC_CMD(DEBUG, 1, 0)
12406 +#define VCMD_read_history VC_CMD(DEBUG, 5, 0)
12407 +#define VCMD_read_monitor VC_CMD(DEBUG, 6, 0)
12409 +struct vcmd_read_history_v0 {
12412 + char __user *data;
12415 +struct vcmd_read_monitor_v0 {
12418 + char __user *data;
12424 +#ifdef CONFIG_COMPAT
12426 +#include <asm/compat.h>
12428 +struct vcmd_read_history_v0_x32 {
12431 + compat_uptr_t data_ptr;
12434 +struct vcmd_read_monitor_v0_x32 {
12437 + compat_uptr_t data_ptr;
12440 +#endif /* CONFIG_COMPAT */
12442 +extern int vc_dump_history(uint32_t);
12444 +extern int vc_read_history(uint32_t, void __user *);
12445 +extern int vc_read_monitor(uint32_t, void __user *);
12447 +#ifdef CONFIG_COMPAT
12449 +extern int vc_read_history_x32(uint32_t, void __user *);
12450 +extern int vc_read_monitor_x32(uint32_t, void __user *);
12452 +#endif /* CONFIG_COMPAT */
12454 +#endif /* __KERNEL__ */
12455 +#endif /* _VX_DEBUG_CMD_H */
12456 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/debug.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/debug.h
12457 --- linux-2.6.35.2/include/linux/vserver/debug.h 1970-01-01 01:00:00.000000000 +0100
12458 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/debug.h 2010-08-02 17:05:06.000000000 +0200
12460 +#ifndef _VX_DEBUG_H
12461 +#define _VX_DEBUG_H
12464 +#define VXD_CBIT(n, m) (vx_debug_ ## n & (1 << (m)))
12465 +#define VXD_CMIN(n, m) (vx_debug_ ## n > (m))
12466 +#define VXD_MASK(n, m) (vx_debug_ ## n & (m))
12468 +#define VXD_DEV(d) (d), (d)->bd_inode->i_ino, \
12469 + imajor((d)->bd_inode), iminor((d)->bd_inode)
12470 +#define VXF_DEV "%p[%lu,%d:%d]"
12473 +#define vxd_path(p) \
12474 + ({ static char _buffer[PATH_MAX]; \
12475 + d_path(p, _buffer, sizeof(_buffer)); })
12477 +#define vxd_cond_path(n) \
12478 + ((n) ? vxd_path(&(n)->path) : "<null>" )
12481 +#ifdef CONFIG_VSERVER_DEBUG
12483 +extern unsigned int vx_debug_switch;
12484 +extern unsigned int vx_debug_xid;
12485 +extern unsigned int vx_debug_nid;
12486 +extern unsigned int vx_debug_tag;
12487 +extern unsigned int vx_debug_net;
12488 +extern unsigned int vx_debug_limit;
12489 +extern unsigned int vx_debug_cres;
12490 +extern unsigned int vx_debug_dlim;
12491 +extern unsigned int vx_debug_quota;
12492 +extern unsigned int vx_debug_cvirt;
12493 +extern unsigned int vx_debug_space;
12494 +extern unsigned int vx_debug_misc;
12497 +#define VX_LOGLEVEL "vxD: "
12498 +#define VX_PROC_FMT "%p: "
12499 +#define VX_PROCESS current
12501 +#define vxdprintk(c, f, x...) \
12504 + printk(VX_LOGLEVEL VX_PROC_FMT f "\n", \
12505 + VX_PROCESS , ##x); \
12508 +#define vxlprintk(c, f, x...) \
12511 + printk(VX_LOGLEVEL f " @%s:%d\n", x); \
12514 +#define vxfprintk(c, f, x...) \
12517 + printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
12523 +void dump_vx_info(struct vx_info *, int);
12524 +void dump_vx_info_inactive(int);
12526 +#else /* CONFIG_VSERVER_DEBUG */
12528 +#define vx_debug_switch 0
12529 +#define vx_debug_xid 0
12530 +#define vx_debug_nid 0
12531 +#define vx_debug_tag 0
12532 +#define vx_debug_net 0
12533 +#define vx_debug_limit 0
12534 +#define vx_debug_cres 0
12535 +#define vx_debug_dlim 0
12536 +#define vx_debug_cvirt 0
12538 +#define vxdprintk(x...) do { } while (0)
12539 +#define vxlprintk(x...) do { } while (0)
12540 +#define vxfprintk(x...) do { } while (0)
12542 +#endif /* CONFIG_VSERVER_DEBUG */
12545 +#ifdef CONFIG_VSERVER_WARN
12547 +#define VX_WARNLEVEL KERN_WARNING "vxW: "
12548 +#define VX_WARN_TASK "[»%s«,%u:#%u|%u|%u] "
12549 +#define VX_WARN_XID "[xid #%u] "
12550 +#define VX_WARN_NID "[nid #%u] "
12551 +#define VX_WARN_TAG "[tag #%u] "
12553 +#define vxwprintk(c, f, x...) \
12556 + printk(VX_WARNLEVEL f "\n", ##x); \
12559 +#else /* CONFIG_VSERVER_WARN */
12561 +#define vxwprintk(x...) do { } while (0)
12563 +#endif /* CONFIG_VSERVER_WARN */
12565 +#define vxwprintk_task(c, f, x...) \
12566 + vxwprintk(c, VX_WARN_TASK f, \
12567 + current->comm, current->pid, \
12568 + current->xid, current->nid, current->tag, ##x)
12569 +#define vxwprintk_xid(c, f, x...) \
12570 + vxwprintk(c, VX_WARN_XID f, current->xid, x)
12571 +#define vxwprintk_nid(c, f, x...) \
12572 + vxwprintk(c, VX_WARN_NID f, current->nid, x)
12573 +#define vxwprintk_tag(c, f, x...) \
12574 + vxwprintk(c, VX_WARN_TAG f, current->tag, x)
12576 +#ifdef CONFIG_VSERVER_DEBUG
12577 +#define vxd_assert_lock(l) assert_spin_locked(l)
12578 +#define vxd_assert(c, f, x...) vxlprintk(!(c), \
12579 + "assertion [" f "] failed.", ##x, __FILE__, __LINE__)
12581 +#define vxd_assert_lock(l) do { } while (0)
12582 +#define vxd_assert(c, f, x...) do { } while (0)
12586 +#endif /* _VX_DEBUG_H */
12587 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/device_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/device_cmd.h
12588 --- linux-2.6.35.2/include/linux/vserver/device_cmd.h 1970-01-01 01:00:00.000000000 +0100
12589 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/device_cmd.h 2010-08-02 17:05:06.000000000 +0200
12591 +#ifndef _VX_DEVICE_CMD_H
12592 +#define _VX_DEVICE_CMD_H
12595 +/* device vserver commands */
12597 +#define VCMD_set_mapping VC_CMD(DEVICE, 1, 0)
12598 +#define VCMD_unset_mapping VC_CMD(DEVICE, 2, 0)
12600 +struct vcmd_set_mapping_v0 {
12601 + const char __user *device;
12602 + const char __user *target;
12609 +#ifdef CONFIG_COMPAT
12611 +#include <asm/compat.h>
12613 +struct vcmd_set_mapping_v0_x32 {
12614 + compat_uptr_t device_ptr;
12615 + compat_uptr_t target_ptr;
12619 +#endif /* CONFIG_COMPAT */
12621 +#include <linux/compiler.h>
12623 +extern int vc_set_mapping(struct vx_info *, void __user *);
12624 +extern int vc_unset_mapping(struct vx_info *, void __user *);
12626 +#ifdef CONFIG_COMPAT
12628 +extern int vc_set_mapping_x32(struct vx_info *, void __user *);
12629 +extern int vc_unset_mapping_x32(struct vx_info *, void __user *);
12631 +#endif /* CONFIG_COMPAT */
12633 +#endif /* __KERNEL__ */
12634 +#endif /* _VX_DEVICE_CMD_H */
12635 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/device_def.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/device_def.h
12636 --- linux-2.6.35.2/include/linux/vserver/device_def.h 1970-01-01 01:00:00.000000000 +0100
12637 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/device_def.h 2010-08-02 17:05:06.000000000 +0200
12639 +#ifndef _VX_DEVICE_DEF_H
12640 +#define _VX_DEVICE_DEF_H
12642 +#include <linux/types.h>
12644 +struct vx_dmap_target {
12649 +struct _vx_device {
12650 +#ifdef CONFIG_VSERVER_DEVICE
12651 + struct vx_dmap_target targets[2];
12655 +#endif /* _VX_DEVICE_DEF_H */
12656 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/device.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/device.h
12657 --- linux-2.6.35.2/include/linux/vserver/device.h 1970-01-01 01:00:00.000000000 +0100
12658 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/device.h 2010-08-02 17:05:06.000000000 +0200
12660 +#ifndef _VX_DEVICE_H
12661 +#define _VX_DEVICE_H
12664 +#define DATTR_CREATE 0x00000001
12665 +#define DATTR_OPEN 0x00000002
12667 +#define DATTR_REMAP 0x00000010
12669 +#define DATTR_MASK 0x00000013
12672 +#else /* _VX_DEVICE_H */
12673 +#warning duplicate inclusion
12674 +#endif /* _VX_DEVICE_H */
12675 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/dlimit_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/dlimit_cmd.h
12676 --- linux-2.6.35.2/include/linux/vserver/dlimit_cmd.h 1970-01-01 01:00:00.000000000 +0100
12677 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/dlimit_cmd.h 2010-08-02 17:05:06.000000000 +0200
12679 +#ifndef _VX_DLIMIT_CMD_H
12680 +#define _VX_DLIMIT_CMD_H
12683 +/* dlimit vserver commands */
12685 +#define VCMD_add_dlimit VC_CMD(DLIMIT, 1, 0)
12686 +#define VCMD_rem_dlimit VC_CMD(DLIMIT, 2, 0)
12688 +#define VCMD_set_dlimit VC_CMD(DLIMIT, 5, 0)
12689 +#define VCMD_get_dlimit VC_CMD(DLIMIT, 6, 0)
12691 +struct vcmd_ctx_dlimit_base_v0 {
12692 + const char __user *name;
12696 +struct vcmd_ctx_dlimit_v0 {
12697 + const char __user *name;
12698 + uint32_t space_used; /* used space in kbytes */
12699 + uint32_t space_total; /* maximum space in kbytes */
12700 + uint32_t inodes_used; /* used inodes */
12701 + uint32_t inodes_total; /* maximum inodes */
12702 + uint32_t reserved; /* reserved for root in % */
12706 +#define CDLIM_UNSET ((uint32_t)0UL)
12707 +#define CDLIM_INFINITY ((uint32_t)~0UL)
12708 +#define CDLIM_KEEP ((uint32_t)~1UL)
12710 +#define DLIME_UNIT 0
12711 +#define DLIME_KILO 1
12712 +#define DLIME_MEGA 2
12713 +#define DLIME_GIGA 3
12715 +#define DLIMF_SHIFT 0x10
12717 +#define DLIMS_USED 0
12718 +#define DLIMS_TOTAL 2
12721 +uint64_t dlimit_space_32to64(uint32_t val, uint32_t flags, int shift)
12723 + int exp = (flags & DLIMF_SHIFT) ?
12724 + (flags >> shift) & DLIME_GIGA : DLIME_KILO;
12725 + return ((uint64_t)val) << (10 * exp);
12729 +uint32_t dlimit_space_64to32(uint64_t val, uint32_t *flags, int shift)
12733 + if (*flags & DLIMF_SHIFT) {
12734 + while (val > (1LL << 32) && (exp < 3)) {
12738 + *flags &= ~(DLIME_GIGA << shift);
12739 + *flags |= exp << shift;
12747 +#ifdef CONFIG_COMPAT
12749 +#include <asm/compat.h>
12751 +struct vcmd_ctx_dlimit_base_v0_x32 {
12752 + compat_uptr_t name_ptr;
12756 +struct vcmd_ctx_dlimit_v0_x32 {
12757 + compat_uptr_t name_ptr;
12758 + uint32_t space_used; /* used space in kbytes */
12759 + uint32_t space_total; /* maximum space in kbytes */
12760 + uint32_t inodes_used; /* used inodes */
12761 + uint32_t inodes_total; /* maximum inodes */
12762 + uint32_t reserved; /* reserved for root in % */
12766 +#endif /* CONFIG_COMPAT */
12768 +#include <linux/compiler.h>
12770 +extern int vc_add_dlimit(uint32_t, void __user *);
12771 +extern int vc_rem_dlimit(uint32_t, void __user *);
12773 +extern int vc_set_dlimit(uint32_t, void __user *);
12774 +extern int vc_get_dlimit(uint32_t, void __user *);
12776 +#ifdef CONFIG_COMPAT
12778 +extern int vc_add_dlimit_x32(uint32_t, void __user *);
12779 +extern int vc_rem_dlimit_x32(uint32_t, void __user *);
12781 +extern int vc_set_dlimit_x32(uint32_t, void __user *);
12782 +extern int vc_get_dlimit_x32(uint32_t, void __user *);
12784 +#endif /* CONFIG_COMPAT */
12786 +#endif /* __KERNEL__ */
12787 +#endif /* _VX_DLIMIT_CMD_H */
12788 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/dlimit.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/dlimit.h
12789 --- linux-2.6.35.2/include/linux/vserver/dlimit.h 1970-01-01 01:00:00.000000000 +0100
12790 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/dlimit.h 2010-08-02 17:05:06.000000000 +0200
12792 +#ifndef _VX_DLIMIT_H
12793 +#define _VX_DLIMIT_H
12795 +#include "switch.h"
12800 +/* keep in sync with CDLIM_INFINITY */
12802 +#define DLIM_INFINITY (~0ULL)
12804 +#include <linux/spinlock.h>
12805 +#include <linux/rcupdate.h>
12807 +struct super_block;
12810 + struct hlist_node dl_hlist; /* linked list of contexts */
12811 + struct rcu_head dl_rcu; /* the rcu head */
12812 + tag_t dl_tag; /* context tag */
12813 + atomic_t dl_usecnt; /* usage count */
12814 + atomic_t dl_refcnt; /* reference count */
12816 + struct super_block *dl_sb; /* associated superblock */
12818 + spinlock_t dl_lock; /* protect the values */
12820 + unsigned long long dl_space_used; /* used space in bytes */
12821 + unsigned long long dl_space_total; /* maximum space in bytes */
12822 + unsigned long dl_inodes_used; /* used inodes */
12823 + unsigned long dl_inodes_total; /* maximum inodes */
12825 + unsigned int dl_nrlmult; /* non root limit mult */
12830 +extern void rcu_free_dl_info(struct rcu_head *);
12831 +extern void unhash_dl_info(struct dl_info *);
12833 +extern struct dl_info *locate_dl_info(struct super_block *, tag_t);
12838 +extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
12840 +typedef uint64_t dlsize_t;
12842 +#endif /* __KERNEL__ */
12843 +#else /* _VX_DLIMIT_H */
12844 +#warning duplicate inclusion
12845 +#endif /* _VX_DLIMIT_H */
12846 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/global.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/global.h
12847 --- linux-2.6.35.2/include/linux/vserver/global.h 1970-01-01 01:00:00.000000000 +0100
12848 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/global.h 2010-08-02 17:05:06.000000000 +0200
12850 +#ifndef _VX_GLOBAL_H
12851 +#define _VX_GLOBAL_H
12854 +extern atomic_t vx_global_ctotal;
12855 +extern atomic_t vx_global_cactive;
12857 +extern atomic_t nx_global_ctotal;
12858 +extern atomic_t nx_global_cactive;
12860 +extern atomic_t vs_global_nsproxy;
12861 +extern atomic_t vs_global_fs;
12862 +extern atomic_t vs_global_mnt_ns;
12863 +extern atomic_t vs_global_uts_ns;
12864 +extern atomic_t vs_global_user_ns;
12865 +extern atomic_t vs_global_pid_ns;
12868 +#endif /* _VX_GLOBAL_H */
12869 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/history.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/history.h
12870 --- linux-2.6.35.2/include/linux/vserver/history.h 1970-01-01 01:00:00.000000000 +0100
12871 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/history.h 2010-08-02 17:05:06.000000000 +0200
12873 +#ifndef _VX_HISTORY_H
12874 +#define _VX_HISTORY_H
12879 + VXH_THROW_OOPS = 1,
12883 + VXH_INIT_VX_INFO,
12886 + VXH_CLAIM_VX_INFO,
12887 + VXH_RELEASE_VX_INFO,
12888 + VXH_ALLOC_VX_INFO,
12889 + VXH_DEALLOC_VX_INFO,
12890 + VXH_HASH_VX_INFO,
12891 + VXH_UNHASH_VX_INFO,
12893 + VXH_LOOKUP_VX_INFO,
12894 + VXH_CREATE_VX_INFO,
12897 +struct _vxhe_vxi {
12898 + struct vx_info *ptr;
12904 +struct _vxhe_set_clr {
12908 +struct _vxhe_loc_lookup {
12912 +struct _vx_hist_entry {
12914 + unsigned short seq;
12915 + unsigned short type;
12916 + struct _vxhe_vxi vxi;
12918 + struct _vxhe_set_clr sc;
12919 + struct _vxhe_loc_lookup ll;
12923 +#ifdef CONFIG_VSERVER_HISTORY
12925 +extern unsigned volatile int vxh_active;
12927 +struct _vx_hist_entry *vxh_advance(void *loc);
12931 +void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
12933 + entry->vxi.ptr = vxi;
12935 + entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
12936 + entry->vxi.tasks = atomic_read(&vxi->vx_tasks);
12937 + entry->vxi.xid = vxi->vx_id;
12942 +#define __HERE__ current_text_addr()
12944 +#define __VXH_BODY(__type, __data, __here) \
12945 + struct _vx_hist_entry *entry; \
12947 + preempt_disable(); \
12948 + entry = vxh_advance(__here); \
12950 + entry->type = __type; \
12951 + preempt_enable();
12954 + /* pass vxi only */
12956 +#define __VXH_SMPL \
12957 + __vxh_copy_vxi(entry, vxi)
12960 +void __vxh_smpl(struct vx_info *vxi, int __type, void *__here)
12962 + __VXH_BODY(__type, __VXH_SMPL, __here)
12965 + /* pass vxi and data (void *) */
12967 +#define __VXH_DATA \
12968 + __vxh_copy_vxi(entry, vxi); \
12969 + entry->sc.data = data
12972 +void __vxh_data(struct vx_info *vxi, void *data,
12973 + int __type, void *__here)
12975 + __VXH_BODY(__type, __VXH_DATA, __here)
12978 + /* pass vxi and arg (long) */
12980 +#define __VXH_LONG \
12981 + __vxh_copy_vxi(entry, vxi); \
12982 + entry->ll.arg = arg
12985 +void __vxh_long(struct vx_info *vxi, long arg,
12986 + int __type, void *__here)
12988 + __VXH_BODY(__type, __VXH_LONG, __here)
12993 +void __vxh_throw_oops(void *__here)
12995 + __VXH_BODY(VXH_THROW_OOPS, {}, __here);
12996 + /* prevent further acquisition */
13001 +#define vxh_throw_oops() __vxh_throw_oops(__HERE__);
13003 +#define __vxh_get_vx_info(v, h) __vxh_smpl(v, VXH_GET_VX_INFO, h);
13004 +#define __vxh_put_vx_info(v, h) __vxh_smpl(v, VXH_PUT_VX_INFO, h);
13006 +#define __vxh_init_vx_info(v, d, h) \
13007 + __vxh_data(v, d, VXH_INIT_VX_INFO, h);
13008 +#define __vxh_set_vx_info(v, d, h) \
13009 + __vxh_data(v, d, VXH_SET_VX_INFO, h);
13010 +#define __vxh_clr_vx_info(v, d, h) \
13011 + __vxh_data(v, d, VXH_CLR_VX_INFO, h);
13013 +#define __vxh_claim_vx_info(v, d, h) \
13014 + __vxh_data(v, d, VXH_CLAIM_VX_INFO, h);
13015 +#define __vxh_release_vx_info(v, d, h) \
13016 + __vxh_data(v, d, VXH_RELEASE_VX_INFO, h);
13018 +#define vxh_alloc_vx_info(v) \
13019 + __vxh_smpl(v, VXH_ALLOC_VX_INFO, __HERE__);
13020 +#define vxh_dealloc_vx_info(v) \
13021 + __vxh_smpl(v, VXH_DEALLOC_VX_INFO, __HERE__);
13023 +#define vxh_hash_vx_info(v) \
13024 + __vxh_smpl(v, VXH_HASH_VX_INFO, __HERE__);
13025 +#define vxh_unhash_vx_info(v) \
13026 + __vxh_smpl(v, VXH_UNHASH_VX_INFO, __HERE__);
13028 +#define vxh_loc_vx_info(v, l) \
13029 + __vxh_long(v, l, VXH_LOC_VX_INFO, __HERE__);
13030 +#define vxh_lookup_vx_info(v, l) \
13031 + __vxh_long(v, l, VXH_LOOKUP_VX_INFO, __HERE__);
13032 +#define vxh_create_vx_info(v, l) \
13033 + __vxh_long(v, l, VXH_CREATE_VX_INFO, __HERE__);
13035 +extern void vxh_dump_history(void);
13038 +#else /* CONFIG_VSERVER_HISTORY */
13040 +#define __HERE__ 0
13042 +#define vxh_throw_oops() do { } while (0)
13044 +#define __vxh_get_vx_info(v, h) do { } while (0)
13045 +#define __vxh_put_vx_info(v, h) do { } while (0)
13047 +#define __vxh_init_vx_info(v, d, h) do { } while (0)
13048 +#define __vxh_set_vx_info(v, d, h) do { } while (0)
13049 +#define __vxh_clr_vx_info(v, d, h) do { } while (0)
13051 +#define __vxh_claim_vx_info(v, d, h) do { } while (0)
13052 +#define __vxh_release_vx_info(v, d, h) do { } while (0)
13054 +#define vxh_alloc_vx_info(v) do { } while (0)
13055 +#define vxh_dealloc_vx_info(v) do { } while (0)
13057 +#define vxh_hash_vx_info(v) do { } while (0)
13058 +#define vxh_unhash_vx_info(v) do { } while (0)
13060 +#define vxh_loc_vx_info(v, l) do { } while (0)
13061 +#define vxh_lookup_vx_info(v, l) do { } while (0)
13062 +#define vxh_create_vx_info(v, l) do { } while (0)
13064 +#define vxh_dump_history() do { } while (0)
13067 +#endif /* CONFIG_VSERVER_HISTORY */
13069 +#endif /* _VX_HISTORY_H */
13070 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/inode_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/inode_cmd.h
13071 --- linux-2.6.35.2/include/linux/vserver/inode_cmd.h 1970-01-01 01:00:00.000000000 +0100
13072 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/inode_cmd.h 2010-08-02 17:05:06.000000000 +0200
13074 +#ifndef _VX_INODE_CMD_H
13075 +#define _VX_INODE_CMD_H
13078 +/* inode vserver commands */
13080 +#define VCMD_get_iattr VC_CMD(INODE, 1, 1)
13081 +#define VCMD_set_iattr VC_CMD(INODE, 2, 1)
13083 +#define VCMD_fget_iattr VC_CMD(INODE, 3, 0)
13084 +#define VCMD_fset_iattr VC_CMD(INODE, 4, 0)
13086 +struct vcmd_ctx_iattr_v1 {
13087 + const char __user *name;
13093 +struct vcmd_ctx_fiattr_v0 {
13103 +#ifdef CONFIG_COMPAT
13105 +#include <asm/compat.h>
13107 +struct vcmd_ctx_iattr_v1_x32 {
13108 + compat_uptr_t name_ptr;
13114 +#endif /* CONFIG_COMPAT */
13116 +#include <linux/compiler.h>
13118 +extern int vc_get_iattr(void __user *);
13119 +extern int vc_set_iattr(void __user *);
13121 +extern int vc_fget_iattr(uint32_t, void __user *);
13122 +extern int vc_fset_iattr(uint32_t, void __user *);
13124 +#ifdef CONFIG_COMPAT
13126 +extern int vc_get_iattr_x32(void __user *);
13127 +extern int vc_set_iattr_x32(void __user *);
13129 +#endif /* CONFIG_COMPAT */
13131 +#endif /* __KERNEL__ */
13132 +#endif /* _VX_INODE_CMD_H */
13133 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/inode.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/inode.h
13134 --- linux-2.6.35.2/include/linux/vserver/inode.h 1970-01-01 01:00:00.000000000 +0100
13135 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/inode.h 2010-08-02 17:05:06.000000000 +0200
13137 +#ifndef _VX_INODE_H
13138 +#define _VX_INODE_H
13141 +#define IATTR_TAG 0x01000000
13143 +#define IATTR_ADMIN 0x00000001
13144 +#define IATTR_WATCH 0x00000002
13145 +#define IATTR_HIDE 0x00000004
13146 +#define IATTR_FLAGS 0x00000007
13148 +#define IATTR_BARRIER 0x00010000
13149 +#define IATTR_IXUNLINK 0x00020000
13150 +#define IATTR_IMMUTABLE 0x00040000
13151 +#define IATTR_COW 0x00080000
13156 +#ifdef CONFIG_VSERVER_PROC_SECURE
13157 +#define IATTR_PROC_DEFAULT ( IATTR_ADMIN | IATTR_HIDE )
13158 +#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
13160 +#define IATTR_PROC_DEFAULT ( IATTR_ADMIN )
13161 +#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
13164 +#define vx_hide_check(c, m) (((m) & IATTR_HIDE) ? vx_check(c, m) : 1)
13166 +#endif /* __KERNEL__ */
13168 +/* inode ioctls */
13170 +#define FIOC_GETXFLG _IOR('x', 5, long)
13171 +#define FIOC_SETXFLG _IOW('x', 6, long)
13173 +#else /* _VX_INODE_H */
13174 +#warning duplicate inclusion
13175 +#endif /* _VX_INODE_H */
13176 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/Kbuild linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/Kbuild
13177 --- linux-2.6.35.2/include/linux/vserver/Kbuild 1970-01-01 01:00:00.000000000 +0100
13178 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/Kbuild 2010-08-02 17:05:06.000000000 +0200
13181 +unifdef-y += context_cmd.h network_cmd.h space_cmd.h \
13182 + cacct_cmd.h cvirt_cmd.h limit_cmd.h dlimit_cmd.h \
13183 + inode_cmd.h tag_cmd.h sched_cmd.h signal_cmd.h \
13184 + debug_cmd.h device_cmd.h
13186 +unifdef-y += switch.h network.h monitor.h inode.h device.h
13188 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/limit_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/limit_cmd.h
13189 --- linux-2.6.35.2/include/linux/vserver/limit_cmd.h 1970-01-01 01:00:00.000000000 +0100
13190 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/limit_cmd.h 2010-08-02 17:05:06.000000000 +0200
13192 +#ifndef _VX_LIMIT_CMD_H
13193 +#define _VX_LIMIT_CMD_H
13196 +/* rlimit vserver commands */
13198 +#define VCMD_get_rlimit VC_CMD(RLIMIT, 1, 0)
13199 +#define VCMD_set_rlimit VC_CMD(RLIMIT, 2, 0)
13200 +#define VCMD_get_rlimit_mask VC_CMD(RLIMIT, 3, 0)
13201 +#define VCMD_reset_hits VC_CMD(RLIMIT, 7, 0)
13202 +#define VCMD_reset_minmax VC_CMD(RLIMIT, 9, 0)
13204 +struct vcmd_ctx_rlimit_v0 {
13206 + uint64_t minimum;
13207 + uint64_t softlimit;
13208 + uint64_t maximum;
13211 +struct vcmd_ctx_rlimit_mask_v0 {
13212 + uint32_t minimum;
13213 + uint32_t softlimit;
13214 + uint32_t maximum;
13217 +#define VCMD_rlimit_stat VC_CMD(VSTAT, 1, 0)
13219 +struct vcmd_rlimit_stat_v0 {
13223 + uint64_t minimum;
13224 + uint64_t maximum;
13227 +#define CRLIM_UNSET (0ULL)
13228 +#define CRLIM_INFINITY (~0ULL)
13229 +#define CRLIM_KEEP (~1ULL)
13233 +#ifdef CONFIG_IA32_EMULATION
13235 +struct vcmd_ctx_rlimit_v0_x32 {
13237 + uint64_t minimum;
13238 + uint64_t softlimit;
13239 + uint64_t maximum;
13240 +} __attribute__ ((packed));
13242 +#endif /* CONFIG_IA32_EMULATION */
13244 +#include <linux/compiler.h>
13246 +extern int vc_get_rlimit_mask(uint32_t, void __user *);
13247 +extern int vc_get_rlimit(struct vx_info *, void __user *);
13248 +extern int vc_set_rlimit(struct vx_info *, void __user *);
13249 +extern int vc_reset_hits(struct vx_info *, void __user *);
13250 +extern int vc_reset_minmax(struct vx_info *, void __user *);
13252 +extern int vc_rlimit_stat(struct vx_info *, void __user *);
13254 +#ifdef CONFIG_IA32_EMULATION
13256 +extern int vc_get_rlimit_x32(struct vx_info *, void __user *);
13257 +extern int vc_set_rlimit_x32(struct vx_info *, void __user *);
13259 +#endif /* CONFIG_IA32_EMULATION */
13261 +#endif /* __KERNEL__ */
13262 +#endif /* _VX_LIMIT_CMD_H */
13263 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/limit_def.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/limit_def.h
13264 --- linux-2.6.35.2/include/linux/vserver/limit_def.h 1970-01-01 01:00:00.000000000 +0100
13265 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/limit_def.h 2010-08-02 17:05:06.000000000 +0200
13267 +#ifndef _VX_LIMIT_DEF_H
13268 +#define _VX_LIMIT_DEF_H
13270 +#include <asm/atomic.h>
13271 +#include <asm/resource.h>
13273 +#include "limit.h"
13276 +struct _vx_res_limit {
13277 + rlim_t soft; /* Context soft limit */
13278 + rlim_t hard; /* Context hard limit */
13280 + rlim_atomic_t rcur; /* Current value */
13281 + rlim_t rmin; /* Context minimum */
13282 + rlim_t rmax; /* Context maximum */
13284 + atomic_t lhit; /* Limit hits */
13287 +/* context sub struct */
13289 +struct _vx_limit {
13290 + struct _vx_res_limit res[NUM_LIMITS];
13293 +#ifdef CONFIG_VSERVER_DEBUG
13295 +static inline void __dump_vx_limit(struct _vx_limit *limit)
13299 + printk("\t_vx_limit:");
13300 + for (i = 0; i < NUM_LIMITS; i++) {
13301 + printk("\t [%2d] = %8lu %8lu/%8lu, %8ld/%8ld, %8d\n",
13302 + i, (unsigned long)__rlim_get(limit, i),
13303 + (unsigned long)__rlim_rmin(limit, i),
13304 + (unsigned long)__rlim_rmax(limit, i),
13305 + (long)__rlim_soft(limit, i),
13306 + (long)__rlim_hard(limit, i),
13307 + atomic_read(&__rlim_lhit(limit, i)));
13313 +#endif /* _VX_LIMIT_DEF_H */
13314 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/limit.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/limit.h
13315 --- linux-2.6.35.2/include/linux/vserver/limit.h 1970-01-01 01:00:00.000000000 +0100
13316 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/limit.h 2010-08-02 17:05:06.000000000 +0200
13318 +#ifndef _VX_LIMIT_H
13319 +#define _VX_LIMIT_H
13321 +#define VLIMIT_NSOCK 16
13322 +#define VLIMIT_OPENFD 17
13323 +#define VLIMIT_ANON 18
13324 +#define VLIMIT_SHMEM 19
13325 +#define VLIMIT_SEMARY 20
13326 +#define VLIMIT_NSEMS 21
13327 +#define VLIMIT_DENTRY 22
13328 +#define VLIMIT_MAPPED 23
13333 +#define VLIM_NOCHECK ((1L << VLIMIT_DENTRY) | (1L << RLIMIT_RSS))
13335 +/* keep in sync with CRLIM_INFINITY */
13337 +#define VLIM_INFINITY (~0ULL)
13339 +#include <asm/atomic.h>
13340 +#include <asm/resource.h>
13342 +#ifndef RLIM_INFINITY
13343 +#warning RLIM_INFINITY is undefined
13346 +#define __rlim_val(l, r, v) ((l)->res[r].v)
13348 +#define __rlim_soft(l, r) __rlim_val(l, r, soft)
13349 +#define __rlim_hard(l, r) __rlim_val(l, r, hard)
13351 +#define __rlim_rcur(l, r) __rlim_val(l, r, rcur)
13352 +#define __rlim_rmin(l, r) __rlim_val(l, r, rmin)
13353 +#define __rlim_rmax(l, r) __rlim_val(l, r, rmax)
13355 +#define __rlim_lhit(l, r) __rlim_val(l, r, lhit)
13356 +#define __rlim_hit(l, r) atomic_inc(&__rlim_lhit(l, r))
13358 +typedef atomic_long_t rlim_atomic_t;
13359 +typedef unsigned long rlim_t;
13361 +#define __rlim_get(l, r) atomic_long_read(&__rlim_rcur(l, r))
13362 +#define __rlim_set(l, r, v) atomic_long_set(&__rlim_rcur(l, r), v)
13363 +#define __rlim_inc(l, r) atomic_long_inc(&__rlim_rcur(l, r))
13364 +#define __rlim_dec(l, r) atomic_long_dec(&__rlim_rcur(l, r))
13365 +#define __rlim_add(l, r, v) atomic_long_add(v, &__rlim_rcur(l, r))
13366 +#define __rlim_sub(l, r, v) atomic_long_sub(v, &__rlim_rcur(l, r))
13369 +#if (RLIM_INFINITY == VLIM_INFINITY)
13370 +#define VX_VLIM(r) ((long long)(long)(r))
13371 +#define VX_RLIM(v) ((rlim_t)(v))
13373 +#define VX_VLIM(r) (((r) == RLIM_INFINITY) \
13374 + ? VLIM_INFINITY : (long long)(r))
13375 +#define VX_RLIM(v) (((v) == VLIM_INFINITY) \
13376 + ? RLIM_INFINITY : (rlim_t)(v))
13381 +void vx_vsi_meminfo(struct sysinfo *);
13382 +void vx_vsi_swapinfo(struct sysinfo *);
13383 +long vx_vsi_cached(struct sysinfo *);
13385 +#define NUM_LIMITS 24
13387 +#endif /* __KERNEL__ */
13388 +#endif /* _VX_LIMIT_H */
13389 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/limit_int.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/limit_int.h
13390 --- linux-2.6.35.2/include/linux/vserver/limit_int.h 1970-01-01 01:00:00.000000000 +0100
13391 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/limit_int.h 2010-08-02 17:05:06.000000000 +0200
13393 +#ifndef _VX_LIMIT_INT_H
13394 +#define _VX_LIMIT_INT_H
13396 +#include "context.h"
13400 +#define VXD_RCRES_COND(r) VXD_CBIT(cres, r)
13401 +#define VXD_RLIMIT_COND(r) VXD_CBIT(limit, r)
13403 +extern const char *vlimit_name[NUM_LIMITS];
13405 +static inline void __vx_acc_cres(struct vx_info *vxi,
13406 + int res, int dir, void *_data, char *_file, int _line)
13408 + if (VXD_RCRES_COND(res))
13409 + vxlprintk(1, "vx_acc_cres[%5d,%s,%2d]: %5ld%s (%p)",
13410 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13411 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13412 + (dir > 0) ? "++" : "--", _data, _file, _line);
13417 + __rlim_inc(&vxi->limit, res);
13419 + __rlim_dec(&vxi->limit, res);
13422 +static inline void __vx_add_cres(struct vx_info *vxi,
13423 + int res, int amount, void *_data, char *_file, int _line)
13425 + if (VXD_RCRES_COND(res))
13426 + vxlprintk(1, "vx_add_cres[%5d,%s,%2d]: %5ld += %5d (%p)",
13427 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13428 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13429 + amount, _data, _file, _line);
13434 + __rlim_add(&vxi->limit, res, amount);
13438 +int __vx_cres_adjust_max(struct _vx_limit *limit, int res, rlim_t value)
13440 + int cond = (value > __rlim_rmax(limit, res));
13443 + __rlim_rmax(limit, res) = value;
13448 +int __vx_cres_adjust_min(struct _vx_limit *limit, int res, rlim_t value)
13450 + int cond = (value < __rlim_rmin(limit, res));
13453 + __rlim_rmin(limit, res) = value;
13458 +void __vx_cres_fixup(struct _vx_limit *limit, int res, rlim_t value)
13460 + if (!__vx_cres_adjust_max(limit, res, value))
13461 + __vx_cres_adjust_min(limit, res, value);
13466 + +1 ... no limit hit
13467 + -1 ... over soft limit
13468 + 0 ... over hard limit */
13470 +static inline int __vx_cres_avail(struct vx_info *vxi,
13471 + int res, int num, char *_file, int _line)
13473 + struct _vx_limit *limit;
13476 + if (VXD_RLIMIT_COND(res))
13477 + vxlprintk(1, "vx_cres_avail[%5d,%s,%2d]: %5ld/%5ld > %5ld + %5d",
13478 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13479 + (vxi ? (long)__rlim_soft(&vxi->limit, res) : -1),
13480 + (vxi ? (long)__rlim_hard(&vxi->limit, res) : -1),
13481 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13482 + num, _file, _line);
13486 + limit = &vxi->limit;
13487 + value = __rlim_get(limit, res);
13489 + if (!__vx_cres_adjust_max(limit, res, value))
13490 + __vx_cres_adjust_min(limit, res, value);
13495 + if (__rlim_soft(limit, res) == RLIM_INFINITY)
13497 + if (value + num <= __rlim_soft(limit, res))
13500 + if (__rlim_hard(limit, res) == RLIM_INFINITY)
13502 + if (value + num <= __rlim_hard(limit, res))
13505 + __rlim_hit(limit, res);
13510 +static const int VLA_RSS[] = { RLIMIT_RSS, VLIMIT_ANON, VLIMIT_MAPPED, 0 };
13513 +rlim_t __vx_cres_array_sum(struct _vx_limit *limit, const int *array)
13515 + rlim_t value, sum = 0;
13518 + while ((res = *array++)) {
13519 + value = __rlim_get(limit, res);
13520 + __vx_cres_fixup(limit, res, value);
13527 +rlim_t __vx_cres_array_fixup(struct _vx_limit *limit, const int *array)
13529 + rlim_t value = __vx_cres_array_sum(limit, array + 1);
13530 + int res = *array;
13532 + if (value == __rlim_get(limit, res))
13535 + __rlim_set(limit, res, value);
13536 + /* now adjust min/max */
13537 + if (!__vx_cres_adjust_max(limit, res, value))
13538 + __vx_cres_adjust_min(limit, res, value);
13543 +static inline int __vx_cres_array_avail(struct vx_info *vxi,
13544 + const int *array, int num, char *_file, int _line)
13546 + struct _vx_limit *limit;
13547 + rlim_t value = 0;
13555 + limit = &vxi->limit;
13557 + value = __vx_cres_array_sum(limit, array + 1);
13559 + __rlim_set(limit, res, value);
13560 + __vx_cres_fixup(limit, res, value);
13562 + return __vx_cres_avail(vxi, res, num, _file, _line);
13566 +static inline void vx_limit_fixup(struct _vx_limit *limit, int id)
13571 + /* complex resources first */
13572 + if ((id < 0) || (id == RLIMIT_RSS))
13573 + __vx_cres_array_fixup(limit, VLA_RSS);
13575 + for (res = 0; res < NUM_LIMITS; res++) {
13576 + if ((id > 0) && (res != id))
13579 + value = __rlim_get(limit, res);
13580 + __vx_cres_fixup(limit, res, value);
13582 + /* not supposed to happen, maybe warn? */
13583 + if (__rlim_rmax(limit, res) > __rlim_hard(limit, res))
13584 + __rlim_rmax(limit, res) = __rlim_hard(limit, res);
13589 +#endif /* __KERNEL__ */
13590 +#endif /* _VX_LIMIT_INT_H */
13591 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/monitor.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/monitor.h
13592 --- linux-2.6.35.2/include/linux/vserver/monitor.h 1970-01-01 01:00:00.000000000 +0100
13593 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/monitor.h 2010-08-02 17:05:06.000000000 +0200
13595 +#ifndef _VX_MONITOR_H
13596 +#define _VX_MONITOR_H
13598 +#include <linux/types.h>
13605 + VXM_UPDATE = 0x20,
13609 + VXM_RQINFO_1 = 0x24,
13612 + VXM_ACTIVATE = 0x40,
13619 + VXM_MIGRATE = 0x48,
13622 + /* all other bits are flags */
13623 + VXM_SCHED = 0x80,
13626 +struct _vxm_update_1 {
13627 + uint32_t tokens_max;
13628 + uint32_t fill_rate;
13629 + uint32_t interval;
13632 +struct _vxm_update_2 {
13633 + uint32_t tokens_min;
13634 + uint32_t fill_rate;
13635 + uint32_t interval;
13638 +struct _vxm_rqinfo_1 {
13639 + uint16_t running;
13643 + uint32_t idle_tokens;
13646 +struct _vxm_rqinfo_2 {
13647 + uint32_t norm_time;
13648 + uint32_t idle_time;
13649 + uint32_t idle_skip;
13652 +struct _vxm_sched {
13654 + uint32_t norm_time;
13655 + uint32_t idle_time;
13658 +struct _vxm_task {
13663 +struct _vxm_event {
13672 + struct _vxm_task tsk;
13676 +struct _vx_mon_entry {
13680 + struct _vxm_event ev;
13681 + struct _vxm_sched sd;
13682 + struct _vxm_update_1 u1;
13683 + struct _vxm_update_2 u2;
13684 + struct _vxm_rqinfo_1 q1;
13685 + struct _vxm_rqinfo_2 q2;
13690 +#endif /* _VX_MONITOR_H */
13691 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/network_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/network_cmd.h
13692 --- linux-2.6.35.2/include/linux/vserver/network_cmd.h 1970-01-01 01:00:00.000000000 +0100
13693 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/network_cmd.h 2010-08-02 17:05:06.000000000 +0200
13695 +#ifndef _VX_NETWORK_CMD_H
13696 +#define _VX_NETWORK_CMD_H
13699 +/* vinfo commands */
13701 +#define VCMD_task_nid VC_CMD(VINFO, 2, 0)
13704 +extern int vc_task_nid(uint32_t);
13706 +#endif /* __KERNEL__ */
13708 +#define VCMD_nx_info VC_CMD(VINFO, 6, 0)
13710 +struct vcmd_nx_info_v0 {
13712 + /* more to come */
13716 +extern int vc_nx_info(struct nx_info *, void __user *);
13718 +#endif /* __KERNEL__ */
13720 +#include <linux/in.h>
13721 +#include <linux/in6.h>
13723 +#define VCMD_net_create_v0 VC_CMD(VNET, 1, 0)
13724 +#define VCMD_net_create VC_CMD(VNET, 1, 1)
13726 +struct vcmd_net_create {
13727 + uint64_t flagword;
13730 +#define VCMD_net_migrate VC_CMD(NETMIG, 1, 0)
13732 +#define VCMD_net_add VC_CMD(NETALT, 1, 0)
13733 +#define VCMD_net_remove VC_CMD(NETALT, 2, 0)
13735 +struct vcmd_net_addr_v0 {
13738 + struct in_addr ip[4];
13739 + struct in_addr mask[4];
13742 +#define VCMD_net_add_ipv4 VC_CMD(NETALT, 1, 1)
13743 +#define VCMD_net_remove_ipv4 VC_CMD(NETALT, 2, 1)
13745 +struct vcmd_net_addr_ipv4_v1 {
13748 + struct in_addr ip;
13749 + struct in_addr mask;
13752 +#define VCMD_net_add_ipv6 VC_CMD(NETALT, 3, 1)
13753 +#define VCMD_net_remove_ipv6 VC_CMD(NETALT, 4, 1)
13755 +struct vcmd_net_addr_ipv6_v1 {
13759 + struct in6_addr ip;
13760 + struct in6_addr mask;
13763 +#define VCMD_add_match_ipv4 VC_CMD(NETALT, 5, 0)
13764 +#define VCMD_get_match_ipv4 VC_CMD(NETALT, 6, 0)
13766 +struct vcmd_match_ipv4_v0 {
13771 + struct in_addr ip;
13772 + struct in_addr ip2;
13773 + struct in_addr mask;
13776 +#define VCMD_add_match_ipv6 VC_CMD(NETALT, 7, 0)
13777 +#define VCMD_get_match_ipv6 VC_CMD(NETALT, 8, 0)
13779 +struct vcmd_match_ipv6_v0 {
13784 + struct in6_addr ip;
13785 + struct in6_addr ip2;
13786 + struct in6_addr mask;
13791 +extern int vc_net_create(uint32_t, void __user *);
13792 +extern int vc_net_migrate(struct nx_info *, void __user *);
13794 +extern int vc_net_add(struct nx_info *, void __user *);
13795 +extern int vc_net_remove(struct nx_info *, void __user *);
13797 +extern int vc_net_add_ipv4(struct nx_info *, void __user *);
13798 +extern int vc_net_remove_ipv4(struct nx_info *, void __user *);
13800 +extern int vc_net_add_ipv6(struct nx_info *, void __user *);
13801 +extern int vc_net_remove_ipv6(struct nx_info *, void __user *);
13803 +extern int vc_add_match_ipv4(struct nx_info *, void __user *);
13804 +extern int vc_get_match_ipv4(struct nx_info *, void __user *);
13806 +extern int vc_add_match_ipv6(struct nx_info *, void __user *);
13807 +extern int vc_get_match_ipv6(struct nx_info *, void __user *);
13809 +#endif /* __KERNEL__ */
13812 +/* flag commands */
13814 +#define VCMD_get_nflags VC_CMD(FLAGS, 5, 0)
13815 +#define VCMD_set_nflags VC_CMD(FLAGS, 6, 0)
13817 +struct vcmd_net_flags_v0 {
13818 + uint64_t flagword;
13823 +extern int vc_get_nflags(struct nx_info *, void __user *);
13824 +extern int vc_set_nflags(struct nx_info *, void __user *);
13826 +#endif /* __KERNEL__ */
13829 +/* network caps commands */
13831 +#define VCMD_get_ncaps VC_CMD(FLAGS, 7, 0)
13832 +#define VCMD_set_ncaps VC_CMD(FLAGS, 8, 0)
13834 +struct vcmd_net_caps_v0 {
13840 +extern int vc_get_ncaps(struct nx_info *, void __user *);
13841 +extern int vc_set_ncaps(struct nx_info *, void __user *);
13843 +#endif /* __KERNEL__ */
13844 +#endif /* _VX_CONTEXT_CMD_H */
13845 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/network.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/network.h
13846 --- linux-2.6.35.2/include/linux/vserver/network.h 1970-01-01 01:00:00.000000000 +0100
13847 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/network.h 2010-08-02 17:05:06.000000000 +0200
13849 +#ifndef _VX_NETWORK_H
13850 +#define _VX_NETWORK_H
13852 +#include <linux/types.h>
13855 +#define MAX_N_CONTEXT 65535 /* Arbitrary limit */
13858 +/* network flags */
13860 +#define NXF_INFO_PRIVATE 0x00000008
13862 +#define NXF_SINGLE_IP 0x00000100
13863 +#define NXF_LBACK_REMAP 0x00000200
13864 +#define NXF_LBACK_ALLOW 0x00000400
13866 +#define NXF_HIDE_NETIF 0x02000000
13867 +#define NXF_HIDE_LBACK 0x04000000
13869 +#define NXF_STATE_SETUP (1ULL << 32)
13870 +#define NXF_STATE_ADMIN (1ULL << 34)
13872 +#define NXF_SC_HELPER (1ULL << 36)
13873 +#define NXF_PERSISTENT (1ULL << 38)
13875 +#define NXF_ONE_TIME (0x0005ULL << 32)
13878 +#define NXF_INIT_SET (__nxf_init_set())
13880 +static inline uint64_t __nxf_init_set(void) {
13881 + return NXF_STATE_ADMIN
13882 +#ifdef CONFIG_VSERVER_AUTO_LBACK
13883 + | NXF_LBACK_REMAP
13886 +#ifdef CONFIG_VSERVER_AUTO_SINGLE
13889 + | NXF_HIDE_NETIF;
13893 +/* network caps */
13895 +#define NXC_TUN_CREATE 0x00000001
13897 +#define NXC_RAW_ICMP 0x00000100
13900 +/* address types */
13902 +#define NXA_TYPE_IPV4 0x0001
13903 +#define NXA_TYPE_IPV6 0x0002
13905 +#define NXA_TYPE_NONE 0x0000
13906 +#define NXA_TYPE_ANY 0x00FF
13908 +#define NXA_TYPE_ADDR 0x0010
13909 +#define NXA_TYPE_MASK 0x0020
13910 +#define NXA_TYPE_RANGE 0x0040
13912 +#define NXA_MASK_ALL (NXA_TYPE_ADDR | NXA_TYPE_MASK | NXA_TYPE_RANGE)
13914 +#define NXA_MOD_BCAST 0x0100
13915 +#define NXA_MOD_LBACK 0x0200
13917 +#define NXA_LOOPBACK 0x1000
13919 +#define NXA_MASK_BIND (NXA_MASK_ALL | NXA_MOD_BCAST | NXA_MOD_LBACK)
13920 +#define NXA_MASK_SHOW (NXA_MASK_ALL | NXA_LOOPBACK)
13924 +#include <linux/list.h>
13925 +#include <linux/spinlock.h>
13926 +#include <linux/rcupdate.h>
13927 +#include <linux/in.h>
13928 +#include <linux/in6.h>
13929 +#include <asm/atomic.h>
13931 +struct nx_addr_v4 {
13932 + struct nx_addr_v4 *next;
13933 + struct in_addr ip[2];
13934 + struct in_addr mask;
13939 +struct nx_addr_v6 {
13940 + struct nx_addr_v6 *next;
13941 + struct in6_addr ip;
13942 + struct in6_addr mask;
13949 + struct hlist_node nx_hlist; /* linked list of nxinfos */
13950 + nid_t nx_id; /* vnet id */
13951 + atomic_t nx_usecnt; /* usage count */
13952 + atomic_t nx_tasks; /* tasks count */
13953 + int nx_state; /* context state */
13955 + uint64_t nx_flags; /* network flag word */
13956 + uint64_t nx_ncaps; /* network capabilities */
13958 + struct in_addr v4_lback; /* Loopback address */
13959 + struct in_addr v4_bcast; /* Broadcast address */
13960 + struct nx_addr_v4 v4; /* First/Single ipv4 address */
13961 +#ifdef CONFIG_IPV6
13962 + struct nx_addr_v6 v6; /* First/Single ipv6 address */
13964 + char nx_name[65]; /* network context name */
13968 +/* status flags */
13970 +#define NXS_HASHED 0x0001
13971 +#define NXS_SHUTDOWN 0x0100
13972 +#define NXS_RELEASED 0x8000
13974 +extern struct nx_info *lookup_nx_info(int);
13976 +extern int get_nid_list(int, unsigned int *, int);
13977 +extern int nid_is_hashed(nid_t);
13979 +extern int nx_migrate_task(struct task_struct *, struct nx_info *);
13981 +extern long vs_net_change(struct nx_info *, unsigned int);
13986 +#define NX_IPV4(n) ((n)->v4.type != NXA_TYPE_NONE)
13987 +#ifdef CONFIG_IPV6
13988 +#define NX_IPV6(n) ((n)->v6.type != NXA_TYPE_NONE)
13990 +#define NX_IPV6(n) (0)
13993 +#endif /* __KERNEL__ */
13994 +#endif /* _VX_NETWORK_H */
13995 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/percpu.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/percpu.h
13996 --- linux-2.6.35.2/include/linux/vserver/percpu.h 1970-01-01 01:00:00.000000000 +0100
13997 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/percpu.h 2010-08-02 17:05:06.000000000 +0200
13999 +#ifndef _VX_PERCPU_H
14000 +#define _VX_PERCPU_H
14002 +#include "cvirt_def.h"
14003 +#include "sched_def.h"
14005 +struct _vx_percpu {
14006 + struct _vx_cvirt_pc cvirt;
14007 + struct _vx_sched_pc sched;
14010 +#define PERCPU_PERCTX (sizeof(struct _vx_percpu))
14012 +#endif /* _VX_PERCPU_H */
14013 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/pid.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/pid.h
14014 --- linux-2.6.35.2/include/linux/vserver/pid.h 1970-01-01 01:00:00.000000000 +0100
14015 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/pid.h 2010-08-02 17:05:06.000000000 +0200
14017 +#ifndef _VSERVER_PID_H
14018 +#define _VSERVER_PID_H
14020 +/* pid faking stuff */
14022 +#define vx_info_map_pid(v, p) \
14023 + __vx_info_map_pid((v), (p), __func__, __FILE__, __LINE__)
14024 +#define vx_info_map_tgid(v,p) vx_info_map_pid(v,p)
14025 +#define vx_map_pid(p) vx_info_map_pid(current_vx_info(), p)
14026 +#define vx_map_tgid(p) vx_map_pid(p)
14028 +static inline int __vx_info_map_pid(struct vx_info *vxi, int pid,
14029 + const char *func, const char *file, int line)
14031 + if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
14032 + vxfprintk(VXD_CBIT(cvirt, 2),
14033 + "vx_map_tgid: %p/%llx: %d -> %d",
14034 + vxi, (long long)vxi->vx_flags, pid,
14035 + (pid && pid == vxi->vx_initpid) ? 1 : pid,
14036 + func, file, line);
14039 + if (pid == vxi->vx_initpid)
14045 +#define vx_info_rmap_pid(v, p) \
14046 + __vx_info_rmap_pid((v), (p), __func__, __FILE__, __LINE__)
14047 +#define vx_rmap_pid(p) vx_info_rmap_pid(current_vx_info(), p)
14048 +#define vx_rmap_tgid(p) vx_rmap_pid(p)
14050 +static inline int __vx_info_rmap_pid(struct vx_info *vxi, int pid,
14051 + const char *func, const char *file, int line)
14053 + if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
14054 + vxfprintk(VXD_CBIT(cvirt, 2),
14055 + "vx_rmap_tgid: %p/%llx: %d -> %d",
14056 + vxi, (long long)vxi->vx_flags, pid,
14057 + (pid == 1) ? vxi->vx_initpid : pid,
14058 + func, file, line);
14059 + if ((pid == 1) && vxi->vx_initpid)
14060 + return vxi->vx_initpid;
14061 + if (pid == vxi->vx_initpid)
14068 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/sched_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/sched_cmd.h
14069 --- linux-2.6.35.2/include/linux/vserver/sched_cmd.h 1970-01-01 01:00:00.000000000 +0100
14070 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/sched_cmd.h 2010-08-02 17:05:06.000000000 +0200
14072 +#ifndef _VX_SCHED_CMD_H
14073 +#define _VX_SCHED_CMD_H
14076 +/* sched vserver commands */
14078 +#define VCMD_set_sched_v2 VC_CMD(SCHED, 1, 2)
14079 +#define VCMD_set_sched_v3 VC_CMD(SCHED, 1, 3)
14080 +#define VCMD_set_sched_v4 VC_CMD(SCHED, 1, 4)
14082 +struct vcmd_set_sched_v2 {
14083 + int32_t fill_rate;
14084 + int32_t interval;
14086 + int32_t tokens_min;
14087 + int32_t tokens_max;
14088 + uint64_t cpu_mask;
14091 +struct vcmd_set_sched_v3 {
14092 + uint32_t set_mask;
14093 + int32_t fill_rate;
14094 + int32_t interval;
14096 + int32_t tokens_min;
14097 + int32_t tokens_max;
14098 + int32_t priority_bias;
14101 +struct vcmd_set_sched_v4 {
14102 + uint32_t set_mask;
14103 + int32_t fill_rate;
14104 + int32_t interval;
14106 + int32_t tokens_min;
14107 + int32_t tokens_max;
14108 + int32_t prio_bias;
14110 + int32_t bucket_id;
14113 +#define VCMD_set_sched VC_CMD(SCHED, 1, 5)
14114 +#define VCMD_get_sched VC_CMD(SCHED, 2, 5)
14116 +struct vcmd_sched_v5 {
14119 + int32_t bucket_id;
14120 + int32_t fill_rate[2];
14121 + int32_t interval[2];
14123 + int32_t tokens_min;
14124 + int32_t tokens_max;
14125 + int32_t prio_bias;
14128 +#define VXSM_FILL_RATE 0x0001
14129 +#define VXSM_INTERVAL 0x0002
14130 +#define VXSM_FILL_RATE2 0x0004
14131 +#define VXSM_INTERVAL2 0x0008
14132 +#define VXSM_TOKENS 0x0010
14133 +#define VXSM_TOKENS_MIN 0x0020
14134 +#define VXSM_TOKENS_MAX 0x0040
14135 +#define VXSM_PRIO_BIAS 0x0100
14137 +#define VXSM_IDLE_TIME 0x0200
14138 +#define VXSM_FORCE 0x0400
14140 +#define VXSM_V3_MASK 0x0173
14141 +#define VXSM_SET_MASK 0x01FF
14143 +#define VXSM_CPU_ID 0x1000
14144 +#define VXSM_BUCKET_ID 0x2000
14146 +#define VXSM_MSEC 0x4000
14148 +#define SCHED_KEEP (-2) /* only for v2 */
14152 +#include <linux/compiler.h>
14154 +extern int vc_set_sched_v2(struct vx_info *, void __user *);
14155 +extern int vc_set_sched_v3(struct vx_info *, void __user *);
14156 +extern int vc_set_sched_v4(struct vx_info *, void __user *);
14157 +extern int vc_set_sched(struct vx_info *, void __user *);
14158 +extern int vc_get_sched(struct vx_info *, void __user *);
14160 +#endif /* __KERNEL__ */
14162 +#define VCMD_sched_info VC_CMD(SCHED, 3, 0)
14164 +struct vcmd_sched_info {
14166 + int32_t bucket_id;
14167 + uint64_t user_msec;
14168 + uint64_t sys_msec;
14169 + uint64_t hold_msec;
14170 + uint32_t token_usec;
14171 + int32_t vavavoom;
14176 +extern int vc_sched_info(struct vx_info *, void __user *);
14178 +#endif /* __KERNEL__ */
14179 +#endif /* _VX_SCHED_CMD_H */
14180 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/sched_def.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/sched_def.h
14181 --- linux-2.6.35.2/include/linux/vserver/sched_def.h 1970-01-01 01:00:00.000000000 +0100
14182 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/sched_def.h 2010-08-02 17:05:06.000000000 +0200
14184 +#ifndef _VX_SCHED_DEF_H
14185 +#define _VX_SCHED_DEF_H
14187 +#include <linux/spinlock.h>
14188 +#include <linux/jiffies.h>
14189 +#include <linux/cpumask.h>
14190 +#include <asm/atomic.h>
14191 +#include <asm/param.h>
14194 +/* context sub struct */
14196 +struct _vx_sched {
14197 + spinlock_t tokens_lock; /* lock for token bucket */
14199 + int tokens; /* number of CPU tokens */
14200 + int fill_rate[2]; /* Fill rate: add X tokens... */
14201 + int interval[2]; /* Divisor: per Y jiffies */
14202 + int tokens_min; /* Limit: minimum for unhold */
14203 + int tokens_max; /* Limit: no more than N tokens */
14205 + int prio_bias; /* bias offset for priority */
14207 + unsigned update_mask; /* which features should be updated */
14208 + cpumask_t update; /* CPUs which should update */
14211 +struct _vx_sched_pc {
14212 + int tokens; /* number of CPU tokens */
14213 + int flags; /* bucket flags */
14215 + int fill_rate[2]; /* Fill rate: add X tokens... */
14216 + int interval[2]; /* Divisor: per Y jiffies */
14217 + int tokens_min; /* Limit: minimum for unhold */
14218 + int tokens_max; /* Limit: no more than N tokens */
14220 + int prio_bias; /* bias offset for priority */
14221 + int vavavoom; /* last calculated vavavoom */
14223 + unsigned long norm_time; /* last time accounted */
14224 + unsigned long idle_time; /* non linear time for fair sched */
14225 + unsigned long token_time; /* token time for accounting */
14226 + unsigned long onhold; /* jiffies when put on hold */
14228 + uint64_t user_ticks; /* token tick events */
14229 + uint64_t sys_ticks; /* token tick events */
14230 + uint64_t hold_ticks; /* token ticks paused */
14234 +#define VXSF_ONHOLD 0x0001
14235 +#define VXSF_IDLE_TIME 0x0100
14237 +#ifdef CONFIG_VSERVER_DEBUG
14239 +static inline void __dump_vx_sched(struct _vx_sched *sched)
14241 + printk("\t_vx_sched:\n");
14242 + printk("\t tokens: %4d/%4d, %4d/%4d, %4d, %4d\n",
14243 + sched->fill_rate[0], sched->interval[0],
14244 + sched->fill_rate[1], sched->interval[1],
14245 + sched->tokens_min, sched->tokens_max);
14246 + printk("\t priority = %4d\n", sched->prio_bias);
14251 +#endif /* _VX_SCHED_DEF_H */
14252 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/sched.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/sched.h
14253 --- linux-2.6.35.2/include/linux/vserver/sched.h 1970-01-01 01:00:00.000000000 +0100
14254 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/sched.h 2010-08-02 17:05:06.000000000 +0200
14256 +#ifndef _VX_SCHED_H
14257 +#define _VX_SCHED_H
14264 +void vx_vsi_uptime(struct timespec *, struct timespec *);
14269 +void vx_update_load(struct vx_info *);
14272 +int vx_tokens_recalc(struct _vx_sched_pc *,
14273 + unsigned long *, unsigned long *, int [2]);
14275 +void vx_update_sched_param(struct _vx_sched *sched,
14276 + struct _vx_sched_pc *sched_pc);
14278 +#endif /* __KERNEL__ */
14279 +#else /* _VX_SCHED_H */
14280 +#warning duplicate inclusion
14281 +#endif /* _VX_SCHED_H */
14282 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/signal_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/signal_cmd.h
14283 --- linux-2.6.35.2/include/linux/vserver/signal_cmd.h 1970-01-01 01:00:00.000000000 +0100
14284 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/signal_cmd.h 2010-08-02 17:05:06.000000000 +0200
14286 +#ifndef _VX_SIGNAL_CMD_H
14287 +#define _VX_SIGNAL_CMD_H
14290 +/* signalling vserver commands */
14292 +#define VCMD_ctx_kill VC_CMD(PROCTRL, 1, 0)
14293 +#define VCMD_wait_exit VC_CMD(EVENT, 99, 0)
14295 +struct vcmd_ctx_kill_v0 {
14300 +struct vcmd_wait_exit_v0 {
14301 + int32_t reboot_cmd;
14302 + int32_t exit_code;
14307 +extern int vc_ctx_kill(struct vx_info *, void __user *);
14308 +extern int vc_wait_exit(struct vx_info *, void __user *);
14310 +#endif /* __KERNEL__ */
14312 +/* process alteration commands */
14314 +#define VCMD_get_pflags VC_CMD(PROCALT, 5, 0)
14315 +#define VCMD_set_pflags VC_CMD(PROCALT, 6, 0)
14317 +struct vcmd_pflags_v0 {
14318 + uint32_t flagword;
14324 +extern int vc_get_pflags(uint32_t pid, void __user *);
14325 +extern int vc_set_pflags(uint32_t pid, void __user *);
14327 +#endif /* __KERNEL__ */
14328 +#endif /* _VX_SIGNAL_CMD_H */
14329 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/signal.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/signal.h
14330 --- linux-2.6.35.2/include/linux/vserver/signal.h 1970-01-01 01:00:00.000000000 +0100
14331 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/signal.h 2010-08-02 17:05:06.000000000 +0200
14333 +#ifndef _VX_SIGNAL_H
14334 +#define _VX_SIGNAL_H
14341 +int vx_info_kill(struct vx_info *, int, int);
14343 +#endif /* __KERNEL__ */
14344 +#else /* _VX_SIGNAL_H */
14345 +#warning duplicate inclusion
14346 +#endif /* _VX_SIGNAL_H */
14347 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/space_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/space_cmd.h
14348 --- linux-2.6.35.2/include/linux/vserver/space_cmd.h 1970-01-01 01:00:00.000000000 +0100
14349 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/space_cmd.h 2010-08-02 17:05:06.000000000 +0200
14351 +#ifndef _VX_SPACE_CMD_H
14352 +#define _VX_SPACE_CMD_H
14355 +#define VCMD_enter_space_v0 VC_CMD(PROCALT, 1, 0)
14356 +#define VCMD_enter_space_v1 VC_CMD(PROCALT, 1, 1)
14357 +#define VCMD_enter_space VC_CMD(PROCALT, 1, 2)
14359 +#define VCMD_set_space_v0 VC_CMD(PROCALT, 3, 0)
14360 +#define VCMD_set_space_v1 VC_CMD(PROCALT, 3, 1)
14361 +#define VCMD_set_space VC_CMD(PROCALT, 3, 2)
14363 +#define VCMD_get_space_mask_v0 VC_CMD(PROCALT, 4, 0)
14365 +#define VCMD_get_space_mask VC_CMD(VSPACE, 0, 1)
14366 +#define VCMD_get_space_default VC_CMD(VSPACE, 1, 0)
14369 +struct vcmd_space_mask_v1 {
14373 +struct vcmd_space_mask_v2 {
14381 +extern int vc_enter_space_v1(struct vx_info *, void __user *);
14382 +extern int vc_set_space_v1(struct vx_info *, void __user *);
14383 +extern int vc_enter_space(struct vx_info *, void __user *);
14384 +extern int vc_set_space(struct vx_info *, void __user *);
14385 +extern int vc_get_space_mask(void __user *, int);
14387 +#endif /* __KERNEL__ */
14388 +#endif /* _VX_SPACE_CMD_H */
14389 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/space.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/space.h
14390 --- linux-2.6.35.2/include/linux/vserver/space.h 1970-01-01 01:00:00.000000000 +0100
14391 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/space.h 2010-08-02 17:05:06.000000000 +0200
14393 +#ifndef _VX_SPACE_H
14394 +#define _VX_SPACE_H
14396 +#include <linux/types.h>
14400 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index);
14402 +#else /* _VX_SPACE_H */
14403 +#warning duplicate inclusion
14404 +#endif /* _VX_SPACE_H */
14405 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/switch.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/switch.h
14406 --- linux-2.6.35.2/include/linux/vserver/switch.h 1970-01-01 01:00:00.000000000 +0100
14407 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/switch.h 2010-08-02 17:05:06.000000000 +0200
14409 +#ifndef _VX_SWITCH_H
14410 +#define _VX_SWITCH_H
14412 +#include <linux/types.h>
14415 +#define VC_CATEGORY(c) (((c) >> 24) & 0x3F)
14416 +#define VC_COMMAND(c) (((c) >> 16) & 0xFF)
14417 +#define VC_VERSION(c) ((c) & 0xFFF)
14419 +#define VC_CMD(c, i, v) ((((VC_CAT_ ## c) & 0x3F) << 24) \
14420 + | (((i) & 0xFF) << 16) | ((v) & 0xFFF))
14424 + Syscall Matrix V2.8
14426 + |VERSION|CREATE |MODIFY |MIGRATE|CONTROL|EXPERIM| |SPECIAL|SPECIAL|
14427 + |STATS |DESTROY|ALTER |CHANGE |LIMIT |TEST | | | |
14428 + |INFO |SETUP | |MOVE | | | | | |
14429 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14430 + SYSTEM |VERSION|VSETUP |VHOST | | | | |DEVICE | |
14431 + HOST | 00| 01| 02| 03| 04| 05| | 06| 07|
14432 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14433 + CPU | |VPROC |PROCALT|PROCMIG|PROCTRL| | |SCHED. | |
14434 + PROCESS| 08| 09| 10| 11| 12| 13| | 14| 15|
14435 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14436 + MEMORY | | | | |MEMCTRL| | |SWAP | |
14437 + | 16| 17| 18| 19| 20| 21| | 22| 23|
14438 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14439 + NETWORK| |VNET |NETALT |NETMIG |NETCTL | | |SERIAL | |
14440 + | 24| 25| 26| 27| 28| 29| | 30| 31|
14441 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14442 + DISK | | | |TAGMIG |DLIMIT | | |INODE | |
14443 + VFS | 32| 33| 34| 35| 36| 37| | 38| 39|
14444 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14445 + OTHER |VSTAT | | | | | | |VINFO | |
14446 + | 40| 41| 42| 43| 44| 45| | 46| 47|
14447 + =======+=======+=======+=======+=======+=======+=======+ +=======+=======+
14448 + SPECIAL|EVENT | | | |FLAGS | | |VSPACE | |
14449 + | 48| 49| 50| 51| 52| 53| | 54| 55|
14450 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14451 + SPECIAL|DEBUG | | | |RLIMIT |SYSCALL| | |COMPAT |
14452 + | 56| 57| 58| 59| 60|TEST 61| | 62| 63|
14453 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14457 +#define VC_CAT_VERSION 0
14459 +#define VC_CAT_VSETUP 1
14460 +#define VC_CAT_VHOST 2
14462 +#define VC_CAT_DEVICE 6
14464 +#define VC_CAT_VPROC 9
14465 +#define VC_CAT_PROCALT 10
14466 +#define VC_CAT_PROCMIG 11
14467 +#define VC_CAT_PROCTRL 12
14469 +#define VC_CAT_SCHED 14
14470 +#define VC_CAT_MEMCTRL 20
14472 +#define VC_CAT_VNET 25
14473 +#define VC_CAT_NETALT 26
14474 +#define VC_CAT_NETMIG 27
14475 +#define VC_CAT_NETCTRL 28
14477 +#define VC_CAT_TAGMIG 35
14478 +#define VC_CAT_DLIMIT 36
14479 +#define VC_CAT_INODE 38
14481 +#define VC_CAT_VSTAT 40
14482 +#define VC_CAT_VINFO 46
14483 +#define VC_CAT_EVENT 48
14485 +#define VC_CAT_FLAGS 52
14486 +#define VC_CAT_VSPACE 54
14487 +#define VC_CAT_DEBUG 56
14488 +#define VC_CAT_RLIMIT 60
14490 +#define VC_CAT_SYSTEST 61
14491 +#define VC_CAT_COMPAT 63
14493 +/* query version */
14495 +#define VCMD_get_version VC_CMD(VERSION, 0, 0)
14496 +#define VCMD_get_vci VC_CMD(VERSION, 1, 0)
14501 +#include <linux/errno.h>
14503 +#endif /* __KERNEL__ */
14505 +#endif /* _VX_SWITCH_H */
14507 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/tag_cmd.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/tag_cmd.h
14508 --- linux-2.6.35.2/include/linux/vserver/tag_cmd.h 1970-01-01 01:00:00.000000000 +0100
14509 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/tag_cmd.h 2010-08-02 17:05:06.000000000 +0200
14511 +#ifndef _VX_TAG_CMD_H
14512 +#define _VX_TAG_CMD_H
14515 +/* vinfo commands */
14517 +#define VCMD_task_tag VC_CMD(VINFO, 3, 0)
14520 +extern int vc_task_tag(uint32_t);
14522 +#endif /* __KERNEL__ */
14524 +/* context commands */
14526 +#define VCMD_tag_migrate VC_CMD(TAGMIG, 1, 0)
14529 +extern int vc_tag_migrate(uint32_t);
14531 +#endif /* __KERNEL__ */
14532 +#endif /* _VX_TAG_CMD_H */
14533 diff -NurpP --minimal linux-2.6.35.2/include/linux/vserver/tag.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/tag.h
14534 --- linux-2.6.35.2/include/linux/vserver/tag.h 1970-01-01 01:00:00.000000000 +0100
14535 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vserver/tag.h 2010-08-02 17:05:06.000000000 +0200
14540 +#include <linux/types.h>
14543 +#define DX_TAG(in) (IS_TAGGED(in))
14546 +#ifdef CONFIG_TAG_NFSD
14547 +#define DX_TAG_NFSD 1
14549 +#define DX_TAG_NFSD 0
14553 +#ifdef CONFIG_TAGGING_NONE
14555 +#define MAX_UID 0xFFFFFFFF
14556 +#define MAX_GID 0xFFFFFFFF
14558 +#define INOTAG_TAG(cond, uid, gid, tag) (0)
14560 +#define TAGINO_UID(cond, uid, tag) (uid)
14561 +#define TAGINO_GID(cond, gid, tag) (gid)
14566 +#ifdef CONFIG_TAGGING_GID16
14568 +#define MAX_UID 0xFFFFFFFF
14569 +#define MAX_GID 0x0000FFFF
14571 +#define INOTAG_TAG(cond, uid, gid, tag) \
14572 + ((cond) ? (((gid) >> 16) & 0xFFFF) : 0)
14574 +#define TAGINO_UID(cond, uid, tag) (uid)
14575 +#define TAGINO_GID(cond, gid, tag) \
14576 + ((cond) ? (((gid) & 0xFFFF) | ((tag) << 16)) : (gid))
14581 +#ifdef CONFIG_TAGGING_ID24
14583 +#define MAX_UID 0x00FFFFFF
14584 +#define MAX_GID 0x00FFFFFF
14586 +#define INOTAG_TAG(cond, uid, gid, tag) \
14587 + ((cond) ? ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) : 0)
14589 +#define TAGINO_UID(cond, uid, tag) \
14590 + ((cond) ? (((uid) & 0xFFFFFF) | (((tag) & 0xFF00) << 16)) : (uid))
14591 +#define TAGINO_GID(cond, gid, tag) \
14592 + ((cond) ? (((gid) & 0xFFFFFF) | (((tag) & 0x00FF) << 24)) : (gid))
14597 +#ifdef CONFIG_TAGGING_UID16
14599 +#define MAX_UID 0x0000FFFF
14600 +#define MAX_GID 0xFFFFFFFF
14602 +#define INOTAG_TAG(cond, uid, gid, tag) \
14603 + ((cond) ? (((uid) >> 16) & 0xFFFF) : 0)
14605 +#define TAGINO_UID(cond, uid, tag) \
14606 + ((cond) ? (((uid) & 0xFFFF) | ((tag) << 16)) : (uid))
14607 +#define TAGINO_GID(cond, gid, tag) (gid)
14612 +#ifdef CONFIG_TAGGING_INTERN
14614 +#define MAX_UID 0xFFFFFFFF
14615 +#define MAX_GID 0xFFFFFFFF
14617 +#define INOTAG_TAG(cond, uid, gid, tag) \
14618 + ((cond) ? (tag) : 0)
14620 +#define TAGINO_UID(cond, uid, tag) (uid)
14621 +#define TAGINO_GID(cond, gid, tag) (gid)
14626 +#ifndef CONFIG_TAGGING_NONE
14627 +#define dx_current_fstag(sb) \
14628 + ((sb)->s_flags & MS_TAGGED ? dx_current_tag() : 0)
14630 +#define dx_current_fstag(sb) (0)
14633 +#ifndef CONFIG_TAGGING_INTERN
14634 +#define TAGINO_TAG(cond, tag) (0)
14636 +#define TAGINO_TAG(cond, tag) ((cond) ? (tag) : 0)
14639 +#define INOTAG_UID(cond, uid, gid) \
14640 + ((cond) ? ((uid) & MAX_UID) : (uid))
14641 +#define INOTAG_GID(cond, uid, gid) \
14642 + ((cond) ? ((gid) & MAX_GID) : (gid))
14645 +static inline uid_t dx_map_uid(uid_t uid)
14647 + if ((uid > MAX_UID) && (uid != -1))
14649 + return (uid & MAX_UID);
14652 +static inline gid_t dx_map_gid(gid_t gid)
14654 + if ((gid > MAX_GID) && (gid != -1))
14656 + return (gid & MAX_GID);
14664 +#define dx_notagcheck(sb) ((sb) && ((sb)->s_flags & MS_NOTAGCHECK))
14666 +int dx_parse_tag(char *string, tag_t *tag, int remove, int *mnt_flags,
14667 + unsigned long *flags);
14669 +#ifdef CONFIG_PROPAGATE
14671 +void __dx_propagate_tag(struct nameidata *nd, struct inode *inode);
14673 +#define dx_propagate_tag(n, i) __dx_propagate_tag(n, i)
14676 +#define dx_propagate_tag(n, i) do { } while (0)
14679 +#endif /* _DX_TAG_H */
14680 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_inet6.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_inet6.h
14681 --- linux-2.6.35.2/include/linux/vs_inet6.h 1970-01-01 01:00:00.000000000 +0100
14682 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_inet6.h 2010-08-02 17:05:06.000000000 +0200
14684 +#ifndef _VS_INET6_H
14685 +#define _VS_INET6_H
14687 +#include "vserver/base.h"
14688 +#include "vserver/network.h"
14689 +#include "vserver/debug.h"
14691 +#include <net/ipv6.h>
14693 +#define NXAV6(a) &(a)->ip, &(a)->mask, (a)->prefix, (a)->type
14694 +#define NXAV6_FMT "[%pI6/%pI6/%d:%04x]"
14697 +#ifdef CONFIG_IPV6
14700 +int v6_addr_match(struct nx_addr_v6 *nxa,
14701 + const struct in6_addr *addr, uint16_t mask)
14705 + switch (nxa->type & mask) {
14706 + case NXA_TYPE_MASK:
14707 + ret = ipv6_masked_addr_cmp(&nxa->ip, &nxa->mask, addr);
14709 + case NXA_TYPE_ADDR:
14710 + ret = ipv6_addr_equal(&nxa->ip, addr);
14712 + case NXA_TYPE_ANY:
14716 + vxdprintk(VXD_CBIT(net, 0),
14717 + "v6_addr_match(%p" NXAV6_FMT ",%pI6,%04x) = %d",
14718 + nxa, NXAV6(nxa), addr, mask, ret);
14723 +int v6_addr_in_nx_info(struct nx_info *nxi,
14724 + const struct in6_addr *addr, uint16_t mask)
14726 + struct nx_addr_v6 *nxa;
14731 + for (nxa = &nxi->v6; nxa; nxa = nxa->next)
14732 + if (v6_addr_match(nxa, addr, mask))
14736 + vxdprintk(VXD_CBIT(net, 0),
14737 + "v6_addr_in_nx_info(%p[#%u],%pI6,%04x) = %d",
14738 + nxi, nxi ? nxi->nx_id : 0, addr, mask, ret);
14743 +int v6_nx_addr_match(struct nx_addr_v6 *nxa, struct nx_addr_v6 *addr, uint16_t mask)
14745 + /* FIXME: needs full range checks */
14746 + return v6_addr_match(nxa, &addr->ip, mask);
14750 +int v6_nx_addr_in_nx_info(struct nx_info *nxi, struct nx_addr_v6 *nxa, uint16_t mask)
14752 + struct nx_addr_v6 *ptr;
14754 + for (ptr = &nxi->v6; ptr; ptr = ptr->next)
14755 + if (v6_nx_addr_match(ptr, nxa, mask))
14762 + * Check if a given address matches for a socket
14764 + * nxi: the socket's nx_info if any
14765 + * addr: to be verified address
14768 +int v6_sock_addr_match (
14769 + struct nx_info *nxi,
14770 + struct inet_sock *inet,
14771 + struct in6_addr *addr)
14773 + struct sock *sk = &inet->sk;
14774 + struct in6_addr *saddr = inet6_rcv_saddr(sk);
14776 + if (!ipv6_addr_any(addr) &&
14777 + ipv6_addr_equal(saddr, addr))
14779 + if (ipv6_addr_any(saddr))
14780 + return v6_addr_in_nx_info(nxi, addr, -1);
14785 + * check if address is covered by socket
14787 + * sk: the socket to check against
14788 + * addr: the address in question (must be != 0)
14792 +int __v6_addr_match_socket(const struct sock *sk, struct nx_addr_v6 *nxa)
14794 + struct nx_info *nxi = sk->sk_nx_info;
14795 + struct in6_addr *saddr = inet6_rcv_saddr(sk);
14797 + vxdprintk(VXD_CBIT(net, 5),
14798 + "__v6_addr_in_socket(%p," NXAV6_FMT ") %p:%pI6 %p;%lx",
14799 + sk, NXAV6(nxa), nxi, saddr, sk->sk_socket,
14800 + (sk->sk_socket?sk->sk_socket->flags:0));
14802 + if (!ipv6_addr_any(saddr)) { /* direct address match */
14803 + return v6_addr_match(nxa, saddr, -1);
14804 + } else if (nxi) { /* match against nx_info */
14805 + return v6_nx_addr_in_nx_info(nxi, nxa, -1);
14806 + } else { /* unrestricted any socket */
14812 +/* inet related checks and helpers */
14816 +struct net_device;
14820 +#include <linux/netdevice.h>
14821 +#include <linux/inetdevice.h>
14822 +#include <net/inet_timewait_sock.h>
14825 +int dev_in_nx_info(struct net_device *, struct nx_info *);
14826 +int v6_dev_in_nx_info(struct net_device *, struct nx_info *);
14827 +int nx_v6_addr_conflict(struct nx_info *, struct nx_info *);
14832 +int v6_ifa_in_nx_info(struct inet6_ifaddr *ifa, struct nx_info *nxi)
14838 + return v6_addr_in_nx_info(nxi, &ifa->addr, -1);
14842 +int nx_v6_ifa_visible(struct nx_info *nxi, struct inet6_ifaddr *ifa)
14844 + vxdprintk(VXD_CBIT(net, 1), "nx_v6_ifa_visible(%p[#%u],%p) %d",
14845 + nxi, nxi ? nxi->nx_id : 0, ifa,
14846 + nxi ? v6_ifa_in_nx_info(ifa, nxi) : 0);
14848 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
14850 + if (v6_ifa_in_nx_info(ifa, nxi))
14856 +struct nx_v6_sock_addr {
14857 + struct in6_addr saddr; /* Address used for validation */
14858 + struct in6_addr baddr; /* Address used for socket bind */
14862 +int v6_map_sock_addr(struct inet_sock *inet, struct sockaddr_in6 *addr,
14863 + struct nx_v6_sock_addr *nsa)
14865 + // struct sock *sk = &inet->sk;
14866 + // struct nx_info *nxi = sk->sk_nx_info;
14867 + struct in6_addr saddr = addr->sin6_addr;
14868 + struct in6_addr baddr = saddr;
14870 + nsa->saddr = saddr;
14871 + nsa->baddr = baddr;
14876 +void v6_set_sock_addr(struct inet_sock *inet, struct nx_v6_sock_addr *nsa)
14878 + // struct sock *sk = &inet->sk;
14879 + // struct in6_addr *saddr = inet6_rcv_saddr(sk);
14881 + // *saddr = nsa->baddr;
14882 + // inet->inet_saddr = nsa->baddr;
14886 +int nx_info_has_v6(struct nx_info *nxi)
14890 + if (NX_IPV6(nxi))
14895 +#else /* CONFIG_IPV6 */
14898 +int nx_v6_dev_visible(struct nx_info *n, struct net_device *d)
14905 +int nx_v6_addr_conflict(struct nx_info *n, uint32_t a, const struct sock *s)
14911 +int v6_ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
14917 +int nx_info_has_v6(struct nx_info *nxi)
14922 +#endif /* CONFIG_IPV6 */
14924 +#define current_nx_info_has_v6() \
14925 + nx_info_has_v6(current_nx_info())
14928 +#warning duplicate inclusion
14930 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_inet.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_inet.h
14931 --- linux-2.6.35.2/include/linux/vs_inet.h 1970-01-01 01:00:00.000000000 +0100
14932 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_inet.h 2010-08-02 17:05:06.000000000 +0200
14934 +#ifndef _VS_INET_H
14935 +#define _VS_INET_H
14937 +#include "vserver/base.h"
14938 +#include "vserver/network.h"
14939 +#include "vserver/debug.h"
14941 +#define IPI_LOOPBACK htonl(INADDR_LOOPBACK)
14943 +#define NXAV4(a) NIPQUAD((a)->ip[0]), NIPQUAD((a)->ip[1]), \
14944 + NIPQUAD((a)->mask), (a)->type
14945 +#define NXAV4_FMT "[" NIPQUAD_FMT "-" NIPQUAD_FMT "/" NIPQUAD_FMT ":%04x]"
14949 +int v4_addr_match(struct nx_addr_v4 *nxa, __be32 addr, uint16_t tmask)
14951 + __be32 ip = nxa->ip[0].s_addr;
14952 + __be32 mask = nxa->mask.s_addr;
14953 + __be32 bcast = ip | ~mask;
14956 + switch (nxa->type & tmask) {
14957 + case NXA_TYPE_MASK:
14958 + ret = (ip == (addr & mask));
14960 + case NXA_TYPE_ADDR:
14964 + /* fall through to broadcast */
14965 + case NXA_MOD_BCAST:
14966 + ret = ((tmask & NXA_MOD_BCAST) && (addr == bcast));
14968 + case NXA_TYPE_RANGE:
14969 + ret = ((nxa->ip[0].s_addr <= addr) &&
14970 + (nxa->ip[1].s_addr > addr));
14972 + case NXA_TYPE_ANY:
14977 + vxdprintk(VXD_CBIT(net, 0),
14978 + "v4_addr_match(%p" NXAV4_FMT "," NIPQUAD_FMT ",%04x) = %d",
14979 + nxa, NXAV4(nxa), NIPQUAD(addr), tmask, ret);
14984 +int v4_addr_in_nx_info(struct nx_info *nxi, __be32 addr, uint16_t tmask)
14986 + struct nx_addr_v4 *nxa;
14993 + /* allow 127.0.0.1 when remapping lback */
14994 + if ((tmask & NXA_LOOPBACK) &&
14995 + (addr == IPI_LOOPBACK) &&
14996 + nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
14999 + /* check for lback address */
15000 + if ((tmask & NXA_MOD_LBACK) &&
15001 + (nxi->v4_lback.s_addr == addr))
15004 + /* check for broadcast address */
15005 + if ((tmask & NXA_MOD_BCAST) &&
15006 + (nxi->v4_bcast.s_addr == addr))
15009 + /* check for v4 addresses */
15010 + for (nxa = &nxi->v4; nxa; nxa = nxa->next)
15011 + if (v4_addr_match(nxa, addr, tmask))
15015 + vxdprintk(VXD_CBIT(net, 0),
15016 + "v4_addr_in_nx_info(%p[#%u]," NIPQUAD_FMT ",%04x) = %d",
15017 + nxi, nxi ? nxi->nx_id : 0, NIPQUAD(addr), tmask, ret);
15022 +int v4_nx_addr_match(struct nx_addr_v4 *nxa, struct nx_addr_v4 *addr, uint16_t mask)
15024 + /* FIXME: needs full range checks */
15025 + return v4_addr_match(nxa, addr->ip[0].s_addr, mask);
15029 +int v4_nx_addr_in_nx_info(struct nx_info *nxi, struct nx_addr_v4 *nxa, uint16_t mask)
15031 + struct nx_addr_v4 *ptr;
15033 + for (ptr = &nxi->v4; ptr; ptr = ptr->next)
15034 + if (v4_nx_addr_match(ptr, nxa, mask))
15039 +#include <net/inet_sock.h>
15042 + * Check if a given address matches for a socket
15044 + * nxi: the socket's nx_info if any
15045 + * addr: to be verified address
15048 +int v4_sock_addr_match (
15049 + struct nx_info *nxi,
15050 + struct inet_sock *inet,
15053 + __be32 saddr = inet->inet_rcv_saddr;
15054 + __be32 bcast = nxi ? nxi->v4_bcast.s_addr : INADDR_BROADCAST;
15056 + if (addr && (saddr == addr || bcast == addr))
15059 + return v4_addr_in_nx_info(nxi, addr, NXA_MASK_BIND);
15064 +/* inet related checks and helpers */
15068 +struct net_device;
15071 +#ifdef CONFIG_INET
15073 +#include <linux/netdevice.h>
15074 +#include <linux/inetdevice.h>
15075 +#include <net/inet_sock.h>
15076 +#include <net/inet_timewait_sock.h>
15079 +int dev_in_nx_info(struct net_device *, struct nx_info *);
15080 +int v4_dev_in_nx_info(struct net_device *, struct nx_info *);
15081 +int nx_v4_addr_conflict(struct nx_info *, struct nx_info *);
15085 + * check if address is covered by socket
15087 + * sk: the socket to check against
15088 + * addr: the address in question (must be != 0)
15092 +int __v4_addr_match_socket(const struct sock *sk, struct nx_addr_v4 *nxa)
15094 + struct nx_info *nxi = sk->sk_nx_info;
15095 + __be32 saddr = inet_rcv_saddr(sk);
15097 + vxdprintk(VXD_CBIT(net, 5),
15098 + "__v4_addr_in_socket(%p," NXAV4_FMT ") %p:" NIPQUAD_FMT " %p;%lx",
15099 + sk, NXAV4(nxa), nxi, NIPQUAD(saddr), sk->sk_socket,
15100 + (sk->sk_socket?sk->sk_socket->flags:0));
15102 + if (saddr) { /* direct address match */
15103 + return v4_addr_match(nxa, saddr, -1);
15104 + } else if (nxi) { /* match against nx_info */
15105 + return v4_nx_addr_in_nx_info(nxi, nxa, -1);
15106 + } else { /* unrestricted any socket */
15114 +int nx_dev_visible(struct nx_info *nxi, struct net_device *dev)
15116 + vxdprintk(VXD_CBIT(net, 1), "nx_dev_visible(%p[#%u],%p »%s«) %d",
15117 + nxi, nxi ? nxi->nx_id : 0, dev, dev->name,
15118 + nxi ? dev_in_nx_info(dev, nxi) : 0);
15120 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15122 + if (dev_in_nx_info(dev, nxi))
15129 +int v4_ifa_in_nx_info(struct in_ifaddr *ifa, struct nx_info *nxi)
15135 + return v4_addr_in_nx_info(nxi, ifa->ifa_local, NXA_MASK_SHOW);
15139 +int nx_v4_ifa_visible(struct nx_info *nxi, struct in_ifaddr *ifa)
15141 + vxdprintk(VXD_CBIT(net, 1), "nx_v4_ifa_visible(%p[#%u],%p) %d",
15142 + nxi, nxi ? nxi->nx_id : 0, ifa,
15143 + nxi ? v4_ifa_in_nx_info(ifa, nxi) : 0);
15145 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15147 + if (v4_ifa_in_nx_info(ifa, nxi))
15153 +struct nx_v4_sock_addr {
15154 + __be32 saddr; /* Address used for validation */
15155 + __be32 baddr; /* Address used for socket bind */
15159 +int v4_map_sock_addr(struct inet_sock *inet, struct sockaddr_in *addr,
15160 + struct nx_v4_sock_addr *nsa)
15162 + struct sock *sk = &inet->sk;
15163 + struct nx_info *nxi = sk->sk_nx_info;
15164 + __be32 saddr = addr->sin_addr.s_addr;
15165 + __be32 baddr = saddr;
15167 + vxdprintk(VXD_CBIT(net, 3),
15168 + "inet_bind(%p)* %p,%p;%lx " NIPQUAD_FMT,
15169 + sk, sk->sk_nx_info, sk->sk_socket,
15170 + (sk->sk_socket ? sk->sk_socket->flags : 0),
15174 + if (saddr == INADDR_ANY) {
15175 + if (nx_info_flags(nxi, NXF_SINGLE_IP, 0))
15176 + baddr = nxi->v4.ip[0].s_addr;
15177 + } else if (saddr == IPI_LOOPBACK) {
15178 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15179 + baddr = nxi->v4_lback.s_addr;
15180 + } else { /* normal address bind */
15181 + if (!v4_addr_in_nx_info(nxi, saddr, NXA_MASK_BIND))
15182 + return -EADDRNOTAVAIL;
15186 + vxdprintk(VXD_CBIT(net, 3),
15187 + "inet_bind(%p) " NIPQUAD_FMT ", " NIPQUAD_FMT,
15188 + sk, NIPQUAD(saddr), NIPQUAD(baddr));
15190 + nsa->saddr = saddr;
15191 + nsa->baddr = baddr;
15196 +void v4_set_sock_addr(struct inet_sock *inet, struct nx_v4_sock_addr *nsa)
15198 + inet->inet_saddr = nsa->baddr;
15199 + inet->inet_rcv_saddr = nsa->baddr;
15204 + * helper to simplify inet_lookup_listener
15206 + * nxi: the socket's nx_info if any
15207 + * addr: to be verified address
15208 + * saddr: socket address
15210 +static inline int v4_inet_addr_match (
15211 + struct nx_info *nxi,
15215 + if (addr && (saddr == addr))
15218 + return nxi ? v4_addr_in_nx_info(nxi, addr, NXA_MASK_BIND) : 1;
15222 +static inline __be32 nx_map_sock_lback(struct nx_info *nxi, __be32 addr)
15224 + if (nx_info_flags(nxi, NXF_HIDE_LBACK, 0) &&
15225 + (addr == nxi->v4_lback.s_addr))
15226 + return IPI_LOOPBACK;
15231 +int nx_info_has_v4(struct nx_info *nxi)
15235 + if (NX_IPV4(nxi))
15237 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15242 +#else /* CONFIG_INET */
15245 +int nx_dev_visible(struct nx_info *n, struct net_device *d)
15251 +int nx_v4_addr_conflict(struct nx_info *n, uint32_t a, const struct sock *s)
15257 +int v4_ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
15263 +int nx_info_has_v4(struct nx_info *nxi)
15268 +#endif /* CONFIG_INET */
15270 +#define current_nx_info_has_v4() \
15271 + nx_info_has_v4(current_nx_info())
15274 +// #warning duplicate inclusion
15276 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_limit.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_limit.h
15277 --- linux-2.6.35.2/include/linux/vs_limit.h 1970-01-01 01:00:00.000000000 +0100
15278 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_limit.h 2010-08-02 17:05:06.000000000 +0200
15280 +#ifndef _VS_LIMIT_H
15281 +#define _VS_LIMIT_H
15283 +#include "vserver/limit.h"
15284 +#include "vserver/base.h"
15285 +#include "vserver/context.h"
15286 +#include "vserver/debug.h"
15287 +#include "vserver/context.h"
15288 +#include "vserver/limit_int.h"
15291 +#define vx_acc_cres(v, d, p, r) \
15292 + __vx_acc_cres(v, r, d, p, __FILE__, __LINE__)
15294 +#define vx_acc_cres_cond(x, d, p, r) \
15295 + __vx_acc_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \
15296 + r, d, p, __FILE__, __LINE__)
15299 +#define vx_add_cres(v, a, p, r) \
15300 + __vx_add_cres(v, r, a, p, __FILE__, __LINE__)
15301 +#define vx_sub_cres(v, a, p, r) vx_add_cres(v, -(a), p, r)
15303 +#define vx_add_cres_cond(x, a, p, r) \
15304 + __vx_add_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \
15305 + r, a, p, __FILE__, __LINE__)
15306 +#define vx_sub_cres_cond(x, a, p, r) vx_add_cres_cond(x, -(a), p, r)
15309 +/* process and file limits */
15311 +#define vx_nproc_inc(p) \
15312 + vx_acc_cres((p)->vx_info, 1, p, RLIMIT_NPROC)
15314 +#define vx_nproc_dec(p) \
15315 + vx_acc_cres((p)->vx_info,-1, p, RLIMIT_NPROC)
15317 +#define vx_files_inc(f) \
15318 + vx_acc_cres_cond((f)->f_xid, 1, f, RLIMIT_NOFILE)
15320 +#define vx_files_dec(f) \
15321 + vx_acc_cres_cond((f)->f_xid,-1, f, RLIMIT_NOFILE)
15323 +#define vx_locks_inc(l) \
15324 + vx_acc_cres_cond((l)->fl_xid, 1, l, RLIMIT_LOCKS)
15326 +#define vx_locks_dec(l) \
15327 + vx_acc_cres_cond((l)->fl_xid,-1, l, RLIMIT_LOCKS)
15329 +#define vx_openfd_inc(f) \
15330 + vx_acc_cres(current_vx_info(), 1, (void *)(long)(f), VLIMIT_OPENFD)
15332 +#define vx_openfd_dec(f) \
15333 + vx_acc_cres(current_vx_info(),-1, (void *)(long)(f), VLIMIT_OPENFD)
15336 +#define vx_cres_avail(v, n, r) \
15337 + __vx_cres_avail(v, r, n, __FILE__, __LINE__)
15340 +#define vx_nproc_avail(n) \
15341 + vx_cres_avail(current_vx_info(), n, RLIMIT_NPROC)
15343 +#define vx_files_avail(n) \
15344 + vx_cres_avail(current_vx_info(), n, RLIMIT_NOFILE)
15346 +#define vx_locks_avail(n) \
15347 + vx_cres_avail(current_vx_info(), n, RLIMIT_LOCKS)
15349 +#define vx_openfd_avail(n) \
15350 + vx_cres_avail(current_vx_info(), n, VLIMIT_OPENFD)
15353 +/* dentry limits */
15355 +#define vx_dentry_inc(d) do { \
15356 + if (atomic_read(&d->d_count) == 1) \
15357 + vx_acc_cres(current_vx_info(), 1, d, VLIMIT_DENTRY); \
15360 +#define vx_dentry_dec(d) do { \
15361 + if (atomic_read(&d->d_count) == 0) \
15362 + vx_acc_cres(current_vx_info(),-1, d, VLIMIT_DENTRY); \
15365 +#define vx_dentry_avail(n) \
15366 + vx_cres_avail(current_vx_info(), n, VLIMIT_DENTRY)
15369 +/* socket limits */
15371 +#define vx_sock_inc(s) \
15372 + vx_acc_cres((s)->sk_vx_info, 1, s, VLIMIT_NSOCK)
15374 +#define vx_sock_dec(s) \
15375 + vx_acc_cres((s)->sk_vx_info,-1, s, VLIMIT_NSOCK)
15377 +#define vx_sock_avail(n) \
15378 + vx_cres_avail(current_vx_info(), n, VLIMIT_NSOCK)
15381 +/* ipc resource limits */
15383 +#define vx_ipcmsg_add(v, u, a) \
15384 + vx_add_cres(v, a, u, RLIMIT_MSGQUEUE)
15386 +#define vx_ipcmsg_sub(v, u, a) \
15387 + vx_sub_cres(v, a, u, RLIMIT_MSGQUEUE)
15389 +#define vx_ipcmsg_avail(v, a) \
15390 + vx_cres_avail(v, a, RLIMIT_MSGQUEUE)
15393 +#define vx_ipcshm_add(v, k, a) \
15394 + vx_add_cres(v, a, (void *)(long)(k), VLIMIT_SHMEM)
15396 +#define vx_ipcshm_sub(v, k, a) \
15397 + vx_sub_cres(v, a, (void *)(long)(k), VLIMIT_SHMEM)
15399 +#define vx_ipcshm_avail(v, a) \
15400 + vx_cres_avail(v, a, VLIMIT_SHMEM)
15403 +#define vx_semary_inc(a) \
15404 + vx_acc_cres(current_vx_info(), 1, a, VLIMIT_SEMARY)
15406 +#define vx_semary_dec(a) \
15407 + vx_acc_cres(current_vx_info(), -1, a, VLIMIT_SEMARY)
15410 +#define vx_nsems_add(a,n) \
15411 + vx_add_cres(current_vx_info(), n, a, VLIMIT_NSEMS)
15413 +#define vx_nsems_sub(a,n) \
15414 + vx_sub_cres(current_vx_info(), n, a, VLIMIT_NSEMS)
15418 +#warning duplicate inclusion
15420 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_memory.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_memory.h
15421 --- linux-2.6.35.2/include/linux/vs_memory.h 1970-01-01 01:00:00.000000000 +0100
15422 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_memory.h 2010-08-02 17:05:06.000000000 +0200
15424 +#ifndef _VS_MEMORY_H
15425 +#define _VS_MEMORY_H
15427 +#include "vserver/limit.h"
15428 +#include "vserver/base.h"
15429 +#include "vserver/context.h"
15430 +#include "vserver/debug.h"
15431 +#include "vserver/context.h"
15432 +#include "vserver/limit_int.h"
15435 + VXPT_UNKNOWN = 0,
15444 +#define vx_page_fault(mm, vma, type, ret)
15448 +void __vx_page_fault(struct mm_struct *mm,
15449 + struct vm_area_struct *vma, int type, int ret)
15451 + struct vx_info *vxi = mm->mm_vx_info;
15454 + static char *page_type[6] =
15455 + { "UNKNOWN", "ANON", "NONE", "FILE", "SWAP", "WRITE" };
15456 + static char *page_what[4] =
15457 + { "FAULT_OOM", "FAULT_SIGBUS", "FAULT_MINOR", "FAULT_MAJOR" };
15463 + what = (ret & 0x3);
15465 +/* printk("[%d] page[%d][%d] %2x %s %s\n", vxi->vx_id,
15466 + type, what, ret, page_type[type], page_what[what]);
15468 + if (ret & VM_FAULT_WRITE)
15470 + atomic_inc(&vxi->cacct.page[type][what]);
15473 +#define vx_page_fault(mm, vma, type, ret) __vx_page_fault(mm, vma, type, ret)
15477 +extern unsigned long vx_badness(struct task_struct *task, struct mm_struct *mm);
15480 +#warning duplicate inclusion
15482 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_network.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_network.h
15483 --- linux-2.6.35.2/include/linux/vs_network.h 1970-01-01 01:00:00.000000000 +0100
15484 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_network.h 2010-08-02 17:05:06.000000000 +0200
15486 +#ifndef _NX_VS_NETWORK_H
15487 +#define _NX_VS_NETWORK_H
15489 +#include "vserver/context.h"
15490 +#include "vserver/network.h"
15491 +#include "vserver/base.h"
15492 +#include "vserver/check.h"
15493 +#include "vserver/debug.h"
15495 +#include <linux/sched.h>
15498 +#define get_nx_info(i) __get_nx_info(i, __FILE__, __LINE__)
15500 +static inline struct nx_info *__get_nx_info(struct nx_info *nxi,
15501 + const char *_file, int _line)
15506 + vxlprintk(VXD_CBIT(nid, 2), "get_nx_info(%p[#%d.%d])",
15507 + nxi, nxi ? nxi->nx_id : 0,
15508 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15511 + atomic_inc(&nxi->nx_usecnt);
15516 +extern void free_nx_info(struct nx_info *);
15518 +#define put_nx_info(i) __put_nx_info(i, __FILE__, __LINE__)
15520 +static inline void __put_nx_info(struct nx_info *nxi, const char *_file, int _line)
15525 + vxlprintk(VXD_CBIT(nid, 2), "put_nx_info(%p[#%d.%d])",
15526 + nxi, nxi ? nxi->nx_id : 0,
15527 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15530 + if (atomic_dec_and_test(&nxi->nx_usecnt))
15531 + free_nx_info(nxi);
15535 +#define init_nx_info(p, i) __init_nx_info(p, i, __FILE__, __LINE__)
15537 +static inline void __init_nx_info(struct nx_info **nxp, struct nx_info *nxi,
15538 + const char *_file, int _line)
15541 + vxlprintk(VXD_CBIT(nid, 3),
15542 + "init_nx_info(%p[#%d.%d])",
15543 + nxi, nxi ? nxi->nx_id : 0,
15544 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15547 + atomic_inc(&nxi->nx_usecnt);
15553 +#define set_nx_info(p, i) __set_nx_info(p, i, __FILE__, __LINE__)
15555 +static inline void __set_nx_info(struct nx_info **nxp, struct nx_info *nxi,
15556 + const char *_file, int _line)
15558 + struct nx_info *nxo;
15563 + vxlprintk(VXD_CBIT(nid, 3), "set_nx_info(%p[#%d.%d])",
15564 + nxi, nxi ? nxi->nx_id : 0,
15565 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15568 + atomic_inc(&nxi->nx_usecnt);
15569 + nxo = xchg(nxp, nxi);
15573 +#define clr_nx_info(p) __clr_nx_info(p, __FILE__, __LINE__)
15575 +static inline void __clr_nx_info(struct nx_info **nxp,
15576 + const char *_file, int _line)
15578 + struct nx_info *nxo;
15580 + nxo = xchg(nxp, NULL);
15584 + vxlprintk(VXD_CBIT(nid, 3), "clr_nx_info(%p[#%d.%d])",
15585 + nxo, nxo ? nxo->nx_id : 0,
15586 + nxo ? atomic_read(&nxo->nx_usecnt) : 0,
15589 + if (atomic_dec_and_test(&nxo->nx_usecnt))
15590 + free_nx_info(nxo);
15594 +#define claim_nx_info(v, p) __claim_nx_info(v, p, __FILE__, __LINE__)
15596 +static inline void __claim_nx_info(struct nx_info *nxi,
15597 + struct task_struct *task, const char *_file, int _line)
15599 + vxlprintk(VXD_CBIT(nid, 3), "claim_nx_info(%p[#%d.%d.%d]) %p",
15600 + nxi, nxi ? nxi->nx_id : 0,
15601 + nxi?atomic_read(&nxi->nx_usecnt):0,
15602 + nxi?atomic_read(&nxi->nx_tasks):0,
15603 + task, _file, _line);
15605 + atomic_inc(&nxi->nx_tasks);
15609 +extern void unhash_nx_info(struct nx_info *);
15611 +#define release_nx_info(v, p) __release_nx_info(v, p, __FILE__, __LINE__)
15613 +static inline void __release_nx_info(struct nx_info *nxi,
15614 + struct task_struct *task, const char *_file, int _line)
15616 + vxlprintk(VXD_CBIT(nid, 3), "release_nx_info(%p[#%d.%d.%d]) %p",
15617 + nxi, nxi ? nxi->nx_id : 0,
15618 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15619 + nxi ? atomic_read(&nxi->nx_tasks) : 0,
15620 + task, _file, _line);
15624 + if (atomic_dec_and_test(&nxi->nx_tasks))
15625 + unhash_nx_info(nxi);
15629 +#define task_get_nx_info(i) __task_get_nx_info(i, __FILE__, __LINE__)
15631 +static __inline__ struct nx_info *__task_get_nx_info(struct task_struct *p,
15632 + const char *_file, int _line)
15634 + struct nx_info *nxi;
15637 + vxlprintk(VXD_CBIT(nid, 5), "task_get_nx_info(%p)",
15638 + p, _file, _line);
15639 + nxi = __get_nx_info(p->nx_info, _file, _line);
15645 +static inline void exit_nx_info(struct task_struct *p)
15648 + release_nx_info(p->nx_info, p);
15653 +#warning duplicate inclusion
15655 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_pid.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_pid.h
15656 --- linux-2.6.35.2/include/linux/vs_pid.h 1970-01-01 01:00:00.000000000 +0100
15657 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_pid.h 2010-08-02 17:05:06.000000000 +0200
15662 +#include "vserver/base.h"
15663 +#include "vserver/check.h"
15664 +#include "vserver/context.h"
15665 +#include "vserver/debug.h"
15666 +#include "vserver/pid.h"
15667 +#include <linux/pid_namespace.h>
15670 +#define VXF_FAKE_INIT (VXF_INFO_INIT | VXF_STATE_INIT)
15673 +int vx_proc_task_visible(struct task_struct *task)
15675 + if ((task->pid == 1) &&
15676 + !vx_flags(VXF_FAKE_INIT, VXF_FAKE_INIT))
15677 + /* show a blend through init */
15679 + if (vx_check(vx_task_xid(task), VS_WATCH | VS_IDENT))
15686 +#define find_task_by_real_pid(pid) find_task_by_pid_ns(pid, &init_pid_ns)
15691 +struct task_struct *vx_find_proc_task_by_pid(int pid)
15693 + struct task_struct *task = find_task_by_real_pid(pid);
15695 + if (task && !vx_proc_task_visible(task)) {
15696 + vxdprintk(VXD_CBIT(misc, 6),
15697 + "dropping task (find) %p[#%u,%u] for %p[#%u,%u]",
15698 + task, task->xid, task->pid,
15699 + current, current->xid, current->pid);
15708 +struct task_struct *vx_get_proc_task(struct inode *inode, struct pid *pid)
15710 + struct task_struct *task = get_pid_task(pid, PIDTYPE_PID);
15712 + if (task && !vx_proc_task_visible(task)) {
15713 + vxdprintk(VXD_CBIT(misc, 6),
15714 + "dropping task (get) %p[#%u,%u] for %p[#%u,%u]",
15715 + task, task->xid, task->pid,
15716 + current, current->xid, current->pid);
15717 + put_task_struct(task);
15726 +struct task_struct *vx_child_reaper(struct task_struct *p)
15728 + struct vx_info *vxi = p->vx_info;
15729 + struct task_struct *reaper = child_reaper(p);
15734 + BUG_ON(!p->vx_info->vx_reaper);
15736 + /* child reaper for the guest reaper */
15737 + if (vxi->vx_reaper == p)
15740 + reaper = vxi->vx_reaper;
15742 + vxdprintk(VXD_CBIT(xid, 7),
15743 + "vx_child_reaper(%p[#%u,%u]) = %p[#%u,%u]",
15744 + p, p->xid, p->pid, reaper, reaper->xid, reaper->pid);
15752 +#warning duplicate inclusion
15754 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_sched.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_sched.h
15755 --- linux-2.6.35.2/include/linux/vs_sched.h 1970-01-01 01:00:00.000000000 +0100
15756 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_sched.h 2010-08-02 17:05:06.000000000 +0200
15758 +#ifndef _VS_SCHED_H
15759 +#define _VS_SCHED_H
15761 +#include "vserver/base.h"
15762 +#include "vserver/context.h"
15763 +#include "vserver/sched.h"
15766 +#define VAVAVOOM_RATIO 50
15768 +#define MAX_PRIO_BIAS 20
15769 +#define MIN_PRIO_BIAS -20
15772 +#ifdef CONFIG_VSERVER_HARDCPU
15775 + * effective_prio - return the priority that is based on the static
15776 + * priority but is modified by bonuses/penalties.
15778 + * We scale the actual sleep average [0 .... MAX_SLEEP_AVG]
15779 + * into a -4 ... 0 ... +4 bonus/penalty range.
15781 + * Additionally, we scale another amount based on the number of
15782 + * CPU tokens currently held by the context, if the process is
15783 + * part of a context (and the appropriate SCHED flag is set).
15784 + * This ranges from -5 ... 0 ... +15, quadratically.
15786 + * So, the total bonus is -9 .. 0 .. +19
15787 + * We use ~50% of the full 0...39 priority range so that:
15789 + * 1) nice +19 interactive tasks do not preempt nice 0 CPU hogs.
15790 + * 2) nice -20 CPU hogs do not get preempted by nice 0 tasks.
15791 + * unless that context is far exceeding its CPU allocation.
15793 + * Both properties are important to certain workloads.
15796 +int vx_effective_vavavoom(struct _vx_sched_pc *sched_pc, int max_prio)
15798 + int vavavoom, max;
15800 + /* lots of tokens = lots of vavavoom
15801 + * no tokens = no vavavoom */
15802 + if ((vavavoom = sched_pc->tokens) >= 0) {
15803 + max = sched_pc->tokens_max;
15804 + vavavoom = max - vavavoom;
15806 + vavavoom = max_prio * VAVAVOOM_RATIO / 100
15807 + * (vavavoom*vavavoom - (max >> 2)) / max;
15815 +int vx_adjust_prio(struct task_struct *p, int prio, int max_user)
15817 + struct vx_info *vxi = p->vx_info;
15818 + struct _vx_sched_pc *sched_pc;
15823 + sched_pc = &vx_cpu(vxi, sched_pc);
15824 + if (vx_info_flags(vxi, VXF_SCHED_PRIO, 0)) {
15825 + int vavavoom = vx_effective_vavavoom(sched_pc, max_user);
15827 + sched_pc->vavavoom = vavavoom;
15828 + prio += vavavoom;
15830 + prio += sched_pc->prio_bias;
15834 +#else /* !CONFIG_VSERVER_HARDCPU */
15837 +int vx_adjust_prio(struct task_struct *p, int prio, int max_user)
15839 + struct vx_info *vxi = p->vx_info;
15842 + prio += vx_cpu(vxi, sched_pc).prio_bias;
15846 +#endif /* CONFIG_VSERVER_HARDCPU */
15849 +static inline void vx_account_user(struct vx_info *vxi,
15850 + cputime_t cputime, int nice)
15854 + vx_cpu(vxi, sched_pc).user_ticks += cputime;
15857 +static inline void vx_account_system(struct vx_info *vxi,
15858 + cputime_t cputime, int idle)
15862 + vx_cpu(vxi, sched_pc).sys_ticks += cputime;
15866 +#warning duplicate inclusion
15868 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_socket.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_socket.h
15869 --- linux-2.6.35.2/include/linux/vs_socket.h 1970-01-01 01:00:00.000000000 +0100
15870 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_socket.h 2010-08-02 17:05:06.000000000 +0200
15872 +#ifndef _VS_SOCKET_H
15873 +#define _VS_SOCKET_H
15875 +#include "vserver/debug.h"
15876 +#include "vserver/base.h"
15877 +#include "vserver/cacct.h"
15878 +#include "vserver/context.h"
15879 +#include "vserver/tag.h"
15882 +/* socket accounting */
15884 +#include <linux/socket.h>
15886 +static inline int vx_sock_type(int family)
15888 + switch (family) {
15890 + return VXA_SOCK_UNSPEC;
15892 + return VXA_SOCK_UNIX;
15894 + return VXA_SOCK_INET;
15896 + return VXA_SOCK_INET6;
15898 + return VXA_SOCK_PACKET;
15900 + return VXA_SOCK_OTHER;
15904 +#define vx_acc_sock(v, f, p, s) \
15905 + __vx_acc_sock(v, f, p, s, __FILE__, __LINE__)
15907 +static inline void __vx_acc_sock(struct vx_info *vxi,
15908 + int family, int pos, int size, char *file, int line)
15911 + int type = vx_sock_type(family);
15913 + atomic_long_inc(&vxi->cacct.sock[type][pos].count);
15914 + atomic_long_add(size, &vxi->cacct.sock[type][pos].total);
15918 +#define vx_sock_recv(sk, s) \
15919 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 0, s)
15920 +#define vx_sock_send(sk, s) \
15921 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 1, s)
15922 +#define vx_sock_fail(sk, s) \
15923 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 2, s)
15926 +#define sock_vx_init(s) do { \
15927 + (s)->sk_xid = 0; \
15928 + (s)->sk_vx_info = NULL; \
15931 +#define sock_nx_init(s) do { \
15932 + (s)->sk_nid = 0; \
15933 + (s)->sk_nx_info = NULL; \
15937 +#warning duplicate inclusion
15939 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_tag.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_tag.h
15940 --- linux-2.6.35.2/include/linux/vs_tag.h 1970-01-01 01:00:00.000000000 +0100
15941 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_tag.h 2010-08-02 17:05:06.000000000 +0200
15946 +#include <linux/vserver/tag.h>
15948 +/* check conditions */
15950 +#define DX_ADMIN 0x0001
15951 +#define DX_WATCH 0x0002
15952 +#define DX_HOSTID 0x0008
15954 +#define DX_IDENT 0x0010
15956 +#define DX_ARG_MASK 0x0010
15959 +#define dx_task_tag(t) ((t)->tag)
15961 +#define dx_current_tag() dx_task_tag(current)
15963 +#define dx_check(c, m) __dx_check(dx_current_tag(), c, m)
15965 +#define dx_weak_check(c, m) ((m) ? dx_check(c, m) : 1)
15969 + * check current context for ADMIN/WATCH and
15970 + * optionally against supplied argument
15972 +static inline int __dx_check(tag_t cid, tag_t id, unsigned int mode)
15974 + if (mode & DX_ARG_MASK) {
15975 + if ((mode & DX_IDENT) && (id == cid))
15978 + return (((mode & DX_ADMIN) && (cid == 0)) ||
15979 + ((mode & DX_WATCH) && (cid == 1)) ||
15980 + ((mode & DX_HOSTID) && (id == 0)));
15984 +int dx_permission(const struct inode *inode, int mask);
15988 +#warning duplicate inclusion
15990 diff -NurpP --minimal linux-2.6.35.2/include/linux/vs_time.h linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_time.h
15991 --- linux-2.6.35.2/include/linux/vs_time.h 1970-01-01 01:00:00.000000000 +0100
15992 +++ linux-2.6.35.2-vs2.3.0.36.31/include/linux/vs_time.h 2010-08-02 17:05:06.000000000 +0200
15994 +#ifndef _VS_TIME_H
15995 +#define _VS_TIME_H
15998 +/* time faking stuff */
16000 +#ifdef CONFIG_VSERVER_VTIME
16002 +extern void vx_gettimeofday(struct timeval *tv);
16003 +extern int vx_settimeofday(struct timespec *ts);
16006 +#define vx_gettimeofday(t) do_gettimeofday(t)
16007 +#define vx_settimeofday(t) do_settimeofday(t)
16011 +#warning duplicate inclusion
16013 diff -NurpP --minimal linux-2.6.35.2/include/net/addrconf.h linux-2.6.35.2-vs2.3.0.36.31/include/net/addrconf.h
16014 --- linux-2.6.35.2/include/net/addrconf.h 2010-07-07 18:31:56.000000000 +0200
16015 +++ linux-2.6.35.2-vs2.3.0.36.31/include/net/addrconf.h 2010-08-02 17:05:06.000000000 +0200
16016 @@ -84,7 +84,8 @@ extern int ipv6_dev_get_saddr(struct n
16017 struct net_device *dev,
16018 const struct in6_addr *daddr,
16019 unsigned int srcprefs,
16020 - struct in6_addr *saddr);
16021 + struct in6_addr *saddr,
16022 + struct nx_info *nxi);
16023 extern int ipv6_get_lladdr(struct net_device *dev,
16024 struct in6_addr *addr,
16025 unsigned char banned_flags);
16026 diff -NurpP --minimal linux-2.6.35.2/include/net/af_unix.h linux-2.6.35.2-vs2.3.0.36.31/include/net/af_unix.h
16027 --- linux-2.6.35.2/include/net/af_unix.h 2010-08-02 16:52:56.000000000 +0200
16028 +++ linux-2.6.35.2-vs2.3.0.36.31/include/net/af_unix.h 2010-08-02 17:05:06.000000000 +0200
16030 #include <linux/socket.h>
16031 #include <linux/un.h>
16032 #include <linux/mutex.h>
16033 +#include <linux/vs_base.h>
16034 #include <net/sock.h>
16036 extern void unix_inflight(struct file *fp);
16037 diff -NurpP --minimal linux-2.6.35.2/include/net/inet_timewait_sock.h linux-2.6.35.2-vs2.3.0.36.31/include/net/inet_timewait_sock.h
16038 --- linux-2.6.35.2/include/net/inet_timewait_sock.h 2010-08-02 16:52:56.000000000 +0200
16039 +++ linux-2.6.35.2-vs2.3.0.36.31/include/net/inet_timewait_sock.h 2010-08-02 17:05:06.000000000 +0200
16040 @@ -117,6 +117,10 @@ struct inet_timewait_sock {
16041 #define tw_hash __tw_common.skc_hash
16042 #define tw_prot __tw_common.skc_prot
16043 #define tw_net __tw_common.skc_net
16044 +#define tw_xid __tw_common.skc_xid
16045 +#define tw_vx_info __tw_common.skc_vx_info
16046 +#define tw_nid __tw_common.skc_nid
16047 +#define tw_nx_info __tw_common.skc_nx_info
16049 volatile unsigned char tw_substate;
16050 /* 3 bits hole, try to pack */
16051 diff -NurpP --minimal linux-2.6.35.2/include/net/route.h linux-2.6.35.2-vs2.3.0.36.31/include/net/route.h
16052 --- linux-2.6.35.2/include/net/route.h 2010-08-02 16:52:57.000000000 +0200
16053 +++ linux-2.6.35.2-vs2.3.0.36.31/include/net/route.h 2010-08-02 17:05:06.000000000 +0200
16054 @@ -147,6 +147,9 @@ static inline void ip_rt_put(struct rtab
16055 dst_release(&rt->u.dst);
16058 +#include <linux/vs_base.h>
16059 +#include <linux/vs_inet.h>
16061 #define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
16063 extern const __u8 ip_tos2prio[16];
16064 @@ -156,6 +159,9 @@ static inline char rt_tos2priority(u8 to
16065 return ip_tos2prio[IPTOS_TOS(tos)>>1];
16068 +extern int ip_v4_find_src(struct net *net, struct nx_info *,
16069 + struct rtable **, struct flowi *);
16071 static inline int ip_route_connect(struct rtable **rp, __be32 dst,
16072 __be32 src, u32 tos, int oif, u8 protocol,
16073 __be16 sport, __be16 dport, struct sock *sk,
16074 @@ -173,11 +179,24 @@ static inline int ip_route_connect(struc
16077 struct net *net = sock_net(sk);
16078 + struct nx_info *nx_info = current_nx_info();
16080 if (inet_sk(sk)->transparent)
16081 fl.flags |= FLOWI_FLAG_ANYSRC;
16083 - if (!dst || !src) {
16085 + nx_info = sk->sk_nx_info;
16087 + vxdprintk(VXD_CBIT(net, 4),
16088 + "ip_route_connect(%p) %p,%p;%lx",
16089 + sk, nx_info, sk->sk_socket,
16090 + (sk->sk_socket?sk->sk_socket->flags:0));
16092 + err = ip_v4_find_src(net, nx_info, rp, &fl);
16096 + if (!fl.fl4_dst || !fl.fl4_src) {
16097 err = __ip_route_output_key(net, rp, &fl);
16100 diff -NurpP --minimal linux-2.6.35.2/include/net/sock.h linux-2.6.35.2-vs2.3.0.36.31/include/net/sock.h
16101 --- linux-2.6.35.2/include/net/sock.h 2010-08-02 16:52:57.000000000 +0200
16102 +++ linux-2.6.35.2-vs2.3.0.36.31/include/net/sock.h 2010-08-02 17:05:06.000000000 +0200
16103 @@ -150,6 +150,10 @@ struct sock_common {
16104 #ifdef CONFIG_NET_NS
16105 struct net *skc_net;
16108 + struct vx_info *skc_vx_info;
16110 + struct nx_info *skc_nx_info;
16114 @@ -239,6 +243,10 @@ struct sock {
16115 #define sk_bind_node __sk_common.skc_bind_node
16116 #define sk_prot __sk_common.skc_prot
16117 #define sk_net __sk_common.skc_net
16118 +#define sk_xid __sk_common.skc_xid
16119 +#define sk_vx_info __sk_common.skc_vx_info
16120 +#define sk_nid __sk_common.skc_nid
16121 +#define sk_nx_info __sk_common.skc_nx_info
16122 kmemcheck_bitfield_begin(flags);
16123 unsigned int sk_shutdown : 2,
16125 diff -NurpP --minimal linux-2.6.35.2/init/Kconfig linux-2.6.35.2-vs2.3.0.36.31/init/Kconfig
16126 --- linux-2.6.35.2/init/Kconfig 2010-08-02 16:52:57.000000000 +0200
16127 +++ linux-2.6.35.2-vs2.3.0.36.31/init/Kconfig 2010-08-02 17:05:06.000000000 +0200
16128 @@ -472,6 +472,7 @@ config HAVE_UNSTABLE_SCHED_CLOCK
16130 boolean "Control Group support"
16134 This option adds support for grouping sets of processes together, for
16135 use with process control subsystems such as Cpusets, CFS, memory
16136 @@ -499,6 +500,7 @@ config CGROUP_DEBUG
16138 bool "Namespace cgroup subsystem"
16142 Provides a simple namespace cgroup subsystem to
16143 provide hierarchical naming of sets of namespaces,
16144 diff -NurpP --minimal linux-2.6.35.2/init/main.c linux-2.6.35.2-vs2.3.0.36.31/init/main.c
16145 --- linux-2.6.35.2/init/main.c 2010-08-02 16:52:57.000000000 +0200
16146 +++ linux-2.6.35.2-vs2.3.0.36.31/init/main.c 2010-08-02 17:05:06.000000000 +0200
16148 #include <linux/shmem_fs.h>
16149 #include <linux/slab.h>
16150 #include <trace/boot.h>
16151 +#include <linux/vserver/percpu.h>
16153 #include <asm/io.h>
16154 #include <asm/bugs.h>
16155 diff -NurpP --minimal linux-2.6.35.2/ipc/mqueue.c linux-2.6.35.2-vs2.3.0.36.31/ipc/mqueue.c
16156 --- linux-2.6.35.2/ipc/mqueue.c 2010-08-02 16:52:57.000000000 +0200
16157 +++ linux-2.6.35.2-vs2.3.0.36.31/ipc/mqueue.c 2010-08-02 17:05:06.000000000 +0200
16159 #include <linux/pid.h>
16160 #include <linux/ipc_namespace.h>
16161 #include <linux/slab.h>
16162 +#include <linux/vs_context.h>
16163 +#include <linux/vs_limit.h>
16165 #include <net/sock.h>
16167 @@ -66,6 +68,7 @@ struct mqueue_inode_info {
16168 struct sigevent notify;
16169 struct pid* notify_owner;
16170 struct user_struct *user; /* user who created, for accounting */
16171 + struct vx_info *vxi;
16172 struct sock *notify_sock;
16173 struct sk_buff *notify_cookie;
16175 @@ -125,6 +128,7 @@ static struct inode *mqueue_get_inode(st
16176 if (S_ISREG(mode)) {
16177 struct mqueue_inode_info *info;
16178 struct task_struct *p = current;
16179 + struct vx_info *vxi = p->vx_info;
16180 unsigned long mq_bytes, mq_msg_tblsz;
16182 inode->i_fop = &mqueue_file_operations;
16183 @@ -138,6 +142,7 @@ static struct inode *mqueue_get_inode(st
16184 info->notify_owner = NULL;
16186 info->user = NULL; /* set when all is ok */
16187 + info->vxi = NULL;
16188 memset(&info->attr, 0, sizeof(info->attr));
16189 info->attr.mq_maxmsg = ipc_ns->mq_msg_max;
16190 info->attr.mq_msgsize = ipc_ns->mq_msgsize_max;
16191 @@ -156,16 +161,19 @@ static struct inode *mqueue_get_inode(st
16192 spin_lock(&mq_lock);
16193 if (u->mq_bytes + mq_bytes < u->mq_bytes ||
16194 u->mq_bytes + mq_bytes >
16195 - task_rlimit(p, RLIMIT_MSGQUEUE)) {
16196 + task_rlimit(p, RLIMIT_MSGQUEUE) ||
16197 + !vx_ipcmsg_avail(vxi, mq_bytes)) {
16198 spin_unlock(&mq_lock);
16199 /* mqueue_delete_inode() releases info->messages */
16202 u->mq_bytes += mq_bytes;
16203 + vx_ipcmsg_add(vxi, u, mq_bytes);
16204 spin_unlock(&mq_lock);
16207 info->user = get_uid(u);
16208 + info->vxi = get_vx_info(vxi);
16209 } else if (S_ISDIR(mode)) {
16211 /* Some things misbehave if size == 0 on a directory */
16212 @@ -268,8 +276,11 @@ static void mqueue_delete_inode(struct i
16213 + info->attr.mq_msgsize);
16216 + struct vx_info *vxi = info->vxi;
16218 spin_lock(&mq_lock);
16219 user->mq_bytes -= mq_bytes;
16220 + vx_ipcmsg_sub(vxi, user, mq_bytes);
16222 * get_ns_from_inode() ensures that the
16223 * (ipc_ns = sb->s_fs_info) is either a valid ipc_ns
16224 @@ -279,6 +290,7 @@ static void mqueue_delete_inode(struct i
16226 ipc_ns->mq_queues_count--;
16227 spin_unlock(&mq_lock);
16228 + put_vx_info(vxi);
16232 diff -NurpP --minimal linux-2.6.35.2/ipc/msg.c linux-2.6.35.2-vs2.3.0.36.31/ipc/msg.c
16233 --- linux-2.6.35.2/ipc/msg.c 2010-08-02 16:52:57.000000000 +0200
16234 +++ linux-2.6.35.2-vs2.3.0.36.31/ipc/msg.c 2010-08-02 17:05:06.000000000 +0200
16236 #include <linux/rwsem.h>
16237 #include <linux/nsproxy.h>
16238 #include <linux/ipc_namespace.h>
16239 +#include <linux/vs_base.h>
16241 #include <asm/current.h>
16242 #include <asm/uaccess.h>
16243 @@ -190,6 +191,7 @@ static int newque(struct ipc_namespace *
16245 msq->q_perm.mode = msgflg & S_IRWXUGO;
16246 msq->q_perm.key = key;
16247 + msq->q_perm.xid = vx_current_xid();
16249 msq->q_perm.security = NULL;
16250 retval = security_msg_queue_alloc(msq);
16251 diff -NurpP --minimal linux-2.6.35.2/ipc/namespace.c linux-2.6.35.2-vs2.3.0.36.31/ipc/namespace.c
16252 --- linux-2.6.35.2/ipc/namespace.c 2009-09-10 15:26:27.000000000 +0200
16253 +++ linux-2.6.35.2-vs2.3.0.36.31/ipc/namespace.c 2010-08-02 17:05:06.000000000 +0200
16255 #include <linux/slab.h>
16256 #include <linux/fs.h>
16257 #include <linux/mount.h>
16258 +#include <linux/vs_base.h>
16259 +#include <linux/vserver/global.h>
16263 diff -NurpP --minimal linux-2.6.35.2/ipc/sem.c linux-2.6.35.2-vs2.3.0.36.31/ipc/sem.c
16264 --- linux-2.6.35.2/ipc/sem.c 2010-08-02 16:52:57.000000000 +0200
16265 +++ linux-2.6.35.2-vs2.3.0.36.31/ipc/sem.c 2010-08-02 17:05:06.000000000 +0200
16267 #include <linux/rwsem.h>
16268 #include <linux/nsproxy.h>
16269 #include <linux/ipc_namespace.h>
16270 +#include <linux/vs_base.h>
16271 +#include <linux/vs_limit.h>
16273 #include <asm/uaccess.h>
16275 @@ -260,6 +262,7 @@ static int newary(struct ipc_namespace *
16277 sma->sem_perm.mode = (semflg & S_IRWXUGO);
16278 sma->sem_perm.key = key;
16279 + sma->sem_perm.xid = vx_current_xid();
16281 sma->sem_perm.security = NULL;
16282 retval = security_sem_alloc(sma);
16283 @@ -275,6 +278,9 @@ static int newary(struct ipc_namespace *
16286 ns->used_sems += nsems;
16287 + /* FIXME: obsoleted? */
16288 + vx_semary_inc(sma);
16289 + vx_nsems_add(sma, nsems);
16291 sma->sem_base = (struct sem *) &sma[1];
16293 @@ -730,6 +736,9 @@ static void freeary(struct ipc_namespace
16295 wake_up_sem_queue_do(&tasks);
16296 ns->used_sems -= sma->sem_nsems;
16297 + /* FIXME: obsoleted? */
16298 + vx_nsems_sub(sma, sma->sem_nsems);
16299 + vx_semary_dec(sma);
16300 security_sem_free(sma);
16301 ipc_rcu_putref(sma);
16303 diff -NurpP --minimal linux-2.6.35.2/ipc/shm.c linux-2.6.35.2-vs2.3.0.36.31/ipc/shm.c
16304 --- linux-2.6.35.2/ipc/shm.c 2010-08-02 16:52:57.000000000 +0200
16305 +++ linux-2.6.35.2-vs2.3.0.36.31/ipc/shm.c 2010-08-02 17:05:06.000000000 +0200
16307 #include <linux/nsproxy.h>
16308 #include <linux/mount.h>
16309 #include <linux/ipc_namespace.h>
16310 +#include <linux/vs_context.h>
16311 +#include <linux/vs_limit.h>
16313 #include <asm/uaccess.h>
16315 @@ -169,7 +171,12 @@ static void shm_open(struct vm_area_stru
16317 static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
16319 - ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
16320 + struct vx_info *vxi = lookup_vx_info(shp->shm_perm.xid);
16321 + int numpages = (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
16323 + vx_ipcshm_sub(vxi, shp, numpages);
16324 + ns->shm_tot -= numpages;
16328 if (!is_file_hugepages(shp->shm_file))
16329 @@ -179,6 +186,7 @@ static void shm_destroy(struct ipc_names
16331 fput (shp->shm_file);
16332 security_shm_free(shp);
16333 + put_vx_info(vxi);
16334 ipc_rcu_putref(shp);
16337 @@ -349,11 +357,15 @@ static int newseg(struct ipc_namespace *
16338 if (ns->shm_tot + numpages > ns->shm_ctlall)
16341 + if (!vx_ipcshm_avail(current_vx_info(), numpages))
16344 shp = ipc_rcu_alloc(sizeof(*shp));
16348 shp->shm_perm.key = key;
16349 + shp->shm_perm.xid = vx_current_xid();
16350 shp->shm_perm.mode = (shmflg & S_IRWXUGO);
16351 shp->mlock_user = NULL;
16353 @@ -407,6 +419,7 @@ static int newseg(struct ipc_namespace *
16354 ns->shm_tot += numpages;
16355 error = shp->shm_perm.id;
16357 + vx_ipcshm_add(current_vx_info(), key, numpages);
16361 diff -NurpP --minimal linux-2.6.35.2/kernel/capability.c linux-2.6.35.2-vs2.3.0.36.31/kernel/capability.c
16362 --- linux-2.6.35.2/kernel/capability.c 2010-08-02 16:52:57.000000000 +0200
16363 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/capability.c 2010-08-02 17:05:06.000000000 +0200
16365 #include <linux/security.h>
16366 #include <linux/syscalls.h>
16367 #include <linux/pid_namespace.h>
16368 +#include <linux/vs_context.h>
16369 #include <asm/uaccess.h>
16372 @@ -119,6 +120,7 @@ static int cap_validate_magic(cap_user_h
16378 * The only thing that can change the capabilities of the current
16379 * process is the current process. As such, we can't be in this code
16380 @@ -289,6 +291,8 @@ error:
16384 +#include <linux/vserver/base.h>
16387 * capable - Determine if the current task has a superior capability in effect
16388 * @cap: The capability to be tested for
16389 @@ -301,6 +305,9 @@ error:
16391 int capable(int cap)
16393 + /* here for now so we don't require task locking */
16394 + if (vs_check_bit(VXC_CAP_MASK, cap) && !vx_mcaps(1L << cap))
16396 if (unlikely(!cap_valid(cap))) {
16397 printk(KERN_CRIT "capable() called with invalid cap=%u\n", cap);
16399 diff -NurpP --minimal linux-2.6.35.2/kernel/compat.c linux-2.6.35.2-vs2.3.0.36.31/kernel/compat.c
16400 --- linux-2.6.35.2/kernel/compat.c 2010-08-02 16:52:57.000000000 +0200
16401 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/compat.c 2010-08-02 17:05:06.000000000 +0200
16402 @@ -900,7 +900,7 @@ asmlinkage long compat_sys_time(compat_t
16406 - do_gettimeofday(&tv);
16407 + vx_gettimeofday(&tv);
16411 @@ -925,7 +925,7 @@ asmlinkage long compat_sys_stime(compat_
16415 - do_settimeofday(&tv);
16416 + vx_settimeofday(&tv);
16420 diff -NurpP --minimal linux-2.6.35.2/kernel/exit.c linux-2.6.35.2-vs2.3.0.36.31/kernel/exit.c
16421 --- linux-2.6.35.2/kernel/exit.c 2010-08-02 16:52:57.000000000 +0200
16422 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/exit.c 2010-08-02 17:05:06.000000000 +0200
16424 #include <linux/fs_struct.h>
16425 #include <linux/init_task.h>
16426 #include <linux/perf_event.h>
16427 +#include <linux/vs_limit.h>
16428 +#include <linux/vs_context.h>
16429 +#include <linux/vs_network.h>
16430 +#include <linux/vs_pid.h>
16431 #include <trace/events/sched.h>
16432 #include <linux/hw_breakpoint.h>
16434 @@ -487,9 +491,11 @@ static void close_files(struct files_str
16435 filp_close(file, files);
16438 + vx_openfd_dec(i);
16446 @@ -1020,11 +1026,16 @@ NORET_TYPE void do_exit(long code)
16448 validate_creds_for_do_exit(tsk);
16450 + /* needs to stay after exit_notify() */
16451 + exit_vx_info(tsk, code);
16452 + exit_nx_info(tsk);
16456 /* causes final put_task_struct in finish_task_switch(). */
16457 tsk->state = TASK_DEAD;
16459 + printk("bad task: %p [%lx]\n", current, current->state);
16461 /* Avoid "noreturn function does return". */
16463 diff -NurpP --minimal linux-2.6.35.2/kernel/fork.c linux-2.6.35.2-vs2.3.0.36.31/kernel/fork.c
16464 --- linux-2.6.35.2/kernel/fork.c 2010-08-02 16:52:57.000000000 +0200
16465 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/fork.c 2010-08-02 17:05:06.000000000 +0200
16467 #include <linux/perf_event.h>
16468 #include <linux/posix-timers.h>
16469 #include <linux/user-return-notifier.h>
16470 +#include <linux/vs_context.h>
16471 +#include <linux/vs_network.h>
16472 +#include <linux/vs_limit.h>
16473 +#include <linux/vs_memory.h>
16475 #include <asm/pgtable.h>
16476 #include <asm/pgalloc.h>
16477 @@ -160,6 +164,8 @@ void free_task(struct task_struct *tsk)
16478 account_kernel_stack(tsk->stack, -1);
16479 free_thread_info(tsk->stack);
16480 rt_mutex_debug_task_free(tsk);
16481 + clr_vx_info(&tsk->vx_info);
16482 + clr_nx_info(&tsk->nx_info);
16483 ftrace_graph_exit_task(tsk);
16484 free_task_struct(tsk);
16486 @@ -489,6 +495,7 @@ static struct mm_struct * mm_init(struct
16487 if (likely(!mm_alloc_pgd(mm))) {
16489 mmu_notifier_mm_init(mm);
16490 + set_vx_info(&mm->mm_vx_info, p->vx_info);
16494 @@ -522,6 +529,7 @@ void __mmdrop(struct mm_struct *mm)
16496 destroy_context(mm);
16497 mmu_notifier_mm_destroy(mm);
16498 + clr_vx_info(&mm->mm_vx_info);
16501 EXPORT_SYMBOL_GPL(__mmdrop);
16502 @@ -657,6 +665,7 @@ struct mm_struct *dup_mm(struct task_str
16505 memcpy(mm, oldmm, sizeof(*mm));
16506 + mm->mm_vx_info = NULL;
16508 /* Initializing for Swap token stuff */
16509 mm->token_priority = 0;
16510 @@ -695,6 +704,7 @@ fail_nocontext:
16511 * If init_new_context() failed, we cannot use mmput() to free the mm
16512 * because it calls destroy_context()
16514 + clr_vx_info(&mm->mm_vx_info);
16518 @@ -969,6 +979,8 @@ static struct task_struct *copy_process(
16520 struct task_struct *p;
16521 int cgroup_callbacks_done = 0;
16522 + struct vx_info *vxi;
16523 + struct nx_info *nxi;
16525 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
16526 return ERR_PTR(-EINVAL);
16527 @@ -1015,7 +1027,12 @@ static struct task_struct *copy_process(
16528 DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
16529 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
16531 + init_vx_info(&p->vx_info, current_vx_info());
16532 + init_nx_info(&p->nx_info, current_nx_info());
16535 + if (!vx_nproc_avail(1))
16536 + goto bad_fork_free;
16537 if (atomic_read(&p->real_cred->user->processes) >=
16538 task_rlimit(p, RLIMIT_NPROC)) {
16539 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
16540 @@ -1280,6 +1297,18 @@ static struct task_struct *copy_process(
16543 spin_unlock(¤t->sighand->siglock);
16545 + /* p is copy of current */
16546 + vxi = p->vx_info;
16548 + claim_vx_info(vxi, p);
16549 + atomic_inc(&vxi->cvirt.nr_threads);
16550 + atomic_inc(&vxi->cvirt.total_forks);
16553 + nxi = p->nx_info;
16555 + claim_nx_info(nxi, p);
16556 write_unlock_irq(&tasklist_lock);
16557 proc_fork_connector(p);
16558 cgroup_post_fork(p);
16559 diff -NurpP --minimal linux-2.6.35.2/kernel/kthread.c linux-2.6.35.2-vs2.3.0.36.31/kernel/kthread.c
16560 --- linux-2.6.35.2/kernel/kthread.c 2010-07-07 18:31:57.000000000 +0200
16561 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/kthread.c 2010-08-02 17:05:06.000000000 +0200
16563 #include <linux/file.h>
16564 #include <linux/module.h>
16565 #include <linux/mutex.h>
16566 +#include <linux/vs_pid.h>
16567 #include <trace/events/sched.h>
16569 static DEFINE_SPINLOCK(kthread_create_lock);
16570 diff -NurpP --minimal linux-2.6.35.2/kernel/Makefile linux-2.6.35.2-vs2.3.0.36.31/kernel/Makefile
16571 --- linux-2.6.35.2/kernel/Makefile 2010-08-02 16:52:57.000000000 +0200
16572 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/Makefile 2010-08-02 17:05:06.000000000 +0200
16573 @@ -25,6 +25,7 @@ CFLAGS_REMOVE_sched_clock.o = -pg
16574 CFLAGS_REMOVE_perf_event.o = -pg
16578 obj-$(CONFIG_FREEZER) += freezer.o
16579 obj-$(CONFIG_PROFILING) += profile.o
16580 obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
16581 diff -NurpP --minimal linux-2.6.35.2/kernel/nsproxy.c linux-2.6.35.2-vs2.3.0.36.31/kernel/nsproxy.c
16582 --- linux-2.6.35.2/kernel/nsproxy.c 2010-07-07 18:31:57.000000000 +0200
16583 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/nsproxy.c 2010-08-02 17:05:06.000000000 +0200
16585 #include <linux/mnt_namespace.h>
16586 #include <linux/utsname.h>
16587 #include <linux/pid_namespace.h>
16588 +#include <linux/vserver/global.h>
16589 +#include <linux/vserver/debug.h>
16590 #include <net/net_namespace.h>
16591 #include <linux/ipc_namespace.h>
16593 @@ -43,8 +45,11 @@ static inline struct nsproxy *create_nsp
16594 struct nsproxy *nsproxy;
16596 nsproxy = kmem_cache_alloc(nsproxy_cachep, GFP_KERNEL);
16599 atomic_set(&nsproxy->count, 1);
16600 + atomic_inc(&vs_global_nsproxy);
16602 + vxdprintk(VXD_CBIT(space, 2), "create_nsproxy = %p[1]", nsproxy);
16606 @@ -53,41 +58,52 @@ static inline struct nsproxy *create_nsp
16607 * Return the newly created nsproxy. Do not attach this to the task,
16608 * leave it to the caller to do proper locking and attach it to task.
16610 -static struct nsproxy *create_new_namespaces(unsigned long flags,
16611 - struct task_struct *tsk, struct fs_struct *new_fs)
16612 +static struct nsproxy *unshare_namespaces(unsigned long flags,
16613 + struct nsproxy *orig, struct fs_struct *new_fs)
16615 struct nsproxy *new_nsp;
16618 + vxdprintk(VXD_CBIT(space, 4),
16619 + "unshare_namespaces(0x%08lx,%p,%p)",
16620 + flags, orig, new_fs);
16622 new_nsp = create_nsproxy();
16624 return ERR_PTR(-ENOMEM);
16626 - new_nsp->mnt_ns = copy_mnt_ns(flags, tsk->nsproxy->mnt_ns, new_fs);
16627 + new_nsp->mnt_ns = copy_mnt_ns(flags, orig->mnt_ns, new_fs);
16628 if (IS_ERR(new_nsp->mnt_ns)) {
16629 err = PTR_ERR(new_nsp->mnt_ns);
16633 - new_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns);
16634 + new_nsp->uts_ns = copy_utsname(flags, orig->uts_ns);
16635 if (IS_ERR(new_nsp->uts_ns)) {
16636 err = PTR_ERR(new_nsp->uts_ns);
16640 - new_nsp->ipc_ns = copy_ipcs(flags, tsk->nsproxy->ipc_ns);
16641 + new_nsp->ipc_ns = copy_ipcs(flags, orig->ipc_ns);
16642 if (IS_ERR(new_nsp->ipc_ns)) {
16643 err = PTR_ERR(new_nsp->ipc_ns);
16647 - new_nsp->pid_ns = copy_pid_ns(flags, task_active_pid_ns(tsk));
16648 + new_nsp->pid_ns = copy_pid_ns(flags, orig->pid_ns);
16649 if (IS_ERR(new_nsp->pid_ns)) {
16650 err = PTR_ERR(new_nsp->pid_ns);
16654 - new_nsp->net_ns = copy_net_ns(flags, tsk->nsproxy->net_ns);
16656 + new_nsp->user_ns = copy_user_ns(flags, orig->user_ns);
16657 + if (IS_ERR(new_nsp->user_ns)) {
16658 + err = PTR_ERR(new_nsp->user_ns);
16662 + new_nsp->net_ns = copy_net_ns(flags, orig->net_ns);
16663 if (IS_ERR(new_nsp->net_ns)) {
16664 err = PTR_ERR(new_nsp->net_ns);
16666 @@ -112,6 +128,38 @@ out_ns:
16667 return ERR_PTR(err);
16670 +static struct nsproxy *create_new_namespaces(int flags, struct task_struct *tsk,
16671 + struct fs_struct *new_fs)
16673 + return unshare_namespaces(flags, tsk->nsproxy, new_fs);
16677 + * copies the nsproxy, setting refcount to 1, and grabbing a
16678 + * reference to all contained namespaces.
16680 +struct nsproxy *copy_nsproxy(struct nsproxy *orig)
16682 + struct nsproxy *ns = create_nsproxy();
16685 + memcpy(ns, orig, sizeof(struct nsproxy));
16686 + atomic_set(&ns->count, 1);
16689 + get_mnt_ns(ns->mnt_ns);
16691 + get_uts_ns(ns->uts_ns);
16693 + get_ipc_ns(ns->ipc_ns);
16695 + get_pid_ns(ns->pid_ns);
16697 + get_net(ns->net_ns);
16703 * called from clone. This now handles copy for nsproxy and all
16704 * namespaces therein.
16705 @@ -119,9 +167,12 @@ out_ns:
16706 int copy_namespaces(unsigned long flags, struct task_struct *tsk)
16708 struct nsproxy *old_ns = tsk->nsproxy;
16709 - struct nsproxy *new_ns;
16710 + struct nsproxy *new_ns = NULL;
16713 + vxdprintk(VXD_CBIT(space, 7), "copy_namespaces(0x%08lx,%p[%p])",
16714 + flags, tsk, old_ns);
16719 @@ -131,7 +182,7 @@ int copy_namespaces(unsigned long flags,
16720 CLONE_NEWPID | CLONE_NEWNET)))
16723 - if (!capable(CAP_SYS_ADMIN)) {
16724 + if (!vx_can_unshare(CAP_SYS_ADMIN, flags)) {
16728 @@ -158,6 +209,9 @@ int copy_namespaces(unsigned long flags,
16731 put_nsproxy(old_ns);
16732 + vxdprintk(VXD_CBIT(space, 3),
16733 + "copy_namespaces(0x%08lx,%p[%p]) = %d [%p]",
16734 + flags, tsk, old_ns, err, new_ns);
16738 @@ -171,7 +225,9 @@ void free_nsproxy(struct nsproxy *ns)
16739 put_ipc_ns(ns->ipc_ns);
16741 put_pid_ns(ns->pid_ns);
16742 - put_net(ns->net_ns);
16744 + put_net(ns->net_ns);
16745 + atomic_dec(&vs_global_nsproxy);
16746 kmem_cache_free(nsproxy_cachep, ns);
16749 @@ -184,11 +240,15 @@ int unshare_nsproxy_namespaces(unsigned
16753 + vxdprintk(VXD_CBIT(space, 4),
16754 + "unshare_nsproxy_namespaces(0x%08lx,[%p])",
16755 + unshare_flags, current->nsproxy);
16757 if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
16761 - if (!capable(CAP_SYS_ADMIN))
16762 + if (!vx_can_unshare(CAP_SYS_ADMIN, unshare_flags))
16765 *new_nsp = create_new_namespaces(unshare_flags, current,
16766 diff -NurpP --minimal linux-2.6.35.2/kernel/pid.c linux-2.6.35.2-vs2.3.0.36.31/kernel/pid.c
16767 --- linux-2.6.35.2/kernel/pid.c 2010-08-02 16:52:57.000000000 +0200
16768 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/pid.c 2010-08-02 17:05:06.000000000 +0200
16770 #include <linux/pid_namespace.h>
16771 #include <linux/init_task.h>
16772 #include <linux/syscalls.h>
16773 +#include <linux/vs_pid.h>
16775 #define pid_hashfn(nr, ns) \
16776 hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift)
16777 @@ -305,7 +306,7 @@ EXPORT_SYMBOL_GPL(find_pid_ns);
16779 struct pid *find_vpid(int nr)
16781 - return find_pid_ns(nr, current->nsproxy->pid_ns);
16782 + return find_pid_ns(vx_rmap_pid(nr), current->nsproxy->pid_ns);
16784 EXPORT_SYMBOL_GPL(find_vpid);
16786 @@ -365,6 +366,9 @@ void transfer_pid(struct task_struct *ol
16787 struct task_struct *pid_task(struct pid *pid, enum pid_type type)
16789 struct task_struct *result = NULL;
16791 + if (type == PIDTYPE_REALPID)
16792 + type = PIDTYPE_PID;
16794 struct hlist_node *first;
16795 first = rcu_dereference_check(pid->tasks[type].first,
16796 @@ -382,7 +386,7 @@ EXPORT_SYMBOL(pid_task);
16798 struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
16800 - return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
16801 + return pid_task(find_pid_ns(vx_rmap_pid(nr), ns), PIDTYPE_PID);
16804 struct task_struct *find_task_by_vpid(pid_t vnr)
16805 @@ -424,7 +428,7 @@ struct pid *find_get_pid(pid_t nr)
16807 EXPORT_SYMBOL_GPL(find_get_pid);
16809 -pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
16810 +pid_t pid_unmapped_nr_ns(struct pid *pid, struct pid_namespace *ns)
16814 @@ -437,6 +441,11 @@ pid_t pid_nr_ns(struct pid *pid, struct
16818 +pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
16820 + return vx_map_pid(pid_unmapped_nr_ns(pid, ns));
16823 pid_t pid_vnr(struct pid *pid)
16825 return pid_nr_ns(pid, current->nsproxy->pid_ns);
16826 diff -NurpP --minimal linux-2.6.35.2/kernel/pid_namespace.c linux-2.6.35.2-vs2.3.0.36.31/kernel/pid_namespace.c
16827 --- linux-2.6.35.2/kernel/pid_namespace.c 2010-07-07 18:31:57.000000000 +0200
16828 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/pid_namespace.c 2010-08-02 17:05:06.000000000 +0200
16830 #include <linux/err.h>
16831 #include <linux/acct.h>
16832 #include <linux/slab.h>
16833 +#include <linux/vserver/global.h>
16835 #define BITS_PER_PAGE (PAGE_SIZE*8)
16837 @@ -87,6 +88,7 @@ static struct pid_namespace *create_pid_
16840 kref_init(&ns->kref);
16841 + atomic_inc(&vs_global_pid_ns);
16843 ns->parent = get_pid_ns(parent_pid_ns);
16845 @@ -112,6 +114,7 @@ static void destroy_pid_namespace(struct
16847 for (i = 0; i < PIDMAP_ENTRIES; i++)
16848 kfree(ns->pidmap[i].page);
16849 + atomic_dec(&vs_global_pid_ns);
16850 kmem_cache_free(pid_ns_cachep, ns);
16853 diff -NurpP --minimal linux-2.6.35.2/kernel/posix-timers.c linux-2.6.35.2-vs2.3.0.36.31/kernel/posix-timers.c
16854 --- linux-2.6.35.2/kernel/posix-timers.c 2010-08-02 16:52:57.000000000 +0200
16855 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/posix-timers.c 2010-08-02 17:05:06.000000000 +0200
16857 #include <linux/wait.h>
16858 #include <linux/workqueue.h>
16859 #include <linux/module.h>
16860 +#include <linux/vs_context.h>
16863 * Management arrays for POSIX timers. Timers are kept in slab memory
16864 @@ -363,6 +364,7 @@ int posix_timer_event(struct k_itimer *t
16866 struct task_struct *task;
16867 int shared, ret = -1;
16870 * FIXME: if ->sigq is queued we can race with
16871 * dequeue_signal()->do_schedule_next_timer().
16872 @@ -379,10 +381,18 @@ int posix_timer_event(struct k_itimer *t
16874 task = pid_task(timr->it_pid, PIDTYPE_PID);
16876 + struct vx_info_save vxis;
16877 + struct vx_info *vxi;
16879 + vxi = get_vx_info(task->vx_info);
16880 + enter_vx_info(vxi, &vxis);
16881 shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
16882 ret = send_sigqueue(timr->sigq, task, shared);
16883 + leave_vx_info(&vxis);
16884 + put_vx_info(vxi);
16888 /* If we failed to send the signal the timer stops. */
16891 diff -NurpP --minimal linux-2.6.35.2/kernel/printk.c linux-2.6.35.2-vs2.3.0.36.31/kernel/printk.c
16892 --- linux-2.6.35.2/kernel/printk.c 2010-08-02 16:52:57.000000000 +0200
16893 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/printk.c 2010-08-02 17:05:06.000000000 +0200
16895 #include <linux/ratelimit.h>
16896 #include <linux/kmsg_dump.h>
16897 #include <linux/syslog.h>
16898 +#include <linux/vs_cvirt.h>
16900 #include <asm/uaccess.h>
16902 @@ -264,18 +265,15 @@ int do_syslog(int type, char __user *buf
16903 unsigned i, j, limit, count;
16909 error = security_syslog(type, from_file);
16914 - case SYSLOG_ACTION_CLOSE: /* Close log */
16916 - case SYSLOG_ACTION_OPEN: /* Open log */
16918 - case SYSLOG_ACTION_READ: /* Read from log */
16919 + if ((type == SYSLOG_ACTION_READ) ||
16920 + (type == SYSLOG_ACTION_READ_ALL) ||
16921 + (type == SYSLOG_ACTION_READ_CLEAR)) {
16923 if (!buf || len < 0)
16925 @@ -286,6 +284,16 @@ int do_syslog(int type, char __user *buf
16930 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
16931 + return vx_do_syslog(type, buf, len);
16934 + case SYSLOG_ACTION_CLOSE: /* Close log */
16936 + case SYSLOG_ACTION_OPEN: /* Open log */
16938 + case SYSLOG_ACTION_READ: /* Read from log */
16939 error = wait_event_interruptible(log_wait,
16940 (log_start - log_end));
16942 @@ -312,16 +320,6 @@ int do_syslog(int type, char __user *buf
16944 /* Read last kernel messages */
16945 case SYSLOG_ACTION_READ_ALL:
16947 - if (!buf || len < 0)
16952 - if (!access_ok(VERIFY_WRITE, buf, len)) {
16957 if (count > log_buf_len)
16958 count = log_buf_len;
16959 diff -NurpP --minimal linux-2.6.35.2/kernel/ptrace.c linux-2.6.35.2-vs2.3.0.36.31/kernel/ptrace.c
16960 --- linux-2.6.35.2/kernel/ptrace.c 2010-08-02 16:52:57.000000000 +0200
16961 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/ptrace.c 2010-08-02 17:05:06.000000000 +0200
16963 #include <linux/syscalls.h>
16964 #include <linux/uaccess.h>
16965 #include <linux/regset.h>
16966 +#include <linux/vs_context.h>
16970 @@ -150,6 +151,11 @@ int __ptrace_may_access(struct task_stru
16971 dumpable = get_dumpable(task->mm);
16972 if (!dumpable && !capable(CAP_SYS_PTRACE))
16974 + if (!vx_check(task->xid, VS_ADMIN_P|VS_IDENT))
16976 + if (!vx_check(task->xid, VS_IDENT) &&
16977 + !task_vx_flags(task, VXF_STATE_ADMIN, 0))
16980 return security_ptrace_access_check(task, mode);
16982 @@ -703,6 +709,10 @@ SYSCALL_DEFINE4(ptrace, long, request, l
16987 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
16988 + goto out_put_task_struct;
16990 if (request == PTRACE_ATTACH) {
16991 ret = ptrace_attach(child);
16993 diff -NurpP --minimal linux-2.6.35.2/kernel/sched.c linux-2.6.35.2-vs2.3.0.36.31/kernel/sched.c
16994 --- linux-2.6.35.2/kernel/sched.c 2010-08-14 18:16:59.000000000 +0200
16995 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/sched.c 2010-08-14 18:19:32.000000000 +0200
16997 #include <linux/ctype.h>
16998 #include <linux/ftrace.h>
16999 #include <linux/slab.h>
17000 +#include <linux/vs_sched.h>
17001 +#include <linux/vs_cvirt.h>
17003 #include <asm/tlb.h>
17004 #include <asm/irq_regs.h>
17005 @@ -2947,9 +2949,17 @@ static inline long calc_load_fold_idle(v
17007 void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
17009 - loads[0] = (avenrun[0] + offset) << shift;
17010 - loads[1] = (avenrun[1] + offset) << shift;
17011 - loads[2] = (avenrun[2] + offset) << shift;
17012 + if (vx_flags(VXF_VIRT_LOAD, 0)) {
17013 + struct vx_info *vxi = current_vx_info();
17015 + loads[0] = (vxi->cvirt.load[0] + offset) << shift;
17016 + loads[1] = (vxi->cvirt.load[1] + offset) << shift;
17017 + loads[2] = (vxi->cvirt.load[2] + offset) << shift;
17019 + loads[0] = (avenrun[0] + offset) << shift;
17020 + loads[1] = (avenrun[1] + offset) << shift;
17021 + loads[2] = (avenrun[2] + offset) << shift;
17025 static unsigned long
17026 @@ -3157,16 +3167,19 @@ void account_user_time(struct task_struc
17027 cputime_t cputime_scaled)
17029 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
17030 + struct vx_info *vxi = p->vx_info; /* p is _always_ current */
17032 + int nice = (TASK_NICE(p) > 0);
17034 /* Add user time to process. */
17035 p->utime = cputime_add(p->utime, cputime);
17036 p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
17037 + vx_account_user(vxi, cputime, nice);
17038 account_group_user_time(p, cputime);
17040 /* Add user time to cpustat. */
17041 tmp = cputime_to_cputime64(cputime);
17042 - if (TASK_NICE(p) > 0)
17044 cpustat->nice = cputime64_add(cpustat->nice, tmp);
17046 cpustat->user = cputime64_add(cpustat->user, tmp);
17047 @@ -3217,6 +3230,7 @@ void account_system_time(struct task_str
17048 cputime_t cputime, cputime_t cputime_scaled)
17050 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
17051 + struct vx_info *vxi = p->vx_info; /* p is _always_ current */
17054 if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
17055 @@ -3227,6 +3241,7 @@ void account_system_time(struct task_str
17056 /* Add system time to process. */
17057 p->stime = cputime_add(p->stime, cputime);
17058 p->stimescaled = cputime_add(p->stimescaled, cputime_scaled);
17059 + vx_account_system(vxi, cputime, 0 /* do we have idle time? */);
17060 account_group_system_time(p, cputime);
17062 /* Add system time to cpustat. */
17063 @@ -4292,7 +4307,7 @@ SYSCALL_DEFINE1(nice, int, increment)
17066 if (increment < 0 && !can_nice(current, nice))
17068 + return vx_flags(VXF_IGNEG_NICE, 0) ? 0 : -EPERM;
17070 retval = security_task_setnice(current, nice);
17072 diff -NurpP --minimal linux-2.6.35.2/kernel/sched_fair.c linux-2.6.35.2-vs2.3.0.36.31/kernel/sched_fair.c
17073 --- linux-2.6.35.2/kernel/sched_fair.c 2010-08-02 16:52:57.000000000 +0200
17074 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/sched_fair.c 2010-08-02 17:05:06.000000000 +0200
17075 @@ -782,6 +782,9 @@ enqueue_entity(struct cfs_rq *cfs_rq, st
17076 check_spread(cfs_rq, se);
17077 if (se != cfs_rq->curr)
17078 __enqueue_entity(cfs_rq, se);
17080 + if (entity_is_task(se))
17081 + vx_activate_task(task_of(se));
17084 static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
17085 @@ -825,6 +828,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
17087 if (se != cfs_rq->curr)
17088 __dequeue_entity(cfs_rq, se);
17089 + if (entity_is_task(se))
17090 + vx_deactivate_task(task_of(se));
17091 account_entity_dequeue(cfs_rq, se);
17092 update_min_vruntime(cfs_rq);
17094 diff -NurpP --minimal linux-2.6.35.2/kernel/signal.c linux-2.6.35.2-vs2.3.0.36.31/kernel/signal.c
17095 --- linux-2.6.35.2/kernel/signal.c 2010-08-14 18:16:59.000000000 +0200
17096 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/signal.c 2010-08-14 18:19:32.000000000 +0200
17098 #include <linux/freezer.h>
17099 #include <linux/pid_namespace.h>
17100 #include <linux/nsproxy.h>
17101 +#include <linux/vs_context.h>
17102 +#include <linux/vs_pid.h>
17103 #define CREATE_TRACE_POINTS
17104 #include <trace/events/signal.h>
17106 @@ -646,9 +648,18 @@ static int check_kill_permission(int sig
17110 + vxdprintk(VXD_CBIT(misc, 7),
17111 + "check_kill_permission(%d,%p,%p[#%u,%u])",
17112 + sig, info, t, vx_task_xid(t), t->pid);
17114 if (!valid_signal(sig))
17117 +/* FIXME: needed? if so, why?
17118 + if ((info != SEND_SIG_NOINFO) &&
17119 + (is_si_special(info) || !si_fromuser(info)))
17122 if (!si_fromuser(info))
17125 @@ -678,6 +689,20 @@ static int check_kill_permission(int sig
17130 + if (t->pid == 1 && current->xid)
17134 + /* FIXME: we shouldn't return ESRCH ever, to avoid
17135 + loops, maybe ENOENT or EACCES? */
17136 + if (!vx_check(vx_task_xid(t), VS_WATCH_P | VS_IDENT)) {
17137 + vxdprintk(current->xid || VXD_CBIT(misc, 7),
17138 + "signal %d[%p] xid mismatch %p[#%u,%u] xid=#%u",
17139 + sig, info, t, vx_task_xid(t), t->pid, current->xid);
17143 return security_task_kill(t, info, sig, 0);
17146 @@ -1170,7 +1195,7 @@ int kill_pid_info(int sig, struct siginf
17149 p = pid_task(pid, PIDTYPE_PID);
17151 + if (p && vx_check(vx_task_xid(p), VS_IDENT)) {
17152 error = group_send_sig_info(sig, info, p);
17153 if (unlikely(error == -ESRCH))
17155 @@ -1210,7 +1235,7 @@ int kill_pid_info_as_uid(int sig, struct
17158 p = pid_task(pid, PIDTYPE_PID);
17160 + if (!p || !vx_check(vx_task_xid(p), VS_IDENT)) {
17164 @@ -1265,8 +1290,10 @@ static int kill_something_info(int sig,
17165 struct task_struct * p;
17167 for_each_process(p) {
17168 - if (task_pid_vnr(p) > 1 &&
17169 - !same_thread_group(p, current)) {
17170 + if (vx_check(vx_task_xid(p), VS_ADMIN|VS_IDENT) &&
17171 + task_pid_vnr(p) > 1 &&
17172 + !same_thread_group(p, current) &&
17173 + !vx_current_initpid(p->pid)) {
17174 int err = group_send_sig_info(sig, info, p);
17177 @@ -1933,6 +1960,11 @@ relock:
17178 !sig_kernel_only(signr))
17181 + /* virtual init is protected against user signals */
17182 + if ((info->si_code == SI_USER) &&
17183 + vx_current_initpid(current->pid))
17186 if (sig_kernel_stop(signr)) {
17188 * The default action is to stop all threads in
17189 diff -NurpP --minimal linux-2.6.35.2/kernel/softirq.c linux-2.6.35.2-vs2.3.0.36.31/kernel/softirq.c
17190 --- linux-2.6.35.2/kernel/softirq.c 2010-08-02 16:52:57.000000000 +0200
17191 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/softirq.c 2010-08-02 17:05:06.000000000 +0200
17193 #include <linux/ftrace.h>
17194 #include <linux/smp.h>
17195 #include <linux/tick.h>
17196 +#include <linux/vs_context.h>
17198 #define CREATE_TRACE_POINTS
17199 #include <trace/events/irq.h>
17200 diff -NurpP --minimal linux-2.6.35.2/kernel/sys.c linux-2.6.35.2-vs2.3.0.36.31/kernel/sys.c
17201 --- linux-2.6.35.2/kernel/sys.c 2010-08-02 16:52:57.000000000 +0200
17202 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/sys.c 2010-08-02 17:48:19.000000000 +0200
17204 #include <linux/syscalls.h>
17205 #include <linux/kprobes.h>
17206 #include <linux/user_namespace.h>
17207 +#include <linux/vs_pid.h>
17209 #include <asm/uaccess.h>
17210 #include <asm/io.h>
17211 @@ -131,7 +132,10 @@ static int set_one_prio(struct task_stru
17214 if (niceval < task_nice(p) && !can_nice(p, niceval)) {
17216 + if (vx_flags(VXF_IGNEG_NICE, 0))
17222 no_nice = security_task_setnice(p, niceval);
17223 @@ -181,6 +185,8 @@ SYSCALL_DEFINE3(setpriority, int, which,
17225 pgrp = task_pgrp(current);
17226 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
17227 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
17229 error = set_one_prio(p, niceval, error);
17230 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
17232 @@ -244,6 +250,8 @@ SYSCALL_DEFINE2(getpriority, int, which,
17234 pgrp = task_pgrp(current);
17235 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
17236 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
17238 niceval = 20 - task_nice(p);
17239 if (niceval > retval)
17241 @@ -357,6 +365,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
17243 static DEFINE_MUTEX(reboot_mutex);
17245 +long vs_reboot(unsigned int, void __user *);
17248 * Reboot system call: for obvious reasons only root may call it,
17249 * and even root needs to set up some magic numbers in the registers
17250 @@ -389,6 +399,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
17251 if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
17252 cmd = LINUX_REBOOT_CMD_HALT;
17254 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
17255 + return vs_reboot(cmd, arg);
17257 mutex_lock(&reboot_mutex);
17259 case LINUX_REBOOT_CMD_RESTART:
17260 @@ -1167,7 +1180,7 @@ SYSCALL_DEFINE2(sethostname, char __user
17262 char tmp[__NEW_UTS_LEN];
17264 - if (!capable(CAP_SYS_ADMIN))
17265 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
17267 if (len < 0 || len > __NEW_UTS_LEN)
17269 @@ -1216,7 +1229,7 @@ SYSCALL_DEFINE2(setdomainname, char __us
17271 char tmp[__NEW_UTS_LEN];
17273 - if (!capable(CAP_SYS_ADMIN))
17274 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
17276 if (len < 0 || len > __NEW_UTS_LEN)
17278 @@ -1285,7 +1298,7 @@ SYSCALL_DEFINE2(setrlimit, unsigned int,
17280 old_rlim = current->signal->rlim + resource;
17281 if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
17282 - !capable(CAP_SYS_RESOURCE))
17283 + !vx_capable(CAP_SYS_RESOURCE, VXC_SET_RLIMIT))
17285 if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
17287 diff -NurpP --minimal linux-2.6.35.2/kernel/sysctl_binary.c linux-2.6.35.2-vs2.3.0.36.31/kernel/sysctl_binary.c
17288 --- linux-2.6.35.2/kernel/sysctl_binary.c 2010-08-02 16:52:57.000000000 +0200
17289 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/sysctl_binary.c 2010-08-02 17:05:06.000000000 +0200
17290 @@ -73,6 +73,7 @@ static const struct bin_table bin_kern_t
17292 { CTL_INT, KERN_PANIC, "panic" },
17293 { CTL_INT, KERN_REALROOTDEV, "real-root-dev" },
17294 + { CTL_STR, KERN_VSHELPER, "vshelper" },
17296 { CTL_STR, KERN_SPARC_REBOOT, "reboot-cmd" },
17297 { CTL_INT, KERN_CTLALTDEL, "ctrl-alt-del" },
17298 diff -NurpP --minimal linux-2.6.35.2/kernel/sysctl.c linux-2.6.35.2-vs2.3.0.36.31/kernel/sysctl.c
17299 --- linux-2.6.35.2/kernel/sysctl.c 2010-08-02 16:52:57.000000000 +0200
17300 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/sysctl.c 2010-08-02 17:05:06.000000000 +0200
17302 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
17303 #include <linux/lockdep.h>
17305 +extern char vshelper_path[];
17306 #ifdef CONFIG_CHR_DEV_SG
17307 #include <scsi/sg.h>
17309 @@ -571,6 +572,13 @@ static struct ctl_table kern_table[] = {
17310 .proc_handler = proc_dostring,
17314 + .procname = "vshelper",
17315 + .data = &vshelper_path,
17318 + .proc_handler = &proc_dostring,
17320 #ifdef CONFIG_CHR_DEV_SG
17322 .procname = "sg-big-buff",
17323 diff -NurpP --minimal linux-2.6.35.2/kernel/time.c linux-2.6.35.2-vs2.3.0.36.31/kernel/time.c
17324 --- linux-2.6.35.2/kernel/time.c 2010-08-02 16:52:57.000000000 +0200
17325 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/time.c 2010-08-02 17:05:06.000000000 +0200
17326 @@ -62,6 +62,7 @@ EXPORT_SYMBOL(sys_tz);
17327 SYSCALL_DEFINE1(time, time_t __user *, tloc)
17329 time_t i = get_seconds();
17330 +/* FIXME: do_gettimeofday(&tv) -> vx_gettimeofday(&tv) */
17333 if (put_user(i,tloc))
17334 @@ -92,7 +93,7 @@ SYSCALL_DEFINE1(stime, time_t __user *,
17338 - do_settimeofday(&tv);
17339 + vx_settimeofday(&tv);
17343 @@ -103,7 +104,7 @@ SYSCALL_DEFINE2(gettimeofday, struct tim
17345 if (likely(tv != NULL)) {
17346 struct timeval ktv;
17347 - do_gettimeofday(&ktv);
17348 + vx_gettimeofday(&ktv);
17349 if (copy_to_user(tv, &ktv, sizeof(ktv)))
17352 @@ -177,7 +178,7 @@ int do_sys_settimeofday(struct timespec
17353 /* SMP safe, again the code in arch/foo/time.c should
17354 * globally block out interrupts when it runs.
17356 - return do_settimeofday(tv);
17357 + return vx_settimeofday(tv);
17361 @@ -309,7 +310,7 @@ void getnstimeofday(struct timespec *tv)
17365 - do_gettimeofday(&x);
17366 + vx_gettimeofday(&x);
17367 tv->tv_sec = x.tv_sec;
17368 tv->tv_nsec = x.tv_usec * NSEC_PER_USEC;
17370 diff -NurpP --minimal linux-2.6.35.2/kernel/timer.c linux-2.6.35.2-vs2.3.0.36.31/kernel/timer.c
17371 --- linux-2.6.35.2/kernel/timer.c 2010-08-02 16:52:58.000000000 +0200
17372 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/timer.c 2010-08-02 17:05:06.000000000 +0200
17374 #include <linux/perf_event.h>
17375 #include <linux/sched.h>
17376 #include <linux/slab.h>
17377 +#include <linux/vs_base.h>
17378 +#include <linux/vs_cvirt.h>
17379 +#include <linux/vs_pid.h>
17380 +#include <linux/vserver/sched.h>
17382 #include <asm/uaccess.h>
17383 #include <asm/unistd.h>
17384 @@ -1318,12 +1322,6 @@ SYSCALL_DEFINE1(alarm, unsigned int, sec
17391 - * The Alpha uses getxpid, getxuid, and getxgid instead. Maybe this
17392 - * should be moved into arch/i386 instead?
17396 * sys_getpid - return the thread group id of the current process
17397 @@ -1352,10 +1350,23 @@ SYSCALL_DEFINE0(getppid)
17399 pid = task_tgid_vnr(current->real_parent);
17401 + return vx_map_pid(pid);
17408 + * The Alpha uses getxpid, getxuid, and getxgid instead.
17411 +asmlinkage long do_getxpid(long *ppid)
17413 + *ppid = sys_getppid();
17414 + return sys_getpid();
17417 +#else /* _alpha_ */
17419 SYSCALL_DEFINE0(getuid)
17421 /* Only we change this so SMP safe */
17422 diff -NurpP --minimal linux-2.6.35.2/kernel/user_namespace.c linux-2.6.35.2-vs2.3.0.36.31/kernel/user_namespace.c
17423 --- linux-2.6.35.2/kernel/user_namespace.c 2010-08-02 16:52:58.000000000 +0200
17424 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/user_namespace.c 2010-08-02 17:05:06.000000000 +0200
17426 #include <linux/slab.h>
17427 #include <linux/user_namespace.h>
17428 #include <linux/cred.h>
17429 +#include <linux/vserver/global.h>
17432 * Create a new user namespace, deriving the creator from the user in the
17433 @@ -30,6 +31,7 @@ int create_user_ns(struct cred *new)
17436 kref_init(&ns->kref);
17437 + atomic_inc(&vs_global_user_ns);
17439 for (n = 0; n < UIDHASH_SZ; ++n)
17440 INIT_HLIST_HEAD(ns->uidhash_table + n);
17441 @@ -78,6 +80,8 @@ void free_user_ns(struct kref *kref)
17442 struct user_namespace *ns =
17443 container_of(kref, struct user_namespace, kref);
17445 + /* FIXME: maybe move into destroyer? */
17446 + atomic_dec(&vs_global_user_ns);
17447 INIT_WORK(&ns->destroyer, free_user_ns_work);
17448 schedule_work(&ns->destroyer);
17450 diff -NurpP --minimal linux-2.6.35.2/kernel/utsname.c linux-2.6.35.2-vs2.3.0.36.31/kernel/utsname.c
17451 --- linux-2.6.35.2/kernel/utsname.c 2009-09-10 15:26:28.000000000 +0200
17452 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/utsname.c 2010-08-02 17:05:06.000000000 +0200
17453 @@ -14,14 +14,17 @@
17454 #include <linux/utsname.h>
17455 #include <linux/err.h>
17456 #include <linux/slab.h>
17457 +#include <linux/vserver/global.h>
17459 static struct uts_namespace *create_uts_ns(void)
17461 struct uts_namespace *uts_ns;
17463 uts_ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL);
17466 kref_init(&uts_ns->kref);
17467 + atomic_inc(&vs_global_uts_ns);
17472 @@ -71,5 +74,6 @@ void free_uts_ns(struct kref *kref)
17473 struct uts_namespace *ns;
17475 ns = container_of(kref, struct uts_namespace, kref);
17476 + atomic_dec(&vs_global_uts_ns);
17479 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/cacct.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cacct.c
17480 --- linux-2.6.35.2/kernel/vserver/cacct.c 1970-01-01 01:00:00.000000000 +0100
17481 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cacct.c 2010-08-02 17:05:06.000000000 +0200
17484 + * linux/kernel/vserver/cacct.c
17486 + * Virtual Server: Context Accounting
17488 + * Copyright (C) 2006-2007 Herbert Pötzl
17490 + * V0.01 added accounting stats
17494 +#include <linux/types.h>
17495 +#include <linux/vs_context.h>
17496 +#include <linux/vserver/cacct_cmd.h>
17497 +#include <linux/vserver/cacct_int.h>
17499 +#include <asm/errno.h>
17500 +#include <asm/uaccess.h>
17503 +int vc_sock_stat(struct vx_info *vxi, void __user *data)
17505 + struct vcmd_sock_stat_v0 vc_data;
17508 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
17511 + field = vc_data.field;
17512 + if ((field < 0) || (field >= VXA_SOCK_SIZE))
17515 + for (j = 0; j < 3; j++) {
17516 + vc_data.count[j] = vx_sock_count(&vxi->cacct, field, j);
17517 + vc_data.total[j] = vx_sock_total(&vxi->cacct, field, j);
17520 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
17525 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/cacct_init.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cacct_init.h
17526 --- linux-2.6.35.2/kernel/vserver/cacct_init.h 1970-01-01 01:00:00.000000000 +0100
17527 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cacct_init.h 2010-08-02 17:05:06.000000000 +0200
17531 +static inline void vx_info_init_cacct(struct _vx_cacct *cacct)
17536 + for (i = 0; i < VXA_SOCK_SIZE; i++) {
17537 + for (j = 0; j < 3; j++) {
17538 + atomic_long_set(&cacct->sock[i][j].count, 0);
17539 + atomic_long_set(&cacct->sock[i][j].total, 0);
17542 + for (i = 0; i < 8; i++)
17543 + atomic_set(&cacct->slab[i], 0);
17544 + for (i = 0; i < 5; i++)
17545 + for (j = 0; j < 4; j++)
17546 + atomic_set(&cacct->page[i][j], 0);
17549 +static inline void vx_info_exit_cacct(struct _vx_cacct *cacct)
17554 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/cacct_proc.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cacct_proc.h
17555 --- linux-2.6.35.2/kernel/vserver/cacct_proc.h 1970-01-01 01:00:00.000000000 +0100
17556 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cacct_proc.h 2010-08-02 17:05:06.000000000 +0200
17558 +#ifndef _VX_CACCT_PROC_H
17559 +#define _VX_CACCT_PROC_H
17561 +#include <linux/vserver/cacct_int.h>
17564 +#define VX_SOCKA_TOP \
17565 + "Type\t recv #/bytes\t\t send #/bytes\t\t fail #/bytes\n"
17567 +static inline int vx_info_proc_cacct(struct _vx_cacct *cacct, char *buffer)
17569 + int i, j, length = 0;
17570 + static char *type[VXA_SOCK_SIZE] = {
17571 + "UNSPEC", "UNIX", "INET", "INET6", "PACKET", "OTHER"
17574 + length += sprintf(buffer + length, VX_SOCKA_TOP);
17575 + for (i = 0; i < VXA_SOCK_SIZE; i++) {
17576 + length += sprintf(buffer + length, "%s:", type[i]);
17577 + for (j = 0; j < 3; j++) {
17578 + length += sprintf(buffer + length,
17579 + "\t%10lu/%-10lu",
17580 + vx_sock_count(cacct, i, j),
17581 + vx_sock_total(cacct, i, j));
17583 + buffer[length++] = '\n';
17586 + length += sprintf(buffer + length, "\n");
17587 + length += sprintf(buffer + length,
17588 + "slab:\t %8u %8u %8u %8u\n",
17589 + atomic_read(&cacct->slab[1]),
17590 + atomic_read(&cacct->slab[4]),
17591 + atomic_read(&cacct->slab[0]),
17592 + atomic_read(&cacct->slab[2]));
17594 + length += sprintf(buffer + length, "\n");
17595 + for (i = 0; i < 5; i++) {
17596 + length += sprintf(buffer + length,
17597 + "page[%d]: %8u %8u %8u %8u\t %8u %8u %8u %8u\n", i,
17598 + atomic_read(&cacct->page[i][0]),
17599 + atomic_read(&cacct->page[i][1]),
17600 + atomic_read(&cacct->page[i][2]),
17601 + atomic_read(&cacct->page[i][3]),
17602 + atomic_read(&cacct->page[i][4]),
17603 + atomic_read(&cacct->page[i][5]),
17604 + atomic_read(&cacct->page[i][6]),
17605 + atomic_read(&cacct->page[i][7]));
17610 +#endif /* _VX_CACCT_PROC_H */
17611 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/context.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/context.c
17612 --- linux-2.6.35.2/kernel/vserver/context.c 1970-01-01 01:00:00.000000000 +0100
17613 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/context.c 2010-08-02 17:05:06.000000000 +0200
17616 + * linux/kernel/vserver/context.c
17618 + * Virtual Server: Context Support
17620 + * Copyright (C) 2003-2007 Herbert Pötzl
17622 + * V0.01 context helper
17623 + * V0.02 vx_ctx_kill syscall command
17624 + * V0.03 replaced context_info calls
17625 + * V0.04 redesign of struct (de)alloc
17626 + * V0.05 rlimit basic implementation
17627 + * V0.06 task_xid and info commands
17628 + * V0.07 context flags and caps
17629 + * V0.08 switch to RCU based hash
17630 + * V0.09 revert to non RCU for now
17631 + * V0.10 and back to working RCU hash
17632 + * V0.11 and back to locking again
17633 + * V0.12 referenced context store
17634 + * V0.13 separate per cpu data
17635 + * V0.14 changed vcmds to vxi arg
17636 + * V0.15 added context stat
17637 + * V0.16 have __create claim() the vxi
17638 + * V0.17 removed older and legacy stuff
17642 +#include <linux/slab.h>
17643 +#include <linux/types.h>
17644 +#include <linux/security.h>
17645 +#include <linux/pid_namespace.h>
17647 +#include <linux/vserver/context.h>
17648 +#include <linux/vserver/network.h>
17649 +#include <linux/vserver/debug.h>
17650 +#include <linux/vserver/limit.h>
17651 +#include <linux/vserver/limit_int.h>
17652 +#include <linux/vserver/space.h>
17653 +#include <linux/init_task.h>
17654 +#include <linux/fs_struct.h>
17656 +#include <linux/vs_context.h>
17657 +#include <linux/vs_limit.h>
17658 +#include <linux/vs_pid.h>
17659 +#include <linux/vserver/context_cmd.h>
17661 +#include "cvirt_init.h"
17662 +#include "cacct_init.h"
17663 +#include "limit_init.h"
17664 +#include "sched_init.h"
17667 +atomic_t vx_global_ctotal = ATOMIC_INIT(0);
17668 +atomic_t vx_global_cactive = ATOMIC_INIT(0);
17671 +/* now inactive context structures */
17673 +static struct hlist_head vx_info_inactive = HLIST_HEAD_INIT;
17675 +static spinlock_t vx_info_inactive_lock = SPIN_LOCK_UNLOCKED;
17678 +/* __alloc_vx_info()
17680 + * allocate an initialized vx_info struct
17681 + * doesn't make it visible (hash) */
17683 +static struct vx_info *__alloc_vx_info(xid_t xid)
17685 + struct vx_info *new = NULL;
17688 + vxdprintk(VXD_CBIT(xid, 0), "alloc_vx_info(%d)*", xid);
17690 + /* would this benefit from a slab cache? */
17691 + new = kmalloc(sizeof(struct vx_info), GFP_KERNEL);
17695 + memset(new, 0, sizeof(struct vx_info));
17697 + new->ptr_pc = alloc_percpu(struct _vx_info_pc);
17698 + if (!new->ptr_pc)
17701 + new->vx_id = xid;
17702 + INIT_HLIST_NODE(&new->vx_hlist);
17703 + atomic_set(&new->vx_usecnt, 0);
17704 + atomic_set(&new->vx_tasks, 0);
17705 + new->vx_parent = NULL;
17706 + new->vx_state = 0;
17707 + init_waitqueue_head(&new->vx_wait);
17709 + /* prepare reaper */
17710 + get_task_struct(init_pid_ns.child_reaper);
17711 + new->vx_reaper = init_pid_ns.child_reaper;
17712 + new->vx_badness_bias = 0;
17714 + /* rest of init goes here */
17715 + vx_info_init_limit(&new->limit);
17716 + vx_info_init_sched(&new->sched);
17717 + vx_info_init_cvirt(&new->cvirt);
17718 + vx_info_init_cacct(&new->cacct);
17720 + /* per cpu data structures */
17721 + for_each_possible_cpu(cpu) {
17722 + vx_info_init_sched_pc(
17723 + &vx_per_cpu(new, sched_pc, cpu), cpu);
17724 + vx_info_init_cvirt_pc(
17725 + &vx_per_cpu(new, cvirt_pc, cpu), cpu);
17728 + new->vx_flags = VXF_INIT_SET;
17729 + cap_set_init_eff(new->vx_bcaps);
17730 + new->vx_ccaps = 0;
17731 + new->vx_umask = 0;
17733 + new->reboot_cmd = 0;
17734 + new->exit_code = 0;
17736 + // preconfig fs entries
17737 + for (index = 0; index < VX_SPACES; index++) {
17738 + write_lock(&init_fs.lock);
17740 + write_unlock(&init_fs.lock);
17741 + new->vx_fs[index] = &init_fs;
17744 + vxdprintk(VXD_CBIT(xid, 0),
17745 + "alloc_vx_info(%d) = %p", xid, new);
17746 + vxh_alloc_vx_info(new);
17747 + atomic_inc(&vx_global_ctotal);
17756 +/* __dealloc_vx_info()
17758 + * final disposal of vx_info */
17760 +static void __dealloc_vx_info(struct vx_info *vxi)
17762 +#ifdef CONFIG_VSERVER_WARN
17763 + struct vx_info_save vxis;
17766 + vxdprintk(VXD_CBIT(xid, 0),
17767 + "dealloc_vx_info(%p)", vxi);
17768 + vxh_dealloc_vx_info(vxi);
17770 +#ifdef CONFIG_VSERVER_WARN
17771 + enter_vx_info(vxi, &vxis);
17772 + vx_info_exit_limit(&vxi->limit);
17773 + vx_info_exit_sched(&vxi->sched);
17774 + vx_info_exit_cvirt(&vxi->cvirt);
17775 + vx_info_exit_cacct(&vxi->cacct);
17777 + for_each_possible_cpu(cpu) {
17778 + vx_info_exit_sched_pc(
17779 + &vx_per_cpu(vxi, sched_pc, cpu), cpu);
17780 + vx_info_exit_cvirt_pc(
17781 + &vx_per_cpu(vxi, cvirt_pc, cpu), cpu);
17783 + leave_vx_info(&vxis);
17787 + vxi->vx_state |= VXS_RELEASED;
17790 + free_percpu(vxi->ptr_pc);
17793 + atomic_dec(&vx_global_ctotal);
17796 +static void __shutdown_vx_info(struct vx_info *vxi)
17798 + struct nsproxy *nsproxy;
17799 + struct fs_struct *fs;
17804 + vxi->vx_state |= VXS_SHUTDOWN;
17805 + vs_state_change(vxi, VSC_SHUTDOWN);
17807 + for (index = 0; index < VX_SPACES; index++) {
17808 + nsproxy = xchg(&vxi->vx_nsproxy[index], NULL);
17810 + put_nsproxy(nsproxy);
17812 + fs = xchg(&vxi->vx_fs[index], NULL);
17813 + write_lock(&fs->lock);
17814 + kill = !--fs->users;
17815 + write_unlock(&fs->lock);
17817 + free_fs_struct(fs);
17821 +/* exported stuff */
17823 +void free_vx_info(struct vx_info *vxi)
17825 + unsigned long flags;
17828 + /* check for reference counts first */
17829 + BUG_ON(atomic_read(&vxi->vx_usecnt));
17830 + BUG_ON(atomic_read(&vxi->vx_tasks));
17832 + /* context must not be hashed */
17833 + BUG_ON(vx_info_state(vxi, VXS_HASHED));
17835 + /* context shutdown is mandatory */
17836 + BUG_ON(!vx_info_state(vxi, VXS_SHUTDOWN));
17838 + /* nsproxy and fs check */
17839 + for (index = 0; index < VX_SPACES; index++) {
17840 + BUG_ON(vxi->vx_nsproxy[index]);
17841 + BUG_ON(vxi->vx_fs[index]);
17844 + spin_lock_irqsave(&vx_info_inactive_lock, flags);
17845 + hlist_del(&vxi->vx_hlist);
17846 + spin_unlock_irqrestore(&vx_info_inactive_lock, flags);
17848 + __dealloc_vx_info(vxi);
17852 +/* hash table for vx_info hash */
17854 +#define VX_HASH_SIZE 13
17856 +static struct hlist_head vx_info_hash[VX_HASH_SIZE] =
17857 + { [0 ... VX_HASH_SIZE-1] = HLIST_HEAD_INIT };
17859 +static spinlock_t vx_info_hash_lock = SPIN_LOCK_UNLOCKED;
17862 +static inline unsigned int __hashval(xid_t xid)
17864 + return (xid % VX_HASH_SIZE);
17869 +/* __hash_vx_info()
17871 + * add the vxi to the global hash table
17872 + * requires the hash_lock to be held */
17874 +static inline void __hash_vx_info(struct vx_info *vxi)
17876 + struct hlist_head *head;
17878 + vxd_assert_lock(&vx_info_hash_lock);
17879 + vxdprintk(VXD_CBIT(xid, 4),
17880 + "__hash_vx_info: %p[#%d]", vxi, vxi->vx_id);
17881 + vxh_hash_vx_info(vxi);
17883 + /* context must not be hashed */
17884 + BUG_ON(vx_info_state(vxi, VXS_HASHED));
17886 + vxi->vx_state |= VXS_HASHED;
17887 + head = &vx_info_hash[__hashval(vxi->vx_id)];
17888 + hlist_add_head(&vxi->vx_hlist, head);
17889 + atomic_inc(&vx_global_cactive);
17892 +/* __unhash_vx_info()
17894 + * remove the vxi from the global hash table
17895 + * requires the hash_lock to be held */
17897 +static inline void __unhash_vx_info(struct vx_info *vxi)
17899 + unsigned long flags;
17901 + vxd_assert_lock(&vx_info_hash_lock);
17902 + vxdprintk(VXD_CBIT(xid, 4),
17903 + "__unhash_vx_info: %p[#%d.%d.%d]", vxi, vxi->vx_id,
17904 + atomic_read(&vxi->vx_usecnt), atomic_read(&vxi->vx_tasks));
17905 + vxh_unhash_vx_info(vxi);
17907 + /* context must be hashed */
17908 + BUG_ON(!vx_info_state(vxi, VXS_HASHED));
17909 + /* but without tasks */
17910 + BUG_ON(atomic_read(&vxi->vx_tasks));
17912 + vxi->vx_state &= ~VXS_HASHED;
17913 + hlist_del_init(&vxi->vx_hlist);
17914 + spin_lock_irqsave(&vx_info_inactive_lock, flags);
17915 + hlist_add_head(&vxi->vx_hlist, &vx_info_inactive);
17916 + spin_unlock_irqrestore(&vx_info_inactive_lock, flags);
17917 + atomic_dec(&vx_global_cactive);
17921 +/* __lookup_vx_info()
17923 + * requires the hash_lock to be held
17924 + * doesn't increment the vx_refcnt */
17926 +static inline struct vx_info *__lookup_vx_info(xid_t xid)
17928 + struct hlist_head *head = &vx_info_hash[__hashval(xid)];
17929 + struct hlist_node *pos;
17930 + struct vx_info *vxi;
17932 + vxd_assert_lock(&vx_info_hash_lock);
17933 + hlist_for_each(pos, head) {
17934 + vxi = hlist_entry(pos, struct vx_info, vx_hlist);
17936 + if (vxi->vx_id == xid)
17941 + vxdprintk(VXD_CBIT(xid, 0),
17942 + "__lookup_vx_info(#%u): %p[#%u]",
17943 + xid, vxi, vxi ? vxi->vx_id : 0);
17944 + vxh_lookup_vx_info(vxi, xid);
17949 +/* __create_vx_info()
17951 + * create the requested context
17952 + * get(), claim() and hash it */
17954 +static struct vx_info *__create_vx_info(int id)
17956 + struct vx_info *new, *vxi = NULL;
17958 + vxdprintk(VXD_CBIT(xid, 1), "create_vx_info(%d)*", id);
17960 + if (!(new = __alloc_vx_info(id)))
17961 + return ERR_PTR(-ENOMEM);
17963 + /* required to make dynamic xids unique */
17964 + spin_lock(&vx_info_hash_lock);
17966 + /* static context requested */
17967 + if ((vxi = __lookup_vx_info(id))) {
17968 + vxdprintk(VXD_CBIT(xid, 0),
17969 + "create_vx_info(%d) = %p (already there)", id, vxi);
17970 + if (vx_info_flags(vxi, VXF_STATE_SETUP, 0))
17971 + vxi = ERR_PTR(-EBUSY);
17973 + vxi = ERR_PTR(-EEXIST);
17976 + /* new context */
17977 + vxdprintk(VXD_CBIT(xid, 0),
17978 + "create_vx_info(%d) = %p (new)", id, new);
17979 + claim_vx_info(new, NULL);
17980 + __hash_vx_info(get_vx_info(new));
17981 + vxi = new, new = NULL;
17984 + spin_unlock(&vx_info_hash_lock);
17985 + vxh_create_vx_info(IS_ERR(vxi) ? NULL : vxi, id);
17987 + __dealloc_vx_info(new);
17992 +/* exported stuff */
17995 +void unhash_vx_info(struct vx_info *vxi)
17997 + __shutdown_vx_info(vxi);
17998 + spin_lock(&vx_info_hash_lock);
17999 + __unhash_vx_info(vxi);
18000 + spin_unlock(&vx_info_hash_lock);
18001 + __wakeup_vx_info(vxi);
18005 +/* lookup_vx_info()
18007 + * search for a vx_info and get() it
18008 + * negative id means current */
18010 +struct vx_info *lookup_vx_info(int id)
18012 + struct vx_info *vxi = NULL;
18015 + vxi = get_vx_info(current_vx_info());
18016 + } else if (id > 1) {
18017 + spin_lock(&vx_info_hash_lock);
18018 + vxi = get_vx_info(__lookup_vx_info(id));
18019 + spin_unlock(&vx_info_hash_lock);
18024 +/* xid_is_hashed()
18026 + * verify that xid is still hashed */
18028 +int xid_is_hashed(xid_t xid)
18032 + spin_lock(&vx_info_hash_lock);
18033 + hashed = (__lookup_vx_info(xid) != NULL);
18034 + spin_unlock(&vx_info_hash_lock);
18038 +#ifdef CONFIG_PROC_FS
18042 + * get a subset of hashed xids for proc
18043 + * assumes size is at least one */
18045 +int get_xid_list(int index, unsigned int *xids, int size)
18047 + int hindex, nr_xids = 0;
18049 + /* only show current and children */
18050 + if (!vx_check(0, VS_ADMIN | VS_WATCH)) {
18053 + xids[nr_xids] = vx_current_xid();
18057 + for (hindex = 0; hindex < VX_HASH_SIZE; hindex++) {
18058 + struct hlist_head *head = &vx_info_hash[hindex];
18059 + struct hlist_node *pos;
18061 + spin_lock(&vx_info_hash_lock);
18062 + hlist_for_each(pos, head) {
18063 + struct vx_info *vxi;
18068 + vxi = hlist_entry(pos, struct vx_info, vx_hlist);
18069 + xids[nr_xids] = vxi->vx_id;
18070 + if (++nr_xids >= size) {
18071 + spin_unlock(&vx_info_hash_lock);
18075 + /* keep the lock time short */
18076 + spin_unlock(&vx_info_hash_lock);
18083 +#ifdef CONFIG_VSERVER_DEBUG
18085 +void dump_vx_info_inactive(int level)
18087 + struct hlist_node *entry, *next;
18089 + hlist_for_each_safe(entry, next, &vx_info_inactive) {
18090 + struct vx_info *vxi =
18091 + list_entry(entry, struct vx_info, vx_hlist);
18093 + dump_vx_info(vxi, level);
18100 +int vx_migrate_user(struct task_struct *p, struct vx_info *vxi)
18102 + struct user_struct *new_user, *old_user;
18107 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0))
18110 + new_user = alloc_uid(vxi->vx_id, p->uid);
18114 + old_user = p->user;
18115 + if (new_user != old_user) {
18116 + atomic_inc(&new_user->processes);
18117 + atomic_dec(&old_user->processes);
18118 + p->user = new_user;
18120 + free_uid(old_user);
18126 +void vx_mask_cap_bset(struct vx_info *vxi, struct task_struct *p)
18128 + // p->cap_effective &= vxi->vx_cap_bset;
18129 + p->cap_effective =
18130 + cap_intersect(p->cap_effective, vxi->cap_bset);
18131 + // p->cap_inheritable &= vxi->vx_cap_bset;
18132 + p->cap_inheritable =
18133 + cap_intersect(p->cap_inheritable, vxi->cap_bset);
18134 + // p->cap_permitted &= vxi->vx_cap_bset;
18135 + p->cap_permitted =
18136 + cap_intersect(p->cap_permitted, vxi->cap_bset);
18141 +#include <linux/file.h>
18142 +#include <linux/fdtable.h>
18144 +static int vx_openfd_task(struct task_struct *tsk)
18146 + struct files_struct *files = tsk->files;
18147 + struct fdtable *fdt;
18148 + const unsigned long *bptr;
18149 + int count, total;
18151 + /* no rcu_read_lock() because of spin_lock() */
18152 + spin_lock(&files->file_lock);
18153 + fdt = files_fdtable(files);
18154 + bptr = fdt->open_fds->fds_bits;
18155 + count = fdt->max_fds / (sizeof(unsigned long) * 8);
18156 + for (total = 0; count > 0; count--) {
18158 + total += hweight_long(*bptr);
18161 + spin_unlock(&files->file_lock);
18166 +/* for *space compatibility */
18168 +asmlinkage long sys_unshare(unsigned long);
18171 + * migrate task to new context
18172 + * gets vxi, puts old_vxi on change
18173 + * optionally unshares namespaces (hack)
18176 +int vx_migrate_task(struct task_struct *p, struct vx_info *vxi, int unshare)
18178 + struct vx_info *old_vxi;
18184 + vxdprintk(VXD_CBIT(xid, 5),
18185 + "vx_migrate_task(%p,%p[#%d.%d])", p, vxi,
18186 + vxi->vx_id, atomic_read(&vxi->vx_usecnt));
18188 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0) &&
18189 + !vx_info_flags(vxi, VXF_STATE_SETUP, 0))
18192 + if (vx_info_state(vxi, VXS_SHUTDOWN))
18195 + old_vxi = task_get_vx_info(p);
18196 + if (old_vxi == vxi)
18199 +// if (!(ret = vx_migrate_user(p, vxi))) {
18204 + openfd = vx_openfd_task(p);
18207 + atomic_dec(&old_vxi->cvirt.nr_threads);
18208 + atomic_dec(&old_vxi->cvirt.nr_running);
18209 + __rlim_dec(&old_vxi->limit, RLIMIT_NPROC);
18210 + /* FIXME: what about the struct files here? */
18211 + __rlim_sub(&old_vxi->limit, VLIMIT_OPENFD, openfd);
18212 + /* account for the executable */
18213 + __rlim_dec(&old_vxi->limit, VLIMIT_DENTRY);
18215 + atomic_inc(&vxi->cvirt.nr_threads);
18216 + atomic_inc(&vxi->cvirt.nr_running);
18217 + __rlim_inc(&vxi->limit, RLIMIT_NPROC);
18218 + /* FIXME: what about the struct files here? */
18219 + __rlim_add(&vxi->limit, VLIMIT_OPENFD, openfd);
18220 + /* account for the executable */
18221 + __rlim_inc(&vxi->limit, VLIMIT_DENTRY);
18224 + release_vx_info(old_vxi, p);
18225 + clr_vx_info(&p->vx_info);
18227 + claim_vx_info(vxi, p);
18228 + set_vx_info(&p->vx_info, vxi);
18229 + p->xid = vxi->vx_id;
18231 + vxdprintk(VXD_CBIT(xid, 5),
18232 + "moved task %p into vxi:%p[#%d]",
18233 + p, vxi, vxi->vx_id);
18235 + // vx_mask_cap_bset(vxi, p);
18238 + /* hack for *spaces to provide compatibility */
18240 + struct nsproxy *old_nsp, *new_nsp;
18242 + ret = unshare_nsproxy_namespaces(
18243 + CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER,
18248 + old_nsp = xchg(&p->nsproxy, new_nsp);
18249 + vx_set_space(vxi,
18250 + CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER, 0);
18251 + put_nsproxy(old_nsp);
18255 + put_vx_info(old_vxi);
18259 +int vx_set_reaper(struct vx_info *vxi, struct task_struct *p)
18261 + struct task_struct *old_reaper;
18266 + vxdprintk(VXD_CBIT(xid, 6),
18267 + "vx_set_reaper(%p[#%d],%p[#%d,%d])",
18268 + vxi, vxi->vx_id, p, p->xid, p->pid);
18270 + old_reaper = vxi->vx_reaper;
18271 + if (old_reaper == p)
18274 + /* set new child reaper */
18275 + get_task_struct(p);
18276 + vxi->vx_reaper = p;
18277 + put_task_struct(old_reaper);
18281 +int vx_set_init(struct vx_info *vxi, struct task_struct *p)
18286 + vxdprintk(VXD_CBIT(xid, 6),
18287 + "vx_set_init(%p[#%d],%p[#%d,%d,%d])",
18288 + vxi, vxi->vx_id, p, p->xid, p->pid, p->tgid);
18290 + vxi->vx_flags &= ~VXF_STATE_INIT;
18291 + // vxi->vx_initpid = p->tgid;
18292 + vxi->vx_initpid = p->pid;
18296 +void vx_exit_init(struct vx_info *vxi, struct task_struct *p, int code)
18298 + vxdprintk(VXD_CBIT(xid, 6),
18299 + "vx_exit_init(%p[#%d],%p[#%d,%d,%d])",
18300 + vxi, vxi->vx_id, p, p->xid, p->pid, p->tgid);
18302 + vxi->exit_code = code;
18303 + vxi->vx_initpid = 0;
18307 +void vx_set_persistent(struct vx_info *vxi)
18309 + vxdprintk(VXD_CBIT(xid, 6),
18310 + "vx_set_persistent(%p[#%d])", vxi, vxi->vx_id);
18312 + get_vx_info(vxi);
18313 + claim_vx_info(vxi, NULL);
18316 +void vx_clear_persistent(struct vx_info *vxi)
18318 + vxdprintk(VXD_CBIT(xid, 6),
18319 + "vx_clear_persistent(%p[#%d])", vxi, vxi->vx_id);
18321 + release_vx_info(vxi, NULL);
18322 + put_vx_info(vxi);
18325 +void vx_update_persistent(struct vx_info *vxi)
18327 + if (vx_info_flags(vxi, VXF_PERSISTENT, 0))
18328 + vx_set_persistent(vxi);
18330 + vx_clear_persistent(vxi);
18334 +/* task must be current or locked */
18336 +void exit_vx_info(struct task_struct *p, int code)
18338 + struct vx_info *vxi = p->vx_info;
18341 + atomic_dec(&vxi->cvirt.nr_threads);
18344 + vxi->exit_code = code;
18345 + release_vx_info(vxi, p);
18349 +void exit_vx_info_early(struct task_struct *p, int code)
18351 + struct vx_info *vxi = p->vx_info;
18354 + if (vxi->vx_initpid == p->pid)
18355 + vx_exit_init(vxi, p, code);
18356 + if (vxi->vx_reaper == p)
18357 + vx_set_reaper(vxi, init_pid_ns.child_reaper);
18362 +/* vserver syscall commands below here */
18364 +/* taks xid and vx_info functions */
18366 +#include <asm/uaccess.h>
18369 +int vc_task_xid(uint32_t id)
18374 + struct task_struct *tsk;
18376 + read_lock(&tasklist_lock);
18377 + tsk = find_task_by_real_pid(id);
18378 + xid = (tsk) ? tsk->xid : -ESRCH;
18379 + read_unlock(&tasklist_lock);
18381 + xid = vx_current_xid();
18386 +int vc_vx_info(struct vx_info *vxi, void __user *data)
18388 + struct vcmd_vx_info_v0 vc_data;
18390 + vc_data.xid = vxi->vx_id;
18391 + vc_data.initpid = vxi->vx_initpid;
18393 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18399 +int vc_ctx_stat(struct vx_info *vxi, void __user *data)
18401 + struct vcmd_ctx_stat_v0 vc_data;
18403 + vc_data.usecnt = atomic_read(&vxi->vx_usecnt);
18404 + vc_data.tasks = atomic_read(&vxi->vx_tasks);
18406 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18412 +/* context functions */
18414 +int vc_ctx_create(uint32_t xid, void __user *data)
18416 + struct vcmd_ctx_create vc_data = { .flagword = VXF_INIT_SET };
18417 + struct vx_info *new_vxi;
18420 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
18423 + if ((xid > MAX_S_CONTEXT) || (xid < 2))
18426 + new_vxi = __create_vx_info(xid);
18427 + if (IS_ERR(new_vxi))
18428 + return PTR_ERR(new_vxi);
18430 + /* initial flags */
18431 + new_vxi->vx_flags = vc_data.flagword;
18434 + if (vs_state_change(new_vxi, VSC_STARTUP))
18437 + ret = vx_migrate_task(current, new_vxi, (!data));
18441 + /* return context id on success */
18442 + ret = new_vxi->vx_id;
18444 + /* get a reference for persistent contexts */
18445 + if ((vc_data.flagword & VXF_PERSISTENT))
18446 + vx_set_persistent(new_vxi);
18448 + release_vx_info(new_vxi, NULL);
18449 + put_vx_info(new_vxi);
18454 +int vc_ctx_migrate(struct vx_info *vxi, void __user *data)
18456 + struct vcmd_ctx_migrate vc_data = { .flagword = 0 };
18459 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
18462 + ret = vx_migrate_task(current, vxi, 0);
18465 + if (vc_data.flagword & VXM_SET_INIT)
18466 + ret = vx_set_init(vxi, current);
18469 + if (vc_data.flagword & VXM_SET_REAPER)
18470 + ret = vx_set_reaper(vxi, current);
18475 +int vc_get_cflags(struct vx_info *vxi, void __user *data)
18477 + struct vcmd_ctx_flags_v0 vc_data;
18479 + vc_data.flagword = vxi->vx_flags;
18481 + /* special STATE flag handling */
18482 + vc_data.mask = vs_mask_flags(~0ULL, vxi->vx_flags, VXF_ONE_TIME);
18484 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18489 +int vc_set_cflags(struct vx_info *vxi, void __user *data)
18491 + struct vcmd_ctx_flags_v0 vc_data;
18492 + uint64_t mask, trigger;
18494 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18497 + /* special STATE flag handling */
18498 + mask = vs_mask_mask(vc_data.mask, vxi->vx_flags, VXF_ONE_TIME);
18499 + trigger = (mask & vxi->vx_flags) ^ (mask & vc_data.flagword);
18501 + if (vxi == current_vx_info()) {
18502 + /* if (trigger & VXF_STATE_SETUP)
18503 + vx_mask_cap_bset(vxi, current); */
18504 + if (trigger & VXF_STATE_INIT) {
18507 + ret = vx_set_init(vxi, current);
18510 + ret = vx_set_reaper(vxi, current);
18516 + vxi->vx_flags = vs_mask_flags(vxi->vx_flags,
18517 + vc_data.flagword, mask);
18518 + if (trigger & VXF_PERSISTENT)
18519 + vx_update_persistent(vxi);
18525 +static inline uint64_t caps_from_cap_t(kernel_cap_t c)
18527 + uint64_t v = c.cap[0] | ((uint64_t)c.cap[1] << 32);
18529 + // printk("caps_from_cap_t(%08x:%08x) = %016llx\n", c.cap[1], c.cap[0], v);
18533 +static inline kernel_cap_t cap_t_from_caps(uint64_t v)
18535 + kernel_cap_t c = __cap_empty_set;
18537 + c.cap[0] = v & 0xFFFFFFFF;
18538 + c.cap[1] = (v >> 32) & 0xFFFFFFFF;
18540 + // printk("cap_t_from_caps(%016llx) = %08x:%08x\n", v, c.cap[1], c.cap[0]);
18545 +static int do_get_caps(struct vx_info *vxi, uint64_t *bcaps, uint64_t *ccaps)
18548 + *bcaps = caps_from_cap_t(vxi->vx_bcaps);
18550 + *ccaps = vxi->vx_ccaps;
18555 +int vc_get_ccaps(struct vx_info *vxi, void __user *data)
18557 + struct vcmd_ctx_caps_v1 vc_data;
18560 + ret = do_get_caps(vxi, NULL, &vc_data.ccaps);
18563 + vc_data.cmask = ~0ULL;
18565 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18570 +static int do_set_caps(struct vx_info *vxi,
18571 + uint64_t bcaps, uint64_t bmask, uint64_t ccaps, uint64_t cmask)
18573 + uint64_t bcold = caps_from_cap_t(vxi->vx_bcaps);
18576 + printk("do_set_caps(%16llx, %16llx, %16llx, %16llx)\n",
18577 + bcaps, bmask, ccaps, cmask);
18579 + vxi->vx_bcaps = cap_t_from_caps(
18580 + vs_mask_flags(bcold, bcaps, bmask));
18581 + vxi->vx_ccaps = vs_mask_flags(vxi->vx_ccaps, ccaps, cmask);
18586 +int vc_set_ccaps(struct vx_info *vxi, void __user *data)
18588 + struct vcmd_ctx_caps_v1 vc_data;
18590 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18593 + return do_set_caps(vxi, 0, 0, vc_data.ccaps, vc_data.cmask);
18596 +int vc_get_bcaps(struct vx_info *vxi, void __user *data)
18598 + struct vcmd_bcaps vc_data;
18601 + ret = do_get_caps(vxi, &vc_data.bcaps, NULL);
18604 + vc_data.bmask = ~0ULL;
18606 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18611 +int vc_set_bcaps(struct vx_info *vxi, void __user *data)
18613 + struct vcmd_bcaps vc_data;
18615 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18618 + return do_set_caps(vxi, vc_data.bcaps, vc_data.bmask, 0, 0);
18622 +int vc_get_umask(struct vx_info *vxi, void __user *data)
18624 + struct vcmd_umask vc_data;
18626 + vc_data.umask = vxi->vx_umask;
18627 + vc_data.mask = ~0ULL;
18629 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18634 +int vc_set_umask(struct vx_info *vxi, void __user *data)
18636 + struct vcmd_umask vc_data;
18638 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18641 + vxi->vx_umask = vs_mask_flags(vxi->vx_umask,
18642 + vc_data.umask, vc_data.mask);
18647 +int vc_get_badness(struct vx_info *vxi, void __user *data)
18649 + struct vcmd_badness_v0 vc_data;
18651 + vc_data.bias = vxi->vx_badness_bias;
18653 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18658 +int vc_set_badness(struct vx_info *vxi, void __user *data)
18660 + struct vcmd_badness_v0 vc_data;
18662 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18665 + vxi->vx_badness_bias = vc_data.bias;
18669 +#include <linux/module.h>
18671 +EXPORT_SYMBOL_GPL(free_vx_info);
18673 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/cvirt.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cvirt.c
18674 --- linux-2.6.35.2/kernel/vserver/cvirt.c 1970-01-01 01:00:00.000000000 +0100
18675 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cvirt.c 2010-08-02 17:05:06.000000000 +0200
18678 + * linux/kernel/vserver/cvirt.c
18680 + * Virtual Server: Context Virtualization
18682 + * Copyright (C) 2004-2007 Herbert Pötzl
18684 + * V0.01 broken out from limit.c
18685 + * V0.02 added utsname stuff
18686 + * V0.03 changed vcmds to vxi arg
18690 +#include <linux/types.h>
18691 +#include <linux/utsname.h>
18692 +#include <linux/vs_cvirt.h>
18693 +#include <linux/vserver/switch.h>
18694 +#include <linux/vserver/cvirt_cmd.h>
18696 +#include <asm/uaccess.h>
18699 +void vx_vsi_uptime(struct timespec *uptime, struct timespec *idle)
18701 + struct vx_info *vxi = current_vx_info();
18703 + set_normalized_timespec(uptime,
18704 + uptime->tv_sec - vxi->cvirt.bias_uptime.tv_sec,
18705 + uptime->tv_nsec - vxi->cvirt.bias_uptime.tv_nsec);
18708 + set_normalized_timespec(idle,
18709 + idle->tv_sec - vxi->cvirt.bias_idle.tv_sec,
18710 + idle->tv_nsec - vxi->cvirt.bias_idle.tv_nsec);
18714 +uint64_t vx_idle_jiffies(void)
18716 + return init_task.utime + init_task.stime;
18721 +static inline uint32_t __update_loadavg(uint32_t load,
18722 + int wsize, int delta, int n)
18724 + unsigned long long calc, prev;
18726 + /* just set it to n */
18727 + if (unlikely(delta >= wsize))
18728 + return (n << FSHIFT);
18730 + calc = delta * n;
18732 + prev = (wsize - delta);
18735 + do_div(calc, wsize);
18740 +void vx_update_load(struct vx_info *vxi)
18742 + uint32_t now, last, delta;
18743 + unsigned int nr_running, nr_uninterruptible;
18744 + unsigned int total;
18745 + unsigned long flags;
18747 + spin_lock_irqsave(&vxi->cvirt.load_lock, flags);
18750 + last = vxi->cvirt.load_last;
18751 + delta = now - last;
18753 + if (delta < 5*HZ)
18756 + nr_running = atomic_read(&vxi->cvirt.nr_running);
18757 + nr_uninterruptible = atomic_read(&vxi->cvirt.nr_uninterruptible);
18758 + total = nr_running + nr_uninterruptible;
18760 + vxi->cvirt.load[0] = __update_loadavg(vxi->cvirt.load[0],
18761 + 60*HZ, delta, total);
18762 + vxi->cvirt.load[1] = __update_loadavg(vxi->cvirt.load[1],
18763 + 5*60*HZ, delta, total);
18764 + vxi->cvirt.load[2] = __update_loadavg(vxi->cvirt.load[2],
18765 + 15*60*HZ, delta, total);
18767 + vxi->cvirt.load_last = now;
18769 + atomic_inc(&vxi->cvirt.load_updates);
18770 + spin_unlock_irqrestore(&vxi->cvirt.load_lock, flags);
18775 + * Commands to do_syslog:
18777 + * 0 -- Close the log. Currently a NOP.
18778 + * 1 -- Open the log. Currently a NOP.
18779 + * 2 -- Read from the log.
18780 + * 3 -- Read all messages remaining in the ring buffer.
18781 + * 4 -- Read and clear all messages remaining in the ring buffer
18782 + * 5 -- Clear ring buffer.
18783 + * 6 -- Disable printk's to console
18784 + * 7 -- Enable printk's to console
18785 + * 8 -- Set level of messages printed to console
18786 + * 9 -- Return number of unread characters in the log buffer
18787 + * 10 -- Return size of the log buffer
18789 +int vx_do_syslog(int type, char __user *buf, int len)
18792 + int do_clear = 0;
18793 + struct vx_info *vxi = current_vx_info();
18794 + struct _vx_syslog *log;
18798 + log = &vxi->cvirt.syslog;
18801 + case 0: /* Close log */
18802 + case 1: /* Open log */
18804 + case 2: /* Read from log */
18805 + error = wait_event_interruptible(log->log_wait,
18806 + (log->log_start - log->log_end));
18809 + spin_lock_irq(&log->logbuf_lock);
18810 + spin_unlock_irq(&log->logbuf_lock);
18812 + case 4: /* Read/clear last kernel messages */
18814 + /* fall through */
18815 + case 3: /* Read last kernel messages */
18818 + case 5: /* Clear ring buffer */
18821 + case 6: /* Disable logging to console */
18822 + case 7: /* Enable logging to console */
18823 + case 8: /* Set level of messages printed to console */
18826 + case 9: /* Number of chars in the log buffer */
18828 + case 10: /* Size of the log buffer */
18838 +/* virtual host info names */
18840 +static char *vx_vhi_name(struct vx_info *vxi, int id)
18842 + struct nsproxy *nsproxy;
18843 + struct uts_namespace *uts;
18845 + if (id == VHIN_CONTEXT)
18846 + return vxi->vx_name;
18848 + nsproxy = vxi->vx_nsproxy[0];
18852 + uts = nsproxy->uts_ns;
18857 + case VHIN_SYSNAME:
18858 + return uts->name.sysname;
18859 + case VHIN_NODENAME:
18860 + return uts->name.nodename;
18861 + case VHIN_RELEASE:
18862 + return uts->name.release;
18863 + case VHIN_VERSION:
18864 + return uts->name.version;
18865 + case VHIN_MACHINE:
18866 + return uts->name.machine;
18867 + case VHIN_DOMAINNAME:
18868 + return uts->name.domainname;
18875 +int vc_set_vhi_name(struct vx_info *vxi, void __user *data)
18877 + struct vcmd_vhi_name_v0 vc_data;
18880 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18883 + name = vx_vhi_name(vxi, vc_data.field);
18887 + memcpy(name, vc_data.name, 65);
18891 +int vc_get_vhi_name(struct vx_info *vxi, void __user *data)
18893 + struct vcmd_vhi_name_v0 vc_data;
18896 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18899 + name = vx_vhi_name(vxi, vc_data.field);
18903 + memcpy(vc_data.name, name, 65);
18904 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18910 +int vc_virt_stat(struct vx_info *vxi, void __user *data)
18912 + struct vcmd_virt_stat_v0 vc_data;
18913 + struct _vx_cvirt *cvirt = &vxi->cvirt;
18914 + struct timespec uptime;
18916 + do_posix_clock_monotonic_gettime(&uptime);
18917 + set_normalized_timespec(&uptime,
18918 + uptime.tv_sec - cvirt->bias_uptime.tv_sec,
18919 + uptime.tv_nsec - cvirt->bias_uptime.tv_nsec);
18921 + vc_data.offset = timeval_to_ns(&cvirt->bias_tv);
18922 + vc_data.uptime = timespec_to_ns(&uptime);
18923 + vc_data.nr_threads = atomic_read(&cvirt->nr_threads);
18924 + vc_data.nr_running = atomic_read(&cvirt->nr_running);
18925 + vc_data.nr_uninterruptible = atomic_read(&cvirt->nr_uninterruptible);
18926 + vc_data.nr_onhold = atomic_read(&cvirt->nr_onhold);
18927 + vc_data.nr_forks = atomic_read(&cvirt->total_forks);
18928 + vc_data.load[0] = cvirt->load[0];
18929 + vc_data.load[1] = cvirt->load[1];
18930 + vc_data.load[2] = cvirt->load[2];
18932 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18938 +#ifdef CONFIG_VSERVER_VTIME
18940 +/* virtualized time base */
18942 +void vx_gettimeofday(struct timeval *tv)
18944 + struct vx_info *vxi;
18946 + do_gettimeofday(tv);
18947 + if (!vx_flags(VXF_VIRT_TIME, 0))
18950 + vxi = current_vx_info();
18951 + tv->tv_sec += vxi->cvirt.bias_tv.tv_sec;
18952 + tv->tv_usec += vxi->cvirt.bias_tv.tv_usec;
18954 + if (tv->tv_usec >= USEC_PER_SEC) {
18956 + tv->tv_usec -= USEC_PER_SEC;
18957 + } else if (tv->tv_usec < 0) {
18959 + tv->tv_usec += USEC_PER_SEC;
18963 +int vx_settimeofday(struct timespec *ts)
18965 + struct timeval tv;
18966 + struct vx_info *vxi;
18968 + if (!vx_flags(VXF_VIRT_TIME, 0))
18969 + return do_settimeofday(ts);
18971 + do_gettimeofday(&tv);
18972 + vxi = current_vx_info();
18973 + vxi->cvirt.bias_tv.tv_sec = ts->tv_sec - tv.tv_sec;
18974 + vxi->cvirt.bias_tv.tv_usec =
18975 + (ts->tv_nsec/NSEC_PER_USEC) - tv.tv_usec;
18981 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/cvirt_init.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cvirt_init.h
18982 --- linux-2.6.35.2/kernel/vserver/cvirt_init.h 1970-01-01 01:00:00.000000000 +0100
18983 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cvirt_init.h 2010-08-02 17:05:06.000000000 +0200
18987 +extern uint64_t vx_idle_jiffies(void);
18989 +static inline void vx_info_init_cvirt(struct _vx_cvirt *cvirt)
18991 + uint64_t idle_jiffies = vx_idle_jiffies();
18992 + uint64_t nsuptime;
18994 + do_posix_clock_monotonic_gettime(&cvirt->bias_uptime);
18995 + nsuptime = (unsigned long long)cvirt->bias_uptime.tv_sec
18996 + * NSEC_PER_SEC + cvirt->bias_uptime.tv_nsec;
18997 + cvirt->bias_clock = nsec_to_clock_t(nsuptime);
18998 + cvirt->bias_tv.tv_sec = 0;
18999 + cvirt->bias_tv.tv_usec = 0;
19001 + jiffies_to_timespec(idle_jiffies, &cvirt->bias_idle);
19002 + atomic_set(&cvirt->nr_threads, 0);
19003 + atomic_set(&cvirt->nr_running, 0);
19004 + atomic_set(&cvirt->nr_uninterruptible, 0);
19005 + atomic_set(&cvirt->nr_onhold, 0);
19007 + spin_lock_init(&cvirt->load_lock);
19008 + cvirt->load_last = jiffies;
19009 + atomic_set(&cvirt->load_updates, 0);
19010 + cvirt->load[0] = 0;
19011 + cvirt->load[1] = 0;
19012 + cvirt->load[2] = 0;
19013 + atomic_set(&cvirt->total_forks, 0);
19015 + spin_lock_init(&cvirt->syslog.logbuf_lock);
19016 + init_waitqueue_head(&cvirt->syslog.log_wait);
19017 + cvirt->syslog.log_start = 0;
19018 + cvirt->syslog.log_end = 0;
19019 + cvirt->syslog.con_start = 0;
19020 + cvirt->syslog.logged_chars = 0;
19024 +void vx_info_init_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, int cpu)
19026 + // cvirt_pc->cpustat = { 0 };
19029 +static inline void vx_info_exit_cvirt(struct _vx_cvirt *cvirt)
19033 + vxwprintk_xid((value = atomic_read(&cvirt->nr_threads)),
19034 + "!!! cvirt: %p[nr_threads] = %d on exit.",
19036 + vxwprintk_xid((value = atomic_read(&cvirt->nr_running)),
19037 + "!!! cvirt: %p[nr_running] = %d on exit.",
19039 + vxwprintk_xid((value = atomic_read(&cvirt->nr_uninterruptible)),
19040 + "!!! cvirt: %p[nr_uninterruptible] = %d on exit.",
19042 + vxwprintk_xid((value = atomic_read(&cvirt->nr_onhold)),
19043 + "!!! cvirt: %p[nr_onhold] = %d on exit.",
19049 +void vx_info_exit_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, int cpu)
19054 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/cvirt_proc.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cvirt_proc.h
19055 --- linux-2.6.35.2/kernel/vserver/cvirt_proc.h 1970-01-01 01:00:00.000000000 +0100
19056 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/cvirt_proc.h 2010-08-02 17:05:06.000000000 +0200
19058 +#ifndef _VX_CVIRT_PROC_H
19059 +#define _VX_CVIRT_PROC_H
19061 +#include <linux/nsproxy.h>
19062 +#include <linux/mnt_namespace.h>
19063 +#include <linux/ipc_namespace.h>
19064 +#include <linux/utsname.h>
19065 +#include <linux/ipc.h>
19069 +int vx_info_proc_nsproxy(struct nsproxy *nsproxy, char *buffer)
19071 + struct mnt_namespace *ns;
19072 + struct uts_namespace *uts;
19073 + struct ipc_namespace *ipc;
19074 + struct path path;
19075 + char *pstr, *root;
19081 + length += sprintf(buffer + length,
19082 + "NSProxy:\t%p [%p,%p,%p]\n",
19083 + nsproxy, nsproxy->mnt_ns,
19084 + nsproxy->uts_ns, nsproxy->ipc_ns);
19086 + ns = nsproxy->mnt_ns;
19090 + pstr = kmalloc(PATH_MAX, GFP_KERNEL);
19094 + path.mnt = ns->root;
19095 + path.dentry = ns->root->mnt_root;
19096 + root = d_path(&path, pstr, PATH_MAX - 2);
19097 + length += sprintf(buffer + length,
19098 + "Namespace:\t%p [#%u]\n"
19099 + "RootPath:\t%s\n",
19100 + ns, atomic_read(&ns->count),
19105 + uts = nsproxy->uts_ns;
19109 + length += sprintf(buffer + length,
19110 + "SysName:\t%.*s\n"
19111 + "NodeName:\t%.*s\n"
19112 + "Release:\t%.*s\n"
19113 + "Version:\t%.*s\n"
19114 + "Machine:\t%.*s\n"
19115 + "DomainName:\t%.*s\n",
19116 + __NEW_UTS_LEN, uts->name.sysname,
19117 + __NEW_UTS_LEN, uts->name.nodename,
19118 + __NEW_UTS_LEN, uts->name.release,
19119 + __NEW_UTS_LEN, uts->name.version,
19120 + __NEW_UTS_LEN, uts->name.machine,
19121 + __NEW_UTS_LEN, uts->name.domainname);
19124 + ipc = nsproxy->ipc_ns;
19128 + length += sprintf(buffer + length,
19129 + "SEMS:\t\t%d %d %d %d %d\n"
19130 + "MSG:\t\t%d %d %d\n"
19131 + "SHM:\t\t%lu %lu %d %d\n",
19132 + ipc->sem_ctls[0], ipc->sem_ctls[1],
19133 + ipc->sem_ctls[2], ipc->sem_ctls[3],
19135 + ipc->msg_ctlmax, ipc->msg_ctlmnb, ipc->msg_ctlmni,
19136 + (unsigned long)ipc->shm_ctlmax,
19137 + (unsigned long)ipc->shm_ctlall,
19138 + ipc->shm_ctlmni, ipc->shm_tot);
19145 +#include <linux/sched.h>
19147 +#define LOAD_INT(x) ((x) >> FSHIFT)
19148 +#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1 - 1)) * 100)
19151 +int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer)
19156 + length += sprintf(buffer + length,
19157 + "BiasUptime:\t%lu.%02lu\n",
19158 + (unsigned long)cvirt->bias_uptime.tv_sec,
19159 + (cvirt->bias_uptime.tv_nsec / (NSEC_PER_SEC / 100)));
19161 + a = cvirt->load[0] + (FIXED_1 / 200);
19162 + b = cvirt->load[1] + (FIXED_1 / 200);
19163 + c = cvirt->load[2] + (FIXED_1 / 200);
19164 + length += sprintf(buffer + length,
19165 + "nr_threads:\t%d\n"
19166 + "nr_running:\t%d\n"
19167 + "nr_unintr:\t%d\n"
19168 + "nr_onhold:\t%d\n"
19169 + "load_updates:\t%d\n"
19170 + "loadavg:\t%d.%02d %d.%02d %d.%02d\n"
19171 + "total_forks:\t%d\n",
19172 + atomic_read(&cvirt->nr_threads),
19173 + atomic_read(&cvirt->nr_running),
19174 + atomic_read(&cvirt->nr_uninterruptible),
19175 + atomic_read(&cvirt->nr_onhold),
19176 + atomic_read(&cvirt->load_updates),
19177 + LOAD_INT(a), LOAD_FRAC(a),
19178 + LOAD_INT(b), LOAD_FRAC(b),
19179 + LOAD_INT(c), LOAD_FRAC(c),
19180 + atomic_read(&cvirt->total_forks));
19185 +int vx_info_proc_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc,
19186 + char *buffer, int cpu)
19192 +#endif /* _VX_CVIRT_PROC_H */
19193 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/debug.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/debug.c
19194 --- linux-2.6.35.2/kernel/vserver/debug.c 1970-01-01 01:00:00.000000000 +0100
19195 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/debug.c 2010-08-02 17:05:06.000000000 +0200
19198 + * kernel/vserver/debug.c
19200 + * Copyright (C) 2005-2007 Herbert Pötzl
19202 + * V0.01 vx_info dump support
19206 +#include <linux/module.h>
19208 +#include <linux/vserver/context.h>
19211 +void dump_vx_info(struct vx_info *vxi, int level)
19213 + printk("vx_info %p[#%d, %d.%d, %4x]\n", vxi, vxi->vx_id,
19214 + atomic_read(&vxi->vx_usecnt),
19215 + atomic_read(&vxi->vx_tasks),
19218 + __dump_vx_limit(&vxi->limit);
19219 + __dump_vx_sched(&vxi->sched);
19220 + __dump_vx_cvirt(&vxi->cvirt);
19221 + __dump_vx_cacct(&vxi->cacct);
19227 +EXPORT_SYMBOL_GPL(dump_vx_info);
19229 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/device.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/device.c
19230 --- linux-2.6.35.2/kernel/vserver/device.c 1970-01-01 01:00:00.000000000 +0100
19231 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/device.c 2010-08-02 17:05:06.000000000 +0200
19234 + * linux/kernel/vserver/device.c
19236 + * Linux-VServer: Device Support
19238 + * Copyright (C) 2006 Herbert Pötzl
19239 + * Copyright (C) 2007 Daniel Hokka Zakrisson
19241 + * V0.01 device mapping basics
19242 + * V0.02 added defaults
19246 +#include <linux/slab.h>
19247 +#include <linux/rcupdate.h>
19248 +#include <linux/fs.h>
19249 +#include <linux/namei.h>
19250 +#include <linux/hash.h>
19252 +#include <asm/errno.h>
19253 +#include <asm/uaccess.h>
19254 +#include <linux/vserver/base.h>
19255 +#include <linux/vserver/debug.h>
19256 +#include <linux/vserver/context.h>
19257 +#include <linux/vserver/device.h>
19258 +#include <linux/vserver/device_cmd.h>
19261 +#define DMAP_HASH_BITS 4
19264 +struct vs_mapping {
19266 + struct hlist_node hlist;
19267 + struct list_head list;
19269 +#define dm_hlist u.hlist
19270 +#define dm_list u.list
19273 + struct vx_dmap_target target;
19277 +static struct hlist_head dmap_main_hash[1 << DMAP_HASH_BITS];
19279 +static spinlock_t dmap_main_hash_lock = SPIN_LOCK_UNLOCKED;
19281 +static struct vx_dmap_target dmap_defaults[2] = {
19282 + { .flags = DATTR_OPEN },
19283 + { .flags = DATTR_OPEN },
19287 +struct kmem_cache *dmap_cachep __read_mostly;
19289 +int __init dmap_cache_init(void)
19291 + dmap_cachep = kmem_cache_create("dmap_cache",
19292 + sizeof(struct vs_mapping), 0,
19293 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
19297 +__initcall(dmap_cache_init);
19300 +static inline unsigned int __hashval(dev_t dev, int bits)
19302 + return hash_long((unsigned long)dev, bits);
19306 +/* __hash_mapping()
19307 + * add the mapping to the hash table
19309 +static inline void __hash_mapping(struct vx_info *vxi, struct vs_mapping *vdm)
19311 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19312 + struct hlist_head *head, *hash = dmap_main_hash;
19313 + int device = vdm->device;
19315 + spin_lock(hash_lock);
19316 + vxdprintk(VXD_CBIT(misc, 8), "__hash_mapping: %p[#%d] %08x:%08x",
19317 + vxi, vxi ? vxi->vx_id : 0, device, vdm->target.target);
19319 + head = &hash[__hashval(device, DMAP_HASH_BITS)];
19320 + hlist_add_head(&vdm->dm_hlist, head);
19321 + spin_unlock(hash_lock);
19325 +static inline int __mode_to_default(umode_t mode)
19338 +/* __set_default()
19341 +static inline void __set_default(struct vx_info *vxi, umode_t mode,
19342 + struct vx_dmap_target *vdmt)
19344 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19345 + spin_lock(hash_lock);
19348 + vxi->dmap.targets[__mode_to_default(mode)] = *vdmt;
19350 + dmap_defaults[__mode_to_default(mode)] = *vdmt;
19353 + spin_unlock(hash_lock);
19355 + vxdprintk(VXD_CBIT(misc, 8), "__set_default: %p[#%u] %08x %04x",
19356 + vxi, vxi ? vxi->vx_id : 0, vdmt->target, vdmt->flags);
19360 +/* __remove_default()
19361 + * remove a default
19363 +static inline int __remove_default(struct vx_info *vxi, umode_t mode)
19365 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19366 + spin_lock(hash_lock);
19369 + vxi->dmap.targets[__mode_to_default(mode)].flags = 0;
19370 + else /* remove == reset */
19371 + dmap_defaults[__mode_to_default(mode)].flags = DATTR_OPEN | mode;
19373 + spin_unlock(hash_lock);
19378 +/* __find_mapping()
19379 + * find a mapping in the hash table
19381 + * caller must hold hash_lock
19383 +static inline int __find_mapping(xid_t xid, dev_t device, umode_t mode,
19384 + struct vs_mapping **local, struct vs_mapping **global)
19386 + struct hlist_head *hash = dmap_main_hash;
19387 + struct hlist_head *head = &hash[__hashval(device, DMAP_HASH_BITS)];
19388 + struct hlist_node *pos;
19389 + struct vs_mapping *vdm;
19395 + hlist_for_each(pos, head) {
19396 + vdm = hlist_entry(pos, struct vs_mapping, dm_hlist);
19398 + if ((vdm->device == device) &&
19399 + !((vdm->target.flags ^ mode) & S_IFMT)) {
19400 + if (vdm->xid == xid) {
19403 + } else if (global && vdm->xid == 0)
19408 + if (global && *global)
19415 +/* __lookup_mapping()
19416 + * find a mapping and store the result in target and flags
19418 +static inline int __lookup_mapping(struct vx_info *vxi,
19419 + dev_t device, dev_t *target, int *flags, umode_t mode)
19421 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19422 + struct vs_mapping *vdm, *global;
19423 + struct vx_dmap_target *vdmt;
19425 + xid_t xid = vxi->vx_id;
19428 + spin_lock(hash_lock);
19429 + if (__find_mapping(xid, device, mode, &vdm, &global) > 0) {
19431 + vdmt = &vdm->target;
19435 + index = __mode_to_default(mode);
19436 + if (vxi && vxi->dmap.targets[index].flags) {
19438 + vdmt = &vxi->dmap.targets[index];
19439 + } else if (global) {
19441 + vdmt = &global->target;
19445 + vdmt = &dmap_defaults[index];
19449 + if (target && (vdmt->flags & DATTR_REMAP))
19450 + *target = vdmt->target;
19452 + *target = device;
19454 + *flags = vdmt->flags;
19456 + spin_unlock(hash_lock);
19462 +/* __remove_mapping()
19463 + * remove a mapping from the hash table
19465 +static inline int __remove_mapping(struct vx_info *vxi, dev_t device,
19468 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19469 + struct vs_mapping *vdm = NULL;
19472 + spin_lock(hash_lock);
19474 + ret = __find_mapping((vxi ? vxi->vx_id : 0), device, mode, &vdm,
19476 + vxdprintk(VXD_CBIT(misc, 8), "__remove_mapping: %p[#%d] %08x %04x",
19477 + vxi, vxi ? vxi->vx_id : 0, device, mode);
19480 + hlist_del(&vdm->dm_hlist);
19483 + spin_unlock(hash_lock);
19485 + kmem_cache_free(dmap_cachep, vdm);
19491 +int vs_map_device(struct vx_info *vxi,
19492 + dev_t device, dev_t *target, umode_t mode)
19494 + int ret, flags = DATTR_MASK;
19498 + *target = device;
19501 + ret = __lookup_mapping(vxi, device, target, &flags, mode);
19502 + vxdprintk(VXD_CBIT(misc, 8), "vs_map_device: %08x target: %08x flags: %04x mode: %04x mapped=%d",
19503 + device, target ? *target : 0, flags, mode, ret);
19505 + return (flags & DATTR_MASK);
19510 +static int do_set_mapping(struct vx_info *vxi,
19511 + dev_t device, dev_t target, int flags, umode_t mode)
19514 + struct vs_mapping *new;
19516 + new = kmem_cache_alloc(dmap_cachep, GFP_KERNEL);
19520 + INIT_HLIST_NODE(&new->dm_hlist);
19521 + new->device = device;
19522 + new->target.target = target;
19523 + new->target.flags = flags | mode;
19524 + new->xid = (vxi ? vxi->vx_id : 0);
19526 + vxdprintk(VXD_CBIT(misc, 8), "do_set_mapping: %08x target: %08x flags: %04x", device, target, flags);
19527 + __hash_mapping(vxi, new);
19529 + struct vx_dmap_target new = {
19530 + .target = target,
19531 + .flags = flags | mode,
19533 + __set_default(vxi, mode, &new);
19539 +static int do_unset_mapping(struct vx_info *vxi,
19540 + dev_t device, dev_t target, int flags, umode_t mode)
19542 + int ret = -EINVAL;
19545 + ret = __remove_mapping(vxi, device, mode);
19549 + ret = __remove_default(vxi, mode);
19559 +static inline int __user_device(const char __user *name, dev_t *dev,
19562 + struct nameidata nd;
19569 + ret = user_lpath(name, &nd.path);
19572 + if (nd.path.dentry->d_inode) {
19573 + *dev = nd.path.dentry->d_inode->i_rdev;
19574 + *mode = nd.path.dentry->d_inode->i_mode;
19576 + path_put(&nd.path);
19580 +static inline int __mapping_mode(dev_t device, dev_t target,
19581 + umode_t device_mode, umode_t target_mode, umode_t *mode)
19584 + *mode = device_mode & S_IFMT;
19586 + *mode = target_mode & S_IFMT;
19590 + /* if both given, device and target mode have to match */
19591 + if (device && target &&
19592 + ((device_mode ^ target_mode) & S_IFMT))
19598 +static inline int do_mapping(struct vx_info *vxi, const char __user *device_path,
19599 + const char __user *target_path, int flags, int set)
19601 + dev_t device = ~0, target = ~0;
19602 + umode_t device_mode = 0, target_mode = 0, mode;
19605 + ret = __user_device(device_path, &device, &device_mode);
19608 + ret = __user_device(target_path, &target, &target_mode);
19612 + ret = __mapping_mode(device, target,
19613 + device_mode, target_mode, &mode);
19618 + return do_set_mapping(vxi, device, target,
19621 + return do_unset_mapping(vxi, device, target,
19626 +int vc_set_mapping(struct vx_info *vxi, void __user *data)
19628 + struct vcmd_set_mapping_v0 vc_data;
19630 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19633 + return do_mapping(vxi, vc_data.device, vc_data.target,
19634 + vc_data.flags, 1);
19637 +int vc_unset_mapping(struct vx_info *vxi, void __user *data)
19639 + struct vcmd_set_mapping_v0 vc_data;
19641 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19644 + return do_mapping(vxi, vc_data.device, vc_data.target,
19645 + vc_data.flags, 0);
19649 +#ifdef CONFIG_COMPAT
19651 +int vc_set_mapping_x32(struct vx_info *vxi, void __user *data)
19653 + struct vcmd_set_mapping_v0_x32 vc_data;
19655 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19658 + return do_mapping(vxi, compat_ptr(vc_data.device_ptr),
19659 + compat_ptr(vc_data.target_ptr), vc_data.flags, 1);
19662 +int vc_unset_mapping_x32(struct vx_info *vxi, void __user *data)
19664 + struct vcmd_set_mapping_v0_x32 vc_data;
19666 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19669 + return do_mapping(vxi, compat_ptr(vc_data.device_ptr),
19670 + compat_ptr(vc_data.target_ptr), vc_data.flags, 0);
19673 +#endif /* CONFIG_COMPAT */
19676 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/dlimit.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/dlimit.c
19677 --- linux-2.6.35.2/kernel/vserver/dlimit.c 1970-01-01 01:00:00.000000000 +0100
19678 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/dlimit.c 2010-08-02 17:05:06.000000000 +0200
19681 + * linux/kernel/vserver/dlimit.c
19683 + * Virtual Server: Context Disk Limits
19685 + * Copyright (C) 2004-2009 Herbert Pötzl
19687 + * V0.01 initial version
19688 + * V0.02 compat32 splitup
19689 + * V0.03 extended interface
19693 +#include <linux/statfs.h>
19694 +#include <linux/sched.h>
19695 +#include <linux/namei.h>
19696 +#include <linux/vs_tag.h>
19697 +#include <linux/vs_dlimit.h>
19698 +#include <linux/vserver/dlimit_cmd.h>
19699 +#include <linux/slab.h>
19700 +// #include <linux/gfp.h>
19702 +#include <asm/uaccess.h>
19704 +/* __alloc_dl_info()
19706 + * allocate an initialized dl_info struct
19707 + * doesn't make it visible (hash) */
19709 +static struct dl_info *__alloc_dl_info(struct super_block *sb, tag_t tag)
19711 + struct dl_info *new = NULL;
19713 + vxdprintk(VXD_CBIT(dlim, 5),
19714 + "alloc_dl_info(%p,%d)*", sb, tag);
19716 + /* would this benefit from a slab cache? */
19717 + new = kmalloc(sizeof(struct dl_info), GFP_KERNEL);
19721 + memset(new, 0, sizeof(struct dl_info));
19722 + new->dl_tag = tag;
19724 + INIT_RCU_HEAD(&new->dl_rcu);
19725 + INIT_HLIST_NODE(&new->dl_hlist);
19726 + spin_lock_init(&new->dl_lock);
19727 + atomic_set(&new->dl_refcnt, 0);
19728 + atomic_set(&new->dl_usecnt, 0);
19730 + /* rest of init goes here */
19732 + vxdprintk(VXD_CBIT(dlim, 4),
19733 + "alloc_dl_info(%p,%d) = %p", sb, tag, new);
19737 +/* __dealloc_dl_info()
19739 + * final disposal of dl_info */
19741 +static void __dealloc_dl_info(struct dl_info *dli)
19743 + vxdprintk(VXD_CBIT(dlim, 4),
19744 + "dealloc_dl_info(%p)", dli);
19746 + dli->dl_hlist.next = LIST_POISON1;
19747 + dli->dl_tag = -1;
19750 + BUG_ON(atomic_read(&dli->dl_usecnt));
19751 + BUG_ON(atomic_read(&dli->dl_refcnt));
19757 +/* hash table for dl_info hash */
19759 +#define DL_HASH_SIZE 13
19761 +struct hlist_head dl_info_hash[DL_HASH_SIZE];
19763 +static spinlock_t dl_info_hash_lock = SPIN_LOCK_UNLOCKED;
19766 +static inline unsigned int __hashval(struct super_block *sb, tag_t tag)
19768 + return ((tag ^ (unsigned long)sb) % DL_HASH_SIZE);
19773 +/* __hash_dl_info()
19775 + * add the dli to the global hash table
19776 + * requires the hash_lock to be held */
19778 +static inline void __hash_dl_info(struct dl_info *dli)
19780 + struct hlist_head *head;
19782 + vxdprintk(VXD_CBIT(dlim, 6),
19783 + "__hash_dl_info: %p[#%d]", dli, dli->dl_tag);
19784 + get_dl_info(dli);
19785 + head = &dl_info_hash[__hashval(dli->dl_sb, dli->dl_tag)];
19786 + hlist_add_head_rcu(&dli->dl_hlist, head);
19789 +/* __unhash_dl_info()
19791 + * remove the dli from the global hash table
19792 + * requires the hash_lock to be held */
19794 +static inline void __unhash_dl_info(struct dl_info *dli)
19796 + vxdprintk(VXD_CBIT(dlim, 6),
19797 + "__unhash_dl_info: %p[#%d]", dli, dli->dl_tag);
19798 + hlist_del_rcu(&dli->dl_hlist);
19799 + put_dl_info(dli);
19803 +/* __lookup_dl_info()
19805 + * requires the rcu_read_lock()
19806 + * doesn't increment the dl_refcnt */
19808 +static inline struct dl_info *__lookup_dl_info(struct super_block *sb, tag_t tag)
19810 + struct hlist_head *head = &dl_info_hash[__hashval(sb, tag)];
19811 + struct hlist_node *pos;
19812 + struct dl_info *dli;
19814 + hlist_for_each_entry_rcu(dli, pos, head, dl_hlist) {
19816 + if (dli->dl_tag == tag && dli->dl_sb == sb) {
19824 +struct dl_info *locate_dl_info(struct super_block *sb, tag_t tag)
19826 + struct dl_info *dli;
19829 + dli = get_dl_info(__lookup_dl_info(sb, tag));
19830 + vxdprintk(VXD_CBIT(dlim, 7),
19831 + "locate_dl_info(%p,#%d) = %p", sb, tag, dli);
19832 + rcu_read_unlock();
19836 +void rcu_free_dl_info(struct rcu_head *head)
19838 + struct dl_info *dli = container_of(head, struct dl_info, dl_rcu);
19839 + int usecnt, refcnt;
19841 + BUG_ON(!dli || !head);
19843 + usecnt = atomic_read(&dli->dl_usecnt);
19844 + BUG_ON(usecnt < 0);
19846 + refcnt = atomic_read(&dli->dl_refcnt);
19847 + BUG_ON(refcnt < 0);
19849 + vxdprintk(VXD_CBIT(dlim, 3),
19850 + "rcu_free_dl_info(%p)", dli);
19852 + __dealloc_dl_info(dli);
19854 + printk("!!! rcu didn't free\n");
19860 +static int do_addrem_dlimit(uint32_t id, const char __user *name,
19861 + uint32_t flags, int add)
19863 + struct path path;
19866 + ret = user_lpath(name, &path);
19868 + struct super_block *sb;
19869 + struct dl_info *dli;
19872 + if (!path.dentry->d_inode)
19873 + goto out_release;
19874 + if (!(sb = path.dentry->d_inode->i_sb))
19875 + goto out_release;
19878 + dli = __alloc_dl_info(sb, id);
19879 + spin_lock(&dl_info_hash_lock);
19882 + if (__lookup_dl_info(sb, id))
19884 + __hash_dl_info(dli);
19887 + spin_lock(&dl_info_hash_lock);
19888 + dli = __lookup_dl_info(sb, id);
19893 + __unhash_dl_info(dli);
19897 + spin_unlock(&dl_info_hash_lock);
19899 + __dealloc_dl_info(dli);
19906 +int vc_add_dlimit(uint32_t id, void __user *data)
19908 + struct vcmd_ctx_dlimit_base_v0 vc_data;
19910 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19913 + return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 1);
19916 +int vc_rem_dlimit(uint32_t id, void __user *data)
19918 + struct vcmd_ctx_dlimit_base_v0 vc_data;
19920 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19923 + return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 0);
19926 +#ifdef CONFIG_COMPAT
19928 +int vc_add_dlimit_x32(uint32_t id, void __user *data)
19930 + struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
19932 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19935 + return do_addrem_dlimit(id,
19936 + compat_ptr(vc_data.name_ptr), vc_data.flags, 1);
19939 +int vc_rem_dlimit_x32(uint32_t id, void __user *data)
19941 + struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
19943 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19946 + return do_addrem_dlimit(id,
19947 + compat_ptr(vc_data.name_ptr), vc_data.flags, 0);
19950 +#endif /* CONFIG_COMPAT */
19954 +int do_set_dlimit(uint32_t id, const char __user *name,
19955 + uint32_t space_used, uint32_t space_total,
19956 + uint32_t inodes_used, uint32_t inodes_total,
19957 + uint32_t reserved, uint32_t flags)
19959 + struct path path;
19962 + ret = user_lpath(name, &path);
19964 + struct super_block *sb;
19965 + struct dl_info *dli;
19968 + if (!path.dentry->d_inode)
19969 + goto out_release;
19970 + if (!(sb = path.dentry->d_inode->i_sb))
19971 + goto out_release;
19973 + /* sanity checks */
19974 + if ((reserved != CDLIM_KEEP &&
19975 + reserved > 100) ||
19976 + (inodes_used != CDLIM_KEEP &&
19977 + inodes_used > inodes_total) ||
19978 + (space_used != CDLIM_KEEP &&
19979 + space_used > space_total))
19980 + goto out_release;
19983 + dli = locate_dl_info(sb, id);
19985 + goto out_release;
19987 + spin_lock(&dli->dl_lock);
19989 + if (inodes_used != CDLIM_KEEP)
19990 + dli->dl_inodes_used = inodes_used;
19991 + if (inodes_total != CDLIM_KEEP)
19992 + dli->dl_inodes_total = inodes_total;
19993 + if (space_used != CDLIM_KEEP)
19994 + dli->dl_space_used = dlimit_space_32to64(
19995 + space_used, flags, DLIMS_USED);
19997 + if (space_total == CDLIM_INFINITY)
19998 + dli->dl_space_total = DLIM_INFINITY;
19999 + else if (space_total != CDLIM_KEEP)
20000 + dli->dl_space_total = dlimit_space_32to64(
20001 + space_total, flags, DLIMS_TOTAL);
20003 + if (reserved != CDLIM_KEEP)
20004 + dli->dl_nrlmult = (1 << 10) * (100 - reserved) / 100;
20006 + spin_unlock(&dli->dl_lock);
20008 + put_dl_info(dli);
20017 +int vc_set_dlimit(uint32_t id, void __user *data)
20019 + struct vcmd_ctx_dlimit_v0 vc_data;
20021 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20024 + return do_set_dlimit(id, vc_data.name,
20025 + vc_data.space_used, vc_data.space_total,
20026 + vc_data.inodes_used, vc_data.inodes_total,
20027 + vc_data.reserved, vc_data.flags);
20030 +#ifdef CONFIG_COMPAT
20032 +int vc_set_dlimit_x32(uint32_t id, void __user *data)
20034 + struct vcmd_ctx_dlimit_v0_x32 vc_data;
20036 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20039 + return do_set_dlimit(id, compat_ptr(vc_data.name_ptr),
20040 + vc_data.space_used, vc_data.space_total,
20041 + vc_data.inodes_used, vc_data.inodes_total,
20042 + vc_data.reserved, vc_data.flags);
20045 +#endif /* CONFIG_COMPAT */
20049 +int do_get_dlimit(uint32_t id, const char __user *name,
20050 + uint32_t *space_used, uint32_t *space_total,
20051 + uint32_t *inodes_used, uint32_t *inodes_total,
20052 + uint32_t *reserved, uint32_t *flags)
20054 + struct path path;
20057 + ret = user_lpath(name, &path);
20059 + struct super_block *sb;
20060 + struct dl_info *dli;
20063 + if (!path.dentry->d_inode)
20064 + goto out_release;
20065 + if (!(sb = path.dentry->d_inode->i_sb))
20066 + goto out_release;
20069 + dli = locate_dl_info(sb, id);
20071 + goto out_release;
20073 + spin_lock(&dli->dl_lock);
20074 + *inodes_used = dli->dl_inodes_used;
20075 + *inodes_total = dli->dl_inodes_total;
20077 + *space_used = dlimit_space_64to32(
20078 + dli->dl_space_used, flags, DLIMS_USED);
20080 + if (dli->dl_space_total == DLIM_INFINITY)
20081 + *space_total = CDLIM_INFINITY;
20083 + *space_total = dlimit_space_64to32(
20084 + dli->dl_space_total, flags, DLIMS_TOTAL);
20086 + *reserved = 100 - ((dli->dl_nrlmult * 100 + 512) >> 10);
20087 + spin_unlock(&dli->dl_lock);
20089 + put_dl_info(dli);
20100 +int vc_get_dlimit(uint32_t id, void __user *data)
20102 + struct vcmd_ctx_dlimit_v0 vc_data;
20105 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20108 + ret = do_get_dlimit(id, vc_data.name,
20109 + &vc_data.space_used, &vc_data.space_total,
20110 + &vc_data.inodes_used, &vc_data.inodes_total,
20111 + &vc_data.reserved, &vc_data.flags);
20115 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20120 +#ifdef CONFIG_COMPAT
20122 +int vc_get_dlimit_x32(uint32_t id, void __user *data)
20124 + struct vcmd_ctx_dlimit_v0_x32 vc_data;
20127 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20130 + ret = do_get_dlimit(id, compat_ptr(vc_data.name_ptr),
20131 + &vc_data.space_used, &vc_data.space_total,
20132 + &vc_data.inodes_used, &vc_data.inodes_total,
20133 + &vc_data.reserved, &vc_data.flags);
20137 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20142 +#endif /* CONFIG_COMPAT */
20145 +void vx_vsi_statfs(struct super_block *sb, struct kstatfs *buf)
20147 + struct dl_info *dli;
20148 + __u64 blimit, bfree, bavail;
20151 + dli = locate_dl_info(sb, dx_current_tag());
20155 + spin_lock(&dli->dl_lock);
20156 + if (dli->dl_inodes_total == (unsigned long)DLIM_INFINITY)
20159 + /* reduce max inodes available to limit */
20160 + if (buf->f_files > dli->dl_inodes_total)
20161 + buf->f_files = dli->dl_inodes_total;
20163 + ifree = dli->dl_inodes_total - dli->dl_inodes_used;
20164 + /* reduce free inodes to min */
20165 + if (ifree < buf->f_ffree)
20166 + buf->f_ffree = ifree;
20169 + if (dli->dl_space_total == DLIM_INFINITY)
20172 + blimit = dli->dl_space_total >> sb->s_blocksize_bits;
20174 + if (dli->dl_space_total < dli->dl_space_used)
20177 + bfree = (dli->dl_space_total - dli->dl_space_used)
20178 + >> sb->s_blocksize_bits;
20180 + bavail = ((dli->dl_space_total >> 10) * dli->dl_nrlmult);
20181 + if (bavail < dli->dl_space_used)
20184 + bavail = (bavail - dli->dl_space_used)
20185 + >> sb->s_blocksize_bits;
20187 + /* reduce max space available to limit */
20188 + if (buf->f_blocks > blimit)
20189 + buf->f_blocks = blimit;
20191 + /* reduce free space to min */
20192 + if (bfree < buf->f_bfree)
20193 + buf->f_bfree = bfree;
20195 + /* reduce avail space to min */
20196 + if (bavail < buf->f_bavail)
20197 + buf->f_bavail = bavail;
20200 + spin_unlock(&dli->dl_lock);
20201 + put_dl_info(dli);
20206 +#include <linux/module.h>
20208 +EXPORT_SYMBOL_GPL(locate_dl_info);
20209 +EXPORT_SYMBOL_GPL(rcu_free_dl_info);
20211 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/helper.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/helper.c
20212 --- linux-2.6.35.2/kernel/vserver/helper.c 1970-01-01 01:00:00.000000000 +0100
20213 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/helper.c 2010-08-02 17:05:06.000000000 +0200
20216 + * linux/kernel/vserver/helper.c
20218 + * Virtual Context Support
20220 + * Copyright (C) 2004-2007 Herbert Pötzl
20222 + * V0.01 basic helper
20226 +#include <linux/kmod.h>
20227 +#include <linux/reboot.h>
20228 +#include <linux/vs_context.h>
20229 +#include <linux/vs_network.h>
20230 +#include <linux/vserver/signal.h>
20233 +char vshelper_path[255] = "/sbin/vshelper";
20236 +static int do_vshelper(char *name, char *argv[], char *envp[], int sync)
20240 + if ((ret = call_usermodehelper(name, argv, envp, sync))) {
20241 + printk( KERN_WARNING
20242 + "%s: (%s %s) returned %s with %d\n",
20243 + name, argv[1], argv[2],
20244 + sync ? "sync" : "async", ret);
20246 + vxdprintk(VXD_CBIT(switch, 4),
20247 + "%s: (%s %s) returned %s with %d",
20248 + name, argv[1], argv[2], sync ? "sync" : "async", ret);
20253 + * vshelper path is set via /proc/sys
20254 + * invoked by vserver sys_reboot(), with
20255 + * the following arguments
20257 + * argv [0] = vshelper_path;
20258 + * argv [1] = action: "restart", "halt", "poweroff", ...
20259 + * argv [2] = context identifier
20261 + * envp [*] = type-specific parameters
20264 +long vs_reboot_helper(struct vx_info *vxi, int cmd, void __user *arg)
20266 + char id_buf[8], cmd_buf[16];
20267 + char uid_buf[16], pid_buf[16];
20270 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20271 + char *envp[] = {"HOME=/", "TERM=linux",
20272 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
20273 + uid_buf, pid_buf, cmd_buf, 0};
20275 + if (vx_info_state(vxi, VXS_HELPER))
20277 + vxi->vx_state |= VXS_HELPER;
20279 + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
20281 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20282 + snprintf(uid_buf, sizeof(uid_buf)-1, "VS_UID=%d", current_uid());
20283 + snprintf(pid_buf, sizeof(pid_buf)-1, "VS_PID=%d", current->pid);
20286 + case LINUX_REBOOT_CMD_RESTART:
20287 + argv[1] = "restart";
20290 + case LINUX_REBOOT_CMD_HALT:
20291 + argv[1] = "halt";
20294 + case LINUX_REBOOT_CMD_POWER_OFF:
20295 + argv[1] = "poweroff";
20298 + case LINUX_REBOOT_CMD_SW_SUSPEND:
20299 + argv[1] = "swsusp";
20302 + case LINUX_REBOOT_CMD_OOM:
20307 + vxi->vx_state &= ~VXS_HELPER;
20311 + ret = do_vshelper(vshelper_path, argv, envp, 0);
20312 + vxi->vx_state &= ~VXS_HELPER;
20313 + __wakeup_vx_info(vxi);
20314 + return (ret) ? -EPERM : 0;
20318 +long vs_reboot(unsigned int cmd, void __user *arg)
20320 + struct vx_info *vxi = current_vx_info();
20323 + vxdprintk(VXD_CBIT(misc, 5),
20324 + "vs_reboot(%p[#%d],%u)",
20325 + vxi, vxi ? vxi->vx_id : 0, cmd);
20327 + ret = vs_reboot_helper(vxi, cmd, arg);
20331 + vxi->reboot_cmd = cmd;
20332 + if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
20334 + case LINUX_REBOOT_CMD_RESTART:
20335 + case LINUX_REBOOT_CMD_HALT:
20336 + case LINUX_REBOOT_CMD_POWER_OFF:
20337 + vx_info_kill(vxi, 0, SIGKILL);
20338 + vx_info_kill(vxi, 1, SIGKILL);
20346 +long vs_oom_action(unsigned int cmd)
20348 + struct vx_info *vxi = current_vx_info();
20351 + vxdprintk(VXD_CBIT(misc, 5),
20352 + "vs_oom_action(%p[#%d],%u)",
20353 + vxi, vxi ? vxi->vx_id : 0, cmd);
20355 + ret = vs_reboot_helper(vxi, cmd, NULL);
20359 + vxi->reboot_cmd = cmd;
20360 + if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
20361 + vx_info_kill(vxi, 0, SIGKILL);
20362 + vx_info_kill(vxi, 1, SIGKILL);
20368 + * argv [0] = vshelper_path;
20369 + * argv [1] = action: "startup", "shutdown"
20370 + * argv [2] = context identifier
20372 + * envp [*] = type-specific parameters
20375 +long vs_state_change(struct vx_info *vxi, unsigned int cmd)
20377 + char id_buf[8], cmd_buf[16];
20378 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20379 + char *envp[] = {"HOME=/", "TERM=linux",
20380 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
20382 + if (!vx_info_flags(vxi, VXF_SC_HELPER, 0))
20385 + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
20386 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20389 + case VSC_STARTUP:
20390 + argv[1] = "startup";
20392 + case VSC_SHUTDOWN:
20393 + argv[1] = "shutdown";
20399 + return do_vshelper(vshelper_path, argv, envp, 1);
20404 + * argv [0] = vshelper_path;
20405 + * argv [1] = action: "netup", "netdown"
20406 + * argv [2] = context identifier
20408 + * envp [*] = type-specific parameters
20411 +long vs_net_change(struct nx_info *nxi, unsigned int cmd)
20413 + char id_buf[8], cmd_buf[16];
20414 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20415 + char *envp[] = {"HOME=/", "TERM=linux",
20416 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
20418 + if (!nx_info_flags(nxi, NXF_SC_HELPER, 0))
20421 + snprintf(id_buf, sizeof(id_buf)-1, "%d", nxi->nx_id);
20422 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20426 + argv[1] = "netup";
20428 + case VSC_NETDOWN:
20429 + argv[1] = "netdown";
20435 + return do_vshelper(vshelper_path, argv, envp, 1);
20438 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/history.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/history.c
20439 --- linux-2.6.35.2/kernel/vserver/history.c 1970-01-01 01:00:00.000000000 +0100
20440 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/history.c 2010-08-02 17:05:06.000000000 +0200
20443 + * kernel/vserver/history.c
20445 + * Virtual Context History Backtrace
20447 + * Copyright (C) 2004-2007 Herbert Pötzl
20449 + * V0.01 basic structure
20450 + * V0.02 hash/unhash and trace
20451 + * V0.03 preemption fixes
20455 +#include <linux/module.h>
20456 +#include <asm/uaccess.h>
20458 +#include <linux/vserver/context.h>
20459 +#include <linux/vserver/debug.h>
20460 +#include <linux/vserver/debug_cmd.h>
20461 +#include <linux/vserver/history.h>
20464 +#ifdef CONFIG_VSERVER_HISTORY
20465 +#define VXH_SIZE CONFIG_VSERVER_HISTORY_SIZE
20467 +#define VXH_SIZE 64
20470 +struct _vx_history {
20471 + unsigned int counter;
20473 + struct _vx_hist_entry entry[VXH_SIZE + 1];
20477 +DEFINE_PER_CPU(struct _vx_history, vx_history_buffer);
20479 +unsigned volatile int vxh_active = 1;
20481 +static atomic_t sequence = ATOMIC_INIT(0);
20486 + * requires disabled preemption */
20488 +struct _vx_hist_entry *vxh_advance(void *loc)
20490 + unsigned int cpu = smp_processor_id();
20491 + struct _vx_history *hist = &per_cpu(vx_history_buffer, cpu);
20492 + struct _vx_hist_entry *entry;
20493 + unsigned int index;
20495 + index = vxh_active ? (hist->counter++ % VXH_SIZE) : VXH_SIZE;
20496 + entry = &hist->entry[index];
20498 + entry->seq = atomic_inc_return(&sequence);
20499 + entry->loc = loc;
20503 +EXPORT_SYMBOL_GPL(vxh_advance);
20506 +#define VXH_LOC_FMTS "(#%04x,*%d):%p"
20508 +#define VXH_LOC_ARGS(e) (e)->seq, cpu, (e)->loc
20511 +#define VXH_VXI_FMTS "%p[#%d,%d.%d]"
20513 +#define VXH_VXI_ARGS(e) (e)->vxi.ptr, \
20514 + (e)->vxi.ptr ? (e)->vxi.xid : 0, \
20515 + (e)->vxi.ptr ? (e)->vxi.usecnt : 0, \
20516 + (e)->vxi.ptr ? (e)->vxi.tasks : 0
20518 +void vxh_dump_entry(struct _vx_hist_entry *e, unsigned cpu)
20520 + switch (e->type) {
20521 + case VXH_THROW_OOPS:
20522 + printk( VXH_LOC_FMTS " oops \n", VXH_LOC_ARGS(e));
20525 + case VXH_GET_VX_INFO:
20526 + case VXH_PUT_VX_INFO:
20527 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS "\n",
20529 + (e->type == VXH_GET_VX_INFO) ? "get" : "put",
20530 + VXH_VXI_ARGS(e));
20533 + case VXH_INIT_VX_INFO:
20534 + case VXH_SET_VX_INFO:
20535 + case VXH_CLR_VX_INFO:
20536 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS " @%p\n",
20538 + (e->type == VXH_INIT_VX_INFO) ? "init" :
20539 + ((e->type == VXH_SET_VX_INFO) ? "set" : "clr"),
20540 + VXH_VXI_ARGS(e), e->sc.data);
20543 + case VXH_CLAIM_VX_INFO:
20544 + case VXH_RELEASE_VX_INFO:
20545 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS " @%p\n",
20547 + (e->type == VXH_CLAIM_VX_INFO) ? "claim" : "release",
20548 + VXH_VXI_ARGS(e), e->sc.data);
20551 + case VXH_ALLOC_VX_INFO:
20552 + case VXH_DEALLOC_VX_INFO:
20553 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS "\n",
20555 + (e->type == VXH_ALLOC_VX_INFO) ? "alloc" : "dealloc",
20556 + VXH_VXI_ARGS(e));
20559 + case VXH_HASH_VX_INFO:
20560 + case VXH_UNHASH_VX_INFO:
20561 + printk( VXH_LOC_FMTS " __%s_vx_info " VXH_VXI_FMTS "\n",
20563 + (e->type == VXH_HASH_VX_INFO) ? "hash" : "unhash",
20564 + VXH_VXI_ARGS(e));
20567 + case VXH_LOC_VX_INFO:
20568 + case VXH_LOOKUP_VX_INFO:
20569 + case VXH_CREATE_VX_INFO:
20570 + printk( VXH_LOC_FMTS " __%s_vx_info [#%d] -> " VXH_VXI_FMTS "\n",
20572 + (e->type == VXH_CREATE_VX_INFO) ? "create" :
20573 + ((e->type == VXH_LOC_VX_INFO) ? "loc" : "lookup"),
20574 + e->ll.arg, VXH_VXI_ARGS(e));
20579 +static void __vxh_dump_history(void)
20581 + unsigned int i, cpu;
20583 + printk("History:\tSEQ: %8x\tNR_CPUS: %d\n",
20584 + atomic_read(&sequence), NR_CPUS);
20586 + for (i = 0; i < VXH_SIZE; i++) {
20587 + for_each_online_cpu(cpu) {
20588 + struct _vx_history *hist =
20589 + &per_cpu(vx_history_buffer, cpu);
20590 + unsigned int index = (hist->counter - i) % VXH_SIZE;
20591 + struct _vx_hist_entry *entry = &hist->entry[index];
20593 + vxh_dump_entry(entry, cpu);
20598 +void vxh_dump_history(void)
20602 + local_irq_enable();
20604 + local_irq_disable();
20606 + __vxh_dump_history();
20610 +/* vserver syscall commands below here */
20613 +int vc_dump_history(uint32_t id)
20616 + __vxh_dump_history();
20623 +int do_read_history(struct __user _vx_hist_entry *data,
20624 + int cpu, uint32_t *index, uint32_t *count)
20626 + int pos, ret = 0;
20627 + struct _vx_history *hist = &per_cpu(vx_history_buffer, cpu);
20628 + int end = hist->counter;
20629 + int start = end - VXH_SIZE + 2;
20630 + int idx = *index;
20632 + /* special case: get current pos */
20638 + /* have we lost some data? */
20642 + for (pos = 0; (pos < *count) && (idx < end); pos++, idx++) {
20643 + struct _vx_hist_entry *entry =
20644 + &hist->entry[idx % VXH_SIZE];
20646 + /* send entry to userspace */
20647 + ret = copy_to_user(&data[pos], entry, sizeof(*entry));
20651 + /* save new index and count */
20654 + return ret ? ret : (*index < end);
20657 +int vc_read_history(uint32_t id, void __user *data)
20659 + struct vcmd_read_history_v0 vc_data;
20662 + if (id >= NR_CPUS)
20665 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20668 + ret = do_read_history((struct __user _vx_hist_entry *)vc_data.data,
20669 + id, &vc_data.index, &vc_data.count);
20671 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20676 +#ifdef CONFIG_COMPAT
20678 +int vc_read_history_x32(uint32_t id, void __user *data)
20680 + struct vcmd_read_history_v0_x32 vc_data;
20683 + if (id >= NR_CPUS)
20686 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20689 + ret = do_read_history((struct __user _vx_hist_entry *)
20690 + compat_ptr(vc_data.data_ptr),
20691 + id, &vc_data.index, &vc_data.count);
20693 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20698 +#endif /* CONFIG_COMPAT */
20700 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/inet.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/inet.c
20701 --- linux-2.6.35.2/kernel/vserver/inet.c 1970-01-01 01:00:00.000000000 +0100
20702 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/inet.c 2010-08-02 18:54:03.000000000 +0200
20705 +#include <linux/in.h>
20706 +#include <linux/inetdevice.h>
20707 +#include <linux/vs_inet.h>
20708 +#include <linux/vs_inet6.h>
20709 +#include <linux/vserver/debug.h>
20710 +#include <net/route.h>
20711 +#include <net/addrconf.h>
20714 +int nx_v4_addr_conflict(struct nx_info *nxi1, struct nx_info *nxi2)
20718 + if (!nxi1 || !nxi2 || nxi1 == nxi2)
20721 + struct nx_addr_v4 *ptr;
20723 + for (ptr = &nxi1->v4; ptr; ptr = ptr->next) {
20724 + if (v4_nx_addr_in_nx_info(nxi2, ptr, -1)) {
20731 + vxdprintk(VXD_CBIT(net, 2),
20732 + "nx_v4_addr_conflict(%p,%p): %d",
20733 + nxi1, nxi2, ret);
20739 +#ifdef CONFIG_IPV6
20741 +int nx_v6_addr_conflict(struct nx_info *nxi1, struct nx_info *nxi2)
20745 + if (!nxi1 || !nxi2 || nxi1 == nxi2)
20748 + struct nx_addr_v6 *ptr;
20750 + for (ptr = &nxi1->v6; ptr; ptr = ptr->next) {
20751 + if (v6_nx_addr_in_nx_info(nxi2, ptr, -1)) {
20758 + vxdprintk(VXD_CBIT(net, 2),
20759 + "nx_v6_addr_conflict(%p,%p): %d",
20760 + nxi1, nxi2, ret);
20767 +int v4_dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
20769 + struct in_device *in_dev;
20770 + struct in_ifaddr **ifap;
20771 + struct in_ifaddr *ifa;
20776 + in_dev = in_dev_get(dev);
20780 + for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
20781 + ifap = &ifa->ifa_next) {
20782 + if (v4_addr_in_nx_info(nxi, ifa->ifa_local, NXA_MASK_SHOW)) {
20787 + in_dev_put(in_dev);
20793 +#ifdef CONFIG_IPV6
20795 +int v6_dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
20797 + struct inet6_dev *in_dev;
20798 + struct inet6_ifaddr *ifa;
20803 + in_dev = in6_dev_get(dev);
20807 + // for (ifap = &in_dev->addr_list; (ifa = *ifap) != NULL;
20808 + list_for_each_entry(ifa, &in_dev->addr_list, if_list) {
20809 + if (v6_addr_in_nx_info(nxi, &ifa->addr, -1)) {
20814 + in6_dev_put(in_dev);
20821 +int dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
20827 + if (nxi->v4.type && v4_dev_in_nx_info(dev, nxi))
20829 +#ifdef CONFIG_IPV6
20831 + if (nxi->v6.type && v6_dev_in_nx_info(dev, nxi))
20836 + vxdprintk(VXD_CBIT(net, 3),
20837 + "dev_in_nx_info(%p,%p[#%d]) = %d",
20838 + dev, nxi, nxi ? nxi->nx_id : 0, ret);
20842 +int ip_v4_find_src(struct net *net, struct nx_info *nxi,
20843 + struct rtable **rp, struct flowi *fl)
20848 + /* FIXME: handle lback only case */
20849 + if (!NX_IPV4(nxi))
20852 + vxdprintk(VXD_CBIT(net, 4),
20853 + "ip_v4_find_src(%p[#%u]) " NIPQUAD_FMT " -> " NIPQUAD_FMT,
20854 + nxi, nxi ? nxi->nx_id : 0,
20855 + NIPQUAD(fl->fl4_src), NIPQUAD(fl->fl4_dst));
20857 + /* single IP is unconditional */
20858 + if (nx_info_flags(nxi, NXF_SINGLE_IP, 0) &&
20859 + (fl->fl4_src == INADDR_ANY))
20860 + fl->fl4_src = nxi->v4.ip[0].s_addr;
20862 + if (fl->fl4_src == INADDR_ANY) {
20863 + struct nx_addr_v4 *ptr;
20864 + __be32 found = 0;
20867 + err = __ip_route_output_key(net, rp, fl);
20869 + found = (*rp)->rt_src;
20871 + vxdprintk(VXD_CBIT(net, 4),
20872 + "ip_v4_find_src(%p[#%u]) rok[%u]: " NIPQUAD_FMT,
20873 + nxi, nxi ? nxi->nx_id : 0, fl->oif, NIPQUAD(found));
20874 + if (v4_addr_in_nx_info(nxi, found, NXA_MASK_BIND))
20878 + for (ptr = &nxi->v4; ptr; ptr = ptr->next) {
20879 + __be32 primary = ptr->ip[0].s_addr;
20880 + __be32 mask = ptr->mask.s_addr;
20881 + __be32 neta = primary & mask;
20883 + vxdprintk(VXD_CBIT(net, 4), "ip_v4_find_src(%p[#%u]) chk: "
20884 + NIPQUAD_FMT "/" NIPQUAD_FMT "/" NIPQUAD_FMT,
20885 + nxi, nxi ? nxi->nx_id : 0, NIPQUAD(primary),
20886 + NIPQUAD(mask), NIPQUAD(neta));
20887 + if ((found & mask) != neta)
20890 + fl->fl4_src = primary;
20891 + err = __ip_route_output_key(net, rp, fl);
20892 + vxdprintk(VXD_CBIT(net, 4),
20893 + "ip_v4_find_src(%p[#%u]) rok[%u]: " NIPQUAD_FMT,
20894 + nxi, nxi ? nxi->nx_id : 0, fl->oif, NIPQUAD(primary));
20896 + found = (*rp)->rt_src;
20898 + if (found == primary)
20902 + /* still no source ip? */
20903 + found = ipv4_is_loopback(fl->fl4_dst)
20904 + ? IPI_LOOPBACK : nxi->v4.ip[0].s_addr;
20906 + /* assign src ip to flow */
20907 + fl->fl4_src = found;
20910 + if (!v4_addr_in_nx_info(nxi, fl->fl4_src, NXA_MASK_BIND))
20914 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0)) {
20915 + if (ipv4_is_loopback(fl->fl4_dst))
20916 + fl->fl4_dst = nxi->v4_lback.s_addr;
20917 + if (ipv4_is_loopback(fl->fl4_src))
20918 + fl->fl4_src = nxi->v4_lback.s_addr;
20919 + } else if (ipv4_is_loopback(fl->fl4_dst) &&
20920 + !nx_info_flags(nxi, NXF_LBACK_ALLOW, 0))
20926 +EXPORT_SYMBOL_GPL(ip_v4_find_src);
20928 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/init.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/init.c
20929 --- linux-2.6.35.2/kernel/vserver/init.c 1970-01-01 01:00:00.000000000 +0100
20930 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/init.c 2010-08-02 17:05:06.000000000 +0200
20933 + * linux/kernel/init.c
20935 + * Virtual Server Init
20937 + * Copyright (C) 2004-2007 Herbert Pötzl
20939 + * V0.01 basic structure
20943 +#include <linux/init.h>
20945 +int vserver_register_sysctl(void);
20946 +void vserver_unregister_sysctl(void);
20949 +static int __init init_vserver(void)
20953 +#ifdef CONFIG_VSERVER_DEBUG
20954 + vserver_register_sysctl();
20960 +static void __exit exit_vserver(void)
20963 +#ifdef CONFIG_VSERVER_DEBUG
20964 + vserver_unregister_sysctl();
20969 +/* FIXME: GFP_ZONETYPES gone
20970 +long vx_slab[GFP_ZONETYPES]; */
20974 +module_init(init_vserver);
20975 +module_exit(exit_vserver);
20977 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/inode.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/inode.c
20978 --- linux-2.6.35.2/kernel/vserver/inode.c 1970-01-01 01:00:00.000000000 +0100
20979 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/inode.c 2010-08-02 17:05:06.000000000 +0200
20982 + * linux/kernel/vserver/inode.c
20984 + * Virtual Server: File System Support
20986 + * Copyright (C) 2004-2007 Herbert Pötzl
20988 + * V0.01 separated from vcontext V0.05
20989 + * V0.02 moved to tag (instead of xid)
20993 +#include <linux/tty.h>
20994 +#include <linux/proc_fs.h>
20995 +#include <linux/devpts_fs.h>
20996 +#include <linux/fs.h>
20997 +#include <linux/file.h>
20998 +#include <linux/mount.h>
20999 +#include <linux/parser.h>
21000 +#include <linux/namei.h>
21001 +#include <linux/vserver/inode.h>
21002 +#include <linux/vserver/inode_cmd.h>
21003 +#include <linux/vs_base.h>
21004 +#include <linux/vs_tag.h>
21006 +#include <asm/uaccess.h>
21009 +static int __vc_get_iattr(struct inode *in, uint32_t *tag, uint32_t *flags, uint32_t *mask)
21011 + struct proc_dir_entry *entry;
21013 + if (!in || !in->i_sb)
21016 + *flags = IATTR_TAG
21017 + | (IS_IMMUTABLE(in) ? IATTR_IMMUTABLE : 0)
21018 + | (IS_IXUNLINK(in) ? IATTR_IXUNLINK : 0)
21019 + | (IS_BARRIER(in) ? IATTR_BARRIER : 0)
21020 + | (IS_COW(in) ? IATTR_COW : 0);
21021 + *mask = IATTR_IXUNLINK | IATTR_IMMUTABLE | IATTR_COW;
21023 + if (S_ISDIR(in->i_mode))
21024 + *mask |= IATTR_BARRIER;
21026 + if (IS_TAGGED(in)) {
21027 + *tag = in->i_tag;
21028 + *mask |= IATTR_TAG;
21031 + switch (in->i_sb->s_magic) {
21032 + case PROC_SUPER_MAGIC:
21033 + entry = PROC_I(in)->pde;
21035 + /* check for specific inodes? */
21037 + *mask |= IATTR_FLAGS;
21039 + *flags |= (entry->vx_flags & IATTR_FLAGS);
21041 + *flags |= (PROC_I(in)->vx_flags & IATTR_FLAGS);
21044 + case DEVPTS_SUPER_MAGIC:
21045 + *tag = in->i_tag;
21046 + *mask |= IATTR_TAG;
21055 +int vc_get_iattr(void __user *data)
21057 + struct path path;
21058 + struct vcmd_ctx_iattr_v1 vc_data = { .tag = -1 };
21061 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21064 + ret = user_lpath(vc_data.name, &path);
21066 + ret = __vc_get_iattr(path.dentry->d_inode,
21067 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21073 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21078 +#ifdef CONFIG_COMPAT
21080 +int vc_get_iattr_x32(void __user *data)
21082 + struct path path;
21083 + struct vcmd_ctx_iattr_v1_x32 vc_data = { .tag = -1 };
21086 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21089 + ret = user_lpath(compat_ptr(vc_data.name_ptr), &path);
21091 + ret = __vc_get_iattr(path.dentry->d_inode,
21092 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21098 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21103 +#endif /* CONFIG_COMPAT */
21106 +int vc_fget_iattr(uint32_t fd, void __user *data)
21108 + struct file *filp;
21109 + struct vcmd_ctx_fiattr_v0 vc_data = { .tag = -1 };
21112 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21116 + if (!filp || !filp->f_dentry || !filp->f_dentry->d_inode)
21119 + ret = __vc_get_iattr(filp->f_dentry->d_inode,
21120 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21124 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21130 +static int __vc_set_iattr(struct dentry *de, uint32_t *tag, uint32_t *flags, uint32_t *mask)
21132 + struct inode *in = de->d_inode;
21133 + int error = 0, is_proc = 0, has_tag = 0;
21134 + struct iattr attr = { 0 };
21136 + if (!in || !in->i_sb)
21139 + is_proc = (in->i_sb->s_magic == PROC_SUPER_MAGIC);
21140 + if ((*mask & IATTR_FLAGS) && !is_proc)
21143 + has_tag = IS_TAGGED(in) ||
21144 + (in->i_sb->s_magic == DEVPTS_SUPER_MAGIC);
21145 + if ((*mask & IATTR_TAG) && !has_tag)
21148 + mutex_lock(&in->i_mutex);
21149 + if (*mask & IATTR_TAG) {
21150 + attr.ia_tag = *tag;
21151 + attr.ia_valid |= ATTR_TAG;
21154 + if (*mask & IATTR_FLAGS) {
21155 + struct proc_dir_entry *entry = PROC_I(in)->pde;
21156 + unsigned int iflags = PROC_I(in)->vx_flags;
21158 + iflags = (iflags & ~(*mask & IATTR_FLAGS))
21159 + | (*flags & IATTR_FLAGS);
21160 + PROC_I(in)->vx_flags = iflags;
21162 + entry->vx_flags = iflags;
21165 + if (*mask & (IATTR_IMMUTABLE | IATTR_IXUNLINK |
21166 + IATTR_BARRIER | IATTR_COW)) {
21167 + int iflags = in->i_flags;
21168 + int vflags = in->i_vflags;
21170 + if (*mask & IATTR_IMMUTABLE) {
21171 + if (*flags & IATTR_IMMUTABLE)
21172 + iflags |= S_IMMUTABLE;
21174 + iflags &= ~S_IMMUTABLE;
21176 + if (*mask & IATTR_IXUNLINK) {
21177 + if (*flags & IATTR_IXUNLINK)
21178 + iflags |= S_IXUNLINK;
21180 + iflags &= ~S_IXUNLINK;
21182 + if (S_ISDIR(in->i_mode) && (*mask & IATTR_BARRIER)) {
21183 + if (*flags & IATTR_BARRIER)
21184 + vflags |= V_BARRIER;
21186 + vflags &= ~V_BARRIER;
21188 + if (S_ISREG(in->i_mode) && (*mask & IATTR_COW)) {
21189 + if (*flags & IATTR_COW)
21192 + vflags &= ~V_COW;
21194 + if (in->i_op && in->i_op->sync_flags) {
21195 + error = in->i_op->sync_flags(in, iflags, vflags);
21201 + if (attr.ia_valid) {
21202 + if (in->i_op && in->i_op->setattr)
21203 + error = in->i_op->setattr(de, &attr);
21205 + error = inode_change_ok(in, &attr);
21207 + error = inode_setattr(in, &attr);
21212 + mutex_unlock(&in->i_mutex);
21216 +int vc_set_iattr(void __user *data)
21218 + struct path path;
21219 + struct vcmd_ctx_iattr_v1 vc_data;
21222 + if (!capable(CAP_LINUX_IMMUTABLE))
21224 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21227 + ret = user_lpath(vc_data.name, &path);
21229 + ret = __vc_set_iattr(path.dentry,
21230 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21234 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21239 +#ifdef CONFIG_COMPAT
21241 +int vc_set_iattr_x32(void __user *data)
21243 + struct path path;
21244 + struct vcmd_ctx_iattr_v1_x32 vc_data;
21247 + if (!capable(CAP_LINUX_IMMUTABLE))
21249 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21252 + ret = user_lpath(compat_ptr(vc_data.name_ptr), &path);
21254 + ret = __vc_set_iattr(path.dentry,
21255 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21259 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21264 +#endif /* CONFIG_COMPAT */
21266 +int vc_fset_iattr(uint32_t fd, void __user *data)
21268 + struct file *filp;
21269 + struct vcmd_ctx_fiattr_v0 vc_data;
21272 + if (!capable(CAP_LINUX_IMMUTABLE))
21274 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21278 + if (!filp || !filp->f_dentry || !filp->f_dentry->d_inode)
21281 + ret = __vc_set_iattr(filp->f_dentry, &vc_data.tag,
21282 + &vc_data.flags, &vc_data.mask);
21286 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21292 +enum { Opt_notagcheck, Opt_tag, Opt_notag, Opt_tagid, Opt_err };
21294 +static match_table_t tokens = {
21295 + {Opt_notagcheck, "notagcheck"},
21296 +#ifdef CONFIG_PROPAGATE
21297 + {Opt_notag, "notag"},
21298 + {Opt_tag, "tag"},
21299 + {Opt_tagid, "tagid=%u"},
21305 +static void __dx_parse_remove(char *string, char *opt)
21307 + char *p = strstr(string, opt);
21311 + while (*q != '\0' && *q != ',')
21320 +int dx_parse_tag(char *string, tag_t *tag, int remove, int *mnt_flags,
21321 + unsigned long *flags)
21324 + substring_t args[MAX_OPT_ARGS];
21325 + int token, option = 0;
21326 + char *s, *p, *opts;
21330 + s = kstrdup(string, GFP_KERNEL | GFP_ATOMIC);
21335 + while ((p = strsep(&opts, ",")) != NULL) {
21336 + token = match_token(p, tokens, args);
21338 + vxdprintk(VXD_CBIT(tag, 7),
21339 + "dx_parse_tag(»%s«): %d:#%d",
21340 + p, token, option);
21343 +#ifdef CONFIG_PROPAGATE
21348 + __dx_parse_remove(s, "tag");
21349 + *mnt_flags |= MNT_TAGID;
21350 + set |= MNT_TAGID;
21354 + __dx_parse_remove(s, "notag");
21355 + *mnt_flags |= MNT_NOTAG;
21356 + set |= MNT_NOTAG;
21359 + if (tag && !match_int(args, &option))
21362 + __dx_parse_remove(s, "tagid");
21363 + *mnt_flags |= MNT_TAGID;
21364 + set |= MNT_TAGID;
21367 + case Opt_notagcheck:
21369 + __dx_parse_remove(s, "notagcheck");
21370 + *flags |= MS_NOTAGCHECK;
21371 + set |= MS_NOTAGCHECK;
21376 + strcpy(string, s);
21381 +#ifdef CONFIG_PROPAGATE
21383 +void __dx_propagate_tag(struct nameidata *nd, struct inode *inode)
21385 + tag_t new_tag = 0;
21386 + struct vfsmount *mnt;
21391 + mnt = nd->path.mnt;
21395 + propagate = (mnt->mnt_flags & MNT_TAGID);
21397 + new_tag = mnt->mnt_tag;
21399 + vxdprintk(VXD_CBIT(tag, 7),
21400 + "dx_propagate_tag(%p[#%lu.%d]): %d,%d",
21401 + inode, inode->i_ino, inode->i_tag,
21402 + new_tag, (propagate) ? 1 : 0);
21405 + inode->i_tag = new_tag;
21408 +#include <linux/module.h>
21410 +EXPORT_SYMBOL_GPL(__dx_propagate_tag);
21412 +#endif /* CONFIG_PROPAGATE */
21414 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/Kconfig linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/Kconfig
21415 --- linux-2.6.35.2/kernel/vserver/Kconfig 1970-01-01 01:00:00.000000000 +0100
21416 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/Kconfig 2010-08-02 17:05:06.000000000 +0200
21419 +# Linux VServer configuration
21422 +menu "Linux VServer"
21424 +config VSERVER_AUTO_LBACK
21425 + bool "Automatically Assign Loopback IP"
21428 + Automatically assign a guest specific loopback
21429 + IP and add it to the kernel network stack on
21432 +config VSERVER_AUTO_SINGLE
21433 + bool "Automatic Single IP Special Casing"
21434 + depends on EXPERIMENTAL
21437 + This allows network contexts with a single IP to
21438 + automatically remap 0.0.0.0 bindings to that IP,
21439 + avoiding further network checks and improving
21442 + (note: such guests do not allow to change the ip
21443 + on the fly and do not show loopback addresses)
21445 +config VSERVER_COWBL
21446 + bool "Enable COW Immutable Link Breaking"
21449 + This enables the COW (Copy-On-Write) link break code.
21450 + It allows you to treat unified files like normal files
21451 + when writing to them (which will implicitely break the
21452 + link and create a copy of the unified file)
21454 +config VSERVER_VTIME
21455 + bool "Enable Virtualized Guest Time"
21456 + depends on EXPERIMENTAL
21459 + This enables per guest time offsets to allow for
21460 + adjusting the system clock individually per guest.
21461 + this adds some overhead to the time functions and
21462 + therefore should not be enabled without good reason.
21464 +config VSERVER_DEVICE
21465 + bool "Enable Guest Device Mapping"
21466 + depends on EXPERIMENTAL
21469 + This enables generic device remapping.
21471 +config VSERVER_PROC_SECURE
21472 + bool "Enable Proc Security"
21473 + depends on PROC_FS
21476 + This configures ProcFS security to initially hide
21477 + non-process entries for all contexts except the main and
21478 + spectator context (i.e. for all guests), which is a secure
21481 + (note: on 1.2x the entries were visible by default)
21483 +config VSERVER_HARDCPU
21484 + bool "Enable Hard CPU Limits"
21487 + Activate the Hard CPU Limits
21489 + This will compile in code that allows the Token Bucket
21490 + Scheduler to put processes on hold when a context's
21491 + tokens are depleted (provided that its per-context
21492 + sched_hard flag is set).
21494 + Processes belonging to that context will not be able
21495 + to consume CPU resources again until a per-context
21496 + configured minimum of tokens has been reached.
21498 +config VSERVER_IDLETIME
21499 + bool "Avoid idle CPUs by skipping Time"
21500 + depends on VSERVER_HARDCPU
21503 + This option allows the scheduler to artificially
21504 + advance time (per cpu) when otherwise the idle
21505 + task would be scheduled, thus keeping the cpu
21506 + busy and sharing the available resources among
21507 + certain contexts.
21509 +config VSERVER_IDLELIMIT
21510 + bool "Limit the IDLE task"
21511 + depends on VSERVER_HARDCPU
21514 + Limit the idle slices, so the the next context
21515 + will be scheduled as soon as possible.
21517 + This might improve interactivity and latency, but
21518 + will also marginally increase scheduling overhead.
21521 + prompt "Persistent Inode Tagging"
21522 + default TAGGING_ID24
21524 + This adds persistent context information to filesystems
21525 + mounted with the tagxid option. Tagging is a requirement
21526 + for per-context disk limits and per-context quota.
21529 +config TAGGING_NONE
21532 + do not store per-context information in inodes.
21534 +config TAGGING_UID16
21535 + bool "UID16/GID32"
21537 + reduces UID to 16 bit, but leaves GID at 32 bit.
21539 +config TAGGING_GID16
21540 + bool "UID32/GID16"
21542 + reduces GID to 16 bit, but leaves UID at 32 bit.
21544 +config TAGGING_ID24
21545 + bool "UID24/GID24"
21547 + uses the upper 8bit from UID and GID for XID tagging
21548 + which leaves 24bit for UID/GID each, which should be
21549 + more than sufficient for normal use.
21551 +config TAGGING_INTERN
21552 + bool "UID32/GID32"
21554 + this uses otherwise reserved inode fields in the on
21555 + disk representation, which limits the use to a few
21556 + filesystems (currently ext2 and ext3)
21561 + bool "Tag NFSD User Auth and Files"
21564 + Enable this if you do want the in-kernel NFS
21565 + Server to use the tagging specified above.
21566 + (will require patched clients too)
21568 +config VSERVER_PRIVACY
21569 + bool "Honor Privacy Aspects of Guests"
21572 + When enabled, most context checks will disallow
21573 + access to structures assigned to a specific context,
21574 + like ptys or loop devices.
21576 +config VSERVER_CONTEXTS
21577 + int "Maximum number of Contexts (1-65533)" if EMBEDDED
21579 + default "768" if 64BIT
21582 + This setting will optimize certain data structures
21583 + and memory allocations according to the expected
21586 + note: this is not a strict upper limit.
21588 +config VSERVER_WARN
21589 + bool "VServer Warnings"
21592 + This enables various runtime warnings, which will
21593 + notify about potential manipulation attempts or
21594 + resource shortage. It is generally considered to
21595 + be a good idea to have that enabled.
21597 +config VSERVER_DEBUG
21598 + bool "VServer Debugging Code"
21601 + Set this to yes if you want to be able to activate
21602 + debugging output at runtime. It adds a very small
21603 + overhead to all vserver related functions and
21604 + increases the kernel size by about 20k.
21606 +config VSERVER_HISTORY
21607 + bool "VServer History Tracing"
21608 + depends on VSERVER_DEBUG
21611 + Set this to yes if you want to record the history of
21612 + linux-vserver activities, so they can be replayed in
21613 + the event of a kernel panic or oops.
21615 +config VSERVER_HISTORY_SIZE
21616 + int "Per-CPU History Size (32-65536)"
21617 + depends on VSERVER_HISTORY
21621 + This allows you to specify the number of entries in
21622 + the per-CPU history buffer.
21624 +config VSERVER_MONITOR
21625 + bool "VServer Scheduling Monitor"
21626 + depends on VSERVER_DISABLED
21629 + Set this to yes if you want to record the scheduling
21630 + decisions, so that they can be relayed to userspace
21631 + for detailed analysis.
21633 +config VSERVER_MONITOR_SIZE
21634 + int "Per-CPU Monitor Queue Size (32-65536)"
21635 + depends on VSERVER_MONITOR
21639 + This allows you to specify the number of entries in
21640 + the per-CPU scheduling monitor buffer.
21642 +config VSERVER_MONITOR_SYNC
21643 + int "Per-CPU Monitor Sync Interval (0-65536)"
21644 + depends on VSERVER_MONITOR
21648 + This allows you to specify the interval in ticks
21649 + when a time sync entry is inserted.
21651 +config VSERVER_LEGACY_MEM
21652 + bool "Legacy Memory Limits"
21655 + This provides fake memory limits to keep
21656 + older tools happy in the face of memory
21666 + select NAMESPACES
21672 +config VSERVER_SECURITY
21674 + depends on SECURITY
21676 + select SECURITY_CAPABILITIES
21678 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/limit.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/limit.c
21679 --- linux-2.6.35.2/kernel/vserver/limit.c 1970-01-01 01:00:00.000000000 +0100
21680 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/limit.c 2010-08-02 17:05:06.000000000 +0200
21683 + * linux/kernel/vserver/limit.c
21685 + * Virtual Server: Context Limits
21687 + * Copyright (C) 2004-2010 Herbert Pötzl
21689 + * V0.01 broken out from vcontext V0.05
21690 + * V0.02 changed vcmds to vxi arg
21691 + * V0.03 added memory cgroup support
21695 +#include <linux/sched.h>
21696 +#include <linux/module.h>
21697 +#include <linux/memcontrol.h>
21698 +#include <linux/res_counter.h>
21699 +#include <linux/vs_limit.h>
21700 +#include <linux/vserver/limit.h>
21701 +#include <linux/vserver/limit_cmd.h>
21703 +#include <asm/uaccess.h>
21706 +const char *vlimit_name[NUM_LIMITS] = {
21707 +#ifdef CONFIG_VSERVER_LEGACY_MEM
21708 + [RLIMIT_RSS] = "RSS",
21709 + [RLIMIT_AS] = "VM",
21710 +#endif /* CONFIG_VSERVER_LEGACY_MEM */
21711 + [RLIMIT_CPU] = "CPU",
21712 + [RLIMIT_NPROC] = "NPROC",
21713 + [RLIMIT_NOFILE] = "NOFILE",
21714 + [RLIMIT_LOCKS] = "LOCKS",
21715 + [RLIMIT_SIGPENDING] = "SIGP",
21716 + [RLIMIT_MSGQUEUE] = "MSGQ",
21718 + [VLIMIT_NSOCK] = "NSOCK",
21719 + [VLIMIT_OPENFD] = "OPENFD",
21720 + [VLIMIT_SHMEM] = "SHMEM",
21721 + [VLIMIT_DENTRY] = "DENTRY",
21724 +EXPORT_SYMBOL_GPL(vlimit_name);
21726 +#define MASK_ENTRY(x) (1 << (x))
21728 +const struct vcmd_ctx_rlimit_mask_v0 vlimit_mask = {
21731 + , /* softlimit */
21732 +#ifdef CONFIG_VSERVER_LEGACY_MEM
21733 + MASK_ENTRY( RLIMIT_RSS ) |
21734 +#endif /* CONFIG_VSERVER_LEGACY_MEM */
21737 +#ifdef CONFIG_VSERVER_LEGACY_MEM
21738 + MASK_ENTRY( RLIMIT_RSS ) |
21739 + MASK_ENTRY( RLIMIT_AS ) |
21740 +#endif /* CONFIG_VSERVER_LEGACY_MEM */
21741 + MASK_ENTRY( RLIMIT_NPROC ) |
21742 + MASK_ENTRY( RLIMIT_NOFILE ) |
21743 + MASK_ENTRY( RLIMIT_LOCKS ) |
21744 + MASK_ENTRY( RLIMIT_MSGQUEUE ) |
21746 + MASK_ENTRY( VLIMIT_NSOCK ) |
21747 + MASK_ENTRY( VLIMIT_OPENFD ) |
21748 + MASK_ENTRY( VLIMIT_SHMEM ) |
21749 + MASK_ENTRY( VLIMIT_DENTRY ) |
21752 + /* accounting only */
21753 +uint32_t account_mask =
21754 + MASK_ENTRY( VLIMIT_SEMARY ) |
21755 + MASK_ENTRY( VLIMIT_NSEMS ) |
21756 + MASK_ENTRY( VLIMIT_MAPPED ) |
21760 +static int is_valid_vlimit(int id)
21762 + uint32_t mask = vlimit_mask.minimum |
21763 + vlimit_mask.softlimit | vlimit_mask.maximum;
21764 + return mask & (1 << id);
21767 +static int is_accounted_vlimit(int id)
21769 + if (is_valid_vlimit(id))
21771 + return account_mask & (1 << id);
21775 +static inline uint64_t vc_get_soft(struct vx_info *vxi, int id)
21777 + rlim_t limit = __rlim_soft(&vxi->limit, id);
21778 + return VX_VLIM(limit);
21781 +static inline uint64_t vc_get_hard(struct vx_info *vxi, int id)
21783 + rlim_t limit = __rlim_hard(&vxi->limit, id);
21784 + return VX_VLIM(limit);
21787 +static int do_get_rlimit(struct vx_info *vxi, uint32_t id,
21788 + uint64_t *minimum, uint64_t *softlimit, uint64_t *maximum)
21790 + if (!is_valid_vlimit(id))
21794 + *minimum = CRLIM_UNSET;
21796 + *softlimit = vc_get_soft(vxi, id);
21798 + *maximum = vc_get_hard(vxi, id);
21802 +int vc_get_rlimit(struct vx_info *vxi, void __user *data)
21804 + struct vcmd_ctx_rlimit_v0 vc_data;
21807 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21810 + ret = do_get_rlimit(vxi, vc_data.id,
21811 + &vc_data.minimum, &vc_data.softlimit, &vc_data.maximum);
21815 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21820 +static int do_set_rlimit(struct vx_info *vxi, uint32_t id,
21821 + uint64_t minimum, uint64_t softlimit, uint64_t maximum)
21823 + if (!is_valid_vlimit(id))
21826 + if (maximum != CRLIM_KEEP)
21827 + __rlim_hard(&vxi->limit, id) = VX_RLIM(maximum);
21828 + if (softlimit != CRLIM_KEEP)
21829 + __rlim_soft(&vxi->limit, id) = VX_RLIM(softlimit);
21831 + /* clamp soft limit */
21832 + if (__rlim_soft(&vxi->limit, id) > __rlim_hard(&vxi->limit, id))
21833 + __rlim_soft(&vxi->limit, id) = __rlim_hard(&vxi->limit, id);
21838 +int vc_set_rlimit(struct vx_info *vxi, void __user *data)
21840 + struct vcmd_ctx_rlimit_v0 vc_data;
21842 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21845 + return do_set_rlimit(vxi, vc_data.id,
21846 + vc_data.minimum, vc_data.softlimit, vc_data.maximum);
21849 +#ifdef CONFIG_IA32_EMULATION
21851 +int vc_set_rlimit_x32(struct vx_info *vxi, void __user *data)
21853 + struct vcmd_ctx_rlimit_v0_x32 vc_data;
21855 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21858 + return do_set_rlimit(vxi, vc_data.id,
21859 + vc_data.minimum, vc_data.softlimit, vc_data.maximum);
21862 +int vc_get_rlimit_x32(struct vx_info *vxi, void __user *data)
21864 + struct vcmd_ctx_rlimit_v0_x32 vc_data;
21867 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21870 + ret = do_get_rlimit(vxi, vc_data.id,
21871 + &vc_data.minimum, &vc_data.softlimit, &vc_data.maximum);
21875 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21880 +#endif /* CONFIG_IA32_EMULATION */
21883 +int vc_get_rlimit_mask(uint32_t id, void __user *data)
21885 + if (copy_to_user(data, &vlimit_mask, sizeof(vlimit_mask)))
21891 +static inline void vx_reset_hits(struct _vx_limit *limit)
21895 + for (lim = 0; lim < NUM_LIMITS; lim++) {
21896 + atomic_set(&__rlim_lhit(limit, lim), 0);
21900 +int vc_reset_hits(struct vx_info *vxi, void __user *data)
21902 + vx_reset_hits(&vxi->limit);
21906 +static inline void vx_reset_minmax(struct _vx_limit *limit)
21911 + for (lim = 0; lim < NUM_LIMITS; lim++) {
21912 + value = __rlim_get(limit, lim);
21913 + __rlim_rmax(limit, lim) = value;
21914 + __rlim_rmin(limit, lim) = value;
21918 +int vc_reset_minmax(struct vx_info *vxi, void __user *data)
21920 + vx_reset_minmax(&vxi->limit);
21925 +int vc_rlimit_stat(struct vx_info *vxi, void __user *data)
21927 + struct vcmd_rlimit_stat_v0 vc_data;
21928 + struct _vx_limit *limit = &vxi->limit;
21931 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21935 + if (!is_accounted_vlimit(id))
21938 + vx_limit_fixup(limit, id);
21939 + vc_data.hits = atomic_read(&__rlim_lhit(limit, id));
21940 + vc_data.value = __rlim_get(limit, id);
21941 + vc_data.minimum = __rlim_rmin(limit, id);
21942 + vc_data.maximum = __rlim_rmax(limit, id);
21944 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21950 +void vx_vsi_meminfo(struct sysinfo *val)
21952 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
21953 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
21954 + u64 res_limit, res_usage;
21959 + res_limit = mem_cgroup_res_read_u64(mcg, RES_LIMIT);
21960 + res_usage = mem_cgroup_res_read_u64(mcg, RES_USAGE);
21962 + if (res_limit != RESOURCE_MAX)
21963 + val->totalram = (res_limit >> PAGE_SHIFT);
21964 + val->freeram = val->totalram - (res_usage >> PAGE_SHIFT);
21965 + val->bufferram = 0;
21966 + val->totalhigh = 0;
21967 + val->freehigh = 0;
21968 +#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
21972 +void vx_vsi_swapinfo(struct sysinfo *val)
21974 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
21975 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
21976 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
21977 + u64 res_limit, res_usage, memsw_limit, memsw_usage;
21978 + s64 swap_limit, swap_usage;
21983 + res_limit = mem_cgroup_res_read_u64(mcg, RES_LIMIT);
21984 + res_usage = mem_cgroup_res_read_u64(mcg, RES_USAGE);
21985 + memsw_limit = mem_cgroup_memsw_read_u64(mcg, RES_LIMIT);
21986 + memsw_usage = mem_cgroup_memsw_read_u64(mcg, RES_USAGE);
21988 + if (res_limit == RESOURCE_MAX)
21991 + swap_limit = memsw_limit - res_limit;
21992 + if (memsw_limit != RESOURCE_MAX)
21993 + val->totalswap = swap_limit >> PAGE_SHIFT;
21995 + swap_usage = memsw_usage - res_usage;
21996 + val->freeswap = (swap_usage < swap_limit) ?
21997 + val->totalswap - (swap_usage >> PAGE_SHIFT) : 0;
21998 +#else /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
21999 + val->totalswap = 0;
22000 + val->freeswap = 0;
22001 +#endif /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
22002 +#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
22006 +long vx_vsi_cached(struct sysinfo *val)
22008 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22009 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22011 + return mem_cgroup_stat_read_cache(mcg);
22018 +unsigned long vx_badness(struct task_struct *task, struct mm_struct *mm)
22020 + struct vx_info *vxi = mm->mm_vx_info;
22021 + unsigned long points;
22027 + points = vxi->vx_badness_bias;
22029 + v = __vx_cres_array_fixup(&vxi->limit, VLA_RSS);
22030 + w = __rlim_soft(&vxi->limit, RLIMIT_RSS);
22031 + points += (v > w) ? (v - w) : 0;
22036 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/limit_init.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/limit_init.h
22037 --- linux-2.6.35.2/kernel/vserver/limit_init.h 1970-01-01 01:00:00.000000000 +0100
22038 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/limit_init.h 2010-08-02 17:05:06.000000000 +0200
22042 +static inline void vx_info_init_limit(struct _vx_limit *limit)
22046 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22047 + __rlim_soft(limit, lim) = RLIM_INFINITY;
22048 + __rlim_hard(limit, lim) = RLIM_INFINITY;
22049 + __rlim_set(limit, lim, 0);
22050 + atomic_set(&__rlim_lhit(limit, lim), 0);
22051 + __rlim_rmin(limit, lim) = 0;
22052 + __rlim_rmax(limit, lim) = 0;
22056 +static inline void vx_info_exit_limit(struct _vx_limit *limit)
22061 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22062 + if ((1 << lim) & VLIM_NOCHECK)
22064 + value = __rlim_get(limit, lim);
22065 + vxwprintk_xid(value,
22066 + "!!! limit: %p[%s,%d] = %ld on exit.",
22067 + limit, vlimit_name[lim], lim, (long)value);
22071 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/limit_proc.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/limit_proc.h
22072 --- linux-2.6.35.2/kernel/vserver/limit_proc.h 1970-01-01 01:00:00.000000000 +0100
22073 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/limit_proc.h 2010-08-02 17:05:06.000000000 +0200
22075 +#ifndef _VX_LIMIT_PROC_H
22076 +#define _VX_LIMIT_PROC_H
22078 +#include <linux/vserver/limit_int.h>
22081 +#define VX_LIMIT_FMT ":\t%8ld\t%8ld/%8ld\t%8lld/%8lld\t%6d\n"
22082 +#define VX_LIMIT_TOP \
22083 + "Limit\t current\t min/max\t\t soft/hard\t\thits\n"
22085 +#define VX_LIMIT_ARG(r) \
22086 + (unsigned long)__rlim_get(limit, r), \
22087 + (unsigned long)__rlim_rmin(limit, r), \
22088 + (unsigned long)__rlim_rmax(limit, r), \
22089 + VX_VLIM(__rlim_soft(limit, r)), \
22090 + VX_VLIM(__rlim_hard(limit, r)), \
22091 + atomic_read(&__rlim_lhit(limit, r))
22093 +static inline int vx_info_proc_limit(struct _vx_limit *limit, char *buffer)
22095 + vx_limit_fixup(limit, -1);
22096 + return sprintf(buffer, VX_LIMIT_TOP
22097 + "PROC" VX_LIMIT_FMT
22098 + "VM" VX_LIMIT_FMT
22099 + "VML" VX_LIMIT_FMT
22100 + "RSS" VX_LIMIT_FMT
22101 + "ANON" VX_LIMIT_FMT
22102 + "RMAP" VX_LIMIT_FMT
22103 + "FILES" VX_LIMIT_FMT
22104 + "OFD" VX_LIMIT_FMT
22105 + "LOCKS" VX_LIMIT_FMT
22106 + "SOCK" VX_LIMIT_FMT
22107 + "MSGQ" VX_LIMIT_FMT
22108 + "SHM" VX_LIMIT_FMT
22109 + "SEMA" VX_LIMIT_FMT
22110 + "SEMS" VX_LIMIT_FMT
22111 + "DENT" VX_LIMIT_FMT,
22112 + VX_LIMIT_ARG(RLIMIT_NPROC),
22113 + VX_LIMIT_ARG(RLIMIT_AS),
22114 + VX_LIMIT_ARG(RLIMIT_MEMLOCK),
22115 + VX_LIMIT_ARG(RLIMIT_RSS),
22116 + VX_LIMIT_ARG(VLIMIT_ANON),
22117 + VX_LIMIT_ARG(VLIMIT_MAPPED),
22118 + VX_LIMIT_ARG(RLIMIT_NOFILE),
22119 + VX_LIMIT_ARG(VLIMIT_OPENFD),
22120 + VX_LIMIT_ARG(RLIMIT_LOCKS),
22121 + VX_LIMIT_ARG(VLIMIT_NSOCK),
22122 + VX_LIMIT_ARG(RLIMIT_MSGQUEUE),
22123 + VX_LIMIT_ARG(VLIMIT_SHMEM),
22124 + VX_LIMIT_ARG(VLIMIT_SEMARY),
22125 + VX_LIMIT_ARG(VLIMIT_NSEMS),
22126 + VX_LIMIT_ARG(VLIMIT_DENTRY));
22129 +#endif /* _VX_LIMIT_PROC_H */
22132 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/Makefile linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/Makefile
22133 --- linux-2.6.35.2/kernel/vserver/Makefile 1970-01-01 01:00:00.000000000 +0100
22134 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/Makefile 2010-08-02 17:05:06.000000000 +0200
22137 +# Makefile for the Linux vserver routines.
22141 +obj-y += vserver.o
22143 +vserver-y := switch.o context.o space.o sched.o network.o inode.o \
22144 + limit.o cvirt.o cacct.o signal.o helper.o init.o \
22147 +vserver-$(CONFIG_INET) += inet.o
22148 +vserver-$(CONFIG_PROC_FS) += proc.o
22149 +vserver-$(CONFIG_VSERVER_DEBUG) += sysctl.o debug.o
22150 +vserver-$(CONFIG_VSERVER_HISTORY) += history.o
22151 +vserver-$(CONFIG_VSERVER_MONITOR) += monitor.o
22152 +vserver-$(CONFIG_VSERVER_DEVICE) += device.o
22154 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/monitor.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/monitor.c
22155 --- linux-2.6.35.2/kernel/vserver/monitor.c 1970-01-01 01:00:00.000000000 +0100
22156 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/monitor.c 2010-08-02 17:05:06.000000000 +0200
22159 + * kernel/vserver/monitor.c
22161 + * Virtual Context Scheduler Monitor
22163 + * Copyright (C) 2006-2007 Herbert Pötzl
22165 + * V0.01 basic design
22169 +#include <linux/module.h>
22170 +#include <linux/jiffies.h>
22171 +#include <asm/uaccess.h>
22172 +#include <asm/atomic.h>
22174 +#include <linux/vserver/monitor.h>
22175 +#include <linux/vserver/debug_cmd.h>
22178 +#ifdef CONFIG_VSERVER_MONITOR
22179 +#define VXM_SIZE CONFIG_VSERVER_MONITOR_SIZE
22181 +#define VXM_SIZE 64
22184 +struct _vx_monitor {
22185 + unsigned int counter;
22187 + struct _vx_mon_entry entry[VXM_SIZE+1];
22191 +DEFINE_PER_CPU(struct _vx_monitor, vx_monitor_buffer);
22193 +unsigned volatile int vxm_active = 1;
22195 +static atomic_t sequence = ATOMIC_INIT(0);
22200 + * requires disabled preemption */
22202 +struct _vx_mon_entry *vxm_advance(int cpu)
22204 + struct _vx_monitor *mon = &per_cpu(vx_monitor_buffer, cpu);
22205 + struct _vx_mon_entry *entry;
22206 + unsigned int index;
22208 + index = vxm_active ? (mon->counter++ % VXM_SIZE) : VXM_SIZE;
22209 + entry = &mon->entry[index];
22211 + entry->ev.seq = atomic_inc_return(&sequence);
22212 + entry->ev.jif = jiffies;
22216 +EXPORT_SYMBOL_GPL(vxm_advance);
22219 +int do_read_monitor(struct __user _vx_mon_entry *data,
22220 + int cpu, uint32_t *index, uint32_t *count)
22222 + int pos, ret = 0;
22223 + struct _vx_monitor *mon = &per_cpu(vx_monitor_buffer, cpu);
22224 + int end = mon->counter;
22225 + int start = end - VXM_SIZE + 2;
22226 + int idx = *index;
22228 + /* special case: get current pos */
22234 + /* have we lost some data? */
22238 + for (pos = 0; (pos < *count) && (idx < end); pos++, idx++) {
22239 + struct _vx_mon_entry *entry =
22240 + &mon->entry[idx % VXM_SIZE];
22242 + /* send entry to userspace */
22243 + ret = copy_to_user(&data[pos], entry, sizeof(*entry));
22247 + /* save new index and count */
22250 + return ret ? ret : (*index < end);
22253 +int vc_read_monitor(uint32_t id, void __user *data)
22255 + struct vcmd_read_monitor_v0 vc_data;
22258 + if (id >= NR_CPUS)
22261 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22264 + ret = do_read_monitor((struct __user _vx_mon_entry *)vc_data.data,
22265 + id, &vc_data.index, &vc_data.count);
22267 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22272 +#ifdef CONFIG_COMPAT
22274 +int vc_read_monitor_x32(uint32_t id, void __user *data)
22276 + struct vcmd_read_monitor_v0_x32 vc_data;
22279 + if (id >= NR_CPUS)
22282 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22285 + ret = do_read_monitor((struct __user _vx_mon_entry *)
22286 + compat_ptr(vc_data.data_ptr),
22287 + id, &vc_data.index, &vc_data.count);
22289 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22294 +#endif /* CONFIG_COMPAT */
22296 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/network.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/network.c
22297 --- linux-2.6.35.2/kernel/vserver/network.c 1970-01-01 01:00:00.000000000 +0100
22298 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/network.c 2010-08-02 17:05:06.000000000 +0200
22301 + * linux/kernel/vserver/network.c
22303 + * Virtual Server: Network Support
22305 + * Copyright (C) 2003-2007 Herbert Pötzl
22307 + * V0.01 broken out from vcontext V0.05
22308 + * V0.02 cleaned up implementation
22309 + * V0.03 added equiv nx commands
22310 + * V0.04 switch to RCU based hash
22311 + * V0.05 and back to locking again
22312 + * V0.06 changed vcmds to nxi arg
22313 + * V0.07 have __create claim() the nxi
22317 +#include <linux/err.h>
22318 +#include <linux/slab.h>
22319 +#include <linux/rcupdate.h>
22321 +#include <linux/vs_network.h>
22322 +#include <linux/vs_pid.h>
22323 +#include <linux/vserver/network_cmd.h>
22326 +atomic_t nx_global_ctotal = ATOMIC_INIT(0);
22327 +atomic_t nx_global_cactive = ATOMIC_INIT(0);
22329 +static struct kmem_cache *nx_addr_v4_cachep = NULL;
22330 +static struct kmem_cache *nx_addr_v6_cachep = NULL;
22333 +static int __init init_network(void)
22335 + nx_addr_v4_cachep = kmem_cache_create("nx_v4_addr_cache",
22336 + sizeof(struct nx_addr_v4), 0,
22337 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
22338 + nx_addr_v6_cachep = kmem_cache_create("nx_v6_addr_cache",
22339 + sizeof(struct nx_addr_v6), 0,
22340 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
22345 +/* __alloc_nx_addr_v4() */
22347 +static inline struct nx_addr_v4 *__alloc_nx_addr_v4(void)
22349 + struct nx_addr_v4 *nxa = kmem_cache_alloc(
22350 + nx_addr_v4_cachep, GFP_KERNEL);
22352 + if (!IS_ERR(nxa))
22353 + memset(nxa, 0, sizeof(*nxa));
22357 +/* __dealloc_nx_addr_v4() */
22359 +static inline void __dealloc_nx_addr_v4(struct nx_addr_v4 *nxa)
22361 + kmem_cache_free(nx_addr_v4_cachep, nxa);
22364 +/* __dealloc_nx_addr_v4_all() */
22366 +static inline void __dealloc_nx_addr_v4_all(struct nx_addr_v4 *nxa)
22369 + struct nx_addr_v4 *next = nxa->next;
22371 + __dealloc_nx_addr_v4(nxa);
22377 +#ifdef CONFIG_IPV6
22379 +/* __alloc_nx_addr_v6() */
22381 +static inline struct nx_addr_v6 *__alloc_nx_addr_v6(void)
22383 + struct nx_addr_v6 *nxa = kmem_cache_alloc(
22384 + nx_addr_v6_cachep, GFP_KERNEL);
22386 + if (!IS_ERR(nxa))
22387 + memset(nxa, 0, sizeof(*nxa));
22391 +/* __dealloc_nx_addr_v6() */
22393 +static inline void __dealloc_nx_addr_v6(struct nx_addr_v6 *nxa)
22395 + kmem_cache_free(nx_addr_v6_cachep, nxa);
22398 +/* __dealloc_nx_addr_v6_all() */
22400 +static inline void __dealloc_nx_addr_v6_all(struct nx_addr_v6 *nxa)
22403 + struct nx_addr_v6 *next = nxa->next;
22405 + __dealloc_nx_addr_v6(nxa);
22410 +#endif /* CONFIG_IPV6 */
22412 +/* __alloc_nx_info()
22414 + * allocate an initialized nx_info struct
22415 + * doesn't make it visible (hash) */
22417 +static struct nx_info *__alloc_nx_info(nid_t nid)
22419 + struct nx_info *new = NULL;
22421 + vxdprintk(VXD_CBIT(nid, 1), "alloc_nx_info(%d)*", nid);
22423 + /* would this benefit from a slab cache? */
22424 + new = kmalloc(sizeof(struct nx_info), GFP_KERNEL);
22428 + memset(new, 0, sizeof(struct nx_info));
22429 + new->nx_id = nid;
22430 + INIT_HLIST_NODE(&new->nx_hlist);
22431 + atomic_set(&new->nx_usecnt, 0);
22432 + atomic_set(&new->nx_tasks, 0);
22433 + new->nx_state = 0;
22435 + new->nx_flags = NXF_INIT_SET;
22437 + /* rest of init goes here */
22439 + new->v4_lback.s_addr = htonl(INADDR_LOOPBACK);
22440 + new->v4_bcast.s_addr = htonl(INADDR_BROADCAST);
22442 + vxdprintk(VXD_CBIT(nid, 0),
22443 + "alloc_nx_info(%d) = %p", nid, new);
22444 + atomic_inc(&nx_global_ctotal);
22448 +/* __dealloc_nx_info()
22450 + * final disposal of nx_info */
22452 +static void __dealloc_nx_info(struct nx_info *nxi)
22454 + vxdprintk(VXD_CBIT(nid, 0),
22455 + "dealloc_nx_info(%p)", nxi);
22457 + nxi->nx_hlist.next = LIST_POISON1;
22460 + BUG_ON(atomic_read(&nxi->nx_usecnt));
22461 + BUG_ON(atomic_read(&nxi->nx_tasks));
22463 + __dealloc_nx_addr_v4_all(nxi->v4.next);
22465 + nxi->nx_state |= NXS_RELEASED;
22467 + atomic_dec(&nx_global_ctotal);
22470 +static void __shutdown_nx_info(struct nx_info *nxi)
22472 + nxi->nx_state |= NXS_SHUTDOWN;
22473 + vs_net_change(nxi, VSC_NETDOWN);
22476 +/* exported stuff */
22478 +void free_nx_info(struct nx_info *nxi)
22480 + /* context shutdown is mandatory */
22481 + BUG_ON(nxi->nx_state != NXS_SHUTDOWN);
22483 + /* context must not be hashed */
22484 + BUG_ON(nxi->nx_state & NXS_HASHED);
22486 + BUG_ON(atomic_read(&nxi->nx_usecnt));
22487 + BUG_ON(atomic_read(&nxi->nx_tasks));
22489 + __dealloc_nx_info(nxi);
22493 +void __nx_set_lback(struct nx_info *nxi)
22495 + int nid = nxi->nx_id;
22496 + __be32 lback = htonl(INADDR_LOOPBACK ^ ((nid & 0xFFFF) << 8));
22498 + nxi->v4_lback.s_addr = lback;
22501 +extern int __nx_inet_add_lback(__be32 addr);
22502 +extern int __nx_inet_del_lback(__be32 addr);
22505 +/* hash table for nx_info hash */
22507 +#define NX_HASH_SIZE 13
22509 +struct hlist_head nx_info_hash[NX_HASH_SIZE];
22511 +static spinlock_t nx_info_hash_lock = SPIN_LOCK_UNLOCKED;
22514 +static inline unsigned int __hashval(nid_t nid)
22516 + return (nid % NX_HASH_SIZE);
22521 +/* __hash_nx_info()
22523 + * add the nxi to the global hash table
22524 + * requires the hash_lock to be held */
22526 +static inline void __hash_nx_info(struct nx_info *nxi)
22528 + struct hlist_head *head;
22530 + vxd_assert_lock(&nx_info_hash_lock);
22531 + vxdprintk(VXD_CBIT(nid, 4),
22532 + "__hash_nx_info: %p[#%d]", nxi, nxi->nx_id);
22534 + /* context must not be hashed */
22535 + BUG_ON(nx_info_state(nxi, NXS_HASHED));
22537 + nxi->nx_state |= NXS_HASHED;
22538 + head = &nx_info_hash[__hashval(nxi->nx_id)];
22539 + hlist_add_head(&nxi->nx_hlist, head);
22540 + atomic_inc(&nx_global_cactive);
22543 +/* __unhash_nx_info()
22545 + * remove the nxi from the global hash table
22546 + * requires the hash_lock to be held */
22548 +static inline void __unhash_nx_info(struct nx_info *nxi)
22550 + vxd_assert_lock(&nx_info_hash_lock);
22551 + vxdprintk(VXD_CBIT(nid, 4),
22552 + "__unhash_nx_info: %p[#%d.%d.%d]", nxi, nxi->nx_id,
22553 + atomic_read(&nxi->nx_usecnt), atomic_read(&nxi->nx_tasks));
22555 + /* context must be hashed */
22556 + BUG_ON(!nx_info_state(nxi, NXS_HASHED));
22557 + /* but without tasks */
22558 + BUG_ON(atomic_read(&nxi->nx_tasks));
22560 + nxi->nx_state &= ~NXS_HASHED;
22561 + hlist_del(&nxi->nx_hlist);
22562 + atomic_dec(&nx_global_cactive);
22566 +/* __lookup_nx_info()
22568 + * requires the hash_lock to be held
22569 + * doesn't increment the nx_refcnt */
22571 +static inline struct nx_info *__lookup_nx_info(nid_t nid)
22573 + struct hlist_head *head = &nx_info_hash[__hashval(nid)];
22574 + struct hlist_node *pos;
22575 + struct nx_info *nxi;
22577 + vxd_assert_lock(&nx_info_hash_lock);
22578 + hlist_for_each(pos, head) {
22579 + nxi = hlist_entry(pos, struct nx_info, nx_hlist);
22581 + if (nxi->nx_id == nid)
22586 + vxdprintk(VXD_CBIT(nid, 0),
22587 + "__lookup_nx_info(#%u): %p[#%u]",
22588 + nid, nxi, nxi ? nxi->nx_id : 0);
22593 +/* __create_nx_info()
22595 + * create the requested context
22596 + * get(), claim() and hash it */
22598 +static struct nx_info *__create_nx_info(int id)
22600 + struct nx_info *new, *nxi = NULL;
22602 + vxdprintk(VXD_CBIT(nid, 1), "create_nx_info(%d)*", id);
22604 + if (!(new = __alloc_nx_info(id)))
22605 + return ERR_PTR(-ENOMEM);
22607 + /* required to make dynamic xids unique */
22608 + spin_lock(&nx_info_hash_lock);
22610 + /* static context requested */
22611 + if ((nxi = __lookup_nx_info(id))) {
22612 + vxdprintk(VXD_CBIT(nid, 0),
22613 + "create_nx_info(%d) = %p (already there)", id, nxi);
22614 + if (nx_info_flags(nxi, NXF_STATE_SETUP, 0))
22615 + nxi = ERR_PTR(-EBUSY);
22617 + nxi = ERR_PTR(-EEXIST);
22620 + /* new context */
22621 + vxdprintk(VXD_CBIT(nid, 0),
22622 + "create_nx_info(%d) = %p (new)", id, new);
22623 + claim_nx_info(new, NULL);
22624 + __nx_set_lback(new);
22625 + __hash_nx_info(get_nx_info(new));
22626 + nxi = new, new = NULL;
22629 + spin_unlock(&nx_info_hash_lock);
22631 + __dealloc_nx_info(new);
22637 +/* exported stuff */
22640 +void unhash_nx_info(struct nx_info *nxi)
22642 + __shutdown_nx_info(nxi);
22643 + spin_lock(&nx_info_hash_lock);
22644 + __unhash_nx_info(nxi);
22645 + spin_unlock(&nx_info_hash_lock);
22648 +/* lookup_nx_info()
22650 + * search for a nx_info and get() it
22651 + * negative id means current */
22653 +struct nx_info *lookup_nx_info(int id)
22655 + struct nx_info *nxi = NULL;
22658 + nxi = get_nx_info(current_nx_info());
22659 + } else if (id > 1) {
22660 + spin_lock(&nx_info_hash_lock);
22661 + nxi = get_nx_info(__lookup_nx_info(id));
22662 + spin_unlock(&nx_info_hash_lock);
22667 +/* nid_is_hashed()
22669 + * verify that nid is still hashed */
22671 +int nid_is_hashed(nid_t nid)
22675 + spin_lock(&nx_info_hash_lock);
22676 + hashed = (__lookup_nx_info(nid) != NULL);
22677 + spin_unlock(&nx_info_hash_lock);
22682 +#ifdef CONFIG_PROC_FS
22686 + * get a subset of hashed nids for proc
22687 + * assumes size is at least one */
22689 +int get_nid_list(int index, unsigned int *nids, int size)
22691 + int hindex, nr_nids = 0;
22693 + /* only show current and children */
22694 + if (!nx_check(0, VS_ADMIN | VS_WATCH)) {
22697 + nids[nr_nids] = nx_current_nid();
22701 + for (hindex = 0; hindex < NX_HASH_SIZE; hindex++) {
22702 + struct hlist_head *head = &nx_info_hash[hindex];
22703 + struct hlist_node *pos;
22705 + spin_lock(&nx_info_hash_lock);
22706 + hlist_for_each(pos, head) {
22707 + struct nx_info *nxi;
22712 + nxi = hlist_entry(pos, struct nx_info, nx_hlist);
22713 + nids[nr_nids] = nxi->nx_id;
22714 + if (++nr_nids >= size) {
22715 + spin_unlock(&nx_info_hash_lock);
22719 + /* keep the lock time short */
22720 + spin_unlock(&nx_info_hash_lock);
22729 + * migrate task to new network
22730 + * gets nxi, puts old_nxi on change
22733 +int nx_migrate_task(struct task_struct *p, struct nx_info *nxi)
22735 + struct nx_info *old_nxi;
22741 + vxdprintk(VXD_CBIT(nid, 5),
22742 + "nx_migrate_task(%p,%p[#%d.%d.%d])",
22743 + p, nxi, nxi->nx_id,
22744 + atomic_read(&nxi->nx_usecnt),
22745 + atomic_read(&nxi->nx_tasks));
22747 + if (nx_info_flags(nxi, NXF_INFO_PRIVATE, 0) &&
22748 + !nx_info_flags(nxi, NXF_STATE_SETUP, 0))
22751 + if (nx_info_state(nxi, NXS_SHUTDOWN))
22754 + /* maybe disallow this completely? */
22755 + old_nxi = task_get_nx_info(p);
22756 + if (old_nxi == nxi)
22761 + clr_nx_info(&p->nx_info);
22762 + claim_nx_info(nxi, p);
22763 + set_nx_info(&p->nx_info, nxi);
22764 + p->nid = nxi->nx_id;
22767 + vxdprintk(VXD_CBIT(nid, 5),
22768 + "moved task %p into nxi:%p[#%d]",
22769 + p, nxi, nxi->nx_id);
22772 + release_nx_info(old_nxi, p);
22775 + put_nx_info(old_nxi);
22780 +void nx_set_persistent(struct nx_info *nxi)
22782 + vxdprintk(VXD_CBIT(nid, 6),
22783 + "nx_set_persistent(%p[#%d])", nxi, nxi->nx_id);
22785 + get_nx_info(nxi);
22786 + claim_nx_info(nxi, NULL);
22789 +void nx_clear_persistent(struct nx_info *nxi)
22791 + vxdprintk(VXD_CBIT(nid, 6),
22792 + "nx_clear_persistent(%p[#%d])", nxi, nxi->nx_id);
22794 + release_nx_info(nxi, NULL);
22795 + put_nx_info(nxi);
22798 +void nx_update_persistent(struct nx_info *nxi)
22800 + if (nx_info_flags(nxi, NXF_PERSISTENT, 0))
22801 + nx_set_persistent(nxi);
22803 + nx_clear_persistent(nxi);
22806 +/* vserver syscall commands below here */
22808 +/* taks nid and nx_info functions */
22810 +#include <asm/uaccess.h>
22813 +int vc_task_nid(uint32_t id)
22818 + struct task_struct *tsk;
22820 + read_lock(&tasklist_lock);
22821 + tsk = find_task_by_real_pid(id);
22822 + nid = (tsk) ? tsk->nid : -ESRCH;
22823 + read_unlock(&tasklist_lock);
22825 + nid = nx_current_nid();
22830 +int vc_nx_info(struct nx_info *nxi, void __user *data)
22832 + struct vcmd_nx_info_v0 vc_data;
22834 + vc_data.nid = nxi->nx_id;
22836 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22842 +/* network functions */
22844 +int vc_net_create(uint32_t nid, void __user *data)
22846 + struct vcmd_net_create vc_data = { .flagword = NXF_INIT_SET };
22847 + struct nx_info *new_nxi;
22850 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
22853 + if ((nid > MAX_S_CONTEXT) || (nid < 2))
22856 + new_nxi = __create_nx_info(nid);
22857 + if (IS_ERR(new_nxi))
22858 + return PTR_ERR(new_nxi);
22860 + /* initial flags */
22861 + new_nxi->nx_flags = vc_data.flagword;
22864 + if (vs_net_change(new_nxi, VSC_NETUP))
22867 + ret = nx_migrate_task(current, new_nxi);
22871 + /* return context id on success */
22872 + ret = new_nxi->nx_id;
22874 + /* get a reference for persistent contexts */
22875 + if ((vc_data.flagword & NXF_PERSISTENT))
22876 + nx_set_persistent(new_nxi);
22878 + release_nx_info(new_nxi, NULL);
22879 + put_nx_info(new_nxi);
22884 +int vc_net_migrate(struct nx_info *nxi, void __user *data)
22886 + return nx_migrate_task(current, nxi);
22891 +int do_add_v4_addr(struct nx_info *nxi, __be32 ip, __be32 ip2, __be32 mask,
22892 + uint16_t type, uint16_t flags)
22894 + struct nx_addr_v4 *nxa = &nxi->v4;
22896 + if (NX_IPV4(nxi)) {
22897 + /* locate last entry */
22898 + for (; nxa->next; nxa = nxa->next);
22899 + nxa->next = __alloc_nx_addr_v4();
22903 + return PTR_ERR(nxa);
22906 + if (nxi->v4.next)
22907 + /* remove single ip for ip list */
22908 + nxi->nx_flags &= ~NXF_SINGLE_IP;
22910 + nxa->ip[0].s_addr = ip;
22911 + nxa->ip[1].s_addr = ip2;
22912 + nxa->mask.s_addr = mask;
22913 + nxa->type = type;
22914 + nxa->flags = flags;
22919 +int vc_net_add(struct nx_info *nxi, void __user *data)
22921 + struct vcmd_net_addr_v0 vc_data;
22922 + int index, ret = 0;
22924 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
22927 + switch (vc_data.type) {
22928 + case NXA_TYPE_IPV4:
22929 + if ((vc_data.count < 1) || (vc_data.count > 4))
22933 + while (index < vc_data.count) {
22934 + ret = do_add_v4_addr(nxi, vc_data.ip[index].s_addr, 0,
22935 + vc_data.mask[index].s_addr, NXA_TYPE_ADDR, 0);
22943 + case NXA_TYPE_IPV4|NXA_MOD_BCAST:
22944 + nxi->v4_bcast = vc_data.ip[0];
22948 + case NXA_TYPE_IPV4|NXA_MOD_LBACK:
22949 + nxi->v4_lback = vc_data.ip[0];
22960 +int vc_net_remove(struct nx_info *nxi, void __user *data)
22962 + struct vcmd_net_addr_v0 vc_data;
22964 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
22967 + switch (vc_data.type) {
22968 + case NXA_TYPE_ANY:
22969 + __dealloc_nx_addr_v4_all(xchg(&nxi->v4.next, NULL));
22970 + memset(&nxi->v4, 0, sizeof(nxi->v4));
22980 +int vc_net_add_ipv4(struct nx_info *nxi, void __user *data)
22982 + struct vcmd_net_addr_ipv4_v1 vc_data;
22984 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
22987 + switch (vc_data.type) {
22988 + case NXA_TYPE_ADDR:
22989 + case NXA_TYPE_RANGE:
22990 + case NXA_TYPE_MASK:
22991 + return do_add_v4_addr(nxi, vc_data.ip.s_addr, 0,
22992 + vc_data.mask.s_addr, vc_data.type, vc_data.flags);
22994 + case NXA_TYPE_ADDR | NXA_MOD_BCAST:
22995 + nxi->v4_bcast = vc_data.ip;
22998 + case NXA_TYPE_ADDR | NXA_MOD_LBACK:
22999 + nxi->v4_lback = vc_data.ip;
23008 +int vc_net_remove_ipv4(struct nx_info *nxi, void __user *data)
23010 + struct vcmd_net_addr_ipv4_v1 vc_data;
23012 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23015 + switch (vc_data.type) {
23016 +/* case NXA_TYPE_ADDR:
23019 + case NXA_TYPE_ANY:
23020 + __dealloc_nx_addr_v4_all(xchg(&nxi->v4.next, NULL));
23021 + memset(&nxi->v4, 0, sizeof(nxi->v4));
23031 +#ifdef CONFIG_IPV6
23033 +int do_add_v6_addr(struct nx_info *nxi,
23034 + struct in6_addr *ip, struct in6_addr *mask,
23035 + uint32_t prefix, uint16_t type, uint16_t flags)
23037 + struct nx_addr_v6 *nxa = &nxi->v6;
23039 + if (NX_IPV6(nxi)) {
23040 + /* locate last entry */
23041 + for (; nxa->next; nxa = nxa->next);
23042 + nxa->next = __alloc_nx_addr_v6();
23046 + return PTR_ERR(nxa);
23050 + nxa->mask = *mask;
23051 + nxa->prefix = prefix;
23052 + nxa->type = type;
23053 + nxa->flags = flags;
23058 +int vc_net_add_ipv6(struct nx_info *nxi, void __user *data)
23060 + struct vcmd_net_addr_ipv6_v1 vc_data;
23062 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23065 + switch (vc_data.type) {
23066 + case NXA_TYPE_ADDR:
23067 + case NXA_TYPE_MASK:
23068 + return do_add_v6_addr(nxi, &vc_data.ip, &vc_data.mask,
23069 + vc_data.prefix, vc_data.type, vc_data.flags);
23076 +int vc_net_remove_ipv6(struct nx_info *nxi, void __user *data)
23078 + struct vcmd_net_addr_ipv6_v1 vc_data;
23080 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23083 + switch (vc_data.type) {
23084 + case NXA_TYPE_ANY:
23085 + __dealloc_nx_addr_v6_all(xchg(&nxi->v6.next, NULL));
23086 + memset(&nxi->v6, 0, sizeof(nxi->v6));
23095 +#endif /* CONFIG_IPV6 */
23098 +int vc_get_nflags(struct nx_info *nxi, void __user *data)
23100 + struct vcmd_net_flags_v0 vc_data;
23102 + vc_data.flagword = nxi->nx_flags;
23104 + /* special STATE flag handling */
23105 + vc_data.mask = vs_mask_flags(~0ULL, nxi->nx_flags, NXF_ONE_TIME);
23107 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23112 +int vc_set_nflags(struct nx_info *nxi, void __user *data)
23114 + struct vcmd_net_flags_v0 vc_data;
23115 + uint64_t mask, trigger;
23117 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
23120 + /* special STATE flag handling */
23121 + mask = vs_mask_mask(vc_data.mask, nxi->nx_flags, NXF_ONE_TIME);
23122 + trigger = (mask & nxi->nx_flags) ^ (mask & vc_data.flagword);
23124 + nxi->nx_flags = vs_mask_flags(nxi->nx_flags,
23125 + vc_data.flagword, mask);
23126 + if (trigger & NXF_PERSISTENT)
23127 + nx_update_persistent(nxi);
23132 +int vc_get_ncaps(struct nx_info *nxi, void __user *data)
23134 + struct vcmd_net_caps_v0 vc_data;
23136 + vc_data.ncaps = nxi->nx_ncaps;
23137 + vc_data.cmask = ~0ULL;
23139 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23144 +int vc_set_ncaps(struct nx_info *nxi, void __user *data)
23146 + struct vcmd_net_caps_v0 vc_data;
23148 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
23151 + nxi->nx_ncaps = vs_mask_flags(nxi->nx_ncaps,
23152 + vc_data.ncaps, vc_data.cmask);
23157 +#include <linux/module.h>
23159 +module_init(init_network);
23161 +EXPORT_SYMBOL_GPL(free_nx_info);
23162 +EXPORT_SYMBOL_GPL(unhash_nx_info);
23164 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/proc.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/proc.c
23165 --- linux-2.6.35.2/kernel/vserver/proc.c 1970-01-01 01:00:00.000000000 +0100
23166 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/proc.c 2010-08-02 17:05:06.000000000 +0200
23169 + * linux/kernel/vserver/proc.c
23171 + * Virtual Context Support
23173 + * Copyright (C) 2003-2007 Herbert Pötzl
23175 + * V0.01 basic structure
23176 + * V0.02 adaptation vs1.3.0
23177 + * V0.03 proc permissions
23178 + * V0.04 locking/generic
23179 + * V0.05 next generation procfs
23180 + * V0.06 inode validation
23181 + * V0.07 generic rewrite vid
23182 + * V0.08 remove inode type
23186 +#include <linux/proc_fs.h>
23187 +#include <linux/fs_struct.h>
23188 +#include <linux/mount.h>
23189 +#include <asm/unistd.h>
23191 +#include <linux/vs_context.h>
23192 +#include <linux/vs_network.h>
23193 +#include <linux/vs_cvirt.h>
23195 +#include <linux/in.h>
23196 +#include <linux/inetdevice.h>
23197 +#include <linux/vs_inet.h>
23198 +#include <linux/vs_inet6.h>
23200 +#include <linux/vserver/global.h>
23202 +#include "cvirt_proc.h"
23203 +#include "cacct_proc.h"
23204 +#include "limit_proc.h"
23205 +#include "sched_proc.h"
23206 +#include "vci_config.h"
23209 +static inline char *print_cap_t(char *buffer, kernel_cap_t *c)
23213 + CAP_FOR_EACH_U32(__capi) {
23214 + buffer += sprintf(buffer, "%08x",
23215 + c->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]);
23221 +static struct proc_dir_entry *proc_virtual;
23223 +static struct proc_dir_entry *proc_virtnet;
23226 +/* first the actual feeds */
23229 +static int proc_vci(char *buffer)
23231 + return sprintf(buffer,
23232 + "VCIVersion:\t%04x:%04x\n"
23233 + "VCISyscall:\t%d\n"
23234 + "VCIKernel:\t%08x\n",
23235 + VCI_VERSION >> 16,
23236 + VCI_VERSION & 0xFFFF,
23238 + vci_kernel_config());
23241 +static int proc_virtual_info(char *buffer)
23243 + return proc_vci(buffer);
23246 +static int proc_virtual_status(char *buffer)
23248 + return sprintf(buffer,
23250 + "#CActive:\t%d\n"
23251 + "#NSProxy:\t%d\t%d %d %d %d %d %d\n"
23252 + "#InitTask:\t%d\t%d %d\n",
23253 + atomic_read(&vx_global_ctotal),
23254 + atomic_read(&vx_global_cactive),
23255 + atomic_read(&vs_global_nsproxy),
23256 + atomic_read(&vs_global_fs),
23257 + atomic_read(&vs_global_mnt_ns),
23258 + atomic_read(&vs_global_uts_ns),
23259 + atomic_read(&nr_ipc_ns),
23260 + atomic_read(&vs_global_user_ns),
23261 + atomic_read(&vs_global_pid_ns),
23262 + atomic_read(&init_task.usage),
23263 + atomic_read(&init_task.nsproxy->count),
23264 + init_task.fs->users);
23268 +int proc_vxi_info(struct vx_info *vxi, char *buffer)
23272 + length = sprintf(buffer,
23280 + vxi->vx_badness_bias);
23284 +int proc_vxi_status(struct vx_info *vxi, char *buffer)
23286 + char *orig = buffer;
23288 + buffer += sprintf(buffer,
23291 + "Flags:\t%016llx\n",
23292 + atomic_read(&vxi->vx_usecnt),
23293 + atomic_read(&vxi->vx_tasks),
23294 + (unsigned long long)vxi->vx_flags);
23296 + buffer += sprintf(buffer, "BCaps:\t");
23297 + buffer = print_cap_t(buffer, &vxi->vx_bcaps);
23298 + buffer += sprintf(buffer, "\n");
23300 + buffer += sprintf(buffer,
23301 + "CCaps:\t%016llx\n"
23302 + "Spaces:\t%08lx %08lx\n",
23303 + (unsigned long long)vxi->vx_ccaps,
23304 + vxi->vx_nsmask[0], vxi->vx_nsmask[1]);
23305 + return buffer - orig;
23308 +int proc_vxi_limit(struct vx_info *vxi, char *buffer)
23310 + return vx_info_proc_limit(&vxi->limit, buffer);
23313 +int proc_vxi_sched(struct vx_info *vxi, char *buffer)
23317 + length = vx_info_proc_sched(&vxi->sched, buffer);
23318 + for_each_online_cpu(cpu) {
23319 + length += vx_info_proc_sched_pc(
23320 + &vx_per_cpu(vxi, sched_pc, cpu),
23321 + buffer + length, cpu);
23326 +int proc_vxi_nsproxy0(struct vx_info *vxi, char *buffer)
23328 + return vx_info_proc_nsproxy(vxi->vx_nsproxy[0], buffer);
23331 +int proc_vxi_nsproxy1(struct vx_info *vxi, char *buffer)
23333 + return vx_info_proc_nsproxy(vxi->vx_nsproxy[1], buffer);
23336 +int proc_vxi_cvirt(struct vx_info *vxi, char *buffer)
23340 + vx_update_load(vxi);
23341 + length = vx_info_proc_cvirt(&vxi->cvirt, buffer);
23342 + for_each_online_cpu(cpu) {
23343 + length += vx_info_proc_cvirt_pc(
23344 + &vx_per_cpu(vxi, cvirt_pc, cpu),
23345 + buffer + length, cpu);
23350 +int proc_vxi_cacct(struct vx_info *vxi, char *buffer)
23352 + return vx_info_proc_cacct(&vxi->cacct, buffer);
23356 +static int proc_virtnet_info(char *buffer)
23358 + return proc_vci(buffer);
23361 +static int proc_virtnet_status(char *buffer)
23363 + return sprintf(buffer,
23365 + "#CActive:\t%d\n",
23366 + atomic_read(&nx_global_ctotal),
23367 + atomic_read(&nx_global_cactive));
23370 +int proc_nxi_info(struct nx_info *nxi, char *buffer)
23372 + struct nx_addr_v4 *v4a;
23373 +#ifdef CONFIG_IPV6
23374 + struct nx_addr_v6 *v6a;
23378 + length = sprintf(buffer,
23381 + "Bcast:\t" NIPQUAD_FMT "\n"
23382 + "Lback:\t" NIPQUAD_FMT "\n",
23385 + NIPQUAD(nxi->v4_bcast.s_addr),
23386 + NIPQUAD(nxi->v4_lback.s_addr));
23388 + if (!NX_IPV4(nxi))
23390 + for (i = 0, v4a = &nxi->v4; v4a; i++, v4a = v4a->next)
23391 + length += sprintf(buffer + length, "%d:\t" NXAV4_FMT "\n",
23394 +#ifdef CONFIG_IPV6
23395 + if (!NX_IPV6(nxi))
23397 + for (i = 0, v6a = &nxi->v6; v6a; i++, v6a = v6a->next)
23398 + length += sprintf(buffer + length, "%d:\t" NXAV6_FMT "\n",
23405 +int proc_nxi_status(struct nx_info *nxi, char *buffer)
23409 + length = sprintf(buffer,
23412 + "Flags:\t%016llx\n"
23413 + "NCaps:\t%016llx\n",
23414 + atomic_read(&nxi->nx_usecnt),
23415 + atomic_read(&nxi->nx_tasks),
23416 + (unsigned long long)nxi->nx_flags,
23417 + (unsigned long long)nxi->nx_ncaps);
23423 +/* here the inode helpers */
23429 + struct inode_operations *iop;
23430 + struct file_operations *fop;
23431 + union proc_op op;
23434 +static struct inode *vs_proc_make_inode(struct super_block *sb, struct vs_entry *p)
23436 + struct inode *inode = new_inode(sb);
23441 + inode->i_mode = p->mode;
23443 + inode->i_op = p->iop;
23445 + inode->i_fop = p->fop;
23447 + inode->i_nlink = (p->mode & S_IFDIR) ? 2 : 1;
23448 + inode->i_flags |= S_IMMUTABLE;
23450 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
23452 + inode->i_uid = 0;
23453 + inode->i_gid = 0;
23454 + inode->i_tag = 0;
23459 +static struct dentry *vs_proc_instantiate(struct inode *dir,
23460 + struct dentry *dentry, int id, void *ptr)
23462 + struct vs_entry *p = ptr;
23463 + struct inode *inode = vs_proc_make_inode(dir->i_sb, p);
23464 + struct dentry *error = ERR_PTR(-EINVAL);
23469 + PROC_I(inode)->op = p->op;
23470 + PROC_I(inode)->fd = id;
23471 + d_add(dentry, inode);
23479 +typedef struct dentry *instantiate_t(struct inode *, struct dentry *, int, void *);
23482 + * Fill a directory entry.
23484 + * If possible create the dcache entry and derive our inode number and
23485 + * file type from dcache entry.
23487 + * Since all of the proc inode numbers are dynamically generated, the inode
23488 + * numbers do not exist until the inode is cache. This means creating the
23489 + * the dcache entry in readdir is necessary to keep the inode numbers
23490 + * reported by readdir in sync with the inode numbers reported
23493 +static int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
23494 + char *name, int len, instantiate_t instantiate, int id, void *ptr)
23496 + struct dentry *child, *dir = filp->f_dentry;
23497 + struct inode *inode;
23498 + struct qstr qname;
23500 + unsigned type = DT_UNKNOWN;
23502 + qname.name = name;
23504 + qname.hash = full_name_hash(name, len);
23506 + child = d_lookup(dir, &qname);
23508 + struct dentry *new;
23509 + new = d_alloc(dir, &qname);
23511 + child = instantiate(dir->d_inode, new, id, ptr);
23518 + if (!child || IS_ERR(child) || !child->d_inode)
23519 + goto end_instantiate;
23520 + inode = child->d_inode;
23522 + ino = inode->i_ino;
23523 + type = inode->i_mode >> 12;
23528 + ino = find_inode_number(dir, &qname);
23531 + return filldir(dirent, name, len, filp->f_pos, ino, type);
23536 +/* get and revalidate vx_info/xid */
23539 +struct vx_info *get_proc_vx_info(struct inode *inode)
23541 + return lookup_vx_info(PROC_I(inode)->fd);
23544 +static int proc_xid_revalidate(struct dentry *dentry, struct nameidata *nd)
23546 + struct inode *inode = dentry->d_inode;
23547 + xid_t xid = PROC_I(inode)->fd;
23549 + if (!xid || xid_is_hashed(xid))
23556 +/* get and revalidate nx_info/nid */
23558 +static int proc_nid_revalidate(struct dentry *dentry, struct nameidata *nd)
23560 + struct inode *inode = dentry->d_inode;
23561 + nid_t nid = PROC_I(inode)->fd;
23563 + if (!nid || nid_is_hashed(nid))
23571 +#define PROC_BLOCK_SIZE (PAGE_SIZE - 1024)
23573 +static ssize_t proc_vs_info_read(struct file *file, char __user *buf,
23574 + size_t count, loff_t *ppos)
23576 + struct inode *inode = file->f_dentry->d_inode;
23577 + unsigned long page;
23578 + ssize_t length = 0;
23580 + if (count > PROC_BLOCK_SIZE)
23581 + count = PROC_BLOCK_SIZE;
23583 + /* fade that out as soon as stable */
23584 + WARN_ON(PROC_I(inode)->fd);
23586 + if (!(page = __get_free_page(GFP_KERNEL)))
23589 + BUG_ON(!PROC_I(inode)->op.proc_vs_read);
23590 + length = PROC_I(inode)->op.proc_vs_read((char *)page);
23593 + length = simple_read_from_buffer(buf, count, ppos,
23594 + (char *)page, length);
23600 +static ssize_t proc_vx_info_read(struct file *file, char __user *buf,
23601 + size_t count, loff_t *ppos)
23603 + struct inode *inode = file->f_dentry->d_inode;
23604 + struct vx_info *vxi = NULL;
23605 + xid_t xid = PROC_I(inode)->fd;
23606 + unsigned long page;
23607 + ssize_t length = 0;
23609 + if (count > PROC_BLOCK_SIZE)
23610 + count = PROC_BLOCK_SIZE;
23612 + /* fade that out as soon as stable */
23614 + vxi = lookup_vx_info(xid);
23618 + length = -ENOMEM;
23619 + if (!(page = __get_free_page(GFP_KERNEL)))
23622 + BUG_ON(!PROC_I(inode)->op.proc_vxi_read);
23623 + length = PROC_I(inode)->op.proc_vxi_read(vxi, (char *)page);
23626 + length = simple_read_from_buffer(buf, count, ppos,
23627 + (char *)page, length);
23631 + put_vx_info(vxi);
23636 +static ssize_t proc_nx_info_read(struct file *file, char __user *buf,
23637 + size_t count, loff_t *ppos)
23639 + struct inode *inode = file->f_dentry->d_inode;
23640 + struct nx_info *nxi = NULL;
23641 + nid_t nid = PROC_I(inode)->fd;
23642 + unsigned long page;
23643 + ssize_t length = 0;
23645 + if (count > PROC_BLOCK_SIZE)
23646 + count = PROC_BLOCK_SIZE;
23648 + /* fade that out as soon as stable */
23650 + nxi = lookup_nx_info(nid);
23654 + length = -ENOMEM;
23655 + if (!(page = __get_free_page(GFP_KERNEL)))
23658 + BUG_ON(!PROC_I(inode)->op.proc_nxi_read);
23659 + length = PROC_I(inode)->op.proc_nxi_read(nxi, (char *)page);
23662 + length = simple_read_from_buffer(buf, count, ppos,
23663 + (char *)page, length);
23667 + put_nx_info(nxi);
23674 +/* here comes the lower level */
23677 +#define NOD(NAME, MODE, IOP, FOP, OP) { \
23678 + .len = sizeof(NAME) - 1, \
23679 + .name = (NAME), \
23687 +#define DIR(NAME, MODE, OTYPE) \
23688 + NOD(NAME, (S_IFDIR | (MODE)), \
23689 + &proc_ ## OTYPE ## _inode_operations, \
23690 + &proc_ ## OTYPE ## _file_operations, { } )
23692 +#define INF(NAME, MODE, OTYPE) \
23693 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
23694 + &proc_vs_info_file_operations, \
23695 + { .proc_vs_read = &proc_##OTYPE } )
23697 +#define VINF(NAME, MODE, OTYPE) \
23698 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
23699 + &proc_vx_info_file_operations, \
23700 + { .proc_vxi_read = &proc_##OTYPE } )
23702 +#define NINF(NAME, MODE, OTYPE) \
23703 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
23704 + &proc_nx_info_file_operations, \
23705 + { .proc_nxi_read = &proc_##OTYPE } )
23708 +static struct file_operations proc_vs_info_file_operations = {
23709 + .read = proc_vs_info_read,
23712 +static struct file_operations proc_vx_info_file_operations = {
23713 + .read = proc_vx_info_read,
23716 +static struct dentry_operations proc_xid_dentry_operations = {
23717 + .d_revalidate = proc_xid_revalidate,
23720 +static struct vs_entry vx_base_stuff[] = {
23721 + VINF("info", S_IRUGO, vxi_info),
23722 + VINF("status", S_IRUGO, vxi_status),
23723 + VINF("limit", S_IRUGO, vxi_limit),
23724 + VINF("sched", S_IRUGO, vxi_sched),
23725 + VINF("nsproxy", S_IRUGO, vxi_nsproxy0),
23726 + VINF("nsproxy1",S_IRUGO, vxi_nsproxy1),
23727 + VINF("cvirt", S_IRUGO, vxi_cvirt),
23728 + VINF("cacct", S_IRUGO, vxi_cacct),
23735 +static struct dentry *proc_xid_instantiate(struct inode *dir,
23736 + struct dentry *dentry, int id, void *ptr)
23738 + dentry->d_op = &proc_xid_dentry_operations;
23739 + return vs_proc_instantiate(dir, dentry, id, ptr);
23742 +static struct dentry *proc_xid_lookup(struct inode *dir,
23743 + struct dentry *dentry, struct nameidata *nd)
23745 + struct vs_entry *p = vx_base_stuff;
23746 + struct dentry *error = ERR_PTR(-ENOENT);
23748 + for (; p->name; p++) {
23749 + if (p->len != dentry->d_name.len)
23751 + if (!memcmp(dentry->d_name.name, p->name, p->len))
23757 + error = proc_xid_instantiate(dir, dentry, PROC_I(dir)->fd, p);
23762 +static int proc_xid_readdir(struct file *filp,
23763 + void *dirent, filldir_t filldir)
23765 + struct dentry *dentry = filp->f_dentry;
23766 + struct inode *inode = dentry->d_inode;
23767 + struct vs_entry *p = vx_base_stuff;
23768 + int size = sizeof(vx_base_stuff) / sizeof(struct vs_entry);
23772 + pos = filp->f_pos;
23775 + ino = inode->i_ino;
23776 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
23779 + /* fall through */
23781 + ino = parent_ino(dentry);
23782 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
23785 + /* fall through */
23788 + if (index >= size)
23790 + for (p += index; p->name; p++) {
23791 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
23792 + vs_proc_instantiate, PROC_I(inode)->fd, p))
23798 + filp->f_pos = pos;
23804 +static struct file_operations proc_nx_info_file_operations = {
23805 + .read = proc_nx_info_read,
23808 +static struct dentry_operations proc_nid_dentry_operations = {
23809 + .d_revalidate = proc_nid_revalidate,
23812 +static struct vs_entry nx_base_stuff[] = {
23813 + NINF("info", S_IRUGO, nxi_info),
23814 + NINF("status", S_IRUGO, nxi_status),
23819 +static struct dentry *proc_nid_instantiate(struct inode *dir,
23820 + struct dentry *dentry, int id, void *ptr)
23822 + dentry->d_op = &proc_nid_dentry_operations;
23823 + return vs_proc_instantiate(dir, dentry, id, ptr);
23826 +static struct dentry *proc_nid_lookup(struct inode *dir,
23827 + struct dentry *dentry, struct nameidata *nd)
23829 + struct vs_entry *p = nx_base_stuff;
23830 + struct dentry *error = ERR_PTR(-ENOENT);
23832 + for (; p->name; p++) {
23833 + if (p->len != dentry->d_name.len)
23835 + if (!memcmp(dentry->d_name.name, p->name, p->len))
23841 + error = proc_nid_instantiate(dir, dentry, PROC_I(dir)->fd, p);
23846 +static int proc_nid_readdir(struct file *filp,
23847 + void *dirent, filldir_t filldir)
23849 + struct dentry *dentry = filp->f_dentry;
23850 + struct inode *inode = dentry->d_inode;
23851 + struct vs_entry *p = nx_base_stuff;
23852 + int size = sizeof(nx_base_stuff) / sizeof(struct vs_entry);
23856 + pos = filp->f_pos;
23859 + ino = inode->i_ino;
23860 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
23863 + /* fall through */
23865 + ino = parent_ino(dentry);
23866 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
23869 + /* fall through */
23872 + if (index >= size)
23874 + for (p += index; p->name; p++) {
23875 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
23876 + vs_proc_instantiate, PROC_I(inode)->fd, p))
23882 + filp->f_pos = pos;
23887 +#define MAX_MULBY10 ((~0U - 9) / 10)
23889 +static inline int atovid(const char *str, int len)
23894 + while (len-- > 0) {
23899 + if (vid >= MAX_MULBY10)
23909 +/* now the upper level (virtual) */
23912 +static struct file_operations proc_xid_file_operations = {
23913 + .read = generic_read_dir,
23914 + .readdir = proc_xid_readdir,
23917 +static struct inode_operations proc_xid_inode_operations = {
23918 + .lookup = proc_xid_lookup,
23921 +static struct vs_entry vx_virtual_stuff[] = {
23922 + INF("info", S_IRUGO, virtual_info),
23923 + INF("status", S_IRUGO, virtual_status),
23924 + DIR(NULL, S_IRUGO | S_IXUGO, xid),
23928 +static struct dentry *proc_virtual_lookup(struct inode *dir,
23929 + struct dentry *dentry, struct nameidata *nd)
23931 + struct vs_entry *p = vx_virtual_stuff;
23932 + struct dentry *error = ERR_PTR(-ENOENT);
23935 + for (; p->name; p++) {
23936 + if (p->len != dentry->d_name.len)
23938 + if (!memcmp(dentry->d_name.name, p->name, p->len))
23942 + goto instantiate;
23944 + id = atovid(dentry->d_name.name, dentry->d_name.len);
23945 + if ((id < 0) || !xid_is_hashed(id))
23949 + error = proc_xid_instantiate(dir, dentry, id, p);
23954 +static struct file_operations proc_nid_file_operations = {
23955 + .read = generic_read_dir,
23956 + .readdir = proc_nid_readdir,
23959 +static struct inode_operations proc_nid_inode_operations = {
23960 + .lookup = proc_nid_lookup,
23963 +static struct vs_entry nx_virtnet_stuff[] = {
23964 + INF("info", S_IRUGO, virtnet_info),
23965 + INF("status", S_IRUGO, virtnet_status),
23966 + DIR(NULL, S_IRUGO | S_IXUGO, nid),
23970 +static struct dentry *proc_virtnet_lookup(struct inode *dir,
23971 + struct dentry *dentry, struct nameidata *nd)
23973 + struct vs_entry *p = nx_virtnet_stuff;
23974 + struct dentry *error = ERR_PTR(-ENOENT);
23977 + for (; p->name; p++) {
23978 + if (p->len != dentry->d_name.len)
23980 + if (!memcmp(dentry->d_name.name, p->name, p->len))
23984 + goto instantiate;
23986 + id = atovid(dentry->d_name.name, dentry->d_name.len);
23987 + if ((id < 0) || !nid_is_hashed(id))
23991 + error = proc_nid_instantiate(dir, dentry, id, p);
23997 +#define PROC_MAXVIDS 32
23999 +int proc_virtual_readdir(struct file *filp,
24000 + void *dirent, filldir_t filldir)
24002 + struct dentry *dentry = filp->f_dentry;
24003 + struct inode *inode = dentry->d_inode;
24004 + struct vs_entry *p = vx_virtual_stuff;
24005 + int size = sizeof(vx_virtual_stuff) / sizeof(struct vs_entry);
24007 + unsigned int xid_array[PROC_MAXVIDS];
24008 + char buf[PROC_NUMBUF];
24009 + unsigned int nr_xids, i;
24012 + pos = filp->f_pos;
24015 + ino = inode->i_ino;
24016 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24019 + /* fall through */
24021 + ino = parent_ino(dentry);
24022 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24025 + /* fall through */
24028 + if (index >= size)
24030 + for (p += index; p->name; p++) {
24031 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24032 + vs_proc_instantiate, 0, p))
24037 + index = pos - size;
24038 + p = &vx_virtual_stuff[size - 1];
24039 + nr_xids = get_xid_list(index, xid_array, PROC_MAXVIDS);
24040 + for (i = 0; i < nr_xids; i++) {
24041 + int n, xid = xid_array[i];
24042 + unsigned int j = PROC_NUMBUF;
24046 + buf[--j] = '0' + (n % 10);
24049 + if (proc_fill_cache(filp, dirent, filldir,
24050 + buf + j, PROC_NUMBUF - j,
24051 + vs_proc_instantiate, xid, p))
24057 + filp->f_pos = pos;
24061 +static int proc_virtual_getattr(struct vfsmount *mnt,
24062 + struct dentry *dentry, struct kstat *stat)
24064 + struct inode *inode = dentry->d_inode;
24066 + generic_fillattr(inode, stat);
24067 + stat->nlink = 2 + atomic_read(&vx_global_cactive);
24071 +static struct file_operations proc_virtual_dir_operations = {
24072 + .read = generic_read_dir,
24073 + .readdir = proc_virtual_readdir,
24076 +static struct inode_operations proc_virtual_dir_inode_operations = {
24077 + .getattr = proc_virtual_getattr,
24078 + .lookup = proc_virtual_lookup,
24085 +int proc_virtnet_readdir(struct file *filp,
24086 + void *dirent, filldir_t filldir)
24088 + struct dentry *dentry = filp->f_dentry;
24089 + struct inode *inode = dentry->d_inode;
24090 + struct vs_entry *p = nx_virtnet_stuff;
24091 + int size = sizeof(nx_virtnet_stuff) / sizeof(struct vs_entry);
24093 + unsigned int nid_array[PROC_MAXVIDS];
24094 + char buf[PROC_NUMBUF];
24095 + unsigned int nr_nids, i;
24098 + pos = filp->f_pos;
24101 + ino = inode->i_ino;
24102 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24105 + /* fall through */
24107 + ino = parent_ino(dentry);
24108 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24111 + /* fall through */
24114 + if (index >= size)
24116 + for (p += index; p->name; p++) {
24117 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24118 + vs_proc_instantiate, 0, p))
24123 + index = pos - size;
24124 + p = &nx_virtnet_stuff[size - 1];
24125 + nr_nids = get_nid_list(index, nid_array, PROC_MAXVIDS);
24126 + for (i = 0; i < nr_nids; i++) {
24127 + int n, nid = nid_array[i];
24128 + unsigned int j = PROC_NUMBUF;
24132 + buf[--j] = '0' + (n % 10);
24135 + if (proc_fill_cache(filp, dirent, filldir,
24136 + buf + j, PROC_NUMBUF - j,
24137 + vs_proc_instantiate, nid, p))
24143 + filp->f_pos = pos;
24147 +static int proc_virtnet_getattr(struct vfsmount *mnt,
24148 + struct dentry *dentry, struct kstat *stat)
24150 + struct inode *inode = dentry->d_inode;
24152 + generic_fillattr(inode, stat);
24153 + stat->nlink = 2 + atomic_read(&nx_global_cactive);
24157 +static struct file_operations proc_virtnet_dir_operations = {
24158 + .read = generic_read_dir,
24159 + .readdir = proc_virtnet_readdir,
24162 +static struct inode_operations proc_virtnet_dir_inode_operations = {
24163 + .getattr = proc_virtnet_getattr,
24164 + .lookup = proc_virtnet_lookup,
24169 +void proc_vx_init(void)
24171 + struct proc_dir_entry *ent;
24173 + ent = proc_mkdir("virtual", 0);
24175 + ent->proc_fops = &proc_virtual_dir_operations;
24176 + ent->proc_iops = &proc_virtual_dir_inode_operations;
24178 + proc_virtual = ent;
24180 + ent = proc_mkdir("virtnet", 0);
24182 + ent->proc_fops = &proc_virtnet_dir_operations;
24183 + ent->proc_iops = &proc_virtnet_dir_inode_operations;
24185 + proc_virtnet = ent;
24191 +/* per pid info */
24194 +int proc_pid_vx_info(struct task_struct *p, char *buffer)
24196 + struct vx_info *vxi;
24197 + char *orig = buffer;
24199 + buffer += sprintf(buffer, "XID:\t%d\n", vx_task_xid(p));
24201 + vxi = task_get_vx_info(p);
24205 + buffer += sprintf(buffer, "BCaps:\t");
24206 + buffer = print_cap_t(buffer, &vxi->vx_bcaps);
24207 + buffer += sprintf(buffer, "\n");
24208 + buffer += sprintf(buffer, "CCaps:\t%016llx\n",
24209 + (unsigned long long)vxi->vx_ccaps);
24210 + buffer += sprintf(buffer, "CFlags:\t%016llx\n",
24211 + (unsigned long long)vxi->vx_flags);
24212 + buffer += sprintf(buffer, "CIPid:\t%d\n", vxi->vx_initpid);
24214 + put_vx_info(vxi);
24216 + return buffer - orig;
24220 +int proc_pid_nx_info(struct task_struct *p, char *buffer)
24222 + struct nx_info *nxi;
24223 + struct nx_addr_v4 *v4a;
24224 +#ifdef CONFIG_IPV6
24225 + struct nx_addr_v6 *v6a;
24227 + char *orig = buffer;
24230 + buffer += sprintf(buffer, "NID:\t%d\n", nx_task_nid(p));
24232 + nxi = task_get_nx_info(p);
24236 + buffer += sprintf(buffer, "NCaps:\t%016llx\n",
24237 + (unsigned long long)nxi->nx_ncaps);
24238 + buffer += sprintf(buffer, "NFlags:\t%016llx\n",
24239 + (unsigned long long)nxi->nx_flags);
24241 + buffer += sprintf(buffer,
24242 + "V4Root[bcast]:\t" NIPQUAD_FMT "\n",
24243 + NIPQUAD(nxi->v4_bcast.s_addr));
24244 + buffer += sprintf (buffer,
24245 + "V4Root[lback]:\t" NIPQUAD_FMT "\n",
24246 + NIPQUAD(nxi->v4_lback.s_addr));
24247 + if (!NX_IPV4(nxi))
24249 + for (i = 0, v4a = &nxi->v4; v4a; i++, v4a = v4a->next)
24250 + buffer += sprintf(buffer, "V4Root[%d]:\t" NXAV4_FMT "\n",
24253 +#ifdef CONFIG_IPV6
24254 + if (!NX_IPV6(nxi))
24256 + for (i = 0, v6a = &nxi->v6; v6a; i++, v6a = v6a->next)
24257 + buffer += sprintf(buffer, "V6Root[%d]:\t" NXAV6_FMT "\n",
24261 + put_nx_info(nxi);
24263 + return buffer - orig;
24266 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/sched.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/sched.c
24267 --- linux-2.6.35.2/kernel/vserver/sched.c 1970-01-01 01:00:00.000000000 +0100
24268 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/sched.c 2010-08-02 17:05:06.000000000 +0200
24271 + * linux/kernel/vserver/sched.c
24273 + * Virtual Server: Scheduler Support
24275 + * Copyright (C) 2004-2007 Herbert Pötzl
24277 + * V0.01 adapted Sam Vilains version to 2.6.3
24278 + * V0.02 removed legacy interface
24279 + * V0.03 changed vcmds to vxi arg
24280 + * V0.04 removed older and legacy interfaces
24284 +#include <linux/vs_context.h>
24285 +#include <linux/vs_sched.h>
24286 +#include <linux/vserver/sched_cmd.h>
24288 +#include <asm/uaccess.h>
24291 +#define vxd_check_range(val, min, max) do { \
24292 + vxlprintk((val < min) || (val > max), \
24293 + "check_range(%ld,%ld,%ld)", \
24294 + (long)val, (long)min, (long)max, \
24295 + __FILE__, __LINE__); \
24299 +void vx_update_sched_param(struct _vx_sched *sched,
24300 + struct _vx_sched_pc *sched_pc)
24302 + unsigned int set_mask = sched->update_mask;
24304 + if (set_mask & VXSM_FILL_RATE)
24305 + sched_pc->fill_rate[0] = sched->fill_rate[0];
24306 + if (set_mask & VXSM_INTERVAL)
24307 + sched_pc->interval[0] = sched->interval[0];
24308 + if (set_mask & VXSM_FILL_RATE2)
24309 + sched_pc->fill_rate[1] = sched->fill_rate[1];
24310 + if (set_mask & VXSM_INTERVAL2)
24311 + sched_pc->interval[1] = sched->interval[1];
24312 + if (set_mask & VXSM_TOKENS)
24313 + sched_pc->tokens = sched->tokens;
24314 + if (set_mask & VXSM_TOKENS_MIN)
24315 + sched_pc->tokens_min = sched->tokens_min;
24316 + if (set_mask & VXSM_TOKENS_MAX)
24317 + sched_pc->tokens_max = sched->tokens_max;
24318 + if (set_mask & VXSM_PRIO_BIAS)
24319 + sched_pc->prio_bias = sched->prio_bias;
24321 + if (set_mask & VXSM_IDLE_TIME)
24322 + sched_pc->flags |= VXSF_IDLE_TIME;
24324 + sched_pc->flags &= ~VXSF_IDLE_TIME;
24327 + sched_pc->norm_time = jiffies;
24332 + * recalculate the context's scheduling tokens
24334 + * ret > 0 : number of tokens available
24335 + * ret < 0 : on hold, check delta_min[]
24336 + * -1 only jiffies
24337 + * -2 also idle time
24340 +int vx_tokens_recalc(struct _vx_sched_pc *sched_pc,
24341 + unsigned long *norm_time, unsigned long *idle_time, int delta_min[2])
24345 + int flags = sched_pc->flags;
24347 + /* how much time did pass? */
24348 + delta = *norm_time - sched_pc->norm_time;
24349 + // printk("@ %ld, %ld, %ld\n", *norm_time, sched_pc->norm_time, jiffies);
24350 + vxd_check_range(delta, 0, INT_MAX);
24352 + if (delta >= sched_pc->interval[0]) {
24353 + long tokens, integral;
24355 + /* calc integral token part */
24356 + tokens = delta / sched_pc->interval[0];
24357 + integral = tokens * sched_pc->interval[0];
24358 + tokens *= sched_pc->fill_rate[0];
24359 +#ifdef CONFIG_VSERVER_HARDCPU
24360 + delta_min[0] = delta - integral;
24361 + vxd_check_range(delta_min[0], 0, sched_pc->interval[0]);
24363 + /* advance time */
24364 + sched_pc->norm_time += delta;
24367 + sched_pc->tokens += tokens;
24368 + sched_pc->token_time += tokens;
24370 + delta_min[0] = delta;
24372 +#ifdef CONFIG_VSERVER_IDLETIME
24373 + if (!(flags & VXSF_IDLE_TIME))
24376 + /* how much was the idle skip? */
24377 + delta = *idle_time - sched_pc->idle_time;
24378 + vxd_check_range(delta, 0, INT_MAX);
24380 + if (delta >= sched_pc->interval[1]) {
24381 + long tokens, integral;
24383 + /* calc fair share token part */
24384 + tokens = delta / sched_pc->interval[1];
24385 + integral = tokens * sched_pc->interval[1];
24386 + tokens *= sched_pc->fill_rate[1];
24387 + delta_min[1] = delta - integral;
24388 + vxd_check_range(delta_min[1], 0, sched_pc->interval[1]);
24390 + /* advance idle time */
24391 + sched_pc->idle_time += integral;
24394 + sched_pc->tokens += tokens;
24395 + sched_pc->token_time += tokens;
24397 + delta_min[1] = delta;
24401 + /* clip at maximum */
24402 + if (sched_pc->tokens > sched_pc->tokens_max)
24403 + sched_pc->tokens = sched_pc->tokens_max;
24404 + tokens = sched_pc->tokens;
24406 + if ((flags & VXSF_ONHOLD)) {
24407 + /* can we unhold? */
24408 + if (tokens >= sched_pc->tokens_min) {
24409 + flags &= ~VXSF_ONHOLD;
24410 + sched_pc->hold_ticks +=
24411 + *norm_time - sched_pc->onhold;
24415 + /* put on hold? */
24416 + if (tokens <= 0) {
24417 + flags |= VXSF_ONHOLD;
24418 + sched_pc->onhold = *norm_time;
24422 + sched_pc->flags = flags;
24426 + tokens = sched_pc->tokens_min - tokens;
24427 + sched_pc->flags = flags;
24428 + // BUG_ON(tokens < 0); probably doesn't hold anymore
24430 +#ifdef CONFIG_VSERVER_HARDCPU
24431 + /* next interval? */
24432 + if (!sched_pc->fill_rate[0])
24433 + delta_min[0] = HZ;
24434 + else if (tokens > sched_pc->fill_rate[0])
24435 + delta_min[0] += sched_pc->interval[0] *
24436 + tokens / sched_pc->fill_rate[0];
24438 + delta_min[0] = sched_pc->interval[0] - delta_min[0];
24439 + vxd_check_range(delta_min[0], 0, INT_MAX);
24441 +#ifdef CONFIG_VSERVER_IDLETIME
24442 + if (!(flags & VXSF_IDLE_TIME))
24445 + /* next interval? */
24446 + if (!sched_pc->fill_rate[1])
24447 + delta_min[1] = HZ;
24448 + else if (tokens > sched_pc->fill_rate[1])
24449 + delta_min[1] += sched_pc->interval[1] *
24450 + tokens / sched_pc->fill_rate[1];
24452 + delta_min[1] = sched_pc->interval[1] - delta_min[1];
24453 + vxd_check_range(delta_min[1], 0, INT_MAX);
24458 +#endif /* CONFIG_VSERVER_IDLETIME */
24461 +#endif /* CONFIG_VSERVER_HARDCPU */
24464 +static inline unsigned long msec_to_ticks(unsigned long msec)
24466 + return msecs_to_jiffies(msec);
24469 +static inline unsigned long ticks_to_msec(unsigned long ticks)
24471 + return jiffies_to_msecs(ticks);
24474 +static inline unsigned long ticks_to_usec(unsigned long ticks)
24476 + return jiffies_to_usecs(ticks);
24480 +static int do_set_sched(struct vx_info *vxi, struct vcmd_sched_v5 *data)
24482 + unsigned int set_mask = data->mask;
24483 + unsigned int update_mask;
24486 + /* Sanity check data values */
24487 + if (data->tokens_max <= 0)
24488 + data->tokens_max = HZ;
24489 + if (data->tokens_min < 0)
24490 + data->tokens_min = HZ / 3;
24491 + if (data->tokens_min >= data->tokens_max)
24492 + data->tokens_min = data->tokens_max;
24494 + if (data->prio_bias > MAX_PRIO_BIAS)
24495 + data->prio_bias = MAX_PRIO_BIAS;
24496 + if (data->prio_bias < MIN_PRIO_BIAS)
24497 + data->prio_bias = MIN_PRIO_BIAS;
24499 + spin_lock(&vxi->sched.tokens_lock);
24501 + /* sync up on delayed updates */
24502 + for_each_cpu_mask(cpu, vxi->sched.update)
24503 + vx_update_sched_param(&vxi->sched,
24504 + &vx_per_cpu(vxi, sched_pc, cpu));
24506 + if (set_mask & VXSM_FILL_RATE)
24507 + vxi->sched.fill_rate[0] = data->fill_rate[0];
24508 + if (set_mask & VXSM_FILL_RATE2)
24509 + vxi->sched.fill_rate[1] = data->fill_rate[1];
24510 + if (set_mask & VXSM_INTERVAL)
24511 + vxi->sched.interval[0] = (set_mask & VXSM_MSEC) ?
24512 + msec_to_ticks(data->interval[0]) : data->interval[0];
24513 + if (set_mask & VXSM_INTERVAL2)
24514 + vxi->sched.interval[1] = (set_mask & VXSM_MSEC) ?
24515 + msec_to_ticks(data->interval[1]) : data->interval[1];
24516 + if (set_mask & VXSM_TOKENS)
24517 + vxi->sched.tokens = data->tokens;
24518 + if (set_mask & VXSM_TOKENS_MIN)
24519 + vxi->sched.tokens_min = data->tokens_min;
24520 + if (set_mask & VXSM_TOKENS_MAX)
24521 + vxi->sched.tokens_max = data->tokens_max;
24522 + if (set_mask & VXSM_PRIO_BIAS)
24523 + vxi->sched.prio_bias = data->prio_bias;
24525 + /* Sanity check rate/interval */
24526 + for (i = 0; i < 2; i++) {
24527 + if (data->fill_rate[i] < 0)
24528 + data->fill_rate[i] = 0;
24529 + if (data->interval[i] <= 0)
24530 + data->interval[i] = HZ;
24533 + update_mask = vxi->sched.update_mask & VXSM_SET_MASK;
24534 + update_mask |= (set_mask & (VXSM_SET_MASK | VXSM_IDLE_TIME));
24535 + vxi->sched.update_mask = update_mask;
24539 + if (set_mask & VXSM_CPU_ID) {
24540 + vxi->sched.update = cpumask_of_cpu(data->cpu_id);
24541 + cpus_and(vxi->sched.update, cpu_online_map,
24542 + vxi->sched.update);
24544 + vxi->sched.update = cpu_online_map;
24546 + /* forced reload? */
24547 + if (set_mask & VXSM_FORCE) {
24548 + for_each_cpu_mask(cpu, vxi->sched.update)
24549 + vx_update_sched_param(&vxi->sched,
24550 + &vx_per_cpu(vxi, sched_pc, cpu));
24551 + vxi->sched.update = CPU_MASK_NONE;
24554 + /* on UP we update immediately */
24555 + vx_update_sched_param(&vxi->sched,
24556 + &vx_per_cpu(vxi, sched_pc, 0));
24559 + spin_unlock(&vxi->sched.tokens_lock);
24564 +#define COPY_IDS(C) C(cpu_id); C(bucket_id)
24565 +#define COPY_PRI(C) C(prio_bias)
24566 +#define COPY_TOK(C) C(tokens); C(tokens_min); C(tokens_max)
24567 +#define COPY_FRI(C) C(fill_rate[0]); C(interval[0]); \
24568 + C(fill_rate[1]); C(interval[1]);
24570 +#define COPY_VALUE(name) vc_data.name = data->name
24572 +static int do_set_sched_v4(struct vx_info *vxi, struct vcmd_set_sched_v4 *data)
24574 + struct vcmd_sched_v5 vc_data;
24576 + vc_data.mask = data->set_mask;
24577 + COPY_IDS(COPY_VALUE);
24578 + COPY_PRI(COPY_VALUE);
24579 + COPY_TOK(COPY_VALUE);
24580 + vc_data.fill_rate[0] = vc_data.fill_rate[1] = data->fill_rate;
24581 + vc_data.interval[0] = vc_data.interval[1] = data->interval;
24582 + return do_set_sched(vxi, &vc_data);
24585 +int vc_set_sched_v4(struct vx_info *vxi, void __user *data)
24587 + struct vcmd_set_sched_v4 vc_data;
24589 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24592 + return do_set_sched_v4(vxi, &vc_data);
24595 + /* latest interface is v5 */
24597 +int vc_set_sched(struct vx_info *vxi, void __user *data)
24599 + struct vcmd_sched_v5 vc_data;
24601 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24604 + return do_set_sched(vxi, &vc_data);
24608 +#define COPY_PRI(C) C(prio_bias)
24609 +#define COPY_TOK(C) C(tokens); C(tokens_min); C(tokens_max)
24610 +#define COPY_FRI(C) C(fill_rate[0]); C(interval[0]); \
24611 + C(fill_rate[1]); C(interval[1]);
24613 +#define COPY_VALUE(name) vc_data.name = data->name
24616 +int vc_get_sched(struct vx_info *vxi, void __user *data)
24618 + struct vcmd_sched_v5 vc_data;
24620 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24623 + if (vc_data.mask & VXSM_CPU_ID) {
24624 + int cpu = vc_data.cpu_id;
24625 + struct _vx_sched_pc *data;
24627 + if (!cpu_possible(cpu))
24630 + data = &vx_per_cpu(vxi, sched_pc, cpu);
24631 + COPY_TOK(COPY_VALUE);
24632 + COPY_PRI(COPY_VALUE);
24633 + COPY_FRI(COPY_VALUE);
24635 + if (data->flags & VXSF_IDLE_TIME)
24636 + vc_data.mask |= VXSM_IDLE_TIME;
24638 + struct _vx_sched *data = &vxi->sched;
24640 + COPY_TOK(COPY_VALUE);
24641 + COPY_PRI(COPY_VALUE);
24642 + COPY_FRI(COPY_VALUE);
24645 + if (vc_data.mask & VXSM_MSEC) {
24646 + vc_data.interval[0] = ticks_to_msec(vc_data.interval[0]);
24647 + vc_data.interval[1] = ticks_to_msec(vc_data.interval[1]);
24650 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
24656 +int vc_sched_info(struct vx_info *vxi, void __user *data)
24658 + struct vcmd_sched_info vc_data;
24661 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24664 + cpu = vc_data.cpu_id;
24665 + if (!cpu_possible(cpu))
24669 + struct _vx_sched_pc *sched_pc =
24670 + &vx_per_cpu(vxi, sched_pc, cpu);
24672 + vc_data.user_msec = ticks_to_msec(sched_pc->user_ticks);
24673 + vc_data.sys_msec = ticks_to_msec(sched_pc->sys_ticks);
24674 + vc_data.hold_msec = ticks_to_msec(sched_pc->hold_ticks);
24675 + vc_data.vavavoom = sched_pc->vavavoom;
24677 + vc_data.token_usec = ticks_to_usec(1);
24679 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
24684 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/sched_init.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/sched_init.h
24685 --- linux-2.6.35.2/kernel/vserver/sched_init.h 1970-01-01 01:00:00.000000000 +0100
24686 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/sched_init.h 2010-08-02 17:05:06.000000000 +0200
24689 +static inline void vx_info_init_sched(struct _vx_sched *sched)
24691 + static struct lock_class_key tokens_lock_key;
24693 + /* scheduling; hard code starting values as constants */
24694 + sched->fill_rate[0] = 1;
24695 + sched->interval[0] = 4;
24696 + sched->fill_rate[1] = 1;
24697 + sched->interval[1] = 8;
24698 + sched->tokens = HZ >> 2;
24699 + sched->tokens_min = HZ >> 4;
24700 + sched->tokens_max = HZ >> 1;
24701 + sched->tokens_lock = SPIN_LOCK_UNLOCKED;
24702 + sched->prio_bias = 0;
24704 + lockdep_set_class(&sched->tokens_lock, &tokens_lock_key);
24708 +void vx_info_init_sched_pc(struct _vx_sched_pc *sched_pc, int cpu)
24710 + sched_pc->fill_rate[0] = 1;
24711 + sched_pc->interval[0] = 4;
24712 + sched_pc->fill_rate[1] = 1;
24713 + sched_pc->interval[1] = 8;
24714 + sched_pc->tokens = HZ >> 2;
24715 + sched_pc->tokens_min = HZ >> 4;
24716 + sched_pc->tokens_max = HZ >> 1;
24717 + sched_pc->prio_bias = 0;
24718 + sched_pc->vavavoom = 0;
24719 + sched_pc->token_time = 0;
24720 + sched_pc->idle_time = 0;
24721 + sched_pc->norm_time = jiffies;
24723 + sched_pc->user_ticks = 0;
24724 + sched_pc->sys_ticks = 0;
24725 + sched_pc->hold_ticks = 0;
24728 +static inline void vx_info_exit_sched(struct _vx_sched *sched)
24734 +void vx_info_exit_sched_pc(struct _vx_sched_pc *sched_pc, int cpu)
24738 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/sched_proc.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/sched_proc.h
24739 --- linux-2.6.35.2/kernel/vserver/sched_proc.h 1970-01-01 01:00:00.000000000 +0100
24740 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/sched_proc.h 2010-08-02 17:05:06.000000000 +0200
24742 +#ifndef _VX_SCHED_PROC_H
24743 +#define _VX_SCHED_PROC_H
24747 +int vx_info_proc_sched(struct _vx_sched *sched, char *buffer)
24751 + length += sprintf(buffer,
24752 + "FillRate:\t%8d,%d\n"
24753 + "Interval:\t%8d,%d\n"
24754 + "TokensMin:\t%8d\n"
24755 + "TokensMax:\t%8d\n"
24756 + "PrioBias:\t%8d\n",
24757 + sched->fill_rate[0],
24758 + sched->fill_rate[1],
24759 + sched->interval[0],
24760 + sched->interval[1],
24761 + sched->tokens_min,
24762 + sched->tokens_max,
24763 + sched->prio_bias);
24768 +int vx_info_proc_sched_pc(struct _vx_sched_pc *sched_pc,
24769 + char *buffer, int cpu)
24773 + length += sprintf(buffer + length,
24774 + "cpu %d: %lld %lld %lld %ld %ld", cpu,
24775 + (unsigned long long)sched_pc->user_ticks,
24776 + (unsigned long long)sched_pc->sys_ticks,
24777 + (unsigned long long)sched_pc->hold_ticks,
24778 + sched_pc->token_time,
24779 + sched_pc->idle_time);
24780 + length += sprintf(buffer + length,
24781 + " %c%c %d %d %d %d/%d %d/%d",
24782 + (sched_pc->flags & VXSF_ONHOLD) ? 'H' : 'R',
24783 + (sched_pc->flags & VXSF_IDLE_TIME) ? 'I' : '-',
24784 + sched_pc->tokens,
24785 + sched_pc->tokens_min,
24786 + sched_pc->tokens_max,
24787 + sched_pc->fill_rate[0],
24788 + sched_pc->interval[0],
24789 + sched_pc->fill_rate[1],
24790 + sched_pc->interval[1]);
24791 + length += sprintf(buffer + length,
24793 + sched_pc->prio_bias,
24794 + sched_pc->vavavoom);
24798 +#endif /* _VX_SCHED_PROC_H */
24799 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/signal.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/signal.c
24800 --- linux-2.6.35.2/kernel/vserver/signal.c 1970-01-01 01:00:00.000000000 +0100
24801 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/signal.c 2010-08-02 17:05:06.000000000 +0200
24804 + * linux/kernel/vserver/signal.c
24806 + * Virtual Server: Signal Support
24808 + * Copyright (C) 2003-2007 Herbert Pötzl
24810 + * V0.01 broken out from vcontext V0.05
24811 + * V0.02 changed vcmds to vxi arg
24812 + * V0.03 adjusted siginfo for kill
24816 +#include <asm/uaccess.h>
24818 +#include <linux/vs_context.h>
24819 +#include <linux/vs_pid.h>
24820 +#include <linux/vserver/signal_cmd.h>
24823 +int vx_info_kill(struct vx_info *vxi, int pid, int sig)
24825 + int retval, count = 0;
24826 + struct task_struct *p;
24827 + struct siginfo *sip = SEND_SIG_PRIV;
24830 + vxdprintk(VXD_CBIT(misc, 4),
24831 + "vx_info_kill(%p[#%d],%d,%d)*",
24832 + vxi, vxi->vx_id, pid, sig);
24833 + read_lock(&tasklist_lock);
24837 + for_each_process(p) {
24840 + if (vx_task_xid(p) != vxi->vx_id || p->pid <= 1 ||
24841 + (pid && vxi->vx_initpid == p->pid))
24844 + err = group_send_sig_info(sig, sip, p);
24846 + if (err != -EPERM)
24852 + if (vxi->vx_initpid) {
24853 + pid = vxi->vx_initpid;
24854 + /* for now, only SIGINT to private init ... */
24855 + if (!vx_info_flags(vxi, VXF_STATE_ADMIN, 0) &&
24856 + /* ... as long as there are tasks left */
24857 + (atomic_read(&vxi->vx_tasks) > 1))
24860 + /* fallthrough */
24862 + p = find_task_by_real_pid(pid);
24864 + if (vx_task_xid(p) == vxi->vx_id)
24865 + retval = group_send_sig_info(sig, sip, p);
24869 + read_unlock(&tasklist_lock);
24870 + vxdprintk(VXD_CBIT(misc, 4),
24871 + "vx_info_kill(%p[#%d],%d,%d,%ld) = %d",
24872 + vxi, vxi->vx_id, pid, sig, (long)sip, retval);
24876 +int vc_ctx_kill(struct vx_info *vxi, void __user *data)
24878 + struct vcmd_ctx_kill_v0 vc_data;
24880 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24883 + /* special check to allow guest shutdown */
24884 + if (!vx_info_flags(vxi, VXF_STATE_ADMIN, 0) &&
24885 + /* forbid killall pid=0 when init is present */
24886 + (((vc_data.pid < 1) && vxi->vx_initpid) ||
24887 + (vc_data.pid > 1)))
24890 + return vx_info_kill(vxi, vc_data.pid, vc_data.sig);
24894 +static int __wait_exit(struct vx_info *vxi)
24896 + DECLARE_WAITQUEUE(wait, current);
24899 + add_wait_queue(&vxi->vx_wait, &wait);
24900 + set_current_state(TASK_INTERRUPTIBLE);
24903 + if (vx_info_state(vxi,
24904 + VXS_SHUTDOWN | VXS_HASHED | VXS_HELPER) == VXS_SHUTDOWN)
24906 + if (signal_pending(current)) {
24907 + ret = -ERESTARTSYS;
24914 + set_current_state(TASK_RUNNING);
24915 + remove_wait_queue(&vxi->vx_wait, &wait);
24921 +int vc_wait_exit(struct vx_info *vxi, void __user *data)
24923 + struct vcmd_wait_exit_v0 vc_data;
24926 + ret = __wait_exit(vxi);
24927 + vc_data.reboot_cmd = vxi->reboot_cmd;
24928 + vc_data.exit_code = vxi->exit_code;
24930 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
24935 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/space.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/space.c
24936 --- linux-2.6.35.2/kernel/vserver/space.c 1970-01-01 01:00:00.000000000 +0100
24937 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/space.c 2010-08-02 17:05:06.000000000 +0200
24940 + * linux/kernel/vserver/space.c
24942 + * Virtual Server: Context Space Support
24944 + * Copyright (C) 2003-2007 Herbert Pötzl
24946 + * V0.01 broken out from context.c 0.07
24947 + * V0.02 added task locking for namespace
24948 + * V0.03 broken out vx_enter_namespace
24949 + * V0.04 added *space support and commands
24953 +#include <linux/utsname.h>
24954 +#include <linux/nsproxy.h>
24955 +#include <linux/err.h>
24956 +#include <linux/fs_struct.h>
24957 +#include <asm/uaccess.h>
24959 +#include <linux/vs_context.h>
24960 +#include <linux/vserver/space.h>
24961 +#include <linux/vserver/space_cmd.h>
24963 +atomic_t vs_global_nsproxy = ATOMIC_INIT(0);
24964 +atomic_t vs_global_fs = ATOMIC_INIT(0);
24965 +atomic_t vs_global_mnt_ns = ATOMIC_INIT(0);
24966 +atomic_t vs_global_uts_ns = ATOMIC_INIT(0);
24967 +atomic_t vs_global_user_ns = ATOMIC_INIT(0);
24968 +atomic_t vs_global_pid_ns = ATOMIC_INIT(0);
24971 +/* namespace functions */
24973 +#include <linux/mnt_namespace.h>
24974 +#include <linux/user_namespace.h>
24975 +#include <linux/pid_namespace.h>
24976 +#include <linux/ipc_namespace.h>
24977 +#include <net/net_namespace.h>
24980 +static const struct vcmd_space_mask_v1 space_mask_v0 = {
24981 + .mask = CLONE_FS |
24989 +static const struct vcmd_space_mask_v1 space_mask = {
24990 + .mask = CLONE_FS |
24995 +#ifdef CONFIG_PID_NS
24998 +#ifdef CONFIG_NET_NS
25004 +static const struct vcmd_space_mask_v1 default_space_mask = {
25005 + .mask = CLONE_FS |
25010 +#ifdef CONFIG_PID_NS
25017 + * build a new nsproxy mix
25018 + * assumes that both proxies are 'const'
25019 + * does not touch nsproxy refcounts
25020 + * will hold a reference on the result.
25023 +struct nsproxy *vs_mix_nsproxy(struct nsproxy *old_nsproxy,
25024 + struct nsproxy *new_nsproxy, unsigned long mask)
25026 + struct mnt_namespace *old_ns;
25027 + struct uts_namespace *old_uts;
25028 + struct ipc_namespace *old_ipc;
25029 +#ifdef CONFIG_PID_NS
25030 + struct pid_namespace *old_pid;
25032 +#ifdef CONFIG_NET_NS
25033 + struct net *old_net;
25035 + struct nsproxy *nsproxy;
25037 + nsproxy = copy_nsproxy(old_nsproxy);
25041 + if (mask & CLONE_NEWNS) {
25042 + old_ns = nsproxy->mnt_ns;
25043 + nsproxy->mnt_ns = new_nsproxy->mnt_ns;
25044 + if (nsproxy->mnt_ns)
25045 + get_mnt_ns(nsproxy->mnt_ns);
25049 + if (mask & CLONE_NEWUTS) {
25050 + old_uts = nsproxy->uts_ns;
25051 + nsproxy->uts_ns = new_nsproxy->uts_ns;
25052 + if (nsproxy->uts_ns)
25053 + get_uts_ns(nsproxy->uts_ns);
25057 + if (mask & CLONE_NEWIPC) {
25058 + old_ipc = nsproxy->ipc_ns;
25059 + nsproxy->ipc_ns = new_nsproxy->ipc_ns;
25060 + if (nsproxy->ipc_ns)
25061 + get_ipc_ns(nsproxy->ipc_ns);
25065 +#ifdef CONFIG_PID_NS
25066 + if (mask & CLONE_NEWPID) {
25067 + old_pid = nsproxy->pid_ns;
25068 + nsproxy->pid_ns = new_nsproxy->pid_ns;
25069 + if (nsproxy->pid_ns)
25070 + get_pid_ns(nsproxy->pid_ns);
25074 +#ifdef CONFIG_NET_NS
25075 + if (mask & CLONE_NEWNET) {
25076 + old_net = nsproxy->net_ns;
25077 + nsproxy->net_ns = new_nsproxy->net_ns;
25078 + if (nsproxy->net_ns)
25079 + get_net(nsproxy->net_ns);
25084 + put_mnt_ns(old_ns);
25086 + put_uts_ns(old_uts);
25088 + put_ipc_ns(old_ipc);
25089 +#ifdef CONFIG_PID_NS
25091 + put_pid_ns(old_pid);
25093 +#ifdef CONFIG_NET_NS
25095 + put_net(old_net);
25103 + * merge two nsproxy structs into a new one.
25104 + * will hold a reference on the result.
25108 +struct nsproxy *__vs_merge_nsproxy(struct nsproxy *old,
25109 + struct nsproxy *proxy, unsigned long mask)
25111 + struct nsproxy null_proxy = { .mnt_ns = NULL };
25117 + /* vs_mix_nsproxy returns with reference */
25118 + return vs_mix_nsproxy(old ? old : &null_proxy,
25121 + get_nsproxy(proxy);
25126 +int vx_enter_space(struct vx_info *vxi, unsigned long mask, unsigned index)
25128 + struct nsproxy *proxy, *proxy_cur, *proxy_new;
25129 + struct fs_struct *fs_cur, *fs = NULL;
25130 + int ret, kill = 0;
25132 + vxdprintk(VXD_CBIT(space, 8), "vx_enter_space(%p[#%u],0x%08lx,%d)",
25133 + vxi, vxi->vx_id, mask, index);
25135 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0))
25139 + mask = vxi->vx_nsmask[index];
25141 + if ((mask & vxi->vx_nsmask[index]) != mask)
25144 + if (mask & CLONE_FS) {
25145 + fs = copy_fs_struct(vxi->vx_fs[index]);
25149 + proxy = vxi->vx_nsproxy[index];
25151 + vxdprintk(VXD_CBIT(space, 9),
25152 + "vx_enter_space(%p[#%u],0x%08lx,%d) -> (%p,%p)",
25153 + vxi, vxi->vx_id, mask, index, proxy, fs);
25155 + task_lock(current);
25156 + fs_cur = current->fs;
25158 + if (mask & CLONE_FS) {
25159 + write_lock(&fs_cur->lock);
25160 + current->fs = fs;
25161 + kill = !--fs_cur->users;
25162 + write_unlock(&fs_cur->lock);
25165 + proxy_cur = current->nsproxy;
25166 + get_nsproxy(proxy_cur);
25167 + task_unlock(current);
25170 + free_fs_struct(fs_cur);
25172 + proxy_new = __vs_merge_nsproxy(proxy_cur, proxy, mask);
25173 + if (IS_ERR(proxy_new)) {
25174 + ret = PTR_ERR(proxy_new);
25178 + proxy_new = xchg(¤t->nsproxy, proxy_new);
25182 + put_nsproxy(proxy_new);
25185 + put_nsproxy(proxy_cur);
25190 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index)
25192 + struct nsproxy *proxy_vxi, *proxy_cur, *proxy_new;
25193 + struct fs_struct *fs_vxi, *fs;
25194 + int ret, kill = 0;
25196 + vxdprintk(VXD_CBIT(space, 8), "vx_set_space(%p[#%u],0x%08lx,%d)",
25197 + vxi, vxi->vx_id, mask, index);
25200 + mask = default_space_mask.mask;
25202 + if ((mask & space_mask.mask) != mask)
25205 + proxy_vxi = vxi->vx_nsproxy[index];
25206 + fs_vxi = vxi->vx_fs[index];
25208 + if (mask & CLONE_FS) {
25209 + fs = copy_fs_struct(current->fs);
25214 + task_lock(current);
25216 + if (mask & CLONE_FS) {
25217 + write_lock(&fs_vxi->lock);
25218 + vxi->vx_fs[index] = fs;
25219 + kill = !--fs_vxi->users;
25220 + write_unlock(&fs_vxi->lock);
25223 + proxy_cur = current->nsproxy;
25224 + get_nsproxy(proxy_cur);
25225 + task_unlock(current);
25228 + free_fs_struct(fs_vxi);
25230 + proxy_new = __vs_merge_nsproxy(proxy_vxi, proxy_cur, mask);
25231 + if (IS_ERR(proxy_new)) {
25232 + ret = PTR_ERR(proxy_new);
25236 + proxy_new = xchg(&vxi->vx_nsproxy[index], proxy_new);
25237 + vxi->vx_nsmask[index] |= mask;
25241 + put_nsproxy(proxy_new);
25244 + put_nsproxy(proxy_cur);
25249 +int vc_enter_space_v1(struct vx_info *vxi, void __user *data)
25251 + struct vcmd_space_mask_v1 vc_data = { .mask = 0 };
25253 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25256 + return vx_enter_space(vxi, vc_data.mask, 0);
25259 +int vc_enter_space(struct vx_info *vxi, void __user *data)
25261 + struct vcmd_space_mask_v2 vc_data = { .mask = 0 };
25263 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25266 + if (vc_data.index >= VX_SPACES)
25269 + return vx_enter_space(vxi, vc_data.mask, vc_data.index);
25272 +int vc_set_space_v1(struct vx_info *vxi, void __user *data)
25274 + struct vcmd_space_mask_v1 vc_data = { .mask = 0 };
25276 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25279 + return vx_set_space(vxi, vc_data.mask, 0);
25282 +int vc_set_space(struct vx_info *vxi, void __user *data)
25284 + struct vcmd_space_mask_v2 vc_data = { .mask = 0 };
25286 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25289 + if (vc_data.index >= VX_SPACES)
25292 + return vx_set_space(vxi, vc_data.mask, vc_data.index);
25295 +int vc_get_space_mask(void __user *data, int type)
25297 + const struct vcmd_space_mask_v1 *mask;
25300 + mask = &space_mask_v0;
25301 + else if (type == 1)
25302 + mask = &space_mask;
25304 + mask = &default_space_mask;
25306 + vxdprintk(VXD_CBIT(space, 10),
25307 + "vc_get_space_mask(%d) = %08llx", type, mask->mask);
25309 + if (copy_to_user(data, mask, sizeof(*mask)))
25314 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/switch.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/switch.c
25315 --- linux-2.6.35.2/kernel/vserver/switch.c 1970-01-01 01:00:00.000000000 +0100
25316 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/switch.c 2010-08-02 17:05:06.000000000 +0200
25319 + * linux/kernel/vserver/switch.c
25321 + * Virtual Server: Syscall Switch
25323 + * Copyright (C) 2003-2007 Herbert Pötzl
25325 + * V0.01 syscall switch
25326 + * V0.02 added signal to context
25327 + * V0.03 added rlimit functions
25328 + * V0.04 added iattr, task/xid functions
25329 + * V0.05 added debug/history stuff
25330 + * V0.06 added compat32 layer
25331 + * V0.07 vcmd args and perms
25332 + * V0.08 added status commands
25333 + * V0.09 added tag commands
25334 + * V0.10 added oom bias
25335 + * V0.11 added device commands
25339 +#include <linux/vs_context.h>
25340 +#include <linux/vs_network.h>
25341 +#include <linux/vserver/switch.h>
25343 +#include "vci_config.h"
25347 +int vc_get_version(uint32_t id)
25349 + return VCI_VERSION;
25353 +int vc_get_vci(uint32_t id)
25355 + return vci_kernel_config();
25358 +#include <linux/vserver/context_cmd.h>
25359 +#include <linux/vserver/cvirt_cmd.h>
25360 +#include <linux/vserver/cacct_cmd.h>
25361 +#include <linux/vserver/limit_cmd.h>
25362 +#include <linux/vserver/network_cmd.h>
25363 +#include <linux/vserver/sched_cmd.h>
25364 +#include <linux/vserver/debug_cmd.h>
25365 +#include <linux/vserver/inode_cmd.h>
25366 +#include <linux/vserver/dlimit_cmd.h>
25367 +#include <linux/vserver/signal_cmd.h>
25368 +#include <linux/vserver/space_cmd.h>
25369 +#include <linux/vserver/tag_cmd.h>
25370 +#include <linux/vserver/device_cmd.h>
25372 +#include <linux/vserver/inode.h>
25373 +#include <linux/vserver/dlimit.h>
25376 +#ifdef CONFIG_COMPAT
25377 +#define __COMPAT(name, id, data, compat) \
25378 + (compat) ? name ## _x32(id, data) : name(id, data)
25379 +#define __COMPAT_NO_ID(name, data, compat) \
25380 + (compat) ? name ## _x32(data) : name(data)
25382 +#define __COMPAT(name, id, data, compat) \
25384 +#define __COMPAT_NO_ID(name, data, compat) \
25390 +long do_vcmd(uint32_t cmd, uint32_t id,
25391 + struct vx_info *vxi, struct nx_info *nxi,
25392 + void __user *data, int compat)
25396 + case VCMD_get_version:
25397 + return vc_get_version(id);
25398 + case VCMD_get_vci:
25399 + return vc_get_vci(id);
25401 + case VCMD_task_xid:
25402 + return vc_task_xid(id);
25403 + case VCMD_vx_info:
25404 + return vc_vx_info(vxi, data);
25406 + case VCMD_task_nid:
25407 + return vc_task_nid(id);
25408 + case VCMD_nx_info:
25409 + return vc_nx_info(nxi, data);
25411 + case VCMD_task_tag:
25412 + return vc_task_tag(id);
25414 + case VCMD_set_space_v1:
25415 + return vc_set_space_v1(vxi, data);
25416 + /* this is version 2 */
25417 + case VCMD_set_space:
25418 + return vc_set_space(vxi, data);
25420 + case VCMD_get_space_mask_v0:
25421 + return vc_get_space_mask(data, 0);
25422 + /* this is version 1 */
25423 + case VCMD_get_space_mask:
25424 + return vc_get_space_mask(data, 1);
25426 + case VCMD_get_space_default:
25427 + return vc_get_space_mask(data, -1);
25429 +#ifdef CONFIG_IA32_EMULATION
25430 + case VCMD_get_rlimit:
25431 + return __COMPAT(vc_get_rlimit, vxi, data, compat);
25432 + case VCMD_set_rlimit:
25433 + return __COMPAT(vc_set_rlimit, vxi, data, compat);
25435 + case VCMD_get_rlimit:
25436 + return vc_get_rlimit(vxi, data);
25437 + case VCMD_set_rlimit:
25438 + return vc_set_rlimit(vxi, data);
25440 + case VCMD_get_rlimit_mask:
25441 + return vc_get_rlimit_mask(id, data);
25442 + case VCMD_reset_hits:
25443 + return vc_reset_hits(vxi, data);
25444 + case VCMD_reset_minmax:
25445 + return vc_reset_minmax(vxi, data);
25447 + case VCMD_get_vhi_name:
25448 + return vc_get_vhi_name(vxi, data);
25449 + case VCMD_set_vhi_name:
25450 + return vc_set_vhi_name(vxi, data);
25452 + case VCMD_ctx_stat:
25453 + return vc_ctx_stat(vxi, data);
25454 + case VCMD_virt_stat:
25455 + return vc_virt_stat(vxi, data);
25456 + case VCMD_sock_stat:
25457 + return vc_sock_stat(vxi, data);
25458 + case VCMD_rlimit_stat:
25459 + return vc_rlimit_stat(vxi, data);
25461 + case VCMD_set_cflags:
25462 + return vc_set_cflags(vxi, data);
25463 + case VCMD_get_cflags:
25464 + return vc_get_cflags(vxi, data);
25466 + /* this is version 1 */
25467 + case VCMD_set_ccaps:
25468 + return vc_set_ccaps(vxi, data);
25469 + /* this is version 1 */
25470 + case VCMD_get_ccaps:
25471 + return vc_get_ccaps(vxi, data);
25472 + case VCMD_set_bcaps:
25473 + return vc_set_bcaps(vxi, data);
25474 + case VCMD_get_bcaps:
25475 + return vc_get_bcaps(vxi, data);
25477 + case VCMD_set_badness:
25478 + return vc_set_badness(vxi, data);
25479 + case VCMD_get_badness:
25480 + return vc_get_badness(vxi, data);
25482 + case VCMD_set_nflags:
25483 + return vc_set_nflags(nxi, data);
25484 + case VCMD_get_nflags:
25485 + return vc_get_nflags(nxi, data);
25487 + case VCMD_set_ncaps:
25488 + return vc_set_ncaps(nxi, data);
25489 + case VCMD_get_ncaps:
25490 + return vc_get_ncaps(nxi, data);
25492 + case VCMD_set_sched_v4:
25493 + return vc_set_sched_v4(vxi, data);
25494 + /* this is version 5 */
25495 + case VCMD_set_sched:
25496 + return vc_set_sched(vxi, data);
25497 + case VCMD_get_sched:
25498 + return vc_get_sched(vxi, data);
25499 + case VCMD_sched_info:
25500 + return vc_sched_info(vxi, data);
25502 + case VCMD_add_dlimit:
25503 + return __COMPAT(vc_add_dlimit, id, data, compat);
25504 + case VCMD_rem_dlimit:
25505 + return __COMPAT(vc_rem_dlimit, id, data, compat);
25506 + case VCMD_set_dlimit:
25507 + return __COMPAT(vc_set_dlimit, id, data, compat);
25508 + case VCMD_get_dlimit:
25509 + return __COMPAT(vc_get_dlimit, id, data, compat);
25511 + case VCMD_ctx_kill:
25512 + return vc_ctx_kill(vxi, data);
25514 + case VCMD_wait_exit:
25515 + return vc_wait_exit(vxi, data);
25517 + case VCMD_get_iattr:
25518 + return __COMPAT_NO_ID(vc_get_iattr, data, compat);
25519 + case VCMD_set_iattr:
25520 + return __COMPAT_NO_ID(vc_set_iattr, data, compat);
25522 + case VCMD_fget_iattr:
25523 + return vc_fget_iattr(id, data);
25524 + case VCMD_fset_iattr:
25525 + return vc_fset_iattr(id, data);
25527 + case VCMD_enter_space_v0:
25528 + return vc_enter_space_v1(vxi, NULL);
25529 + case VCMD_enter_space_v1:
25530 + return vc_enter_space_v1(vxi, data);
25531 + /* this is version 2 */
25532 + case VCMD_enter_space:
25533 + return vc_enter_space(vxi, data);
25535 + case VCMD_ctx_create_v0:
25536 + return vc_ctx_create(id, NULL);
25537 + case VCMD_ctx_create:
25538 + return vc_ctx_create(id, data);
25539 + case VCMD_ctx_migrate_v0:
25540 + return vc_ctx_migrate(vxi, NULL);
25541 + case VCMD_ctx_migrate:
25542 + return vc_ctx_migrate(vxi, data);
25544 + case VCMD_net_create_v0:
25545 + return vc_net_create(id, NULL);
25546 + case VCMD_net_create:
25547 + return vc_net_create(id, data);
25548 + case VCMD_net_migrate:
25549 + return vc_net_migrate(nxi, data);
25551 + case VCMD_tag_migrate:
25552 + return vc_tag_migrate(id);
25554 + case VCMD_net_add:
25555 + return vc_net_add(nxi, data);
25556 + case VCMD_net_remove:
25557 + return vc_net_remove(nxi, data);
25559 + case VCMD_net_add_ipv4:
25560 + return vc_net_add_ipv4(nxi, data);
25561 + case VCMD_net_remove_ipv4:
25562 + return vc_net_remove_ipv4(nxi, data);
25563 +#ifdef CONFIG_IPV6
25564 + case VCMD_net_add_ipv6:
25565 + return vc_net_add_ipv6(nxi, data);
25566 + case VCMD_net_remove_ipv6:
25567 + return vc_net_remove_ipv6(nxi, data);
25569 +/* case VCMD_add_match_ipv4:
25570 + return vc_add_match_ipv4(nxi, data);
25571 + case VCMD_get_match_ipv4:
25572 + return vc_get_match_ipv4(nxi, data);
25573 +#ifdef CONFIG_IPV6
25574 + case VCMD_add_match_ipv6:
25575 + return vc_add_match_ipv6(nxi, data);
25576 + case VCMD_get_match_ipv6:
25577 + return vc_get_match_ipv6(nxi, data);
25580 +#ifdef CONFIG_VSERVER_DEVICE
25581 + case VCMD_set_mapping:
25582 + return __COMPAT(vc_set_mapping, vxi, data, compat);
25583 + case VCMD_unset_mapping:
25584 + return __COMPAT(vc_unset_mapping, vxi, data, compat);
25586 +#ifdef CONFIG_VSERVER_HISTORY
25587 + case VCMD_dump_history:
25588 + return vc_dump_history(id);
25589 + case VCMD_read_history:
25590 + return __COMPAT(vc_read_history, id, data, compat);
25592 +#ifdef CONFIG_VSERVER_MONITOR
25593 + case VCMD_read_monitor:
25594 + return __COMPAT(vc_read_monitor, id, data, compat);
25597 + vxwprintk_task(1, "unimplemented VCMD_%02d_%d[%d]",
25598 + VC_CATEGORY(cmd), VC_COMMAND(cmd), VC_VERSION(cmd));
25604 +#define __VCMD(vcmd, _perm, _args, _flags) \
25605 + case VCMD_ ## vcmd: perm = _perm; \
25606 + args = _args; flags = _flags; break
25609 +#define VCA_NONE 0x00
25610 +#define VCA_VXI 0x01
25611 +#define VCA_NXI 0x02
25613 +#define VCF_NONE 0x00
25614 +#define VCF_INFO 0x01
25615 +#define VCF_ADMIN 0x02
25616 +#define VCF_ARES 0x06 /* includes admin */
25617 +#define VCF_SETUP 0x08
25619 +#define VCF_ZIDOK 0x10 /* zero id okay */
25623 +long do_vserver(uint32_t cmd, uint32_t id, void __user *data, int compat)
25626 + int permit = -1, state = 0;
25627 + int perm = -1, args = 0, flags = 0;
25628 + struct vx_info *vxi = NULL;
25629 + struct nx_info *nxi = NULL;
25632 + /* unpriviledged commands */
25633 + __VCMD(get_version, 0, VCA_NONE, 0);
25634 + __VCMD(get_vci, 0, VCA_NONE, 0);
25635 + __VCMD(get_rlimit_mask, 0, VCA_NONE, 0);
25636 + __VCMD(get_space_mask_v0,0, VCA_NONE, 0);
25637 + __VCMD(get_space_mask, 0, VCA_NONE, 0);
25638 + __VCMD(get_space_default,0, VCA_NONE, 0);
25640 + /* info commands */
25641 + __VCMD(task_xid, 2, VCA_NONE, 0);
25642 + __VCMD(reset_hits, 2, VCA_VXI, 0);
25643 + __VCMD(reset_minmax, 2, VCA_VXI, 0);
25644 + __VCMD(vx_info, 3, VCA_VXI, VCF_INFO);
25645 + __VCMD(get_bcaps, 3, VCA_VXI, VCF_INFO);
25646 + __VCMD(get_ccaps, 3, VCA_VXI, VCF_INFO);
25647 + __VCMD(get_cflags, 3, VCA_VXI, VCF_INFO);
25648 + __VCMD(get_badness, 3, VCA_VXI, VCF_INFO);
25649 + __VCMD(get_vhi_name, 3, VCA_VXI, VCF_INFO);
25650 + __VCMD(get_rlimit, 3, VCA_VXI, VCF_INFO);
25652 + __VCMD(ctx_stat, 3, VCA_VXI, VCF_INFO);
25653 + __VCMD(virt_stat, 3, VCA_VXI, VCF_INFO);
25654 + __VCMD(sock_stat, 3, VCA_VXI, VCF_INFO);
25655 + __VCMD(rlimit_stat, 3, VCA_VXI, VCF_INFO);
25657 + __VCMD(task_nid, 2, VCA_NONE, 0);
25658 + __VCMD(nx_info, 3, VCA_NXI, VCF_INFO);
25659 + __VCMD(get_ncaps, 3, VCA_NXI, VCF_INFO);
25660 + __VCMD(get_nflags, 3, VCA_NXI, VCF_INFO);
25662 + __VCMD(task_tag, 2, VCA_NONE, 0);
25664 + __VCMD(get_iattr, 2, VCA_NONE, 0);
25665 + __VCMD(fget_iattr, 2, VCA_NONE, 0);
25666 + __VCMD(get_dlimit, 3, VCA_NONE, VCF_INFO);
25667 + __VCMD(get_sched, 3, VCA_VXI, VCF_INFO);
25668 + __VCMD(sched_info, 3, VCA_VXI, VCF_INFO | VCF_ZIDOK);
25670 + /* lower admin commands */
25671 + __VCMD(wait_exit, 4, VCA_VXI, VCF_INFO);
25672 + __VCMD(ctx_create_v0, 5, VCA_NONE, 0);
25673 + __VCMD(ctx_create, 5, VCA_NONE, 0);
25674 + __VCMD(ctx_migrate_v0, 5, VCA_VXI, VCF_ADMIN);
25675 + __VCMD(ctx_migrate, 5, VCA_VXI, VCF_ADMIN);
25676 + __VCMD(enter_space_v0, 5, VCA_VXI, VCF_ADMIN);
25677 + __VCMD(enter_space_v1, 5, VCA_VXI, VCF_ADMIN);
25678 + __VCMD(enter_space, 5, VCA_VXI, VCF_ADMIN);
25680 + __VCMD(net_create_v0, 5, VCA_NONE, 0);
25681 + __VCMD(net_create, 5, VCA_NONE, 0);
25682 + __VCMD(net_migrate, 5, VCA_NXI, VCF_ADMIN);
25684 + __VCMD(tag_migrate, 5, VCA_NONE, VCF_ADMIN);
25686 + /* higher admin commands */
25687 + __VCMD(ctx_kill, 6, VCA_VXI, VCF_ARES);
25688 + __VCMD(set_space_v1, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25689 + __VCMD(set_space, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25691 + __VCMD(set_ccaps, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25692 + __VCMD(set_bcaps, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25693 + __VCMD(set_cflags, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25694 + __VCMD(set_badness, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25696 + __VCMD(set_vhi_name, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25697 + __VCMD(set_rlimit, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25698 + __VCMD(set_sched, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25699 + __VCMD(set_sched_v4, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25701 + __VCMD(set_ncaps, 7, VCA_NXI, VCF_ARES | VCF_SETUP);
25702 + __VCMD(set_nflags, 7, VCA_NXI, VCF_ARES | VCF_SETUP);
25703 + __VCMD(net_add, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25704 + __VCMD(net_remove, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25705 + __VCMD(net_add_ipv4, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25706 + __VCMD(net_remove_ipv4, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25707 +#ifdef CONFIG_IPV6
25708 + __VCMD(net_add_ipv6, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25709 + __VCMD(net_remove_ipv6, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25711 + __VCMD(set_iattr, 7, VCA_NONE, 0);
25712 + __VCMD(fset_iattr, 7, VCA_NONE, 0);
25713 + __VCMD(set_dlimit, 7, VCA_NONE, VCF_ARES);
25714 + __VCMD(add_dlimit, 8, VCA_NONE, VCF_ARES);
25715 + __VCMD(rem_dlimit, 8, VCA_NONE, VCF_ARES);
25717 +#ifdef CONFIG_VSERVER_DEVICE
25718 + __VCMD(set_mapping, 8, VCA_VXI, VCF_ARES|VCF_ZIDOK);
25719 + __VCMD(unset_mapping, 8, VCA_VXI, VCF_ARES|VCF_ZIDOK);
25721 + /* debug level admin commands */
25722 +#ifdef CONFIG_VSERVER_HISTORY
25723 + __VCMD(dump_history, 9, VCA_NONE, 0);
25724 + __VCMD(read_history, 9, VCA_NONE, 0);
25726 +#ifdef CONFIG_VSERVER_MONITOR
25727 + __VCMD(read_monitor, 9, VCA_NONE, 0);
25734 + vxdprintk(VXD_CBIT(switch, 0),
25735 + "vc: VCMD_%02d_%d[%d], %d,%p [%d,%d,%x,%x]",
25736 + VC_CATEGORY(cmd), VC_COMMAND(cmd),
25737 + VC_VERSION(cmd), id, data, compat,
25738 + perm, args, flags);
25745 + if (!capable(CAP_CONTEXT))
25749 + /* moved here from the individual commands */
25751 + if ((perm > 1) && !capable(CAP_SYS_ADMIN))
25755 + /* vcmd involves resource management */
25757 + if ((flags & VCF_ARES) && !capable(CAP_SYS_RESOURCE))
25761 + /* various legacy exceptions */
25763 + /* will go away when spectator is a cap */
25764 + case VCMD_ctx_migrate_v0:
25765 + case VCMD_ctx_migrate:
25767 + current->xid = 1;
25773 + /* will go away when spectator is a cap */
25774 + case VCMD_net_migrate:
25776 + current->nid = 1;
25783 + /* vcmds are fine by default */
25786 + /* admin type vcmds require admin ... */
25787 + if (flags & VCF_ADMIN)
25788 + permit = vx_check(0, VS_ADMIN) ? 1 : 0;
25790 + /* ... but setup type vcmds override that */
25791 + if (!permit && (flags & VCF_SETUP))
25792 + permit = vx_flags(VXF_STATE_SETUP, 0) ? 2 : 0;
25800 + if (!id && (flags & VCF_ZIDOK))
25804 + if (args & VCA_VXI) {
25805 + vxi = lookup_vx_info(id);
25809 + if ((flags & VCF_ADMIN) &&
25810 + /* special case kill for shutdown */
25811 + (cmd != VCMD_ctx_kill) &&
25812 + /* can context be administrated? */
25813 + !vx_info_flags(vxi, VXF_STATE_ADMIN, 0)) {
25819 + if (args & VCA_NXI) {
25820 + nxi = lookup_nx_info(id);
25824 + if ((flags & VCF_ADMIN) &&
25825 + /* can context be administrated? */
25826 + !nx_info_flags(nxi, NXF_STATE_ADMIN, 0)) {
25833 + ret = do_vcmd(cmd, id, vxi, nxi, data, compat);
25836 + if ((args & VCA_NXI) && nxi)
25837 + put_nx_info(nxi);
25839 + if ((args & VCA_VXI) && vxi)
25840 + put_vx_info(vxi);
25842 + vxdprintk(VXD_CBIT(switch, 1),
25843 + "vc: VCMD_%02d_%d[%d] = %08lx(%ld) [%d,%d]",
25844 + VC_CATEGORY(cmd), VC_COMMAND(cmd),
25845 + VC_VERSION(cmd), ret, ret, state, permit);
25850 +sys_vserver(uint32_t cmd, uint32_t id, void __user *data)
25852 + return do_vserver(cmd, id, data, 0);
25855 +#ifdef CONFIG_COMPAT
25858 +sys32_vserver(uint32_t cmd, uint32_t id, void __user *data)
25860 + return do_vserver(cmd, id, data, 1);
25863 +#endif /* CONFIG_COMPAT */
25864 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/sysctl.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/sysctl.c
25865 --- linux-2.6.35.2/kernel/vserver/sysctl.c 1970-01-01 01:00:00.000000000 +0100
25866 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/sysctl.c 2010-08-02 17:05:06.000000000 +0200
25869 + * kernel/vserver/sysctl.c
25871 + * Virtual Context Support
25873 + * Copyright (C) 2004-2007 Herbert Pötzl
25875 + * V0.01 basic structure
25879 +#include <linux/module.h>
25880 +#include <linux/ctype.h>
25881 +#include <linux/sysctl.h>
25882 +#include <linux/parser.h>
25883 +#include <asm/uaccess.h>
25886 + CTL_DEBUG_ERROR = 0,
25887 + CTL_DEBUG_SWITCH = 1,
25902 +unsigned int vx_debug_switch = 0;
25903 +unsigned int vx_debug_xid = 0;
25904 +unsigned int vx_debug_nid = 0;
25905 +unsigned int vx_debug_tag = 0;
25906 +unsigned int vx_debug_net = 0;
25907 +unsigned int vx_debug_limit = 0;
25908 +unsigned int vx_debug_cres = 0;
25909 +unsigned int vx_debug_dlim = 0;
25910 +unsigned int vx_debug_quota = 0;
25911 +unsigned int vx_debug_cvirt = 0;
25912 +unsigned int vx_debug_space = 0;
25913 +unsigned int vx_debug_misc = 0;
25916 +static struct ctl_table_header *vserver_table_header;
25917 +static ctl_table vserver_root_table[];
25920 +void vserver_register_sysctl(void)
25922 + if (!vserver_table_header) {
25923 + vserver_table_header = register_sysctl_table(vserver_root_table);
25928 +void vserver_unregister_sysctl(void)
25930 + if (vserver_table_header) {
25931 + unregister_sysctl_table(vserver_table_header);
25932 + vserver_table_header = NULL;
25937 +static int proc_dodebug(ctl_table *table, int write,
25938 + void __user *buffer, size_t *lenp, loff_t *ppos)
25940 + char tmpbuf[20], *p, c;
25941 + unsigned int value;
25942 + size_t left, len;
25944 + if ((*ppos && !write) || !*lenp) {
25952 + if (!access_ok(VERIFY_READ, buffer, left))
25954 + p = (char *)buffer;
25955 + while (left && __get_user(c, p) >= 0 && isspace(c))
25960 + if (left > sizeof(tmpbuf) - 1)
25962 + if (copy_from_user(tmpbuf, p, left))
25964 + tmpbuf[left] = '\0';
25966 + for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
25967 + value = 10 * value + (*p - '0');
25968 + if (*p && !isspace(*p))
25970 + while (left && isspace(*p))
25972 + *(unsigned int *)table->data = value;
25974 + if (!access_ok(VERIFY_WRITE, buffer, left))
25976 + len = sprintf(tmpbuf, "%d", *(unsigned int *)table->data);
25979 + if (__copy_to_user(buffer, tmpbuf, len))
25981 + if ((left -= len) > 0) {
25982 + if (put_user('\n', (char *)buffer + len))
25996 +#define CTL_ENTRY(ctl, name) \
25998 + .procname = #name, \
25999 + .data = &vx_ ## name, \
26000 + .maxlen = sizeof(int), \
26002 + .proc_handler = &proc_dodebug, \
26003 + .extra1 = &zero, \
26004 + .extra2 = &zero, \
26007 +static ctl_table vserver_debug_table[] = {
26008 + CTL_ENTRY(CTL_DEBUG_SWITCH, debug_switch),
26009 + CTL_ENTRY(CTL_DEBUG_XID, debug_xid),
26010 + CTL_ENTRY(CTL_DEBUG_NID, debug_nid),
26011 + CTL_ENTRY(CTL_DEBUG_TAG, debug_tag),
26012 + CTL_ENTRY(CTL_DEBUG_NET, debug_net),
26013 + CTL_ENTRY(CTL_DEBUG_LIMIT, debug_limit),
26014 + CTL_ENTRY(CTL_DEBUG_CRES, debug_cres),
26015 + CTL_ENTRY(CTL_DEBUG_DLIM, debug_dlim),
26016 + CTL_ENTRY(CTL_DEBUG_QUOTA, debug_quota),
26017 + CTL_ENTRY(CTL_DEBUG_CVIRT, debug_cvirt),
26018 + CTL_ENTRY(CTL_DEBUG_SPACE, debug_space),
26019 + CTL_ENTRY(CTL_DEBUG_MISC, debug_misc),
26023 +static ctl_table vserver_root_table[] = {
26025 + .procname = "vserver",
26027 + .child = vserver_debug_table
26033 +static match_table_t tokens = {
26034 + { CTL_DEBUG_SWITCH, "switch=%x" },
26035 + { CTL_DEBUG_XID, "xid=%x" },
26036 + { CTL_DEBUG_NID, "nid=%x" },
26037 + { CTL_DEBUG_TAG, "tag=%x" },
26038 + { CTL_DEBUG_NET, "net=%x" },
26039 + { CTL_DEBUG_LIMIT, "limit=%x" },
26040 + { CTL_DEBUG_CRES, "cres=%x" },
26041 + { CTL_DEBUG_DLIM, "dlim=%x" },
26042 + { CTL_DEBUG_QUOTA, "quota=%x" },
26043 + { CTL_DEBUG_CVIRT, "cvirt=%x" },
26044 + { CTL_DEBUG_SPACE, "space=%x" },
26045 + { CTL_DEBUG_MISC, "misc=%x" },
26046 + { CTL_DEBUG_ERROR, NULL }
26049 +#define HANDLE_CASE(id, name, val) \
26050 + case CTL_DEBUG_ ## id: \
26051 + vx_debug_ ## name = val; \
26052 + printk("vs_debug_" #name "=0x%x\n", val); \
26056 +static int __init vs_debug_setup(char *str)
26061 + printk("vs_debug_setup(%s)\n", str);
26062 + while ((p = strsep(&str, ",")) != NULL) {
26063 + substring_t args[MAX_OPT_ARGS];
26064 + unsigned int value;
26069 + token = match_token(p, tokens, args);
26070 + value = (token > 0) ? simple_strtoul(args[0].from, NULL, 0) : 0;
26073 + HANDLE_CASE(SWITCH, switch, value);
26074 + HANDLE_CASE(XID, xid, value);
26075 + HANDLE_CASE(NID, nid, value);
26076 + HANDLE_CASE(TAG, tag, value);
26077 + HANDLE_CASE(NET, net, value);
26078 + HANDLE_CASE(LIMIT, limit, value);
26079 + HANDLE_CASE(CRES, cres, value);
26080 + HANDLE_CASE(DLIM, dlim, value);
26081 + HANDLE_CASE(QUOTA, quota, value);
26082 + HANDLE_CASE(CVIRT, cvirt, value);
26083 + HANDLE_CASE(SPACE, space, value);
26084 + HANDLE_CASE(MISC, misc, value);
26093 +__setup("vsdebug=", vs_debug_setup);
26097 +EXPORT_SYMBOL_GPL(vx_debug_switch);
26098 +EXPORT_SYMBOL_GPL(vx_debug_xid);
26099 +EXPORT_SYMBOL_GPL(vx_debug_nid);
26100 +EXPORT_SYMBOL_GPL(vx_debug_net);
26101 +EXPORT_SYMBOL_GPL(vx_debug_limit);
26102 +EXPORT_SYMBOL_GPL(vx_debug_cres);
26103 +EXPORT_SYMBOL_GPL(vx_debug_dlim);
26104 +EXPORT_SYMBOL_GPL(vx_debug_quota);
26105 +EXPORT_SYMBOL_GPL(vx_debug_cvirt);
26106 +EXPORT_SYMBOL_GPL(vx_debug_space);
26107 +EXPORT_SYMBOL_GPL(vx_debug_misc);
26109 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/tag.c linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/tag.c
26110 --- linux-2.6.35.2/kernel/vserver/tag.c 1970-01-01 01:00:00.000000000 +0100
26111 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/tag.c 2010-08-02 17:05:06.000000000 +0200
26114 + * linux/kernel/vserver/tag.c
26116 + * Virtual Server: Shallow Tag Space
26118 + * Copyright (C) 2007 Herbert Pötzl
26120 + * V0.01 basic implementation
26124 +#include <linux/sched.h>
26125 +#include <linux/vserver/debug.h>
26126 +#include <linux/vs_pid.h>
26127 +#include <linux/vs_tag.h>
26129 +#include <linux/vserver/tag_cmd.h>
26132 +int dx_migrate_task(struct task_struct *p, tag_t tag)
26137 + vxdprintk(VXD_CBIT(tag, 5),
26138 + "dx_migrate_task(%p[#%d],#%d)", p, p->tag, tag);
26144 + vxdprintk(VXD_CBIT(tag, 5),
26145 + "moved task %p into [#%d]", p, tag);
26149 +/* vserver syscall commands below here */
26151 +/* taks xid and vx_info functions */
26154 +int vc_task_tag(uint32_t id)
26159 + struct task_struct *tsk;
26160 + read_lock(&tasklist_lock);
26161 + tsk = find_task_by_real_pid(id);
26162 + tag = (tsk) ? tsk->tag : -ESRCH;
26163 + read_unlock(&tasklist_lock);
26165 + tag = dx_current_tag();
26170 +int vc_tag_migrate(uint32_t tag)
26172 + return dx_migrate_task(current, tag & 0xFFFF);
26176 diff -NurpP --minimal linux-2.6.35.2/kernel/vserver/vci_config.h linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/vci_config.h
26177 --- linux-2.6.35.2/kernel/vserver/vci_config.h 1970-01-01 01:00:00.000000000 +0100
26178 +++ linux-2.6.35.2-vs2.3.0.36.31/kernel/vserver/vci_config.h 2010-08-02 17:05:06.000000000 +0200
26181 +/* interface version */
26183 +#define VCI_VERSION 0x00020306
26187 + VCI_KCBIT_NO_DYNAMIC = 0,
26189 + VCI_KCBIT_PROC_SECURE = 4,
26190 + VCI_KCBIT_HARDCPU = 5,
26191 + VCI_KCBIT_IDLELIMIT = 6,
26192 + VCI_KCBIT_IDLETIME = 7,
26194 + VCI_KCBIT_COWBL = 8,
26195 + VCI_KCBIT_FULLCOWBL = 9,
26196 + VCI_KCBIT_SPACES = 10,
26197 + VCI_KCBIT_NETV2 = 11,
26198 + VCI_KCBIT_MEMCG = 12,
26200 + VCI_KCBIT_DEBUG = 16,
26201 + VCI_KCBIT_HISTORY = 20,
26202 + VCI_KCBIT_TAGGED = 24,
26203 + VCI_KCBIT_PPTAG = 28,
26205 + VCI_KCBIT_MORE = 31,
26209 +static inline uint32_t vci_kernel_config(void)
26212 + (1 << VCI_KCBIT_NO_DYNAMIC) |
26214 + /* configured features */
26215 +#ifdef CONFIG_VSERVER_PROC_SECURE
26216 + (1 << VCI_KCBIT_PROC_SECURE) |
26218 +#ifdef CONFIG_VSERVER_HARDCPU
26219 + (1 << VCI_KCBIT_HARDCPU) |
26221 +#ifdef CONFIG_VSERVER_IDLELIMIT
26222 + (1 << VCI_KCBIT_IDLELIMIT) |
26224 +#ifdef CONFIG_VSERVER_IDLETIME
26225 + (1 << VCI_KCBIT_IDLETIME) |
26227 +#ifdef CONFIG_VSERVER_COWBL
26228 + (1 << VCI_KCBIT_COWBL) |
26229 + (1 << VCI_KCBIT_FULLCOWBL) |
26231 + (1 << VCI_KCBIT_SPACES) |
26232 + (1 << VCI_KCBIT_NETV2) |
26233 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
26234 + (1 << VCI_KCBIT_MEMCG) |
26237 + /* debug options */
26238 +#ifdef CONFIG_VSERVER_DEBUG
26239 + (1 << VCI_KCBIT_DEBUG) |
26241 +#ifdef CONFIG_VSERVER_HISTORY
26242 + (1 << VCI_KCBIT_HISTORY) |
26245 + /* inode context tagging */
26246 +#if defined(CONFIG_TAGGING_NONE)
26247 + (0 << VCI_KCBIT_TAGGED) |
26248 +#elif defined(CONFIG_TAGGING_UID16)
26249 + (1 << VCI_KCBIT_TAGGED) |
26250 +#elif defined(CONFIG_TAGGING_GID16)
26251 + (2 << VCI_KCBIT_TAGGED) |
26252 +#elif defined(CONFIG_TAGGING_ID24)
26253 + (3 << VCI_KCBIT_TAGGED) |
26254 +#elif defined(CONFIG_TAGGING_INTERN)
26255 + (4 << VCI_KCBIT_TAGGED) |
26256 +#elif defined(CONFIG_TAGGING_RUNTIME)
26257 + (5 << VCI_KCBIT_TAGGED) |
26259 + (7 << VCI_KCBIT_TAGGED) |
26261 + (1 << VCI_KCBIT_PPTAG) |
26265 diff -NurpP --minimal linux-2.6.35.2/mm/filemap_xip.c linux-2.6.35.2-vs2.3.0.36.31/mm/filemap_xip.c
26266 --- linux-2.6.35.2/mm/filemap_xip.c 2010-07-07 18:31:58.000000000 +0200
26267 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/filemap_xip.c 2010-08-02 17:05:06.000000000 +0200
26269 #include <linux/seqlock.h>
26270 #include <linux/mutex.h>
26271 #include <linux/gfp.h>
26272 +#include <linux/vs_memory.h>
26273 #include <asm/tlbflush.h>
26274 #include <asm/io.h>
26276 diff -NurpP --minimal linux-2.6.35.2/mm/fremap.c linux-2.6.35.2-vs2.3.0.36.31/mm/fremap.c
26277 --- linux-2.6.35.2/mm/fremap.c 2010-07-07 18:31:58.000000000 +0200
26278 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/fremap.c 2010-08-02 17:05:06.000000000 +0200
26280 #include <linux/module.h>
26281 #include <linux/syscalls.h>
26282 #include <linux/mmu_notifier.h>
26283 +#include <linux/vs_memory.h>
26285 #include <asm/mmu_context.h>
26286 #include <asm/cacheflush.h>
26287 diff -NurpP --minimal linux-2.6.35.2/mm/hugetlb.c linux-2.6.35.2-vs2.3.0.36.31/mm/hugetlb.c
26288 --- linux-2.6.35.2/mm/hugetlb.c 2010-08-02 16:52:58.000000000 +0200
26289 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/hugetlb.c 2010-08-02 17:05:06.000000000 +0200
26292 #include <linux/hugetlb.h>
26293 #include <linux/node.h>
26294 +#include <linux/vs_memory.h>
26295 #include "internal.h"
26297 const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
26298 diff -NurpP --minimal linux-2.6.35.2/mm/memcontrol.c linux-2.6.35.2-vs2.3.0.36.31/mm/memcontrol.c
26299 --- linux-2.6.35.2/mm/memcontrol.c 2010-08-02 16:52:58.000000000 +0200
26300 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/memcontrol.c 2010-08-02 17:05:06.000000000 +0200
26301 @@ -635,6 +635,31 @@ struct mem_cgroup *mem_cgroup_from_task(
26302 struct mem_cgroup, css);
26305 +u64 mem_cgroup_res_read_u64(struct mem_cgroup *mem, int member)
26307 + return res_counter_read_u64(&mem->res, member);
26310 +u64 mem_cgroup_memsw_read_u64(struct mem_cgroup *mem, int member)
26312 + return res_counter_read_u64(&mem->memsw, member);
26315 +s64 mem_cgroup_stat_read_cache(struct mem_cgroup *mem)
26317 + return mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_CACHE);
26320 +s64 mem_cgroup_stat_read_anon(struct mem_cgroup *mem)
26322 + return mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_RSS);
26325 +s64 mem_cgroup_stat_read_mapped(struct mem_cgroup *mem)
26327 + return mem_cgroup_read_stat(mem, MEM_CGROUP_STAT_FILE_MAPPED);
26330 static struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
26332 struct mem_cgroup *mem = NULL;
26333 diff -NurpP --minimal linux-2.6.35.2/mm/memory.c linux-2.6.35.2-vs2.3.0.36.31/mm/memory.c
26334 --- linux-2.6.35.2/mm/memory.c 2010-08-14 18:16:59.000000000 +0200
26335 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/memory.c 2010-08-14 18:19:32.000000000 +0200
26336 @@ -3101,6 +3101,7 @@ static inline int handle_pte_fault(struc
26340 + int ret = 0, type = VXPT_UNKNOWN;
26343 if (!pte_present(entry)) {
26344 @@ -3125,9 +3126,12 @@ static inline int handle_pte_fault(struc
26345 if (unlikely(!pte_same(*pte, entry)))
26347 if (flags & FAULT_FLAG_WRITE) {
26348 - if (!pte_write(entry))
26349 - return do_wp_page(mm, vma, address,
26350 + if (!pte_write(entry)) {
26351 + ret = do_wp_page(mm, vma, address,
26352 pte, pmd, ptl, entry);
26353 + type = VXPT_WRITE;
26356 entry = pte_mkdirty(entry);
26358 entry = pte_mkyoung(entry);
26359 @@ -3145,7 +3149,10 @@ static inline int handle_pte_fault(struc
26362 pte_unmap_unlock(pte, ptl);
26366 + vx_page_fault(mm, vma, type, ret);
26371 diff -NurpP --minimal linux-2.6.35.2/mm/mlock.c linux-2.6.35.2-vs2.3.0.36.31/mm/mlock.c
26372 --- linux-2.6.35.2/mm/mlock.c 2010-08-02 16:52:58.000000000 +0200
26373 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/mlock.c 2010-08-02 17:05:06.000000000 +0200
26375 #include <linux/rmap.h>
26376 #include <linux/mmzone.h>
26377 #include <linux/hugetlb.h>
26378 +#include <linux/vs_memory.h>
26380 #include "internal.h"
26382 @@ -471,7 +472,7 @@ static int do_mlock(unsigned long start,
26384 SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
26386 - unsigned long locked;
26387 + unsigned long locked, grow;
26388 unsigned long lock_limit;
26389 int error = -ENOMEM;
26391 @@ -493,6 +494,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
26392 /* check against resource limits */
26393 if ((locked <= lock_limit) || capable(CAP_IPC_LOCK))
26394 error = do_mlock(start, len, 1);
26396 up_write(¤t->mm->mmap_sem);
26399 diff -NurpP --minimal linux-2.6.35.2/mm/mremap.c linux-2.6.35.2-vs2.3.0.36.31/mm/mremap.c
26400 --- linux-2.6.35.2/mm/mremap.c 2010-07-07 18:31:58.000000000 +0200
26401 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/mremap.c 2010-08-02 17:05:06.000000000 +0200
26403 #include <linux/security.h>
26404 #include <linux/syscalls.h>
26405 #include <linux/mmu_notifier.h>
26406 +#include <linux/vs_memory.h>
26408 #include <asm/uaccess.h>
26409 #include <asm/cacheflush.h>
26410 diff -NurpP --minimal linux-2.6.35.2/mm/oom_kill.c linux-2.6.35.2-vs2.3.0.36.31/mm/oom_kill.c
26411 --- linux-2.6.35.2/mm/oom_kill.c 2010-08-02 16:52:58.000000000 +0200
26412 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/oom_kill.c 2010-08-02 17:05:06.000000000 +0200
26414 #include <linux/notifier.h>
26415 #include <linux/memcontrol.h>
26416 #include <linux/security.h>
26417 +#include <linux/reboot.h>
26418 +#include <linux/vs_memory.h>
26419 +#include <linux/vs_context.h>
26421 int sysctl_panic_on_oom;
26422 int sysctl_oom_kill_allocating_task;
26423 @@ -187,9 +190,21 @@ unsigned long badness(struct task_struct
26424 points >>= -(oom_adj);
26428 + * add points for context badness and
26429 + * reduce badness for processes belonging to
26430 + * a different context
26433 + points += vx_badness(p, mm);
26435 + if ((vx_current_xid() > 1) &&
26436 + vx_current_xid() != vx_task_xid(p))
26440 - printk(KERN_DEBUG "OOMkill: task %d (%s) got %lu points\n",
26441 - p->pid, p->comm, points);
26442 + printk(KERN_DEBUG "OOMkill: task %d:#%u (%s) got %d points\n",
26443 + task_pid_nr(p), p->xid, p->comm, points);
26447 @@ -250,6 +265,7 @@ static struct task_struct *select_bad_pr
26448 struct task_struct *p;
26449 struct task_struct *chosen = NULL;
26450 struct timespec uptime;
26451 + unsigned xid = vx_current_xid();
26454 do_posix_clock_monotonic_gettime(&uptime);
26455 @@ -262,11 +278,14 @@ static struct task_struct *select_bad_pr
26459 - /* skip the init task */
26460 - if (is_global_init(p))
26461 + /* skip the init task, global and per guest */
26462 + if (task_is_init(p))
26464 if (mem && !task_in_mem_cgroup(p, mem))
26466 + /* skip other guest and host processes if oom in guest */
26467 + if (xid && vx_task_xid(p) != xid)
26471 * This task already has access to memory reserves and is
26472 @@ -398,9 +417,9 @@ static void __oom_kill_task(struct task_
26476 - printk(KERN_ERR "Killed process %d (%s) "
26477 + printk(KERN_ERR "Killed process %s(%d:#%u) "
26478 "vsz:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
26479 - task_pid_nr(p), p->comm,
26480 + p->comm, task_pid_nr(p), p->xid,
26481 K(p->mm->total_vm),
26482 K(get_mm_counter(p->mm, MM_ANONPAGES)),
26483 K(get_mm_counter(p->mm, MM_FILEPAGES)));
26484 @@ -453,8 +472,8 @@ static int oom_kill_process(struct task_
26488 - printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n",
26489 - message, task_pid_nr(p), p->comm, points);
26490 + printk(KERN_ERR "%s: kill process %s(%d:#%u) score %li or a child\n",
26491 + message, p->comm, task_pid_nr(p), p->xid, points);
26493 /* Try to kill a child first */
26494 list_for_each_entry(c, &p->children, sibling) {
26495 @@ -554,6 +573,8 @@ void clear_zonelist_oom(struct zonelist
26496 spin_unlock(&zone_scan_lock);
26499 +long vs_oom_action(unsigned int);
26502 * Must be called with tasklist_lock held for read.
26504 @@ -580,7 +601,11 @@ retry:
26506 read_unlock(&tasklist_lock);
26507 dump_header(NULL, gfp_mask, order, NULL);
26508 - panic("Out of memory and no killable processes...\n");
26509 + /* avoid panic for guest OOM */
26510 + if (current->xid)
26511 + vs_oom_action(LINUX_REBOOT_CMD_OOM);
26513 + panic("Out of memory and no killable processes...\n");
26516 if (oom_kill_process(p, gfp_mask, order, points, NULL,
26517 diff -NurpP --minimal linux-2.6.35.2/mm/page_alloc.c linux-2.6.35.2-vs2.3.0.36.31/mm/page_alloc.c
26518 --- linux-2.6.35.2/mm/page_alloc.c 2010-08-02 16:52:58.000000000 +0200
26519 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/page_alloc.c 2010-08-02 17:46:11.000000000 +0200
26521 #include <linux/compaction.h>
26522 #include <trace/events/kmem.h>
26523 #include <linux/ftrace_event.h>
26524 +#include <linux/vs_base.h>
26525 +#include <linux/vs_limit.h>
26527 #include <asm/tlbflush.h>
26528 #include <asm/div64.h>
26529 @@ -2305,6 +2307,9 @@ void si_meminfo(struct sysinfo *val)
26530 val->totalhigh = totalhigh_pages;
26531 val->freehigh = nr_free_highpages();
26532 val->mem_unit = PAGE_SIZE;
26534 + if (vx_flags(VXF_VIRT_MEM, 0))
26535 + vx_vsi_meminfo(val);
26538 EXPORT_SYMBOL(si_meminfo);
26539 @@ -2325,6 +2330,9 @@ void si_meminfo_node(struct sysinfo *val
26542 val->mem_unit = PAGE_SIZE;
26544 + if (vx_flags(VXF_VIRT_MEM, 0))
26545 + vx_vsi_meminfo(val);
26549 diff -NurpP --minimal linux-2.6.35.2/mm/rmap.c linux-2.6.35.2-vs2.3.0.36.31/mm/rmap.c
26550 --- linux-2.6.35.2/mm/rmap.c 2010-08-02 16:52:58.000000000 +0200
26551 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/rmap.c 2010-08-02 17:05:06.000000000 +0200
26553 #include <linux/memcontrol.h>
26554 #include <linux/mmu_notifier.h>
26555 #include <linux/migrate.h>
26556 +#include <linux/vs_memory.h>
26558 #include <asm/tlbflush.h>
26560 diff -NurpP --minimal linux-2.6.35.2/mm/shmem.c linux-2.6.35.2-vs2.3.0.36.31/mm/shmem.c
26561 --- linux-2.6.35.2/mm/shmem.c 2010-08-02 16:52:58.000000000 +0200
26562 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/shmem.c 2010-08-02 17:05:06.000000000 +0200
26563 @@ -1788,7 +1788,7 @@ static int shmem_statfs(struct dentry *d
26565 struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
26567 - buf->f_type = TMPFS_MAGIC;
26568 + buf->f_type = TMPFS_SUPER_MAGIC;
26569 buf->f_bsize = PAGE_CACHE_SIZE;
26570 buf->f_namelen = NAME_MAX;
26571 spin_lock(&sbinfo->stat_lock);
26572 @@ -2350,7 +2350,7 @@ int shmem_fill_super(struct super_block
26573 sb->s_maxbytes = SHMEM_MAX_BYTES;
26574 sb->s_blocksize = PAGE_CACHE_SIZE;
26575 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
26576 - sb->s_magic = TMPFS_MAGIC;
26577 + sb->s_magic = TMPFS_SUPER_MAGIC;
26578 sb->s_op = &shmem_ops;
26579 sb->s_time_gran = 1;
26580 #ifdef CONFIG_TMPFS_POSIX_ACL
26581 diff -NurpP --minimal linux-2.6.35.2/mm/slab.c linux-2.6.35.2-vs2.3.0.36.31/mm/slab.c
26582 --- linux-2.6.35.2/mm/slab.c 2010-08-02 16:52:58.000000000 +0200
26583 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/slab.c 2010-08-02 17:05:06.000000000 +0200
26584 @@ -408,6 +408,8 @@ static void kmem_list3_init(struct kmem_
26585 #define STATS_INC_FREEMISS(x) do { } while (0)
26588 +#include "slab_vs.h"
26593 @@ -3347,6 +3349,7 @@ retry:
26595 obj = slab_get_obj(cachep, slabp, nodeid);
26596 check_slabp(cachep, slabp);
26597 + vx_slab_alloc(cachep, flags);
26598 l3->free_objects--;
26599 /* move slabp to correct slabp list: */
26600 list_del(&slabp->list);
26601 @@ -3424,6 +3427,7 @@ __cache_alloc_node(struct kmem_cache *ca
26602 /* ___cache_alloc_node can fall back to other nodes */
26603 ptr = ____cache_alloc_node(cachep, flags, nodeid);
26605 + vx_slab_alloc(cachep, flags);
26606 local_irq_restore(save_flags);
26607 ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, caller);
26608 kmemleak_alloc_recursive(ptr, obj_size(cachep), 1, cachep->flags,
26609 @@ -3610,6 +3614,7 @@ static inline void __cache_free(struct k
26611 kmemleak_free_recursive(objp, cachep->flags);
26612 objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
26613 + vx_slab_free(cachep);
26615 kmemcheck_slab_free(cachep, objp, obj_size(cachep));
26617 diff -NurpP --minimal linux-2.6.35.2/mm/slab_vs.h linux-2.6.35.2-vs2.3.0.36.31/mm/slab_vs.h
26618 --- linux-2.6.35.2/mm/slab_vs.h 1970-01-01 01:00:00.000000000 +0100
26619 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/slab_vs.h 2010-08-02 17:05:06.000000000 +0200
26622 +#include <linux/vserver/context.h>
26624 +#include <linux/vs_context.h>
26627 +void vx_slab_alloc(struct kmem_cache *cachep, gfp_t flags)
26629 + int what = gfp_zone(cachep->gfpflags);
26630 + struct vx_info *vxi = current_vx_info();
26635 + atomic_add(cachep->buffer_size, &vxi->cacct.slab[what]);
26639 +void vx_slab_free(struct kmem_cache *cachep)
26641 + int what = gfp_zone(cachep->gfpflags);
26642 + struct vx_info *vxi = current_vx_info();
26647 + atomic_sub(cachep->buffer_size, &vxi->cacct.slab[what]);
26650 diff -NurpP --minimal linux-2.6.35.2/mm/swapfile.c linux-2.6.35.2-vs2.3.0.36.31/mm/swapfile.c
26651 --- linux-2.6.35.2/mm/swapfile.c 2010-08-14 18:16:59.000000000 +0200
26652 +++ linux-2.6.35.2-vs2.3.0.36.31/mm/swapfile.c 2010-08-14 18:19:32.000000000 +0200
26654 #include <asm/tlbflush.h>
26655 #include <linux/swapops.h>
26656 #include <linux/page_cgroup.h>
26657 +#include <linux/vs_base.h>
26658 +#include <linux/vs_memory.h>
26660 static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
26662 @@ -1734,6 +1736,16 @@ static int swap_show(struct seq_file *sw
26664 if (si == SEQ_START_TOKEN) {
26665 seq_puts(swap,"Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
26666 + if (vx_flags(VXF_VIRT_MEM, 0)) {
26667 + struct sysinfo si;
26669 + vx_vsi_swapinfo(&si);
26670 + if (si.totalswap < (1 << 10))
26672 + seq_printf(swap, "%s\t\t\t\t\t%s\t%lu\t%lu\t%d\n",
26673 + "hdv0", "partition", si.totalswap >> 10,
26674 + (si.totalswap - si.freeswap) >> 10, -1);
26679 @@ -2118,6 +2130,8 @@ void si_swapinfo(struct sysinfo *val)
26680 val->freeswap = nr_swap_pages + nr_to_be_unused;
26681 val->totalswap = total_swap_pages + nr_to_be_unused;
26682 spin_unlock(&swap_lock);
26683 + if (vx_flags(VXF_VIRT_MEM, 0))
26684 + vx_vsi_swapinfo(val);
26688 diff -NurpP --minimal linux-2.6.35.2/net/core/dev.c linux-2.6.35.2-vs2.3.0.36.31/net/core/dev.c
26689 --- linux-2.6.35.2/net/core/dev.c 2010-08-02 16:52:59.000000000 +0200
26690 +++ linux-2.6.35.2-vs2.3.0.36.31/net/core/dev.c 2010-08-02 17:05:06.000000000 +0200
26691 @@ -129,6 +129,7 @@
26692 #include <linux/in.h>
26693 #include <linux/jhash.h>
26694 #include <linux/random.h>
26695 +#include <linux/vs_inet.h>
26696 #include <trace/events/napi.h>
26697 #include <linux/pci.h>
26699 @@ -609,7 +610,8 @@ struct net_device *__dev_get_by_name(str
26700 struct hlist_head *head = dev_name_hash(net, name);
26702 hlist_for_each_entry(dev, p, head, name_hlist)
26703 - if (!strncmp(dev->name, name, IFNAMSIZ))
26704 + if (!strncmp(dev->name, name, IFNAMSIZ) &&
26705 + nx_dev_visible(current_nx_info(), dev))
26709 @@ -635,7 +637,8 @@ struct net_device *dev_get_by_name_rcu(s
26710 struct hlist_head *head = dev_name_hash(net, name);
26712 hlist_for_each_entry_rcu(dev, p, head, name_hlist)
26713 - if (!strncmp(dev->name, name, IFNAMSIZ))
26714 + if (!strncmp(dev->name, name, IFNAMSIZ) &&
26715 + nx_dev_visible(current_nx_info(), dev))
26719 @@ -686,7 +689,8 @@ struct net_device *__dev_get_by_index(st
26720 struct hlist_head *head = dev_index_hash(net, ifindex);
26722 hlist_for_each_entry(dev, p, head, index_hlist)
26723 - if (dev->ifindex == ifindex)
26724 + if ((dev->ifindex == ifindex) &&
26725 + nx_dev_visible(current_nx_info(), dev))
26729 @@ -711,7 +715,8 @@ struct net_device *dev_get_by_index_rcu(
26730 struct hlist_head *head = dev_index_hash(net, ifindex);
26732 hlist_for_each_entry_rcu(dev, p, head, index_hlist)
26733 - if (dev->ifindex == ifindex)
26734 + if ((dev->ifindex == ifindex) &&
26735 + nx_dev_visible(current_nx_info(), dev))
26739 @@ -764,10 +769,12 @@ struct net_device *dev_getbyhwaddr(struc
26743 - for_each_netdev(net, dev)
26744 + for_each_netdev(net, dev) {
26745 if (dev->type == type &&
26746 - !memcmp(dev->dev_addr, ha, dev->addr_len))
26747 + !memcmp(dev->dev_addr, ha, dev->addr_len) &&
26748 + nx_dev_visible(current_nx_info(), dev))
26754 @@ -778,9 +785,11 @@ struct net_device *__dev_getfirstbyhwtyp
26755 struct net_device *dev;
26758 - for_each_netdev(net, dev)
26759 - if (dev->type == type)
26760 + for_each_netdev(net, dev) {
26761 + if ((dev->type == type) &&
26762 + nx_dev_visible(current_nx_info(), dev))
26768 @@ -902,6 +911,8 @@ static int __dev_alloc_name(struct net *
26770 if (i < 0 || i >= max_netdevices)
26772 + if (!nx_dev_visible(current_nx_info(), d))
26775 /* avoid cases where sscanf is not exact inverse of printf */
26776 snprintf(buf, IFNAMSIZ, name, i);
26777 @@ -3651,6 +3662,8 @@ static int dev_ifconf(struct net *net, c
26780 for_each_netdev(net, dev) {
26781 + if (!nx_dev_visible(current_nx_info(), dev))
26783 for (i = 0; i < NPROTO; i++) {
26784 if (gifconf_list[i]) {
26786 @@ -3721,6 +3734,9 @@ static void dev_seq_printf_stats(struct
26788 const struct net_device_stats *stats = dev_get_stats(dev);
26790 + if (!nx_dev_visible(current_nx_info(), dev))
26793 seq_printf(seq, "%6s: %7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
26794 "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
26795 dev->name, stats->rx_bytes, stats->rx_packets,
26796 diff -NurpP --minimal linux-2.6.35.2/net/core/rtnetlink.c linux-2.6.35.2-vs2.3.0.36.31/net/core/rtnetlink.c
26797 --- linux-2.6.35.2/net/core/rtnetlink.c 2010-08-02 16:52:59.000000000 +0200
26798 +++ linux-2.6.35.2-vs2.3.0.36.31/net/core/rtnetlink.c 2010-08-02 17:05:06.000000000 +0200
26799 @@ -926,6 +926,8 @@ static int rtnl_dump_ifinfo(struct sk_bu
26800 hlist_for_each_entry(dev, node, head, index_hlist) {
26803 + if (!nx_dev_visible(skb->sk->sk_nx_info, dev))
26805 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
26806 NETLINK_CB(cb->skb).pid,
26807 cb->nlh->nlmsg_seq, 0,
26808 @@ -1642,6 +1644,9 @@ void rtmsg_ifinfo(int type, struct net_d
26809 struct sk_buff *skb;
26810 int err = -ENOBUFS;
26812 + if (!nx_dev_visible(current_nx_info(), dev))
26815 skb = nlmsg_new(if_nlmsg_size(dev), GFP_KERNEL);
26818 diff -NurpP --minimal linux-2.6.35.2/net/core/sock.c linux-2.6.35.2-vs2.3.0.36.31/net/core/sock.c
26819 --- linux-2.6.35.2/net/core/sock.c 2010-08-02 16:52:59.000000000 +0200
26820 +++ linux-2.6.35.2-vs2.3.0.36.31/net/core/sock.c 2010-08-02 17:05:06.000000000 +0200
26821 @@ -126,6 +126,10 @@
26822 #include <net/cls_cgroup.h>
26824 #include <linux/filter.h>
26825 +#include <linux/vs_socket.h>
26826 +#include <linux/vs_limit.h>
26827 +#include <linux/vs_context.h>
26828 +#include <linux/vs_network.h>
26831 #include <net/tcp.h>
26832 @@ -1027,6 +1031,8 @@ static struct sock *sk_prot_alloc(struct
26834 sk_tx_queue_clear(sk);
26836 + sock_vx_init(sk);
26837 + sock_nx_init(sk);
26841 @@ -1120,6 +1126,11 @@ static void __sk_free(struct sock *sk)
26842 __func__, atomic_read(&sk->sk_omem_alloc));
26844 put_net(sock_net(sk));
26846 + clr_vx_info(&sk->sk_vx_info);
26848 + clr_nx_info(&sk->sk_nx_info);
26850 sk_prot_free(sk->sk_prot_creator, sk);
26853 @@ -1167,6 +1178,8 @@ struct sock *sk_clone(const struct sock
26856 get_net(sock_net(newsk));
26857 + sock_vx_init(newsk);
26858 + sock_nx_init(newsk);
26859 sk_node_init(&newsk->sk_node);
26860 sock_lock_init(newsk);
26861 bh_lock_sock(newsk);
26862 @@ -1222,6 +1235,12 @@ struct sock *sk_clone(const struct sock
26864 atomic_set(&newsk->sk_refcnt, 2);
26866 + set_vx_info(&newsk->sk_vx_info, sk->sk_vx_info);
26867 + newsk->sk_xid = sk->sk_xid;
26868 + vx_sock_inc(newsk);
26869 + set_nx_info(&newsk->sk_nx_info, sk->sk_nx_info);
26870 + newsk->sk_nid = sk->sk_nid;
26873 * Increment the counter in the same struct proto as the master
26874 * sock (sk_refcnt_debug_inc uses newsk->sk_prot->socks, that
26875 @@ -1964,6 +1983,12 @@ void sock_init_data(struct socket *sock,
26877 sk->sk_stamp = ktime_set(-1L, 0);
26879 + set_vx_info(&sk->sk_vx_info, current_vx_info());
26880 + sk->sk_xid = vx_current_xid();
26882 + set_nx_info(&sk->sk_nx_info, current_nx_info());
26883 + sk->sk_nid = nx_current_nid();
26886 * Before updating sk_refcnt, we must commit prior changes to memory
26887 * (Documentation/RCU/rculist_nulls.txt for details)
26888 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/af_inet.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/af_inet.c
26889 --- linux-2.6.35.2/net/ipv4/af_inet.c 2010-08-02 16:52:59.000000000 +0200
26890 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/af_inet.c 2010-08-02 17:05:06.000000000 +0200
26891 @@ -116,6 +116,7 @@
26892 #ifdef CONFIG_IP_MROUTE
26893 #include <linux/mroute.h>
26895 +#include <linux/vs_limit.h>
26898 /* The inetsw table contains everything that inet_create needs to
26899 @@ -327,9 +328,13 @@ lookup_protocol:
26903 + if ((protocol == IPPROTO_ICMP) &&
26904 + nx_capable(CAP_NET_RAW, NXC_RAW_ICMP))
26907 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
26908 goto out_rcu_unlock;
26911 err = -EAFNOSUPPORT;
26912 if (!inet_netns_ok(net, protocol))
26913 goto out_rcu_unlock;
26914 @@ -451,6 +456,7 @@ int inet_bind(struct socket *sock, struc
26915 struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
26916 struct sock *sk = sock->sk;
26917 struct inet_sock *inet = inet_sk(sk);
26918 + struct nx_v4_sock_addr nsa;
26919 unsigned short snum;
26922 @@ -464,7 +470,11 @@ int inet_bind(struct socket *sock, struc
26923 if (addr_len < sizeof(struct sockaddr_in))
26926 - chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
26927 + err = v4_map_sock_addr(inet, addr, &nsa);
26931 + chk_addr_ret = inet_addr_type(sock_net(sk), nsa.saddr);
26933 /* Not specified by any standard per-se, however it breaks too
26934 * many applications when removed. It is unfortunate since
26935 @@ -476,7 +486,7 @@ int inet_bind(struct socket *sock, struc
26936 err = -EADDRNOTAVAIL;
26937 if (!sysctl_ip_nonlocal_bind &&
26938 !(inet->freebind || inet->transparent) &&
26939 - addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
26940 + nsa.saddr != htonl(INADDR_ANY) &&
26941 chk_addr_ret != RTN_LOCAL &&
26942 chk_addr_ret != RTN_MULTICAST &&
26943 chk_addr_ret != RTN_BROADCAST)
26944 @@ -501,7 +511,7 @@ int inet_bind(struct socket *sock, struc
26945 if (sk->sk_state != TCP_CLOSE || inet->inet_num)
26946 goto out_release_sock;
26948 - inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
26949 + v4_set_sock_addr(inet, &nsa);
26950 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
26951 inet->inet_saddr = 0; /* Use device */
26953 @@ -703,11 +713,13 @@ int inet_getname(struct socket *sock, st
26956 sin->sin_port = inet->inet_dport;
26957 - sin->sin_addr.s_addr = inet->inet_daddr;
26958 + sin->sin_addr.s_addr =
26959 + nx_map_sock_lback(sk->sk_nx_info, inet->inet_daddr);
26961 __be32 addr = inet->inet_rcv_saddr;
26963 addr = inet->inet_saddr;
26964 + addr = nx_map_sock_lback(sk->sk_nx_info, addr);
26965 sin->sin_port = inet->inet_sport;
26966 sin->sin_addr.s_addr = addr;
26968 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/devinet.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/devinet.c
26969 --- linux-2.6.35.2/net/ipv4/devinet.c 2010-08-14 18:16:59.000000000 +0200
26970 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/devinet.c 2010-08-14 18:19:32.000000000 +0200
26971 @@ -417,6 +417,7 @@ struct in_device *inetdev_by_index(struc
26973 EXPORT_SYMBOL(inetdev_by_index);
26976 /* Called only from RTNL semaphored context. No locks. */
26978 struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
26979 @@ -659,6 +660,8 @@ int devinet_ioctl(struct net *net, unsig
26981 in_dev = __in_dev_get_rtnl(dev);
26983 + struct nx_info *nxi = current_nx_info();
26985 if (tryaddrmatch) {
26986 /* Matthias Andree */
26987 /* compare label and address (4.4BSD style) */
26988 @@ -667,6 +670,8 @@ int devinet_ioctl(struct net *net, unsig
26989 This is checked above. */
26990 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
26991 ifap = &ifa->ifa_next) {
26992 + if (!nx_v4_ifa_visible(nxi, ifa))
26994 if (!strcmp(ifr.ifr_name, ifa->ifa_label) &&
26995 sin_orig.sin_addr.s_addr ==
26996 ifa->ifa_address) {
26997 @@ -679,9 +684,12 @@ int devinet_ioctl(struct net *net, unsig
26998 comparing just the label */
27000 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
27001 - ifap = &ifa->ifa_next)
27002 + ifap = &ifa->ifa_next) {
27003 + if (!nx_v4_ifa_visible(nxi, ifa))
27005 if (!strcmp(ifr.ifr_name, ifa->ifa_label))
27011 @@ -833,6 +841,8 @@ static int inet_gifconf(struct net_devic
27014 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
27015 + if (!nx_v4_ifa_visible(current_nx_info(), ifa))
27018 done += sizeof(ifr);
27020 @@ -1182,6 +1192,7 @@ static int inet_dump_ifaddr(struct sk_bu
27021 struct net_device *dev;
27022 struct in_device *in_dev;
27023 struct in_ifaddr *ifa;
27024 + struct sock *sk = skb->sk;
27025 struct hlist_head *head;
27026 struct hlist_node *node;
27028 @@ -1204,6 +1215,8 @@ static int inet_dump_ifaddr(struct sk_bu
27030 for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
27031 ifa = ifa->ifa_next, ip_idx++) {
27032 + if (sk && !nx_v4_ifa_visible(sk->sk_nx_info, ifa))
27034 if (ip_idx < s_ip_idx)
27036 if (inet_fill_ifaddr(skb, ifa,
27037 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/fib_hash.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/fib_hash.c
27038 --- linux-2.6.35.2/net/ipv4/fib_hash.c 2010-07-07 18:31:59.000000000 +0200
27039 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/fib_hash.c 2010-08-02 17:05:06.000000000 +0200
27040 @@ -1017,7 +1017,7 @@ static int fib_seq_show(struct seq_file
27041 prefix = f->fn_key;
27042 mask = FZ_MASK(iter->zone);
27043 flags = fib_flag_trans(fa->fa_type, mask, fi);
27045 + if (fi && nx_dev_visible(current_nx_info(), fi->fib_dev))
27047 "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u%n",
27048 fi->fib_dev ? fi->fib_dev->name : "*", prefix,
27049 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/inet_connection_sock.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/inet_connection_sock.c
27050 --- linux-2.6.35.2/net/ipv4/inet_connection_sock.c 2010-08-02 16:52:59.000000000 +0200
27051 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/inet_connection_sock.c 2010-08-02 17:05:06.000000000 +0200
27052 @@ -52,10 +52,40 @@ void inet_get_local_port_range(int *low,
27054 EXPORT_SYMBOL(inet_get_local_port_range);
27056 +int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
27058 + __be32 sk1_rcv_saddr = inet_rcv_saddr(sk1),
27059 + sk2_rcv_saddr = inet_rcv_saddr(sk2);
27061 + if (inet_v6_ipv6only(sk2))
27064 + if (sk1_rcv_saddr &&
27066 + sk1_rcv_saddr == sk2_rcv_saddr)
27069 + if (sk1_rcv_saddr &&
27070 + !sk2_rcv_saddr &&
27071 + v4_addr_in_nx_info(sk2->sk_nx_info, sk1_rcv_saddr, NXA_MASK_BIND))
27074 + if (sk2_rcv_saddr &&
27075 + !sk1_rcv_saddr &&
27076 + v4_addr_in_nx_info(sk1->sk_nx_info, sk2_rcv_saddr, NXA_MASK_BIND))
27079 + if (!sk1_rcv_saddr &&
27080 + !sk2_rcv_saddr &&
27081 + nx_v4_addr_conflict(sk1->sk_nx_info, sk2->sk_nx_info))
27087 int inet_csk_bind_conflict(const struct sock *sk,
27088 const struct inet_bind_bucket *tb)
27090 - const __be32 sk_rcv_saddr = inet_rcv_saddr(sk);
27092 struct hlist_node *node;
27093 int reuse = sk->sk_reuse;
27094 @@ -75,9 +105,7 @@ int inet_csk_bind_conflict(const struct
27095 sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
27096 if (!reuse || !sk2->sk_reuse ||
27097 sk2->sk_state == TCP_LISTEN) {
27098 - const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
27099 - if (!sk2_rcv_saddr || !sk_rcv_saddr ||
27100 - sk2_rcv_saddr == sk_rcv_saddr)
27101 + if (ipv4_rcv_saddr_equal(sk, sk2))
27105 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/inet_diag.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/inet_diag.c
27106 --- linux-2.6.35.2/net/ipv4/inet_diag.c 2010-07-07 18:31:59.000000000 +0200
27107 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/inet_diag.c 2010-08-02 17:05:06.000000000 +0200
27109 #include <linux/stddef.h>
27111 #include <linux/inet_diag.h>
27112 +#include <linux/vs_network.h>
27113 +#include <linux/vs_inet.h>
27115 static const struct inet_diag_handler **inet_diag_table;
27117 @@ -119,8 +121,10 @@ static int inet_csk_diag_fill(struct soc
27119 r->id.idiag_sport = inet->inet_sport;
27120 r->id.idiag_dport = inet->inet_dport;
27121 - r->id.idiag_src[0] = inet->inet_rcv_saddr;
27122 - r->id.idiag_dst[0] = inet->inet_daddr;
27123 + r->id.idiag_src[0] = nx_map_sock_lback(sk->sk_nx_info,
27124 + inet->inet_rcv_saddr);
27125 + r->id.idiag_dst[0] = nx_map_sock_lback(sk->sk_nx_info,
27126 + inet->inet_daddr);
27128 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
27129 if (r->idiag_family == AF_INET6) {
27130 @@ -205,8 +209,8 @@ static int inet_twsk_diag_fill(struct in
27131 r->id.idiag_cookie[1] = (u32)(((unsigned long)tw >> 31) >> 1);
27132 r->id.idiag_sport = tw->tw_sport;
27133 r->id.idiag_dport = tw->tw_dport;
27134 - r->id.idiag_src[0] = tw->tw_rcv_saddr;
27135 - r->id.idiag_dst[0] = tw->tw_daddr;
27136 + r->id.idiag_src[0] = nx_map_sock_lback(tw->tw_nx_info, tw->tw_rcv_saddr);
27137 + r->id.idiag_dst[0] = nx_map_sock_lback(tw->tw_nx_info, tw->tw_daddr);
27138 r->idiag_state = tw->tw_substate;
27139 r->idiag_timer = 3;
27140 r->idiag_expires = DIV_ROUND_UP(tmo * 1000, HZ);
27141 @@ -263,6 +267,7 @@ static int inet_diag_get_exact(struct sk
27144 if (req->idiag_family == AF_INET) {
27145 + /* TODO: lback */
27146 sk = inet_lookup(&init_net, hashinfo, req->id.idiag_dst[0],
27147 req->id.idiag_dport, req->id.idiag_src[0],
27148 req->id.idiag_sport, req->id.idiag_if);
27149 @@ -505,6 +510,7 @@ static int inet_csk_diag_dump(struct soc
27153 + /* TODO: lback */
27154 entry.saddr = &inet->inet_rcv_saddr;
27155 entry.daddr = &inet->inet_daddr;
27157 @@ -541,6 +547,7 @@ static int inet_twsk_diag_dump(struct in
27161 + /* TODO: lback */
27162 entry.saddr = &tw->tw_rcv_saddr;
27163 entry.daddr = &tw->tw_daddr;
27165 @@ -587,8 +594,8 @@ static int inet_diag_fill_req(struct sk_
27167 r->id.idiag_sport = inet->inet_sport;
27168 r->id.idiag_dport = ireq->rmt_port;
27169 - r->id.idiag_src[0] = ireq->loc_addr;
27170 - r->id.idiag_dst[0] = ireq->rmt_addr;
27171 + r->id.idiag_src[0] = nx_map_sock_lback(sk->sk_nx_info, ireq->loc_addr);
27172 + r->id.idiag_dst[0] = nx_map_sock_lback(sk->sk_nx_info, ireq->rmt_addr);
27173 r->idiag_expires = jiffies_to_msecs(tmo);
27174 r->idiag_rqueue = 0;
27175 r->idiag_wqueue = 0;
27176 @@ -658,6 +665,7 @@ static int inet_diag_dump_reqs(struct sk
27180 + /* TODO: lback */
27182 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
27183 (entry.family == AF_INET6) ?
27184 @@ -728,6 +736,8 @@ static int inet_diag_dump(struct sk_buff
27185 sk_nulls_for_each(sk, node, &ilb->head) {
27186 struct inet_sock *inet = inet_sk(sk);
27188 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27193 @@ -794,6 +804,8 @@ skip_listen_ht:
27194 sk_nulls_for_each(sk, node, &head->chain) {
27195 struct inet_sock *inet = inet_sk(sk);
27197 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27201 if (!(r->idiag_states & (1 << sk->sk_state)))
27202 @@ -818,6 +830,8 @@ next_normal:
27203 inet_twsk_for_each(tw, node,
27206 + if (!nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))
27210 if (r->id.idiag_sport != tw->tw_sport &&
27211 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/inet_hashtables.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/inet_hashtables.c
27212 --- linux-2.6.35.2/net/ipv4/inet_hashtables.c 2010-08-02 16:52:59.000000000 +0200
27213 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/inet_hashtables.c 2010-08-02 17:05:06.000000000 +0200
27216 #include <net/inet_connection_sock.h>
27217 #include <net/inet_hashtables.h>
27218 +#include <net/route.h>
27219 #include <net/ip.h>
27222 @@ -134,6 +135,11 @@ static inline int compute_score(struct s
27223 if (rcv_saddr != daddr)
27227 + /* block non nx_info ips */
27228 + if (!v4_addr_in_nx_info(sk->sk_nx_info,
27229 + daddr, NXA_MASK_BIND))
27232 if (sk->sk_bound_dev_if) {
27233 if (sk->sk_bound_dev_if != dif)
27234 @@ -151,7 +157,6 @@ static inline int compute_score(struct s
27235 * wildcarded during the search since they can never be otherwise.
27239 struct sock *__inet_lookup_listener(struct net *net,
27240 struct inet_hashinfo *hashinfo,
27241 const __be32 daddr, const unsigned short hnum,
27242 @@ -174,6 +179,7 @@ begin:
27248 * if the nulls value we got at the end of this lookup is
27249 * not the expected one, we must restart lookup.
27250 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/netfilter/nf_nat_helper.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/netfilter/nf_nat_helper.c
27251 --- linux-2.6.35.2/net/ipv4/netfilter/nf_nat_helper.c 2010-07-07 18:31:59.000000000 +0200
27252 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/netfilter/nf_nat_helper.c 2010-08-02 17:05:06.000000000 +0200
27254 #include <net/route.h>
27256 #include <linux/netfilter_ipv4.h>
27257 +#include <net/route.h>
27258 #include <net/netfilter/nf_conntrack.h>
27259 #include <net/netfilter/nf_conntrack_helper.h>
27260 #include <net/netfilter/nf_conntrack_ecache.h>
27261 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/netfilter.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/netfilter.c
27262 --- linux-2.6.35.2/net/ipv4/netfilter.c 2010-08-02 16:52:59.000000000 +0200
27263 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/netfilter.c 2010-08-02 17:05:06.000000000 +0200
27265 #include <linux/ip.h>
27266 #include <linux/skbuff.h>
27267 #include <linux/gfp.h>
27268 -#include <net/route.h>
27269 +// #include <net/route.h>
27270 #include <net/xfrm.h>
27271 #include <net/ip.h>
27272 #include <net/netfilter/nf_queue.h>
27273 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/raw.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/raw.c
27274 --- linux-2.6.35.2/net/ipv4/raw.c 2010-08-02 16:52:59.000000000 +0200
27275 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/raw.c 2010-08-02 18:19:23.000000000 +0200
27276 @@ -116,7 +116,7 @@ static struct sock *__raw_v4_lookup(stru
27278 if (net_eq(sock_net(sk), net) && inet->inet_num == num &&
27279 !(inet->inet_daddr && inet->inet_daddr != raddr) &&
27280 - !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
27281 + v4_sock_addr_match(sk->sk_nx_info, inet, laddr) &&
27282 !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
27283 goto found; /* gotcha */
27285 @@ -381,6 +381,12 @@ static int raw_send_hdrinc(struct sock *
27286 icmp_out_count(net, ((struct icmphdr *)
27287 skb_transport_header(skb))->type);
27290 + if (!nx_check(0, VS_ADMIN) && !capable(CAP_NET_RAW) &&
27291 + sk->sk_nx_info &&
27292 + !v4_addr_in_nx_info(sk->sk_nx_info, iph->saddr, NXA_MASK_BIND))
27295 err = NF_HOOK(NFPROTO_IPV4, NF_INET_LOCAL_OUT, skb, NULL,
27296 rt->u.dst.dev, dst_output);
27298 @@ -561,6 +567,13 @@ static int raw_sendmsg(struct kiocb *ioc
27301 security_sk_classify_flow(sk, &fl);
27302 + if (sk->sk_nx_info) {
27303 + err = ip_v4_find_src(sock_net(sk),
27304 + sk->sk_nx_info, &rt, &fl);
27309 err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1);
27312 @@ -633,17 +646,19 @@ static int raw_bind(struct sock *sk, str
27314 struct inet_sock *inet = inet_sk(sk);
27315 struct sockaddr_in *addr = (struct sockaddr_in *) uaddr;
27316 + struct nx_v4_sock_addr nsa = { 0 };
27320 if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in))
27322 - chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
27323 + v4_map_sock_addr(inet, addr, &nsa);
27324 + chk_addr_ret = inet_addr_type(sock_net(sk), nsa.saddr);
27325 ret = -EADDRNOTAVAIL;
27326 - if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL &&
27327 + if (nsa.saddr && chk_addr_ret != RTN_LOCAL &&
27328 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
27330 - inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
27331 + v4_set_sock_addr(inet, &nsa);
27332 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
27333 inet->inet_saddr = 0; /* Use device */
27335 @@ -695,7 +710,8 @@ static int raw_recvmsg(struct kiocb *ioc
27336 /* Copy the address. */
27338 sin->sin_family = AF_INET;
27339 - sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
27340 + sin->sin_addr.s_addr =
27341 + nx_map_sock_lback(sk->sk_nx_info, ip_hdr(skb)->saddr);
27343 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
27345 @@ -873,7 +889,8 @@ static struct sock *raw_get_first(struct
27346 struct hlist_node *node;
27348 sk_for_each(sk, node, &state->h->ht[state->bucket])
27349 - if (sock_net(sk) == seq_file_net(seq))
27350 + if ((sock_net(sk) == seq_file_net(seq)) &&
27351 + nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27355 @@ -889,7 +906,8 @@ static struct sock *raw_get_next(struct
27359 - } while (sk && sock_net(sk) != seq_file_net(seq));
27360 + } while (sk && ((sock_net(sk) != seq_file_net(seq)) ||
27361 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
27363 if (!sk && ++state->bucket < RAW_HTABLE_SIZE) {
27364 sk = sk_head(&state->h->ht[state->bucket]);
27365 @@ -948,7 +966,10 @@ static void raw_sock_seq_show(struct seq
27367 seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
27368 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",
27369 - i, src, srcp, dest, destp, sp->sk_state,
27371 + nx_map_sock_lback(current_nx_info(), src), srcp,
27372 + nx_map_sock_lback(current_nx_info(), dest), destp,
27374 sk_wmem_alloc_get(sp),
27375 sk_rmem_alloc_get(sp),
27376 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
27377 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/tcp.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/tcp.c
27378 --- linux-2.6.35.2/net/ipv4/tcp.c 2010-08-02 16:52:59.000000000 +0200
27379 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/tcp.c 2010-08-02 17:05:06.000000000 +0200
27380 @@ -266,6 +266,7 @@
27381 #include <linux/crypto.h>
27382 #include <linux/time.h>
27383 #include <linux/slab.h>
27384 +#include <linux/in.h>
27386 #include <net/icmp.h>
27387 #include <net/tcp.h>
27388 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/tcp_ipv4.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/tcp_ipv4.c
27389 --- linux-2.6.35.2/net/ipv4/tcp_ipv4.c 2010-08-02 16:52:59.000000000 +0200
27390 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/tcp_ipv4.c 2010-08-02 17:05:06.000000000 +0200
27391 @@ -2004,6 +2004,12 @@ static void *listening_get_next(struct s
27392 req = req->dl_next;
27395 + vxdprintk(VXD_CBIT(net, 6),
27396 + "sk,req: %p [#%d] (from %d)", req->sk,
27397 + (req->sk)?req->sk->sk_nid:0, nx_current_nid());
27399 + !nx_check(req->sk->sk_nid, VS_WATCH_P | VS_IDENT))
27401 if (req->rsk_ops->family == st->family) {
27404 @@ -2028,6 +2034,10 @@ get_req:
27407 sk_nulls_for_each_from(sk, node) {
27408 + vxdprintk(VXD_CBIT(net, 6), "sk: %p [#%d] (from %d)",
27409 + sk, sk->sk_nid, nx_current_nid());
27410 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27412 if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) {
27415 @@ -2091,6 +2101,11 @@ static void *established_get_first(struc
27417 spin_lock_bh(lock);
27418 sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
27419 + vxdprintk(VXD_CBIT(net, 6),
27420 + "sk,egf: %p [#%d] (from %d)",
27421 + sk, sk->sk_nid, nx_current_nid());
27422 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27424 if (sk->sk_family != st->family ||
27425 !net_eq(sock_net(sk), net)) {
27427 @@ -2101,6 +2116,11 @@ static void *established_get_first(struc
27428 st->state = TCP_SEQ_STATE_TIME_WAIT;
27429 inet_twsk_for_each(tw, node,
27430 &tcp_hashinfo.ehash[st->bucket].twchain) {
27431 + vxdprintk(VXD_CBIT(net, 6),
27432 + "tw: %p [#%d] (from %d)",
27433 + tw, tw->tw_nid, nx_current_nid());
27434 + if (!nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))
27436 if (tw->tw_family != st->family ||
27437 !net_eq(twsk_net(tw), net)) {
27439 @@ -2129,7 +2149,9 @@ static void *established_get_next(struct
27443 - while (tw && (tw->tw_family != st->family || !net_eq(twsk_net(tw), net))) {
27444 + while (tw && (tw->tw_family != st->family ||
27445 + !net_eq(twsk_net(tw), net) ||
27446 + !nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))) {
27450 @@ -2152,6 +2174,11 @@ get_tw:
27451 sk = sk_nulls_next(sk);
27453 sk_nulls_for_each_from(sk, node) {
27454 + vxdprintk(VXD_CBIT(net, 6),
27455 + "sk,egn: %p [#%d] (from %d)",
27456 + sk, sk->sk_nid, nx_current_nid());
27457 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27459 if (sk->sk_family == st->family && net_eq(sock_net(sk), net))
27462 @@ -2303,9 +2330,9 @@ static void get_openreq4(struct sock *sk
27463 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
27464 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %p%n",
27467 + nx_map_sock_lback(current_nx_info(), ireq->loc_addr),
27468 ntohs(inet_sk(sk)->inet_sport),
27470 + nx_map_sock_lback(current_nx_info(), ireq->rmt_addr),
27471 ntohs(ireq->rmt_port),
27473 0, 0, /* could print option size, but that is af dependent. */
27474 @@ -2357,7 +2384,10 @@ static void get_tcp4_sock(struct sock *s
27476 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
27477 "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
27478 - i, src, srcp, dest, destp, sk->sk_state,
27480 + nx_map_sock_lback(current_nx_info(), src), srcp,
27481 + nx_map_sock_lback(current_nx_info(), dest), destp,
27483 tp->write_seq - tp->snd_una,
27486 @@ -2392,7 +2422,10 @@ static void get_timewait4_sock(struct in
27488 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
27489 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p%n",
27490 - i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
27492 + nx_map_sock_lback(current_nx_info(), src), srcp,
27493 + nx_map_sock_lback(current_nx_info(), dest), destp,
27494 + tw->tw_substate, 0, 0,
27495 3, jiffies_to_clock_t(ttd), 0, 0, 0, 0,
27496 atomic_read(&tw->tw_refcnt), tw, len);
27498 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/tcp_minisocks.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/tcp_minisocks.c
27499 --- linux-2.6.35.2/net/ipv4/tcp_minisocks.c 2010-08-02 16:52:59.000000000 +0200
27500 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/tcp_minisocks.c 2010-08-02 17:05:06.000000000 +0200
27502 #include <linux/slab.h>
27503 #include <linux/sysctl.h>
27504 #include <linux/workqueue.h>
27505 +#include <linux/vs_limit.h>
27506 +#include <linux/vs_socket.h>
27507 +#include <linux/vs_context.h>
27508 #include <net/tcp.h>
27509 #include <net/inet_common.h>
27510 #include <net/xfrm.h>
27511 @@ -290,6 +293,11 @@ void tcp_time_wait(struct sock *sk, int
27512 tcptw->tw_ts_recent = tp->rx_opt.ts_recent;
27513 tcptw->tw_ts_recent_stamp = tp->rx_opt.ts_recent_stamp;
27515 + tw->tw_xid = sk->sk_xid;
27516 + tw->tw_vx_info = NULL;
27517 + tw->tw_nid = sk->sk_nid;
27518 + tw->tw_nx_info = NULL;
27520 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
27521 if (tw->tw_family == PF_INET6) {
27522 struct ipv6_pinfo *np = inet6_sk(sk);
27523 diff -NurpP --minimal linux-2.6.35.2/net/ipv4/udp.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/udp.c
27524 --- linux-2.6.35.2/net/ipv4/udp.c 2010-08-02 16:52:59.000000000 +0200
27525 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv4/udp.c 2010-08-02 17:05:06.000000000 +0200
27526 @@ -296,14 +296,7 @@ fail:
27528 EXPORT_SYMBOL(udp_lib_get_port);
27530 -static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
27532 - struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2);
27534 - return (!ipv6_only_sock(sk2) &&
27535 - (!inet1->inet_rcv_saddr || !inet2->inet_rcv_saddr ||
27536 - inet1->inet_rcv_saddr == inet2->inet_rcv_saddr));
27538 +extern int ipv4_rcv_saddr_equal(const struct sock *, const struct sock *);
27540 static unsigned int udp4_portaddr_hash(struct net *net, __be32 saddr,
27542 @@ -338,6 +331,11 @@ static inline int compute_score(struct s
27543 if (inet->inet_rcv_saddr != daddr)
27547 + /* block non nx_info ips */
27548 + if (!v4_addr_in_nx_info(sk->sk_nx_info,
27549 + daddr, NXA_MASK_BIND))
27552 if (inet->inet_daddr) {
27553 if (inet->inet_daddr != saddr)
27554 @@ -441,6 +439,7 @@ exact_match:
27559 /* UDP is nearly always wildcards out the wazoo, it makes no sense to try
27560 * harder than this. -DaveM
27562 @@ -486,6 +485,11 @@ begin:
27563 sk_nulls_for_each_rcu(sk, node, &hslot->head) {
27564 score = compute_score(sk, net, saddr, hnum, sport,
27565 daddr, dport, dif);
27566 + /* FIXME: disabled?
27567 + if (score == 9) {
27571 if (score > badness) {
27574 @@ -499,6 +503,7 @@ begin:
27575 if (get_nulls_value(node) != slot)
27580 if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
27582 @@ -508,6 +513,7 @@ begin:
27590 @@ -550,8 +556,7 @@ static inline struct sock *udp_v4_mcast_
27591 udp_sk(s)->udp_port_hash != hnum ||
27592 (inet->inet_daddr && inet->inet_daddr != rmt_addr) ||
27593 (inet->inet_dport != rmt_port && inet->inet_dport) ||
27594 - (inet->inet_rcv_saddr &&
27595 - inet->inet_rcv_saddr != loc_addr) ||
27596 + !v4_sock_addr_match(sk->sk_nx_info, inet, loc_addr) ||
27597 ipv6_only_sock(s) ||
27598 (s->sk_bound_dev_if && s->sk_bound_dev_if != dif))
27600 @@ -900,8 +905,13 @@ int udp_sendmsg(struct kiocb *iocb, stru
27601 { .sport = inet->inet_sport,
27602 .dport = dport } } };
27603 struct net *net = sock_net(sk);
27604 + struct nx_info *nxi = sk->sk_nx_info;
27606 security_sk_classify_flow(sk, &fl);
27607 + err = ip_v4_find_src(net, nxi, &rt, &fl);
27611 err = ip_route_output_flow(net, &rt, &fl, sk, 1);
27613 if (err == -ENETUNREACH)
27614 @@ -1183,7 +1193,8 @@ try_again:
27616 sin->sin_family = AF_INET;
27617 sin->sin_port = udp_hdr(skb)->source;
27618 - sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
27619 + sin->sin_addr.s_addr = nx_map_sock_lback(
27620 + skb->sk->sk_nx_info, ip_hdr(skb)->saddr);
27621 memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
27623 if (inet->cmsg_flags)
27624 @@ -1879,6 +1890,8 @@ static struct sock *udp_get_first(struct
27625 sk_nulls_for_each(sk, node, &hslot->head) {
27626 if (!net_eq(sock_net(sk), net))
27628 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27630 if (sk->sk_family == state->family)
27633 @@ -1896,7 +1909,9 @@ static struct sock *udp_get_next(struct
27636 sk = sk_nulls_next(sk);
27637 - } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family));
27638 + } while (sk && (!net_eq(sock_net(sk), net) ||
27639 + sk->sk_family != state->family ||
27640 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
27643 if (state->bucket <= state->udp_table->mask)
27644 @@ -2003,7 +2018,10 @@ static void udp4_format_sock(struct sock
27646 seq_printf(f, "%5d: %08X:%04X %08X:%04X"
27647 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n",
27648 - bucket, src, srcp, dest, destp, sp->sk_state,
27650 + nx_map_sock_lback(current_nx_info(), src), srcp,
27651 + nx_map_sock_lback(current_nx_info(), dest), destp,
27653 sk_wmem_alloc_get(sp),
27654 sk_rmem_alloc_get(sp),
27655 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
27656 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/addrconf.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/addrconf.c
27657 --- linux-2.6.35.2/net/ipv6/addrconf.c 2010-08-02 16:52:59.000000000 +0200
27658 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/addrconf.c 2010-08-02 17:05:06.000000000 +0200
27661 #include <linux/proc_fs.h>
27662 #include <linux/seq_file.h>
27663 +#include <linux/vs_network.h>
27664 +#include <linux/vs_inet6.h>
27666 /* Set to 3 to get tracing... */
27667 #define ACONF_DEBUG 2
27668 @@ -1117,7 +1119,7 @@ out:
27670 int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
27671 const struct in6_addr *daddr, unsigned int prefs,
27672 - struct in6_addr *saddr)
27673 + struct in6_addr *saddr, struct nx_info *nxi)
27675 struct ipv6_saddr_score scores[2],
27676 *score = &scores[0], *hiscore = &scores[1];
27677 @@ -1189,6 +1191,8 @@ int ipv6_dev_get_saddr(struct net *net,
27681 + if (!v6_addr_in_nx_info(nxi, &score->ifa->addr, -1))
27685 bitmap_zero(score->scorebits, IPV6_SADDR_RULE_MAX);
27686 @@ -3074,7 +3078,10 @@ static void if6_seq_stop(struct seq_file
27687 static int if6_seq_show(struct seq_file *seq, void *v)
27689 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
27690 - seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
27692 + if (nx_check(0, VS_ADMIN|VS_WATCH) ||
27693 + v6_addr_in_nx_info(current_nx_info(), &ifp->addr, -1))
27694 + seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
27696 ifp->idev->dev->ifindex,
27698 @@ -3578,6 +3585,11 @@ static int in6_dump_addrs(struct inet6_d
27699 struct ifacaddr6 *ifaca;
27701 int ip_idx = *p_ip_idx;
27702 + struct nx_info *nxi = skb->sk ? skb->sk->sk_nx_info : NULL;
27704 + /* disable ipv6 on non v6 guests */
27705 + if (nxi && !nx_info_has_v6(nxi))
27708 read_lock_bh(&idev->lock);
27710 @@ -3588,6 +3600,8 @@ static int in6_dump_addrs(struct inet6_d
27711 list_for_each_entry(ifa, &idev->addr_list, if_list) {
27712 if (++ip_idx < s_ip_idx)
27714 + if (!v6_addr_in_nx_info(nxi, &ifa->addr, -1))
27716 err = inet6_fill_ifaddr(skb, ifa,
27717 NETLINK_CB(cb->skb).pid,
27718 cb->nlh->nlmsg_seq,
27719 @@ -3604,6 +3618,8 @@ static int in6_dump_addrs(struct inet6_d
27720 ifmca = ifmca->next, ip_idx++) {
27721 if (ip_idx < s_ip_idx)
27723 + if (!v6_addr_in_nx_info(nxi, &ifmca->mca_addr, -1))
27725 err = inet6_fill_ifmcaddr(skb, ifmca,
27726 NETLINK_CB(cb->skb).pid,
27727 cb->nlh->nlmsg_seq,
27728 @@ -3619,6 +3635,8 @@ static int in6_dump_addrs(struct inet6_d
27729 ifaca = ifaca->aca_next, ip_idx++) {
27730 if (ip_idx < s_ip_idx)
27732 + if (!v6_addr_in_nx_info(nxi, &ifaca->aca_addr, -1))
27734 err = inet6_fill_ifacaddr(skb, ifaca,
27735 NETLINK_CB(cb->skb).pid,
27736 cb->nlh->nlmsg_seq,
27737 @@ -3950,6 +3968,11 @@ static int inet6_dump_ifinfo(struct sk_b
27738 struct inet6_dev *idev;
27739 struct hlist_head *head;
27740 struct hlist_node *node;
27741 + struct nx_info *nxi = skb->sk ? skb->sk->sk_nx_info : NULL;
27743 + /* FIXME: maybe disable ipv6 on non v6 guests?
27744 + if (skb->sk && skb->sk->sk_vx_info)
27745 + return skb->len; */
27748 s_idx = cb->args[1];
27749 @@ -3961,6 +3984,8 @@ static int inet6_dump_ifinfo(struct sk_b
27750 hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
27753 + if (!v6_dev_in_nx_info(dev, nxi))
27755 idev = __in6_dev_get(dev);
27758 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/af_inet6.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/af_inet6.c
27759 --- linux-2.6.35.2/net/ipv6/af_inet6.c 2010-08-02 16:52:59.000000000 +0200
27760 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/af_inet6.c 2010-08-02 17:05:06.000000000 +0200
27762 #include <linux/netdevice.h>
27763 #include <linux/icmpv6.h>
27764 #include <linux/netfilter_ipv6.h>
27765 +#include <linux/vs_inet.h>
27766 +#include <linux/vs_inet6.h>
27768 #include <net/ip.h>
27769 #include <net/ipv6.h>
27770 @@ -160,9 +162,12 @@ lookup_protocol:
27774 + if ((protocol == IPPROTO_ICMPV6) &&
27775 + nx_capable(CAP_NET_RAW, NXC_RAW_ICMP))
27777 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
27778 goto out_rcu_unlock;
27781 sock->ops = answer->ops;
27782 answer_prot = answer->prot;
27783 answer_no_check = answer->no_check;
27784 @@ -261,6 +266,7 @@ int inet6_bind(struct socket *sock, stru
27785 struct inet_sock *inet = inet_sk(sk);
27786 struct ipv6_pinfo *np = inet6_sk(sk);
27787 struct net *net = sock_net(sk);
27788 + struct nx_v6_sock_addr nsa;
27790 unsigned short snum;
27792 @@ -272,6 +278,11 @@ int inet6_bind(struct socket *sock, stru
27794 if (addr_len < SIN6_LEN_RFC2133)
27797 + err = v6_map_sock_addr(inet, addr, &nsa);
27801 addr_type = ipv6_addr_type(&addr->sin6_addr);
27802 if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM)
27804 @@ -303,6 +314,7 @@ int inet6_bind(struct socket *sock, stru
27805 /* Reproduce AF_INET checks to make the bindings consitant */
27806 v4addr = addr->sin6_addr.s6_addr32[3];
27807 chk_addr_ret = inet_addr_type(net, v4addr);
27809 if (!sysctl_ip_nonlocal_bind &&
27810 !(inet->freebind || inet->transparent) &&
27811 v4addr != htonl(INADDR_ANY) &&
27812 @@ -312,6 +324,10 @@ int inet6_bind(struct socket *sock, stru
27813 err = -EADDRNOTAVAIL;
27816 + if (!v4_addr_in_nx_info(sk->sk_nx_info, v4addr, NXA_MASK_BIND)) {
27817 + err = -EADDRNOTAVAIL;
27821 if (addr_type != IPV6_ADDR_ANY) {
27822 struct net_device *dev = NULL;
27823 @@ -338,6 +354,11 @@ int inet6_bind(struct socket *sock, stru
27827 + if (!v6_addr_in_nx_info(sk->sk_nx_info, &addr->sin6_addr, -1)) {
27828 + err = -EADDRNOTAVAIL;
27832 /* ipv4 addr of the socket is invalid. Only the
27833 * unspecified and mapped address have a v4 equivalent.
27835 @@ -353,6 +374,9 @@ int inet6_bind(struct socket *sock, stru
27839 + /* what's that for? */
27840 + v6_set_sock_addr(inet, &nsa);
27842 inet->inet_rcv_saddr = v4addr;
27843 inet->inet_saddr = v4addr;
27845 @@ -454,9 +478,11 @@ int inet6_getname(struct socket *sock, s
27847 sin->sin6_port = inet->inet_dport;
27848 ipv6_addr_copy(&sin->sin6_addr, &np->daddr);
27849 + /* FIXME: remap lback? */
27851 sin->sin6_flowinfo = np->flow_label;
27853 + /* FIXME: remap lback? */
27854 if (ipv6_addr_any(&np->rcv_saddr))
27855 ipv6_addr_copy(&sin->sin6_addr, &np->saddr);
27857 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/fib6_rules.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/fib6_rules.c
27858 --- linux-2.6.35.2/net/ipv6/fib6_rules.c 2010-08-02 16:52:59.000000000 +0200
27859 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/fib6_rules.c 2010-08-02 17:05:06.000000000 +0200
27860 @@ -89,7 +89,7 @@ static int fib6_rule_action(struct fib_r
27861 ip6_dst_idev(&rt->u.dst)->dev,
27863 rt6_flags2srcprefs(flags),
27867 if (!ipv6_prefix_equal(&saddr, &r->src.addr,
27869 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/inet6_hashtables.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/inet6_hashtables.c
27870 --- linux-2.6.35.2/net/ipv6/inet6_hashtables.c 2010-02-25 11:52:10.000000000 +0100
27871 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/inet6_hashtables.c 2010-08-02 17:05:06.000000000 +0200
27874 #include <linux/module.h>
27875 #include <linux/random.h>
27876 +#include <linux/vs_inet6.h>
27878 #include <net/inet_connection_sock.h>
27879 #include <net/inet_hashtables.h>
27880 @@ -82,7 +83,6 @@ struct sock *__inet6_lookup_established(
27881 unsigned int slot = hash & hashinfo->ehash_mask;
27882 struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
27887 sk_nulls_for_each_rcu(sk, node, &head->chain) {
27888 @@ -94,7 +94,7 @@ begin:
27896 if (get_nulls_value(node) != slot)
27897 @@ -140,6 +140,9 @@ static int inline compute_score(struct s
27898 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
27902 + if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
27905 if (sk->sk_bound_dev_if) {
27906 if (sk->sk_bound_dev_if != dif)
27907 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/ip6_output.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/ip6_output.c
27908 --- linux-2.6.35.2/net/ipv6/ip6_output.c 2010-08-02 16:52:59.000000000 +0200
27909 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/ip6_output.c 2010-08-02 17:05:06.000000000 +0200
27910 @@ -930,7 +930,7 @@ static int ip6_dst_lookup_tail(struct so
27911 err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev,
27913 sk ? inet6_sk(sk)->srcprefs : 0,
27915 + &fl->fl6_src, sk->sk_nx_info);
27917 goto out_err_release;
27919 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/Kconfig linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/Kconfig
27920 --- linux-2.6.35.2/net/ipv6/Kconfig 2010-08-02 16:52:59.000000000 +0200
27921 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/Kconfig 2010-08-02 17:05:06.000000000 +0200
27924 # IPv6 as module will cause a CRASH if you try to unload it
27926 - tristate "The IPv6 protocol"
27928 + bool "The IPv6 protocol"
27931 This is complemental support for the IP version 6.
27932 You will still be able to do traditional IPv4 networking as well.
27933 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/ndisc.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/ndisc.c
27934 --- linux-2.6.35.2/net/ipv6/ndisc.c 2010-08-02 16:53:00.000000000 +0200
27935 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/ndisc.c 2010-08-02 17:05:06.000000000 +0200
27936 @@ -591,7 +591,7 @@ static void ndisc_send_na(struct net_dev
27938 if (ipv6_dev_get_saddr(dev_net(dev), dev, daddr,
27939 inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs,
27941 + &tmpaddr, NULL /* FIXME: ? */ ))
27943 src_addr = &tmpaddr;
27945 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/raw.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/raw.c
27946 --- linux-2.6.35.2/net/ipv6/raw.c 2010-08-02 16:53:00.000000000 +0200
27947 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/raw.c 2010-08-02 17:05:06.000000000 +0200
27949 #include <linux/icmpv6.h>
27950 #include <linux/netfilter.h>
27951 #include <linux/netfilter_ipv6.h>
27952 +#include <linux/vs_inet6.h>
27953 #include <linux/skbuff.h>
27954 #include <asm/uaccess.h>
27955 #include <asm/ioctls.h>
27956 @@ -283,6 +284,13 @@ static int rawv6_bind(struct sock *sk, s
27960 + if (!v6_addr_in_nx_info(sk->sk_nx_info, &addr->sin6_addr, -1)) {
27961 + err = -EADDRNOTAVAIL;
27967 /* ipv4 addr of the socket is invalid. Only the
27968 * unspecified and mapped address have a v4 equivalent.
27970 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/route.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/route.c
27971 --- linux-2.6.35.2/net/ipv6/route.c 2010-08-02 16:53:00.000000000 +0200
27972 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/route.c 2010-08-02 17:05:06.000000000 +0200
27973 @@ -2255,7 +2255,8 @@ static int rt6_fill_node(struct net *net
27974 struct inet6_dev *idev = ip6_dst_idev(&rt->u.dst);
27975 struct in6_addr saddr_buf;
27976 if (ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
27977 - dst, 0, &saddr_buf) == 0)
27978 + dst, 0, &saddr_buf,
27979 + (skb->sk ? skb->sk->sk_nx_info : NULL)) == 0)
27980 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
27983 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/tcp_ipv6.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/tcp_ipv6.c
27984 --- linux-2.6.35.2/net/ipv6/tcp_ipv6.c 2010-08-02 16:53:00.000000000 +0200
27985 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/tcp_ipv6.c 2010-08-02 17:05:06.000000000 +0200
27988 #include <linux/crypto.h>
27989 #include <linux/scatterlist.h>
27990 +#include <linux/vs_inet6.h>
27992 static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb);
27993 static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
27994 @@ -160,8 +161,15 @@ static int tcp_v6_connect(struct sock *s
27995 * connect() to INADDR_ANY means loopback (BSD'ism).
27998 - if(ipv6_addr_any(&usin->sin6_addr))
27999 - usin->sin6_addr.s6_addr[15] = 0x1;
28000 + if(ipv6_addr_any(&usin->sin6_addr)) {
28001 + struct nx_info *nxi = sk->sk_nx_info;
28003 + if (nxi && nx_info_has_v6(nxi))
28004 + /* FIXME: remap lback? */
28005 + usin->sin6_addr = nxi->v6.ip;
28007 + usin->sin6_addr.s6_addr[15] = 0x1;
28010 addr_type = ipv6_addr_type(&usin->sin6_addr);
28012 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/udp.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/udp.c
28013 --- linux-2.6.35.2/net/ipv6/udp.c 2010-08-02 16:53:00.000000000 +0200
28014 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/udp.c 2010-08-02 17:05:06.000000000 +0200
28015 @@ -48,13 +48,14 @@
28017 #include <linux/proc_fs.h>
28018 #include <linux/seq_file.h>
28019 +#include <linux/vs_inet6.h>
28020 #include "udp_impl.h"
28022 int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
28024 const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr;
28025 const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2);
28026 - __be32 sk1_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
28027 + __be32 sk_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
28028 __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
28029 int sk_ipv6only = ipv6_only_sock(sk);
28030 int sk2_ipv6only = inet_v6_ipv6only(sk2);
28031 @@ -62,24 +63,49 @@ int ipv6_rcv_saddr_equal(const struct so
28032 int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
28034 /* if both are mapped, treat as IPv4 */
28035 - if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED)
28036 - return (!sk2_ipv6only &&
28037 - (!sk1_rcv_saddr || !sk2_rcv_saddr ||
28038 - sk1_rcv_saddr == sk2_rcv_saddr));
28039 + if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) {
28040 + if (!sk2_ipv6only &&
28041 + (!sk_rcv_saddr || !sk2_rcv_saddr ||
28042 + sk_rcv_saddr == sk2_rcv_saddr))
28048 if (addr_type2 == IPV6_ADDR_ANY &&
28049 !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
28053 if (addr_type == IPV6_ADDR_ANY &&
28054 !(sk_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
28058 if (sk2_rcv_saddr6 &&
28059 ipv6_addr_equal(sk_rcv_saddr6, sk2_rcv_saddr6))
28066 + if (!sk_rcv_saddr && !sk2_rcv_saddr)
28067 + return nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28068 + if (!sk2_rcv_saddr)
28069 + return v4_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr, -1);
28070 + if (!sk_rcv_saddr)
28071 + return v4_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr, -1);
28074 + if (addr_type2 == IPV6_ADDR_ANY && addr_type == IPV6_ADDR_ANY)
28075 + return nx_v6_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28076 + else if (addr_type2 == IPV6_ADDR_ANY)
28077 + return v6_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr6, -1);
28078 + else if (addr_type == IPV6_ADDR_ANY) {
28079 + if (addr_type2 == IPV6_ADDR_MAPPED)
28080 + return nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28082 + return v6_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr6, -1);
28087 static unsigned int udp6_portaddr_hash(struct net *net,
28088 @@ -134,6 +160,10 @@ static inline int compute_score(struct s
28089 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
28093 + /* block non nx_info ips */
28094 + if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
28097 if (!ipv6_addr_any(&np->daddr)) {
28098 if (!ipv6_addr_equal(&np->daddr, saddr))
28099 diff -NurpP --minimal linux-2.6.35.2/net/ipv6/xfrm6_policy.c linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/xfrm6_policy.c
28100 --- linux-2.6.35.2/net/ipv6/xfrm6_policy.c 2010-08-02 16:53:00.000000000 +0200
28101 +++ linux-2.6.35.2-vs2.3.0.36.31/net/ipv6/xfrm6_policy.c 2010-08-02 17:05:06.000000000 +0200
28102 @@ -62,7 +62,7 @@ static int xfrm6_get_saddr(struct net *n
28103 dev = ip6_dst_idev(dst)->dev;
28104 ipv6_dev_get_saddr(dev_net(dev), dev,
28105 (struct in6_addr *)&daddr->a6, 0,
28106 - (struct in6_addr *)&saddr->a6);
28107 + (struct in6_addr *)&saddr->a6, NULL);
28111 diff -NurpP --minimal linux-2.6.35.2/net/netlink/af_netlink.c linux-2.6.35.2-vs2.3.0.36.31/net/netlink/af_netlink.c
28112 --- linux-2.6.35.2/net/netlink/af_netlink.c 2010-08-02 16:53:01.000000000 +0200
28113 +++ linux-2.6.35.2-vs2.3.0.36.31/net/netlink/af_netlink.c 2010-08-02 17:05:06.000000000 +0200
28115 #include <linux/types.h>
28116 #include <linux/audit.h>
28117 #include <linux/mutex.h>
28118 +#include <linux/vs_context.h>
28119 +#include <linux/vs_network.h>
28120 +#include <linux/vs_limit.h>
28122 #include <net/net_namespace.h>
28123 #include <net/sock.h>
28124 @@ -1936,6 +1939,8 @@ static struct sock *netlink_seq_socket_i
28125 sk_for_each(s, node, &hash->table[j]) {
28126 if (sock_net(s) != seq_file_net(seq))
28128 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
28132 iter->hash_idx = j;
28133 @@ -1970,7 +1975,8 @@ static void *netlink_seq_next(struct seq
28137 - } while (s && sock_net(s) != seq_file_net(seq));
28138 + } while (s && (sock_net(s) != seq_file_net(seq) ||
28139 + !nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT)));
28143 @@ -1982,7 +1988,8 @@ static void *netlink_seq_next(struct seq
28145 for (; j <= hash->mask; j++) {
28146 s = sk_head(&hash->table[j]);
28147 - while (s && sock_net(s) != seq_file_net(seq))
28148 + while (s && (sock_net(s) != seq_file_net(seq) ||
28149 + !nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT)))
28153 diff -NurpP --minimal linux-2.6.35.2/net/sctp/ipv6.c linux-2.6.35.2-vs2.3.0.36.31/net/sctp/ipv6.c
28154 --- linux-2.6.35.2/net/sctp/ipv6.c 2010-08-02 16:53:01.000000000 +0200
28155 +++ linux-2.6.35.2-vs2.3.0.36.31/net/sctp/ipv6.c 2010-08-02 17:05:06.000000000 +0200
28156 @@ -304,7 +304,8 @@ static void sctp_v6_get_saddr(struct sct
28157 dst ? ip6_dst_idev(dst)->dev : NULL,
28158 &daddr->v6.sin6_addr,
28159 inet6_sk(&sk->inet.sk)->srcprefs,
28160 - &saddr->v6.sin6_addr);
28161 + &saddr->v6.sin6_addr,
28162 + asoc->base.sk->sk_nx_info);
28163 SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: %pI6\n",
28164 &saddr->v6.sin6_addr);
28166 diff -NurpP --minimal linux-2.6.35.2/net/socket.c linux-2.6.35.2-vs2.3.0.36.31/net/socket.c
28167 --- linux-2.6.35.2/net/socket.c 2010-08-02 16:53:02.000000000 +0200
28168 +++ linux-2.6.35.2-vs2.3.0.36.31/net/socket.c 2010-08-02 17:05:06.000000000 +0200
28171 #include <net/sock.h>
28172 #include <linux/netfilter.h>
28173 +#include <linux/vs_base.h>
28174 +#include <linux/vs_socket.h>
28175 +#include <linux/vs_inet.h>
28176 +#include <linux/vs_inet6.h>
28178 #include <linux/if_tun.h>
28179 #include <linux/ipv6_route.h>
28180 @@ -557,7 +561,7 @@ static inline int __sock_sendmsg(struct
28181 struct msghdr *msg, size_t size)
28183 struct sock_iocb *si = kiocb_to_siocb(iocb);
28187 sock_update_classid(sock->sk);
28189 @@ -570,7 +574,22 @@ static inline int __sock_sendmsg(struct
28193 - return sock->ops->sendmsg(iocb, sock, msg, size);
28194 + len = sock->ops->sendmsg(iocb, sock, msg, size);
28197 + vx_sock_send(sock->sk, size);
28199 + vx_sock_fail(sock->sk, size);
28201 + vxdprintk(VXD_CBIT(net, 7),
28202 + "__sock_sendmsg: %p[%p,%p,%p;%d/%d]:%d/%d",
28204 + (sock->sk)?sock->sk->sk_nx_info:0,
28205 + (sock->sk)?sock->sk->sk_vx_info:0,
28206 + (sock->sk)?sock->sk->sk_xid:0,
28207 + (sock->sk)?sock->sk->sk_nid:0,
28208 + (unsigned int)size, len);
28212 int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
28213 @@ -686,6 +705,7 @@ static inline int __sock_recvmsg_nosec(s
28214 struct msghdr *msg, size_t size, int flags)
28216 struct sock_iocb *si = kiocb_to_siocb(iocb);
28219 sock_update_classid(sock->sk);
28221 @@ -695,7 +715,18 @@ static inline int __sock_recvmsg_nosec(s
28225 - return sock->ops->recvmsg(iocb, sock, msg, size, flags);
28226 + len = sock->ops->recvmsg(iocb, sock, msg, size, flags);
28227 + if ((len >= 0) && sock->sk)
28228 + vx_sock_recv(sock->sk, len);
28229 + vxdprintk(VXD_CBIT(net, 7),
28230 + "__sock_recvmsg: %p[%p,%p,%p;%d/%d]:%d/%d",
28232 + (sock->sk)?sock->sk->sk_nx_info:0,
28233 + (sock->sk)?sock->sk->sk_vx_info:0,
28234 + (sock->sk)?sock->sk->sk_xid:0,
28235 + (sock->sk)?sock->sk->sk_nid:0,
28236 + (unsigned int)size, len);
28240 static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock,
28241 @@ -1163,6 +1194,13 @@ static int __sock_create(struct net *net
28242 if (type < 0 || type >= SOCK_MAX)
28245 + if (!nx_check(0, VS_ADMIN)) {
28246 + if (family == PF_INET && !current_nx_info_has_v4())
28247 + return -EAFNOSUPPORT;
28248 + if (family == PF_INET6 && !current_nx_info_has_v6())
28249 + return -EAFNOSUPPORT;
28254 This uglymoron is moved from INET layer to here to avoid
28255 @@ -1295,6 +1333,7 @@ SYSCALL_DEFINE3(socket, int, family, int
28259 + set_bit(SOCK_USER_SOCKET, &sock->flags);
28260 retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
28263 @@ -1336,10 +1375,12 @@ SYSCALL_DEFINE4(socketpair, int, family,
28264 err = sock_create(family, type, protocol, &sock1);
28267 + set_bit(SOCK_USER_SOCKET, &sock1->flags);
28269 err = sock_create(family, type, protocol, &sock2);
28271 goto out_release_1;
28272 + set_bit(SOCK_USER_SOCKET, &sock2->flags);
28274 err = sock1->ops->socketpair(sock1, sock2);
28276 diff -NurpP --minimal linux-2.6.35.2/net/sunrpc/auth.c linux-2.6.35.2-vs2.3.0.36.31/net/sunrpc/auth.c
28277 --- linux-2.6.35.2/net/sunrpc/auth.c 2010-08-02 16:53:02.000000000 +0200
28278 +++ linux-2.6.35.2-vs2.3.0.36.31/net/sunrpc/auth.c 2010-08-02 17:05:06.000000000 +0200
28280 #include <linux/hash.h>
28281 #include <linux/sunrpc/clnt.h>
28282 #include <linux/spinlock.h>
28283 +#include <linux/vs_tag.h>
28286 # define RPCDBG_FACILITY RPCDBG_AUTH
28287 @@ -366,6 +367,7 @@ rpcauth_lookupcred(struct rpc_auth *auth
28288 memset(&acred, 0, sizeof(acred));
28289 acred.uid = cred->fsuid;
28290 acred.gid = cred->fsgid;
28291 + acred.tag = dx_current_tag();
28292 acred.group_info = get_group_info(((struct cred *)cred)->group_info);
28294 ret = auth->au_ops->lookup_cred(auth, &acred, flags);
28295 @@ -406,6 +408,7 @@ rpcauth_bind_root_cred(struct rpc_task *
28296 struct auth_cred acred = {
28299 + .tag = dx_current_tag(),
28301 struct rpc_cred *ret;
28303 diff -NurpP --minimal linux-2.6.35.2/net/sunrpc/auth_unix.c linux-2.6.35.2-vs2.3.0.36.31/net/sunrpc/auth_unix.c
28304 --- linux-2.6.35.2/net/sunrpc/auth_unix.c 2010-07-07 18:32:01.000000000 +0200
28305 +++ linux-2.6.35.2-vs2.3.0.36.31/net/sunrpc/auth_unix.c 2010-08-02 17:05:06.000000000 +0200
28306 @@ -12,12 +12,14 @@
28307 #include <linux/module.h>
28308 #include <linux/sunrpc/clnt.h>
28309 #include <linux/sunrpc/auth.h>
28310 +#include <linux/vs_tag.h>
28312 #define NFS_NGROUPS 16
28315 struct rpc_cred uc_base;
28318 gid_t uc_gids[NFS_NGROUPS];
28320 #define uc_uid uc_base.cr_uid
28321 @@ -79,6 +81,7 @@ unx_create_cred(struct rpc_auth *auth, s
28322 groups = NFS_NGROUPS;
28324 cred->uc_gid = acred->gid;
28325 + cred->uc_tag = acred->tag;
28326 for (i = 0; i < groups; i++)
28327 cred->uc_gids[i] = GROUP_AT(acred->group_info, i);
28328 if (i < NFS_NGROUPS)
28329 @@ -120,7 +123,9 @@ unx_match(struct auth_cred *acred, struc
28333 - if (cred->uc_uid != acred->uid || cred->uc_gid != acred->gid)
28334 + if (cred->uc_uid != acred->uid ||
28335 + cred->uc_gid != acred->gid ||
28336 + cred->uc_tag != acred->tag)
28339 if (acred->group_info != NULL)
28340 @@ -143,7 +148,7 @@ unx_marshal(struct rpc_task *task, __be3
28341 struct rpc_clnt *clnt = task->tk_client;
28342 struct unx_cred *cred = container_of(task->tk_msg.rpc_cred, struct unx_cred, uc_base);
28343 __be32 *base, *hold;
28347 *p++ = htonl(RPC_AUTH_UNIX);
28349 @@ -153,9 +158,12 @@ unx_marshal(struct rpc_task *task, __be3
28350 * Copy the UTS nodename captured when the client was created.
28352 p = xdr_encode_array(p, clnt->cl_nodename, clnt->cl_nodelen);
28353 + tag = task->tk_client->cl_tag;
28355 - *p++ = htonl((u32) cred->uc_uid);
28356 - *p++ = htonl((u32) cred->uc_gid);
28357 + *p++ = htonl((u32) TAGINO_UID(tag,
28358 + cred->uc_uid, cred->uc_tag));
28359 + *p++ = htonl((u32) TAGINO_GID(tag,
28360 + cred->uc_gid, cred->uc_tag));
28362 for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++)
28363 *p++ = htonl((u32) cred->uc_gids[i]);
28364 diff -NurpP --minimal linux-2.6.35.2/net/sunrpc/clnt.c linux-2.6.35.2-vs2.3.0.36.31/net/sunrpc/clnt.c
28365 --- linux-2.6.35.2/net/sunrpc/clnt.c 2010-08-02 16:53:02.000000000 +0200
28366 +++ linux-2.6.35.2-vs2.3.0.36.31/net/sunrpc/clnt.c 2010-08-02 17:05:06.000000000 +0200
28368 #include <linux/utsname.h>
28369 #include <linux/workqueue.h>
28370 #include <linux/in6.h>
28371 +#include <linux/vs_cvirt.h>
28373 #include <linux/sunrpc/clnt.h>
28374 #include <linux/sunrpc/rpc_pipe_fs.h>
28375 @@ -358,6 +359,9 @@ struct rpc_clnt *rpc_create(struct rpc_c
28376 if (!(args->flags & RPC_CLNT_CREATE_QUIET))
28377 clnt->cl_chatty = 1;
28379 + /* TODO: handle RPC_CLNT_CREATE_TAGGED
28380 + if (args->flags & RPC_CLNT_CREATE_TAGGED)
28381 + clnt->cl_tag = 1; */
28384 EXPORT_SYMBOL_GPL(rpc_create);
28385 diff -NurpP --minimal linux-2.6.35.2/net/unix/af_unix.c linux-2.6.35.2-vs2.3.0.36.31/net/unix/af_unix.c
28386 --- linux-2.6.35.2/net/unix/af_unix.c 2010-08-02 16:53:02.000000000 +0200
28387 +++ linux-2.6.35.2-vs2.3.0.36.31/net/unix/af_unix.c 2010-08-02 17:05:06.000000000 +0200
28388 @@ -114,6 +114,8 @@
28389 #include <linux/mount.h>
28390 #include <net/checksum.h>
28391 #include <linux/security.h>
28392 +#include <linux/vs_context.h>
28393 +#include <linux/vs_limit.h>
28395 static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
28396 static DEFINE_SPINLOCK(unix_table_lock);
28397 @@ -258,6 +260,8 @@ static struct sock *__unix_find_socket_b
28398 if (!net_eq(sock_net(s), net))
28401 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
28403 if (u->addr->len == len &&
28404 !memcmp(u->addr->name, sunname, len))
28406 @@ -2114,6 +2118,8 @@ static struct sock *unix_seq_idx(struct
28407 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) {
28408 if (sock_net(s) != seq_file_net(seq))
28410 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
28415 @@ -2138,7 +2144,8 @@ static void *unix_seq_next(struct seq_fi
28416 sk = first_unix_socket(&iter->i);
28418 sk = next_unix_socket(&iter->i, sk);
28419 - while (sk && (sock_net(sk) != seq_file_net(seq)))
28420 + while (sk && (sock_net(sk) != seq_file_net(seq) ||
28421 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)))
28422 sk = next_unix_socket(&iter->i, sk);
28425 diff -NurpP --minimal linux-2.6.35.2/net/x25/af_x25.c linux-2.6.35.2-vs2.3.0.36.31/net/x25/af_x25.c
28426 --- linux-2.6.35.2/net/x25/af_x25.c 2010-08-02 16:53:02.000000000 +0200
28427 +++ linux-2.6.35.2-vs2.3.0.36.31/net/x25/af_x25.c 2010-08-02 17:05:06.000000000 +0200
28428 @@ -568,7 +568,10 @@ static int x25_create(struct net *net, s
28432 - sock_init_data(sock, sk);
28433 + sk->sk_socket = sock;
28434 + sk->sk_type = sock->type;
28435 + sk->sk_sleep = &sock->wait;
28438 x25_init_timers(sk);
28440 diff -NurpP --minimal linux-2.6.35.2/scripts/checksyscalls.sh linux-2.6.35.2-vs2.3.0.36.31/scripts/checksyscalls.sh
28441 --- linux-2.6.35.2/scripts/checksyscalls.sh 2009-09-10 15:26:31.000000000 +0200
28442 +++ linux-2.6.35.2-vs2.3.0.36.31/scripts/checksyscalls.sh 2010-08-02 17:05:06.000000000 +0200
28443 @@ -194,7 +194,6 @@ cat << EOF
28444 #define __IGNORE_afs_syscall
28445 #define __IGNORE_getpmsg
28446 #define __IGNORE_putpmsg
28447 -#define __IGNORE_vserver
28451 diff -NurpP --minimal linux-2.6.35.2/security/commoncap.c linux-2.6.35.2-vs2.3.0.36.31/security/commoncap.c
28452 --- linux-2.6.35.2/security/commoncap.c 2010-08-02 16:53:03.000000000 +0200
28453 +++ linux-2.6.35.2-vs2.3.0.36.31/security/commoncap.c 2010-08-02 17:05:06.000000000 +0200
28455 #include <linux/prctl.h>
28456 #include <linux/securebits.h>
28457 #include <linux/syslog.h>
28458 +#include <linux/vs_context.h>
28461 * If a non-root user executes a setuid-root binary in
28462 @@ -53,7 +54,7 @@ static void warn_setuid_and_fcaps_mixed(
28464 int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
28466 - NETLINK_CB(skb).eff_cap = current_cap();
28467 + NETLINK_CB(skb).eff_cap = vx_mbcaps(current_cap());
28471 @@ -63,6 +64,7 @@ int cap_netlink_recv(struct sk_buff *skb
28476 EXPORT_SYMBOL(cap_netlink_recv);
28479 @@ -83,7 +85,22 @@ EXPORT_SYMBOL(cap_netlink_recv);
28480 int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap,
28483 - return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;
28484 + struct vx_info *vxi = tsk->vx_info;
28487 + printk("cap_capable() VXF_STATE_SETUP = %llx, raised = %x, eff = %08x:%08x\n",
28488 + vx_info_flags(vxi, VXF_STATE_SETUP, 0),
28489 + cap_raised(tsk->cap_effective, cap),
28490 + tsk->cap_effective.cap[1], tsk->cap_effective.cap[0]);
28493 + /* special case SETUP */
28494 + if (vx_info_flags(vxi, VXF_STATE_SETUP, 0) &&
28495 + /* FIXME: maybe use cred instead? */
28496 + cap_raised(tsk->cred->cap_effective, cap))
28499 + return vx_cap_raised(vxi, cred->cap_effective, cap) ? 0 : -EPERM;
28503 @@ -571,7 +588,7 @@ int cap_inode_setxattr(struct dentry *de
28505 if (!strncmp(name, XATTR_SECURITY_PREFIX,
28506 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
28507 - !capable(CAP_SYS_ADMIN))
28508 + !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
28512 @@ -597,7 +614,7 @@ int cap_inode_removexattr(struct dentry
28514 if (!strncmp(name, XATTR_SECURITY_PREFIX,
28515 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
28516 - !capable(CAP_SYS_ADMIN))
28517 + !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
28521 @@ -899,7 +916,8 @@ int cap_syslog(int type, bool from_file)
28522 if (type != SYSLOG_ACTION_OPEN && from_file)
28524 if ((type != SYSLOG_ACTION_READ_ALL &&
28525 - type != SYSLOG_ACTION_SIZE_BUFFER) && !capable(CAP_SYS_ADMIN))
28526 + type != SYSLOG_ACTION_SIZE_BUFFER) &&
28527 + !vx_capable(CAP_SYS_ADMIN, VXC_SYSLOG))
28531 @@ -951,3 +969,4 @@ int cap_file_mmap(struct file *file, uns
28536 diff -NurpP --minimal linux-2.6.35.2/security/selinux/av_permissions.h linux-2.6.35.2-vs2.3.0.36.31/security/selinux/av_permissions.h
28537 --- linux-2.6.35.2/security/selinux/av_permissions.h 1970-01-01 01:00:00.000000000 +0100
28538 +++ linux-2.6.35.2-vs2.3.0.36.31/security/selinux/av_permissions.h 2010-08-02 17:05:06.000000000 +0200
28540 +/* This file is automatically generated. Do not edit. */
28541 +#ifndef _SELINUX_AV_PERMISSIONS_H_
28542 +#define _SELINUX_AV_PERMISSIONS_H_
28544 +#define SECURITY__COMPUTE_AV 0x00000001UL
28545 +#define SECURITY__COMPUTE_CREATE 0x00000002UL
28546 +#define SECURITY__COMPUTE_MEMBER 0x00000004UL
28547 +#define SECURITY__CHECK_CONTEXT 0x00000008UL
28548 +#define SECURITY__LOAD_POLICY 0x00000010UL
28549 +#define SECURITY__COMPUTE_RELABEL 0x00000020UL
28550 +#define SECURITY__COMPUTE_USER 0x00000040UL
28551 +#define SECURITY__SETENFORCE 0x00000080UL
28552 +#define SECURITY__SETBOOL 0x00000100UL
28553 +#define SECURITY__SETSECPARAM 0x00000200UL
28554 +#define SECURITY__SETCHECKREQPROT 0x00000400UL
28555 +#define PROCESS__FORK 0x00000001UL
28556 +#define PROCESS__TRANSITION 0x00000002UL
28557 +#define PROCESS__SIGCHLD 0x00000004UL
28558 +#define PROCESS__SIGKILL 0x00000008UL
28559 +#define PROCESS__SIGSTOP 0x00000010UL
28560 +#define PROCESS__SIGNULL 0x00000020UL
28561 +#define PROCESS__SIGNAL 0x00000040UL
28562 +#define PROCESS__PTRACE 0x00000080UL
28563 +#define PROCESS__GETSCHED 0x00000100UL
28564 +#define PROCESS__SETSCHED 0x00000200UL
28565 +#define PROCESS__GETSESSION 0x00000400UL
28566 +#define PROCESS__GETPGID 0x00000800UL
28567 +#define PROCESS__SETPGID 0x00001000UL
28568 +#define PROCESS__GETCAP 0x00002000UL
28569 +#define PROCESS__SETCAP 0x00004000UL
28570 +#define PROCESS__SHARE 0x00008000UL
28571 +#define PROCESS__GETATTR 0x00010000UL
28572 +#define PROCESS__SETEXEC 0x00020000UL
28573 +#define PROCESS__SETFSCREATE 0x00040000UL
28574 +#define PROCESS__NOATSECURE 0x00080000UL
28575 +#define PROCESS__SIGINH 0x00100000UL
28576 +#define PROCESS__SETRLIMIT 0x00200000UL
28577 +#define PROCESS__RLIMITINH 0x00400000UL
28578 +#define PROCESS__DYNTRANSITION 0x00800000UL
28579 +#define PROCESS__SETCURRENT 0x01000000UL
28580 +#define PROCESS__EXECMEM 0x02000000UL
28581 +#define PROCESS__EXECSTACK 0x04000000UL
28582 +#define PROCESS__EXECHEAP 0x08000000UL
28583 +#define PROCESS__SETKEYCREATE 0x10000000UL
28584 +#define PROCESS__SETSOCKCREATE 0x20000000UL
28585 +#define SYSTEM__IPC_INFO 0x00000001UL
28586 +#define SYSTEM__SYSLOG_READ 0x00000002UL
28587 +#define SYSTEM__SYSLOG_MOD 0x00000004UL
28588 +#define SYSTEM__SYSLOG_CONSOLE 0x00000008UL
28589 +#define SYSTEM__MODULE_REQUEST 0x00000010UL
28590 +#define CAPABILITY__CHOWN 0x00000001UL
28591 +#define CAPABILITY__DAC_OVERRIDE 0x00000002UL
28592 +#define CAPABILITY__DAC_READ_SEARCH 0x00000004UL
28593 +#define CAPABILITY__FOWNER 0x00000008UL
28594 +#define CAPABILITY__FSETID 0x00000010UL
28595 +#define CAPABILITY__KILL 0x00000020UL
28596 +#define CAPABILITY__SETGID 0x00000040UL
28597 +#define CAPABILITY__SETUID 0x00000080UL
28598 +#define CAPABILITY__SETPCAP 0x00000100UL
28599 +#define CAPABILITY__LINUX_IMMUTABLE 0x00000200UL
28600 +#define CAPABILITY__NET_BIND_SERVICE 0x00000400UL
28601 +#define CAPABILITY__NET_BROADCAST 0x00000800UL
28602 +#define CAPABILITY__NET_ADMIN 0x00001000UL
28603 +#define CAPABILITY__NET_RAW 0x00002000UL
28604 +#define CAPABILITY__IPC_LOCK 0x00004000UL
28605 +#define CAPABILITY__IPC_OWNER 0x00008000UL
28606 +#define CAPABILITY__SYS_MODULE 0x00010000UL
28607 +#define CAPABILITY__SYS_RAWIO 0x00020000UL
28608 +#define CAPABILITY__SYS_CHROOT 0x00040000UL
28609 +#define CAPABILITY__SYS_PTRACE 0x00080000UL
28610 +#define CAPABILITY__SYS_PACCT 0x00100000UL
28611 +#define CAPABILITY__SYS_ADMIN 0x00200000UL
28612 +#define CAPABILITY__SYS_BOOT 0x00400000UL
28613 +#define CAPABILITY__SYS_NICE 0x00800000UL
28614 +#define CAPABILITY__SYS_RESOURCE 0x01000000UL
28615 +#define CAPABILITY__SYS_TIME 0x02000000UL
28616 +#define CAPABILITY__SYS_TTY_CONFIG 0x04000000UL
28617 +#define CAPABILITY__MKNOD 0x08000000UL
28618 +#define CAPABILITY__LEASE 0x10000000UL
28619 +#define CAPABILITY__AUDIT_WRITE 0x20000000UL
28620 +#define CAPABILITY__AUDIT_CONTROL 0x40000000UL
28621 +#define CAPABILITY__SETFCAP 0x80000000UL
28622 +#define FILESYSTEM__MOUNT 0x00000001UL
28623 +#define FILESYSTEM__REMOUNT 0x00000002UL
28624 +#define FILESYSTEM__UNMOUNT 0x00000004UL
28625 +#define FILESYSTEM__GETATTR 0x00000008UL
28626 +#define FILESYSTEM__RELABELFROM 0x00000010UL
28627 +#define FILESYSTEM__RELABELTO 0x00000020UL
28628 +#define FILESYSTEM__TRANSITION 0x00000040UL
28629 +#define FILESYSTEM__ASSOCIATE 0x00000080UL
28630 +#define FILESYSTEM__QUOTAMOD 0x00000100UL
28631 +#define FILESYSTEM__QUOTAGET 0x00000200UL
28632 +#define FILE__IOCTL 0x00000001UL
28633 +#define FILE__READ 0x00000002UL
28634 +#define FILE__WRITE 0x00000004UL
28635 +#define FILE__CREATE 0x00000008UL
28636 +#define FILE__GETATTR 0x00000010UL
28637 +#define FILE__SETATTR 0x00000020UL
28638 +#define FILE__LOCK 0x00000040UL
28639 +#define FILE__RELABELFROM 0x00000080UL
28640 +#define FILE__RELABELTO 0x00000100UL
28641 +#define FILE__APPEND 0x00000200UL
28642 +#define FILE__UNLINK 0x00000400UL
28643 +#define FILE__LINK 0x00000800UL
28644 +#define FILE__RENAME 0x00001000UL
28645 +#define FILE__EXECUTE 0x00002000UL
28646 +#define FILE__SWAPON 0x00004000UL
28647 +#define FILE__QUOTAON 0x00008000UL
28648 +#define FILE__MOUNTON 0x00010000UL
28649 +#define FILE__EXECUTE_NO_TRANS 0x00020000UL
28650 +#define FILE__ENTRYPOINT 0x00040000UL
28651 +#define FILE__EXECMOD 0x00080000UL
28652 +#define FILE__OPEN 0x00100000UL
28653 +#define DIR__IOCTL 0x00000001UL
28654 +#define DIR__READ 0x00000002UL
28655 +#define DIR__WRITE 0x00000004UL
28656 +#define DIR__CREATE 0x00000008UL
28657 +#define DIR__GETATTR 0x00000010UL
28658 +#define DIR__SETATTR 0x00000020UL
28659 +#define DIR__LOCK 0x00000040UL
28660 +#define DIR__RELABELFROM 0x00000080UL
28661 +#define DIR__RELABELTO 0x00000100UL
28662 +#define DIR__APPEND 0x00000200UL
28663 +#define DIR__UNLINK 0x00000400UL
28664 +#define DIR__LINK 0x00000800UL
28665 +#define DIR__RENAME 0x00001000UL
28666 +#define DIR__EXECUTE 0x00002000UL
28667 +#define DIR__SWAPON 0x00004000UL
28668 +#define DIR__QUOTAON 0x00008000UL
28669 +#define DIR__MOUNTON 0x00010000UL
28670 +#define DIR__ADD_NAME 0x00020000UL
28671 +#define DIR__REMOVE_NAME 0x00040000UL
28672 +#define DIR__REPARENT 0x00080000UL
28673 +#define DIR__SEARCH 0x00100000UL
28674 +#define DIR__RMDIR 0x00200000UL
28675 +#define DIR__OPEN 0x00400000UL
28676 +#define FD__USE 0x00000001UL
28677 +#define LNK_FILE__IOCTL 0x00000001UL
28678 +#define LNK_FILE__READ 0x00000002UL
28679 +#define LNK_FILE__WRITE 0x00000004UL
28680 +#define LNK_FILE__CREATE 0x00000008UL
28681 +#define LNK_FILE__GETATTR 0x00000010UL
28682 +#define LNK_FILE__SETATTR 0x00000020UL
28683 +#define LNK_FILE__LOCK 0x00000040UL
28684 +#define LNK_FILE__RELABELFROM 0x00000080UL
28685 +#define LNK_FILE__RELABELTO 0x00000100UL
28686 +#define LNK_FILE__APPEND 0x00000200UL
28687 +#define LNK_FILE__UNLINK 0x00000400UL
28688 +#define LNK_FILE__LINK 0x00000800UL
28689 +#define LNK_FILE__RENAME 0x00001000UL
28690 +#define LNK_FILE__EXECUTE 0x00002000UL
28691 +#define LNK_FILE__SWAPON 0x00004000UL
28692 +#define LNK_FILE__QUOTAON 0x00008000UL
28693 +#define LNK_FILE__MOUNTON 0x00010000UL
28694 +#define CHR_FILE__IOCTL 0x00000001UL
28695 +#define CHR_FILE__READ 0x00000002UL
28696 +#define CHR_FILE__WRITE 0x00000004UL
28697 +#define CHR_FILE__CREATE 0x00000008UL
28698 +#define CHR_FILE__GETATTR 0x00000010UL
28699 +#define CHR_FILE__SETATTR 0x00000020UL
28700 +#define CHR_FILE__LOCK 0x00000040UL
28701 +#define CHR_FILE__RELABELFROM 0x00000080UL
28702 +#define CHR_FILE__RELABELTO 0x00000100UL
28703 +#define CHR_FILE__APPEND 0x00000200UL
28704 +#define CHR_FILE__UNLINK 0x00000400UL
28705 +#define CHR_FILE__LINK 0x00000800UL
28706 +#define CHR_FILE__RENAME 0x00001000UL
28707 +#define CHR_FILE__EXECUTE 0x00002000UL
28708 +#define CHR_FILE__SWAPON 0x00004000UL
28709 +#define CHR_FILE__QUOTAON 0x00008000UL
28710 +#define CHR_FILE__MOUNTON 0x00010000UL
28711 +#define CHR_FILE__EXECUTE_NO_TRANS 0x00020000UL
28712 +#define CHR_FILE__ENTRYPOINT 0x00040000UL
28713 +#define CHR_FILE__EXECMOD 0x00080000UL
28714 +#define CHR_FILE__OPEN 0x00100000UL
28715 +#define BLK_FILE__IOCTL 0x00000001UL
28716 +#define BLK_FILE__READ 0x00000002UL
28717 +#define BLK_FILE__WRITE 0x00000004UL
28718 +#define BLK_FILE__CREATE 0x00000008UL
28719 +#define BLK_FILE__GETATTR 0x00000010UL
28720 +#define BLK_FILE__SETATTR 0x00000020UL
28721 +#define BLK_FILE__LOCK 0x00000040UL
28722 +#define BLK_FILE__RELABELFROM 0x00000080UL
28723 +#define BLK_FILE__RELABELTO 0x00000100UL
28724 +#define BLK_FILE__APPEND 0x00000200UL
28725 +#define BLK_FILE__UNLINK 0x00000400UL
28726 +#define BLK_FILE__LINK 0x00000800UL
28727 +#define BLK_FILE__RENAME 0x00001000UL
28728 +#define BLK_FILE__EXECUTE 0x00002000UL
28729 +#define BLK_FILE__SWAPON 0x00004000UL
28730 +#define BLK_FILE__QUOTAON 0x00008000UL
28731 +#define BLK_FILE__MOUNTON 0x00010000UL
28732 +#define BLK_FILE__OPEN 0x00020000UL
28733 +#define SOCK_FILE__IOCTL 0x00000001UL
28734 +#define SOCK_FILE__READ 0x00000002UL
28735 +#define SOCK_FILE__WRITE 0x00000004UL
28736 +#define SOCK_FILE__CREATE 0x00000008UL
28737 +#define SOCK_FILE__GETATTR 0x00000010UL
28738 +#define SOCK_FILE__SETATTR 0x00000020UL
28739 +#define SOCK_FILE__LOCK 0x00000040UL
28740 +#define SOCK_FILE__RELABELFROM 0x00000080UL
28741 +#define SOCK_FILE__RELABELTO 0x00000100UL
28742 +#define SOCK_FILE__APPEND 0x00000200UL
28743 +#define SOCK_FILE__UNLINK 0x00000400UL
28744 +#define SOCK_FILE__LINK 0x00000800UL
28745 +#define SOCK_FILE__RENAME 0x00001000UL
28746 +#define SOCK_FILE__EXECUTE 0x00002000UL
28747 +#define SOCK_FILE__SWAPON 0x00004000UL
28748 +#define SOCK_FILE__QUOTAON 0x00008000UL
28749 +#define SOCK_FILE__MOUNTON 0x00010000UL
28750 +#define SOCK_FILE__OPEN 0x00020000UL
28751 +#define FIFO_FILE__IOCTL 0x00000001UL
28752 +#define FIFO_FILE__READ 0x00000002UL
28753 +#define FIFO_FILE__WRITE 0x00000004UL
28754 +#define FIFO_FILE__CREATE 0x00000008UL
28755 +#define FIFO_FILE__GETATTR 0x00000010UL
28756 +#define FIFO_FILE__SETATTR 0x00000020UL
28757 +#define FIFO_FILE__LOCK 0x00000040UL
28758 +#define FIFO_FILE__RELABELFROM 0x00000080UL
28759 +#define FIFO_FILE__RELABELTO 0x00000100UL
28760 +#define FIFO_FILE__APPEND 0x00000200UL
28761 +#define FIFO_FILE__UNLINK 0x00000400UL
28762 +#define FIFO_FILE__LINK 0x00000800UL
28763 +#define FIFO_FILE__RENAME 0x00001000UL
28764 +#define FIFO_FILE__EXECUTE 0x00002000UL
28765 +#define FIFO_FILE__SWAPON 0x00004000UL
28766 +#define FIFO_FILE__QUOTAON 0x00008000UL
28767 +#define FIFO_FILE__MOUNTON 0x00010000UL
28768 +#define FIFO_FILE__OPEN 0x00020000UL
28769 +#define SOCKET__IOCTL 0x00000001UL
28770 +#define SOCKET__READ 0x00000002UL
28771 +#define SOCKET__WRITE 0x00000004UL
28772 +#define SOCKET__CREATE 0x00000008UL
28773 +#define SOCKET__GETATTR 0x00000010UL
28774 +#define SOCKET__SETATTR 0x00000020UL
28775 +#define SOCKET__LOCK 0x00000040UL
28776 +#define SOCKET__RELABELFROM 0x00000080UL
28777 +#define SOCKET__RELABELTO 0x00000100UL
28778 +#define SOCKET__APPEND 0x00000200UL
28779 +#define SOCKET__BIND 0x00000400UL
28780 +#define SOCKET__CONNECT 0x00000800UL
28781 +#define SOCKET__LISTEN 0x00001000UL
28782 +#define SOCKET__ACCEPT 0x00002000UL
28783 +#define SOCKET__GETOPT 0x00004000UL
28784 +#define SOCKET__SETOPT 0x00008000UL
28785 +#define SOCKET__SHUTDOWN 0x00010000UL
28786 +#define SOCKET__RECVFROM 0x00020000UL
28787 +#define SOCKET__SENDTO 0x00040000UL
28788 +#define SOCKET__RECV_MSG 0x00080000UL
28789 +#define SOCKET__SEND_MSG 0x00100000UL
28790 +#define SOCKET__NAME_BIND 0x00200000UL
28791 +#define TCP_SOCKET__IOCTL 0x00000001UL
28792 +#define TCP_SOCKET__READ 0x00000002UL
28793 +#define TCP_SOCKET__WRITE 0x00000004UL
28794 +#define TCP_SOCKET__CREATE 0x00000008UL
28795 +#define TCP_SOCKET__GETATTR 0x00000010UL
28796 +#define TCP_SOCKET__SETATTR 0x00000020UL
28797 +#define TCP_SOCKET__LOCK 0x00000040UL
28798 +#define TCP_SOCKET__RELABELFROM 0x00000080UL
28799 +#define TCP_SOCKET__RELABELTO 0x00000100UL
28800 +#define TCP_SOCKET__APPEND 0x00000200UL
28801 +#define TCP_SOCKET__BIND 0x00000400UL
28802 +#define TCP_SOCKET__CONNECT 0x00000800UL
28803 +#define TCP_SOCKET__LISTEN 0x00001000UL
28804 +#define TCP_SOCKET__ACCEPT 0x00002000UL
28805 +#define TCP_SOCKET__GETOPT 0x00004000UL
28806 +#define TCP_SOCKET__SETOPT 0x00008000UL
28807 +#define TCP_SOCKET__SHUTDOWN 0x00010000UL
28808 +#define TCP_SOCKET__RECVFROM 0x00020000UL
28809 +#define TCP_SOCKET__SENDTO 0x00040000UL
28810 +#define TCP_SOCKET__RECV_MSG 0x00080000UL
28811 +#define TCP_SOCKET__SEND_MSG 0x00100000UL
28812 +#define TCP_SOCKET__NAME_BIND 0x00200000UL
28813 +#define TCP_SOCKET__CONNECTTO 0x00400000UL
28814 +#define TCP_SOCKET__NEWCONN 0x00800000UL
28815 +#define TCP_SOCKET__ACCEPTFROM 0x01000000UL
28816 +#define TCP_SOCKET__NODE_BIND 0x02000000UL
28817 +#define TCP_SOCKET__NAME_CONNECT 0x04000000UL
28818 +#define UDP_SOCKET__IOCTL 0x00000001UL
28819 +#define UDP_SOCKET__READ 0x00000002UL
28820 +#define UDP_SOCKET__WRITE 0x00000004UL
28821 +#define UDP_SOCKET__CREATE 0x00000008UL
28822 +#define UDP_SOCKET__GETATTR 0x00000010UL
28823 +#define UDP_SOCKET__SETATTR 0x00000020UL
28824 +#define UDP_SOCKET__LOCK 0x00000040UL
28825 +#define UDP_SOCKET__RELABELFROM 0x00000080UL
28826 +#define UDP_SOCKET__RELABELTO 0x00000100UL
28827 +#define UDP_SOCKET__APPEND 0x00000200UL
28828 +#define UDP_SOCKET__BIND 0x00000400UL
28829 +#define UDP_SOCKET__CONNECT 0x00000800UL
28830 +#define UDP_SOCKET__LISTEN 0x00001000UL
28831 +#define UDP_SOCKET__ACCEPT 0x00002000UL
28832 +#define UDP_SOCKET__GETOPT 0x00004000UL
28833 +#define UDP_SOCKET__SETOPT 0x00008000UL
28834 +#define UDP_SOCKET__SHUTDOWN 0x00010000UL
28835 +#define UDP_SOCKET__RECVFROM 0x00020000UL
28836 +#define UDP_SOCKET__SENDTO 0x00040000UL
28837 +#define UDP_SOCKET__RECV_MSG 0x00080000UL
28838 +#define UDP_SOCKET__SEND_MSG 0x00100000UL
28839 +#define UDP_SOCKET__NAME_BIND 0x00200000UL
28840 +#define UDP_SOCKET__NODE_BIND 0x00400000UL
28841 +#define RAWIP_SOCKET__IOCTL 0x00000001UL
28842 +#define RAWIP_SOCKET__READ 0x00000002UL
28843 +#define RAWIP_SOCKET__WRITE 0x00000004UL
28844 +#define RAWIP_SOCKET__CREATE 0x00000008UL
28845 +#define RAWIP_SOCKET__GETATTR 0x00000010UL
28846 +#define RAWIP_SOCKET__SETATTR 0x00000020UL
28847 +#define RAWIP_SOCKET__LOCK 0x00000040UL
28848 +#define RAWIP_SOCKET__RELABELFROM 0x00000080UL
28849 +#define RAWIP_SOCKET__RELABELTO 0x00000100UL
28850 +#define RAWIP_SOCKET__APPEND 0x00000200UL
28851 +#define RAWIP_SOCKET__BIND 0x00000400UL
28852 +#define RAWIP_SOCKET__CONNECT 0x00000800UL
28853 +#define RAWIP_SOCKET__LISTEN 0x00001000UL
28854 +#define RAWIP_SOCKET__ACCEPT 0x00002000UL
28855 +#define RAWIP_SOCKET__GETOPT 0x00004000UL
28856 +#define RAWIP_SOCKET__SETOPT 0x00008000UL
28857 +#define RAWIP_SOCKET__SHUTDOWN 0x00010000UL
28858 +#define RAWIP_SOCKET__RECVFROM 0x00020000UL
28859 +#define RAWIP_SOCKET__SENDTO 0x00040000UL
28860 +#define RAWIP_SOCKET__RECV_MSG 0x00080000UL
28861 +#define RAWIP_SOCKET__SEND_MSG 0x00100000UL
28862 +#define RAWIP_SOCKET__NAME_BIND 0x00200000UL
28863 +#define RAWIP_SOCKET__NODE_BIND 0x00400000UL
28864 +#define NODE__TCP_RECV 0x00000001UL
28865 +#define NODE__TCP_SEND 0x00000002UL
28866 +#define NODE__UDP_RECV 0x00000004UL
28867 +#define NODE__UDP_SEND 0x00000008UL
28868 +#define NODE__RAWIP_RECV 0x00000010UL
28869 +#define NODE__RAWIP_SEND 0x00000020UL
28870 +#define NODE__ENFORCE_DEST 0x00000040UL
28871 +#define NODE__DCCP_RECV 0x00000080UL
28872 +#define NODE__DCCP_SEND 0x00000100UL
28873 +#define NODE__RECVFROM 0x00000200UL
28874 +#define NODE__SENDTO 0x00000400UL
28875 +#define NETIF__TCP_RECV 0x00000001UL
28876 +#define NETIF__TCP_SEND 0x00000002UL
28877 +#define NETIF__UDP_RECV 0x00000004UL
28878 +#define NETIF__UDP_SEND 0x00000008UL
28879 +#define NETIF__RAWIP_RECV 0x00000010UL
28880 +#define NETIF__RAWIP_SEND 0x00000020UL
28881 +#define NETIF__DCCP_RECV 0x00000040UL
28882 +#define NETIF__DCCP_SEND 0x00000080UL
28883 +#define NETIF__INGRESS 0x00000100UL
28884 +#define NETIF__EGRESS 0x00000200UL
28885 +#define NETLINK_SOCKET__IOCTL 0x00000001UL
28886 +#define NETLINK_SOCKET__READ 0x00000002UL
28887 +#define NETLINK_SOCKET__WRITE 0x00000004UL
28888 +#define NETLINK_SOCKET__CREATE 0x00000008UL
28889 +#define NETLINK_SOCKET__GETATTR 0x00000010UL
28890 +#define NETLINK_SOCKET__SETATTR 0x00000020UL
28891 +#define NETLINK_SOCKET__LOCK 0x00000040UL
28892 +#define NETLINK_SOCKET__RELABELFROM 0x00000080UL
28893 +#define NETLINK_SOCKET__RELABELTO 0x00000100UL
28894 +#define NETLINK_SOCKET__APPEND 0x00000200UL
28895 +#define NETLINK_SOCKET__BIND 0x00000400UL
28896 +#define NETLINK_SOCKET__CONNECT 0x00000800UL
28897 +#define NETLINK_SOCKET__LISTEN 0x00001000UL
28898 +#define NETLINK_SOCKET__ACCEPT 0x00002000UL
28899 +#define NETLINK_SOCKET__GETOPT 0x00004000UL
28900 +#define NETLINK_SOCKET__SETOPT 0x00008000UL
28901 +#define NETLINK_SOCKET__SHUTDOWN 0x00010000UL
28902 +#define NETLINK_SOCKET__RECVFROM 0x00020000UL
28903 +#define NETLINK_SOCKET__SENDTO 0x00040000UL
28904 +#define NETLINK_SOCKET__RECV_MSG 0x00080000UL
28905 +#define NETLINK_SOCKET__SEND_MSG 0x00100000UL
28906 +#define NETLINK_SOCKET__NAME_BIND 0x00200000UL
28907 +#define PACKET_SOCKET__IOCTL 0x00000001UL
28908 +#define PACKET_SOCKET__READ 0x00000002UL
28909 +#define PACKET_SOCKET__WRITE 0x00000004UL
28910 +#define PACKET_SOCKET__CREATE 0x00000008UL
28911 +#define PACKET_SOCKET__GETATTR 0x00000010UL
28912 +#define PACKET_SOCKET__SETATTR 0x00000020UL
28913 +#define PACKET_SOCKET__LOCK 0x00000040UL
28914 +#define PACKET_SOCKET__RELABELFROM 0x00000080UL
28915 +#define PACKET_SOCKET__RELABELTO 0x00000100UL
28916 +#define PACKET_SOCKET__APPEND 0x00000200UL
28917 +#define PACKET_SOCKET__BIND 0x00000400UL
28918 +#define PACKET_SOCKET__CONNECT 0x00000800UL
28919 +#define PACKET_SOCKET__LISTEN 0x00001000UL
28920 +#define PACKET_SOCKET__ACCEPT 0x00002000UL
28921 +#define PACKET_SOCKET__GETOPT 0x00004000UL
28922 +#define PACKET_SOCKET__SETOPT 0x00008000UL
28923 +#define PACKET_SOCKET__SHUTDOWN 0x00010000UL
28924 +#define PACKET_SOCKET__RECVFROM 0x00020000UL
28925 +#define PACKET_SOCKET__SENDTO 0x00040000UL
28926 +#define PACKET_SOCKET__RECV_MSG 0x00080000UL
28927 +#define PACKET_SOCKET__SEND_MSG 0x00100000UL
28928 +#define PACKET_SOCKET__NAME_BIND 0x00200000UL
28929 +#define KEY_SOCKET__IOCTL 0x00000001UL
28930 +#define KEY_SOCKET__READ 0x00000002UL
28931 +#define KEY_SOCKET__WRITE 0x00000004UL
28932 +#define KEY_SOCKET__CREATE 0x00000008UL
28933 +#define KEY_SOCKET__GETATTR 0x00000010UL
28934 +#define KEY_SOCKET__SETATTR 0x00000020UL
28935 +#define KEY_SOCKET__LOCK 0x00000040UL
28936 +#define KEY_SOCKET__RELABELFROM 0x00000080UL
28937 +#define KEY_SOCKET__RELABELTO 0x00000100UL
28938 +#define KEY_SOCKET__APPEND 0x00000200UL
28939 +#define KEY_SOCKET__BIND 0x00000400UL
28940 +#define KEY_SOCKET__CONNECT 0x00000800UL
28941 +#define KEY_SOCKET__LISTEN 0x00001000UL
28942 +#define KEY_SOCKET__ACCEPT 0x00002000UL
28943 +#define KEY_SOCKET__GETOPT 0x00004000UL
28944 +#define KEY_SOCKET__SETOPT 0x00008000UL
28945 +#define KEY_SOCKET__SHUTDOWN 0x00010000UL
28946 +#define KEY_SOCKET__RECVFROM 0x00020000UL
28947 +#define KEY_SOCKET__SENDTO 0x00040000UL
28948 +#define KEY_SOCKET__RECV_MSG 0x00080000UL
28949 +#define KEY_SOCKET__SEND_MSG 0x00100000UL
28950 +#define KEY_SOCKET__NAME_BIND 0x00200000UL
28951 +#define UNIX_STREAM_SOCKET__IOCTL 0x00000001UL
28952 +#define UNIX_STREAM_SOCKET__READ 0x00000002UL
28953 +#define UNIX_STREAM_SOCKET__WRITE 0x00000004UL
28954 +#define UNIX_STREAM_SOCKET__CREATE 0x00000008UL
28955 +#define UNIX_STREAM_SOCKET__GETATTR 0x00000010UL
28956 +#define UNIX_STREAM_SOCKET__SETATTR 0x00000020UL
28957 +#define UNIX_STREAM_SOCKET__LOCK 0x00000040UL
28958 +#define UNIX_STREAM_SOCKET__RELABELFROM 0x00000080UL
28959 +#define UNIX_STREAM_SOCKET__RELABELTO 0x00000100UL
28960 +#define UNIX_STREAM_SOCKET__APPEND 0x00000200UL
28961 +#define UNIX_STREAM_SOCKET__BIND 0x00000400UL
28962 +#define UNIX_STREAM_SOCKET__CONNECT 0x00000800UL
28963 +#define UNIX_STREAM_SOCKET__LISTEN 0x00001000UL
28964 +#define UNIX_STREAM_SOCKET__ACCEPT 0x00002000UL
28965 +#define UNIX_STREAM_SOCKET__GETOPT 0x00004000UL
28966 +#define UNIX_STREAM_SOCKET__SETOPT 0x00008000UL
28967 +#define UNIX_STREAM_SOCKET__SHUTDOWN 0x00010000UL
28968 +#define UNIX_STREAM_SOCKET__RECVFROM 0x00020000UL
28969 +#define UNIX_STREAM_SOCKET__SENDTO 0x00040000UL
28970 +#define UNIX_STREAM_SOCKET__RECV_MSG 0x00080000UL
28971 +#define UNIX_STREAM_SOCKET__SEND_MSG 0x00100000UL
28972 +#define UNIX_STREAM_SOCKET__NAME_BIND 0x00200000UL
28973 +#define UNIX_STREAM_SOCKET__CONNECTTO 0x00400000UL
28974 +#define UNIX_STREAM_SOCKET__NEWCONN 0x00800000UL
28975 +#define UNIX_STREAM_SOCKET__ACCEPTFROM 0x01000000UL
28976 +#define UNIX_DGRAM_SOCKET__IOCTL 0x00000001UL
28977 +#define UNIX_DGRAM_SOCKET__READ 0x00000002UL
28978 +#define UNIX_DGRAM_SOCKET__WRITE 0x00000004UL
28979 +#define UNIX_DGRAM_SOCKET__CREATE 0x00000008UL
28980 +#define UNIX_DGRAM_SOCKET__GETATTR 0x00000010UL
28981 +#define UNIX_DGRAM_SOCKET__SETATTR 0x00000020UL
28982 +#define UNIX_DGRAM_SOCKET__LOCK 0x00000040UL
28983 +#define UNIX_DGRAM_SOCKET__RELABELFROM 0x00000080UL
28984 +#define UNIX_DGRAM_SOCKET__RELABELTO 0x00000100UL
28985 +#define UNIX_DGRAM_SOCKET__APPEND 0x00000200UL
28986 +#define UNIX_DGRAM_SOCKET__BIND 0x00000400UL
28987 +#define UNIX_DGRAM_SOCKET__CONNECT 0x00000800UL
28988 +#define UNIX_DGRAM_SOCKET__LISTEN 0x00001000UL
28989 +#define UNIX_DGRAM_SOCKET__ACCEPT 0x00002000UL
28990 +#define UNIX_DGRAM_SOCKET__GETOPT 0x00004000UL
28991 +#define UNIX_DGRAM_SOCKET__SETOPT 0x00008000UL
28992 +#define UNIX_DGRAM_SOCKET__SHUTDOWN 0x00010000UL
28993 +#define UNIX_DGRAM_SOCKET__RECVFROM 0x00020000UL
28994 +#define UNIX_DGRAM_SOCKET__SENDTO 0x00040000UL
28995 +#define UNIX_DGRAM_SOCKET__RECV_MSG 0x00080000UL
28996 +#define UNIX_DGRAM_SOCKET__SEND_MSG 0x00100000UL
28997 +#define UNIX_DGRAM_SOCKET__NAME_BIND 0x00200000UL
28998 +#define SEM__CREATE 0x00000001UL
28999 +#define SEM__DESTROY 0x00000002UL
29000 +#define SEM__GETATTR 0x00000004UL
29001 +#define SEM__SETATTR 0x00000008UL
29002 +#define SEM__READ 0x00000010UL
29003 +#define SEM__WRITE 0x00000020UL
29004 +#define SEM__ASSOCIATE 0x00000040UL
29005 +#define SEM__UNIX_READ 0x00000080UL
29006 +#define SEM__UNIX_WRITE 0x00000100UL
29007 +#define MSG__SEND 0x00000001UL
29008 +#define MSG__RECEIVE 0x00000002UL
29009 +#define MSGQ__CREATE 0x00000001UL
29010 +#define MSGQ__DESTROY 0x00000002UL
29011 +#define MSGQ__GETATTR 0x00000004UL
29012 +#define MSGQ__SETATTR 0x00000008UL
29013 +#define MSGQ__READ 0x00000010UL
29014 +#define MSGQ__WRITE 0x00000020UL
29015 +#define MSGQ__ASSOCIATE 0x00000040UL
29016 +#define MSGQ__UNIX_READ 0x00000080UL
29017 +#define MSGQ__UNIX_WRITE 0x00000100UL
29018 +#define MSGQ__ENQUEUE 0x00000200UL
29019 +#define SHM__CREATE 0x00000001UL
29020 +#define SHM__DESTROY 0x00000002UL
29021 +#define SHM__GETATTR 0x00000004UL
29022 +#define SHM__SETATTR 0x00000008UL
29023 +#define SHM__READ 0x00000010UL
29024 +#define SHM__WRITE 0x00000020UL
29025 +#define SHM__ASSOCIATE 0x00000040UL
29026 +#define SHM__UNIX_READ 0x00000080UL
29027 +#define SHM__UNIX_WRITE 0x00000100UL
29028 +#define SHM__LOCK 0x00000200UL
29029 +#define IPC__CREATE 0x00000001UL
29030 +#define IPC__DESTROY 0x00000002UL
29031 +#define IPC__GETATTR 0x00000004UL
29032 +#define IPC__SETATTR 0x00000008UL
29033 +#define IPC__READ 0x00000010UL
29034 +#define IPC__WRITE 0x00000020UL
29035 +#define IPC__ASSOCIATE 0x00000040UL
29036 +#define IPC__UNIX_READ 0x00000080UL
29037 +#define IPC__UNIX_WRITE 0x00000100UL
29038 +#define NETLINK_ROUTE_SOCKET__IOCTL 0x00000001UL
29039 +#define NETLINK_ROUTE_SOCKET__READ 0x00000002UL
29040 +#define NETLINK_ROUTE_SOCKET__WRITE 0x00000004UL
29041 +#define NETLINK_ROUTE_SOCKET__CREATE 0x00000008UL
29042 +#define NETLINK_ROUTE_SOCKET__GETATTR 0x00000010UL
29043 +#define NETLINK_ROUTE_SOCKET__SETATTR 0x00000020UL
29044 +#define NETLINK_ROUTE_SOCKET__LOCK 0x00000040UL
29045 +#define NETLINK_ROUTE_SOCKET__RELABELFROM 0x00000080UL
29046 +#define NETLINK_ROUTE_SOCKET__RELABELTO 0x00000100UL
29047 +#define NETLINK_ROUTE_SOCKET__APPEND 0x00000200UL
29048 +#define NETLINK_ROUTE_SOCKET__BIND 0x00000400UL
29049 +#define NETLINK_ROUTE_SOCKET__CONNECT 0x00000800UL
29050 +#define NETLINK_ROUTE_SOCKET__LISTEN 0x00001000UL
29051 +#define NETLINK_ROUTE_SOCKET__ACCEPT 0x00002000UL
29052 +#define NETLINK_ROUTE_SOCKET__GETOPT 0x00004000UL
29053 +#define NETLINK_ROUTE_SOCKET__SETOPT 0x00008000UL
29054 +#define NETLINK_ROUTE_SOCKET__SHUTDOWN 0x00010000UL
29055 +#define NETLINK_ROUTE_SOCKET__RECVFROM 0x00020000UL
29056 +#define NETLINK_ROUTE_SOCKET__SENDTO 0x00040000UL
29057 +#define NETLINK_ROUTE_SOCKET__RECV_MSG 0x00080000UL
29058 +#define NETLINK_ROUTE_SOCKET__SEND_MSG 0x00100000UL
29059 +#define NETLINK_ROUTE_SOCKET__NAME_BIND 0x00200000UL
29060 +#define NETLINK_ROUTE_SOCKET__NLMSG_READ 0x00400000UL
29061 +#define NETLINK_ROUTE_SOCKET__NLMSG_WRITE 0x00800000UL
29062 +#define NETLINK_FIREWALL_SOCKET__IOCTL 0x00000001UL
29063 +#define NETLINK_FIREWALL_SOCKET__READ 0x00000002UL
29064 +#define NETLINK_FIREWALL_SOCKET__WRITE 0x00000004UL
29065 +#define NETLINK_FIREWALL_SOCKET__CREATE 0x00000008UL
29066 +#define NETLINK_FIREWALL_SOCKET__GETATTR 0x00000010UL
29067 +#define NETLINK_FIREWALL_SOCKET__SETATTR 0x00000020UL
29068 +#define NETLINK_FIREWALL_SOCKET__LOCK 0x00000040UL
29069 +#define NETLINK_FIREWALL_SOCKET__RELABELFROM 0x00000080UL
29070 +#define NETLINK_FIREWALL_SOCKET__RELABELTO 0x00000100UL
29071 +#define NETLINK_FIREWALL_SOCKET__APPEND 0x00000200UL
29072 +#define NETLINK_FIREWALL_SOCKET__BIND 0x00000400UL
29073 +#define NETLINK_FIREWALL_SOCKET__CONNECT 0x00000800UL
29074 +#define NETLINK_FIREWALL_SOCKET__LISTEN 0x00001000UL
29075 +#define NETLINK_FIREWALL_SOCKET__ACCEPT 0x00002000UL
29076 +#define NETLINK_FIREWALL_SOCKET__GETOPT 0x00004000UL
29077 +#define NETLINK_FIREWALL_SOCKET__SETOPT 0x00008000UL
29078 +#define NETLINK_FIREWALL_SOCKET__SHUTDOWN 0x00010000UL
29079 +#define NETLINK_FIREWALL_SOCKET__RECVFROM 0x00020000UL
29080 +#define NETLINK_FIREWALL_SOCKET__SENDTO 0x00040000UL
29081 +#define NETLINK_FIREWALL_SOCKET__RECV_MSG 0x00080000UL
29082 +#define NETLINK_FIREWALL_SOCKET__SEND_MSG 0x00100000UL
29083 +#define NETLINK_FIREWALL_SOCKET__NAME_BIND 0x00200000UL
29084 +#define NETLINK_FIREWALL_SOCKET__NLMSG_READ 0x00400000UL
29085 +#define NETLINK_FIREWALL_SOCKET__NLMSG_WRITE 0x00800000UL
29086 +#define NETLINK_TCPDIAG_SOCKET__IOCTL 0x00000001UL
29087 +#define NETLINK_TCPDIAG_SOCKET__READ 0x00000002UL
29088 +#define NETLINK_TCPDIAG_SOCKET__WRITE 0x00000004UL
29089 +#define NETLINK_TCPDIAG_SOCKET__CREATE 0x00000008UL
29090 +#define NETLINK_TCPDIAG_SOCKET__GETATTR 0x00000010UL
29091 +#define NETLINK_TCPDIAG_SOCKET__SETATTR 0x00000020UL
29092 +#define NETLINK_TCPDIAG_SOCKET__LOCK 0x00000040UL
29093 +#define NETLINK_TCPDIAG_SOCKET__RELABELFROM 0x00000080UL
29094 +#define NETLINK_TCPDIAG_SOCKET__RELABELTO 0x00000100UL
29095 +#define NETLINK_TCPDIAG_SOCKET__APPEND 0x00000200UL
29096 +#define NETLINK_TCPDIAG_SOCKET__BIND 0x00000400UL
29097 +#define NETLINK_TCPDIAG_SOCKET__CONNECT 0x00000800UL
29098 +#define NETLINK_TCPDIAG_SOCKET__LISTEN 0x00001000UL
29099 +#define NETLINK_TCPDIAG_SOCKET__ACCEPT 0x00002000UL
29100 +#define NETLINK_TCPDIAG_SOCKET__GETOPT 0x00004000UL
29101 +#define NETLINK_TCPDIAG_SOCKET__SETOPT 0x00008000UL
29102 +#define NETLINK_TCPDIAG_SOCKET__SHUTDOWN 0x00010000UL
29103 +#define NETLINK_TCPDIAG_SOCKET__RECVFROM 0x00020000UL
29104 +#define NETLINK_TCPDIAG_SOCKET__SENDTO 0x00040000UL
29105 +#define NETLINK_TCPDIAG_SOCKET__RECV_MSG 0x00080000UL
29106 +#define NETLINK_TCPDIAG_SOCKET__SEND_MSG 0x00100000UL
29107 +#define NETLINK_TCPDIAG_SOCKET__NAME_BIND 0x00200000UL
29108 +#define NETLINK_TCPDIAG_SOCKET__NLMSG_READ 0x00400000UL
29109 +#define NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE 0x00800000UL
29110 +#define NETLINK_NFLOG_SOCKET__IOCTL 0x00000001UL
29111 +#define NETLINK_NFLOG_SOCKET__READ 0x00000002UL
29112 +#define NETLINK_NFLOG_SOCKET__WRITE 0x00000004UL
29113 +#define NETLINK_NFLOG_SOCKET__CREATE 0x00000008UL
29114 +#define NETLINK_NFLOG_SOCKET__GETATTR 0x00000010UL
29115 +#define NETLINK_NFLOG_SOCKET__SETATTR 0x00000020UL
29116 +#define NETLINK_NFLOG_SOCKET__LOCK 0x00000040UL
29117 +#define NETLINK_NFLOG_SOCKET__RELABELFROM 0x00000080UL
29118 +#define NETLINK_NFLOG_SOCKET__RELABELTO 0x00000100UL
29119 +#define NETLINK_NFLOG_SOCKET__APPEND 0x00000200UL
29120 +#define NETLINK_NFLOG_SOCKET__BIND 0x00000400UL
29121 +#define NETLINK_NFLOG_SOCKET__CONNECT 0x00000800UL
29122 +#define NETLINK_NFLOG_SOCKET__LISTEN 0x00001000UL
29123 +#define NETLINK_NFLOG_SOCKET__ACCEPT 0x00002000UL
29124 +#define NETLINK_NFLOG_SOCKET__GETOPT 0x00004000UL
29125 +#define NETLINK_NFLOG_SOCKET__SETOPT 0x00008000UL
29126 +#define NETLINK_NFLOG_SOCKET__SHUTDOWN 0x00010000UL
29127 +#define NETLINK_NFLOG_SOCKET__RECVFROM 0x00020000UL
29128 +#define NETLINK_NFLOG_SOCKET__SENDTO 0x00040000UL
29129 +#define NETLINK_NFLOG_SOCKET__RECV_MSG 0x00080000UL
29130 +#define NETLINK_NFLOG_SOCKET__SEND_MSG 0x00100000UL
29131 +#define NETLINK_NFLOG_SOCKET__NAME_BIND 0x00200000UL
29132 +#define NETLINK_XFRM_SOCKET__IOCTL 0x00000001UL
29133 +#define NETLINK_XFRM_SOCKET__READ 0x00000002UL
29134 +#define NETLINK_XFRM_SOCKET__WRITE 0x00000004UL
29135 +#define NETLINK_XFRM_SOCKET__CREATE 0x00000008UL
29136 +#define NETLINK_XFRM_SOCKET__GETATTR 0x00000010UL
29137 +#define NETLINK_XFRM_SOCKET__SETATTR 0x00000020UL
29138 +#define NETLINK_XFRM_SOCKET__LOCK 0x00000040UL
29139 +#define NETLINK_XFRM_SOCKET__RELABELFROM 0x00000080UL
29140 +#define NETLINK_XFRM_SOCKET__RELABELTO 0x00000100UL
29141 +#define NETLINK_XFRM_SOCKET__APPEND 0x00000200UL
29142 +#define NETLINK_XFRM_SOCKET__BIND 0x00000400UL
29143 +#define NETLINK_XFRM_SOCKET__CONNECT 0x00000800UL
29144 +#define NETLINK_XFRM_SOCKET__LISTEN 0x00001000UL
29145 +#define NETLINK_XFRM_SOCKET__ACCEPT 0x00002000UL
29146 +#define NETLINK_XFRM_SOCKET__GETOPT 0x00004000UL
29147 +#define NETLINK_XFRM_SOCKET__SETOPT 0x00008000UL
29148 +#define NETLINK_XFRM_SOCKET__SHUTDOWN 0x00010000UL
29149 +#define NETLINK_XFRM_SOCKET__RECVFROM 0x00020000UL
29150 +#define NETLINK_XFRM_SOCKET__SENDTO 0x00040000UL
29151 +#define NETLINK_XFRM_SOCKET__RECV_MSG 0x00080000UL
29152 +#define NETLINK_XFRM_SOCKET__SEND_MSG 0x00100000UL
29153 +#define NETLINK_XFRM_SOCKET__NAME_BIND 0x00200000UL
29154 +#define NETLINK_XFRM_SOCKET__NLMSG_READ 0x00400000UL
29155 +#define NETLINK_XFRM_SOCKET__NLMSG_WRITE 0x00800000UL
29156 +#define NETLINK_SELINUX_SOCKET__IOCTL 0x00000001UL
29157 +#define NETLINK_SELINUX_SOCKET__READ 0x00000002UL
29158 +#define NETLINK_SELINUX_SOCKET__WRITE 0x00000004UL
29159 +#define NETLINK_SELINUX_SOCKET__CREATE 0x00000008UL
29160 +#define NETLINK_SELINUX_SOCKET__GETATTR 0x00000010UL
29161 +#define NETLINK_SELINUX_SOCKET__SETATTR 0x00000020UL
29162 +#define NETLINK_SELINUX_SOCKET__LOCK 0x00000040UL
29163 +#define NETLINK_SELINUX_SOCKET__RELABELFROM 0x00000080UL
29164 +#define NETLINK_SELINUX_SOCKET__RELABELTO 0x00000100UL
29165 +#define NETLINK_SELINUX_SOCKET__APPEND 0x00000200UL
29166 +#define NETLINK_SELINUX_SOCKET__BIND 0x00000400UL
29167 +#define NETLINK_SELINUX_SOCKET__CONNECT 0x00000800UL
29168 +#define NETLINK_SELINUX_SOCKET__LISTEN 0x00001000UL
29169 +#define NETLINK_SELINUX_SOCKET__ACCEPT 0x00002000UL
29170 +#define NETLINK_SELINUX_SOCKET__GETOPT 0x00004000UL
29171 +#define NETLINK_SELINUX_SOCKET__SETOPT 0x00008000UL
29172 +#define NETLINK_SELINUX_SOCKET__SHUTDOWN 0x00010000UL
29173 +#define NETLINK_SELINUX_SOCKET__RECVFROM 0x00020000UL
29174 +#define NETLINK_SELINUX_SOCKET__SENDTO 0x00040000UL
29175 +#define NETLINK_SELINUX_SOCKET__RECV_MSG 0x00080000UL
29176 +#define NETLINK_SELINUX_SOCKET__SEND_MSG 0x00100000UL
29177 +#define NETLINK_SELINUX_SOCKET__NAME_BIND 0x00200000UL
29178 +#define NETLINK_AUDIT_SOCKET__IOCTL 0x00000001UL
29179 +#define NETLINK_AUDIT_SOCKET__READ 0x00000002UL
29180 +#define NETLINK_AUDIT_SOCKET__WRITE 0x00000004UL
29181 +#define NETLINK_AUDIT_SOCKET__CREATE 0x00000008UL
29182 +#define NETLINK_AUDIT_SOCKET__GETATTR 0x00000010UL
29183 +#define NETLINK_AUDIT_SOCKET__SETATTR 0x00000020UL
29184 +#define NETLINK_AUDIT_SOCKET__LOCK 0x00000040UL
29185 +#define NETLINK_AUDIT_SOCKET__RELABELFROM 0x00000080UL
29186 +#define NETLINK_AUDIT_SOCKET__RELABELTO 0x00000100UL
29187 +#define NETLINK_AUDIT_SOCKET__APPEND 0x00000200UL
29188 +#define NETLINK_AUDIT_SOCKET__BIND 0x00000400UL
29189 +#define NETLINK_AUDIT_SOCKET__CONNECT 0x00000800UL
29190 +#define NETLINK_AUDIT_SOCKET__LISTEN 0x00001000UL
29191 +#define NETLINK_AUDIT_SOCKET__ACCEPT 0x00002000UL
29192 +#define NETLINK_AUDIT_SOCKET__GETOPT 0x00004000UL
29193 +#define NETLINK_AUDIT_SOCKET__SETOPT 0x00008000UL
29194 +#define NETLINK_AUDIT_SOCKET__SHUTDOWN 0x00010000UL
29195 +#define NETLINK_AUDIT_SOCKET__RECVFROM 0x00020000UL
29196 +#define NETLINK_AUDIT_SOCKET__SENDTO 0x00040000UL
29197 +#define NETLINK_AUDIT_SOCKET__RECV_MSG 0x00080000UL
29198 +#define NETLINK_AUDIT_SOCKET__SEND_MSG 0x00100000UL
29199 +#define NETLINK_AUDIT_SOCKET__NAME_BIND 0x00200000UL
29200 +#define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL
29201 +#define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL
29202 +#define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL
29203 +#define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL
29204 +#define NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT 0x04000000UL
29205 +#define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL
29206 +#define NETLINK_IP6FW_SOCKET__READ 0x00000002UL
29207 +#define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL
29208 +#define NETLINK_IP6FW_SOCKET__CREATE 0x00000008UL
29209 +#define NETLINK_IP6FW_SOCKET__GETATTR 0x00000010UL
29210 +#define NETLINK_IP6FW_SOCKET__SETATTR 0x00000020UL
29211 +#define NETLINK_IP6FW_SOCKET__LOCK 0x00000040UL
29212 +#define NETLINK_IP6FW_SOCKET__RELABELFROM 0x00000080UL
29213 +#define NETLINK_IP6FW_SOCKET__RELABELTO 0x00000100UL
29214 +#define NETLINK_IP6FW_SOCKET__APPEND 0x00000200UL
29215 +#define NETLINK_IP6FW_SOCKET__BIND 0x00000400UL
29216 +#define NETLINK_IP6FW_SOCKET__CONNECT 0x00000800UL
29217 +#define NETLINK_IP6FW_SOCKET__LISTEN 0x00001000UL
29218 +#define NETLINK_IP6FW_SOCKET__ACCEPT 0x00002000UL
29219 +#define NETLINK_IP6FW_SOCKET__GETOPT 0x00004000UL
29220 +#define NETLINK_IP6FW_SOCKET__SETOPT 0x00008000UL
29221 +#define NETLINK_IP6FW_SOCKET__SHUTDOWN 0x00010000UL
29222 +#define NETLINK_IP6FW_SOCKET__RECVFROM 0x00020000UL
29223 +#define NETLINK_IP6FW_SOCKET__SENDTO 0x00040000UL
29224 +#define NETLINK_IP6FW_SOCKET__RECV_MSG 0x00080000UL
29225 +#define NETLINK_IP6FW_SOCKET__SEND_MSG 0x00100000UL
29226 +#define NETLINK_IP6FW_SOCKET__NAME_BIND 0x00200000UL
29227 +#define NETLINK_IP6FW_SOCKET__NLMSG_READ 0x00400000UL
29228 +#define NETLINK_IP6FW_SOCKET__NLMSG_WRITE 0x00800000UL
29229 +#define NETLINK_DNRT_SOCKET__IOCTL 0x00000001UL
29230 +#define NETLINK_DNRT_SOCKET__READ 0x00000002UL
29231 +#define NETLINK_DNRT_SOCKET__WRITE 0x00000004UL
29232 +#define NETLINK_DNRT_SOCKET__CREATE 0x00000008UL
29233 +#define NETLINK_DNRT_SOCKET__GETATTR 0x00000010UL
29234 +#define NETLINK_DNRT_SOCKET__SETATTR 0x00000020UL
29235 +#define NETLINK_DNRT_SOCKET__LOCK 0x00000040UL
29236 +#define NETLINK_DNRT_SOCKET__RELABELFROM 0x00000080UL
29237 +#define NETLINK_DNRT_SOCKET__RELABELTO 0x00000100UL
29238 +#define NETLINK_DNRT_SOCKET__APPEND 0x00000200UL
29239 +#define NETLINK_DNRT_SOCKET__BIND 0x00000400UL
29240 +#define NETLINK_DNRT_SOCKET__CONNECT 0x00000800UL
29241 +#define NETLINK_DNRT_SOCKET__LISTEN 0x00001000UL
29242 +#define NETLINK_DNRT_SOCKET__ACCEPT 0x00002000UL
29243 +#define NETLINK_DNRT_SOCKET__GETOPT 0x00004000UL
29244 +#define NETLINK_DNRT_SOCKET__SETOPT 0x00008000UL
29245 +#define NETLINK_DNRT_SOCKET__SHUTDOWN 0x00010000UL
29246 +#define NETLINK_DNRT_SOCKET__RECVFROM 0x00020000UL
29247 +#define NETLINK_DNRT_SOCKET__SENDTO 0x00040000UL
29248 +#define NETLINK_DNRT_SOCKET__RECV_MSG 0x00080000UL
29249 +#define NETLINK_DNRT_SOCKET__SEND_MSG 0x00100000UL
29250 +#define NETLINK_DNRT_SOCKET__NAME_BIND 0x00200000UL
29251 +#define ASSOCIATION__SENDTO 0x00000001UL
29252 +#define ASSOCIATION__RECVFROM 0x00000002UL
29253 +#define ASSOCIATION__SETCONTEXT 0x00000004UL
29254 +#define ASSOCIATION__POLMATCH 0x00000008UL
29255 +#define NETLINK_KOBJECT_UEVENT_SOCKET__IOCTL 0x00000001UL
29256 +#define NETLINK_KOBJECT_UEVENT_SOCKET__READ 0x00000002UL
29257 +#define NETLINK_KOBJECT_UEVENT_SOCKET__WRITE 0x00000004UL
29258 +#define NETLINK_KOBJECT_UEVENT_SOCKET__CREATE 0x00000008UL
29259 +#define NETLINK_KOBJECT_UEVENT_SOCKET__GETATTR 0x00000010UL
29260 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SETATTR 0x00000020UL
29261 +#define NETLINK_KOBJECT_UEVENT_SOCKET__LOCK 0x00000040UL
29262 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELFROM 0x00000080UL
29263 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELTO 0x00000100UL
29264 +#define NETLINK_KOBJECT_UEVENT_SOCKET__APPEND 0x00000200UL
29265 +#define NETLINK_KOBJECT_UEVENT_SOCKET__BIND 0x00000400UL
29266 +#define NETLINK_KOBJECT_UEVENT_SOCKET__CONNECT 0x00000800UL
29267 +#define NETLINK_KOBJECT_UEVENT_SOCKET__LISTEN 0x00001000UL
29268 +#define NETLINK_KOBJECT_UEVENT_SOCKET__ACCEPT 0x00002000UL
29269 +#define NETLINK_KOBJECT_UEVENT_SOCKET__GETOPT 0x00004000UL
29270 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SETOPT 0x00008000UL
29271 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SHUTDOWN 0x00010000UL
29272 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RECVFROM 0x00020000UL
29273 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SENDTO 0x00040000UL
29274 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RECV_MSG 0x00080000UL
29275 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SEND_MSG 0x00100000UL
29276 +#define NETLINK_KOBJECT_UEVENT_SOCKET__NAME_BIND 0x00200000UL
29277 +#define APPLETALK_SOCKET__IOCTL 0x00000001UL
29278 +#define APPLETALK_SOCKET__READ 0x00000002UL
29279 +#define APPLETALK_SOCKET__WRITE 0x00000004UL
29280 +#define APPLETALK_SOCKET__CREATE 0x00000008UL
29281 +#define APPLETALK_SOCKET__GETATTR 0x00000010UL
29282 +#define APPLETALK_SOCKET__SETATTR 0x00000020UL
29283 +#define APPLETALK_SOCKET__LOCK 0x00000040UL
29284 +#define APPLETALK_SOCKET__RELABELFROM 0x00000080UL
29285 +#define APPLETALK_SOCKET__RELABELTO 0x00000100UL
29286 +#define APPLETALK_SOCKET__APPEND 0x00000200UL
29287 +#define APPLETALK_SOCKET__BIND 0x00000400UL
29288 +#define APPLETALK_SOCKET__CONNECT 0x00000800UL
29289 +#define APPLETALK_SOCKET__LISTEN 0x00001000UL
29290 +#define APPLETALK_SOCKET__ACCEPT 0x00002000UL
29291 +#define APPLETALK_SOCKET__GETOPT 0x00004000UL
29292 +#define APPLETALK_SOCKET__SETOPT 0x00008000UL
29293 +#define APPLETALK_SOCKET__SHUTDOWN 0x00010000UL
29294 +#define APPLETALK_SOCKET__RECVFROM 0x00020000UL
29295 +#define APPLETALK_SOCKET__SENDTO 0x00040000UL
29296 +#define APPLETALK_SOCKET__RECV_MSG 0x00080000UL
29297 +#define APPLETALK_SOCKET__SEND_MSG 0x00100000UL
29298 +#define APPLETALK_SOCKET__NAME_BIND 0x00200000UL
29299 +#define PACKET__SEND 0x00000001UL
29300 +#define PACKET__RECV 0x00000002UL
29301 +#define PACKET__RELABELTO 0x00000004UL
29302 +#define PACKET__FLOW_IN 0x00000008UL
29303 +#define PACKET__FLOW_OUT 0x00000010UL
29304 +#define PACKET__FORWARD_IN 0x00000020UL
29305 +#define PACKET__FORWARD_OUT 0x00000040UL
29306 +#define KEY__VIEW 0x00000001UL
29307 +#define KEY__READ 0x00000002UL
29308 +#define KEY__WRITE 0x00000004UL
29309 +#define KEY__SEARCH 0x00000008UL
29310 +#define KEY__LINK 0x00000010UL
29311 +#define KEY__SETATTR 0x00000020UL
29312 +#define KEY__CREATE 0x00000040UL
29313 +#define DCCP_SOCKET__IOCTL 0x00000001UL
29314 +#define DCCP_SOCKET__READ 0x00000002UL
29315 +#define DCCP_SOCKET__WRITE 0x00000004UL
29316 +#define DCCP_SOCKET__CREATE 0x00000008UL
29317 +#define DCCP_SOCKET__GETATTR 0x00000010UL
29318 +#define DCCP_SOCKET__SETATTR 0x00000020UL
29319 +#define DCCP_SOCKET__LOCK 0x00000040UL
29320 +#define DCCP_SOCKET__RELABELFROM 0x00000080UL
29321 +#define DCCP_SOCKET__RELABELTO 0x00000100UL
29322 +#define DCCP_SOCKET__APPEND 0x00000200UL
29323 +#define DCCP_SOCKET__BIND 0x00000400UL
29324 +#define DCCP_SOCKET__CONNECT 0x00000800UL
29325 +#define DCCP_SOCKET__LISTEN 0x00001000UL
29326 +#define DCCP_SOCKET__ACCEPT 0x00002000UL
29327 +#define DCCP_SOCKET__GETOPT 0x00004000UL
29328 +#define DCCP_SOCKET__SETOPT 0x00008000UL
29329 +#define DCCP_SOCKET__SHUTDOWN 0x00010000UL
29330 +#define DCCP_SOCKET__RECVFROM 0x00020000UL
29331 +#define DCCP_SOCKET__SENDTO 0x00040000UL
29332 +#define DCCP_SOCKET__RECV_MSG 0x00080000UL
29333 +#define DCCP_SOCKET__SEND_MSG 0x00100000UL
29334 +#define DCCP_SOCKET__NAME_BIND 0x00200000UL
29335 +#define DCCP_SOCKET__NODE_BIND 0x00400000UL
29336 +#define DCCP_SOCKET__NAME_CONNECT 0x00800000UL
29337 +#define MEMPROTECT__MMAP_ZERO 0x00000001UL
29338 +#define PEER__RECV 0x00000001UL
29339 +#define CAPABILITY2__MAC_OVERRIDE 0x00000001UL
29340 +#define CAPABILITY2__MAC_ADMIN 0x00000002UL
29341 +#define KERNEL_SERVICE__USE_AS_OVERRIDE 0x00000001UL
29342 +#define KERNEL_SERVICE__CREATE_FILES_AS 0x00000002UL
29343 +#define TUN_SOCKET__IOCTL 0x00000001UL
29344 +#define TUN_SOCKET__READ 0x00000002UL
29345 +#define TUN_SOCKET__WRITE 0x00000004UL
29346 +#define TUN_SOCKET__CREATE 0x00000008UL
29347 +#define TUN_SOCKET__GETATTR 0x00000010UL
29348 +#define TUN_SOCKET__SETATTR 0x00000020UL
29349 +#define TUN_SOCKET__LOCK 0x00000040UL
29350 +#define TUN_SOCKET__RELABELFROM 0x00000080UL
29351 +#define TUN_SOCKET__RELABELTO 0x00000100UL
29352 +#define TUN_SOCKET__APPEND 0x00000200UL
29353 +#define TUN_SOCKET__BIND 0x00000400UL
29354 +#define TUN_SOCKET__CONNECT 0x00000800UL
29355 +#define TUN_SOCKET__LISTEN 0x00001000UL
29356 +#define TUN_SOCKET__ACCEPT 0x00002000UL
29357 +#define TUN_SOCKET__GETOPT 0x00004000UL
29358 +#define TUN_SOCKET__SETOPT 0x00008000UL
29359 +#define TUN_SOCKET__SHUTDOWN 0x00010000UL
29360 +#define TUN_SOCKET__RECVFROM 0x00020000UL
29361 +#define TUN_SOCKET__SENDTO 0x00040000UL
29362 +#define TUN_SOCKET__RECV_MSG 0x00080000UL
29363 +#define TUN_SOCKET__SEND_MSG 0x00100000UL
29364 +#define TUN_SOCKET__NAME_BIND 0x00200000UL
29367 diff -NurpP --minimal linux-2.6.35.2/security/selinux/hooks.c linux-2.6.35.2-vs2.3.0.36.31/security/selinux/hooks.c
29368 --- linux-2.6.35.2/security/selinux/hooks.c 2010-08-02 16:53:03.000000000 +0200
29369 +++ linux-2.6.35.2-vs2.3.0.36.31/security/selinux/hooks.c 2010-08-02 17:05:06.000000000 +0200
29371 #include <linux/dccp.h>
29372 #include <linux/quota.h>
29373 #include <linux/un.h> /* for Unix socket types */
29374 -#include <net/af_unix.h> /* for Unix socket types */
29375 #include <linux/parser.h>
29376 #include <linux/nfs_mount.h>
29377 #include <net/ipv6.h>