1 diff -NurpP --minimal linux-2.6.34/arch/alpha/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/Kconfig
2 --- linux-2.6.34/arch/alpha/Kconfig 2010-05-18 15:07:43.000000000 +0200
3 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/Kconfig 2010-05-18 18:11:22.000000000 +0200
4 @@ -679,6 +679,8 @@ config DUMMY_CONSOLE
8 +source "kernel/vserver/Kconfig"
10 source "security/Kconfig"
12 source "crypto/Kconfig"
13 diff -NurpP --minimal linux-2.6.34/arch/alpha/kernel/entry.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/entry.S
14 --- linux-2.6.34/arch/alpha/kernel/entry.S 2009-06-11 17:11:46.000000000 +0200
15 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/entry.S 2010-05-18 18:11:22.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.34/arch/alpha/kernel/osf_sys.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/osf_sys.c
49 --- linux-2.6.34/arch/alpha/kernel/osf_sys.c 2010-05-18 15:07:43.000000000 +0200
50 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/osf_sys.c 2010-05-18 18:11:22.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.34/arch/alpha/kernel/ptrace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/ptrace.c
61 --- linux-2.6.34/arch/alpha/kernel/ptrace.c 2010-05-18 15:07:43.000000000 +0200
62 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/ptrace.c 2010-05-18 18:11:22.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.34/arch/alpha/kernel/systbls.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/systbls.S
72 --- linux-2.6.34/arch/alpha/kernel/systbls.S 2010-02-25 11:51:19.000000000 +0100
73 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/systbls.S 2010-05-18 18:11:22.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.34/arch/alpha/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/traps.c
84 --- linux-2.6.34/arch/alpha/kernel/traps.c 2010-05-18 15:07:43.000000000 +0200
85 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/kernel/traps.c 2010-05-18 18:11:22.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.34/arch/alpha/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/mm/fault.c
97 --- linux-2.6.34/arch/alpha/mm/fault.c 2009-09-10 15:25:14.000000000 +0200
98 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/alpha/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
99 @@ -193,8 +193,8 @@ do_page_fault(unsigned long address, uns
100 down_read(&mm->mmap_sem);
103 - printk(KERN_ALERT "VM: killing process %s(%d)\n",
104 - current->comm, task_pid_nr(current));
105 + printk(KERN_ALERT "VM: killing process %s(%d:#%u)\n",
106 + current->comm, task_pid_nr(current), current->xid);
107 if (!user_mode(regs))
109 do_group_exit(SIGKILL);
110 diff -NurpP --minimal linux-2.6.34/arch/arm/include/asm/tlb.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/include/asm/tlb.h
111 --- linux-2.6.34/arch/arm/include/asm/tlb.h 2009-09-10 15:25:15.000000000 +0200
112 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/include/asm/tlb.h 2010-05-18 18:11:22.000000000 +0200
115 #else /* !CONFIG_MMU */
117 +#include <linux/vs_memory.h>
118 #include <asm/pgalloc.h>
121 diff -NurpP --minimal linux-2.6.34/arch/arm/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/Kconfig
122 --- linux-2.6.34/arch/arm/Kconfig 2010-05-18 15:07:43.000000000 +0200
123 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/Kconfig 2010-05-18 18:11:22.000000000 +0200
124 @@ -1655,6 +1655,8 @@ source "fs/Kconfig"
126 source "arch/arm/Kconfig.debug"
128 +source "kernel/vserver/Kconfig"
130 source "security/Kconfig"
132 source "crypto/Kconfig"
133 diff -NurpP --minimal linux-2.6.34/arch/arm/kernel/calls.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/kernel/calls.S
134 --- linux-2.6.34/arch/arm/kernel/calls.S 2010-05-18 15:07:43.000000000 +0200
135 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/kernel/calls.S 2010-05-18 18:11:22.000000000 +0200
137 /* 310 */ CALL(sys_request_key)
139 CALL(ABI(sys_semtimedop, sys_oabi_semtimedop))
140 -/* vserver */ CALL(sys_ni_syscall)
143 /* 315 */ CALL(sys_ioprio_get)
144 CALL(sys_inotify_init)
145 diff -NurpP --minimal linux-2.6.34/arch/arm/kernel/process.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/kernel/process.c
146 --- linux-2.6.34/arch/arm/kernel/process.c 2010-05-18 15:07:43.000000000 +0200
147 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/kernel/process.c 2010-05-18 18:11:22.000000000 +0200
148 @@ -269,7 +269,8 @@ void __show_regs(struct pt_regs *regs)
149 void show_regs(struct pt_regs * regs)
152 - printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
153 + printk("Pid: %d[#%u], comm: %20s\n",
154 + task_pid_nr(current), current->xid, current->comm);
158 diff -NurpP --minimal linux-2.6.34/arch/arm/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/kernel/traps.c
159 --- linux-2.6.34/arch/arm/kernel/traps.c 2010-05-18 15:07:43.000000000 +0200
160 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/arm/kernel/traps.c 2010-05-18 18:11:22.000000000 +0200
161 @@ -243,8 +243,8 @@ static int __die(const char *str, int er
165 - printk(KERN_EMERG "Process %.*s (pid: %d, stack limit = 0x%p)\n",
166 - TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1);
167 + printk(KERN_EMERG "Process %.*s (pid: %d:#%u, stack limit = 0x%p)\n",
168 + TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), tsk->xid, thread + 1);
170 if (!user_mode(regs) || in_interrupt()) {
171 dump_mem(KERN_EMERG, "Stack: ", regs->ARM_sp,
172 diff -NurpP --minimal linux-2.6.34/arch/avr32/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/avr32/mm/fault.c
173 --- linux-2.6.34/arch/avr32/mm/fault.c 2009-09-10 15:25:20.000000000 +0200
174 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/avr32/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
175 @@ -216,7 +216,8 @@ out_of_memory:
176 down_read(&mm->mmap_sem);
179 - printk("VM: Killing process %s\n", tsk->comm);
180 + printk("VM: Killing process %s(%d:#%u)\n",
181 + tsk->comm, task_pid_nr(tsk), tsk->xid);
183 do_group_exit(SIGKILL);
185 diff -NurpP --minimal linux-2.6.34/arch/cris/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/cris/Kconfig
186 --- linux-2.6.34/arch/cris/Kconfig 2010-05-18 15:07:44.000000000 +0200
187 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/cris/Kconfig 2010-05-18 18:11:22.000000000 +0200
188 @@ -691,6 +691,8 @@ source "drivers/staging/Kconfig"
190 source "arch/cris/Kconfig.debug"
192 +source "kernel/vserver/Kconfig"
194 source "security/Kconfig"
196 source "crypto/Kconfig"
197 diff -NurpP --minimal linux-2.6.34/arch/cris/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/cris/mm/fault.c
198 --- linux-2.6.34/arch/cris/mm/fault.c 2010-02-25 11:51:26.000000000 +0100
199 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/cris/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
200 @@ -245,7 +245,8 @@ do_page_fault(unsigned long address, str
203 up_read(&mm->mmap_sem);
204 - printk("VM: killing process %s\n", tsk->comm);
205 + printk("VM: killing process %s(%d:#%u)\n",
206 + tsk->comm, task_pid_nr(tsk), tsk->xid);
210 diff -NurpP --minimal linux-2.6.34/arch/frv/kernel/kernel_thread.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/frv/kernel/kernel_thread.S
211 --- linux-2.6.34/arch/frv/kernel/kernel_thread.S 2008-12-25 00:26:37.000000000 +0100
212 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/frv/kernel/kernel_thread.S 2010-05-18 18:11:22.000000000 +0200
213 @@ -37,7 +37,7 @@ kernel_thread:
215 # start by forking the current process, but with shared VM
216 setlos.p #__NR_clone,gr7 ; syscall number
217 - ori gr10,#CLONE_VM,gr8 ; first syscall arg [clone_flags]
218 + ori gr10,#CLONE_KT,gr8 ; first syscall arg [clone_flags]
219 sethi.p #0xe4e4,gr9 ; second syscall arg [newsp]
221 setlos.p #0,gr10 ; third syscall arg [parent_tidptr]
222 diff -NurpP --minimal linux-2.6.34/arch/frv/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/frv/mm/fault.c
223 --- linux-2.6.34/arch/frv/mm/fault.c 2009-09-10 15:25:22.000000000 +0200
224 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/frv/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
225 @@ -257,7 +257,8 @@ asmlinkage void do_page_fault(int datamm
228 up_read(&mm->mmap_sem);
229 - printk("VM: killing process %s\n", current->comm);
230 + printk("VM: killing process %s(%d:#%u)\n",
231 + current->comm, task_pid_nr(current), current->xid);
232 if (user_mode(__frame))
233 do_group_exit(SIGKILL);
235 diff -NurpP --minimal linux-2.6.34/arch/h8300/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/h8300/Kconfig
236 --- linux-2.6.34/arch/h8300/Kconfig 2010-02-25 11:51:26.000000000 +0100
237 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/h8300/Kconfig 2010-05-18 18:11:22.000000000 +0200
238 @@ -230,6 +230,8 @@ source "fs/Kconfig"
240 source "arch/h8300/Kconfig.debug"
242 +source "kernel/vserver/Kconfig"
244 source "security/Kconfig"
246 source "crypto/Kconfig"
247 diff -NurpP --minimal linux-2.6.34/arch/ia64/include/asm/tlb.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/include/asm/tlb.h
248 --- linux-2.6.34/arch/ia64/include/asm/tlb.h 2010-02-25 11:51:26.000000000 +0100
249 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/include/asm/tlb.h 2010-05-18 18:11:22.000000000 +0200
251 #include <linux/mm.h>
252 #include <linux/pagemap.h>
253 #include <linux/swap.h>
254 +#include <linux/vs_memory.h>
256 #include <asm/pgalloc.h>
257 #include <asm/processor.h>
258 diff -NurpP --minimal linux-2.6.34/arch/ia64/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/Kconfig
259 --- linux-2.6.34/arch/ia64/Kconfig 2010-05-18 15:07:44.000000000 +0200
260 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/Kconfig 2010-05-18 18:11:22.000000000 +0200
261 @@ -668,6 +668,8 @@ source "fs/Kconfig"
263 source "arch/ia64/Kconfig.debug"
265 +source "kernel/vserver/Kconfig"
267 source "security/Kconfig"
269 source "crypto/Kconfig"
270 diff -NurpP --minimal linux-2.6.34/arch/ia64/kernel/entry.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/entry.S
271 --- linux-2.6.34/arch/ia64/kernel/entry.S 2010-05-18 15:07:44.000000000 +0200
272 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/entry.S 2010-05-18 18:11:22.000000000 +0200
273 @@ -1714,7 +1714,7 @@ sys_call_table:
275 data8 sys_mq_getsetattr
277 - data8 sys_ni_syscall // reserved for vserver
279 data8 sys_waitid // 1270
281 data8 sys_request_key
282 diff -NurpP --minimal linux-2.6.34/arch/ia64/kernel/perfmon.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/perfmon.c
283 --- linux-2.6.34/arch/ia64/kernel/perfmon.c 2010-05-18 15:07:44.000000000 +0200
284 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/perfmon.c 2010-05-19 03:10:18.000000000 +0200
286 #include <linux/completion.h>
287 #include <linux/tracehook.h>
288 #include <linux/slab.h>
289 +#include <linux/vs_memory.h>
291 #include <asm/errno.h>
292 #include <asm/intrinsics.h>
293 diff -NurpP --minimal linux-2.6.34/arch/ia64/kernel/process.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/process.c
294 --- linux-2.6.34/arch/ia64/kernel/process.c 2010-05-18 15:07:44.000000000 +0200
295 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/process.c 2010-05-18 18:11:22.000000000 +0200
296 @@ -113,8 +113,8 @@ show_regs (struct pt_regs *regs)
297 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
300 - printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
301 - smp_processor_id(), current->comm);
302 + printk("\nPid: %d[#%u], CPU %d, comm: %20s\n", task_pid_nr(current),
303 + current->xid, smp_processor_id(), current->comm);
304 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n",
305 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
306 init_utsname()->release);
307 diff -NurpP --minimal linux-2.6.34/arch/ia64/kernel/ptrace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/ptrace.c
308 --- linux-2.6.34/arch/ia64/kernel/ptrace.c 2010-05-18 15:07:44.000000000 +0200
309 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/ptrace.c 2010-05-18 18:11:22.000000000 +0200
311 #include <linux/regset.h>
312 #include <linux/elf.h>
313 #include <linux/tracehook.h>
314 +#include <linux/vs_base.h>
316 #include <asm/pgtable.h>
317 #include <asm/processor.h>
318 diff -NurpP --minimal linux-2.6.34/arch/ia64/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/traps.c
319 --- linux-2.6.34/arch/ia64/kernel/traps.c 2010-05-18 15:07:44.000000000 +0200
320 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/kernel/traps.c 2010-05-18 18:11:22.000000000 +0200
321 @@ -59,8 +59,9 @@ die (const char *str, struct pt_regs *re
324 if (++die.lock_owner_depth < 3) {
325 - printk("%s[%d]: %s %ld [%d]\n",
326 - current->comm, task_pid_nr(current), str, err, ++die_counter);
327 + printk("%s[%d[#%u]]: %s %ld [%d]\n",
328 + current->comm, task_pid_nr(current), current->xid,
329 + str, err, ++die_counter);
330 if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV)
333 @@ -323,8 +324,9 @@ handle_fpu_swa (int fp_fault, struct pt_
334 if ((last.count & 15) < 5 && (ia64_fetchadd(1, &last.count, acq) & 15) < 5) {
335 last.time = current_jiffies + 5 * HZ;
337 - "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
338 - current->comm, task_pid_nr(current), regs->cr_iip + ia64_psr(regs)->ri, isr);
339 + "%s(%d[#%u]): floating-point assist fault at ip %016lx, isr %016lx\n",
340 + current->comm, task_pid_nr(current), current->xid,
341 + regs->cr_iip + ia64_psr(regs)->ri, isr);
345 diff -NurpP --minimal linux-2.6.34/arch/ia64/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/mm/fault.c
346 --- linux-2.6.34/arch/ia64/mm/fault.c 2009-09-10 15:25:23.000000000 +0200
347 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/ia64/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
349 #include <linux/interrupt.h>
350 #include <linux/kprobes.h>
351 #include <linux/kdebug.h>
352 +#include <linux/vs_memory.h>
354 #include <asm/pgtable.h>
355 #include <asm/processor.h>
356 @@ -281,7 +282,8 @@ ia64_do_page_fault (unsigned long addres
357 down_read(&mm->mmap_sem);
360 - printk(KERN_CRIT "VM: killing process %s\n", current->comm);
361 + printk(KERN_CRIT "VM: killing process %s(%d:#%u)\n",
362 + current->comm, task_pid_nr(current), current->xid);
364 do_group_exit(SIGKILL);
366 diff -NurpP --minimal linux-2.6.34/arch/m32r/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m32r/kernel/traps.c
367 --- linux-2.6.34/arch/m32r/kernel/traps.c 2009-12-03 20:01:57.000000000 +0100
368 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m32r/kernel/traps.c 2010-05-18 18:11:22.000000000 +0200
369 @@ -196,8 +196,9 @@ static void show_registers(struct pt_reg
371 printk("SPI: %08lx\n", sp);
373 - printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)",
374 - current->comm, task_pid_nr(current), 0xffff & i, 4096+(unsigned long)current);
375 + printk("Process %s (pid: %d[#%u], process nr: %d, stackpage=%08lx)",
376 + current->comm, task_pid_nr(current), current->xid,
377 + 0xffff & i, 4096+(unsigned long)current);
380 * When in-kernel, we also print out the stack and code at the
381 diff -NurpP --minimal linux-2.6.34/arch/m32r/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m32r/mm/fault.c
382 --- linux-2.6.34/arch/m32r/mm/fault.c 2010-05-18 15:07:44.000000000 +0200
383 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m32r/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
384 @@ -276,7 +276,8 @@ out_of_memory:
385 down_read(&mm->mmap_sem);
388 - printk("VM: killing process %s\n", tsk->comm);
389 + printk("VM: killing process %s(%d:#%u)\n",
390 + tsk->comm, task_pid_nr(tsk), tsk->xid);
391 if (error_code & ACE_USERMODE)
392 do_group_exit(SIGKILL);
394 diff -NurpP --minimal linux-2.6.34/arch/m68k/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68k/Kconfig
395 --- linux-2.6.34/arch/m68k/Kconfig 2010-05-18 15:07:44.000000000 +0200
396 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68k/Kconfig 2010-05-18 18:11:22.000000000 +0200
397 @@ -618,6 +618,8 @@ source "fs/Kconfig"
399 source "arch/m68k/Kconfig.debug"
401 +source "kernel/vserver/Kconfig"
403 source "security/Kconfig"
405 source "crypto/Kconfig"
406 diff -NurpP --minimal linux-2.6.34/arch/m68k/kernel/ptrace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68k/kernel/ptrace.c
407 --- linux-2.6.34/arch/m68k/kernel/ptrace.c 2010-05-18 15:07:44.000000000 +0200
408 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68k/kernel/ptrace.c 2010-05-18 18:11:22.000000000 +0200
410 #include <linux/ptrace.h>
411 #include <linux/user.h>
412 #include <linux/signal.h>
413 +#include <linux/vs_base.h>
415 #include <asm/uaccess.h>
416 #include <asm/page.h>
417 @@ -254,6 +255,8 @@ long arch_ptrace(struct task_struct *chi
418 ret = ptrace_request(child, request, addr, data);
421 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
426 diff -NurpP --minimal linux-2.6.34/arch/m68k/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68k/kernel/traps.c
427 --- linux-2.6.34/arch/m68k/kernel/traps.c 2009-09-10 15:25:23.000000000 +0200
428 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68k/kernel/traps.c 2010-05-18 18:11:22.000000000 +0200
429 @@ -906,8 +906,8 @@ void show_registers(struct pt_regs *regs
430 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
431 regs->d4, regs->d5, regs->a0, regs->a1);
433 - printk("Process %s (pid: %d, task=%p)\n",
434 - current->comm, task_pid_nr(current), current);
435 + printk("Process %s (pid: %d[#%u], task=%p)\n",
436 + current->comm, task_pid_nr(current), current->xid, current);
437 addr = (unsigned long)&fp->un;
438 printk("Frame format=%X ", regs->format);
439 switch (regs->format) {
440 diff -NurpP --minimal linux-2.6.34/arch/m68k/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68k/mm/fault.c
441 --- linux-2.6.34/arch/m68k/mm/fault.c 2009-09-10 15:25:23.000000000 +0200
442 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68k/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
443 @@ -186,7 +186,8 @@ out_of_memory:
447 - printk("VM: killing process %s\n", current->comm);
448 + printk("VM: killing process %s(%d:#%u)\n",
449 + current->comm, task_pid_nr(current), current->xid);
451 do_group_exit(SIGKILL);
453 diff -NurpP --minimal linux-2.6.34/arch/m68knommu/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68knommu/Kconfig
454 --- linux-2.6.34/arch/m68knommu/Kconfig 2010-02-25 11:51:27.000000000 +0100
455 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68knommu/Kconfig 2010-05-18 18:11:22.000000000 +0200
456 @@ -734,6 +734,8 @@ source "fs/Kconfig"
458 source "arch/m68knommu/Kconfig.debug"
460 +source "kernel/vserver/Kconfig"
462 source "security/Kconfig"
464 source "crypto/Kconfig"
465 diff -NurpP --minimal linux-2.6.34/arch/m68knommu/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68knommu/kernel/traps.c
466 --- linux-2.6.34/arch/m68knommu/kernel/traps.c 2009-09-10 15:25:23.000000000 +0200
467 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/m68knommu/kernel/traps.c 2010-05-18 18:11:22.000000000 +0200
468 @@ -78,8 +78,9 @@ void die_if_kernel(char *str, struct pt_
469 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
470 fp->d4, fp->d5, fp->a0, fp->a1);
472 - printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
473 - current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
474 + printk(KERN_EMERG "Process %s (pid: %d[#%u], stackpage=%08lx)\n",
475 + current->comm, task_pid_nr(current), current->xid,
476 + PAGE_SIZE+(unsigned long)current);
477 show_stack(NULL, (unsigned long *)(fp + 1));
478 add_taint(TAINT_DIE);
480 diff -NurpP --minimal linux-2.6.34/arch/mips/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/Kconfig
481 --- linux-2.6.34/arch/mips/Kconfig 2010-05-18 15:07:44.000000000 +0200
482 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/Kconfig 2010-05-18 18:11:22.000000000 +0200
483 @@ -2251,6 +2251,8 @@ source "fs/Kconfig"
485 source "arch/mips/Kconfig.debug"
487 +source "kernel/vserver/Kconfig"
489 source "security/Kconfig"
491 source "crypto/Kconfig"
492 diff -NurpP --minimal linux-2.6.34/arch/mips/kernel/ptrace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/ptrace.c
493 --- linux-2.6.34/arch/mips/kernel/ptrace.c 2010-05-18 15:07:44.000000000 +0200
494 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/ptrace.c 2010-05-18 18:11:22.000000000 +0200
496 #include <linux/security.h>
497 #include <linux/audit.h>
498 #include <linux/seccomp.h>
499 +#include <linux/vs_base.h>
501 #include <asm/byteorder.h>
503 @@ -259,6 +260,9 @@ long arch_ptrace(struct task_struct *chi
507 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
511 /* when I and D space are separate, these will need to be fixed. */
512 case PTRACE_PEEKTEXT: /* read word at location addr. */
513 diff -NurpP --minimal linux-2.6.34/arch/mips/kernel/scall32-o32.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/scall32-o32.S
514 --- linux-2.6.34/arch/mips/kernel/scall32-o32.S 2010-02-25 11:51:28.000000000 +0100
515 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/scall32-o32.S 2010-05-18 18:11:22.000000000 +0200
516 @@ -525,7 +525,7 @@ einval: li v0, -ENOSYS
517 sys sys_mq_timedreceive 5
518 sys sys_mq_notify 2 /* 4275 */
519 sys sys_mq_getsetattr 3
520 - sys sys_ni_syscall 0 /* sys_vserver */
523 sys sys_ni_syscall 0 /* available, was setaltroot */
524 sys sys_add_key 5 /* 4280 */
525 diff -NurpP --minimal linux-2.6.34/arch/mips/kernel/scall64-64.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/scall64-64.S
526 --- linux-2.6.34/arch/mips/kernel/scall64-64.S 2010-02-25 11:51:28.000000000 +0100
527 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/scall64-64.S 2010-05-18 18:11:22.000000000 +0200
528 @@ -362,7 +362,7 @@ sys_call_table:
529 PTR sys_mq_timedreceive
531 PTR sys_mq_getsetattr /* 5235 */
532 - PTR sys_ni_syscall /* sys_vserver */
535 PTR sys_ni_syscall /* available, was setaltroot */
537 diff -NurpP --minimal linux-2.6.34/arch/mips/kernel/scall64-n32.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/scall64-n32.S
538 --- linux-2.6.34/arch/mips/kernel/scall64-n32.S 2010-05-18 15:07:44.000000000 +0200
539 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/scall64-n32.S 2010-05-18 18:11:22.000000000 +0200
540 @@ -360,7 +360,7 @@ EXPORT(sysn32_call_table)
541 PTR compat_sys_mq_timedreceive
542 PTR compat_sys_mq_notify
543 PTR compat_sys_mq_getsetattr
544 - PTR sys_ni_syscall /* 6240, sys_vserver */
545 + PTR sys32_vserver /* 6240 */
546 PTR compat_sys_waitid
547 PTR sys_ni_syscall /* available, was setaltroot */
549 diff -NurpP --minimal linux-2.6.34/arch/mips/kernel/scall64-o32.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/scall64-o32.S
550 --- linux-2.6.34/arch/mips/kernel/scall64-o32.S 2010-05-18 15:07:44.000000000 +0200
551 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/scall64-o32.S 2010-05-18 18:11:22.000000000 +0200
552 @@ -480,7 +480,7 @@ sys_call_table:
553 PTR compat_sys_mq_timedreceive
554 PTR compat_sys_mq_notify /* 4275 */
555 PTR compat_sys_mq_getsetattr
556 - PTR sys_ni_syscall /* sys_vserver */
559 PTR sys_ni_syscall /* available, was setaltroot */
560 PTR sys_add_key /* 4280 */
561 diff -NurpP --minimal linux-2.6.34/arch/mips/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/traps.c
562 --- linux-2.6.34/arch/mips/kernel/traps.c 2010-05-18 15:07:44.000000000 +0200
563 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mips/kernel/traps.c 2010-05-18 18:11:22.000000000 +0200
564 @@ -334,9 +334,10 @@ void show_registers(const struct pt_regs
568 - printk("Process %s (pid: %d, threadinfo=%p, task=%p, tls=%0*lx)\n",
569 - current->comm, current->pid, current_thread_info(), current,
570 - field, current_thread_info()->tp_value);
571 + printk("Process %s (pid: %d:#%u, threadinfo=%p, task=%p, tls=%0*lx)\n",
572 + current->comm, task_pid_nr(current), current->xid,
573 + current_thread_info(), current,
574 + field, current_thread_info()->tp_value);
575 if (cpu_has_userlocal) {
578 diff -NurpP --minimal linux-2.6.34/arch/mn10300/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mn10300/mm/fault.c
579 --- linux-2.6.34/arch/mn10300/mm/fault.c 2009-09-10 15:25:39.000000000 +0200
580 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/mn10300/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
581 @@ -339,7 +339,8 @@ no_context:
583 up_read(&mm->mmap_sem);
584 monitor_signal(regs);
585 - printk(KERN_ALERT "VM: killing process %s\n", tsk->comm);
586 + printk(KERN_ALERT "VM: killing process %s(%d:#%u)\n",
587 + tsk->comm, task_pid_nr(tsk), tsk->xid);
588 if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR)
591 diff -NurpP --minimal linux-2.6.34/arch/parisc/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/parisc/Kconfig
592 --- linux-2.6.34/arch/parisc/Kconfig 2010-05-18 15:07:44.000000000 +0200
593 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/parisc/Kconfig 2010-05-18 18:11:22.000000000 +0200
594 @@ -296,6 +296,8 @@ source "fs/Kconfig"
596 source "arch/parisc/Kconfig.debug"
598 +source "kernel/vserver/Kconfig"
600 source "security/Kconfig"
602 source "crypto/Kconfig"
603 diff -NurpP --minimal linux-2.6.34/arch/parisc/kernel/syscall_table.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/parisc/kernel/syscall_table.S
604 --- linux-2.6.34/arch/parisc/kernel/syscall_table.S 2010-05-18 15:07:44.000000000 +0200
605 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/parisc/kernel/syscall_table.S 2010-05-18 18:11:22.000000000 +0200
607 ENTRY_COMP(mbind) /* 260 */
608 ENTRY_COMP(get_mempolicy)
609 ENTRY_COMP(set_mempolicy)
610 - ENTRY_SAME(ni_syscall) /* 263: reserved for vserver */
611 + ENTRY_DIFF(vserver)
613 ENTRY_SAME(request_key) /* 265 */
615 diff -NurpP --minimal linux-2.6.34/arch/parisc/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/parisc/kernel/traps.c
616 --- linux-2.6.34/arch/parisc/kernel/traps.c 2009-09-10 15:25:40.000000000 +0200
617 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/parisc/kernel/traps.c 2010-05-18 18:11:22.000000000 +0200
618 @@ -236,8 +236,9 @@ void die_if_kernel(char *str, struct pt_
622 - printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
623 - current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
624 + printk(KERN_CRIT "%s (pid %d:#%u): %s (code %ld) at " RFMT "\n",
625 + current->comm, task_pid_nr(current), current->xid,
626 + str, err, regs->iaoq[0]);
627 #ifdef PRINT_USER_FAULTS
628 /* XXX for debugging only */
630 @@ -270,8 +271,8 @@ void die_if_kernel(char *str, struct pt_
631 pdc_console_restart();
634 - printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
635 - current->comm, task_pid_nr(current), str, err);
636 + printk(KERN_CRIT "%s (pid %d:#%u): %s (code %ld)\n",
637 + current->comm, task_pid_nr(current), current->xid, str, err);
639 /* Wot's wrong wif bein' racy? */
640 if (current->thread.flags & PARISC_KERNEL_DEATH) {
641 diff -NurpP --minimal linux-2.6.34/arch/parisc/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/parisc/mm/fault.c
642 --- linux-2.6.34/arch/parisc/mm/fault.c 2009-09-10 15:25:40.000000000 +0200
643 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/parisc/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
644 @@ -237,8 +237,9 @@ bad_area:
646 #ifdef PRINT_USER_FAULTS
647 printk(KERN_DEBUG "\n");
648 - printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
649 - task_pid_nr(tsk), tsk->comm, code, address);
650 + printk(KERN_DEBUG "do_page_fault() pid=%d:#%u "
651 + "command='%s' type=%lu address=0x%08lx\n",
652 + task_pid_nr(tsk), tsk->xid, tsk->comm, code, address);
654 printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
655 vma->vm_start, vma->vm_end);
656 @@ -264,7 +265,8 @@ no_context:
659 up_read(&mm->mmap_sem);
660 - printk(KERN_CRIT "VM: killing process %s\n", current->comm);
661 + printk(KERN_CRIT "VM: killing process %s(%d:#%u)\n",
662 + current->comm, current->pid, current->xid);
664 do_group_exit(SIGKILL);
666 diff -NurpP --minimal linux-2.6.34/arch/powerpc/include/asm/unistd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/include/asm/unistd.h
667 --- linux-2.6.34/arch/powerpc/include/asm/unistd.h 2010-05-18 15:07:45.000000000 +0200
668 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/include/asm/unistd.h 2010-05-18 18:11:22.000000000 +0200
671 #define __NR_rtas 255
672 #define __NR_sys_debug_setcontext 256
673 -/* Number 257 is reserved for vserver */
674 +#define __NR_vserver 257
675 #define __NR_migrate_pages 258
676 #define __NR_mbind 259
677 #define __NR_get_mempolicy 260
678 diff -NurpP --minimal linux-2.6.34/arch/powerpc/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/Kconfig
679 --- linux-2.6.34/arch/powerpc/Kconfig 2010-05-18 15:07:44.000000000 +0200
680 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/Kconfig 2010-05-18 18:11:22.000000000 +0200
681 @@ -986,6 +986,8 @@ source "lib/Kconfig"
683 source "arch/powerpc/Kconfig.debug"
685 +source "kernel/vserver/Kconfig"
687 source "security/Kconfig"
690 diff -NurpP --minimal linux-2.6.34/arch/powerpc/kernel/process.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/kernel/process.c
691 --- linux-2.6.34/arch/powerpc/kernel/process.c 2010-05-18 15:07:45.000000000 +0200
692 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/kernel/process.c 2010-05-18 18:11:22.000000000 +0200
693 @@ -602,8 +602,9 @@ void show_regs(struct pt_regs * regs)
695 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
697 - printk("TASK = %p[%d] '%s' THREAD: %p",
698 - current, task_pid_nr(current), current->comm, task_thread_info(current));
699 + printk("TASK = %p[%d,#%u] '%s' THREAD: %p",
700 + current, task_pid_nr(current), current->xid,
701 + current->comm, task_thread_info(current));
704 printk(" CPU: %d", raw_smp_processor_id());
705 diff -NurpP --minimal linux-2.6.34/arch/powerpc/kernel/traps.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/kernel/traps.c
706 --- linux-2.6.34/arch/powerpc/kernel/traps.c 2010-05-18 15:07:45.000000000 +0200
707 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/kernel/traps.c 2010-05-18 18:11:22.000000000 +0200
708 @@ -924,8 +924,9 @@ void nonrecoverable_exception(struct pt_
710 void trace_syscall(struct pt_regs *regs)
712 - printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
713 - current, task_pid_nr(current), regs->nip, regs->link, regs->gpr[0],
714 + printk("Task: %p(%d[#%u]), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
715 + current, task_pid_nr(current), current->xid,
716 + regs->nip, regs->link, regs->gpr[0],
717 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
720 diff -NurpP --minimal linux-2.6.34/arch/powerpc/kernel/vdso.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/kernel/vdso.c
721 --- linux-2.6.34/arch/powerpc/kernel/vdso.c 2010-02-25 11:51:31.000000000 +0100
722 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/kernel/vdso.c 2010-05-18 18:11:22.000000000 +0200
724 #include <linux/security.h>
725 #include <linux/bootmem.h>
726 #include <linux/lmb.h>
727 +#include <linux/vs_memory.h>
729 #include <asm/pgtable.h>
730 #include <asm/system.h>
731 diff -NurpP --minimal linux-2.6.34/arch/powerpc/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/mm/fault.c
732 --- linux-2.6.34/arch/powerpc/mm/fault.c 2010-02-25 11:51:31.000000000 +0100
733 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/powerpc/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
734 @@ -364,7 +364,8 @@ out_of_memory:
735 down_read(&mm->mmap_sem);
738 - printk("VM: killing process %s\n", current->comm);
739 + printk("VM: killing process %s(%d:#%u)\n",
740 + current->comm, current->pid, current->xid);
742 do_group_exit(SIGKILL);
744 diff -NurpP --minimal linux-2.6.34/arch/s390/include/asm/tlb.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/include/asm/tlb.h
745 --- linux-2.6.34/arch/s390/include/asm/tlb.h 2009-09-10 15:25:43.000000000 +0200
746 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/include/asm/tlb.h 2010-05-18 18:11:22.000000000 +0200
749 #include <linux/mm.h>
750 #include <linux/swap.h>
751 +#include <linux/vs_memory.h>
753 #include <asm/processor.h>
754 #include <asm/pgalloc.h>
756 diff -NurpP --minimal linux-2.6.34/arch/s390/include/asm/unistd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/include/asm/unistd.h
757 --- linux-2.6.34/arch/s390/include/asm/unistd.h 2010-05-18 15:07:45.000000000 +0200
758 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/include/asm/unistd.h 2010-05-18 18:11:22.000000000 +0200
760 #define __NR_clock_gettime (__NR_timer_create+6)
761 #define __NR_clock_getres (__NR_timer_create+7)
762 #define __NR_clock_nanosleep (__NR_timer_create+8)
763 -/* Number 263 is reserved for vserver */
764 +#define __NR_vserver 263
765 #define __NR_statfs64 265
766 #define __NR_fstatfs64 266
767 #define __NR_remap_file_pages 267
768 diff -NurpP --minimal linux-2.6.34/arch/s390/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/Kconfig
769 --- linux-2.6.34/arch/s390/Kconfig 2010-05-18 15:07:45.000000000 +0200
770 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/Kconfig 2010-05-18 18:11:22.000000000 +0200
771 @@ -636,6 +636,8 @@ source "fs/Kconfig"
773 source "arch/s390/Kconfig.debug"
775 +source "kernel/vserver/Kconfig"
777 source "security/Kconfig"
779 source "crypto/Kconfig"
780 diff -NurpP --minimal linux-2.6.34/arch/s390/kernel/ptrace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/kernel/ptrace.c
781 --- linux-2.6.34/arch/s390/kernel/ptrace.c 2010-05-18 15:07:45.000000000 +0200
782 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/kernel/ptrace.c 2010-05-18 18:11:22.000000000 +0200
784 #include <linux/regset.h>
785 #include <linux/tracehook.h>
786 #include <linux/seccomp.h>
787 +#include <linux/vs_base.h>
788 #include <trace/syscall.h>
789 #include <asm/compat.h>
790 #include <asm/segment.h>
791 diff -NurpP --minimal linux-2.6.34/arch/s390/kernel/syscalls.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/kernel/syscalls.S
792 --- linux-2.6.34/arch/s390/kernel/syscalls.S 2010-05-18 15:07:45.000000000 +0200
793 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/s390/kernel/syscalls.S 2010-05-18 18:11:22.000000000 +0200
794 @@ -271,7 +271,7 @@ SYSCALL(sys_clock_settime,sys_clock_sett
795 SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */
796 SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
797 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
798 -NI_SYSCALL /* reserved for vserver */
799 +SYSCALL(sys_vserver,sys_vserver,sys32_vserver)
800 SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
801 SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
802 SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
803 diff -NurpP --minimal linux-2.6.34/arch/sh/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/Kconfig
804 --- linux-2.6.34/arch/sh/Kconfig 2010-05-18 15:07:45.000000000 +0200
805 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/Kconfig 2010-05-18 18:11:22.000000000 +0200
806 @@ -859,6 +859,8 @@ source "fs/Kconfig"
808 source "arch/sh/Kconfig.debug"
810 +source "kernel/vserver/Kconfig"
812 source "security/Kconfig"
814 source "crypto/Kconfig"
815 diff -NurpP --minimal linux-2.6.34/arch/sh/kernel/irq.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/kernel/irq.c
816 --- linux-2.6.34/arch/sh/kernel/irq.c 2010-02-25 11:51:33.000000000 +0100
817 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/kernel/irq.c 2010-05-18 18:11:22.000000000 +0200
819 #include <linux/kernel_stat.h>
820 #include <linux/seq_file.h>
821 #include <linux/ftrace.h>
822 +// #include <linux/vs_context.h>
823 #include <asm/processor.h>
824 #include <asm/machvec.h>
825 #include <asm/uaccess.h>
826 diff -NurpP --minimal linux-2.6.34/arch/sh/kernel/vsyscall/vsyscall.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/kernel/vsyscall/vsyscall.c
827 --- linux-2.6.34/arch/sh/kernel/vsyscall/vsyscall.c 2010-05-18 15:07:45.000000000 +0200
828 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/kernel/vsyscall/vsyscall.c 2010-05-18 18:11:22.000000000 +0200
830 #include <linux/elf.h>
831 #include <linux/sched.h>
832 #include <linux/err.h>
833 +#include <linux/vs_memory.h>
836 * Should the kernel map a VDSO page into processes and pass its
837 diff -NurpP --minimal linux-2.6.34/arch/sh/mm/fault_32.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/mm/fault_32.c
838 --- linux-2.6.34/arch/sh/mm/fault_32.c 2010-05-18 15:07:45.000000000 +0200
839 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/mm/fault_32.c 2010-05-18 18:11:22.000000000 +0200
840 @@ -295,7 +295,8 @@ out_of_memory:
841 down_read(&mm->mmap_sem);
844 - printk("VM: killing process %s\n", tsk->comm);
845 + printk("VM: killing process %s(%d:#%u)\n",
846 + tsk->comm, task_pid_nr(tsk), tsk->xid);
848 do_group_exit(SIGKILL);
850 diff -NurpP --minimal linux-2.6.34/arch/sh/mm/tlbflush_64.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/mm/tlbflush_64.c
851 --- linux-2.6.34/arch/sh/mm/tlbflush_64.c 2010-05-18 15:07:45.000000000 +0200
852 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sh/mm/tlbflush_64.c 2010-05-18 18:11:22.000000000 +0200
853 @@ -306,7 +306,8 @@ out_of_memory:
854 down_read(&mm->mmap_sem);
857 - printk("VM: killing process %s\n", tsk->comm);
858 + printk("VM: killing process %s(%d:#%u)\n",
859 + tsk->comm, task_pid_nr(tsk), tsk->xid);
861 do_group_exit(SIGKILL);
863 diff -NurpP --minimal linux-2.6.34/arch/sparc/include/asm/tlb_64.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/include/asm/tlb_64.h
864 --- linux-2.6.34/arch/sparc/include/asm/tlb_64.h 2009-09-10 15:25:45.000000000 +0200
865 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/include/asm/tlb_64.h 2010-05-18 18:11:22.000000000 +0200
868 #include <linux/swap.h>
869 #include <linux/pagemap.h>
870 +#include <linux/vs_memory.h>
871 #include <asm/pgalloc.h>
872 #include <asm/tlbflush.h>
873 #include <asm/mmu_context.h>
874 diff -NurpP --minimal linux-2.6.34/arch/sparc/include/asm/unistd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/include/asm/unistd.h
875 --- linux-2.6.34/arch/sparc/include/asm/unistd.h 2010-05-18 15:07:45.000000000 +0200
876 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/include/asm/unistd.h 2010-05-18 18:11:22.000000000 +0200
878 #define __NR_timer_getoverrun 264
879 #define __NR_timer_delete 265
880 #define __NR_timer_create 266
881 -/* #define __NR_vserver 267 Reserved for VSERVER */
882 +#define __NR_vserver 267
883 #define __NR_io_setup 268
884 #define __NR_io_destroy 269
885 #define __NR_io_submit 270
886 diff -NurpP --minimal linux-2.6.34/arch/sparc/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/Kconfig
887 --- linux-2.6.34/arch/sparc/Kconfig 2010-05-18 15:07:45.000000000 +0200
888 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/Kconfig 2010-05-18 18:11:22.000000000 +0200
889 @@ -567,6 +567,8 @@ source "fs/Kconfig"
891 source "arch/sparc/Kconfig.debug"
893 +source "kernel/vserver/Kconfig"
895 source "security/Kconfig"
897 source "crypto/Kconfig"
898 diff -NurpP --minimal linux-2.6.34/arch/sparc/kernel/systbls_32.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/kernel/systbls_32.S
899 --- linux-2.6.34/arch/sparc/kernel/systbls_32.S 2010-02-25 11:51:34.000000000 +0100
900 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/kernel/systbls_32.S 2010-05-18 18:11:22.000000000 +0200
901 @@ -70,7 +70,7 @@ sys_call_table:
902 /*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
903 /*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
904 /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
905 -/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
906 +/*265*/ .long sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
907 /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
908 /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
909 /*280*/ .long sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
910 diff -NurpP --minimal linux-2.6.34/arch/sparc/kernel/systbls_64.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/kernel/systbls_64.S
911 --- linux-2.6.34/arch/sparc/kernel/systbls_64.S 2010-05-18 15:07:45.000000000 +0200
912 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/sparc/kernel/systbls_64.S 2010-05-18 18:11:22.000000000 +0200
913 @@ -71,7 +71,7 @@ sys_call_table32:
914 /*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
915 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
916 /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
917 - .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
918 + .word sys_timer_delete, compat_sys_timer_create, sys32_vserver, compat_sys_io_setup, sys_io_destroy
919 /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
920 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
921 /*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
922 @@ -146,7 +146,7 @@ sys_call_table:
923 /*250*/ .word sys_64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
924 .word sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
925 /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
926 - .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
927 + .word sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
928 /*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
929 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
930 /*280*/ .word sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
931 diff -NurpP --minimal linux-2.6.34/arch/um/include/asm/tlb.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/include/asm/tlb.h
932 --- linux-2.6.34/arch/um/include/asm/tlb.h 2009-09-10 15:25:46.000000000 +0200
933 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/include/asm/tlb.h 2010-05-18 18:11:22.000000000 +0200
936 #include <linux/pagemap.h>
937 #include <linux/swap.h>
938 +#include <linux/vs_memory.h>
939 #include <asm/percpu.h>
940 #include <asm/pgalloc.h>
941 #include <asm/tlbflush.h>
942 diff -NurpP --minimal linux-2.6.34/arch/um/include/shared/kern_constants.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/include/shared/kern_constants.h
943 --- linux-2.6.34/arch/um/include/shared/kern_constants.h 1970-01-01 01:00:00.000000000 +0100
944 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/include/shared/kern_constants.h 2010-05-18 18:11:22.000000000 +0200
946 +#include "../../../../include/generated/asm-offsets.h"
947 diff -NurpP --minimal linux-2.6.34/arch/um/include/shared/user_constants.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/include/shared/user_constants.h
948 --- linux-2.6.34/arch/um/include/shared/user_constants.h 1970-01-01 01:00:00.000000000 +0100
949 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/include/shared/user_constants.h 2010-05-18 18:11:22.000000000 +0200
954 + * This file was generated by arch/um/Makefile
958 +#define HOST_SC_CR2 176 /* offsetof(struct sigcontext, cr2) # */
959 +#define HOST_SC_ERR 152 /* offsetof(struct sigcontext, err) # */
960 +#define HOST_SC_TRAPNO 160 /* offsetof(struct sigcontext, trapno) # */
961 +#define HOST_FP_SIZE 64 /* sizeof(struct _fpstate) / sizeof(unsigned long) # */
962 +#define HOST_RBX 5 /* RBX # */
963 +#define HOST_RCX 11 /* RCX # */
964 +#define HOST_RDI 14 /* RDI # */
965 +#define HOST_RSI 13 /* RSI # */
966 +#define HOST_RDX 12 /* RDX # */
967 +#define HOST_RBP 4 /* RBP # */
968 +#define HOST_RAX 10 /* RAX # */
969 +#define HOST_R8 9 /* R8 # */
970 +#define HOST_R9 8 /* R9 # */
971 +#define HOST_R10 7 /* R10 # */
972 +#define HOST_R11 6 /* R11 # */
973 +#define HOST_R12 3 /* R12 # */
974 +#define HOST_R13 2 /* R13 # */
975 +#define HOST_R14 1 /* R14 # */
976 +#define HOST_R15 0 /* R15 # */
977 +#define HOST_ORIG_RAX 15 /* ORIG_RAX # */
978 +#define HOST_CS 17 /* CS # */
979 +#define HOST_SS 20 /* SS # */
980 +#define HOST_EFLAGS 18 /* EFLAGS # */
981 +#define HOST_IP 16 /* RIP # */
982 +#define HOST_SP 19 /* RSP # */
983 +#define UM_FRAME_SIZE 216 /* sizeof(struct user_regs_struct) # */
984 +#define UM_POLLIN 1 /* POLLIN # */
985 +#define UM_POLLPRI 2 /* POLLPRI # */
986 +#define UM_POLLOUT 4 /* POLLOUT # */
987 +#define UM_PROT_READ 1 /* PROT_READ # */
988 +#define UM_PROT_WRITE 2 /* PROT_WRITE # */
989 +#define UM_PROT_EXEC 4 /* PROT_EXEC # */
991 diff -NurpP --minimal linux-2.6.34/arch/um/Kconfig.rest linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/Kconfig.rest
992 --- linux-2.6.34/arch/um/Kconfig.rest 2009-06-11 17:12:19.000000000 +0200
993 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/Kconfig.rest 2010-05-18 18:11:22.000000000 +0200
994 @@ -18,6 +18,8 @@ source "drivers/connector/Kconfig"
998 +source "kernel/vserver/Kconfig"
1000 source "security/Kconfig"
1002 source "crypto/Kconfig"
1003 diff -NurpP --minimal linux-2.6.34/arch/um/kernel/config.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/kernel/config.c
1004 --- linux-2.6.34/arch/um/kernel/config.c 1970-01-01 01:00:00.000000000 +0100
1005 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/kernel/config.c 2010-05-18 18:11:22.000000000 +0200
1008 + * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
1009 + * Licensed under the GPL
1013 +#include <stdlib.h>
1016 +static __initdata const char *config[] = {
1019 +"# Automatically generated make config: don't edit\n",
1020 +"# Linux kernel version: 2.6.33-vs2.3.0.36.29.1\n",
1021 +"# Wed Mar 10 20:29:46 2010\n",
1023 +"CONFIG_DEFCONFIG_LIST=\"arch/$ARCH/defconfig\"\n",
1024 +"CONFIG_GENERIC_HARDIRQS=y\n",
1027 +"CONFIG_NO_IOMEM=y\n",
1028 +"# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set\n",
1029 +"CONFIG_LOCKDEP_SUPPORT=y\n",
1030 +"# CONFIG_STACKTRACE_SUPPORT is not set\n",
1031 +"CONFIG_GENERIC_CALIBRATE_DELAY=y\n",
1032 +"CONFIG_GENERIC_BUG=y\n",
1033 +"CONFIG_GENERIC_TIME=y\n",
1034 +"CONFIG_GENERIC_CLOCKEVENTS=y\n",
1035 +"CONFIG_IRQ_RELEASE_METHOD=y\n",
1039 +"# UML-specific options\n",
1043 +"# Host processor type and features\n",
1045 +"# CONFIG_M386 is not set\n",
1046 +"# CONFIG_M486 is not set\n",
1047 +"# CONFIG_M586 is not set\n",
1048 +"# CONFIG_M586TSC is not set\n",
1049 +"# CONFIG_M586MMX is not set\n",
1050 +"# CONFIG_M686 is not set\n",
1051 +"# CONFIG_MPENTIUMII is not set\n",
1052 +"# CONFIG_MPENTIUMIII is not set\n",
1053 +"# CONFIG_MPENTIUMM is not set\n",
1054 +"# CONFIG_MPENTIUM4 is not set\n",
1055 +"# CONFIG_MK6 is not set\n",
1056 +"# CONFIG_MK7 is not set\n",
1058 +"# CONFIG_MCRUSOE is not set\n",
1059 +"# CONFIG_MEFFICEON is not set\n",
1060 +"# CONFIG_MWINCHIPC6 is not set\n",
1061 +"# CONFIG_MWINCHIP3D is not set\n",
1062 +"# CONFIG_MGEODEGX1 is not set\n",
1063 +"# CONFIG_MGEODE_LX is not set\n",
1064 +"# CONFIG_MCYRIXIII is not set\n",
1065 +"# CONFIG_MVIAC3_2 is not set\n",
1066 +"# CONFIG_MVIAC7 is not set\n",
1067 +"# CONFIG_MPSC is not set\n",
1068 +"# CONFIG_MCORE2 is not set\n",
1069 +"# CONFIG_MATOM is not set\n",
1070 +"# CONFIG_GENERIC_CPU is not set\n",
1071 +"CONFIG_X86_CPU=y\n",
1072 +"CONFIG_X86_INTERNODE_CACHE_SHIFT=6\n",
1073 +"# CONFIG_X86_CMPXCHG is not set\n",
1074 +"CONFIG_X86_L1_CACHE_SHIFT=6\n",
1075 +"CONFIG_X86_WP_WORKS_OK=y\n",
1076 +"CONFIG_X86_INTEL_USERCOPY=y\n",
1077 +"CONFIG_X86_USE_PPRO_CHECKSUM=y\n",
1078 +"CONFIG_X86_TSC=y\n",
1079 +"CONFIG_X86_CMOV=y\n",
1080 +"CONFIG_X86_MINIMUM_CPU_FAMILY=3\n",
1081 +"CONFIG_CPU_SUP_INTEL=y\n",
1082 +"CONFIG_CPU_SUP_AMD=y\n",
1083 +"CONFIG_CPU_SUP_CENTAUR=y\n",
1084 +"CONFIG_UML_X86=y\n",
1085 +"CONFIG_64BIT=y\n",
1086 +"# CONFIG_X86_32 is not set\n",
1087 +"# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set\n",
1088 +"CONFIG_RWSEM_GENERIC_SPINLOCK=y\n",
1089 +"# CONFIG_ARCH_HAS_SC_SIGNALS is not set\n",
1090 +"# CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA is not set\n",
1091 +"CONFIG_SMP_BROKEN=y\n",
1092 +"CONFIG_GENERIC_HWEIGHT=y\n",
1093 +"# CONFIG_STATIC_LINK is not set\n",
1094 +"CONFIG_FLATMEM=y\n",
1095 +"CONFIG_FLAT_NODE_MEM_MAP=y\n",
1096 +"CONFIG_PAGEFLAGS_EXTENDED=y\n",
1097 +"CONFIG_SPLIT_PTLOCK_CPUS=4\n",
1098 +"CONFIG_PHYS_ADDR_T_64BIT=y\n",
1099 +"CONFIG_ZONE_DMA_FLAG=0\n",
1100 +"CONFIG_VIRT_TO_BUS=y\n",
1101 +"# CONFIG_KSM is not set\n",
1102 +"CONFIG_DEFAULT_MMAP_MIN_ADDR=4096\n",
1103 +"# CONFIG_NO_HZ is not set\n",
1104 +"# CONFIG_HIGH_RES_TIMERS is not set\n",
1105 +"CONFIG_GENERIC_CLOCKEVENTS_BUILD=y\n",
1106 +"CONFIG_LD_SCRIPT_DYN=y\n",
1107 +"# CONFIG_BINFMT_ELF is not set\n",
1108 +"# CONFIG_HAVE_AOUT is not set\n",
1109 +"# CONFIG_BINFMT_MISC is not set\n",
1110 +"# CONFIG_HOSTFS is not set\n",
1111 +"# CONFIG_MCONSOLE is not set\n",
1112 +"CONFIG_KERNEL_STACK_ORDER=1\n",
1115 +"# General setup\n",
1117 +"# CONFIG_EXPERIMENTAL is not set\n",
1118 +"CONFIG_BROKEN_ON_SMP=y\n",
1119 +"CONFIG_INIT_ENV_ARG_LIMIT=128\n",
1120 +"CONFIG_LOCALVERSION=\"\"\n",
1121 +"# CONFIG_LOCALVERSION_AUTO is not set\n",
1122 +"# CONFIG_SWAP is not set\n",
1123 +"CONFIG_SYSVIPC=y\n",
1124 +"CONFIG_SYSVIPC_SYSCTL=y\n",
1125 +"# CONFIG_BSD_PROCESS_ACCT is not set\n",
1128 +"# RCU Subsystem\n",
1130 +"CONFIG_TREE_RCU=y\n",
1131 +"# CONFIG_TREE_PREEMPT_RCU is not set\n",
1132 +"# CONFIG_TINY_RCU is not set\n",
1133 +"# CONFIG_RCU_TRACE is not set\n",
1134 +"CONFIG_RCU_FANOUT=64\n",
1135 +"# CONFIG_RCU_FANOUT_EXACT is not set\n",
1136 +"# CONFIG_TREE_RCU_TRACE is not set\n",
1137 +"# CONFIG_IKCONFIG is not set\n",
1138 +"CONFIG_LOG_BUF_SHIFT=17\n",
1139 +"# CONFIG_CGROUPS is not set\n",
1140 +"# CONFIG_SYSFS_DEPRECATED_V2 is not set\n",
1141 +"# CONFIG_RELAY is not set\n",
1142 +"CONFIG_NAMESPACES=y\n",
1143 +"CONFIG_UTS_NS=y\n",
1144 +"CONFIG_IPC_NS=y\n",
1145 +"CONFIG_USER_NS=y\n",
1146 +"# CONFIG_BLK_DEV_INITRD is not set\n",
1147 +"# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set\n",
1148 +"CONFIG_SYSCTL=y\n",
1149 +"CONFIG_ANON_INODES=y\n",
1150 +"# CONFIG_EMBEDDED is not set\n",
1151 +"CONFIG_UID16=y\n",
1152 +"CONFIG_SYSCTL_SYSCALL=y\n",
1153 +"CONFIG_KALLSYMS=y\n",
1154 +"# CONFIG_KALLSYMS_EXTRA_PASS is not set\n",
1155 +"CONFIG_HOTPLUG=y\n",
1156 +"CONFIG_PRINTK=y\n",
1158 +"CONFIG_ELF_CORE=y\n",
1159 +"CONFIG_BASE_FULL=y\n",
1160 +"CONFIG_FUTEX=y\n",
1161 +"CONFIG_EPOLL=y\n",
1162 +"CONFIG_SIGNALFD=y\n",
1163 +"CONFIG_TIMERFD=y\n",
1164 +"CONFIG_EVENTFD=y\n",
1165 +"CONFIG_SHMEM=y\n",
1169 +"# Kernel Performance Events And Counters\n",
1171 +"CONFIG_VM_EVENT_COUNTERS=y\n",
1172 +"CONFIG_SLUB_DEBUG=y\n",
1173 +"# CONFIG_COMPAT_BRK is not set\n",
1174 +"# CONFIG_SLAB is not set\n",
1176 +"# CONFIG_SLOB is not set\n",
1177 +"# CONFIG_PROFILING is not set\n",
1180 +"# GCOV-based kernel profiling\n",
1182 +"# CONFIG_SLOW_WORK is not set\n",
1183 +"# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set\n",
1184 +"CONFIG_SLABINFO=y\n",
1185 +"CONFIG_RT_MUTEXES=y\n",
1186 +"CONFIG_BASE_SMALL=0\n",
1187 +"# CONFIG_MODULES is not set\n",
1188 +"CONFIG_BLOCK=y\n",
1189 +"# CONFIG_BLK_DEV_BSG is not set\n",
1190 +"# CONFIG_BLK_DEV_INTEGRITY is not set\n",
1193 +"# IO Schedulers\n",
1195 +"CONFIG_IOSCHED_NOOP=y\n",
1196 +"# CONFIG_IOSCHED_DEADLINE is not set\n",
1197 +"# CONFIG_IOSCHED_CFQ is not set\n",
1198 +"# CONFIG_DEFAULT_DEADLINE is not set\n",
1199 +"# CONFIG_DEFAULT_CFQ is not set\n",
1200 +"CONFIG_DEFAULT_NOOP=y\n",
1201 +"CONFIG_DEFAULT_IOSCHED=\"noop\"\n",
1202 +"# CONFIG_INLINE_SPIN_TRYLOCK is not set\n",
1203 +"# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set\n",
1204 +"# CONFIG_INLINE_SPIN_LOCK is not set\n",
1205 +"# CONFIG_INLINE_SPIN_LOCK_BH is not set\n",
1206 +"# CONFIG_INLINE_SPIN_LOCK_IRQ is not set\n",
1207 +"# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set\n",
1208 +"CONFIG_INLINE_SPIN_UNLOCK=y\n",
1209 +"# CONFIG_INLINE_SPIN_UNLOCK_BH is not set\n",
1210 +"CONFIG_INLINE_SPIN_UNLOCK_IRQ=y\n",
1211 +"# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set\n",
1212 +"# CONFIG_INLINE_READ_TRYLOCK is not set\n",
1213 +"# CONFIG_INLINE_READ_LOCK is not set\n",
1214 +"# CONFIG_INLINE_READ_LOCK_BH is not set\n",
1215 +"# CONFIG_INLINE_READ_LOCK_IRQ is not set\n",
1216 +"# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set\n",
1217 +"CONFIG_INLINE_READ_UNLOCK=y\n",
1218 +"# CONFIG_INLINE_READ_UNLOCK_BH is not set\n",
1219 +"CONFIG_INLINE_READ_UNLOCK_IRQ=y\n",
1220 +"# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set\n",
1221 +"# CONFIG_INLINE_WRITE_TRYLOCK is not set\n",
1222 +"# CONFIG_INLINE_WRITE_LOCK is not set\n",
1223 +"# CONFIG_INLINE_WRITE_LOCK_BH is not set\n",
1224 +"# CONFIG_INLINE_WRITE_LOCK_IRQ is not set\n",
1225 +"# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set\n",
1226 +"CONFIG_INLINE_WRITE_UNLOCK=y\n",
1227 +"# CONFIG_INLINE_WRITE_UNLOCK_BH is not set\n",
1228 +"CONFIG_INLINE_WRITE_UNLOCK_IRQ=y\n",
1229 +"# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set\n",
1230 +"# CONFIG_MUTEX_SPIN_ON_OWNER is not set\n",
1231 +"# CONFIG_FREEZER is not set\n",
1232 +"# CONFIG_BLK_DEV is not set\n",
1235 +"# Character Devices\n",
1237 +"# CONFIG_STDERR_CONSOLE is not set\n",
1238 +"CONFIG_STDIO_CONSOLE=y\n",
1239 +"# CONFIG_SSL is not set\n",
1240 +"# CONFIG_NULL_CHAN is not set\n",
1241 +"# CONFIG_PORT_CHAN is not set\n",
1242 +"# CONFIG_PTY_CHAN is not set\n",
1243 +"# CONFIG_TTY_CHAN is not set\n",
1244 +"# CONFIG_XTERM_CHAN is not set\n",
1245 +"CONFIG_NOCONFIG_CHAN=y\n",
1246 +"CONFIG_CON_ZERO_CHAN=\"fd:0,fd:1\"\n",
1247 +"CONFIG_CON_CHAN=\"xterm\"\n",
1248 +"CONFIG_SSL_CHAN=\"pty\"\n",
1249 +"# CONFIG_UNIX98_PTYS is not set\n",
1250 +"# CONFIG_LEGACY_PTYS is not set\n",
1251 +"# CONFIG_RAW_DRIVER is not set\n",
1252 +"# CONFIG_WATCHDOG is not set\n",
1253 +"# CONFIG_UML_SOUND is not set\n",
1254 +"# CONFIG_SOUND is not set\n",
1255 +"# CONFIG_SOUND_OSS_CORE is not set\n",
1256 +"# CONFIG_HOSTAUDIO is not set\n",
1257 +"# CONFIG_HW_RANDOM is not set\n",
1258 +"# CONFIG_UML_RANDOM is not set\n",
1259 +"# CONFIG_MMAPPER is not set\n",
1262 +"# Generic Driver Options\n",
1264 +"CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\"\n",
1265 +"CONFIG_STANDALONE=y\n",
1266 +"# CONFIG_PREVENT_FIRMWARE_BUILD is not set\n",
1267 +"CONFIG_FW_LOADER=y\n",
1268 +"# CONFIG_FIRMWARE_IN_KERNEL is not set\n",
1269 +"CONFIG_EXTRA_FIRMWARE=\"\"\n",
1270 +"# CONFIG_SYS_HYPERVISOR is not set\n",
1271 +"# CONFIG_NET is not set\n",
1274 +"# File systems\n",
1276 +"# CONFIG_EXT2_FS is not set\n",
1277 +"# CONFIG_EXT3_FS is not set\n",
1278 +"# CONFIG_EXT4_FS is not set\n",
1279 +"# CONFIG_REISERFS_FS is not set\n",
1280 +"# CONFIG_JFS_FS is not set\n",
1281 +"# CONFIG_FS_POSIX_ACL is not set\n",
1282 +"# CONFIG_XFS_FS is not set\n",
1283 +"CONFIG_FILE_LOCKING=y\n",
1284 +"# CONFIG_FSNOTIFY is not set\n",
1285 +"# CONFIG_DNOTIFY is not set\n",
1286 +"# CONFIG_INOTIFY is not set\n",
1287 +"# CONFIG_INOTIFY_USER is not set\n",
1288 +"# CONFIG_QUOTA is not set\n",
1289 +"# CONFIG_AUTOFS_FS is not set\n",
1290 +"# CONFIG_AUTOFS4_FS is not set\n",
1291 +"# CONFIG_FUSE_FS is not set\n",
1298 +"# CD-ROM/DVD Filesystems\n",
1300 +"# CONFIG_ISO9660_FS is not set\n",
1301 +"# CONFIG_UDF_FS is not set\n",
1304 +"# DOS/FAT/NT Filesystems\n",
1306 +"# CONFIG_MSDOS_FS is not set\n",
1307 +"# CONFIG_VFAT_FS is not set\n",
1308 +"# CONFIG_NTFS_FS is not set\n",
1311 +"# Pseudo filesystems\n",
1313 +"CONFIG_PROC_FS=y\n",
1314 +"# CONFIG_PROC_KCORE is not set\n",
1315 +"CONFIG_PROC_SYSCTL=y\n",
1316 +"CONFIG_PROC_PAGE_MONITOR=y\n",
1317 +"CONFIG_SYSFS=y\n",
1318 +"# CONFIG_TMPFS is not set\n",
1319 +"# CONFIG_HUGETLB_PAGE is not set\n",
1320 +"# CONFIG_CONFIGFS_FS is not set\n",
1321 +"# CONFIG_MISC_FILESYSTEMS is not set\n",
1324 +"# Partition Types\n",
1326 +"# CONFIG_PARTITION_ADVANCED is not set\n",
1327 +"CONFIG_MSDOS_PARTITION=y\n",
1328 +"# CONFIG_NLS is not set\n",
1331 +"# Linux VServer\n",
1333 +"# CONFIG_VSERVER_AUTO_LBACK is not set\n",
1334 +"# CONFIG_VSERVER_COWBL is not set\n",
1335 +"# CONFIG_VSERVER_PROC_SECURE is not set\n",
1336 +"# CONFIG_VSERVER_HARDCPU is not set\n",
1337 +"# CONFIG_TAGGING_NONE is not set\n",
1338 +"# CONFIG_TAGGING_UID16 is not set\n",
1339 +"# CONFIG_TAGGING_GID16 is not set\n",
1340 +"CONFIG_TAGGING_ID24=y\n",
1341 +"# CONFIG_TAGGING_INTERN is not set\n",
1342 +"# CONFIG_TAG_NFSD is not set\n",
1343 +"# CONFIG_VSERVER_PRIVACY is not set\n",
1344 +"CONFIG_VSERVER_CONTEXTS=768\n",
1345 +"# CONFIG_VSERVER_WARN is not set\n",
1346 +"# CONFIG_VSERVER_DEBUG is not set\n",
1347 +"CONFIG_VSERVER=y\n",
1350 +"# Security options\n",
1352 +"# CONFIG_KEYS is not set\n",
1353 +"# CONFIG_SECURITY is not set\n",
1354 +"# CONFIG_SECURITYFS is not set\n",
1355 +"# CONFIG_DEFAULT_SECURITY_SELINUX is not set\n",
1356 +"# CONFIG_DEFAULT_SECURITY_SMACK is not set\n",
1357 +"# CONFIG_DEFAULT_SECURITY_TOMOYO is not set\n",
1358 +"CONFIG_DEFAULT_SECURITY_DAC=y\n",
1359 +"CONFIG_DEFAULT_SECURITY=\"\"\n",
1360 +"# CONFIG_CRYPTO is not set\n",
1361 +"# CONFIG_BINARY_PRINTF is not set\n",
1364 +"# Library routines\n",
1366 +"CONFIG_GENERIC_FIND_FIRST_BIT=y\n",
1367 +"CONFIG_GENERIC_FIND_NEXT_BIT=y\n",
1368 +"CONFIG_GENERIC_FIND_LAST_BIT=y\n",
1369 +"# CONFIG_CRC_CCITT is not set\n",
1370 +"# CONFIG_CRC16 is not set\n",
1371 +"# CONFIG_CRC_T10DIF is not set\n",
1372 +"# CONFIG_CRC_ITU_T is not set\n",
1373 +"# CONFIG_CRC32 is not set\n",
1374 +"# CONFIG_CRC7 is not set\n",
1375 +"# CONFIG_LIBCRC32C is not set\n",
1376 +"CONFIG_HAS_DMA=y\n",
1379 +"# SCSI device support\n",
1381 +"# CONFIG_RAID_ATTRS is not set\n",
1382 +"# CONFIG_SCSI is not set\n",
1383 +"# CONFIG_SCSI_DMA is not set\n",
1384 +"# CONFIG_SCSI_NETLINK is not set\n",
1385 +"# CONFIG_MD is not set\n",
1386 +"# CONFIG_NEW_LEDS is not set\n",
1387 +"# CONFIG_INPUT is not set\n",
1390 +"# Kernel hacking\n",
1392 +"# CONFIG_PRINTK_TIME is not set\n",
1393 +"# CONFIG_ENABLE_WARN_DEPRECATED is not set\n",
1394 +"# CONFIG_ENABLE_MUST_CHECK is not set\n",
1395 +"CONFIG_FRAME_WARN=2048\n",
1396 +"# CONFIG_STRIP_ASM_SYMS is not set\n",
1397 +"# CONFIG_UNUSED_SYMBOLS is not set\n",
1398 +"# CONFIG_DEBUG_FS is not set\n",
1399 +"# CONFIG_DEBUG_KERNEL is not set\n",
1400 +"# CONFIG_SLUB_DEBUG_ON is not set\n",
1401 +"# CONFIG_SLUB_STATS is not set\n",
1402 +"CONFIG_DEBUG_BUGVERBOSE=y\n",
1403 +"CONFIG_DEBUG_MEMORY_INIT=y\n",
1404 +"# CONFIG_RCU_CPU_STALL_DETECTOR is not set\n",
1405 +"# CONFIG_SYSCTL_SYSCALL_CHECK is not set\n",
1406 +"# CONFIG_SAMPLES is not set\n",
1407 +"# CONFIG_DEBUG_STACK_USAGE is not set\n",
1411 +static int __init print_config(char *line, int *add)
1414 + for (i = 0; i < sizeof(config)/sizeof(config[0]); i++)
1415 + printf("%s", config[i]);
1419 +__uml_setup("--showconfig", print_config,
1421 +" Prints the config file that this UML binary was generated from.\n\n"
1424 diff -NurpP --minimal linux-2.6.34/arch/um/kernel/config.tmp linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/kernel/config.tmp
1425 --- linux-2.6.34/arch/um/kernel/config.tmp 1970-01-01 01:00:00.000000000 +0100
1426 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/kernel/config.tmp 2010-05-18 18:11:22.000000000 +0200
1429 +"# Automatically generated make config: don't edit\n",
1430 +"# Linux kernel version: 2.6.33-vs2.3.0.36.29.1\n",
1431 +"# Wed Mar 10 20:29:46 2010\n",
1433 +"CONFIG_DEFCONFIG_LIST=\"arch/$ARCH/defconfig\"\n",
1434 +"CONFIG_GENERIC_HARDIRQS=y\n",
1437 +"CONFIG_NO_IOMEM=y\n",
1438 +"# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set\n",
1439 +"CONFIG_LOCKDEP_SUPPORT=y\n",
1440 +"# CONFIG_STACKTRACE_SUPPORT is not set\n",
1441 +"CONFIG_GENERIC_CALIBRATE_DELAY=y\n",
1442 +"CONFIG_GENERIC_BUG=y\n",
1443 +"CONFIG_GENERIC_TIME=y\n",
1444 +"CONFIG_GENERIC_CLOCKEVENTS=y\n",
1445 +"CONFIG_IRQ_RELEASE_METHOD=y\n",
1449 +"# UML-specific options\n",
1453 +"# Host processor type and features\n",
1455 +"# CONFIG_M386 is not set\n",
1456 +"# CONFIG_M486 is not set\n",
1457 +"# CONFIG_M586 is not set\n",
1458 +"# CONFIG_M586TSC is not set\n",
1459 +"# CONFIG_M586MMX is not set\n",
1460 +"# CONFIG_M686 is not set\n",
1461 +"# CONFIG_MPENTIUMII is not set\n",
1462 +"# CONFIG_MPENTIUMIII is not set\n",
1463 +"# CONFIG_MPENTIUMM is not set\n",
1464 +"# CONFIG_MPENTIUM4 is not set\n",
1465 +"# CONFIG_MK6 is not set\n",
1466 +"# CONFIG_MK7 is not set\n",
1468 +"# CONFIG_MCRUSOE is not set\n",
1469 +"# CONFIG_MEFFICEON is not set\n",
1470 +"# CONFIG_MWINCHIPC6 is not set\n",
1471 +"# CONFIG_MWINCHIP3D is not set\n",
1472 +"# CONFIG_MGEODEGX1 is not set\n",
1473 +"# CONFIG_MGEODE_LX is not set\n",
1474 +"# CONFIG_MCYRIXIII is not set\n",
1475 +"# CONFIG_MVIAC3_2 is not set\n",
1476 +"# CONFIG_MVIAC7 is not set\n",
1477 +"# CONFIG_MPSC is not set\n",
1478 +"# CONFIG_MCORE2 is not set\n",
1479 +"# CONFIG_MATOM is not set\n",
1480 +"# CONFIG_GENERIC_CPU is not set\n",
1481 +"CONFIG_X86_CPU=y\n",
1482 +"CONFIG_X86_INTERNODE_CACHE_SHIFT=6\n",
1483 +"# CONFIG_X86_CMPXCHG is not set\n",
1484 +"CONFIG_X86_L1_CACHE_SHIFT=6\n",
1485 +"CONFIG_X86_WP_WORKS_OK=y\n",
1486 +"CONFIG_X86_INTEL_USERCOPY=y\n",
1487 +"CONFIG_X86_USE_PPRO_CHECKSUM=y\n",
1488 +"CONFIG_X86_TSC=y\n",
1489 +"CONFIG_X86_CMOV=y\n",
1490 +"CONFIG_X86_MINIMUM_CPU_FAMILY=3\n",
1491 +"CONFIG_CPU_SUP_INTEL=y\n",
1492 +"CONFIG_CPU_SUP_AMD=y\n",
1493 +"CONFIG_CPU_SUP_CENTAUR=y\n",
1494 +"CONFIG_UML_X86=y\n",
1495 +"CONFIG_64BIT=y\n",
1496 +"# CONFIG_X86_32 is not set\n",
1497 +"# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set\n",
1498 +"CONFIG_RWSEM_GENERIC_SPINLOCK=y\n",
1499 +"# CONFIG_ARCH_HAS_SC_SIGNALS is not set\n",
1500 +"# CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA is not set\n",
1501 +"CONFIG_SMP_BROKEN=y\n",
1502 +"CONFIG_GENERIC_HWEIGHT=y\n",
1503 +"# CONFIG_STATIC_LINK is not set\n",
1504 +"CONFIG_FLATMEM=y\n",
1505 +"CONFIG_FLAT_NODE_MEM_MAP=y\n",
1506 +"CONFIG_PAGEFLAGS_EXTENDED=y\n",
1507 +"CONFIG_SPLIT_PTLOCK_CPUS=4\n",
1508 +"CONFIG_PHYS_ADDR_T_64BIT=y\n",
1509 +"CONFIG_ZONE_DMA_FLAG=0\n",
1510 +"CONFIG_VIRT_TO_BUS=y\n",
1511 +"# CONFIG_KSM is not set\n",
1512 +"CONFIG_DEFAULT_MMAP_MIN_ADDR=4096\n",
1513 +"# CONFIG_NO_HZ is not set\n",
1514 +"# CONFIG_HIGH_RES_TIMERS is not set\n",
1515 +"CONFIG_GENERIC_CLOCKEVENTS_BUILD=y\n",
1516 +"CONFIG_LD_SCRIPT_DYN=y\n",
1517 +"# CONFIG_BINFMT_ELF is not set\n",
1518 +"# CONFIG_HAVE_AOUT is not set\n",
1519 +"# CONFIG_BINFMT_MISC is not set\n",
1520 +"# CONFIG_HOSTFS is not set\n",
1521 +"# CONFIG_MCONSOLE is not set\n",
1522 +"CONFIG_KERNEL_STACK_ORDER=1\n",
1525 +"# General setup\n",
1527 +"# CONFIG_EXPERIMENTAL is not set\n",
1528 +"CONFIG_BROKEN_ON_SMP=y\n",
1529 +"CONFIG_INIT_ENV_ARG_LIMIT=128\n",
1530 +"CONFIG_LOCALVERSION=\"\"\n",
1531 +"# CONFIG_LOCALVERSION_AUTO is not set\n",
1532 +"# CONFIG_SWAP is not set\n",
1533 +"CONFIG_SYSVIPC=y\n",
1534 +"CONFIG_SYSVIPC_SYSCTL=y\n",
1535 +"# CONFIG_BSD_PROCESS_ACCT is not set\n",
1538 +"# RCU Subsystem\n",
1540 +"CONFIG_TREE_RCU=y\n",
1541 +"# CONFIG_TREE_PREEMPT_RCU is not set\n",
1542 +"# CONFIG_TINY_RCU is not set\n",
1543 +"# CONFIG_RCU_TRACE is not set\n",
1544 +"CONFIG_RCU_FANOUT=64\n",
1545 +"# CONFIG_RCU_FANOUT_EXACT is not set\n",
1546 +"# CONFIG_TREE_RCU_TRACE is not set\n",
1547 +"# CONFIG_IKCONFIG is not set\n",
1548 +"CONFIG_LOG_BUF_SHIFT=17\n",
1549 +"# CONFIG_CGROUPS is not set\n",
1550 +"# CONFIG_SYSFS_DEPRECATED_V2 is not set\n",
1551 +"# CONFIG_RELAY is not set\n",
1552 +"CONFIG_NAMESPACES=y\n",
1553 +"CONFIG_UTS_NS=y\n",
1554 +"CONFIG_IPC_NS=y\n",
1555 +"CONFIG_USER_NS=y\n",
1556 +"# CONFIG_BLK_DEV_INITRD is not set\n",
1557 +"# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set\n",
1558 +"CONFIG_SYSCTL=y\n",
1559 +"CONFIG_ANON_INODES=y\n",
1560 +"# CONFIG_EMBEDDED is not set\n",
1561 +"CONFIG_UID16=y\n",
1562 +"CONFIG_SYSCTL_SYSCALL=y\n",
1563 +"CONFIG_KALLSYMS=y\n",
1564 +"# CONFIG_KALLSYMS_EXTRA_PASS is not set\n",
1565 +"CONFIG_HOTPLUG=y\n",
1566 +"CONFIG_PRINTK=y\n",
1568 +"CONFIG_ELF_CORE=y\n",
1569 +"CONFIG_BASE_FULL=y\n",
1570 +"CONFIG_FUTEX=y\n",
1571 +"CONFIG_EPOLL=y\n",
1572 +"CONFIG_SIGNALFD=y\n",
1573 +"CONFIG_TIMERFD=y\n",
1574 +"CONFIG_EVENTFD=y\n",
1575 +"CONFIG_SHMEM=y\n",
1579 +"# Kernel Performance Events And Counters\n",
1581 +"CONFIG_VM_EVENT_COUNTERS=y\n",
1582 +"CONFIG_SLUB_DEBUG=y\n",
1583 +"# CONFIG_COMPAT_BRK is not set\n",
1584 +"# CONFIG_SLAB is not set\n",
1586 +"# CONFIG_SLOB is not set\n",
1587 +"# CONFIG_PROFILING is not set\n",
1590 +"# GCOV-based kernel profiling\n",
1592 +"# CONFIG_SLOW_WORK is not set\n",
1593 +"# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set\n",
1594 +"CONFIG_SLABINFO=y\n",
1595 +"CONFIG_RT_MUTEXES=y\n",
1596 +"CONFIG_BASE_SMALL=0\n",
1597 +"# CONFIG_MODULES is not set\n",
1598 +"CONFIG_BLOCK=y\n",
1599 +"# CONFIG_BLK_DEV_BSG is not set\n",
1600 +"# CONFIG_BLK_DEV_INTEGRITY is not set\n",
1603 +"# IO Schedulers\n",
1605 +"CONFIG_IOSCHED_NOOP=y\n",
1606 +"# CONFIG_IOSCHED_DEADLINE is not set\n",
1607 +"# CONFIG_IOSCHED_CFQ is not set\n",
1608 +"# CONFIG_DEFAULT_DEADLINE is not set\n",
1609 +"# CONFIG_DEFAULT_CFQ is not set\n",
1610 +"CONFIG_DEFAULT_NOOP=y\n",
1611 +"CONFIG_DEFAULT_IOSCHED=\"noop\"\n",
1612 +"# CONFIG_INLINE_SPIN_TRYLOCK is not set\n",
1613 +"# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set\n",
1614 +"# CONFIG_INLINE_SPIN_LOCK is not set\n",
1615 +"# CONFIG_INLINE_SPIN_LOCK_BH is not set\n",
1616 +"# CONFIG_INLINE_SPIN_LOCK_IRQ is not set\n",
1617 +"# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set\n",
1618 +"CONFIG_INLINE_SPIN_UNLOCK=y\n",
1619 +"# CONFIG_INLINE_SPIN_UNLOCK_BH is not set\n",
1620 +"CONFIG_INLINE_SPIN_UNLOCK_IRQ=y\n",
1621 +"# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set\n",
1622 +"# CONFIG_INLINE_READ_TRYLOCK is not set\n",
1623 +"# CONFIG_INLINE_READ_LOCK is not set\n",
1624 +"# CONFIG_INLINE_READ_LOCK_BH is not set\n",
1625 +"# CONFIG_INLINE_READ_LOCK_IRQ is not set\n",
1626 +"# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set\n",
1627 +"CONFIG_INLINE_READ_UNLOCK=y\n",
1628 +"# CONFIG_INLINE_READ_UNLOCK_BH is not set\n",
1629 +"CONFIG_INLINE_READ_UNLOCK_IRQ=y\n",
1630 +"# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set\n",
1631 +"# CONFIG_INLINE_WRITE_TRYLOCK is not set\n",
1632 +"# CONFIG_INLINE_WRITE_LOCK is not set\n",
1633 +"# CONFIG_INLINE_WRITE_LOCK_BH is not set\n",
1634 +"# CONFIG_INLINE_WRITE_LOCK_IRQ is not set\n",
1635 +"# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set\n",
1636 +"CONFIG_INLINE_WRITE_UNLOCK=y\n",
1637 +"# CONFIG_INLINE_WRITE_UNLOCK_BH is not set\n",
1638 +"CONFIG_INLINE_WRITE_UNLOCK_IRQ=y\n",
1639 +"# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set\n",
1640 +"# CONFIG_MUTEX_SPIN_ON_OWNER is not set\n",
1641 +"# CONFIG_FREEZER is not set\n",
1642 +"# CONFIG_BLK_DEV is not set\n",
1645 +"# Character Devices\n",
1647 +"# CONFIG_STDERR_CONSOLE is not set\n",
1648 +"CONFIG_STDIO_CONSOLE=y\n",
1649 +"# CONFIG_SSL is not set\n",
1650 +"# CONFIG_NULL_CHAN is not set\n",
1651 +"# CONFIG_PORT_CHAN is not set\n",
1652 +"# CONFIG_PTY_CHAN is not set\n",
1653 +"# CONFIG_TTY_CHAN is not set\n",
1654 +"# CONFIG_XTERM_CHAN is not set\n",
1655 +"CONFIG_NOCONFIG_CHAN=y\n",
1656 +"CONFIG_CON_ZERO_CHAN=\"fd:0,fd:1\"\n",
1657 +"CONFIG_CON_CHAN=\"xterm\"\n",
1658 +"CONFIG_SSL_CHAN=\"pty\"\n",
1659 +"# CONFIG_UNIX98_PTYS is not set\n",
1660 +"# CONFIG_LEGACY_PTYS is not set\n",
1661 +"# CONFIG_RAW_DRIVER is not set\n",
1662 +"# CONFIG_WATCHDOG is not set\n",
1663 +"# CONFIG_UML_SOUND is not set\n",
1664 +"# CONFIG_SOUND is not set\n",
1665 +"# CONFIG_SOUND_OSS_CORE is not set\n",
1666 +"# CONFIG_HOSTAUDIO is not set\n",
1667 +"# CONFIG_HW_RANDOM is not set\n",
1668 +"# CONFIG_UML_RANDOM is not set\n",
1669 +"# CONFIG_MMAPPER is not set\n",
1672 +"# Generic Driver Options\n",
1674 +"CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\"\n",
1675 +"CONFIG_STANDALONE=y\n",
1676 +"# CONFIG_PREVENT_FIRMWARE_BUILD is not set\n",
1677 +"CONFIG_FW_LOADER=y\n",
1678 +"# CONFIG_FIRMWARE_IN_KERNEL is not set\n",
1679 +"CONFIG_EXTRA_FIRMWARE=\"\"\n",
1680 +"# CONFIG_SYS_HYPERVISOR is not set\n",
1681 +"# CONFIG_NET is not set\n",
1684 +"# File systems\n",
1686 +"# CONFIG_EXT2_FS is not set\n",
1687 +"# CONFIG_EXT3_FS is not set\n",
1688 +"# CONFIG_EXT4_FS is not set\n",
1689 +"# CONFIG_REISERFS_FS is not set\n",
1690 +"# CONFIG_JFS_FS is not set\n",
1691 +"# CONFIG_FS_POSIX_ACL is not set\n",
1692 +"# CONFIG_XFS_FS is not set\n",
1693 +"CONFIG_FILE_LOCKING=y\n",
1694 +"# CONFIG_FSNOTIFY is not set\n",
1695 +"# CONFIG_DNOTIFY is not set\n",
1696 +"# CONFIG_INOTIFY is not set\n",
1697 +"# CONFIG_INOTIFY_USER is not set\n",
1698 +"# CONFIG_QUOTA is not set\n",
1699 +"# CONFIG_AUTOFS_FS is not set\n",
1700 +"# CONFIG_AUTOFS4_FS is not set\n",
1701 +"# CONFIG_FUSE_FS is not set\n",
1708 +"# CD-ROM/DVD Filesystems\n",
1710 +"# CONFIG_ISO9660_FS is not set\n",
1711 +"# CONFIG_UDF_FS is not set\n",
1714 +"# DOS/FAT/NT Filesystems\n",
1716 +"# CONFIG_MSDOS_FS is not set\n",
1717 +"# CONFIG_VFAT_FS is not set\n",
1718 +"# CONFIG_NTFS_FS is not set\n",
1721 +"# Pseudo filesystems\n",
1723 +"CONFIG_PROC_FS=y\n",
1724 +"# CONFIG_PROC_KCORE is not set\n",
1725 +"CONFIG_PROC_SYSCTL=y\n",
1726 +"CONFIG_PROC_PAGE_MONITOR=y\n",
1727 +"CONFIG_SYSFS=y\n",
1728 +"# CONFIG_TMPFS is not set\n",
1729 +"# CONFIG_HUGETLB_PAGE is not set\n",
1730 +"# CONFIG_CONFIGFS_FS is not set\n",
1731 +"# CONFIG_MISC_FILESYSTEMS is not set\n",
1734 +"# Partition Types\n",
1736 +"# CONFIG_PARTITION_ADVANCED is not set\n",
1737 +"CONFIG_MSDOS_PARTITION=y\n",
1738 +"# CONFIG_NLS is not set\n",
1741 +"# Linux VServer\n",
1743 +"# CONFIG_VSERVER_AUTO_LBACK is not set\n",
1744 +"# CONFIG_VSERVER_COWBL is not set\n",
1745 +"# CONFIG_VSERVER_PROC_SECURE is not set\n",
1746 +"# CONFIG_VSERVER_HARDCPU is not set\n",
1747 +"# CONFIG_TAGGING_NONE is not set\n",
1748 +"# CONFIG_TAGGING_UID16 is not set\n",
1749 +"# CONFIG_TAGGING_GID16 is not set\n",
1750 +"CONFIG_TAGGING_ID24=y\n",
1751 +"# CONFIG_TAGGING_INTERN is not set\n",
1752 +"# CONFIG_TAG_NFSD is not set\n",
1753 +"# CONFIG_VSERVER_PRIVACY is not set\n",
1754 +"CONFIG_VSERVER_CONTEXTS=768\n",
1755 +"# CONFIG_VSERVER_WARN is not set\n",
1756 +"# CONFIG_VSERVER_DEBUG is not set\n",
1757 +"CONFIG_VSERVER=y\n",
1760 +"# Security options\n",
1762 +"# CONFIG_KEYS is not set\n",
1763 +"# CONFIG_SECURITY is not set\n",
1764 +"# CONFIG_SECURITYFS is not set\n",
1765 +"# CONFIG_DEFAULT_SECURITY_SELINUX is not set\n",
1766 +"# CONFIG_DEFAULT_SECURITY_SMACK is not set\n",
1767 +"# CONFIG_DEFAULT_SECURITY_TOMOYO is not set\n",
1768 +"CONFIG_DEFAULT_SECURITY_DAC=y\n",
1769 +"CONFIG_DEFAULT_SECURITY=\"\"\n",
1770 +"# CONFIG_CRYPTO is not set\n",
1771 +"# CONFIG_BINARY_PRINTF is not set\n",
1774 +"# Library routines\n",
1776 +"CONFIG_GENERIC_FIND_FIRST_BIT=y\n",
1777 +"CONFIG_GENERIC_FIND_NEXT_BIT=y\n",
1778 +"CONFIG_GENERIC_FIND_LAST_BIT=y\n",
1779 +"# CONFIG_CRC_CCITT is not set\n",
1780 +"# CONFIG_CRC16 is not set\n",
1781 +"# CONFIG_CRC_T10DIF is not set\n",
1782 +"# CONFIG_CRC_ITU_T is not set\n",
1783 +"# CONFIG_CRC32 is not set\n",
1784 +"# CONFIG_CRC7 is not set\n",
1785 +"# CONFIG_LIBCRC32C is not set\n",
1786 +"CONFIG_HAS_DMA=y\n",
1789 +"# SCSI device support\n",
1791 +"# CONFIG_RAID_ATTRS is not set\n",
1792 +"# CONFIG_SCSI is not set\n",
1793 +"# CONFIG_SCSI_DMA is not set\n",
1794 +"# CONFIG_SCSI_NETLINK is not set\n",
1795 +"# CONFIG_MD is not set\n",
1796 +"# CONFIG_NEW_LEDS is not set\n",
1797 +"# CONFIG_INPUT is not set\n",
1800 +"# Kernel hacking\n",
1802 +"# CONFIG_PRINTK_TIME is not set\n",
1803 +"# CONFIG_ENABLE_WARN_DEPRECATED is not set\n",
1804 +"# CONFIG_ENABLE_MUST_CHECK is not set\n",
1805 +"CONFIG_FRAME_WARN=2048\n",
1806 +"# CONFIG_STRIP_ASM_SYMS is not set\n",
1807 +"# CONFIG_UNUSED_SYMBOLS is not set\n",
1808 +"# CONFIG_DEBUG_FS is not set\n",
1809 +"# CONFIG_DEBUG_KERNEL is not set\n",
1810 +"# CONFIG_SLUB_DEBUG_ON is not set\n",
1811 +"# CONFIG_SLUB_STATS is not set\n",
1812 +"CONFIG_DEBUG_BUGVERBOSE=y\n",
1813 +"CONFIG_DEBUG_MEMORY_INIT=y\n",
1814 +"# CONFIG_RCU_CPU_STALL_DETECTOR is not set\n",
1815 +"# CONFIG_SYSCTL_SYSCALL_CHECK is not set\n",
1816 +"# CONFIG_SAMPLES is not set\n",
1817 +"# CONFIG_DEBUG_STACK_USAGE is not set\n",
1818 diff -NurpP --minimal linux-2.6.34/arch/um/kernel/vmlinux.lds linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/kernel/vmlinux.lds
1819 --- linux-2.6.34/arch/um/kernel/vmlinux.lds 1970-01-01 01:00:00.000000000 +0100
1820 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/um/kernel/vmlinux.lds 2010-05-18 18:11:22.000000000 +0200
1825 + * Automatically generated C config: don't edit
1826 + * Linux kernel version: 2.6.33-vs2.3.0.36.29.1
1827 + * Wed Mar 10 20:12:10 2010
1829 +KERNEL_STACK_SIZE = 4096 * (1 << 1);
1831 + * Helper macros to support writing architecture specific
1834 + * A minimal linker scripts has following content:
1835 + * [This is a sample, architectures may have special requiriements]
1837 + * OUTPUT_FORMAT(...)
1838 + * OUTPUT_ARCH(...)
1843 + * __init_begin = .;
1844 + * HEAD_TEXT_SECTION
1845 + * INIT_TEXT_SECTION(PAGE_SIZE)
1846 + * INIT_DATA_SECTION(...)
1847 + * PERCPU(PAGE_SIZE)
1851 + * TEXT_SECTION = 0
1855 + * RO_DATA_SECTION(PAGE_SIZE)
1856 + * RW_DATA_SECTION(...)
1859 + * EXCEPTION_TABLE(...)
1862 + * BSS_SECTION(0, 0, 0)
1868 + * DISCARDS // must be the last
1871 + * [__init_begin, __init_end] is the init section that may be freed after init
1872 + * [_stext, _etext] is the text section
1873 + * [_sdata, _edata] is the data section
1875 + * Some of the included output section have their own set of constants.
1876 + * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
1877 + * [__nosave_begin, __nosave_end] for the nosave data
1886 +/* Align . to a 8 byte boundary equals to maximum function alignment. */
1889 +/* The actual configuration determine if the init/exit sections
1890 + * are handled as text/data or they can be discarded (which
1891 + * often happens at runtime)
1893 +/* .data section */
1895 + * Data section helpers
1900 +/* RODATA & RO_DATA provided for backward compatibility.
1901 + * All archs are supposed to use RO_DATA() */
1902 +/* .text section. Map to function alignment to avoid address changes
1903 + * during second ld run in second ld pass when generating System.map */
1904 +/* sched.text is aling to function alignment to secure we have same
1905 + * address even at second ld pass when generating System.map */
1906 +/* spinlock.text is aling to function alignment to secure we have same
1907 + * address even at second ld pass when generating System.map */
1908 +/* Section used for early init (in .S files) */
1915 +/* init and exit section handling */
1917 + * bss (Block Started by Symbol) - uninitialized data
1918 + * zeroed during startup
1921 + * DWARF debug sections.
1922 + * Symbols in the DWARF debugging sections are relative to
1923 + * the beginning of the section so we begin them at 0.
1925 + /* Stabs debugging sections. */
1927 + * Default discarded sections.
1929 + * Some archs want to discard exit text/data at runtime rather than
1930 + * link time due to cross-section references such as alt instructions,
1931 + * bug table, eh_frame, etc. DISCARDS must be the last of output
1932 + * section definitions so that such archs put those in earlier section
1936 + * PERCPU_VADDR - define output section for percpu area
1937 + * @vaddr: explicit base address (optional)
1938 + * @phdr: destination PHDR (optional)
1940 + * Macro which expands to output section for percpu area. If @vaddr
1941 + * is not blank, it specifies explicit base address and all percpu
1942 + * symbols will be offset from the given address. If blank, @vaddr
1943 + * always equals @laddr + LOAD_OFFSET.
1945 + * @phdr defines the output PHDR to use if not blank. Be warned that
1946 + * output PHDR is sticky. If @phdr is specified, the next output
1947 + * section in the linker script will go there too. @phdr should have
1948 + * a leading colon.
1950 + * Note that this macros defines __per_cpu_load as an absolute symbol.
1951 + * If there is no need to put the percpu section at a predetermined
1952 + * address, use PERCPU().
1955 + * PERCPU - define output section for percpu area, simple version
1956 + * @align: required alignment
1958 + * Align to @align and outputs output section for percpu area. This
1959 + * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
1960 + * __per_cpu_start will be identical.
1962 + * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
1963 + * that __per_cpu_load is defined as a relative symbol against
1964 + * .data.percpu which is required for relocatable x86_32
1968 + * Definition of the high level *_SECTION macros
1969 + * They will fit only a subset of the architectures
1973 + * All sections are combined in a single .data section.
1974 + * The sections following CONSTRUCTORS are arranged so their
1975 + * typical alignment matches.
1976 + * A cacheline is typical/always less than a PAGE_SIZE so
1977 + * the sections that has this restriction (or similar)
1978 + * is located before the ones requiring PAGE_SIZE alignment.
1979 + * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
1980 + * matches the requirment of PAGE_ALIGNED_DATA.
1982 + * use 0 as page_align if page_aligned data is not used */
1984 + * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
1985 + * Copyright 2003 PathScale, Inc.
1986 + * Licensed under the GPL
1988 +/* const.h: Macros for dealing with constants. */
1989 +/* Some constant macros are used in both assembler and
1990 + * C code. Therefore we cannot annotate them always with
1991 + * 'UL' and other type specifiers unilaterally. We
1992 + * use the following macros to deal with this.
1994 + * Similarly, _AT() will cast an expression with a type in C, but
1995 + * leave it unchanged in asm.
1997 +/* PAGE_SHIFT determines the page size */
1998 +OUTPUT_FORMAT(elf64-x86-64)
1999 +OUTPUT_ARCH(i386:x86-64)
2001 +jiffies = jiffies_64;
2004 + PROVIDE (__executable_start = 0x60000000);
2005 + . = 0x60000000 + SIZEOF_HEADERS;
2006 + .interp : { *(.interp) }
2007 + __binary_start = .;
2008 + . = ALIGN(4096); /* Init code and data */
2012 + . = ALIGN((1 << 12)); .init.text : AT(ADDR(.init.text) - 0) { _sinittext = .; *(.init.text) *(.cpuinit.text) *(.meminit.text) _einittext = .; }
2013 + . = ALIGN((1 << 12));
2014 + /* Read-only sections, merged into text segment: */
2015 + .hash : { *(.hash) }
2016 + .gnu.hash : { *(.gnu.hash) }
2017 + .dynsym : { *(.dynsym) }
2018 + .dynstr : { *(.dynstr) }
2019 + .gnu.version : { *(.gnu.version) }
2020 + .gnu.version_d : { *(.gnu.version_d) }
2021 + .gnu.version_r : { *(.gnu.version_r) }
2022 + .rel.init : { *(.rel.init) }
2023 + .rela.init : { *(.rela.init) }
2024 + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
2025 + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
2026 + .rel.fini : { *(.rel.fini) }
2027 + .rela.fini : { *(.rela.fini) }
2028 + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
2029 + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
2030 + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
2031 + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
2032 + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
2033 + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
2034 + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
2035 + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
2036 + .rel.ctors : { *(.rel.ctors) }
2037 + .rela.ctors : { *(.rela.ctors) }
2038 + .rel.dtors : { *(.rel.dtors) }
2039 + .rela.dtors : { *(.rela.dtors) }
2040 + .rel.got : { *(.rel.got) }
2041 + .rela.got : { *(.rela.got) }
2042 + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
2043 + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
2044 + .rel.plt : { *(.rel.plt) }
2045 + .rela.plt : { *(.rela.plt) }
2049 + .plt : { *(.plt) }
2051 + . = ALIGN(8); *(.text.hot) *(.text) *(.ref.text) *(.devinit.text) *(.devexit.text) *(.text.unlikely)
2052 + . = ALIGN(8); __sched_text_start = .; *(.sched.text) __sched_text_end = .;
2053 + . = ALIGN(8); __lock_text_start = .; *(.spinlock.text) __lock_text_end = .;
2055 + *(.stub .text.* .gnu.linkonce.t.*)
2056 + /* .gnu.warning sections are handled specially by elf32.em. */
2058 + . = ALIGN((1 << 12));
2060 + . = ALIGN((1 << 12));
2062 + __syscall_stub_start = .;
2063 + *(.__syscall_stub*)
2064 + __syscall_stub_end = .;
2069 + .kstrtab : { *(.kstrtab) }
2071 + * Helper macros to support writing architecture specific
2074 + * A minimal linker scripts has following content:
2075 + * [This is a sample, architectures may have special requiriements]
2077 + * OUTPUT_FORMAT(...)
2078 + * OUTPUT_ARCH(...)
2083 + * __init_begin = .;
2084 + * HEAD_TEXT_SECTION
2085 + * INIT_TEXT_SECTION(PAGE_SIZE)
2086 + * INIT_DATA_SECTION(...)
2087 + * PERCPU(PAGE_SIZE)
2091 + * TEXT_SECTION = 0
2095 + * RO_DATA_SECTION(PAGE_SIZE)
2096 + * RW_DATA_SECTION(...)
2099 + * EXCEPTION_TABLE(...)
2102 + * BSS_SECTION(0, 0, 0)
2108 + * DISCARDS // must be the last
2111 + * [__init_begin, __init_end] is the init section that may be freed after init
2112 + * [_stext, _etext] is the text section
2113 + * [_sdata, _edata] is the data section
2115 + * Some of the included output section have their own set of constants.
2116 + * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
2117 + * [__nosave_begin, __nosave_end] for the nosave data
2119 +/* Align . to a 8 byte boundary equals to maximum function alignment. */
2120 +/* The actual configuration determine if the init/exit sections
2121 + * are handled as text/data or they can be discarded (which
2122 + * often happens at runtime)
2124 +/* .data section */
2126 + * Data section helpers
2131 +/* RODATA & RO_DATA provided for backward compatibility.
2132 + * All archs are supposed to use RO_DATA() */
2133 +/* .text section. Map to function alignment to avoid address changes
2134 + * during second ld run in second ld pass when generating System.map */
2135 +/* sched.text is aling to function alignment to secure we have same
2136 + * address even at second ld pass when generating System.map */
2137 +/* spinlock.text is aling to function alignment to secure we have same
2138 + * address even at second ld pass when generating System.map */
2139 +/* Section used for early init (in .S files) */
2146 +/* init and exit section handling */
2148 + * bss (Block Started by Symbol) - uninitialized data
2149 + * zeroed during startup
2152 + * DWARF debug sections.
2153 + * Symbols in the DWARF debugging sections are relative to
2154 + * the beginning of the section so we begin them at 0.
2156 + /* Stabs debugging sections. */
2158 + * Default discarded sections.
2160 + * Some archs want to discard exit text/data at runtime rather than
2161 + * link time due to cross-section references such as alt instructions,
2162 + * bug table, eh_frame, etc. DISCARDS must be the last of output
2163 + * section definitions so that such archs put those in earlier section
2167 + * PERCPU_VADDR - define output section for percpu area
2168 + * @vaddr: explicit base address (optional)
2169 + * @phdr: destination PHDR (optional)
2171 + * Macro which expands to output section for percpu area. If @vaddr
2172 + * is not blank, it specifies explicit base address and all percpu
2173 + * symbols will be offset from the given address. If blank, @vaddr
2174 + * always equals @laddr + LOAD_OFFSET.
2176 + * @phdr defines the output PHDR to use if not blank. Be warned that
2177 + * output PHDR is sticky. If @phdr is specified, the next output
2178 + * section in the linker script will go there too. @phdr should have
2179 + * a leading colon.
2181 + * Note that this macros defines __per_cpu_load as an absolute symbol.
2182 + * If there is no need to put the percpu section at a predetermined
2183 + * address, use PERCPU().
2186 + * PERCPU - define output section for percpu area, simple version
2187 + * @align: required alignment
2189 + * Align to @align and outputs output section for percpu area. This
2190 + * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
2191 + * __per_cpu_start will be identical.
2193 + * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
2194 + * that __per_cpu_load is defined as a relative symbol against
2195 + * .data.percpu which is required for relocatable x86_32
2199 + * Definition of the high level *_SECTION macros
2200 + * They will fit only a subset of the architectures
2204 + * All sections are combined in a single .data section.
2205 + * The sections following CONSTRUCTORS are arranged so their
2206 + * typical alignment matches.
2207 + * A cacheline is typical/always less than a PAGE_SIZE so
2208 + * the sections that has this restriction (or similar)
2209 + * is located before the ones requiring PAGE_SIZE alignment.
2210 + * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
2211 + * matches the requirment of PAGE_ALIGNED_DATA.
2213 + * use 0 as page_align if page_aligned data is not used */
2214 + .fini : { *(.fini) } =0x9090
2216 + PROVIDE (etext = .);
2219 + PROVIDE (sdata = .);
2220 + . = 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));
2221 + .unprotected : { *(.unprotected) }
2223 + PROVIDE (_unprotected_end = .);
2225 + .note : { *(.note.*) }
2226 + . = ALIGN(0); __ex_table : AT(ADDR(__ex_table) - 0) { __start___ex_table = .; *(__ex_table) __stop___ex_table = .; }
2227 + . = ALIGN(8); __bug_table : AT(ADDR(__bug_table) - 0) { __start___bug_table = .; *(__bug_table) __stop___bug_table = .; }
2228 + .uml.setup.init : {
2229 + __uml_setup_start = .;
2230 + *(.uml.setup.init)
2231 + __uml_setup_end = .;
2233 + .uml.help.init : {
2234 + __uml_help_start = .;
2236 + __uml_help_end = .;
2238 + .uml.postsetup.init : {
2239 + __uml_postsetup_start = .;
2240 + *(.uml.postsetup.init)
2241 + __uml_postsetup_end = .;
2244 + . = ALIGN(0); __setup_start = .; *(.init.setup) __setup_end = .;
2246 + . = 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 = .; }
2247 + .initcall.init : {
2248 + __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 = .;
2250 + .con_initcall.init : {
2251 + __con_initcall_start = .; *(.con_initcall.init) __con_initcall_end = .;
2253 + .uml.initcall.init : {
2254 + __uml_initcall_start = .;
2255 + *(.uml.initcall.init)
2256 + __uml_initcall_end = .;
2259 + .security_initcall.init : AT(ADDR(.security_initcall.init) - 0) { __security_initcall_start = .; *(.security_initcall.init) __security_initcall_end = .; }
2261 + __exitcall_begin = .;
2263 + __exitcall_end = .;
2266 + __uml_exitcall_begin = .;
2267 + *(.uml.exitcall.exit)
2268 + __uml_exitcall_end = .;
2271 + .altinstructions : {
2272 + __alt_instructions = .;
2273 + *(.altinstructions)
2274 + __alt_instructions_end = .;
2276 + .altinstr_replacement : { *(.altinstr_replacement) }
2277 + /* .exit.text is discard at runtime, not link time, to deal with references
2278 + from .altinstructions and .eh_frame */
2279 + .exit.text : { *(.exit.text) }
2280 + .exit.data : { *(.exit.data) }
2281 + .preinit_array : {
2282 + __preinit_array_start = .;
2284 + __preinit_array_end = .;
2287 + __init_array_start = .;
2289 + __init_array_end = .;
2292 + __fini_array_start = .;
2294 + __fini_array_end = .;
2300 + init.data : { *(.init.data) *(.cpuinit.data) *(.meminit.data) *(.init.rodata) *(.cpuinit.rodata) *(.meminit.rodata) }
2301 + /* Ensure the __preinit_array_start label is properly aligned. We
2302 + could instead move the label definition inside the section, but
2303 + the linker would then create the section even if it turns out to
2304 + be empty, which isn't pretty. */
2305 + . = ALIGN(32 / 8);
2306 + .preinit_array : { *(.preinit_array) }
2307 + .init_array : { *(.init_array) }
2308 + .fini_array : { *(.fini_array) }
2310 + . = ALIGN(KERNEL_STACK_SIZE); *(.data.init_task)
2311 + . = ALIGN(KERNEL_STACK_SIZE);
2312 + *(.data.init_irqstack)
2313 + *(.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 = .;
2314 + *(.data.* .gnu.linkonce.d.*)
2315 + SORT(CONSTRUCTORS)
2317 + .data1 : { *(.data1) }
2318 + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
2319 + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
2320 + .eh_frame : { KEEP (*(.eh_frame)) }
2321 + .gcc_except_table : { *(.gcc_except_table) }
2322 + .dynamic : { *(.dynamic) }
2324 + /* gcc uses crtbegin.o to find the start of
2325 + the constructors, so we make sure it is
2326 + first. Because this is a wildcard, it
2327 + doesn't matter if the user does not
2328 + actually link against crtbegin.o; the
2329 + linker won't look for a file to match a
2330 + wildcard. The wildcard also means that it
2331 + doesn't matter which directory crtbegin.o
2333 + KEEP (*crtbegin.o(.ctors))
2334 + /* We don't want to include the .ctor section from
2335 + from the crtend.o file until after the sorted ctors.
2336 + The .ctor section from the crtend file contains the
2337 + end of ctors marker and it must be last */
2338 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
2339 + KEEP (*(SORT(.ctors.*)))
2343 + KEEP (*crtbegin.o(.dtors))
2344 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
2345 + KEEP (*(SORT(.dtors.*)))
2348 + .jcr : { KEEP (*(.jcr)) }
2349 + .got : { *(.got.plt) *(.got) }
2351 + PROVIDE (edata = .);
2355 + *(.bss .bss.* .gnu.linkonce.b.*)
2357 + /* Align here to ensure that the .bss section occupies space up to
2358 + _end. Align after .bss to ensure correct alignment even if the
2359 + .bss section disappears because there are no input sections. */
2360 + . = ALIGN(32 / 8);
2361 + . = ALIGN(32 / 8);
2364 + PROVIDE (end = .);
2365 + .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) }
2366 + .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) }
2367 + /DISCARD/ : { *(.exit.text) *(.cpuexit.text) *(.memexit.text) *(.exit.data) *(.cpuexit.data) *(.cpuexit.rodata) *(.memexit.data) *(.memexit.rodata) *(.exitcall.exit) *(.discard) }
2369 diff -NurpP --minimal linux-2.6.34/arch/x86/ia32/ia32entry.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/x86/ia32/ia32entry.S
2370 --- linux-2.6.34/arch/x86/ia32/ia32entry.S 2010-05-18 15:07:45.000000000 +0200
2371 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/x86/ia32/ia32entry.S 2010-05-18 18:11:22.000000000 +0200
2372 @@ -777,7 +777,7 @@ ia32_sys_call_table:
2373 .quad sys_tgkill /* 270 */
2374 .quad compat_sys_utimes
2375 .quad sys32_fadvise64_64
2376 - .quad quiet_ni_syscall /* sys_vserver */
2377 + .quad sys32_vserver
2379 .quad compat_sys_get_mempolicy /* 275 */
2380 .quad sys_set_mempolicy
2381 diff -NurpP --minimal linux-2.6.34/arch/x86/include/asm/unistd_64.h linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/x86/include/asm/unistd_64.h
2382 --- linux-2.6.34/arch/x86/include/asm/unistd_64.h 2010-05-18 15:07:45.000000000 +0200
2383 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/x86/include/asm/unistd_64.h 2010-05-18 18:11:22.000000000 +0200
2384 @@ -535,7 +535,7 @@ __SYSCALL(__NR_tgkill, sys_tgkill)
2385 #define __NR_utimes 235
2386 __SYSCALL(__NR_utimes, sys_utimes)
2387 #define __NR_vserver 236
2388 -__SYSCALL(__NR_vserver, sys_ni_syscall)
2389 +__SYSCALL(__NR_vserver, sys_vserver)
2390 #define __NR_mbind 237
2391 __SYSCALL(__NR_mbind, sys_mbind)
2392 #define __NR_set_mempolicy 238
2393 diff -NurpP --minimal linux-2.6.34/arch/x86/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/x86/Kconfig
2394 --- linux-2.6.34/arch/x86/Kconfig 2010-05-18 15:07:45.000000000 +0200
2395 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/x86/Kconfig 2010-05-18 18:11:22.000000000 +0200
2396 @@ -2118,6 +2118,8 @@ source "fs/Kconfig"
2398 source "arch/x86/Kconfig.debug"
2400 +source "kernel/vserver/Kconfig"
2402 source "security/Kconfig"
2404 source "crypto/Kconfig"
2405 diff -NurpP --minimal linux-2.6.34/arch/x86/kernel/syscall_table_32.S linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/x86/kernel/syscall_table_32.S
2406 --- linux-2.6.34/arch/x86/kernel/syscall_table_32.S 2010-05-18 15:07:45.000000000 +0200
2407 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/x86/kernel/syscall_table_32.S 2010-05-18 18:11:22.000000000 +0200
2408 @@ -272,7 +272,7 @@ ENTRY(sys_call_table)
2409 .long sys_tgkill /* 270 */
2411 .long sys_fadvise64_64
2412 - .long sys_ni_syscall /* sys_vserver */
2415 .long sys_get_mempolicy
2416 .long sys_set_mempolicy
2417 diff -NurpP --minimal linux-2.6.34/arch/xtensa/mm/fault.c linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/xtensa/mm/fault.c
2418 --- linux-2.6.34/arch/xtensa/mm/fault.c 2009-09-10 15:25:48.000000000 +0200
2419 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/arch/xtensa/mm/fault.c 2010-05-18 18:11:22.000000000 +0200
2420 @@ -151,7 +151,8 @@ out_of_memory:
2421 down_read(&mm->mmap_sem);
2424 - printk("VM: killing process %s\n", current->comm);
2425 + printk("VM: killing process %s(%d:#%u)\n",
2426 + current->comm, task_pid_nr(current), current->xid);
2427 if (user_mode(regs))
2428 do_group_exit(SIGKILL);
2429 bad_page_fault(regs, address, SIGKILL);
2430 diff -NurpP --minimal linux-2.6.34/Documentation/vserver/debug.txt linux-2.6.34-vs2.3.0.36.30.4.pre6/Documentation/vserver/debug.txt
2431 --- linux-2.6.34/Documentation/vserver/debug.txt 1970-01-01 01:00:00.000000000 +0100
2432 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/Documentation/vserver/debug.txt 2010-05-18 18:11:22.000000000 +0200
2437 + 2 4 "vx_map_tgid: %p/%llx: %d -> %d"
2438 + "vx_rmap_tgid: %p/%llx: %d -> %d"
2442 + 0 1 "ALLOC (%p,#%d)%c inode (%d)"
2443 + "FREE (%p,#%d)%c inode"
2444 + 1 2 "ALLOC (%p,#%d)%c %lld bytes (%d)"
2445 + "FREE (%p,#%d)%c %lld bytes"
2446 + 2 4 "ADJUST: %lld,%lld on %ld,%ld [mult=%d]"
2447 + 3 8 "ext3_has_free_blocks(%p): %lu<%lu+1, %c, %u!=%u r=%d"
2448 + "ext3_has_free_blocks(%p): free=%lu, root=%lu"
2449 + "rcu_free_dl_info(%p)"
2450 + 4 10 "alloc_dl_info(%p,%d) = %p"
2451 + "dealloc_dl_info(%p)"
2452 + "get_dl_info(%p[#%d.%d])"
2453 + "put_dl_info(%p[#%d.%d])"
2454 + 5 20 "alloc_dl_info(%p,%d)*"
2455 + 6 40 "__hash_dl_info: %p[#%d]"
2456 + "__unhash_dl_info: %p[#%d]"
2457 + 7 80 "locate_dl_info(%p,#%d) = %p"
2461 + 0 1 "destroy_dqhash: %p [#0x%08x] c=%d"
2462 + "new_dqhash: %p [#0x%08x]"
2463 + "vroot[%d]_clr_dev: dev=%p[%lu,%d:%d]"
2464 + "vroot[%d]_get_real_bdev: dev=%p[%lu,%d:%d]"
2465 + "vroot[%d]_set_dev: dev=%p[%lu,%d:%d]"
2466 + "vroot_get_real_bdev not set"
2467 + 1 2 "cow_break_link(»%s«)"
2468 + "temp copy »%s«"
2469 + 2 4 "dentry_open(new): %p"
2470 + "dentry_open(old): %p"
2471 + "lookup_create(new): %p"
2473 + "path_lookup(old): %d"
2474 + "vfs_create(new): %d"
2476 + "vfs_sendfile: %d"
2477 + 3 8 "fput(new_file=%p[#%d])"
2478 + "fput(old_file=%p[#%d])"
2479 + 4 10 "vx_info_kill(%p[#%d],%d,%d) = %d"
2480 + "vx_info_kill(%p[#%d],%d,%d)*"
2481 + 5 20 "vs_reboot(%p[#%d],%d)"
2482 + 6 40 "dropping task %p[#%u,%u] for %p[#%u,%u]"
2486 + 2 4 "nx_addr_conflict(%p,%p) %d.%d,%d.%d"
2487 + 3 8 "inet_bind(%p) %d.%d.%d.%d, %d.%d.%d.%d, %d.%d.%d.%d"
2488 + "inet_bind(%p)* %p,%p;%lx %d.%d.%d.%d"
2489 + 4 10 "ip_route_connect(%p) %p,%p;%lx"
2490 + 5 20 "__addr_in_socket(%p,%d.%d.%d.%d) %p:%d.%d.%d.%d %p;%lx"
2491 + 6 40 "sk,egf: %p [#%d] (from %d)"
2492 + "sk,egn: %p [#%d] (from %d)"
2493 + "sk,req: %p [#%d] (from %d)"
2494 + "sk: %p [#%d] (from %d)"
2495 + "tw: %p [#%d] (from %d)"
2496 + 7 80 "__sock_recvmsg: %p[%p,%p,%p;%d]:%d/%d"
2497 + "__sock_sendmsg: %p[%p,%p,%p;%d]:%d/%d"
2501 + 0 1 "__lookup_nx_info(#%u): %p[#%u]"
2502 + "alloc_nx_info(%d) = %p"
2503 + "create_nx_info(%d) (dynamic rejected)"
2504 + "create_nx_info(%d) = %p (already there)"
2505 + "create_nx_info(%d) = %p (new)"
2506 + "dealloc_nx_info(%p)"
2507 + 1 2 "alloc_nx_info(%d)*"
2508 + "create_nx_info(%d)*"
2509 + 2 4 "get_nx_info(%p[#%d.%d])"
2510 + "put_nx_info(%p[#%d.%d])"
2511 + 3 8 "claim_nx_info(%p[#%d.%d.%d]) %p"
2512 + "clr_nx_info(%p[#%d.%d])"
2513 + "init_nx_info(%p[#%d.%d])"
2514 + "release_nx_info(%p[#%d.%d.%d]) %p"
2515 + "set_nx_info(%p[#%d.%d])"
2516 + 4 10 "__hash_nx_info: %p[#%d]"
2517 + "__nx_dynamic_id: [#%d]"
2518 + "__unhash_nx_info: %p[#%d.%d.%d]"
2519 + 5 20 "moved task %p into nxi:%p[#%d]"
2520 + "nx_migrate_task(%p,%p[#%d.%d.%d])"
2521 + "task_get_nx_info(%p)"
2522 + 6 40 "nx_clear_persistent(%p[#%d])"
2526 + 0 1 "quota_sync_dqh(%p,%d) discard inode %p"
2527 + 1 2 "quota_sync_dqh(%p,%d)"
2528 + "sync_dquots(%p,%d)"
2529 + "sync_dquots_dqh(%p,%d)"
2530 + 3 8 "do_quotactl(%p,%d,cmd=%d,id=%d,%p)"
2534 + 0 1 "vc: VCMD_%02d_%d[%d], %d,%p [%d,%d,%x,%x]"
2535 + 1 2 "vc: VCMD_%02d_%d[%d] = %08lx(%ld) [%d,%d]"
2536 + 4 10 "%s: (%s %s) returned %s with %d"
2540 + 7 80 "dx_parse_tag(»%s«): %d:#%d"
2541 + "dx_propagate_tag(%p[#%lu.%d]): %d,%d"
2545 + 0 1 "__lookup_vx_info(#%u): %p[#%u]"
2546 + "alloc_vx_info(%d) = %p"
2547 + "alloc_vx_info(%d)*"
2548 + "create_vx_info(%d) (dynamic rejected)"
2549 + "create_vx_info(%d) = %p (already there)"
2550 + "create_vx_info(%d) = %p (new)"
2551 + "dealloc_vx_info(%p)"
2552 + "loc_vx_info(%d) = %p (found)"
2553 + "loc_vx_info(%d) = %p (new)"
2554 + "loc_vx_info(%d) = %p (not available)"
2555 + 1 2 "create_vx_info(%d)*"
2556 + "loc_vx_info(%d)*"
2557 + 2 4 "get_vx_info(%p[#%d.%d])"
2558 + "put_vx_info(%p[#%d.%d])"
2559 + 3 8 "claim_vx_info(%p[#%d.%d.%d]) %p"
2560 + "clr_vx_info(%p[#%d.%d])"
2561 + "init_vx_info(%p[#%d.%d])"
2562 + "release_vx_info(%p[#%d.%d.%d]) %p"
2563 + "set_vx_info(%p[#%d.%d])"
2564 + 4 10 "__hash_vx_info: %p[#%d]"
2565 + "__unhash_vx_info: %p[#%d.%d.%d]"
2566 + "__vx_dynamic_id: [#%d]"
2567 + 5 20 "enter_vx_info(%p[#%d],%p) %p[#%d,%p]"
2568 + "leave_vx_info(%p[#%d,%p]) %p[#%d,%p]"
2569 + "moved task %p into vxi:%p[#%d]"
2570 + "task_get_vx_info(%p)"
2571 + "vx_migrate_task(%p,%p[#%d.%d])"
2572 + 6 40 "vx_clear_persistent(%p[#%d])"
2573 + "vx_exit_init(%p[#%d],%p[#%d,%d,%d])"
2574 + "vx_set_init(%p[#%d],%p[#%d,%d,%d])"
2575 + "vx_set_persistent(%p[#%d])"
2576 + "vx_set_reaper(%p[#%d],%p[#%d,%d])"
2577 + 7 80 "vx_child_reaper(%p[#%u,%u]) = %p[#%u,%u]"
2582 + n 2^n "vx_acc_cres[%5d,%s,%2d]: %5d%s"
2583 + "vx_cres_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
2585 + m 2^m "vx_acc_page[%5d,%s,%2d]: %5d%s"
2586 + "vx_acc_pages[%5d,%s,%2d]: %5d += %5d"
2587 + "vx_pages_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
2588 diff -NurpP --minimal linux-2.6.34/drivers/block/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/block/Kconfig
2589 --- linux-2.6.34/drivers/block/Kconfig 2010-02-25 11:51:36.000000000 +0100
2590 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/block/Kconfig 2010-05-18 18:11:22.000000000 +0200
2591 @@ -273,6 +273,13 @@ config BLK_DEV_CRYPTOLOOP
2593 source "drivers/block/drbd/Kconfig"
2595 +config BLK_DEV_VROOT
2596 + tristate "Virtual Root device support"
2597 + depends on QUOTACTL
2599 + Saying Y here will allow you to use quota/fs ioctls on a shared
2600 + partition within a virtual server without compromising security.
2603 tristate "Network block device support"
2605 diff -NurpP --minimal linux-2.6.34/drivers/block/loop.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/block/loop.c
2606 --- linux-2.6.34/drivers/block/loop.c 2010-05-18 15:07:45.000000000 +0200
2607 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/block/loop.c 2010-05-18 18:11:22.000000000 +0200
2609 #include <linux/highmem.h>
2610 #include <linux/kthread.h>
2611 #include <linux/splice.h>
2612 +#include <linux/vs_context.h>
2614 #include <asm/uaccess.h>
2616 @@ -813,6 +814,7 @@ static int loop_set_fd(struct loop_devic
2617 lo->lo_blocksize = lo_blocksize;
2618 lo->lo_device = bdev;
2619 lo->lo_flags = lo_flags;
2620 + lo->lo_xid = vx_current_xid();
2621 lo->lo_backing_file = file;
2622 lo->transfer = transfer_none;
2624 @@ -938,6 +940,7 @@ static int loop_clr_fd(struct loop_devic
2625 lo->lo_encrypt_key_size = 0;
2627 lo->lo_thread = NULL;
2629 memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
2630 memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
2631 memset(lo->lo_file_name, 0, LO_NAME_SIZE);
2632 @@ -972,7 +975,7 @@ loop_set_status(struct loop_device *lo,
2634 if (lo->lo_encrypt_key_size &&
2635 lo->lo_key_owner != uid &&
2636 - !capable(CAP_SYS_ADMIN))
2637 + !vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_CLOOP))
2639 if (lo->lo_state != Lo_bound)
2641 @@ -1056,7 +1059,8 @@ loop_get_status(struct loop_device *lo,
2642 memcpy(info->lo_crypt_name, lo->lo_crypt_name, LO_NAME_SIZE);
2643 info->lo_encrypt_type =
2644 lo->lo_encryption ? lo->lo_encryption->number : 0;
2645 - if (lo->lo_encrypt_key_size && capable(CAP_SYS_ADMIN)) {
2646 + if (lo->lo_encrypt_key_size &&
2647 + vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_CLOOP)) {
2648 info->lo_encrypt_key_size = lo->lo_encrypt_key_size;
2649 memcpy(info->lo_encrypt_key, lo->lo_encrypt_key,
2650 lo->lo_encrypt_key_size);
2651 @@ -1400,6 +1404,9 @@ static int lo_open(struct block_device *
2653 struct loop_device *lo = bdev->bd_disk->private_data;
2655 + if (!vx_check(lo->lo_xid, VS_IDENT|VS_HOSTID|VS_ADMIN_P))
2658 mutex_lock(&lo->lo_ctl_mutex);
2660 mutex_unlock(&lo->lo_ctl_mutex);
2661 diff -NurpP --minimal linux-2.6.34/drivers/block/Makefile linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/block/Makefile
2662 --- linux-2.6.34/drivers/block/Makefile 2010-02-25 11:51:36.000000000 +0100
2663 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/block/Makefile 2010-05-18 18:11:22.000000000 +0200
2664 @@ -34,6 +34,7 @@ obj-$(CONFIG_VIODASD) += viodasd.o
2665 obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
2666 obj-$(CONFIG_BLK_DEV_UB) += ub.o
2667 obj-$(CONFIG_BLK_DEV_HD) += hd.o
2668 +obj-$(CONFIG_BLK_DEV_VROOT) += vroot.o
2670 obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o
2671 obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
2672 diff -NurpP --minimal linux-2.6.34/drivers/block/vroot.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/block/vroot.c
2673 --- linux-2.6.34/drivers/block/vroot.c 1970-01-01 01:00:00.000000000 +0100
2674 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/block/vroot.c 2010-05-18 18:11:22.000000000 +0200
2677 + * linux/drivers/block/vroot.c
2679 + * written by Herbert Pötzl, 9/11/2002
2680 + * ported to 2.6.10 by Herbert Pötzl, 30/12/2004
2682 + * based on the loop.c code by Theodore Ts'o.
2684 + * Copyright (C) 2002-2007 by Herbert Pötzl.
2685 + * Redistribution of this file is permitted under the
2686 + * GNU General Public License.
2690 +#include <linux/module.h>
2691 +#include <linux/moduleparam.h>
2692 +#include <linux/file.h>
2693 +#include <linux/major.h>
2694 +#include <linux/blkdev.h>
2696 +#include <linux/vroot.h>
2697 +#include <linux/vs_context.h>
2700 +static int max_vroot = 8;
2702 +static struct vroot_device *vroot_dev;
2703 +static struct gendisk **disks;
2706 +static int vroot_set_dev(
2707 + struct vroot_device *vr,
2708 + struct block_device *bdev,
2711 + struct block_device *real_bdev;
2712 + struct file *file;
2713 + struct inode *inode;
2717 + if (vr->vr_state != Vr_unbound)
2726 + inode = file->f_dentry->d_inode;
2729 + if (S_ISBLK(inode->i_mode)) {
2730 + real_bdev = inode->i_bdev;
2731 + vr->vr_device = real_bdev;
2732 + __iget(real_bdev->bd_inode);
2736 + vxdprintk(VXD_CBIT(misc, 0),
2737 + "vroot[%d]_set_dev: dev=" VXF_DEV,
2738 + vr->vr_number, VXD_DEV(real_bdev));
2740 + vr->vr_state = Vr_bound;
2749 +static int vroot_clr_dev(
2750 + struct vroot_device *vr,
2751 + struct block_device *bdev)
2753 + struct block_device *real_bdev;
2755 + if (vr->vr_state != Vr_bound)
2757 + if (vr->vr_refcnt > 1) /* we needed one fd for the ioctl */
2760 + real_bdev = vr->vr_device;
2762 + vxdprintk(VXD_CBIT(misc, 0),
2763 + "vroot[%d]_clr_dev: dev=" VXF_DEV,
2764 + vr->vr_number, VXD_DEV(real_bdev));
2767 + vr->vr_state = Vr_unbound;
2768 + vr->vr_device = NULL;
2773 +static int vr_ioctl(struct block_device *bdev, fmode_t mode,
2774 + unsigned int cmd, unsigned long arg)
2776 + struct vroot_device *vr = bdev->bd_disk->private_data;
2779 + down(&vr->vr_ctl_mutex);
2781 + case VROOT_SET_DEV:
2782 + err = vroot_set_dev(vr, bdev, arg);
2784 + case VROOT_CLR_DEV:
2785 + err = vroot_clr_dev(vr, bdev);
2791 + up(&vr->vr_ctl_mutex);
2795 +static int vr_open(struct block_device *bdev, fmode_t mode)
2797 + struct vroot_device *vr = bdev->bd_disk->private_data;
2799 + down(&vr->vr_ctl_mutex);
2801 + up(&vr->vr_ctl_mutex);
2805 +static int vr_release(struct gendisk *disk, fmode_t mode)
2807 + struct vroot_device *vr = disk->private_data;
2809 + down(&vr->vr_ctl_mutex);
2811 + up(&vr->vr_ctl_mutex);
2815 +static struct block_device_operations vr_fops = {
2816 + .owner = THIS_MODULE,
2818 + .release = vr_release,
2819 + .ioctl = vr_ioctl,
2822 +struct block_device *__vroot_get_real_bdev(struct block_device *bdev)
2824 + struct inode *inode = bdev->bd_inode;
2825 + struct vroot_device *vr;
2826 + struct block_device *real_bdev;
2827 + int minor = iminor(inode);
2829 + vr = &vroot_dev[minor];
2830 + real_bdev = vr->vr_device;
2832 + vxdprintk(VXD_CBIT(misc, 0),
2833 + "vroot[%d]_get_real_bdev: dev=" VXF_DEV,
2834 + vr->vr_number, VXD_DEV(real_bdev));
2836 + if (vr->vr_state != Vr_bound)
2837 + return ERR_PTR(-ENXIO);
2839 + __iget(real_bdev->bd_inode);
2844 + * And now the modules code and kernel interface.
2847 +module_param(max_vroot, int, 0);
2849 +MODULE_PARM_DESC(max_vroot, "Maximum number of vroot devices (1-256)");
2850 +MODULE_LICENSE("GPL");
2851 +MODULE_ALIAS_BLOCKDEV_MAJOR(VROOT_MAJOR);
2853 +MODULE_AUTHOR ("Herbert Pötzl");
2854 +MODULE_DESCRIPTION ("Virtual Root Device Mapper");
2857 +int __init vroot_init(void)
2861 + if (max_vroot < 1 || max_vroot > 256) {
2862 + max_vroot = MAX_VROOT_DEFAULT;
2863 + printk(KERN_WARNING "vroot: invalid max_vroot "
2864 + "(must be between 1 and 256), "
2865 + "using default (%d)\n", max_vroot);
2868 + if (register_blkdev(VROOT_MAJOR, "vroot"))
2872 + vroot_dev = kmalloc(max_vroot * sizeof(struct vroot_device), GFP_KERNEL);
2875 + memset(vroot_dev, 0, max_vroot * sizeof(struct vroot_device));
2877 + disks = kmalloc(max_vroot * sizeof(struct gendisk *), GFP_KERNEL);
2881 + for (i = 0; i < max_vroot; i++) {
2882 + disks[i] = alloc_disk(1);
2885 + disks[i]->queue = blk_alloc_queue(GFP_KERNEL);
2886 + if (!disks[i]->queue)
2890 + for (i = 0; i < max_vroot; i++) {
2891 + struct vroot_device *vr = &vroot_dev[i];
2892 + struct gendisk *disk = disks[i];
2894 + memset(vr, 0, sizeof(*vr));
2895 + init_MUTEX(&vr->vr_ctl_mutex);
2896 + vr->vr_number = i;
2897 + disk->major = VROOT_MAJOR;
2898 + disk->first_minor = i;
2899 + disk->fops = &vr_fops;
2900 + sprintf(disk->disk_name, "vroot%d", i);
2901 + disk->private_data = vr;
2904 + err = register_vroot_grb(&__vroot_get_real_bdev);
2908 + for (i = 0; i < max_vroot; i++)
2909 + add_disk(disks[i]);
2910 + printk(KERN_INFO "vroot: loaded (max %d devices)\n", max_vroot);
2915 + put_disk(disks[i]);
2920 + unregister_blkdev(VROOT_MAJOR, "vroot");
2921 + printk(KERN_ERR "vroot: ran out of memory\n");
2925 +void vroot_exit(void)
2929 + if (unregister_vroot_grb(&__vroot_get_real_bdev))
2930 + printk(KERN_WARNING "vroot: cannot unregister grb\n");
2932 + for (i = 0; i < max_vroot; i++) {
2933 + del_gendisk(disks[i]);
2934 + put_disk(disks[i]);
2936 + unregister_blkdev(VROOT_MAJOR, "vroot");
2942 +module_init(vroot_init);
2943 +module_exit(vroot_exit);
2947 +static int __init max_vroot_setup(char *str)
2949 + max_vroot = simple_strtol(str, NULL, 0);
2953 +__setup("max_vroot=", max_vroot_setup);
2957 diff -NurpP --minimal linux-2.6.34/drivers/char/sysrq.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/char/sysrq.c
2958 --- linux-2.6.34/drivers/char/sysrq.c 2010-05-18 15:07:46.000000000 +0200
2959 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/char/sysrq.c 2010-05-18 18:11:22.000000000 +0200
2961 #include <linux/hrtimer.h>
2962 #include <linux/oom.h>
2963 #include <linux/slab.h>
2964 +#include <linux/vserver/debug.h>
2966 #include <asm/ptrace.h>
2967 #include <asm/irq_regs.h>
2968 @@ -392,6 +393,21 @@ static struct sysrq_key_op sysrq_unrt_op
2969 .enable_mask = SYSRQ_ENABLE_RTNICE,
2973 +#ifdef CONFIG_VSERVER_DEBUG
2974 +static void sysrq_handle_vxinfo(int key, struct tty_struct *tty)
2976 + dump_vx_info_inactive((key == 'x')?0:1);
2979 +static struct sysrq_key_op sysrq_showvxinfo_op = {
2980 + .handler = sysrq_handle_vxinfo,
2981 + .help_msg = "conteXt",
2982 + .action_msg = "Show Context Info",
2983 + .enable_mask = SYSRQ_ENABLE_DUMP,
2987 /* Key Operations table and lock */
2988 static DEFINE_SPINLOCK(sysrq_key_table_lock);
2990 @@ -446,7 +462,11 @@ static struct sysrq_key_op *sysrq_key_ta
2992 &sysrq_showstate_blocked_op, /* w */
2993 /* x: May be registered on ppc/powerpc for xmon */
2994 +#ifdef CONFIG_VSERVER_DEBUG
2995 + &sysrq_showvxinfo_op, /* x */
2999 /* y: May be registered on sparc64 for global register dump */
3001 &sysrq_ftrace_dump_op, /* z */
3002 @@ -461,6 +481,8 @@ static int sysrq_key_table_key2index(int
3004 else if ((key >= 'a') && (key <= 'z'))
3005 retval = key + 10 - 'a';
3006 + else if ((key >= 'A') && (key <= 'Z'))
3007 + retval = key + 10 - 'A';
3011 diff -NurpP --minimal linux-2.6.34/drivers/char/tty_io.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/char/tty_io.c
3012 --- linux-2.6.34/drivers/char/tty_io.c 2010-05-18 15:07:46.000000000 +0200
3013 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/char/tty_io.c 2010-05-18 18:11:22.000000000 +0200
3016 #include <linux/kmod.h>
3017 #include <linux/nsproxy.h>
3018 +#include <linux/vs_pid.h>
3020 #undef TTY_DEBUG_HANGUP
3022 @@ -1992,7 +1993,8 @@ static int tiocsti(struct tty_struct *tt
3024 struct tty_ldisc *ld;
3026 - if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
3027 + if (((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN)) ||
3028 + !vx_ccaps(VXC_TIOCSTI))
3030 if (get_user(ch, p))
3032 @@ -2280,6 +2282,7 @@ static int tiocspgrp(struct tty_struct *
3034 if (get_user(pgrp_nr, p))
3036 + pgrp_nr = vx_rmap_pid(pgrp_nr);
3040 diff -NurpP --minimal linux-2.6.34/drivers/gpu/drm/radeon/r100_reg_safe.h linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/r100_reg_safe.h
3041 --- linux-2.6.34/drivers/gpu/drm/radeon/r100_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3042 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/r100_reg_safe.h 2010-05-18 18:11:22.000000000 +0200
3044 +static const unsigned r100_reg_safe_bm[102] = {
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 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3051 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3052 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3053 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3054 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3055 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3056 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3057 + 0xFFFFFFCF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3058 + 0xFFFFFF9F, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3059 + 0x38E7FE1F, 0xFFC3FF8E, 0x7FF8FFFF, 0xFFFF803C,
3060 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3061 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFEFFFF, 0xFFFFFFFF,
3062 + 0x00000000, 0xFFFFFFFD, 0xFFFFFFFF, 0xFFFFFFFF,
3063 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3064 + 0xFFFFFFFF, 0xFFFCFFFF, 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, 0xFFFFFFEF,
3072 diff -NurpP --minimal linux-2.6.34/drivers/gpu/drm/radeon/r200_reg_safe.h linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/r200_reg_safe.h
3073 --- linux-2.6.34/drivers/gpu/drm/radeon/r200_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3074 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/r200_reg_safe.h 2010-05-18 18:11:22.000000000 +0200
3076 +static const unsigned r200_reg_safe_bm[102] = {
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 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3088 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3089 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3090 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3091 + 0xFFE7FE1F, 0xF003FFFF, 0x7EFFFFFF, 0xFFFF803C,
3092 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3093 + 0xFFFFFFFF, 0xFFFFEFCE, 0xFFFEFFFF, 0xFFFFFFFE,
3094 + 0x020E0FF0, 0xFFCC83FD, 0xFFFFFFFF, 0xFFFFFFFF,
3095 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3096 + 0xFFFBFFFF, 0xEFFCFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3097 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3098 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3099 + 0xDFDFDFDF, 0x3FFDDFDF, 0xFFFFFFFF, 0xFFFFFF7F,
3100 + 0xFFFFFFFF, 0x00FFFFFF, 0x00000000, 0x00000000,
3101 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3102 + 0xFFFFFE3F, 0xFFFFFFEF,
3104 diff -NurpP --minimal linux-2.6.34/drivers/gpu/drm/radeon/r300_reg_safe.h linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/r300_reg_safe.h
3105 --- linux-2.6.34/drivers/gpu/drm/radeon/r300_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3106 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/r300_reg_safe.h 2010-05-18 18:11:22.000000000 +0200
3108 +static const unsigned r300_reg_safe_bm[159] = {
3109 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3110 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3111 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3112 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3113 + 0xFFFFFFFF, 0xFFFFFFFF, 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 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3120 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3121 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3122 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3123 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3124 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3125 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3126 + 0xF0000078, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3127 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3128 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3129 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3130 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3131 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3132 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3133 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3134 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3135 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 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 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3142 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3143 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3144 + 0x00000000, 0x0000C100, 0x00000000, 0x00000000,
3145 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3146 + 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFF80FFFF,
3147 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3148 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19,
3150 diff -NurpP --minimal linux-2.6.34/drivers/gpu/drm/radeon/r420_reg_safe.h linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/r420_reg_safe.h
3151 --- linux-2.6.34/drivers/gpu/drm/radeon/r420_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3152 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/r420_reg_safe.h 2010-05-18 18:11:22.000000000 +0200
3154 +static const unsigned r420_reg_safe_bm[159] = {
3155 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3156 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
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 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3166 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3167 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3168 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3169 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3170 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3171 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3172 + 0xF0000078, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3173 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3174 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3175 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 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 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3182 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3183 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3184 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3185 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3186 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3187 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3188 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3189 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3190 + 0x00000000, 0x00000100, 0x00000000, 0x00000000,
3191 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3192 + 0x00000000, 0x00000000, 0x00000000, 0xFF800000,
3193 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3194 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19,
3196 diff -NurpP --minimal linux-2.6.34/drivers/gpu/drm/radeon/rn50_reg_safe.h linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/rn50_reg_safe.h
3197 --- linux-2.6.34/drivers/gpu/drm/radeon/rn50_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3198 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/rn50_reg_safe.h 2010-05-18 18:11:22.000000000 +0200
3200 +static const unsigned rn50_reg_safe_bm[102] = {
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 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3212 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3213 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3214 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3215 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3216 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3217 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3218 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3219 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3220 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3221 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3222 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3223 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3224 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3225 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3226 + 0xFFFFFFFF, 0xFFFFFFFF,
3228 diff -NurpP --minimal linux-2.6.34/drivers/gpu/drm/radeon/rs600_reg_safe.h linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/rs600_reg_safe.h
3229 --- linux-2.6.34/drivers/gpu/drm/radeon/rs600_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3230 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/rs600_reg_safe.h 2010-05-18 18:11:22.000000000 +0200
3232 +static const unsigned rs600_reg_safe_bm[219] = {
3233 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3234 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3235 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3236 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3237 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3238 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3239 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3240 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3241 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3242 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3243 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3244 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3245 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3246 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3247 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3248 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3249 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3250 + 0xF0000078, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3251 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3252 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3253 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3254 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3255 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3256 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3257 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3258 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3259 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3260 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3261 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3262 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3263 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3264 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3265 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3266 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3267 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3268 + 0x00000000, 0x00000100, 0x00000000, 0x00000000,
3269 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3270 + 0x00000000, 0x00000000, 0x00000000, 0xFF800000,
3271 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3272 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19, 0xFFFFFFFF,
3273 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3274 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3275 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3276 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3277 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3278 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3279 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3280 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3281 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3282 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3283 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3284 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3285 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3286 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3287 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3289 diff -NurpP --minimal linux-2.6.34/drivers/gpu/drm/radeon/rv515_reg_safe.h linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/rv515_reg_safe.h
3290 --- linux-2.6.34/drivers/gpu/drm/radeon/rv515_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3291 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/gpu/drm/radeon/rv515_reg_safe.h 2010-05-18 18:11:22.000000000 +0200
3293 +static const unsigned rv515_reg_safe_bm[219] = {
3294 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3295 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3296 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3297 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3298 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3299 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3300 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3301 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3302 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3303 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3304 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3305 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3306 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3307 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3308 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3309 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3310 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3311 + 0xF0000038, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3312 + 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF,
3313 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3314 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3315 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3316 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3317 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3318 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3319 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3320 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3321 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3322 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3323 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3324 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3325 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3326 + 0x1FFFF878, 0xFFFFE000, 0xFFFFFE1E, 0xFFFFFFFF,
3327 + 0x388F8F50, 0xFFF88082, 0xFF0000FC, 0xFAE009FF,
3328 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3329 + 0xFFFF8CFC, 0xFFFFC1FF, 0xFFFFFFFF, 0xFFFFFFFF,
3330 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3331 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF80FFFF,
3332 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3333 + 0x0003FC01, 0x3FFFFCF8, 0xFF800B19, 0xFFDFFFFF,
3334 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3335 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3336 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3337 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3338 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3339 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3340 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3341 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3342 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3343 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3344 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3345 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3346 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3347 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3348 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3350 diff -NurpP --minimal linux-2.6.34/drivers/infiniband/core/addr.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/infiniband/core/addr.c
3351 --- linux-2.6.34/drivers/infiniband/core/addr.c 2010-05-18 15:07:46.000000000 +0200
3352 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/infiniband/core/addr.c 2010-05-18 18:11:22.000000000 +0200
3353 @@ -252,7 +252,7 @@ static int addr6_resolve(struct sockaddr
3355 if (ipv6_addr_any(&fl.fl6_src)) {
3356 ret = ipv6_dev_get_saddr(&init_net, ip6_dst_idev(dst)->dev,
3357 - &fl.fl6_dst, 0, &fl.fl6_src);
3358 + &fl.fl6_dst, 0, &fl.fl6_src, NULL);
3362 diff -NurpP --minimal linux-2.6.34/drivers/infiniband/hw/ipath/ipath_user_pages.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/infiniband/hw/ipath/ipath_user_pages.c
3363 --- linux-2.6.34/drivers/infiniband/hw/ipath/ipath_user_pages.c 2010-05-18 15:07:46.000000000 +0200
3364 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/infiniband/hw/ipath/ipath_user_pages.c 2010-05-19 03:10:18.000000000 +0200
3366 #include <linux/device.h>
3367 #include <linux/slab.h>
3368 #include <linux/sched.h>
3369 +#include <linux/vs_memory.h>
3371 #include "ipath_kernel.h"
3373 diff -NurpP --minimal linux-2.6.34/drivers/md/dm.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/md/dm.c
3374 --- linux-2.6.34/drivers/md/dm.c 2010-05-18 15:07:47.000000000 +0200
3375 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/md/dm.c 2010-05-18 18:11:22.000000000 +0200
3377 #include <linux/slab.h>
3378 #include <linux/idr.h>
3379 #include <linux/hdreg.h>
3380 +#include <linux/vs_base.h>
3382 #include <trace/events/block.h>
3384 @@ -119,6 +120,7 @@ struct mapped_device {
3387 atomic_t open_count;
3390 unsigned long flags;
3392 @@ -337,6 +339,7 @@ int dm_deleting_md(struct mapped_device
3393 static int dm_blk_open(struct block_device *bdev, fmode_t mode)
3395 struct mapped_device *md;
3398 spin_lock(&_minor_lock);
3400 @@ -345,18 +348,19 @@ static int dm_blk_open(struct block_devi
3403 if (test_bit(DMF_FREEING, &md->flags) ||
3404 - dm_deleting_md(md)) {
3406 + dm_deleting_md(md))
3410 + if (!vx_check(md->xid, VS_IDENT|VS_HOSTID))
3415 atomic_inc(&md->open_count);
3419 spin_unlock(&_minor_lock);
3421 - return md ? 0 : -ENXIO;
3425 static int dm_blk_close(struct gendisk *disk, fmode_t mode)
3426 @@ -574,6 +578,14 @@ int dm_set_geometry(struct mapped_device
3431 + * Get the xid associated with a dm device
3433 +xid_t dm_get_xid(struct mapped_device *md)
3438 /*-----------------------------------------------------------------
3440 * A more elegant soln is in the works that uses the queue
3441 @@ -1886,6 +1898,7 @@ static struct mapped_device *alloc_dev(i
3442 INIT_LIST_HEAD(&md->uevent_list);
3443 spin_lock_init(&md->uevent_lock);
3445 + md->xid = vx_current_xid();
3446 md->queue = blk_init_queue(dm_request_fn, NULL);
3449 diff -NurpP --minimal linux-2.6.34/drivers/md/dm.h linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/md/dm.h
3450 --- linux-2.6.34/drivers/md/dm.h 2010-05-18 15:07:47.000000000 +0200
3451 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/md/dm.h 2010-05-18 18:11:22.000000000 +0200
3452 @@ -41,6 +41,8 @@ struct dm_dev_internal {
3454 struct dm_md_mempools;
3456 +xid_t dm_get_xid(struct mapped_device *md);
3458 /*-----------------------------------------------------------------
3459 * Internal table functions.
3460 *---------------------------------------------------------------*/
3461 diff -NurpP --minimal linux-2.6.34/drivers/md/dm-ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/md/dm-ioctl.c
3462 --- linux-2.6.34/drivers/md/dm-ioctl.c 2010-05-18 15:07:47.000000000 +0200
3463 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/md/dm-ioctl.c 2010-05-18 18:11:22.000000000 +0200
3465 #include <linux/dm-ioctl.h>
3466 #include <linux/hdreg.h>
3467 #include <linux/compat.h>
3468 +#include <linux/vs_context.h>
3470 #include <asm/uaccess.h>
3472 @@ -106,7 +107,8 @@ static struct hash_cell *__get_name_cell
3473 unsigned int h = hash_str(str);
3475 list_for_each_entry (hc, _name_buckets + h, name_list)
3476 - if (!strcmp(hc->name, str)) {
3477 + if (vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT) &&
3478 + !strcmp(hc->name, str)) {
3482 @@ -120,7 +122,8 @@ static struct hash_cell *__get_uuid_cell
3483 unsigned int h = hash_str(str);
3485 list_for_each_entry (hc, _uuid_buckets + h, uuid_list)
3486 - if (!strcmp(hc->uuid, str)) {
3487 + if (vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT) &&
3488 + !strcmp(hc->uuid, str)) {
3492 @@ -365,6 +368,9 @@ typedef int (*ioctl_fn)(struct dm_ioctl
3494 static int remove_all(struct dm_ioctl *param, size_t param_size)
3496 + if (!vx_check(0, VS_ADMIN))
3499 dm_hash_remove_all(1);
3500 param->data_size = 0;
3502 @@ -412,6 +418,8 @@ static int list_devices(struct dm_ioctl
3504 for (i = 0; i < NUM_BUCKETS; i++) {
3505 list_for_each_entry (hc, _name_buckets + i, name_list) {
3506 + if (!vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT))
3508 needed += sizeof(struct dm_name_list);
3509 needed += strlen(hc->name) + 1;
3510 needed += ALIGN_MASK;
3511 @@ -435,6 +443,8 @@ static int list_devices(struct dm_ioctl
3513 for (i = 0; i < NUM_BUCKETS; i++) {
3514 list_for_each_entry (hc, _name_buckets + i, name_list) {
3515 + if (!vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT))
3518 old_nl->next = (uint32_t) ((void *) nl -
3520 @@ -669,10 +679,11 @@ static struct hash_cell *__find_device_h
3524 - mdptr = dm_get_mdptr(md);
3525 + if (vx_check(dm_get_xid(md), VS_WATCH_P | VS_IDENT))
3526 + mdptr = dm_get_mdptr(md);
3534 @@ -1514,8 +1525,8 @@ static int ctl_ioctl(uint command, struc
3538 - /* only root can play with this */
3539 - if (!capable(CAP_SYS_ADMIN))
3540 + /* only root and certain contexts can play with this */
3541 + if (!vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_MAPPER))
3544 if (_IOC_TYPE(command) != DM_IOCTL)
3545 diff -NurpP --minimal linux-2.6.34/drivers/net/tun.c linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/net/tun.c
3546 --- linux-2.6.34/drivers/net/tun.c 2010-05-18 15:07:48.000000000 +0200
3547 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/drivers/net/tun.c 2010-05-18 18:11:22.000000000 +0200
3549 #include <linux/nsproxy.h>
3550 #include <linux/virtio_net.h>
3551 #include <linux/rcupdate.h>
3552 +#include <linux/vs_network.h>
3553 #include <net/net_namespace.h>
3554 #include <net/netns/generic.h>
3555 #include <net/rtnetlink.h>
3556 @@ -103,6 +104,7 @@ struct tun_struct {
3562 struct net_device *dev;
3563 struct fasync_struct *fasync;
3564 @@ -838,6 +840,7 @@ static void tun_setup(struct net_device
3568 + tun->nid = current->nid;
3570 dev->ethtool_ops = &tun_ethtool_ops;
3571 dev->destructor = tun_free_netdev;
3572 @@ -986,7 +989,7 @@ static int tun_set_iff(struct net *net,
3574 if (((tun->owner != -1 && cred->euid != tun->owner) ||
3575 (tun->group != -1 && !in_egroup_p(tun->group))) &&
3576 - !capable(CAP_NET_ADMIN))
3577 + !cap_raised(current_cap(), CAP_NET_ADMIN))
3579 err = security_tun_dev_attach(tun->socket.sk);
3581 @@ -1000,7 +1003,7 @@ static int tun_set_iff(struct net *net,
3583 unsigned long flags = 0;
3585 - if (!capable(CAP_NET_ADMIN))
3586 + if (!nx_capable(CAP_NET_ADMIN, NXC_TUN_CREATE))
3588 err = security_tun_dev_create();
3590 @@ -1068,6 +1071,9 @@ static int tun_set_iff(struct net *net,
3592 sk->sk_destruct = tun_sock_destruct;
3594 + if (!nx_check(tun->nid, VS_IDENT | VS_HOSTID | VS_ADMIN_P))
3597 err = tun_attach(tun, file);
3600 @@ -1258,6 +1264,16 @@ static long __tun_chr_ioctl(struct file
3601 DBG(KERN_INFO "%s: group set to %d\n", tun->dev->name, tun->group);
3605 + if (!capable(CAP_CONTEXT))
3608 + /* Set nid owner of the device */
3609 + tun->nid = (nid_t) arg;
3611 + DBG(KERN_INFO "%s: nid owner set to %u\n", tun->dev->name, tun->nid);
3615 /* Only allow setting the type when the interface is down */
3616 if (tun->dev->flags & IFF_UP) {
3617 diff -NurpP --minimal linux-2.6.34/fs/attr.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/attr.c
3618 --- linux-2.6.34/fs/attr.c 2010-05-18 15:07:51.000000000 +0200
3619 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/attr.c 2010-05-18 18:11:22.000000000 +0200
3621 #include <linux/fsnotify.h>
3622 #include <linux/fcntl.h>
3623 #include <linux/security.h>
3624 +#include <linux/proc_fs.h>
3625 +#include <linux/devpts_fs.h>
3626 +#include <linux/vs_tag.h>
3628 /* Taken over from the old code... */
3630 @@ -54,6 +57,10 @@ int inode_change_ok(const struct inode *
3631 if (!is_owner_or_cap(inode))
3635 + if (dx_permission(inode, MAY_WRITE))
3641 @@ -119,6 +126,8 @@ int inode_setattr(struct inode * inode,
3642 inode->i_uid = attr->ia_uid;
3643 if (ia_valid & ATTR_GID)
3644 inode->i_gid = attr->ia_gid;
3645 + if ((ia_valid & ATTR_TAG) && IS_TAGGED(inode))
3646 + inode->i_tag = attr->ia_tag;
3647 if (ia_valid & ATTR_ATIME)
3648 inode->i_atime = timespec_trunc(attr->ia_atime,
3649 inode->i_sb->s_time_gran);
3650 @@ -149,7 +158,8 @@ int notify_change(struct dentry * dentry
3651 struct timespec now;
3652 unsigned int ia_valid = attr->ia_valid;
3654 - if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_TIMES_SET)) {
3655 + if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID |
3656 + ATTR_TAG | ATTR_TIMES_SET)) {
3657 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
3660 diff -NurpP --minimal linux-2.6.34/fs/binfmt_aout.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/binfmt_aout.c
3661 --- linux-2.6.34/fs/binfmt_aout.c 2010-05-18 15:07:51.000000000 +0200
3662 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/binfmt_aout.c 2010-05-18 18:11:22.000000000 +0200
3664 #include <linux/init.h>
3665 #include <linux/coredump.h>
3666 #include <linux/slab.h>
3667 +#include <linux/vs_memory.h>
3669 #include <asm/system.h>
3670 #include <asm/uaccess.h>
3671 diff -NurpP --minimal linux-2.6.34/fs/binfmt_elf.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/binfmt_elf.c
3672 --- linux-2.6.34/fs/binfmt_elf.c 2010-05-18 15:07:51.000000000 +0200
3673 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/binfmt_elf.c 2010-05-18 18:11:22.000000000 +0200
3675 #include <linux/elf.h>
3676 #include <linux/utsname.h>
3677 #include <linux/coredump.h>
3678 +#include <linux/vs_memory.h>
3679 #include <asm/uaccess.h>
3680 #include <asm/param.h>
3681 #include <asm/page.h>
3682 diff -NurpP --minimal linux-2.6.34/fs/binfmt_flat.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/binfmt_flat.c
3683 --- linux-2.6.34/fs/binfmt_flat.c 2010-05-18 15:07:51.000000000 +0200
3684 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/binfmt_flat.c 2010-05-18 18:11:22.000000000 +0200
3686 #include <linux/init.h>
3687 #include <linux/flat.h>
3688 #include <linux/syscalls.h>
3689 +#include <linux/vs_memory.h>
3691 #include <asm/byteorder.h>
3692 #include <asm/system.h>
3693 diff -NurpP --minimal linux-2.6.34/fs/binfmt_som.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/binfmt_som.c
3694 --- linux-2.6.34/fs/binfmt_som.c 2010-02-25 11:52:04.000000000 +0100
3695 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/binfmt_som.c 2010-05-18 18:11:22.000000000 +0200
3697 #include <linux/shm.h>
3698 #include <linux/personality.h>
3699 #include <linux/init.h>
3700 +#include <linux/vs_memory.h>
3702 #include <asm/uaccess.h>
3703 #include <asm/pgtable.h>
3704 diff -NurpP --minimal linux-2.6.34/fs/block_dev.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/block_dev.c
3705 --- linux-2.6.34/fs/block_dev.c 2010-05-18 15:07:51.000000000 +0200
3706 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/block_dev.c 2010-05-18 18:11:22.000000000 +0200
3708 #include <linux/namei.h>
3709 #include <linux/log2.h>
3710 #include <linux/kmemleak.h>
3711 +#include <linux/vs_device.h>
3712 #include <asm/uaccess.h>
3713 #include "internal.h"
3715 @@ -574,6 +575,7 @@ struct block_device *bdget(dev_t dev)
3716 bdev->bd_invalidated = 0;
3717 inode->i_mode = S_IFBLK;
3718 inode->i_rdev = dev;
3719 + inode->i_mdev = dev;
3720 inode->i_bdev = bdev;
3721 inode->i_data.a_ops = &def_blk_aops;
3722 mapping_set_gfp_mask(&inode->i_data, GFP_USER);
3723 @@ -620,6 +622,11 @@ EXPORT_SYMBOL(bdput);
3724 static struct block_device *bd_acquire(struct inode *inode)
3726 struct block_device *bdev;
3729 + if (!vs_map_blkdev(inode->i_rdev, &mdev, DATTR_OPEN))
3731 + inode->i_mdev = mdev;
3733 spin_lock(&bdev_lock);
3734 bdev = inode->i_bdev;
3735 @@ -630,7 +637,7 @@ static struct block_device *bd_acquire(s
3737 spin_unlock(&bdev_lock);
3739 - bdev = bdget(inode->i_rdev);
3740 + bdev = bdget(mdev);
3742 spin_lock(&bdev_lock);
3743 if (!inode->i_bdev) {
3744 diff -NurpP --minimal linux-2.6.34/fs/btrfs/ctree.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/ctree.h
3745 --- linux-2.6.34/fs/btrfs/ctree.h 2010-05-18 15:07:51.000000000 +0200
3746 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/ctree.h 2010-05-18 18:11:22.000000000 +0200
3747 @@ -550,11 +550,14 @@ struct btrfs_inode_item {
3748 /* modification sequence number for NFS */
3753 * a little future expansion, for more than this we can
3754 * just grow the inode item and version it
3756 - __le64 reserved[4];
3757 + __le16 reserved16;
3758 + __le32 reserved32;
3759 + __le64 reserved[3];
3760 struct btrfs_timespec atime;
3761 struct btrfs_timespec ctime;
3762 struct btrfs_timespec mtime;
3763 @@ -1165,6 +1168,8 @@ struct btrfs_root {
3764 #define BTRFS_MOUNT_DISCARD (1 << 10)
3765 #define BTRFS_MOUNT_FORCE_COMPRESS (1 << 11)
3767 +#define BTRFS_MOUNT_TAGGED (1 << 24)
3769 #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
3770 #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
3771 #define btrfs_test_opt(root, opt) ((root)->fs_info->mount_opt & \
3772 @@ -1385,6 +1390,7 @@ BTRFS_SETGET_FUNCS(inode_block_group, st
3773 BTRFS_SETGET_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
3774 BTRFS_SETGET_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
3775 BTRFS_SETGET_FUNCS(inode_gid, struct btrfs_inode_item, gid, 32);
3776 +BTRFS_SETGET_FUNCS(inode_tag, struct btrfs_inode_item, tag, 16);
3777 BTRFS_SETGET_FUNCS(inode_mode, struct btrfs_inode_item, mode, 32);
3778 BTRFS_SETGET_FUNCS(inode_rdev, struct btrfs_inode_item, rdev, 64);
3779 BTRFS_SETGET_FUNCS(inode_flags, struct btrfs_inode_item, flags, 64);
3780 @@ -1446,6 +1452,10 @@ BTRFS_SETGET_FUNCS(extent_flags, struct
3782 BTRFS_SETGET_FUNCS(extent_refs_v0, struct btrfs_extent_item_v0, refs, 32);
3784 +#define BTRFS_INODE_IXUNLINK (1 << 24)
3785 +#define BTRFS_INODE_BARRIER (1 << 25)
3786 +#define BTRFS_INODE_COW (1 << 26)
3789 BTRFS_SETGET_FUNCS(tree_block_level, struct btrfs_tree_block_info, level, 8);
3791 @@ -2359,6 +2369,7 @@ extern const struct dentry_operations bt
3792 long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
3793 void btrfs_update_iflags(struct inode *inode);
3794 void btrfs_inherit_iflags(struct inode *inode, struct inode *dir);
3795 +int btrfs_sync_flags(struct inode *inode, int, int);
3798 int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync);
3799 diff -NurpP --minimal linux-2.6.34/fs/btrfs/disk-io.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/disk-io.c
3800 --- linux-2.6.34/fs/btrfs/disk-io.c 2010-05-18 15:07:51.000000000 +0200
3801 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/disk-io.c 2010-05-18 18:11:22.000000000 +0200
3802 @@ -1718,6 +1718,9 @@ struct btrfs_root *open_ctree(struct sup
3806 + if (btrfs_test_opt(tree_root, TAGGED))
3807 + sb->s_flags |= MS_TAGGED;
3809 features = btrfs_super_incompat_flags(disk_super) &
3810 ~BTRFS_FEATURE_INCOMPAT_SUPP;
3812 diff -NurpP --minimal linux-2.6.34/fs/btrfs/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/inode.c
3813 --- linux-2.6.34/fs/btrfs/inode.c 2010-05-18 15:07:51.000000000 +0200
3814 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/inode.c 2010-05-18 18:11:22.000000000 +0200
3816 #include <linux/posix_acl.h>
3817 #include <linux/falloc.h>
3818 #include <linux/slab.h>
3819 +#include <linux/vs_tag.h>
3823 #include "disk-io.h"
3824 @@ -2227,6 +2229,8 @@ static void btrfs_read_locked_inode(stru
3826 u64 alloc_group_block;
3832 path = btrfs_alloc_path();
3833 @@ -2243,8 +2247,13 @@ static void btrfs_read_locked_inode(stru
3835 inode->i_mode = btrfs_inode_mode(leaf, inode_item);
3836 inode->i_nlink = btrfs_inode_nlink(leaf, inode_item);
3837 - inode->i_uid = btrfs_inode_uid(leaf, inode_item);
3838 - inode->i_gid = btrfs_inode_gid(leaf, inode_item);
3840 + uid = btrfs_inode_uid(leaf, inode_item);
3841 + gid = btrfs_inode_gid(leaf, inode_item);
3842 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
3843 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
3844 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
3845 + btrfs_inode_tag(leaf, inode_item));
3846 btrfs_i_size_write(inode, btrfs_inode_size(leaf, inode_item));
3848 tspec = btrfs_inode_atime(inode_item);
3849 @@ -2326,8 +2335,15 @@ static void fill_inode_item(struct btrfs
3850 struct btrfs_inode_item *item,
3851 struct inode *inode)
3853 - btrfs_set_inode_uid(leaf, item, inode->i_uid);
3854 - btrfs_set_inode_gid(leaf, item, inode->i_gid);
3855 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
3856 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
3858 + btrfs_set_inode_uid(leaf, item, uid);
3859 + btrfs_set_inode_gid(leaf, item, gid);
3860 +#ifdef CONFIG_TAGGING_INTERN
3861 + btrfs_set_inode_tag(leaf, item, inode->i_tag);
3864 btrfs_set_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size);
3865 btrfs_set_inode_mode(leaf, item, inode->i_mode);
3866 btrfs_set_inode_nlink(leaf, item, inode->i_nlink);
3867 @@ -4130,6 +4146,7 @@ static struct inode *btrfs_new_inode(str
3869 inode->i_gid = current_fsgid();
3871 + inode->i_tag = dx_current_fstag(root->fs_info->sb);
3872 inode->i_mode = mode;
3873 inode->i_ino = objectid;
3874 inode_set_bytes(inode, 0);
3875 @@ -5938,6 +5955,7 @@ static const struct inode_operations btr
3876 .listxattr = btrfs_listxattr,
3877 .removexattr = btrfs_removexattr,
3878 .permission = btrfs_permission,
3879 + .sync_flags = btrfs_sync_flags,
3881 static const struct inode_operations btrfs_dir_ro_inode_operations = {
3882 .lookup = btrfs_lookup,
3883 @@ -6013,6 +6031,7 @@ static const struct inode_operations btr
3884 .permission = btrfs_permission,
3885 .fallocate = btrfs_fallocate,
3886 .fiemap = btrfs_fiemap,
3887 + .sync_flags = btrfs_sync_flags,
3889 static const struct inode_operations btrfs_special_inode_operations = {
3890 .getattr = btrfs_getattr,
3891 diff -NurpP --minimal linux-2.6.34/fs/btrfs/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/ioctl.c
3892 --- linux-2.6.34/fs/btrfs/ioctl.c 2010-05-18 15:07:51.000000000 +0200
3893 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/ioctl.c 2010-05-18 18:11:22.000000000 +0200
3894 @@ -68,10 +68,13 @@ static unsigned int btrfs_flags_to_ioctl
3896 unsigned int iflags = 0;
3898 - if (flags & BTRFS_INODE_SYNC)
3899 - iflags |= FS_SYNC_FL;
3900 if (flags & BTRFS_INODE_IMMUTABLE)
3901 iflags |= FS_IMMUTABLE_FL;
3902 + if (flags & BTRFS_INODE_IXUNLINK)
3903 + iflags |= FS_IXUNLINK_FL;
3905 + if (flags & BTRFS_INODE_SYNC)
3906 + iflags |= FS_SYNC_FL;
3907 if (flags & BTRFS_INODE_APPEND)
3908 iflags |= FS_APPEND_FL;
3909 if (flags & BTRFS_INODE_NODUMP)
3910 @@ -81,28 +84,78 @@ static unsigned int btrfs_flags_to_ioctl
3911 if (flags & BTRFS_INODE_DIRSYNC)
3912 iflags |= FS_DIRSYNC_FL;
3914 + if (flags & BTRFS_INODE_BARRIER)
3915 + iflags |= FS_BARRIER_FL;
3916 + if (flags & BTRFS_INODE_COW)
3917 + iflags |= FS_COW_FL;
3922 - * Update inode->i_flags based on the btrfs internal flags.
3923 + * Update inode->i_(v)flags based on the btrfs internal flags.
3925 void btrfs_update_iflags(struct inode *inode)
3927 struct btrfs_inode *ip = BTRFS_I(inode);
3929 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
3930 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
3931 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
3933 - if (ip->flags & BTRFS_INODE_SYNC)
3934 - inode->i_flags |= S_SYNC;
3935 if (ip->flags & BTRFS_INODE_IMMUTABLE)
3936 inode->i_flags |= S_IMMUTABLE;
3937 + if (ip->flags & BTRFS_INODE_IXUNLINK)
3938 + inode->i_flags |= S_IXUNLINK;
3940 + if (ip->flags & BTRFS_INODE_SYNC)
3941 + inode->i_flags |= S_SYNC;
3942 if (ip->flags & BTRFS_INODE_APPEND)
3943 inode->i_flags |= S_APPEND;
3944 if (ip->flags & BTRFS_INODE_NOATIME)
3945 inode->i_flags |= S_NOATIME;
3946 if (ip->flags & BTRFS_INODE_DIRSYNC)
3947 inode->i_flags |= S_DIRSYNC;
3949 + inode->i_vflags &= ~(V_BARRIER | V_COW);
3951 + if (ip->flags & BTRFS_INODE_BARRIER)
3952 + inode->i_vflags |= V_BARRIER;
3953 + if (ip->flags & BTRFS_INODE_COW)
3954 + inode->i_vflags |= V_COW;
3958 + * Update btrfs internal flags from inode->i_(v)flags.
3960 +void btrfs_update_flags(struct inode *inode)
3962 + struct btrfs_inode *ip = BTRFS_I(inode);
3964 + unsigned int flags = inode->i_flags;
3965 + unsigned int vflags = inode->i_vflags;
3967 + ip->flags &= ~(BTRFS_INODE_SYNC | BTRFS_INODE_APPEND |
3968 + BTRFS_INODE_IMMUTABLE | BTRFS_INODE_IXUNLINK |
3969 + BTRFS_INODE_NOATIME | BTRFS_INODE_DIRSYNC |
3970 + BTRFS_INODE_BARRIER | BTRFS_INODE_COW);
3972 + if (flags & S_IMMUTABLE)
3973 + ip->flags |= BTRFS_INODE_IMMUTABLE;
3974 + if (flags & S_IXUNLINK)
3975 + ip->flags |= BTRFS_INODE_IXUNLINK;
3977 + if (flags & S_SYNC)
3978 + ip->flags |= BTRFS_INODE_SYNC;
3979 + if (flags & S_APPEND)
3980 + ip->flags |= BTRFS_INODE_APPEND;
3981 + if (flags & S_NOATIME)
3982 + ip->flags |= BTRFS_INODE_NOATIME;
3983 + if (flags & S_DIRSYNC)
3984 + ip->flags |= BTRFS_INODE_DIRSYNC;
3986 + if (vflags & V_BARRIER)
3987 + ip->flags |= BTRFS_INODE_BARRIER;
3988 + if (vflags & V_COW)
3989 + ip->flags |= BTRFS_INODE_COW;
3993 @@ -120,7 +173,7 @@ void btrfs_inherit_iflags(struct inode *
3994 flags = BTRFS_I(dir)->flags;
3996 if (S_ISREG(inode->i_mode))
3997 - flags &= ~BTRFS_INODE_DIRSYNC;
3998 + flags &= ~(BTRFS_INODE_DIRSYNC | BTRFS_INODE_BARRIER);
3999 else if (!S_ISDIR(inode->i_mode))
4000 flags &= (BTRFS_INODE_NODUMP | BTRFS_INODE_NOATIME);
4002 @@ -128,6 +181,30 @@ void btrfs_inherit_iflags(struct inode *
4003 btrfs_update_iflags(inode);
4006 +int btrfs_sync_flags(struct inode *inode, int flags, int vflags)
4008 + struct btrfs_inode *ip = BTRFS_I(inode);
4009 + struct btrfs_root *root = ip->root;
4010 + struct btrfs_trans_handle *trans;
4013 + trans = btrfs_join_transaction(root, 1);
4016 + inode->i_flags = flags;
4017 + inode->i_vflags = vflags;
4018 + btrfs_update_flags(inode);
4020 + ret = btrfs_update_inode(trans, root, inode);
4023 + btrfs_update_iflags(inode);
4024 + inode->i_ctime = CURRENT_TIME;
4025 + btrfs_end_transaction(trans, root);
4030 static int btrfs_ioctl_getflags(struct file *file, void __user *arg)
4032 struct btrfs_inode *ip = BTRFS_I(file->f_path.dentry->d_inode);
4033 @@ -150,6 +227,7 @@ static int btrfs_ioctl_setflags(struct f
4034 if (copy_from_user(&flags, arg, sizeof(flags)))
4037 + /* maybe add FS_IXUNLINK_FL ? */
4038 if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
4039 FS_NOATIME_FL | FS_NODUMP_FL | \
4040 FS_SYNC_FL | FS_DIRSYNC_FL))
4041 @@ -162,7 +240,8 @@ static int btrfs_ioctl_setflags(struct f
4043 flags = btrfs_mask_flags(inode->i_mode, flags);
4044 oldflags = btrfs_flags_to_ioctl(ip->flags);
4045 - if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) {
4046 + if ((flags ^ oldflags) & (FS_APPEND_FL |
4047 + FS_IMMUTABLE_FL | FS_IXUNLINK_FL)) {
4048 if (!capable(CAP_LINUX_IMMUTABLE)) {
4051 @@ -173,14 +252,19 @@ static int btrfs_ioctl_setflags(struct f
4055 - if (flags & FS_SYNC_FL)
4056 - ip->flags |= BTRFS_INODE_SYNC;
4058 - ip->flags &= ~BTRFS_INODE_SYNC;
4059 if (flags & FS_IMMUTABLE_FL)
4060 ip->flags |= BTRFS_INODE_IMMUTABLE;
4062 ip->flags &= ~BTRFS_INODE_IMMUTABLE;
4063 + if (flags & FS_IXUNLINK_FL)
4064 + ip->flags |= BTRFS_INODE_IXUNLINK;
4066 + ip->flags &= ~BTRFS_INODE_IXUNLINK;
4068 + if (flags & FS_SYNC_FL)
4069 + ip->flags |= BTRFS_INODE_SYNC;
4071 + ip->flags &= ~BTRFS_INODE_SYNC;
4072 if (flags & FS_APPEND_FL)
4073 ip->flags |= BTRFS_INODE_APPEND;
4075 diff -NurpP --minimal linux-2.6.34/fs/btrfs/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/super.c
4076 --- linux-2.6.34/fs/btrfs/super.c 2010-05-18 15:07:51.000000000 +0200
4077 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/btrfs/super.c 2010-05-18 18:11:22.000000000 +0200
4078 @@ -68,7 +68,7 @@ enum {
4079 Opt_nodatacow, Opt_max_inline, Opt_alloc_start, Opt_nobarrier, Opt_ssd,
4080 Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl, Opt_compress,
4081 Opt_compress_force, Opt_notreelog, Opt_ratio, Opt_flushoncommit,
4082 - Opt_discard, Opt_err,
4083 + Opt_tag, Opt_notag, Opt_tagid, Opt_discard, Opt_err,
4086 static match_table_t tokens = {
4087 @@ -92,6 +92,9 @@ static match_table_t tokens = {
4088 {Opt_flushoncommit, "flushoncommit"},
4089 {Opt_ratio, "metadata_ratio=%d"},
4090 {Opt_discard, "discard"},
4092 + {Opt_notag, "notag"},
4093 + {Opt_tagid, "tagid=%u"},
4097 @@ -235,6 +238,22 @@ int btrfs_parse_options(struct btrfs_roo
4099 btrfs_set_opt(info->mount_opt, DISCARD);
4101 +#ifndef CONFIG_TAGGING_NONE
4103 + printk(KERN_INFO "btrfs: use tagging\n");
4104 + btrfs_set_opt(info->mount_opt, TAGGED);
4107 + printk(KERN_INFO "btrfs: disabled tagging\n");
4108 + btrfs_clear_opt(info->mount_opt, TAGGED);
4111 +#ifdef CONFIG_PROPAGATE
4114 + btrfs_set_opt(info->mount_opt, TAGGED);
4118 printk(KERN_INFO "btrfs: unrecognized mount option "
4120 @@ -679,6 +698,12 @@ static int btrfs_remount(struct super_bl
4124 + if (btrfs_test_opt(root, TAGGED) && !(sb->s_flags & MS_TAGGED)) {
4125 + printk("btrfs: %s: tagging not permitted on remount.\n",
4130 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
4133 diff -NurpP --minimal linux-2.6.34/fs/char_dev.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/char_dev.c
4134 --- linux-2.6.34/fs/char_dev.c 2009-12-03 20:02:51.000000000 +0100
4135 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/char_dev.c 2010-05-18 18:11:22.000000000 +0200
4137 #include <linux/cdev.h>
4138 #include <linux/mutex.h>
4139 #include <linux/backing-dev.h>
4140 +#include <linux/vs_context.h>
4141 +#include <linux/vs_device.h>
4143 #include "internal.h"
4145 @@ -368,14 +370,21 @@ static int chrdev_open(struct inode *ino
4147 struct cdev *new = NULL;
4151 + if (!vs_map_chrdev(inode->i_rdev, &mdev, DATTR_OPEN))
4153 + inode->i_mdev = mdev;
4155 spin_lock(&cdev_lock);
4158 struct kobject *kobj;
4161 spin_unlock(&cdev_lock);
4162 - kobj = kobj_lookup(cdev_map, inode->i_rdev, &idx);
4164 + kobj = kobj_lookup(cdev_map, mdev, &idx);
4167 new = container_of(kobj, struct cdev, kobj);
4168 diff -NurpP --minimal linux-2.6.34/fs/dcache.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/dcache.c
4169 --- linux-2.6.34/fs/dcache.c 2010-05-18 15:07:51.000000000 +0200
4170 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/dcache.c 2010-05-18 18:11:22.000000000 +0200
4172 #include <linux/bootmem.h>
4173 #include <linux/fs_struct.h>
4174 #include <linux/hardirq.h>
4175 +#include <linux/vs_limit.h>
4176 #include "internal.h"
4178 int sysctl_vfs_cache_pressure __read_mostly = 100;
4179 @@ -230,6 +231,8 @@ repeat:
4183 + vx_dentry_dec(dentry);
4186 * AV: ->d_delete() is _NOT_ allowed to block now.
4188 @@ -323,6 +326,7 @@ static inline struct dentry * __dget_loc
4190 atomic_inc(&dentry->d_count);
4191 dentry_lru_del_init(dentry);
4192 + vx_dentry_inc(dentry);
4196 @@ -927,6 +931,9 @@ struct dentry *d_alloc(struct dentry * p
4197 struct dentry *dentry;
4200 + if (!vx_dentry_avail(1))
4203 dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
4206 @@ -972,6 +979,7 @@ struct dentry *d_alloc(struct dentry * p
4208 list_add(&dentry->d_u.d_child, &parent->d_subdirs);
4209 dentry_stat.nr_dentry++;
4210 + vx_dentry_inc(dentry);
4211 spin_unlock(&dcache_lock);
4214 @@ -1421,6 +1429,7 @@ struct dentry * __d_lookup(struct dentry
4217 atomic_inc(&dentry->d_count);
4218 + vx_dentry_inc(dentry);
4220 spin_unlock(&dentry->d_lock);
4222 diff -NurpP --minimal linux-2.6.34/fs/devpts/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/devpts/inode.c
4223 --- linux-2.6.34/fs/devpts/inode.c 2010-05-18 15:07:51.000000000 +0200
4224 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/devpts/inode.c 2010-05-18 18:11:22.000000000 +0200
4226 #include <linux/parser.h>
4227 #include <linux/fsnotify.h>
4228 #include <linux/seq_file.h>
4229 +#include <linux/vs_base.h>
4231 #define DEVPTS_DEFAULT_MODE 0600
4234 #define DEVPTS_DEFAULT_PTMX_MODE 0000
4235 #define PTMX_MINOR 2
4237 +static int devpts_permission(struct inode *inode, int mask)
4239 + int ret = -EACCES;
4241 + /* devpts is xid tagged */
4242 + if (vx_check((xid_t)inode->i_tag, VS_WATCH_P | VS_IDENT))
4243 + ret = generic_permission(inode, mask, NULL);
4247 +static struct inode_operations devpts_file_inode_operations = {
4248 + .permission = devpts_permission,
4251 extern int pty_limit; /* Config limit on Unix98 ptys */
4252 static DEFINE_MUTEX(allocated_ptys_lock);
4254 @@ -263,6 +278,25 @@ static int devpts_show_options(struct se
4258 +static int devpts_filter(struct dentry *de)
4260 + /* devpts is xid tagged */
4261 + return vx_check((xid_t)de->d_inode->i_tag, VS_WATCH_P | VS_IDENT);
4264 +static int devpts_readdir(struct file * filp, void * dirent, filldir_t filldir)
4266 + return dcache_readdir_filter(filp, dirent, filldir, devpts_filter);
4269 +static struct file_operations devpts_dir_operations = {
4270 + .open = dcache_dir_open,
4271 + .release = dcache_dir_close,
4272 + .llseek = dcache_dir_lseek,
4273 + .read = generic_read_dir,
4274 + .readdir = devpts_readdir,
4277 static const struct super_operations devpts_sops = {
4278 .statfs = simple_statfs,
4279 .remount_fs = devpts_remount,
4280 @@ -302,12 +336,15 @@ devpts_fill_super(struct super_block *s,
4281 inode = new_inode(s);
4286 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
4287 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
4288 inode->i_op = &simple_dir_inode_operations;
4289 - inode->i_fop = &simple_dir_operations;
4290 + inode->i_fop = &devpts_dir_operations;
4292 + /* devpts is xid tagged */
4293 + inode->i_tag = (tag_t)vx_current_xid();
4295 s->s_root = d_alloc_root(inode);
4297 @@ -498,6 +535,9 @@ int devpts_pty_new(struct inode *ptmx_in
4298 inode->i_gid = opts->setgid ? opts->gid : current_fsgid();
4299 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
4300 init_special_inode(inode, S_IFCHR|opts->mode, device);
4301 + /* devpts is xid tagged */
4302 + inode->i_tag = (tag_t)vx_current_xid();
4303 + inode->i_op = &devpts_file_inode_operations;
4304 inode->i_private = tty;
4305 tty->driver_data = inode;
4307 diff -NurpP --minimal linux-2.6.34/fs/exec.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/exec.c
4308 --- linux-2.6.34/fs/exec.c 2010-05-18 15:07:51.000000000 +0200
4309 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/exec.c 2010-05-19 03:10:18.000000000 +0200
4310 @@ -1502,7 +1502,7 @@ static int format_corename(char *corenam
4311 /* UNIX time of coredump */
4314 - do_gettimeofday(&tv);
4315 + vx_gettimeofday(&tv);
4316 rc = snprintf(out_ptr, out_end - out_ptr,
4318 if (rc > out_end - out_ptr)
4319 diff -NurpP --minimal linux-2.6.34/fs/ext2/balloc.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/balloc.c
4320 --- linux-2.6.34/fs/ext2/balloc.c 2010-05-18 15:07:51.000000000 +0200
4321 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/balloc.c 2010-05-18 18:11:22.000000000 +0200
4322 @@ -702,7 +702,6 @@ ext2_try_to_allocate(struct super_block
4324 end = EXT2_BLOCKS_PER_GROUP(sb);
4327 BUG_ON(start > EXT2_BLOCKS_PER_GROUP(sb));
4330 diff -NurpP --minimal linux-2.6.34/fs/ext2/ext2.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/ext2.h
4331 --- linux-2.6.34/fs/ext2/ext2.h 2010-05-18 15:07:51.000000000 +0200
4332 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/ext2.h 2010-05-18 18:11:22.000000000 +0200
4333 @@ -131,6 +131,7 @@ extern int ext2_fiemap(struct inode *ino
4334 int __ext2_write_begin(struct file *file, struct address_space *mapping,
4335 loff_t pos, unsigned len, unsigned flags,
4336 struct page **pagep, void **fsdata);
4337 +extern int ext2_sync_flags(struct inode *, int, int);
4340 extern long ext2_ioctl(struct file *, unsigned int, unsigned long);
4341 diff -NurpP --minimal linux-2.6.34/fs/ext2/file.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/file.c
4342 --- linux-2.6.34/fs/ext2/file.c 2010-05-18 15:07:51.000000000 +0200
4343 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/file.c 2010-05-18 18:11:22.000000000 +0200
4344 @@ -105,4 +105,5 @@ const struct inode_operations ext2_file_
4345 .setattr = ext2_setattr,
4346 .check_acl = ext2_check_acl,
4347 .fiemap = ext2_fiemap,
4348 + .sync_flags = ext2_sync_flags,
4350 diff -NurpP --minimal linux-2.6.34/fs/ext2/ialloc.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/ialloc.c
4351 --- linux-2.6.34/fs/ext2/ialloc.c 2010-05-18 15:07:51.000000000 +0200
4352 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/ialloc.c 2010-05-18 18:11:22.000000000 +0200
4354 #include <linux/backing-dev.h>
4355 #include <linux/buffer_head.h>
4356 #include <linux/random.h>
4357 +#include <linux/vs_tag.h>
4361 @@ -560,6 +561,7 @@ got:
4363 inode->i_gid = current_fsgid();
4364 inode->i_mode = mode;
4365 + inode->i_tag = dx_current_fstag(sb);
4368 inode->i_blocks = 0;
4369 diff -NurpP --minimal linux-2.6.34/fs/ext2/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/inode.c
4370 --- linux-2.6.34/fs/ext2/inode.c 2010-05-18 15:07:51.000000000 +0200
4371 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/inode.c 2010-05-18 18:11:22.000000000 +0200
4373 #include <linux/mpage.h>
4374 #include <linux/fiemap.h>
4375 #include <linux/namei.h>
4376 +#include <linux/vs_tag.h>
4380 @@ -1046,7 +1047,7 @@ void ext2_truncate(struct inode *inode)
4382 if (ext2_inode_is_fast_symlink(inode))
4384 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
4385 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
4388 blocksize = inode->i_sb->s_blocksize;
4389 @@ -1184,36 +1185,61 @@ void ext2_set_inode_flags(struct inode *
4391 unsigned int flags = EXT2_I(inode)->i_flags;
4393 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4394 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
4395 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
4398 + if (flags & EXT2_IMMUTABLE_FL)
4399 + inode->i_flags |= S_IMMUTABLE;
4400 + if (flags & EXT2_IXUNLINK_FL)
4401 + inode->i_flags |= S_IXUNLINK;
4403 if (flags & EXT2_SYNC_FL)
4404 inode->i_flags |= S_SYNC;
4405 if (flags & EXT2_APPEND_FL)
4406 inode->i_flags |= S_APPEND;
4407 - if (flags & EXT2_IMMUTABLE_FL)
4408 - inode->i_flags |= S_IMMUTABLE;
4409 if (flags & EXT2_NOATIME_FL)
4410 inode->i_flags |= S_NOATIME;
4411 if (flags & EXT2_DIRSYNC_FL)
4412 inode->i_flags |= S_DIRSYNC;
4414 + inode->i_vflags &= ~(V_BARRIER | V_COW);
4416 + if (flags & EXT2_BARRIER_FL)
4417 + inode->i_vflags |= V_BARRIER;
4418 + if (flags & EXT2_COW_FL)
4419 + inode->i_vflags |= V_COW;
4422 /* Propagate flags from i_flags to EXT2_I(inode)->i_flags */
4423 void ext2_get_inode_flags(struct ext2_inode_info *ei)
4425 unsigned int flags = ei->vfs_inode.i_flags;
4426 + unsigned int vflags = ei->vfs_inode.i_vflags;
4428 + ei->i_flags &= ~(EXT2_SYNC_FL | EXT2_APPEND_FL |
4429 + EXT2_IMMUTABLE_FL | EXT2_IXUNLINK_FL |
4430 + EXT2_NOATIME_FL | EXT2_DIRSYNC_FL |
4431 + EXT2_BARRIER_FL | EXT2_COW_FL);
4433 + if (flags & S_IMMUTABLE)
4434 + ei->i_flags |= EXT2_IMMUTABLE_FL;
4435 + if (flags & S_IXUNLINK)
4436 + ei->i_flags |= EXT2_IXUNLINK_FL;
4438 - ei->i_flags &= ~(EXT2_SYNC_FL|EXT2_APPEND_FL|
4439 - EXT2_IMMUTABLE_FL|EXT2_NOATIME_FL|EXT2_DIRSYNC_FL);
4441 ei->i_flags |= EXT2_SYNC_FL;
4442 if (flags & S_APPEND)
4443 ei->i_flags |= EXT2_APPEND_FL;
4444 - if (flags & S_IMMUTABLE)
4445 - ei->i_flags |= EXT2_IMMUTABLE_FL;
4446 if (flags & S_NOATIME)
4447 ei->i_flags |= EXT2_NOATIME_FL;
4448 if (flags & S_DIRSYNC)
4449 ei->i_flags |= EXT2_DIRSYNC_FL;
4451 + if (vflags & V_BARRIER)
4452 + ei->i_flags |= EXT2_BARRIER_FL;
4453 + if (vflags & V_COW)
4454 + ei->i_flags |= EXT2_COW_FL;
4457 struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
4458 @@ -1223,6 +1249,8 @@ struct inode *ext2_iget (struct super_bl
4459 struct ext2_inode *raw_inode;
4460 struct inode *inode;
4466 inode = iget_locked(sb, ino);
4467 @@ -1241,12 +1269,17 @@ struct inode *ext2_iget (struct super_bl
4470 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
4471 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4472 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4473 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4474 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4475 if (!(test_opt (inode->i_sb, NO_UID32))) {
4476 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4477 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4478 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4479 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4481 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
4482 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
4483 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
4484 + le16_to_cpu(raw_inode->i_raw_tag));
4486 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
4487 inode->i_size = le32_to_cpu(raw_inode->i_size);
4488 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
4489 @@ -1344,8 +1377,8 @@ static int __ext2_write_inode(struct ino
4490 struct ext2_inode_info *ei = EXT2_I(inode);
4491 struct super_block *sb = inode->i_sb;
4492 ino_t ino = inode->i_ino;
4493 - uid_t uid = inode->i_uid;
4494 - gid_t gid = inode->i_gid;
4495 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
4496 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
4497 struct buffer_head * bh;
4498 struct ext2_inode * raw_inode = ext2_get_inode(sb, ino, &bh);
4500 @@ -1381,6 +1414,9 @@ static int __ext2_write_inode(struct ino
4501 raw_inode->i_uid_high = 0;
4502 raw_inode->i_gid_high = 0;
4504 +#ifdef CONFIG_TAGGING_INTERN
4505 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
4507 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
4508 raw_inode->i_size = cpu_to_le32(inode->i_size);
4509 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
4510 @@ -1470,7 +1506,8 @@ int ext2_setattr(struct dentry *dentry,
4511 if (iattr->ia_valid & ATTR_SIZE)
4512 dquot_initialize(inode);
4513 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
4514 - (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
4515 + (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
4516 + (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
4517 error = dquot_transfer(inode, iattr);
4520 diff -NurpP --minimal linux-2.6.34/fs/ext2/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/ioctl.c
4521 --- linux-2.6.34/fs/ext2/ioctl.c 2009-09-10 15:26:21.000000000 +0200
4522 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/ioctl.c 2010-05-18 18:11:22.000000000 +0200
4524 #include <asm/uaccess.h>
4527 +int ext2_sync_flags(struct inode *inode, int flags, int vflags)
4529 + inode->i_flags = flags;
4530 + inode->i_vflags = vflags;
4531 + ext2_get_inode_flags(EXT2_I(inode));
4532 + inode->i_ctime = CURRENT_TIME_SEC;
4533 + mark_inode_dirty(inode);
4537 long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
4539 struct inode *inode = filp->f_dentry->d_inode;
4540 @@ -51,6 +61,11 @@ long ext2_ioctl(struct file *filp, unsig
4542 flags = ext2_mask_flags(inode->i_mode, flags);
4544 + if (IS_BARRIER(inode)) {
4545 + vxwprintk_task(1, "messing with the barrier.");
4549 mutex_lock(&inode->i_mutex);
4550 /* Is it quota file? Do not allow user to mess with it */
4551 if (IS_NOQUOTA(inode)) {
4552 @@ -66,7 +81,9 @@ long ext2_ioctl(struct file *filp, unsig
4554 * This test looks nicer. Thanks to Pauline Middelink
4556 - if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) {
4557 + if ((oldflags & EXT2_IMMUTABLE_FL) ||
4558 + ((flags ^ oldflags) & (EXT2_APPEND_FL |
4559 + EXT2_IMMUTABLE_FL | EXT2_IXUNLINK_FL))) {
4560 if (!capable(CAP_LINUX_IMMUTABLE)) {
4561 mutex_unlock(&inode->i_mutex);
4563 @@ -74,7 +91,7 @@ long ext2_ioctl(struct file *filp, unsig
4567 - flags = flags & EXT2_FL_USER_MODIFIABLE;
4568 + flags &= EXT2_FL_USER_MODIFIABLE;
4569 flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE;
4570 ei->i_flags = flags;
4571 mutex_unlock(&inode->i_mutex);
4572 diff -NurpP --minimal linux-2.6.34/fs/ext2/namei.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/namei.c
4573 --- linux-2.6.34/fs/ext2/namei.c 2010-05-18 15:07:51.000000000 +0200
4574 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/namei.c 2010-05-18 18:11:22.000000000 +0200
4577 #include <linux/pagemap.h>
4578 #include <linux/quotaops.h>
4579 +#include <linux/vs_tag.h>
4583 @@ -75,6 +76,7 @@ static struct dentry *ext2_lookup(struct
4584 return ERR_PTR(-EIO);
4586 return ERR_CAST(inode);
4587 + dx_propagate_tag(nd, inode);
4591 @@ -418,6 +420,7 @@ const struct inode_operations ext2_dir_i
4593 .setattr = ext2_setattr,
4594 .check_acl = ext2_check_acl,
4595 + .sync_flags = ext2_sync_flags,
4598 const struct inode_operations ext2_special_inode_operations = {
4599 diff -NurpP --minimal linux-2.6.34/fs/ext2/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/super.c
4600 --- linux-2.6.34/fs/ext2/super.c 2010-05-18 15:07:51.000000000 +0200
4601 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext2/super.c 2010-05-18 18:11:22.000000000 +0200
4602 @@ -384,7 +384,8 @@ enum {
4603 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
4604 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
4605 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
4606 - Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
4607 + Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation,
4608 + Opt_tag, Opt_notag, Opt_tagid
4611 static const match_table_t tokens = {
4612 @@ -412,6 +413,9 @@ static const match_table_t tokens = {
4614 {Opt_noacl, "noacl"},
4617 + {Opt_notag, "notag"},
4618 + {Opt_tagid, "tagid=%u"},
4619 {Opt_grpquota, "grpquota"},
4620 {Opt_ignore, "noquota"},
4621 {Opt_quota, "quota"},
4622 @@ -482,6 +486,20 @@ static int parse_options(char *options,
4624 set_opt (sbi->s_mount_opt, NO_UID32);
4626 +#ifndef CONFIG_TAGGING_NONE
4628 + set_opt (sbi->s_mount_opt, TAGGED);
4631 + clear_opt (sbi->s_mount_opt, TAGGED);
4634 +#ifdef CONFIG_PROPAGATE
4637 + set_opt (sbi->s_mount_opt, TAGGED);
4641 clear_opt (sbi->s_mount_opt, CHECK);
4643 @@ -838,6 +856,8 @@ static int ext2_fill_super(struct super_
4644 if (!parse_options((char *) data, sb))
4647 + if (EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_TAGGED)
4648 + sb->s_flags |= MS_TAGGED;
4649 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4650 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ?
4652 @@ -1231,6 +1251,14 @@ static int ext2_remount (struct super_bl
4656 + if ((sbi->s_mount_opt & EXT2_MOUNT_TAGGED) &&
4657 + !(sb->s_flags & MS_TAGGED)) {
4658 + printk("EXT2-fs: %s: tagging not permitted on remount.\n",
4661 + goto restore_opts;
4664 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4665 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
4667 diff -NurpP --minimal linux-2.6.34/fs/ext3/file.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/file.c
4668 --- linux-2.6.34/fs/ext3/file.c 2010-05-18 15:07:51.000000000 +0200
4669 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/file.c 2010-05-18 18:11:22.000000000 +0200
4670 @@ -81,5 +81,6 @@ const struct inode_operations ext3_file_
4672 .check_acl = ext3_check_acl,
4673 .fiemap = ext3_fiemap,
4674 + .sync_flags = ext3_sync_flags,
4677 diff -NurpP --minimal linux-2.6.34/fs/ext3/ialloc.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/ialloc.c
4678 --- linux-2.6.34/fs/ext3/ialloc.c 2010-05-18 15:07:51.000000000 +0200
4679 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/ialloc.c 2010-05-18 18:11:22.000000000 +0200
4681 #include <linux/buffer_head.h>
4682 #include <linux/random.h>
4683 #include <linux/bitops.h>
4684 +#include <linux/vs_tag.h>
4686 #include <asm/byteorder.h>
4688 @@ -548,6 +549,7 @@ got:
4690 inode->i_gid = current_fsgid();
4691 inode->i_mode = mode;
4692 + inode->i_tag = dx_current_fstag(sb);
4695 /* This is the optimal IO size (for stat), not the fs block size */
4696 diff -NurpP --minimal linux-2.6.34/fs/ext3/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/inode.c
4697 --- linux-2.6.34/fs/ext3/inode.c 2010-05-18 15:07:51.000000000 +0200
4698 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/inode.c 2010-05-18 18:11:22.000000000 +0200
4700 #include <linux/bio.h>
4701 #include <linux/fiemap.h>
4702 #include <linux/namei.h>
4703 +#include <linux/vs_tag.h>
4707 @@ -2354,7 +2355,7 @@ static void ext3_free_branches(handle_t
4709 int ext3_can_truncate(struct inode *inode)
4711 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
4712 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
4714 if (S_ISREG(inode->i_mode))
4716 @@ -2739,36 +2740,60 @@ void ext3_set_inode_flags(struct inode *
4718 unsigned int flags = EXT3_I(inode)->i_flags;
4720 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4721 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
4722 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
4724 + if (flags & EXT3_IMMUTABLE_FL)
4725 + inode->i_flags |= S_IMMUTABLE;
4726 + if (flags & EXT3_IXUNLINK_FL)
4727 + inode->i_flags |= S_IXUNLINK;
4729 if (flags & EXT3_SYNC_FL)
4730 inode->i_flags |= S_SYNC;
4731 if (flags & EXT3_APPEND_FL)
4732 inode->i_flags |= S_APPEND;
4733 - if (flags & EXT3_IMMUTABLE_FL)
4734 - inode->i_flags |= S_IMMUTABLE;
4735 if (flags & EXT3_NOATIME_FL)
4736 inode->i_flags |= S_NOATIME;
4737 if (flags & EXT3_DIRSYNC_FL)
4738 inode->i_flags |= S_DIRSYNC;
4740 + inode->i_vflags &= ~(V_BARRIER | V_COW);
4742 + if (flags & EXT3_BARRIER_FL)
4743 + inode->i_vflags |= V_BARRIER;
4744 + if (flags & EXT3_COW_FL)
4745 + inode->i_vflags |= V_COW;
4748 /* Propagate flags from i_flags to EXT3_I(inode)->i_flags */
4749 void ext3_get_inode_flags(struct ext3_inode_info *ei)
4751 unsigned int flags = ei->vfs_inode.i_flags;
4752 + unsigned int vflags = ei->vfs_inode.i_vflags;
4754 + ei->i_flags &= ~(EXT3_SYNC_FL | EXT3_APPEND_FL |
4755 + EXT3_IMMUTABLE_FL | EXT3_IXUNLINK_FL |
4756 + EXT3_NOATIME_FL | EXT3_DIRSYNC_FL |
4757 + EXT3_BARRIER_FL | EXT3_COW_FL);
4759 + if (flags & S_IMMUTABLE)
4760 + ei->i_flags |= EXT3_IMMUTABLE_FL;
4761 + if (flags & S_IXUNLINK)
4762 + ei->i_flags |= EXT3_IXUNLINK_FL;
4764 - ei->i_flags &= ~(EXT3_SYNC_FL|EXT3_APPEND_FL|
4765 - EXT3_IMMUTABLE_FL|EXT3_NOATIME_FL|EXT3_DIRSYNC_FL);
4767 ei->i_flags |= EXT3_SYNC_FL;
4768 if (flags & S_APPEND)
4769 ei->i_flags |= EXT3_APPEND_FL;
4770 - if (flags & S_IMMUTABLE)
4771 - ei->i_flags |= EXT3_IMMUTABLE_FL;
4772 if (flags & S_NOATIME)
4773 ei->i_flags |= EXT3_NOATIME_FL;
4774 if (flags & S_DIRSYNC)
4775 ei->i_flags |= EXT3_DIRSYNC_FL;
4777 + if (vflags & V_BARRIER)
4778 + ei->i_flags |= EXT3_BARRIER_FL;
4779 + if (vflags & V_COW)
4780 + ei->i_flags |= EXT3_COW_FL;
4783 struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
4784 @@ -2782,6 +2807,8 @@ struct inode *ext3_iget(struct super_blo
4785 transaction_t *transaction;
4791 inode = iget_locked(sb, ino);
4793 @@ -2798,12 +2825,17 @@ struct inode *ext3_iget(struct super_blo
4795 raw_inode = ext3_raw_inode(&iloc);
4796 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
4797 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4798 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4799 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4800 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4801 if(!(test_opt (inode->i_sb, NO_UID32))) {
4802 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4803 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4804 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4805 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4807 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
4808 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
4809 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
4810 + le16_to_cpu(raw_inode->i_raw_tag));
4812 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
4813 inode->i_size = le32_to_cpu(raw_inode->i_size);
4814 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
4815 @@ -2958,6 +2990,8 @@ static int ext3_do_update_inode(handle_t
4816 struct ext3_inode *raw_inode = ext3_raw_inode(iloc);
4817 struct ext3_inode_info *ei = EXT3_I(inode);
4818 struct buffer_head *bh = iloc->bh;
4819 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
4820 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
4821 int err = 0, rc, block;
4824 @@ -2972,29 +3006,32 @@ again:
4825 ext3_get_inode_flags(ei);
4826 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
4827 if(!(test_opt(inode->i_sb, NO_UID32))) {
4828 - raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
4829 - raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
4830 + raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
4831 + raw_inode->i_gid_low = cpu_to_le16(low_16_bits(gid));
4833 * Fix up interoperability with old kernels. Otherwise, old inodes get
4834 * re-used with the upper 16 bits of the uid/gid intact
4837 raw_inode->i_uid_high =
4838 - cpu_to_le16(high_16_bits(inode->i_uid));
4839 + cpu_to_le16(high_16_bits(uid));
4840 raw_inode->i_gid_high =
4841 - cpu_to_le16(high_16_bits(inode->i_gid));
4842 + cpu_to_le16(high_16_bits(gid));
4844 raw_inode->i_uid_high = 0;
4845 raw_inode->i_gid_high = 0;
4848 raw_inode->i_uid_low =
4849 - cpu_to_le16(fs_high2lowuid(inode->i_uid));
4850 + cpu_to_le16(fs_high2lowuid(uid));
4851 raw_inode->i_gid_low =
4852 - cpu_to_le16(fs_high2lowgid(inode->i_gid));
4853 + cpu_to_le16(fs_high2lowgid(gid));
4854 raw_inode->i_uid_high = 0;
4855 raw_inode->i_gid_high = 0;
4857 +#ifdef CONFIG_TAGGING_INTERN
4858 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
4860 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
4861 raw_inode->i_size = cpu_to_le32(ei->i_disksize);
4862 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
4863 @@ -3154,7 +3191,8 @@ int ext3_setattr(struct dentry *dentry,
4864 if (ia_valid & ATTR_SIZE)
4865 dquot_initialize(inode);
4866 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
4867 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
4868 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
4869 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
4872 /* (user+group)*(old+new) structure, inode write (sb,
4873 @@ -3176,6 +3214,8 @@ int ext3_setattr(struct dentry *dentry,
4874 inode->i_uid = attr->ia_uid;
4875 if (attr->ia_valid & ATTR_GID)
4876 inode->i_gid = attr->ia_gid;
4877 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
4878 + inode->i_tag = attr->ia_tag;
4879 error = ext3_mark_inode_dirty(handle, inode);
4880 ext3_journal_stop(handle);
4882 diff -NurpP --minimal linux-2.6.34/fs/ext3/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/ioctl.c
4883 --- linux-2.6.34/fs/ext3/ioctl.c 2009-06-11 17:13:03.000000000 +0200
4884 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/ioctl.c 2010-05-18 18:11:22.000000000 +0200
4888 #include <linux/fs.h>
4889 +#include <linux/mount.h>
4890 #include <linux/jbd.h>
4891 #include <linux/capability.h>
4892 #include <linux/ext3_fs.h>
4894 #include <linux/compat.h>
4895 #include <asm/uaccess.h>
4898 +int ext3_sync_flags(struct inode *inode, int flags, int vflags)
4900 + handle_t *handle = NULL;
4901 + struct ext3_iloc iloc;
4904 + handle = ext3_journal_start(inode, 1);
4905 + if (IS_ERR(handle))
4906 + return PTR_ERR(handle);
4908 + if (IS_SYNC(inode))
4909 + handle->h_sync = 1;
4910 + err = ext3_reserve_inode_write(handle, inode, &iloc);
4914 + inode->i_flags = flags;
4915 + inode->i_vflags = vflags;
4916 + ext3_get_inode_flags(EXT3_I(inode));
4917 + inode->i_ctime = CURRENT_TIME_SEC;
4919 + err = ext3_mark_iloc_dirty(handle, inode, &iloc);
4921 + ext3_journal_stop(handle);
4925 long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
4927 struct inode *inode = filp->f_dentry->d_inode;
4928 @@ -50,6 +79,11 @@ long ext3_ioctl(struct file *filp, unsig
4930 flags = ext3_mask_flags(inode->i_mode, flags);
4932 + if (IS_BARRIER(inode)) {
4933 + vxwprintk_task(1, "messing with the barrier.");
4937 mutex_lock(&inode->i_mutex);
4939 /* Is it quota file? Do not allow user to mess with it */
4940 @@ -68,7 +102,9 @@ long ext3_ioctl(struct file *filp, unsig
4942 * This test looks nicer. Thanks to Pauline Middelink
4944 - if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) {
4945 + if ((oldflags & EXT3_IMMUTABLE_FL) ||
4946 + ((flags ^ oldflags) & (EXT3_APPEND_FL |
4947 + EXT3_IMMUTABLE_FL | EXT3_IXUNLINK_FL))) {
4948 if (!capable(CAP_LINUX_IMMUTABLE))
4951 @@ -93,7 +129,7 @@ long ext3_ioctl(struct file *filp, unsig
4955 - flags = flags & EXT3_FL_USER_MODIFIABLE;
4956 + flags &= EXT3_FL_USER_MODIFIABLE;
4957 flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
4958 ei->i_flags = flags;
4960 diff -NurpP --minimal linux-2.6.34/fs/ext3/namei.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/namei.c
4961 --- linux-2.6.34/fs/ext3/namei.c 2010-05-18 15:07:51.000000000 +0200
4962 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/namei.c 2010-05-18 18:11:22.000000000 +0200
4964 #include <linux/quotaops.h>
4965 #include <linux/buffer_head.h>
4966 #include <linux/bio.h>
4967 +#include <linux/vs_tag.h>
4971 @@ -912,6 +913,7 @@ restart:
4973 ll_rw_block(READ_META, 1, &bh);
4975 + dx_propagate_tag(nd, inode);
4977 if ((bh = bh_use[ra_ptr++]) == NULL)
4979 @@ -2466,6 +2468,7 @@ const struct inode_operations ext3_dir_i
4980 .removexattr = generic_removexattr,
4982 .check_acl = ext3_check_acl,
4983 + .sync_flags = ext3_sync_flags,
4986 const struct inode_operations ext3_special_inode_operations = {
4987 diff -NurpP --minimal linux-2.6.34/fs/ext3/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/super.c
4988 --- linux-2.6.34/fs/ext3/super.c 2010-05-18 15:07:51.000000000 +0200
4989 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext3/super.c 2010-05-18 18:11:22.000000000 +0200
4990 @@ -811,7 +811,7 @@ enum {
4991 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
4992 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
4993 Opt_noquota, Opt_ignore, Opt_barrier, Opt_err, Opt_resize,
4994 - Opt_usrquota, Opt_grpquota
4995 + Opt_usrquota, Opt_grpquota, Opt_tag, Opt_notag, Opt_tagid
4998 static const match_table_t tokens = {
4999 @@ -866,6 +866,9 @@ static const match_table_t tokens = {
5000 {Opt_usrquota, "usrquota"},
5001 {Opt_barrier, "barrier=%u"},
5002 {Opt_resize, "resize"},
5004 + {Opt_notag, "notag"},
5005 + {Opt_tagid, "tagid=%u"},
5009 @@ -1014,6 +1017,20 @@ static int parse_options (char *options,
5011 set_opt (sbi->s_mount_opt, NO_UID32);
5013 +#ifndef CONFIG_TAGGING_NONE
5015 + set_opt (sbi->s_mount_opt, TAGGED);
5018 + clear_opt (sbi->s_mount_opt, TAGGED);
5021 +#ifdef CONFIG_PROPAGATE
5024 + set_opt (sbi->s_mount_opt, TAGGED);
5028 clear_opt (sbi->s_mount_opt, CHECK);
5030 @@ -1694,6 +1711,9 @@ static int ext3_fill_super (struct super
5034 + if (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_TAGGED)
5035 + sb->s_flags |= MS_TAGGED;
5037 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5038 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
5040 @@ -2565,6 +2585,14 @@ static int ext3_remount (struct super_bl
5041 if (test_opt(sb, ABORT))
5042 ext3_abort(sb, __func__, "Abort forced by user");
5044 + if ((sbi->s_mount_opt & EXT3_MOUNT_TAGGED) &&
5045 + !(sb->s_flags & MS_TAGGED)) {
5046 + printk("EXT3-fs: %s: tagging not permitted on remount.\n",
5049 + goto restore_opts;
5052 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5053 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
5055 diff -NurpP --minimal linux-2.6.34/fs/ext4/ext4.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/ext4.h
5056 --- linux-2.6.34/fs/ext4/ext4.h 2010-05-18 15:07:51.000000000 +0200
5057 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/ext4.h 2010-05-18 18:11:22.000000000 +0200
5058 @@ -292,8 +292,12 @@ struct flex_groups {
5059 #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
5060 #define EXT4_EA_INODE_FL 0x00200000 /* Inode used for large EA */
5061 #define EXT4_EOFBLOCKS_FL 0x00400000 /* Blocks allocated beyond EOF */
5062 +#define EXT4_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
5063 #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
5065 +#define EXT4_BARRIER_FL 0x04000000 /* Barrier for chroot() */
5066 +#define EXT4_COW_FL 0x20000000 /* Copy on Write marker */
5068 #define EXT4_FL_USER_VISIBLE 0x004BDFFF /* User visible flags */
5069 #define EXT4_FL_USER_MODIFIABLE 0x004B80FF /* User modifiable flags */
5071 @@ -470,7 +474,8 @@ struct ext4_inode {
5072 __le16 l_i_file_acl_high;
5073 __le16 l_i_uid_high; /* these 2 fields */
5074 __le16 l_i_gid_high; /* were reserved2[0] */
5075 - __u32 l_i_reserved2;
5076 + __le16 l_i_tag; /* Context Tag */
5077 + __u16 l_i_reserved2;
5080 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
5081 @@ -584,6 +589,7 @@ do { \
5082 #define i_gid_low i_gid
5083 #define i_uid_high osd2.linux2.l_i_uid_high
5084 #define i_gid_high osd2.linux2.l_i_gid_high
5085 +#define i_raw_tag osd2.linux2.l_i_tag
5086 #define i_reserved2 osd2.linux2.l_i_reserved2
5088 #elif defined(__GNU__)
5089 @@ -763,6 +769,7 @@ struct ext4_inode_info {
5090 #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
5091 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
5092 #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
5093 +#define EXT4_MOUNT_TAGGED 0x4000000 /* Enable Context Tags */
5094 #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */
5095 #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */
5096 #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */
5097 @@ -1787,6 +1794,7 @@ extern int ext4_get_blocks(handle_t *han
5098 struct buffer_head *bh, int flags);
5099 extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
5100 __u64 start, __u64 len);
5101 +extern int ext4_sync_flags(struct inode *, int, int);
5103 extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
5104 __u64 start_orig, __u64 start_donor,
5105 diff -NurpP --minimal linux-2.6.34/fs/ext4/file.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/file.c
5106 --- linux-2.6.34/fs/ext4/file.c 2010-05-18 15:07:51.000000000 +0200
5107 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/file.c 2010-05-18 18:11:22.000000000 +0200
5108 @@ -160,5 +160,6 @@ const struct inode_operations ext4_file_
5109 .check_acl = ext4_check_acl,
5110 .fallocate = ext4_fallocate,
5111 .fiemap = ext4_fiemap,
5112 + .sync_flags = ext4_sync_flags,
5115 diff -NurpP --minimal linux-2.6.34/fs/ext4/ialloc.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/ialloc.c
5116 --- linux-2.6.34/fs/ext4/ialloc.c 2010-05-18 15:07:51.000000000 +0200
5117 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/ialloc.c 2010-05-18 18:11:22.000000000 +0200
5119 #include <linux/random.h>
5120 #include <linux/bitops.h>
5121 #include <linux/blkdev.h>
5122 +#include <linux/vs_tag.h>
5123 #include <asm/byteorder.h>
5126 @@ -989,6 +990,7 @@ got:
5128 inode->i_gid = current_fsgid();
5129 inode->i_mode = mode;
5130 + inode->i_tag = dx_current_fstag(sb);
5132 inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb);
5133 /* This is the optimal IO size (for stat), not the fs block size */
5134 diff -NurpP --minimal linux-2.6.34/fs/ext4/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/inode.c
5135 --- linux-2.6.34/fs/ext4/inode.c 2010-05-18 15:07:51.000000000 +0200
5136 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/inode.c 2010-05-18 18:11:22.000000000 +0200
5138 #include <linux/workqueue.h>
5139 #include <linux/kernel.h>
5140 #include <linux/slab.h>
5141 +#include <linux/vs_tag.h>
5143 #include "ext4_jbd2.h"
5145 @@ -4555,7 +4556,7 @@ static void ext4_free_branches(handle_t
5147 int ext4_can_truncate(struct inode *inode)
5149 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
5150 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
5152 if (S_ISREG(inode->i_mode))
5154 @@ -4906,36 +4907,60 @@ void ext4_set_inode_flags(struct inode *
5156 unsigned int flags = EXT4_I(inode)->i_flags;
5158 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
5159 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
5160 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
5162 + if (flags & EXT4_IMMUTABLE_FL)
5163 + inode->i_flags |= S_IMMUTABLE;
5164 + if (flags & EXT4_IXUNLINK_FL)
5165 + inode->i_flags |= S_IXUNLINK;
5167 if (flags & EXT4_SYNC_FL)
5168 inode->i_flags |= S_SYNC;
5169 if (flags & EXT4_APPEND_FL)
5170 inode->i_flags |= S_APPEND;
5171 - if (flags & EXT4_IMMUTABLE_FL)
5172 - inode->i_flags |= S_IMMUTABLE;
5173 if (flags & EXT4_NOATIME_FL)
5174 inode->i_flags |= S_NOATIME;
5175 if (flags & EXT4_DIRSYNC_FL)
5176 inode->i_flags |= S_DIRSYNC;
5178 + inode->i_vflags &= ~(V_BARRIER | V_COW);
5180 + if (flags & EXT4_BARRIER_FL)
5181 + inode->i_vflags |= V_BARRIER;
5182 + if (flags & EXT4_COW_FL)
5183 + inode->i_vflags |= V_COW;
5186 /* Propagate flags from i_flags to EXT4_I(inode)->i_flags */
5187 void ext4_get_inode_flags(struct ext4_inode_info *ei)
5189 unsigned int flags = ei->vfs_inode.i_flags;
5190 + unsigned int vflags = ei->vfs_inode.i_vflags;
5192 + ei->i_flags &= ~(EXT4_SYNC_FL | EXT4_APPEND_FL |
5193 + EXT4_IMMUTABLE_FL | EXT4_IXUNLINK_FL |
5194 + EXT4_NOATIME_FL | EXT4_DIRSYNC_FL |
5195 + EXT4_BARRIER_FL | EXT4_COW_FL);
5197 + if (flags & S_IMMUTABLE)
5198 + ei->i_flags |= EXT4_IMMUTABLE_FL;
5199 + if (flags & S_IXUNLINK)
5200 + ei->i_flags |= EXT4_IXUNLINK_FL;
5202 - ei->i_flags &= ~(EXT4_SYNC_FL|EXT4_APPEND_FL|
5203 - EXT4_IMMUTABLE_FL|EXT4_NOATIME_FL|EXT4_DIRSYNC_FL);
5205 ei->i_flags |= EXT4_SYNC_FL;
5206 if (flags & S_APPEND)
5207 ei->i_flags |= EXT4_APPEND_FL;
5208 - if (flags & S_IMMUTABLE)
5209 - ei->i_flags |= EXT4_IMMUTABLE_FL;
5210 if (flags & S_NOATIME)
5211 ei->i_flags |= EXT4_NOATIME_FL;
5212 if (flags & S_DIRSYNC)
5213 ei->i_flags |= EXT4_DIRSYNC_FL;
5215 + if (vflags & V_BARRIER)
5216 + ei->i_flags |= EXT4_BARRIER_FL;
5217 + if (vflags & V_COW)
5218 + ei->i_flags |= EXT4_COW_FL;
5221 static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
5222 @@ -4970,6 +4995,8 @@ struct inode *ext4_iget(struct super_blo
5223 journal_t *journal = EXT4_SB(sb)->s_journal;
5229 inode = iget_locked(sb, ino);
5231 @@ -4985,12 +5012,16 @@ struct inode *ext4_iget(struct super_blo
5233 raw_inode = ext4_raw_inode(&iloc);
5234 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
5235 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
5236 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
5237 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
5238 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
5239 if (!(test_opt(inode->i_sb, NO_UID32))) {
5240 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
5241 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
5242 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
5243 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
5245 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
5246 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
5247 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
5248 + le16_to_cpu(raw_inode->i_raw_tag));
5249 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
5251 ei->i_state_flags = 0;
5252 @@ -5210,6 +5241,8 @@ static int ext4_do_update_inode(handle_t
5253 struct ext4_inode *raw_inode = ext4_raw_inode(iloc);
5254 struct ext4_inode_info *ei = EXT4_I(inode);
5255 struct buffer_head *bh = iloc->bh;
5256 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
5257 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
5258 int err = 0, rc, block;
5260 /* For fields not not tracking in the in-memory inode,
5261 @@ -5220,29 +5253,32 @@ static int ext4_do_update_inode(handle_t
5262 ext4_get_inode_flags(ei);
5263 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
5264 if (!(test_opt(inode->i_sb, NO_UID32))) {
5265 - raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
5266 - raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
5267 + raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
5268 + raw_inode->i_gid_low = cpu_to_le16(low_16_bits(gid));
5270 * Fix up interoperability with old kernels. Otherwise, old inodes get
5271 * re-used with the upper 16 bits of the uid/gid intact
5274 raw_inode->i_uid_high =
5275 - cpu_to_le16(high_16_bits(inode->i_uid));
5276 + cpu_to_le16(high_16_bits(uid));
5277 raw_inode->i_gid_high =
5278 - cpu_to_le16(high_16_bits(inode->i_gid));
5279 + cpu_to_le16(high_16_bits(gid));
5281 raw_inode->i_uid_high = 0;
5282 raw_inode->i_gid_high = 0;
5285 raw_inode->i_uid_low =
5286 - cpu_to_le16(fs_high2lowuid(inode->i_uid));
5287 + cpu_to_le16(fs_high2lowuid(uid));
5288 raw_inode->i_gid_low =
5289 - cpu_to_le16(fs_high2lowgid(inode->i_gid));
5290 + cpu_to_le16(fs_high2lowgid(gid));
5291 raw_inode->i_uid_high = 0;
5292 raw_inode->i_gid_high = 0;
5294 +#ifdef CONFIG_TAGGING_INTERN
5295 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
5297 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
5299 EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
5300 @@ -5428,7 +5464,8 @@ int ext4_setattr(struct dentry *dentry,
5301 if (ia_valid & ATTR_SIZE)
5302 dquot_initialize(inode);
5303 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
5304 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
5305 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
5306 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
5309 /* (user+group)*(old+new) structure, inode write (sb,
5310 @@ -5450,6 +5487,8 @@ int ext4_setattr(struct dentry *dentry,
5311 inode->i_uid = attr->ia_uid;
5312 if (attr->ia_valid & ATTR_GID)
5313 inode->i_gid = attr->ia_gid;
5314 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
5315 + inode->i_tag = attr->ia_tag;
5316 error = ext4_mark_inode_dirty(handle, inode);
5317 ext4_journal_stop(handle);
5319 diff -NurpP --minimal linux-2.6.34/fs/ext4/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/ioctl.c
5320 --- linux-2.6.34/fs/ext4/ioctl.c 2010-05-18 15:07:51.000000000 +0200
5321 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/ioctl.c 2010-05-18 18:11:22.000000000 +0200
5323 #include <linux/compat.h>
5324 #include <linux/mount.h>
5325 #include <linux/file.h>
5326 +#include <linux/vs_tag.h>
5327 #include <asm/uaccess.h>
5328 #include "ext4_jbd2.h"
5332 +int ext4_sync_flags(struct inode *inode, int flags, int vflags)
5334 + handle_t *handle = NULL;
5335 + struct ext4_iloc iloc;
5338 + handle = ext4_journal_start(inode, 1);
5339 + if (IS_ERR(handle))
5340 + return PTR_ERR(handle);
5342 + if (IS_SYNC(inode))
5343 + ext4_handle_sync(handle);
5344 + err = ext4_reserve_inode_write(handle, inode, &iloc);
5348 + inode->i_flags = flags;
5349 + inode->i_vflags = vflags;
5350 + ext4_get_inode_flags(EXT4_I(inode));
5351 + inode->i_ctime = ext4_current_time(inode);
5353 + err = ext4_mark_iloc_dirty(handle, inode, &iloc);
5355 + ext4_journal_stop(handle);
5359 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5361 struct inode *inode = filp->f_dentry->d_inode;
5362 @@ -50,6 +79,11 @@ long ext4_ioctl(struct file *filp, unsig
5364 flags = ext4_mask_flags(inode->i_mode, flags);
5366 + if (IS_BARRIER(inode)) {
5367 + vxwprintk_task(1, "messing with the barrier.");
5372 mutex_lock(&inode->i_mutex);
5373 /* Is it quota file? Do not allow user to mess with it */
5374 @@ -67,7 +101,9 @@ long ext4_ioctl(struct file *filp, unsig
5376 * This test looks nicer. Thanks to Pauline Middelink
5378 - if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) {
5379 + if ((oldflags & EXT4_IMMUTABLE_FL) ||
5380 + ((flags ^ oldflags) & (EXT4_APPEND_FL |
5381 + EXT4_IMMUTABLE_FL | EXT4_IXUNLINK_FL))) {
5382 if (!capable(CAP_LINUX_IMMUTABLE))
5385 diff -NurpP --minimal linux-2.6.34/fs/ext4/namei.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/namei.c
5386 --- linux-2.6.34/fs/ext4/namei.c 2010-05-18 15:07:51.000000000 +0200
5387 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/namei.c 2010-05-18 18:11:22.000000000 +0200
5389 #include <linux/quotaops.h>
5390 #include <linux/buffer_head.h>
5391 #include <linux/bio.h>
5392 +#include <linux/vs_tag.h>
5394 #include "ext4_jbd2.h"
5396 @@ -937,6 +938,7 @@ restart:
5398 ll_rw_block(READ_META, 1, &bh);
5400 + dx_propagate_tag(nd, inode);
5402 if ((bh = bh_use[ra_ptr++]) == NULL)
5404 @@ -2551,6 +2553,7 @@ const struct inode_operations ext4_dir_i
5406 .check_acl = ext4_check_acl,
5407 .fiemap = ext4_fiemap,
5408 + .sync_flags = ext4_sync_flags,
5411 const struct inode_operations ext4_special_inode_operations = {
5412 diff -NurpP --minimal linux-2.6.34/fs/ext4/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/super.c
5413 --- linux-2.6.34/fs/ext4/super.c 2010-05-18 15:07:51.000000000 +0200
5414 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ext4/super.c 2010-05-18 18:11:22.000000000 +0200
5415 @@ -1156,6 +1156,7 @@ enum {
5416 Opt_inode_readahead_blks, Opt_journal_ioprio,
5417 Opt_dioread_nolock, Opt_dioread_lock,
5418 Opt_discard, Opt_nodiscard,
5419 + Opt_tag, Opt_notag, Opt_tagid
5422 static const match_table_t tokens = {
5423 @@ -1226,6 +1227,9 @@ static const match_table_t tokens = {
5424 {Opt_dioread_lock, "dioread_lock"},
5425 {Opt_discard, "discard"},
5426 {Opt_nodiscard, "nodiscard"},
5428 + {Opt_notag, "notag"},
5429 + {Opt_tagid, "tagid=%u"},
5433 @@ -1394,6 +1398,20 @@ static int parse_options(char *options,
5435 set_opt(sbi->s_mount_opt, NO_UID32);
5437 +#ifndef CONFIG_TAGGING_NONE
5439 + set_opt (sbi->s_mount_opt, TAGGED);
5442 + clear_opt (sbi->s_mount_opt, TAGGED);
5445 +#ifdef CONFIG_PROPAGATE
5448 + set_opt (sbi->s_mount_opt, TAGGED);
5452 set_opt(sbi->s_mount_opt, DEBUG);
5454 @@ -2560,6 +2578,9 @@ static int ext4_fill_super(struct super_
5455 &journal_ioprio, NULL, 0))
5458 + if (EXT4_SB(sb)->s_mount_opt & EXT4_MOUNT_TAGGED)
5459 + sb->s_flags |= MS_TAGGED;
5461 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5462 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
5464 @@ -3612,6 +3633,14 @@ static int ext4_remount(struct super_blo
5465 if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
5466 ext4_abort(sb, __func__, "Abort forced by user");
5468 + if ((sbi->s_mount_opt & EXT4_MOUNT_TAGGED) &&
5469 + !(sb->s_flags & MS_TAGGED)) {
5470 + printk("EXT4-fs: %s: tagging not permitted on remount.\n",
5473 + goto restore_opts;
5476 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5477 (test_opt(sb, POSIX_ACL) ? MS_POSIXACL : 0);
5479 diff -NurpP --minimal linux-2.6.34/fs/fcntl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/fcntl.c
5480 --- linux-2.6.34/fs/fcntl.c 2010-05-18 15:07:51.000000000 +0200
5481 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/fcntl.c 2010-05-18 18:11:22.000000000 +0200
5483 #include <linux/signal.h>
5484 #include <linux/rcupdate.h>
5485 #include <linux/pid_namespace.h>
5486 +#include <linux/vs_limit.h>
5488 #include <asm/poll.h>
5489 #include <asm/siginfo.h>
5490 @@ -102,6 +103,8 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldf
5493 filp_close(tofree, files);
5495 + vx_openfd_inc(newfd); /* fd was unused */
5499 @@ -426,6 +429,8 @@ SYSCALL_DEFINE3(fcntl, unsigned int, fd,
5503 + if (!vx_files_avail(1))
5506 err = security_file_fcntl(filp, cmd, arg);
5508 diff -NurpP --minimal linux-2.6.34/fs/file.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/file.c
5509 --- linux-2.6.34/fs/file.c 2010-05-18 15:07:51.000000000 +0200
5510 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/file.c 2010-05-18 18:11:22.000000000 +0200
5512 #include <linux/spinlock.h>
5513 #include <linux/rcupdate.h>
5514 #include <linux/workqueue.h>
5515 +#include <linux/vs_limit.h>
5517 struct fdtable_defer {
5519 @@ -368,6 +369,8 @@ struct files_struct *dup_fd(struct files
5520 struct file *f = *old_fds++;
5523 + /* TODO: sum it first for check and performance */
5524 + vx_openfd_inc(open_files - i);
5527 * The fd may be claimed in the fd bitmap but not yet
5528 @@ -476,6 +479,7 @@ repeat:
5530 FD_CLR(fd, fdt->close_on_exec);
5532 + vx_openfd_inc(fd);
5535 if (rcu_dereference_raw(fdt->fd[fd]) != NULL) {
5536 diff -NurpP --minimal linux-2.6.34/fs/file_table.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/file_table.c
5537 --- linux-2.6.34/fs/file_table.c 2010-05-18 15:07:51.000000000 +0200
5538 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/file_table.c 2010-05-18 18:11:22.000000000 +0200
5540 #include <linux/sysctl.h>
5541 #include <linux/percpu_counter.h>
5542 #include <linux/ima.h>
5543 +#include <linux/vs_limit.h>
5544 +#include <linux/vs_context.h>
5546 #include <asm/atomic.h>
5548 @@ -133,6 +135,8 @@ struct file *get_empty_filp(void)
5549 spin_lock_init(&f->f_lock);
5550 eventpoll_init_file(f);
5551 /* f->f_version: 0 */
5552 + f->f_xid = vx_current_xid();
5557 @@ -258,6 +262,8 @@ void __fput(struct file *file)
5558 cdev_put(inode->i_cdev);
5559 fops_put(file->f_op);
5560 put_pid(file->f_owner.pid);
5561 + vx_files_dec(file);
5564 if (file->f_mode & FMODE_WRITE)
5565 drop_file_write_access(file);
5566 @@ -325,6 +331,8 @@ void put_filp(struct file *file)
5568 if (atomic_long_dec_and_test(&file->f_count)) {
5569 security_file_free(file);
5570 + vx_files_dec(file);
5575 diff -NurpP --minimal linux-2.6.34/fs/fs_struct.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/fs_struct.c
5576 --- linux-2.6.34/fs/fs_struct.c 2009-06-11 17:13:04.000000000 +0200
5577 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/fs_struct.c 2010-05-18 18:11:22.000000000 +0200
5579 #include <linux/path.h>
5580 #include <linux/slab.h>
5581 #include <linux/fs_struct.h>
5582 +#include <linux/vserver/global.h>
5585 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
5586 @@ -77,6 +78,7 @@ void free_fs_struct(struct fs_struct *fs
5588 path_put(&fs->root);
5590 + atomic_dec(&vs_global_fs);
5591 kmem_cache_free(fs_cachep, fs);
5594 @@ -112,6 +114,7 @@ struct fs_struct *copy_fs_struct(struct
5596 path_get(&old->pwd);
5597 read_unlock(&old->lock);
5598 + atomic_inc(&vs_global_fs);
5602 diff -NurpP --minimal linux-2.6.34/fs/gfs2/file.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/gfs2/file.c
5603 --- linux-2.6.34/fs/gfs2/file.c 2010-05-18 15:07:51.000000000 +0200
5604 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/gfs2/file.c 2010-05-18 18:11:22.000000000 +0200
5605 @@ -132,6 +132,9 @@ static const u32 fsflags_to_gfs2[32] = {
5606 [7] = GFS2_DIF_NOATIME,
5607 [12] = GFS2_DIF_EXHASH,
5608 [14] = GFS2_DIF_INHERIT_JDATA,
5609 + [27] = GFS2_DIF_IXUNLINK,
5610 + [26] = GFS2_DIF_BARRIER,
5611 + [29] = GFS2_DIF_COW,
5614 static const u32 gfs2_to_fsflags[32] = {
5615 @@ -141,6 +144,9 @@ static const u32 gfs2_to_fsflags[32] = {
5616 [gfs2fl_NoAtime] = FS_NOATIME_FL,
5617 [gfs2fl_ExHash] = FS_INDEX_FL,
5618 [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL,
5619 + [gfs2fl_IXUnlink] = FS_IXUNLINK_FL,
5620 + [gfs2fl_Barrier] = FS_BARRIER_FL,
5621 + [gfs2fl_Cow] = FS_COW_FL,
5624 static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
5625 @@ -171,10 +177,16 @@ void gfs2_set_inode_flags(struct inode *
5627 struct gfs2_inode *ip = GFS2_I(inode);
5628 unsigned int flags = inode->i_flags;
5629 + unsigned int vflags = inode->i_vflags;
5631 + flags &= ~(S_IMMUTABLE | S_IXUNLINK |
5632 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
5634 - flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
5635 if (ip->i_diskflags & GFS2_DIF_IMMUTABLE)
5636 flags |= S_IMMUTABLE;
5637 + if (ip->i_diskflags & GFS2_DIF_IXUNLINK)
5638 + flags |= S_IXUNLINK;
5640 if (ip->i_diskflags & GFS2_DIF_APPENDONLY)
5642 if (ip->i_diskflags & GFS2_DIF_NOATIME)
5643 @@ -182,6 +194,43 @@ void gfs2_set_inode_flags(struct inode *
5644 if (ip->i_diskflags & GFS2_DIF_SYNC)
5646 inode->i_flags = flags;
5648 + vflags &= ~(V_BARRIER | V_COW);
5650 + if (ip->i_diskflags & GFS2_DIF_BARRIER)
5651 + vflags |= V_BARRIER;
5652 + if (ip->i_diskflags & GFS2_DIF_COW)
5654 + inode->i_vflags = vflags;
5657 +void gfs2_get_inode_flags(struct inode *inode)
5659 + struct gfs2_inode *ip = GFS2_I(inode);
5660 + unsigned int flags = inode->i_flags;
5661 + unsigned int vflags = inode->i_vflags;
5663 + ip->i_diskflags &= ~(GFS2_DIF_APPENDONLY |
5664 + GFS2_DIF_NOATIME | GFS2_DIF_SYNC |
5665 + GFS2_DIF_IMMUTABLE | GFS2_DIF_IXUNLINK |
5666 + GFS2_DIF_BARRIER | GFS2_DIF_COW);
5668 + if (flags & S_IMMUTABLE)
5669 + ip->i_diskflags |= GFS2_DIF_IMMUTABLE;
5670 + if (flags & S_IXUNLINK)
5671 + ip->i_diskflags |= GFS2_DIF_IXUNLINK;
5673 + if (flags & S_APPEND)
5674 + ip->i_diskflags |= GFS2_DIF_APPENDONLY;
5675 + if (flags & S_NOATIME)
5676 + ip->i_diskflags |= GFS2_DIF_NOATIME;
5677 + if (flags & S_SYNC)
5678 + ip->i_diskflags |= GFS2_DIF_SYNC;
5680 + if (vflags & V_BARRIER)
5681 + ip->i_diskflags |= GFS2_DIF_BARRIER;
5682 + if (vflags & V_COW)
5683 + ip->i_diskflags |= GFS2_DIF_COW;
5686 /* Flags that can be set by user space */
5687 @@ -286,6 +335,37 @@ static int gfs2_set_flags(struct file *f
5688 return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_JDATA);
5691 +int gfs2_sync_flags(struct inode *inode, int flags, int vflags)
5693 + struct gfs2_inode *ip = GFS2_I(inode);
5694 + struct gfs2_sbd *sdp = GFS2_SB(inode);
5695 + struct buffer_head *bh;
5696 + struct gfs2_holder gh;
5699 + error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
5702 + error = gfs2_trans_begin(sdp, RES_DINODE, 0);
5705 + error = gfs2_meta_inode_buffer(ip, &bh);
5707 + goto out_trans_end;
5708 + gfs2_trans_add_bh(ip->i_gl, bh, 1);
5709 + inode->i_flags = flags;
5710 + inode->i_vflags = vflags;
5711 + gfs2_get_inode_flags(inode);
5712 + gfs2_dinode_out(ip, bh->b_data);
5714 + gfs2_set_aops(inode);
5716 + gfs2_trans_end(sdp);
5718 + gfs2_glock_dq_uninit(&gh);
5722 static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5725 diff -NurpP --minimal linux-2.6.34/fs/gfs2/inode.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/gfs2/inode.h
5726 --- linux-2.6.34/fs/gfs2/inode.h 2009-09-10 15:26:22.000000000 +0200
5727 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/gfs2/inode.h 2010-05-18 18:11:22.000000000 +0200
5728 @@ -109,6 +109,7 @@ extern const struct file_operations gfs2
5729 extern const struct file_operations gfs2_dir_fops_nolock;
5731 extern void gfs2_set_inode_flags(struct inode *inode);
5732 +extern int gfs2_sync_flags(struct inode *inode, int flags, int vflags);
5734 #ifdef CONFIG_GFS2_FS_LOCKING_DLM
5735 extern const struct file_operations gfs2_file_fops;
5736 diff -NurpP --minimal linux-2.6.34/fs/gfs2/ops_inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/gfs2/ops_inode.c
5737 --- linux-2.6.34/fs/gfs2/ops_inode.c 2010-05-18 15:07:51.000000000 +0200
5738 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/gfs2/ops_inode.c 2010-05-18 18:11:22.000000000 +0200
5739 @@ -1343,6 +1343,7 @@ const struct inode_operations gfs2_file_
5740 .listxattr = gfs2_listxattr,
5741 .removexattr = gfs2_removexattr,
5742 .fiemap = gfs2_fiemap,
5743 + .sync_flags = gfs2_sync_flags,
5746 const struct inode_operations gfs2_dir_iops = {
5747 @@ -1363,6 +1364,7 @@ const struct inode_operations gfs2_dir_i
5748 .listxattr = gfs2_listxattr,
5749 .removexattr = gfs2_removexattr,
5750 .fiemap = gfs2_fiemap,
5751 + .sync_flags = gfs2_sync_flags,
5754 const struct inode_operations gfs2_symlink_iops = {
5755 diff -NurpP --minimal linux-2.6.34/fs/hfsplus/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/hfsplus/ioctl.c
5756 --- linux-2.6.34/fs/hfsplus/ioctl.c 2008-12-25 00:26:37.000000000 +0100
5757 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/hfsplus/ioctl.c 2010-05-18 18:11:22.000000000 +0200
5759 #include <linux/mount.h>
5760 #include <linux/sched.h>
5761 #include <linux/xattr.h>
5762 +#include <linux/mount.h>
5763 #include <asm/uaccess.h>
5764 #include "hfsplus_fs.h"
5766 diff -NurpP --minimal linux-2.6.34/fs/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/inode.c
5767 --- linux-2.6.34/fs/inode.c 2010-05-18 15:07:52.000000000 +0200
5768 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/inode.c 2010-05-18 18:11:22.000000000 +0200
5769 @@ -131,6 +131,9 @@ int inode_init_always(struct super_block
5770 struct address_space *const mapping = &inode->i_data;
5774 + /* essential because of inode slab reuse */
5776 inode->i_blkbits = sb->s_blocksize_bits;
5778 atomic_set(&inode->i_count, 1);
5779 @@ -151,6 +154,7 @@ int inode_init_always(struct super_block
5780 inode->i_bdev = NULL;
5781 inode->i_cdev = NULL;
5783 + inode->i_mdev = 0;
5784 inode->dirtied_when = 0;
5786 if (security_inode_alloc(inode))
5787 @@ -296,6 +300,8 @@ void __iget(struct inode *inode)
5788 inodes_stat.nr_unused--;
5791 +EXPORT_SYMBOL_GPL(__iget);
5794 * clear_inode - clear an inode
5795 * @inode: inode to clear
5796 @@ -1597,9 +1603,11 @@ void init_special_inode(struct inode *in
5797 if (S_ISCHR(mode)) {
5798 inode->i_fop = &def_chr_fops;
5799 inode->i_rdev = rdev;
5800 + inode->i_mdev = rdev;
5801 } else if (S_ISBLK(mode)) {
5802 inode->i_fop = &def_blk_fops;
5803 inode->i_rdev = rdev;
5804 + inode->i_mdev = rdev;
5805 } else if (S_ISFIFO(mode))
5806 inode->i_fop = &def_fifo_fops;
5807 else if (S_ISSOCK(mode))
5808 diff -NurpP --minimal linux-2.6.34/fs/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ioctl.c
5809 --- linux-2.6.34/fs/ioctl.c 2010-05-18 15:07:52.000000000 +0200
5810 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ioctl.c 2010-05-18 18:11:22.000000000 +0200
5812 #include <linux/writeback.h>
5813 #include <linux/buffer_head.h>
5814 #include <linux/falloc.h>
5815 +#include <linux/proc_fs.h>
5816 +#include <linux/vserver/inode.h>
5817 +#include <linux/vs_tag.h>
5819 #include <asm/ioctls.h>
5821 diff -NurpP --minimal linux-2.6.34/fs/ioprio.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ioprio.c
5822 --- linux-2.6.34/fs/ioprio.c 2010-05-18 15:07:52.000000000 +0200
5823 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ioprio.c 2010-05-18 18:11:22.000000000 +0200
5825 #include <linux/syscalls.h>
5826 #include <linux/security.h>
5827 #include <linux/pid_namespace.h>
5828 +#include <linux/vs_base.h>
5830 int set_task_ioprio(struct task_struct *task, int ioprio)
5832 @@ -124,6 +125,8 @@ SYSCALL_DEFINE3(ioprio_set, int, which,
5834 pgrp = find_vpid(who);
5835 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
5836 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
5838 ret = set_task_ioprio(p, ioprio);
5841 @@ -213,6 +216,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which,
5843 pgrp = find_vpid(who);
5844 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
5845 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
5847 tmpio = get_task_ioprio(p);
5850 diff -NurpP --minimal linux-2.6.34/fs/jfs/file.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/file.c
5851 --- linux-2.6.34/fs/jfs/file.c 2010-05-18 15:07:52.000000000 +0200
5852 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/file.c 2010-05-18 18:11:22.000000000 +0200
5853 @@ -101,7 +101,8 @@ int jfs_setattr(struct dentry *dentry, s
5854 if (iattr->ia_valid & ATTR_SIZE)
5855 dquot_initialize(inode);
5856 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
5857 - (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
5858 + (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
5859 + (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
5860 rc = dquot_transfer(inode, iattr);
5863 @@ -125,6 +126,7 @@ const struct inode_operations jfs_file_i
5864 #ifdef CONFIG_JFS_POSIX_ACL
5865 .check_acl = jfs_check_acl,
5867 + .sync_flags = jfs_sync_flags,
5870 const struct file_operations jfs_file_operations = {
5871 diff -NurpP --minimal linux-2.6.34/fs/jfs/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/ioctl.c
5872 --- linux-2.6.34/fs/jfs/ioctl.c 2008-12-25 00:26:37.000000000 +0100
5873 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/ioctl.c 2010-05-18 18:11:22.000000000 +0200
5875 #include <linux/mount.h>
5876 #include <linux/time.h>
5877 #include <linux/sched.h>
5878 +#include <linux/mount.h>
5879 #include <asm/current.h>
5880 #include <asm/uaccess.h>
5882 @@ -52,6 +53,16 @@ static long jfs_map_ext2(unsigned long f
5886 +int jfs_sync_flags(struct inode *inode, int flags, int vflags)
5888 + inode->i_flags = flags;
5889 + inode->i_vflags = vflags;
5890 + jfs_get_inode_flags(JFS_IP(inode));
5891 + inode->i_ctime = CURRENT_TIME_SEC;
5892 + mark_inode_dirty(inode);
5896 long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5898 struct inode *inode = filp->f_dentry->d_inode;
5899 @@ -85,6 +96,11 @@ long jfs_ioctl(struct file *filp, unsign
5900 if (!S_ISDIR(inode->i_mode))
5901 flags &= ~JFS_DIRSYNC_FL;
5903 + if (IS_BARRIER(inode)) {
5904 + vxwprintk_task(1, "messing with the barrier.");
5908 /* Is it quota file? Do not allow user to mess with it */
5909 if (IS_NOQUOTA(inode)) {
5911 @@ -102,8 +118,8 @@ long jfs_ioctl(struct file *filp, unsign
5912 * the relevant capability.
5914 if ((oldflags & JFS_IMMUTABLE_FL) ||
5915 - ((flags ^ oldflags) &
5916 - (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) {
5917 + ((flags ^ oldflags) & (JFS_APPEND_FL |
5918 + JFS_IMMUTABLE_FL | JFS_IXUNLINK_FL))) {
5919 if (!capable(CAP_LINUX_IMMUTABLE)) {
5920 mutex_unlock(&inode->i_mutex);
5922 @@ -111,7 +127,7 @@ long jfs_ioctl(struct file *filp, unsign
5926 - flags = flags & JFS_FL_USER_MODIFIABLE;
5927 + flags &= JFS_FL_USER_MODIFIABLE;
5928 flags |= oldflags & ~JFS_FL_USER_MODIFIABLE;
5929 jfs_inode->mode2 = flags;
5931 diff -NurpP --minimal linux-2.6.34/fs/jfs/jfs_dinode.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_dinode.h
5932 --- linux-2.6.34/fs/jfs/jfs_dinode.h 2008-12-25 00:26:37.000000000 +0100
5933 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_dinode.h 2010-05-18 18:11:22.000000000 +0200
5934 @@ -161,9 +161,13 @@ struct dinode {
5936 #define JFS_APPEND_FL 0x01000000 /* writes to file may only append */
5937 #define JFS_IMMUTABLE_FL 0x02000000 /* Immutable file */
5938 +#define JFS_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
5940 -#define JFS_FL_USER_VISIBLE 0x03F80000
5941 -#define JFS_FL_USER_MODIFIABLE 0x03F80000
5942 +#define JFS_BARRIER_FL 0x04000000 /* Barrier for chroot() */
5943 +#define JFS_COW_FL 0x20000000 /* Copy on Write marker */
5945 +#define JFS_FL_USER_VISIBLE 0x07F80000
5946 +#define JFS_FL_USER_MODIFIABLE 0x07F80000
5947 #define JFS_FL_INHERIT 0x03C80000
5949 /* These are identical to EXT[23]_IOC_GETFLAGS/SETFLAGS */
5950 diff -NurpP --minimal linux-2.6.34/fs/jfs/jfs_filsys.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_filsys.h
5951 --- linux-2.6.34/fs/jfs/jfs_filsys.h 2008-12-25 00:26:37.000000000 +0100
5952 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_filsys.h 2010-05-18 18:11:22.000000000 +0200
5954 #define JFS_NAME_MAX 255
5955 #define JFS_PATH_MAX BPSIZE
5957 +#define JFS_TAGGED 0x00800000 /* Context Tagging */
5960 * file system state (superblock state)
5961 diff -NurpP --minimal linux-2.6.34/fs/jfs/jfs_imap.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_imap.c
5962 --- linux-2.6.34/fs/jfs/jfs_imap.c 2010-05-18 15:07:52.000000000 +0200
5963 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_imap.c 2010-05-18 18:11:22.000000000 +0200
5965 #include <linux/pagemap.h>
5966 #include <linux/quotaops.h>
5967 #include <linux/slab.h>
5968 +#include <linux/vs_tag.h>
5970 #include "jfs_incore.h"
5971 #include "jfs_inode.h"
5972 @@ -3060,6 +3061,8 @@ static int copy_from_dinode(struct dinod
5974 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
5975 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
5979 jfs_ip->fileset = le32_to_cpu(dip->di_fileset);
5980 jfs_ip->mode2 = le32_to_cpu(dip->di_mode);
5981 @@ -3080,14 +3083,18 @@ static int copy_from_dinode(struct dinod
5983 ip->i_nlink = le32_to_cpu(dip->di_nlink);
5985 - jfs_ip->saved_uid = le32_to_cpu(dip->di_uid);
5986 + uid = le32_to_cpu(dip->di_uid);
5987 + gid = le32_to_cpu(dip->di_gid);
5988 + ip->i_tag = INOTAG_TAG(DX_TAG(ip), uid, gid, 0);
5990 + jfs_ip->saved_uid = INOTAG_UID(DX_TAG(ip), uid, gid);
5992 ip->i_uid = jfs_ip->saved_uid;
5994 ip->i_uid = sbi->uid;
5997 - jfs_ip->saved_gid = le32_to_cpu(dip->di_gid);
5998 + jfs_ip->saved_gid = INOTAG_GID(DX_TAG(ip), uid, gid);
6000 ip->i_gid = jfs_ip->saved_gid;
6002 @@ -3152,14 +3159,12 @@ static void copy_to_dinode(struct dinode
6003 dip->di_size = cpu_to_le64(ip->i_size);
6004 dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks));
6005 dip->di_nlink = cpu_to_le32(ip->i_nlink);
6006 - if (sbi->uid == -1)
6007 - dip->di_uid = cpu_to_le32(ip->i_uid);
6009 - dip->di_uid = cpu_to_le32(jfs_ip->saved_uid);
6010 - if (sbi->gid == -1)
6011 - dip->di_gid = cpu_to_le32(ip->i_gid);
6013 - dip->di_gid = cpu_to_le32(jfs_ip->saved_gid);
6015 + dip->di_uid = cpu_to_le32(TAGINO_UID(DX_TAG(ip),
6016 + (sbi->uid == -1) ? ip->i_uid : jfs_ip->saved_uid, ip->i_tag));
6017 + dip->di_gid = cpu_to_le32(TAGINO_GID(DX_TAG(ip),
6018 + (sbi->gid == -1) ? ip->i_gid : jfs_ip->saved_gid, ip->i_tag));
6020 jfs_get_inode_flags(jfs_ip);
6022 * mode2 is only needed for storing the higher order bits.
6023 diff -NurpP --minimal linux-2.6.34/fs/jfs/jfs_inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_inode.c
6024 --- linux-2.6.34/fs/jfs/jfs_inode.c 2010-05-18 15:07:52.000000000 +0200
6025 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_inode.c 2010-05-18 18:11:22.000000000 +0200
6028 #include <linux/fs.h>
6029 #include <linux/quotaops.h>
6030 +#include <linux/vs_tag.h>
6031 #include "jfs_incore.h"
6032 #include "jfs_inode.h"
6033 #include "jfs_filsys.h"
6034 @@ -30,29 +31,46 @@ void jfs_set_inode_flags(struct inode *i
6036 unsigned int flags = JFS_IP(inode)->mode2;
6038 - inode->i_flags &= ~(S_IMMUTABLE | S_APPEND |
6039 - S_NOATIME | S_DIRSYNC | S_SYNC);
6040 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
6041 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
6043 if (flags & JFS_IMMUTABLE_FL)
6044 inode->i_flags |= S_IMMUTABLE;
6045 + if (flags & JFS_IXUNLINK_FL)
6046 + inode->i_flags |= S_IXUNLINK;
6048 + if (flags & JFS_SYNC_FL)
6049 + inode->i_flags |= S_SYNC;
6050 if (flags & JFS_APPEND_FL)
6051 inode->i_flags |= S_APPEND;
6052 if (flags & JFS_NOATIME_FL)
6053 inode->i_flags |= S_NOATIME;
6054 if (flags & JFS_DIRSYNC_FL)
6055 inode->i_flags |= S_DIRSYNC;
6056 - if (flags & JFS_SYNC_FL)
6057 - inode->i_flags |= S_SYNC;
6059 + inode->i_vflags &= ~(V_BARRIER | V_COW);
6061 + if (flags & JFS_BARRIER_FL)
6062 + inode->i_vflags |= V_BARRIER;
6063 + if (flags & JFS_COW_FL)
6064 + inode->i_vflags |= V_COW;
6067 void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip)
6069 unsigned int flags = jfs_ip->vfs_inode.i_flags;
6070 + unsigned int vflags = jfs_ip->vfs_inode.i_vflags;
6072 + jfs_ip->mode2 &= ~(JFS_IMMUTABLE_FL | JFS_IXUNLINK_FL |
6073 + JFS_APPEND_FL | JFS_NOATIME_FL |
6074 + JFS_DIRSYNC_FL | JFS_SYNC_FL |
6075 + JFS_BARRIER_FL | JFS_COW_FL);
6077 - jfs_ip->mode2 &= ~(JFS_IMMUTABLE_FL | JFS_APPEND_FL | JFS_NOATIME_FL |
6078 - JFS_DIRSYNC_FL | JFS_SYNC_FL);
6079 if (flags & S_IMMUTABLE)
6080 jfs_ip->mode2 |= JFS_IMMUTABLE_FL;
6081 + if (flags & S_IXUNLINK)
6082 + jfs_ip->mode2 |= JFS_IXUNLINK_FL;
6084 if (flags & S_APPEND)
6085 jfs_ip->mode2 |= JFS_APPEND_FL;
6086 if (flags & S_NOATIME)
6087 @@ -61,6 +79,11 @@ void jfs_get_inode_flags(struct jfs_inod
6088 jfs_ip->mode2 |= JFS_DIRSYNC_FL;
6090 jfs_ip->mode2 |= JFS_SYNC_FL;
6092 + if (vflags & V_BARRIER)
6093 + jfs_ip->mode2 |= JFS_BARRIER_FL;
6094 + if (vflags & V_COW)
6095 + jfs_ip->mode2 |= JFS_COW_FL;
6099 @@ -105,6 +128,7 @@ struct inode *ialloc(struct inode *paren
6102 inode->i_gid = current_fsgid();
6103 + inode->i_tag = dx_current_fstag(sb);
6106 * New inodes need to save sane values on disk when
6107 diff -NurpP --minimal linux-2.6.34/fs/jfs/jfs_inode.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_inode.h
6108 --- linux-2.6.34/fs/jfs/jfs_inode.h 2010-05-18 15:07:52.000000000 +0200
6109 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/jfs_inode.h 2010-05-18 18:11:22.000000000 +0200
6110 @@ -39,6 +39,7 @@ extern struct dentry *jfs_fh_to_dentry(s
6111 extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
6112 int fh_len, int fh_type);
6113 extern void jfs_set_inode_flags(struct inode *);
6114 +extern int jfs_sync_flags(struct inode *, int, int);
6115 extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
6116 extern int jfs_setattr(struct dentry *, struct iattr *);
6118 diff -NurpP --minimal linux-2.6.34/fs/jfs/namei.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/namei.c
6119 --- linux-2.6.34/fs/jfs/namei.c 2010-05-18 15:07:52.000000000 +0200
6120 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/namei.c 2010-05-18 18:11:22.000000000 +0200
6122 #include <linux/ctype.h>
6123 #include <linux/quotaops.h>
6124 #include <linux/exportfs.h>
6125 +#include <linux/vs_tag.h>
6126 #include "jfs_incore.h"
6127 #include "jfs_superblock.h"
6128 #include "jfs_inode.h"
6129 @@ -1491,6 +1492,7 @@ static struct dentry *jfs_lookup(struct
6130 return ERR_CAST(ip);
6133 + dx_propagate_tag(nd, ip);
6134 dentry = d_splice_alias(ip, dentry);
6136 if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2))
6137 @@ -1560,6 +1562,7 @@ const struct inode_operations jfs_dir_in
6138 #ifdef CONFIG_JFS_POSIX_ACL
6139 .check_acl = jfs_check_acl,
6141 + .sync_flags = jfs_sync_flags,
6144 const struct file_operations jfs_dir_operations = {
6145 diff -NurpP --minimal linux-2.6.34/fs/jfs/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/super.c
6146 --- linux-2.6.34/fs/jfs/super.c 2010-05-18 15:07:52.000000000 +0200
6147 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/jfs/super.c 2010-05-18 18:11:22.000000000 +0200
6148 @@ -198,7 +198,8 @@ static void jfs_put_super(struct super_b
6150 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
6151 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
6152 - Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask
6153 + Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask,
6154 + Opt_tag, Opt_notag, Opt_tagid
6157 static const match_table_t tokens = {
6158 @@ -208,6 +209,10 @@ static const match_table_t tokens = {
6159 {Opt_resize, "resize=%u"},
6160 {Opt_resize_nosize, "resize"},
6161 {Opt_errors, "errors=%s"},
6163 + {Opt_notag, "notag"},
6164 + {Opt_tagid, "tagid=%u"},
6165 + {Opt_tag, "tagxid"},
6166 {Opt_ignore, "noquota"},
6167 {Opt_ignore, "quota"},
6168 {Opt_usrquota, "usrquota"},
6169 @@ -342,6 +347,20 @@ static int parse_options(char *options,
6173 +#ifndef CONFIG_TAGGING_NONE
6175 + *flag |= JFS_TAGGED;
6178 + *flag &= JFS_TAGGED;
6181 +#ifdef CONFIG_PROPAGATE
6184 + *flag |= JFS_TAGGED;
6188 printk("jfs: Unrecognized mount option \"%s\" "
6189 " or missing value\n", p);
6190 @@ -372,6 +391,12 @@ static int jfs_remount(struct super_bloc
6191 if (!parse_options(data, sb, &newLVSize, &flag)) {
6194 + if ((flag & JFS_TAGGED) && !(sb->s_flags & MS_TAGGED)) {
6195 + printk(KERN_ERR "JFS: %s: tagging not permitted on remount.\n",
6202 if (sb->s_flags & MS_RDONLY) {
6203 @@ -453,6 +478,9 @@ static int jfs_fill_super(struct super_b
6204 #ifdef CONFIG_JFS_POSIX_ACL
6205 sb->s_flags |= MS_POSIXACL;
6207 + /* map mount option tagxid */
6208 + if (sbi->flag & JFS_TAGGED)
6209 + sb->s_flags |= MS_TAGGED;
6212 printk(KERN_ERR "resize option for remount only\n");
6213 diff -NurpP --minimal linux-2.6.34/fs/libfs.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/libfs.c
6214 --- linux-2.6.34/fs/libfs.c 2010-05-18 15:07:52.000000000 +0200
6215 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/libfs.c 2010-05-18 18:11:22.000000000 +0200
6216 @@ -128,7 +128,8 @@ static inline unsigned char dt_type(stru
6217 * both impossible due to the lock on directory.
6220 -int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
6221 +static inline int do_dcache_readdir_filter(struct file *filp,
6222 + void *dirent, filldir_t filldir, int (*filter)(struct dentry *dentry))
6224 struct dentry *dentry = filp->f_path.dentry;
6225 struct dentry *cursor = filp->private_data;
6226 @@ -161,6 +162,8 @@ int dcache_readdir(struct file * filp, v
6227 next = list_entry(p, struct dentry, d_u.d_child);
6228 if (d_unhashed(next) || !next->d_inode)
6230 + if (filter && !filter(next))
6233 spin_unlock(&dcache_lock);
6234 if (filldir(dirent, next->d_name.name,
6235 @@ -179,6 +182,18 @@ int dcache_readdir(struct file * filp, v
6239 +int dcache_readdir(struct file *filp, void *dirent, filldir_t filldir)
6241 + return do_dcache_readdir_filter(filp, dirent, filldir, NULL);
6244 +int dcache_readdir_filter(struct file *filp, void *dirent, filldir_t filldir,
6245 + int (*filter)(struct dentry *))
6247 + return do_dcache_readdir_filter(filp, dirent, filldir, filter);
6251 ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
6254 @@ -844,6 +859,7 @@ EXPORT_SYMBOL(dcache_dir_close);
6255 EXPORT_SYMBOL(dcache_dir_lseek);
6256 EXPORT_SYMBOL(dcache_dir_open);
6257 EXPORT_SYMBOL(dcache_readdir);
6258 +EXPORT_SYMBOL(dcache_readdir_filter);
6259 EXPORT_SYMBOL(generic_read_dir);
6260 EXPORT_SYMBOL(get_sb_pseudo);
6261 EXPORT_SYMBOL(simple_write_begin);
6262 diff -NurpP --minimal linux-2.6.34/fs/locks.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/locks.c
6263 --- linux-2.6.34/fs/locks.c 2010-05-18 15:07:52.000000000 +0200
6264 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/locks.c 2010-05-18 18:11:22.000000000 +0200
6266 #include <linux/time.h>
6267 #include <linux/rcupdate.h>
6268 #include <linux/pid_namespace.h>
6269 +#include <linux/vs_base.h>
6270 +#include <linux/vs_limit.h>
6272 #include <asm/uaccess.h>
6274 @@ -148,6 +150,8 @@ static struct kmem_cache *filelock_cache
6275 /* Allocate an empty lock structure. */
6276 static struct file_lock *locks_alloc_lock(void)
6278 + if (!vx_locks_avail(1))
6280 return kmem_cache_alloc(filelock_cache, GFP_KERNEL);
6283 @@ -174,6 +178,7 @@ static void locks_free_lock(struct file_
6284 BUG_ON(!list_empty(&fl->fl_block));
6285 BUG_ON(!list_empty(&fl->fl_link));
6288 locks_release_private(fl);
6289 kmem_cache_free(filelock_cache, fl);
6291 @@ -194,6 +199,7 @@ void locks_init_lock(struct file_lock *f
6292 fl->fl_start = fl->fl_end = 0;
6294 fl->fl_lmops = NULL;
6298 EXPORT_SYMBOL(locks_init_lock);
6299 @@ -248,6 +254,7 @@ void locks_copy_lock(struct file_lock *n
6300 new->fl_file = fl->fl_file;
6301 new->fl_ops = fl->fl_ops;
6302 new->fl_lmops = fl->fl_lmops;
6303 + new->fl_xid = fl->fl_xid;
6305 locks_copy_private(new, fl);
6307 @@ -286,6 +293,11 @@ static int flock_make_lock(struct file *
6308 fl->fl_flags = FL_FLOCK;
6310 fl->fl_end = OFFSET_MAX;
6312 + vxd_assert(filp->f_xid == vx_current_xid(),
6313 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6314 + fl->fl_xid = filp->f_xid;
6319 @@ -451,6 +463,7 @@ static int lease_init(struct file *filp,
6321 fl->fl_owner = current->files;
6322 fl->fl_pid = current->tgid;
6323 + fl->fl_xid = vx_current_xid();
6326 fl->fl_flags = FL_LEASE;
6327 @@ -470,6 +483,11 @@ static struct file_lock *lease_alloc(str
6329 return ERR_PTR(error);
6331 + fl->fl_xid = vx_current_xid();
6333 + vxd_assert(filp->f_xid == fl->fl_xid,
6334 + "f_xid(%d) == fl_xid(%d)", filp->f_xid, fl->fl_xid);
6336 error = lease_init(filp, type, fl);
6338 locks_free_lock(fl);
6339 @@ -770,6 +788,7 @@ static int flock_lock_file(struct file *
6343 + new_fl->fl_xid = -1;
6345 for_each_lock(inode, before) {
6346 struct file_lock *fl = *before;
6347 @@ -790,6 +809,7 @@ find_conflict:
6349 locks_copy_lock(new_fl, request);
6350 locks_insert_lock(before, new_fl);
6351 + vx_locks_inc(new_fl);
6355 @@ -800,7 +820,8 @@ out:
6359 -static int __posix_lock_file(struct inode *inode, struct file_lock *request, struct file_lock *conflock)
6360 +static int __posix_lock_file(struct inode *inode, struct file_lock *request,
6361 + struct file_lock *conflock, xid_t xid)
6363 struct file_lock *fl;
6364 struct file_lock *new_fl = NULL;
6365 @@ -810,6 +831,8 @@ static int __posix_lock_file(struct inod
6366 struct file_lock **before;
6367 int error, added = 0;
6369 + vxd_assert(xid == vx_current_xid(),
6370 + "xid(%d) == current(%d)", xid, vx_current_xid());
6372 * We may need two file_lock structures for this operation,
6373 * so we get them in advance to avoid races.
6374 @@ -820,7 +843,11 @@ static int __posix_lock_file(struct inod
6375 (request->fl_type != F_UNLCK ||
6376 request->fl_start != 0 || request->fl_end != OFFSET_MAX)) {
6377 new_fl = locks_alloc_lock();
6378 + new_fl->fl_xid = xid;
6379 + vx_locks_inc(new_fl);
6380 new_fl2 = locks_alloc_lock();
6381 + new_fl2->fl_xid = xid;
6382 + vx_locks_inc(new_fl2);
6386 @@ -1019,7 +1046,8 @@ static int __posix_lock_file(struct inod
6387 int posix_lock_file(struct file *filp, struct file_lock *fl,
6388 struct file_lock *conflock)
6390 - return __posix_lock_file(filp->f_path.dentry->d_inode, fl, conflock);
6391 + return __posix_lock_file(filp->f_path.dentry->d_inode,
6392 + fl, conflock, filp->f_xid);
6394 EXPORT_SYMBOL(posix_lock_file);
6396 @@ -1109,7 +1137,7 @@ int locks_mandatory_area(int read_write,
6397 fl.fl_end = offset + count - 1;
6400 - error = __posix_lock_file(inode, &fl, NULL);
6401 + error = __posix_lock_file(inode, &fl, NULL, filp->f_xid);
6402 if (error != FILE_LOCK_DEFERRED)
6404 error = wait_event_interruptible(fl.fl_wait, !fl.fl_next);
6405 @@ -1425,6 +1453,7 @@ int generic_setlease(struct file *filp,
6407 locks_copy_lock(new_fl, lease);
6408 locks_insert_lock(before, new_fl);
6409 + vx_locks_inc(new_fl);
6413 @@ -1780,6 +1809,11 @@ int fcntl_setlk(unsigned int fd, struct
6414 if (file_lock == NULL)
6417 + vxd_assert(filp->f_xid == vx_current_xid(),
6418 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6419 + file_lock->fl_xid = filp->f_xid;
6420 + vx_locks_inc(file_lock);
6423 * This might block, so we do it before checking the inode.
6425 @@ -1898,6 +1932,11 @@ int fcntl_setlk64(unsigned int fd, struc
6426 if (file_lock == NULL)
6429 + vxd_assert(filp->f_xid == vx_current_xid(),
6430 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6431 + file_lock->fl_xid = filp->f_xid;
6432 + vx_locks_inc(file_lock);
6435 * This might block, so we do it before checking the inode.
6437 @@ -2163,8 +2202,11 @@ static int locks_show(struct seq_file *f
6439 lock_get_status(f, fl, (long)f->private, "");
6441 - list_for_each_entry(bfl, &fl->fl_block, fl_block)
6442 + list_for_each_entry(bfl, &fl->fl_block, fl_block) {
6443 + if (!vx_check(fl->fl_xid, VS_WATCH_P | VS_IDENT))
6445 lock_get_status(f, bfl, (long)f->private, " ->");
6450 diff -NurpP --minimal linux-2.6.34/fs/namei.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/namei.c
6451 --- linux-2.6.34/fs/namei.c 2010-05-18 15:07:52.000000000 +0200
6452 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/namei.c 2010-05-21 14:17:04.000000000 +0200
6454 #include <linux/fcntl.h>
6455 #include <linux/device_cgroup.h>
6456 #include <linux/fs_struct.h>
6457 +#include <linux/proc_fs.h>
6458 +#include <linux/vserver/inode.h>
6459 +#include <linux/vs_base.h>
6460 +#include <linux/vs_tag.h>
6461 +#include <linux/vs_cowbl.h>
6462 +#include <linux/vs_device.h>
6463 +#include <linux/vs_context.h>
6464 +#include <linux/pid_namespace.h>
6465 #include <asm/uaccess.h>
6467 #include "internal.h"
6468 @@ -166,6 +174,77 @@ void putname(const char *name)
6469 EXPORT_SYMBOL(putname);
6472 +static inline int dx_barrier(const struct inode *inode)
6474 + if (IS_BARRIER(inode) && !vx_check(0, VS_ADMIN | VS_WATCH)) {
6475 + vxwprintk_task(1, "did hit the barrier.");
6481 +static int __dx_permission(const struct inode *inode, int mask)
6483 + if (dx_barrier(inode))
6486 + if (inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC) {
6487 + /* devpts is xid tagged */
6488 + if (S_ISDIR(inode->i_mode) ||
6489 + vx_check((xid_t)inode->i_tag, VS_IDENT | VS_WATCH_P))
6492 + else if (inode->i_sb->s_magic == PROC_SUPER_MAGIC) {
6493 + struct proc_dir_entry *de = PDE(inode);
6495 + if (de && !vx_hide_check(0, de->vx_flags))
6498 + if ((mask & (MAY_WRITE | MAY_APPEND))) {
6500 + struct task_struct *tsk;
6502 + if (vx_check(0, VS_ADMIN | VS_WATCH_P) ||
6503 + vx_flags(VXF_STATE_SETUP, 0))
6506 + pid = PROC_I(inode)->pid;
6510 + tsk = pid_task(pid, PIDTYPE_PID);
6511 + vxdprintk(VXD_CBIT(tag, 0), "accessing %p[#%u]",
6512 + tsk, (tsk ? vx_task_xid(tsk) : 0));
6513 + if (tsk && vx_check(vx_task_xid(tsk), VS_IDENT | VS_WATCH_P))
6517 + /* FIXME: Should we block some entries here? */
6522 + if (dx_notagcheck(inode->i_sb) ||
6523 + dx_check(inode->i_tag, DX_HOSTID | DX_ADMIN | DX_WATCH |
6532 +int dx_permission(const struct inode *inode, int mask)
6534 + int ret = __dx_permission(inode, mask);
6535 + if (unlikely(ret)) {
6536 + vxwprintk_task(1, "denied %x access to %s:%p[#%d,%lu]",
6537 + mask, inode->i_sb->s_id, inode, inode->i_tag,
6544 * This does basic POSIX ACL permission checking
6546 @@ -266,10 +345,14 @@ int inode_permission(struct inode *inode
6548 * Nobody gets write access to an immutable file.
6550 - if (IS_IMMUTABLE(inode))
6551 + if (IS_IMMUTABLE(inode) && !IS_COW(inode))
6555 + retval = dx_permission(inode, mask);
6559 if (inode->i_op->permission)
6560 retval = inode->i_op->permission(inode, mask);
6562 @@ -464,6 +547,9 @@ static int exec_permission(struct inode
6566 + if (dx_barrier(inode))
6569 if (inode->i_op->permission) {
6570 ret = inode->i_op->permission(inode, MAY_EXEC);
6572 @@ -676,7 +762,8 @@ static __always_inline void follow_dotdo
6574 if (nd->path.dentry == nd->root.dentry &&
6575 nd->path.mnt == nd->root.mnt) {
6577 + /* for sane '/' avoid follow_mount() */
6580 if (nd->path.dentry != nd->path.mnt->mnt_root) {
6581 /* rare case of legitimate dget_parent()... */
6582 @@ -700,7 +787,7 @@ static int do_lookup(struct nameidata *n
6584 struct vfsmount *mnt = nd->path.mnt;
6585 struct dentry *dentry, *parent;
6586 - struct inode *dir;
6587 + struct inode *dir, *inode;
6589 * See if the low-level filesystem might want
6590 * to use its own hash..
6591 @@ -716,12 +803,26 @@ static int do_lookup(struct nameidata *n
6593 if (dentry->d_op && dentry->d_op->d_revalidate)
6594 goto need_revalidate;
6596 + inode = dentry->d_inode;
6600 + if (__dx_permission(inode, MAY_ACCESS))
6604 path->dentry = dentry;
6605 __follow_mount(path);
6609 + vxwprintk_task(1, "did lookup hidden %s:%p[#%d,%lu] »%s/%.*s«.",
6610 + inode->i_sb->s_id, inode, inode->i_tag, inode->i_ino,
6611 + vxd_path(&nd->path), name->len, name->name);
6616 parent = nd->path.dentry;
6617 dir = parent->d_inode;
6618 @@ -1325,7 +1426,7 @@ static int may_delete(struct inode *dir,
6621 if (check_sticky(dir, victim->d_inode)||IS_APPEND(victim->d_inode)||
6622 - IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode))
6623 + IS_IXORUNLINK(victim->d_inode) || IS_SWAPFILE(victim->d_inode))
6626 if (!S_ISDIR(victim->d_inode->i_mode))
6627 @@ -1448,6 +1549,14 @@ int may_open(struct path *path, int acc_
6631 +#ifdef CONFIG_VSERVER_COWBL
6632 + if (IS_COW(inode) && (flag & FMODE_WRITE)) {
6633 + if (IS_COW_LINK(inode))
6635 + inode->i_flags &= ~(S_IXUNLINK|S_IMMUTABLE);
6636 + mark_inode_dirty(inode);
6639 error = inode_permission(inode, acc_mode);
6642 @@ -1557,7 +1666,8 @@ static int open_will_truncate(int flag,
6645 static struct file *finish_open(struct nameidata *nd,
6646 - int open_flag, int acc_mode)
6647 + int open_flag, int acc_mode,
6648 + const char *pathname)
6652 @@ -1570,6 +1680,23 @@ static struct file *finish_open(struct n
6655 error = may_open(&nd->path, acc_mode, open_flag);
6656 +#ifdef CONFIG_VSERVER_COWBL
6657 + if (error == -EMLINK) {
6658 + struct dentry *dentry;
6659 + dentry = cow_break_link(pathname);
6660 + if (IS_ERR(dentry)) {
6661 + error = PTR_ERR(dentry);
6665 + if (will_truncate)
6666 + mnt_drop_write(nd->path.mnt);
6667 + release_open_intent(nd);
6668 + path_put(&nd->path);
6669 + return ERR_PTR(-EMLINK);
6675 mnt_drop_write(nd->path.mnt);
6676 @@ -1738,7 +1865,7 @@ static struct file *do_last(struct namei
6677 if (S_ISDIR(path->dentry->d_inode->i_mode))
6680 - filp = finish_open(nd, open_flag, acc_mode);
6681 + filp = finish_open(nd, open_flag, acc_mode, pathname);
6685 @@ -1767,7 +1894,11 @@ struct file *do_filp_open(int dfd, const
6687 int flag = open_to_namei_flags(open_flag);
6688 int force_reval = 0;
6690 +#ifdef CONFIG_VSERVER_COWBL
6695 if (!(open_flag & O_CREAT))
6698 @@ -1833,6 +1964,13 @@ reval:
6699 if (!(open_flag & O_NOFOLLOW))
6700 nd.flags |= LOOKUP_FOLLOW;
6701 filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
6702 +#ifdef CONFIG_VSERVER_COWBL
6703 + if (unlikely(IS_ERR(filp) && PTR_ERR(filp) == -EMLINK)) {
6709 while (unlikely(!filp)) { /* trailing symlink */
6711 struct inode *inode = path.dentry->d_inode;
6712 @@ -1871,6 +2009,13 @@ reval:
6714 nd.flags &= ~LOOKUP_PARENT;
6715 filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
6716 +#ifdef CONFIG_VSERVER_COWBL
6717 + if (unlikely(IS_ERR(filp) && PTR_ERR(filp) == -EMLINK)) {
6723 if (inode->i_op->put_link)
6724 inode->i_op->put_link(holder.dentry, &nd, cookie);
6726 @@ -1971,9 +2116,17 @@ int vfs_mknod(struct inode *dir, struct
6730 - if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
6731 + if (!(S_ISCHR(mode) || S_ISBLK(mode)))
6734 + if (!capable(CAP_MKNOD))
6737 + if (S_ISCHR(mode) && !vs_chrdev_perm(dev, DATTR_CREATE))
6739 + if (S_ISBLK(mode) && !vs_blkdev_perm(dev, DATTR_CREATE))
6742 if (!dir->i_op->mknod)
6745 @@ -2438,7 +2591,7 @@ int vfs_link(struct dentry *old_dentry,
6747 * A link to an append-only or immutable file cannot be created.
6749 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
6750 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
6752 if (!dir->i_op->link)
6754 @@ -2810,6 +2963,219 @@ int vfs_follow_link(struct nameidata *nd
6755 return __vfs_follow_link(nd, link);
6759 +#ifdef CONFIG_VSERVER_COWBL
6761 +#include <linux/file.h>
6764 +long do_cow_splice(struct file *in, struct file *out, size_t len)
6768 + return do_splice_direct(in, &ppos, out, len, 0);
6771 +struct dentry *cow_break_link(const char *pathname)
6773 + int ret, mode, pathlen, redo = 0;
6774 + struct nameidata old_nd, dir_nd;
6775 + struct path old_path, new_path;
6776 + struct dentry *dir, *res = NULL;
6777 + struct file *old_file;
6778 + struct file *new_file;
6779 + char *to, *path, pad='\251';
6782 + vxdprintk(VXD_CBIT(misc, 1), "cow_break_link(»%s«)", pathname);
6783 + path = kmalloc(PATH_MAX, GFP_KERNEL);
6788 + /* old_nd will have refs to dentry and mnt */
6789 + ret = path_lookup(pathname, LOOKUP_FOLLOW, &old_nd);
6790 + vxdprintk(VXD_CBIT(misc, 2), "path_lookup(old): %d", ret);
6792 + goto out_free_path;
6794 + old_path = old_nd.path;
6795 + mode = old_path.dentry->d_inode->i_mode;
6797 + to = d_path(&old_path, path, PATH_MAX-2);
6798 + pathlen = strlen(to);
6799 + vxdprintk(VXD_CBIT(misc, 2), "old path »%s« [»%.*s«:%d]", to,
6800 + old_path.dentry->d_name.len, old_path.dentry->d_name.name,
6801 + old_path.dentry->d_name.len);
6803 + to[pathlen + 1] = 0;
6805 + to[pathlen] = pad--;
6807 + if (pad <= '\240')
6810 + vxdprintk(VXD_CBIT(misc, 1), "temp copy »%s«", to);
6811 + /* dir_nd will have refs to dentry and mnt */
6812 + ret = path_lookup(to,
6813 + LOOKUP_PARENT | LOOKUP_OPEN | LOOKUP_CREATE, &dir_nd);
6814 + vxdprintk(VXD_CBIT(misc, 2),
6815 + "path_lookup(new): %d", ret);
6819 + /* this puppy downs the inode mutex */
6820 + new_path.dentry = lookup_create(&dir_nd, 0);
6821 + if (!new_path.dentry || IS_ERR(new_path.dentry)) {
6822 + vxdprintk(VXD_CBIT(misc, 2),
6823 + "lookup_create(new): %p", new_path.dentry);
6824 + mutex_unlock(&dir_nd.path.dentry->d_inode->i_mutex);
6825 + path_put(&dir_nd.path);
6828 + vxdprintk(VXD_CBIT(misc, 2),
6829 + "lookup_create(new): %p [»%.*s«:%d]", new_path.dentry,
6830 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
6831 + new_path.dentry->d_name.len);
6832 + dir = dir_nd.path.dentry;
6834 + ret = vfs_create(dir_nd.path.dentry->d_inode, new_path.dentry, mode, &dir_nd);
6835 + vxdprintk(VXD_CBIT(misc, 2),
6836 + "vfs_create(new): %d", ret);
6837 + if (ret == -EEXIST) {
6838 + mutex_unlock(&dir->d_inode->i_mutex);
6839 + dput(new_path.dentry);
6840 + path_put(&dir_nd.path);
6844 + goto out_unlock_new;
6846 + /* drop out early, ret passes ENOENT */
6848 + if ((redo = d_unhashed(old_path.dentry)))
6849 + goto out_unlock_new;
6851 + new_path.mnt = dir_nd.path.mnt;
6852 + dget(old_path.dentry);
6853 + mntget(old_path.mnt);
6854 + /* this one cleans up the dentry/mnt in case of failure */
6855 + old_file = dentry_open(old_path.dentry, old_path.mnt,
6856 + O_RDONLY, current_cred());
6857 + vxdprintk(VXD_CBIT(misc, 2),
6858 + "dentry_open(old): %p", old_file);
6859 + if (!old_file || IS_ERR(old_file)) {
6860 + res = IS_ERR(old_file) ? (void *) old_file : res;
6861 + goto out_unlock_new;
6864 + dget(new_path.dentry);
6865 + mntget(new_path.mnt);
6866 + /* this one cleans up the dentry/mnt in case of failure */
6867 + new_file = dentry_open(new_path.dentry, new_path.mnt,
6868 + O_WRONLY, current_cred());
6869 + vxdprintk(VXD_CBIT(misc, 2),
6870 + "dentry_open(new): %p", new_file);
6872 + ret = IS_ERR(new_file) ? PTR_ERR(new_file) : -ENOENT;
6873 + if (!new_file || IS_ERR(new_file))
6874 + goto out_fput_old;
6876 + size = i_size_read(old_file->f_dentry->d_inode);
6877 + ret = do_cow_splice(old_file, new_file, size);
6878 + vxdprintk(VXD_CBIT(misc, 2), "do_splice_direct: %d", ret);
6880 + goto out_fput_both;
6881 + } else if (ret < size) {
6883 + goto out_fput_both;
6885 + struct inode *old_inode = old_path.dentry->d_inode;
6886 + struct inode *new_inode = new_path.dentry->d_inode;
6887 + struct iattr attr = {
6888 + .ia_uid = old_inode->i_uid,
6889 + .ia_gid = old_inode->i_gid,
6890 + .ia_valid = ATTR_UID | ATTR_GID
6893 + ret = inode_setattr(new_inode, &attr);
6895 + goto out_fput_both;
6898 + mutex_lock(&old_path.dentry->d_inode->i_sb->s_vfs_rename_mutex);
6900 + /* drop out late */
6902 + if ((redo = d_unhashed(old_path.dentry)))
6905 + vxdprintk(VXD_CBIT(misc, 2),
6906 + "vfs_rename: [»%*s«:%d] -> [»%*s«:%d]",
6907 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
6908 + new_path.dentry->d_name.len,
6909 + old_path.dentry->d_name.len, old_path.dentry->d_name.name,
6910 + old_path.dentry->d_name.len);
6911 + ret = vfs_rename(dir_nd.path.dentry->d_inode, new_path.dentry,
6912 + old_nd.path.dentry->d_parent->d_inode, old_path.dentry);
6913 + vxdprintk(VXD_CBIT(misc, 2), "vfs_rename: %d", ret);
6914 + res = new_path.dentry;
6917 + mutex_unlock(&old_path.dentry->d_inode->i_sb->s_vfs_rename_mutex);
6920 + vxdprintk(VXD_CBIT(misc, 3),
6921 + "fput(new_file=%p[#%ld])", new_file,
6922 + atomic_long_read(&new_file->f_count));
6926 + vxdprintk(VXD_CBIT(misc, 3),
6927 + "fput(old_file=%p[#%ld])", old_file,
6928 + atomic_long_read(&old_file->f_count));
6932 + mutex_unlock(&dir->d_inode->i_mutex);
6936 + /* error path cleanup */
6937 + vfs_unlink(dir->d_inode, new_path.dentry);
6938 + dput(new_path.dentry);
6942 + goto out_rel_both;
6943 + /* lookup dentry once again */
6944 + path_put(&old_nd.path);
6945 + ret = path_lookup(pathname, LOOKUP_FOLLOW, &old_nd);
6947 + goto out_rel_both;
6949 + new_path.dentry = old_nd.path.dentry;
6950 + vxdprintk(VXD_CBIT(misc, 2),
6951 + "path_lookup(redo): %p [»%.*s«:%d]", new_path.dentry,
6952 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
6953 + new_path.dentry->d_name.len);
6954 + dget(new_path.dentry);
6955 + res = new_path.dentry;
6958 + path_put(&dir_nd.path);
6960 + path_put(&old_nd.path);
6965 + res = ERR_PTR(ret);
6971 /* get the link contents into pagecache */
6972 static char *page_getlink(struct dentry * dentry, struct page **ppage)
6974 diff -NurpP --minimal linux-2.6.34/fs/namespace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/namespace.c
6975 --- linux-2.6.34/fs/namespace.c 2010-05-18 15:07:52.000000000 +0200
6976 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/namespace.c 2010-05-18 18:11:22.000000000 +0200
6978 #include <linux/log2.h>
6979 #include <linux/idr.h>
6980 #include <linux/fs_struct.h>
6981 +#include <linux/vs_base.h>
6982 +#include <linux/vs_context.h>
6983 +#include <linux/vs_tag.h>
6984 +#include <linux/vserver/space.h>
6985 +#include <linux/vserver/global.h>
6986 #include <asm/uaccess.h>
6987 #include <asm/unistd.h>
6989 @@ -567,6 +572,7 @@ static struct vfsmount *clone_mnt(struct
6990 mnt->mnt_root = dget(root);
6991 mnt->mnt_mountpoint = mnt->mnt_root;
6992 mnt->mnt_parent = mnt;
6993 + mnt->mnt_tag = old->mnt_tag;
6995 if (flag & CL_SLAVE) {
6996 list_add(&mnt->mnt_slave, &old->mnt_slave_list);
6997 @@ -661,6 +667,31 @@ static inline void mangle(struct seq_fil
6998 seq_escape(m, s, " \t\n\\");
7001 +static int mnt_is_reachable(struct vfsmount *mnt)
7004 + struct dentry *point;
7007 + if (mnt == mnt->mnt_ns->root)
7010 + spin_lock(&vfsmount_lock);
7011 + root = current->fs->root;
7012 + point = root.dentry;
7014 + while ((mnt != mnt->mnt_parent) && (mnt != root.mnt)) {
7015 + point = mnt->mnt_mountpoint;
7016 + mnt = mnt->mnt_parent;
7019 + ret = (mnt == root.mnt) && is_subdir(point, root.dentry);
7021 + spin_unlock(&vfsmount_lock);
7027 * Simple .show_options callback for filesystems which don't want to
7028 * implement more complex mount option showing.
7029 @@ -763,6 +794,8 @@ static int show_sb_opts(struct seq_file
7030 { MS_SYNCHRONOUS, ",sync" },
7031 { MS_DIRSYNC, ",dirsync" },
7032 { MS_MANDLOCK, ",mand" },
7033 + { MS_TAGGED, ",tag" },
7034 + { MS_NOTAGCHECK, ",notagcheck" },
7037 const struct proc_fs_info *fs_infop;
7038 @@ -810,10 +843,20 @@ static int show_vfsmnt(struct seq_file *
7040 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
7042 - mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
7044 - seq_path(m, &mnt_path, " \t\n\\");
7046 + if (vx_flags(VXF_HIDE_MOUNT, 0))
7048 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
7051 + if (!vx_check(0, VS_ADMIN|VS_WATCH) &&
7052 + mnt == current->fs->root.mnt) {
7053 + seq_puts(m, "/dev/root / ");
7055 + mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
7057 + seq_path(m, &mnt_path, " \t\n\\");
7060 show_type(m, mnt->mnt_sb);
7061 seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
7062 err = show_sb_opts(m, mnt->mnt_sb);
7063 @@ -843,6 +886,11 @@ static int show_mountinfo(struct seq_fil
7064 struct path root = p->root;
7067 + if (vx_flags(VXF_HIDE_MOUNT, 0))
7069 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
7072 seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id,
7073 MAJOR(sb->s_dev), MINOR(sb->s_dev));
7074 seq_dentry(m, mnt->mnt_root, " \t\n\\");
7075 @@ -901,17 +949,27 @@ static int show_vfsstat(struct seq_file
7076 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
7080 - if (mnt->mnt_devname) {
7081 - seq_puts(m, "device ");
7082 - mangle(m, mnt->mnt_devname);
7084 - seq_puts(m, "no device");
7085 + if (vx_flags(VXF_HIDE_MOUNT, 0))
7087 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
7091 - seq_puts(m, " mounted on ");
7092 - seq_path(m, &mnt_path, " \t\n\\");
7094 + if (!vx_check(0, VS_ADMIN|VS_WATCH) &&
7095 + mnt == current->fs->root.mnt) {
7096 + seq_puts(m, "device /dev/root mounted on / ");
7099 + if (mnt->mnt_devname) {
7100 + seq_puts(m, "device ");
7101 + mangle(m, mnt->mnt_devname);
7103 + seq_puts(m, "no device");
7106 + seq_puts(m, " mounted on ");
7107 + seq_path(m, &mnt_path, " \t\n\\");
7111 /* file system type */
7112 seq_puts(m, "with fstype ");
7113 @@ -1154,7 +1212,7 @@ SYSCALL_DEFINE2(umount, char __user *, n
7117 - if (!capable(CAP_SYS_ADMIN))
7118 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7121 retval = do_umount(path.mnt, flags);
7122 @@ -1180,7 +1238,7 @@ SYSCALL_DEFINE1(oldumount, char __user *
7124 static int mount_is_safe(struct path *path)
7126 - if (capable(CAP_SYS_ADMIN))
7127 + if (vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7131 @@ -1459,7 +1517,7 @@ static int do_change_type(struct path *p
7132 int type = flag & ~MS_REC;
7135 - if (!capable(CAP_SYS_ADMIN))
7136 + if (!vx_capable(CAP_SYS_ADMIN, VXC_NAMESPACE))
7139 if (path->dentry != path->mnt->mnt_root)
7140 @@ -1486,11 +1544,13 @@ static int do_change_type(struct path *p
7141 * do loopback mount.
7143 static int do_loopback(struct path *path, char *old_name,
7145 + tag_t tag, unsigned long flags, int mnt_flags)
7147 struct path old_path;
7148 struct vfsmount *mnt = NULL;
7149 int err = mount_is_safe(path);
7150 + int recurse = flags & MS_REC;
7154 if (!old_name || !*old_name)
7155 @@ -1524,6 +1584,7 @@ static int do_loopback(struct path *path
7156 spin_unlock(&vfsmount_lock);
7157 release_mounts(&umount_list);
7159 + mnt->mnt_flags = mnt_flags;
7162 up_write(&namespace_sem);
7163 @@ -1554,12 +1615,12 @@ static int change_mount_flags(struct vfs
7164 * on it - tough luck.
7166 static int do_remount(struct path *path, int flags, int mnt_flags,
7168 + void *data, xid_t xid)
7171 struct super_block *sb = path->mnt->mnt_sb;
7173 - if (!capable(CAP_SYS_ADMIN))
7174 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_REMOUNT))
7177 if (!check_mnt(path->mnt))
7178 @@ -1605,7 +1666,7 @@ static int do_move_mount(struct path *pa
7179 struct path old_path, parent_path;
7182 - if (!capable(CAP_SYS_ADMIN))
7183 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7185 if (!old_name || !*old_name)
7187 @@ -1687,7 +1748,7 @@ static int do_new_mount(struct path *pat
7190 /* we need capabilities... */
7191 - if (!capable(CAP_SYS_ADMIN))
7192 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7196 @@ -1953,6 +2014,7 @@ long do_mount(char *dev_name, char *dir_
7203 if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
7204 @@ -1980,6 +2042,12 @@ long do_mount(char *dev_name, char *dir_
7205 if (!(flags & MS_NOATIME))
7206 mnt_flags |= MNT_RELATIME;
7208 + if (dx_parse_tag(data_page, &tag, 1, &mnt_flags, &flags)) {
7209 + /* FIXME: bind and re-mounts get the tag flag? */
7210 + if (flags & (MS_BIND|MS_REMOUNT))
7211 + flags |= MS_TAGID;
7214 /* Separate the per-mountpoint flags */
7215 if (flags & MS_NOSUID)
7216 mnt_flags |= MNT_NOSUID;
7217 @@ -1996,15 +2064,17 @@ long do_mount(char *dev_name, char *dir_
7218 if (flags & MS_RDONLY)
7219 mnt_flags |= MNT_READONLY;
7221 + if (!capable(CAP_SYS_ADMIN))
7222 + mnt_flags |= MNT_NODEV;
7223 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
7224 MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
7227 if (flags & MS_REMOUNT)
7228 retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
7231 else if (flags & MS_BIND)
7232 - retval = do_loopback(&path, dev_name, flags & MS_REC);
7233 + retval = do_loopback(&path, dev_name, tag, flags, mnt_flags);
7234 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
7235 retval = do_change_type(&path, flags);
7236 else if (flags & MS_MOVE)
7237 @@ -2083,6 +2153,7 @@ static struct mnt_namespace *dup_mnt_ns(
7238 q = next_mnt(q, new_ns->root);
7240 up_write(&namespace_sem);
7241 + atomic_inc(&vs_global_mnt_ns);
7245 @@ -2227,9 +2298,10 @@ SYSCALL_DEFINE2(pivot_root, const char _
7246 down_write(&namespace_sem);
7247 mutex_lock(&old.dentry->d_inode->i_mutex);
7249 - if (IS_MNT_SHARED(old.mnt) ||
7250 + if ((IS_MNT_SHARED(old.mnt) ||
7251 IS_MNT_SHARED(new.mnt->mnt_parent) ||
7252 - IS_MNT_SHARED(root.mnt->mnt_parent))
7253 + IS_MNT_SHARED(root.mnt->mnt_parent)) &&
7254 + !vx_flags(VXF_STATE_SETUP, 0))
7256 if (!check_mnt(root.mnt))
7258 @@ -2361,6 +2433,7 @@ void put_mnt_ns(struct mnt_namespace *ns
7259 spin_unlock(&vfsmount_lock);
7260 up_write(&namespace_sem);
7261 release_mounts(&umount_list);
7262 + atomic_dec(&vs_global_mnt_ns);
7265 EXPORT_SYMBOL(put_mnt_ns);
7266 diff -NurpP --minimal linux-2.6.34/fs/nfs/client.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/client.c
7267 --- linux-2.6.34/fs/nfs/client.c 2010-05-18 15:07:52.000000000 +0200
7268 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/client.c 2010-05-18 18:11:22.000000000 +0200
7269 @@ -739,6 +739,9 @@ static int nfs_init_server_rpcclient(str
7270 if (server->flags & NFS_MOUNT_SOFT)
7271 server->client->cl_softrtry = 1;
7273 + server->client->cl_tag = 0;
7274 + if (server->flags & NFS_MOUNT_TAGGED)
7275 + server->client->cl_tag = 1;
7279 @@ -910,6 +913,10 @@ static void nfs_server_set_fsinfo(struct
7280 server->acdirmin = server->acdirmax = 0;
7283 + /* FIXME: needs fsinfo
7284 + if (server->flags & NFS_MOUNT_TAGGED)
7285 + sb->s_flags |= MS_TAGGED; */
7287 server->maxfilesize = fsinfo->maxfilesize;
7289 /* We're airborne Set socket buffersize */
7290 diff -NurpP --minimal linux-2.6.34/fs/nfs/dir.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/dir.c
7291 --- linux-2.6.34/fs/nfs/dir.c 2010-05-18 15:07:52.000000000 +0200
7292 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/dir.c 2010-05-18 18:11:22.000000000 +0200
7294 #include <linux/namei.h>
7295 #include <linux/mount.h>
7296 #include <linux/sched.h>
7297 +#include <linux/vs_tag.h>
7299 #include "nfs4_fs.h"
7300 #include "delegation.h"
7301 @@ -951,6 +952,7 @@ static struct dentry *nfs_lookup(struct
7303 goto out_unblock_sillyrename;
7305 + dx_propagate_tag(nd, inode);
7307 res = d_materialise_unique(dentry, inode);
7309 diff -NurpP --minimal linux-2.6.34/fs/nfs/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/inode.c
7310 --- linux-2.6.34/fs/nfs/inode.c 2010-05-18 15:07:52.000000000 +0200
7311 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/inode.c 2010-05-18 18:11:22.000000000 +0200
7313 #include <linux/inet.h>
7314 #include <linux/nfs_xdr.h>
7315 #include <linux/slab.h>
7316 +#include <linux/vs_tag.h>
7318 #include <asm/system.h>
7319 #include <asm/uaccess.h>
7320 @@ -260,6 +261,8 @@ nfs_fhget(struct super_block *sb, struct
7321 if (inode->i_state & I_NEW) {
7322 struct nfs_inode *nfsi = NFS_I(inode);
7323 unsigned long now = jiffies;
7327 /* We set i_ino for the few things that still rely on it,
7328 * such as stat(2) */
7329 @@ -308,8 +311,8 @@ nfs_fhget(struct super_block *sb, struct
7330 nfsi->change_attr = 0;
7333 - inode->i_uid = -2;
7334 - inode->i_gid = -2;
7337 inode->i_blocks = 0;
7338 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
7340 @@ -346,13 +349,13 @@ nfs_fhget(struct super_block *sb, struct
7341 else if (nfs_server_capable(inode, NFS_CAP_NLINK))
7342 nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
7343 if (fattr->valid & NFS_ATTR_FATTR_OWNER)
7344 - inode->i_uid = fattr->uid;
7346 else if (nfs_server_capable(inode, NFS_CAP_OWNER))
7347 nfsi->cache_validity |= NFS_INO_INVALID_ATTR
7348 | NFS_INO_INVALID_ACCESS
7349 | NFS_INO_INVALID_ACL;
7350 if (fattr->valid & NFS_ATTR_FATTR_GROUP)
7351 - inode->i_gid = fattr->gid;
7353 else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP))
7354 nfsi->cache_validity |= NFS_INO_INVALID_ATTR
7355 | NFS_INO_INVALID_ACCESS
7356 @@ -365,6 +368,11 @@ nfs_fhget(struct super_block *sb, struct
7358 inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used);
7360 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
7361 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
7362 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid, 0);
7363 + /* maybe fattr->xid someday */
7365 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
7366 nfsi->attrtimeo_timestamp = now;
7367 nfsi->access_cache = RB_ROOT;
7368 @@ -477,6 +485,8 @@ void nfs_setattr_update_inode(struct ino
7369 inode->i_uid = attr->ia_uid;
7370 if ((attr->ia_valid & ATTR_GID) != 0)
7371 inode->i_gid = attr->ia_gid;
7372 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
7373 + inode->i_tag = attr->ia_tag;
7374 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7375 spin_unlock(&inode->i_lock);
7377 @@ -838,6 +848,9 @@ static int nfs_check_inode_attributes(st
7378 struct nfs_inode *nfsi = NFS_I(inode);
7379 loff_t cur_size, new_isize;
7380 unsigned long invalid = 0;
7386 /* Has the inode gone and changed behind our back? */
7387 @@ -861,13 +874,18 @@ static int nfs_check_inode_attributes(st
7388 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
7391 + uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
7392 + gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
7393 + tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
7395 /* Have any file permissions changed? */
7396 if ((fattr->valid & NFS_ATTR_FATTR_MODE) && (inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO))
7397 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7398 - if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && inode->i_uid != fattr->uid)
7399 + if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && uid != fattr->uid)
7400 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7401 - if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && inode->i_gid != fattr->gid)
7402 + if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && gid != fattr->gid)
7403 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7404 + /* maybe check for tag too? */
7406 /* Has the link count changed? */
7407 if ((fattr->valid & NFS_ATTR_FATTR_NLINK) && inode->i_nlink != fattr->nlink)
7408 @@ -1082,6 +1100,9 @@ static int nfs_update_inode(struct inode
7409 unsigned long invalid = 0;
7410 unsigned long now = jiffies;
7411 unsigned long save_cache_validity;
7416 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n",
7417 __func__, inode->i_sb->s_id, inode->i_ino,
7418 @@ -1184,6 +1205,9 @@ static int nfs_update_inode(struct inode
7419 | NFS_INO_REVAL_PAGECACHE
7420 | NFS_INO_REVAL_FORCED);
7422 + uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
7423 + gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
7424 + tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
7426 if (fattr->valid & NFS_ATTR_FATTR_ATIME)
7427 memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
7428 @@ -1205,9 +1229,9 @@ static int nfs_update_inode(struct inode
7429 | NFS_INO_REVAL_FORCED);
7431 if (fattr->valid & NFS_ATTR_FATTR_OWNER) {
7432 - if (inode->i_uid != fattr->uid) {
7433 + if (uid != fattr->uid) {
7434 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7435 - inode->i_uid = fattr->uid;
7438 } else if (server->caps & NFS_CAP_OWNER)
7439 invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
7440 @@ -1216,9 +1240,9 @@ static int nfs_update_inode(struct inode
7441 | NFS_INO_REVAL_FORCED);
7443 if (fattr->valid & NFS_ATTR_FATTR_GROUP) {
7444 - if (inode->i_gid != fattr->gid) {
7445 + if (gid != fattr->gid) {
7446 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7447 - inode->i_gid = fattr->gid;
7450 } else if (server->caps & NFS_CAP_OWNER_GROUP)
7451 invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
7452 @@ -1226,6 +1250,10 @@ static int nfs_update_inode(struct inode
7453 | NFS_INO_INVALID_ACL
7454 | NFS_INO_REVAL_FORCED);
7456 + inode->i_uid = uid;
7457 + inode->i_gid = gid;
7458 + inode->i_tag = tag;
7460 if (fattr->valid & NFS_ATTR_FATTR_NLINK) {
7461 if (inode->i_nlink != fattr->nlink) {
7462 invalid |= NFS_INO_INVALID_ATTR;
7463 diff -NurpP --minimal linux-2.6.34/fs/nfs/nfs3xdr.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/nfs3xdr.c
7464 --- linux-2.6.34/fs/nfs/nfs3xdr.c 2010-05-18 15:07:52.000000000 +0200
7465 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/nfs3xdr.c 2010-05-18 18:11:22.000000000 +0200
7467 #include <linux/nfs3.h>
7468 #include <linux/nfs_fs.h>
7469 #include <linux/nfsacl.h>
7470 +#include <linux/vs_tag.h>
7471 #include "internal.h"
7473 #define NFSDBG_FACILITY NFSDBG_XDR
7474 @@ -175,7 +176,7 @@ xdr_decode_fattr(__be32 *p, struct nfs_f
7477 static inline __be32 *
7478 -xdr_encode_sattr(__be32 *p, struct iattr *attr)
7479 +xdr_encode_sattr(__be32 *p, struct iattr *attr, int tag)
7481 if (attr->ia_valid & ATTR_MODE) {
7483 @@ -183,15 +184,17 @@ xdr_encode_sattr(__be32 *p, struct iattr
7487 - if (attr->ia_valid & ATTR_UID) {
7488 + if (attr->ia_valid & ATTR_UID ||
7489 + (tag && (attr->ia_valid & ATTR_TAG))) {
7491 - *p++ = htonl(attr->ia_uid);
7492 + *p++ = htonl(TAGINO_UID(tag, attr->ia_uid, attr->ia_tag));
7496 - if (attr->ia_valid & ATTR_GID) {
7497 + if (attr->ia_valid & ATTR_GID ||
7498 + (tag && (attr->ia_valid & ATTR_TAG))) {
7500 - *p++ = htonl(attr->ia_gid);
7501 + *p++ = htonl(TAGINO_GID(tag, attr->ia_gid, attr->ia_tag));
7505 @@ -278,7 +281,8 @@ static int
7506 nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args)
7508 p = xdr_encode_fhandle(p, args->fh);
7509 - p = xdr_encode_sattr(p, args->sattr);
7510 + p = xdr_encode_sattr(p, args->sattr,
7511 + req->rq_task->tk_client->cl_tag);
7512 *p++ = htonl(args->guard);
7514 p = xdr_encode_time3(p, &args->guardtime);
7515 @@ -383,7 +387,8 @@ nfs3_xdr_createargs(struct rpc_rqst *req
7516 *p++ = args->verifier[0];
7517 *p++ = args->verifier[1];
7519 - p = xdr_encode_sattr(p, args->sattr);
7520 + p = xdr_encode_sattr(p, args->sattr,
7521 + req->rq_task->tk_client->cl_tag);
7523 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7525 @@ -397,7 +402,8 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req,
7527 p = xdr_encode_fhandle(p, args->fh);
7528 p = xdr_encode_array(p, args->name, args->len);
7529 - p = xdr_encode_sattr(p, args->sattr);
7530 + p = xdr_encode_sattr(p, args->sattr,
7531 + req->rq_task->tk_client->cl_tag);
7532 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7535 @@ -410,7 +416,8 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *re
7537 p = xdr_encode_fhandle(p, args->fromfh);
7538 p = xdr_encode_array(p, args->fromname, args->fromlen);
7539 - p = xdr_encode_sattr(p, args->sattr);
7540 + p = xdr_encode_sattr(p, args->sattr,
7541 + req->rq_task->tk_client->cl_tag);
7542 *p++ = htonl(args->pathlen);
7543 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7545 @@ -428,7 +435,8 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req,
7546 p = xdr_encode_fhandle(p, args->fh);
7547 p = xdr_encode_array(p, args->name, args->len);
7548 *p++ = htonl(args->type);
7549 - p = xdr_encode_sattr(p, args->sattr);
7550 + p = xdr_encode_sattr(p, args->sattr,
7551 + req->rq_task->tk_client->cl_tag);
7552 if (args->type == NF3CHR || args->type == NF3BLK) {
7553 *p++ = htonl(MAJOR(args->rdev));
7554 *p++ = htonl(MINOR(args->rdev));
7555 diff -NurpP --minimal linux-2.6.34/fs/nfs/nfsroot.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/nfsroot.c
7556 --- linux-2.6.34/fs/nfs/nfsroot.c 2009-09-10 15:26:23.000000000 +0200
7557 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/nfsroot.c 2010-05-18 18:11:22.000000000 +0200
7558 @@ -122,12 +122,12 @@ static int mount_port __initdata = 0; /
7560 /* Options that take integer arguments */
7561 Opt_port, Opt_rsize, Opt_wsize, Opt_timeo, Opt_retrans, Opt_acregmin,
7562 - Opt_acregmax, Opt_acdirmin, Opt_acdirmax,
7563 + Opt_acregmax, Opt_acdirmin, Opt_acdirmax, Opt_tagid,
7564 /* Options that take no arguments */
7565 Opt_soft, Opt_hard, Opt_intr,
7566 Opt_nointr, Opt_posix, Opt_noposix, Opt_cto, Opt_nocto, Opt_ac,
7567 Opt_noac, Opt_lock, Opt_nolock, Opt_v2, Opt_v3, Opt_udp, Opt_tcp,
7568 - Opt_acl, Opt_noacl,
7569 + Opt_acl, Opt_noacl, Opt_tag, Opt_notag,
7573 @@ -164,6 +164,9 @@ static const match_table_t tokens __init
7576 {Opt_noacl, "noacl"},
7578 + {Opt_notag, "notag"},
7579 + {Opt_tagid, "tagid=%u"},
7583 @@ -275,6 +278,20 @@ static int __init root_nfs_parse(char *n
7585 nfs_data.flags |= NFS_MOUNT_NOACL;
7587 +#ifndef CONFIG_TAGGING_NONE
7589 + nfs_data.flags |= NFS_MOUNT_TAGGED;
7592 + nfs_data.flags &= ~NFS_MOUNT_TAGGED;
7595 +#ifdef CONFIG_PROPAGATE
7598 + nfs_data.flags |= NFS_MOUNT_TAGGED;
7602 printk(KERN_WARNING "Root-NFS: unknown "
7604 diff -NurpP --minimal linux-2.6.34/fs/nfs/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/super.c
7605 --- linux-2.6.34/fs/nfs/super.c 2010-05-18 15:07:52.000000000 +0200
7606 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfs/super.c 2010-05-18 18:11:22.000000000 +0200
7608 #include <linux/nfs_xdr.h>
7609 #include <linux/magic.h>
7610 #include <linux/parser.h>
7611 +#include <linux/vs_tag.h>
7613 #include <asm/system.h>
7614 #include <asm/uaccess.h>
7615 @@ -586,6 +587,7 @@ static void nfs_show_mount_options(struc
7616 { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
7617 { NFS_MOUNT_UNSHARED, ",nosharecache", "" },
7618 { NFS_MOUNT_NORESVPORT, ",noresvport", "" },
7619 + { NFS_MOUNT_TAGGED, ",tag", "" },
7622 const struct proc_nfs_info *nfs_infop;
7623 diff -NurpP --minimal linux-2.6.34/fs/nfsd/auth.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfsd/auth.c
7624 --- linux-2.6.34/fs/nfsd/auth.c 2010-02-25 11:52:05.000000000 +0100
7625 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfsd/auth.c 2010-05-18 18:11:22.000000000 +0200
7627 /* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */
7629 #include <linux/sched.h>
7630 +#include <linux/vs_tag.h>
7634 @@ -36,6 +37,9 @@ int nfsd_setuser(struct svc_rqst *rqstp,
7636 new->fsuid = rqstp->rq_cred.cr_uid;
7637 new->fsgid = rqstp->rq_cred.cr_gid;
7638 + /* FIXME: this desperately needs a tag :)
7639 + new->xid = (xid_t)INOTAG_TAG(DX_TAG_NFSD, cred.cr_uid, cred.cr_gid, 0);
7642 rqgi = rqstp->rq_cred.cr_group_info;
7644 diff -NurpP --minimal linux-2.6.34/fs/nfsd/nfs3xdr.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfsd/nfs3xdr.c
7645 --- linux-2.6.34/fs/nfsd/nfs3xdr.c 2010-02-25 11:52:05.000000000 +0100
7646 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfsd/nfs3xdr.c 2010-05-18 18:11:22.000000000 +0200
7650 #include <linux/namei.h>
7651 +#include <linux/vs_tag.h>
7655 @@ -95,6 +96,8 @@ static __be32 *
7656 decode_sattr3(__be32 *p, struct iattr *iap)
7664 @@ -104,12 +107,15 @@ decode_sattr3(__be32 *p, struct iattr *i
7667 iap->ia_valid |= ATTR_UID;
7668 - iap->ia_uid = ntohl(*p++);
7669 + uid = ntohl(*p++);
7672 iap->ia_valid |= ATTR_GID;
7673 - iap->ia_gid = ntohl(*p++);
7674 + gid = ntohl(*p++);
7676 + iap->ia_uid = INOTAG_UID(DX_TAG_NFSD, uid, gid);
7677 + iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid);
7678 + iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0);
7682 @@ -165,8 +171,12 @@ encode_fattr3(struct svc_rqst *rqstp, __
7683 *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
7684 *p++ = htonl((u32) stat->mode);
7685 *p++ = htonl((u32) stat->nlink);
7686 - *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
7687 - *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
7688 + *p++ = htonl((u32) nfsd_ruid(rqstp,
7689 + TAGINO_UID(0 /* FIXME: DX_TAG(dentry->d_inode) */,
7690 + stat->uid, stat->tag)));
7691 + *p++ = htonl((u32) nfsd_rgid(rqstp,
7692 + TAGINO_GID(0 /* FIXME: DX_TAG(dentry->d_inode) */,
7693 + stat->gid, stat->tag)));
7694 if (S_ISLNK(stat->mode) && stat->size > NFS3_MAXPATHLEN) {
7695 p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
7697 diff -NurpP --minimal linux-2.6.34/fs/nfsd/nfs4xdr.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfsd/nfs4xdr.c
7698 --- linux-2.6.34/fs/nfsd/nfs4xdr.c 2010-05-18 15:07:52.000000000 +0200
7699 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfsd/nfs4xdr.c 2010-05-18 18:11:22.000000000 +0200
7701 #include <linux/nfsd_idmap.h>
7702 #include <linux/nfs4_acl.h>
7703 #include <linux/sunrpc/svcauth_gss.h>
7704 +#include <linux/vs_tag.h>
7708 @@ -2043,14 +2044,18 @@ out_acl:
7709 WRITE32(stat.nlink);
7711 if (bmval1 & FATTR4_WORD1_OWNER) {
7712 - status = nfsd4_encode_user(rqstp, stat.uid, &p, &buflen);
7713 + status = nfsd4_encode_user(rqstp,
7714 + TAGINO_UID(DX_TAG(dentry->d_inode),
7715 + stat.uid, stat.tag), &p, &buflen);
7716 if (status == nfserr_resource)
7721 if (bmval1 & FATTR4_WORD1_OWNER_GROUP) {
7722 - status = nfsd4_encode_group(rqstp, stat.gid, &p, &buflen);
7723 + status = nfsd4_encode_group(rqstp,
7724 + TAGINO_GID(DX_TAG(dentry->d_inode),
7725 + stat.gid, stat.tag), &p, &buflen);
7726 if (status == nfserr_resource)
7729 diff -NurpP --minimal linux-2.6.34/fs/nfsd/nfsxdr.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfsd/nfsxdr.c
7730 --- linux-2.6.34/fs/nfsd/nfsxdr.c 2010-02-25 11:52:05.000000000 +0100
7731 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/nfsd/nfsxdr.c 2010-05-18 18:11:22.000000000 +0200
7736 +#include <linux/vs_tag.h>
7738 #define NFSDDBG_FACILITY NFSDDBG_XDR
7740 @@ -88,6 +89,8 @@ static __be32 *
7741 decode_sattr(__be32 *p, struct iattr *iap)
7749 @@ -101,12 +104,15 @@ decode_sattr(__be32 *p, struct iattr *ia
7751 if ((tmp = ntohl(*p++)) != (u32)-1) {
7752 iap->ia_valid |= ATTR_UID;
7753 - iap->ia_uid = tmp;
7756 if ((tmp = ntohl(*p++)) != (u32)-1) {
7757 iap->ia_valid |= ATTR_GID;
7758 - iap->ia_gid = tmp;
7761 + iap->ia_uid = INOTAG_UID(DX_TAG_NFSD, uid, gid);
7762 + iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid);
7763 + iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0);
7764 if ((tmp = ntohl(*p++)) != (u32)-1) {
7765 iap->ia_valid |= ATTR_SIZE;
7767 @@ -151,8 +157,10 @@ encode_fattr(struct svc_rqst *rqstp, __b
7768 *p++ = htonl(nfs_ftypes[type >> 12]);
7769 *p++ = htonl((u32) stat->mode);
7770 *p++ = htonl((u32) stat->nlink);
7771 - *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
7772 - *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
7773 + *p++ = htonl((u32) nfsd_ruid(rqstp,
7774 + TAGINO_UID(DX_TAG(dentry->d_inode), stat->uid, stat->tag)));
7775 + *p++ = htonl((u32) nfsd_rgid(rqstp,
7776 + TAGINO_GID(DX_TAG(dentry->d_inode), stat->gid, stat->tag)));
7778 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
7779 *p++ = htonl(NFS_MAXPATHLEN);
7780 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/dlmglue.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/dlmglue.c
7781 --- linux-2.6.34/fs/ocfs2/dlmglue.c 2010-05-18 15:07:52.000000000 +0200
7782 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/dlmglue.c 2010-05-18 18:11:22.000000000 +0200
7783 @@ -2114,6 +2114,7 @@ static void __ocfs2_stuff_meta_lvb(struc
7784 lvb->lvb_iclusters = cpu_to_be32(oi->ip_clusters);
7785 lvb->lvb_iuid = cpu_to_be32(inode->i_uid);
7786 lvb->lvb_igid = cpu_to_be32(inode->i_gid);
7787 + lvb->lvb_itag = cpu_to_be16(inode->i_tag);
7788 lvb->lvb_imode = cpu_to_be16(inode->i_mode);
7789 lvb->lvb_inlink = cpu_to_be16(inode->i_nlink);
7790 lvb->lvb_iatime_packed =
7791 @@ -2168,6 +2169,7 @@ static void ocfs2_refresh_inode_from_lvb
7793 inode->i_uid = be32_to_cpu(lvb->lvb_iuid);
7794 inode->i_gid = be32_to_cpu(lvb->lvb_igid);
7795 + inode->i_tag = be16_to_cpu(lvb->lvb_itag);
7796 inode->i_mode = be16_to_cpu(lvb->lvb_imode);
7797 inode->i_nlink = be16_to_cpu(lvb->lvb_inlink);
7798 ocfs2_unpack_timespec(&inode->i_atime,
7799 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/dlmglue.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/dlmglue.h
7800 --- linux-2.6.34/fs/ocfs2/dlmglue.h 2009-12-03 20:02:53.000000000 +0100
7801 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/dlmglue.h 2010-05-18 18:11:22.000000000 +0200
7802 @@ -46,7 +46,8 @@ struct ocfs2_meta_lvb {
7805 __be32 lvb_igeneration;
7806 - __be32 lvb_reserved2;
7808 + __be16 lvb_reserved2;
7811 #define OCFS2_QINFO_LVB_VERSION 1
7812 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/file.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/file.c
7813 --- linux-2.6.34/fs/ocfs2/file.c 2010-05-18 15:07:52.000000000 +0200
7814 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/file.c 2010-05-18 18:11:22.000000000 +0200
7815 @@ -963,13 +963,15 @@ int ocfs2_setattr(struct dentry *dentry,
7816 mlog(0, "uid change: %d\n", attr->ia_uid);
7817 if (attr->ia_valid & ATTR_GID)
7818 mlog(0, "gid change: %d\n", attr->ia_gid);
7819 + if (attr->ia_valid & ATTR_TAG)
7820 + mlog(0, "tag change: %d\n", attr->ia_tag);
7821 if (attr->ia_valid & ATTR_SIZE)
7822 mlog(0, "size change...\n");
7823 if (attr->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME))
7824 mlog(0, "time change...\n");
7826 #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \
7827 - | ATTR_GID | ATTR_UID | ATTR_MODE)
7828 + | ATTR_GID | ATTR_UID | ATTR_TAG | ATTR_MODE)
7829 if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) {
7830 mlog(0, "can't handle attrs: 0x%x\n", attr->ia_valid);
7832 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/inode.c
7833 --- linux-2.6.34/fs/ocfs2/inode.c 2010-05-18 15:07:52.000000000 +0200
7834 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/inode.c 2010-05-18 18:11:22.000000000 +0200
7836 #include <linux/highmem.h>
7837 #include <linux/pagemap.h>
7838 #include <linux/quotaops.h>
7839 +#include <linux/vs_tag.h>
7841 #include <asm/byteorder.h>
7843 @@ -78,11 +79,13 @@ void ocfs2_set_inode_flags(struct inode
7845 unsigned int flags = OCFS2_I(inode)->ip_attr;
7847 - inode->i_flags &= ~(S_IMMUTABLE |
7848 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
7849 S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
7851 if (flags & OCFS2_IMMUTABLE_FL)
7852 inode->i_flags |= S_IMMUTABLE;
7853 + if (flags & OCFS2_IXUNLINK_FL)
7854 + inode->i_flags |= S_IXUNLINK;
7856 if (flags & OCFS2_SYNC_FL)
7857 inode->i_flags |= S_SYNC;
7858 @@ -92,25 +95,44 @@ void ocfs2_set_inode_flags(struct inode
7859 inode->i_flags |= S_NOATIME;
7860 if (flags & OCFS2_DIRSYNC_FL)
7861 inode->i_flags |= S_DIRSYNC;
7863 + inode->i_vflags &= ~(V_BARRIER | V_COW);
7865 + if (flags & OCFS2_BARRIER_FL)
7866 + inode->i_vflags |= V_BARRIER;
7867 + if (flags & OCFS2_COW_FL)
7868 + inode->i_vflags |= V_COW;
7871 /* Propagate flags from i_flags to OCFS2_I(inode)->ip_attr */
7872 void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi)
7874 unsigned int flags = oi->vfs_inode.i_flags;
7875 + unsigned int vflags = oi->vfs_inode.i_vflags;
7877 + oi->ip_attr &= ~(OCFS2_SYNC_FL | OCFS2_APPEND_FL |
7878 + OCFS2_IMMUTABLE_FL | OCFS2_IXUNLINK_FL |
7879 + OCFS2_NOATIME_FL | OCFS2_DIRSYNC_FL |
7880 + OCFS2_BARRIER_FL | OCFS2_COW_FL);
7882 + if (flags & S_IMMUTABLE)
7883 + oi->ip_attr |= OCFS2_IMMUTABLE_FL;
7884 + if (flags & S_IXUNLINK)
7885 + oi->ip_attr |= OCFS2_IXUNLINK_FL;
7887 - oi->ip_attr &= ~(OCFS2_SYNC_FL|OCFS2_APPEND_FL|
7888 - OCFS2_IMMUTABLE_FL|OCFS2_NOATIME_FL|OCFS2_DIRSYNC_FL);
7890 oi->ip_attr |= OCFS2_SYNC_FL;
7891 if (flags & S_APPEND)
7892 oi->ip_attr |= OCFS2_APPEND_FL;
7893 - if (flags & S_IMMUTABLE)
7894 - oi->ip_attr |= OCFS2_IMMUTABLE_FL;
7895 if (flags & S_NOATIME)
7896 oi->ip_attr |= OCFS2_NOATIME_FL;
7897 if (flags & S_DIRSYNC)
7898 oi->ip_attr |= OCFS2_DIRSYNC_FL;
7900 + if (vflags & V_BARRIER)
7901 + oi->ip_attr |= OCFS2_BARRIER_FL;
7902 + if (vflags & V_COW)
7903 + oi->ip_attr |= OCFS2_COW_FL;
7906 struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno)
7907 @@ -245,6 +267,8 @@ void ocfs2_populate_inode(struct inode *
7908 struct super_block *sb;
7909 struct ocfs2_super *osb;
7914 mlog_entry("(0x%p, size:%llu)\n", inode,
7915 (unsigned long long)le64_to_cpu(fe->i_size));
7916 @@ -276,8 +300,12 @@ void ocfs2_populate_inode(struct inode *
7917 inode->i_generation = le32_to_cpu(fe->i_generation);
7918 inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
7919 inode->i_mode = le16_to_cpu(fe->i_mode);
7920 - inode->i_uid = le32_to_cpu(fe->i_uid);
7921 - inode->i_gid = le32_to_cpu(fe->i_gid);
7922 + uid = le32_to_cpu(fe->i_uid);
7923 + gid = le32_to_cpu(fe->i_gid);
7924 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
7925 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
7926 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
7927 + /* le16_to_cpu(raw_inode->i_raw_tag)i */ 0);
7929 /* Fast symlinks will have i_size but no allocated clusters. */
7930 if (S_ISLNK(inode->i_mode) && !fe->i_clusters)
7931 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/inode.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/inode.h
7932 --- linux-2.6.34/fs/ocfs2/inode.h 2010-05-18 15:07:52.000000000 +0200
7933 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/inode.h 2010-05-18 18:11:22.000000000 +0200
7934 @@ -152,6 +152,7 @@ struct buffer_head *ocfs2_bread(struct i
7936 void ocfs2_set_inode_flags(struct inode *inode);
7937 void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi);
7938 +int ocfs2_sync_flags(struct inode *inode, int, int);
7940 static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode)
7942 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/ioctl.c
7943 --- linux-2.6.34/fs/ocfs2/ioctl.c 2010-02-25 11:52:06.000000000 +0100
7944 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/ioctl.c 2010-05-18 18:11:22.000000000 +0200
7945 @@ -43,7 +43,41 @@ static int ocfs2_get_inode_attr(struct i
7949 -static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
7950 +int ocfs2_sync_flags(struct inode *inode, int flags, int vflags)
7952 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
7953 + struct buffer_head *bh = NULL;
7954 + handle_t *handle = NULL;
7957 + status = ocfs2_inode_lock(inode, &bh, 1);
7959 + mlog_errno(status);
7962 + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
7963 + if (IS_ERR(handle)) {
7964 + status = PTR_ERR(handle);
7965 + mlog_errno(status);
7969 + inode->i_flags = flags;
7970 + inode->i_vflags = vflags;
7971 + ocfs2_get_inode_flags(OCFS2_I(inode));
7973 + status = ocfs2_mark_inode_dirty(handle, inode, bh);
7975 + mlog_errno(status);
7977 + ocfs2_commit_trans(osb, handle);
7979 + ocfs2_inode_unlock(inode, 1);
7984 +int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
7987 struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode);
7988 @@ -68,6 +102,11 @@ static int ocfs2_set_inode_attr(struct i
7989 if (!S_ISDIR(inode->i_mode))
7990 flags &= ~OCFS2_DIRSYNC_FL;
7992 + if (IS_BARRIER(inode)) {
7993 + vxwprintk_task(1, "messing with the barrier.");
7997 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
7998 if (IS_ERR(handle)) {
7999 status = PTR_ERR(handle);
8000 @@ -109,6 +148,7 @@ bail:
8005 long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
8007 struct inode *inode = filp->f_path.dentry->d_inode;
8008 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/namei.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/namei.c
8009 --- linux-2.6.34/fs/ocfs2/namei.c 2010-05-18 15:07:52.000000000 +0200
8010 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/namei.c 2010-05-18 18:11:22.000000000 +0200
8012 #include <linux/slab.h>
8013 #include <linux/highmem.h>
8014 #include <linux/quotaops.h>
8015 +#include <linux/vs_tag.h>
8017 #define MLOG_MASK_PREFIX ML_NAMEI
8018 #include <cluster/masklog.h>
8019 @@ -490,6 +491,7 @@ static int ocfs2_mknod_locked(struct ocf
8027 @@ -533,8 +535,11 @@ static int ocfs2_mknod_locked(struct ocf
8028 fe->i_blkno = cpu_to_le64(fe_blkno);
8029 fe->i_suballoc_bit = cpu_to_le16(suballoc_bit);
8030 fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot);
8031 - fe->i_uid = cpu_to_le32(inode->i_uid);
8032 - fe->i_gid = cpu_to_le32(inode->i_gid);
8034 + tag = dx_current_fstag(osb->sb);
8035 + fe->i_uid = cpu_to_le32(TAGINO_UID(DX_TAG(inode), inode->i_uid, tag));
8036 + fe->i_gid = cpu_to_le32(TAGINO_GID(DX_TAG(inode), inode->i_gid, tag));
8037 + inode->i_tag = tag;
8038 fe->i_mode = cpu_to_le16(inode->i_mode);
8039 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
8040 fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev));
8041 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/ocfs2_fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/ocfs2_fs.h
8042 --- linux-2.6.34/fs/ocfs2/ocfs2_fs.h 2010-05-18 15:07:52.000000000 +0200
8043 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/ocfs2_fs.h 2010-05-18 18:11:22.000000000 +0200
8044 @@ -231,18 +231,23 @@
8045 #define OCFS2_HAS_REFCOUNT_FL (0x0010)
8047 /* Inode attributes, keep in sync with EXT2 */
8048 -#define OCFS2_SECRM_FL (0x00000001) /* Secure deletion */
8049 -#define OCFS2_UNRM_FL (0x00000002) /* Undelete */
8050 -#define OCFS2_COMPR_FL (0x00000004) /* Compress file */
8051 -#define OCFS2_SYNC_FL (0x00000008) /* Synchronous updates */
8052 -#define OCFS2_IMMUTABLE_FL (0x00000010) /* Immutable file */
8053 -#define OCFS2_APPEND_FL (0x00000020) /* writes to file may only append */
8054 -#define OCFS2_NODUMP_FL (0x00000040) /* do not dump file */
8055 -#define OCFS2_NOATIME_FL (0x00000080) /* do not update atime */
8056 -#define OCFS2_DIRSYNC_FL (0x00010000) /* dirsync behaviour (directories only) */
8057 +#define OCFS2_SECRM_FL FS_SECRM_FL /* Secure deletion */
8058 +#define OCFS2_UNRM_FL FS_UNRM_FL /* Undelete */
8059 +#define OCFS2_COMPR_FL FS_COMPR_FL /* Compress file */
8060 +#define OCFS2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
8061 +#define OCFS2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
8062 +#define OCFS2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
8063 +#define OCFS2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
8064 +#define OCFS2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
8066 -#define OCFS2_FL_VISIBLE (0x000100FF) /* User visible flags */
8067 -#define OCFS2_FL_MODIFIABLE (0x000100FF) /* User modifiable flags */
8068 +#define OCFS2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
8069 +#define OCFS2_IXUNLINK_FL FS_IXUNLINK_FL /* Immutable invert on unlink */
8071 +#define OCFS2_BARRIER_FL FS_BARRIER_FL /* Barrier for chroot() */
8072 +#define OCFS2_COW_FL FS_COW_FL /* Copy on Write marker */
8074 +#define OCFS2_FL_VISIBLE (0x010300FF) /* User visible flags */
8075 +#define OCFS2_FL_MODIFIABLE (0x010300FF) /* User modifiable flags */
8078 * Extent record flags (e_node.leaf.flags)
8079 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/ocfs2.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/ocfs2.h
8080 --- linux-2.6.34/fs/ocfs2/ocfs2.h 2010-05-18 15:07:52.000000000 +0200
8081 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/ocfs2.h 2010-05-18 18:11:22.000000000 +0200
8082 @@ -255,6 +255,7 @@ enum ocfs2_mount_options
8084 OCFS2_MOUNT_USRQUOTA = 1 << 10, /* We support user quotas */
8085 OCFS2_MOUNT_GRPQUOTA = 1 << 11, /* We support group quotas */
8086 + OCFS2_MOUNT_TAGGED = 1 << 12, /* use tagging */
8089 #define OCFS2_OSB_SOFT_RO 0x0001
8090 diff -NurpP --minimal linux-2.6.34/fs/ocfs2/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/super.c
8091 --- linux-2.6.34/fs/ocfs2/super.c 2010-05-18 15:07:52.000000000 +0200
8092 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/ocfs2/super.c 2010-05-18 18:11:22.000000000 +0200
8093 @@ -176,6 +176,7 @@ enum {
8097 + Opt_tag, Opt_notag, Opt_tagid,
8101 @@ -202,6 +203,9 @@ static const match_table_t tokens = {
8102 {Opt_noacl, "noacl"},
8103 {Opt_usrquota, "usrquota"},
8104 {Opt_grpquota, "grpquota"},
8106 + {Opt_notag, "notag"},
8107 + {Opt_tagid, "tagid=%u"},
8111 @@ -612,6 +616,13 @@ static int ocfs2_remount(struct super_bl
8115 + if ((osb->s_mount_opt & OCFS2_MOUNT_TAGGED) !=
8116 + (parsed_options.mount_opt & OCFS2_MOUNT_TAGGED)) {
8118 + mlog(ML_ERROR, "Cannot change tagging on remount\n");
8122 if ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) !=
8123 (parsed_options.mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
8125 @@ -1142,6 +1153,9 @@ static int ocfs2_fill_super(struct super
8127 ocfs2_complete_mount_recovery(osb);
8129 + if (osb->s_mount_opt & OCFS2_MOUNT_TAGGED)
8130 + sb->s_flags |= MS_TAGGED;
8132 if (ocfs2_mount_local(osb))
8133 snprintf(nodestr, sizeof(nodestr), "local");
8135 @@ -1433,6 +1447,20 @@ static int ocfs2_parse_options(struct su
8136 mopt->mount_opt |= OCFS2_MOUNT_NO_POSIX_ACL;
8137 mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
8139 +#ifndef CONFIG_TAGGING_NONE
8141 + mopt->mount_opt |= OCFS2_MOUNT_TAGGED;
8144 + mopt->mount_opt &= ~OCFS2_MOUNT_TAGGED;
8147 +#ifdef CONFIG_PROPAGATE
8150 + mopt->mount_opt |= OCFS2_MOUNT_TAGGED;
8155 "Unrecognized mount option \"%s\" "
8156 diff -NurpP --minimal linux-2.6.34/fs/open.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/open.c
8157 --- linux-2.6.34/fs/open.c 2010-05-18 15:07:52.000000000 +0200
8158 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/open.c 2010-05-19 01:49:29.000000000 +0200
8160 #include <linux/falloc.h>
8161 #include <linux/fs_struct.h>
8162 #include <linux/ima.h>
8163 +#include <linux/vs_base.h>
8164 +#include <linux/vs_limit.h>
8165 +#include <linux/vs_tag.h>
8166 +#include <linux/vs_cowbl.h>
8167 +#include <linux/vserver/dlimit.h>
8169 #include "internal.h"
8171 @@ -38,16 +43,20 @@ int vfs_statfs(struct dentry *dentry, st
8172 int retval = -ENODEV;
8175 + struct super_block *sb = dentry->d_sb;
8178 - if (dentry->d_sb->s_op->statfs) {
8179 + if (sb->s_op->statfs) {
8180 memset(buf, 0, sizeof(*buf));
8181 retval = security_sb_statfs(dentry);
8184 - retval = dentry->d_sb->s_op->statfs(dentry, buf);
8185 + retval = sb->s_op->statfs(dentry, buf);
8186 if (retval == 0 && buf->f_frsize == 0)
8187 buf->f_frsize = buf->f_bsize;
8189 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
8190 + vx_vsi_statfs(sb, buf);
8194 @@ -647,6 +656,10 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, cons
8195 error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);
8199 + error = cow_check_and_break(&path);
8201 + goto dput_and_out;
8202 inode = path.dentry->d_inode;
8204 error = mnt_want_write(path.mnt);
8205 @@ -684,11 +697,11 @@ static int chown_common(struct path *pat
8206 newattrs.ia_valid = ATTR_CTIME;
8207 if (user != (uid_t) -1) {
8208 newattrs.ia_valid |= ATTR_UID;
8209 - newattrs.ia_uid = user;
8210 + newattrs.ia_uid = dx_map_uid(user);
8212 if (group != (gid_t) -1) {
8213 newattrs.ia_valid |= ATTR_GID;
8214 - newattrs.ia_gid = group;
8215 + newattrs.ia_gid = dx_map_gid(group);
8217 if (!S_ISDIR(inode->i_mode))
8218 newattrs.ia_valid |=
8219 @@ -713,6 +726,10 @@ SYSCALL_DEFINE3(chown, const char __user
8220 error = mnt_want_write(path.mnt);
8223 +#ifdef CONFIG_VSERVER_COWBL
8224 + error = cow_check_and_break(&path);
8227 error = chown_common(&path, user, group);
8228 mnt_drop_write(path.mnt);
8230 @@ -738,6 +755,10 @@ SYSCALL_DEFINE5(fchownat, int, dfd, cons
8231 error = mnt_want_write(path.mnt);
8234 +#ifdef CONFIG_VSERVER_COWBL
8235 + error = cow_check_and_break(&path);
8238 error = chown_common(&path, user, group);
8239 mnt_drop_write(path.mnt);
8241 @@ -757,6 +778,10 @@ SYSCALL_DEFINE3(lchown, const char __use
8242 error = mnt_want_write(path.mnt);
8245 +#ifdef CONFIG_VSERVER_COWBL
8246 + error = cow_check_and_break(&path);
8249 error = chown_common(&path, user, group);
8250 mnt_drop_write(path.mnt);
8252 @@ -1003,6 +1028,7 @@ static void __put_unused_fd(struct files
8253 __FD_CLR(fd, fdt->open_fds);
8254 if (fd < files->next_fd)
8255 files->next_fd = fd;
8256 + vx_openfd_dec(fd);
8259 void put_unused_fd(unsigned int fd)
8260 diff -NurpP --minimal linux-2.6.34/fs/proc/array.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/array.c
8261 --- linux-2.6.34/fs/proc/array.c 2010-05-18 15:07:52.000000000 +0200
8262 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/array.c 2010-05-18 18:13:43.000000000 +0200
8264 #include <linux/pid_namespace.h>
8265 #include <linux/ptrace.h>
8266 #include <linux/tracehook.h>
8267 +#include <linux/vs_context.h>
8268 +#include <linux/vs_network.h>
8270 #include <asm/pgtable.h>
8271 #include <asm/processor.h>
8272 @@ -170,6 +172,9 @@ static inline void task_state(struct seq
8274 ppid = pid_alive(p) ?
8275 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
8276 + if (unlikely(vx_current_initpid(p->pid)))
8281 struct task_struct *tracer = tracehook_tracer_task(p);
8282 @@ -287,7 +292,7 @@ static inline void task_sig(struct seq_f
8285 static void render_cap_t(struct seq_file *m, const char *header,
8287 + struct vx_info *vxi, kernel_cap_t *a)
8291 @@ -312,10 +317,11 @@ static inline void task_cap(struct seq_f
8292 cap_bset = cred->cap_bset;
8295 - render_cap_t(m, "CapInh:\t", &cap_inheritable);
8296 - render_cap_t(m, "CapPrm:\t", &cap_permitted);
8297 - render_cap_t(m, "CapEff:\t", &cap_effective);
8298 - render_cap_t(m, "CapBnd:\t", &cap_bset);
8299 + /* FIXME: maybe move the p->vx_info masking to __task_cred() ? */
8300 + render_cap_t(m, "CapInh:\t", p->vx_info, &cap_inheritable);
8301 + render_cap_t(m, "CapPrm:\t", p->vx_info, &cap_permitted);
8302 + render_cap_t(m, "CapEff:\t", p->vx_info, &cap_effective);
8303 + render_cap_t(m, "CapBnd:\t", p->vx_info, &cap_bset);
8306 static inline void task_context_switch_counts(struct seq_file *m,
8307 @@ -337,6 +343,42 @@ static void task_cpus_allowed(struct seq
8308 seq_printf(m, "\n");
8311 +int proc_pid_nsproxy(struct seq_file *m, struct pid_namespace *ns,
8312 + struct pid *pid, struct task_struct *task)
8314 + seq_printf(m, "Proxy:\t%p(%c)\n"
8322 + (task->nsproxy == init_task.nsproxy ? 'I' : '-'),
8323 + atomic_read(&task->nsproxy->count),
8324 + task->nsproxy->uts_ns,
8325 + (task->nsproxy->uts_ns == init_task.nsproxy->uts_ns ? 'I' : '-'),
8326 + task->nsproxy->ipc_ns,
8327 + (task->nsproxy->ipc_ns == init_task.nsproxy->ipc_ns ? 'I' : '-'),
8328 + task->nsproxy->mnt_ns,
8329 + (task->nsproxy->mnt_ns == init_task.nsproxy->mnt_ns ? 'I' : '-'),
8330 + task->nsproxy->pid_ns,
8331 + (task->nsproxy->pid_ns == init_task.nsproxy->pid_ns ? 'I' : '-'),
8332 + task->nsproxy->net_ns,
8333 + (task->nsproxy->net_ns == init_task.nsproxy->net_ns ? 'I' : '-'));
8337 +void task_vs_id(struct seq_file *m, struct task_struct *task)
8339 + if (task_vx_flags(task, VXF_HIDE_VINFO, 0))
8342 + seq_printf(m, "VxID: %d\n", vx_task_xid(task));
8343 + seq_printf(m, "NxID: %d\n", nx_task_nid(task));
8347 int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
8348 struct pid *pid, struct task_struct *task)
8350 @@ -353,6 +395,7 @@ int proc_pid_status(struct seq_file *m,
8352 task_cpus_allowed(m, task);
8353 cpuset_task_status_allowed(m, task);
8354 + task_vs_id(m, task);
8355 #if defined(CONFIG_S390)
8356 task_show_regs(m, task);
8358 @@ -465,6 +508,17 @@ static int do_task_stat(struct seq_file
8359 /* convert nsec -> ticks */
8360 start_time = nsec_to_clock_t(start_time);
8362 + /* fixup start time for virt uptime */
8363 + if (vx_flags(VXF_VIRT_UPTIME, 0)) {
8364 + unsigned long long bias =
8365 + current->vx_info->cvirt.bias_clock;
8367 + if (start_time > bias)
8368 + start_time -= bias;
8373 seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \
8374 %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
8375 %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n",
8376 diff -NurpP --minimal linux-2.6.34/fs/proc/base.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/base.c
8377 --- linux-2.6.34/fs/proc/base.c 2010-05-18 15:07:52.000000000 +0200
8378 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/base.c 2010-05-18 18:11:22.000000000 +0200
8380 #include <linux/pid_namespace.h>
8381 #include <linux/fs_struct.h>
8382 #include <linux/slab.h>
8383 +#include <linux/vs_context.h>
8384 +#include <linux/vs_network.h>
8385 #include "internal.h"
8388 @@ -1043,12 +1045,17 @@ static ssize_t oom_adjust_write(struct f
8392 - if (oom_adjust < task->signal->oom_adj && !capable(CAP_SYS_RESOURCE)) {
8393 + if (oom_adjust < task->signal->oom_adj &&
8394 + !vx_capable(CAP_SYS_RESOURCE, VXC_OOM_ADJUST)) {
8395 unlock_task_sighand(task, &flags);
8396 put_task_struct(task);
8400 + /* prevent guest processes from circumventing the oom killer */
8401 + if (vx_current_xid() && (oom_adjust == OOM_DISABLE))
8402 + oom_adjust = OOM_ADJUST_MIN;
8404 task->signal->oom_adj = oom_adjust;
8406 unlock_task_sighand(task, &flags);
8407 @@ -1088,7 +1095,7 @@ static ssize_t proc_loginuid_write(struc
8411 - if (!capable(CAP_AUDIT_CONTROL))
8412 + if (!vx_capable(CAP_AUDIT_CONTROL, VXC_AUDIT_CONTROL))
8416 @@ -1523,6 +1530,8 @@ static struct inode *proc_pid_make_inode
8417 inode->i_gid = cred->egid;
8420 + /* procfs is xid tagged */
8421 + inode->i_tag = (tag_t)vx_task_xid(task);
8422 security_task_to_inode(task, inode);
8425 @@ -2073,6 +2082,13 @@ static struct dentry *proc_pident_lookup
8429 + /* TODO: maybe we can come up with a generic approach? */
8430 + if (task_vx_flags(task, VXF_HIDE_VINFO, 0) &&
8431 + (dentry->d_name.len == 5) &&
8432 + (!memcmp(dentry->d_name.name, "vinfo", 5) ||
8433 + !memcmp(dentry->d_name.name, "ninfo", 5)))
8437 * Yes, it does not scale. And it should not. Don't add
8438 * new entries into /proc/<tgid>/ without very good reasons.
8439 @@ -2478,7 +2494,7 @@ out_iput:
8440 static struct dentry *proc_base_lookup(struct inode *dir, struct dentry *dentry)
8442 struct dentry *error;
8443 - struct task_struct *task = get_proc_task(dir);
8444 + struct task_struct *task = get_proc_task_real(dir);
8445 const struct pid_entry *p, *last;
8447 error = ERR_PTR(-ENOENT);
8448 @@ -2568,6 +2584,9 @@ static int proc_pid_personality(struct s
8449 static const struct file_operations proc_task_operations;
8450 static const struct inode_operations proc_task_inode_operations;
8452 +extern int proc_pid_vx_info(struct task_struct *, char *);
8453 +extern int proc_pid_nx_info(struct task_struct *, char *);
8455 static const struct pid_entry tgid_base_stuff[] = {
8456 DIR("task", S_IRUGO|S_IXUGO, proc_task_inode_operations, proc_task_operations),
8457 DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
8458 @@ -2627,6 +2646,8 @@ static const struct pid_entry tgid_base_
8459 #ifdef CONFIG_CGROUPS
8460 REG("cgroup", S_IRUGO, proc_cgroup_operations),
8462 + INF("vinfo", S_IRUGO, proc_pid_vx_info),
8463 + INF("ninfo", S_IRUGO, proc_pid_nx_info),
8464 INF("oom_score", S_IRUGO, proc_oom_score),
8465 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_operations),
8466 #ifdef CONFIG_AUDITSYSCALL
8467 @@ -2642,6 +2663,7 @@ static const struct pid_entry tgid_base_
8468 #ifdef CONFIG_TASK_IO_ACCOUNTING
8469 INF("io", S_IRUGO, proc_tgid_io_accounting),
8471 + ONE("nsproxy", S_IRUGO, proc_pid_nsproxy),
8474 static int proc_tgid_base_readdir(struct file * filp,
8475 @@ -2833,7 +2855,7 @@ retry:
8477 pid = find_ge_pid(iter.tgid, ns);
8479 - iter.tgid = pid_nr_ns(pid, ns);
8480 + iter.tgid = pid_unmapped_nr_ns(pid, ns);
8481 iter.task = pid_task(pid, PIDTYPE_PID);
8482 /* What we to know is if the pid we have find is the
8483 * pid of a thread_group_leader. Testing for task
8484 @@ -2863,7 +2885,7 @@ static int proc_pid_fill_cache(struct fi
8485 struct tgid_iter iter)
8487 char name[PROC_NUMBUF];
8488 - int len = snprintf(name, sizeof(name), "%d", iter.tgid);
8489 + int len = snprintf(name, sizeof(name), "%d", vx_map_tgid(iter.tgid));
8490 return proc_fill_cache(filp, dirent, filldir, name, len,
8491 proc_pid_instantiate, iter.task, NULL);
8493 @@ -2872,7 +2894,7 @@ static int proc_pid_fill_cache(struct fi
8494 int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
8496 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
8497 - struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
8498 + struct task_struct *reaper = get_proc_task_real(filp->f_path.dentry->d_inode);
8499 struct tgid_iter iter;
8500 struct pid_namespace *ns;
8502 @@ -2892,6 +2914,8 @@ int proc_pid_readdir(struct file * filp,
8504 iter.tgid += 1, iter = next_tgid(ns, iter)) {
8505 filp->f_pos = iter.tgid + TGID_OFFSET;
8506 + if (!vx_proc_task_visible(iter.task))
8508 if (proc_pid_fill_cache(filp, dirent, filldir, iter) < 0) {
8509 put_task_struct(iter.task);
8511 @@ -3039,6 +3063,8 @@ static struct dentry *proc_task_lookup(s
8512 tid = name_to_int(dentry);
8515 + if (vx_current_initpid(tid))
8518 ns = dentry->d_sb->s_fs_info;
8520 diff -NurpP --minimal linux-2.6.34/fs/proc/generic.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/generic.c
8521 --- linux-2.6.34/fs/proc/generic.c 2010-05-18 15:07:52.000000000 +0200
8522 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/generic.c 2010-05-18 18:11:22.000000000 +0200
8524 #include <linux/bitops.h>
8525 #include <linux/spinlock.h>
8526 #include <linux/completion.h>
8527 +#include <linux/vserver/inode.h>
8528 #include <asm/uaccess.h>
8530 #include "internal.h"
8531 @@ -433,6 +434,8 @@ struct dentry *proc_lookup_de(struct pro
8532 for (de = de->subdir; de ; de = de->next) {
8533 if (de->namelen != dentry->d_name.len)
8535 + if (!vx_hide_check(0, de->vx_flags))
8537 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
8540 @@ -441,6 +444,8 @@ struct dentry *proc_lookup_de(struct pro
8541 spin_unlock(&proc_subdir_lock);
8543 inode = proc_get_inode(dir->i_sb, ino, de);
8544 + /* generic proc entries belong to the host */
8549 @@ -518,6 +523,8 @@ int proc_readdir_de(struct proc_dir_entr
8551 /* filldir passes info to user space */
8553 + if (!vx_hide_check(0, de->vx_flags))
8555 spin_unlock(&proc_subdir_lock);
8556 if (filldir(dirent, de->name, de->namelen, filp->f_pos,
8557 de->low_ino, de->mode >> 12) < 0) {
8558 @@ -525,6 +532,7 @@ int proc_readdir_de(struct proc_dir_entr
8561 spin_lock(&proc_subdir_lock);
8566 @@ -639,6 +647,7 @@ static struct proc_dir_entry *__proc_cre
8568 atomic_set(&ent->count, 1);
8570 + ent->vx_flags = IATTR_PROC_DEFAULT;
8571 spin_lock_init(&ent->pde_unload_lock);
8572 ent->pde_unload_completion = NULL;
8573 INIT_LIST_HEAD(&ent->pde_openers);
8574 @@ -662,7 +671,8 @@ struct proc_dir_entry *proc_symlink(cons
8580 + ent->vx_flags = IATTR_PROC_SYMLINK;
8584 diff -NurpP --minimal linux-2.6.34/fs/proc/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/inode.c
8585 --- linux-2.6.34/fs/proc/inode.c 2010-05-18 15:07:52.000000000 +0200
8586 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/inode.c 2010-05-18 18:11:22.000000000 +0200
8587 @@ -437,6 +437,8 @@ struct inode *proc_get_inode(struct supe
8588 inode->i_uid = de->uid;
8589 inode->i_gid = de->gid;
8592 + PROC_I(inode)->vx_flags = de->vx_flags;
8594 inode->i_size = de->size;
8596 diff -NurpP --minimal linux-2.6.34/fs/proc/internal.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/internal.h
8597 --- linux-2.6.34/fs/proc/internal.h 2010-02-25 11:52:06.000000000 +0100
8598 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/internal.h 2010-05-18 18:11:22.000000000 +0200
8602 #include <linux/proc_fs.h>
8603 +#include <linux/vs_pid.h>
8605 extern struct proc_dir_entry proc_root;
8606 #ifdef CONFIG_PROC_SYSCTL
8607 @@ -51,6 +52,9 @@ extern int proc_pid_status(struct seq_fi
8608 struct pid *pid, struct task_struct *task);
8609 extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
8610 struct pid *pid, struct task_struct *task);
8611 +extern int proc_pid_nsproxy(struct seq_file *m, struct pid_namespace *ns,
8612 + struct pid *pid, struct task_struct *task);
8614 extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
8616 extern const struct file_operations proc_maps_operations;
8617 @@ -68,11 +72,16 @@ static inline struct pid *proc_pid(struc
8618 return PROC_I(inode)->pid;
8621 -static inline struct task_struct *get_proc_task(struct inode *inode)
8622 +static inline struct task_struct *get_proc_task_real(struct inode *inode)
8624 return get_pid_task(proc_pid(inode), PIDTYPE_PID);
8627 +static inline struct task_struct *get_proc_task(struct inode *inode)
8629 + return vx_get_proc_task(inode, proc_pid(inode));
8632 static inline int proc_fd(struct inode *inode)
8634 return PROC_I(inode)->fd;
8635 diff -NurpP --minimal linux-2.6.34/fs/proc/loadavg.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/loadavg.c
8636 --- linux-2.6.34/fs/proc/loadavg.c 2009-09-10 15:26:23.000000000 +0200
8637 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/loadavg.c 2010-05-18 18:11:22.000000000 +0200
8640 static int loadavg_proc_show(struct seq_file *m, void *v)
8642 + unsigned long running;
8643 + unsigned int threads;
8644 unsigned long avnrun[3];
8646 get_avenrun(avnrun, FIXED_1/200, 0);
8648 + if (vx_flags(VXF_VIRT_LOAD, 0)) {
8649 + struct vx_info *vxi = current_vx_info();
8651 + running = atomic_read(&vxi->cvirt.nr_running);
8652 + threads = atomic_read(&vxi->cvirt.nr_threads);
8654 + running = nr_running();
8655 + threads = nr_threads;
8658 seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %ld/%d %d\n",
8659 LOAD_INT(avnrun[0]), LOAD_FRAC(avnrun[0]),
8660 LOAD_INT(avnrun[1]), LOAD_FRAC(avnrun[1]),
8661 LOAD_INT(avnrun[2]), LOAD_FRAC(avnrun[2]),
8662 - nr_running(), nr_threads,
8664 task_active_pid_ns(current)->last_pid);
8667 diff -NurpP --minimal linux-2.6.34/fs/proc/meminfo.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/meminfo.c
8668 --- linux-2.6.34/fs/proc/meminfo.c 2009-12-03 20:02:53.000000000 +0100
8669 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/meminfo.c 2010-05-18 18:11:22.000000000 +0200
8670 @@ -39,7 +39,8 @@ static int meminfo_proc_show(struct seq_
8671 allowed = ((totalram_pages - hugetlb_total_pages())
8672 * sysctl_overcommit_ratio / 100) + total_swap_pages;
8674 - cached = global_page_state(NR_FILE_PAGES) -
8675 + cached = vx_flags(VXF_VIRT_MEM, 0) ?
8676 + vx_vsi_cached(&i) : global_page_state(NR_FILE_PAGES) -
8677 total_swapcache_pages - i.bufferram;
8680 diff -NurpP --minimal linux-2.6.34/fs/proc/root.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/root.c
8681 --- linux-2.6.34/fs/proc/root.c 2010-05-18 15:07:52.000000000 +0200
8682 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/root.c 2010-05-18 18:11:22.000000000 +0200
8684 #include <linux/bitops.h>
8685 #include <linux/mount.h>
8686 #include <linux/pid_namespace.h>
8687 +#include <linux/vserver/inode.h>
8689 #include "internal.h"
8691 +struct proc_dir_entry *proc_virtual;
8693 +extern void proc_vx_init(void);
8695 static int proc_test_super(struct super_block *sb, void *data)
8697 return sb->s_fs_info == data;
8698 @@ -136,6 +141,7 @@ void __init proc_root_init(void)
8700 proc_mkdir("bus", NULL);
8705 static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
8706 @@ -203,6 +209,7 @@ struct proc_dir_entry proc_root = {
8707 .proc_iops = &proc_root_inode_operations,
8708 .proc_fops = &proc_root_operations,
8709 .parent = &proc_root,
8710 + .vx_flags = IATTR_ADMIN | IATTR_WATCH,
8713 int pid_ns_prepare_proc(struct pid_namespace *ns)
8714 diff -NurpP --minimal linux-2.6.34/fs/proc/uptime.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/uptime.c
8715 --- linux-2.6.34/fs/proc/uptime.c 2009-12-03 20:02:53.000000000 +0100
8716 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/proc/uptime.c 2010-05-18 18:11:22.000000000 +0200
8718 #include <linux/sched.h>
8719 #include <linux/seq_file.h>
8720 #include <linux/time.h>
8721 -#include <linux/kernel_stat.h>
8722 +#include <linux/vserver/cvirt.h>
8723 #include <asm/cputime.h>
8725 static int uptime_proc_show(struct seq_file *m, void *v)
8727 struct timespec uptime;
8728 struct timespec idle;
8730 - cputime_t idletime = cputime_zero;
8732 - for_each_possible_cpu(i)
8733 - idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle);
8734 + cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
8736 do_posix_clock_monotonic_gettime(&uptime);
8737 monotonic_to_bootbased(&uptime);
8738 cputime_to_timespec(idletime, &idle);
8740 + if (vx_flags(VXF_VIRT_UPTIME, 0))
8741 + vx_vsi_uptime(&uptime, &idle);
8743 seq_printf(m, "%lu.%02lu %lu.%02lu\n",
8744 (unsigned long) uptime.tv_sec,
8745 (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
8746 diff -NurpP --minimal linux-2.6.34/fs/quota/quota.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/quota/quota.c
8747 --- linux-2.6.34/fs/quota/quota.c 2010-05-18 15:07:52.000000000 +0200
8748 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/quota/quota.c 2010-05-18 18:11:22.000000000 +0200
8750 #include <linux/fs.h>
8751 #include <linux/namei.h>
8752 #include <linux/slab.h>
8753 +#include <linux/vs_context.h>
8754 #include <asm/current.h>
8755 #include <asm/uaccess.h>
8756 #include <linux/kernel.h>
8757 @@ -38,7 +39,7 @@ static int check_quotactl_permission(str
8761 - if (!capable(CAP_SYS_ADMIN))
8762 + if (!vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
8766 @@ -275,6 +276,46 @@ static int do_quotactl(struct super_bloc
8770 +#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
8772 +#include <linux/vroot.h>
8773 +#include <linux/major.h>
8774 +#include <linux/module.h>
8775 +#include <linux/kallsyms.h>
8776 +#include <linux/vserver/debug.h>
8778 +static vroot_grb_func *vroot_get_real_bdev = NULL;
8780 +static spinlock_t vroot_grb_lock = SPIN_LOCK_UNLOCKED;
8782 +int register_vroot_grb(vroot_grb_func *func) {
8785 + spin_lock(&vroot_grb_lock);
8786 + if (!vroot_get_real_bdev) {
8787 + vroot_get_real_bdev = func;
8790 + spin_unlock(&vroot_grb_lock);
8793 +EXPORT_SYMBOL(register_vroot_grb);
8795 +int unregister_vroot_grb(vroot_grb_func *func) {
8796 + int ret = -EINVAL;
8798 + spin_lock(&vroot_grb_lock);
8799 + if (vroot_get_real_bdev) {
8800 + vroot_get_real_bdev = NULL;
8803 + spin_unlock(&vroot_grb_lock);
8806 +EXPORT_SYMBOL(unregister_vroot_grb);
8811 * look up a superblock on which quota ops will be performed
8812 * - use the name of a block device to find the superblock thereon
8813 @@ -292,6 +333,22 @@ static struct super_block *quotactl_bloc
8816 return ERR_CAST(bdev);
8817 +#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
8818 + if (bdev && bdev->bd_inode &&
8819 + imajor(bdev->bd_inode) == VROOT_MAJOR) {
8820 + struct block_device *bdnew = (void *)-EINVAL;
8822 + if (vroot_get_real_bdev)
8823 + bdnew = vroot_get_real_bdev(bdev);
8825 + vxdprintk(VXD_CBIT(misc, 0),
8826 + "vroot_get_real_bdev not set");
8828 + if (IS_ERR(bdnew))
8829 + return ERR_PTR(PTR_ERR(bdnew));
8833 sb = get_super(bdev);
8836 diff -NurpP --minimal linux-2.6.34/fs/reiserfs/file.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/file.c
8837 --- linux-2.6.34/fs/reiserfs/file.c 2010-05-18 15:07:52.000000000 +0200
8838 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/file.c 2010-05-18 18:11:22.000000000 +0200
8839 @@ -307,4 +307,5 @@ const struct inode_operations reiserfs_f
8840 .listxattr = reiserfs_listxattr,
8841 .removexattr = reiserfs_removexattr,
8842 .permission = reiserfs_permission,
8843 + .sync_flags = reiserfs_sync_flags,
8845 diff -NurpP --minimal linux-2.6.34/fs/reiserfs/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/inode.c
8846 --- linux-2.6.34/fs/reiserfs/inode.c 2010-05-18 15:07:52.000000000 +0200
8847 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/inode.c 2010-05-18 18:11:22.000000000 +0200
8849 #include <linux/writeback.h>
8850 #include <linux/quotaops.h>
8851 #include <linux/swap.h>
8852 +#include <linux/vs_tag.h>
8854 int reiserfs_commit_write(struct file *f, struct page *page,
8855 unsigned from, unsigned to);
8856 @@ -1125,6 +1126,8 @@ static void init_inode(struct inode *ino
8857 struct buffer_head *bh;
8858 struct item_head *ih;
8862 //int version = ITEM_VERSION_1;
8864 bh = PATH_PLAST_BUFFER(path);
8865 @@ -1146,12 +1149,13 @@ static void init_inode(struct inode *ino
8866 (struct stat_data_v1 *)B_I_PITEM(bh, ih);
8867 unsigned long blocks;
8869 + uid = sd_v1_uid(sd);
8870 + gid = sd_v1_gid(sd);
8872 set_inode_item_key_version(inode, KEY_FORMAT_3_5);
8873 set_inode_sd_version(inode, STAT_DATA_V1);
8874 inode->i_mode = sd_v1_mode(sd);
8875 inode->i_nlink = sd_v1_nlink(sd);
8876 - inode->i_uid = sd_v1_uid(sd);
8877 - inode->i_gid = sd_v1_gid(sd);
8878 inode->i_size = sd_v1_size(sd);
8879 inode->i_atime.tv_sec = sd_v1_atime(sd);
8880 inode->i_mtime.tv_sec = sd_v1_mtime(sd);
8881 @@ -1193,11 +1197,12 @@ static void init_inode(struct inode *ino
8882 // (directories and symlinks)
8883 struct stat_data *sd = (struct stat_data *)B_I_PITEM(bh, ih);
8885 + uid = sd_v2_uid(sd);
8886 + gid = sd_v2_gid(sd);
8888 inode->i_mode = sd_v2_mode(sd);
8889 inode->i_nlink = sd_v2_nlink(sd);
8890 - inode->i_uid = sd_v2_uid(sd);
8891 inode->i_size = sd_v2_size(sd);
8892 - inode->i_gid = sd_v2_gid(sd);
8893 inode->i_mtime.tv_sec = sd_v2_mtime(sd);
8894 inode->i_atime.tv_sec = sd_v2_atime(sd);
8895 inode->i_ctime.tv_sec = sd_v2_ctime(sd);
8896 @@ -1227,6 +1232,10 @@ static void init_inode(struct inode *ino
8897 sd_attrs_to_i_attrs(sd_v2_attrs(sd), inode);
8900 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
8901 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
8902 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid, 0);
8905 if (S_ISREG(inode->i_mode)) {
8906 inode->i_op = &reiserfs_file_inode_operations;
8907 @@ -1249,13 +1258,15 @@ static void init_inode(struct inode *ino
8908 static void inode2sd(void *sd, struct inode *inode, loff_t size)
8910 struct stat_data *sd_v2 = (struct stat_data *)sd;
8911 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
8912 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
8915 + set_sd_v2_uid(sd_v2, uid);
8916 + set_sd_v2_gid(sd_v2, gid);
8917 set_sd_v2_mode(sd_v2, inode->i_mode);
8918 set_sd_v2_nlink(sd_v2, inode->i_nlink);
8919 - set_sd_v2_uid(sd_v2, inode->i_uid);
8920 set_sd_v2_size(sd_v2, size);
8921 - set_sd_v2_gid(sd_v2, inode->i_gid);
8922 set_sd_v2_mtime(sd_v2, inode->i_mtime.tv_sec);
8923 set_sd_v2_atime(sd_v2, inode->i_atime.tv_sec);
8924 set_sd_v2_ctime(sd_v2, inode->i_ctime.tv_sec);
8925 @@ -2856,14 +2867,19 @@ int reiserfs_commit_write(struct file *f
8926 void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode)
8928 if (reiserfs_attrs(inode->i_sb)) {
8929 - if (sd_attrs & REISERFS_SYNC_FL)
8930 - inode->i_flags |= S_SYNC;
8932 - inode->i_flags &= ~S_SYNC;
8933 if (sd_attrs & REISERFS_IMMUTABLE_FL)
8934 inode->i_flags |= S_IMMUTABLE;
8936 inode->i_flags &= ~S_IMMUTABLE;
8937 + if (sd_attrs & REISERFS_IXUNLINK_FL)
8938 + inode->i_flags |= S_IXUNLINK;
8940 + inode->i_flags &= ~S_IXUNLINK;
8942 + if (sd_attrs & REISERFS_SYNC_FL)
8943 + inode->i_flags |= S_SYNC;
8945 + inode->i_flags &= ~S_SYNC;
8946 if (sd_attrs & REISERFS_APPEND_FL)
8947 inode->i_flags |= S_APPEND;
8949 @@ -2876,6 +2892,15 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs,
8950 REISERFS_I(inode)->i_flags |= i_nopack_mask;
8952 REISERFS_I(inode)->i_flags &= ~i_nopack_mask;
8954 + if (sd_attrs & REISERFS_BARRIER_FL)
8955 + inode->i_vflags |= V_BARRIER;
8957 + inode->i_vflags &= ~V_BARRIER;
8958 + if (sd_attrs & REISERFS_COW_FL)
8959 + inode->i_vflags |= V_COW;
8961 + inode->i_vflags &= ~V_COW;
8965 @@ -2886,6 +2911,11 @@ void i_attrs_to_sd_attrs(struct inode *i
8966 *sd_attrs |= REISERFS_IMMUTABLE_FL;
8968 *sd_attrs &= ~REISERFS_IMMUTABLE_FL;
8969 + if (inode->i_flags & S_IXUNLINK)
8970 + *sd_attrs |= REISERFS_IXUNLINK_FL;
8972 + *sd_attrs &= ~REISERFS_IXUNLINK_FL;
8974 if (inode->i_flags & S_SYNC)
8975 *sd_attrs |= REISERFS_SYNC_FL;
8977 @@ -2898,6 +2928,15 @@ void i_attrs_to_sd_attrs(struct inode *i
8978 *sd_attrs |= REISERFS_NOTAIL_FL;
8980 *sd_attrs &= ~REISERFS_NOTAIL_FL;
8982 + if (inode->i_vflags & V_BARRIER)
8983 + *sd_attrs |= REISERFS_BARRIER_FL;
8985 + *sd_attrs &= ~REISERFS_BARRIER_FL;
8986 + if (inode->i_vflags & V_COW)
8987 + *sd_attrs |= REISERFS_COW_FL;
8989 + *sd_attrs &= ~REISERFS_COW_FL;
8993 @@ -3121,9 +3160,11 @@ int reiserfs_setattr(struct dentry *dent
8996 error = inode_change_ok(inode, attr);
8999 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
9000 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
9001 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
9002 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
9003 error = reiserfs_chown_xattrs(inode, attr);
9006 @@ -3152,6 +3193,9 @@ int reiserfs_setattr(struct dentry *dent
9007 inode->i_uid = attr->ia_uid;
9008 if (attr->ia_valid & ATTR_GID)
9009 inode->i_gid = attr->ia_gid;
9010 + if ((attr->ia_valid & ATTR_TAG) &&
9012 + inode->i_tag = attr->ia_tag;
9013 mark_inode_dirty(inode);
9015 journal_end(&th, inode->i_sb, jbegin_count);
9016 diff -NurpP --minimal linux-2.6.34/fs/reiserfs/ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/ioctl.c
9017 --- linux-2.6.34/fs/reiserfs/ioctl.c 2010-02-25 11:52:06.000000000 +0100
9018 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/ioctl.c 2010-05-18 18:11:22.000000000 +0200
9020 #include <linux/mount.h>
9021 #include <linux/reiserfs_fs.h>
9022 #include <linux/time.h>
9023 +#include <linux/mount.h>
9024 #include <asm/uaccess.h>
9025 #include <linux/pagemap.h>
9026 #include <linux/smp_lock.h>
9027 #include <linux/compat.h>
9030 +int reiserfs_sync_flags(struct inode *inode, int flags, int vflags)
9032 + __u16 sd_attrs = 0;
9034 + inode->i_flags = flags;
9035 + inode->i_vflags = vflags;
9037 + i_attrs_to_sd_attrs(inode, &sd_attrs);
9038 + REISERFS_I(inode)->i_attrs = sd_attrs;
9039 + inode->i_ctime = CURRENT_TIME_SEC;
9040 + mark_inode_dirty(inode);
9045 * reiserfs_ioctl - handler for ioctl for inode
9046 * supported commands:
9048 long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
9050 struct inode *inode = filp->f_path.dentry->d_inode;
9051 - unsigned int flags;
9052 + unsigned int flags, oldflags;
9055 reiserfs_write_lock(inode->i_sb);
9056 @@ -48,6 +64,7 @@ long reiserfs_ioctl(struct file *filp, u
9058 flags = REISERFS_I(inode)->i_attrs;
9059 i_attrs_to_sd_attrs(inode, (__u16 *) & flags);
9060 + flags &= REISERFS_FL_USER_VISIBLE;
9061 err = put_user(flags, (int __user *)arg);
9063 case REISERFS_IOC_SETFLAGS:{
9064 @@ -68,6 +85,10 @@ long reiserfs_ioctl(struct file *filp, u
9068 + if (IS_BARRIER(inode)) {
9069 + vxwprintk_task(1, "messing with the barrier.");
9073 * Is it quota file? Do not allow user to mess with it
9075 @@ -92,6 +113,10 @@ long reiserfs_ioctl(struct file *filp, u
9080 + oldflags = REISERFS_I(inode)->i_attrs;
9081 + flags &= REISERFS_FL_USER_MODIFIABLE;
9082 + flags |= oldflags & ~REISERFS_FL_USER_MODIFIABLE;
9083 sd_attrs_to_i_attrs(flags, inode);
9084 REISERFS_I(inode)->i_attrs = flags;
9085 inode->i_ctime = CURRENT_TIME_SEC;
9086 diff -NurpP --minimal linux-2.6.34/fs/reiserfs/namei.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/namei.c
9087 --- linux-2.6.34/fs/reiserfs/namei.c 2010-05-18 15:07:52.000000000 +0200
9088 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/namei.c 2010-05-18 18:11:22.000000000 +0200
9090 #include <linux/reiserfs_acl.h>
9091 #include <linux/reiserfs_xattr.h>
9092 #include <linux/quotaops.h>
9093 +#include <linux/vs_tag.h>
9095 #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; }
9096 #define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i);
9097 @@ -362,6 +363,7 @@ static struct dentry *reiserfs_lookup(st
9098 if (retval == IO_ERROR) {
9099 return ERR_PTR(-EIO);
9101 + dx_propagate_tag(nd, inode);
9103 return d_splice_alias(inode, dentry);
9105 @@ -578,6 +580,7 @@ static int new_inode_init(struct inode *
9107 inode->i_gid = current_fsgid();
9109 + inode->i_tag = dx_current_fstag(inode->i_sb);
9110 dquot_initialize(inode);
9113 @@ -1542,6 +1545,7 @@ const struct inode_operations reiserfs_d
9114 .listxattr = reiserfs_listxattr,
9115 .removexattr = reiserfs_removexattr,
9116 .permission = reiserfs_permission,
9117 + .sync_flags = reiserfs_sync_flags,
9121 diff -NurpP --minimal linux-2.6.34/fs/reiserfs/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/super.c
9122 --- linux-2.6.34/fs/reiserfs/super.c 2010-05-18 15:07:52.000000000 +0200
9123 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/super.c 2010-05-18 18:11:22.000000000 +0200
9124 @@ -887,6 +887,14 @@ static int reiserfs_parse_options(struct
9125 {"user_xattr",.setmask = 1 << REISERFS_UNSUPPORTED_OPT},
9126 {"nouser_xattr",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT},
9128 +#ifndef CONFIG_TAGGING_NONE
9129 + {"tagxid",.setmask = 1 << REISERFS_TAGGED},
9130 + {"tag",.setmask = 1 << REISERFS_TAGGED},
9131 + {"notag",.clrmask = 1 << REISERFS_TAGGED},
9133 +#ifdef CONFIG_PROPAGATE
9134 + {"tag",.arg_required = 'T',.values = NULL},
9136 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
9137 {"acl",.setmask = 1 << REISERFS_POSIXACL},
9138 {"noacl",.clrmask = 1 << REISERFS_POSIXACL},
9139 @@ -1196,6 +1204,14 @@ static int reiserfs_remount(struct super
9140 handle_quota_files(s, qf_names, &qfmt);
9143 + if ((mount_options & (1 << REISERFS_TAGGED)) &&
9144 + !(s->s_flags & MS_TAGGED)) {
9145 + reiserfs_warning(s, "super-vs01",
9146 + "reiserfs: tagging not permitted on remount.");
9153 /* Add options that are safe here */
9154 @@ -1672,6 +1688,10 @@ static int reiserfs_fill_super(struct su
9158 + /* map mount option tagxid */
9159 + if (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TAGGED))
9160 + s->s_flags |= MS_TAGGED;
9162 rs = SB_DISK_SUPER_BLOCK(s);
9163 /* Let's do basic sanity check to verify that underlying device is not
9164 smaller than the filesystem. If the check fails then abort and scream,
9165 diff -NurpP --minimal linux-2.6.34/fs/reiserfs/xattr.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/xattr.c
9166 --- linux-2.6.34/fs/reiserfs/xattr.c 2010-05-18 15:07:52.000000000 +0200
9167 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/reiserfs/xattr.c 2010-05-18 18:11:22.000000000 +0200
9169 #include <linux/errno.h>
9170 #include <linux/gfp.h>
9171 #include <linux/fs.h>
9172 +#include <linux/mount.h>
9173 #include <linux/file.h>
9174 #include <linux/pagemap.h>
9175 #include <linux/xattr.h>
9176 diff -NurpP --minimal linux-2.6.34/fs/stat.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/stat.c
9177 --- linux-2.6.34/fs/stat.c 2010-02-25 11:52:06.000000000 +0100
9178 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/stat.c 2010-05-18 18:11:22.000000000 +0200
9179 @@ -26,6 +26,7 @@ void generic_fillattr(struct inode *inod
9180 stat->nlink = inode->i_nlink;
9181 stat->uid = inode->i_uid;
9182 stat->gid = inode->i_gid;
9183 + stat->tag = inode->i_tag;
9184 stat->rdev = inode->i_rdev;
9185 stat->atime = inode->i_atime;
9186 stat->mtime = inode->i_mtime;
9187 diff -NurpP --minimal linux-2.6.34/fs/super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/super.c
9188 --- linux-2.6.34/fs/super.c 2010-05-18 15:07:52.000000000 +0200
9189 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/super.c 2010-05-18 18:15:42.000000000 +0200
9191 #include <linux/mutex.h>
9192 #include <linux/file.h>
9193 #include <linux/backing-dev.h>
9194 +#include <linux/devpts_fs.h>
9195 +#include <linux/proc_fs.h>
9196 +#include <linux/vs_context.h>
9197 #include <asm/uaccess.h>
9198 #include "internal.h"
9200 @@ -928,12 +931,18 @@ struct vfsmount *
9201 vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
9203 struct vfsmount *mnt;
9204 + struct super_block *sb;
9205 char *secdata = NULL;
9209 return ERR_PTR(-ENODEV);
9212 + if ((type->fs_flags & FS_BINARY_MOUNTDATA) &&
9213 + !vx_capable(CAP_SYS_ADMIN, VXC_BINARY_MOUNT))
9217 mnt = alloc_vfsmnt(name);
9219 @@ -955,10 +964,18 @@ vfs_kern_mount(struct file_system_type *
9220 error = type->get_sb(type, flags, name, data, mnt);
9222 goto out_free_secdata;
9223 - BUG_ON(!mnt->mnt_sb);
9224 - WARN_ON(!mnt->mnt_sb->s_bdi);
9228 + WARN_ON(!sb->s_bdi);
9230 - error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
9232 + if (!vx_capable(CAP_SYS_ADMIN, VXC_BINARY_MOUNT) && !sb->s_bdev &&
9233 + (sb->s_magic != PROC_SUPER_MAGIC) &&
9234 + (sb->s_magic != DEVPTS_SUPER_MAGIC))
9237 + error = security_sb_kern_mount(sb, flags, secdata);
9241 diff -NurpP --minimal linux-2.6.34/fs/sysfs/mount.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/sysfs/mount.c
9242 --- linux-2.6.34/fs/sysfs/mount.c 2010-05-18 15:07:52.000000000 +0200
9243 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/sysfs/mount.c 2010-05-18 18:11:22.000000000 +0200
9244 @@ -47,7 +47,7 @@ static int sysfs_fill_super(struct super
9246 sb->s_blocksize = PAGE_CACHE_SIZE;
9247 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
9248 - sb->s_magic = SYSFS_MAGIC;
9249 + sb->s_magic = SYSFS_SUPER_MAGIC;
9250 sb->s_op = &sysfs_ops;
9251 sb->s_time_gran = 1;
9253 diff -NurpP --minimal linux-2.6.34/fs/utimes.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/utimes.c
9254 --- linux-2.6.34/fs/utimes.c 2009-03-24 14:22:37.000000000 +0100
9255 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/utimes.c 2010-05-18 18:11:22.000000000 +0200
9257 #include <linux/stat.h>
9258 #include <linux/utime.h>
9259 #include <linux/syscalls.h>
9260 +#include <linux/mount.h>
9261 +#include <linux/vs_cowbl.h>
9262 #include <asm/uaccess.h>
9263 #include <asm/unistd.h>
9265 diff -NurpP --minimal linux-2.6.34/fs/xattr.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xattr.c
9266 --- linux-2.6.34/fs/xattr.c 2010-02-25 11:52:06.000000000 +0100
9267 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xattr.c 2010-05-18 18:11:22.000000000 +0200
9269 #include <linux/module.h>
9270 #include <linux/fsnotify.h>
9271 #include <linux/audit.h>
9272 +#include <linux/mount.h>
9273 #include <asm/uaccess.h>
9276 @@ -49,7 +50,7 @@ xattr_permission(struct inode *inode, co
9277 * The trusted.* namespace can only be accessed by a privileged user.
9279 if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
9280 - return (capable(CAP_SYS_ADMIN) ? 0 : -EPERM);
9281 + return (vx_capable(CAP_SYS_ADMIN, VXC_FS_TRUSTED) ? 0 : -EPERM);
9283 /* In user.* namespace, only regular files and directories can have
9284 * extended attributes. For sticky directories, only the owner and
9285 diff -NurpP --minimal linux-2.6.34/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_ioctl.c
9286 --- linux-2.6.34/fs/xfs/linux-2.6/xfs_ioctl.c 2010-05-18 15:07:52.000000000 +0200
9287 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_ioctl.c 2010-05-18 18:11:22.000000000 +0200
9289 #include "xfs_dir2_sf.h"
9290 #include "xfs_dinode.h"
9291 #include "xfs_inode.h"
9292 -#include "xfs_ioctl.h"
9293 #include "xfs_btree.h"
9294 #include "xfs_ialloc.h"
9295 #include "xfs_rtalloc.h"
9296 @@ -744,6 +743,10 @@ xfs_merge_ioc_xflags(
9297 xflags |= XFS_XFLAG_IMMUTABLE;
9299 xflags &= ~XFS_XFLAG_IMMUTABLE;
9300 + if (flags & FS_IXUNLINK_FL)
9301 + xflags |= XFS_XFLAG_IXUNLINK;
9303 + xflags &= ~XFS_XFLAG_IXUNLINK;
9304 if (flags & FS_APPEND_FL)
9305 xflags |= XFS_XFLAG_APPEND;
9307 @@ -772,6 +775,8 @@ xfs_di2lxflags(
9309 if (di_flags & XFS_DIFLAG_IMMUTABLE)
9310 flags |= FS_IMMUTABLE_FL;
9311 + if (di_flags & XFS_DIFLAG_IXUNLINK)
9312 + flags |= FS_IXUNLINK_FL;
9313 if (di_flags & XFS_DIFLAG_APPEND)
9314 flags |= FS_APPEND_FL;
9315 if (di_flags & XFS_DIFLAG_SYNC)
9316 @@ -830,6 +835,8 @@ xfs_set_diflags(
9317 di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC);
9318 if (xflags & XFS_XFLAG_IMMUTABLE)
9319 di_flags |= XFS_DIFLAG_IMMUTABLE;
9320 + if (xflags & XFS_XFLAG_IXUNLINK)
9321 + di_flags |= XFS_DIFLAG_IXUNLINK;
9322 if (xflags & XFS_XFLAG_APPEND)
9323 di_flags |= XFS_DIFLAG_APPEND;
9324 if (xflags & XFS_XFLAG_SYNC)
9325 @@ -872,6 +879,10 @@ xfs_diflags_to_linux(
9326 inode->i_flags |= S_IMMUTABLE;
9328 inode->i_flags &= ~S_IMMUTABLE;
9329 + if (xflags & XFS_XFLAG_IXUNLINK)
9330 + inode->i_flags |= S_IXUNLINK;
9332 + inode->i_flags &= ~S_IXUNLINK;
9333 if (xflags & XFS_XFLAG_APPEND)
9334 inode->i_flags |= S_APPEND;
9336 @@ -1348,10 +1359,18 @@ xfs_file_ioctl(
9337 case XFS_IOC_FSGETXATTRA:
9338 return xfs_ioc_fsgetxattr(ip, 1, arg);
9339 case XFS_IOC_FSSETXATTR:
9340 + if (IS_BARRIER(inode)) {
9341 + vxwprintk_task(1, "messing with the barrier.");
9342 + return -XFS_ERROR(EACCES);
9344 return xfs_ioc_fssetxattr(ip, filp, arg);
9345 case XFS_IOC_GETXFLAGS:
9346 return xfs_ioc_getxflags(ip, arg);
9347 case XFS_IOC_SETXFLAGS:
9348 + if (IS_BARRIER(inode)) {
9349 + vxwprintk_task(1, "messing with the barrier.");
9350 + return -XFS_ERROR(EACCES);
9352 return xfs_ioc_setxflags(ip, filp, arg);
9354 case XFS_IOC_FSSETDM: {
9355 diff -NurpP --minimal linux-2.6.34/fs/xfs/linux-2.6/xfs_ioctl.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_ioctl.h
9356 --- linux-2.6.34/fs/xfs/linux-2.6/xfs_ioctl.h 2010-05-18 15:07:52.000000000 +0200
9357 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_ioctl.h 2010-05-18 18:11:22.000000000 +0200
9358 @@ -70,6 +70,12 @@ xfs_handle_to_dentry(
9359 void __user *uhandle,
9364 + struct inode *inode,
9371 diff -NurpP --minimal linux-2.6.34/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_iops.c
9372 --- linux-2.6.34/fs/xfs/linux-2.6/xfs_iops.c 2010-05-18 15:07:52.000000000 +0200
9373 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_iops.c 2010-05-18 18:11:22.000000000 +0200
9375 #include "xfs_attr_sf.h"
9376 #include "xfs_dinode.h"
9377 #include "xfs_inode.h"
9378 +#include "xfs_ioctl.h"
9379 #include "xfs_bmap.h"
9380 #include "xfs_btree.h"
9381 #include "xfs_ialloc.h"
9383 #include <linux/falloc.h>
9384 #include <linux/fiemap.h>
9385 #include <linux/slab.h>
9386 +#include <linux/vs_tag.h>
9389 * Bring the timestamps in the XFS inode uptodate.
9390 @@ -507,6 +509,7 @@ xfs_vn_getattr(
9391 stat->nlink = ip->i_d.di_nlink;
9392 stat->uid = ip->i_d.di_uid;
9393 stat->gid = ip->i_d.di_gid;
9394 + stat->tag = ip->i_d.di_tag;
9395 stat->ino = ip->i_ino;
9396 stat->atime = inode->i_atime;
9397 stat->mtime = inode->i_mtime;
9398 @@ -698,6 +701,7 @@ static const struct inode_operations xfs
9399 .listxattr = xfs_vn_listxattr,
9400 .fallocate = xfs_vn_fallocate,
9401 .fiemap = xfs_vn_fiemap,
9402 + .sync_flags = xfs_sync_flags,
9405 static const struct inode_operations xfs_dir_inode_operations = {
9406 @@ -723,6 +727,7 @@ static const struct inode_operations xfs
9407 .getxattr = generic_getxattr,
9408 .removexattr = generic_removexattr,
9409 .listxattr = xfs_vn_listxattr,
9410 + .sync_flags = xfs_sync_flags,
9413 static const struct inode_operations xfs_dir_ci_inode_operations = {
9414 @@ -772,6 +777,10 @@ xfs_diflags_to_iflags(
9415 inode->i_flags |= S_IMMUTABLE;
9417 inode->i_flags &= ~S_IMMUTABLE;
9418 + if (ip->i_d.di_flags & XFS_DIFLAG_IXUNLINK)
9419 + inode->i_flags |= S_IXUNLINK;
9421 + inode->i_flags &= ~S_IXUNLINK;
9422 if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
9423 inode->i_flags |= S_APPEND;
9425 @@ -784,6 +793,15 @@ xfs_diflags_to_iflags(
9426 inode->i_flags |= S_NOATIME;
9428 inode->i_flags &= ~S_NOATIME;
9430 + if (ip->i_d.di_vflags & XFS_DIVFLAG_BARRIER)
9431 + inode->i_vflags |= V_BARRIER;
9433 + inode->i_vflags &= ~V_BARRIER;
9434 + if (ip->i_d.di_vflags & XFS_DIVFLAG_COW)
9435 + inode->i_vflags |= V_COW;
9437 + inode->i_vflags &= ~V_COW;
9441 @@ -812,6 +830,7 @@ xfs_setup_inode(
9442 inode->i_nlink = ip->i_d.di_nlink;
9443 inode->i_uid = ip->i_d.di_uid;
9444 inode->i_gid = ip->i_d.di_gid;
9445 + inode->i_tag = ip->i_d.di_tag;
9447 switch (inode->i_mode & S_IFMT) {
9449 diff -NurpP --minimal linux-2.6.34/fs/xfs/linux-2.6/xfs_linux.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_linux.h
9450 --- linux-2.6.34/fs/xfs/linux-2.6/xfs_linux.h 2010-05-18 15:07:52.000000000 +0200
9451 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_linux.h 2010-05-18 18:11:22.000000000 +0200
9454 #define current_cpu() (raw_smp_processor_id())
9455 #define current_pid() (current->pid)
9456 +#define current_fstag(cred,vp) (dx_current_fstag((vp)->i_sb))
9457 #define current_test_flags(f) (current->flags & (f))
9458 #define current_set_flags_nested(sp, f) \
9459 (*(sp) = current->flags, current->flags |= (f))
9460 diff -NurpP --minimal linux-2.6.34/fs/xfs/linux-2.6/xfs_super.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_super.c
9461 --- linux-2.6.34/fs/xfs/linux-2.6/xfs_super.c 2010-05-18 15:07:52.000000000 +0200
9462 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/linux-2.6/xfs_super.c 2010-05-18 18:11:22.000000000 +0200
9463 @@ -119,6 +119,9 @@ mempool_t *xfs_ioend_pool;
9464 #define MNTOPT_DMAPI "dmapi" /* DMI enabled (DMAPI / XDSM) */
9465 #define MNTOPT_XDSM "xdsm" /* DMI enabled (DMAPI / XDSM) */
9466 #define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */
9467 +#define MNTOPT_TAGXID "tagxid" /* context tagging for inodes */
9468 +#define MNTOPT_TAGGED "tag" /* context tagging for inodes */
9469 +#define MNTOPT_NOTAGTAG "notag" /* do not use context tagging */
9472 * Table driven mount option parser.
9473 @@ -127,10 +130,14 @@ mempool_t *xfs_ioend_pool;
9474 * in the future, too.
9477 + Opt_tag, Opt_notag,
9478 Opt_barrier, Opt_nobarrier, Opt_err
9481 static const match_table_t tokens = {
9482 + {Opt_tag, "tagxid"},
9484 + {Opt_notag, "notag"},
9485 {Opt_barrier, "barrier"},
9486 {Opt_nobarrier, "nobarrier"},
9488 @@ -384,6 +391,19 @@ xfs_parseargs(
9489 } else if (!strcmp(this_char, "irixsgid")) {
9491 "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
9492 +#ifndef CONFIG_TAGGING_NONE
9493 + } else if (!strcmp(this_char, MNTOPT_TAGGED)) {
9494 + mp->m_flags |= XFS_MOUNT_TAGGED;
9495 + } else if (!strcmp(this_char, MNTOPT_NOTAGTAG)) {
9496 + mp->m_flags &= ~XFS_MOUNT_TAGGED;
9497 + } else if (!strcmp(this_char, MNTOPT_TAGXID)) {
9498 + mp->m_flags |= XFS_MOUNT_TAGGED;
9500 +#ifdef CONFIG_PROPAGATE
9501 + } else if (!strcmp(this_char, MNTOPT_TAGGED)) {
9503 + mp->m_flags |= XFS_MOUNT_TAGGED;
9507 "XFS: unknown mount option [%s].", this_char);
9508 @@ -1363,6 +1383,16 @@ xfs_fs_remount(
9510 mp->m_flags &= ~XFS_MOUNT_BARRIER;
9513 + if (!(sb->s_flags & MS_TAGGED)) {
9515 + "XFS: %s: tagging not permitted on remount.\n",
9524 * Logically we would return an error here to prevent
9525 @@ -1597,6 +1627,9 @@ xfs_fs_fill_super(
9527 XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, mtpt, mp->m_fsname);
9529 + if (mp->m_flags & XFS_MOUNT_TAGGED)
9530 + sb->s_flags |= MS_TAGGED;
9532 sb->s_magic = XFS_SB_MAGIC;
9533 sb->s_blocksize = mp->m_sb.sb_blocksize;
9534 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1;
9535 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_dinode.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_dinode.h
9536 --- linux-2.6.34/fs/xfs/xfs_dinode.h 2009-06-11 17:13:09.000000000 +0200
9537 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_dinode.h 2010-05-18 18:11:22.000000000 +0200
9538 @@ -50,7 +50,9 @@ typedef struct xfs_dinode {
9539 __be32 di_gid; /* owner's group id */
9540 __be32 di_nlink; /* number of links to file */
9541 __be16 di_projid; /* owner's project id */
9542 - __u8 di_pad[8]; /* unused, zeroed space */
9543 + __be16 di_tag; /* context tagging */
9544 + __be16 di_vflags; /* vserver specific flags */
9545 + __u8 di_pad[4]; /* unused, zeroed space */
9546 __be16 di_flushiter; /* incremented on flush */
9547 xfs_timestamp_t di_atime; /* time last accessed */
9548 xfs_timestamp_t di_mtime; /* time last modified */
9549 @@ -183,6 +185,8 @@ static inline void xfs_dinode_put_rdev(s
9550 #define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
9551 #define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */
9552 #define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */
9553 +#define XFS_DIFLAG_IXUNLINK_BIT 15 /* Immutable inver on unlink */
9555 #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
9556 #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
9557 #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
9558 @@ -198,6 +202,7 @@ static inline void xfs_dinode_put_rdev(s
9559 #define XFS_DIFLAG_EXTSZINHERIT (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
9560 #define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT)
9561 #define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT)
9562 +#define XFS_DIFLAG_IXUNLINK (1 << XFS_DIFLAG_IXUNLINK_BIT)
9564 #ifdef CONFIG_XFS_RT
9565 #define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
9566 @@ -210,6 +215,10 @@ static inline void xfs_dinode_put_rdev(s
9567 XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
9568 XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
9569 XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
9570 - XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM)
9571 + XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM | \
9572 + XFS_DIFLAG_IXUNLINK)
9574 +#define XFS_DIVFLAG_BARRIER 0x01
9575 +#define XFS_DIVFLAG_COW 0x02
9577 #endif /* __XFS_DINODE_H__ */
9578 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_fs.h
9579 --- linux-2.6.34/fs/xfs/xfs_fs.h 2010-05-18 15:07:52.000000000 +0200
9580 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_fs.h 2010-05-18 18:11:22.000000000 +0200
9581 @@ -67,6 +67,9 @@ struct fsxattr {
9582 #define XFS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
9583 #define XFS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
9584 #define XFS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
9585 +#define XFS_XFLAG_IXUNLINK 0x00008000 /* immutable invert on unlink */
9586 +#define XFS_XFLAG_BARRIER 0x10000000 /* chroot() barrier */
9587 +#define XFS_XFLAG_COW 0x20000000 /* copy on write mark */
9588 #define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
9591 @@ -293,7 +296,8 @@ typedef struct xfs_bstat {
9592 __u32 bs_gen; /* generation count */
9593 __u16 bs_projid; /* project id */
9594 __u16 bs_forkoff; /* inode fork offset in bytes */
9595 - unsigned char bs_pad[12]; /* pad space, unused */
9596 + __u16 bs_tag; /* context tagging */
9597 + unsigned char bs_pad[10]; /* pad space, unused */
9598 __u32 bs_dmevmask; /* DMIG event mask */
9599 __u16 bs_dmstate; /* DMIG state info */
9600 __u16 bs_aextents; /* attribute number of extents */
9601 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_ialloc.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_ialloc.c
9602 --- linux-2.6.34/fs/xfs/xfs_ialloc.c 2010-05-18 15:07:52.000000000 +0200
9603 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_ialloc.c 2010-05-18 18:11:22.000000000 +0200
9605 #include "xfs_error.h"
9606 #include "xfs_bmap.h"
9610 * Allocation group level functions.
9612 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_inode.c
9613 --- linux-2.6.34/fs/xfs/xfs_inode.c 2010-05-18 15:07:52.000000000 +0200
9614 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_inode.c 2010-05-18 18:11:22.000000000 +0200
9615 @@ -249,6 +249,7 @@ xfs_inotobp(
9619 +#include <linux/vs_tag.h>
9622 * This routine is called to map an inode to the buffer containing
9623 @@ -654,15 +655,25 @@ xfs_iformat_btree(
9625 xfs_dinode_from_disk(
9627 - xfs_dinode_t *from)
9628 + xfs_dinode_t *from,
9631 + uint32_t uid, gid, tag;
9633 to->di_magic = be16_to_cpu(from->di_magic);
9634 to->di_mode = be16_to_cpu(from->di_mode);
9635 to->di_version = from ->di_version;
9636 to->di_format = from->di_format;
9637 to->di_onlink = be16_to_cpu(from->di_onlink);
9638 - to->di_uid = be32_to_cpu(from->di_uid);
9639 - to->di_gid = be32_to_cpu(from->di_gid);
9641 + uid = be32_to_cpu(from->di_uid);
9642 + gid = be32_to_cpu(from->di_gid);
9643 + tag = be16_to_cpu(from->di_tag);
9645 + to->di_uid = INOTAG_UID(tagged, uid, gid);
9646 + to->di_gid = INOTAG_GID(tagged, uid, gid);
9647 + to->di_tag = INOTAG_TAG(tagged, uid, gid, tag);
9649 to->di_nlink = be32_to_cpu(from->di_nlink);
9650 to->di_projid = be16_to_cpu(from->di_projid);
9651 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
9652 @@ -683,21 +694,26 @@ xfs_dinode_from_disk(
9653 to->di_dmevmask = be32_to_cpu(from->di_dmevmask);
9654 to->di_dmstate = be16_to_cpu(from->di_dmstate);
9655 to->di_flags = be16_to_cpu(from->di_flags);
9656 + to->di_vflags = be16_to_cpu(from->di_vflags);
9657 to->di_gen = be32_to_cpu(from->di_gen);
9663 - xfs_icdinode_t *from)
9664 + xfs_icdinode_t *from,
9667 to->di_magic = cpu_to_be16(from->di_magic);
9668 to->di_mode = cpu_to_be16(from->di_mode);
9669 to->di_version = from ->di_version;
9670 to->di_format = from->di_format;
9671 to->di_onlink = cpu_to_be16(from->di_onlink);
9672 - to->di_uid = cpu_to_be32(from->di_uid);
9673 - to->di_gid = cpu_to_be32(from->di_gid);
9675 + to->di_uid = cpu_to_be32(TAGINO_UID(tagged, from->di_uid, from->di_tag));
9676 + to->di_gid = cpu_to_be32(TAGINO_GID(tagged, from->di_gid, from->di_tag));
9677 + to->di_tag = cpu_to_be16(TAGINO_TAG(tagged, from->di_tag));
9679 to->di_nlink = cpu_to_be32(from->di_nlink);
9680 to->di_projid = cpu_to_be16(from->di_projid);
9681 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
9682 @@ -718,12 +734,14 @@ xfs_dinode_to_disk(
9683 to->di_dmevmask = cpu_to_be32(from->di_dmevmask);
9684 to->di_dmstate = cpu_to_be16(from->di_dmstate);
9685 to->di_flags = cpu_to_be16(from->di_flags);
9686 + to->di_vflags = cpu_to_be16(from->di_vflags);
9687 to->di_gen = cpu_to_be32(from->di_gen);
9692 - __uint16_t di_flags)
9693 + __uint16_t di_flags,
9694 + __uint16_t di_vflags)
9698 @@ -734,6 +752,8 @@ _xfs_dic2xflags(
9699 flags |= XFS_XFLAG_PREALLOC;
9700 if (di_flags & XFS_DIFLAG_IMMUTABLE)
9701 flags |= XFS_XFLAG_IMMUTABLE;
9702 + if (di_flags & XFS_DIFLAG_IXUNLINK)
9703 + flags |= XFS_XFLAG_IXUNLINK;
9704 if (di_flags & XFS_DIFLAG_APPEND)
9705 flags |= XFS_XFLAG_APPEND;
9706 if (di_flags & XFS_DIFLAG_SYNC)
9707 @@ -758,6 +778,10 @@ _xfs_dic2xflags(
9708 flags |= XFS_XFLAG_FILESTREAM;
9711 + if (di_vflags & XFS_DIVFLAG_BARRIER)
9712 + flags |= FS_BARRIER_FL;
9713 + if (di_vflags & XFS_DIVFLAG_COW)
9714 + flags |= FS_COW_FL;
9718 @@ -767,7 +791,7 @@ xfs_ip2xflags(
9720 xfs_icdinode_t *dic = &ip->i_d;
9722 - return _xfs_dic2xflags(dic->di_flags) |
9723 + return _xfs_dic2xflags(dic->di_flags, dic->di_vflags) |
9724 (XFS_IFORK_Q(ip) ? XFS_XFLAG_HASATTR : 0);
9727 @@ -775,7 +799,8 @@ uint
9731 - return _xfs_dic2xflags(be16_to_cpu(dip->di_flags)) |
9732 + return _xfs_dic2xflags(be16_to_cpu(dip->di_flags),
9733 + be16_to_cpu(dip->di_vflags)) |
9734 (XFS_DFORK_Q(dip) ? XFS_XFLAG_HASATTR : 0);
9737 @@ -811,7 +836,6 @@ xfs_iread(
9740 dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);
9743 * If we got something that isn't an inode it means someone
9744 * (nfs or dmi) has a stale handle.
9745 @@ -836,7 +860,8 @@ xfs_iread(
9746 * Otherwise, just get the truly permanent information.
9749 - xfs_dinode_from_disk(&ip->i_d, dip);
9750 + xfs_dinode_from_disk(&ip->i_d, dip,
9751 + mp->m_flags & XFS_MOUNT_TAGGED);
9752 error = xfs_iformat(ip, dip);
9755 @@ -1036,6 +1061,7 @@ xfs_ialloc(
9756 ASSERT(ip->i_d.di_nlink == nlink);
9757 ip->i_d.di_uid = current_fsuid();
9758 ip->i_d.di_gid = current_fsgid();
9759 + ip->i_d.di_tag = current_fstag(cr, &ip->i_vnode);
9760 ip->i_d.di_projid = prid;
9761 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
9763 @@ -1096,6 +1122,7 @@ xfs_ialloc(
9764 ip->i_d.di_dmevmask = 0;
9765 ip->i_d.di_dmstate = 0;
9766 ip->i_d.di_flags = 0;
9767 + ip->i_d.di_vflags = 0;
9768 flags = XFS_ILOG_CORE;
9769 switch (mode & S_IFMT) {
9771 @@ -2137,6 +2164,7 @@ xfs_ifree(
9773 ip->i_d.di_mode = 0; /* mark incore inode as free */
9774 ip->i_d.di_flags = 0;
9775 + ip->i_d.di_vflags = 0;
9776 ip->i_d.di_dmevmask = 0;
9777 ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */
9778 ip->i_df.if_ext_max =
9779 @@ -3006,7 +3034,8 @@ xfs_iflush_int(
9780 * because if the inode is dirty at all the core must
9783 - xfs_dinode_to_disk(dip, &ip->i_d);
9784 + xfs_dinode_to_disk(dip, &ip->i_d,
9785 + mp->m_flags & XFS_MOUNT_TAGGED);
9787 /* Wrap, we never let the log put out DI_MAX_FLUSH */
9788 if (ip->i_d.di_flushiter == DI_MAX_FLUSH)
9789 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_inode.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_inode.h
9790 --- linux-2.6.34/fs/xfs/xfs_inode.h 2010-05-18 15:07:52.000000000 +0200
9791 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_inode.h 2010-05-18 18:11:22.000000000 +0200
9792 @@ -135,7 +135,9 @@ typedef struct xfs_icdinode {
9793 __uint32_t di_gid; /* owner's group id */
9794 __uint32_t di_nlink; /* number of links to file */
9795 __uint16_t di_projid; /* owner's project id */
9796 - __uint8_t di_pad[8]; /* unused, zeroed space */
9797 + __uint16_t di_tag; /* context tagging */
9798 + __uint16_t di_vflags; /* vserver specific flags */
9799 + __uint8_t di_pad[4]; /* unused, zeroed space */
9800 __uint16_t di_flushiter; /* incremented on flush */
9801 xfs_ictimestamp_t di_atime; /* time last accessed */
9802 xfs_ictimestamp_t di_mtime; /* time last modified */
9803 @@ -511,7 +513,7 @@ int xfs_itobp(struct xfs_mount *, struc
9804 int xfs_iread(struct xfs_mount *, struct xfs_trans *,
9805 struct xfs_inode *, xfs_daddr_t, uint);
9806 void xfs_dinode_to_disk(struct xfs_dinode *,
9807 - struct xfs_icdinode *);
9808 + struct xfs_icdinode *, int);
9809 void xfs_idestroy_fork(struct xfs_inode *, int);
9810 void xfs_idata_realloc(struct xfs_inode *, int, int);
9811 void xfs_iroot_realloc(struct xfs_inode *, int, int);
9812 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_itable.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_itable.c
9813 --- linux-2.6.34/fs/xfs/xfs_itable.c 2010-05-18 15:07:52.000000000 +0200
9814 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_itable.c 2010-05-18 18:11:22.000000000 +0200
9815 @@ -84,6 +84,7 @@ xfs_bulkstat_one_iget(
9816 buf->bs_mode = dic->di_mode;
9817 buf->bs_uid = dic->di_uid;
9818 buf->bs_gid = dic->di_gid;
9819 + buf->bs_tag = dic->di_tag;
9820 buf->bs_size = dic->di_size;
9823 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_log_recover.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_log_recover.c
9824 --- linux-2.6.34/fs/xfs/xfs_log_recover.c 2010-05-18 15:07:52.000000000 +0200
9825 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_log_recover.c 2010-05-18 18:11:22.000000000 +0200
9826 @@ -2404,7 +2404,8 @@ xlog_recover_do_inode_trans(
9829 /* The core is in in-core format */
9830 - xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr);
9831 + xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr,
9832 + mp->m_flags & XFS_MOUNT_TAGGED);
9834 /* the rest is in on-disk format */
9835 if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) {
9836 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_mount.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_mount.h
9837 --- linux-2.6.34/fs/xfs/xfs_mount.h 2010-05-18 15:07:52.000000000 +0200
9838 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_mount.h 2010-05-18 18:11:22.000000000 +0200
9839 @@ -301,6 +301,7 @@ typedef struct xfs_mount {
9841 #define XFS_MOUNT_NOATTR2 (1ULL << 25) /* disable use of attr2 format */
9843 +#define XFS_MOUNT_TAGGED (1ULL << 31) /* context tagging */
9846 * Default minimum read and write sizes.
9847 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_vnodeops.c linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_vnodeops.c
9848 --- linux-2.6.34/fs/xfs/xfs_vnodeops.c 2010-05-18 15:07:52.000000000 +0200
9849 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_vnodeops.c 2010-05-18 18:11:22.000000000 +0200
9851 #include "xfs_vnodeops.h"
9852 #include "xfs_trace.h"
9856 +xfs_get_inode_flags(
9859 + struct inode *inode = VFS_I(ip);
9860 + unsigned int flags = inode->i_flags;
9861 + unsigned int vflags = inode->i_vflags;
9863 + if (flags & S_IMMUTABLE)
9864 + ip->i_d.di_flags |= XFS_DIFLAG_IMMUTABLE;
9866 + ip->i_d.di_flags &= ~XFS_DIFLAG_IMMUTABLE;
9867 + if (flags & S_IXUNLINK)
9868 + ip->i_d.di_flags |= XFS_DIFLAG_IXUNLINK;
9870 + ip->i_d.di_flags &= ~XFS_DIFLAG_IXUNLINK;
9872 + if (vflags & V_BARRIER)
9873 + ip->i_d.di_vflags |= XFS_DIVFLAG_BARRIER;
9875 + ip->i_d.di_vflags &= ~XFS_DIVFLAG_BARRIER;
9876 + if (vflags & V_COW)
9877 + ip->i_d.di_vflags |= XFS_DIVFLAG_COW;
9879 + ip->i_d.di_vflags &= ~XFS_DIVFLAG_COW;
9884 + struct inode *inode,
9888 + struct xfs_inode *ip = XFS_I(inode);
9889 + struct xfs_mount *mp = ip->i_mount;
9890 + struct xfs_trans *tp;
9891 + unsigned int lock_flags = 0;
9894 + tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
9895 + code = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0);
9899 + lock_flags = XFS_ILOCK_EXCL;
9900 + xfs_ilock(ip, lock_flags);
9902 + xfs_trans_ijoin(tp, ip, lock_flags);
9903 + xfs_trans_ihold(tp, ip);
9905 + inode->i_flags = flags;
9906 + inode->i_vflags = vflags;
9907 + xfs_get_inode_flags(ip);
9909 + xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
9910 + xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
9912 + XFS_STATS_INC(xs_ig_attrchg);
9914 + if (mp->m_flags & XFS_MOUNT_WSYNC)
9915 + xfs_trans_set_sync(tp);
9916 + code = xfs_trans_commit(tp, 0);
9917 + xfs_iunlock(ip, lock_flags);
9921 + xfs_trans_cancel(tp, 0);
9923 + xfs_iunlock(ip, lock_flags);
9930 struct xfs_inode *ip,
9931 @@ -70,6 +144,7 @@ xfs_setattr(
9932 uint commit_flags=0;
9933 uid_t uid=0, iuid=0;
9934 gid_t gid=0, igid=0;
9935 + tag_t tag=0, itag=0;
9936 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
9937 int need_iolock = 1;
9939 @@ -162,7 +237,7 @@ xfs_setattr(
9941 * Change file ownership. Must be the owner or privileged.
9943 - if (mask & (ATTR_UID|ATTR_GID)) {
9944 + if (mask & (ATTR_UID|ATTR_GID|ATTR_TAG)) {
9946 * These IDs could have changed since we last looked at them.
9947 * But, we're assured that if the ownership did change
9948 @@ -171,8 +246,10 @@ xfs_setattr(
9950 iuid = ip->i_d.di_uid;
9951 igid = ip->i_d.di_gid;
9952 + itag = ip->i_d.di_tag;
9953 gid = (mask & ATTR_GID) ? iattr->ia_gid : igid;
9954 uid = (mask & ATTR_UID) ? iattr->ia_uid : iuid;
9955 + tag = (mask & ATTR_TAG) ? iattr->ia_tag : itag;
9958 * Do a quota reservation only if uid/gid is actually
9959 @@ -180,7 +257,8 @@ xfs_setattr(
9961 if (XFS_IS_QUOTA_RUNNING(mp) &&
9962 ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
9963 - (XFS_IS_GQUOTA_ON(mp) && igid != gid))) {
9964 + (XFS_IS_GQUOTA_ON(mp) && igid != gid) ||
9965 + (XFS_IS_GQUOTA_ON(mp) && itag != tag))) {
9967 code = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp,
9968 capable(CAP_FOWNER) ?
9969 @@ -341,7 +419,7 @@ xfs_setattr(
9971 * Change file ownership. Must be the owner or privileged.
9973 - if (mask & (ATTR_UID|ATTR_GID)) {
9974 + if (mask & (ATTR_UID|ATTR_GID|ATTR_TAG)) {
9976 * CAP_FSETID overrides the following restrictions:
9978 @@ -357,6 +435,10 @@ xfs_setattr(
9979 * Change the ownerships and register quota modifications
9980 * in the transaction.
9982 + if (itag != tag) {
9983 + ip->i_d.di_tag = tag;
9984 + inode->i_tag = tag;
9987 if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_UQUOTA_ON(mp)) {
9988 ASSERT(mask & ATTR_UID);
9989 diff -NurpP --minimal linux-2.6.34/fs/xfs/xfs_vnodeops.h linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_vnodeops.h
9990 --- linux-2.6.34/fs/xfs/xfs_vnodeops.h 2010-05-18 15:07:52.000000000 +0200
9991 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/fs/xfs/xfs_vnodeops.h 2010-05-18 18:11:22.000000000 +0200
9992 @@ -14,6 +14,7 @@ struct xfs_inode;
9996 +int xfs_sync_xflags(struct xfs_inode *ip);
9997 int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags);
9998 #define XFS_ATTR_DMI 0x01 /* invocation from a DMI function */
9999 #define XFS_ATTR_NONBLOCK 0x02 /* return EAGAIN if operation would block */
10000 diff -NurpP --minimal linux-2.6.34/include/asm-generic/tlb.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/asm-generic/tlb.h
10001 --- linux-2.6.34/include/asm-generic/tlb.h 2009-09-10 15:26:24.000000000 +0200
10002 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/asm-generic/tlb.h 2010-05-18 18:11:22.000000000 +0200
10004 #define _ASM_GENERIC__TLB_H
10006 #include <linux/swap.h>
10007 +#include <linux/vs_memory.h>
10008 #include <asm/pgalloc.h>
10009 #include <asm/tlbflush.h>
10011 diff -NurpP --minimal linux-2.6.34/include/linux/capability.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/capability.h
10012 --- linux-2.6.34/include/linux/capability.h 2010-02-25 11:52:07.000000000 +0100
10013 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/capability.h 2010-05-18 18:11:22.000000000 +0200
10014 @@ -283,6 +283,7 @@ struct cpu_vfs_cap_data {
10015 arbitrary SCSI commands */
10016 /* Allow setting encryption key on loopback filesystem */
10017 /* Allow setting zone reclaim policy */
10018 +/* Allow the selection of a security context */
10020 #define CAP_SYS_ADMIN 21
10022 @@ -355,7 +356,13 @@ struct cpu_vfs_cap_data {
10024 #define CAP_MAC_ADMIN 33
10026 -#define CAP_LAST_CAP CAP_MAC_ADMIN
10027 +/* Allow context manipulations */
10028 +/* Allow changing context info on files */
10030 +#define CAP_CONTEXT 34
10033 +#define CAP_LAST_CAP CAP_CONTEXT
10035 #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
10037 diff -NurpP --minimal linux-2.6.34/include/linux/devpts_fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/devpts_fs.h
10038 --- linux-2.6.34/include/linux/devpts_fs.h 2008-12-25 00:26:37.000000000 +0100
10039 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/devpts_fs.h 2010-05-18 18:11:22.000000000 +0200
10040 @@ -45,5 +45,4 @@ static inline void devpts_pty_kill(struc
10045 #endif /* _LINUX_DEVPTS_FS_H */
10046 diff -NurpP --minimal linux-2.6.34/include/linux/ext2_fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/ext2_fs.h
10047 --- linux-2.6.34/include/linux/ext2_fs.h 2010-02-25 11:52:07.000000000 +0100
10048 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/ext2_fs.h 2010-05-18 18:11:22.000000000 +0200
10049 @@ -189,8 +189,12 @@ struct ext2_group_desc
10050 #define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
10051 #define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
10052 #define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
10053 +#define EXT2_IXUNLINK_FL FS_IXUNLINK_FL /* Immutable invert on unlink */
10054 #define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
10056 +#define EXT2_BARRIER_FL FS_BARRIER_FL /* Barrier for chroot() */
10057 +#define EXT2_COW_FL FS_COW_FL /* Copy on Write marker */
10059 #define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
10060 #define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
10062 @@ -274,7 +278,8 @@ struct ext2_inode {
10064 __le16 l_i_uid_high; /* these 2 fields */
10065 __le16 l_i_gid_high; /* were reserved2[0] */
10066 - __u32 l_i_reserved2;
10067 + __le16 l_i_tag; /* Context Tag */
10068 + __u16 l_i_reserved2;
10071 __u8 h_i_frag; /* Fragment number */
10072 @@ -303,6 +308,7 @@ struct ext2_inode {
10073 #define i_gid_low i_gid
10074 #define i_uid_high osd2.linux2.l_i_uid_high
10075 #define i_gid_high osd2.linux2.l_i_gid_high
10076 +#define i_raw_tag osd2.linux2.l_i_tag
10077 #define i_reserved2 osd2.linux2.l_i_reserved2
10080 @@ -347,6 +353,7 @@ struct ext2_inode {
10081 #define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
10082 #define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
10083 #define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
10084 +#define EXT2_MOUNT_TAGGED (1<<24) /* Enable Context Tags */
10087 #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
10088 diff -NurpP --minimal linux-2.6.34/include/linux/ext3_fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/ext3_fs.h
10089 --- linux-2.6.34/include/linux/ext3_fs.h 2010-05-18 15:07:52.000000000 +0200
10090 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/ext3_fs.h 2010-05-18 18:11:22.000000000 +0200
10091 @@ -173,10 +173,14 @@ struct ext3_group_desc
10092 #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
10093 #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
10094 #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
10095 +#define EXT3_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
10096 #define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */
10098 -#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
10099 -#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
10100 +#define EXT3_BARRIER_FL 0x04000000 /* Barrier for chroot() */
10101 +#define EXT3_COW_FL 0x20000000 /* Copy on Write marker */
10103 +#define EXT3_FL_USER_VISIBLE 0x0103DFFF /* User visible flags */
10104 +#define EXT3_FL_USER_MODIFIABLE 0x010380FF /* User modifiable flags */
10106 /* Flags that should be inherited by new inodes from their parent. */
10107 #define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
10108 @@ -312,7 +316,8 @@ struct ext3_inode {
10110 __le16 l_i_uid_high; /* these 2 fields */
10111 __le16 l_i_gid_high; /* were reserved2[0] */
10112 - __u32 l_i_reserved2;
10113 + __le16 l_i_tag; /* Context Tag */
10114 + __u16 l_i_reserved2;
10117 __u8 h_i_frag; /* Fragment number */
10118 @@ -343,6 +348,7 @@ struct ext3_inode {
10119 #define i_gid_low i_gid
10120 #define i_uid_high osd2.linux2.l_i_uid_high
10121 #define i_gid_high osd2.linux2.l_i_gid_high
10122 +#define i_raw_tag osd2.linux2.l_i_tag
10123 #define i_reserved2 osd2.linux2.l_i_reserved2
10125 #elif defined(__GNU__)
10126 @@ -406,6 +412,7 @@ struct ext3_inode {
10127 #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
10128 #define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write
10129 * error in ordered mode */
10130 +#define EXT3_MOUNT_TAGGED (1<<24) /* Enable Context Tags */
10132 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
10133 #ifndef _LINUX_EXT2_FS_H
10134 @@ -909,6 +916,7 @@ extern void ext3_get_inode_flags(struct
10135 extern void ext3_set_aops(struct inode *inode);
10136 extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
10137 u64 start, u64 len);
10138 +extern int ext3_sync_flags(struct inode *, int, int);
10141 extern long ext3_ioctl(struct file *, unsigned int, unsigned long);
10142 diff -NurpP --minimal linux-2.6.34/include/linux/fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/fs.h
10143 --- linux-2.6.34/include/linux/fs.h 2010-05-18 15:07:52.000000000 +0200
10144 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/fs.h 2010-05-18 18:11:22.000000000 +0200
10145 @@ -209,6 +209,9 @@ struct inodes_stat_t {
10146 #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
10147 #define MS_I_VERSION (1<<23) /* Update inode I_version field */
10148 #define MS_STRICTATIME (1<<24) /* Always perform atime updates */
10149 +#define MS_TAGGED (1<<25) /* use generic inode tagging */
10150 +#define MS_TAGID (1<<26) /* use specific tag for this mount */
10151 +#define MS_NOTAGCHECK (1<<27) /* don't check tags */
10152 #define MS_ACTIVE (1<<30)
10153 #define MS_NOUSER (1<<31)
10155 @@ -235,6 +238,14 @@ struct inodes_stat_t {
10156 #define S_NOCMTIME 128 /* Do not update file c/mtime */
10157 #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
10158 #define S_PRIVATE 512 /* Inode is fs-internal */
10159 +#define S_IXUNLINK 1024 /* Immutable Invert on unlink */
10161 +/* Linux-VServer related Inode flags */
10165 +#define V_BARRIER 4 /* Barrier for chroot() */
10166 +#define V_COW 8 /* Copy on Write */
10169 * Note that nosuid etc flags are inode-specific: setting some file-system
10170 @@ -257,12 +268,15 @@ struct inodes_stat_t {
10171 #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
10172 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
10173 #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
10174 -#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
10175 -#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
10176 +#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
10177 +#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
10178 +#define IS_TAGGED(inode) __IS_FLG(inode, MS_TAGGED)
10180 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
10181 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
10182 #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
10183 +#define IS_IXUNLINK(inode) ((inode)->i_flags & S_IXUNLINK)
10184 +#define IS_IXORUNLINK(inode) ((IS_IXUNLINK(inode) ? S_IMMUTABLE : 0) ^ IS_IMMUTABLE(inode))
10185 #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
10187 #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
10188 @@ -270,6 +284,16 @@ struct inodes_stat_t {
10189 #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
10190 #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
10192 +#define IS_BARRIER(inode) (S_ISDIR((inode)->i_mode) && ((inode)->i_vflags & V_BARRIER))
10194 +#ifdef CONFIG_VSERVER_COWBL
10195 +# define IS_COW(inode) (IS_IXUNLINK(inode) && IS_IMMUTABLE(inode))
10196 +# define IS_COW_LINK(inode) (S_ISREG((inode)->i_mode) && ((inode)->i_nlink > 1))
10198 +# define IS_COW(inode) (0)
10199 +# define IS_COW_LINK(inode) (0)
10202 /* the read-only stuff doesn't really belong here, but any other place is
10203 probably as bad and I don't want to create yet another include file. */
10205 @@ -352,11 +376,14 @@ struct inodes_stat_t {
10206 #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
10207 #define FS_EXTENT_FL 0x00080000 /* Extents */
10208 #define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
10209 +#define FS_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
10210 #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
10212 -#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
10213 -#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
10214 +#define FS_BARRIER_FL 0x04000000 /* Barrier for chroot() */
10215 +#define FS_COW_FL 0x20000000 /* Copy on Write marker */
10217 +#define FS_FL_USER_VISIBLE 0x0103DFFF /* User visible flags */
10218 +#define FS_FL_USER_MODIFIABLE 0x010380FF /* User modifiable flags */
10220 #define SYNC_FILE_RANGE_WAIT_BEFORE 1
10221 #define SYNC_FILE_RANGE_WRITE 2
10222 @@ -438,6 +465,7 @@ typedef void (dio_iodone_t)(struct kiocb
10223 #define ATTR_KILL_PRIV (1 << 14)
10224 #define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
10225 #define ATTR_TIMES_SET (1 << 16)
10226 +#define ATTR_TAG (1 << 17)
10229 * This is the Inode Attributes structure, used for notify_change(). It
10230 @@ -453,6 +481,7 @@ struct iattr {
10236 struct timespec ia_atime;
10237 struct timespec ia_mtime;
10238 @@ -466,6 +495,9 @@ struct iattr {
10239 struct file *ia_file;
10242 +#define ATTR_FLAG_BARRIER 512 /* Barrier for chroot() */
10243 +#define ATTR_FLAG_IXUNLINK 1024 /* Immutable invert on unlink */
10246 * Includes for diskquotas.
10248 @@ -731,7 +763,9 @@ struct inode {
10249 unsigned int i_nlink;
10255 unsigned int i_blkbits;
10258 @@ -778,7 +812,8 @@ struct inode {
10259 unsigned long i_state;
10260 unsigned long dirtied_when; /* jiffies of first dirtying */
10262 - unsigned int i_flags;
10263 + unsigned short i_flags;
10264 + unsigned short i_vflags;
10266 atomic_t i_writecount;
10267 #ifdef CONFIG_SECURITY
10268 @@ -866,12 +901,12 @@ static inline void i_size_write(struct i
10270 static inline unsigned iminor(const struct inode *inode)
10272 - return MINOR(inode->i_rdev);
10273 + return MINOR(inode->i_mdev);
10276 static inline unsigned imajor(const struct inode *inode)
10278 - return MAJOR(inode->i_rdev);
10279 + return MAJOR(inode->i_mdev);
10282 extern struct block_device *I_BDEV(struct inode *inode);
10283 @@ -930,6 +965,7 @@ struct file {
10285 struct fown_struct f_owner;
10286 const struct cred *f_cred;
10288 struct file_ra_state f_ra;
10291 @@ -1071,6 +1107,7 @@ struct file_lock {
10292 struct file *fl_file;
10297 struct fasync_struct * fl_fasync; /* for lease break notifications */
10298 unsigned long fl_break_time; /* for nonblocking lease breaks */
10299 @@ -1534,6 +1571,7 @@ struct inode_operations {
10300 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
10301 ssize_t (*listxattr) (struct dentry *, char *, size_t);
10302 int (*removexattr) (struct dentry *, const char *);
10303 + int (*sync_flags) (struct inode *, int, int);
10304 void (*truncate_range)(struct inode *, loff_t, loff_t);
10305 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
10307 @@ -1554,6 +1592,7 @@ extern ssize_t vfs_readv(struct file *,
10308 unsigned long, loff_t *);
10309 extern ssize_t vfs_writev(struct file *, const struct iovec __user *,
10310 unsigned long, loff_t *);
10311 +ssize_t vfs_sendfile(struct file *, struct file *, loff_t *, size_t, loff_t);
10313 struct super_operations {
10314 struct inode *(*alloc_inode)(struct super_block *sb);
10315 @@ -2334,6 +2373,7 @@ extern int dcache_dir_open(struct inode
10316 extern int dcache_dir_close(struct inode *, struct file *);
10317 extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
10318 extern int dcache_readdir(struct file *, void *, filldir_t);
10319 +extern int dcache_readdir_filter(struct file *, void *, filldir_t, int (*)(struct dentry *));
10320 extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
10321 extern int simple_statfs(struct dentry *, struct kstatfs *);
10322 extern int simple_link(struct dentry *, struct inode *, struct dentry *);
10323 diff -NurpP --minimal linux-2.6.34/include/linux/gfs2_ondisk.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/gfs2_ondisk.h
10324 --- linux-2.6.34/include/linux/gfs2_ondisk.h 2010-05-18 15:07:52.000000000 +0200
10325 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/gfs2_ondisk.h 2010-05-18 18:11:22.000000000 +0200
10326 @@ -211,6 +211,9 @@ enum {
10327 gfs2fl_NoAtime = 7,
10330 + gfs2fl_IXUnlink = 16,
10331 + gfs2fl_Barrier = 17,
10333 gfs2fl_TruncInProg = 29,
10334 gfs2fl_InheritDirectio = 30,
10335 gfs2fl_InheritJdata = 31,
10336 @@ -227,6 +230,9 @@ enum {
10337 #define GFS2_DIF_NOATIME 0x00000080
10338 #define GFS2_DIF_SYNC 0x00000100
10339 #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */
10340 +#define GFS2_DIF_IXUNLINK 0x00010000
10341 +#define GFS2_DIF_BARRIER 0x00020000
10342 +#define GFS2_DIF_COW 0x00040000
10343 #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */
10344 #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000
10345 #define GFS2_DIF_INHERIT_JDATA 0x80000000
10346 diff -NurpP --minimal linux-2.6.34/include/linux/if_tun.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/if_tun.h
10347 --- linux-2.6.34/include/linux/if_tun.h 2010-05-18 15:07:52.000000000 +0200
10348 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/if_tun.h 2010-05-18 18:11:22.000000000 +0200
10350 #define TUNSETSNDBUF _IOW('T', 212, int)
10351 #define TUNATTACHFILTER _IOW('T', 213, struct sock_fprog)
10352 #define TUNDETACHFILTER _IOW('T', 214, struct sock_fprog)
10353 +#define TUNSETNID _IOW('T', 215, int)
10355 /* TUNSETIFF ifr flags */
10356 #define IFF_TUN 0x0001
10357 diff -NurpP --minimal linux-2.6.34/include/linux/init_task.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/init_task.h
10358 --- linux-2.6.34/include/linux/init_task.h 2010-05-18 15:07:52.000000000 +0200
10359 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/init_task.h 2010-05-18 18:11:22.000000000 +0200
10360 @@ -172,6 +172,10 @@ extern struct cred init_cred;
10361 INIT_FTRACE_GRAPH \
10362 INIT_TRACE_RECURSION \
10363 INIT_TASK_RCU_PREEMPT(tsk) \
10365 + .vx_info = NULL, \
10367 + .nx_info = NULL, \
10371 diff -NurpP --minimal linux-2.6.34/include/linux/ipc.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/ipc.h
10372 --- linux-2.6.34/include/linux/ipc.h 2009-12-03 20:02:55.000000000 +0100
10373 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/ipc.h 2010-05-18 18:11:22.000000000 +0200
10374 @@ -91,6 +91,7 @@ struct kern_ipc_perm
10382 diff -NurpP --minimal linux-2.6.34/include/linux/Kbuild linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/Kbuild
10383 --- linux-2.6.34/include/linux/Kbuild 2010-05-18 15:07:52.000000000 +0200
10384 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/Kbuild 2010-05-18 18:11:22.000000000 +0200
10385 @@ -386,5 +386,8 @@ unifdef-y += xattr.h
10386 unifdef-y += xfrm.h
10388 objhdr-y += version.h
10390 +header-y += vserver/
10391 header-y += wimax.h
10394 diff -NurpP --minimal linux-2.6.34/include/linux/loop.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/loop.h
10395 --- linux-2.6.34/include/linux/loop.h 2009-09-10 15:26:25.000000000 +0200
10396 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/loop.h 2010-05-18 18:11:22.000000000 +0200
10397 @@ -45,6 +45,7 @@ struct loop_device {
10398 struct loop_func_table *lo_encryption;
10400 uid_t lo_key_owner; /* Who set the key */
10402 int (*ioctl)(struct loop_device *, int cmd,
10403 unsigned long arg);
10405 diff -NurpP --minimal linux-2.6.34/include/linux/magic.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/magic.h
10406 --- linux-2.6.34/include/linux/magic.h 2010-05-18 15:07:52.000000000 +0200
10407 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/magic.h 2010-05-18 18:11:22.000000000 +0200
10410 #define ADFS_SUPER_MAGIC 0xadf5
10411 #define AFFS_SUPER_MAGIC 0xadff
10412 -#define AFS_SUPER_MAGIC 0x5346414F
10413 +#define AFS_SUPER_MAGIC 0x5346414F
10414 #define AUTOFS_SUPER_MAGIC 0x0187
10415 #define CODA_SUPER_MAGIC 0x73757245
10416 #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
10418 #define NFS_SUPER_MAGIC 0x6969
10419 #define OPENPROM_SUPER_MAGIC 0x9fa1
10420 #define PROC_SUPER_MAGIC 0x9fa0
10421 +#define DEVPTS_SUPER_MAGIC 0x1cd1
10422 #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
10424 #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */
10425 diff -NurpP --minimal linux-2.6.34/include/linux/major.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/major.h
10426 --- linux-2.6.34/include/linux/major.h 2009-09-10 15:26:25.000000000 +0200
10427 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/major.h 2010-05-18 18:11:22.000000000 +0200
10429 #define HD_MAJOR IDE0_MAJOR
10430 #define PTY_SLAVE_MAJOR 3
10431 #define TTY_MAJOR 4
10432 +#define VROOT_MAJOR 4
10433 #define TTYAUX_MAJOR 5
10435 #define VCS_MAJOR 7
10436 diff -NurpP --minimal linux-2.6.34/include/linux/memcontrol.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/memcontrol.h
10437 --- linux-2.6.34/include/linux/memcontrol.h 2010-05-18 15:07:52.000000000 +0200
10438 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/memcontrol.h 2010-05-18 18:11:22.000000000 +0200
10439 @@ -76,6 +76,13 @@ int task_in_mem_cgroup(struct task_struc
10440 extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
10441 extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
10443 +extern u64 mem_cgroup_res_read_u64(struct mem_cgroup *mem, int member);
10444 +extern u64 mem_cgroup_memsw_read_u64(struct mem_cgroup *mem, int member);
10446 +extern s64 mem_cgroup_stat_read_cache(struct mem_cgroup *mem);
10447 +extern s64 mem_cgroup_stat_read_anon(struct mem_cgroup *mem);
10448 +extern s64 mem_cgroup_stat_read_mapped(struct mem_cgroup *mem);
10451 int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
10453 diff -NurpP --minimal linux-2.6.34/include/linux/mm_types.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/mm_types.h
10454 --- linux-2.6.34/include/linux/mm_types.h 2010-05-18 15:07:52.000000000 +0200
10455 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/mm_types.h 2010-05-18 18:11:22.000000000 +0200
10456 @@ -269,6 +269,7 @@ struct mm_struct {
10458 /* Architecture-specific MM context */
10459 mm_context_t context;
10460 + struct vx_info *mm_vx_info;
10462 /* Swap token stuff */
10464 diff -NurpP --minimal linux-2.6.34/include/linux/mount.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/mount.h
10465 --- linux-2.6.34/include/linux/mount.h 2010-05-18 15:07:52.000000000 +0200
10466 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/mount.h 2010-05-18 18:11:22.000000000 +0200
10467 @@ -47,6 +47,9 @@ struct mnt_namespace;
10469 #define MNT_INTERNAL 0x4000
10471 +#define MNT_TAGID 0x10000
10472 +#define MNT_NOTAG 0x20000
10475 struct list_head mnt_hash;
10476 struct vfsmount *mnt_parent; /* fs we are mounted on */
10477 @@ -81,6 +84,7 @@ struct vfsmount {
10481 + tag_t mnt_tag; /* tagging used for vfsmount */
10484 static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
10485 diff -NurpP --minimal linux-2.6.34/include/linux/net.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/net.h
10486 --- linux-2.6.34/include/linux/net.h 2010-05-18 15:07:52.000000000 +0200
10487 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/net.h 2010-05-18 18:11:22.000000000 +0200
10488 @@ -70,6 +70,7 @@ struct net;
10489 #define SOCK_NOSPACE 2
10490 #define SOCK_PASSCRED 3
10491 #define SOCK_PASSSEC 4
10492 +#define SOCK_USER_SOCKET 5
10494 #ifndef ARCH_HAS_SOCKET_TYPES
10496 diff -NurpP --minimal linux-2.6.34/include/linux/nfs_mount.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/nfs_mount.h
10497 --- linux-2.6.34/include/linux/nfs_mount.h 2009-03-24 14:22:43.000000000 +0100
10498 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/nfs_mount.h 2010-05-18 18:11:22.000000000 +0200
10499 @@ -63,7 +63,8 @@ struct nfs_mount_data {
10500 #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
10501 #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */
10502 #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */
10503 -#define NFS_MOUNT_FLAGMASK 0xFFFF
10504 +#define NFS_MOUNT_TAGGED 0x10000 /* context tagging */
10505 +#define NFS_MOUNT_FLAGMASK 0x1FFFF
10507 /* The following are for internal use only */
10508 #define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
10509 diff -NurpP --minimal linux-2.6.34/include/linux/nsproxy.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/nsproxy.h
10510 --- linux-2.6.34/include/linux/nsproxy.h 2009-06-11 17:13:17.000000000 +0200
10511 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/nsproxy.h 2010-05-18 18:11:22.000000000 +0200
10514 #include <linux/spinlock.h>
10515 #include <linux/sched.h>
10516 +#include <linux/vserver/debug.h>
10518 struct mnt_namespace;
10519 struct uts_namespace;
10520 @@ -63,22 +64,33 @@ static inline struct nsproxy *task_nspro
10523 int copy_namespaces(unsigned long flags, struct task_struct *tsk);
10524 +struct nsproxy *copy_nsproxy(struct nsproxy *orig);
10525 void exit_task_namespaces(struct task_struct *tsk);
10526 void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
10527 void free_nsproxy(struct nsproxy *ns);
10528 int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
10529 struct fs_struct *);
10531 -static inline void put_nsproxy(struct nsproxy *ns)
10532 +#define get_nsproxy(n) __get_nsproxy(n, __FILE__, __LINE__)
10534 +static inline void __get_nsproxy(struct nsproxy *ns,
10535 + const char *_file, int _line)
10537 - if (atomic_dec_and_test(&ns->count)) {
10538 - free_nsproxy(ns);
10540 + vxlprintk(VXD_CBIT(space, 0), "get_nsproxy(%p[%u])",
10541 + ns, atomic_read(&ns->count), _file, _line);
10542 + atomic_inc(&ns->count);
10545 -static inline void get_nsproxy(struct nsproxy *ns)
10546 +#define put_nsproxy(n) __put_nsproxy(n, __FILE__, __LINE__)
10548 +static inline void __put_nsproxy(struct nsproxy *ns,
10549 + const char *_file, int _line)
10551 - atomic_inc(&ns->count);
10552 + vxlprintk(VXD_CBIT(space, 0), "put_nsproxy(%p[%u])",
10553 + ns, atomic_read(&ns->count), _file, _line);
10554 + if (atomic_dec_and_test(&ns->count)) {
10555 + free_nsproxy(ns);
10559 #ifdef CONFIG_CGROUP_NS
10560 diff -NurpP --minimal linux-2.6.34/include/linux/pid.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/pid.h
10561 --- linux-2.6.34/include/linux/pid.h 2009-03-24 14:22:43.000000000 +0100
10562 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/pid.h 2010-05-18 18:11:22.000000000 +0200
10563 @@ -8,7 +8,8 @@ enum pid_type
10573 @@ -160,6 +161,7 @@ static inline pid_t pid_nr(struct pid *p
10576 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
10577 +pid_t pid_unmapped_nr_ns(struct pid *pid, struct pid_namespace *ns);
10578 pid_t pid_vnr(struct pid *pid);
10580 #define do_each_pid_task(pid, type, task) \
10581 diff -NurpP --minimal linux-2.6.34/include/linux/proc_fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/proc_fs.h
10582 --- linux-2.6.34/include/linux/proc_fs.h 2009-12-03 20:02:56.000000000 +0100
10583 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/proc_fs.h 2010-05-18 18:11:22.000000000 +0200
10584 @@ -56,6 +56,7 @@ struct proc_dir_entry {
10590 const struct inode_operations *proc_iops;
10592 @@ -250,12 +251,18 @@ kclist_add(struct kcore_list *new, void
10593 extern void kclist_add(struct kcore_list *, void *, size_t, int type);
10600 int (*proc_get_link)(struct inode *, struct path *);
10601 int (*proc_read)(struct task_struct *task, char *page);
10602 int (*proc_show)(struct seq_file *m,
10603 struct pid_namespace *ns, struct pid *pid,
10604 struct task_struct *task);
10605 + int (*proc_vs_read)(char *page);
10606 + int (*proc_vxi_read)(struct vx_info *vxi, char *page);
10607 + int (*proc_nxi_read)(struct nx_info *nxi, char *page);
10610 struct ctl_table_header;
10611 @@ -263,6 +270,7 @@ struct ctl_table;
10613 struct proc_inode {
10618 struct proc_dir_entry *pde;
10619 diff -NurpP --minimal linux-2.6.34/include/linux/quotaops.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/quotaops.h
10620 --- linux-2.6.34/include/linux/quotaops.h 2010-05-18 15:07:52.000000000 +0200
10621 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/quotaops.h 2010-05-18 18:11:22.000000000 +0200
10623 #define _LINUX_QUOTAOPS_
10625 #include <linux/fs.h>
10626 +#include <linux/vs_dlimit.h>
10628 static inline struct quota_info *sb_dqopt(struct super_block *sb)
10630 diff -NurpP --minimal linux-2.6.34/include/linux/reboot.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/reboot.h
10631 --- linux-2.6.34/include/linux/reboot.h 2010-05-18 15:07:52.000000000 +0200
10632 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/reboot.h 2010-05-18 18:11:22.000000000 +0200
10634 #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
10635 #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
10636 #define LINUX_REBOOT_CMD_KEXEC 0x45584543
10637 +#define LINUX_REBOOT_CMD_OOM 0xDEADBEEF
10641 diff -NurpP --minimal linux-2.6.34/include/linux/reiserfs_fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/reiserfs_fs.h
10642 --- linux-2.6.34/include/linux/reiserfs_fs.h 2010-05-18 15:07:52.000000000 +0200
10643 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/reiserfs_fs.h 2010-05-18 18:11:22.000000000 +0200
10644 @@ -977,6 +977,11 @@ struct stat_data_v1 {
10645 #define REISERFS_COMPR_FL FS_COMPR_FL
10646 #define REISERFS_NOTAIL_FL FS_NOTAIL_FL
10648 +/* unfortunately reiserfs sdattr is only 16 bit */
10649 +#define REISERFS_IXUNLINK_FL (FS_IXUNLINK_FL >> 16)
10650 +#define REISERFS_BARRIER_FL (FS_BARRIER_FL >> 16)
10651 +#define REISERFS_COW_FL (FS_COW_FL >> 16)
10653 /* persistent flags that file inherits from the parent directory */
10654 #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \
10655 REISERFS_SYNC_FL | \
10656 @@ -986,6 +991,9 @@ struct stat_data_v1 {
10657 REISERFS_COMPR_FL | \
10658 REISERFS_NOTAIL_FL )
10660 +#define REISERFS_FL_USER_VISIBLE 0x80FF
10661 +#define REISERFS_FL_USER_MODIFIABLE 0x80FF
10663 /* Stat Data on disk (reiserfs version of UFS disk inode minus the
10666 @@ -2071,6 +2079,7 @@ static inline void reiserfs_update_sd(st
10667 void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
10668 void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
10669 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
10670 +int reiserfs_sync_flags(struct inode *inode, int, int);
10673 void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
10674 diff -NurpP --minimal linux-2.6.34/include/linux/reiserfs_fs_sb.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/reiserfs_fs_sb.h
10675 --- linux-2.6.34/include/linux/reiserfs_fs_sb.h 2010-02-25 11:52:07.000000000 +0100
10676 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/reiserfs_fs_sb.h 2010-05-18 18:11:22.000000000 +0200
10677 @@ -476,6 +476,7 @@ enum reiserfs_mount_options {
10678 REISERFS_EXPOSE_PRIVROOT,
10679 REISERFS_BARRIER_NONE,
10680 REISERFS_BARRIER_FLUSH,
10683 /* Actions on error */
10684 REISERFS_ERROR_PANIC,
10685 diff -NurpP --minimal linux-2.6.34/include/linux/sched.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sched.h
10686 --- linux-2.6.34/include/linux/sched.h 2010-05-18 15:07:52.000000000 +0200
10687 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sched.h 2010-05-18 18:11:22.000000000 +0200
10688 @@ -1352,6 +1352,14 @@ struct task_struct {
10692 +/* vserver context data */
10693 + struct vx_info *vx_info;
10694 + struct nx_info *nx_info;
10700 /* Thread group tracking */
10701 u32 parent_exec_id;
10703 @@ -1584,6 +1592,11 @@ struct pid_namespace;
10704 pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
10705 struct pid_namespace *ns);
10707 +#include <linux/vserver/base.h>
10708 +#include <linux/vserver/context.h>
10709 +#include <linux/vserver/debug.h>
10710 +#include <linux/vserver/pid.h>
10712 static inline pid_t task_pid_nr(struct task_struct *tsk)
10715 @@ -1597,7 +1610,8 @@ static inline pid_t task_pid_nr_ns(struc
10717 static inline pid_t task_pid_vnr(struct task_struct *tsk)
10719 - return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
10720 + // return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
10721 + return vx_map_pid(__task_pid_nr_ns(tsk, PIDTYPE_PID, NULL));
10725 @@ -1610,7 +1624,7 @@ pid_t task_tgid_nr_ns(struct task_struct
10727 static inline pid_t task_tgid_vnr(struct task_struct *tsk)
10729 - return pid_vnr(task_tgid(tsk));
10730 + return vx_map_tgid(pid_vnr(task_tgid(tsk)));
10734 diff -NurpP --minimal linux-2.6.34/include/linux/shmem_fs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/shmem_fs.h
10735 --- linux-2.6.34/include/linux/shmem_fs.h 2010-02-25 11:52:08.000000000 +0100
10736 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/shmem_fs.h 2010-05-18 18:11:22.000000000 +0200
10739 #define SHMEM_NR_DIRECT 16
10741 +#define TMPFS_SUPER_MAGIC 0x01021994
10744 struct shmem_inode_info {
10746 unsigned long flags;
10747 diff -NurpP --minimal linux-2.6.34/include/linux/stat.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/stat.h
10748 --- linux-2.6.34/include/linux/stat.h 2008-12-25 00:26:37.000000000 +0100
10749 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/stat.h 2010-05-18 18:11:22.000000000 +0200
10750 @@ -66,6 +66,7 @@ struct kstat {
10751 unsigned int nlink;
10757 struct timespec atime;
10758 diff -NurpP --minimal linux-2.6.34/include/linux/sunrpc/auth.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sunrpc/auth.h
10759 --- linux-2.6.34/include/linux/sunrpc/auth.h 2009-12-03 20:02:56.000000000 +0100
10760 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sunrpc/auth.h 2010-05-18 18:11:22.000000000 +0200
10766 struct group_info *group_info;
10767 unsigned char machine_cred : 1;
10769 diff -NurpP --minimal linux-2.6.34/include/linux/sunrpc/clnt.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sunrpc/clnt.h
10770 --- linux-2.6.34/include/linux/sunrpc/clnt.h 2009-12-03 20:02:56.000000000 +0100
10771 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sunrpc/clnt.h 2010-05-18 18:11:22.000000000 +0200
10772 @@ -49,7 +49,8 @@ struct rpc_clnt {
10773 unsigned int cl_softrtry : 1,/* soft timeouts */
10774 cl_discrtry : 1,/* disconnect before retry */
10775 cl_autobind : 1,/* use getport() */
10776 - cl_chatty : 1;/* be verbose */
10777 + cl_chatty : 1,/* be verbose */
10778 + cl_tag : 1;/* context tagging */
10780 struct rpc_rtt * cl_rtt; /* RTO estimator data */
10781 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
10782 diff -NurpP --minimal linux-2.6.34/include/linux/syscalls.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/syscalls.h
10783 --- linux-2.6.34/include/linux/syscalls.h 2010-05-18 15:07:52.000000000 +0200
10784 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/syscalls.h 2010-05-18 18:11:22.000000000 +0200
10785 @@ -500,6 +500,8 @@ asmlinkage long sys_symlink(const char _
10786 asmlinkage long sys_unlink(const char __user *pathname);
10787 asmlinkage long sys_rename(const char __user *oldname,
10788 const char __user *newname);
10789 +asmlinkage long sys_copyfile(const char __user *from, const char __user *to,
10791 asmlinkage long sys_chmod(const char __user *filename, mode_t mode);
10792 asmlinkage long sys_fchmod(unsigned int fd, mode_t mode);
10794 diff -NurpP --minimal linux-2.6.34/include/linux/sysctl.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sysctl.h
10795 --- linux-2.6.34/include/linux/sysctl.h 2010-05-18 15:07:52.000000000 +0200
10796 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sysctl.h 2010-05-18 18:11:22.000000000 +0200
10797 @@ -60,6 +60,7 @@ enum
10798 CTL_ABI=9, /* Binary emulation */
10799 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
10800 CTL_ARLAN=254, /* arlan wireless driver */
10801 + CTL_VSERVER=4242, /* Linux-VServer debug */
10802 CTL_S390DBF=5677, /* s390 debug */
10803 CTL_SUNRPC=7249, /* sunrpc debug */
10804 CTL_PM=9899, /* frv power management */
10805 @@ -94,6 +95,7 @@ enum
10807 KERN_PANIC=15, /* int: panic timeout */
10808 KERN_REALROOTDEV=16, /* real root device to mount after initrd */
10809 + KERN_VSHELPER=17, /* string: path to vshelper policy agent */
10811 KERN_SPARC_REBOOT=21, /* reboot command on Sparc */
10812 KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
10813 diff -NurpP --minimal linux-2.6.34/include/linux/sysfs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sysfs.h
10814 --- linux-2.6.34/include/linux/sysfs.h 2010-05-18 15:07:52.000000000 +0200
10815 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/sysfs.h 2010-05-18 18:11:22.000000000 +0200
10817 #include <linux/lockdep.h>
10818 #include <asm/atomic.h>
10820 +#define SYSFS_SUPER_MAGIC 0x62656572
10825 diff -NurpP --minimal linux-2.6.34/include/linux/time.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/time.h
10826 --- linux-2.6.34/include/linux/time.h 2010-02-25 11:52:08.000000000 +0100
10827 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/time.h 2010-05-18 18:11:22.000000000 +0200
10828 @@ -238,6 +238,9 @@ static __always_inline void timespec_add
10829 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
10833 +#include <linux/vs_time.h>
10835 #endif /* __KERNEL__ */
10837 #define NFDBITS __NFDBITS
10838 diff -NurpP --minimal linux-2.6.34/include/linux/types.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/types.h
10839 --- linux-2.6.34/include/linux/types.h 2009-09-10 15:26:26.000000000 +0200
10840 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/types.h 2010-05-18 18:11:22.000000000 +0200
10841 @@ -37,6 +37,9 @@ typedef __kernel_uid32_t uid_t;
10842 typedef __kernel_gid32_t gid_t;
10843 typedef __kernel_uid16_t uid16_t;
10844 typedef __kernel_gid16_t gid16_t;
10845 +typedef unsigned int xid_t;
10846 +typedef unsigned int nid_t;
10847 +typedef unsigned int tag_t;
10849 typedef unsigned long uintptr_t;
10851 diff -NurpP --minimal linux-2.6.34/include/linux/vroot.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vroot.h
10852 --- linux-2.6.34/include/linux/vroot.h 1970-01-01 01:00:00.000000000 +0100
10853 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vroot.h 2010-05-18 18:11:22.000000000 +0200
10857 + * include/linux/vroot.h
10859 + * written by Herbert Pötzl, 9/11/2002
10860 + * ported to 2.6 by Herbert Pötzl, 30/12/2004
10862 + * Copyright (C) 2002-2007 by Herbert Pötzl.
10863 + * Redistribution of this file is permitted under the
10864 + * GNU General Public License.
10867 +#ifndef _LINUX_VROOT_H
10868 +#define _LINUX_VROOT_H
10873 +/* Possible states of device */
10879 +struct vroot_device {
10883 + struct semaphore vr_ctl_mutex;
10884 + struct block_device *vr_device;
10889 +typedef struct block_device *(vroot_grb_func)(struct block_device *);
10891 +extern int register_vroot_grb(vroot_grb_func *);
10892 +extern int unregister_vroot_grb(vroot_grb_func *);
10894 +#endif /* __KERNEL__ */
10896 +#define MAX_VROOT_DEFAULT 8
10899 + * IOCTL commands --- we will commandeer 0x56 ('V')
10902 +#define VROOT_SET_DEV 0x5600
10903 +#define VROOT_CLR_DEV 0x5601
10905 +#endif /* _LINUX_VROOT_H */
10906 diff -NurpP --minimal linux-2.6.34/include/linux/vs_base.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_base.h
10907 --- linux-2.6.34/include/linux/vs_base.h 1970-01-01 01:00:00.000000000 +0100
10908 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_base.h 2010-05-18 18:11:22.000000000 +0200
10910 +#ifndef _VS_BASE_H
10911 +#define _VS_BASE_H
10913 +#include "vserver/base.h"
10914 +#include "vserver/check.h"
10915 +#include "vserver/debug.h"
10918 +#warning duplicate inclusion
10920 diff -NurpP --minimal linux-2.6.34/include/linux/vs_context.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_context.h
10921 --- linux-2.6.34/include/linux/vs_context.h 1970-01-01 01:00:00.000000000 +0100
10922 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_context.h 2010-05-18 18:11:22.000000000 +0200
10924 +#ifndef _VS_CONTEXT_H
10925 +#define _VS_CONTEXT_H
10927 +#include "vserver/base.h"
10928 +#include "vserver/check.h"
10929 +#include "vserver/context.h"
10930 +#include "vserver/history.h"
10931 +#include "vserver/debug.h"
10933 +#include <linux/sched.h>
10936 +#define get_vx_info(i) __get_vx_info(i, __FILE__, __LINE__, __HERE__)
10938 +static inline struct vx_info *__get_vx_info(struct vx_info *vxi,
10939 + const char *_file, int _line, void *_here)
10944 + vxlprintk(VXD_CBIT(xid, 2), "get_vx_info(%p[#%d.%d])",
10945 + vxi, vxi ? vxi->vx_id : 0,
10946 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
10948 + __vxh_get_vx_info(vxi, _here);
10950 + atomic_inc(&vxi->vx_usecnt);
10955 +extern void free_vx_info(struct vx_info *);
10957 +#define put_vx_info(i) __put_vx_info(i, __FILE__, __LINE__, __HERE__)
10959 +static inline void __put_vx_info(struct vx_info *vxi,
10960 + const char *_file, int _line, void *_here)
10965 + vxlprintk(VXD_CBIT(xid, 2), "put_vx_info(%p[#%d.%d])",
10966 + vxi, vxi ? vxi->vx_id : 0,
10967 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
10969 + __vxh_put_vx_info(vxi, _here);
10971 + if (atomic_dec_and_test(&vxi->vx_usecnt))
10972 + free_vx_info(vxi);
10976 +#define init_vx_info(p, i) \
10977 + __init_vx_info(p, i, __FILE__, __LINE__, __HERE__)
10979 +static inline void __init_vx_info(struct vx_info **vxp, struct vx_info *vxi,
10980 + const char *_file, int _line, void *_here)
10983 + vxlprintk(VXD_CBIT(xid, 3),
10984 + "init_vx_info(%p[#%d.%d])",
10985 + vxi, vxi ? vxi->vx_id : 0,
10986 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
10988 + __vxh_init_vx_info(vxi, vxp, _here);
10990 + atomic_inc(&vxi->vx_usecnt);
10996 +#define set_vx_info(p, i) \
10997 + __set_vx_info(p, i, __FILE__, __LINE__, __HERE__)
10999 +static inline void __set_vx_info(struct vx_info **vxp, struct vx_info *vxi,
11000 + const char *_file, int _line, void *_here)
11002 + struct vx_info *vxo;
11007 + vxlprintk(VXD_CBIT(xid, 3), "set_vx_info(%p[#%d.%d])",
11008 + vxi, vxi ? vxi->vx_id : 0,
11009 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11011 + __vxh_set_vx_info(vxi, vxp, _here);
11013 + atomic_inc(&vxi->vx_usecnt);
11014 + vxo = xchg(vxp, vxi);
11019 +#define clr_vx_info(p) __clr_vx_info(p, __FILE__, __LINE__, __HERE__)
11021 +static inline void __clr_vx_info(struct vx_info **vxp,
11022 + const char *_file, int _line, void *_here)
11024 + struct vx_info *vxo;
11026 + vxo = xchg(vxp, NULL);
11030 + vxlprintk(VXD_CBIT(xid, 3), "clr_vx_info(%p[#%d.%d])",
11031 + vxo, vxo ? vxo->vx_id : 0,
11032 + vxo ? atomic_read(&vxo->vx_usecnt) : 0,
11034 + __vxh_clr_vx_info(vxo, vxp, _here);
11036 + if (atomic_dec_and_test(&vxo->vx_usecnt))
11037 + free_vx_info(vxo);
11041 +#define claim_vx_info(v, p) \
11042 + __claim_vx_info(v, p, __FILE__, __LINE__, __HERE__)
11044 +static inline void __claim_vx_info(struct vx_info *vxi,
11045 + struct task_struct *task,
11046 + const char *_file, int _line, void *_here)
11048 + vxlprintk(VXD_CBIT(xid, 3), "claim_vx_info(%p[#%d.%d.%d]) %p",
11049 + vxi, vxi ? vxi->vx_id : 0,
11050 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11051 + vxi ? atomic_read(&vxi->vx_tasks) : 0,
11052 + task, _file, _line);
11053 + __vxh_claim_vx_info(vxi, task, _here);
11055 + atomic_inc(&vxi->vx_tasks);
11059 +extern void unhash_vx_info(struct vx_info *);
11061 +#define release_vx_info(v, p) \
11062 + __release_vx_info(v, p, __FILE__, __LINE__, __HERE__)
11064 +static inline void __release_vx_info(struct vx_info *vxi,
11065 + struct task_struct *task,
11066 + const char *_file, int _line, void *_here)
11068 + vxlprintk(VXD_CBIT(xid, 3), "release_vx_info(%p[#%d.%d.%d]) %p",
11069 + vxi, vxi ? vxi->vx_id : 0,
11070 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11071 + vxi ? atomic_read(&vxi->vx_tasks) : 0,
11072 + task, _file, _line);
11073 + __vxh_release_vx_info(vxi, task, _here);
11077 + if (atomic_dec_and_test(&vxi->vx_tasks))
11078 + unhash_vx_info(vxi);
11082 +#define task_get_vx_info(p) \
11083 + __task_get_vx_info(p, __FILE__, __LINE__, __HERE__)
11085 +static inline struct vx_info *__task_get_vx_info(struct task_struct *p,
11086 + const char *_file, int _line, void *_here)
11088 + struct vx_info *vxi;
11091 + vxlprintk(VXD_CBIT(xid, 5), "task_get_vx_info(%p)",
11092 + p, _file, _line);
11093 + vxi = __get_vx_info(p->vx_info, _file, _line, _here);
11099 +static inline void __wakeup_vx_info(struct vx_info *vxi)
11101 + if (waitqueue_active(&vxi->vx_wait))
11102 + wake_up_interruptible(&vxi->vx_wait);
11106 +#define enter_vx_info(v, s) __enter_vx_info(v, s, __FILE__, __LINE__)
11108 +static inline void __enter_vx_info(struct vx_info *vxi,
11109 + struct vx_info_save *vxis, const char *_file, int _line)
11111 + vxlprintk(VXD_CBIT(xid, 5), "enter_vx_info(%p[#%d],%p) %p[#%d,%p]",
11112 + vxi, vxi ? vxi->vx_id : 0, vxis, current,
11113 + current->xid, current->vx_info, _file, _line);
11114 + vxis->vxi = xchg(¤t->vx_info, vxi);
11115 + vxis->xid = current->xid;
11116 + current->xid = vxi ? vxi->vx_id : 0;
11119 +#define leave_vx_info(s) __leave_vx_info(s, __FILE__, __LINE__)
11121 +static inline void __leave_vx_info(struct vx_info_save *vxis,
11122 + const char *_file, int _line)
11124 + vxlprintk(VXD_CBIT(xid, 5), "leave_vx_info(%p[#%d,%p]) %p[#%d,%p]",
11125 + vxis, vxis->xid, vxis->vxi, current,
11126 + current->xid, current->vx_info, _file, _line);
11127 + (void)xchg(¤t->vx_info, vxis->vxi);
11128 + current->xid = vxis->xid;
11132 +static inline void __enter_vx_admin(struct vx_info_save *vxis)
11134 + vxis->vxi = xchg(¤t->vx_info, NULL);
11135 + vxis->xid = xchg(¤t->xid, (xid_t)0);
11138 +static inline void __leave_vx_admin(struct vx_info_save *vxis)
11140 + (void)xchg(¤t->xid, vxis->xid);
11141 + (void)xchg(¤t->vx_info, vxis->vxi);
11144 +#define task_is_init(p) \
11145 + __task_is_init(p, __FILE__, __LINE__, __HERE__)
11147 +static inline int __task_is_init(struct task_struct *p,
11148 + const char *_file, int _line, void *_here)
11150 + int is_init = is_global_init(p);
11154 + is_init = p->vx_info->vx_initpid == p->pid;
11159 +extern void exit_vx_info(struct task_struct *, int);
11160 +extern void exit_vx_info_early(struct task_struct *, int);
11164 +#warning duplicate inclusion
11166 diff -NurpP --minimal linux-2.6.34/include/linux/vs_cowbl.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_cowbl.h
11167 --- linux-2.6.34/include/linux/vs_cowbl.h 1970-01-01 01:00:00.000000000 +0100
11168 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_cowbl.h 2010-05-19 02:44:39.000000000 +0200
11170 +#ifndef _VS_COWBL_H
11171 +#define _VS_COWBL_H
11173 +#include <linux/fs.h>
11174 +#include <linux/dcache.h>
11175 +#include <linux/namei.h>
11176 +#include <linux/slab.h>
11178 +extern struct dentry *cow_break_link(const char *pathname);
11180 +static inline int cow_check_and_break(struct path *path)
11182 + struct inode *inode = path->dentry->d_inode;
11185 + /* do we need this check? */
11186 + if (IS_RDONLY(inode))
11189 + if (IS_COW(inode)) {
11190 + if (IS_COW_LINK(inode)) {
11191 + struct dentry *new_dentry, *old_dentry = path->dentry;
11194 + buf = kmalloc(PATH_MAX, GFP_KERNEL);
11198 + pp = d_path(path, buf, PATH_MAX);
11199 + new_dentry = cow_break_link(pp);
11201 + if (!IS_ERR(new_dentry)) {
11202 + path->dentry = new_dentry;
11203 + dput(old_dentry);
11205 + error = PTR_ERR(new_dentry);
11207 + inode->i_flags &= ~(S_IXUNLINK | S_IMMUTABLE);
11208 + inode->i_ctime = CURRENT_TIME;
11209 + mark_inode_dirty(inode);
11216 +#warning duplicate inclusion
11218 diff -NurpP --minimal linux-2.6.34/include/linux/vs_cvirt.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_cvirt.h
11219 --- linux-2.6.34/include/linux/vs_cvirt.h 1970-01-01 01:00:00.000000000 +0100
11220 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_cvirt.h 2010-05-18 18:11:22.000000000 +0200
11222 +#ifndef _VS_CVIRT_H
11223 +#define _VS_CVIRT_H
11225 +#include "vserver/cvirt.h"
11226 +#include "vserver/context.h"
11227 +#include "vserver/base.h"
11228 +#include "vserver/check.h"
11229 +#include "vserver/debug.h"
11232 +static inline void vx_activate_task(struct task_struct *p)
11234 + struct vx_info *vxi;
11236 + if ((vxi = p->vx_info)) {
11237 + vx_update_load(vxi);
11238 + atomic_inc(&vxi->cvirt.nr_running);
11242 +static inline void vx_deactivate_task(struct task_struct *p)
11244 + struct vx_info *vxi;
11246 + if ((vxi = p->vx_info)) {
11247 + vx_update_load(vxi);
11248 + atomic_dec(&vxi->cvirt.nr_running);
11252 +static inline void vx_uninterruptible_inc(struct task_struct *p)
11254 + struct vx_info *vxi;
11256 + if ((vxi = p->vx_info))
11257 + atomic_inc(&vxi->cvirt.nr_uninterruptible);
11260 +static inline void vx_uninterruptible_dec(struct task_struct *p)
11262 + struct vx_info *vxi;
11264 + if ((vxi = p->vx_info))
11265 + atomic_dec(&vxi->cvirt.nr_uninterruptible);
11270 +#warning duplicate inclusion
11272 diff -NurpP --minimal linux-2.6.34/include/linux/vs_device.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_device.h
11273 --- linux-2.6.34/include/linux/vs_device.h 1970-01-01 01:00:00.000000000 +0100
11274 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_device.h 2010-05-18 18:11:22.000000000 +0200
11276 +#ifndef _VS_DEVICE_H
11277 +#define _VS_DEVICE_H
11279 +#include "vserver/base.h"
11280 +#include "vserver/device.h"
11281 +#include "vserver/debug.h"
11284 +#ifdef CONFIG_VSERVER_DEVICE
11286 +int vs_map_device(struct vx_info *, dev_t, dev_t *, umode_t);
11288 +#define vs_device_perm(v, d, m, p) \
11289 + ((vs_map_device(current_vx_info(), d, NULL, m) & (p)) == (p))
11294 +int vs_map_device(struct vx_info *vxi,
11295 + dev_t device, dev_t *target, umode_t mode)
11298 + *target = device;
11302 +#define vs_device_perm(v, d, m, p) ((p) == (p))
11307 +#define vs_map_chrdev(d, t, p) \
11308 + ((vs_map_device(current_vx_info(), d, t, S_IFCHR) & (p)) == (p))
11309 +#define vs_map_blkdev(d, t, p) \
11310 + ((vs_map_device(current_vx_info(), d, t, S_IFBLK) & (p)) == (p))
11312 +#define vs_chrdev_perm(d, p) \
11313 + vs_device_perm(current_vx_info(), d, S_IFCHR, p)
11314 +#define vs_blkdev_perm(d, p) \
11315 + vs_device_perm(current_vx_info(), d, S_IFBLK, p)
11319 +#warning duplicate inclusion
11321 diff -NurpP --minimal linux-2.6.34/include/linux/vs_dlimit.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_dlimit.h
11322 --- linux-2.6.34/include/linux/vs_dlimit.h 1970-01-01 01:00:00.000000000 +0100
11323 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_dlimit.h 2010-05-18 18:11:22.000000000 +0200
11325 +#ifndef _VS_DLIMIT_H
11326 +#define _VS_DLIMIT_H
11328 +#include <linux/fs.h>
11330 +#include "vserver/dlimit.h"
11331 +#include "vserver/base.h"
11332 +#include "vserver/debug.h"
11335 +#define get_dl_info(i) __get_dl_info(i, __FILE__, __LINE__)
11337 +static inline struct dl_info *__get_dl_info(struct dl_info *dli,
11338 + const char *_file, int _line)
11342 + vxlprintk(VXD_CBIT(dlim, 4), "get_dl_info(%p[#%d.%d])",
11343 + dli, dli ? dli->dl_tag : 0,
11344 + dli ? atomic_read(&dli->dl_usecnt) : 0,
11346 + atomic_inc(&dli->dl_usecnt);
11351 +#define free_dl_info(i) \
11352 + call_rcu(&(i)->dl_rcu, rcu_free_dl_info)
11354 +#define put_dl_info(i) __put_dl_info(i, __FILE__, __LINE__)
11356 +static inline void __put_dl_info(struct dl_info *dli,
11357 + const char *_file, int _line)
11361 + vxlprintk(VXD_CBIT(dlim, 4), "put_dl_info(%p[#%d.%d])",
11362 + dli, dli ? dli->dl_tag : 0,
11363 + dli ? atomic_read(&dli->dl_usecnt) : 0,
11365 + if (atomic_dec_and_test(&dli->dl_usecnt))
11366 + free_dl_info(dli);
11370 +#define __dlimit_char(d) ((d) ? '*' : ' ')
11372 +static inline int __dl_alloc_space(struct super_block *sb,
11373 + tag_t tag, dlsize_t nr, const char *file, int line)
11375 + struct dl_info *dli = NULL;
11380 + dli = locate_dl_info(sb, tag);
11384 + spin_lock(&dli->dl_lock);
11385 + ret = (dli->dl_space_used + nr > dli->dl_space_total);
11387 + dli->dl_space_used += nr;
11388 + spin_unlock(&dli->dl_lock);
11389 + put_dl_info(dli);
11391 + vxlprintk(VXD_CBIT(dlim, 1),
11392 + "ALLOC (%p,#%d)%c %lld bytes (%d)",
11393 + sb, tag, __dlimit_char(dli), (long long)nr,
11394 + ret, file, line);
11398 +static inline void __dl_free_space(struct super_block *sb,
11399 + tag_t tag, dlsize_t nr, const char *_file, int _line)
11401 + struct dl_info *dli = NULL;
11405 + dli = locate_dl_info(sb, tag);
11409 + spin_lock(&dli->dl_lock);
11410 + if (dli->dl_space_used > nr)
11411 + dli->dl_space_used -= nr;
11413 + dli->dl_space_used = 0;
11414 + spin_unlock(&dli->dl_lock);
11415 + put_dl_info(dli);
11417 + vxlprintk(VXD_CBIT(dlim, 1),
11418 + "FREE (%p,#%d)%c %lld bytes",
11419 + sb, tag, __dlimit_char(dli), (long long)nr,
11423 +static inline int __dl_alloc_inode(struct super_block *sb,
11424 + tag_t tag, const char *_file, int _line)
11426 + struct dl_info *dli;
11429 + dli = locate_dl_info(sb, tag);
11433 + spin_lock(&dli->dl_lock);
11434 + dli->dl_inodes_used++;
11435 + ret = (dli->dl_inodes_used > dli->dl_inodes_total);
11436 + spin_unlock(&dli->dl_lock);
11437 + put_dl_info(dli);
11439 + vxlprintk(VXD_CBIT(dlim, 0),
11440 + "ALLOC (%p,#%d)%c inode (%d)",
11441 + sb, tag, __dlimit_char(dli), ret, _file, _line);
11445 +static inline void __dl_free_inode(struct super_block *sb,
11446 + tag_t tag, const char *_file, int _line)
11448 + struct dl_info *dli;
11450 + dli = locate_dl_info(sb, tag);
11454 + spin_lock(&dli->dl_lock);
11455 + if (dli->dl_inodes_used > 1)
11456 + dli->dl_inodes_used--;
11458 + dli->dl_inodes_used = 0;
11459 + spin_unlock(&dli->dl_lock);
11460 + put_dl_info(dli);
11462 + vxlprintk(VXD_CBIT(dlim, 0),
11463 + "FREE (%p,#%d)%c inode",
11464 + sb, tag, __dlimit_char(dli), _file, _line);
11467 +static inline void __dl_adjust_block(struct super_block *sb, tag_t tag,
11468 + unsigned long long *free_blocks, unsigned long long *root_blocks,
11469 + const char *_file, int _line)
11471 + struct dl_info *dli;
11472 + uint64_t broot, bfree;
11474 + dli = locate_dl_info(sb, tag);
11478 + spin_lock(&dli->dl_lock);
11479 + broot = (dli->dl_space_total -
11480 + (dli->dl_space_total >> 10) * dli->dl_nrlmult)
11481 + >> sb->s_blocksize_bits;
11482 + bfree = (dli->dl_space_total - dli->dl_space_used)
11483 + >> sb->s_blocksize_bits;
11484 + spin_unlock(&dli->dl_lock);
11486 + vxlprintk(VXD_CBIT(dlim, 2),
11487 + "ADJUST: %lld,%lld on %lld,%lld [mult=%d]",
11488 + (long long)bfree, (long long)broot,
11489 + *free_blocks, *root_blocks, dli->dl_nrlmult,
11491 + if (free_blocks) {
11492 + if (*free_blocks > bfree)
11493 + *free_blocks = bfree;
11495 + if (root_blocks) {
11496 + if (*root_blocks > broot)
11497 + *root_blocks = broot;
11499 + put_dl_info(dli);
11502 +#define dl_prealloc_space(in, bytes) \
11503 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11504 + __FILE__, __LINE__ )
11506 +#define dl_alloc_space(in, bytes) \
11507 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11508 + __FILE__, __LINE__ )
11510 +#define dl_reserve_space(in, bytes) \
11511 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11512 + __FILE__, __LINE__ )
11514 +#define dl_claim_space(in, bytes) (0)
11516 +#define dl_release_space(in, bytes) \
11517 + __dl_free_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11518 + __FILE__, __LINE__ )
11520 +#define dl_free_space(in, bytes) \
11521 + __dl_free_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11522 + __FILE__, __LINE__ )
11526 +#define dl_alloc_inode(in) \
11527 + __dl_alloc_inode((in)->i_sb, (in)->i_tag, __FILE__, __LINE__ )
11529 +#define dl_free_inode(in) \
11530 + __dl_free_inode((in)->i_sb, (in)->i_tag, __FILE__, __LINE__ )
11533 +#define dl_adjust_block(sb, tag, fb, rb) \
11534 + __dl_adjust_block(sb, tag, fb, rb, __FILE__, __LINE__ )
11538 +#warning duplicate inclusion
11540 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/base.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/base.h
11541 --- linux-2.6.34/include/linux/vserver/base.h 1970-01-01 01:00:00.000000000 +0100
11542 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/base.h 2010-05-18 18:11:22.000000000 +0200
11544 +#ifndef _VX_BASE_H
11545 +#define _VX_BASE_H
11548 +/* context state changes */
11560 +#define vx_task_xid(t) ((t)->xid)
11562 +#define vx_current_xid() vx_task_xid(current)
11564 +#define current_vx_info() (current->vx_info)
11567 +#define nx_task_nid(t) ((t)->nid)
11569 +#define nx_current_nid() nx_task_nid(current)
11571 +#define current_nx_info() (current->nx_info)
11574 +/* generic flag merging */
11576 +#define vs_check_flags(v, m, f) (((v) & (m)) ^ (f))
11578 +#define vs_mask_flags(v, f, m) (((v) & ~(m)) | ((f) & (m)))
11580 +#define vs_mask_mask(v, f, m) (((v) & ~(m)) | ((v) & (f) & (m)))
11582 +#define vs_check_bit(v, n) ((v) & (1LL << (n)))
11585 +/* context flags */
11587 +#define __vx_flags(v) ((v) ? (v)->vx_flags : 0)
11589 +#define vx_current_flags() __vx_flags(current_vx_info())
11591 +#define vx_info_flags(v, m, f) \
11592 + vs_check_flags(__vx_flags(v), m, f)
11594 +#define task_vx_flags(t, m, f) \
11595 + ((t) && vx_info_flags((t)->vx_info, m, f))
11597 +#define vx_flags(m, f) vx_info_flags(current_vx_info(), m, f)
11600 +/* context caps */
11602 +#define __vx_ccaps(v) ((v) ? (v)->vx_ccaps : 0)
11604 +#define vx_current_ccaps() __vx_ccaps(current_vx_info())
11606 +#define vx_info_ccaps(v, c) (__vx_ccaps(v) & (c))
11608 +#define vx_ccaps(c) vx_info_ccaps(current_vx_info(), (c))
11612 +/* network flags */
11614 +#define __nx_flags(n) ((n) ? (n)->nx_flags : 0)
11616 +#define nx_current_flags() __nx_flags(current_nx_info())
11618 +#define nx_info_flags(n, m, f) \
11619 + vs_check_flags(__nx_flags(n), m, f)
11621 +#define task_nx_flags(t, m, f) \
11622 + ((t) && nx_info_flags((t)->nx_info, m, f))
11624 +#define nx_flags(m, f) nx_info_flags(current_nx_info(), m, f)
11627 +/* network caps */
11629 +#define __nx_ncaps(n) ((n) ? (n)->nx_ncaps : 0)
11631 +#define nx_current_ncaps() __nx_ncaps(current_nx_info())
11633 +#define nx_info_ncaps(n, c) (__nx_ncaps(n) & (c))
11635 +#define nx_ncaps(c) nx_info_ncaps(current_nx_info(), c)
11638 +/* context mask capabilities */
11640 +#define __vx_mcaps(v) ((v) ? (v)->vx_ccaps >> 32UL : ~0 )
11642 +#define vx_info_mcaps(v, c) (__vx_mcaps(v) & (c))
11644 +#define vx_mcaps(c) vx_info_mcaps(current_vx_info(), c)
11647 +/* context bcap mask */
11649 +#define __vx_bcaps(v) ((v)->vx_bcaps)
11651 +#define vx_current_bcaps() __vx_bcaps(current_vx_info())
11654 +/* mask given bcaps */
11656 +#define vx_info_mbcaps(v, c) ((v) ? cap_intersect(__vx_bcaps(v), c) : c)
11658 +#define vx_mbcaps(c) vx_info_mbcaps(current_vx_info(), c)
11661 +/* masked cap_bset */
11663 +#define vx_info_cap_bset(v) vx_info_mbcaps(v, current->cap_bset)
11665 +#define vx_current_cap_bset() vx_info_cap_bset(current_vx_info())
11668 +#define vx_info_mbcap(v, b) \
11669 + (!vx_info_flags(v, VXF_STATE_SETUP, 0) ? \
11670 + vx_info_bcaps(v, b) : (b))
11672 +#define task_vx_mbcap(t, b) \
11673 + vx_info_mbcap((t)->vx_info, (t)->b)
11675 +#define vx_mbcap(b) task_vx_mbcap(current, b)
11678 +#define vx_cap_raised(v, c, f) cap_raised(vx_info_mbcaps(v, c), f)
11680 +#define vx_capable(b, c) (capable(b) || \
11681 + (cap_raised(current_cap(), b) && vx_ccaps(c)))
11683 +#define nx_capable(b, c) (capable(b) || \
11684 + (cap_raised(current_cap(), b) && nx_ncaps(c)))
11686 +#define vx_task_initpid(t, n) \
11687 + ((t)->vx_info && \
11688 + ((t)->vx_info->vx_initpid == (n)))
11690 +#define vx_current_initpid(n) vx_task_initpid(current, n)
11693 +/* context unshare mask */
11695 +#define __vx_umask(v) ((v)->vx_umask)
11697 +#define vx_current_umask() __vx_umask(current_vx_info())
11699 +#define vx_can_unshare(b, f) (capable(b) || \
11700 + (cap_raised(current_cap(), b) && \
11701 + !((f) & ~vx_current_umask())))
11704 +#define __vx_state(v) ((v) ? ((v)->vx_state) : 0)
11706 +#define vx_info_state(v, m) (__vx_state(v) & (m))
11709 +#define __nx_state(n) ((n) ? ((n)->nx_state) : 0)
11711 +#define nx_info_state(n, m) (__nx_state(n) & (m))
11714 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/cacct_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cacct_cmd.h
11715 --- linux-2.6.34/include/linux/vserver/cacct_cmd.h 1970-01-01 01:00:00.000000000 +0100
11716 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cacct_cmd.h 2010-05-18 18:11:22.000000000 +0200
11718 +#ifndef _VX_CACCT_CMD_H
11719 +#define _VX_CACCT_CMD_H
11722 +/* virtual host info name commands */
11724 +#define VCMD_sock_stat VC_CMD(VSTAT, 5, 0)
11726 +struct vcmd_sock_stat_v0 {
11728 + uint32_t count[3];
11729 + uint64_t total[3];
11735 +#include <linux/compiler.h>
11737 +extern int vc_sock_stat(struct vx_info *, void __user *);
11739 +#endif /* __KERNEL__ */
11740 +#endif /* _VX_CACCT_CMD_H */
11741 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/cacct_def.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cacct_def.h
11742 --- linux-2.6.34/include/linux/vserver/cacct_def.h 1970-01-01 01:00:00.000000000 +0100
11743 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cacct_def.h 2010-05-18 18:11:22.000000000 +0200
11745 +#ifndef _VX_CACCT_DEF_H
11746 +#define _VX_CACCT_DEF_H
11748 +#include <asm/atomic.h>
11749 +#include <linux/vserver/cacct.h>
11752 +struct _vx_sock_acc {
11753 + atomic_long_t count;
11754 + atomic_long_t total;
11757 +/* context sub struct */
11759 +struct _vx_cacct {
11760 + struct _vx_sock_acc sock[VXA_SOCK_SIZE][3];
11761 + atomic_t slab[8];
11762 + atomic_t page[6][8];
11765 +#ifdef CONFIG_VSERVER_DEBUG
11767 +static inline void __dump_vx_cacct(struct _vx_cacct *cacct)
11771 + printk("\t_vx_cacct:");
11772 + for (i = 0; i < 6; i++) {
11773 + struct _vx_sock_acc *ptr = cacct->sock[i];
11775 + printk("\t [%d] =", i);
11776 + for (j = 0; j < 3; j++) {
11777 + printk(" [%d] = %8lu, %8lu", j,
11778 + atomic_long_read(&ptr[j].count),
11779 + atomic_long_read(&ptr[j].total));
11787 +#endif /* _VX_CACCT_DEF_H */
11788 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/cacct.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cacct.h
11789 --- linux-2.6.34/include/linux/vserver/cacct.h 1970-01-01 01:00:00.000000000 +0100
11790 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cacct.h 2010-05-18 18:11:22.000000000 +0200
11792 +#ifndef _VX_CACCT_H
11793 +#define _VX_CACCT_H
11796 +enum sock_acc_field {
11797 + VXA_SOCK_UNSPEC = 0,
11803 + VXA_SOCK_SIZE /* array size */
11806 +#endif /* _VX_CACCT_H */
11807 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/cacct_int.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cacct_int.h
11808 --- linux-2.6.34/include/linux/vserver/cacct_int.h 1970-01-01 01:00:00.000000000 +0100
11809 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cacct_int.h 2010-05-18 18:11:22.000000000 +0200
11811 +#ifndef _VX_CACCT_INT_H
11812 +#define _VX_CACCT_INT_H
11818 +unsigned long vx_sock_count(struct _vx_cacct *cacct, int type, int pos)
11820 + return atomic_long_read(&cacct->sock[type][pos].count);
11825 +unsigned long vx_sock_total(struct _vx_cacct *cacct, int type, int pos)
11827 + return atomic_long_read(&cacct->sock[type][pos].total);
11830 +#endif /* __KERNEL__ */
11831 +#endif /* _VX_CACCT_INT_H */
11832 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/check.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/check.h
11833 --- linux-2.6.34/include/linux/vserver/check.h 1970-01-01 01:00:00.000000000 +0100
11834 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/check.h 2010-05-18 18:11:22.000000000 +0200
11836 +#ifndef _VS_CHECK_H
11837 +#define _VS_CHECK_H
11840 +#define MAX_S_CONTEXT 65535 /* Arbitrary limit */
11842 +#ifdef CONFIG_VSERVER_DYNAMIC_IDS
11843 +#define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
11845 +#define MIN_D_CONTEXT 65536
11848 +/* check conditions */
11850 +#define VS_ADMIN 0x0001
11851 +#define VS_WATCH 0x0002
11852 +#define VS_HIDE 0x0004
11853 +#define VS_HOSTID 0x0008
11855 +#define VS_IDENT 0x0010
11856 +#define VS_EQUIV 0x0020
11857 +#define VS_PARENT 0x0040
11858 +#define VS_CHILD 0x0080
11860 +#define VS_ARG_MASK 0x00F0
11862 +#define VS_DYNAMIC 0x0100
11863 +#define VS_STATIC 0x0200
11865 +#define VS_ATR_MASK 0x0F00
11867 +#ifdef CONFIG_VSERVER_PRIVACY
11868 +#define VS_ADMIN_P (0)
11869 +#define VS_WATCH_P (0)
11871 +#define VS_ADMIN_P VS_ADMIN
11872 +#define VS_WATCH_P VS_WATCH
11875 +#define VS_HARDIRQ 0x1000
11876 +#define VS_SOFTIRQ 0x2000
11877 +#define VS_IRQ 0x4000
11879 +#define VS_IRQ_MASK 0xF000
11881 +#include <linux/hardirq.h>
11884 + * check current context for ADMIN/WATCH and
11885 + * optionally against supplied argument
11887 +static inline int __vs_check(int cid, int id, unsigned int mode)
11889 + if (mode & VS_ARG_MASK) {
11890 + if ((mode & VS_IDENT) && (id == cid))
11893 + if (mode & VS_ATR_MASK) {
11894 + if ((mode & VS_DYNAMIC) &&
11895 + (id >= MIN_D_CONTEXT) &&
11896 + (id <= MAX_S_CONTEXT))
11898 + if ((mode & VS_STATIC) &&
11899 + (id > 1) && (id < MIN_D_CONTEXT))
11902 + if (mode & VS_IRQ_MASK) {
11903 + if ((mode & VS_IRQ) && unlikely(in_interrupt()))
11905 + if ((mode & VS_HARDIRQ) && unlikely(in_irq()))
11907 + if ((mode & VS_SOFTIRQ) && unlikely(in_softirq()))
11910 + return (((mode & VS_ADMIN) && (cid == 0)) ||
11911 + ((mode & VS_WATCH) && (cid == 1)) ||
11912 + ((mode & VS_HOSTID) && (id == 0)));
11915 +#define vx_check(c, m) __vs_check(vx_current_xid(), c, (m) | VS_IRQ)
11917 +#define vx_weak_check(c, m) ((m) ? vx_check(c, m) : 1)
11920 +#define nx_check(c, m) __vs_check(nx_current_nid(), c, m)
11922 +#define nx_weak_check(c, m) ((m) ? nx_check(c, m) : 1)
11925 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/context_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/context_cmd.h
11926 --- linux-2.6.34/include/linux/vserver/context_cmd.h 1970-01-01 01:00:00.000000000 +0100
11927 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/context_cmd.h 2010-05-18 18:11:22.000000000 +0200
11929 +#ifndef _VX_CONTEXT_CMD_H
11930 +#define _VX_CONTEXT_CMD_H
11933 +/* vinfo commands */
11935 +#define VCMD_task_xid VC_CMD(VINFO, 1, 0)
11938 +extern int vc_task_xid(uint32_t);
11940 +#endif /* __KERNEL__ */
11942 +#define VCMD_vx_info VC_CMD(VINFO, 5, 0)
11944 +struct vcmd_vx_info_v0 {
11946 + uint32_t initpid;
11947 + /* more to come */
11951 +extern int vc_vx_info(struct vx_info *, void __user *);
11953 +#endif /* __KERNEL__ */
11955 +#define VCMD_ctx_stat VC_CMD(VSTAT, 0, 0)
11957 +struct vcmd_ctx_stat_v0 {
11960 + /* more to come */
11964 +extern int vc_ctx_stat(struct vx_info *, void __user *);
11966 +#endif /* __KERNEL__ */
11968 +/* context commands */
11970 +#define VCMD_ctx_create_v0 VC_CMD(VPROC, 1, 0)
11971 +#define VCMD_ctx_create VC_CMD(VPROC, 1, 1)
11973 +struct vcmd_ctx_create {
11974 + uint64_t flagword;
11977 +#define VCMD_ctx_migrate_v0 VC_CMD(PROCMIG, 1, 0)
11978 +#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 1)
11980 +struct vcmd_ctx_migrate {
11981 + uint64_t flagword;
11985 +extern int vc_ctx_create(uint32_t, void __user *);
11986 +extern int vc_ctx_migrate(struct vx_info *, void __user *);
11988 +#endif /* __KERNEL__ */
11991 +/* flag commands */
11993 +#define VCMD_get_cflags VC_CMD(FLAGS, 1, 0)
11994 +#define VCMD_set_cflags VC_CMD(FLAGS, 2, 0)
11996 +struct vcmd_ctx_flags_v0 {
11997 + uint64_t flagword;
12002 +extern int vc_get_cflags(struct vx_info *, void __user *);
12003 +extern int vc_set_cflags(struct vx_info *, void __user *);
12005 +#endif /* __KERNEL__ */
12008 +/* context caps commands */
12010 +#define VCMD_get_ccaps VC_CMD(FLAGS, 3, 1)
12011 +#define VCMD_set_ccaps VC_CMD(FLAGS, 4, 1)
12013 +struct vcmd_ctx_caps_v1 {
12019 +extern int vc_get_ccaps(struct vx_info *, void __user *);
12020 +extern int vc_set_ccaps(struct vx_info *, void __user *);
12022 +#endif /* __KERNEL__ */
12025 +/* bcaps commands */
12027 +#define VCMD_get_bcaps VC_CMD(FLAGS, 9, 0)
12028 +#define VCMD_set_bcaps VC_CMD(FLAGS, 10, 0)
12030 +struct vcmd_bcaps {
12036 +extern int vc_get_bcaps(struct vx_info *, void __user *);
12037 +extern int vc_set_bcaps(struct vx_info *, void __user *);
12039 +#endif /* __KERNEL__ */
12042 +/* umask commands */
12044 +#define VCMD_get_umask VC_CMD(FLAGS, 13, 0)
12045 +#define VCMD_set_umask VC_CMD(FLAGS, 14, 0)
12047 +struct vcmd_umask {
12053 +extern int vc_get_umask(struct vx_info *, void __user *);
12054 +extern int vc_set_umask(struct vx_info *, void __user *);
12056 +#endif /* __KERNEL__ */
12061 +#define VCMD_get_badness VC_CMD(MEMCTRL, 5, 0)
12062 +#define VCMD_set_badness VC_CMD(MEMCTRL, 6, 0)
12064 +struct vcmd_badness_v0 {
12069 +extern int vc_get_badness(struct vx_info *, void __user *);
12070 +extern int vc_set_badness(struct vx_info *, void __user *);
12072 +#endif /* __KERNEL__ */
12073 +#endif /* _VX_CONTEXT_CMD_H */
12074 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/context.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/context.h
12075 --- linux-2.6.34/include/linux/vserver/context.h 1970-01-01 01:00:00.000000000 +0100
12076 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/context.h 2010-05-18 18:11:22.000000000 +0200
12078 +#ifndef _VX_CONTEXT_H
12079 +#define _VX_CONTEXT_H
12081 +#include <linux/types.h>
12082 +#include <linux/capability.h>
12085 +/* context flags */
12087 +#define VXF_INFO_SCHED 0x00000002
12088 +#define VXF_INFO_NPROC 0x00000004
12089 +#define VXF_INFO_PRIVATE 0x00000008
12091 +#define VXF_INFO_INIT 0x00000010
12092 +#define VXF_INFO_HIDE 0x00000020
12093 +#define VXF_INFO_ULIMIT 0x00000040
12094 +#define VXF_INFO_NSPACE 0x00000080
12096 +#define VXF_SCHED_HARD 0x00000100
12097 +#define VXF_SCHED_PRIO 0x00000200
12098 +#define VXF_SCHED_PAUSE 0x00000400
12100 +#define VXF_VIRT_MEM 0x00010000
12101 +#define VXF_VIRT_UPTIME 0x00020000
12102 +#define VXF_VIRT_CPU 0x00040000
12103 +#define VXF_VIRT_LOAD 0x00080000
12104 +#define VXF_VIRT_TIME 0x00100000
12106 +#define VXF_HIDE_MOUNT 0x01000000
12107 +/* was VXF_HIDE_NETIF 0x02000000 */
12108 +#define VXF_HIDE_VINFO 0x04000000
12110 +#define VXF_STATE_SETUP (1ULL << 32)
12111 +#define VXF_STATE_INIT (1ULL << 33)
12112 +#define VXF_STATE_ADMIN (1ULL << 34)
12114 +#define VXF_SC_HELPER (1ULL << 36)
12115 +#define VXF_REBOOT_KILL (1ULL << 37)
12116 +#define VXF_PERSISTENT (1ULL << 38)
12118 +#define VXF_FORK_RSS (1ULL << 48)
12119 +#define VXF_PROLIFIC (1ULL << 49)
12121 +#define VXF_IGNEG_NICE (1ULL << 52)
12123 +#define VXF_ONE_TIME (0x0007ULL << 32)
12125 +#define VXF_INIT_SET (VXF_STATE_SETUP | VXF_STATE_INIT | VXF_STATE_ADMIN)
12128 +/* context migration */
12130 +#define VXM_SET_INIT 0x00000001
12131 +#define VXM_SET_REAPER 0x00000002
12133 +/* context caps */
12135 +#define VXC_CAP_MASK 0x00000000
12137 +#define VXC_SET_UTSNAME 0x00000001
12138 +#define VXC_SET_RLIMIT 0x00000002
12139 +#define VXC_FS_SECURITY 0x00000004
12140 +#define VXC_FS_TRUSTED 0x00000008
12141 +#define VXC_TIOCSTI 0x00000010
12143 +/* was VXC_RAW_ICMP 0x00000100 */
12144 +#define VXC_SYSLOG 0x00001000
12145 +#define VXC_OOM_ADJUST 0x00002000
12146 +#define VXC_AUDIT_CONTROL 0x00004000
12148 +#define VXC_SECURE_MOUNT 0x00010000
12149 +#define VXC_SECURE_REMOUNT 0x00020000
12150 +#define VXC_BINARY_MOUNT 0x00040000
12152 +#define VXC_QUOTA_CTL 0x00100000
12153 +#define VXC_ADMIN_MAPPER 0x00200000
12154 +#define VXC_ADMIN_CLOOP 0x00400000
12156 +#define VXC_KTHREAD 0x01000000
12157 +#define VXC_NAMESPACE 0x02000000
12162 +#include <linux/list.h>
12163 +#include <linux/spinlock.h>
12164 +#include <linux/rcupdate.h>
12166 +#include "limit_def.h"
12167 +#include "sched_def.h"
12168 +#include "cvirt_def.h"
12169 +#include "cacct_def.h"
12170 +#include "device_def.h"
12172 +#define VX_SPACES 2
12174 +struct _vx_info_pc {
12175 + struct _vx_sched_pc sched_pc;
12176 + struct _vx_cvirt_pc cvirt_pc;
12180 + struct hlist_node vx_hlist; /* linked list of contexts */
12181 + xid_t vx_id; /* context id */
12182 + atomic_t vx_usecnt; /* usage count */
12183 + atomic_t vx_tasks; /* tasks count */
12184 + struct vx_info *vx_parent; /* parent context */
12185 + int vx_state; /* context state */
12187 + unsigned long vx_nsmask[VX_SPACES]; /* assignment mask */
12188 + struct nsproxy *vx_nsproxy[VX_SPACES]; /* private namespaces */
12189 + struct fs_struct *vx_fs[VX_SPACES]; /* private namespace fs */
12191 + uint64_t vx_flags; /* context flags */
12192 + uint64_t vx_ccaps; /* context caps (vserver) */
12193 + kernel_cap_t vx_bcaps; /* bounding caps (system) */
12194 + unsigned long vx_umask; /* unshare mask (guest) */
12196 + struct task_struct *vx_reaper; /* guest reaper process */
12197 + pid_t vx_initpid; /* PID of guest init */
12198 + int64_t vx_badness_bias; /* OOM points bias */
12200 + struct _vx_limit limit; /* vserver limits */
12201 + struct _vx_sched sched; /* vserver scheduler */
12202 + struct _vx_cvirt cvirt; /* virtual/bias stuff */
12203 + struct _vx_cacct cacct; /* context accounting */
12205 + struct _vx_device dmap; /* default device map targets */
12207 +#ifndef CONFIG_SMP
12208 + struct _vx_info_pc info_pc; /* per cpu data */
12210 + struct _vx_info_pc *ptr_pc; /* per cpu array */
12213 + wait_queue_head_t vx_wait; /* context exit waitqueue */
12214 + int reboot_cmd; /* last sys_reboot() cmd */
12215 + int exit_code; /* last process exit code */
12217 + char vx_name[65]; /* vserver name */
12220 +#ifndef CONFIG_SMP
12221 +#define vx_ptr_pc(vxi) (&(vxi)->info_pc)
12222 +#define vx_per_cpu(vxi, v, id) vx_ptr_pc(vxi)->v
12224 +#define vx_ptr_pc(vxi) ((vxi)->ptr_pc)
12225 +#define vx_per_cpu(vxi, v, id) per_cpu_ptr(vx_ptr_pc(vxi), id)->v
12228 +#define vx_cpu(vxi, v) vx_per_cpu(vxi, v, smp_processor_id())
12231 +struct vx_info_save {
12232 + struct vx_info *vxi;
12237 +/* status flags */
12239 +#define VXS_HASHED 0x0001
12240 +#define VXS_PAUSED 0x0010
12241 +#define VXS_SHUTDOWN 0x0100
12242 +#define VXS_HELPER 0x1000
12243 +#define VXS_RELEASED 0x8000
12246 +extern void claim_vx_info(struct vx_info *, struct task_struct *);
12247 +extern void release_vx_info(struct vx_info *, struct task_struct *);
12249 +extern struct vx_info *lookup_vx_info(int);
12250 +extern struct vx_info *lookup_or_create_vx_info(int);
12252 +extern int get_xid_list(int, unsigned int *, int);
12253 +extern int xid_is_hashed(xid_t);
12255 +extern int vx_migrate_task(struct task_struct *, struct vx_info *, int);
12257 +extern long vs_state_change(struct vx_info *, unsigned int);
12260 +#endif /* __KERNEL__ */
12261 +#endif /* _VX_CONTEXT_H */
12262 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/cvirt_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cvirt_cmd.h
12263 --- linux-2.6.34/include/linux/vserver/cvirt_cmd.h 1970-01-01 01:00:00.000000000 +0100
12264 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cvirt_cmd.h 2010-05-18 18:11:22.000000000 +0200
12266 +#ifndef _VX_CVIRT_CMD_H
12267 +#define _VX_CVIRT_CMD_H
12270 +/* virtual host info name commands */
12272 +#define VCMD_set_vhi_name VC_CMD(VHOST, 1, 0)
12273 +#define VCMD_get_vhi_name VC_CMD(VHOST, 2, 0)
12275 +struct vcmd_vhi_name_v0 {
12281 +enum vhi_name_field {
12282 + VHIN_CONTEXT = 0,
12294 +#include <linux/compiler.h>
12296 +extern int vc_set_vhi_name(struct vx_info *, void __user *);
12297 +extern int vc_get_vhi_name(struct vx_info *, void __user *);
12299 +#endif /* __KERNEL__ */
12301 +#define VCMD_virt_stat VC_CMD(VSTAT, 3, 0)
12303 +struct vcmd_virt_stat_v0 {
12306 + uint32_t nr_threads;
12307 + uint32_t nr_running;
12308 + uint32_t nr_uninterruptible;
12309 + uint32_t nr_onhold;
12310 + uint32_t nr_forks;
12311 + uint32_t load[3];
12315 +extern int vc_virt_stat(struct vx_info *, void __user *);
12317 +#endif /* __KERNEL__ */
12318 +#endif /* _VX_CVIRT_CMD_H */
12319 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/cvirt_def.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cvirt_def.h
12320 --- linux-2.6.34/include/linux/vserver/cvirt_def.h 1970-01-01 01:00:00.000000000 +0100
12321 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cvirt_def.h 2010-05-18 18:11:22.000000000 +0200
12323 +#ifndef _VX_CVIRT_DEF_H
12324 +#define _VX_CVIRT_DEF_H
12326 +#include <linux/jiffies.h>
12327 +#include <linux/spinlock.h>
12328 +#include <linux/wait.h>
12329 +#include <linux/time.h>
12330 +#include <asm/atomic.h>
12333 +struct _vx_usage_stat {
12337 + uint64_t softirq;
12343 +struct _vx_syslog {
12344 + wait_queue_head_t log_wait;
12345 + spinlock_t logbuf_lock; /* lock for the log buffer */
12347 + unsigned long log_start; /* next char to be read by syslog() */
12348 + unsigned long con_start; /* next char to be sent to consoles */
12349 + unsigned long log_end; /* most-recently-written-char + 1 */
12350 + unsigned long logged_chars; /* #chars since last read+clear operation */
12352 + char log_buf[1024];
12356 +/* context sub struct */
12358 +struct _vx_cvirt {
12359 + atomic_t nr_threads; /* number of current threads */
12360 + atomic_t nr_running; /* number of running threads */
12361 + atomic_t nr_uninterruptible; /* number of uninterruptible threads */
12363 + atomic_t nr_onhold; /* processes on hold */
12364 + uint32_t onhold_last; /* jiffies when put on hold */
12366 + struct timeval bias_tv; /* time offset to the host */
12367 + struct timespec bias_idle;
12368 + struct timespec bias_uptime; /* context creation point */
12369 + uint64_t bias_clock; /* offset in clock_t */
12371 + spinlock_t load_lock; /* lock for the load averages */
12372 + atomic_t load_updates; /* nr of load updates done so far */
12373 + uint32_t load_last; /* last time load was calculated */
12374 + uint32_t load[3]; /* load averages 1,5,15 */
12376 + atomic_t total_forks; /* number of forks so far */
12378 + struct _vx_syslog syslog;
12381 +struct _vx_cvirt_pc {
12382 + struct _vx_usage_stat cpustat;
12386 +#ifdef CONFIG_VSERVER_DEBUG
12388 +static inline void __dump_vx_cvirt(struct _vx_cvirt *cvirt)
12390 + printk("\t_vx_cvirt:\n");
12391 + printk("\t threads: %4d, %4d, %4d, %4d\n",
12392 + atomic_read(&cvirt->nr_threads),
12393 + atomic_read(&cvirt->nr_running),
12394 + atomic_read(&cvirt->nr_uninterruptible),
12395 + atomic_read(&cvirt->nr_onhold));
12396 + /* add rest here */
12397 + printk("\t total_forks = %d\n", atomic_read(&cvirt->total_forks));
12402 +#endif /* _VX_CVIRT_DEF_H */
12403 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/cvirt.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cvirt.h
12404 --- linux-2.6.34/include/linux/vserver/cvirt.h 1970-01-01 01:00:00.000000000 +0100
12405 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/cvirt.h 2010-05-18 18:11:22.000000000 +0200
12407 +#ifndef _VX_CVIRT_H
12408 +#define _VX_CVIRT_H
12415 +void vx_vsi_uptime(struct timespec *, struct timespec *);
12420 +void vx_update_load(struct vx_info *);
12423 +int vx_do_syslog(int, char __user *, int);
12425 +#endif /* __KERNEL__ */
12426 +#endif /* _VX_CVIRT_H */
12427 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/debug_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/debug_cmd.h
12428 --- linux-2.6.34/include/linux/vserver/debug_cmd.h 1970-01-01 01:00:00.000000000 +0100
12429 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/debug_cmd.h 2010-05-18 18:11:22.000000000 +0200
12431 +#ifndef _VX_DEBUG_CMD_H
12432 +#define _VX_DEBUG_CMD_H
12435 +/* debug commands */
12437 +#define VCMD_dump_history VC_CMD(DEBUG, 1, 0)
12439 +#define VCMD_read_history VC_CMD(DEBUG, 5, 0)
12440 +#define VCMD_read_monitor VC_CMD(DEBUG, 6, 0)
12442 +struct vcmd_read_history_v0 {
12445 + char __user *data;
12448 +struct vcmd_read_monitor_v0 {
12451 + char __user *data;
12457 +#ifdef CONFIG_COMPAT
12459 +#include <asm/compat.h>
12461 +struct vcmd_read_history_v0_x32 {
12464 + compat_uptr_t data_ptr;
12467 +struct vcmd_read_monitor_v0_x32 {
12470 + compat_uptr_t data_ptr;
12473 +#endif /* CONFIG_COMPAT */
12475 +extern int vc_dump_history(uint32_t);
12477 +extern int vc_read_history(uint32_t, void __user *);
12478 +extern int vc_read_monitor(uint32_t, void __user *);
12480 +#ifdef CONFIG_COMPAT
12482 +extern int vc_read_history_x32(uint32_t, void __user *);
12483 +extern int vc_read_monitor_x32(uint32_t, void __user *);
12485 +#endif /* CONFIG_COMPAT */
12487 +#endif /* __KERNEL__ */
12488 +#endif /* _VX_DEBUG_CMD_H */
12489 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/debug.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/debug.h
12490 --- linux-2.6.34/include/linux/vserver/debug.h 1970-01-01 01:00:00.000000000 +0100
12491 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/debug.h 2010-05-18 18:11:22.000000000 +0200
12493 +#ifndef _VX_DEBUG_H
12494 +#define _VX_DEBUG_H
12497 +#define VXD_CBIT(n, m) (vx_debug_ ## n & (1 << (m)))
12498 +#define VXD_CMIN(n, m) (vx_debug_ ## n > (m))
12499 +#define VXD_MASK(n, m) (vx_debug_ ## n & (m))
12501 +#define VXD_DEV(d) (d), (d)->bd_inode->i_ino, \
12502 + imajor((d)->bd_inode), iminor((d)->bd_inode)
12503 +#define VXF_DEV "%p[%lu,%d:%d]"
12506 +#define vxd_path(p) \
12507 + ({ static char _buffer[PATH_MAX]; \
12508 + d_path(p, _buffer, sizeof(_buffer)); })
12510 +#define vxd_cond_path(n) \
12511 + ((n) ? vxd_path(&(n)->path) : "<null>" )
12514 +#ifdef CONFIG_VSERVER_DEBUG
12516 +extern unsigned int vx_debug_switch;
12517 +extern unsigned int vx_debug_xid;
12518 +extern unsigned int vx_debug_nid;
12519 +extern unsigned int vx_debug_tag;
12520 +extern unsigned int vx_debug_net;
12521 +extern unsigned int vx_debug_limit;
12522 +extern unsigned int vx_debug_cres;
12523 +extern unsigned int vx_debug_dlim;
12524 +extern unsigned int vx_debug_quota;
12525 +extern unsigned int vx_debug_cvirt;
12526 +extern unsigned int vx_debug_space;
12527 +extern unsigned int vx_debug_misc;
12530 +#define VX_LOGLEVEL "vxD: "
12531 +#define VX_PROC_FMT "%p: "
12532 +#define VX_PROCESS current
12534 +#define vxdprintk(c, f, x...) \
12537 + printk(VX_LOGLEVEL VX_PROC_FMT f "\n", \
12538 + VX_PROCESS , ##x); \
12541 +#define vxlprintk(c, f, x...) \
12544 + printk(VX_LOGLEVEL f " @%s:%d\n", x); \
12547 +#define vxfprintk(c, f, x...) \
12550 + printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
12556 +void dump_vx_info(struct vx_info *, int);
12557 +void dump_vx_info_inactive(int);
12559 +#else /* CONFIG_VSERVER_DEBUG */
12561 +#define vx_debug_switch 0
12562 +#define vx_debug_xid 0
12563 +#define vx_debug_nid 0
12564 +#define vx_debug_tag 0
12565 +#define vx_debug_net 0
12566 +#define vx_debug_limit 0
12567 +#define vx_debug_cres 0
12568 +#define vx_debug_dlim 0
12569 +#define vx_debug_cvirt 0
12571 +#define vxdprintk(x...) do { } while (0)
12572 +#define vxlprintk(x...) do { } while (0)
12573 +#define vxfprintk(x...) do { } while (0)
12575 +#endif /* CONFIG_VSERVER_DEBUG */
12578 +#ifdef CONFIG_VSERVER_WARN
12580 +#define VX_WARNLEVEL KERN_WARNING "vxW: "
12581 +#define VX_WARN_TASK "[»%s«,%u:#%u|%u|%u] "
12582 +#define VX_WARN_XID "[xid #%u] "
12583 +#define VX_WARN_NID "[nid #%u] "
12584 +#define VX_WARN_TAG "[tag #%u] "
12586 +#define vxwprintk(c, f, x...) \
12589 + printk(VX_WARNLEVEL f "\n", ##x); \
12592 +#else /* CONFIG_VSERVER_WARN */
12594 +#define vxwprintk(x...) do { } while (0)
12596 +#endif /* CONFIG_VSERVER_WARN */
12598 +#define vxwprintk_task(c, f, x...) \
12599 + vxwprintk(c, VX_WARN_TASK f, \
12600 + current->comm, current->pid, \
12601 + current->xid, current->nid, current->tag, ##x)
12602 +#define vxwprintk_xid(c, f, x...) \
12603 + vxwprintk(c, VX_WARN_XID f, current->xid, x)
12604 +#define vxwprintk_nid(c, f, x...) \
12605 + vxwprintk(c, VX_WARN_NID f, current->nid, x)
12606 +#define vxwprintk_tag(c, f, x...) \
12607 + vxwprintk(c, VX_WARN_TAG f, current->tag, x)
12609 +#ifdef CONFIG_VSERVER_DEBUG
12610 +#define vxd_assert_lock(l) assert_spin_locked(l)
12611 +#define vxd_assert(c, f, x...) vxlprintk(!(c), \
12612 + "assertion [" f "] failed.", ##x, __FILE__, __LINE__)
12614 +#define vxd_assert_lock(l) do { } while (0)
12615 +#define vxd_assert(c, f, x...) do { } while (0)
12619 +#endif /* _VX_DEBUG_H */
12620 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/device_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/device_cmd.h
12621 --- linux-2.6.34/include/linux/vserver/device_cmd.h 1970-01-01 01:00:00.000000000 +0100
12622 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/device_cmd.h 2010-05-18 18:11:22.000000000 +0200
12624 +#ifndef _VX_DEVICE_CMD_H
12625 +#define _VX_DEVICE_CMD_H
12628 +/* device vserver commands */
12630 +#define VCMD_set_mapping VC_CMD(DEVICE, 1, 0)
12631 +#define VCMD_unset_mapping VC_CMD(DEVICE, 2, 0)
12633 +struct vcmd_set_mapping_v0 {
12634 + const char __user *device;
12635 + const char __user *target;
12642 +#ifdef CONFIG_COMPAT
12644 +#include <asm/compat.h>
12646 +struct vcmd_set_mapping_v0_x32 {
12647 + compat_uptr_t device_ptr;
12648 + compat_uptr_t target_ptr;
12652 +#endif /* CONFIG_COMPAT */
12654 +#include <linux/compiler.h>
12656 +extern int vc_set_mapping(struct vx_info *, void __user *);
12657 +extern int vc_unset_mapping(struct vx_info *, void __user *);
12659 +#ifdef CONFIG_COMPAT
12661 +extern int vc_set_mapping_x32(struct vx_info *, void __user *);
12662 +extern int vc_unset_mapping_x32(struct vx_info *, void __user *);
12664 +#endif /* CONFIG_COMPAT */
12666 +#endif /* __KERNEL__ */
12667 +#endif /* _VX_DEVICE_CMD_H */
12668 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/device_def.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/device_def.h
12669 --- linux-2.6.34/include/linux/vserver/device_def.h 1970-01-01 01:00:00.000000000 +0100
12670 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/device_def.h 2010-05-18 18:11:22.000000000 +0200
12672 +#ifndef _VX_DEVICE_DEF_H
12673 +#define _VX_DEVICE_DEF_H
12675 +#include <linux/types.h>
12677 +struct vx_dmap_target {
12682 +struct _vx_device {
12683 +#ifdef CONFIG_VSERVER_DEVICE
12684 + struct vx_dmap_target targets[2];
12688 +#endif /* _VX_DEVICE_DEF_H */
12689 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/device.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/device.h
12690 --- linux-2.6.34/include/linux/vserver/device.h 1970-01-01 01:00:00.000000000 +0100
12691 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/device.h 2010-05-18 18:11:22.000000000 +0200
12693 +#ifndef _VX_DEVICE_H
12694 +#define _VX_DEVICE_H
12697 +#define DATTR_CREATE 0x00000001
12698 +#define DATTR_OPEN 0x00000002
12700 +#define DATTR_REMAP 0x00000010
12702 +#define DATTR_MASK 0x00000013
12705 +#else /* _VX_DEVICE_H */
12706 +#warning duplicate inclusion
12707 +#endif /* _VX_DEVICE_H */
12708 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/dlimit_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/dlimit_cmd.h
12709 --- linux-2.6.34/include/linux/vserver/dlimit_cmd.h 1970-01-01 01:00:00.000000000 +0100
12710 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/dlimit_cmd.h 2010-05-18 18:11:22.000000000 +0200
12712 +#ifndef _VX_DLIMIT_CMD_H
12713 +#define _VX_DLIMIT_CMD_H
12716 +/* dlimit vserver commands */
12718 +#define VCMD_add_dlimit VC_CMD(DLIMIT, 1, 0)
12719 +#define VCMD_rem_dlimit VC_CMD(DLIMIT, 2, 0)
12721 +#define VCMD_set_dlimit VC_CMD(DLIMIT, 5, 0)
12722 +#define VCMD_get_dlimit VC_CMD(DLIMIT, 6, 0)
12724 +struct vcmd_ctx_dlimit_base_v0 {
12725 + const char __user *name;
12729 +struct vcmd_ctx_dlimit_v0 {
12730 + const char __user *name;
12731 + uint32_t space_used; /* used space in kbytes */
12732 + uint32_t space_total; /* maximum space in kbytes */
12733 + uint32_t inodes_used; /* used inodes */
12734 + uint32_t inodes_total; /* maximum inodes */
12735 + uint32_t reserved; /* reserved for root in % */
12739 +#define CDLIM_UNSET ((uint32_t)0UL)
12740 +#define CDLIM_INFINITY ((uint32_t)~0UL)
12741 +#define CDLIM_KEEP ((uint32_t)~1UL)
12743 +#define DLIME_UNIT 0
12744 +#define DLIME_KILO 1
12745 +#define DLIME_MEGA 2
12746 +#define DLIME_GIGA 3
12748 +#define DLIMF_SHIFT 0x10
12750 +#define DLIMS_USED 0
12751 +#define DLIMS_TOTAL 2
12754 +uint64_t dlimit_space_32to64(uint32_t val, uint32_t flags, int shift)
12756 + int exp = (flags & DLIMF_SHIFT) ?
12757 + (flags >> shift) & DLIME_GIGA : DLIME_KILO;
12758 + return ((uint64_t)val) << (10 * exp);
12762 +uint32_t dlimit_space_64to32(uint64_t val, uint32_t *flags, int shift)
12766 + if (*flags & DLIMF_SHIFT) {
12767 + while (val > (1LL << 32) && (exp < 3)) {
12771 + *flags &= ~(DLIME_GIGA << shift);
12772 + *flags |= exp << shift;
12780 +#ifdef CONFIG_COMPAT
12782 +#include <asm/compat.h>
12784 +struct vcmd_ctx_dlimit_base_v0_x32 {
12785 + compat_uptr_t name_ptr;
12789 +struct vcmd_ctx_dlimit_v0_x32 {
12790 + compat_uptr_t name_ptr;
12791 + uint32_t space_used; /* used space in kbytes */
12792 + uint32_t space_total; /* maximum space in kbytes */
12793 + uint32_t inodes_used; /* used inodes */
12794 + uint32_t inodes_total; /* maximum inodes */
12795 + uint32_t reserved; /* reserved for root in % */
12799 +#endif /* CONFIG_COMPAT */
12801 +#include <linux/compiler.h>
12803 +extern int vc_add_dlimit(uint32_t, void __user *);
12804 +extern int vc_rem_dlimit(uint32_t, void __user *);
12806 +extern int vc_set_dlimit(uint32_t, void __user *);
12807 +extern int vc_get_dlimit(uint32_t, void __user *);
12809 +#ifdef CONFIG_COMPAT
12811 +extern int vc_add_dlimit_x32(uint32_t, void __user *);
12812 +extern int vc_rem_dlimit_x32(uint32_t, void __user *);
12814 +extern int vc_set_dlimit_x32(uint32_t, void __user *);
12815 +extern int vc_get_dlimit_x32(uint32_t, void __user *);
12817 +#endif /* CONFIG_COMPAT */
12819 +#endif /* __KERNEL__ */
12820 +#endif /* _VX_DLIMIT_CMD_H */
12821 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/dlimit.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/dlimit.h
12822 --- linux-2.6.34/include/linux/vserver/dlimit.h 1970-01-01 01:00:00.000000000 +0100
12823 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/dlimit.h 2010-05-18 18:11:22.000000000 +0200
12825 +#ifndef _VX_DLIMIT_H
12826 +#define _VX_DLIMIT_H
12828 +#include "switch.h"
12833 +/* keep in sync with CDLIM_INFINITY */
12835 +#define DLIM_INFINITY (~0ULL)
12837 +#include <linux/spinlock.h>
12838 +#include <linux/rcupdate.h>
12840 +struct super_block;
12843 + struct hlist_node dl_hlist; /* linked list of contexts */
12844 + struct rcu_head dl_rcu; /* the rcu head */
12845 + tag_t dl_tag; /* context tag */
12846 + atomic_t dl_usecnt; /* usage count */
12847 + atomic_t dl_refcnt; /* reference count */
12849 + struct super_block *dl_sb; /* associated superblock */
12851 + spinlock_t dl_lock; /* protect the values */
12853 + unsigned long long dl_space_used; /* used space in bytes */
12854 + unsigned long long dl_space_total; /* maximum space in bytes */
12855 + unsigned long dl_inodes_used; /* used inodes */
12856 + unsigned long dl_inodes_total; /* maximum inodes */
12858 + unsigned int dl_nrlmult; /* non root limit mult */
12863 +extern void rcu_free_dl_info(struct rcu_head *);
12864 +extern void unhash_dl_info(struct dl_info *);
12866 +extern struct dl_info *locate_dl_info(struct super_block *, tag_t);
12871 +extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
12873 +typedef uint64_t dlsize_t;
12875 +#endif /* __KERNEL__ */
12876 +#else /* _VX_DLIMIT_H */
12877 +#warning duplicate inclusion
12878 +#endif /* _VX_DLIMIT_H */
12879 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/global.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/global.h
12880 --- linux-2.6.34/include/linux/vserver/global.h 1970-01-01 01:00:00.000000000 +0100
12881 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/global.h 2010-05-18 18:11:22.000000000 +0200
12883 +#ifndef _VX_GLOBAL_H
12884 +#define _VX_GLOBAL_H
12887 +extern atomic_t vx_global_ctotal;
12888 +extern atomic_t vx_global_cactive;
12890 +extern atomic_t nx_global_ctotal;
12891 +extern atomic_t nx_global_cactive;
12893 +extern atomic_t vs_global_nsproxy;
12894 +extern atomic_t vs_global_fs;
12895 +extern atomic_t vs_global_mnt_ns;
12896 +extern atomic_t vs_global_uts_ns;
12897 +extern atomic_t vs_global_user_ns;
12898 +extern atomic_t vs_global_pid_ns;
12901 +#endif /* _VX_GLOBAL_H */
12902 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/history.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/history.h
12903 --- linux-2.6.34/include/linux/vserver/history.h 1970-01-01 01:00:00.000000000 +0100
12904 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/history.h 2010-05-18 18:11:22.000000000 +0200
12906 +#ifndef _VX_HISTORY_H
12907 +#define _VX_HISTORY_H
12912 + VXH_THROW_OOPS = 1,
12916 + VXH_INIT_VX_INFO,
12919 + VXH_CLAIM_VX_INFO,
12920 + VXH_RELEASE_VX_INFO,
12921 + VXH_ALLOC_VX_INFO,
12922 + VXH_DEALLOC_VX_INFO,
12923 + VXH_HASH_VX_INFO,
12924 + VXH_UNHASH_VX_INFO,
12926 + VXH_LOOKUP_VX_INFO,
12927 + VXH_CREATE_VX_INFO,
12930 +struct _vxhe_vxi {
12931 + struct vx_info *ptr;
12937 +struct _vxhe_set_clr {
12941 +struct _vxhe_loc_lookup {
12945 +struct _vx_hist_entry {
12947 + unsigned short seq;
12948 + unsigned short type;
12949 + struct _vxhe_vxi vxi;
12951 + struct _vxhe_set_clr sc;
12952 + struct _vxhe_loc_lookup ll;
12956 +#ifdef CONFIG_VSERVER_HISTORY
12958 +extern unsigned volatile int vxh_active;
12960 +struct _vx_hist_entry *vxh_advance(void *loc);
12964 +void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
12966 + entry->vxi.ptr = vxi;
12968 + entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
12969 + entry->vxi.tasks = atomic_read(&vxi->vx_tasks);
12970 + entry->vxi.xid = vxi->vx_id;
12975 +#define __HERE__ current_text_addr()
12977 +#define __VXH_BODY(__type, __data, __here) \
12978 + struct _vx_hist_entry *entry; \
12980 + preempt_disable(); \
12981 + entry = vxh_advance(__here); \
12983 + entry->type = __type; \
12984 + preempt_enable();
12987 + /* pass vxi only */
12989 +#define __VXH_SMPL \
12990 + __vxh_copy_vxi(entry, vxi)
12993 +void __vxh_smpl(struct vx_info *vxi, int __type, void *__here)
12995 + __VXH_BODY(__type, __VXH_SMPL, __here)
12998 + /* pass vxi and data (void *) */
13000 +#define __VXH_DATA \
13001 + __vxh_copy_vxi(entry, vxi); \
13002 + entry->sc.data = data
13005 +void __vxh_data(struct vx_info *vxi, void *data,
13006 + int __type, void *__here)
13008 + __VXH_BODY(__type, __VXH_DATA, __here)
13011 + /* pass vxi and arg (long) */
13013 +#define __VXH_LONG \
13014 + __vxh_copy_vxi(entry, vxi); \
13015 + entry->ll.arg = arg
13018 +void __vxh_long(struct vx_info *vxi, long arg,
13019 + int __type, void *__here)
13021 + __VXH_BODY(__type, __VXH_LONG, __here)
13026 +void __vxh_throw_oops(void *__here)
13028 + __VXH_BODY(VXH_THROW_OOPS, {}, __here);
13029 + /* prevent further acquisition */
13034 +#define vxh_throw_oops() __vxh_throw_oops(__HERE__);
13036 +#define __vxh_get_vx_info(v, h) __vxh_smpl(v, VXH_GET_VX_INFO, h);
13037 +#define __vxh_put_vx_info(v, h) __vxh_smpl(v, VXH_PUT_VX_INFO, h);
13039 +#define __vxh_init_vx_info(v, d, h) \
13040 + __vxh_data(v, d, VXH_INIT_VX_INFO, h);
13041 +#define __vxh_set_vx_info(v, d, h) \
13042 + __vxh_data(v, d, VXH_SET_VX_INFO, h);
13043 +#define __vxh_clr_vx_info(v, d, h) \
13044 + __vxh_data(v, d, VXH_CLR_VX_INFO, h);
13046 +#define __vxh_claim_vx_info(v, d, h) \
13047 + __vxh_data(v, d, VXH_CLAIM_VX_INFO, h);
13048 +#define __vxh_release_vx_info(v, d, h) \
13049 + __vxh_data(v, d, VXH_RELEASE_VX_INFO, h);
13051 +#define vxh_alloc_vx_info(v) \
13052 + __vxh_smpl(v, VXH_ALLOC_VX_INFO, __HERE__);
13053 +#define vxh_dealloc_vx_info(v) \
13054 + __vxh_smpl(v, VXH_DEALLOC_VX_INFO, __HERE__);
13056 +#define vxh_hash_vx_info(v) \
13057 + __vxh_smpl(v, VXH_HASH_VX_INFO, __HERE__);
13058 +#define vxh_unhash_vx_info(v) \
13059 + __vxh_smpl(v, VXH_UNHASH_VX_INFO, __HERE__);
13061 +#define vxh_loc_vx_info(v, l) \
13062 + __vxh_long(v, l, VXH_LOC_VX_INFO, __HERE__);
13063 +#define vxh_lookup_vx_info(v, l) \
13064 + __vxh_long(v, l, VXH_LOOKUP_VX_INFO, __HERE__);
13065 +#define vxh_create_vx_info(v, l) \
13066 + __vxh_long(v, l, VXH_CREATE_VX_INFO, __HERE__);
13068 +extern void vxh_dump_history(void);
13071 +#else /* CONFIG_VSERVER_HISTORY */
13073 +#define __HERE__ 0
13075 +#define vxh_throw_oops() do { } while (0)
13077 +#define __vxh_get_vx_info(v, h) do { } while (0)
13078 +#define __vxh_put_vx_info(v, h) do { } while (0)
13080 +#define __vxh_init_vx_info(v, d, h) do { } while (0)
13081 +#define __vxh_set_vx_info(v, d, h) do { } while (0)
13082 +#define __vxh_clr_vx_info(v, d, h) do { } while (0)
13084 +#define __vxh_claim_vx_info(v, d, h) do { } while (0)
13085 +#define __vxh_release_vx_info(v, d, h) do { } while (0)
13087 +#define vxh_alloc_vx_info(v) do { } while (0)
13088 +#define vxh_dealloc_vx_info(v) do { } while (0)
13090 +#define vxh_hash_vx_info(v) do { } while (0)
13091 +#define vxh_unhash_vx_info(v) do { } while (0)
13093 +#define vxh_loc_vx_info(v, l) do { } while (0)
13094 +#define vxh_lookup_vx_info(v, l) do { } while (0)
13095 +#define vxh_create_vx_info(v, l) do { } while (0)
13097 +#define vxh_dump_history() do { } while (0)
13100 +#endif /* CONFIG_VSERVER_HISTORY */
13102 +#endif /* _VX_HISTORY_H */
13103 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/inode_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/inode_cmd.h
13104 --- linux-2.6.34/include/linux/vserver/inode_cmd.h 1970-01-01 01:00:00.000000000 +0100
13105 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/inode_cmd.h 2010-05-18 18:11:22.000000000 +0200
13107 +#ifndef _VX_INODE_CMD_H
13108 +#define _VX_INODE_CMD_H
13111 +/* inode vserver commands */
13113 +#define VCMD_get_iattr VC_CMD(INODE, 1, 1)
13114 +#define VCMD_set_iattr VC_CMD(INODE, 2, 1)
13116 +#define VCMD_fget_iattr VC_CMD(INODE, 3, 0)
13117 +#define VCMD_fset_iattr VC_CMD(INODE, 4, 0)
13119 +struct vcmd_ctx_iattr_v1 {
13120 + const char __user *name;
13126 +struct vcmd_ctx_fiattr_v0 {
13136 +#ifdef CONFIG_COMPAT
13138 +#include <asm/compat.h>
13140 +struct vcmd_ctx_iattr_v1_x32 {
13141 + compat_uptr_t name_ptr;
13147 +#endif /* CONFIG_COMPAT */
13149 +#include <linux/compiler.h>
13151 +extern int vc_get_iattr(void __user *);
13152 +extern int vc_set_iattr(void __user *);
13154 +extern int vc_fget_iattr(uint32_t, void __user *);
13155 +extern int vc_fset_iattr(uint32_t, void __user *);
13157 +#ifdef CONFIG_COMPAT
13159 +extern int vc_get_iattr_x32(void __user *);
13160 +extern int vc_set_iattr_x32(void __user *);
13162 +#endif /* CONFIG_COMPAT */
13164 +#endif /* __KERNEL__ */
13165 +#endif /* _VX_INODE_CMD_H */
13166 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/inode.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/inode.h
13167 --- linux-2.6.34/include/linux/vserver/inode.h 1970-01-01 01:00:00.000000000 +0100
13168 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/inode.h 2010-05-18 18:11:22.000000000 +0200
13170 +#ifndef _VX_INODE_H
13171 +#define _VX_INODE_H
13174 +#define IATTR_TAG 0x01000000
13176 +#define IATTR_ADMIN 0x00000001
13177 +#define IATTR_WATCH 0x00000002
13178 +#define IATTR_HIDE 0x00000004
13179 +#define IATTR_FLAGS 0x00000007
13181 +#define IATTR_BARRIER 0x00010000
13182 +#define IATTR_IXUNLINK 0x00020000
13183 +#define IATTR_IMMUTABLE 0x00040000
13184 +#define IATTR_COW 0x00080000
13189 +#ifdef CONFIG_VSERVER_PROC_SECURE
13190 +#define IATTR_PROC_DEFAULT ( IATTR_ADMIN | IATTR_HIDE )
13191 +#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
13193 +#define IATTR_PROC_DEFAULT ( IATTR_ADMIN )
13194 +#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
13197 +#define vx_hide_check(c, m) (((m) & IATTR_HIDE) ? vx_check(c, m) : 1)
13199 +#endif /* __KERNEL__ */
13201 +/* inode ioctls */
13203 +#define FIOC_GETXFLG _IOR('x', 5, long)
13204 +#define FIOC_SETXFLG _IOW('x', 6, long)
13206 +#else /* _VX_INODE_H */
13207 +#warning duplicate inclusion
13208 +#endif /* _VX_INODE_H */
13209 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/Kbuild linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/Kbuild
13210 --- linux-2.6.34/include/linux/vserver/Kbuild 1970-01-01 01:00:00.000000000 +0100
13211 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/Kbuild 2010-05-18 18:11:22.000000000 +0200
13214 +unifdef-y += context_cmd.h network_cmd.h space_cmd.h \
13215 + cacct_cmd.h cvirt_cmd.h limit_cmd.h dlimit_cmd.h \
13216 + inode_cmd.h tag_cmd.h sched_cmd.h signal_cmd.h \
13217 + debug_cmd.h device_cmd.h
13219 +unifdef-y += switch.h network.h monitor.h inode.h device.h
13221 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/limit_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/limit_cmd.h
13222 --- linux-2.6.34/include/linux/vserver/limit_cmd.h 1970-01-01 01:00:00.000000000 +0100
13223 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/limit_cmd.h 2010-05-18 18:11:22.000000000 +0200
13225 +#ifndef _VX_LIMIT_CMD_H
13226 +#define _VX_LIMIT_CMD_H
13229 +/* rlimit vserver commands */
13231 +#define VCMD_get_rlimit VC_CMD(RLIMIT, 1, 0)
13232 +#define VCMD_set_rlimit VC_CMD(RLIMIT, 2, 0)
13233 +#define VCMD_get_rlimit_mask VC_CMD(RLIMIT, 3, 0)
13234 +#define VCMD_reset_hits VC_CMD(RLIMIT, 7, 0)
13235 +#define VCMD_reset_minmax VC_CMD(RLIMIT, 9, 0)
13237 +struct vcmd_ctx_rlimit_v0 {
13239 + uint64_t minimum;
13240 + uint64_t softlimit;
13241 + uint64_t maximum;
13244 +struct vcmd_ctx_rlimit_mask_v0 {
13245 + uint32_t minimum;
13246 + uint32_t softlimit;
13247 + uint32_t maximum;
13250 +#define VCMD_rlimit_stat VC_CMD(VSTAT, 1, 0)
13252 +struct vcmd_rlimit_stat_v0 {
13256 + uint64_t minimum;
13257 + uint64_t maximum;
13260 +#define CRLIM_UNSET (0ULL)
13261 +#define CRLIM_INFINITY (~0ULL)
13262 +#define CRLIM_KEEP (~1ULL)
13266 +#ifdef CONFIG_IA32_EMULATION
13268 +struct vcmd_ctx_rlimit_v0_x32 {
13270 + uint64_t minimum;
13271 + uint64_t softlimit;
13272 + uint64_t maximum;
13273 +} __attribute__ ((packed));
13275 +#endif /* CONFIG_IA32_EMULATION */
13277 +#include <linux/compiler.h>
13279 +extern int vc_get_rlimit_mask(uint32_t, void __user *);
13280 +extern int vc_get_rlimit(struct vx_info *, void __user *);
13281 +extern int vc_set_rlimit(struct vx_info *, void __user *);
13282 +extern int vc_reset_hits(struct vx_info *, void __user *);
13283 +extern int vc_reset_minmax(struct vx_info *, void __user *);
13285 +extern int vc_rlimit_stat(struct vx_info *, void __user *);
13287 +#ifdef CONFIG_IA32_EMULATION
13289 +extern int vc_get_rlimit_x32(struct vx_info *, void __user *);
13290 +extern int vc_set_rlimit_x32(struct vx_info *, void __user *);
13292 +#endif /* CONFIG_IA32_EMULATION */
13294 +#endif /* __KERNEL__ */
13295 +#endif /* _VX_LIMIT_CMD_H */
13296 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/limit_def.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/limit_def.h
13297 --- linux-2.6.34/include/linux/vserver/limit_def.h 1970-01-01 01:00:00.000000000 +0100
13298 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/limit_def.h 2010-05-18 18:11:22.000000000 +0200
13300 +#ifndef _VX_LIMIT_DEF_H
13301 +#define _VX_LIMIT_DEF_H
13303 +#include <asm/atomic.h>
13304 +#include <asm/resource.h>
13306 +#include "limit.h"
13309 +struct _vx_res_limit {
13310 + rlim_t soft; /* Context soft limit */
13311 + rlim_t hard; /* Context hard limit */
13313 + rlim_atomic_t rcur; /* Current value */
13314 + rlim_t rmin; /* Context minimum */
13315 + rlim_t rmax; /* Context maximum */
13317 + atomic_t lhit; /* Limit hits */
13320 +/* context sub struct */
13322 +struct _vx_limit {
13323 + struct _vx_res_limit res[NUM_LIMITS];
13326 +#ifdef CONFIG_VSERVER_DEBUG
13328 +static inline void __dump_vx_limit(struct _vx_limit *limit)
13332 + printk("\t_vx_limit:");
13333 + for (i = 0; i < NUM_LIMITS; i++) {
13334 + printk("\t [%2d] = %8lu %8lu/%8lu, %8ld/%8ld, %8d\n",
13335 + i, (unsigned long)__rlim_get(limit, i),
13336 + (unsigned long)__rlim_rmin(limit, i),
13337 + (unsigned long)__rlim_rmax(limit, i),
13338 + (long)__rlim_soft(limit, i),
13339 + (long)__rlim_hard(limit, i),
13340 + atomic_read(&__rlim_lhit(limit, i)));
13346 +#endif /* _VX_LIMIT_DEF_H */
13347 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/limit.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/limit.h
13348 --- linux-2.6.34/include/linux/vserver/limit.h 1970-01-01 01:00:00.000000000 +0100
13349 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/limit.h 2010-05-18 18:11:22.000000000 +0200
13351 +#ifndef _VX_LIMIT_H
13352 +#define _VX_LIMIT_H
13354 +#define VLIMIT_NSOCK 16
13355 +#define VLIMIT_OPENFD 17
13356 +#define VLIMIT_ANON 18
13357 +#define VLIMIT_SHMEM 19
13358 +#define VLIMIT_SEMARY 20
13359 +#define VLIMIT_NSEMS 21
13360 +#define VLIMIT_DENTRY 22
13361 +#define VLIMIT_MAPPED 23
13366 +#define VLIM_NOCHECK ((1L << VLIMIT_DENTRY) | (1L << RLIMIT_RSS))
13368 +/* keep in sync with CRLIM_INFINITY */
13370 +#define VLIM_INFINITY (~0ULL)
13372 +#include <asm/atomic.h>
13373 +#include <asm/resource.h>
13375 +#ifndef RLIM_INFINITY
13376 +#warning RLIM_INFINITY is undefined
13379 +#define __rlim_val(l, r, v) ((l)->res[r].v)
13381 +#define __rlim_soft(l, r) __rlim_val(l, r, soft)
13382 +#define __rlim_hard(l, r) __rlim_val(l, r, hard)
13384 +#define __rlim_rcur(l, r) __rlim_val(l, r, rcur)
13385 +#define __rlim_rmin(l, r) __rlim_val(l, r, rmin)
13386 +#define __rlim_rmax(l, r) __rlim_val(l, r, rmax)
13388 +#define __rlim_lhit(l, r) __rlim_val(l, r, lhit)
13389 +#define __rlim_hit(l, r) atomic_inc(&__rlim_lhit(l, r))
13391 +typedef atomic_long_t rlim_atomic_t;
13392 +typedef unsigned long rlim_t;
13394 +#define __rlim_get(l, r) atomic_long_read(&__rlim_rcur(l, r))
13395 +#define __rlim_set(l, r, v) atomic_long_set(&__rlim_rcur(l, r), v)
13396 +#define __rlim_inc(l, r) atomic_long_inc(&__rlim_rcur(l, r))
13397 +#define __rlim_dec(l, r) atomic_long_dec(&__rlim_rcur(l, r))
13398 +#define __rlim_add(l, r, v) atomic_long_add(v, &__rlim_rcur(l, r))
13399 +#define __rlim_sub(l, r, v) atomic_long_sub(v, &__rlim_rcur(l, r))
13402 +#if (RLIM_INFINITY == VLIM_INFINITY)
13403 +#define VX_VLIM(r) ((long long)(long)(r))
13404 +#define VX_RLIM(v) ((rlim_t)(v))
13406 +#define VX_VLIM(r) (((r) == RLIM_INFINITY) \
13407 + ? VLIM_INFINITY : (long long)(r))
13408 +#define VX_RLIM(v) (((v) == VLIM_INFINITY) \
13409 + ? RLIM_INFINITY : (rlim_t)(v))
13414 +void vx_vsi_meminfo(struct sysinfo *);
13415 +void vx_vsi_swapinfo(struct sysinfo *);
13416 +long vx_vsi_cached(struct sysinfo *);
13418 +#define NUM_LIMITS 24
13420 +#endif /* __KERNEL__ */
13421 +#endif /* _VX_LIMIT_H */
13422 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/limit_int.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/limit_int.h
13423 --- linux-2.6.34/include/linux/vserver/limit_int.h 1970-01-01 01:00:00.000000000 +0100
13424 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/limit_int.h 2010-05-18 18:11:22.000000000 +0200
13426 +#ifndef _VX_LIMIT_INT_H
13427 +#define _VX_LIMIT_INT_H
13429 +#include "context.h"
13433 +#define VXD_RCRES_COND(r) VXD_CBIT(cres, r)
13434 +#define VXD_RLIMIT_COND(r) VXD_CBIT(limit, r)
13436 +extern const char *vlimit_name[NUM_LIMITS];
13438 +static inline void __vx_acc_cres(struct vx_info *vxi,
13439 + int res, int dir, void *_data, char *_file, int _line)
13441 + if (VXD_RCRES_COND(res))
13442 + vxlprintk(1, "vx_acc_cres[%5d,%s,%2d]: %5ld%s (%p)",
13443 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13444 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13445 + (dir > 0) ? "++" : "--", _data, _file, _line);
13450 + __rlim_inc(&vxi->limit, res);
13452 + __rlim_dec(&vxi->limit, res);
13455 +static inline void __vx_add_cres(struct vx_info *vxi,
13456 + int res, int amount, void *_data, char *_file, int _line)
13458 + if (VXD_RCRES_COND(res))
13459 + vxlprintk(1, "vx_add_cres[%5d,%s,%2d]: %5ld += %5d (%p)",
13460 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13461 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13462 + amount, _data, _file, _line);
13467 + __rlim_add(&vxi->limit, res, amount);
13471 +int __vx_cres_adjust_max(struct _vx_limit *limit, int res, rlim_t value)
13473 + int cond = (value > __rlim_rmax(limit, res));
13476 + __rlim_rmax(limit, res) = value;
13481 +int __vx_cres_adjust_min(struct _vx_limit *limit, int res, rlim_t value)
13483 + int cond = (value < __rlim_rmin(limit, res));
13486 + __rlim_rmin(limit, res) = value;
13491 +void __vx_cres_fixup(struct _vx_limit *limit, int res, rlim_t value)
13493 + if (!__vx_cres_adjust_max(limit, res, value))
13494 + __vx_cres_adjust_min(limit, res, value);
13499 + +1 ... no limit hit
13500 + -1 ... over soft limit
13501 + 0 ... over hard limit */
13503 +static inline int __vx_cres_avail(struct vx_info *vxi,
13504 + int res, int num, char *_file, int _line)
13506 + struct _vx_limit *limit;
13509 + if (VXD_RLIMIT_COND(res))
13510 + vxlprintk(1, "vx_cres_avail[%5d,%s,%2d]: %5ld/%5ld > %5ld + %5d",
13511 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13512 + (vxi ? (long)__rlim_soft(&vxi->limit, res) : -1),
13513 + (vxi ? (long)__rlim_hard(&vxi->limit, res) : -1),
13514 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13515 + num, _file, _line);
13519 + limit = &vxi->limit;
13520 + value = __rlim_get(limit, res);
13522 + if (!__vx_cres_adjust_max(limit, res, value))
13523 + __vx_cres_adjust_min(limit, res, value);
13528 + if (__rlim_soft(limit, res) == RLIM_INFINITY)
13530 + if (value + num <= __rlim_soft(limit, res))
13533 + if (__rlim_hard(limit, res) == RLIM_INFINITY)
13535 + if (value + num <= __rlim_hard(limit, res))
13538 + __rlim_hit(limit, res);
13543 +static const int VLA_RSS[] = { RLIMIT_RSS, VLIMIT_ANON, VLIMIT_MAPPED, 0 };
13546 +rlim_t __vx_cres_array_sum(struct _vx_limit *limit, const int *array)
13548 + rlim_t value, sum = 0;
13551 + while ((res = *array++)) {
13552 + value = __rlim_get(limit, res);
13553 + __vx_cres_fixup(limit, res, value);
13560 +rlim_t __vx_cres_array_fixup(struct _vx_limit *limit, const int *array)
13562 + rlim_t value = __vx_cres_array_sum(limit, array + 1);
13563 + int res = *array;
13565 + if (value == __rlim_get(limit, res))
13568 + __rlim_set(limit, res, value);
13569 + /* now adjust min/max */
13570 + if (!__vx_cres_adjust_max(limit, res, value))
13571 + __vx_cres_adjust_min(limit, res, value);
13576 +static inline int __vx_cres_array_avail(struct vx_info *vxi,
13577 + const int *array, int num, char *_file, int _line)
13579 + struct _vx_limit *limit;
13580 + rlim_t value = 0;
13588 + limit = &vxi->limit;
13590 + value = __vx_cres_array_sum(limit, array + 1);
13592 + __rlim_set(limit, res, value);
13593 + __vx_cres_fixup(limit, res, value);
13595 + return __vx_cres_avail(vxi, res, num, _file, _line);
13599 +static inline void vx_limit_fixup(struct _vx_limit *limit, int id)
13604 + /* complex resources first */
13605 + if ((id < 0) || (id == RLIMIT_RSS))
13606 + __vx_cres_array_fixup(limit, VLA_RSS);
13608 + for (res = 0; res < NUM_LIMITS; res++) {
13609 + if ((id > 0) && (res != id))
13612 + value = __rlim_get(limit, res);
13613 + __vx_cres_fixup(limit, res, value);
13615 + /* not supposed to happen, maybe warn? */
13616 + if (__rlim_rmax(limit, res) > __rlim_hard(limit, res))
13617 + __rlim_rmax(limit, res) = __rlim_hard(limit, res);
13622 +#endif /* __KERNEL__ */
13623 +#endif /* _VX_LIMIT_INT_H */
13624 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/monitor.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/monitor.h
13625 --- linux-2.6.34/include/linux/vserver/monitor.h 1970-01-01 01:00:00.000000000 +0100
13626 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/monitor.h 2010-05-18 18:11:22.000000000 +0200
13628 +#ifndef _VX_MONITOR_H
13629 +#define _VX_MONITOR_H
13631 +#include <linux/types.h>
13638 + VXM_UPDATE = 0x20,
13642 + VXM_RQINFO_1 = 0x24,
13645 + VXM_ACTIVATE = 0x40,
13652 + VXM_MIGRATE = 0x48,
13655 + /* all other bits are flags */
13656 + VXM_SCHED = 0x80,
13659 +struct _vxm_update_1 {
13660 + uint32_t tokens_max;
13661 + uint32_t fill_rate;
13662 + uint32_t interval;
13665 +struct _vxm_update_2 {
13666 + uint32_t tokens_min;
13667 + uint32_t fill_rate;
13668 + uint32_t interval;
13671 +struct _vxm_rqinfo_1 {
13672 + uint16_t running;
13676 + uint32_t idle_tokens;
13679 +struct _vxm_rqinfo_2 {
13680 + uint32_t norm_time;
13681 + uint32_t idle_time;
13682 + uint32_t idle_skip;
13685 +struct _vxm_sched {
13687 + uint32_t norm_time;
13688 + uint32_t idle_time;
13691 +struct _vxm_task {
13696 +struct _vxm_event {
13705 + struct _vxm_task tsk;
13709 +struct _vx_mon_entry {
13713 + struct _vxm_event ev;
13714 + struct _vxm_sched sd;
13715 + struct _vxm_update_1 u1;
13716 + struct _vxm_update_2 u2;
13717 + struct _vxm_rqinfo_1 q1;
13718 + struct _vxm_rqinfo_2 q2;
13723 +#endif /* _VX_MONITOR_H */
13724 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/network_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/network_cmd.h
13725 --- linux-2.6.34/include/linux/vserver/network_cmd.h 1970-01-01 01:00:00.000000000 +0100
13726 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/network_cmd.h 2010-05-18 18:11:22.000000000 +0200
13728 +#ifndef _VX_NETWORK_CMD_H
13729 +#define _VX_NETWORK_CMD_H
13732 +/* vinfo commands */
13734 +#define VCMD_task_nid VC_CMD(VINFO, 2, 0)
13737 +extern int vc_task_nid(uint32_t);
13739 +#endif /* __KERNEL__ */
13741 +#define VCMD_nx_info VC_CMD(VINFO, 6, 0)
13743 +struct vcmd_nx_info_v0 {
13745 + /* more to come */
13749 +extern int vc_nx_info(struct nx_info *, void __user *);
13751 +#endif /* __KERNEL__ */
13753 +#include <linux/in.h>
13754 +#include <linux/in6.h>
13756 +#define VCMD_net_create_v0 VC_CMD(VNET, 1, 0)
13757 +#define VCMD_net_create VC_CMD(VNET, 1, 1)
13759 +struct vcmd_net_create {
13760 + uint64_t flagword;
13763 +#define VCMD_net_migrate VC_CMD(NETMIG, 1, 0)
13765 +#define VCMD_net_add VC_CMD(NETALT, 1, 0)
13766 +#define VCMD_net_remove VC_CMD(NETALT, 2, 0)
13768 +struct vcmd_net_addr_v0 {
13771 + struct in_addr ip[4];
13772 + struct in_addr mask[4];
13775 +#define VCMD_net_add_ipv4 VC_CMD(NETALT, 1, 1)
13776 +#define VCMD_net_remove_ipv4 VC_CMD(NETALT, 2, 1)
13778 +struct vcmd_net_addr_ipv4_v1 {
13781 + struct in_addr ip;
13782 + struct in_addr mask;
13785 +#define VCMD_net_add_ipv6 VC_CMD(NETALT, 3, 1)
13786 +#define VCMD_net_remove_ipv6 VC_CMD(NETALT, 4, 1)
13788 +struct vcmd_net_addr_ipv6_v1 {
13792 + struct in6_addr ip;
13793 + struct in6_addr mask;
13796 +#define VCMD_add_match_ipv4 VC_CMD(NETALT, 5, 0)
13797 +#define VCMD_get_match_ipv4 VC_CMD(NETALT, 6, 0)
13799 +struct vcmd_match_ipv4_v0 {
13804 + struct in_addr ip;
13805 + struct in_addr ip2;
13806 + struct in_addr mask;
13809 +#define VCMD_add_match_ipv6 VC_CMD(NETALT, 7, 0)
13810 +#define VCMD_get_match_ipv6 VC_CMD(NETALT, 8, 0)
13812 +struct vcmd_match_ipv6_v0 {
13817 + struct in6_addr ip;
13818 + struct in6_addr ip2;
13819 + struct in6_addr mask;
13824 +extern int vc_net_create(uint32_t, void __user *);
13825 +extern int vc_net_migrate(struct nx_info *, void __user *);
13827 +extern int vc_net_add(struct nx_info *, void __user *);
13828 +extern int vc_net_remove(struct nx_info *, void __user *);
13830 +extern int vc_net_add_ipv4(struct nx_info *, void __user *);
13831 +extern int vc_net_remove_ipv4(struct nx_info *, void __user *);
13833 +extern int vc_net_add_ipv6(struct nx_info *, void __user *);
13834 +extern int vc_net_remove_ipv6(struct nx_info *, void __user *);
13836 +extern int vc_add_match_ipv4(struct nx_info *, void __user *);
13837 +extern int vc_get_match_ipv4(struct nx_info *, void __user *);
13839 +extern int vc_add_match_ipv6(struct nx_info *, void __user *);
13840 +extern int vc_get_match_ipv6(struct nx_info *, void __user *);
13842 +#endif /* __KERNEL__ */
13845 +/* flag commands */
13847 +#define VCMD_get_nflags VC_CMD(FLAGS, 5, 0)
13848 +#define VCMD_set_nflags VC_CMD(FLAGS, 6, 0)
13850 +struct vcmd_net_flags_v0 {
13851 + uint64_t flagword;
13856 +extern int vc_get_nflags(struct nx_info *, void __user *);
13857 +extern int vc_set_nflags(struct nx_info *, void __user *);
13859 +#endif /* __KERNEL__ */
13862 +/* network caps commands */
13864 +#define VCMD_get_ncaps VC_CMD(FLAGS, 7, 0)
13865 +#define VCMD_set_ncaps VC_CMD(FLAGS, 8, 0)
13867 +struct vcmd_net_caps_v0 {
13873 +extern int vc_get_ncaps(struct nx_info *, void __user *);
13874 +extern int vc_set_ncaps(struct nx_info *, void __user *);
13876 +#endif /* __KERNEL__ */
13877 +#endif /* _VX_CONTEXT_CMD_H */
13878 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/network.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/network.h
13879 --- linux-2.6.34/include/linux/vserver/network.h 1970-01-01 01:00:00.000000000 +0100
13880 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/network.h 2010-05-18 18:11:22.000000000 +0200
13882 +#ifndef _VX_NETWORK_H
13883 +#define _VX_NETWORK_H
13885 +#include <linux/types.h>
13888 +#define MAX_N_CONTEXT 65535 /* Arbitrary limit */
13891 +/* network flags */
13893 +#define NXF_INFO_PRIVATE 0x00000008
13895 +#define NXF_SINGLE_IP 0x00000100
13896 +#define NXF_LBACK_REMAP 0x00000200
13897 +#define NXF_LBACK_ALLOW 0x00000400
13899 +#define NXF_HIDE_NETIF 0x02000000
13900 +#define NXF_HIDE_LBACK 0x04000000
13902 +#define NXF_STATE_SETUP (1ULL << 32)
13903 +#define NXF_STATE_ADMIN (1ULL << 34)
13905 +#define NXF_SC_HELPER (1ULL << 36)
13906 +#define NXF_PERSISTENT (1ULL << 38)
13908 +#define NXF_ONE_TIME (0x0005ULL << 32)
13911 +#define NXF_INIT_SET (__nxf_init_set())
13913 +static inline uint64_t __nxf_init_set(void) {
13914 + return NXF_STATE_ADMIN
13915 +#ifdef CONFIG_VSERVER_AUTO_LBACK
13916 + | NXF_LBACK_REMAP
13919 +#ifdef CONFIG_VSERVER_AUTO_SINGLE
13922 + | NXF_HIDE_NETIF;
13926 +/* network caps */
13928 +#define NXC_TUN_CREATE 0x00000001
13930 +#define NXC_RAW_ICMP 0x00000100
13933 +/* address types */
13935 +#define NXA_TYPE_IPV4 0x0001
13936 +#define NXA_TYPE_IPV6 0x0002
13938 +#define NXA_TYPE_NONE 0x0000
13939 +#define NXA_TYPE_ANY 0x00FF
13941 +#define NXA_TYPE_ADDR 0x0010
13942 +#define NXA_TYPE_MASK 0x0020
13943 +#define NXA_TYPE_RANGE 0x0040
13945 +#define NXA_MASK_ALL (NXA_TYPE_ADDR | NXA_TYPE_MASK | NXA_TYPE_RANGE)
13947 +#define NXA_MOD_BCAST 0x0100
13948 +#define NXA_MOD_LBACK 0x0200
13950 +#define NXA_LOOPBACK 0x1000
13952 +#define NXA_MASK_BIND (NXA_MASK_ALL | NXA_MOD_BCAST | NXA_MOD_LBACK)
13953 +#define NXA_MASK_SHOW (NXA_MASK_ALL | NXA_LOOPBACK)
13957 +#include <linux/list.h>
13958 +#include <linux/spinlock.h>
13959 +#include <linux/rcupdate.h>
13960 +#include <linux/in.h>
13961 +#include <linux/in6.h>
13962 +#include <asm/atomic.h>
13964 +struct nx_addr_v4 {
13965 + struct nx_addr_v4 *next;
13966 + struct in_addr ip[2];
13967 + struct in_addr mask;
13972 +struct nx_addr_v6 {
13973 + struct nx_addr_v6 *next;
13974 + struct in6_addr ip;
13975 + struct in6_addr mask;
13982 + struct hlist_node nx_hlist; /* linked list of nxinfos */
13983 + nid_t nx_id; /* vnet id */
13984 + atomic_t nx_usecnt; /* usage count */
13985 + atomic_t nx_tasks; /* tasks count */
13986 + int nx_state; /* context state */
13988 + uint64_t nx_flags; /* network flag word */
13989 + uint64_t nx_ncaps; /* network capabilities */
13991 + struct in_addr v4_lback; /* Loopback address */
13992 + struct in_addr v4_bcast; /* Broadcast address */
13993 + struct nx_addr_v4 v4; /* First/Single ipv4 address */
13994 +#ifdef CONFIG_IPV6
13995 + struct nx_addr_v6 v6; /* First/Single ipv6 address */
13997 + char nx_name[65]; /* network context name */
14001 +/* status flags */
14003 +#define NXS_HASHED 0x0001
14004 +#define NXS_SHUTDOWN 0x0100
14005 +#define NXS_RELEASED 0x8000
14007 +extern struct nx_info *lookup_nx_info(int);
14009 +extern int get_nid_list(int, unsigned int *, int);
14010 +extern int nid_is_hashed(nid_t);
14012 +extern int nx_migrate_task(struct task_struct *, struct nx_info *);
14014 +extern long vs_net_change(struct nx_info *, unsigned int);
14019 +#define NX_IPV4(n) ((n)->v4.type != NXA_TYPE_NONE)
14020 +#ifdef CONFIG_IPV6
14021 +#define NX_IPV6(n) ((n)->v6.type != NXA_TYPE_NONE)
14023 +#define NX_IPV6(n) (0)
14026 +#endif /* __KERNEL__ */
14027 +#endif /* _VX_NETWORK_H */
14028 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/percpu.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/percpu.h
14029 --- linux-2.6.34/include/linux/vserver/percpu.h 1970-01-01 01:00:00.000000000 +0100
14030 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/percpu.h 2010-05-18 18:11:22.000000000 +0200
14032 +#ifndef _VX_PERCPU_H
14033 +#define _VX_PERCPU_H
14035 +#include "cvirt_def.h"
14036 +#include "sched_def.h"
14038 +struct _vx_percpu {
14039 + struct _vx_cvirt_pc cvirt;
14040 + struct _vx_sched_pc sched;
14043 +#define PERCPU_PERCTX (sizeof(struct _vx_percpu))
14045 +#endif /* _VX_PERCPU_H */
14046 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/pid.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/pid.h
14047 --- linux-2.6.34/include/linux/vserver/pid.h 1970-01-01 01:00:00.000000000 +0100
14048 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/pid.h 2010-05-18 18:11:22.000000000 +0200
14050 +#ifndef _VSERVER_PID_H
14051 +#define _VSERVER_PID_H
14053 +/* pid faking stuff */
14055 +#define vx_info_map_pid(v, p) \
14056 + __vx_info_map_pid((v), (p), __func__, __FILE__, __LINE__)
14057 +#define vx_info_map_tgid(v,p) vx_info_map_pid(v,p)
14058 +#define vx_map_pid(p) vx_info_map_pid(current_vx_info(), p)
14059 +#define vx_map_tgid(p) vx_map_pid(p)
14061 +static inline int __vx_info_map_pid(struct vx_info *vxi, int pid,
14062 + const char *func, const char *file, int line)
14064 + if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
14065 + vxfprintk(VXD_CBIT(cvirt, 2),
14066 + "vx_map_tgid: %p/%llx: %d -> %d",
14067 + vxi, (long long)vxi->vx_flags, pid,
14068 + (pid && pid == vxi->vx_initpid) ? 1 : pid,
14069 + func, file, line);
14072 + if (pid == vxi->vx_initpid)
14078 +#define vx_info_rmap_pid(v, p) \
14079 + __vx_info_rmap_pid((v), (p), __func__, __FILE__, __LINE__)
14080 +#define vx_rmap_pid(p) vx_info_rmap_pid(current_vx_info(), p)
14081 +#define vx_rmap_tgid(p) vx_rmap_pid(p)
14083 +static inline int __vx_info_rmap_pid(struct vx_info *vxi, int pid,
14084 + const char *func, const char *file, int line)
14086 + if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
14087 + vxfprintk(VXD_CBIT(cvirt, 2),
14088 + "vx_rmap_tgid: %p/%llx: %d -> %d",
14089 + vxi, (long long)vxi->vx_flags, pid,
14090 + (pid == 1) ? vxi->vx_initpid : pid,
14091 + func, file, line);
14092 + if ((pid == 1) && vxi->vx_initpid)
14093 + return vxi->vx_initpid;
14094 + if (pid == vxi->vx_initpid)
14101 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/sched_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/sched_cmd.h
14102 --- linux-2.6.34/include/linux/vserver/sched_cmd.h 1970-01-01 01:00:00.000000000 +0100
14103 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/sched_cmd.h 2010-05-18 18:11:22.000000000 +0200
14105 +#ifndef _VX_SCHED_CMD_H
14106 +#define _VX_SCHED_CMD_H
14109 +/* sched vserver commands */
14111 +#define VCMD_set_sched_v2 VC_CMD(SCHED, 1, 2)
14112 +#define VCMD_set_sched_v3 VC_CMD(SCHED, 1, 3)
14113 +#define VCMD_set_sched_v4 VC_CMD(SCHED, 1, 4)
14115 +struct vcmd_set_sched_v2 {
14116 + int32_t fill_rate;
14117 + int32_t interval;
14119 + int32_t tokens_min;
14120 + int32_t tokens_max;
14121 + uint64_t cpu_mask;
14124 +struct vcmd_set_sched_v3 {
14125 + uint32_t set_mask;
14126 + int32_t fill_rate;
14127 + int32_t interval;
14129 + int32_t tokens_min;
14130 + int32_t tokens_max;
14131 + int32_t priority_bias;
14134 +struct vcmd_set_sched_v4 {
14135 + uint32_t set_mask;
14136 + int32_t fill_rate;
14137 + int32_t interval;
14139 + int32_t tokens_min;
14140 + int32_t tokens_max;
14141 + int32_t prio_bias;
14143 + int32_t bucket_id;
14146 +#define VCMD_set_sched VC_CMD(SCHED, 1, 5)
14147 +#define VCMD_get_sched VC_CMD(SCHED, 2, 5)
14149 +struct vcmd_sched_v5 {
14152 + int32_t bucket_id;
14153 + int32_t fill_rate[2];
14154 + int32_t interval[2];
14156 + int32_t tokens_min;
14157 + int32_t tokens_max;
14158 + int32_t prio_bias;
14161 +#define VXSM_FILL_RATE 0x0001
14162 +#define VXSM_INTERVAL 0x0002
14163 +#define VXSM_FILL_RATE2 0x0004
14164 +#define VXSM_INTERVAL2 0x0008
14165 +#define VXSM_TOKENS 0x0010
14166 +#define VXSM_TOKENS_MIN 0x0020
14167 +#define VXSM_TOKENS_MAX 0x0040
14168 +#define VXSM_PRIO_BIAS 0x0100
14170 +#define VXSM_IDLE_TIME 0x0200
14171 +#define VXSM_FORCE 0x0400
14173 +#define VXSM_V3_MASK 0x0173
14174 +#define VXSM_SET_MASK 0x01FF
14176 +#define VXSM_CPU_ID 0x1000
14177 +#define VXSM_BUCKET_ID 0x2000
14179 +#define VXSM_MSEC 0x4000
14181 +#define SCHED_KEEP (-2) /* only for v2 */
14185 +#include <linux/compiler.h>
14187 +extern int vc_set_sched_v2(struct vx_info *, void __user *);
14188 +extern int vc_set_sched_v3(struct vx_info *, void __user *);
14189 +extern int vc_set_sched_v4(struct vx_info *, void __user *);
14190 +extern int vc_set_sched(struct vx_info *, void __user *);
14191 +extern int vc_get_sched(struct vx_info *, void __user *);
14193 +#endif /* __KERNEL__ */
14195 +#define VCMD_sched_info VC_CMD(SCHED, 3, 0)
14197 +struct vcmd_sched_info {
14199 + int32_t bucket_id;
14200 + uint64_t user_msec;
14201 + uint64_t sys_msec;
14202 + uint64_t hold_msec;
14203 + uint32_t token_usec;
14204 + int32_t vavavoom;
14209 +extern int vc_sched_info(struct vx_info *, void __user *);
14211 +#endif /* __KERNEL__ */
14212 +#endif /* _VX_SCHED_CMD_H */
14213 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/sched_def.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/sched_def.h
14214 --- linux-2.6.34/include/linux/vserver/sched_def.h 1970-01-01 01:00:00.000000000 +0100
14215 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/sched_def.h 2010-05-18 18:11:22.000000000 +0200
14217 +#ifndef _VX_SCHED_DEF_H
14218 +#define _VX_SCHED_DEF_H
14220 +#include <linux/spinlock.h>
14221 +#include <linux/jiffies.h>
14222 +#include <linux/cpumask.h>
14223 +#include <asm/atomic.h>
14224 +#include <asm/param.h>
14227 +/* context sub struct */
14229 +struct _vx_sched {
14230 + spinlock_t tokens_lock; /* lock for token bucket */
14232 + int tokens; /* number of CPU tokens */
14233 + int fill_rate[2]; /* Fill rate: add X tokens... */
14234 + int interval[2]; /* Divisor: per Y jiffies */
14235 + int tokens_min; /* Limit: minimum for unhold */
14236 + int tokens_max; /* Limit: no more than N tokens */
14238 + int prio_bias; /* bias offset for priority */
14240 + unsigned update_mask; /* which features should be updated */
14241 + cpumask_t update; /* CPUs which should update */
14244 +struct _vx_sched_pc {
14245 + int tokens; /* number of CPU tokens */
14246 + int flags; /* bucket flags */
14248 + int fill_rate[2]; /* Fill rate: add X tokens... */
14249 + int interval[2]; /* Divisor: per Y jiffies */
14250 + int tokens_min; /* Limit: minimum for unhold */
14251 + int tokens_max; /* Limit: no more than N tokens */
14253 + int prio_bias; /* bias offset for priority */
14254 + int vavavoom; /* last calculated vavavoom */
14256 + unsigned long norm_time; /* last time accounted */
14257 + unsigned long idle_time; /* non linear time for fair sched */
14258 + unsigned long token_time; /* token time for accounting */
14259 + unsigned long onhold; /* jiffies when put on hold */
14261 + uint64_t user_ticks; /* token tick events */
14262 + uint64_t sys_ticks; /* token tick events */
14263 + uint64_t hold_ticks; /* token ticks paused */
14267 +#define VXSF_ONHOLD 0x0001
14268 +#define VXSF_IDLE_TIME 0x0100
14270 +#ifdef CONFIG_VSERVER_DEBUG
14272 +static inline void __dump_vx_sched(struct _vx_sched *sched)
14274 + printk("\t_vx_sched:\n");
14275 + printk("\t tokens: %4d/%4d, %4d/%4d, %4d, %4d\n",
14276 + sched->fill_rate[0], sched->interval[0],
14277 + sched->fill_rate[1], sched->interval[1],
14278 + sched->tokens_min, sched->tokens_max);
14279 + printk("\t priority = %4d\n", sched->prio_bias);
14284 +#endif /* _VX_SCHED_DEF_H */
14285 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/sched.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/sched.h
14286 --- linux-2.6.34/include/linux/vserver/sched.h 1970-01-01 01:00:00.000000000 +0100
14287 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/sched.h 2010-05-18 18:11:22.000000000 +0200
14289 +#ifndef _VX_SCHED_H
14290 +#define _VX_SCHED_H
14297 +void vx_vsi_uptime(struct timespec *, struct timespec *);
14302 +void vx_update_load(struct vx_info *);
14305 +int vx_tokens_recalc(struct _vx_sched_pc *,
14306 + unsigned long *, unsigned long *, int [2]);
14308 +void vx_update_sched_param(struct _vx_sched *sched,
14309 + struct _vx_sched_pc *sched_pc);
14311 +#endif /* __KERNEL__ */
14312 +#else /* _VX_SCHED_H */
14313 +#warning duplicate inclusion
14314 +#endif /* _VX_SCHED_H */
14315 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/signal_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/signal_cmd.h
14316 --- linux-2.6.34/include/linux/vserver/signal_cmd.h 1970-01-01 01:00:00.000000000 +0100
14317 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/signal_cmd.h 2010-05-18 18:11:22.000000000 +0200
14319 +#ifndef _VX_SIGNAL_CMD_H
14320 +#define _VX_SIGNAL_CMD_H
14323 +/* signalling vserver commands */
14325 +#define VCMD_ctx_kill VC_CMD(PROCTRL, 1, 0)
14326 +#define VCMD_wait_exit VC_CMD(EVENT, 99, 0)
14328 +struct vcmd_ctx_kill_v0 {
14333 +struct vcmd_wait_exit_v0 {
14334 + int32_t reboot_cmd;
14335 + int32_t exit_code;
14340 +extern int vc_ctx_kill(struct vx_info *, void __user *);
14341 +extern int vc_wait_exit(struct vx_info *, void __user *);
14343 +#endif /* __KERNEL__ */
14345 +/* process alteration commands */
14347 +#define VCMD_get_pflags VC_CMD(PROCALT, 5, 0)
14348 +#define VCMD_set_pflags VC_CMD(PROCALT, 6, 0)
14350 +struct vcmd_pflags_v0 {
14351 + uint32_t flagword;
14357 +extern int vc_get_pflags(uint32_t pid, void __user *);
14358 +extern int vc_set_pflags(uint32_t pid, void __user *);
14360 +#endif /* __KERNEL__ */
14361 +#endif /* _VX_SIGNAL_CMD_H */
14362 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/signal.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/signal.h
14363 --- linux-2.6.34/include/linux/vserver/signal.h 1970-01-01 01:00:00.000000000 +0100
14364 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/signal.h 2010-05-18 18:11:22.000000000 +0200
14366 +#ifndef _VX_SIGNAL_H
14367 +#define _VX_SIGNAL_H
14374 +int vx_info_kill(struct vx_info *, int, int);
14376 +#endif /* __KERNEL__ */
14377 +#else /* _VX_SIGNAL_H */
14378 +#warning duplicate inclusion
14379 +#endif /* _VX_SIGNAL_H */
14380 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/space_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/space_cmd.h
14381 --- linux-2.6.34/include/linux/vserver/space_cmd.h 1970-01-01 01:00:00.000000000 +0100
14382 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/space_cmd.h 2010-05-18 18:11:22.000000000 +0200
14384 +#ifndef _VX_SPACE_CMD_H
14385 +#define _VX_SPACE_CMD_H
14388 +#define VCMD_enter_space_v0 VC_CMD(PROCALT, 1, 0)
14389 +#define VCMD_enter_space_v1 VC_CMD(PROCALT, 1, 1)
14390 +#define VCMD_enter_space VC_CMD(PROCALT, 1, 2)
14392 +#define VCMD_set_space_v0 VC_CMD(PROCALT, 3, 0)
14393 +#define VCMD_set_space_v1 VC_CMD(PROCALT, 3, 1)
14394 +#define VCMD_set_space VC_CMD(PROCALT, 3, 2)
14396 +#define VCMD_get_space_mask_v0 VC_CMD(PROCALT, 4, 0)
14398 +#define VCMD_get_space_mask VC_CMD(VSPACE, 0, 1)
14399 +#define VCMD_get_space_default VC_CMD(VSPACE, 1, 0)
14402 +struct vcmd_space_mask_v1 {
14406 +struct vcmd_space_mask_v2 {
14414 +extern int vc_enter_space_v1(struct vx_info *, void __user *);
14415 +extern int vc_set_space_v1(struct vx_info *, void __user *);
14416 +extern int vc_enter_space(struct vx_info *, void __user *);
14417 +extern int vc_set_space(struct vx_info *, void __user *);
14418 +extern int vc_get_space_mask(void __user *, int);
14420 +#endif /* __KERNEL__ */
14421 +#endif /* _VX_SPACE_CMD_H */
14422 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/space.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/space.h
14423 --- linux-2.6.34/include/linux/vserver/space.h 1970-01-01 01:00:00.000000000 +0100
14424 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/space.h 2010-05-18 18:11:22.000000000 +0200
14426 +#ifndef _VX_SPACE_H
14427 +#define _VX_SPACE_H
14429 +#include <linux/types.h>
14433 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index);
14435 +#else /* _VX_SPACE_H */
14436 +#warning duplicate inclusion
14437 +#endif /* _VX_SPACE_H */
14438 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/switch.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/switch.h
14439 --- linux-2.6.34/include/linux/vserver/switch.h 1970-01-01 01:00:00.000000000 +0100
14440 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/switch.h 2010-05-18 18:11:22.000000000 +0200
14442 +#ifndef _VX_SWITCH_H
14443 +#define _VX_SWITCH_H
14445 +#include <linux/types.h>
14448 +#define VC_CATEGORY(c) (((c) >> 24) & 0x3F)
14449 +#define VC_COMMAND(c) (((c) >> 16) & 0xFF)
14450 +#define VC_VERSION(c) ((c) & 0xFFF)
14452 +#define VC_CMD(c, i, v) ((((VC_CAT_ ## c) & 0x3F) << 24) \
14453 + | (((i) & 0xFF) << 16) | ((v) & 0xFFF))
14457 + Syscall Matrix V2.8
14459 + |VERSION|CREATE |MODIFY |MIGRATE|CONTROL|EXPERIM| |SPECIAL|SPECIAL|
14460 + |STATS |DESTROY|ALTER |CHANGE |LIMIT |TEST | | | |
14461 + |INFO |SETUP | |MOVE | | | | | |
14462 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14463 + SYSTEM |VERSION|VSETUP |VHOST | | | | |DEVICE | |
14464 + HOST | 00| 01| 02| 03| 04| 05| | 06| 07|
14465 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14466 + CPU | |VPROC |PROCALT|PROCMIG|PROCTRL| | |SCHED. | |
14467 + PROCESS| 08| 09| 10| 11| 12| 13| | 14| 15|
14468 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14469 + MEMORY | | | | |MEMCTRL| | |SWAP | |
14470 + | 16| 17| 18| 19| 20| 21| | 22| 23|
14471 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14472 + NETWORK| |VNET |NETALT |NETMIG |NETCTL | | |SERIAL | |
14473 + | 24| 25| 26| 27| 28| 29| | 30| 31|
14474 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14475 + DISK | | | |TAGMIG |DLIMIT | | |INODE | |
14476 + VFS | 32| 33| 34| 35| 36| 37| | 38| 39|
14477 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14478 + OTHER |VSTAT | | | | | | |VINFO | |
14479 + | 40| 41| 42| 43| 44| 45| | 46| 47|
14480 + =======+=======+=======+=======+=======+=======+=======+ +=======+=======+
14481 + SPECIAL|EVENT | | | |FLAGS | | |VSPACE | |
14482 + | 48| 49| 50| 51| 52| 53| | 54| 55|
14483 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14484 + SPECIAL|DEBUG | | | |RLIMIT |SYSCALL| | |COMPAT |
14485 + | 56| 57| 58| 59| 60|TEST 61| | 62| 63|
14486 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14490 +#define VC_CAT_VERSION 0
14492 +#define VC_CAT_VSETUP 1
14493 +#define VC_CAT_VHOST 2
14495 +#define VC_CAT_DEVICE 6
14497 +#define VC_CAT_VPROC 9
14498 +#define VC_CAT_PROCALT 10
14499 +#define VC_CAT_PROCMIG 11
14500 +#define VC_CAT_PROCTRL 12
14502 +#define VC_CAT_SCHED 14
14503 +#define VC_CAT_MEMCTRL 20
14505 +#define VC_CAT_VNET 25
14506 +#define VC_CAT_NETALT 26
14507 +#define VC_CAT_NETMIG 27
14508 +#define VC_CAT_NETCTRL 28
14510 +#define VC_CAT_TAGMIG 35
14511 +#define VC_CAT_DLIMIT 36
14512 +#define VC_CAT_INODE 38
14514 +#define VC_CAT_VSTAT 40
14515 +#define VC_CAT_VINFO 46
14516 +#define VC_CAT_EVENT 48
14518 +#define VC_CAT_FLAGS 52
14519 +#define VC_CAT_VSPACE 54
14520 +#define VC_CAT_DEBUG 56
14521 +#define VC_CAT_RLIMIT 60
14523 +#define VC_CAT_SYSTEST 61
14524 +#define VC_CAT_COMPAT 63
14526 +/* query version */
14528 +#define VCMD_get_version VC_CMD(VERSION, 0, 0)
14529 +#define VCMD_get_vci VC_CMD(VERSION, 1, 0)
14534 +#include <linux/errno.h>
14536 +#endif /* __KERNEL__ */
14538 +#endif /* _VX_SWITCH_H */
14540 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/tag_cmd.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/tag_cmd.h
14541 --- linux-2.6.34/include/linux/vserver/tag_cmd.h 1970-01-01 01:00:00.000000000 +0100
14542 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/tag_cmd.h 2010-05-18 18:11:22.000000000 +0200
14544 +#ifndef _VX_TAG_CMD_H
14545 +#define _VX_TAG_CMD_H
14548 +/* vinfo commands */
14550 +#define VCMD_task_tag VC_CMD(VINFO, 3, 0)
14553 +extern int vc_task_tag(uint32_t);
14555 +#endif /* __KERNEL__ */
14557 +/* context commands */
14559 +#define VCMD_tag_migrate VC_CMD(TAGMIG, 1, 0)
14562 +extern int vc_tag_migrate(uint32_t);
14564 +#endif /* __KERNEL__ */
14565 +#endif /* _VX_TAG_CMD_H */
14566 diff -NurpP --minimal linux-2.6.34/include/linux/vserver/tag.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/tag.h
14567 --- linux-2.6.34/include/linux/vserver/tag.h 1970-01-01 01:00:00.000000000 +0100
14568 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vserver/tag.h 2010-05-18 18:11:22.000000000 +0200
14573 +#include <linux/types.h>
14576 +#define DX_TAG(in) (IS_TAGGED(in))
14579 +#ifdef CONFIG_TAG_NFSD
14580 +#define DX_TAG_NFSD 1
14582 +#define DX_TAG_NFSD 0
14586 +#ifdef CONFIG_TAGGING_NONE
14588 +#define MAX_UID 0xFFFFFFFF
14589 +#define MAX_GID 0xFFFFFFFF
14591 +#define INOTAG_TAG(cond, uid, gid, tag) (0)
14593 +#define TAGINO_UID(cond, uid, tag) (uid)
14594 +#define TAGINO_GID(cond, gid, tag) (gid)
14599 +#ifdef CONFIG_TAGGING_GID16
14601 +#define MAX_UID 0xFFFFFFFF
14602 +#define MAX_GID 0x0000FFFF
14604 +#define INOTAG_TAG(cond, uid, gid, tag) \
14605 + ((cond) ? (((gid) >> 16) & 0xFFFF) : 0)
14607 +#define TAGINO_UID(cond, uid, tag) (uid)
14608 +#define TAGINO_GID(cond, gid, tag) \
14609 + ((cond) ? (((gid) & 0xFFFF) | ((tag) << 16)) : (gid))
14614 +#ifdef CONFIG_TAGGING_ID24
14616 +#define MAX_UID 0x00FFFFFF
14617 +#define MAX_GID 0x00FFFFFF
14619 +#define INOTAG_TAG(cond, uid, gid, tag) \
14620 + ((cond) ? ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) : 0)
14622 +#define TAGINO_UID(cond, uid, tag) \
14623 + ((cond) ? (((uid) & 0xFFFFFF) | (((tag) & 0xFF00) << 16)) : (uid))
14624 +#define TAGINO_GID(cond, gid, tag) \
14625 + ((cond) ? (((gid) & 0xFFFFFF) | (((tag) & 0x00FF) << 24)) : (gid))
14630 +#ifdef CONFIG_TAGGING_UID16
14632 +#define MAX_UID 0x0000FFFF
14633 +#define MAX_GID 0xFFFFFFFF
14635 +#define INOTAG_TAG(cond, uid, gid, tag) \
14636 + ((cond) ? (((uid) >> 16) & 0xFFFF) : 0)
14638 +#define TAGINO_UID(cond, uid, tag) \
14639 + ((cond) ? (((uid) & 0xFFFF) | ((tag) << 16)) : (uid))
14640 +#define TAGINO_GID(cond, gid, tag) (gid)
14645 +#ifdef CONFIG_TAGGING_INTERN
14647 +#define MAX_UID 0xFFFFFFFF
14648 +#define MAX_GID 0xFFFFFFFF
14650 +#define INOTAG_TAG(cond, uid, gid, tag) \
14651 + ((cond) ? (tag) : 0)
14653 +#define TAGINO_UID(cond, uid, tag) (uid)
14654 +#define TAGINO_GID(cond, gid, tag) (gid)
14659 +#ifndef CONFIG_TAGGING_NONE
14660 +#define dx_current_fstag(sb) \
14661 + ((sb)->s_flags & MS_TAGGED ? dx_current_tag() : 0)
14663 +#define dx_current_fstag(sb) (0)
14666 +#ifndef CONFIG_TAGGING_INTERN
14667 +#define TAGINO_TAG(cond, tag) (0)
14669 +#define TAGINO_TAG(cond, tag) ((cond) ? (tag) : 0)
14672 +#define INOTAG_UID(cond, uid, gid) \
14673 + ((cond) ? ((uid) & MAX_UID) : (uid))
14674 +#define INOTAG_GID(cond, uid, gid) \
14675 + ((cond) ? ((gid) & MAX_GID) : (gid))
14678 +static inline uid_t dx_map_uid(uid_t uid)
14680 + if ((uid > MAX_UID) && (uid != -1))
14682 + return (uid & MAX_UID);
14685 +static inline gid_t dx_map_gid(gid_t gid)
14687 + if ((gid > MAX_GID) && (gid != -1))
14689 + return (gid & MAX_GID);
14697 +#define dx_notagcheck(sb) ((sb) && ((sb)->s_flags & MS_NOTAGCHECK))
14699 +int dx_parse_tag(char *string, tag_t *tag, int remove, int *mnt_flags,
14700 + unsigned long *flags);
14702 +#ifdef CONFIG_PROPAGATE
14704 +void __dx_propagate_tag(struct nameidata *nd, struct inode *inode);
14706 +#define dx_propagate_tag(n, i) __dx_propagate_tag(n, i)
14709 +#define dx_propagate_tag(n, i) do { } while (0)
14712 +#endif /* _DX_TAG_H */
14713 diff -NurpP --minimal linux-2.6.34/include/linux/vs_inet6.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_inet6.h
14714 --- linux-2.6.34/include/linux/vs_inet6.h 1970-01-01 01:00:00.000000000 +0100
14715 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_inet6.h 2010-05-18 18:11:22.000000000 +0200
14717 +#ifndef _VS_INET6_H
14718 +#define _VS_INET6_H
14720 +#include "vserver/base.h"
14721 +#include "vserver/network.h"
14722 +#include "vserver/debug.h"
14724 +#include <net/ipv6.h>
14726 +#define NXAV6(a) &(a)->ip, &(a)->mask, (a)->prefix, (a)->type
14727 +#define NXAV6_FMT "[%pI6/%pI6/%d:%04x]"
14730 +#ifdef CONFIG_IPV6
14733 +int v6_addr_match(struct nx_addr_v6 *nxa,
14734 + const struct in6_addr *addr, uint16_t mask)
14738 + switch (nxa->type & mask) {
14739 + case NXA_TYPE_MASK:
14740 + ret = ipv6_masked_addr_cmp(&nxa->ip, &nxa->mask, addr);
14742 + case NXA_TYPE_ADDR:
14743 + ret = ipv6_addr_equal(&nxa->ip, addr);
14745 + case NXA_TYPE_ANY:
14749 + vxdprintk(VXD_CBIT(net, 0),
14750 + "v6_addr_match(%p" NXAV6_FMT ",%pI6,%04x) = %d",
14751 + nxa, NXAV6(nxa), addr, mask, ret);
14756 +int v6_addr_in_nx_info(struct nx_info *nxi,
14757 + const struct in6_addr *addr, uint16_t mask)
14759 + struct nx_addr_v6 *nxa;
14764 + for (nxa = &nxi->v6; nxa; nxa = nxa->next)
14765 + if (v6_addr_match(nxa, addr, mask))
14769 + vxdprintk(VXD_CBIT(net, 0),
14770 + "v6_addr_in_nx_info(%p[#%u],%pI6,%04x) = %d",
14771 + nxi, nxi ? nxi->nx_id : 0, addr, mask, ret);
14776 +int v6_nx_addr_match(struct nx_addr_v6 *nxa, struct nx_addr_v6 *addr, uint16_t mask)
14778 + /* FIXME: needs full range checks */
14779 + return v6_addr_match(nxa, &addr->ip, mask);
14783 +int v6_nx_addr_in_nx_info(struct nx_info *nxi, struct nx_addr_v6 *nxa, uint16_t mask)
14785 + struct nx_addr_v6 *ptr;
14787 + for (ptr = &nxi->v6; ptr; ptr = ptr->next)
14788 + if (v6_nx_addr_match(ptr, nxa, mask))
14795 + * Check if a given address matches for a socket
14797 + * nxi: the socket's nx_info if any
14798 + * addr: to be verified address
14801 +int v6_sock_addr_match (
14802 + struct nx_info *nxi,
14803 + struct inet_sock *inet,
14804 + struct in6_addr *addr)
14806 + struct sock *sk = &inet->sk;
14807 + struct in6_addr *saddr = inet6_rcv_saddr(sk);
14809 + if (!ipv6_addr_any(addr) &&
14810 + ipv6_addr_equal(saddr, addr))
14812 + if (ipv6_addr_any(saddr))
14813 + return v6_addr_in_nx_info(nxi, addr, -1);
14818 + * check if address is covered by socket
14820 + * sk: the socket to check against
14821 + * addr: the address in question (must be != 0)
14825 +int __v6_addr_match_socket(const struct sock *sk, struct nx_addr_v6 *nxa)
14827 + struct nx_info *nxi = sk->sk_nx_info;
14828 + struct in6_addr *saddr = inet6_rcv_saddr(sk);
14830 + vxdprintk(VXD_CBIT(net, 5),
14831 + "__v6_addr_in_socket(%p," NXAV6_FMT ") %p:%pI6 %p;%lx",
14832 + sk, NXAV6(nxa), nxi, saddr, sk->sk_socket,
14833 + (sk->sk_socket?sk->sk_socket->flags:0));
14835 + if (!ipv6_addr_any(saddr)) { /* direct address match */
14836 + return v6_addr_match(nxa, saddr, -1);
14837 + } else if (nxi) { /* match against nx_info */
14838 + return v6_nx_addr_in_nx_info(nxi, nxa, -1);
14839 + } else { /* unrestricted any socket */
14845 +/* inet related checks and helpers */
14849 +struct net_device;
14853 +#include <linux/netdevice.h>
14854 +#include <linux/inetdevice.h>
14855 +#include <net/inet_timewait_sock.h>
14858 +int dev_in_nx_info(struct net_device *, struct nx_info *);
14859 +int v6_dev_in_nx_info(struct net_device *, struct nx_info *);
14860 +int nx_v6_addr_conflict(struct nx_info *, struct nx_info *);
14865 +int v6_ifa_in_nx_info(struct inet6_ifaddr *ifa, struct nx_info *nxi)
14871 + return v6_addr_in_nx_info(nxi, &ifa->addr, -1);
14875 +int nx_v6_ifa_visible(struct nx_info *nxi, struct inet6_ifaddr *ifa)
14877 + vxdprintk(VXD_CBIT(net, 1), "nx_v6_ifa_visible(%p[#%u],%p) %d",
14878 + nxi, nxi ? nxi->nx_id : 0, ifa,
14879 + nxi ? v6_ifa_in_nx_info(ifa, nxi) : 0);
14881 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
14883 + if (v6_ifa_in_nx_info(ifa, nxi))
14889 +struct nx_v6_sock_addr {
14890 + struct in6_addr saddr; /* Address used for validation */
14891 + struct in6_addr baddr; /* Address used for socket bind */
14895 +int v6_map_sock_addr(struct inet_sock *inet, struct sockaddr_in6 *addr,
14896 + struct nx_v6_sock_addr *nsa)
14898 + // struct sock *sk = &inet->sk;
14899 + // struct nx_info *nxi = sk->sk_nx_info;
14900 + struct in6_addr saddr = addr->sin6_addr;
14901 + struct in6_addr baddr = saddr;
14903 + nsa->saddr = saddr;
14904 + nsa->baddr = baddr;
14909 +void v6_set_sock_addr(struct inet_sock *inet, struct nx_v6_sock_addr *nsa)
14911 + // struct sock *sk = &inet->sk;
14912 + // struct in6_addr *saddr = inet6_rcv_saddr(sk);
14914 + // *saddr = nsa->baddr;
14915 + // inet->inet_saddr = nsa->baddr;
14919 +int nx_info_has_v6(struct nx_info *nxi)
14923 + if (NX_IPV6(nxi))
14928 +#else /* CONFIG_IPV6 */
14931 +int nx_v6_dev_visible(struct nx_info *n, struct net_device *d)
14938 +int nx_v6_addr_conflict(struct nx_info *n, uint32_t a, const struct sock *s)
14944 +int v6_ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
14950 +int nx_info_has_v6(struct nx_info *nxi)
14955 +#endif /* CONFIG_IPV6 */
14957 +#define current_nx_info_has_v6() \
14958 + nx_info_has_v6(current_nx_info())
14961 +#warning duplicate inclusion
14963 diff -NurpP --minimal linux-2.6.34/include/linux/vs_inet.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_inet.h
14964 --- linux-2.6.34/include/linux/vs_inet.h 1970-01-01 01:00:00.000000000 +0100
14965 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_inet.h 2010-05-18 18:11:22.000000000 +0200
14967 +#ifndef _VS_INET_H
14968 +#define _VS_INET_H
14970 +#include "vserver/base.h"
14971 +#include "vserver/network.h"
14972 +#include "vserver/debug.h"
14974 +#define IPI_LOOPBACK htonl(INADDR_LOOPBACK)
14976 +#define NXAV4(a) NIPQUAD((a)->ip[0]), NIPQUAD((a)->ip[1]), \
14977 + NIPQUAD((a)->mask), (a)->type
14978 +#define NXAV4_FMT "[" NIPQUAD_FMT "-" NIPQUAD_FMT "/" NIPQUAD_FMT ":%04x]"
14982 +int v4_addr_match(struct nx_addr_v4 *nxa, __be32 addr, uint16_t tmask)
14984 + __be32 ip = nxa->ip[0].s_addr;
14985 + __be32 mask = nxa->mask.s_addr;
14986 + __be32 bcast = ip | ~mask;
14989 + switch (nxa->type & tmask) {
14990 + case NXA_TYPE_MASK:
14991 + ret = (ip == (addr & mask));
14993 + case NXA_TYPE_ADDR:
14997 + /* fall through to broadcast */
14998 + case NXA_MOD_BCAST:
14999 + ret = ((tmask & NXA_MOD_BCAST) && (addr == bcast));
15001 + case NXA_TYPE_RANGE:
15002 + ret = ((nxa->ip[0].s_addr <= addr) &&
15003 + (nxa->ip[1].s_addr > addr));
15005 + case NXA_TYPE_ANY:
15010 + vxdprintk(VXD_CBIT(net, 0),
15011 + "v4_addr_match(%p" NXAV4_FMT "," NIPQUAD_FMT ",%04x) = %d",
15012 + nxa, NXAV4(nxa), NIPQUAD(addr), tmask, ret);
15017 +int v4_addr_in_nx_info(struct nx_info *nxi, __be32 addr, uint16_t tmask)
15019 + struct nx_addr_v4 *nxa;
15026 + /* allow 127.0.0.1 when remapping lback */
15027 + if ((tmask & NXA_LOOPBACK) &&
15028 + (addr == IPI_LOOPBACK) &&
15029 + nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15032 + /* check for lback address */
15033 + if ((tmask & NXA_MOD_LBACK) &&
15034 + (nxi->v4_lback.s_addr == addr))
15037 + /* check for broadcast address */
15038 + if ((tmask & NXA_MOD_BCAST) &&
15039 + (nxi->v4_bcast.s_addr == addr))
15042 + /* check for v4 addresses */
15043 + for (nxa = &nxi->v4; nxa; nxa = nxa->next)
15044 + if (v4_addr_match(nxa, addr, tmask))
15048 + vxdprintk(VXD_CBIT(net, 0),
15049 + "v4_addr_in_nx_info(%p[#%u]," NIPQUAD_FMT ",%04x) = %d",
15050 + nxi, nxi ? nxi->nx_id : 0, NIPQUAD(addr), tmask, ret);
15055 +int v4_nx_addr_match(struct nx_addr_v4 *nxa, struct nx_addr_v4 *addr, uint16_t mask)
15057 + /* FIXME: needs full range checks */
15058 + return v4_addr_match(nxa, addr->ip[0].s_addr, mask);
15062 +int v4_nx_addr_in_nx_info(struct nx_info *nxi, struct nx_addr_v4 *nxa, uint16_t mask)
15064 + struct nx_addr_v4 *ptr;
15066 + for (ptr = &nxi->v4; ptr; ptr = ptr->next)
15067 + if (v4_nx_addr_match(ptr, nxa, mask))
15072 +#include <net/inet_sock.h>
15075 + * Check if a given address matches for a socket
15077 + * nxi: the socket's nx_info if any
15078 + * addr: to be verified address
15081 +int v4_sock_addr_match (
15082 + struct nx_info *nxi,
15083 + struct inet_sock *inet,
15086 + __be32 saddr = inet->inet_rcv_saddr;
15087 + __be32 bcast = nxi ? nxi->v4_bcast.s_addr : INADDR_BROADCAST;
15089 + if (addr && (saddr == addr || bcast == addr))
15092 + return v4_addr_in_nx_info(nxi, addr, NXA_MASK_BIND);
15097 +/* inet related checks and helpers */
15101 +struct net_device;
15104 +#ifdef CONFIG_INET
15106 +#include <linux/netdevice.h>
15107 +#include <linux/inetdevice.h>
15108 +#include <net/inet_sock.h>
15109 +#include <net/inet_timewait_sock.h>
15112 +int dev_in_nx_info(struct net_device *, struct nx_info *);
15113 +int v4_dev_in_nx_info(struct net_device *, struct nx_info *);
15114 +int nx_v4_addr_conflict(struct nx_info *, struct nx_info *);
15118 + * check if address is covered by socket
15120 + * sk: the socket to check against
15121 + * addr: the address in question (must be != 0)
15125 +int __v4_addr_match_socket(const struct sock *sk, struct nx_addr_v4 *nxa)
15127 + struct nx_info *nxi = sk->sk_nx_info;
15128 + __be32 saddr = inet_rcv_saddr(sk);
15130 + vxdprintk(VXD_CBIT(net, 5),
15131 + "__v4_addr_in_socket(%p," NXAV4_FMT ") %p:" NIPQUAD_FMT " %p;%lx",
15132 + sk, NXAV4(nxa), nxi, NIPQUAD(saddr), sk->sk_socket,
15133 + (sk->sk_socket?sk->sk_socket->flags:0));
15135 + if (saddr) { /* direct address match */
15136 + return v4_addr_match(nxa, saddr, -1);
15137 + } else if (nxi) { /* match against nx_info */
15138 + return v4_nx_addr_in_nx_info(nxi, nxa, -1);
15139 + } else { /* unrestricted any socket */
15147 +int nx_dev_visible(struct nx_info *nxi, struct net_device *dev)
15149 + vxdprintk(VXD_CBIT(net, 1), "nx_dev_visible(%p[#%u],%p »%s«) %d",
15150 + nxi, nxi ? nxi->nx_id : 0, dev, dev->name,
15151 + nxi ? dev_in_nx_info(dev, nxi) : 0);
15153 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15155 + if (dev_in_nx_info(dev, nxi))
15162 +int v4_ifa_in_nx_info(struct in_ifaddr *ifa, struct nx_info *nxi)
15168 + return v4_addr_in_nx_info(nxi, ifa->ifa_local, NXA_MASK_SHOW);
15172 +int nx_v4_ifa_visible(struct nx_info *nxi, struct in_ifaddr *ifa)
15174 + vxdprintk(VXD_CBIT(net, 1), "nx_v4_ifa_visible(%p[#%u],%p) %d",
15175 + nxi, nxi ? nxi->nx_id : 0, ifa,
15176 + nxi ? v4_ifa_in_nx_info(ifa, nxi) : 0);
15178 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15180 + if (v4_ifa_in_nx_info(ifa, nxi))
15186 +struct nx_v4_sock_addr {
15187 + __be32 saddr; /* Address used for validation */
15188 + __be32 baddr; /* Address used for socket bind */
15192 +int v4_map_sock_addr(struct inet_sock *inet, struct sockaddr_in *addr,
15193 + struct nx_v4_sock_addr *nsa)
15195 + struct sock *sk = &inet->sk;
15196 + struct nx_info *nxi = sk->sk_nx_info;
15197 + __be32 saddr = addr->sin_addr.s_addr;
15198 + __be32 baddr = saddr;
15200 + vxdprintk(VXD_CBIT(net, 3),
15201 + "inet_bind(%p)* %p,%p;%lx " NIPQUAD_FMT,
15202 + sk, sk->sk_nx_info, sk->sk_socket,
15203 + (sk->sk_socket ? sk->sk_socket->flags : 0),
15207 + if (saddr == INADDR_ANY) {
15208 + if (nx_info_flags(nxi, NXF_SINGLE_IP, 0))
15209 + baddr = nxi->v4.ip[0].s_addr;
15210 + } else if (saddr == IPI_LOOPBACK) {
15211 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15212 + baddr = nxi->v4_lback.s_addr;
15213 + } else { /* normal address bind */
15214 + if (!v4_addr_in_nx_info(nxi, saddr, NXA_MASK_BIND))
15215 + return -EADDRNOTAVAIL;
15219 + vxdprintk(VXD_CBIT(net, 3),
15220 + "inet_bind(%p) " NIPQUAD_FMT ", " NIPQUAD_FMT,
15221 + sk, NIPQUAD(saddr), NIPQUAD(baddr));
15223 + nsa->saddr = saddr;
15224 + nsa->baddr = baddr;
15229 +void v4_set_sock_addr(struct inet_sock *inet, struct nx_v4_sock_addr *nsa)
15231 + inet->inet_saddr = nsa->baddr;
15232 + inet->inet_rcv_saddr = nsa->baddr;
15237 + * helper to simplify inet_lookup_listener
15239 + * nxi: the socket's nx_info if any
15240 + * addr: to be verified address
15241 + * saddr: socket address
15243 +static inline int v4_inet_addr_match (
15244 + struct nx_info *nxi,
15248 + if (addr && (saddr == addr))
15251 + return nxi ? v4_addr_in_nx_info(nxi, addr, NXA_MASK_BIND) : 1;
15255 +static inline __be32 nx_map_sock_lback(struct nx_info *nxi, __be32 addr)
15257 + if (nx_info_flags(nxi, NXF_HIDE_LBACK, 0) &&
15258 + (addr == nxi->v4_lback.s_addr))
15259 + return IPI_LOOPBACK;
15264 +int nx_info_has_v4(struct nx_info *nxi)
15268 + if (NX_IPV4(nxi))
15270 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15275 +#else /* CONFIG_INET */
15278 +int nx_dev_visible(struct nx_info *n, struct net_device *d)
15284 +int nx_v4_addr_conflict(struct nx_info *n, uint32_t a, const struct sock *s)
15290 +int v4_ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
15296 +int nx_info_has_v4(struct nx_info *nxi)
15301 +#endif /* CONFIG_INET */
15303 +#define current_nx_info_has_v4() \
15304 + nx_info_has_v4(current_nx_info())
15307 +// #warning duplicate inclusion
15309 diff -NurpP --minimal linux-2.6.34/include/linux/vs_limit.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_limit.h
15310 --- linux-2.6.34/include/linux/vs_limit.h 1970-01-01 01:00:00.000000000 +0100
15311 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_limit.h 2010-05-18 18:11:22.000000000 +0200
15313 +#ifndef _VS_LIMIT_H
15314 +#define _VS_LIMIT_H
15316 +#include "vserver/limit.h"
15317 +#include "vserver/base.h"
15318 +#include "vserver/context.h"
15319 +#include "vserver/debug.h"
15320 +#include "vserver/context.h"
15321 +#include "vserver/limit_int.h"
15324 +#define vx_acc_cres(v, d, p, r) \
15325 + __vx_acc_cres(v, r, d, p, __FILE__, __LINE__)
15327 +#define vx_acc_cres_cond(x, d, p, r) \
15328 + __vx_acc_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \
15329 + r, d, p, __FILE__, __LINE__)
15332 +#define vx_add_cres(v, a, p, r) \
15333 + __vx_add_cres(v, r, a, p, __FILE__, __LINE__)
15334 +#define vx_sub_cres(v, a, p, r) vx_add_cres(v, -(a), p, r)
15336 +#define vx_add_cres_cond(x, a, p, r) \
15337 + __vx_add_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \
15338 + r, a, p, __FILE__, __LINE__)
15339 +#define vx_sub_cres_cond(x, a, p, r) vx_add_cres_cond(x, -(a), p, r)
15342 +/* process and file limits */
15344 +#define vx_nproc_inc(p) \
15345 + vx_acc_cres((p)->vx_info, 1, p, RLIMIT_NPROC)
15347 +#define vx_nproc_dec(p) \
15348 + vx_acc_cres((p)->vx_info,-1, p, RLIMIT_NPROC)
15350 +#define vx_files_inc(f) \
15351 + vx_acc_cres_cond((f)->f_xid, 1, f, RLIMIT_NOFILE)
15353 +#define vx_files_dec(f) \
15354 + vx_acc_cres_cond((f)->f_xid,-1, f, RLIMIT_NOFILE)
15356 +#define vx_locks_inc(l) \
15357 + vx_acc_cres_cond((l)->fl_xid, 1, l, RLIMIT_LOCKS)
15359 +#define vx_locks_dec(l) \
15360 + vx_acc_cres_cond((l)->fl_xid,-1, l, RLIMIT_LOCKS)
15362 +#define vx_openfd_inc(f) \
15363 + vx_acc_cres(current_vx_info(), 1, (void *)(long)(f), VLIMIT_OPENFD)
15365 +#define vx_openfd_dec(f) \
15366 + vx_acc_cres(current_vx_info(),-1, (void *)(long)(f), VLIMIT_OPENFD)
15369 +#define vx_cres_avail(v, n, r) \
15370 + __vx_cres_avail(v, r, n, __FILE__, __LINE__)
15373 +#define vx_nproc_avail(n) \
15374 + vx_cres_avail(current_vx_info(), n, RLIMIT_NPROC)
15376 +#define vx_files_avail(n) \
15377 + vx_cres_avail(current_vx_info(), n, RLIMIT_NOFILE)
15379 +#define vx_locks_avail(n) \
15380 + vx_cres_avail(current_vx_info(), n, RLIMIT_LOCKS)
15382 +#define vx_openfd_avail(n) \
15383 + vx_cres_avail(current_vx_info(), n, VLIMIT_OPENFD)
15386 +/* dentry limits */
15388 +#define vx_dentry_inc(d) do { \
15389 + if (atomic_read(&d->d_count) == 1) \
15390 + vx_acc_cres(current_vx_info(), 1, d, VLIMIT_DENTRY); \
15393 +#define vx_dentry_dec(d) do { \
15394 + if (atomic_read(&d->d_count) == 0) \
15395 + vx_acc_cres(current_vx_info(),-1, d, VLIMIT_DENTRY); \
15398 +#define vx_dentry_avail(n) \
15399 + vx_cres_avail(current_vx_info(), n, VLIMIT_DENTRY)
15402 +/* socket limits */
15404 +#define vx_sock_inc(s) \
15405 + vx_acc_cres((s)->sk_vx_info, 1, s, VLIMIT_NSOCK)
15407 +#define vx_sock_dec(s) \
15408 + vx_acc_cres((s)->sk_vx_info,-1, s, VLIMIT_NSOCK)
15410 +#define vx_sock_avail(n) \
15411 + vx_cres_avail(current_vx_info(), n, VLIMIT_NSOCK)
15414 +/* ipc resource limits */
15416 +#define vx_ipcmsg_add(v, u, a) \
15417 + vx_add_cres(v, a, u, RLIMIT_MSGQUEUE)
15419 +#define vx_ipcmsg_sub(v, u, a) \
15420 + vx_sub_cres(v, a, u, RLIMIT_MSGQUEUE)
15422 +#define vx_ipcmsg_avail(v, a) \
15423 + vx_cres_avail(v, a, RLIMIT_MSGQUEUE)
15426 +#define vx_ipcshm_add(v, k, a) \
15427 + vx_add_cres(v, a, (void *)(long)(k), VLIMIT_SHMEM)
15429 +#define vx_ipcshm_sub(v, k, a) \
15430 + vx_sub_cres(v, a, (void *)(long)(k), VLIMIT_SHMEM)
15432 +#define vx_ipcshm_avail(v, a) \
15433 + vx_cres_avail(v, a, VLIMIT_SHMEM)
15436 +#define vx_semary_inc(a) \
15437 + vx_acc_cres(current_vx_info(), 1, a, VLIMIT_SEMARY)
15439 +#define vx_semary_dec(a) \
15440 + vx_acc_cres(current_vx_info(), -1, a, VLIMIT_SEMARY)
15443 +#define vx_nsems_add(a,n) \
15444 + vx_add_cres(current_vx_info(), n, a, VLIMIT_NSEMS)
15446 +#define vx_nsems_sub(a,n) \
15447 + vx_sub_cres(current_vx_info(), n, a, VLIMIT_NSEMS)
15451 +#warning duplicate inclusion
15453 diff -NurpP --minimal linux-2.6.34/include/linux/vs_memory.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_memory.h
15454 --- linux-2.6.34/include/linux/vs_memory.h 1970-01-01 01:00:00.000000000 +0100
15455 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_memory.h 2010-05-19 03:11:07.000000000 +0200
15457 +#ifndef _VS_MEMORY_H
15458 +#define _VS_MEMORY_H
15460 +#include "vserver/limit.h"
15461 +#include "vserver/base.h"
15462 +#include "vserver/context.h"
15463 +#include "vserver/debug.h"
15464 +#include "vserver/context.h"
15465 +#include "vserver/limit_int.h"
15468 + VXPT_UNKNOWN = 0,
15477 +#define vx_page_fault(mm, vma, type, ret)
15481 +void __vx_page_fault(struct mm_struct *mm,
15482 + struct vm_area_struct *vma, int type, int ret)
15484 + struct vx_info *vxi = mm->mm_vx_info;
15487 + static char *page_type[6] =
15488 + { "UNKNOWN", "ANON", "NONE", "FILE", "SWAP", "WRITE" };
15489 + static char *page_what[4] =
15490 + { "FAULT_OOM", "FAULT_SIGBUS", "FAULT_MINOR", "FAULT_MAJOR" };
15496 + what = (ret & 0x3);
15498 +/* printk("[%d] page[%d][%d] %2x %s %s\n", vxi->vx_id,
15499 + type, what, ret, page_type[type], page_what[what]);
15501 + if (ret & VM_FAULT_WRITE)
15503 + atomic_inc(&vxi->cacct.page[type][what]);
15506 +#define vx_page_fault(mm, vma, type, ret) __vx_page_fault(mm, vma, type, ret)
15510 +extern unsigned long vx_badness(struct task_struct *task, struct mm_struct *mm);
15513 +#warning duplicate inclusion
15515 diff -NurpP --minimal linux-2.6.34/include/linux/vs_network.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_network.h
15516 --- linux-2.6.34/include/linux/vs_network.h 1970-01-01 01:00:00.000000000 +0100
15517 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_network.h 2010-05-18 18:11:22.000000000 +0200
15519 +#ifndef _NX_VS_NETWORK_H
15520 +#define _NX_VS_NETWORK_H
15522 +#include "vserver/context.h"
15523 +#include "vserver/network.h"
15524 +#include "vserver/base.h"
15525 +#include "vserver/check.h"
15526 +#include "vserver/debug.h"
15528 +#include <linux/sched.h>
15531 +#define get_nx_info(i) __get_nx_info(i, __FILE__, __LINE__)
15533 +static inline struct nx_info *__get_nx_info(struct nx_info *nxi,
15534 + const char *_file, int _line)
15539 + vxlprintk(VXD_CBIT(nid, 2), "get_nx_info(%p[#%d.%d])",
15540 + nxi, nxi ? nxi->nx_id : 0,
15541 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15544 + atomic_inc(&nxi->nx_usecnt);
15549 +extern void free_nx_info(struct nx_info *);
15551 +#define put_nx_info(i) __put_nx_info(i, __FILE__, __LINE__)
15553 +static inline void __put_nx_info(struct nx_info *nxi, const char *_file, int _line)
15558 + vxlprintk(VXD_CBIT(nid, 2), "put_nx_info(%p[#%d.%d])",
15559 + nxi, nxi ? nxi->nx_id : 0,
15560 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15563 + if (atomic_dec_and_test(&nxi->nx_usecnt))
15564 + free_nx_info(nxi);
15568 +#define init_nx_info(p, i) __init_nx_info(p, i, __FILE__, __LINE__)
15570 +static inline void __init_nx_info(struct nx_info **nxp, struct nx_info *nxi,
15571 + const char *_file, int _line)
15574 + vxlprintk(VXD_CBIT(nid, 3),
15575 + "init_nx_info(%p[#%d.%d])",
15576 + nxi, nxi ? nxi->nx_id : 0,
15577 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15580 + atomic_inc(&nxi->nx_usecnt);
15586 +#define set_nx_info(p, i) __set_nx_info(p, i, __FILE__, __LINE__)
15588 +static inline void __set_nx_info(struct nx_info **nxp, struct nx_info *nxi,
15589 + const char *_file, int _line)
15591 + struct nx_info *nxo;
15596 + vxlprintk(VXD_CBIT(nid, 3), "set_nx_info(%p[#%d.%d])",
15597 + nxi, nxi ? nxi->nx_id : 0,
15598 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15601 + atomic_inc(&nxi->nx_usecnt);
15602 + nxo = xchg(nxp, nxi);
15606 +#define clr_nx_info(p) __clr_nx_info(p, __FILE__, __LINE__)
15608 +static inline void __clr_nx_info(struct nx_info **nxp,
15609 + const char *_file, int _line)
15611 + struct nx_info *nxo;
15613 + nxo = xchg(nxp, NULL);
15617 + vxlprintk(VXD_CBIT(nid, 3), "clr_nx_info(%p[#%d.%d])",
15618 + nxo, nxo ? nxo->nx_id : 0,
15619 + nxo ? atomic_read(&nxo->nx_usecnt) : 0,
15622 + if (atomic_dec_and_test(&nxo->nx_usecnt))
15623 + free_nx_info(nxo);
15627 +#define claim_nx_info(v, p) __claim_nx_info(v, p, __FILE__, __LINE__)
15629 +static inline void __claim_nx_info(struct nx_info *nxi,
15630 + struct task_struct *task, const char *_file, int _line)
15632 + vxlprintk(VXD_CBIT(nid, 3), "claim_nx_info(%p[#%d.%d.%d]) %p",
15633 + nxi, nxi ? nxi->nx_id : 0,
15634 + nxi?atomic_read(&nxi->nx_usecnt):0,
15635 + nxi?atomic_read(&nxi->nx_tasks):0,
15636 + task, _file, _line);
15638 + atomic_inc(&nxi->nx_tasks);
15642 +extern void unhash_nx_info(struct nx_info *);
15644 +#define release_nx_info(v, p) __release_nx_info(v, p, __FILE__, __LINE__)
15646 +static inline void __release_nx_info(struct nx_info *nxi,
15647 + struct task_struct *task, const char *_file, int _line)
15649 + vxlprintk(VXD_CBIT(nid, 3), "release_nx_info(%p[#%d.%d.%d]) %p",
15650 + nxi, nxi ? nxi->nx_id : 0,
15651 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15652 + nxi ? atomic_read(&nxi->nx_tasks) : 0,
15653 + task, _file, _line);
15657 + if (atomic_dec_and_test(&nxi->nx_tasks))
15658 + unhash_nx_info(nxi);
15662 +#define task_get_nx_info(i) __task_get_nx_info(i, __FILE__, __LINE__)
15664 +static __inline__ struct nx_info *__task_get_nx_info(struct task_struct *p,
15665 + const char *_file, int _line)
15667 + struct nx_info *nxi;
15670 + vxlprintk(VXD_CBIT(nid, 5), "task_get_nx_info(%p)",
15671 + p, _file, _line);
15672 + nxi = __get_nx_info(p->nx_info, _file, _line);
15678 +static inline void exit_nx_info(struct task_struct *p)
15681 + release_nx_info(p->nx_info, p);
15686 +#warning duplicate inclusion
15688 diff -NurpP --minimal linux-2.6.34/include/linux/vs_pid.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_pid.h
15689 --- linux-2.6.34/include/linux/vs_pid.h 1970-01-01 01:00:00.000000000 +0100
15690 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_pid.h 2010-05-18 18:11:22.000000000 +0200
15695 +#include "vserver/base.h"
15696 +#include "vserver/check.h"
15697 +#include "vserver/context.h"
15698 +#include "vserver/debug.h"
15699 +#include "vserver/pid.h"
15700 +#include <linux/pid_namespace.h>
15703 +#define VXF_FAKE_INIT (VXF_INFO_INIT | VXF_STATE_INIT)
15706 +int vx_proc_task_visible(struct task_struct *task)
15708 + if ((task->pid == 1) &&
15709 + !vx_flags(VXF_FAKE_INIT, VXF_FAKE_INIT))
15710 + /* show a blend through init */
15712 + if (vx_check(vx_task_xid(task), VS_WATCH | VS_IDENT))
15719 +#define find_task_by_real_pid(pid) find_task_by_pid_ns(pid, &init_pid_ns)
15724 +struct task_struct *vx_find_proc_task_by_pid(int pid)
15726 + struct task_struct *task = find_task_by_real_pid(pid);
15728 + if (task && !vx_proc_task_visible(task)) {
15729 + vxdprintk(VXD_CBIT(misc, 6),
15730 + "dropping task (find) %p[#%u,%u] for %p[#%u,%u]",
15731 + task, task->xid, task->pid,
15732 + current, current->xid, current->pid);
15741 +struct task_struct *vx_get_proc_task(struct inode *inode, struct pid *pid)
15743 + struct task_struct *task = get_pid_task(pid, PIDTYPE_PID);
15745 + if (task && !vx_proc_task_visible(task)) {
15746 + vxdprintk(VXD_CBIT(misc, 6),
15747 + "dropping task (get) %p[#%u,%u] for %p[#%u,%u]",
15748 + task, task->xid, task->pid,
15749 + current, current->xid, current->pid);
15750 + put_task_struct(task);
15759 +struct task_struct *vx_child_reaper(struct task_struct *p)
15761 + struct vx_info *vxi = p->vx_info;
15762 + struct task_struct *reaper = child_reaper(p);
15767 + BUG_ON(!p->vx_info->vx_reaper);
15769 + /* child reaper for the guest reaper */
15770 + if (vxi->vx_reaper == p)
15773 + reaper = vxi->vx_reaper;
15775 + vxdprintk(VXD_CBIT(xid, 7),
15776 + "vx_child_reaper(%p[#%u,%u]) = %p[#%u,%u]",
15777 + p, p->xid, p->pid, reaper, reaper->xid, reaper->pid);
15785 +#warning duplicate inclusion
15787 diff -NurpP --minimal linux-2.6.34/include/linux/vs_sched.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_sched.h
15788 --- linux-2.6.34/include/linux/vs_sched.h 1970-01-01 01:00:00.000000000 +0100
15789 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_sched.h 2010-05-18 18:11:22.000000000 +0200
15791 +#ifndef _VS_SCHED_H
15792 +#define _VS_SCHED_H
15794 +#include "vserver/base.h"
15795 +#include "vserver/context.h"
15796 +#include "vserver/sched.h"
15799 +#define VAVAVOOM_RATIO 50
15801 +#define MAX_PRIO_BIAS 20
15802 +#define MIN_PRIO_BIAS -20
15805 +#ifdef CONFIG_VSERVER_HARDCPU
15808 + * effective_prio - return the priority that is based on the static
15809 + * priority but is modified by bonuses/penalties.
15811 + * We scale the actual sleep average [0 .... MAX_SLEEP_AVG]
15812 + * into a -4 ... 0 ... +4 bonus/penalty range.
15814 + * Additionally, we scale another amount based on the number of
15815 + * CPU tokens currently held by the context, if the process is
15816 + * part of a context (and the appropriate SCHED flag is set).
15817 + * This ranges from -5 ... 0 ... +15, quadratically.
15819 + * So, the total bonus is -9 .. 0 .. +19
15820 + * We use ~50% of the full 0...39 priority range so that:
15822 + * 1) nice +19 interactive tasks do not preempt nice 0 CPU hogs.
15823 + * 2) nice -20 CPU hogs do not get preempted by nice 0 tasks.
15824 + * unless that context is far exceeding its CPU allocation.
15826 + * Both properties are important to certain workloads.
15829 +int vx_effective_vavavoom(struct _vx_sched_pc *sched_pc, int max_prio)
15831 + int vavavoom, max;
15833 + /* lots of tokens = lots of vavavoom
15834 + * no tokens = no vavavoom */
15835 + if ((vavavoom = sched_pc->tokens) >= 0) {
15836 + max = sched_pc->tokens_max;
15837 + vavavoom = max - vavavoom;
15839 + vavavoom = max_prio * VAVAVOOM_RATIO / 100
15840 + * (vavavoom*vavavoom - (max >> 2)) / max;
15848 +int vx_adjust_prio(struct task_struct *p, int prio, int max_user)
15850 + struct vx_info *vxi = p->vx_info;
15851 + struct _vx_sched_pc *sched_pc;
15856 + sched_pc = &vx_cpu(vxi, sched_pc);
15857 + if (vx_info_flags(vxi, VXF_SCHED_PRIO, 0)) {
15858 + int vavavoom = vx_effective_vavavoom(sched_pc, max_user);
15860 + sched_pc->vavavoom = vavavoom;
15861 + prio += vavavoom;
15863 + prio += sched_pc->prio_bias;
15867 +#else /* !CONFIG_VSERVER_HARDCPU */
15870 +int vx_adjust_prio(struct task_struct *p, int prio, int max_user)
15872 + struct vx_info *vxi = p->vx_info;
15875 + prio += vx_cpu(vxi, sched_pc).prio_bias;
15879 +#endif /* CONFIG_VSERVER_HARDCPU */
15882 +static inline void vx_account_user(struct vx_info *vxi,
15883 + cputime_t cputime, int nice)
15887 + vx_cpu(vxi, sched_pc).user_ticks += cputime;
15890 +static inline void vx_account_system(struct vx_info *vxi,
15891 + cputime_t cputime, int idle)
15895 + vx_cpu(vxi, sched_pc).sys_ticks += cputime;
15899 +#warning duplicate inclusion
15901 diff -NurpP --minimal linux-2.6.34/include/linux/vs_socket.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_socket.h
15902 --- linux-2.6.34/include/linux/vs_socket.h 1970-01-01 01:00:00.000000000 +0100
15903 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_socket.h 2010-05-18 18:11:22.000000000 +0200
15905 +#ifndef _VS_SOCKET_H
15906 +#define _VS_SOCKET_H
15908 +#include "vserver/debug.h"
15909 +#include "vserver/base.h"
15910 +#include "vserver/cacct.h"
15911 +#include "vserver/context.h"
15912 +#include "vserver/tag.h"
15915 +/* socket accounting */
15917 +#include <linux/socket.h>
15919 +static inline int vx_sock_type(int family)
15921 + switch (family) {
15923 + return VXA_SOCK_UNSPEC;
15925 + return VXA_SOCK_UNIX;
15927 + return VXA_SOCK_INET;
15929 + return VXA_SOCK_INET6;
15931 + return VXA_SOCK_PACKET;
15933 + return VXA_SOCK_OTHER;
15937 +#define vx_acc_sock(v, f, p, s) \
15938 + __vx_acc_sock(v, f, p, s, __FILE__, __LINE__)
15940 +static inline void __vx_acc_sock(struct vx_info *vxi,
15941 + int family, int pos, int size, char *file, int line)
15944 + int type = vx_sock_type(family);
15946 + atomic_long_inc(&vxi->cacct.sock[type][pos].count);
15947 + atomic_long_add(size, &vxi->cacct.sock[type][pos].total);
15951 +#define vx_sock_recv(sk, s) \
15952 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 0, s)
15953 +#define vx_sock_send(sk, s) \
15954 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 1, s)
15955 +#define vx_sock_fail(sk, s) \
15956 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 2, s)
15959 +#define sock_vx_init(s) do { \
15960 + (s)->sk_xid = 0; \
15961 + (s)->sk_vx_info = NULL; \
15964 +#define sock_nx_init(s) do { \
15965 + (s)->sk_nid = 0; \
15966 + (s)->sk_nx_info = NULL; \
15970 +#warning duplicate inclusion
15972 diff -NurpP --minimal linux-2.6.34/include/linux/vs_tag.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_tag.h
15973 --- linux-2.6.34/include/linux/vs_tag.h 1970-01-01 01:00:00.000000000 +0100
15974 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_tag.h 2010-05-18 18:11:22.000000000 +0200
15979 +#include <linux/vserver/tag.h>
15981 +/* check conditions */
15983 +#define DX_ADMIN 0x0001
15984 +#define DX_WATCH 0x0002
15985 +#define DX_HOSTID 0x0008
15987 +#define DX_IDENT 0x0010
15989 +#define DX_ARG_MASK 0x0010
15992 +#define dx_task_tag(t) ((t)->tag)
15994 +#define dx_current_tag() dx_task_tag(current)
15996 +#define dx_check(c, m) __dx_check(dx_current_tag(), c, m)
15998 +#define dx_weak_check(c, m) ((m) ? dx_check(c, m) : 1)
16002 + * check current context for ADMIN/WATCH and
16003 + * optionally against supplied argument
16005 +static inline int __dx_check(tag_t cid, tag_t id, unsigned int mode)
16007 + if (mode & DX_ARG_MASK) {
16008 + if ((mode & DX_IDENT) && (id == cid))
16011 + return (((mode & DX_ADMIN) && (cid == 0)) ||
16012 + ((mode & DX_WATCH) && (cid == 1)) ||
16013 + ((mode & DX_HOSTID) && (id == 0)));
16017 +int dx_permission(const struct inode *inode, int mask);
16021 +#warning duplicate inclusion
16023 diff -NurpP --minimal linux-2.6.34/include/linux/vs_time.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_time.h
16024 --- linux-2.6.34/include/linux/vs_time.h 1970-01-01 01:00:00.000000000 +0100
16025 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/linux/vs_time.h 2010-05-18 18:11:22.000000000 +0200
16027 +#ifndef _VS_TIME_H
16028 +#define _VS_TIME_H
16031 +/* time faking stuff */
16033 +#ifdef CONFIG_VSERVER_VTIME
16035 +extern void vx_gettimeofday(struct timeval *tv);
16036 +extern int vx_settimeofday(struct timespec *ts);
16039 +#define vx_gettimeofday(t) do_gettimeofday(t)
16040 +#define vx_settimeofday(t) do_settimeofday(t)
16044 +#warning duplicate inclusion
16046 diff -NurpP --minimal linux-2.6.34/include/net/addrconf.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/addrconf.h
16047 --- linux-2.6.34/include/net/addrconf.h 2010-05-18 15:07:52.000000000 +0200
16048 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/addrconf.h 2010-05-18 18:11:22.000000000 +0200
16049 @@ -84,7 +84,8 @@ extern int ipv6_dev_get_saddr(struct n
16050 struct net_device *dev,
16051 const struct in6_addr *daddr,
16052 unsigned int srcprefs,
16053 - struct in6_addr *saddr);
16054 + struct in6_addr *saddr,
16055 + struct nx_info *nxi);
16056 extern int ipv6_get_lladdr(struct net_device *dev,
16057 struct in6_addr *addr,
16058 unsigned char banned_flags);
16059 diff -NurpP --minimal linux-2.6.34/include/net/af_unix.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/af_unix.h
16060 --- linux-2.6.34/include/net/af_unix.h 2008-12-25 00:26:37.000000000 +0100
16061 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/af_unix.h 2010-05-18 18:11:22.000000000 +0200
16063 #include <linux/socket.h>
16064 #include <linux/un.h>
16065 #include <linux/mutex.h>
16066 +#include <linux/vs_base.h>
16067 #include <net/sock.h>
16069 extern void unix_inflight(struct file *fp);
16070 diff -NurpP --minimal linux-2.6.34/include/net/inet_timewait_sock.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/inet_timewait_sock.h
16071 --- linux-2.6.34/include/net/inet_timewait_sock.h 2010-02-25 11:52:08.000000000 +0100
16072 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/inet_timewait_sock.h 2010-05-18 18:11:22.000000000 +0200
16073 @@ -117,6 +117,10 @@ struct inet_timewait_sock {
16074 #define tw_hash __tw_common.skc_hash
16075 #define tw_prot __tw_common.skc_prot
16076 #define tw_net __tw_common.skc_net
16077 +#define tw_xid __tw_common.skc_xid
16078 +#define tw_vx_info __tw_common.skc_vx_info
16079 +#define tw_nid __tw_common.skc_nid
16080 +#define tw_nx_info __tw_common.skc_nx_info
16082 volatile unsigned char tw_substate;
16083 /* 3 bits hole, try to pack */
16084 diff -NurpP --minimal linux-2.6.34/include/net/route.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/route.h
16085 --- linux-2.6.34/include/net/route.h 2010-05-18 15:07:52.000000000 +0200
16086 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/route.h 2010-05-18 18:11:22.000000000 +0200
16087 @@ -132,6 +132,9 @@ static inline void ip_rt_put(struct rtab
16088 dst_release(&rt->u.dst);
16091 +#include <linux/vs_base.h>
16092 +#include <linux/vs_inet.h>
16094 #define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
16096 extern const __u8 ip_tos2prio[16];
16097 @@ -141,6 +144,9 @@ static inline char rt_tos2priority(u8 to
16098 return ip_tos2prio[IPTOS_TOS(tos)>>1];
16101 +extern int ip_v4_find_src(struct net *net, struct nx_info *,
16102 + struct rtable **, struct flowi *);
16104 static inline int ip_route_connect(struct rtable **rp, __be32 dst,
16105 __be32 src, u32 tos, int oif, u8 protocol,
16106 __be16 sport, __be16 dport, struct sock *sk,
16107 @@ -158,11 +164,24 @@ static inline int ip_route_connect(struc
16110 struct net *net = sock_net(sk);
16111 + struct nx_info *nx_info = current_nx_info();
16113 if (inet_sk(sk)->transparent)
16114 fl.flags |= FLOWI_FLAG_ANYSRC;
16116 - if (!dst || !src) {
16118 + nx_info = sk->sk_nx_info;
16120 + vxdprintk(VXD_CBIT(net, 4),
16121 + "ip_route_connect(%p) %p,%p;%lx",
16122 + sk, nx_info, sk->sk_socket,
16123 + (sk->sk_socket?sk->sk_socket->flags:0));
16125 + err = ip_v4_find_src(net, nx_info, rp, &fl);
16129 + if (!fl.fl4_dst || !fl.fl4_src) {
16130 err = __ip_route_output_key(net, rp, &fl);
16133 diff -NurpP --minimal linux-2.6.34/include/net/sock.h linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/sock.h
16134 --- linux-2.6.34/include/net/sock.h 2010-05-18 15:07:53.000000000 +0200
16135 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/include/net/sock.h 2010-05-18 18:11:22.000000000 +0200
16136 @@ -150,6 +150,10 @@ struct sock_common {
16137 #ifdef CONFIG_NET_NS
16138 struct net *skc_net;
16141 + struct vx_info *skc_vx_info;
16143 + struct nx_info *skc_nx_info;
16147 @@ -237,6 +241,10 @@ struct sock {
16148 #define sk_bind_node __sk_common.skc_bind_node
16149 #define sk_prot __sk_common.skc_prot
16150 #define sk_net __sk_common.skc_net
16151 +#define sk_xid __sk_common.skc_xid
16152 +#define sk_vx_info __sk_common.skc_vx_info
16153 +#define sk_nid __sk_common.skc_nid
16154 +#define sk_nx_info __sk_common.skc_nx_info
16155 kmemcheck_bitfield_begin(flags);
16156 unsigned int sk_shutdown : 2,
16158 diff -NurpP --minimal linux-2.6.34/init/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/init/Kconfig
16159 --- linux-2.6.34/init/Kconfig 2010-05-18 15:07:53.000000000 +0200
16160 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/init/Kconfig 2010-05-18 18:11:22.000000000 +0200
16161 @@ -464,6 +464,7 @@ config HAVE_UNSTABLE_SCHED_CLOCK
16163 boolean "Control Group support"
16167 This option adds support for grouping sets of processes together, for
16168 use with process control subsystems such as Cpusets, CFS, memory
16169 @@ -491,6 +492,7 @@ config CGROUP_DEBUG
16171 bool "Namespace cgroup subsystem"
16175 Provides a simple namespace cgroup subsystem to
16176 provide hierarchical naming of sets of namespaces,
16177 diff -NurpP --minimal linux-2.6.34/init/main.c linux-2.6.34-vs2.3.0.36.30.4.pre6/init/main.c
16178 --- linux-2.6.34/init/main.c 2010-05-18 15:07:53.000000000 +0200
16179 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/init/main.c 2010-05-18 18:11:22.000000000 +0200
16181 #include <linux/shmem_fs.h>
16182 #include <linux/slab.h>
16183 #include <trace/boot.h>
16184 +#include <linux/vserver/percpu.h>
16186 #include <asm/io.h>
16187 #include <asm/bugs.h>
16188 diff -NurpP --minimal linux-2.6.34/ipc/mqueue.c linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/mqueue.c
16189 --- linux-2.6.34/ipc/mqueue.c 2010-05-18 15:07:53.000000000 +0200
16190 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/mqueue.c 2010-05-18 18:13:21.000000000 +0200
16192 #include <linux/pid.h>
16193 #include <linux/ipc_namespace.h>
16194 #include <linux/slab.h>
16195 +#include <linux/vs_context.h>
16196 +#include <linux/vs_limit.h>
16198 #include <net/sock.h>
16200 @@ -66,6 +68,7 @@ struct mqueue_inode_info {
16201 struct sigevent notify;
16202 struct pid* notify_owner;
16203 struct user_struct *user; /* user who created, for accounting */
16204 + struct vx_info *vxi;
16205 struct sock *notify_sock;
16206 struct sk_buff *notify_cookie;
16208 @@ -125,6 +128,7 @@ static struct inode *mqueue_get_inode(st
16209 if (S_ISREG(mode)) {
16210 struct mqueue_inode_info *info;
16211 struct task_struct *p = current;
16212 + struct vx_info *vxi = p->vx_info;
16213 unsigned long mq_bytes, mq_msg_tblsz;
16215 inode->i_fop = &mqueue_file_operations;
16216 @@ -138,6 +142,7 @@ static struct inode *mqueue_get_inode(st
16217 info->notify_owner = NULL;
16219 info->user = NULL; /* set when all is ok */
16220 + info->vxi = NULL;
16221 memset(&info->attr, 0, sizeof(info->attr));
16222 info->attr.mq_maxmsg = ipc_ns->mq_msg_max;
16223 info->attr.mq_msgsize = ipc_ns->mq_msgsize_max;
16224 @@ -156,16 +161,19 @@ static struct inode *mqueue_get_inode(st
16225 spin_lock(&mq_lock);
16226 if (u->mq_bytes + mq_bytes < u->mq_bytes ||
16227 u->mq_bytes + mq_bytes >
16228 - task_rlimit(p, RLIMIT_MSGQUEUE)) {
16229 + task_rlimit(p, RLIMIT_MSGQUEUE) ||
16230 + !vx_ipcmsg_avail(vxi, mq_bytes)) {
16231 spin_unlock(&mq_lock);
16232 /* mqueue_delete_inode() releases info->messages */
16235 u->mq_bytes += mq_bytes;
16236 + vx_ipcmsg_add(vxi, u, mq_bytes);
16237 spin_unlock(&mq_lock);
16240 info->user = get_uid(u);
16241 + info->vxi = get_vx_info(vxi);
16242 } else if (S_ISDIR(mode)) {
16244 /* Some things misbehave if size == 0 on a directory */
16245 @@ -269,8 +277,11 @@ static void mqueue_delete_inode(struct i
16246 + info->attr.mq_msgsize);
16249 + struct vx_info *vxi = info->vxi;
16251 spin_lock(&mq_lock);
16252 user->mq_bytes -= mq_bytes;
16253 + vx_ipcmsg_sub(vxi, user, mq_bytes);
16255 * get_ns_from_inode() ensures that the
16256 * (ipc_ns = sb->s_fs_info) is either a valid ipc_ns
16257 @@ -280,6 +291,7 @@ static void mqueue_delete_inode(struct i
16259 ipc_ns->mq_queues_count--;
16260 spin_unlock(&mq_lock);
16261 + put_vx_info(vxi);
16265 diff -NurpP --minimal linux-2.6.34/ipc/msg.c linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/msg.c
16266 --- linux-2.6.34/ipc/msg.c 2010-05-18 15:07:53.000000000 +0200
16267 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/msg.c 2010-05-18 18:11:22.000000000 +0200
16269 #include <linux/rwsem.h>
16270 #include <linux/nsproxy.h>
16271 #include <linux/ipc_namespace.h>
16272 +#include <linux/vs_base.h>
16274 #include <asm/current.h>
16275 #include <asm/uaccess.h>
16276 @@ -190,6 +191,7 @@ static int newque(struct ipc_namespace *
16278 msq->q_perm.mode = msgflg & S_IRWXUGO;
16279 msq->q_perm.key = key;
16280 + msq->q_perm.xid = vx_current_xid();
16282 msq->q_perm.security = NULL;
16283 retval = security_msg_queue_alloc(msq);
16284 diff -NurpP --minimal linux-2.6.34/ipc/namespace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/namespace.c
16285 --- linux-2.6.34/ipc/namespace.c 2009-09-10 15:26:27.000000000 +0200
16286 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/namespace.c 2010-05-18 18:11:22.000000000 +0200
16288 #include <linux/slab.h>
16289 #include <linux/fs.h>
16290 #include <linux/mount.h>
16291 +#include <linux/vs_base.h>
16292 +#include <linux/vserver/global.h>
16296 diff -NurpP --minimal linux-2.6.34/ipc/sem.c linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/sem.c
16297 --- linux-2.6.34/ipc/sem.c 2010-02-25 11:52:09.000000000 +0100
16298 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/sem.c 2010-05-18 18:11:22.000000000 +0200
16300 #include <linux/rwsem.h>
16301 #include <linux/nsproxy.h>
16302 #include <linux/ipc_namespace.h>
16303 +#include <linux/vs_base.h>
16304 +#include <linux/vs_limit.h>
16306 #include <asm/uaccess.h>
16308 @@ -257,6 +259,7 @@ static int newary(struct ipc_namespace *
16310 sma->sem_perm.mode = (semflg & S_IRWXUGO);
16311 sma->sem_perm.key = key;
16312 + sma->sem_perm.xid = vx_current_xid();
16314 sma->sem_perm.security = NULL;
16315 retval = security_sem_alloc(sma);
16316 @@ -272,6 +275,9 @@ static int newary(struct ipc_namespace *
16319 ns->used_sems += nsems;
16320 + /* FIXME: obsoleted? */
16321 + vx_semary_inc(sma);
16322 + vx_nsems_add(sma, nsems);
16324 sma->sem_base = (struct sem *) &sma[1];
16326 @@ -595,6 +601,9 @@ static void freeary(struct ipc_namespace
16329 ns->used_sems -= sma->sem_nsems;
16330 + /* FIXME: obsoleted? */
16331 + vx_nsems_sub(sma, sma->sem_nsems);
16332 + vx_semary_dec(sma);
16333 security_sem_free(sma);
16334 ipc_rcu_putref(sma);
16336 diff -NurpP --minimal linux-2.6.34/ipc/shm.c linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/shm.c
16337 --- linux-2.6.34/ipc/shm.c 2010-05-18 15:07:53.000000000 +0200
16338 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/ipc/shm.c 2010-05-18 18:11:22.000000000 +0200
16340 #include <linux/nsproxy.h>
16341 #include <linux/mount.h>
16342 #include <linux/ipc_namespace.h>
16343 +#include <linux/vs_context.h>
16344 +#include <linux/vs_limit.h>
16346 #include <asm/uaccess.h>
16348 @@ -169,7 +171,12 @@ static void shm_open(struct vm_area_stru
16350 static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
16352 - ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
16353 + struct vx_info *vxi = lookup_vx_info(shp->shm_perm.xid);
16354 + int numpages = (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
16356 + vx_ipcshm_sub(vxi, shp, numpages);
16357 + ns->shm_tot -= numpages;
16361 if (!is_file_hugepages(shp->shm_file))
16362 @@ -179,6 +186,7 @@ static void shm_destroy(struct ipc_names
16364 fput (shp->shm_file);
16365 security_shm_free(shp);
16366 + put_vx_info(vxi);
16367 ipc_rcu_putref(shp);
16370 @@ -352,11 +360,15 @@ static int newseg(struct ipc_namespace *
16371 if (ns->shm_tot + numpages > ns->shm_ctlall)
16374 + if (!vx_ipcshm_avail(current_vx_info(), numpages))
16377 shp = ipc_rcu_alloc(sizeof(*shp));
16381 shp->shm_perm.key = key;
16382 + shp->shm_perm.xid = vx_current_xid();
16383 shp->shm_perm.mode = (shmflg & S_IRWXUGO);
16384 shp->mlock_user = NULL;
16386 @@ -410,6 +422,7 @@ static int newseg(struct ipc_namespace *
16387 ns->shm_tot += numpages;
16388 error = shp->shm_perm.id;
16390 + vx_ipcshm_add(current_vx_info(), key, numpages);
16394 diff -NurpP --minimal linux-2.6.34/kernel/capability.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/capability.c
16395 --- linux-2.6.34/kernel/capability.c 2010-05-18 15:07:53.000000000 +0200
16396 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/capability.c 2010-05-18 18:11:22.000000000 +0200
16398 #include <linux/security.h>
16399 #include <linux/syscalls.h>
16400 #include <linux/pid_namespace.h>
16401 +#include <linux/vs_context.h>
16402 #include <asm/uaccess.h>
16403 #include "cred-internals.h"
16405 @@ -120,6 +121,7 @@ static int cap_validate_magic(cap_user_h
16411 * The only thing that can change the capabilities of the current
16412 * process is the current process. As such, we can't be in this code
16413 @@ -290,6 +292,8 @@ error:
16417 +#include <linux/vserver/base.h>
16420 * capable - Determine if the current task has a superior capability in effect
16421 * @cap: The capability to be tested for
16422 @@ -302,6 +306,9 @@ error:
16424 int capable(int cap)
16426 + /* here for now so we don't require task locking */
16427 + if (vs_check_bit(VXC_CAP_MASK, cap) && !vx_mcaps(1L << cap))
16429 if (unlikely(!cap_valid(cap))) {
16430 printk(KERN_CRIT "capable() called with invalid cap=%u\n", cap);
16432 diff -NurpP --minimal linux-2.6.34/kernel/compat.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/compat.c
16433 --- linux-2.6.34/kernel/compat.c 2010-05-18 15:07:53.000000000 +0200
16434 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/compat.c 2010-05-18 18:11:22.000000000 +0200
16435 @@ -903,7 +903,7 @@ asmlinkage long compat_sys_time(compat_t
16439 - do_gettimeofday(&tv);
16440 + vx_gettimeofday(&tv);
16444 @@ -928,7 +928,7 @@ asmlinkage long compat_sys_stime(compat_
16448 - do_settimeofday(&tv);
16449 + vx_settimeofday(&tv);
16453 diff -NurpP --minimal linux-2.6.34/kernel/exit.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/exit.c
16454 --- linux-2.6.34/kernel/exit.c 2010-05-18 15:07:53.000000000 +0200
16455 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/exit.c 2010-05-18 18:11:22.000000000 +0200
16457 #include <linux/fs_struct.h>
16458 #include <linux/init_task.h>
16459 #include <linux/perf_event.h>
16460 +#include <linux/vs_limit.h>
16461 +#include <linux/vs_context.h>
16462 +#include <linux/vs_network.h>
16463 +#include <linux/vs_pid.h>
16464 #include <trace/events/sched.h>
16465 #include <linux/hw_breakpoint.h>
16467 @@ -495,9 +499,11 @@ static void close_files(struct files_str
16468 filp_close(file, files);
16471 + vx_openfd_dec(i);
16479 @@ -1029,11 +1035,16 @@ NORET_TYPE void do_exit(long code)
16481 validate_creds_for_do_exit(tsk);
16483 + /* needs to stay after exit_notify() */
16484 + exit_vx_info(tsk, code);
16485 + exit_nx_info(tsk);
16489 /* causes final put_task_struct in finish_task_switch(). */
16490 tsk->state = TASK_DEAD;
16492 + printk("bad task: %p [%lx]\n", current, current->state);
16494 /* Avoid "noreturn function does return". */
16496 diff -NurpP --minimal linux-2.6.34/kernel/fork.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/fork.c
16497 --- linux-2.6.34/kernel/fork.c 2010-05-18 15:07:53.000000000 +0200
16498 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/fork.c 2010-05-21 23:19:57.000000000 +0200
16500 #include <linux/perf_event.h>
16501 #include <linux/posix-timers.h>
16502 #include <linux/user-return-notifier.h>
16503 +#include <linux/vs_context.h>
16504 +#include <linux/vs_network.h>
16505 +#include <linux/vs_limit.h>
16506 +#include <linux/vs_memory.h>
16508 #include <asm/pgtable.h>
16509 #include <asm/pgalloc.h>
16510 @@ -160,6 +164,8 @@ void free_task(struct task_struct *tsk)
16511 account_kernel_stack(tsk->stack, -1);
16512 free_thread_info(tsk->stack);
16513 rt_mutex_debug_task_free(tsk);
16514 + clr_vx_info(&tsk->vx_info);
16515 + clr_nx_info(&tsk->nx_info);
16516 ftrace_graph_exit_task(tsk);
16517 free_task_struct(tsk);
16519 @@ -476,6 +482,7 @@ static struct mm_struct * mm_init(struct
16520 if (likely(!mm_alloc_pgd(mm))) {
16522 mmu_notifier_mm_init(mm);
16523 + set_vx_info(&mm->mm_vx_info, p->vx_info);
16527 @@ -509,6 +516,7 @@ void __mmdrop(struct mm_struct *mm)
16529 destroy_context(mm);
16530 mmu_notifier_mm_destroy(mm);
16531 + clr_vx_info(&mm->mm_vx_info);
16534 EXPORT_SYMBOL_GPL(__mmdrop);
16535 @@ -644,6 +652,7 @@ struct mm_struct *dup_mm(struct task_str
16538 memcpy(mm, oldmm, sizeof(*mm));
16539 + mm->mm_vx_info = NULL;
16541 /* Initializing for Swap token stuff */
16542 mm->token_priority = 0;
16543 @@ -682,6 +691,7 @@ fail_nocontext:
16544 * If init_new_context() failed, we cannot use mmput() to free the mm
16545 * because it calls destroy_context()
16547 + clr_vx_info(&mm->mm_vx_info);
16551 @@ -962,6 +972,8 @@ static struct task_struct *copy_process(
16553 struct task_struct *p;
16554 int cgroup_callbacks_done = 0;
16555 + struct vx_info *vxi;
16556 + struct nx_info *nxi;
16558 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
16559 return ERR_PTR(-EINVAL);
16560 @@ -1008,7 +1020,12 @@ static struct task_struct *copy_process(
16561 DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
16562 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
16564 + init_vx_info(&p->vx_info, current_vx_info());
16565 + init_nx_info(&p->nx_info, current_nx_info());
16568 + if (!vx_nproc_avail(1))
16569 + goto bad_fork_free;
16570 if (atomic_read(&p->real_cred->user->processes) >=
16571 task_rlimit(p, RLIMIT_NPROC)) {
16572 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
16573 @@ -1275,6 +1292,18 @@ static struct task_struct *copy_process(
16576 spin_unlock(¤t->sighand->siglock);
16578 + /* p is copy of current */
16579 + vxi = p->vx_info;
16581 + claim_vx_info(vxi, p);
16582 + atomic_inc(&vxi->cvirt.nr_threads);
16583 + atomic_inc(&vxi->cvirt.total_forks);
16586 + nxi = p->nx_info;
16588 + claim_nx_info(nxi, p);
16589 write_unlock_irq(&tasklist_lock);
16590 proc_fork_connector(p);
16591 cgroup_post_fork(p);
16592 diff -NurpP --minimal linux-2.6.34/kernel/kthread.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/kthread.c
16593 --- linux-2.6.34/kernel/kthread.c 2010-05-18 15:07:53.000000000 +0200
16594 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/kthread.c 2010-05-18 18:11:22.000000000 +0200
16596 #include <linux/file.h>
16597 #include <linux/module.h>
16598 #include <linux/mutex.h>
16599 +#include <linux/vs_pid.h>
16600 #include <trace/events/sched.h>
16602 static DEFINE_SPINLOCK(kthread_create_lock);
16603 diff -NurpP --minimal linux-2.6.34/kernel/Makefile linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/Makefile
16604 --- linux-2.6.34/kernel/Makefile 2010-05-18 15:07:53.000000000 +0200
16605 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/Makefile 2010-05-18 18:11:22.000000000 +0200
16606 @@ -25,6 +25,7 @@ CFLAGS_REMOVE_sched_clock.o = -pg
16607 CFLAGS_REMOVE_perf_event.o = -pg
16611 obj-$(CONFIG_FREEZER) += freezer.o
16612 obj-$(CONFIG_PROFILING) += profile.o
16613 obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
16614 diff -NurpP --minimal linux-2.6.34/kernel/nsproxy.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/nsproxy.c
16615 --- linux-2.6.34/kernel/nsproxy.c 2010-05-18 15:07:53.000000000 +0200
16616 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/nsproxy.c 2010-05-18 18:11:22.000000000 +0200
16618 #include <linux/mnt_namespace.h>
16619 #include <linux/utsname.h>
16620 #include <linux/pid_namespace.h>
16621 +#include <linux/vserver/global.h>
16622 +#include <linux/vserver/debug.h>
16623 #include <net/net_namespace.h>
16624 #include <linux/ipc_namespace.h>
16626 @@ -43,8 +45,11 @@ static inline struct nsproxy *create_nsp
16627 struct nsproxy *nsproxy;
16629 nsproxy = kmem_cache_alloc(nsproxy_cachep, GFP_KERNEL);
16632 atomic_set(&nsproxy->count, 1);
16633 + atomic_inc(&vs_global_nsproxy);
16635 + vxdprintk(VXD_CBIT(space, 2), "create_nsproxy = %p[1]", nsproxy);
16639 @@ -53,41 +58,52 @@ static inline struct nsproxy *create_nsp
16640 * Return the newly created nsproxy. Do not attach this to the task,
16641 * leave it to the caller to do proper locking and attach it to task.
16643 -static struct nsproxy *create_new_namespaces(unsigned long flags,
16644 - struct task_struct *tsk, struct fs_struct *new_fs)
16645 +static struct nsproxy *unshare_namespaces(unsigned long flags,
16646 + struct nsproxy *orig, struct fs_struct *new_fs)
16648 struct nsproxy *new_nsp;
16651 + vxdprintk(VXD_CBIT(space, 4),
16652 + "unshare_namespaces(0x%08lx,%p,%p)",
16653 + flags, orig, new_fs);
16655 new_nsp = create_nsproxy();
16657 return ERR_PTR(-ENOMEM);
16659 - new_nsp->mnt_ns = copy_mnt_ns(flags, tsk->nsproxy->mnt_ns, new_fs);
16660 + new_nsp->mnt_ns = copy_mnt_ns(flags, orig->mnt_ns, new_fs);
16661 if (IS_ERR(new_nsp->mnt_ns)) {
16662 err = PTR_ERR(new_nsp->mnt_ns);
16666 - new_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns);
16667 + new_nsp->uts_ns = copy_utsname(flags, orig->uts_ns);
16668 if (IS_ERR(new_nsp->uts_ns)) {
16669 err = PTR_ERR(new_nsp->uts_ns);
16673 - new_nsp->ipc_ns = copy_ipcs(flags, tsk->nsproxy->ipc_ns);
16674 + new_nsp->ipc_ns = copy_ipcs(flags, orig->ipc_ns);
16675 if (IS_ERR(new_nsp->ipc_ns)) {
16676 err = PTR_ERR(new_nsp->ipc_ns);
16680 - new_nsp->pid_ns = copy_pid_ns(flags, task_active_pid_ns(tsk));
16681 + new_nsp->pid_ns = copy_pid_ns(flags, orig->pid_ns);
16682 if (IS_ERR(new_nsp->pid_ns)) {
16683 err = PTR_ERR(new_nsp->pid_ns);
16687 - new_nsp->net_ns = copy_net_ns(flags, tsk->nsproxy->net_ns);
16689 + new_nsp->user_ns = copy_user_ns(flags, orig->user_ns);
16690 + if (IS_ERR(new_nsp->user_ns)) {
16691 + err = PTR_ERR(new_nsp->user_ns);
16695 + new_nsp->net_ns = copy_net_ns(flags, orig->net_ns);
16696 if (IS_ERR(new_nsp->net_ns)) {
16697 err = PTR_ERR(new_nsp->net_ns);
16699 @@ -112,6 +128,38 @@ out_ns:
16700 return ERR_PTR(err);
16703 +static struct nsproxy *create_new_namespaces(int flags, struct task_struct *tsk,
16704 + struct fs_struct *new_fs)
16706 + return unshare_namespaces(flags, tsk->nsproxy, new_fs);
16710 + * copies the nsproxy, setting refcount to 1, and grabbing a
16711 + * reference to all contained namespaces.
16713 +struct nsproxy *copy_nsproxy(struct nsproxy *orig)
16715 + struct nsproxy *ns = create_nsproxy();
16718 + memcpy(ns, orig, sizeof(struct nsproxy));
16719 + atomic_set(&ns->count, 1);
16722 + get_mnt_ns(ns->mnt_ns);
16724 + get_uts_ns(ns->uts_ns);
16726 + get_ipc_ns(ns->ipc_ns);
16728 + get_pid_ns(ns->pid_ns);
16730 + get_net(ns->net_ns);
16736 * called from clone. This now handles copy for nsproxy and all
16737 * namespaces therein.
16738 @@ -119,9 +167,12 @@ out_ns:
16739 int copy_namespaces(unsigned long flags, struct task_struct *tsk)
16741 struct nsproxy *old_ns = tsk->nsproxy;
16742 - struct nsproxy *new_ns;
16743 + struct nsproxy *new_ns = NULL;
16746 + vxdprintk(VXD_CBIT(space, 7), "copy_namespaces(0x%08lx,%p[%p])",
16747 + flags, tsk, old_ns);
16752 @@ -131,7 +182,7 @@ int copy_namespaces(unsigned long flags,
16753 CLONE_NEWPID | CLONE_NEWNET)))
16756 - if (!capable(CAP_SYS_ADMIN)) {
16757 + if (!vx_can_unshare(CAP_SYS_ADMIN, flags)) {
16761 @@ -158,6 +209,9 @@ int copy_namespaces(unsigned long flags,
16764 put_nsproxy(old_ns);
16765 + vxdprintk(VXD_CBIT(space, 3),
16766 + "copy_namespaces(0x%08lx,%p[%p]) = %d [%p]",
16767 + flags, tsk, old_ns, err, new_ns);
16771 @@ -171,7 +225,9 @@ void free_nsproxy(struct nsproxy *ns)
16772 put_ipc_ns(ns->ipc_ns);
16774 put_pid_ns(ns->pid_ns);
16775 - put_net(ns->net_ns);
16777 + put_net(ns->net_ns);
16778 + atomic_dec(&vs_global_nsproxy);
16779 kmem_cache_free(nsproxy_cachep, ns);
16782 @@ -184,11 +240,15 @@ int unshare_nsproxy_namespaces(unsigned
16786 + vxdprintk(VXD_CBIT(space, 4),
16787 + "unshare_nsproxy_namespaces(0x%08lx,[%p])",
16788 + unshare_flags, current->nsproxy);
16790 if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
16794 - if (!capable(CAP_SYS_ADMIN))
16795 + if (!vx_can_unshare(CAP_SYS_ADMIN, unshare_flags))
16798 *new_nsp = create_new_namespaces(unshare_flags, current,
16799 diff -NurpP --minimal linux-2.6.34/kernel/pid.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/pid.c
16800 --- linux-2.6.34/kernel/pid.c 2010-05-18 15:07:53.000000000 +0200
16801 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/pid.c 2010-05-18 18:11:22.000000000 +0200
16803 #include <linux/pid_namespace.h>
16804 #include <linux/init_task.h>
16805 #include <linux/syscalls.h>
16806 +#include <linux/vs_pid.h>
16808 #define pid_hashfn(nr, ns) \
16809 hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift)
16810 @@ -305,7 +306,7 @@ EXPORT_SYMBOL_GPL(find_pid_ns);
16812 struct pid *find_vpid(int nr)
16814 - return find_pid_ns(nr, current->nsproxy->pid_ns);
16815 + return find_pid_ns(vx_rmap_pid(nr), current->nsproxy->pid_ns);
16817 EXPORT_SYMBOL_GPL(find_vpid);
16819 @@ -365,6 +366,9 @@ void transfer_pid(struct task_struct *ol
16820 struct task_struct *pid_task(struct pid *pid, enum pid_type type)
16822 struct task_struct *result = NULL;
16824 + if (type == PIDTYPE_REALPID)
16825 + type = PIDTYPE_PID;
16827 struct hlist_node *first;
16828 first = rcu_dereference_check(pid->tasks[type].first,
16829 @@ -382,7 +386,7 @@ EXPORT_SYMBOL(pid_task);
16831 struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
16833 - return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
16834 + return pid_task(find_pid_ns(vx_rmap_pid(nr), ns), PIDTYPE_PID);
16837 struct task_struct *find_task_by_vpid(pid_t vnr)
16838 @@ -424,7 +428,7 @@ struct pid *find_get_pid(pid_t nr)
16840 EXPORT_SYMBOL_GPL(find_get_pid);
16842 -pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
16843 +pid_t pid_unmapped_nr_ns(struct pid *pid, struct pid_namespace *ns)
16847 @@ -437,6 +441,11 @@ pid_t pid_nr_ns(struct pid *pid, struct
16851 +pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
16853 + return vx_map_pid(pid_unmapped_nr_ns(pid, ns));
16856 pid_t pid_vnr(struct pid *pid)
16858 return pid_nr_ns(pid, current->nsproxy->pid_ns);
16859 diff -NurpP --minimal linux-2.6.34/kernel/pid_namespace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/pid_namespace.c
16860 --- linux-2.6.34/kernel/pid_namespace.c 2010-05-18 15:07:53.000000000 +0200
16861 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/pid_namespace.c 2010-05-18 18:11:22.000000000 +0200
16863 #include <linux/err.h>
16864 #include <linux/acct.h>
16865 #include <linux/slab.h>
16866 +#include <linux/vserver/global.h>
16868 #define BITS_PER_PAGE (PAGE_SIZE*8)
16870 @@ -87,6 +88,7 @@ static struct pid_namespace *create_pid_
16873 kref_init(&ns->kref);
16874 + atomic_inc(&vs_global_pid_ns);
16876 ns->parent = get_pid_ns(parent_pid_ns);
16878 @@ -112,6 +114,7 @@ static void destroy_pid_namespace(struct
16880 for (i = 0; i < PIDMAP_ENTRIES; i++)
16881 kfree(ns->pidmap[i].page);
16882 + atomic_dec(&vs_global_pid_ns);
16883 kmem_cache_free(pid_ns_cachep, ns);
16886 diff -NurpP --minimal linux-2.6.34/kernel/posix-timers.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/posix-timers.c
16887 --- linux-2.6.34/kernel/posix-timers.c 2010-05-18 15:07:53.000000000 +0200
16888 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/posix-timers.c 2010-05-18 18:11:22.000000000 +0200
16890 #include <linux/wait.h>
16891 #include <linux/workqueue.h>
16892 #include <linux/module.h>
16893 +#include <linux/vs_context.h>
16896 * Management arrays for POSIX timers. Timers are kept in slab memory
16897 @@ -363,6 +364,7 @@ int posix_timer_event(struct k_itimer *t
16899 struct task_struct *task;
16900 int shared, ret = -1;
16903 * FIXME: if ->sigq is queued we can race with
16904 * dequeue_signal()->do_schedule_next_timer().
16905 @@ -379,10 +381,18 @@ int posix_timer_event(struct k_itimer *t
16907 task = pid_task(timr->it_pid, PIDTYPE_PID);
16909 + struct vx_info_save vxis;
16910 + struct vx_info *vxi;
16912 + vxi = get_vx_info(task->vx_info);
16913 + enter_vx_info(vxi, &vxis);
16914 shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
16915 ret = send_sigqueue(timr->sigq, task, shared);
16916 + leave_vx_info(&vxis);
16917 + put_vx_info(vxi);
16921 /* If we failed to send the signal the timer stops. */
16924 diff -NurpP --minimal linux-2.6.34/kernel/printk.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/printk.c
16925 --- linux-2.6.34/kernel/printk.c 2010-05-18 15:07:53.000000000 +0200
16926 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/printk.c 2010-05-18 18:11:22.000000000 +0200
16928 #include <linux/ratelimit.h>
16929 #include <linux/kmsg_dump.h>
16930 #include <linux/syslog.h>
16931 +#include <linux/vs_cvirt.h>
16933 #include <asm/uaccess.h>
16935 @@ -263,18 +264,15 @@ int do_syslog(int type, char __user *buf
16936 unsigned i, j, limit, count;
16942 error = security_syslog(type, from_file);
16947 - case SYSLOG_ACTION_CLOSE: /* Close log */
16949 - case SYSLOG_ACTION_OPEN: /* Open log */
16951 - case SYSLOG_ACTION_READ: /* Read from log */
16952 + if ((type == SYSLOG_ACTION_READ) ||
16953 + (type == SYSLOG_ACTION_READ_ALL) ||
16954 + (type == SYSLOG_ACTION_READ_CLEAR)) {
16956 if (!buf || len < 0)
16958 @@ -285,6 +283,16 @@ int do_syslog(int type, char __user *buf
16963 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
16964 + return vx_do_syslog(type, buf, len);
16967 + case SYSLOG_ACTION_CLOSE: /* Close log */
16969 + case SYSLOG_ACTION_OPEN: /* Open log */
16971 + case SYSLOG_ACTION_READ: /* Read from log */
16972 error = wait_event_interruptible(log_wait,
16973 (log_start - log_end));
16975 @@ -311,16 +319,6 @@ int do_syslog(int type, char __user *buf
16977 /* Read last kernel messages */
16978 case SYSLOG_ACTION_READ_ALL:
16980 - if (!buf || len < 0)
16985 - if (!access_ok(VERIFY_WRITE, buf, len)) {
16990 if (count > log_buf_len)
16991 count = log_buf_len;
16992 diff -NurpP --minimal linux-2.6.34/kernel/ptrace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/ptrace.c
16993 --- linux-2.6.34/kernel/ptrace.c 2010-05-18 15:07:53.000000000 +0200
16994 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/ptrace.c 2010-05-18 18:11:22.000000000 +0200
16996 #include <linux/syscalls.h>
16997 #include <linux/uaccess.h>
16998 #include <linux/regset.h>
16999 +#include <linux/vs_context.h>
17003 @@ -152,6 +153,11 @@ int __ptrace_may_access(struct task_stru
17004 dumpable = get_dumpable(task->mm);
17005 if (!dumpable && !capable(CAP_SYS_PTRACE))
17007 + if (!vx_check(task->xid, VS_ADMIN_P|VS_IDENT))
17009 + if (!vx_check(task->xid, VS_IDENT) &&
17010 + !task_vx_flags(task, VXF_STATE_ADMIN, 0))
17013 return security_ptrace_access_check(task, mode);
17015 @@ -683,6 +689,10 @@ SYSCALL_DEFINE4(ptrace, long, request, l
17020 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
17021 + goto out_put_task_struct;
17023 if (request == PTRACE_ATTACH) {
17024 ret = ptrace_attach(child);
17026 diff -NurpP --minimal linux-2.6.34/kernel/sched.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sched.c
17027 --- linux-2.6.34/kernel/sched.c 2010-05-18 15:07:53.000000000 +0200
17028 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sched.c 2010-05-18 18:11:22.000000000 +0200
17030 #include <linux/ctype.h>
17031 #include <linux/ftrace.h>
17032 #include <linux/slab.h>
17033 +#include <linux/vs_sched.h>
17034 +#include <linux/vs_cvirt.h>
17036 #include <asm/tlb.h>
17037 #include <asm/irq_regs.h>
17038 @@ -3035,9 +3037,17 @@ EXPORT_SYMBOL(avenrun);
17040 void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
17042 - loads[0] = (avenrun[0] + offset) << shift;
17043 - loads[1] = (avenrun[1] + offset) << shift;
17044 - loads[2] = (avenrun[2] + offset) << shift;
17045 + if (vx_flags(VXF_VIRT_LOAD, 0)) {
17046 + struct vx_info *vxi = current_vx_info();
17048 + loads[0] = (vxi->cvirt.load[0] + offset) << shift;
17049 + loads[1] = (vxi->cvirt.load[1] + offset) << shift;
17050 + loads[2] = (vxi->cvirt.load[2] + offset) << shift;
17052 + loads[0] = (avenrun[0] + offset) << shift;
17053 + loads[1] = (avenrun[1] + offset) << shift;
17054 + loads[2] = (avenrun[2] + offset) << shift;
17058 static unsigned long
17059 @@ -3263,16 +3273,19 @@ void account_user_time(struct task_struc
17060 cputime_t cputime_scaled)
17062 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
17063 + struct vx_info *vxi = p->vx_info; /* p is _always_ current */
17065 + int nice = (TASK_NICE(p) > 0);
17067 /* Add user time to process. */
17068 p->utime = cputime_add(p->utime, cputime);
17069 p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
17070 + vx_account_user(vxi, cputime, nice);
17071 account_group_user_time(p, cputime);
17073 /* Add user time to cpustat. */
17074 tmp = cputime_to_cputime64(cputime);
17075 - if (TASK_NICE(p) > 0)
17077 cpustat->nice = cputime64_add(cpustat->nice, tmp);
17079 cpustat->user = cputime64_add(cpustat->user, tmp);
17080 @@ -3323,6 +3336,7 @@ void account_system_time(struct task_str
17081 cputime_t cputime, cputime_t cputime_scaled)
17083 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
17084 + struct vx_info *vxi = p->vx_info; /* p is _always_ current */
17087 if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
17088 @@ -3333,6 +3347,7 @@ void account_system_time(struct task_str
17089 /* Add system time to process. */
17090 p->stime = cputime_add(p->stime, cputime);
17091 p->stimescaled = cputime_add(p->stimescaled, cputime_scaled);
17092 + vx_account_system(vxi, cputime, 0 /* do we have idle time? */);
17093 account_group_system_time(p, cputime);
17095 /* Add system time to cpustat. */
17096 @@ -4398,7 +4413,7 @@ SYSCALL_DEFINE1(nice, int, increment)
17099 if (increment < 0 && !can_nice(current, nice))
17101 + return vx_flags(VXF_IGNEG_NICE, 0) ? 0 : -EPERM;
17103 retval = security_task_setnice(current, nice);
17105 diff -NurpP --minimal linux-2.6.34/kernel/sched_fair.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sched_fair.c
17106 --- linux-2.6.34/kernel/sched_fair.c 2010-05-18 15:07:53.000000000 +0200
17107 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sched_fair.c 2010-05-18 18:11:22.000000000 +0200
17108 @@ -794,6 +794,9 @@ enqueue_entity(struct cfs_rq *cfs_rq, st
17109 check_spread(cfs_rq, se);
17110 if (se != cfs_rq->curr)
17111 __enqueue_entity(cfs_rq, se);
17113 + if (entity_is_task(se))
17114 + vx_activate_task(task_of(se));
17117 static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
17118 @@ -837,6 +840,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
17120 if (se != cfs_rq->curr)
17121 __dequeue_entity(cfs_rq, se);
17122 + if (entity_is_task(se))
17123 + vx_deactivate_task(task_of(se));
17124 account_entity_dequeue(cfs_rq, se);
17125 update_min_vruntime(cfs_rq);
17127 diff -NurpP --minimal linux-2.6.34/kernel/signal.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/signal.c
17128 --- linux-2.6.34/kernel/signal.c 2010-05-18 15:07:53.000000000 +0200
17129 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/signal.c 2010-05-18 18:11:22.000000000 +0200
17131 #include <linux/freezer.h>
17132 #include <linux/pid_namespace.h>
17133 #include <linux/nsproxy.h>
17134 +#include <linux/vs_context.h>
17135 +#include <linux/vs_pid.h>
17136 #define CREATE_TRACE_POINTS
17137 #include <trace/events/signal.h>
17139 @@ -646,9 +648,18 @@ static int check_kill_permission(int sig
17143 + vxdprintk(VXD_CBIT(misc, 7),
17144 + "check_kill_permission(%d,%p,%p[#%u,%u])",
17145 + sig, info, t, vx_task_xid(t), t->pid);
17147 if (!valid_signal(sig))
17150 +/* FIXME: needed? if so, why?
17151 + if ((info != SEND_SIG_NOINFO) &&
17152 + (is_si_special(info) || !si_fromuser(info)))
17155 if (!si_fromuser(info))
17158 @@ -676,6 +687,20 @@ static int check_kill_permission(int sig
17163 + if (t->pid == 1 && current->xid)
17167 + /* FIXME: we shouldn't return ESRCH ever, to avoid
17168 + loops, maybe ENOENT or EACCES? */
17169 + if (!vx_check(vx_task_xid(t), VS_WATCH_P | VS_IDENT)) {
17170 + vxdprintk(current->xid || VXD_CBIT(misc, 7),
17171 + "signal %d[%p] xid mismatch %p[#%u,%u] xid=#%u",
17172 + sig, info, t, vx_task_xid(t), t->pid, current->xid);
17176 return security_task_kill(t, info, sig, 0);
17179 @@ -1164,7 +1189,7 @@ int kill_pid_info(int sig, struct siginf
17182 p = pid_task(pid, PIDTYPE_PID);
17184 + if (p && vx_check(vx_task_xid(p), VS_IDENT)) {
17185 error = group_send_sig_info(sig, info, p);
17186 if (unlikely(error == -ESRCH))
17188 @@ -1204,7 +1229,7 @@ int kill_pid_info_as_uid(int sig, struct
17191 p = pid_task(pid, PIDTYPE_PID);
17193 + if (!p || !vx_check(vx_task_xid(p), VS_IDENT)) {
17197 @@ -1259,8 +1284,10 @@ static int kill_something_info(int sig,
17198 struct task_struct * p;
17200 for_each_process(p) {
17201 - if (task_pid_vnr(p) > 1 &&
17202 - !same_thread_group(p, current)) {
17203 + if (vx_check(vx_task_xid(p), VS_ADMIN|VS_IDENT) &&
17204 + task_pid_vnr(p) > 1 &&
17205 + !same_thread_group(p, current) &&
17206 + !vx_current_initpid(p->pid)) {
17207 int err = group_send_sig_info(sig, info, p);
17210 @@ -1927,6 +1954,11 @@ relock:
17211 !sig_kernel_only(signr))
17214 + /* virtual init is protected against user signals */
17215 + if ((info->si_code == SI_USER) &&
17216 + vx_current_initpid(current->pid))
17219 if (sig_kernel_stop(signr)) {
17221 * The default action is to stop all threads in
17222 diff -NurpP --minimal linux-2.6.34/kernel/softirq.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/softirq.c
17223 --- linux-2.6.34/kernel/softirq.c 2010-02-25 11:52:09.000000000 +0100
17224 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/softirq.c 2010-05-18 18:11:22.000000000 +0200
17226 #include <linux/ftrace.h>
17227 #include <linux/smp.h>
17228 #include <linux/tick.h>
17229 +#include <linux/vs_context.h>
17231 #define CREATE_TRACE_POINTS
17232 #include <trace/events/irq.h>
17233 diff -NurpP --minimal linux-2.6.34/kernel/sys.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sys.c
17234 --- linux-2.6.34/kernel/sys.c 2010-05-18 15:07:53.000000000 +0200
17235 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sys.c 2010-05-18 18:11:22.000000000 +0200
17237 #include <linux/syscalls.h>
17238 #include <linux/kprobes.h>
17239 #include <linux/user_namespace.h>
17240 +#include <linux/vs_pid.h>
17242 #include <asm/uaccess.h>
17243 #include <asm/io.h>
17244 @@ -131,7 +132,10 @@ static int set_one_prio(struct task_stru
17247 if (niceval < task_nice(p) && !can_nice(p, niceval)) {
17249 + if (vx_flags(VXF_IGNEG_NICE, 0))
17255 no_nice = security_task_setnice(p, niceval);
17256 @@ -181,6 +185,8 @@ SYSCALL_DEFINE3(setpriority, int, which,
17258 pgrp = task_pgrp(current);
17259 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
17260 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
17262 error = set_one_prio(p, niceval, error);
17263 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
17265 @@ -244,6 +250,8 @@ SYSCALL_DEFINE2(getpriority, int, which,
17267 pgrp = task_pgrp(current);
17268 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
17269 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
17271 niceval = 20 - task_nice(p);
17272 if (niceval > retval)
17274 @@ -357,6 +365,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
17276 static DEFINE_MUTEX(reboot_mutex);
17278 +long vs_reboot(unsigned int, void __user *);
17281 * Reboot system call: for obvious reasons only root may call it,
17282 * and even root needs to set up some magic numbers in the registers
17283 @@ -389,6 +399,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
17284 if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
17285 cmd = LINUX_REBOOT_CMD_HALT;
17287 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
17288 + return vs_reboot(cmd, arg);
17290 mutex_lock(&reboot_mutex);
17292 case LINUX_REBOOT_CMD_RESTART:
17293 @@ -1198,7 +1211,7 @@ SYSCALL_DEFINE2(sethostname, char __user
17295 char tmp[__NEW_UTS_LEN];
17297 - if (!capable(CAP_SYS_ADMIN))
17298 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
17300 if (len < 0 || len > __NEW_UTS_LEN)
17302 @@ -1247,7 +1260,7 @@ SYSCALL_DEFINE2(setdomainname, char __us
17304 char tmp[__NEW_UTS_LEN];
17306 - if (!capable(CAP_SYS_ADMIN))
17307 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
17309 if (len < 0 || len > __NEW_UTS_LEN)
17311 @@ -1316,7 +1329,7 @@ SYSCALL_DEFINE2(setrlimit, unsigned int,
17313 old_rlim = current->signal->rlim + resource;
17314 if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
17315 - !capable(CAP_SYS_RESOURCE))
17316 + !vx_capable(CAP_SYS_RESOURCE, VXC_SET_RLIMIT))
17318 if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
17320 diff -NurpP --minimal linux-2.6.34/kernel/sysctl_binary.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sysctl_binary.c
17321 --- linux-2.6.34/kernel/sysctl_binary.c 2010-05-18 15:07:53.000000000 +0200
17322 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sysctl_binary.c 2010-05-18 18:11:22.000000000 +0200
17323 @@ -72,6 +72,7 @@ static const struct bin_table bin_kern_t
17325 { CTL_INT, KERN_PANIC, "panic" },
17326 { CTL_INT, KERN_REALROOTDEV, "real-root-dev" },
17327 + { CTL_STR, KERN_VSHELPER, "vshelper" },
17329 { CTL_STR, KERN_SPARC_REBOOT, "reboot-cmd" },
17330 { CTL_INT, KERN_CTLALTDEL, "ctrl-alt-del" },
17331 diff -NurpP --minimal linux-2.6.34/kernel/sysctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sysctl.c
17332 --- linux-2.6.34/kernel/sysctl.c 2010-05-18 15:07:53.000000000 +0200
17333 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/sysctl.c 2010-05-18 18:11:22.000000000 +0200
17335 #if defined(CONFIG_PROVE_LOCKING) || defined(CONFIG_LOCK_STAT)
17336 #include <linux/lockdep.h>
17338 +extern char vshelper_path[];
17339 #ifdef CONFIG_CHR_DEV_SG
17340 #include <scsi/sg.h>
17342 @@ -543,6 +544,13 @@ static struct ctl_table kern_table[] = {
17343 .proc_handler = proc_dostring,
17347 + .procname = "vshelper",
17348 + .data = &vshelper_path,
17351 + .proc_handler = &proc_dostring,
17353 #ifdef CONFIG_CHR_DEV_SG
17355 .procname = "sg-big-buff",
17356 diff -NurpP --minimal linux-2.6.34/kernel/time.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/time.c
17357 --- linux-2.6.34/kernel/time.c 2010-05-18 15:07:53.000000000 +0200
17358 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/time.c 2010-05-18 18:11:22.000000000 +0200
17359 @@ -62,6 +62,7 @@ EXPORT_SYMBOL(sys_tz);
17360 SYSCALL_DEFINE1(time, time_t __user *, tloc)
17362 time_t i = get_seconds();
17363 +/* FIXME: do_gettimeofday(&tv) -> vx_gettimeofday(&tv) */
17366 if (put_user(i,tloc))
17367 @@ -92,7 +93,7 @@ SYSCALL_DEFINE1(stime, time_t __user *,
17371 - do_settimeofday(&tv);
17372 + vx_settimeofday(&tv);
17376 @@ -103,7 +104,7 @@ SYSCALL_DEFINE2(gettimeofday, struct tim
17378 if (likely(tv != NULL)) {
17379 struct timeval ktv;
17380 - do_gettimeofday(&ktv);
17381 + vx_gettimeofday(&ktv);
17382 if (copy_to_user(tv, &ktv, sizeof(ktv)))
17385 @@ -178,7 +179,7 @@ int do_sys_settimeofday(struct timespec
17386 /* SMP safe, again the code in arch/foo/time.c should
17387 * globally block out interrupts when it runs.
17389 - return do_settimeofday(tv);
17390 + return vx_settimeofday(tv);
17394 @@ -310,7 +311,7 @@ void getnstimeofday(struct timespec *tv)
17398 - do_gettimeofday(&x);
17399 + vx_gettimeofday(&x);
17400 tv->tv_sec = x.tv_sec;
17401 tv->tv_nsec = x.tv_usec * NSEC_PER_USEC;
17403 diff -NurpP --minimal linux-2.6.34/kernel/timer.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/timer.c
17404 --- linux-2.6.34/kernel/timer.c 2010-05-18 15:07:53.000000000 +0200
17405 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/timer.c 2010-05-18 18:11:22.000000000 +0200
17407 #include <linux/perf_event.h>
17408 #include <linux/sched.h>
17409 #include <linux/slab.h>
17410 +#include <linux/vs_base.h>
17411 +#include <linux/vs_cvirt.h>
17412 +#include <linux/vs_pid.h>
17413 +#include <linux/vserver/sched.h>
17415 #include <asm/uaccess.h>
17416 #include <asm/unistd.h>
17417 @@ -1254,12 +1258,6 @@ SYSCALL_DEFINE1(alarm, unsigned int, sec
17424 - * The Alpha uses getxpid, getxuid, and getxgid instead. Maybe this
17425 - * should be moved into arch/i386 instead?
17429 * sys_getpid - return the thread group id of the current process
17430 @@ -1288,10 +1286,23 @@ SYSCALL_DEFINE0(getppid)
17432 pid = task_tgid_vnr(current->real_parent);
17434 + return vx_map_pid(pid);
17441 + * The Alpha uses getxpid, getxuid, and getxgid instead.
17444 +asmlinkage long do_getxpid(long *ppid)
17446 + *ppid = sys_getppid();
17447 + return sys_getpid();
17450 +#else /* _alpha_ */
17452 SYSCALL_DEFINE0(getuid)
17454 /* Only we change this so SMP safe */
17455 diff -NurpP --minimal linux-2.6.34/kernel/user_namespace.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/user_namespace.c
17456 --- linux-2.6.34/kernel/user_namespace.c 2009-03-24 14:22:45.000000000 +0100
17457 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/user_namespace.c 2010-05-18 18:11:22.000000000 +0200
17459 #include <linux/slab.h>
17460 #include <linux/user_namespace.h>
17461 #include <linux/cred.h>
17462 +#include <linux/vserver/global.h>
17465 * Create a new user namespace, deriving the creator from the user in the
17466 @@ -30,6 +31,7 @@ int create_user_ns(struct cred *new)
17469 kref_init(&ns->kref);
17470 + atomic_inc(&vs_global_user_ns);
17472 for (n = 0; n < UIDHASH_SZ; ++n)
17473 INIT_HLIST_HEAD(ns->uidhash_table + n);
17474 @@ -78,6 +80,8 @@ void free_user_ns(struct kref *kref)
17475 struct user_namespace *ns =
17476 container_of(kref, struct user_namespace, kref);
17478 + /* FIXME: maybe move into destroyer? */
17479 + atomic_dec(&vs_global_user_ns);
17480 INIT_WORK(&ns->destroyer, free_user_ns_work);
17481 schedule_work(&ns->destroyer);
17483 diff -NurpP --minimal linux-2.6.34/kernel/utsname.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/utsname.c
17484 --- linux-2.6.34/kernel/utsname.c 2009-09-10 15:26:28.000000000 +0200
17485 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/utsname.c 2010-05-18 18:11:22.000000000 +0200
17486 @@ -14,14 +14,17 @@
17487 #include <linux/utsname.h>
17488 #include <linux/err.h>
17489 #include <linux/slab.h>
17490 +#include <linux/vserver/global.h>
17492 static struct uts_namespace *create_uts_ns(void)
17494 struct uts_namespace *uts_ns;
17496 uts_ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL);
17499 kref_init(&uts_ns->kref);
17500 + atomic_inc(&vs_global_uts_ns);
17505 @@ -71,5 +74,6 @@ void free_uts_ns(struct kref *kref)
17506 struct uts_namespace *ns;
17508 ns = container_of(kref, struct uts_namespace, kref);
17509 + atomic_dec(&vs_global_uts_ns);
17512 diff -NurpP --minimal linux-2.6.34/kernel/vserver/cacct.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cacct.c
17513 --- linux-2.6.34/kernel/vserver/cacct.c 1970-01-01 01:00:00.000000000 +0100
17514 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cacct.c 2010-05-18 18:11:22.000000000 +0200
17517 + * linux/kernel/vserver/cacct.c
17519 + * Virtual Server: Context Accounting
17521 + * Copyright (C) 2006-2007 Herbert Pötzl
17523 + * V0.01 added accounting stats
17527 +#include <linux/types.h>
17528 +#include <linux/vs_context.h>
17529 +#include <linux/vserver/cacct_cmd.h>
17530 +#include <linux/vserver/cacct_int.h>
17532 +#include <asm/errno.h>
17533 +#include <asm/uaccess.h>
17536 +int vc_sock_stat(struct vx_info *vxi, void __user *data)
17538 + struct vcmd_sock_stat_v0 vc_data;
17541 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
17544 + field = vc_data.field;
17545 + if ((field < 0) || (field >= VXA_SOCK_SIZE))
17548 + for (j = 0; j < 3; j++) {
17549 + vc_data.count[j] = vx_sock_count(&vxi->cacct, field, j);
17550 + vc_data.total[j] = vx_sock_total(&vxi->cacct, field, j);
17553 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
17558 diff -NurpP --minimal linux-2.6.34/kernel/vserver/cacct_init.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cacct_init.h
17559 --- linux-2.6.34/kernel/vserver/cacct_init.h 1970-01-01 01:00:00.000000000 +0100
17560 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cacct_init.h 2010-05-18 18:11:22.000000000 +0200
17564 +static inline void vx_info_init_cacct(struct _vx_cacct *cacct)
17569 + for (i = 0; i < VXA_SOCK_SIZE; i++) {
17570 + for (j = 0; j < 3; j++) {
17571 + atomic_long_set(&cacct->sock[i][j].count, 0);
17572 + atomic_long_set(&cacct->sock[i][j].total, 0);
17575 + for (i = 0; i < 8; i++)
17576 + atomic_set(&cacct->slab[i], 0);
17577 + for (i = 0; i < 5; i++)
17578 + for (j = 0; j < 4; j++)
17579 + atomic_set(&cacct->page[i][j], 0);
17582 +static inline void vx_info_exit_cacct(struct _vx_cacct *cacct)
17587 diff -NurpP --minimal linux-2.6.34/kernel/vserver/cacct_proc.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cacct_proc.h
17588 --- linux-2.6.34/kernel/vserver/cacct_proc.h 1970-01-01 01:00:00.000000000 +0100
17589 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cacct_proc.h 2010-05-18 18:11:22.000000000 +0200
17591 +#ifndef _VX_CACCT_PROC_H
17592 +#define _VX_CACCT_PROC_H
17594 +#include <linux/vserver/cacct_int.h>
17597 +#define VX_SOCKA_TOP \
17598 + "Type\t recv #/bytes\t\t send #/bytes\t\t fail #/bytes\n"
17600 +static inline int vx_info_proc_cacct(struct _vx_cacct *cacct, char *buffer)
17602 + int i, j, length = 0;
17603 + static char *type[VXA_SOCK_SIZE] = {
17604 + "UNSPEC", "UNIX", "INET", "INET6", "PACKET", "OTHER"
17607 + length += sprintf(buffer + length, VX_SOCKA_TOP);
17608 + for (i = 0; i < VXA_SOCK_SIZE; i++) {
17609 + length += sprintf(buffer + length, "%s:", type[i]);
17610 + for (j = 0; j < 3; j++) {
17611 + length += sprintf(buffer + length,
17612 + "\t%10lu/%-10lu",
17613 + vx_sock_count(cacct, i, j),
17614 + vx_sock_total(cacct, i, j));
17616 + buffer[length++] = '\n';
17619 + length += sprintf(buffer + length, "\n");
17620 + length += sprintf(buffer + length,
17621 + "slab:\t %8u %8u %8u %8u\n",
17622 + atomic_read(&cacct->slab[1]),
17623 + atomic_read(&cacct->slab[4]),
17624 + atomic_read(&cacct->slab[0]),
17625 + atomic_read(&cacct->slab[2]));
17627 + length += sprintf(buffer + length, "\n");
17628 + for (i = 0; i < 5; i++) {
17629 + length += sprintf(buffer + length,
17630 + "page[%d]: %8u %8u %8u %8u\t %8u %8u %8u %8u\n", i,
17631 + atomic_read(&cacct->page[i][0]),
17632 + atomic_read(&cacct->page[i][1]),
17633 + atomic_read(&cacct->page[i][2]),
17634 + atomic_read(&cacct->page[i][3]),
17635 + atomic_read(&cacct->page[i][4]),
17636 + atomic_read(&cacct->page[i][5]),
17637 + atomic_read(&cacct->page[i][6]),
17638 + atomic_read(&cacct->page[i][7]));
17643 +#endif /* _VX_CACCT_PROC_H */
17644 diff -NurpP --minimal linux-2.6.34/kernel/vserver/context.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/context.c
17645 --- linux-2.6.34/kernel/vserver/context.c 1970-01-01 01:00:00.000000000 +0100
17646 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/context.c 2010-05-18 18:11:22.000000000 +0200
17649 + * linux/kernel/vserver/context.c
17651 + * Virtual Server: Context Support
17653 + * Copyright (C) 2003-2007 Herbert Pötzl
17655 + * V0.01 context helper
17656 + * V0.02 vx_ctx_kill syscall command
17657 + * V0.03 replaced context_info calls
17658 + * V0.04 redesign of struct (de)alloc
17659 + * V0.05 rlimit basic implementation
17660 + * V0.06 task_xid and info commands
17661 + * V0.07 context flags and caps
17662 + * V0.08 switch to RCU based hash
17663 + * V0.09 revert to non RCU for now
17664 + * V0.10 and back to working RCU hash
17665 + * V0.11 and back to locking again
17666 + * V0.12 referenced context store
17667 + * V0.13 separate per cpu data
17668 + * V0.14 changed vcmds to vxi arg
17669 + * V0.15 added context stat
17670 + * V0.16 have __create claim() the vxi
17671 + * V0.17 removed older and legacy stuff
17675 +#include <linux/slab.h>
17676 +#include <linux/types.h>
17677 +#include <linux/security.h>
17678 +#include <linux/pid_namespace.h>
17680 +#include <linux/vserver/context.h>
17681 +#include <linux/vserver/network.h>
17682 +#include <linux/vserver/debug.h>
17683 +#include <linux/vserver/limit.h>
17684 +#include <linux/vserver/limit_int.h>
17685 +#include <linux/vserver/space.h>
17686 +#include <linux/init_task.h>
17687 +#include <linux/fs_struct.h>
17689 +#include <linux/vs_context.h>
17690 +#include <linux/vs_limit.h>
17691 +#include <linux/vs_pid.h>
17692 +#include <linux/vserver/context_cmd.h>
17694 +#include "cvirt_init.h"
17695 +#include "cacct_init.h"
17696 +#include "limit_init.h"
17697 +#include "sched_init.h"
17700 +atomic_t vx_global_ctotal = ATOMIC_INIT(0);
17701 +atomic_t vx_global_cactive = ATOMIC_INIT(0);
17704 +/* now inactive context structures */
17706 +static struct hlist_head vx_info_inactive = HLIST_HEAD_INIT;
17708 +static spinlock_t vx_info_inactive_lock = SPIN_LOCK_UNLOCKED;
17711 +/* __alloc_vx_info()
17713 + * allocate an initialized vx_info struct
17714 + * doesn't make it visible (hash) */
17716 +static struct vx_info *__alloc_vx_info(xid_t xid)
17718 + struct vx_info *new = NULL;
17721 + vxdprintk(VXD_CBIT(xid, 0), "alloc_vx_info(%d)*", xid);
17723 + /* would this benefit from a slab cache? */
17724 + new = kmalloc(sizeof(struct vx_info), GFP_KERNEL);
17728 + memset(new, 0, sizeof(struct vx_info));
17730 + new->ptr_pc = alloc_percpu(struct _vx_info_pc);
17731 + if (!new->ptr_pc)
17734 + new->vx_id = xid;
17735 + INIT_HLIST_NODE(&new->vx_hlist);
17736 + atomic_set(&new->vx_usecnt, 0);
17737 + atomic_set(&new->vx_tasks, 0);
17738 + new->vx_parent = NULL;
17739 + new->vx_state = 0;
17740 + init_waitqueue_head(&new->vx_wait);
17742 + /* prepare reaper */
17743 + get_task_struct(init_pid_ns.child_reaper);
17744 + new->vx_reaper = init_pid_ns.child_reaper;
17745 + new->vx_badness_bias = 0;
17747 + /* rest of init goes here */
17748 + vx_info_init_limit(&new->limit);
17749 + vx_info_init_sched(&new->sched);
17750 + vx_info_init_cvirt(&new->cvirt);
17751 + vx_info_init_cacct(&new->cacct);
17753 + /* per cpu data structures */
17754 + for_each_possible_cpu(cpu) {
17755 + vx_info_init_sched_pc(
17756 + &vx_per_cpu(new, sched_pc, cpu), cpu);
17757 + vx_info_init_cvirt_pc(
17758 + &vx_per_cpu(new, cvirt_pc, cpu), cpu);
17761 + new->vx_flags = VXF_INIT_SET;
17762 + cap_set_init_eff(new->vx_bcaps);
17763 + new->vx_ccaps = 0;
17764 + new->vx_umask = 0;
17766 + new->reboot_cmd = 0;
17767 + new->exit_code = 0;
17769 + // preconfig fs entries
17770 + for (index = 0; index < VX_SPACES; index++) {
17771 + write_lock(&init_fs.lock);
17773 + write_unlock(&init_fs.lock);
17774 + new->vx_fs[index] = &init_fs;
17777 + vxdprintk(VXD_CBIT(xid, 0),
17778 + "alloc_vx_info(%d) = %p", xid, new);
17779 + vxh_alloc_vx_info(new);
17780 + atomic_inc(&vx_global_ctotal);
17789 +/* __dealloc_vx_info()
17791 + * final disposal of vx_info */
17793 +static void __dealloc_vx_info(struct vx_info *vxi)
17795 +#ifdef CONFIG_VSERVER_WARN
17796 + struct vx_info_save vxis;
17799 + vxdprintk(VXD_CBIT(xid, 0),
17800 + "dealloc_vx_info(%p)", vxi);
17801 + vxh_dealloc_vx_info(vxi);
17803 +#ifdef CONFIG_VSERVER_WARN
17804 + enter_vx_info(vxi, &vxis);
17805 + vx_info_exit_limit(&vxi->limit);
17806 + vx_info_exit_sched(&vxi->sched);
17807 + vx_info_exit_cvirt(&vxi->cvirt);
17808 + vx_info_exit_cacct(&vxi->cacct);
17810 + for_each_possible_cpu(cpu) {
17811 + vx_info_exit_sched_pc(
17812 + &vx_per_cpu(vxi, sched_pc, cpu), cpu);
17813 + vx_info_exit_cvirt_pc(
17814 + &vx_per_cpu(vxi, cvirt_pc, cpu), cpu);
17816 + leave_vx_info(&vxis);
17820 + vxi->vx_state |= VXS_RELEASED;
17823 + free_percpu(vxi->ptr_pc);
17826 + atomic_dec(&vx_global_ctotal);
17829 +static void __shutdown_vx_info(struct vx_info *vxi)
17831 + struct nsproxy *nsproxy;
17832 + struct fs_struct *fs;
17837 + vxi->vx_state |= VXS_SHUTDOWN;
17838 + vs_state_change(vxi, VSC_SHUTDOWN);
17840 + for (index = 0; index < VX_SPACES; index++) {
17841 + nsproxy = xchg(&vxi->vx_nsproxy[index], NULL);
17843 + put_nsproxy(nsproxy);
17845 + fs = xchg(&vxi->vx_fs[index], NULL);
17846 + write_lock(&fs->lock);
17847 + kill = !--fs->users;
17848 + write_unlock(&fs->lock);
17850 + free_fs_struct(fs);
17854 +/* exported stuff */
17856 +void free_vx_info(struct vx_info *vxi)
17858 + unsigned long flags;
17861 + /* check for reference counts first */
17862 + BUG_ON(atomic_read(&vxi->vx_usecnt));
17863 + BUG_ON(atomic_read(&vxi->vx_tasks));
17865 + /* context must not be hashed */
17866 + BUG_ON(vx_info_state(vxi, VXS_HASHED));
17868 + /* context shutdown is mandatory */
17869 + BUG_ON(!vx_info_state(vxi, VXS_SHUTDOWN));
17871 + /* nsproxy and fs check */
17872 + for (index = 0; index < VX_SPACES; index++) {
17873 + BUG_ON(vxi->vx_nsproxy[index]);
17874 + BUG_ON(vxi->vx_fs[index]);
17877 + spin_lock_irqsave(&vx_info_inactive_lock, flags);
17878 + hlist_del(&vxi->vx_hlist);
17879 + spin_unlock_irqrestore(&vx_info_inactive_lock, flags);
17881 + __dealloc_vx_info(vxi);
17885 +/* hash table for vx_info hash */
17887 +#define VX_HASH_SIZE 13
17889 +static struct hlist_head vx_info_hash[VX_HASH_SIZE] =
17890 + { [0 ... VX_HASH_SIZE-1] = HLIST_HEAD_INIT };
17892 +static spinlock_t vx_info_hash_lock = SPIN_LOCK_UNLOCKED;
17895 +static inline unsigned int __hashval(xid_t xid)
17897 + return (xid % VX_HASH_SIZE);
17902 +/* __hash_vx_info()
17904 + * add the vxi to the global hash table
17905 + * requires the hash_lock to be held */
17907 +static inline void __hash_vx_info(struct vx_info *vxi)
17909 + struct hlist_head *head;
17911 + vxd_assert_lock(&vx_info_hash_lock);
17912 + vxdprintk(VXD_CBIT(xid, 4),
17913 + "__hash_vx_info: %p[#%d]", vxi, vxi->vx_id);
17914 + vxh_hash_vx_info(vxi);
17916 + /* context must not be hashed */
17917 + BUG_ON(vx_info_state(vxi, VXS_HASHED));
17919 + vxi->vx_state |= VXS_HASHED;
17920 + head = &vx_info_hash[__hashval(vxi->vx_id)];
17921 + hlist_add_head(&vxi->vx_hlist, head);
17922 + atomic_inc(&vx_global_cactive);
17925 +/* __unhash_vx_info()
17927 + * remove the vxi from the global hash table
17928 + * requires the hash_lock to be held */
17930 +static inline void __unhash_vx_info(struct vx_info *vxi)
17932 + unsigned long flags;
17934 + vxd_assert_lock(&vx_info_hash_lock);
17935 + vxdprintk(VXD_CBIT(xid, 4),
17936 + "__unhash_vx_info: %p[#%d.%d.%d]", vxi, vxi->vx_id,
17937 + atomic_read(&vxi->vx_usecnt), atomic_read(&vxi->vx_tasks));
17938 + vxh_unhash_vx_info(vxi);
17940 + /* context must be hashed */
17941 + BUG_ON(!vx_info_state(vxi, VXS_HASHED));
17942 + /* but without tasks */
17943 + BUG_ON(atomic_read(&vxi->vx_tasks));
17945 + vxi->vx_state &= ~VXS_HASHED;
17946 + hlist_del_init(&vxi->vx_hlist);
17947 + spin_lock_irqsave(&vx_info_inactive_lock, flags);
17948 + hlist_add_head(&vxi->vx_hlist, &vx_info_inactive);
17949 + spin_unlock_irqrestore(&vx_info_inactive_lock, flags);
17950 + atomic_dec(&vx_global_cactive);
17954 +/* __lookup_vx_info()
17956 + * requires the hash_lock to be held
17957 + * doesn't increment the vx_refcnt */
17959 +static inline struct vx_info *__lookup_vx_info(xid_t xid)
17961 + struct hlist_head *head = &vx_info_hash[__hashval(xid)];
17962 + struct hlist_node *pos;
17963 + struct vx_info *vxi;
17965 + vxd_assert_lock(&vx_info_hash_lock);
17966 + hlist_for_each(pos, head) {
17967 + vxi = hlist_entry(pos, struct vx_info, vx_hlist);
17969 + if (vxi->vx_id == xid)
17974 + vxdprintk(VXD_CBIT(xid, 0),
17975 + "__lookup_vx_info(#%u): %p[#%u]",
17976 + xid, vxi, vxi ? vxi->vx_id : 0);
17977 + vxh_lookup_vx_info(vxi, xid);
17982 +/* __create_vx_info()
17984 + * create the requested context
17985 + * get(), claim() and hash it */
17987 +static struct vx_info *__create_vx_info(int id)
17989 + struct vx_info *new, *vxi = NULL;
17991 + vxdprintk(VXD_CBIT(xid, 1), "create_vx_info(%d)*", id);
17993 + if (!(new = __alloc_vx_info(id)))
17994 + return ERR_PTR(-ENOMEM);
17996 + /* required to make dynamic xids unique */
17997 + spin_lock(&vx_info_hash_lock);
17999 + /* static context requested */
18000 + if ((vxi = __lookup_vx_info(id))) {
18001 + vxdprintk(VXD_CBIT(xid, 0),
18002 + "create_vx_info(%d) = %p (already there)", id, vxi);
18003 + if (vx_info_flags(vxi, VXF_STATE_SETUP, 0))
18004 + vxi = ERR_PTR(-EBUSY);
18006 + vxi = ERR_PTR(-EEXIST);
18009 + /* new context */
18010 + vxdprintk(VXD_CBIT(xid, 0),
18011 + "create_vx_info(%d) = %p (new)", id, new);
18012 + claim_vx_info(new, NULL);
18013 + __hash_vx_info(get_vx_info(new));
18014 + vxi = new, new = NULL;
18017 + spin_unlock(&vx_info_hash_lock);
18018 + vxh_create_vx_info(IS_ERR(vxi) ? NULL : vxi, id);
18020 + __dealloc_vx_info(new);
18025 +/* exported stuff */
18028 +void unhash_vx_info(struct vx_info *vxi)
18030 + __shutdown_vx_info(vxi);
18031 + spin_lock(&vx_info_hash_lock);
18032 + __unhash_vx_info(vxi);
18033 + spin_unlock(&vx_info_hash_lock);
18034 + __wakeup_vx_info(vxi);
18038 +/* lookup_vx_info()
18040 + * search for a vx_info and get() it
18041 + * negative id means current */
18043 +struct vx_info *lookup_vx_info(int id)
18045 + struct vx_info *vxi = NULL;
18048 + vxi = get_vx_info(current_vx_info());
18049 + } else if (id > 1) {
18050 + spin_lock(&vx_info_hash_lock);
18051 + vxi = get_vx_info(__lookup_vx_info(id));
18052 + spin_unlock(&vx_info_hash_lock);
18057 +/* xid_is_hashed()
18059 + * verify that xid is still hashed */
18061 +int xid_is_hashed(xid_t xid)
18065 + spin_lock(&vx_info_hash_lock);
18066 + hashed = (__lookup_vx_info(xid) != NULL);
18067 + spin_unlock(&vx_info_hash_lock);
18071 +#ifdef CONFIG_PROC_FS
18075 + * get a subset of hashed xids for proc
18076 + * assumes size is at least one */
18078 +int get_xid_list(int index, unsigned int *xids, int size)
18080 + int hindex, nr_xids = 0;
18082 + /* only show current and children */
18083 + if (!vx_check(0, VS_ADMIN | VS_WATCH)) {
18086 + xids[nr_xids] = vx_current_xid();
18090 + for (hindex = 0; hindex < VX_HASH_SIZE; hindex++) {
18091 + struct hlist_head *head = &vx_info_hash[hindex];
18092 + struct hlist_node *pos;
18094 + spin_lock(&vx_info_hash_lock);
18095 + hlist_for_each(pos, head) {
18096 + struct vx_info *vxi;
18101 + vxi = hlist_entry(pos, struct vx_info, vx_hlist);
18102 + xids[nr_xids] = vxi->vx_id;
18103 + if (++nr_xids >= size) {
18104 + spin_unlock(&vx_info_hash_lock);
18108 + /* keep the lock time short */
18109 + spin_unlock(&vx_info_hash_lock);
18116 +#ifdef CONFIG_VSERVER_DEBUG
18118 +void dump_vx_info_inactive(int level)
18120 + struct hlist_node *entry, *next;
18122 + hlist_for_each_safe(entry, next, &vx_info_inactive) {
18123 + struct vx_info *vxi =
18124 + list_entry(entry, struct vx_info, vx_hlist);
18126 + dump_vx_info(vxi, level);
18133 +int vx_migrate_user(struct task_struct *p, struct vx_info *vxi)
18135 + struct user_struct *new_user, *old_user;
18140 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0))
18143 + new_user = alloc_uid(vxi->vx_id, p->uid);
18147 + old_user = p->user;
18148 + if (new_user != old_user) {
18149 + atomic_inc(&new_user->processes);
18150 + atomic_dec(&old_user->processes);
18151 + p->user = new_user;
18153 + free_uid(old_user);
18159 +void vx_mask_cap_bset(struct vx_info *vxi, struct task_struct *p)
18161 + // p->cap_effective &= vxi->vx_cap_bset;
18162 + p->cap_effective =
18163 + cap_intersect(p->cap_effective, vxi->cap_bset);
18164 + // p->cap_inheritable &= vxi->vx_cap_bset;
18165 + p->cap_inheritable =
18166 + cap_intersect(p->cap_inheritable, vxi->cap_bset);
18167 + // p->cap_permitted &= vxi->vx_cap_bset;
18168 + p->cap_permitted =
18169 + cap_intersect(p->cap_permitted, vxi->cap_bset);
18174 +#include <linux/file.h>
18175 +#include <linux/fdtable.h>
18177 +static int vx_openfd_task(struct task_struct *tsk)
18179 + struct files_struct *files = tsk->files;
18180 + struct fdtable *fdt;
18181 + const unsigned long *bptr;
18182 + int count, total;
18184 + /* no rcu_read_lock() because of spin_lock() */
18185 + spin_lock(&files->file_lock);
18186 + fdt = files_fdtable(files);
18187 + bptr = fdt->open_fds->fds_bits;
18188 + count = fdt->max_fds / (sizeof(unsigned long) * 8);
18189 + for (total = 0; count > 0; count--) {
18191 + total += hweight_long(*bptr);
18194 + spin_unlock(&files->file_lock);
18199 +/* for *space compatibility */
18201 +asmlinkage long sys_unshare(unsigned long);
18204 + * migrate task to new context
18205 + * gets vxi, puts old_vxi on change
18206 + * optionally unshares namespaces (hack)
18209 +int vx_migrate_task(struct task_struct *p, struct vx_info *vxi, int unshare)
18211 + struct vx_info *old_vxi;
18217 + vxdprintk(VXD_CBIT(xid, 5),
18218 + "vx_migrate_task(%p,%p[#%d.%d])", p, vxi,
18219 + vxi->vx_id, atomic_read(&vxi->vx_usecnt));
18221 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0) &&
18222 + !vx_info_flags(vxi, VXF_STATE_SETUP, 0))
18225 + if (vx_info_state(vxi, VXS_SHUTDOWN))
18228 + old_vxi = task_get_vx_info(p);
18229 + if (old_vxi == vxi)
18232 +// if (!(ret = vx_migrate_user(p, vxi))) {
18237 + openfd = vx_openfd_task(p);
18240 + atomic_dec(&old_vxi->cvirt.nr_threads);
18241 + atomic_dec(&old_vxi->cvirt.nr_running);
18242 + __rlim_dec(&old_vxi->limit, RLIMIT_NPROC);
18243 + /* FIXME: what about the struct files here? */
18244 + __rlim_sub(&old_vxi->limit, VLIMIT_OPENFD, openfd);
18245 + /* account for the executable */
18246 + __rlim_dec(&old_vxi->limit, VLIMIT_DENTRY);
18248 + atomic_inc(&vxi->cvirt.nr_threads);
18249 + atomic_inc(&vxi->cvirt.nr_running);
18250 + __rlim_inc(&vxi->limit, RLIMIT_NPROC);
18251 + /* FIXME: what about the struct files here? */
18252 + __rlim_add(&vxi->limit, VLIMIT_OPENFD, openfd);
18253 + /* account for the executable */
18254 + __rlim_inc(&vxi->limit, VLIMIT_DENTRY);
18257 + release_vx_info(old_vxi, p);
18258 + clr_vx_info(&p->vx_info);
18260 + claim_vx_info(vxi, p);
18261 + set_vx_info(&p->vx_info, vxi);
18262 + p->xid = vxi->vx_id;
18264 + vxdprintk(VXD_CBIT(xid, 5),
18265 + "moved task %p into vxi:%p[#%d]",
18266 + p, vxi, vxi->vx_id);
18268 + // vx_mask_cap_bset(vxi, p);
18271 + /* hack for *spaces to provide compatibility */
18273 + struct nsproxy *old_nsp, *new_nsp;
18275 + ret = unshare_nsproxy_namespaces(
18276 + CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER,
18281 + old_nsp = xchg(&p->nsproxy, new_nsp);
18282 + vx_set_space(vxi,
18283 + CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER, 0);
18284 + put_nsproxy(old_nsp);
18288 + put_vx_info(old_vxi);
18292 +int vx_set_reaper(struct vx_info *vxi, struct task_struct *p)
18294 + struct task_struct *old_reaper;
18299 + vxdprintk(VXD_CBIT(xid, 6),
18300 + "vx_set_reaper(%p[#%d],%p[#%d,%d])",
18301 + vxi, vxi->vx_id, p, p->xid, p->pid);
18303 + old_reaper = vxi->vx_reaper;
18304 + if (old_reaper == p)
18307 + /* set new child reaper */
18308 + get_task_struct(p);
18309 + vxi->vx_reaper = p;
18310 + put_task_struct(old_reaper);
18314 +int vx_set_init(struct vx_info *vxi, struct task_struct *p)
18319 + vxdprintk(VXD_CBIT(xid, 6),
18320 + "vx_set_init(%p[#%d],%p[#%d,%d,%d])",
18321 + vxi, vxi->vx_id, p, p->xid, p->pid, p->tgid);
18323 + vxi->vx_flags &= ~VXF_STATE_INIT;
18324 + // vxi->vx_initpid = p->tgid;
18325 + vxi->vx_initpid = p->pid;
18329 +void vx_exit_init(struct vx_info *vxi, struct task_struct *p, int code)
18331 + vxdprintk(VXD_CBIT(xid, 6),
18332 + "vx_exit_init(%p[#%d],%p[#%d,%d,%d])",
18333 + vxi, vxi->vx_id, p, p->xid, p->pid, p->tgid);
18335 + vxi->exit_code = code;
18336 + vxi->vx_initpid = 0;
18340 +void vx_set_persistent(struct vx_info *vxi)
18342 + vxdprintk(VXD_CBIT(xid, 6),
18343 + "vx_set_persistent(%p[#%d])", vxi, vxi->vx_id);
18345 + get_vx_info(vxi);
18346 + claim_vx_info(vxi, NULL);
18349 +void vx_clear_persistent(struct vx_info *vxi)
18351 + vxdprintk(VXD_CBIT(xid, 6),
18352 + "vx_clear_persistent(%p[#%d])", vxi, vxi->vx_id);
18354 + release_vx_info(vxi, NULL);
18355 + put_vx_info(vxi);
18358 +void vx_update_persistent(struct vx_info *vxi)
18360 + if (vx_info_flags(vxi, VXF_PERSISTENT, 0))
18361 + vx_set_persistent(vxi);
18363 + vx_clear_persistent(vxi);
18367 +/* task must be current or locked */
18369 +void exit_vx_info(struct task_struct *p, int code)
18371 + struct vx_info *vxi = p->vx_info;
18374 + atomic_dec(&vxi->cvirt.nr_threads);
18377 + vxi->exit_code = code;
18378 + release_vx_info(vxi, p);
18382 +void exit_vx_info_early(struct task_struct *p, int code)
18384 + struct vx_info *vxi = p->vx_info;
18387 + if (vxi->vx_initpid == p->pid)
18388 + vx_exit_init(vxi, p, code);
18389 + if (vxi->vx_reaper == p)
18390 + vx_set_reaper(vxi, init_pid_ns.child_reaper);
18395 +/* vserver syscall commands below here */
18397 +/* taks xid and vx_info functions */
18399 +#include <asm/uaccess.h>
18402 +int vc_task_xid(uint32_t id)
18407 + struct task_struct *tsk;
18409 + read_lock(&tasklist_lock);
18410 + tsk = find_task_by_real_pid(id);
18411 + xid = (tsk) ? tsk->xid : -ESRCH;
18412 + read_unlock(&tasklist_lock);
18414 + xid = vx_current_xid();
18419 +int vc_vx_info(struct vx_info *vxi, void __user *data)
18421 + struct vcmd_vx_info_v0 vc_data;
18423 + vc_data.xid = vxi->vx_id;
18424 + vc_data.initpid = vxi->vx_initpid;
18426 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18432 +int vc_ctx_stat(struct vx_info *vxi, void __user *data)
18434 + struct vcmd_ctx_stat_v0 vc_data;
18436 + vc_data.usecnt = atomic_read(&vxi->vx_usecnt);
18437 + vc_data.tasks = atomic_read(&vxi->vx_tasks);
18439 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18445 +/* context functions */
18447 +int vc_ctx_create(uint32_t xid, void __user *data)
18449 + struct vcmd_ctx_create vc_data = { .flagword = VXF_INIT_SET };
18450 + struct vx_info *new_vxi;
18453 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
18456 + if ((xid > MAX_S_CONTEXT) || (xid < 2))
18459 + new_vxi = __create_vx_info(xid);
18460 + if (IS_ERR(new_vxi))
18461 + return PTR_ERR(new_vxi);
18463 + /* initial flags */
18464 + new_vxi->vx_flags = vc_data.flagword;
18467 + if (vs_state_change(new_vxi, VSC_STARTUP))
18470 + ret = vx_migrate_task(current, new_vxi, (!data));
18474 + /* return context id on success */
18475 + ret = new_vxi->vx_id;
18477 + /* get a reference for persistent contexts */
18478 + if ((vc_data.flagword & VXF_PERSISTENT))
18479 + vx_set_persistent(new_vxi);
18481 + release_vx_info(new_vxi, NULL);
18482 + put_vx_info(new_vxi);
18487 +int vc_ctx_migrate(struct vx_info *vxi, void __user *data)
18489 + struct vcmd_ctx_migrate vc_data = { .flagword = 0 };
18492 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
18495 + ret = vx_migrate_task(current, vxi, 0);
18498 + if (vc_data.flagword & VXM_SET_INIT)
18499 + ret = vx_set_init(vxi, current);
18502 + if (vc_data.flagword & VXM_SET_REAPER)
18503 + ret = vx_set_reaper(vxi, current);
18508 +int vc_get_cflags(struct vx_info *vxi, void __user *data)
18510 + struct vcmd_ctx_flags_v0 vc_data;
18512 + vc_data.flagword = vxi->vx_flags;
18514 + /* special STATE flag handling */
18515 + vc_data.mask = vs_mask_flags(~0ULL, vxi->vx_flags, VXF_ONE_TIME);
18517 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18522 +int vc_set_cflags(struct vx_info *vxi, void __user *data)
18524 + struct vcmd_ctx_flags_v0 vc_data;
18525 + uint64_t mask, trigger;
18527 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18530 + /* special STATE flag handling */
18531 + mask = vs_mask_mask(vc_data.mask, vxi->vx_flags, VXF_ONE_TIME);
18532 + trigger = (mask & vxi->vx_flags) ^ (mask & vc_data.flagword);
18534 + if (vxi == current_vx_info()) {
18535 + /* if (trigger & VXF_STATE_SETUP)
18536 + vx_mask_cap_bset(vxi, current); */
18537 + if (trigger & VXF_STATE_INIT) {
18540 + ret = vx_set_init(vxi, current);
18543 + ret = vx_set_reaper(vxi, current);
18549 + vxi->vx_flags = vs_mask_flags(vxi->vx_flags,
18550 + vc_data.flagword, mask);
18551 + if (trigger & VXF_PERSISTENT)
18552 + vx_update_persistent(vxi);
18558 +static inline uint64_t caps_from_cap_t(kernel_cap_t c)
18560 + uint64_t v = c.cap[0] | ((uint64_t)c.cap[1] << 32);
18562 + // printk("caps_from_cap_t(%08x:%08x) = %016llx\n", c.cap[1], c.cap[0], v);
18566 +static inline kernel_cap_t cap_t_from_caps(uint64_t v)
18568 + kernel_cap_t c = __cap_empty_set;
18570 + c.cap[0] = v & 0xFFFFFFFF;
18571 + c.cap[1] = (v >> 32) & 0xFFFFFFFF;
18573 + // printk("cap_t_from_caps(%016llx) = %08x:%08x\n", v, c.cap[1], c.cap[0]);
18578 +static int do_get_caps(struct vx_info *vxi, uint64_t *bcaps, uint64_t *ccaps)
18581 + *bcaps = caps_from_cap_t(vxi->vx_bcaps);
18583 + *ccaps = vxi->vx_ccaps;
18588 +int vc_get_ccaps(struct vx_info *vxi, void __user *data)
18590 + struct vcmd_ctx_caps_v1 vc_data;
18593 + ret = do_get_caps(vxi, NULL, &vc_data.ccaps);
18596 + vc_data.cmask = ~0ULL;
18598 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18603 +static int do_set_caps(struct vx_info *vxi,
18604 + uint64_t bcaps, uint64_t bmask, uint64_t ccaps, uint64_t cmask)
18606 + uint64_t bcold = caps_from_cap_t(vxi->vx_bcaps);
18609 + printk("do_set_caps(%16llx, %16llx, %16llx, %16llx)\n",
18610 + bcaps, bmask, ccaps, cmask);
18612 + vxi->vx_bcaps = cap_t_from_caps(
18613 + vs_mask_flags(bcold, bcaps, bmask));
18614 + vxi->vx_ccaps = vs_mask_flags(vxi->vx_ccaps, ccaps, cmask);
18619 +int vc_set_ccaps(struct vx_info *vxi, void __user *data)
18621 + struct vcmd_ctx_caps_v1 vc_data;
18623 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18626 + return do_set_caps(vxi, 0, 0, vc_data.ccaps, vc_data.cmask);
18629 +int vc_get_bcaps(struct vx_info *vxi, void __user *data)
18631 + struct vcmd_bcaps vc_data;
18634 + ret = do_get_caps(vxi, &vc_data.bcaps, NULL);
18637 + vc_data.bmask = ~0ULL;
18639 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18644 +int vc_set_bcaps(struct vx_info *vxi, void __user *data)
18646 + struct vcmd_bcaps vc_data;
18648 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18651 + return do_set_caps(vxi, vc_data.bcaps, vc_data.bmask, 0, 0);
18655 +int vc_get_umask(struct vx_info *vxi, void __user *data)
18657 + struct vcmd_umask vc_data;
18659 + vc_data.umask = vxi->vx_umask;
18660 + vc_data.mask = ~0ULL;
18662 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18667 +int vc_set_umask(struct vx_info *vxi, void __user *data)
18669 + struct vcmd_umask vc_data;
18671 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18674 + vxi->vx_umask = vs_mask_flags(vxi->vx_umask,
18675 + vc_data.umask, vc_data.mask);
18680 +int vc_get_badness(struct vx_info *vxi, void __user *data)
18682 + struct vcmd_badness_v0 vc_data;
18684 + vc_data.bias = vxi->vx_badness_bias;
18686 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18691 +int vc_set_badness(struct vx_info *vxi, void __user *data)
18693 + struct vcmd_badness_v0 vc_data;
18695 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18698 + vxi->vx_badness_bias = vc_data.bias;
18702 +#include <linux/module.h>
18704 +EXPORT_SYMBOL_GPL(free_vx_info);
18706 diff -NurpP --minimal linux-2.6.34/kernel/vserver/cvirt.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cvirt.c
18707 --- linux-2.6.34/kernel/vserver/cvirt.c 1970-01-01 01:00:00.000000000 +0100
18708 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cvirt.c 2010-05-18 18:11:22.000000000 +0200
18711 + * linux/kernel/vserver/cvirt.c
18713 + * Virtual Server: Context Virtualization
18715 + * Copyright (C) 2004-2007 Herbert Pötzl
18717 + * V0.01 broken out from limit.c
18718 + * V0.02 added utsname stuff
18719 + * V0.03 changed vcmds to vxi arg
18723 +#include <linux/types.h>
18724 +#include <linux/utsname.h>
18725 +#include <linux/vs_cvirt.h>
18726 +#include <linux/vserver/switch.h>
18727 +#include <linux/vserver/cvirt_cmd.h>
18729 +#include <asm/uaccess.h>
18732 +void vx_vsi_uptime(struct timespec *uptime, struct timespec *idle)
18734 + struct vx_info *vxi = current_vx_info();
18736 + set_normalized_timespec(uptime,
18737 + uptime->tv_sec - vxi->cvirt.bias_uptime.tv_sec,
18738 + uptime->tv_nsec - vxi->cvirt.bias_uptime.tv_nsec);
18741 + set_normalized_timespec(idle,
18742 + idle->tv_sec - vxi->cvirt.bias_idle.tv_sec,
18743 + idle->tv_nsec - vxi->cvirt.bias_idle.tv_nsec);
18747 +uint64_t vx_idle_jiffies(void)
18749 + return init_task.utime + init_task.stime;
18754 +static inline uint32_t __update_loadavg(uint32_t load,
18755 + int wsize, int delta, int n)
18757 + unsigned long long calc, prev;
18759 + /* just set it to n */
18760 + if (unlikely(delta >= wsize))
18761 + return (n << FSHIFT);
18763 + calc = delta * n;
18765 + prev = (wsize - delta);
18768 + do_div(calc, wsize);
18773 +void vx_update_load(struct vx_info *vxi)
18775 + uint32_t now, last, delta;
18776 + unsigned int nr_running, nr_uninterruptible;
18777 + unsigned int total;
18778 + unsigned long flags;
18780 + spin_lock_irqsave(&vxi->cvirt.load_lock, flags);
18783 + last = vxi->cvirt.load_last;
18784 + delta = now - last;
18786 + if (delta < 5*HZ)
18789 + nr_running = atomic_read(&vxi->cvirt.nr_running);
18790 + nr_uninterruptible = atomic_read(&vxi->cvirt.nr_uninterruptible);
18791 + total = nr_running + nr_uninterruptible;
18793 + vxi->cvirt.load[0] = __update_loadavg(vxi->cvirt.load[0],
18794 + 60*HZ, delta, total);
18795 + vxi->cvirt.load[1] = __update_loadavg(vxi->cvirt.load[1],
18796 + 5*60*HZ, delta, total);
18797 + vxi->cvirt.load[2] = __update_loadavg(vxi->cvirt.load[2],
18798 + 15*60*HZ, delta, total);
18800 + vxi->cvirt.load_last = now;
18802 + atomic_inc(&vxi->cvirt.load_updates);
18803 + spin_unlock_irqrestore(&vxi->cvirt.load_lock, flags);
18808 + * Commands to do_syslog:
18810 + * 0 -- Close the log. Currently a NOP.
18811 + * 1 -- Open the log. Currently a NOP.
18812 + * 2 -- Read from the log.
18813 + * 3 -- Read all messages remaining in the ring buffer.
18814 + * 4 -- Read and clear all messages remaining in the ring buffer
18815 + * 5 -- Clear ring buffer.
18816 + * 6 -- Disable printk's to console
18817 + * 7 -- Enable printk's to console
18818 + * 8 -- Set level of messages printed to console
18819 + * 9 -- Return number of unread characters in the log buffer
18820 + * 10 -- Return size of the log buffer
18822 +int vx_do_syslog(int type, char __user *buf, int len)
18825 + int do_clear = 0;
18826 + struct vx_info *vxi = current_vx_info();
18827 + struct _vx_syslog *log;
18831 + log = &vxi->cvirt.syslog;
18834 + case 0: /* Close log */
18835 + case 1: /* Open log */
18837 + case 2: /* Read from log */
18838 + error = wait_event_interruptible(log->log_wait,
18839 + (log->log_start - log->log_end));
18842 + spin_lock_irq(&log->logbuf_lock);
18843 + spin_unlock_irq(&log->logbuf_lock);
18845 + case 4: /* Read/clear last kernel messages */
18847 + /* fall through */
18848 + case 3: /* Read last kernel messages */
18851 + case 5: /* Clear ring buffer */
18854 + case 6: /* Disable logging to console */
18855 + case 7: /* Enable logging to console */
18856 + case 8: /* Set level of messages printed to console */
18859 + case 9: /* Number of chars in the log buffer */
18861 + case 10: /* Size of the log buffer */
18871 +/* virtual host info names */
18873 +static char *vx_vhi_name(struct vx_info *vxi, int id)
18875 + struct nsproxy *nsproxy;
18876 + struct uts_namespace *uts;
18878 + if (id == VHIN_CONTEXT)
18879 + return vxi->vx_name;
18881 + nsproxy = vxi->vx_nsproxy[0];
18885 + uts = nsproxy->uts_ns;
18890 + case VHIN_SYSNAME:
18891 + return uts->name.sysname;
18892 + case VHIN_NODENAME:
18893 + return uts->name.nodename;
18894 + case VHIN_RELEASE:
18895 + return uts->name.release;
18896 + case VHIN_VERSION:
18897 + return uts->name.version;
18898 + case VHIN_MACHINE:
18899 + return uts->name.machine;
18900 + case VHIN_DOMAINNAME:
18901 + return uts->name.domainname;
18908 +int vc_set_vhi_name(struct vx_info *vxi, void __user *data)
18910 + struct vcmd_vhi_name_v0 vc_data;
18913 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18916 + name = vx_vhi_name(vxi, vc_data.field);
18920 + memcpy(name, vc_data.name, 65);
18924 +int vc_get_vhi_name(struct vx_info *vxi, void __user *data)
18926 + struct vcmd_vhi_name_v0 vc_data;
18929 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18932 + name = vx_vhi_name(vxi, vc_data.field);
18936 + memcpy(vc_data.name, name, 65);
18937 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18943 +int vc_virt_stat(struct vx_info *vxi, void __user *data)
18945 + struct vcmd_virt_stat_v0 vc_data;
18946 + struct _vx_cvirt *cvirt = &vxi->cvirt;
18947 + struct timespec uptime;
18949 + do_posix_clock_monotonic_gettime(&uptime);
18950 + set_normalized_timespec(&uptime,
18951 + uptime.tv_sec - cvirt->bias_uptime.tv_sec,
18952 + uptime.tv_nsec - cvirt->bias_uptime.tv_nsec);
18954 + vc_data.offset = timeval_to_ns(&cvirt->bias_tv);
18955 + vc_data.uptime = timespec_to_ns(&uptime);
18956 + vc_data.nr_threads = atomic_read(&cvirt->nr_threads);
18957 + vc_data.nr_running = atomic_read(&cvirt->nr_running);
18958 + vc_data.nr_uninterruptible = atomic_read(&cvirt->nr_uninterruptible);
18959 + vc_data.nr_onhold = atomic_read(&cvirt->nr_onhold);
18960 + vc_data.nr_forks = atomic_read(&cvirt->total_forks);
18961 + vc_data.load[0] = cvirt->load[0];
18962 + vc_data.load[1] = cvirt->load[1];
18963 + vc_data.load[2] = cvirt->load[2];
18965 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18971 +#ifdef CONFIG_VSERVER_VTIME
18973 +/* virtualized time base */
18975 +void vx_gettimeofday(struct timeval *tv)
18977 + struct vx_info *vxi;
18979 + do_gettimeofday(tv);
18980 + if (!vx_flags(VXF_VIRT_TIME, 0))
18983 + vxi = current_vx_info();
18984 + tv->tv_sec += vxi->cvirt.bias_tv.tv_sec;
18985 + tv->tv_usec += vxi->cvirt.bias_tv.tv_usec;
18987 + if (tv->tv_usec >= USEC_PER_SEC) {
18989 + tv->tv_usec -= USEC_PER_SEC;
18990 + } else if (tv->tv_usec < 0) {
18992 + tv->tv_usec += USEC_PER_SEC;
18996 +int vx_settimeofday(struct timespec *ts)
18998 + struct timeval tv;
18999 + struct vx_info *vxi;
19001 + if (!vx_flags(VXF_VIRT_TIME, 0))
19002 + return do_settimeofday(ts);
19004 + do_gettimeofday(&tv);
19005 + vxi = current_vx_info();
19006 + vxi->cvirt.bias_tv.tv_sec = ts->tv_sec - tv.tv_sec;
19007 + vxi->cvirt.bias_tv.tv_usec =
19008 + (ts->tv_nsec/NSEC_PER_USEC) - tv.tv_usec;
19014 diff -NurpP --minimal linux-2.6.34/kernel/vserver/cvirt_init.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cvirt_init.h
19015 --- linux-2.6.34/kernel/vserver/cvirt_init.h 1970-01-01 01:00:00.000000000 +0100
19016 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cvirt_init.h 2010-05-18 18:11:22.000000000 +0200
19020 +extern uint64_t vx_idle_jiffies(void);
19022 +static inline void vx_info_init_cvirt(struct _vx_cvirt *cvirt)
19024 + uint64_t idle_jiffies = vx_idle_jiffies();
19025 + uint64_t nsuptime;
19027 + do_posix_clock_monotonic_gettime(&cvirt->bias_uptime);
19028 + nsuptime = (unsigned long long)cvirt->bias_uptime.tv_sec
19029 + * NSEC_PER_SEC + cvirt->bias_uptime.tv_nsec;
19030 + cvirt->bias_clock = nsec_to_clock_t(nsuptime);
19031 + cvirt->bias_tv.tv_sec = 0;
19032 + cvirt->bias_tv.tv_usec = 0;
19034 + jiffies_to_timespec(idle_jiffies, &cvirt->bias_idle);
19035 + atomic_set(&cvirt->nr_threads, 0);
19036 + atomic_set(&cvirt->nr_running, 0);
19037 + atomic_set(&cvirt->nr_uninterruptible, 0);
19038 + atomic_set(&cvirt->nr_onhold, 0);
19040 + spin_lock_init(&cvirt->load_lock);
19041 + cvirt->load_last = jiffies;
19042 + atomic_set(&cvirt->load_updates, 0);
19043 + cvirt->load[0] = 0;
19044 + cvirt->load[1] = 0;
19045 + cvirt->load[2] = 0;
19046 + atomic_set(&cvirt->total_forks, 0);
19048 + spin_lock_init(&cvirt->syslog.logbuf_lock);
19049 + init_waitqueue_head(&cvirt->syslog.log_wait);
19050 + cvirt->syslog.log_start = 0;
19051 + cvirt->syslog.log_end = 0;
19052 + cvirt->syslog.con_start = 0;
19053 + cvirt->syslog.logged_chars = 0;
19057 +void vx_info_init_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, int cpu)
19059 + // cvirt_pc->cpustat = { 0 };
19062 +static inline void vx_info_exit_cvirt(struct _vx_cvirt *cvirt)
19066 + vxwprintk_xid((value = atomic_read(&cvirt->nr_threads)),
19067 + "!!! cvirt: %p[nr_threads] = %d on exit.",
19069 + vxwprintk_xid((value = atomic_read(&cvirt->nr_running)),
19070 + "!!! cvirt: %p[nr_running] = %d on exit.",
19072 + vxwprintk_xid((value = atomic_read(&cvirt->nr_uninterruptible)),
19073 + "!!! cvirt: %p[nr_uninterruptible] = %d on exit.",
19075 + vxwprintk_xid((value = atomic_read(&cvirt->nr_onhold)),
19076 + "!!! cvirt: %p[nr_onhold] = %d on exit.",
19082 +void vx_info_exit_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, int cpu)
19087 diff -NurpP --minimal linux-2.6.34/kernel/vserver/cvirt_proc.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cvirt_proc.h
19088 --- linux-2.6.34/kernel/vserver/cvirt_proc.h 1970-01-01 01:00:00.000000000 +0100
19089 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/cvirt_proc.h 2010-05-18 18:11:22.000000000 +0200
19091 +#ifndef _VX_CVIRT_PROC_H
19092 +#define _VX_CVIRT_PROC_H
19094 +#include <linux/nsproxy.h>
19095 +#include <linux/mnt_namespace.h>
19096 +#include <linux/ipc_namespace.h>
19097 +#include <linux/utsname.h>
19098 +#include <linux/ipc.h>
19102 +int vx_info_proc_nsproxy(struct nsproxy *nsproxy, char *buffer)
19104 + struct mnt_namespace *ns;
19105 + struct uts_namespace *uts;
19106 + struct ipc_namespace *ipc;
19107 + struct path path;
19108 + char *pstr, *root;
19114 + length += sprintf(buffer + length,
19115 + "NSProxy:\t%p [%p,%p,%p]\n",
19116 + nsproxy, nsproxy->mnt_ns,
19117 + nsproxy->uts_ns, nsproxy->ipc_ns);
19119 + ns = nsproxy->mnt_ns;
19123 + pstr = kmalloc(PATH_MAX, GFP_KERNEL);
19127 + path.mnt = ns->root;
19128 + path.dentry = ns->root->mnt_root;
19129 + root = d_path(&path, pstr, PATH_MAX - 2);
19130 + length += sprintf(buffer + length,
19131 + "Namespace:\t%p [#%u]\n"
19132 + "RootPath:\t%s\n",
19133 + ns, atomic_read(&ns->count),
19138 + uts = nsproxy->uts_ns;
19142 + length += sprintf(buffer + length,
19143 + "SysName:\t%.*s\n"
19144 + "NodeName:\t%.*s\n"
19145 + "Release:\t%.*s\n"
19146 + "Version:\t%.*s\n"
19147 + "Machine:\t%.*s\n"
19148 + "DomainName:\t%.*s\n",
19149 + __NEW_UTS_LEN, uts->name.sysname,
19150 + __NEW_UTS_LEN, uts->name.nodename,
19151 + __NEW_UTS_LEN, uts->name.release,
19152 + __NEW_UTS_LEN, uts->name.version,
19153 + __NEW_UTS_LEN, uts->name.machine,
19154 + __NEW_UTS_LEN, uts->name.domainname);
19157 + ipc = nsproxy->ipc_ns;
19161 + length += sprintf(buffer + length,
19162 + "SEMS:\t\t%d %d %d %d %d\n"
19163 + "MSG:\t\t%d %d %d\n"
19164 + "SHM:\t\t%lu %lu %d %d\n",
19165 + ipc->sem_ctls[0], ipc->sem_ctls[1],
19166 + ipc->sem_ctls[2], ipc->sem_ctls[3],
19168 + ipc->msg_ctlmax, ipc->msg_ctlmnb, ipc->msg_ctlmni,
19169 + (unsigned long)ipc->shm_ctlmax,
19170 + (unsigned long)ipc->shm_ctlall,
19171 + ipc->shm_ctlmni, ipc->shm_tot);
19178 +#include <linux/sched.h>
19180 +#define LOAD_INT(x) ((x) >> FSHIFT)
19181 +#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1 - 1)) * 100)
19184 +int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer)
19189 + length += sprintf(buffer + length,
19190 + "BiasUptime:\t%lu.%02lu\n",
19191 + (unsigned long)cvirt->bias_uptime.tv_sec,
19192 + (cvirt->bias_uptime.tv_nsec / (NSEC_PER_SEC / 100)));
19194 + a = cvirt->load[0] + (FIXED_1 / 200);
19195 + b = cvirt->load[1] + (FIXED_1 / 200);
19196 + c = cvirt->load[2] + (FIXED_1 / 200);
19197 + length += sprintf(buffer + length,
19198 + "nr_threads:\t%d\n"
19199 + "nr_running:\t%d\n"
19200 + "nr_unintr:\t%d\n"
19201 + "nr_onhold:\t%d\n"
19202 + "load_updates:\t%d\n"
19203 + "loadavg:\t%d.%02d %d.%02d %d.%02d\n"
19204 + "total_forks:\t%d\n",
19205 + atomic_read(&cvirt->nr_threads),
19206 + atomic_read(&cvirt->nr_running),
19207 + atomic_read(&cvirt->nr_uninterruptible),
19208 + atomic_read(&cvirt->nr_onhold),
19209 + atomic_read(&cvirt->load_updates),
19210 + LOAD_INT(a), LOAD_FRAC(a),
19211 + LOAD_INT(b), LOAD_FRAC(b),
19212 + LOAD_INT(c), LOAD_FRAC(c),
19213 + atomic_read(&cvirt->total_forks));
19218 +int vx_info_proc_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc,
19219 + char *buffer, int cpu)
19225 +#endif /* _VX_CVIRT_PROC_H */
19226 diff -NurpP --minimal linux-2.6.34/kernel/vserver/debug.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/debug.c
19227 --- linux-2.6.34/kernel/vserver/debug.c 1970-01-01 01:00:00.000000000 +0100
19228 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/debug.c 2010-05-18 18:11:22.000000000 +0200
19231 + * kernel/vserver/debug.c
19233 + * Copyright (C) 2005-2007 Herbert Pötzl
19235 + * V0.01 vx_info dump support
19239 +#include <linux/module.h>
19241 +#include <linux/vserver/context.h>
19244 +void dump_vx_info(struct vx_info *vxi, int level)
19246 + printk("vx_info %p[#%d, %d.%d, %4x]\n", vxi, vxi->vx_id,
19247 + atomic_read(&vxi->vx_usecnt),
19248 + atomic_read(&vxi->vx_tasks),
19251 + __dump_vx_limit(&vxi->limit);
19252 + __dump_vx_sched(&vxi->sched);
19253 + __dump_vx_cvirt(&vxi->cvirt);
19254 + __dump_vx_cacct(&vxi->cacct);
19260 +EXPORT_SYMBOL_GPL(dump_vx_info);
19262 diff -NurpP --minimal linux-2.6.34/kernel/vserver/device.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/device.c
19263 --- linux-2.6.34/kernel/vserver/device.c 1970-01-01 01:00:00.000000000 +0100
19264 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/device.c 2010-05-18 18:11:22.000000000 +0200
19267 + * linux/kernel/vserver/device.c
19269 + * Linux-VServer: Device Support
19271 + * Copyright (C) 2006 Herbert Pötzl
19272 + * Copyright (C) 2007 Daniel Hokka Zakrisson
19274 + * V0.01 device mapping basics
19275 + * V0.02 added defaults
19279 +#include <linux/slab.h>
19280 +#include <linux/rcupdate.h>
19281 +#include <linux/fs.h>
19282 +#include <linux/namei.h>
19283 +#include <linux/hash.h>
19285 +#include <asm/errno.h>
19286 +#include <asm/uaccess.h>
19287 +#include <linux/vserver/base.h>
19288 +#include <linux/vserver/debug.h>
19289 +#include <linux/vserver/context.h>
19290 +#include <linux/vserver/device.h>
19291 +#include <linux/vserver/device_cmd.h>
19294 +#define DMAP_HASH_BITS 4
19297 +struct vs_mapping {
19299 + struct hlist_node hlist;
19300 + struct list_head list;
19302 +#define dm_hlist u.hlist
19303 +#define dm_list u.list
19306 + struct vx_dmap_target target;
19310 +static struct hlist_head dmap_main_hash[1 << DMAP_HASH_BITS];
19312 +static spinlock_t dmap_main_hash_lock = SPIN_LOCK_UNLOCKED;
19314 +static struct vx_dmap_target dmap_defaults[2] = {
19315 + { .flags = DATTR_OPEN },
19316 + { .flags = DATTR_OPEN },
19320 +struct kmem_cache *dmap_cachep __read_mostly;
19322 +int __init dmap_cache_init(void)
19324 + dmap_cachep = kmem_cache_create("dmap_cache",
19325 + sizeof(struct vs_mapping), 0,
19326 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
19330 +__initcall(dmap_cache_init);
19333 +static inline unsigned int __hashval(dev_t dev, int bits)
19335 + return hash_long((unsigned long)dev, bits);
19339 +/* __hash_mapping()
19340 + * add the mapping to the hash table
19342 +static inline void __hash_mapping(struct vx_info *vxi, struct vs_mapping *vdm)
19344 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19345 + struct hlist_head *head, *hash = dmap_main_hash;
19346 + int device = vdm->device;
19348 + spin_lock(hash_lock);
19349 + vxdprintk(VXD_CBIT(misc, 8), "__hash_mapping: %p[#%d] %08x:%08x",
19350 + vxi, vxi ? vxi->vx_id : 0, device, vdm->target.target);
19352 + head = &hash[__hashval(device, DMAP_HASH_BITS)];
19353 + hlist_add_head(&vdm->dm_hlist, head);
19354 + spin_unlock(hash_lock);
19358 +static inline int __mode_to_default(umode_t mode)
19371 +/* __set_default()
19374 +static inline void __set_default(struct vx_info *vxi, umode_t mode,
19375 + struct vx_dmap_target *vdmt)
19377 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19378 + spin_lock(hash_lock);
19381 + vxi->dmap.targets[__mode_to_default(mode)] = *vdmt;
19383 + dmap_defaults[__mode_to_default(mode)] = *vdmt;
19386 + spin_unlock(hash_lock);
19388 + vxdprintk(VXD_CBIT(misc, 8), "__set_default: %p[#%u] %08x %04x",
19389 + vxi, vxi ? vxi->vx_id : 0, vdmt->target, vdmt->flags);
19393 +/* __remove_default()
19394 + * remove a default
19396 +static inline int __remove_default(struct vx_info *vxi, umode_t mode)
19398 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19399 + spin_lock(hash_lock);
19402 + vxi->dmap.targets[__mode_to_default(mode)].flags = 0;
19403 + else /* remove == reset */
19404 + dmap_defaults[__mode_to_default(mode)].flags = DATTR_OPEN | mode;
19406 + spin_unlock(hash_lock);
19411 +/* __find_mapping()
19412 + * find a mapping in the hash table
19414 + * caller must hold hash_lock
19416 +static inline int __find_mapping(xid_t xid, dev_t device, umode_t mode,
19417 + struct vs_mapping **local, struct vs_mapping **global)
19419 + struct hlist_head *hash = dmap_main_hash;
19420 + struct hlist_head *head = &hash[__hashval(device, DMAP_HASH_BITS)];
19421 + struct hlist_node *pos;
19422 + struct vs_mapping *vdm;
19428 + hlist_for_each(pos, head) {
19429 + vdm = hlist_entry(pos, struct vs_mapping, dm_hlist);
19431 + if ((vdm->device == device) &&
19432 + !((vdm->target.flags ^ mode) & S_IFMT)) {
19433 + if (vdm->xid == xid) {
19436 + } else if (global && vdm->xid == 0)
19441 + if (global && *global)
19448 +/* __lookup_mapping()
19449 + * find a mapping and store the result in target and flags
19451 +static inline int __lookup_mapping(struct vx_info *vxi,
19452 + dev_t device, dev_t *target, int *flags, umode_t mode)
19454 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19455 + struct vs_mapping *vdm, *global;
19456 + struct vx_dmap_target *vdmt;
19458 + xid_t xid = vxi->vx_id;
19461 + spin_lock(hash_lock);
19462 + if (__find_mapping(xid, device, mode, &vdm, &global) > 0) {
19464 + vdmt = &vdm->target;
19468 + index = __mode_to_default(mode);
19469 + if (vxi && vxi->dmap.targets[index].flags) {
19471 + vdmt = &vxi->dmap.targets[index];
19472 + } else if (global) {
19474 + vdmt = &global->target;
19478 + vdmt = &dmap_defaults[index];
19482 + if (target && (vdmt->flags & DATTR_REMAP))
19483 + *target = vdmt->target;
19485 + *target = device;
19487 + *flags = vdmt->flags;
19489 + spin_unlock(hash_lock);
19495 +/* __remove_mapping()
19496 + * remove a mapping from the hash table
19498 +static inline int __remove_mapping(struct vx_info *vxi, dev_t device,
19501 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19502 + struct vs_mapping *vdm = NULL;
19505 + spin_lock(hash_lock);
19507 + ret = __find_mapping((vxi ? vxi->vx_id : 0), device, mode, &vdm,
19509 + vxdprintk(VXD_CBIT(misc, 8), "__remove_mapping: %p[#%d] %08x %04x",
19510 + vxi, vxi ? vxi->vx_id : 0, device, mode);
19513 + hlist_del(&vdm->dm_hlist);
19516 + spin_unlock(hash_lock);
19518 + kmem_cache_free(dmap_cachep, vdm);
19524 +int vs_map_device(struct vx_info *vxi,
19525 + dev_t device, dev_t *target, umode_t mode)
19527 + int ret, flags = DATTR_MASK;
19531 + *target = device;
19534 + ret = __lookup_mapping(vxi, device, target, &flags, mode);
19535 + vxdprintk(VXD_CBIT(misc, 8), "vs_map_device: %08x target: %08x flags: %04x mode: %04x mapped=%d",
19536 + device, target ? *target : 0, flags, mode, ret);
19538 + return (flags & DATTR_MASK);
19543 +static int do_set_mapping(struct vx_info *vxi,
19544 + dev_t device, dev_t target, int flags, umode_t mode)
19547 + struct vs_mapping *new;
19549 + new = kmem_cache_alloc(dmap_cachep, GFP_KERNEL);
19553 + INIT_HLIST_NODE(&new->dm_hlist);
19554 + new->device = device;
19555 + new->target.target = target;
19556 + new->target.flags = flags | mode;
19557 + new->xid = (vxi ? vxi->vx_id : 0);
19559 + vxdprintk(VXD_CBIT(misc, 8), "do_set_mapping: %08x target: %08x flags: %04x", device, target, flags);
19560 + __hash_mapping(vxi, new);
19562 + struct vx_dmap_target new = {
19563 + .target = target,
19564 + .flags = flags | mode,
19566 + __set_default(vxi, mode, &new);
19572 +static int do_unset_mapping(struct vx_info *vxi,
19573 + dev_t device, dev_t target, int flags, umode_t mode)
19575 + int ret = -EINVAL;
19578 + ret = __remove_mapping(vxi, device, mode);
19582 + ret = __remove_default(vxi, mode);
19592 +static inline int __user_device(const char __user *name, dev_t *dev,
19595 + struct nameidata nd;
19602 + ret = user_lpath(name, &nd.path);
19605 + if (nd.path.dentry->d_inode) {
19606 + *dev = nd.path.dentry->d_inode->i_rdev;
19607 + *mode = nd.path.dentry->d_inode->i_mode;
19609 + path_put(&nd.path);
19613 +static inline int __mapping_mode(dev_t device, dev_t target,
19614 + umode_t device_mode, umode_t target_mode, umode_t *mode)
19617 + *mode = device_mode & S_IFMT;
19619 + *mode = target_mode & S_IFMT;
19623 + /* if both given, device and target mode have to match */
19624 + if (device && target &&
19625 + ((device_mode ^ target_mode) & S_IFMT))
19631 +static inline int do_mapping(struct vx_info *vxi, const char __user *device_path,
19632 + const char __user *target_path, int flags, int set)
19634 + dev_t device = ~0, target = ~0;
19635 + umode_t device_mode = 0, target_mode = 0, mode;
19638 + ret = __user_device(device_path, &device, &device_mode);
19641 + ret = __user_device(target_path, &target, &target_mode);
19645 + ret = __mapping_mode(device, target,
19646 + device_mode, target_mode, &mode);
19651 + return do_set_mapping(vxi, device, target,
19654 + return do_unset_mapping(vxi, device, target,
19659 +int vc_set_mapping(struct vx_info *vxi, void __user *data)
19661 + struct vcmd_set_mapping_v0 vc_data;
19663 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19666 + return do_mapping(vxi, vc_data.device, vc_data.target,
19667 + vc_data.flags, 1);
19670 +int vc_unset_mapping(struct vx_info *vxi, void __user *data)
19672 + struct vcmd_set_mapping_v0 vc_data;
19674 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19677 + return do_mapping(vxi, vc_data.device, vc_data.target,
19678 + vc_data.flags, 0);
19682 +#ifdef CONFIG_COMPAT
19684 +int vc_set_mapping_x32(struct vx_info *vxi, void __user *data)
19686 + struct vcmd_set_mapping_v0_x32 vc_data;
19688 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19691 + return do_mapping(vxi, compat_ptr(vc_data.device_ptr),
19692 + compat_ptr(vc_data.target_ptr), vc_data.flags, 1);
19695 +int vc_unset_mapping_x32(struct vx_info *vxi, void __user *data)
19697 + struct vcmd_set_mapping_v0_x32 vc_data;
19699 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19702 + return do_mapping(vxi, compat_ptr(vc_data.device_ptr),
19703 + compat_ptr(vc_data.target_ptr), vc_data.flags, 0);
19706 +#endif /* CONFIG_COMPAT */
19709 diff -NurpP --minimal linux-2.6.34/kernel/vserver/dlimit.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/dlimit.c
19710 --- linux-2.6.34/kernel/vserver/dlimit.c 1970-01-01 01:00:00.000000000 +0100
19711 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/dlimit.c 2010-05-19 01:45:32.000000000 +0200
19714 + * linux/kernel/vserver/dlimit.c
19716 + * Virtual Server: Context Disk Limits
19718 + * Copyright (C) 2004-2009 Herbert Pötzl
19720 + * V0.01 initial version
19721 + * V0.02 compat32 splitup
19722 + * V0.03 extended interface
19726 +#include <linux/statfs.h>
19727 +#include <linux/sched.h>
19728 +#include <linux/namei.h>
19729 +#include <linux/vs_tag.h>
19730 +#include <linux/vs_dlimit.h>
19731 +#include <linux/vserver/dlimit_cmd.h>
19732 +#include <linux/slab.h>
19733 +// #include <linux/gfp.h>
19735 +#include <asm/uaccess.h>
19737 +/* __alloc_dl_info()
19739 + * allocate an initialized dl_info struct
19740 + * doesn't make it visible (hash) */
19742 +static struct dl_info *__alloc_dl_info(struct super_block *sb, tag_t tag)
19744 + struct dl_info *new = NULL;
19746 + vxdprintk(VXD_CBIT(dlim, 5),
19747 + "alloc_dl_info(%p,%d)*", sb, tag);
19749 + /* would this benefit from a slab cache? */
19750 + new = kmalloc(sizeof(struct dl_info), GFP_KERNEL);
19754 + memset(new, 0, sizeof(struct dl_info));
19755 + new->dl_tag = tag;
19757 + INIT_RCU_HEAD(&new->dl_rcu);
19758 + INIT_HLIST_NODE(&new->dl_hlist);
19759 + spin_lock_init(&new->dl_lock);
19760 + atomic_set(&new->dl_refcnt, 0);
19761 + atomic_set(&new->dl_usecnt, 0);
19763 + /* rest of init goes here */
19765 + vxdprintk(VXD_CBIT(dlim, 4),
19766 + "alloc_dl_info(%p,%d) = %p", sb, tag, new);
19770 +/* __dealloc_dl_info()
19772 + * final disposal of dl_info */
19774 +static void __dealloc_dl_info(struct dl_info *dli)
19776 + vxdprintk(VXD_CBIT(dlim, 4),
19777 + "dealloc_dl_info(%p)", dli);
19779 + dli->dl_hlist.next = LIST_POISON1;
19780 + dli->dl_tag = -1;
19783 + BUG_ON(atomic_read(&dli->dl_usecnt));
19784 + BUG_ON(atomic_read(&dli->dl_refcnt));
19790 +/* hash table for dl_info hash */
19792 +#define DL_HASH_SIZE 13
19794 +struct hlist_head dl_info_hash[DL_HASH_SIZE];
19796 +static spinlock_t dl_info_hash_lock = SPIN_LOCK_UNLOCKED;
19799 +static inline unsigned int __hashval(struct super_block *sb, tag_t tag)
19801 + return ((tag ^ (unsigned long)sb) % DL_HASH_SIZE);
19806 +/* __hash_dl_info()
19808 + * add the dli to the global hash table
19809 + * requires the hash_lock to be held */
19811 +static inline void __hash_dl_info(struct dl_info *dli)
19813 + struct hlist_head *head;
19815 + vxdprintk(VXD_CBIT(dlim, 6),
19816 + "__hash_dl_info: %p[#%d]", dli, dli->dl_tag);
19817 + get_dl_info(dli);
19818 + head = &dl_info_hash[__hashval(dli->dl_sb, dli->dl_tag)];
19819 + hlist_add_head_rcu(&dli->dl_hlist, head);
19822 +/* __unhash_dl_info()
19824 + * remove the dli from the global hash table
19825 + * requires the hash_lock to be held */
19827 +static inline void __unhash_dl_info(struct dl_info *dli)
19829 + vxdprintk(VXD_CBIT(dlim, 6),
19830 + "__unhash_dl_info: %p[#%d]", dli, dli->dl_tag);
19831 + hlist_del_rcu(&dli->dl_hlist);
19832 + put_dl_info(dli);
19836 +/* __lookup_dl_info()
19838 + * requires the rcu_read_lock()
19839 + * doesn't increment the dl_refcnt */
19841 +static inline struct dl_info *__lookup_dl_info(struct super_block *sb, tag_t tag)
19843 + struct hlist_head *head = &dl_info_hash[__hashval(sb, tag)];
19844 + struct hlist_node *pos;
19845 + struct dl_info *dli;
19847 + hlist_for_each_entry_rcu(dli, pos, head, dl_hlist) {
19849 + if (dli->dl_tag == tag && dli->dl_sb == sb) {
19857 +struct dl_info *locate_dl_info(struct super_block *sb, tag_t tag)
19859 + struct dl_info *dli;
19862 + dli = get_dl_info(__lookup_dl_info(sb, tag));
19863 + vxdprintk(VXD_CBIT(dlim, 7),
19864 + "locate_dl_info(%p,#%d) = %p", sb, tag, dli);
19865 + rcu_read_unlock();
19869 +void rcu_free_dl_info(struct rcu_head *head)
19871 + struct dl_info *dli = container_of(head, struct dl_info, dl_rcu);
19872 + int usecnt, refcnt;
19874 + BUG_ON(!dli || !head);
19876 + usecnt = atomic_read(&dli->dl_usecnt);
19877 + BUG_ON(usecnt < 0);
19879 + refcnt = atomic_read(&dli->dl_refcnt);
19880 + BUG_ON(refcnt < 0);
19882 + vxdprintk(VXD_CBIT(dlim, 3),
19883 + "rcu_free_dl_info(%p)", dli);
19885 + __dealloc_dl_info(dli);
19887 + printk("!!! rcu didn't free\n");
19893 +static int do_addrem_dlimit(uint32_t id, const char __user *name,
19894 + uint32_t flags, int add)
19896 + struct path path;
19899 + ret = user_lpath(name, &path);
19901 + struct super_block *sb;
19902 + struct dl_info *dli;
19905 + if (!path.dentry->d_inode)
19906 + goto out_release;
19907 + if (!(sb = path.dentry->d_inode->i_sb))
19908 + goto out_release;
19911 + dli = __alloc_dl_info(sb, id);
19912 + spin_lock(&dl_info_hash_lock);
19915 + if (__lookup_dl_info(sb, id))
19917 + __hash_dl_info(dli);
19920 + spin_lock(&dl_info_hash_lock);
19921 + dli = __lookup_dl_info(sb, id);
19926 + __unhash_dl_info(dli);
19930 + spin_unlock(&dl_info_hash_lock);
19932 + __dealloc_dl_info(dli);
19939 +int vc_add_dlimit(uint32_t id, void __user *data)
19941 + struct vcmd_ctx_dlimit_base_v0 vc_data;
19943 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19946 + return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 1);
19949 +int vc_rem_dlimit(uint32_t id, void __user *data)
19951 + struct vcmd_ctx_dlimit_base_v0 vc_data;
19953 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19956 + return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 0);
19959 +#ifdef CONFIG_COMPAT
19961 +int vc_add_dlimit_x32(uint32_t id, void __user *data)
19963 + struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
19965 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19968 + return do_addrem_dlimit(id,
19969 + compat_ptr(vc_data.name_ptr), vc_data.flags, 1);
19972 +int vc_rem_dlimit_x32(uint32_t id, void __user *data)
19974 + struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
19976 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19979 + return do_addrem_dlimit(id,
19980 + compat_ptr(vc_data.name_ptr), vc_data.flags, 0);
19983 +#endif /* CONFIG_COMPAT */
19987 +int do_set_dlimit(uint32_t id, const char __user *name,
19988 + uint32_t space_used, uint32_t space_total,
19989 + uint32_t inodes_used, uint32_t inodes_total,
19990 + uint32_t reserved, uint32_t flags)
19992 + struct path path;
19995 + ret = user_lpath(name, &path);
19997 + struct super_block *sb;
19998 + struct dl_info *dli;
20001 + if (!path.dentry->d_inode)
20002 + goto out_release;
20003 + if (!(sb = path.dentry->d_inode->i_sb))
20004 + goto out_release;
20006 + /* sanity checks */
20007 + if ((reserved != CDLIM_KEEP &&
20008 + reserved > 100) ||
20009 + (inodes_used != CDLIM_KEEP &&
20010 + inodes_used > inodes_total) ||
20011 + (space_used != CDLIM_KEEP &&
20012 + space_used > space_total))
20013 + goto out_release;
20016 + dli = locate_dl_info(sb, id);
20018 + goto out_release;
20020 + spin_lock(&dli->dl_lock);
20022 + if (inodes_used != CDLIM_KEEP)
20023 + dli->dl_inodes_used = inodes_used;
20024 + if (inodes_total != CDLIM_KEEP)
20025 + dli->dl_inodes_total = inodes_total;
20026 + if (space_used != CDLIM_KEEP)
20027 + dli->dl_space_used = dlimit_space_32to64(
20028 + space_used, flags, DLIMS_USED);
20030 + if (space_total == CDLIM_INFINITY)
20031 + dli->dl_space_total = DLIM_INFINITY;
20032 + else if (space_total != CDLIM_KEEP)
20033 + dli->dl_space_total = dlimit_space_32to64(
20034 + space_total, flags, DLIMS_TOTAL);
20036 + if (reserved != CDLIM_KEEP)
20037 + dli->dl_nrlmult = (1 << 10) * (100 - reserved) / 100;
20039 + spin_unlock(&dli->dl_lock);
20041 + put_dl_info(dli);
20050 +int vc_set_dlimit(uint32_t id, void __user *data)
20052 + struct vcmd_ctx_dlimit_v0 vc_data;
20054 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20057 + return do_set_dlimit(id, vc_data.name,
20058 + vc_data.space_used, vc_data.space_total,
20059 + vc_data.inodes_used, vc_data.inodes_total,
20060 + vc_data.reserved, vc_data.flags);
20063 +#ifdef CONFIG_COMPAT
20065 +int vc_set_dlimit_x32(uint32_t id, void __user *data)
20067 + struct vcmd_ctx_dlimit_v0_x32 vc_data;
20069 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20072 + return do_set_dlimit(id, compat_ptr(vc_data.name_ptr),
20073 + vc_data.space_used, vc_data.space_total,
20074 + vc_data.inodes_used, vc_data.inodes_total,
20075 + vc_data.reserved, vc_data.flags);
20078 +#endif /* CONFIG_COMPAT */
20082 +int do_get_dlimit(uint32_t id, const char __user *name,
20083 + uint32_t *space_used, uint32_t *space_total,
20084 + uint32_t *inodes_used, uint32_t *inodes_total,
20085 + uint32_t *reserved, uint32_t *flags)
20087 + struct path path;
20090 + ret = user_lpath(name, &path);
20092 + struct super_block *sb;
20093 + struct dl_info *dli;
20096 + if (!path.dentry->d_inode)
20097 + goto out_release;
20098 + if (!(sb = path.dentry->d_inode->i_sb))
20099 + goto out_release;
20102 + dli = locate_dl_info(sb, id);
20104 + goto out_release;
20106 + spin_lock(&dli->dl_lock);
20107 + *inodes_used = dli->dl_inodes_used;
20108 + *inodes_total = dli->dl_inodes_total;
20110 + *space_used = dlimit_space_64to32(
20111 + dli->dl_space_used, flags, DLIMS_USED);
20113 + if (dli->dl_space_total == DLIM_INFINITY)
20114 + *space_total = CDLIM_INFINITY;
20116 + *space_total = dlimit_space_64to32(
20117 + dli->dl_space_total, flags, DLIMS_TOTAL);
20119 + *reserved = 100 - ((dli->dl_nrlmult * 100 + 512) >> 10);
20120 + spin_unlock(&dli->dl_lock);
20122 + put_dl_info(dli);
20133 +int vc_get_dlimit(uint32_t id, void __user *data)
20135 + struct vcmd_ctx_dlimit_v0 vc_data;
20138 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20141 + ret = do_get_dlimit(id, vc_data.name,
20142 + &vc_data.space_used, &vc_data.space_total,
20143 + &vc_data.inodes_used, &vc_data.inodes_total,
20144 + &vc_data.reserved, &vc_data.flags);
20148 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20153 +#ifdef CONFIG_COMPAT
20155 +int vc_get_dlimit_x32(uint32_t id, void __user *data)
20157 + struct vcmd_ctx_dlimit_v0_x32 vc_data;
20160 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20163 + ret = do_get_dlimit(id, compat_ptr(vc_data.name_ptr),
20164 + &vc_data.space_used, &vc_data.space_total,
20165 + &vc_data.inodes_used, &vc_data.inodes_total,
20166 + &vc_data.reserved, &vc_data.flags);
20170 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20175 +#endif /* CONFIG_COMPAT */
20178 +void vx_vsi_statfs(struct super_block *sb, struct kstatfs *buf)
20180 + struct dl_info *dli;
20181 + __u64 blimit, bfree, bavail;
20184 + dli = locate_dl_info(sb, dx_current_tag());
20188 + spin_lock(&dli->dl_lock);
20189 + if (dli->dl_inodes_total == (unsigned long)DLIM_INFINITY)
20192 + /* reduce max inodes available to limit */
20193 + if (buf->f_files > dli->dl_inodes_total)
20194 + buf->f_files = dli->dl_inodes_total;
20196 + ifree = dli->dl_inodes_total - dli->dl_inodes_used;
20197 + /* reduce free inodes to min */
20198 + if (ifree < buf->f_ffree)
20199 + buf->f_ffree = ifree;
20202 + if (dli->dl_space_total == DLIM_INFINITY)
20205 + blimit = dli->dl_space_total >> sb->s_blocksize_bits;
20207 + if (dli->dl_space_total < dli->dl_space_used)
20210 + bfree = (dli->dl_space_total - dli->dl_space_used)
20211 + >> sb->s_blocksize_bits;
20213 + bavail = ((dli->dl_space_total >> 10) * dli->dl_nrlmult);
20214 + if (bavail < dli->dl_space_used)
20217 + bavail = (bavail - dli->dl_space_used)
20218 + >> sb->s_blocksize_bits;
20220 + /* reduce max space available to limit */
20221 + if (buf->f_blocks > blimit)
20222 + buf->f_blocks = blimit;
20224 + /* reduce free space to min */
20225 + if (bfree < buf->f_bfree)
20226 + buf->f_bfree = bfree;
20228 + /* reduce avail space to min */
20229 + if (bavail < buf->f_bavail)
20230 + buf->f_bavail = bavail;
20233 + spin_unlock(&dli->dl_lock);
20234 + put_dl_info(dli);
20239 +#include <linux/module.h>
20241 +EXPORT_SYMBOL_GPL(locate_dl_info);
20242 +EXPORT_SYMBOL_GPL(rcu_free_dl_info);
20244 diff -NurpP --minimal linux-2.6.34/kernel/vserver/helper.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/helper.c
20245 --- linux-2.6.34/kernel/vserver/helper.c 1970-01-01 01:00:00.000000000 +0100
20246 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/helper.c 2010-05-18 18:11:22.000000000 +0200
20249 + * linux/kernel/vserver/helper.c
20251 + * Virtual Context Support
20253 + * Copyright (C) 2004-2007 Herbert Pötzl
20255 + * V0.01 basic helper
20259 +#include <linux/kmod.h>
20260 +#include <linux/reboot.h>
20261 +#include <linux/vs_context.h>
20262 +#include <linux/vs_network.h>
20263 +#include <linux/vserver/signal.h>
20266 +char vshelper_path[255] = "/sbin/vshelper";
20269 +static int do_vshelper(char *name, char *argv[], char *envp[], int sync)
20273 + if ((ret = call_usermodehelper(name, argv, envp, sync))) {
20274 + printk( KERN_WARNING
20275 + "%s: (%s %s) returned %s with %d\n",
20276 + name, argv[1], argv[2],
20277 + sync ? "sync" : "async", ret);
20279 + vxdprintk(VXD_CBIT(switch, 4),
20280 + "%s: (%s %s) returned %s with %d",
20281 + name, argv[1], argv[2], sync ? "sync" : "async", ret);
20286 + * vshelper path is set via /proc/sys
20287 + * invoked by vserver sys_reboot(), with
20288 + * the following arguments
20290 + * argv [0] = vshelper_path;
20291 + * argv [1] = action: "restart", "halt", "poweroff", ...
20292 + * argv [2] = context identifier
20294 + * envp [*] = type-specific parameters
20297 +long vs_reboot_helper(struct vx_info *vxi, int cmd, void __user *arg)
20299 + char id_buf[8], cmd_buf[16];
20300 + char uid_buf[16], pid_buf[16];
20303 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20304 + char *envp[] = {"HOME=/", "TERM=linux",
20305 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
20306 + uid_buf, pid_buf, cmd_buf, 0};
20308 + if (vx_info_state(vxi, VXS_HELPER))
20310 + vxi->vx_state |= VXS_HELPER;
20312 + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
20314 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20315 + snprintf(uid_buf, sizeof(uid_buf)-1, "VS_UID=%d", current_uid());
20316 + snprintf(pid_buf, sizeof(pid_buf)-1, "VS_PID=%d", current->pid);
20319 + case LINUX_REBOOT_CMD_RESTART:
20320 + argv[1] = "restart";
20323 + case LINUX_REBOOT_CMD_HALT:
20324 + argv[1] = "halt";
20327 + case LINUX_REBOOT_CMD_POWER_OFF:
20328 + argv[1] = "poweroff";
20331 + case LINUX_REBOOT_CMD_SW_SUSPEND:
20332 + argv[1] = "swsusp";
20335 + case LINUX_REBOOT_CMD_OOM:
20340 + vxi->vx_state &= ~VXS_HELPER;
20344 + ret = do_vshelper(vshelper_path, argv, envp, 0);
20345 + vxi->vx_state &= ~VXS_HELPER;
20346 + __wakeup_vx_info(vxi);
20347 + return (ret) ? -EPERM : 0;
20351 +long vs_reboot(unsigned int cmd, void __user *arg)
20353 + struct vx_info *vxi = current_vx_info();
20356 + vxdprintk(VXD_CBIT(misc, 5),
20357 + "vs_reboot(%p[#%d],%u)",
20358 + vxi, vxi ? vxi->vx_id : 0, cmd);
20360 + ret = vs_reboot_helper(vxi, cmd, arg);
20364 + vxi->reboot_cmd = cmd;
20365 + if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
20367 + case LINUX_REBOOT_CMD_RESTART:
20368 + case LINUX_REBOOT_CMD_HALT:
20369 + case LINUX_REBOOT_CMD_POWER_OFF:
20370 + vx_info_kill(vxi, 0, SIGKILL);
20371 + vx_info_kill(vxi, 1, SIGKILL);
20379 +long vs_oom_action(unsigned int cmd)
20381 + struct vx_info *vxi = current_vx_info();
20384 + vxdprintk(VXD_CBIT(misc, 5),
20385 + "vs_oom_action(%p[#%d],%u)",
20386 + vxi, vxi ? vxi->vx_id : 0, cmd);
20388 + ret = vs_reboot_helper(vxi, cmd, NULL);
20392 + vxi->reboot_cmd = cmd;
20393 + if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
20394 + vx_info_kill(vxi, 0, SIGKILL);
20395 + vx_info_kill(vxi, 1, SIGKILL);
20401 + * argv [0] = vshelper_path;
20402 + * argv [1] = action: "startup", "shutdown"
20403 + * argv [2] = context identifier
20405 + * envp [*] = type-specific parameters
20408 +long vs_state_change(struct vx_info *vxi, unsigned int cmd)
20410 + char id_buf[8], cmd_buf[16];
20411 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20412 + char *envp[] = {"HOME=/", "TERM=linux",
20413 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
20415 + if (!vx_info_flags(vxi, VXF_SC_HELPER, 0))
20418 + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
20419 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20422 + case VSC_STARTUP:
20423 + argv[1] = "startup";
20425 + case VSC_SHUTDOWN:
20426 + argv[1] = "shutdown";
20432 + return do_vshelper(vshelper_path, argv, envp, 1);
20437 + * argv [0] = vshelper_path;
20438 + * argv [1] = action: "netup", "netdown"
20439 + * argv [2] = context identifier
20441 + * envp [*] = type-specific parameters
20444 +long vs_net_change(struct nx_info *nxi, unsigned int cmd)
20446 + char id_buf[8], cmd_buf[16];
20447 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20448 + char *envp[] = {"HOME=/", "TERM=linux",
20449 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
20451 + if (!nx_info_flags(nxi, NXF_SC_HELPER, 0))
20454 + snprintf(id_buf, sizeof(id_buf)-1, "%d", nxi->nx_id);
20455 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20459 + argv[1] = "netup";
20461 + case VSC_NETDOWN:
20462 + argv[1] = "netdown";
20468 + return do_vshelper(vshelper_path, argv, envp, 1);
20471 diff -NurpP --minimal linux-2.6.34/kernel/vserver/history.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/history.c
20472 --- linux-2.6.34/kernel/vserver/history.c 1970-01-01 01:00:00.000000000 +0100
20473 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/history.c 2010-05-18 18:11:22.000000000 +0200
20476 + * kernel/vserver/history.c
20478 + * Virtual Context History Backtrace
20480 + * Copyright (C) 2004-2007 Herbert Pötzl
20482 + * V0.01 basic structure
20483 + * V0.02 hash/unhash and trace
20484 + * V0.03 preemption fixes
20488 +#include <linux/module.h>
20489 +#include <asm/uaccess.h>
20491 +#include <linux/vserver/context.h>
20492 +#include <linux/vserver/debug.h>
20493 +#include <linux/vserver/debug_cmd.h>
20494 +#include <linux/vserver/history.h>
20497 +#ifdef CONFIG_VSERVER_HISTORY
20498 +#define VXH_SIZE CONFIG_VSERVER_HISTORY_SIZE
20500 +#define VXH_SIZE 64
20503 +struct _vx_history {
20504 + unsigned int counter;
20506 + struct _vx_hist_entry entry[VXH_SIZE + 1];
20510 +DEFINE_PER_CPU(struct _vx_history, vx_history_buffer);
20512 +unsigned volatile int vxh_active = 1;
20514 +static atomic_t sequence = ATOMIC_INIT(0);
20519 + * requires disabled preemption */
20521 +struct _vx_hist_entry *vxh_advance(void *loc)
20523 + unsigned int cpu = smp_processor_id();
20524 + struct _vx_history *hist = &per_cpu(vx_history_buffer, cpu);
20525 + struct _vx_hist_entry *entry;
20526 + unsigned int index;
20528 + index = vxh_active ? (hist->counter++ % VXH_SIZE) : VXH_SIZE;
20529 + entry = &hist->entry[index];
20531 + entry->seq = atomic_inc_return(&sequence);
20532 + entry->loc = loc;
20536 +EXPORT_SYMBOL_GPL(vxh_advance);
20539 +#define VXH_LOC_FMTS "(#%04x,*%d):%p"
20541 +#define VXH_LOC_ARGS(e) (e)->seq, cpu, (e)->loc
20544 +#define VXH_VXI_FMTS "%p[#%d,%d.%d]"
20546 +#define VXH_VXI_ARGS(e) (e)->vxi.ptr, \
20547 + (e)->vxi.ptr ? (e)->vxi.xid : 0, \
20548 + (e)->vxi.ptr ? (e)->vxi.usecnt : 0, \
20549 + (e)->vxi.ptr ? (e)->vxi.tasks : 0
20551 +void vxh_dump_entry(struct _vx_hist_entry *e, unsigned cpu)
20553 + switch (e->type) {
20554 + case VXH_THROW_OOPS:
20555 + printk( VXH_LOC_FMTS " oops \n", VXH_LOC_ARGS(e));
20558 + case VXH_GET_VX_INFO:
20559 + case VXH_PUT_VX_INFO:
20560 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS "\n",
20562 + (e->type == VXH_GET_VX_INFO) ? "get" : "put",
20563 + VXH_VXI_ARGS(e));
20566 + case VXH_INIT_VX_INFO:
20567 + case VXH_SET_VX_INFO:
20568 + case VXH_CLR_VX_INFO:
20569 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS " @%p\n",
20571 + (e->type == VXH_INIT_VX_INFO) ? "init" :
20572 + ((e->type == VXH_SET_VX_INFO) ? "set" : "clr"),
20573 + VXH_VXI_ARGS(e), e->sc.data);
20576 + case VXH_CLAIM_VX_INFO:
20577 + case VXH_RELEASE_VX_INFO:
20578 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS " @%p\n",
20580 + (e->type == VXH_CLAIM_VX_INFO) ? "claim" : "release",
20581 + VXH_VXI_ARGS(e), e->sc.data);
20584 + case VXH_ALLOC_VX_INFO:
20585 + case VXH_DEALLOC_VX_INFO:
20586 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS "\n",
20588 + (e->type == VXH_ALLOC_VX_INFO) ? "alloc" : "dealloc",
20589 + VXH_VXI_ARGS(e));
20592 + case VXH_HASH_VX_INFO:
20593 + case VXH_UNHASH_VX_INFO:
20594 + printk( VXH_LOC_FMTS " __%s_vx_info " VXH_VXI_FMTS "\n",
20596 + (e->type == VXH_HASH_VX_INFO) ? "hash" : "unhash",
20597 + VXH_VXI_ARGS(e));
20600 + case VXH_LOC_VX_INFO:
20601 + case VXH_LOOKUP_VX_INFO:
20602 + case VXH_CREATE_VX_INFO:
20603 + printk( VXH_LOC_FMTS " __%s_vx_info [#%d] -> " VXH_VXI_FMTS "\n",
20605 + (e->type == VXH_CREATE_VX_INFO) ? "create" :
20606 + ((e->type == VXH_LOC_VX_INFO) ? "loc" : "lookup"),
20607 + e->ll.arg, VXH_VXI_ARGS(e));
20612 +static void __vxh_dump_history(void)
20614 + unsigned int i, cpu;
20616 + printk("History:\tSEQ: %8x\tNR_CPUS: %d\n",
20617 + atomic_read(&sequence), NR_CPUS);
20619 + for (i = 0; i < VXH_SIZE; i++) {
20620 + for_each_online_cpu(cpu) {
20621 + struct _vx_history *hist =
20622 + &per_cpu(vx_history_buffer, cpu);
20623 + unsigned int index = (hist->counter - i) % VXH_SIZE;
20624 + struct _vx_hist_entry *entry = &hist->entry[index];
20626 + vxh_dump_entry(entry, cpu);
20631 +void vxh_dump_history(void)
20635 + local_irq_enable();
20637 + local_irq_disable();
20639 + __vxh_dump_history();
20643 +/* vserver syscall commands below here */
20646 +int vc_dump_history(uint32_t id)
20649 + __vxh_dump_history();
20656 +int do_read_history(struct __user _vx_hist_entry *data,
20657 + int cpu, uint32_t *index, uint32_t *count)
20659 + int pos, ret = 0;
20660 + struct _vx_history *hist = &per_cpu(vx_history_buffer, cpu);
20661 + int end = hist->counter;
20662 + int start = end - VXH_SIZE + 2;
20663 + int idx = *index;
20665 + /* special case: get current pos */
20671 + /* have we lost some data? */
20675 + for (pos = 0; (pos < *count) && (idx < end); pos++, idx++) {
20676 + struct _vx_hist_entry *entry =
20677 + &hist->entry[idx % VXH_SIZE];
20679 + /* send entry to userspace */
20680 + ret = copy_to_user(&data[pos], entry, sizeof(*entry));
20684 + /* save new index and count */
20687 + return ret ? ret : (*index < end);
20690 +int vc_read_history(uint32_t id, void __user *data)
20692 + struct vcmd_read_history_v0 vc_data;
20695 + if (id >= NR_CPUS)
20698 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20701 + ret = do_read_history((struct __user _vx_hist_entry *)vc_data.data,
20702 + id, &vc_data.index, &vc_data.count);
20704 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20709 +#ifdef CONFIG_COMPAT
20711 +int vc_read_history_x32(uint32_t id, void __user *data)
20713 + struct vcmd_read_history_v0_x32 vc_data;
20716 + if (id >= NR_CPUS)
20719 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20722 + ret = do_read_history((struct __user _vx_hist_entry *)
20723 + compat_ptr(vc_data.data_ptr),
20724 + id, &vc_data.index, &vc_data.count);
20726 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20731 +#endif /* CONFIG_COMPAT */
20733 diff -NurpP --minimal linux-2.6.34/kernel/vserver/inet.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/inet.c
20734 --- linux-2.6.34/kernel/vserver/inet.c 1970-01-01 01:00:00.000000000 +0100
20735 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/inet.c 2010-05-18 18:11:22.000000000 +0200
20738 +#include <linux/in.h>
20739 +#include <linux/inetdevice.h>
20740 +#include <linux/vs_inet.h>
20741 +#include <linux/vs_inet6.h>
20742 +#include <linux/vserver/debug.h>
20743 +#include <net/route.h>
20744 +#include <net/addrconf.h>
20747 +int nx_v4_addr_conflict(struct nx_info *nxi1, struct nx_info *nxi2)
20751 + if (!nxi1 || !nxi2 || nxi1 == nxi2)
20754 + struct nx_addr_v4 *ptr;
20756 + for (ptr = &nxi1->v4; ptr; ptr = ptr->next) {
20757 + if (v4_nx_addr_in_nx_info(nxi2, ptr, -1)) {
20764 + vxdprintk(VXD_CBIT(net, 2),
20765 + "nx_v4_addr_conflict(%p,%p): %d",
20766 + nxi1, nxi2, ret);
20772 +#ifdef CONFIG_IPV6
20774 +int nx_v6_addr_conflict(struct nx_info *nxi1, struct nx_info *nxi2)
20778 + if (!nxi1 || !nxi2 || nxi1 == nxi2)
20781 + struct nx_addr_v6 *ptr;
20783 + for (ptr = &nxi1->v6; ptr; ptr = ptr->next) {
20784 + if (v6_nx_addr_in_nx_info(nxi2, ptr, -1)) {
20791 + vxdprintk(VXD_CBIT(net, 2),
20792 + "nx_v6_addr_conflict(%p,%p): %d",
20793 + nxi1, nxi2, ret);
20800 +int v4_dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
20802 + struct in_device *in_dev;
20803 + struct in_ifaddr **ifap;
20804 + struct in_ifaddr *ifa;
20809 + in_dev = in_dev_get(dev);
20813 + for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
20814 + ifap = &ifa->ifa_next) {
20815 + if (v4_addr_in_nx_info(nxi, ifa->ifa_local, NXA_MASK_SHOW)) {
20820 + in_dev_put(in_dev);
20826 +#ifdef CONFIG_IPV6
20828 +int v6_dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
20830 + struct inet6_dev *in_dev;
20831 + struct inet6_ifaddr **ifap;
20832 + struct inet6_ifaddr *ifa;
20837 + in_dev = in6_dev_get(dev);
20841 + for (ifap = &in_dev->addr_list; (ifa = *ifap) != NULL;
20842 + ifap = &ifa->if_next) {
20843 + if (v6_addr_in_nx_info(nxi, &ifa->addr, -1)) {
20848 + in6_dev_put(in_dev);
20855 +int dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
20861 + if (nxi->v4.type && v4_dev_in_nx_info(dev, nxi))
20863 +#ifdef CONFIG_IPV6
20865 + if (nxi->v6.type && v6_dev_in_nx_info(dev, nxi))
20870 + vxdprintk(VXD_CBIT(net, 3),
20871 + "dev_in_nx_info(%p,%p[#%d]) = %d",
20872 + dev, nxi, nxi ? nxi->nx_id : 0, ret);
20876 +int ip_v4_find_src(struct net *net, struct nx_info *nxi,
20877 + struct rtable **rp, struct flowi *fl)
20882 + /* FIXME: handle lback only case */
20883 + if (!NX_IPV4(nxi))
20886 + vxdprintk(VXD_CBIT(net, 4),
20887 + "ip_v4_find_src(%p[#%u]) " NIPQUAD_FMT " -> " NIPQUAD_FMT,
20888 + nxi, nxi ? nxi->nx_id : 0,
20889 + NIPQUAD(fl->fl4_src), NIPQUAD(fl->fl4_dst));
20891 + /* single IP is unconditional */
20892 + if (nx_info_flags(nxi, NXF_SINGLE_IP, 0) &&
20893 + (fl->fl4_src == INADDR_ANY))
20894 + fl->fl4_src = nxi->v4.ip[0].s_addr;
20896 + if (fl->fl4_src == INADDR_ANY) {
20897 + struct nx_addr_v4 *ptr;
20898 + __be32 found = 0;
20901 + err = __ip_route_output_key(net, rp, fl);
20903 + found = (*rp)->rt_src;
20905 + vxdprintk(VXD_CBIT(net, 4),
20906 + "ip_v4_find_src(%p[#%u]) rok[%u]: " NIPQUAD_FMT,
20907 + nxi, nxi ? nxi->nx_id : 0, fl->oif, NIPQUAD(found));
20908 + if (v4_addr_in_nx_info(nxi, found, NXA_MASK_BIND))
20912 + for (ptr = &nxi->v4; ptr; ptr = ptr->next) {
20913 + __be32 primary = ptr->ip[0].s_addr;
20914 + __be32 mask = ptr->mask.s_addr;
20915 + __be32 neta = primary & mask;
20917 + vxdprintk(VXD_CBIT(net, 4), "ip_v4_find_src(%p[#%u]) chk: "
20918 + NIPQUAD_FMT "/" NIPQUAD_FMT "/" NIPQUAD_FMT,
20919 + nxi, nxi ? nxi->nx_id : 0, NIPQUAD(primary),
20920 + NIPQUAD(mask), NIPQUAD(neta));
20921 + if ((found & mask) != neta)
20924 + fl->fl4_src = primary;
20925 + err = __ip_route_output_key(net, rp, fl);
20926 + vxdprintk(VXD_CBIT(net, 4),
20927 + "ip_v4_find_src(%p[#%u]) rok[%u]: " NIPQUAD_FMT,
20928 + nxi, nxi ? nxi->nx_id : 0, fl->oif, NIPQUAD(primary));
20930 + found = (*rp)->rt_src;
20932 + if (found == primary)
20936 + /* still no source ip? */
20937 + found = ipv4_is_loopback(fl->fl4_dst)
20938 + ? IPI_LOOPBACK : nxi->v4.ip[0].s_addr;
20940 + /* assign src ip to flow */
20941 + fl->fl4_src = found;
20944 + if (!v4_addr_in_nx_info(nxi, fl->fl4_src, NXA_MASK_BIND))
20948 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0)) {
20949 + if (ipv4_is_loopback(fl->fl4_dst))
20950 + fl->fl4_dst = nxi->v4_lback.s_addr;
20951 + if (ipv4_is_loopback(fl->fl4_src))
20952 + fl->fl4_src = nxi->v4_lback.s_addr;
20953 + } else if (ipv4_is_loopback(fl->fl4_dst) &&
20954 + !nx_info_flags(nxi, NXF_LBACK_ALLOW, 0))
20960 +EXPORT_SYMBOL_GPL(ip_v4_find_src);
20962 diff -NurpP --minimal linux-2.6.34/kernel/vserver/init.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/init.c
20963 --- linux-2.6.34/kernel/vserver/init.c 1970-01-01 01:00:00.000000000 +0100
20964 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/init.c 2010-05-18 18:11:22.000000000 +0200
20967 + * linux/kernel/init.c
20969 + * Virtual Server Init
20971 + * Copyright (C) 2004-2007 Herbert Pötzl
20973 + * V0.01 basic structure
20977 +#include <linux/init.h>
20979 +int vserver_register_sysctl(void);
20980 +void vserver_unregister_sysctl(void);
20983 +static int __init init_vserver(void)
20987 +#ifdef CONFIG_VSERVER_DEBUG
20988 + vserver_register_sysctl();
20994 +static void __exit exit_vserver(void)
20997 +#ifdef CONFIG_VSERVER_DEBUG
20998 + vserver_unregister_sysctl();
21003 +/* FIXME: GFP_ZONETYPES gone
21004 +long vx_slab[GFP_ZONETYPES]; */
21008 +module_init(init_vserver);
21009 +module_exit(exit_vserver);
21011 diff -NurpP --minimal linux-2.6.34/kernel/vserver/inode.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/inode.c
21012 --- linux-2.6.34/kernel/vserver/inode.c 1970-01-01 01:00:00.000000000 +0100
21013 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/inode.c 2010-05-18 18:11:22.000000000 +0200
21016 + * linux/kernel/vserver/inode.c
21018 + * Virtual Server: File System Support
21020 + * Copyright (C) 2004-2007 Herbert Pötzl
21022 + * V0.01 separated from vcontext V0.05
21023 + * V0.02 moved to tag (instead of xid)
21027 +#include <linux/tty.h>
21028 +#include <linux/proc_fs.h>
21029 +#include <linux/devpts_fs.h>
21030 +#include <linux/fs.h>
21031 +#include <linux/file.h>
21032 +#include <linux/mount.h>
21033 +#include <linux/parser.h>
21034 +#include <linux/namei.h>
21035 +#include <linux/vserver/inode.h>
21036 +#include <linux/vserver/inode_cmd.h>
21037 +#include <linux/vs_base.h>
21038 +#include <linux/vs_tag.h>
21040 +#include <asm/uaccess.h>
21043 +static int __vc_get_iattr(struct inode *in, uint32_t *tag, uint32_t *flags, uint32_t *mask)
21045 + struct proc_dir_entry *entry;
21047 + if (!in || !in->i_sb)
21050 + *flags = IATTR_TAG
21051 + | (IS_IMMUTABLE(in) ? IATTR_IMMUTABLE : 0)
21052 + | (IS_IXUNLINK(in) ? IATTR_IXUNLINK : 0)
21053 + | (IS_BARRIER(in) ? IATTR_BARRIER : 0)
21054 + | (IS_COW(in) ? IATTR_COW : 0);
21055 + *mask = IATTR_IXUNLINK | IATTR_IMMUTABLE | IATTR_COW;
21057 + if (S_ISDIR(in->i_mode))
21058 + *mask |= IATTR_BARRIER;
21060 + if (IS_TAGGED(in)) {
21061 + *tag = in->i_tag;
21062 + *mask |= IATTR_TAG;
21065 + switch (in->i_sb->s_magic) {
21066 + case PROC_SUPER_MAGIC:
21067 + entry = PROC_I(in)->pde;
21069 + /* check for specific inodes? */
21071 + *mask |= IATTR_FLAGS;
21073 + *flags |= (entry->vx_flags & IATTR_FLAGS);
21075 + *flags |= (PROC_I(in)->vx_flags & IATTR_FLAGS);
21078 + case DEVPTS_SUPER_MAGIC:
21079 + *tag = in->i_tag;
21080 + *mask |= IATTR_TAG;
21089 +int vc_get_iattr(void __user *data)
21091 + struct path path;
21092 + struct vcmd_ctx_iattr_v1 vc_data = { .tag = -1 };
21095 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21098 + ret = user_lpath(vc_data.name, &path);
21100 + ret = __vc_get_iattr(path.dentry->d_inode,
21101 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21107 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21112 +#ifdef CONFIG_COMPAT
21114 +int vc_get_iattr_x32(void __user *data)
21116 + struct path path;
21117 + struct vcmd_ctx_iattr_v1_x32 vc_data = { .tag = -1 };
21120 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21123 + ret = user_lpath(compat_ptr(vc_data.name_ptr), &path);
21125 + ret = __vc_get_iattr(path.dentry->d_inode,
21126 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21132 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21137 +#endif /* CONFIG_COMPAT */
21140 +int vc_fget_iattr(uint32_t fd, void __user *data)
21142 + struct file *filp;
21143 + struct vcmd_ctx_fiattr_v0 vc_data = { .tag = -1 };
21146 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21150 + if (!filp || !filp->f_dentry || !filp->f_dentry->d_inode)
21153 + ret = __vc_get_iattr(filp->f_dentry->d_inode,
21154 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21158 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21164 +static int __vc_set_iattr(struct dentry *de, uint32_t *tag, uint32_t *flags, uint32_t *mask)
21166 + struct inode *in = de->d_inode;
21167 + int error = 0, is_proc = 0, has_tag = 0;
21168 + struct iattr attr = { 0 };
21170 + if (!in || !in->i_sb)
21173 + is_proc = (in->i_sb->s_magic == PROC_SUPER_MAGIC);
21174 + if ((*mask & IATTR_FLAGS) && !is_proc)
21177 + has_tag = IS_TAGGED(in) ||
21178 + (in->i_sb->s_magic == DEVPTS_SUPER_MAGIC);
21179 + if ((*mask & IATTR_TAG) && !has_tag)
21182 + mutex_lock(&in->i_mutex);
21183 + if (*mask & IATTR_TAG) {
21184 + attr.ia_tag = *tag;
21185 + attr.ia_valid |= ATTR_TAG;
21188 + if (*mask & IATTR_FLAGS) {
21189 + struct proc_dir_entry *entry = PROC_I(in)->pde;
21190 + unsigned int iflags = PROC_I(in)->vx_flags;
21192 + iflags = (iflags & ~(*mask & IATTR_FLAGS))
21193 + | (*flags & IATTR_FLAGS);
21194 + PROC_I(in)->vx_flags = iflags;
21196 + entry->vx_flags = iflags;
21199 + if (*mask & (IATTR_IMMUTABLE | IATTR_IXUNLINK |
21200 + IATTR_BARRIER | IATTR_COW)) {
21201 + int iflags = in->i_flags;
21202 + int vflags = in->i_vflags;
21204 + if (*mask & IATTR_IMMUTABLE) {
21205 + if (*flags & IATTR_IMMUTABLE)
21206 + iflags |= S_IMMUTABLE;
21208 + iflags &= ~S_IMMUTABLE;
21210 + if (*mask & IATTR_IXUNLINK) {
21211 + if (*flags & IATTR_IXUNLINK)
21212 + iflags |= S_IXUNLINK;
21214 + iflags &= ~S_IXUNLINK;
21216 + if (S_ISDIR(in->i_mode) && (*mask & IATTR_BARRIER)) {
21217 + if (*flags & IATTR_BARRIER)
21218 + vflags |= V_BARRIER;
21220 + vflags &= ~V_BARRIER;
21222 + if (S_ISREG(in->i_mode) && (*mask & IATTR_COW)) {
21223 + if (*flags & IATTR_COW)
21226 + vflags &= ~V_COW;
21228 + if (in->i_op && in->i_op->sync_flags) {
21229 + error = in->i_op->sync_flags(in, iflags, vflags);
21235 + if (attr.ia_valid) {
21236 + if (in->i_op && in->i_op->setattr)
21237 + error = in->i_op->setattr(de, &attr);
21239 + error = inode_change_ok(in, &attr);
21241 + error = inode_setattr(in, &attr);
21246 + mutex_unlock(&in->i_mutex);
21250 +int vc_set_iattr(void __user *data)
21252 + struct path path;
21253 + struct vcmd_ctx_iattr_v1 vc_data;
21256 + if (!capable(CAP_LINUX_IMMUTABLE))
21258 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21261 + ret = user_lpath(vc_data.name, &path);
21263 + ret = __vc_set_iattr(path.dentry,
21264 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21268 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21273 +#ifdef CONFIG_COMPAT
21275 +int vc_set_iattr_x32(void __user *data)
21277 + struct path path;
21278 + struct vcmd_ctx_iattr_v1_x32 vc_data;
21281 + if (!capable(CAP_LINUX_IMMUTABLE))
21283 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21286 + ret = user_lpath(compat_ptr(vc_data.name_ptr), &path);
21288 + ret = __vc_set_iattr(path.dentry,
21289 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21293 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21298 +#endif /* CONFIG_COMPAT */
21300 +int vc_fset_iattr(uint32_t fd, void __user *data)
21302 + struct file *filp;
21303 + struct vcmd_ctx_fiattr_v0 vc_data;
21306 + if (!capable(CAP_LINUX_IMMUTABLE))
21308 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21312 + if (!filp || !filp->f_dentry || !filp->f_dentry->d_inode)
21315 + ret = __vc_set_iattr(filp->f_dentry, &vc_data.tag,
21316 + &vc_data.flags, &vc_data.mask);
21320 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21326 +enum { Opt_notagcheck, Opt_tag, Opt_notag, Opt_tagid, Opt_err };
21328 +static match_table_t tokens = {
21329 + {Opt_notagcheck, "notagcheck"},
21330 +#ifdef CONFIG_PROPAGATE
21331 + {Opt_notag, "notag"},
21332 + {Opt_tag, "tag"},
21333 + {Opt_tagid, "tagid=%u"},
21339 +static void __dx_parse_remove(char *string, char *opt)
21341 + char *p = strstr(string, opt);
21345 + while (*q != '\0' && *q != ',')
21354 +int dx_parse_tag(char *string, tag_t *tag, int remove, int *mnt_flags,
21355 + unsigned long *flags)
21358 + substring_t args[MAX_OPT_ARGS];
21359 + int token, option = 0;
21360 + char *s, *p, *opts;
21364 + s = kstrdup(string, GFP_KERNEL | GFP_ATOMIC);
21369 + while ((p = strsep(&opts, ",")) != NULL) {
21370 + token = match_token(p, tokens, args);
21372 + vxdprintk(VXD_CBIT(tag, 7),
21373 + "dx_parse_tag(»%s«): %d:#%d",
21374 + p, token, option);
21377 +#ifdef CONFIG_PROPAGATE
21382 + __dx_parse_remove(s, "tag");
21383 + *mnt_flags |= MNT_TAGID;
21384 + set |= MNT_TAGID;
21388 + __dx_parse_remove(s, "notag");
21389 + *mnt_flags |= MNT_NOTAG;
21390 + set |= MNT_NOTAG;
21393 + if (tag && !match_int(args, &option))
21396 + __dx_parse_remove(s, "tagid");
21397 + *mnt_flags |= MNT_TAGID;
21398 + set |= MNT_TAGID;
21401 + case Opt_notagcheck:
21403 + __dx_parse_remove(s, "notagcheck");
21404 + *flags |= MS_NOTAGCHECK;
21405 + set |= MS_NOTAGCHECK;
21410 + strcpy(string, s);
21415 +#ifdef CONFIG_PROPAGATE
21417 +void __dx_propagate_tag(struct nameidata *nd, struct inode *inode)
21419 + tag_t new_tag = 0;
21420 + struct vfsmount *mnt;
21425 + mnt = nd->path.mnt;
21429 + propagate = (mnt->mnt_flags & MNT_TAGID);
21431 + new_tag = mnt->mnt_tag;
21433 + vxdprintk(VXD_CBIT(tag, 7),
21434 + "dx_propagate_tag(%p[#%lu.%d]): %d,%d",
21435 + inode, inode->i_ino, inode->i_tag,
21436 + new_tag, (propagate) ? 1 : 0);
21439 + inode->i_tag = new_tag;
21442 +#include <linux/module.h>
21444 +EXPORT_SYMBOL_GPL(__dx_propagate_tag);
21446 +#endif /* CONFIG_PROPAGATE */
21448 diff -NurpP --minimal linux-2.6.34/kernel/vserver/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/Kconfig
21449 --- linux-2.6.34/kernel/vserver/Kconfig 1970-01-01 01:00:00.000000000 +0100
21450 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/Kconfig 2010-05-22 00:54:16.000000000 +0200
21453 +# Linux VServer configuration
21456 +menu "Linux VServer"
21458 +config VSERVER_AUTO_LBACK
21459 + bool "Automatically Assign Loopback IP"
21462 + Automatically assign a guest specific loopback
21463 + IP and add it to the kernel network stack on
21466 +config VSERVER_AUTO_SINGLE
21467 + bool "Automatic Single IP Special Casing"
21468 + depends on EXPERIMENTAL
21471 + This allows network contexts with a single IP to
21472 + automatically remap 0.0.0.0 bindings to that IP,
21473 + avoiding further network checks and improving
21476 + (note: such guests do not allow to change the ip
21477 + on the fly and do not show loopback addresses)
21479 +config VSERVER_COWBL
21480 + bool "Enable COW Immutable Link Breaking"
21483 + This enables the COW (Copy-On-Write) link break code.
21484 + It allows you to treat unified files like normal files
21485 + when writing to them (which will implicitely break the
21486 + link and create a copy of the unified file)
21488 +config VSERVER_VTIME
21489 + bool "Enable Virtualized Guest Time"
21490 + depends on EXPERIMENTAL
21493 + This enables per guest time offsets to allow for
21494 + adjusting the system clock individually per guest.
21495 + this adds some overhead to the time functions and
21496 + therefore should not be enabled without good reason.
21498 +config VSERVER_DEVICE
21499 + bool "Enable Guest Device Mapping"
21500 + depends on EXPERIMENTAL
21503 + This enables generic device remapping.
21505 +config VSERVER_PROC_SECURE
21506 + bool "Enable Proc Security"
21507 + depends on PROC_FS
21510 + This configures ProcFS security to initially hide
21511 + non-process entries for all contexts except the main and
21512 + spectator context (i.e. for all guests), which is a secure
21515 + (note: on 1.2x the entries were visible by default)
21517 +config VSERVER_HARDCPU
21518 + bool "Enable Hard CPU Limits"
21521 + Activate the Hard CPU Limits
21523 + This will compile in code that allows the Token Bucket
21524 + Scheduler to put processes on hold when a context's
21525 + tokens are depleted (provided that its per-context
21526 + sched_hard flag is set).
21528 + Processes belonging to that context will not be able
21529 + to consume CPU resources again until a per-context
21530 + configured minimum of tokens has been reached.
21532 +config VSERVER_IDLETIME
21533 + bool "Avoid idle CPUs by skipping Time"
21534 + depends on VSERVER_HARDCPU
21537 + This option allows the scheduler to artificially
21538 + advance time (per cpu) when otherwise the idle
21539 + task would be scheduled, thus keeping the cpu
21540 + busy and sharing the available resources among
21541 + certain contexts.
21543 +config VSERVER_IDLELIMIT
21544 + bool "Limit the IDLE task"
21545 + depends on VSERVER_HARDCPU
21548 + Limit the idle slices, so the the next context
21549 + will be scheduled as soon as possible.
21551 + This might improve interactivity and latency, but
21552 + will also marginally increase scheduling overhead.
21555 + prompt "Persistent Inode Tagging"
21556 + default TAGGING_ID24
21558 + This adds persistent context information to filesystems
21559 + mounted with the tagxid option. Tagging is a requirement
21560 + for per-context disk limits and per-context quota.
21563 +config TAGGING_NONE
21566 + do not store per-context information in inodes.
21568 +config TAGGING_UID16
21569 + bool "UID16/GID32"
21571 + reduces UID to 16 bit, but leaves GID at 32 bit.
21573 +config TAGGING_GID16
21574 + bool "UID32/GID16"
21576 + reduces GID to 16 bit, but leaves UID at 32 bit.
21578 +config TAGGING_ID24
21579 + bool "UID24/GID24"
21581 + uses the upper 8bit from UID and GID for XID tagging
21582 + which leaves 24bit for UID/GID each, which should be
21583 + more than sufficient for normal use.
21585 +config TAGGING_INTERN
21586 + bool "UID32/GID32"
21588 + this uses otherwise reserved inode fields in the on
21589 + disk representation, which limits the use to a few
21590 + filesystems (currently ext2 and ext3)
21595 + bool "Tag NFSD User Auth and Files"
21598 + Enable this if you do want the in-kernel NFS
21599 + Server to use the tagging specified above.
21600 + (will require patched clients too)
21602 +config VSERVER_PRIVACY
21603 + bool "Honor Privacy Aspects of Guests"
21606 + When enabled, most context checks will disallow
21607 + access to structures assigned to a specific context,
21608 + like ptys or loop devices.
21610 +config VSERVER_CONTEXTS
21611 + int "Maximum number of Contexts (1-65533)" if EMBEDDED
21613 + default "768" if 64BIT
21616 + This setting will optimize certain data structures
21617 + and memory allocations according to the expected
21620 + note: this is not a strict upper limit.
21622 +config VSERVER_WARN
21623 + bool "VServer Warnings"
21626 + This enables various runtime warnings, which will
21627 + notify about potential manipulation attempts or
21628 + resource shortage. It is generally considered to
21629 + be a good idea to have that enabled.
21631 +config VSERVER_DEBUG
21632 + bool "VServer Debugging Code"
21635 + Set this to yes if you want to be able to activate
21636 + debugging output at runtime. It adds a very small
21637 + overhead to all vserver related functions and
21638 + increases the kernel size by about 20k.
21640 +config VSERVER_HISTORY
21641 + bool "VServer History Tracing"
21642 + depends on VSERVER_DEBUG
21645 + Set this to yes if you want to record the history of
21646 + linux-vserver activities, so they can be replayed in
21647 + the event of a kernel panic or oops.
21649 +config VSERVER_HISTORY_SIZE
21650 + int "Per-CPU History Size (32-65536)"
21651 + depends on VSERVER_HISTORY
21655 + This allows you to specify the number of entries in
21656 + the per-CPU history buffer.
21658 +config VSERVER_MONITOR
21659 + bool "VServer Scheduling Monitor"
21660 + depends on VSERVER_DISABLED
21663 + Set this to yes if you want to record the scheduling
21664 + decisions, so that they can be relayed to userspace
21665 + for detailed analysis.
21667 +config VSERVER_MONITOR_SIZE
21668 + int "Per-CPU Monitor Queue Size (32-65536)"
21669 + depends on VSERVER_MONITOR
21673 + This allows you to specify the number of entries in
21674 + the per-CPU scheduling monitor buffer.
21676 +config VSERVER_MONITOR_SYNC
21677 + int "Per-CPU Monitor Sync Interval (0-65536)"
21678 + depends on VSERVER_MONITOR
21682 + This allows you to specify the interval in ticks
21683 + when a time sync entry is inserted.
21685 +config VSERVER_LEGACY_MEM
21686 + bool "Legacy Memory Limits"
21689 + This provides fake memory limits to keep
21690 + older tools happy in the face of memory
21700 + select NAMESPACES
21706 +config VSERVER_SECURITY
21708 + depends on SECURITY
21710 + select SECURITY_CAPABILITIES
21712 diff -NurpP --minimal linux-2.6.34/kernel/vserver/limit.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/limit.c
21713 --- linux-2.6.34/kernel/vserver/limit.c 1970-01-01 01:00:00.000000000 +0100
21714 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/limit.c 2010-05-22 00:52:02.000000000 +0200
21717 + * linux/kernel/vserver/limit.c
21719 + * Virtual Server: Context Limits
21721 + * Copyright (C) 2004-2010 Herbert Pötzl
21723 + * V0.01 broken out from vcontext V0.05
21724 + * V0.02 changed vcmds to vxi arg
21725 + * V0.03 added memory cgroup support
21729 +#include <linux/sched.h>
21730 +#include <linux/module.h>
21731 +#include <linux/memcontrol.h>
21732 +#include <linux/res_counter.h>
21733 +#include <linux/vs_limit.h>
21734 +#include <linux/vserver/limit.h>
21735 +#include <linux/vserver/limit_cmd.h>
21737 +#include <asm/uaccess.h>
21740 +const char *vlimit_name[NUM_LIMITS] = {
21741 +#ifdef CONFIG_VSERVER_LEGACY_MEM
21742 + [RLIMIT_RSS] = "RSS",
21743 + [RLIMIT_AS] = "VM",
21744 +#endif /* CONFIG_VSERVER_LEGACY_MEM */
21745 + [RLIMIT_CPU] = "CPU",
21746 + [RLIMIT_NPROC] = "NPROC",
21747 + [RLIMIT_NOFILE] = "NOFILE",
21748 + [RLIMIT_LOCKS] = "LOCKS",
21749 + [RLIMIT_SIGPENDING] = "SIGP",
21750 + [RLIMIT_MSGQUEUE] = "MSGQ",
21752 + [VLIMIT_NSOCK] = "NSOCK",
21753 + [VLIMIT_OPENFD] = "OPENFD",
21754 + [VLIMIT_SHMEM] = "SHMEM",
21755 + [VLIMIT_DENTRY] = "DENTRY",
21758 +EXPORT_SYMBOL_GPL(vlimit_name);
21760 +#define MASK_ENTRY(x) (1 << (x))
21762 +const struct vcmd_ctx_rlimit_mask_v0 vlimit_mask = {
21765 + , /* softlimit */
21766 +#ifdef CONFIG_VSERVER_LEGACY_MEM
21767 + MASK_ENTRY( RLIMIT_RSS ) |
21768 +#endif /* CONFIG_VSERVER_LEGACY_MEM */
21771 +#ifdef CONFIG_VSERVER_LEGACY_MEM
21772 + MASK_ENTRY( RLIMIT_RSS ) |
21773 + MASK_ENTRY( RLIMIT_AS ) |
21774 +#endif /* CONFIG_VSERVER_LEGACY_MEM */
21775 + MASK_ENTRY( RLIMIT_NPROC ) |
21776 + MASK_ENTRY( RLIMIT_NOFILE ) |
21777 + MASK_ENTRY( RLIMIT_LOCKS ) |
21778 + MASK_ENTRY( RLIMIT_MSGQUEUE ) |
21780 + MASK_ENTRY( VLIMIT_NSOCK ) |
21781 + MASK_ENTRY( VLIMIT_OPENFD ) |
21782 + MASK_ENTRY( VLIMIT_SHMEM ) |
21783 + MASK_ENTRY( VLIMIT_DENTRY ) |
21786 + /* accounting only */
21787 +uint32_t account_mask =
21788 + MASK_ENTRY( VLIMIT_SEMARY ) |
21789 + MASK_ENTRY( VLIMIT_NSEMS ) |
21790 + MASK_ENTRY( VLIMIT_MAPPED ) |
21794 +static int is_valid_vlimit(int id)
21796 + uint32_t mask = vlimit_mask.minimum |
21797 + vlimit_mask.softlimit | vlimit_mask.maximum;
21798 + return mask & (1 << id);
21801 +static int is_accounted_vlimit(int id)
21803 + if (is_valid_vlimit(id))
21805 + return account_mask & (1 << id);
21809 +static inline uint64_t vc_get_soft(struct vx_info *vxi, int id)
21811 + rlim_t limit = __rlim_soft(&vxi->limit, id);
21812 + return VX_VLIM(limit);
21815 +static inline uint64_t vc_get_hard(struct vx_info *vxi, int id)
21817 + rlim_t limit = __rlim_hard(&vxi->limit, id);
21818 + return VX_VLIM(limit);
21821 +static int do_get_rlimit(struct vx_info *vxi, uint32_t id,
21822 + uint64_t *minimum, uint64_t *softlimit, uint64_t *maximum)
21824 + if (!is_valid_vlimit(id))
21828 + *minimum = CRLIM_UNSET;
21830 + *softlimit = vc_get_soft(vxi, id);
21832 + *maximum = vc_get_hard(vxi, id);
21836 +int vc_get_rlimit(struct vx_info *vxi, void __user *data)
21838 + struct vcmd_ctx_rlimit_v0 vc_data;
21841 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21844 + ret = do_get_rlimit(vxi, vc_data.id,
21845 + &vc_data.minimum, &vc_data.softlimit, &vc_data.maximum);
21849 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21854 +static int do_set_rlimit(struct vx_info *vxi, uint32_t id,
21855 + uint64_t minimum, uint64_t softlimit, uint64_t maximum)
21857 + if (!is_valid_vlimit(id))
21860 + if (maximum != CRLIM_KEEP)
21861 + __rlim_hard(&vxi->limit, id) = VX_RLIM(maximum);
21862 + if (softlimit != CRLIM_KEEP)
21863 + __rlim_soft(&vxi->limit, id) = VX_RLIM(softlimit);
21865 + /* clamp soft limit */
21866 + if (__rlim_soft(&vxi->limit, id) > __rlim_hard(&vxi->limit, id))
21867 + __rlim_soft(&vxi->limit, id) = __rlim_hard(&vxi->limit, id);
21872 +int vc_set_rlimit(struct vx_info *vxi, void __user *data)
21874 + struct vcmd_ctx_rlimit_v0 vc_data;
21876 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21879 + return do_set_rlimit(vxi, vc_data.id,
21880 + vc_data.minimum, vc_data.softlimit, vc_data.maximum);
21883 +#ifdef CONFIG_IA32_EMULATION
21885 +int vc_set_rlimit_x32(struct vx_info *vxi, void __user *data)
21887 + struct vcmd_ctx_rlimit_v0_x32 vc_data;
21889 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21892 + return do_set_rlimit(vxi, vc_data.id,
21893 + vc_data.minimum, vc_data.softlimit, vc_data.maximum);
21896 +int vc_get_rlimit_x32(struct vx_info *vxi, void __user *data)
21898 + struct vcmd_ctx_rlimit_v0_x32 vc_data;
21901 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21904 + ret = do_get_rlimit(vxi, vc_data.id,
21905 + &vc_data.minimum, &vc_data.softlimit, &vc_data.maximum);
21909 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21914 +#endif /* CONFIG_IA32_EMULATION */
21917 +int vc_get_rlimit_mask(uint32_t id, void __user *data)
21919 + if (copy_to_user(data, &vlimit_mask, sizeof(vlimit_mask)))
21925 +static inline void vx_reset_hits(struct _vx_limit *limit)
21929 + for (lim = 0; lim < NUM_LIMITS; lim++) {
21930 + atomic_set(&__rlim_lhit(limit, lim), 0);
21934 +int vc_reset_hits(struct vx_info *vxi, void __user *data)
21936 + vx_reset_hits(&vxi->limit);
21940 +static inline void vx_reset_minmax(struct _vx_limit *limit)
21945 + for (lim = 0; lim < NUM_LIMITS; lim++) {
21946 + value = __rlim_get(limit, lim);
21947 + __rlim_rmax(limit, lim) = value;
21948 + __rlim_rmin(limit, lim) = value;
21952 +int vc_reset_minmax(struct vx_info *vxi, void __user *data)
21954 + vx_reset_minmax(&vxi->limit);
21959 +int vc_rlimit_stat(struct vx_info *vxi, void __user *data)
21961 + struct vcmd_rlimit_stat_v0 vc_data;
21962 + struct _vx_limit *limit = &vxi->limit;
21965 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21969 + if (!is_accounted_vlimit(id))
21972 + vx_limit_fixup(limit, id);
21973 + vc_data.hits = atomic_read(&__rlim_lhit(limit, id));
21974 + vc_data.value = __rlim_get(limit, id);
21975 + vc_data.minimum = __rlim_rmin(limit, id);
21976 + vc_data.maximum = __rlim_rmax(limit, id);
21978 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21984 +void vx_vsi_meminfo(struct sysinfo *val)
21986 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
21987 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
21988 + u64 res_limit, res_usage;
21993 + res_limit = mem_cgroup_res_read_u64(mcg, RES_LIMIT);
21994 + res_usage = mem_cgroup_res_read_u64(mcg, RES_USAGE);
21996 + if (res_limit != RESOURCE_MAX)
21997 + val->totalram = (res_limit >> PAGE_SHIFT);
21998 + val->freeram = val->totalram - (res_usage >> PAGE_SHIFT);
21999 + val->bufferram = 0;
22000 + val->totalhigh = 0;
22001 + val->freehigh = 0;
22002 +#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
22006 +void vx_vsi_swapinfo(struct sysinfo *val)
22008 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22009 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
22010 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22011 + u64 res_limit, res_usage, memsw_limit, memsw_usage;
22012 + s64 swap_limit, swap_usage;
22017 + res_limit = mem_cgroup_res_read_u64(mcg, RES_LIMIT);
22018 + res_usage = mem_cgroup_res_read_u64(mcg, RES_USAGE);
22019 + memsw_limit = mem_cgroup_memsw_read_u64(mcg, RES_LIMIT);
22020 + memsw_usage = mem_cgroup_memsw_read_u64(mcg, RES_USAGE);
22022 + if (res_limit == RESOURCE_MAX)
22025 + swap_limit = memsw_limit - res_limit;
22026 + if (memsw_limit != RESOURCE_MAX)
22027 + val->totalswap = swap_limit >> PAGE_SHIFT;
22029 + swap_usage = memsw_usage - res_usage;
22030 + val->freeswap = (swap_usage < swap_limit) ?
22031 + val->totalswap - (swap_usage >> PAGE_SHIFT) : 0;
22032 +#else /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
22033 + val->totalswap = 0;
22034 + val->freeswap = 0;
22035 +#endif /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
22036 +#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
22040 +long vx_vsi_cached(struct sysinfo *val)
22042 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22043 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22045 + return mem_cgroup_stat_read_cache(mcg);
22052 +unsigned long vx_badness(struct task_struct *task, struct mm_struct *mm)
22054 + struct vx_info *vxi = mm->mm_vx_info;
22055 + unsigned long points;
22061 + points = vxi->vx_badness_bias;
22063 + v = __vx_cres_array_fixup(&vxi->limit, VLA_RSS);
22064 + w = __rlim_soft(&vxi->limit, RLIMIT_RSS);
22065 + points += (v > w) ? (v - w) : 0;
22070 diff -NurpP --minimal linux-2.6.34/kernel/vserver/limit_init.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/limit_init.h
22071 --- linux-2.6.34/kernel/vserver/limit_init.h 1970-01-01 01:00:00.000000000 +0100
22072 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/limit_init.h 2010-05-18 18:11:22.000000000 +0200
22076 +static inline void vx_info_init_limit(struct _vx_limit *limit)
22080 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22081 + __rlim_soft(limit, lim) = RLIM_INFINITY;
22082 + __rlim_hard(limit, lim) = RLIM_INFINITY;
22083 + __rlim_set(limit, lim, 0);
22084 + atomic_set(&__rlim_lhit(limit, lim), 0);
22085 + __rlim_rmin(limit, lim) = 0;
22086 + __rlim_rmax(limit, lim) = 0;
22090 +static inline void vx_info_exit_limit(struct _vx_limit *limit)
22095 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22096 + if ((1 << lim) & VLIM_NOCHECK)
22098 + value = __rlim_get(limit, lim);
22099 + vxwprintk_xid(value,
22100 + "!!! limit: %p[%s,%d] = %ld on exit.",
22101 + limit, vlimit_name[lim], lim, (long)value);
22105 diff -NurpP --minimal linux-2.6.34/kernel/vserver/limit_proc.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/limit_proc.h
22106 --- linux-2.6.34/kernel/vserver/limit_proc.h 1970-01-01 01:00:00.000000000 +0100
22107 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/limit_proc.h 2010-05-18 18:11:22.000000000 +0200
22109 +#ifndef _VX_LIMIT_PROC_H
22110 +#define _VX_LIMIT_PROC_H
22112 +#include <linux/vserver/limit_int.h>
22115 +#define VX_LIMIT_FMT ":\t%8ld\t%8ld/%8ld\t%8lld/%8lld\t%6d\n"
22116 +#define VX_LIMIT_TOP \
22117 + "Limit\t current\t min/max\t\t soft/hard\t\thits\n"
22119 +#define VX_LIMIT_ARG(r) \
22120 + (unsigned long)__rlim_get(limit, r), \
22121 + (unsigned long)__rlim_rmin(limit, r), \
22122 + (unsigned long)__rlim_rmax(limit, r), \
22123 + VX_VLIM(__rlim_soft(limit, r)), \
22124 + VX_VLIM(__rlim_hard(limit, r)), \
22125 + atomic_read(&__rlim_lhit(limit, r))
22127 +static inline int vx_info_proc_limit(struct _vx_limit *limit, char *buffer)
22129 + vx_limit_fixup(limit, -1);
22130 + return sprintf(buffer, VX_LIMIT_TOP
22131 + "PROC" VX_LIMIT_FMT
22132 + "VM" VX_LIMIT_FMT
22133 + "VML" VX_LIMIT_FMT
22134 + "RSS" VX_LIMIT_FMT
22135 + "ANON" VX_LIMIT_FMT
22136 + "RMAP" VX_LIMIT_FMT
22137 + "FILES" VX_LIMIT_FMT
22138 + "OFD" VX_LIMIT_FMT
22139 + "LOCKS" VX_LIMIT_FMT
22140 + "SOCK" VX_LIMIT_FMT
22141 + "MSGQ" VX_LIMIT_FMT
22142 + "SHM" VX_LIMIT_FMT
22143 + "SEMA" VX_LIMIT_FMT
22144 + "SEMS" VX_LIMIT_FMT
22145 + "DENT" VX_LIMIT_FMT,
22146 + VX_LIMIT_ARG(RLIMIT_NPROC),
22147 + VX_LIMIT_ARG(RLIMIT_AS),
22148 + VX_LIMIT_ARG(RLIMIT_MEMLOCK),
22149 + VX_LIMIT_ARG(RLIMIT_RSS),
22150 + VX_LIMIT_ARG(VLIMIT_ANON),
22151 + VX_LIMIT_ARG(VLIMIT_MAPPED),
22152 + VX_LIMIT_ARG(RLIMIT_NOFILE),
22153 + VX_LIMIT_ARG(VLIMIT_OPENFD),
22154 + VX_LIMIT_ARG(RLIMIT_LOCKS),
22155 + VX_LIMIT_ARG(VLIMIT_NSOCK),
22156 + VX_LIMIT_ARG(RLIMIT_MSGQUEUE),
22157 + VX_LIMIT_ARG(VLIMIT_SHMEM),
22158 + VX_LIMIT_ARG(VLIMIT_SEMARY),
22159 + VX_LIMIT_ARG(VLIMIT_NSEMS),
22160 + VX_LIMIT_ARG(VLIMIT_DENTRY));
22163 +#endif /* _VX_LIMIT_PROC_H */
22166 diff -NurpP --minimal linux-2.6.34/kernel/vserver/Makefile linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/Makefile
22167 --- linux-2.6.34/kernel/vserver/Makefile 1970-01-01 01:00:00.000000000 +0100
22168 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/Makefile 2010-05-18 18:11:22.000000000 +0200
22171 +# Makefile for the Linux vserver routines.
22175 +obj-y += vserver.o
22177 +vserver-y := switch.o context.o space.o sched.o network.o inode.o \
22178 + limit.o cvirt.o cacct.o signal.o helper.o init.o \
22181 +vserver-$(CONFIG_INET) += inet.o
22182 +vserver-$(CONFIG_PROC_FS) += proc.o
22183 +vserver-$(CONFIG_VSERVER_DEBUG) += sysctl.o debug.o
22184 +vserver-$(CONFIG_VSERVER_HISTORY) += history.o
22185 +vserver-$(CONFIG_VSERVER_MONITOR) += monitor.o
22186 +vserver-$(CONFIG_VSERVER_DEVICE) += device.o
22188 diff -NurpP --minimal linux-2.6.34/kernel/vserver/monitor.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/monitor.c
22189 --- linux-2.6.34/kernel/vserver/monitor.c 1970-01-01 01:00:00.000000000 +0100
22190 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/monitor.c 2010-05-18 18:11:22.000000000 +0200
22193 + * kernel/vserver/monitor.c
22195 + * Virtual Context Scheduler Monitor
22197 + * Copyright (C) 2006-2007 Herbert Pötzl
22199 + * V0.01 basic design
22203 +#include <linux/module.h>
22204 +#include <linux/jiffies.h>
22205 +#include <asm/uaccess.h>
22206 +#include <asm/atomic.h>
22208 +#include <linux/vserver/monitor.h>
22209 +#include <linux/vserver/debug_cmd.h>
22212 +#ifdef CONFIG_VSERVER_MONITOR
22213 +#define VXM_SIZE CONFIG_VSERVER_MONITOR_SIZE
22215 +#define VXM_SIZE 64
22218 +struct _vx_monitor {
22219 + unsigned int counter;
22221 + struct _vx_mon_entry entry[VXM_SIZE+1];
22225 +DEFINE_PER_CPU(struct _vx_monitor, vx_monitor_buffer);
22227 +unsigned volatile int vxm_active = 1;
22229 +static atomic_t sequence = ATOMIC_INIT(0);
22234 + * requires disabled preemption */
22236 +struct _vx_mon_entry *vxm_advance(int cpu)
22238 + struct _vx_monitor *mon = &per_cpu(vx_monitor_buffer, cpu);
22239 + struct _vx_mon_entry *entry;
22240 + unsigned int index;
22242 + index = vxm_active ? (mon->counter++ % VXM_SIZE) : VXM_SIZE;
22243 + entry = &mon->entry[index];
22245 + entry->ev.seq = atomic_inc_return(&sequence);
22246 + entry->ev.jif = jiffies;
22250 +EXPORT_SYMBOL_GPL(vxm_advance);
22253 +int do_read_monitor(struct __user _vx_mon_entry *data,
22254 + int cpu, uint32_t *index, uint32_t *count)
22256 + int pos, ret = 0;
22257 + struct _vx_monitor *mon = &per_cpu(vx_monitor_buffer, cpu);
22258 + int end = mon->counter;
22259 + int start = end - VXM_SIZE + 2;
22260 + int idx = *index;
22262 + /* special case: get current pos */
22268 + /* have we lost some data? */
22272 + for (pos = 0; (pos < *count) && (idx < end); pos++, idx++) {
22273 + struct _vx_mon_entry *entry =
22274 + &mon->entry[idx % VXM_SIZE];
22276 + /* send entry to userspace */
22277 + ret = copy_to_user(&data[pos], entry, sizeof(*entry));
22281 + /* save new index and count */
22284 + return ret ? ret : (*index < end);
22287 +int vc_read_monitor(uint32_t id, void __user *data)
22289 + struct vcmd_read_monitor_v0 vc_data;
22292 + if (id >= NR_CPUS)
22295 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22298 + ret = do_read_monitor((struct __user _vx_mon_entry *)vc_data.data,
22299 + id, &vc_data.index, &vc_data.count);
22301 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22306 +#ifdef CONFIG_COMPAT
22308 +int vc_read_monitor_x32(uint32_t id, void __user *data)
22310 + struct vcmd_read_monitor_v0_x32 vc_data;
22313 + if (id >= NR_CPUS)
22316 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22319 + ret = do_read_monitor((struct __user _vx_mon_entry *)
22320 + compat_ptr(vc_data.data_ptr),
22321 + id, &vc_data.index, &vc_data.count);
22323 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22328 +#endif /* CONFIG_COMPAT */
22330 diff -NurpP --minimal linux-2.6.34/kernel/vserver/network.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/network.c
22331 --- linux-2.6.34/kernel/vserver/network.c 1970-01-01 01:00:00.000000000 +0100
22332 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/network.c 2010-05-18 18:11:22.000000000 +0200
22335 + * linux/kernel/vserver/network.c
22337 + * Virtual Server: Network Support
22339 + * Copyright (C) 2003-2007 Herbert Pötzl
22341 + * V0.01 broken out from vcontext V0.05
22342 + * V0.02 cleaned up implementation
22343 + * V0.03 added equiv nx commands
22344 + * V0.04 switch to RCU based hash
22345 + * V0.05 and back to locking again
22346 + * V0.06 changed vcmds to nxi arg
22347 + * V0.07 have __create claim() the nxi
22351 +#include <linux/err.h>
22352 +#include <linux/slab.h>
22353 +#include <linux/rcupdate.h>
22355 +#include <linux/vs_network.h>
22356 +#include <linux/vs_pid.h>
22357 +#include <linux/vserver/network_cmd.h>
22360 +atomic_t nx_global_ctotal = ATOMIC_INIT(0);
22361 +atomic_t nx_global_cactive = ATOMIC_INIT(0);
22363 +static struct kmem_cache *nx_addr_v4_cachep = NULL;
22364 +static struct kmem_cache *nx_addr_v6_cachep = NULL;
22367 +static int __init init_network(void)
22369 + nx_addr_v4_cachep = kmem_cache_create("nx_v4_addr_cache",
22370 + sizeof(struct nx_addr_v4), 0,
22371 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
22372 + nx_addr_v6_cachep = kmem_cache_create("nx_v6_addr_cache",
22373 + sizeof(struct nx_addr_v6), 0,
22374 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
22379 +/* __alloc_nx_addr_v4() */
22381 +static inline struct nx_addr_v4 *__alloc_nx_addr_v4(void)
22383 + struct nx_addr_v4 *nxa = kmem_cache_alloc(
22384 + nx_addr_v4_cachep, GFP_KERNEL);
22386 + if (!IS_ERR(nxa))
22387 + memset(nxa, 0, sizeof(*nxa));
22391 +/* __dealloc_nx_addr_v4() */
22393 +static inline void __dealloc_nx_addr_v4(struct nx_addr_v4 *nxa)
22395 + kmem_cache_free(nx_addr_v4_cachep, nxa);
22398 +/* __dealloc_nx_addr_v4_all() */
22400 +static inline void __dealloc_nx_addr_v4_all(struct nx_addr_v4 *nxa)
22403 + struct nx_addr_v4 *next = nxa->next;
22405 + __dealloc_nx_addr_v4(nxa);
22411 +#ifdef CONFIG_IPV6
22413 +/* __alloc_nx_addr_v6() */
22415 +static inline struct nx_addr_v6 *__alloc_nx_addr_v6(void)
22417 + struct nx_addr_v6 *nxa = kmem_cache_alloc(
22418 + nx_addr_v6_cachep, GFP_KERNEL);
22420 + if (!IS_ERR(nxa))
22421 + memset(nxa, 0, sizeof(*nxa));
22425 +/* __dealloc_nx_addr_v6() */
22427 +static inline void __dealloc_nx_addr_v6(struct nx_addr_v6 *nxa)
22429 + kmem_cache_free(nx_addr_v6_cachep, nxa);
22432 +/* __dealloc_nx_addr_v6_all() */
22434 +static inline void __dealloc_nx_addr_v6_all(struct nx_addr_v6 *nxa)
22437 + struct nx_addr_v6 *next = nxa->next;
22439 + __dealloc_nx_addr_v6(nxa);
22444 +#endif /* CONFIG_IPV6 */
22446 +/* __alloc_nx_info()
22448 + * allocate an initialized nx_info struct
22449 + * doesn't make it visible (hash) */
22451 +static struct nx_info *__alloc_nx_info(nid_t nid)
22453 + struct nx_info *new = NULL;
22455 + vxdprintk(VXD_CBIT(nid, 1), "alloc_nx_info(%d)*", nid);
22457 + /* would this benefit from a slab cache? */
22458 + new = kmalloc(sizeof(struct nx_info), GFP_KERNEL);
22462 + memset(new, 0, sizeof(struct nx_info));
22463 + new->nx_id = nid;
22464 + INIT_HLIST_NODE(&new->nx_hlist);
22465 + atomic_set(&new->nx_usecnt, 0);
22466 + atomic_set(&new->nx_tasks, 0);
22467 + new->nx_state = 0;
22469 + new->nx_flags = NXF_INIT_SET;
22471 + /* rest of init goes here */
22473 + new->v4_lback.s_addr = htonl(INADDR_LOOPBACK);
22474 + new->v4_bcast.s_addr = htonl(INADDR_BROADCAST);
22476 + vxdprintk(VXD_CBIT(nid, 0),
22477 + "alloc_nx_info(%d) = %p", nid, new);
22478 + atomic_inc(&nx_global_ctotal);
22482 +/* __dealloc_nx_info()
22484 + * final disposal of nx_info */
22486 +static void __dealloc_nx_info(struct nx_info *nxi)
22488 + vxdprintk(VXD_CBIT(nid, 0),
22489 + "dealloc_nx_info(%p)", nxi);
22491 + nxi->nx_hlist.next = LIST_POISON1;
22494 + BUG_ON(atomic_read(&nxi->nx_usecnt));
22495 + BUG_ON(atomic_read(&nxi->nx_tasks));
22497 + __dealloc_nx_addr_v4_all(nxi->v4.next);
22499 + nxi->nx_state |= NXS_RELEASED;
22501 + atomic_dec(&nx_global_ctotal);
22504 +static void __shutdown_nx_info(struct nx_info *nxi)
22506 + nxi->nx_state |= NXS_SHUTDOWN;
22507 + vs_net_change(nxi, VSC_NETDOWN);
22510 +/* exported stuff */
22512 +void free_nx_info(struct nx_info *nxi)
22514 + /* context shutdown is mandatory */
22515 + BUG_ON(nxi->nx_state != NXS_SHUTDOWN);
22517 + /* context must not be hashed */
22518 + BUG_ON(nxi->nx_state & NXS_HASHED);
22520 + BUG_ON(atomic_read(&nxi->nx_usecnt));
22521 + BUG_ON(atomic_read(&nxi->nx_tasks));
22523 + __dealloc_nx_info(nxi);
22527 +void __nx_set_lback(struct nx_info *nxi)
22529 + int nid = nxi->nx_id;
22530 + __be32 lback = htonl(INADDR_LOOPBACK ^ ((nid & 0xFFFF) << 8));
22532 + nxi->v4_lback.s_addr = lback;
22535 +extern int __nx_inet_add_lback(__be32 addr);
22536 +extern int __nx_inet_del_lback(__be32 addr);
22539 +/* hash table for nx_info hash */
22541 +#define NX_HASH_SIZE 13
22543 +struct hlist_head nx_info_hash[NX_HASH_SIZE];
22545 +static spinlock_t nx_info_hash_lock = SPIN_LOCK_UNLOCKED;
22548 +static inline unsigned int __hashval(nid_t nid)
22550 + return (nid % NX_HASH_SIZE);
22555 +/* __hash_nx_info()
22557 + * add the nxi to the global hash table
22558 + * requires the hash_lock to be held */
22560 +static inline void __hash_nx_info(struct nx_info *nxi)
22562 + struct hlist_head *head;
22564 + vxd_assert_lock(&nx_info_hash_lock);
22565 + vxdprintk(VXD_CBIT(nid, 4),
22566 + "__hash_nx_info: %p[#%d]", nxi, nxi->nx_id);
22568 + /* context must not be hashed */
22569 + BUG_ON(nx_info_state(nxi, NXS_HASHED));
22571 + nxi->nx_state |= NXS_HASHED;
22572 + head = &nx_info_hash[__hashval(nxi->nx_id)];
22573 + hlist_add_head(&nxi->nx_hlist, head);
22574 + atomic_inc(&nx_global_cactive);
22577 +/* __unhash_nx_info()
22579 + * remove the nxi from the global hash table
22580 + * requires the hash_lock to be held */
22582 +static inline void __unhash_nx_info(struct nx_info *nxi)
22584 + vxd_assert_lock(&nx_info_hash_lock);
22585 + vxdprintk(VXD_CBIT(nid, 4),
22586 + "__unhash_nx_info: %p[#%d.%d.%d]", nxi, nxi->nx_id,
22587 + atomic_read(&nxi->nx_usecnt), atomic_read(&nxi->nx_tasks));
22589 + /* context must be hashed */
22590 + BUG_ON(!nx_info_state(nxi, NXS_HASHED));
22591 + /* but without tasks */
22592 + BUG_ON(atomic_read(&nxi->nx_tasks));
22594 + nxi->nx_state &= ~NXS_HASHED;
22595 + hlist_del(&nxi->nx_hlist);
22596 + atomic_dec(&nx_global_cactive);
22600 +/* __lookup_nx_info()
22602 + * requires the hash_lock to be held
22603 + * doesn't increment the nx_refcnt */
22605 +static inline struct nx_info *__lookup_nx_info(nid_t nid)
22607 + struct hlist_head *head = &nx_info_hash[__hashval(nid)];
22608 + struct hlist_node *pos;
22609 + struct nx_info *nxi;
22611 + vxd_assert_lock(&nx_info_hash_lock);
22612 + hlist_for_each(pos, head) {
22613 + nxi = hlist_entry(pos, struct nx_info, nx_hlist);
22615 + if (nxi->nx_id == nid)
22620 + vxdprintk(VXD_CBIT(nid, 0),
22621 + "__lookup_nx_info(#%u): %p[#%u]",
22622 + nid, nxi, nxi ? nxi->nx_id : 0);
22627 +/* __create_nx_info()
22629 + * create the requested context
22630 + * get(), claim() and hash it */
22632 +static struct nx_info *__create_nx_info(int id)
22634 + struct nx_info *new, *nxi = NULL;
22636 + vxdprintk(VXD_CBIT(nid, 1), "create_nx_info(%d)*", id);
22638 + if (!(new = __alloc_nx_info(id)))
22639 + return ERR_PTR(-ENOMEM);
22641 + /* required to make dynamic xids unique */
22642 + spin_lock(&nx_info_hash_lock);
22644 + /* static context requested */
22645 + if ((nxi = __lookup_nx_info(id))) {
22646 + vxdprintk(VXD_CBIT(nid, 0),
22647 + "create_nx_info(%d) = %p (already there)", id, nxi);
22648 + if (nx_info_flags(nxi, NXF_STATE_SETUP, 0))
22649 + nxi = ERR_PTR(-EBUSY);
22651 + nxi = ERR_PTR(-EEXIST);
22654 + /* new context */
22655 + vxdprintk(VXD_CBIT(nid, 0),
22656 + "create_nx_info(%d) = %p (new)", id, new);
22657 + claim_nx_info(new, NULL);
22658 + __nx_set_lback(new);
22659 + __hash_nx_info(get_nx_info(new));
22660 + nxi = new, new = NULL;
22663 + spin_unlock(&nx_info_hash_lock);
22665 + __dealloc_nx_info(new);
22671 +/* exported stuff */
22674 +void unhash_nx_info(struct nx_info *nxi)
22676 + __shutdown_nx_info(nxi);
22677 + spin_lock(&nx_info_hash_lock);
22678 + __unhash_nx_info(nxi);
22679 + spin_unlock(&nx_info_hash_lock);
22682 +/* lookup_nx_info()
22684 + * search for a nx_info and get() it
22685 + * negative id means current */
22687 +struct nx_info *lookup_nx_info(int id)
22689 + struct nx_info *nxi = NULL;
22692 + nxi = get_nx_info(current_nx_info());
22693 + } else if (id > 1) {
22694 + spin_lock(&nx_info_hash_lock);
22695 + nxi = get_nx_info(__lookup_nx_info(id));
22696 + spin_unlock(&nx_info_hash_lock);
22701 +/* nid_is_hashed()
22703 + * verify that nid is still hashed */
22705 +int nid_is_hashed(nid_t nid)
22709 + spin_lock(&nx_info_hash_lock);
22710 + hashed = (__lookup_nx_info(nid) != NULL);
22711 + spin_unlock(&nx_info_hash_lock);
22716 +#ifdef CONFIG_PROC_FS
22720 + * get a subset of hashed nids for proc
22721 + * assumes size is at least one */
22723 +int get_nid_list(int index, unsigned int *nids, int size)
22725 + int hindex, nr_nids = 0;
22727 + /* only show current and children */
22728 + if (!nx_check(0, VS_ADMIN | VS_WATCH)) {
22731 + nids[nr_nids] = nx_current_nid();
22735 + for (hindex = 0; hindex < NX_HASH_SIZE; hindex++) {
22736 + struct hlist_head *head = &nx_info_hash[hindex];
22737 + struct hlist_node *pos;
22739 + spin_lock(&nx_info_hash_lock);
22740 + hlist_for_each(pos, head) {
22741 + struct nx_info *nxi;
22746 + nxi = hlist_entry(pos, struct nx_info, nx_hlist);
22747 + nids[nr_nids] = nxi->nx_id;
22748 + if (++nr_nids >= size) {
22749 + spin_unlock(&nx_info_hash_lock);
22753 + /* keep the lock time short */
22754 + spin_unlock(&nx_info_hash_lock);
22763 + * migrate task to new network
22764 + * gets nxi, puts old_nxi on change
22767 +int nx_migrate_task(struct task_struct *p, struct nx_info *nxi)
22769 + struct nx_info *old_nxi;
22775 + vxdprintk(VXD_CBIT(nid, 5),
22776 + "nx_migrate_task(%p,%p[#%d.%d.%d])",
22777 + p, nxi, nxi->nx_id,
22778 + atomic_read(&nxi->nx_usecnt),
22779 + atomic_read(&nxi->nx_tasks));
22781 + if (nx_info_flags(nxi, NXF_INFO_PRIVATE, 0) &&
22782 + !nx_info_flags(nxi, NXF_STATE_SETUP, 0))
22785 + if (nx_info_state(nxi, NXS_SHUTDOWN))
22788 + /* maybe disallow this completely? */
22789 + old_nxi = task_get_nx_info(p);
22790 + if (old_nxi == nxi)
22795 + clr_nx_info(&p->nx_info);
22796 + claim_nx_info(nxi, p);
22797 + set_nx_info(&p->nx_info, nxi);
22798 + p->nid = nxi->nx_id;
22801 + vxdprintk(VXD_CBIT(nid, 5),
22802 + "moved task %p into nxi:%p[#%d]",
22803 + p, nxi, nxi->nx_id);
22806 + release_nx_info(old_nxi, p);
22809 + put_nx_info(old_nxi);
22814 +void nx_set_persistent(struct nx_info *nxi)
22816 + vxdprintk(VXD_CBIT(nid, 6),
22817 + "nx_set_persistent(%p[#%d])", nxi, nxi->nx_id);
22819 + get_nx_info(nxi);
22820 + claim_nx_info(nxi, NULL);
22823 +void nx_clear_persistent(struct nx_info *nxi)
22825 + vxdprintk(VXD_CBIT(nid, 6),
22826 + "nx_clear_persistent(%p[#%d])", nxi, nxi->nx_id);
22828 + release_nx_info(nxi, NULL);
22829 + put_nx_info(nxi);
22832 +void nx_update_persistent(struct nx_info *nxi)
22834 + if (nx_info_flags(nxi, NXF_PERSISTENT, 0))
22835 + nx_set_persistent(nxi);
22837 + nx_clear_persistent(nxi);
22840 +/* vserver syscall commands below here */
22842 +/* taks nid and nx_info functions */
22844 +#include <asm/uaccess.h>
22847 +int vc_task_nid(uint32_t id)
22852 + struct task_struct *tsk;
22854 + read_lock(&tasklist_lock);
22855 + tsk = find_task_by_real_pid(id);
22856 + nid = (tsk) ? tsk->nid : -ESRCH;
22857 + read_unlock(&tasklist_lock);
22859 + nid = nx_current_nid();
22864 +int vc_nx_info(struct nx_info *nxi, void __user *data)
22866 + struct vcmd_nx_info_v0 vc_data;
22868 + vc_data.nid = nxi->nx_id;
22870 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22876 +/* network functions */
22878 +int vc_net_create(uint32_t nid, void __user *data)
22880 + struct vcmd_net_create vc_data = { .flagword = NXF_INIT_SET };
22881 + struct nx_info *new_nxi;
22884 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
22887 + if ((nid > MAX_S_CONTEXT) || (nid < 2))
22890 + new_nxi = __create_nx_info(nid);
22891 + if (IS_ERR(new_nxi))
22892 + return PTR_ERR(new_nxi);
22894 + /* initial flags */
22895 + new_nxi->nx_flags = vc_data.flagword;
22898 + if (vs_net_change(new_nxi, VSC_NETUP))
22901 + ret = nx_migrate_task(current, new_nxi);
22905 + /* return context id on success */
22906 + ret = new_nxi->nx_id;
22908 + /* get a reference for persistent contexts */
22909 + if ((vc_data.flagword & NXF_PERSISTENT))
22910 + nx_set_persistent(new_nxi);
22912 + release_nx_info(new_nxi, NULL);
22913 + put_nx_info(new_nxi);
22918 +int vc_net_migrate(struct nx_info *nxi, void __user *data)
22920 + return nx_migrate_task(current, nxi);
22925 +int do_add_v4_addr(struct nx_info *nxi, __be32 ip, __be32 ip2, __be32 mask,
22926 + uint16_t type, uint16_t flags)
22928 + struct nx_addr_v4 *nxa = &nxi->v4;
22930 + if (NX_IPV4(nxi)) {
22931 + /* locate last entry */
22932 + for (; nxa->next; nxa = nxa->next);
22933 + nxa->next = __alloc_nx_addr_v4();
22937 + return PTR_ERR(nxa);
22940 + if (nxi->v4.next)
22941 + /* remove single ip for ip list */
22942 + nxi->nx_flags &= ~NXF_SINGLE_IP;
22944 + nxa->ip[0].s_addr = ip;
22945 + nxa->ip[1].s_addr = ip2;
22946 + nxa->mask.s_addr = mask;
22947 + nxa->type = type;
22948 + nxa->flags = flags;
22953 +int vc_net_add(struct nx_info *nxi, void __user *data)
22955 + struct vcmd_net_addr_v0 vc_data;
22956 + int index, ret = 0;
22958 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
22961 + switch (vc_data.type) {
22962 + case NXA_TYPE_IPV4:
22963 + if ((vc_data.count < 1) || (vc_data.count > 4))
22967 + while (index < vc_data.count) {
22968 + ret = do_add_v4_addr(nxi, vc_data.ip[index].s_addr, 0,
22969 + vc_data.mask[index].s_addr, NXA_TYPE_ADDR, 0);
22977 + case NXA_TYPE_IPV4|NXA_MOD_BCAST:
22978 + nxi->v4_bcast = vc_data.ip[0];
22982 + case NXA_TYPE_IPV4|NXA_MOD_LBACK:
22983 + nxi->v4_lback = vc_data.ip[0];
22994 +int vc_net_remove(struct nx_info *nxi, void __user *data)
22996 + struct vcmd_net_addr_v0 vc_data;
22998 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23001 + switch (vc_data.type) {
23002 + case NXA_TYPE_ANY:
23003 + __dealloc_nx_addr_v4_all(xchg(&nxi->v4.next, NULL));
23004 + memset(&nxi->v4, 0, sizeof(nxi->v4));
23014 +int vc_net_add_ipv4(struct nx_info *nxi, void __user *data)
23016 + struct vcmd_net_addr_ipv4_v1 vc_data;
23018 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23021 + switch (vc_data.type) {
23022 + case NXA_TYPE_ADDR:
23023 + case NXA_TYPE_RANGE:
23024 + case NXA_TYPE_MASK:
23025 + return do_add_v4_addr(nxi, vc_data.ip.s_addr, 0,
23026 + vc_data.mask.s_addr, vc_data.type, vc_data.flags);
23028 + case NXA_TYPE_ADDR | NXA_MOD_BCAST:
23029 + nxi->v4_bcast = vc_data.ip;
23032 + case NXA_TYPE_ADDR | NXA_MOD_LBACK:
23033 + nxi->v4_lback = vc_data.ip;
23042 +int vc_net_remove_ipv4(struct nx_info *nxi, void __user *data)
23044 + struct vcmd_net_addr_ipv4_v1 vc_data;
23046 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23049 + switch (vc_data.type) {
23050 +/* case NXA_TYPE_ADDR:
23053 + case NXA_TYPE_ANY:
23054 + __dealloc_nx_addr_v4_all(xchg(&nxi->v4.next, NULL));
23055 + memset(&nxi->v4, 0, sizeof(nxi->v4));
23065 +#ifdef CONFIG_IPV6
23067 +int do_add_v6_addr(struct nx_info *nxi,
23068 + struct in6_addr *ip, struct in6_addr *mask,
23069 + uint32_t prefix, uint16_t type, uint16_t flags)
23071 + struct nx_addr_v6 *nxa = &nxi->v6;
23073 + if (NX_IPV6(nxi)) {
23074 + /* locate last entry */
23075 + for (; nxa->next; nxa = nxa->next);
23076 + nxa->next = __alloc_nx_addr_v6();
23080 + return PTR_ERR(nxa);
23084 + nxa->mask = *mask;
23085 + nxa->prefix = prefix;
23086 + nxa->type = type;
23087 + nxa->flags = flags;
23092 +int vc_net_add_ipv6(struct nx_info *nxi, void __user *data)
23094 + struct vcmd_net_addr_ipv6_v1 vc_data;
23096 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23099 + switch (vc_data.type) {
23100 + case NXA_TYPE_ADDR:
23101 + case NXA_TYPE_MASK:
23102 + return do_add_v6_addr(nxi, &vc_data.ip, &vc_data.mask,
23103 + vc_data.prefix, vc_data.type, vc_data.flags);
23110 +int vc_net_remove_ipv6(struct nx_info *nxi, void __user *data)
23112 + struct vcmd_net_addr_ipv6_v1 vc_data;
23114 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23117 + switch (vc_data.type) {
23118 + case NXA_TYPE_ANY:
23119 + __dealloc_nx_addr_v6_all(xchg(&nxi->v6.next, NULL));
23120 + memset(&nxi->v6, 0, sizeof(nxi->v6));
23129 +#endif /* CONFIG_IPV6 */
23132 +int vc_get_nflags(struct nx_info *nxi, void __user *data)
23134 + struct vcmd_net_flags_v0 vc_data;
23136 + vc_data.flagword = nxi->nx_flags;
23138 + /* special STATE flag handling */
23139 + vc_data.mask = vs_mask_flags(~0ULL, nxi->nx_flags, NXF_ONE_TIME);
23141 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23146 +int vc_set_nflags(struct nx_info *nxi, void __user *data)
23148 + struct vcmd_net_flags_v0 vc_data;
23149 + uint64_t mask, trigger;
23151 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
23154 + /* special STATE flag handling */
23155 + mask = vs_mask_mask(vc_data.mask, nxi->nx_flags, NXF_ONE_TIME);
23156 + trigger = (mask & nxi->nx_flags) ^ (mask & vc_data.flagword);
23158 + nxi->nx_flags = vs_mask_flags(nxi->nx_flags,
23159 + vc_data.flagword, mask);
23160 + if (trigger & NXF_PERSISTENT)
23161 + nx_update_persistent(nxi);
23166 +int vc_get_ncaps(struct nx_info *nxi, void __user *data)
23168 + struct vcmd_net_caps_v0 vc_data;
23170 + vc_data.ncaps = nxi->nx_ncaps;
23171 + vc_data.cmask = ~0ULL;
23173 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23178 +int vc_set_ncaps(struct nx_info *nxi, void __user *data)
23180 + struct vcmd_net_caps_v0 vc_data;
23182 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
23185 + nxi->nx_ncaps = vs_mask_flags(nxi->nx_ncaps,
23186 + vc_data.ncaps, vc_data.cmask);
23191 +#include <linux/module.h>
23193 +module_init(init_network);
23195 +EXPORT_SYMBOL_GPL(free_nx_info);
23196 +EXPORT_SYMBOL_GPL(unhash_nx_info);
23198 diff -NurpP --minimal linux-2.6.34/kernel/vserver/proc.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/proc.c
23199 --- linux-2.6.34/kernel/vserver/proc.c 1970-01-01 01:00:00.000000000 +0100
23200 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/proc.c 2010-05-18 18:11:22.000000000 +0200
23203 + * linux/kernel/vserver/proc.c
23205 + * Virtual Context Support
23207 + * Copyright (C) 2003-2007 Herbert Pötzl
23209 + * V0.01 basic structure
23210 + * V0.02 adaptation vs1.3.0
23211 + * V0.03 proc permissions
23212 + * V0.04 locking/generic
23213 + * V0.05 next generation procfs
23214 + * V0.06 inode validation
23215 + * V0.07 generic rewrite vid
23216 + * V0.08 remove inode type
23220 +#include <linux/proc_fs.h>
23221 +#include <linux/fs_struct.h>
23222 +#include <linux/mount.h>
23223 +#include <asm/unistd.h>
23225 +#include <linux/vs_context.h>
23226 +#include <linux/vs_network.h>
23227 +#include <linux/vs_cvirt.h>
23229 +#include <linux/in.h>
23230 +#include <linux/inetdevice.h>
23231 +#include <linux/vs_inet.h>
23232 +#include <linux/vs_inet6.h>
23234 +#include <linux/vserver/global.h>
23236 +#include "cvirt_proc.h"
23237 +#include "cacct_proc.h"
23238 +#include "limit_proc.h"
23239 +#include "sched_proc.h"
23240 +#include "vci_config.h"
23243 +static inline char *print_cap_t(char *buffer, kernel_cap_t *c)
23247 + CAP_FOR_EACH_U32(__capi) {
23248 + buffer += sprintf(buffer, "%08x",
23249 + c->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]);
23255 +static struct proc_dir_entry *proc_virtual;
23257 +static struct proc_dir_entry *proc_virtnet;
23260 +/* first the actual feeds */
23263 +static int proc_vci(char *buffer)
23265 + return sprintf(buffer,
23266 + "VCIVersion:\t%04x:%04x\n"
23267 + "VCISyscall:\t%d\n"
23268 + "VCIKernel:\t%08x\n",
23269 + VCI_VERSION >> 16,
23270 + VCI_VERSION & 0xFFFF,
23272 + vci_kernel_config());
23275 +static int proc_virtual_info(char *buffer)
23277 + return proc_vci(buffer);
23280 +static int proc_virtual_status(char *buffer)
23282 + return sprintf(buffer,
23284 + "#CActive:\t%d\n"
23285 + "#NSProxy:\t%d\t%d %d %d %d %d %d\n"
23286 + "#InitTask:\t%d\t%d %d\n",
23287 + atomic_read(&vx_global_ctotal),
23288 + atomic_read(&vx_global_cactive),
23289 + atomic_read(&vs_global_nsproxy),
23290 + atomic_read(&vs_global_fs),
23291 + atomic_read(&vs_global_mnt_ns),
23292 + atomic_read(&vs_global_uts_ns),
23293 + atomic_read(&nr_ipc_ns),
23294 + atomic_read(&vs_global_user_ns),
23295 + atomic_read(&vs_global_pid_ns),
23296 + atomic_read(&init_task.usage),
23297 + atomic_read(&init_task.nsproxy->count),
23298 + init_task.fs->users);
23302 +int proc_vxi_info(struct vx_info *vxi, char *buffer)
23306 + length = sprintf(buffer,
23314 + vxi->vx_badness_bias);
23318 +int proc_vxi_status(struct vx_info *vxi, char *buffer)
23320 + char *orig = buffer;
23322 + buffer += sprintf(buffer,
23325 + "Flags:\t%016llx\n",
23326 + atomic_read(&vxi->vx_usecnt),
23327 + atomic_read(&vxi->vx_tasks),
23328 + (unsigned long long)vxi->vx_flags);
23330 + buffer += sprintf(buffer, "BCaps:\t");
23331 + buffer = print_cap_t(buffer, &vxi->vx_bcaps);
23332 + buffer += sprintf(buffer, "\n");
23334 + buffer += sprintf(buffer,
23335 + "CCaps:\t%016llx\n"
23336 + "Spaces:\t%08lx %08lx\n",
23337 + (unsigned long long)vxi->vx_ccaps,
23338 + vxi->vx_nsmask[0], vxi->vx_nsmask[1]);
23339 + return buffer - orig;
23342 +int proc_vxi_limit(struct vx_info *vxi, char *buffer)
23344 + return vx_info_proc_limit(&vxi->limit, buffer);
23347 +int proc_vxi_sched(struct vx_info *vxi, char *buffer)
23351 + length = vx_info_proc_sched(&vxi->sched, buffer);
23352 + for_each_online_cpu(cpu) {
23353 + length += vx_info_proc_sched_pc(
23354 + &vx_per_cpu(vxi, sched_pc, cpu),
23355 + buffer + length, cpu);
23360 +int proc_vxi_nsproxy0(struct vx_info *vxi, char *buffer)
23362 + return vx_info_proc_nsproxy(vxi->vx_nsproxy[0], buffer);
23365 +int proc_vxi_nsproxy1(struct vx_info *vxi, char *buffer)
23367 + return vx_info_proc_nsproxy(vxi->vx_nsproxy[1], buffer);
23370 +int proc_vxi_cvirt(struct vx_info *vxi, char *buffer)
23374 + vx_update_load(vxi);
23375 + length = vx_info_proc_cvirt(&vxi->cvirt, buffer);
23376 + for_each_online_cpu(cpu) {
23377 + length += vx_info_proc_cvirt_pc(
23378 + &vx_per_cpu(vxi, cvirt_pc, cpu),
23379 + buffer + length, cpu);
23384 +int proc_vxi_cacct(struct vx_info *vxi, char *buffer)
23386 + return vx_info_proc_cacct(&vxi->cacct, buffer);
23390 +static int proc_virtnet_info(char *buffer)
23392 + return proc_vci(buffer);
23395 +static int proc_virtnet_status(char *buffer)
23397 + return sprintf(buffer,
23399 + "#CActive:\t%d\n",
23400 + atomic_read(&nx_global_ctotal),
23401 + atomic_read(&nx_global_cactive));
23404 +int proc_nxi_info(struct nx_info *nxi, char *buffer)
23406 + struct nx_addr_v4 *v4a;
23407 +#ifdef CONFIG_IPV6
23408 + struct nx_addr_v6 *v6a;
23412 + length = sprintf(buffer,
23415 + "Bcast:\t" NIPQUAD_FMT "\n"
23416 + "Lback:\t" NIPQUAD_FMT "\n",
23419 + NIPQUAD(nxi->v4_bcast.s_addr),
23420 + NIPQUAD(nxi->v4_lback.s_addr));
23422 + if (!NX_IPV4(nxi))
23424 + for (i = 0, v4a = &nxi->v4; v4a; i++, v4a = v4a->next)
23425 + length += sprintf(buffer + length, "%d:\t" NXAV4_FMT "\n",
23428 +#ifdef CONFIG_IPV6
23429 + if (!NX_IPV6(nxi))
23431 + for (i = 0, v6a = &nxi->v6; v6a; i++, v6a = v6a->next)
23432 + length += sprintf(buffer + length, "%d:\t" NXAV6_FMT "\n",
23439 +int proc_nxi_status(struct nx_info *nxi, char *buffer)
23443 + length = sprintf(buffer,
23446 + "Flags:\t%016llx\n"
23447 + "NCaps:\t%016llx\n",
23448 + atomic_read(&nxi->nx_usecnt),
23449 + atomic_read(&nxi->nx_tasks),
23450 + (unsigned long long)nxi->nx_flags,
23451 + (unsigned long long)nxi->nx_ncaps);
23457 +/* here the inode helpers */
23463 + struct inode_operations *iop;
23464 + struct file_operations *fop;
23465 + union proc_op op;
23468 +static struct inode *vs_proc_make_inode(struct super_block *sb, struct vs_entry *p)
23470 + struct inode *inode = new_inode(sb);
23475 + inode->i_mode = p->mode;
23477 + inode->i_op = p->iop;
23479 + inode->i_fop = p->fop;
23481 + inode->i_nlink = (p->mode & S_IFDIR) ? 2 : 1;
23482 + inode->i_flags |= S_IMMUTABLE;
23484 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
23486 + inode->i_uid = 0;
23487 + inode->i_gid = 0;
23488 + inode->i_tag = 0;
23493 +static struct dentry *vs_proc_instantiate(struct inode *dir,
23494 + struct dentry *dentry, int id, void *ptr)
23496 + struct vs_entry *p = ptr;
23497 + struct inode *inode = vs_proc_make_inode(dir->i_sb, p);
23498 + struct dentry *error = ERR_PTR(-EINVAL);
23503 + PROC_I(inode)->op = p->op;
23504 + PROC_I(inode)->fd = id;
23505 + d_add(dentry, inode);
23513 +typedef struct dentry *instantiate_t(struct inode *, struct dentry *, int, void *);
23516 + * Fill a directory entry.
23518 + * If possible create the dcache entry and derive our inode number and
23519 + * file type from dcache entry.
23521 + * Since all of the proc inode numbers are dynamically generated, the inode
23522 + * numbers do not exist until the inode is cache. This means creating the
23523 + * the dcache entry in readdir is necessary to keep the inode numbers
23524 + * reported by readdir in sync with the inode numbers reported
23527 +static int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
23528 + char *name, int len, instantiate_t instantiate, int id, void *ptr)
23530 + struct dentry *child, *dir = filp->f_dentry;
23531 + struct inode *inode;
23532 + struct qstr qname;
23534 + unsigned type = DT_UNKNOWN;
23536 + qname.name = name;
23538 + qname.hash = full_name_hash(name, len);
23540 + child = d_lookup(dir, &qname);
23542 + struct dentry *new;
23543 + new = d_alloc(dir, &qname);
23545 + child = instantiate(dir->d_inode, new, id, ptr);
23552 + if (!child || IS_ERR(child) || !child->d_inode)
23553 + goto end_instantiate;
23554 + inode = child->d_inode;
23556 + ino = inode->i_ino;
23557 + type = inode->i_mode >> 12;
23562 + ino = find_inode_number(dir, &qname);
23565 + return filldir(dirent, name, len, filp->f_pos, ino, type);
23570 +/* get and revalidate vx_info/xid */
23573 +struct vx_info *get_proc_vx_info(struct inode *inode)
23575 + return lookup_vx_info(PROC_I(inode)->fd);
23578 +static int proc_xid_revalidate(struct dentry *dentry, struct nameidata *nd)
23580 + struct inode *inode = dentry->d_inode;
23581 + xid_t xid = PROC_I(inode)->fd;
23583 + if (!xid || xid_is_hashed(xid))
23590 +/* get and revalidate nx_info/nid */
23592 +static int proc_nid_revalidate(struct dentry *dentry, struct nameidata *nd)
23594 + struct inode *inode = dentry->d_inode;
23595 + nid_t nid = PROC_I(inode)->fd;
23597 + if (!nid || nid_is_hashed(nid))
23605 +#define PROC_BLOCK_SIZE (PAGE_SIZE - 1024)
23607 +static ssize_t proc_vs_info_read(struct file *file, char __user *buf,
23608 + size_t count, loff_t *ppos)
23610 + struct inode *inode = file->f_dentry->d_inode;
23611 + unsigned long page;
23612 + ssize_t length = 0;
23614 + if (count > PROC_BLOCK_SIZE)
23615 + count = PROC_BLOCK_SIZE;
23617 + /* fade that out as soon as stable */
23618 + WARN_ON(PROC_I(inode)->fd);
23620 + if (!(page = __get_free_page(GFP_KERNEL)))
23623 + BUG_ON(!PROC_I(inode)->op.proc_vs_read);
23624 + length = PROC_I(inode)->op.proc_vs_read((char *)page);
23627 + length = simple_read_from_buffer(buf, count, ppos,
23628 + (char *)page, length);
23634 +static ssize_t proc_vx_info_read(struct file *file, char __user *buf,
23635 + size_t count, loff_t *ppos)
23637 + struct inode *inode = file->f_dentry->d_inode;
23638 + struct vx_info *vxi = NULL;
23639 + xid_t xid = PROC_I(inode)->fd;
23640 + unsigned long page;
23641 + ssize_t length = 0;
23643 + if (count > PROC_BLOCK_SIZE)
23644 + count = PROC_BLOCK_SIZE;
23646 + /* fade that out as soon as stable */
23648 + vxi = lookup_vx_info(xid);
23652 + length = -ENOMEM;
23653 + if (!(page = __get_free_page(GFP_KERNEL)))
23656 + BUG_ON(!PROC_I(inode)->op.proc_vxi_read);
23657 + length = PROC_I(inode)->op.proc_vxi_read(vxi, (char *)page);
23660 + length = simple_read_from_buffer(buf, count, ppos,
23661 + (char *)page, length);
23665 + put_vx_info(vxi);
23670 +static ssize_t proc_nx_info_read(struct file *file, char __user *buf,
23671 + size_t count, loff_t *ppos)
23673 + struct inode *inode = file->f_dentry->d_inode;
23674 + struct nx_info *nxi = NULL;
23675 + nid_t nid = PROC_I(inode)->fd;
23676 + unsigned long page;
23677 + ssize_t length = 0;
23679 + if (count > PROC_BLOCK_SIZE)
23680 + count = PROC_BLOCK_SIZE;
23682 + /* fade that out as soon as stable */
23684 + nxi = lookup_nx_info(nid);
23688 + length = -ENOMEM;
23689 + if (!(page = __get_free_page(GFP_KERNEL)))
23692 + BUG_ON(!PROC_I(inode)->op.proc_nxi_read);
23693 + length = PROC_I(inode)->op.proc_nxi_read(nxi, (char *)page);
23696 + length = simple_read_from_buffer(buf, count, ppos,
23697 + (char *)page, length);
23701 + put_nx_info(nxi);
23708 +/* here comes the lower level */
23711 +#define NOD(NAME, MODE, IOP, FOP, OP) { \
23712 + .len = sizeof(NAME) - 1, \
23713 + .name = (NAME), \
23721 +#define DIR(NAME, MODE, OTYPE) \
23722 + NOD(NAME, (S_IFDIR | (MODE)), \
23723 + &proc_ ## OTYPE ## _inode_operations, \
23724 + &proc_ ## OTYPE ## _file_operations, { } )
23726 +#define INF(NAME, MODE, OTYPE) \
23727 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
23728 + &proc_vs_info_file_operations, \
23729 + { .proc_vs_read = &proc_##OTYPE } )
23731 +#define VINF(NAME, MODE, OTYPE) \
23732 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
23733 + &proc_vx_info_file_operations, \
23734 + { .proc_vxi_read = &proc_##OTYPE } )
23736 +#define NINF(NAME, MODE, OTYPE) \
23737 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
23738 + &proc_nx_info_file_operations, \
23739 + { .proc_nxi_read = &proc_##OTYPE } )
23742 +static struct file_operations proc_vs_info_file_operations = {
23743 + .read = proc_vs_info_read,
23746 +static struct file_operations proc_vx_info_file_operations = {
23747 + .read = proc_vx_info_read,
23750 +static struct dentry_operations proc_xid_dentry_operations = {
23751 + .d_revalidate = proc_xid_revalidate,
23754 +static struct vs_entry vx_base_stuff[] = {
23755 + VINF("info", S_IRUGO, vxi_info),
23756 + VINF("status", S_IRUGO, vxi_status),
23757 + VINF("limit", S_IRUGO, vxi_limit),
23758 + VINF("sched", S_IRUGO, vxi_sched),
23759 + VINF("nsproxy", S_IRUGO, vxi_nsproxy0),
23760 + VINF("nsproxy1",S_IRUGO, vxi_nsproxy1),
23761 + VINF("cvirt", S_IRUGO, vxi_cvirt),
23762 + VINF("cacct", S_IRUGO, vxi_cacct),
23769 +static struct dentry *proc_xid_instantiate(struct inode *dir,
23770 + struct dentry *dentry, int id, void *ptr)
23772 + dentry->d_op = &proc_xid_dentry_operations;
23773 + return vs_proc_instantiate(dir, dentry, id, ptr);
23776 +static struct dentry *proc_xid_lookup(struct inode *dir,
23777 + struct dentry *dentry, struct nameidata *nd)
23779 + struct vs_entry *p = vx_base_stuff;
23780 + struct dentry *error = ERR_PTR(-ENOENT);
23782 + for (; p->name; p++) {
23783 + if (p->len != dentry->d_name.len)
23785 + if (!memcmp(dentry->d_name.name, p->name, p->len))
23791 + error = proc_xid_instantiate(dir, dentry, PROC_I(dir)->fd, p);
23796 +static int proc_xid_readdir(struct file *filp,
23797 + void *dirent, filldir_t filldir)
23799 + struct dentry *dentry = filp->f_dentry;
23800 + struct inode *inode = dentry->d_inode;
23801 + struct vs_entry *p = vx_base_stuff;
23802 + int size = sizeof(vx_base_stuff) / sizeof(struct vs_entry);
23806 + pos = filp->f_pos;
23809 + ino = inode->i_ino;
23810 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
23813 + /* fall through */
23815 + ino = parent_ino(dentry);
23816 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
23819 + /* fall through */
23822 + if (index >= size)
23824 + for (p += index; p->name; p++) {
23825 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
23826 + vs_proc_instantiate, PROC_I(inode)->fd, p))
23832 + filp->f_pos = pos;
23838 +static struct file_operations proc_nx_info_file_operations = {
23839 + .read = proc_nx_info_read,
23842 +static struct dentry_operations proc_nid_dentry_operations = {
23843 + .d_revalidate = proc_nid_revalidate,
23846 +static struct vs_entry nx_base_stuff[] = {
23847 + NINF("info", S_IRUGO, nxi_info),
23848 + NINF("status", S_IRUGO, nxi_status),
23853 +static struct dentry *proc_nid_instantiate(struct inode *dir,
23854 + struct dentry *dentry, int id, void *ptr)
23856 + dentry->d_op = &proc_nid_dentry_operations;
23857 + return vs_proc_instantiate(dir, dentry, id, ptr);
23860 +static struct dentry *proc_nid_lookup(struct inode *dir,
23861 + struct dentry *dentry, struct nameidata *nd)
23863 + struct vs_entry *p = nx_base_stuff;
23864 + struct dentry *error = ERR_PTR(-ENOENT);
23866 + for (; p->name; p++) {
23867 + if (p->len != dentry->d_name.len)
23869 + if (!memcmp(dentry->d_name.name, p->name, p->len))
23875 + error = proc_nid_instantiate(dir, dentry, PROC_I(dir)->fd, p);
23880 +static int proc_nid_readdir(struct file *filp,
23881 + void *dirent, filldir_t filldir)
23883 + struct dentry *dentry = filp->f_dentry;
23884 + struct inode *inode = dentry->d_inode;
23885 + struct vs_entry *p = nx_base_stuff;
23886 + int size = sizeof(nx_base_stuff) / sizeof(struct vs_entry);
23890 + pos = filp->f_pos;
23893 + ino = inode->i_ino;
23894 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
23897 + /* fall through */
23899 + ino = parent_ino(dentry);
23900 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
23903 + /* fall through */
23906 + if (index >= size)
23908 + for (p += index; p->name; p++) {
23909 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
23910 + vs_proc_instantiate, PROC_I(inode)->fd, p))
23916 + filp->f_pos = pos;
23921 +#define MAX_MULBY10 ((~0U - 9) / 10)
23923 +static inline int atovid(const char *str, int len)
23928 + while (len-- > 0) {
23933 + if (vid >= MAX_MULBY10)
23943 +/* now the upper level (virtual) */
23946 +static struct file_operations proc_xid_file_operations = {
23947 + .read = generic_read_dir,
23948 + .readdir = proc_xid_readdir,
23951 +static struct inode_operations proc_xid_inode_operations = {
23952 + .lookup = proc_xid_lookup,
23955 +static struct vs_entry vx_virtual_stuff[] = {
23956 + INF("info", S_IRUGO, virtual_info),
23957 + INF("status", S_IRUGO, virtual_status),
23958 + DIR(NULL, S_IRUGO | S_IXUGO, xid),
23962 +static struct dentry *proc_virtual_lookup(struct inode *dir,
23963 + struct dentry *dentry, struct nameidata *nd)
23965 + struct vs_entry *p = vx_virtual_stuff;
23966 + struct dentry *error = ERR_PTR(-ENOENT);
23969 + for (; p->name; p++) {
23970 + if (p->len != dentry->d_name.len)
23972 + if (!memcmp(dentry->d_name.name, p->name, p->len))
23976 + goto instantiate;
23978 + id = atovid(dentry->d_name.name, dentry->d_name.len);
23979 + if ((id < 0) || !xid_is_hashed(id))
23983 + error = proc_xid_instantiate(dir, dentry, id, p);
23988 +static struct file_operations proc_nid_file_operations = {
23989 + .read = generic_read_dir,
23990 + .readdir = proc_nid_readdir,
23993 +static struct inode_operations proc_nid_inode_operations = {
23994 + .lookup = proc_nid_lookup,
23997 +static struct vs_entry nx_virtnet_stuff[] = {
23998 + INF("info", S_IRUGO, virtnet_info),
23999 + INF("status", S_IRUGO, virtnet_status),
24000 + DIR(NULL, S_IRUGO | S_IXUGO, nid),
24004 +static struct dentry *proc_virtnet_lookup(struct inode *dir,
24005 + struct dentry *dentry, struct nameidata *nd)
24007 + struct vs_entry *p = nx_virtnet_stuff;
24008 + struct dentry *error = ERR_PTR(-ENOENT);
24011 + for (; p->name; p++) {
24012 + if (p->len != dentry->d_name.len)
24014 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24018 + goto instantiate;
24020 + id = atovid(dentry->d_name.name, dentry->d_name.len);
24021 + if ((id < 0) || !nid_is_hashed(id))
24025 + error = proc_nid_instantiate(dir, dentry, id, p);
24031 +#define PROC_MAXVIDS 32
24033 +int proc_virtual_readdir(struct file *filp,
24034 + void *dirent, filldir_t filldir)
24036 + struct dentry *dentry = filp->f_dentry;
24037 + struct inode *inode = dentry->d_inode;
24038 + struct vs_entry *p = vx_virtual_stuff;
24039 + int size = sizeof(vx_virtual_stuff) / sizeof(struct vs_entry);
24041 + unsigned int xid_array[PROC_MAXVIDS];
24042 + char buf[PROC_NUMBUF];
24043 + unsigned int nr_xids, i;
24046 + pos = filp->f_pos;
24049 + ino = inode->i_ino;
24050 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24053 + /* fall through */
24055 + ino = parent_ino(dentry);
24056 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24059 + /* fall through */
24062 + if (index >= size)
24064 + for (p += index; p->name; p++) {
24065 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24066 + vs_proc_instantiate, 0, p))
24071 + index = pos - size;
24072 + p = &vx_virtual_stuff[size - 1];
24073 + nr_xids = get_xid_list(index, xid_array, PROC_MAXVIDS);
24074 + for (i = 0; i < nr_xids; i++) {
24075 + int n, xid = xid_array[i];
24076 + unsigned int j = PROC_NUMBUF;
24080 + buf[--j] = '0' + (n % 10);
24083 + if (proc_fill_cache(filp, dirent, filldir,
24084 + buf + j, PROC_NUMBUF - j,
24085 + vs_proc_instantiate, xid, p))
24091 + filp->f_pos = pos;
24095 +static int proc_virtual_getattr(struct vfsmount *mnt,
24096 + struct dentry *dentry, struct kstat *stat)
24098 + struct inode *inode = dentry->d_inode;
24100 + generic_fillattr(inode, stat);
24101 + stat->nlink = 2 + atomic_read(&vx_global_cactive);
24105 +static struct file_operations proc_virtual_dir_operations = {
24106 + .read = generic_read_dir,
24107 + .readdir = proc_virtual_readdir,
24110 +static struct inode_operations proc_virtual_dir_inode_operations = {
24111 + .getattr = proc_virtual_getattr,
24112 + .lookup = proc_virtual_lookup,
24119 +int proc_virtnet_readdir(struct file *filp,
24120 + void *dirent, filldir_t filldir)
24122 + struct dentry *dentry = filp->f_dentry;
24123 + struct inode *inode = dentry->d_inode;
24124 + struct vs_entry *p = nx_virtnet_stuff;
24125 + int size = sizeof(nx_virtnet_stuff) / sizeof(struct vs_entry);
24127 + unsigned int nid_array[PROC_MAXVIDS];
24128 + char buf[PROC_NUMBUF];
24129 + unsigned int nr_nids, i;
24132 + pos = filp->f_pos;
24135 + ino = inode->i_ino;
24136 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24139 + /* fall through */
24141 + ino = parent_ino(dentry);
24142 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24145 + /* fall through */
24148 + if (index >= size)
24150 + for (p += index; p->name; p++) {
24151 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24152 + vs_proc_instantiate, 0, p))
24157 + index = pos - size;
24158 + p = &nx_virtnet_stuff[size - 1];
24159 + nr_nids = get_nid_list(index, nid_array, PROC_MAXVIDS);
24160 + for (i = 0; i < nr_nids; i++) {
24161 + int n, nid = nid_array[i];
24162 + unsigned int j = PROC_NUMBUF;
24166 + buf[--j] = '0' + (n % 10);
24169 + if (proc_fill_cache(filp, dirent, filldir,
24170 + buf + j, PROC_NUMBUF - j,
24171 + vs_proc_instantiate, nid, p))
24177 + filp->f_pos = pos;
24181 +static int proc_virtnet_getattr(struct vfsmount *mnt,
24182 + struct dentry *dentry, struct kstat *stat)
24184 + struct inode *inode = dentry->d_inode;
24186 + generic_fillattr(inode, stat);
24187 + stat->nlink = 2 + atomic_read(&nx_global_cactive);
24191 +static struct file_operations proc_virtnet_dir_operations = {
24192 + .read = generic_read_dir,
24193 + .readdir = proc_virtnet_readdir,
24196 +static struct inode_operations proc_virtnet_dir_inode_operations = {
24197 + .getattr = proc_virtnet_getattr,
24198 + .lookup = proc_virtnet_lookup,
24203 +void proc_vx_init(void)
24205 + struct proc_dir_entry *ent;
24207 + ent = proc_mkdir("virtual", 0);
24209 + ent->proc_fops = &proc_virtual_dir_operations;
24210 + ent->proc_iops = &proc_virtual_dir_inode_operations;
24212 + proc_virtual = ent;
24214 + ent = proc_mkdir("virtnet", 0);
24216 + ent->proc_fops = &proc_virtnet_dir_operations;
24217 + ent->proc_iops = &proc_virtnet_dir_inode_operations;
24219 + proc_virtnet = ent;
24225 +/* per pid info */
24228 +int proc_pid_vx_info(struct task_struct *p, char *buffer)
24230 + struct vx_info *vxi;
24231 + char *orig = buffer;
24233 + buffer += sprintf(buffer, "XID:\t%d\n", vx_task_xid(p));
24235 + vxi = task_get_vx_info(p);
24239 + buffer += sprintf(buffer, "BCaps:\t");
24240 + buffer = print_cap_t(buffer, &vxi->vx_bcaps);
24241 + buffer += sprintf(buffer, "\n");
24242 + buffer += sprintf(buffer, "CCaps:\t%016llx\n",
24243 + (unsigned long long)vxi->vx_ccaps);
24244 + buffer += sprintf(buffer, "CFlags:\t%016llx\n",
24245 + (unsigned long long)vxi->vx_flags);
24246 + buffer += sprintf(buffer, "CIPid:\t%d\n", vxi->vx_initpid);
24248 + put_vx_info(vxi);
24250 + return buffer - orig;
24254 +int proc_pid_nx_info(struct task_struct *p, char *buffer)
24256 + struct nx_info *nxi;
24257 + struct nx_addr_v4 *v4a;
24258 +#ifdef CONFIG_IPV6
24259 + struct nx_addr_v6 *v6a;
24261 + char *orig = buffer;
24264 + buffer += sprintf(buffer, "NID:\t%d\n", nx_task_nid(p));
24266 + nxi = task_get_nx_info(p);
24270 + buffer += sprintf(buffer, "NCaps:\t%016llx\n",
24271 + (unsigned long long)nxi->nx_ncaps);
24272 + buffer += sprintf(buffer, "NFlags:\t%016llx\n",
24273 + (unsigned long long)nxi->nx_flags);
24275 + buffer += sprintf(buffer,
24276 + "V4Root[bcast]:\t" NIPQUAD_FMT "\n",
24277 + NIPQUAD(nxi->v4_bcast.s_addr));
24278 + buffer += sprintf (buffer,
24279 + "V4Root[lback]:\t" NIPQUAD_FMT "\n",
24280 + NIPQUAD(nxi->v4_lback.s_addr));
24281 + if (!NX_IPV4(nxi))
24283 + for (i = 0, v4a = &nxi->v4; v4a; i++, v4a = v4a->next)
24284 + buffer += sprintf(buffer, "V4Root[%d]:\t" NXAV4_FMT "\n",
24287 +#ifdef CONFIG_IPV6
24288 + if (!NX_IPV6(nxi))
24290 + for (i = 0, v6a = &nxi->v6; v6a; i++, v6a = v6a->next)
24291 + buffer += sprintf(buffer, "V6Root[%d]:\t" NXAV6_FMT "\n",
24295 + put_nx_info(nxi);
24297 + return buffer - orig;
24300 diff -NurpP --minimal linux-2.6.34/kernel/vserver/sched.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/sched.c
24301 --- linux-2.6.34/kernel/vserver/sched.c 1970-01-01 01:00:00.000000000 +0100
24302 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/sched.c 2010-05-18 18:11:22.000000000 +0200
24305 + * linux/kernel/vserver/sched.c
24307 + * Virtual Server: Scheduler Support
24309 + * Copyright (C) 2004-2007 Herbert Pötzl
24311 + * V0.01 adapted Sam Vilains version to 2.6.3
24312 + * V0.02 removed legacy interface
24313 + * V0.03 changed vcmds to vxi arg
24314 + * V0.04 removed older and legacy interfaces
24318 +#include <linux/vs_context.h>
24319 +#include <linux/vs_sched.h>
24320 +#include <linux/vserver/sched_cmd.h>
24322 +#include <asm/uaccess.h>
24325 +#define vxd_check_range(val, min, max) do { \
24326 + vxlprintk((val < min) || (val > max), \
24327 + "check_range(%ld,%ld,%ld)", \
24328 + (long)val, (long)min, (long)max, \
24329 + __FILE__, __LINE__); \
24333 +void vx_update_sched_param(struct _vx_sched *sched,
24334 + struct _vx_sched_pc *sched_pc)
24336 + unsigned int set_mask = sched->update_mask;
24338 + if (set_mask & VXSM_FILL_RATE)
24339 + sched_pc->fill_rate[0] = sched->fill_rate[0];
24340 + if (set_mask & VXSM_INTERVAL)
24341 + sched_pc->interval[0] = sched->interval[0];
24342 + if (set_mask & VXSM_FILL_RATE2)
24343 + sched_pc->fill_rate[1] = sched->fill_rate[1];
24344 + if (set_mask & VXSM_INTERVAL2)
24345 + sched_pc->interval[1] = sched->interval[1];
24346 + if (set_mask & VXSM_TOKENS)
24347 + sched_pc->tokens = sched->tokens;
24348 + if (set_mask & VXSM_TOKENS_MIN)
24349 + sched_pc->tokens_min = sched->tokens_min;
24350 + if (set_mask & VXSM_TOKENS_MAX)
24351 + sched_pc->tokens_max = sched->tokens_max;
24352 + if (set_mask & VXSM_PRIO_BIAS)
24353 + sched_pc->prio_bias = sched->prio_bias;
24355 + if (set_mask & VXSM_IDLE_TIME)
24356 + sched_pc->flags |= VXSF_IDLE_TIME;
24358 + sched_pc->flags &= ~VXSF_IDLE_TIME;
24361 + sched_pc->norm_time = jiffies;
24366 + * recalculate the context's scheduling tokens
24368 + * ret > 0 : number of tokens available
24369 + * ret < 0 : on hold, check delta_min[]
24370 + * -1 only jiffies
24371 + * -2 also idle time
24374 +int vx_tokens_recalc(struct _vx_sched_pc *sched_pc,
24375 + unsigned long *norm_time, unsigned long *idle_time, int delta_min[2])
24379 + int flags = sched_pc->flags;
24381 + /* how much time did pass? */
24382 + delta = *norm_time - sched_pc->norm_time;
24383 + // printk("@ %ld, %ld, %ld\n", *norm_time, sched_pc->norm_time, jiffies);
24384 + vxd_check_range(delta, 0, INT_MAX);
24386 + if (delta >= sched_pc->interval[0]) {
24387 + long tokens, integral;
24389 + /* calc integral token part */
24390 + tokens = delta / sched_pc->interval[0];
24391 + integral = tokens * sched_pc->interval[0];
24392 + tokens *= sched_pc->fill_rate[0];
24393 +#ifdef CONFIG_VSERVER_HARDCPU
24394 + delta_min[0] = delta - integral;
24395 + vxd_check_range(delta_min[0], 0, sched_pc->interval[0]);
24397 + /* advance time */
24398 + sched_pc->norm_time += delta;
24401 + sched_pc->tokens += tokens;
24402 + sched_pc->token_time += tokens;
24404 + delta_min[0] = delta;
24406 +#ifdef CONFIG_VSERVER_IDLETIME
24407 + if (!(flags & VXSF_IDLE_TIME))
24410 + /* how much was the idle skip? */
24411 + delta = *idle_time - sched_pc->idle_time;
24412 + vxd_check_range(delta, 0, INT_MAX);
24414 + if (delta >= sched_pc->interval[1]) {
24415 + long tokens, integral;
24417 + /* calc fair share token part */
24418 + tokens = delta / sched_pc->interval[1];
24419 + integral = tokens * sched_pc->interval[1];
24420 + tokens *= sched_pc->fill_rate[1];
24421 + delta_min[1] = delta - integral;
24422 + vxd_check_range(delta_min[1], 0, sched_pc->interval[1]);
24424 + /* advance idle time */
24425 + sched_pc->idle_time += integral;
24428 + sched_pc->tokens += tokens;
24429 + sched_pc->token_time += tokens;
24431 + delta_min[1] = delta;
24435 + /* clip at maximum */
24436 + if (sched_pc->tokens > sched_pc->tokens_max)
24437 + sched_pc->tokens = sched_pc->tokens_max;
24438 + tokens = sched_pc->tokens;
24440 + if ((flags & VXSF_ONHOLD)) {
24441 + /* can we unhold? */
24442 + if (tokens >= sched_pc->tokens_min) {
24443 + flags &= ~VXSF_ONHOLD;
24444 + sched_pc->hold_ticks +=
24445 + *norm_time - sched_pc->onhold;
24449 + /* put on hold? */
24450 + if (tokens <= 0) {
24451 + flags |= VXSF_ONHOLD;
24452 + sched_pc->onhold = *norm_time;
24456 + sched_pc->flags = flags;
24460 + tokens = sched_pc->tokens_min - tokens;
24461 + sched_pc->flags = flags;
24462 + // BUG_ON(tokens < 0); probably doesn't hold anymore
24464 +#ifdef CONFIG_VSERVER_HARDCPU
24465 + /* next interval? */
24466 + if (!sched_pc->fill_rate[0])
24467 + delta_min[0] = HZ;
24468 + else if (tokens > sched_pc->fill_rate[0])
24469 + delta_min[0] += sched_pc->interval[0] *
24470 + tokens / sched_pc->fill_rate[0];
24472 + delta_min[0] = sched_pc->interval[0] - delta_min[0];
24473 + vxd_check_range(delta_min[0], 0, INT_MAX);
24475 +#ifdef CONFIG_VSERVER_IDLETIME
24476 + if (!(flags & VXSF_IDLE_TIME))
24479 + /* next interval? */
24480 + if (!sched_pc->fill_rate[1])
24481 + delta_min[1] = HZ;
24482 + else if (tokens > sched_pc->fill_rate[1])
24483 + delta_min[1] += sched_pc->interval[1] *
24484 + tokens / sched_pc->fill_rate[1];
24486 + delta_min[1] = sched_pc->interval[1] - delta_min[1];
24487 + vxd_check_range(delta_min[1], 0, INT_MAX);
24492 +#endif /* CONFIG_VSERVER_IDLETIME */
24495 +#endif /* CONFIG_VSERVER_HARDCPU */
24498 +static inline unsigned long msec_to_ticks(unsigned long msec)
24500 + return msecs_to_jiffies(msec);
24503 +static inline unsigned long ticks_to_msec(unsigned long ticks)
24505 + return jiffies_to_msecs(ticks);
24508 +static inline unsigned long ticks_to_usec(unsigned long ticks)
24510 + return jiffies_to_usecs(ticks);
24514 +static int do_set_sched(struct vx_info *vxi, struct vcmd_sched_v5 *data)
24516 + unsigned int set_mask = data->mask;
24517 + unsigned int update_mask;
24520 + /* Sanity check data values */
24521 + if (data->tokens_max <= 0)
24522 + data->tokens_max = HZ;
24523 + if (data->tokens_min < 0)
24524 + data->tokens_min = HZ / 3;
24525 + if (data->tokens_min >= data->tokens_max)
24526 + data->tokens_min = data->tokens_max;
24528 + if (data->prio_bias > MAX_PRIO_BIAS)
24529 + data->prio_bias = MAX_PRIO_BIAS;
24530 + if (data->prio_bias < MIN_PRIO_BIAS)
24531 + data->prio_bias = MIN_PRIO_BIAS;
24533 + spin_lock(&vxi->sched.tokens_lock);
24535 + /* sync up on delayed updates */
24536 + for_each_cpu_mask(cpu, vxi->sched.update)
24537 + vx_update_sched_param(&vxi->sched,
24538 + &vx_per_cpu(vxi, sched_pc, cpu));
24540 + if (set_mask & VXSM_FILL_RATE)
24541 + vxi->sched.fill_rate[0] = data->fill_rate[0];
24542 + if (set_mask & VXSM_FILL_RATE2)
24543 + vxi->sched.fill_rate[1] = data->fill_rate[1];
24544 + if (set_mask & VXSM_INTERVAL)
24545 + vxi->sched.interval[0] = (set_mask & VXSM_MSEC) ?
24546 + msec_to_ticks(data->interval[0]) : data->interval[0];
24547 + if (set_mask & VXSM_INTERVAL2)
24548 + vxi->sched.interval[1] = (set_mask & VXSM_MSEC) ?
24549 + msec_to_ticks(data->interval[1]) : data->interval[1];
24550 + if (set_mask & VXSM_TOKENS)
24551 + vxi->sched.tokens = data->tokens;
24552 + if (set_mask & VXSM_TOKENS_MIN)
24553 + vxi->sched.tokens_min = data->tokens_min;
24554 + if (set_mask & VXSM_TOKENS_MAX)
24555 + vxi->sched.tokens_max = data->tokens_max;
24556 + if (set_mask & VXSM_PRIO_BIAS)
24557 + vxi->sched.prio_bias = data->prio_bias;
24559 + /* Sanity check rate/interval */
24560 + for (i = 0; i < 2; i++) {
24561 + if (data->fill_rate[i] < 0)
24562 + data->fill_rate[i] = 0;
24563 + if (data->interval[i] <= 0)
24564 + data->interval[i] = HZ;
24567 + update_mask = vxi->sched.update_mask & VXSM_SET_MASK;
24568 + update_mask |= (set_mask & (VXSM_SET_MASK | VXSM_IDLE_TIME));
24569 + vxi->sched.update_mask = update_mask;
24573 + if (set_mask & VXSM_CPU_ID) {
24574 + vxi->sched.update = cpumask_of_cpu(data->cpu_id);
24575 + cpus_and(vxi->sched.update, cpu_online_map,
24576 + vxi->sched.update);
24578 + vxi->sched.update = cpu_online_map;
24580 + /* forced reload? */
24581 + if (set_mask & VXSM_FORCE) {
24582 + for_each_cpu_mask(cpu, vxi->sched.update)
24583 + vx_update_sched_param(&vxi->sched,
24584 + &vx_per_cpu(vxi, sched_pc, cpu));
24585 + vxi->sched.update = CPU_MASK_NONE;
24588 + /* on UP we update immediately */
24589 + vx_update_sched_param(&vxi->sched,
24590 + &vx_per_cpu(vxi, sched_pc, 0));
24593 + spin_unlock(&vxi->sched.tokens_lock);
24598 +#define COPY_IDS(C) C(cpu_id); C(bucket_id)
24599 +#define COPY_PRI(C) C(prio_bias)
24600 +#define COPY_TOK(C) C(tokens); C(tokens_min); C(tokens_max)
24601 +#define COPY_FRI(C) C(fill_rate[0]); C(interval[0]); \
24602 + C(fill_rate[1]); C(interval[1]);
24604 +#define COPY_VALUE(name) vc_data.name = data->name
24606 +static int do_set_sched_v4(struct vx_info *vxi, struct vcmd_set_sched_v4 *data)
24608 + struct vcmd_sched_v5 vc_data;
24610 + vc_data.mask = data->set_mask;
24611 + COPY_IDS(COPY_VALUE);
24612 + COPY_PRI(COPY_VALUE);
24613 + COPY_TOK(COPY_VALUE);
24614 + vc_data.fill_rate[0] = vc_data.fill_rate[1] = data->fill_rate;
24615 + vc_data.interval[0] = vc_data.interval[1] = data->interval;
24616 + return do_set_sched(vxi, &vc_data);
24619 +int vc_set_sched_v4(struct vx_info *vxi, void __user *data)
24621 + struct vcmd_set_sched_v4 vc_data;
24623 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24626 + return do_set_sched_v4(vxi, &vc_data);
24629 + /* latest interface is v5 */
24631 +int vc_set_sched(struct vx_info *vxi, void __user *data)
24633 + struct vcmd_sched_v5 vc_data;
24635 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24638 + return do_set_sched(vxi, &vc_data);
24642 +#define COPY_PRI(C) C(prio_bias)
24643 +#define COPY_TOK(C) C(tokens); C(tokens_min); C(tokens_max)
24644 +#define COPY_FRI(C) C(fill_rate[0]); C(interval[0]); \
24645 + C(fill_rate[1]); C(interval[1]);
24647 +#define COPY_VALUE(name) vc_data.name = data->name
24650 +int vc_get_sched(struct vx_info *vxi, void __user *data)
24652 + struct vcmd_sched_v5 vc_data;
24654 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24657 + if (vc_data.mask & VXSM_CPU_ID) {
24658 + int cpu = vc_data.cpu_id;
24659 + struct _vx_sched_pc *data;
24661 + if (!cpu_possible(cpu))
24664 + data = &vx_per_cpu(vxi, sched_pc, cpu);
24665 + COPY_TOK(COPY_VALUE);
24666 + COPY_PRI(COPY_VALUE);
24667 + COPY_FRI(COPY_VALUE);
24669 + if (data->flags & VXSF_IDLE_TIME)
24670 + vc_data.mask |= VXSM_IDLE_TIME;
24672 + struct _vx_sched *data = &vxi->sched;
24674 + COPY_TOK(COPY_VALUE);
24675 + COPY_PRI(COPY_VALUE);
24676 + COPY_FRI(COPY_VALUE);
24679 + if (vc_data.mask & VXSM_MSEC) {
24680 + vc_data.interval[0] = ticks_to_msec(vc_data.interval[0]);
24681 + vc_data.interval[1] = ticks_to_msec(vc_data.interval[1]);
24684 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
24690 +int vc_sched_info(struct vx_info *vxi, void __user *data)
24692 + struct vcmd_sched_info vc_data;
24695 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24698 + cpu = vc_data.cpu_id;
24699 + if (!cpu_possible(cpu))
24703 + struct _vx_sched_pc *sched_pc =
24704 + &vx_per_cpu(vxi, sched_pc, cpu);
24706 + vc_data.user_msec = ticks_to_msec(sched_pc->user_ticks);
24707 + vc_data.sys_msec = ticks_to_msec(sched_pc->sys_ticks);
24708 + vc_data.hold_msec = ticks_to_msec(sched_pc->hold_ticks);
24709 + vc_data.vavavoom = sched_pc->vavavoom;
24711 + vc_data.token_usec = ticks_to_usec(1);
24713 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
24718 diff -NurpP --minimal linux-2.6.34/kernel/vserver/sched_init.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/sched_init.h
24719 --- linux-2.6.34/kernel/vserver/sched_init.h 1970-01-01 01:00:00.000000000 +0100
24720 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/sched_init.h 2010-05-18 18:11:22.000000000 +0200
24723 +static inline void vx_info_init_sched(struct _vx_sched *sched)
24725 + static struct lock_class_key tokens_lock_key;
24727 + /* scheduling; hard code starting values as constants */
24728 + sched->fill_rate[0] = 1;
24729 + sched->interval[0] = 4;
24730 + sched->fill_rate[1] = 1;
24731 + sched->interval[1] = 8;
24732 + sched->tokens = HZ >> 2;
24733 + sched->tokens_min = HZ >> 4;
24734 + sched->tokens_max = HZ >> 1;
24735 + sched->tokens_lock = SPIN_LOCK_UNLOCKED;
24736 + sched->prio_bias = 0;
24738 + lockdep_set_class(&sched->tokens_lock, &tokens_lock_key);
24742 +void vx_info_init_sched_pc(struct _vx_sched_pc *sched_pc, int cpu)
24744 + sched_pc->fill_rate[0] = 1;
24745 + sched_pc->interval[0] = 4;
24746 + sched_pc->fill_rate[1] = 1;
24747 + sched_pc->interval[1] = 8;
24748 + sched_pc->tokens = HZ >> 2;
24749 + sched_pc->tokens_min = HZ >> 4;
24750 + sched_pc->tokens_max = HZ >> 1;
24751 + sched_pc->prio_bias = 0;
24752 + sched_pc->vavavoom = 0;
24753 + sched_pc->token_time = 0;
24754 + sched_pc->idle_time = 0;
24755 + sched_pc->norm_time = jiffies;
24757 + sched_pc->user_ticks = 0;
24758 + sched_pc->sys_ticks = 0;
24759 + sched_pc->hold_ticks = 0;
24762 +static inline void vx_info_exit_sched(struct _vx_sched *sched)
24768 +void vx_info_exit_sched_pc(struct _vx_sched_pc *sched_pc, int cpu)
24772 diff -NurpP --minimal linux-2.6.34/kernel/vserver/sched_proc.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/sched_proc.h
24773 --- linux-2.6.34/kernel/vserver/sched_proc.h 1970-01-01 01:00:00.000000000 +0100
24774 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/sched_proc.h 2010-05-18 18:11:22.000000000 +0200
24776 +#ifndef _VX_SCHED_PROC_H
24777 +#define _VX_SCHED_PROC_H
24781 +int vx_info_proc_sched(struct _vx_sched *sched, char *buffer)
24785 + length += sprintf(buffer,
24786 + "FillRate:\t%8d,%d\n"
24787 + "Interval:\t%8d,%d\n"
24788 + "TokensMin:\t%8d\n"
24789 + "TokensMax:\t%8d\n"
24790 + "PrioBias:\t%8d\n",
24791 + sched->fill_rate[0],
24792 + sched->fill_rate[1],
24793 + sched->interval[0],
24794 + sched->interval[1],
24795 + sched->tokens_min,
24796 + sched->tokens_max,
24797 + sched->prio_bias);
24802 +int vx_info_proc_sched_pc(struct _vx_sched_pc *sched_pc,
24803 + char *buffer, int cpu)
24807 + length += sprintf(buffer + length,
24808 + "cpu %d: %lld %lld %lld %ld %ld", cpu,
24809 + (unsigned long long)sched_pc->user_ticks,
24810 + (unsigned long long)sched_pc->sys_ticks,
24811 + (unsigned long long)sched_pc->hold_ticks,
24812 + sched_pc->token_time,
24813 + sched_pc->idle_time);
24814 + length += sprintf(buffer + length,
24815 + " %c%c %d %d %d %d/%d %d/%d",
24816 + (sched_pc->flags & VXSF_ONHOLD) ? 'H' : 'R',
24817 + (sched_pc->flags & VXSF_IDLE_TIME) ? 'I' : '-',
24818 + sched_pc->tokens,
24819 + sched_pc->tokens_min,
24820 + sched_pc->tokens_max,
24821 + sched_pc->fill_rate[0],
24822 + sched_pc->interval[0],
24823 + sched_pc->fill_rate[1],
24824 + sched_pc->interval[1]);
24825 + length += sprintf(buffer + length,
24827 + sched_pc->prio_bias,
24828 + sched_pc->vavavoom);
24832 +#endif /* _VX_SCHED_PROC_H */
24833 diff -NurpP --minimal linux-2.6.34/kernel/vserver/signal.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/signal.c
24834 --- linux-2.6.34/kernel/vserver/signal.c 1970-01-01 01:00:00.000000000 +0100
24835 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/signal.c 2010-05-18 18:11:22.000000000 +0200
24838 + * linux/kernel/vserver/signal.c
24840 + * Virtual Server: Signal Support
24842 + * Copyright (C) 2003-2007 Herbert Pötzl
24844 + * V0.01 broken out from vcontext V0.05
24845 + * V0.02 changed vcmds to vxi arg
24846 + * V0.03 adjusted siginfo for kill
24850 +#include <asm/uaccess.h>
24852 +#include <linux/vs_context.h>
24853 +#include <linux/vs_pid.h>
24854 +#include <linux/vserver/signal_cmd.h>
24857 +int vx_info_kill(struct vx_info *vxi, int pid, int sig)
24859 + int retval, count = 0;
24860 + struct task_struct *p;
24861 + struct siginfo *sip = SEND_SIG_PRIV;
24864 + vxdprintk(VXD_CBIT(misc, 4),
24865 + "vx_info_kill(%p[#%d],%d,%d)*",
24866 + vxi, vxi->vx_id, pid, sig);
24867 + read_lock(&tasklist_lock);
24871 + for_each_process(p) {
24874 + if (vx_task_xid(p) != vxi->vx_id || p->pid <= 1 ||
24875 + (pid && vxi->vx_initpid == p->pid))
24878 + err = group_send_sig_info(sig, sip, p);
24880 + if (err != -EPERM)
24886 + if (vxi->vx_initpid) {
24887 + pid = vxi->vx_initpid;
24888 + /* for now, only SIGINT to private init ... */
24889 + if (!vx_info_flags(vxi, VXF_STATE_ADMIN, 0) &&
24890 + /* ... as long as there are tasks left */
24891 + (atomic_read(&vxi->vx_tasks) > 1))
24894 + /* fallthrough */
24896 + p = find_task_by_real_pid(pid);
24898 + if (vx_task_xid(p) == vxi->vx_id)
24899 + retval = group_send_sig_info(sig, sip, p);
24903 + read_unlock(&tasklist_lock);
24904 + vxdprintk(VXD_CBIT(misc, 4),
24905 + "vx_info_kill(%p[#%d],%d,%d,%ld) = %d",
24906 + vxi, vxi->vx_id, pid, sig, (long)sip, retval);
24910 +int vc_ctx_kill(struct vx_info *vxi, void __user *data)
24912 + struct vcmd_ctx_kill_v0 vc_data;
24914 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
24917 + /* special check to allow guest shutdown */
24918 + if (!vx_info_flags(vxi, VXF_STATE_ADMIN, 0) &&
24919 + /* forbid killall pid=0 when init is present */
24920 + (((vc_data.pid < 1) && vxi->vx_initpid) ||
24921 + (vc_data.pid > 1)))
24924 + return vx_info_kill(vxi, vc_data.pid, vc_data.sig);
24928 +static int __wait_exit(struct vx_info *vxi)
24930 + DECLARE_WAITQUEUE(wait, current);
24933 + add_wait_queue(&vxi->vx_wait, &wait);
24934 + set_current_state(TASK_INTERRUPTIBLE);
24937 + if (vx_info_state(vxi,
24938 + VXS_SHUTDOWN | VXS_HASHED | VXS_HELPER) == VXS_SHUTDOWN)
24940 + if (signal_pending(current)) {
24941 + ret = -ERESTARTSYS;
24948 + set_current_state(TASK_RUNNING);
24949 + remove_wait_queue(&vxi->vx_wait, &wait);
24955 +int vc_wait_exit(struct vx_info *vxi, void __user *data)
24957 + struct vcmd_wait_exit_v0 vc_data;
24960 + ret = __wait_exit(vxi);
24961 + vc_data.reboot_cmd = vxi->reboot_cmd;
24962 + vc_data.exit_code = vxi->exit_code;
24964 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
24969 diff -NurpP --minimal linux-2.6.34/kernel/vserver/space.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/space.c
24970 --- linux-2.6.34/kernel/vserver/space.c 1970-01-01 01:00:00.000000000 +0100
24971 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/space.c 2010-05-18 18:11:22.000000000 +0200
24974 + * linux/kernel/vserver/space.c
24976 + * Virtual Server: Context Space Support
24978 + * Copyright (C) 2003-2007 Herbert Pötzl
24980 + * V0.01 broken out from context.c 0.07
24981 + * V0.02 added task locking for namespace
24982 + * V0.03 broken out vx_enter_namespace
24983 + * V0.04 added *space support and commands
24987 +#include <linux/utsname.h>
24988 +#include <linux/nsproxy.h>
24989 +#include <linux/err.h>
24990 +#include <linux/fs_struct.h>
24991 +#include <asm/uaccess.h>
24993 +#include <linux/vs_context.h>
24994 +#include <linux/vserver/space.h>
24995 +#include <linux/vserver/space_cmd.h>
24997 +atomic_t vs_global_nsproxy = ATOMIC_INIT(0);
24998 +atomic_t vs_global_fs = ATOMIC_INIT(0);
24999 +atomic_t vs_global_mnt_ns = ATOMIC_INIT(0);
25000 +atomic_t vs_global_uts_ns = ATOMIC_INIT(0);
25001 +atomic_t vs_global_user_ns = ATOMIC_INIT(0);
25002 +atomic_t vs_global_pid_ns = ATOMIC_INIT(0);
25005 +/* namespace functions */
25007 +#include <linux/mnt_namespace.h>
25008 +#include <linux/user_namespace.h>
25009 +#include <linux/pid_namespace.h>
25010 +#include <linux/ipc_namespace.h>
25011 +#include <net/net_namespace.h>
25014 +static const struct vcmd_space_mask_v1 space_mask_v0 = {
25015 + .mask = CLONE_FS |
25023 +static const struct vcmd_space_mask_v1 space_mask = {
25024 + .mask = CLONE_FS |
25029 +#ifdef CONFIG_PID_NS
25032 +#ifdef CONFIG_NET_NS
25038 +static const struct vcmd_space_mask_v1 default_space_mask = {
25039 + .mask = CLONE_FS |
25044 +#ifdef CONFIG_PID_NS
25051 + * build a new nsproxy mix
25052 + * assumes that both proxies are 'const'
25053 + * does not touch nsproxy refcounts
25054 + * will hold a reference on the result.
25057 +struct nsproxy *vs_mix_nsproxy(struct nsproxy *old_nsproxy,
25058 + struct nsproxy *new_nsproxy, unsigned long mask)
25060 + struct mnt_namespace *old_ns;
25061 + struct uts_namespace *old_uts;
25062 + struct ipc_namespace *old_ipc;
25063 +#ifdef CONFIG_PID_NS
25064 + struct pid_namespace *old_pid;
25066 +#ifdef CONFIG_NET_NS
25067 + struct net *old_net;
25069 + struct nsproxy *nsproxy;
25071 + nsproxy = copy_nsproxy(old_nsproxy);
25075 + if (mask & CLONE_NEWNS) {
25076 + old_ns = nsproxy->mnt_ns;
25077 + nsproxy->mnt_ns = new_nsproxy->mnt_ns;
25078 + if (nsproxy->mnt_ns)
25079 + get_mnt_ns(nsproxy->mnt_ns);
25083 + if (mask & CLONE_NEWUTS) {
25084 + old_uts = nsproxy->uts_ns;
25085 + nsproxy->uts_ns = new_nsproxy->uts_ns;
25086 + if (nsproxy->uts_ns)
25087 + get_uts_ns(nsproxy->uts_ns);
25091 + if (mask & CLONE_NEWIPC) {
25092 + old_ipc = nsproxy->ipc_ns;
25093 + nsproxy->ipc_ns = new_nsproxy->ipc_ns;
25094 + if (nsproxy->ipc_ns)
25095 + get_ipc_ns(nsproxy->ipc_ns);
25099 +#ifdef CONFIG_PID_NS
25100 + if (mask & CLONE_NEWPID) {
25101 + old_pid = nsproxy->pid_ns;
25102 + nsproxy->pid_ns = new_nsproxy->pid_ns;
25103 + if (nsproxy->pid_ns)
25104 + get_pid_ns(nsproxy->pid_ns);
25108 +#ifdef CONFIG_NET_NS
25109 + if (mask & CLONE_NEWNET) {
25110 + old_net = nsproxy->net_ns;
25111 + nsproxy->net_ns = new_nsproxy->net_ns;
25112 + if (nsproxy->net_ns)
25113 + get_net(nsproxy->net_ns);
25118 + put_mnt_ns(old_ns);
25120 + put_uts_ns(old_uts);
25122 + put_ipc_ns(old_ipc);
25123 +#ifdef CONFIG_PID_NS
25125 + put_pid_ns(old_pid);
25127 +#ifdef CONFIG_NET_NS
25129 + put_net(old_net);
25137 + * merge two nsproxy structs into a new one.
25138 + * will hold a reference on the result.
25142 +struct nsproxy *__vs_merge_nsproxy(struct nsproxy *old,
25143 + struct nsproxy *proxy, unsigned long mask)
25145 + struct nsproxy null_proxy = { .mnt_ns = NULL };
25151 + /* vs_mix_nsproxy returns with reference */
25152 + return vs_mix_nsproxy(old ? old : &null_proxy,
25155 + get_nsproxy(proxy);
25160 +int vx_enter_space(struct vx_info *vxi, unsigned long mask, unsigned index)
25162 + struct nsproxy *proxy, *proxy_cur, *proxy_new;
25163 + struct fs_struct *fs_cur, *fs = NULL;
25164 + int ret, kill = 0;
25166 + vxdprintk(VXD_CBIT(space, 8), "vx_enter_space(%p[#%u],0x%08lx,%d)",
25167 + vxi, vxi->vx_id, mask, index);
25169 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0))
25173 + mask = vxi->vx_nsmask[index];
25175 + if ((mask & vxi->vx_nsmask[index]) != mask)
25178 + if (mask & CLONE_FS) {
25179 + fs = copy_fs_struct(vxi->vx_fs[index]);
25183 + proxy = vxi->vx_nsproxy[index];
25185 + vxdprintk(VXD_CBIT(space, 9),
25186 + "vx_enter_space(%p[#%u],0x%08lx,%d) -> (%p,%p)",
25187 + vxi, vxi->vx_id, mask, index, proxy, fs);
25189 + task_lock(current);
25190 + fs_cur = current->fs;
25192 + if (mask & CLONE_FS) {
25193 + write_lock(&fs_cur->lock);
25194 + current->fs = fs;
25195 + kill = !--fs_cur->users;
25196 + write_unlock(&fs_cur->lock);
25199 + proxy_cur = current->nsproxy;
25200 + get_nsproxy(proxy_cur);
25201 + task_unlock(current);
25204 + free_fs_struct(fs_cur);
25206 + proxy_new = __vs_merge_nsproxy(proxy_cur, proxy, mask);
25207 + if (IS_ERR(proxy_new)) {
25208 + ret = PTR_ERR(proxy_new);
25212 + proxy_new = xchg(¤t->nsproxy, proxy_new);
25216 + put_nsproxy(proxy_new);
25219 + put_nsproxy(proxy_cur);
25224 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index)
25226 + struct nsproxy *proxy_vxi, *proxy_cur, *proxy_new;
25227 + struct fs_struct *fs_vxi, *fs;
25228 + int ret, kill = 0;
25230 + vxdprintk(VXD_CBIT(space, 8), "vx_set_space(%p[#%u],0x%08lx,%d)",
25231 + vxi, vxi->vx_id, mask, index);
25234 + mask = default_space_mask.mask;
25236 + if ((mask & space_mask.mask) != mask)
25239 + proxy_vxi = vxi->vx_nsproxy[index];
25240 + fs_vxi = vxi->vx_fs[index];
25242 + if (mask & CLONE_FS) {
25243 + fs = copy_fs_struct(current->fs);
25248 + task_lock(current);
25250 + if (mask & CLONE_FS) {
25251 + write_lock(&fs_vxi->lock);
25252 + vxi->vx_fs[index] = fs;
25253 + kill = !--fs_vxi->users;
25254 + write_unlock(&fs_vxi->lock);
25257 + proxy_cur = current->nsproxy;
25258 + get_nsproxy(proxy_cur);
25259 + task_unlock(current);
25262 + free_fs_struct(fs_vxi);
25264 + proxy_new = __vs_merge_nsproxy(proxy_vxi, proxy_cur, mask);
25265 + if (IS_ERR(proxy_new)) {
25266 + ret = PTR_ERR(proxy_new);
25270 + proxy_new = xchg(&vxi->vx_nsproxy[index], proxy_new);
25271 + vxi->vx_nsmask[index] |= mask;
25275 + put_nsproxy(proxy_new);
25278 + put_nsproxy(proxy_cur);
25283 +int vc_enter_space_v1(struct vx_info *vxi, void __user *data)
25285 + struct vcmd_space_mask_v1 vc_data = { .mask = 0 };
25287 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25290 + return vx_enter_space(vxi, vc_data.mask, 0);
25293 +int vc_enter_space(struct vx_info *vxi, void __user *data)
25295 + struct vcmd_space_mask_v2 vc_data = { .mask = 0 };
25297 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25300 + if (vc_data.index >= VX_SPACES)
25303 + return vx_enter_space(vxi, vc_data.mask, vc_data.index);
25306 +int vc_set_space_v1(struct vx_info *vxi, void __user *data)
25308 + struct vcmd_space_mask_v1 vc_data = { .mask = 0 };
25310 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25313 + return vx_set_space(vxi, vc_data.mask, 0);
25316 +int vc_set_space(struct vx_info *vxi, void __user *data)
25318 + struct vcmd_space_mask_v2 vc_data = { .mask = 0 };
25320 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25323 + if (vc_data.index >= VX_SPACES)
25326 + return vx_set_space(vxi, vc_data.mask, vc_data.index);
25329 +int vc_get_space_mask(void __user *data, int type)
25331 + const struct vcmd_space_mask_v1 *mask;
25334 + mask = &space_mask_v0;
25335 + else if (type == 1)
25336 + mask = &space_mask;
25338 + mask = &default_space_mask;
25340 + vxdprintk(VXD_CBIT(space, 10),
25341 + "vc_get_space_mask(%d) = %08llx", type, mask->mask);
25343 + if (copy_to_user(data, mask, sizeof(*mask)))
25348 diff -NurpP --minimal linux-2.6.34/kernel/vserver/switch.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/switch.c
25349 --- linux-2.6.34/kernel/vserver/switch.c 1970-01-01 01:00:00.000000000 +0100
25350 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/switch.c 2010-05-18 18:11:22.000000000 +0200
25353 + * linux/kernel/vserver/switch.c
25355 + * Virtual Server: Syscall Switch
25357 + * Copyright (C) 2003-2007 Herbert Pötzl
25359 + * V0.01 syscall switch
25360 + * V0.02 added signal to context
25361 + * V0.03 added rlimit functions
25362 + * V0.04 added iattr, task/xid functions
25363 + * V0.05 added debug/history stuff
25364 + * V0.06 added compat32 layer
25365 + * V0.07 vcmd args and perms
25366 + * V0.08 added status commands
25367 + * V0.09 added tag commands
25368 + * V0.10 added oom bias
25369 + * V0.11 added device commands
25373 +#include <linux/vs_context.h>
25374 +#include <linux/vs_network.h>
25375 +#include <linux/vserver/switch.h>
25377 +#include "vci_config.h"
25381 +int vc_get_version(uint32_t id)
25383 + return VCI_VERSION;
25387 +int vc_get_vci(uint32_t id)
25389 + return vci_kernel_config();
25392 +#include <linux/vserver/context_cmd.h>
25393 +#include <linux/vserver/cvirt_cmd.h>
25394 +#include <linux/vserver/cacct_cmd.h>
25395 +#include <linux/vserver/limit_cmd.h>
25396 +#include <linux/vserver/network_cmd.h>
25397 +#include <linux/vserver/sched_cmd.h>
25398 +#include <linux/vserver/debug_cmd.h>
25399 +#include <linux/vserver/inode_cmd.h>
25400 +#include <linux/vserver/dlimit_cmd.h>
25401 +#include <linux/vserver/signal_cmd.h>
25402 +#include <linux/vserver/space_cmd.h>
25403 +#include <linux/vserver/tag_cmd.h>
25404 +#include <linux/vserver/device_cmd.h>
25406 +#include <linux/vserver/inode.h>
25407 +#include <linux/vserver/dlimit.h>
25410 +#ifdef CONFIG_COMPAT
25411 +#define __COMPAT(name, id, data, compat) \
25412 + (compat) ? name ## _x32(id, data) : name(id, data)
25413 +#define __COMPAT_NO_ID(name, data, compat) \
25414 + (compat) ? name ## _x32(data) : name(data)
25416 +#define __COMPAT(name, id, data, compat) \
25418 +#define __COMPAT_NO_ID(name, data, compat) \
25424 +long do_vcmd(uint32_t cmd, uint32_t id,
25425 + struct vx_info *vxi, struct nx_info *nxi,
25426 + void __user *data, int compat)
25430 + case VCMD_get_version:
25431 + return vc_get_version(id);
25432 + case VCMD_get_vci:
25433 + return vc_get_vci(id);
25435 + case VCMD_task_xid:
25436 + return vc_task_xid(id);
25437 + case VCMD_vx_info:
25438 + return vc_vx_info(vxi, data);
25440 + case VCMD_task_nid:
25441 + return vc_task_nid(id);
25442 + case VCMD_nx_info:
25443 + return vc_nx_info(nxi, data);
25445 + case VCMD_task_tag:
25446 + return vc_task_tag(id);
25448 + case VCMD_set_space_v1:
25449 + return vc_set_space_v1(vxi, data);
25450 + /* this is version 2 */
25451 + case VCMD_set_space:
25452 + return vc_set_space(vxi, data);
25454 + case VCMD_get_space_mask_v0:
25455 + return vc_get_space_mask(data, 0);
25456 + /* this is version 1 */
25457 + case VCMD_get_space_mask:
25458 + return vc_get_space_mask(data, 1);
25460 + case VCMD_get_space_default:
25461 + return vc_get_space_mask(data, -1);
25463 +#ifdef CONFIG_IA32_EMULATION
25464 + case VCMD_get_rlimit:
25465 + return __COMPAT(vc_get_rlimit, vxi, data, compat);
25466 + case VCMD_set_rlimit:
25467 + return __COMPAT(vc_set_rlimit, vxi, data, compat);
25469 + case VCMD_get_rlimit:
25470 + return vc_get_rlimit(vxi, data);
25471 + case VCMD_set_rlimit:
25472 + return vc_set_rlimit(vxi, data);
25474 + case VCMD_get_rlimit_mask:
25475 + return vc_get_rlimit_mask(id, data);
25476 + case VCMD_reset_hits:
25477 + return vc_reset_hits(vxi, data);
25478 + case VCMD_reset_minmax:
25479 + return vc_reset_minmax(vxi, data);
25481 + case VCMD_get_vhi_name:
25482 + return vc_get_vhi_name(vxi, data);
25483 + case VCMD_set_vhi_name:
25484 + return vc_set_vhi_name(vxi, data);
25486 + case VCMD_ctx_stat:
25487 + return vc_ctx_stat(vxi, data);
25488 + case VCMD_virt_stat:
25489 + return vc_virt_stat(vxi, data);
25490 + case VCMD_sock_stat:
25491 + return vc_sock_stat(vxi, data);
25492 + case VCMD_rlimit_stat:
25493 + return vc_rlimit_stat(vxi, data);
25495 + case VCMD_set_cflags:
25496 + return vc_set_cflags(vxi, data);
25497 + case VCMD_get_cflags:
25498 + return vc_get_cflags(vxi, data);
25500 + /* this is version 1 */
25501 + case VCMD_set_ccaps:
25502 + return vc_set_ccaps(vxi, data);
25503 + /* this is version 1 */
25504 + case VCMD_get_ccaps:
25505 + return vc_get_ccaps(vxi, data);
25506 + case VCMD_set_bcaps:
25507 + return vc_set_bcaps(vxi, data);
25508 + case VCMD_get_bcaps:
25509 + return vc_get_bcaps(vxi, data);
25511 + case VCMD_set_badness:
25512 + return vc_set_badness(vxi, data);
25513 + case VCMD_get_badness:
25514 + return vc_get_badness(vxi, data);
25516 + case VCMD_set_nflags:
25517 + return vc_set_nflags(nxi, data);
25518 + case VCMD_get_nflags:
25519 + return vc_get_nflags(nxi, data);
25521 + case VCMD_set_ncaps:
25522 + return vc_set_ncaps(nxi, data);
25523 + case VCMD_get_ncaps:
25524 + return vc_get_ncaps(nxi, data);
25526 + case VCMD_set_sched_v4:
25527 + return vc_set_sched_v4(vxi, data);
25528 + /* this is version 5 */
25529 + case VCMD_set_sched:
25530 + return vc_set_sched(vxi, data);
25531 + case VCMD_get_sched:
25532 + return vc_get_sched(vxi, data);
25533 + case VCMD_sched_info:
25534 + return vc_sched_info(vxi, data);
25536 + case VCMD_add_dlimit:
25537 + return __COMPAT(vc_add_dlimit, id, data, compat);
25538 + case VCMD_rem_dlimit:
25539 + return __COMPAT(vc_rem_dlimit, id, data, compat);
25540 + case VCMD_set_dlimit:
25541 + return __COMPAT(vc_set_dlimit, id, data, compat);
25542 + case VCMD_get_dlimit:
25543 + return __COMPAT(vc_get_dlimit, id, data, compat);
25545 + case VCMD_ctx_kill:
25546 + return vc_ctx_kill(vxi, data);
25548 + case VCMD_wait_exit:
25549 + return vc_wait_exit(vxi, data);
25551 + case VCMD_get_iattr:
25552 + return __COMPAT_NO_ID(vc_get_iattr, data, compat);
25553 + case VCMD_set_iattr:
25554 + return __COMPAT_NO_ID(vc_set_iattr, data, compat);
25556 + case VCMD_fget_iattr:
25557 + return vc_fget_iattr(id, data);
25558 + case VCMD_fset_iattr:
25559 + return vc_fset_iattr(id, data);
25561 + case VCMD_enter_space_v0:
25562 + return vc_enter_space_v1(vxi, NULL);
25563 + case VCMD_enter_space_v1:
25564 + return vc_enter_space_v1(vxi, data);
25565 + /* this is version 2 */
25566 + case VCMD_enter_space:
25567 + return vc_enter_space(vxi, data);
25569 + case VCMD_ctx_create_v0:
25570 + return vc_ctx_create(id, NULL);
25571 + case VCMD_ctx_create:
25572 + return vc_ctx_create(id, data);
25573 + case VCMD_ctx_migrate_v0:
25574 + return vc_ctx_migrate(vxi, NULL);
25575 + case VCMD_ctx_migrate:
25576 + return vc_ctx_migrate(vxi, data);
25578 + case VCMD_net_create_v0:
25579 + return vc_net_create(id, NULL);
25580 + case VCMD_net_create:
25581 + return vc_net_create(id, data);
25582 + case VCMD_net_migrate:
25583 + return vc_net_migrate(nxi, data);
25585 + case VCMD_tag_migrate:
25586 + return vc_tag_migrate(id);
25588 + case VCMD_net_add:
25589 + return vc_net_add(nxi, data);
25590 + case VCMD_net_remove:
25591 + return vc_net_remove(nxi, data);
25593 + case VCMD_net_add_ipv4:
25594 + return vc_net_add_ipv4(nxi, data);
25595 + case VCMD_net_remove_ipv4:
25596 + return vc_net_remove_ipv4(nxi, data);
25597 +#ifdef CONFIG_IPV6
25598 + case VCMD_net_add_ipv6:
25599 + return vc_net_add_ipv6(nxi, data);
25600 + case VCMD_net_remove_ipv6:
25601 + return vc_net_remove_ipv6(nxi, data);
25603 +/* case VCMD_add_match_ipv4:
25604 + return vc_add_match_ipv4(nxi, data);
25605 + case VCMD_get_match_ipv4:
25606 + return vc_get_match_ipv4(nxi, data);
25607 +#ifdef CONFIG_IPV6
25608 + case VCMD_add_match_ipv6:
25609 + return vc_add_match_ipv6(nxi, data);
25610 + case VCMD_get_match_ipv6:
25611 + return vc_get_match_ipv6(nxi, data);
25614 +#ifdef CONFIG_VSERVER_DEVICE
25615 + case VCMD_set_mapping:
25616 + return __COMPAT(vc_set_mapping, vxi, data, compat);
25617 + case VCMD_unset_mapping:
25618 + return __COMPAT(vc_unset_mapping, vxi, data, compat);
25620 +#ifdef CONFIG_VSERVER_HISTORY
25621 + case VCMD_dump_history:
25622 + return vc_dump_history(id);
25623 + case VCMD_read_history:
25624 + return __COMPAT(vc_read_history, id, data, compat);
25626 +#ifdef CONFIG_VSERVER_MONITOR
25627 + case VCMD_read_monitor:
25628 + return __COMPAT(vc_read_monitor, id, data, compat);
25631 + vxwprintk_task(1, "unimplemented VCMD_%02d_%d[%d]",
25632 + VC_CATEGORY(cmd), VC_COMMAND(cmd), VC_VERSION(cmd));
25638 +#define __VCMD(vcmd, _perm, _args, _flags) \
25639 + case VCMD_ ## vcmd: perm = _perm; \
25640 + args = _args; flags = _flags; break
25643 +#define VCA_NONE 0x00
25644 +#define VCA_VXI 0x01
25645 +#define VCA_NXI 0x02
25647 +#define VCF_NONE 0x00
25648 +#define VCF_INFO 0x01
25649 +#define VCF_ADMIN 0x02
25650 +#define VCF_ARES 0x06 /* includes admin */
25651 +#define VCF_SETUP 0x08
25653 +#define VCF_ZIDOK 0x10 /* zero id okay */
25657 +long do_vserver(uint32_t cmd, uint32_t id, void __user *data, int compat)
25660 + int permit = -1, state = 0;
25661 + int perm = -1, args = 0, flags = 0;
25662 + struct vx_info *vxi = NULL;
25663 + struct nx_info *nxi = NULL;
25666 + /* unpriviledged commands */
25667 + __VCMD(get_version, 0, VCA_NONE, 0);
25668 + __VCMD(get_vci, 0, VCA_NONE, 0);
25669 + __VCMD(get_rlimit_mask, 0, VCA_NONE, 0);
25670 + __VCMD(get_space_mask_v0,0, VCA_NONE, 0);
25671 + __VCMD(get_space_mask, 0, VCA_NONE, 0);
25672 + __VCMD(get_space_default,0, VCA_NONE, 0);
25674 + /* info commands */
25675 + __VCMD(task_xid, 2, VCA_NONE, 0);
25676 + __VCMD(reset_hits, 2, VCA_VXI, 0);
25677 + __VCMD(reset_minmax, 2, VCA_VXI, 0);
25678 + __VCMD(vx_info, 3, VCA_VXI, VCF_INFO);
25679 + __VCMD(get_bcaps, 3, VCA_VXI, VCF_INFO);
25680 + __VCMD(get_ccaps, 3, VCA_VXI, VCF_INFO);
25681 + __VCMD(get_cflags, 3, VCA_VXI, VCF_INFO);
25682 + __VCMD(get_badness, 3, VCA_VXI, VCF_INFO);
25683 + __VCMD(get_vhi_name, 3, VCA_VXI, VCF_INFO);
25684 + __VCMD(get_rlimit, 3, VCA_VXI, VCF_INFO);
25686 + __VCMD(ctx_stat, 3, VCA_VXI, VCF_INFO);
25687 + __VCMD(virt_stat, 3, VCA_VXI, VCF_INFO);
25688 + __VCMD(sock_stat, 3, VCA_VXI, VCF_INFO);
25689 + __VCMD(rlimit_stat, 3, VCA_VXI, VCF_INFO);
25691 + __VCMD(task_nid, 2, VCA_NONE, 0);
25692 + __VCMD(nx_info, 3, VCA_NXI, VCF_INFO);
25693 + __VCMD(get_ncaps, 3, VCA_NXI, VCF_INFO);
25694 + __VCMD(get_nflags, 3, VCA_NXI, VCF_INFO);
25696 + __VCMD(task_tag, 2, VCA_NONE, 0);
25698 + __VCMD(get_iattr, 2, VCA_NONE, 0);
25699 + __VCMD(fget_iattr, 2, VCA_NONE, 0);
25700 + __VCMD(get_dlimit, 3, VCA_NONE, VCF_INFO);
25701 + __VCMD(get_sched, 3, VCA_VXI, VCF_INFO);
25702 + __VCMD(sched_info, 3, VCA_VXI, VCF_INFO | VCF_ZIDOK);
25704 + /* lower admin commands */
25705 + __VCMD(wait_exit, 4, VCA_VXI, VCF_INFO);
25706 + __VCMD(ctx_create_v0, 5, VCA_NONE, 0);
25707 + __VCMD(ctx_create, 5, VCA_NONE, 0);
25708 + __VCMD(ctx_migrate_v0, 5, VCA_VXI, VCF_ADMIN);
25709 + __VCMD(ctx_migrate, 5, VCA_VXI, VCF_ADMIN);
25710 + __VCMD(enter_space_v0, 5, VCA_VXI, VCF_ADMIN);
25711 + __VCMD(enter_space_v1, 5, VCA_VXI, VCF_ADMIN);
25712 + __VCMD(enter_space, 5, VCA_VXI, VCF_ADMIN);
25714 + __VCMD(net_create_v0, 5, VCA_NONE, 0);
25715 + __VCMD(net_create, 5, VCA_NONE, 0);
25716 + __VCMD(net_migrate, 5, VCA_NXI, VCF_ADMIN);
25718 + __VCMD(tag_migrate, 5, VCA_NONE, VCF_ADMIN);
25720 + /* higher admin commands */
25721 + __VCMD(ctx_kill, 6, VCA_VXI, VCF_ARES);
25722 + __VCMD(set_space_v1, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25723 + __VCMD(set_space, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25725 + __VCMD(set_ccaps, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25726 + __VCMD(set_bcaps, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25727 + __VCMD(set_cflags, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25728 + __VCMD(set_badness, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25730 + __VCMD(set_vhi_name, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25731 + __VCMD(set_rlimit, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25732 + __VCMD(set_sched, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25733 + __VCMD(set_sched_v4, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
25735 + __VCMD(set_ncaps, 7, VCA_NXI, VCF_ARES | VCF_SETUP);
25736 + __VCMD(set_nflags, 7, VCA_NXI, VCF_ARES | VCF_SETUP);
25737 + __VCMD(net_add, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25738 + __VCMD(net_remove, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25739 + __VCMD(net_add_ipv4, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25740 + __VCMD(net_remove_ipv4, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25741 +#ifdef CONFIG_IPV6
25742 + __VCMD(net_add_ipv6, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25743 + __VCMD(net_remove_ipv6, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
25745 + __VCMD(set_iattr, 7, VCA_NONE, 0);
25746 + __VCMD(fset_iattr, 7, VCA_NONE, 0);
25747 + __VCMD(set_dlimit, 7, VCA_NONE, VCF_ARES);
25748 + __VCMD(add_dlimit, 8, VCA_NONE, VCF_ARES);
25749 + __VCMD(rem_dlimit, 8, VCA_NONE, VCF_ARES);
25751 +#ifdef CONFIG_VSERVER_DEVICE
25752 + __VCMD(set_mapping, 8, VCA_VXI, VCF_ARES|VCF_ZIDOK);
25753 + __VCMD(unset_mapping, 8, VCA_VXI, VCF_ARES|VCF_ZIDOK);
25755 + /* debug level admin commands */
25756 +#ifdef CONFIG_VSERVER_HISTORY
25757 + __VCMD(dump_history, 9, VCA_NONE, 0);
25758 + __VCMD(read_history, 9, VCA_NONE, 0);
25760 +#ifdef CONFIG_VSERVER_MONITOR
25761 + __VCMD(read_monitor, 9, VCA_NONE, 0);
25768 + vxdprintk(VXD_CBIT(switch, 0),
25769 + "vc: VCMD_%02d_%d[%d], %d,%p [%d,%d,%x,%x]",
25770 + VC_CATEGORY(cmd), VC_COMMAND(cmd),
25771 + VC_VERSION(cmd), id, data, compat,
25772 + perm, args, flags);
25779 + if (!capable(CAP_CONTEXT))
25783 + /* moved here from the individual commands */
25785 + if ((perm > 1) && !capable(CAP_SYS_ADMIN))
25789 + /* vcmd involves resource management */
25791 + if ((flags & VCF_ARES) && !capable(CAP_SYS_RESOURCE))
25795 + /* various legacy exceptions */
25797 + /* will go away when spectator is a cap */
25798 + case VCMD_ctx_migrate_v0:
25799 + case VCMD_ctx_migrate:
25801 + current->xid = 1;
25807 + /* will go away when spectator is a cap */
25808 + case VCMD_net_migrate:
25810 + current->nid = 1;
25817 + /* vcmds are fine by default */
25820 + /* admin type vcmds require admin ... */
25821 + if (flags & VCF_ADMIN)
25822 + permit = vx_check(0, VS_ADMIN) ? 1 : 0;
25824 + /* ... but setup type vcmds override that */
25825 + if (!permit && (flags & VCF_SETUP))
25826 + permit = vx_flags(VXF_STATE_SETUP, 0) ? 2 : 0;
25834 + if (!id && (flags & VCF_ZIDOK))
25838 + if (args & VCA_VXI) {
25839 + vxi = lookup_vx_info(id);
25843 + if ((flags & VCF_ADMIN) &&
25844 + /* special case kill for shutdown */
25845 + (cmd != VCMD_ctx_kill) &&
25846 + /* can context be administrated? */
25847 + !vx_info_flags(vxi, VXF_STATE_ADMIN, 0)) {
25853 + if (args & VCA_NXI) {
25854 + nxi = lookup_nx_info(id);
25858 + if ((flags & VCF_ADMIN) &&
25859 + /* can context be administrated? */
25860 + !nx_info_flags(nxi, NXF_STATE_ADMIN, 0)) {
25867 + ret = do_vcmd(cmd, id, vxi, nxi, data, compat);
25870 + if ((args & VCA_NXI) && nxi)
25871 + put_nx_info(nxi);
25873 + if ((args & VCA_VXI) && vxi)
25874 + put_vx_info(vxi);
25876 + vxdprintk(VXD_CBIT(switch, 1),
25877 + "vc: VCMD_%02d_%d[%d] = %08lx(%ld) [%d,%d]",
25878 + VC_CATEGORY(cmd), VC_COMMAND(cmd),
25879 + VC_VERSION(cmd), ret, ret, state, permit);
25884 +sys_vserver(uint32_t cmd, uint32_t id, void __user *data)
25886 + return do_vserver(cmd, id, data, 0);
25889 +#ifdef CONFIG_COMPAT
25892 +sys32_vserver(uint32_t cmd, uint32_t id, void __user *data)
25894 + return do_vserver(cmd, id, data, 1);
25897 +#endif /* CONFIG_COMPAT */
25898 diff -NurpP --minimal linux-2.6.34/kernel/vserver/sysctl.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/sysctl.c
25899 --- linux-2.6.34/kernel/vserver/sysctl.c 1970-01-01 01:00:00.000000000 +0100
25900 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/sysctl.c 2010-05-18 18:11:22.000000000 +0200
25903 + * kernel/vserver/sysctl.c
25905 + * Virtual Context Support
25907 + * Copyright (C) 2004-2007 Herbert Pötzl
25909 + * V0.01 basic structure
25913 +#include <linux/module.h>
25914 +#include <linux/ctype.h>
25915 +#include <linux/sysctl.h>
25916 +#include <linux/parser.h>
25917 +#include <asm/uaccess.h>
25920 + CTL_DEBUG_ERROR = 0,
25921 + CTL_DEBUG_SWITCH = 1,
25936 +unsigned int vx_debug_switch = 0;
25937 +unsigned int vx_debug_xid = 0;
25938 +unsigned int vx_debug_nid = 0;
25939 +unsigned int vx_debug_tag = 0;
25940 +unsigned int vx_debug_net = 0;
25941 +unsigned int vx_debug_limit = 0;
25942 +unsigned int vx_debug_cres = 0;
25943 +unsigned int vx_debug_dlim = 0;
25944 +unsigned int vx_debug_quota = 0;
25945 +unsigned int vx_debug_cvirt = 0;
25946 +unsigned int vx_debug_space = 0;
25947 +unsigned int vx_debug_misc = 0;
25950 +static struct ctl_table_header *vserver_table_header;
25951 +static ctl_table vserver_root_table[];
25954 +void vserver_register_sysctl(void)
25956 + if (!vserver_table_header) {
25957 + vserver_table_header = register_sysctl_table(vserver_root_table);
25962 +void vserver_unregister_sysctl(void)
25964 + if (vserver_table_header) {
25965 + unregister_sysctl_table(vserver_table_header);
25966 + vserver_table_header = NULL;
25971 +static int proc_dodebug(ctl_table *table, int write,
25972 + void __user *buffer, size_t *lenp, loff_t *ppos)
25974 + char tmpbuf[20], *p, c;
25975 + unsigned int value;
25976 + size_t left, len;
25978 + if ((*ppos && !write) || !*lenp) {
25986 + if (!access_ok(VERIFY_READ, buffer, left))
25988 + p = (char *)buffer;
25989 + while (left && __get_user(c, p) >= 0 && isspace(c))
25994 + if (left > sizeof(tmpbuf) - 1)
25996 + if (copy_from_user(tmpbuf, p, left))
25998 + tmpbuf[left] = '\0';
26000 + for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
26001 + value = 10 * value + (*p - '0');
26002 + if (*p && !isspace(*p))
26004 + while (left && isspace(*p))
26006 + *(unsigned int *)table->data = value;
26008 + if (!access_ok(VERIFY_WRITE, buffer, left))
26010 + len = sprintf(tmpbuf, "%d", *(unsigned int *)table->data);
26013 + if (__copy_to_user(buffer, tmpbuf, len))
26015 + if ((left -= len) > 0) {
26016 + if (put_user('\n', (char *)buffer + len))
26030 +#define CTL_ENTRY(ctl, name) \
26032 + .procname = #name, \
26033 + .data = &vx_ ## name, \
26034 + .maxlen = sizeof(int), \
26036 + .proc_handler = &proc_dodebug, \
26037 + .extra1 = &zero, \
26038 + .extra2 = &zero, \
26041 +static ctl_table vserver_debug_table[] = {
26042 + CTL_ENTRY(CTL_DEBUG_SWITCH, debug_switch),
26043 + CTL_ENTRY(CTL_DEBUG_XID, debug_xid),
26044 + CTL_ENTRY(CTL_DEBUG_NID, debug_nid),
26045 + CTL_ENTRY(CTL_DEBUG_TAG, debug_tag),
26046 + CTL_ENTRY(CTL_DEBUG_NET, debug_net),
26047 + CTL_ENTRY(CTL_DEBUG_LIMIT, debug_limit),
26048 + CTL_ENTRY(CTL_DEBUG_CRES, debug_cres),
26049 + CTL_ENTRY(CTL_DEBUG_DLIM, debug_dlim),
26050 + CTL_ENTRY(CTL_DEBUG_QUOTA, debug_quota),
26051 + CTL_ENTRY(CTL_DEBUG_CVIRT, debug_cvirt),
26052 + CTL_ENTRY(CTL_DEBUG_SPACE, debug_space),
26053 + CTL_ENTRY(CTL_DEBUG_MISC, debug_misc),
26057 +static ctl_table vserver_root_table[] = {
26059 + .procname = "vserver",
26061 + .child = vserver_debug_table
26067 +static match_table_t tokens = {
26068 + { CTL_DEBUG_SWITCH, "switch=%x" },
26069 + { CTL_DEBUG_XID, "xid=%x" },
26070 + { CTL_DEBUG_NID, "nid=%x" },
26071 + { CTL_DEBUG_TAG, "tag=%x" },
26072 + { CTL_DEBUG_NET, "net=%x" },
26073 + { CTL_DEBUG_LIMIT, "limit=%x" },
26074 + { CTL_DEBUG_CRES, "cres=%x" },
26075 + { CTL_DEBUG_DLIM, "dlim=%x" },
26076 + { CTL_DEBUG_QUOTA, "quota=%x" },
26077 + { CTL_DEBUG_CVIRT, "cvirt=%x" },
26078 + { CTL_DEBUG_SPACE, "space=%x" },
26079 + { CTL_DEBUG_MISC, "misc=%x" },
26080 + { CTL_DEBUG_ERROR, NULL }
26083 +#define HANDLE_CASE(id, name, val) \
26084 + case CTL_DEBUG_ ## id: \
26085 + vx_debug_ ## name = val; \
26086 + printk("vs_debug_" #name "=0x%x\n", val); \
26090 +static int __init vs_debug_setup(char *str)
26095 + printk("vs_debug_setup(%s)\n", str);
26096 + while ((p = strsep(&str, ",")) != NULL) {
26097 + substring_t args[MAX_OPT_ARGS];
26098 + unsigned int value;
26103 + token = match_token(p, tokens, args);
26104 + value = (token > 0) ? simple_strtoul(args[0].from, NULL, 0) : 0;
26107 + HANDLE_CASE(SWITCH, switch, value);
26108 + HANDLE_CASE(XID, xid, value);
26109 + HANDLE_CASE(NID, nid, value);
26110 + HANDLE_CASE(TAG, tag, value);
26111 + HANDLE_CASE(NET, net, value);
26112 + HANDLE_CASE(LIMIT, limit, value);
26113 + HANDLE_CASE(CRES, cres, value);
26114 + HANDLE_CASE(DLIM, dlim, value);
26115 + HANDLE_CASE(QUOTA, quota, value);
26116 + HANDLE_CASE(CVIRT, cvirt, value);
26117 + HANDLE_CASE(SPACE, space, value);
26118 + HANDLE_CASE(MISC, misc, value);
26127 +__setup("vsdebug=", vs_debug_setup);
26131 +EXPORT_SYMBOL_GPL(vx_debug_switch);
26132 +EXPORT_SYMBOL_GPL(vx_debug_xid);
26133 +EXPORT_SYMBOL_GPL(vx_debug_nid);
26134 +EXPORT_SYMBOL_GPL(vx_debug_net);
26135 +EXPORT_SYMBOL_GPL(vx_debug_limit);
26136 +EXPORT_SYMBOL_GPL(vx_debug_cres);
26137 +EXPORT_SYMBOL_GPL(vx_debug_dlim);
26138 +EXPORT_SYMBOL_GPL(vx_debug_quota);
26139 +EXPORT_SYMBOL_GPL(vx_debug_cvirt);
26140 +EXPORT_SYMBOL_GPL(vx_debug_space);
26141 +EXPORT_SYMBOL_GPL(vx_debug_misc);
26143 diff -NurpP --minimal linux-2.6.34/kernel/vserver/tag.c linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/tag.c
26144 --- linux-2.6.34/kernel/vserver/tag.c 1970-01-01 01:00:00.000000000 +0100
26145 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/tag.c 2010-05-18 18:11:22.000000000 +0200
26148 + * linux/kernel/vserver/tag.c
26150 + * Virtual Server: Shallow Tag Space
26152 + * Copyright (C) 2007 Herbert Pötzl
26154 + * V0.01 basic implementation
26158 +#include <linux/sched.h>
26159 +#include <linux/vserver/debug.h>
26160 +#include <linux/vs_pid.h>
26161 +#include <linux/vs_tag.h>
26163 +#include <linux/vserver/tag_cmd.h>
26166 +int dx_migrate_task(struct task_struct *p, tag_t tag)
26171 + vxdprintk(VXD_CBIT(tag, 5),
26172 + "dx_migrate_task(%p[#%d],#%d)", p, p->tag, tag);
26178 + vxdprintk(VXD_CBIT(tag, 5),
26179 + "moved task %p into [#%d]", p, tag);
26183 +/* vserver syscall commands below here */
26185 +/* taks xid and vx_info functions */
26188 +int vc_task_tag(uint32_t id)
26193 + struct task_struct *tsk;
26194 + read_lock(&tasklist_lock);
26195 + tsk = find_task_by_real_pid(id);
26196 + tag = (tsk) ? tsk->tag : -ESRCH;
26197 + read_unlock(&tasklist_lock);
26199 + tag = dx_current_tag();
26204 +int vc_tag_migrate(uint32_t tag)
26206 + return dx_migrate_task(current, tag & 0xFFFF);
26210 diff -NurpP --minimal linux-2.6.34/kernel/vserver/vci_config.h linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/vci_config.h
26211 --- linux-2.6.34/kernel/vserver/vci_config.h 1970-01-01 01:00:00.000000000 +0100
26212 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/kernel/vserver/vci_config.h 2010-05-22 01:16:29.000000000 +0200
26215 +/* interface version */
26217 +#define VCI_VERSION 0x00020306
26221 + VCI_KCBIT_NO_DYNAMIC = 0,
26223 + VCI_KCBIT_PROC_SECURE = 4,
26224 + VCI_KCBIT_HARDCPU = 5,
26225 + VCI_KCBIT_IDLELIMIT = 6,
26226 + VCI_KCBIT_IDLETIME = 7,
26228 + VCI_KCBIT_COWBL = 8,
26229 + VCI_KCBIT_FULLCOWBL = 9,
26230 + VCI_KCBIT_SPACES = 10,
26231 + VCI_KCBIT_NETV2 = 11,
26232 + VCI_KCBIT_MEMCG = 12,
26234 + VCI_KCBIT_DEBUG = 16,
26235 + VCI_KCBIT_HISTORY = 20,
26236 + VCI_KCBIT_TAGGED = 24,
26237 + VCI_KCBIT_PPTAG = 28,
26239 + VCI_KCBIT_MORE = 31,
26243 +static inline uint32_t vci_kernel_config(void)
26246 + (1 << VCI_KCBIT_NO_DYNAMIC) |
26248 + /* configured features */
26249 +#ifdef CONFIG_VSERVER_PROC_SECURE
26250 + (1 << VCI_KCBIT_PROC_SECURE) |
26252 +#ifdef CONFIG_VSERVER_HARDCPU
26253 + (1 << VCI_KCBIT_HARDCPU) |
26255 +#ifdef CONFIG_VSERVER_IDLELIMIT
26256 + (1 << VCI_KCBIT_IDLELIMIT) |
26258 +#ifdef CONFIG_VSERVER_IDLETIME
26259 + (1 << VCI_KCBIT_IDLETIME) |
26261 +#ifdef CONFIG_VSERVER_COWBL
26262 + (1 << VCI_KCBIT_COWBL) |
26263 + (1 << VCI_KCBIT_FULLCOWBL) |
26265 + (1 << VCI_KCBIT_SPACES) |
26266 + (1 << VCI_KCBIT_NETV2) |
26267 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
26268 + (1 << VCI_KCBIT_MEMCG) |
26271 + /* debug options */
26272 +#ifdef CONFIG_VSERVER_DEBUG
26273 + (1 << VCI_KCBIT_DEBUG) |
26275 +#ifdef CONFIG_VSERVER_HISTORY
26276 + (1 << VCI_KCBIT_HISTORY) |
26279 + /* inode context tagging */
26280 +#if defined(CONFIG_TAGGING_NONE)
26281 + (0 << VCI_KCBIT_TAGGED) |
26282 +#elif defined(CONFIG_TAGGING_UID16)
26283 + (1 << VCI_KCBIT_TAGGED) |
26284 +#elif defined(CONFIG_TAGGING_GID16)
26285 + (2 << VCI_KCBIT_TAGGED) |
26286 +#elif defined(CONFIG_TAGGING_ID24)
26287 + (3 << VCI_KCBIT_TAGGED) |
26288 +#elif defined(CONFIG_TAGGING_INTERN)
26289 + (4 << VCI_KCBIT_TAGGED) |
26290 +#elif defined(CONFIG_TAGGING_RUNTIME)
26291 + (5 << VCI_KCBIT_TAGGED) |
26293 + (7 << VCI_KCBIT_TAGGED) |
26295 + (1 << VCI_KCBIT_PPTAG) |
26299 diff -NurpP --minimal linux-2.6.34/mm/filemap_xip.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/filemap_xip.c
26300 --- linux-2.6.34/mm/filemap_xip.c 2010-05-18 15:07:53.000000000 +0200
26301 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/filemap_xip.c 2010-05-18 18:11:22.000000000 +0200
26303 #include <linux/seqlock.h>
26304 #include <linux/mutex.h>
26305 #include <linux/gfp.h>
26306 +#include <linux/vs_memory.h>
26307 #include <asm/tlbflush.h>
26308 #include <asm/io.h>
26310 diff -NurpP --minimal linux-2.6.34/mm/fremap.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/fremap.c
26311 --- linux-2.6.34/mm/fremap.c 2010-05-18 15:07:53.000000000 +0200
26312 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/fremap.c 2010-05-18 18:11:22.000000000 +0200
26314 #include <linux/module.h>
26315 #include <linux/syscalls.h>
26316 #include <linux/mmu_notifier.h>
26317 +#include <linux/vs_memory.h>
26319 #include <asm/mmu_context.h>
26320 #include <asm/cacheflush.h>
26321 diff -NurpP --minimal linux-2.6.34/mm/hugetlb.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/hugetlb.c
26322 --- linux-2.6.34/mm/hugetlb.c 2010-05-18 15:07:53.000000000 +0200
26323 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/hugetlb.c 2010-05-18 18:11:22.000000000 +0200
26326 #include <linux/hugetlb.h>
26327 #include <linux/node.h>
26328 +#include <linux/vs_memory.h>
26329 #include "internal.h"
26331 const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
26332 diff -NurpP --minimal linux-2.6.34/mm/memcontrol.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/memcontrol.c
26333 --- linux-2.6.34/mm/memcontrol.c 2010-05-18 15:07:53.000000000 +0200
26334 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/memcontrol.c 2010-05-18 18:11:22.000000000 +0200
26335 @@ -596,6 +596,31 @@ struct mem_cgroup *mem_cgroup_from_task(
26336 struct mem_cgroup, css);
26339 +u64 mem_cgroup_res_read_u64(struct mem_cgroup *mem, int member)
26341 + return res_counter_read_u64(&mem->res, member);
26344 +u64 mem_cgroup_memsw_read_u64(struct mem_cgroup *mem, int member)
26346 + return res_counter_read_u64(&mem->memsw, member);
26349 +s64 mem_cgroup_stat_read_cache(struct mem_cgroup *mem)
26351 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_CACHE);
26354 +s64 mem_cgroup_stat_read_anon(struct mem_cgroup *mem)
26356 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_RSS);
26359 +s64 mem_cgroup_stat_read_mapped(struct mem_cgroup *mem)
26361 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_FILE_MAPPED);
26364 static struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
26366 struct mem_cgroup *mem = NULL;
26367 diff -NurpP --minimal linux-2.6.34/mm/memory.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/memory.c
26368 --- linux-2.6.34/mm/memory.c 2010-05-18 15:07:53.000000000 +0200
26369 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/memory.c 2010-05-19 03:16:21.000000000 +0200
26370 @@ -3057,6 +3057,7 @@ static inline int handle_pte_fault(struc
26374 + int ret = 0, type = VXPT_UNKNOWN;
26377 if (!pte_present(entry)) {
26378 @@ -3081,9 +3082,12 @@ static inline int handle_pte_fault(struc
26379 if (unlikely(!pte_same(*pte, entry)))
26381 if (flags & FAULT_FLAG_WRITE) {
26382 - if (!pte_write(entry))
26383 - return do_wp_page(mm, vma, address,
26384 + if (!pte_write(entry)) {
26385 + ret = do_wp_page(mm, vma, address,
26386 pte, pmd, ptl, entry);
26387 + type = VXPT_WRITE;
26390 entry = pte_mkdirty(entry);
26392 entry = pte_mkyoung(entry);
26393 @@ -3101,7 +3105,10 @@ static inline int handle_pte_fault(struc
26396 pte_unmap_unlock(pte, ptl);
26400 + vx_page_fault(mm, vma, type, ret);
26405 diff -NurpP --minimal linux-2.6.34/mm/mlock.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/mlock.c
26406 --- linux-2.6.34/mm/mlock.c 2010-05-18 15:07:53.000000000 +0200
26407 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/mlock.c 2010-05-19 03:10:18.000000000 +0200
26409 #include <linux/rmap.h>
26410 #include <linux/mmzone.h>
26411 #include <linux/hugetlb.h>
26412 +#include <linux/vs_memory.h>
26414 #include "internal.h"
26416 @@ -471,7 +472,7 @@ static int do_mlock(unsigned long start,
26418 SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
26420 - unsigned long locked;
26421 + unsigned long locked, grow;
26422 unsigned long lock_limit;
26423 int error = -ENOMEM;
26425 @@ -493,6 +494,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
26426 /* check against resource limits */
26427 if ((locked <= lock_limit) || capable(CAP_IPC_LOCK))
26428 error = do_mlock(start, len, 1);
26430 up_write(¤t->mm->mmap_sem);
26433 diff -NurpP --minimal linux-2.6.34/mm/mremap.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/mremap.c
26434 --- linux-2.6.34/mm/mremap.c 2010-05-18 15:07:53.000000000 +0200
26435 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/mremap.c 2010-05-19 03:10:18.000000000 +0200
26437 #include <linux/security.h>
26438 #include <linux/syscalls.h>
26439 #include <linux/mmu_notifier.h>
26440 +#include <linux/vs_memory.h>
26442 #include <asm/uaccess.h>
26443 #include <asm/cacheflush.h>
26444 diff -NurpP --minimal linux-2.6.34/mm/oom_kill.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/oom_kill.c
26445 --- linux-2.6.34/mm/oom_kill.c 2010-05-18 15:07:53.000000000 +0200
26446 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/oom_kill.c 2010-05-18 18:11:22.000000000 +0200
26448 #include <linux/notifier.h>
26449 #include <linux/memcontrol.h>
26450 #include <linux/security.h>
26451 +#include <linux/reboot.h>
26452 +#include <linux/vs_memory.h>
26453 +#include <linux/vs_context.h>
26455 int sysctl_panic_on_oom;
26456 int sysctl_oom_kill_allocating_task;
26457 @@ -187,9 +190,21 @@ unsigned long badness(struct task_struct
26458 points >>= -(oom_adj);
26462 + * add points for context badness and
26463 + * reduce badness for processes belonging to
26464 + * a different context
26467 + points += vx_badness(p, mm);
26469 + if ((vx_current_xid() > 1) &&
26470 + vx_current_xid() != vx_task_xid(p))
26474 - printk(KERN_DEBUG "OOMkill: task %d (%s) got %lu points\n",
26475 - p->pid, p->comm, points);
26476 + printk(KERN_DEBUG "OOMkill: task %d:#%u (%s) got %d points\n",
26477 + task_pid_nr(p), p->xid, p->comm, points);
26481 @@ -250,6 +265,7 @@ static struct task_struct *select_bad_pr
26482 struct task_struct *p;
26483 struct task_struct *chosen = NULL;
26484 struct timespec uptime;
26485 + unsigned xid = vx_current_xid();
26488 do_posix_clock_monotonic_gettime(&uptime);
26489 @@ -262,11 +278,14 @@ static struct task_struct *select_bad_pr
26493 - /* skip the init task */
26494 - if (is_global_init(p))
26495 + /* skip the init task, global and per guest */
26496 + if (task_is_init(p))
26498 if (mem && !task_in_mem_cgroup(p, mem))
26500 + /* skip other guest and host processes if oom in guest */
26501 + if (xid && vx_task_xid(p) != xid)
26505 * This task already has access to memory reserves and is
26506 @@ -398,9 +417,9 @@ static void __oom_kill_task(struct task_
26510 - printk(KERN_ERR "Killed process %d (%s) "
26511 + printk(KERN_ERR "Killed process %s(%d:#%u) "
26512 "vsz:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
26513 - task_pid_nr(p), p->comm,
26514 + p->comm, task_pid_nr(p), p->xid,
26515 K(p->mm->total_vm),
26516 K(get_mm_counter(p->mm, MM_ANONPAGES)),
26517 K(get_mm_counter(p->mm, MM_FILEPAGES)));
26518 @@ -453,8 +472,8 @@ static int oom_kill_process(struct task_
26522 - printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n",
26523 - message, task_pid_nr(p), p->comm, points);
26524 + printk(KERN_ERR "%s: kill process %s(%d:#%u) score %li or a child\n",
26525 + message, p->comm, task_pid_nr(p), p->xid, points);
26527 /* Try to kill a child first */
26528 list_for_each_entry(c, &p->children, sibling) {
26529 @@ -557,6 +576,8 @@ void clear_zonelist_oom(struct zonelist
26530 spin_unlock(&zone_scan_lock);
26533 +long vs_oom_action(unsigned int);
26536 * Must be called with tasklist_lock held for read.
26538 @@ -583,7 +604,11 @@ retry:
26540 read_unlock(&tasklist_lock);
26541 dump_header(NULL, gfp_mask, order, NULL);
26542 - panic("Out of memory and no killable processes...\n");
26543 + /* avoid panic for guest OOM */
26544 + if (current->xid)
26545 + vs_oom_action(LINUX_REBOOT_CMD_OOM);
26547 + panic("Out of memory and no killable processes...\n");
26550 if (oom_kill_process(p, gfp_mask, order, points, NULL,
26551 diff -NurpP --minimal linux-2.6.34/mm/page_alloc.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/page_alloc.c
26552 --- linux-2.6.34/mm/page_alloc.c 2010-05-18 15:07:53.000000000 +0200
26553 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/page_alloc.c 2010-05-18 18:11:22.000000000 +0200
26555 #include <linux/debugobjects.h>
26556 #include <linux/kmemleak.h>
26557 #include <linux/memory.h>
26558 +#include <linux/vs_base.h>
26559 +#include <linux/vs_limit.h>
26560 #include <trace/events/kmem.h>
26561 #include <linux/ftrace_event.h>
26563 @@ -2152,6 +2154,9 @@ void si_meminfo(struct sysinfo *val)
26564 val->totalhigh = totalhigh_pages;
26565 val->freehigh = nr_free_highpages();
26566 val->mem_unit = PAGE_SIZE;
26568 + if (vx_flags(VXF_VIRT_MEM, 0))
26569 + vx_vsi_meminfo(val);
26572 EXPORT_SYMBOL(si_meminfo);
26573 @@ -2172,6 +2177,9 @@ void si_meminfo_node(struct sysinfo *val
26576 val->mem_unit = PAGE_SIZE;
26578 + if (vx_flags(VXF_VIRT_MEM, 0))
26579 + vx_vsi_meminfo(val);
26583 diff -NurpP --minimal linux-2.6.34/mm/rmap.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/rmap.c
26584 --- linux-2.6.34/mm/rmap.c 2010-05-18 15:07:53.000000000 +0200
26585 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/rmap.c 2010-05-18 18:11:22.000000000 +0200
26587 #include <linux/memcontrol.h>
26588 #include <linux/mmu_notifier.h>
26589 #include <linux/migrate.h>
26590 +#include <linux/vs_memory.h>
26592 #include <asm/tlbflush.h>
26594 diff -NurpP --minimal linux-2.6.34/mm/shmem.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/shmem.c
26595 --- linux-2.6.34/mm/shmem.c 2010-02-25 11:52:09.000000000 +0100
26596 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/shmem.c 2010-05-18 18:11:22.000000000 +0200
26597 @@ -1788,7 +1788,7 @@ static int shmem_statfs(struct dentry *d
26599 struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
26601 - buf->f_type = TMPFS_MAGIC;
26602 + buf->f_type = TMPFS_SUPER_MAGIC;
26603 buf->f_bsize = PAGE_CACHE_SIZE;
26604 buf->f_namelen = NAME_MAX;
26605 spin_lock(&sbinfo->stat_lock);
26606 @@ -2358,7 +2358,7 @@ int shmem_fill_super(struct super_block
26607 sb->s_maxbytes = SHMEM_MAX_BYTES;
26608 sb->s_blocksize = PAGE_CACHE_SIZE;
26609 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
26610 - sb->s_magic = TMPFS_MAGIC;
26611 + sb->s_magic = TMPFS_SUPER_MAGIC;
26612 sb->s_op = &shmem_ops;
26613 sb->s_time_gran = 1;
26614 #ifdef CONFIG_TMPFS_POSIX_ACL
26615 diff -NurpP --minimal linux-2.6.34/mm/slab.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/slab.c
26616 --- linux-2.6.34/mm/slab.c 2010-05-18 15:07:53.000000000 +0200
26617 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/slab.c 2010-05-18 18:11:22.000000000 +0200
26618 @@ -431,6 +431,8 @@ static void kmem_list3_init(struct kmem_
26619 #define STATS_INC_FREEMISS(x) do { } while (0)
26622 +#include "slab_vs.h"
26627 @@ -3274,6 +3276,7 @@ retry:
26629 obj = slab_get_obj(cachep, slabp, nodeid);
26630 check_slabp(cachep, slabp);
26631 + vx_slab_alloc(cachep, flags);
26632 l3->free_objects--;
26633 /* move slabp to correct slabp list: */
26634 list_del(&slabp->list);
26635 @@ -3350,6 +3353,7 @@ __cache_alloc_node(struct kmem_cache *ca
26636 /* ___cache_alloc_node can fall back to other nodes */
26637 ptr = ____cache_alloc_node(cachep, flags, nodeid);
26639 + vx_slab_alloc(cachep, flags);
26640 local_irq_restore(save_flags);
26641 ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, caller);
26642 kmemleak_alloc_recursive(ptr, obj_size(cachep), 1, cachep->flags,
26643 @@ -3536,6 +3540,7 @@ static inline void __cache_free(struct k
26645 kmemleak_free_recursive(objp, cachep->flags);
26646 objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
26647 + vx_slab_free(cachep);
26649 kmemcheck_slab_free(cachep, objp, obj_size(cachep));
26651 diff -NurpP --minimal linux-2.6.34/mm/slab_vs.h linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/slab_vs.h
26652 --- linux-2.6.34/mm/slab_vs.h 1970-01-01 01:00:00.000000000 +0100
26653 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/slab_vs.h 2010-05-18 18:11:22.000000000 +0200
26656 +#include <linux/vserver/context.h>
26658 +#include <linux/vs_context.h>
26661 +void vx_slab_alloc(struct kmem_cache *cachep, gfp_t flags)
26663 + int what = gfp_zone(cachep->gfpflags);
26664 + struct vx_info *vxi = current_vx_info();
26669 + atomic_add(cachep->buffer_size, &vxi->cacct.slab[what]);
26673 +void vx_slab_free(struct kmem_cache *cachep)
26675 + int what = gfp_zone(cachep->gfpflags);
26676 + struct vx_info *vxi = current_vx_info();
26681 + atomic_sub(cachep->buffer_size, &vxi->cacct.slab[what]);
26684 diff -NurpP --minimal linux-2.6.34/mm/swapfile.c linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/swapfile.c
26685 --- linux-2.6.34/mm/swapfile.c 2010-05-18 15:07:53.000000000 +0200
26686 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/mm/swapfile.c 2010-05-18 18:11:22.000000000 +0200
26688 #include <asm/tlbflush.h>
26689 #include <linux/swapops.h>
26690 #include <linux/page_cgroup.h>
26691 +#include <linux/vs_base.h>
26692 +#include <linux/vs_memory.h>
26694 static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
26696 @@ -1725,6 +1727,16 @@ static int swap_show(struct seq_file *sw
26698 if (si == SEQ_START_TOKEN) {
26699 seq_puts(swap,"Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
26700 + if (vx_flags(VXF_VIRT_MEM, 0)) {
26701 + struct sysinfo si;
26703 + vx_vsi_swapinfo(&si);
26704 + if (si.totalswap < (1 << 10))
26706 + seq_printf(swap, "%s\t\t\t\t\t%s\t%lu\t%lu\t%d\n",
26707 + "hdv0", "partition", si.totalswap >> 10,
26708 + (si.totalswap - si.freeswap) >> 10, -1);
26713 @@ -2108,6 +2120,8 @@ void si_swapinfo(struct sysinfo *val)
26714 val->freeswap = nr_swap_pages + nr_to_be_unused;
26715 val->totalswap = total_swap_pages + nr_to_be_unused;
26716 spin_unlock(&swap_lock);
26717 + if (vx_flags(VXF_VIRT_MEM, 0))
26718 + vx_vsi_swapinfo(val);
26722 diff -NurpP --minimal linux-2.6.34/net/core/dev.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/core/dev.c
26723 --- linux-2.6.34/net/core/dev.c 2010-05-18 15:07:53.000000000 +0200
26724 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/core/dev.c 2010-05-18 18:11:22.000000000 +0200
26725 @@ -129,6 +129,7 @@
26726 #include <linux/in.h>
26727 #include <linux/jhash.h>
26728 #include <linux/random.h>
26729 +#include <linux/vs_inet.h>
26730 #include <trace/events/napi.h>
26732 #include "net-sysfs.h"
26733 @@ -594,7 +595,8 @@ struct net_device *__dev_get_by_name(str
26734 struct hlist_head *head = dev_name_hash(net, name);
26736 hlist_for_each_entry(dev, p, head, name_hlist)
26737 - if (!strncmp(dev->name, name, IFNAMSIZ))
26738 + if (!strncmp(dev->name, name, IFNAMSIZ) &&
26739 + nx_dev_visible(current_nx_info(), dev))
26743 @@ -620,7 +622,8 @@ struct net_device *dev_get_by_name_rcu(s
26744 struct hlist_head *head = dev_name_hash(net, name);
26746 hlist_for_each_entry_rcu(dev, p, head, name_hlist)
26747 - if (!strncmp(dev->name, name, IFNAMSIZ))
26748 + if (!strncmp(dev->name, name, IFNAMSIZ) &&
26749 + nx_dev_visible(current_nx_info(), dev))
26753 @@ -671,7 +674,8 @@ struct net_device *__dev_get_by_index(st
26754 struct hlist_head *head = dev_index_hash(net, ifindex);
26756 hlist_for_each_entry(dev, p, head, index_hlist)
26757 - if (dev->ifindex == ifindex)
26758 + if ((dev->ifindex == ifindex) &&
26759 + nx_dev_visible(current_nx_info(), dev))
26763 @@ -696,7 +700,8 @@ struct net_device *dev_get_by_index_rcu(
26764 struct hlist_head *head = dev_index_hash(net, ifindex);
26766 hlist_for_each_entry_rcu(dev, p, head, index_hlist)
26767 - if (dev->ifindex == ifindex)
26768 + if ((dev->ifindex == ifindex) &&
26769 + nx_dev_visible(current_nx_info(), dev))
26773 @@ -749,10 +754,12 @@ struct net_device *dev_getbyhwaddr(struc
26777 - for_each_netdev(net, dev)
26778 + for_each_netdev(net, dev) {
26779 if (dev->type == type &&
26780 - !memcmp(dev->dev_addr, ha, dev->addr_len))
26781 + !memcmp(dev->dev_addr, ha, dev->addr_len) &&
26782 + nx_dev_visible(current_nx_info(), dev))
26788 @@ -763,9 +770,11 @@ struct net_device *__dev_getfirstbyhwtyp
26789 struct net_device *dev;
26792 - for_each_netdev(net, dev)
26793 - if (dev->type == type)
26794 + for_each_netdev(net, dev) {
26795 + if ((dev->type == type) &&
26796 + nx_dev_visible(current_nx_info(), dev))
26802 @@ -884,6 +893,8 @@ static int __dev_alloc_name(struct net *
26804 if (i < 0 || i >= max_netdevices)
26806 + if (!nx_dev_visible(current_nx_info(), d))
26809 /* avoid cases where sscanf is not exact inverse of printf */
26810 snprintf(buf, IFNAMSIZ, name, i);
26811 @@ -3195,6 +3206,8 @@ static int dev_ifconf(struct net *net, c
26814 for_each_netdev(net, dev) {
26815 + if (!nx_dev_visible(current_nx_info(), dev))
26817 for (i = 0; i < NPROTO; i++) {
26818 if (gifconf_list[i]) {
26820 @@ -3265,6 +3278,9 @@ static void dev_seq_printf_stats(struct
26822 const struct net_device_stats *stats = dev_get_stats(dev);
26824 + if (!nx_dev_visible(current_nx_info(), dev))
26827 seq_printf(seq, "%6s: %7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
26828 "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
26829 dev->name, stats->rx_bytes, stats->rx_packets,
26830 @@ -5642,7 +5658,6 @@ int dev_change_net_namespace(struct net_
26831 if (dev->dev.parent)
26835 /* Ensure the device has been registrered */
26837 if (dev->reg_state != NETREG_REGISTERED)
26838 diff -NurpP --minimal linux-2.6.34/net/core/rtnetlink.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/core/rtnetlink.c
26839 --- linux-2.6.34/net/core/rtnetlink.c 2010-05-18 15:07:53.000000000 +0200
26840 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/core/rtnetlink.c 2010-05-18 18:11:22.000000000 +0200
26841 @@ -769,6 +769,8 @@ static int rtnl_dump_ifinfo(struct sk_bu
26842 hlist_for_each_entry(dev, node, head, index_hlist) {
26845 + if (!nx_dev_visible(skb->sk->sk_nx_info, dev))
26847 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
26848 NETLINK_CB(cb->skb).pid,
26849 cb->nlh->nlmsg_seq, 0,
26850 @@ -1420,6 +1422,9 @@ void rtmsg_ifinfo(int type, struct net_d
26851 struct sk_buff *skb;
26852 int err = -ENOBUFS;
26854 + if (!nx_dev_visible(current_nx_info(), dev))
26857 skb = nlmsg_new(if_nlmsg_size(dev), GFP_KERNEL);
26860 diff -NurpP --minimal linux-2.6.34/net/core/sock.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/core/sock.c
26861 --- linux-2.6.34/net/core/sock.c 2010-05-18 15:07:53.000000000 +0200
26862 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/core/sock.c 2010-05-18 18:11:22.000000000 +0200
26863 @@ -125,6 +125,10 @@
26864 #include <linux/ipsec.h>
26866 #include <linux/filter.h>
26867 +#include <linux/vs_socket.h>
26868 +#include <linux/vs_limit.h>
26869 +#include <linux/vs_context.h>
26870 +#include <linux/vs_network.h>
26873 #include <net/tcp.h>
26874 @@ -1012,6 +1016,8 @@ static struct sock *sk_prot_alloc(struct
26876 sk_tx_queue_clear(sk);
26878 + sock_vx_init(sk);
26879 + sock_nx_init(sk);
26883 @@ -1092,6 +1098,11 @@ static void __sk_free(struct sock *sk)
26884 __func__, atomic_read(&sk->sk_omem_alloc));
26886 put_net(sock_net(sk));
26888 + clr_vx_info(&sk->sk_vx_info);
26890 + clr_nx_info(&sk->sk_nx_info);
26892 sk_prot_free(sk->sk_prot_creator, sk);
26895 @@ -1139,6 +1150,8 @@ struct sock *sk_clone(const struct sock
26898 get_net(sock_net(newsk));
26899 + sock_vx_init(newsk);
26900 + sock_nx_init(newsk);
26901 sk_node_init(&newsk->sk_node);
26902 sock_lock_init(newsk);
26903 bh_lock_sock(newsk);
26904 @@ -1194,6 +1207,12 @@ struct sock *sk_clone(const struct sock
26906 atomic_set(&newsk->sk_refcnt, 2);
26908 + set_vx_info(&newsk->sk_vx_info, sk->sk_vx_info);
26909 + newsk->sk_xid = sk->sk_xid;
26910 + vx_sock_inc(newsk);
26911 + set_nx_info(&newsk->sk_nx_info, sk->sk_nx_info);
26912 + newsk->sk_nid = sk->sk_nid;
26915 * Increment the counter in the same struct proto as the master
26916 * sock (sk_refcnt_debug_inc uses newsk->sk_prot->socks, that
26917 @@ -1923,6 +1942,12 @@ void sock_init_data(struct socket *sock,
26919 sk->sk_stamp = ktime_set(-1L, 0);
26921 + set_vx_info(&sk->sk_vx_info, current_vx_info());
26922 + sk->sk_xid = vx_current_xid();
26924 + set_nx_info(&sk->sk_nx_info, current_nx_info());
26925 + sk->sk_nid = nx_current_nid();
26928 * Before updating sk_refcnt, we must commit prior changes to memory
26929 * (Documentation/RCU/rculist_nulls.txt for details)
26930 diff -NurpP --minimal linux-2.6.34/net/ipv4/af_inet.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/af_inet.c
26931 --- linux-2.6.34/net/ipv4/af_inet.c 2010-05-18 15:07:53.000000000 +0200
26932 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/af_inet.c 2010-05-18 18:11:22.000000000 +0200
26933 @@ -116,6 +116,7 @@
26934 #ifdef CONFIG_IP_MROUTE
26935 #include <linux/mroute.h>
26937 +#include <linux/vs_limit.h>
26940 /* The inetsw table contains everything that inet_create needs to
26941 @@ -327,9 +328,13 @@ lookup_protocol:
26945 + if ((protocol == IPPROTO_ICMP) &&
26946 + nx_capable(CAP_NET_RAW, NXC_RAW_ICMP))
26949 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
26950 goto out_rcu_unlock;
26953 err = -EAFNOSUPPORT;
26954 if (!inet_netns_ok(net, protocol))
26955 goto out_rcu_unlock;
26956 @@ -449,6 +454,7 @@ int inet_bind(struct socket *sock, struc
26957 struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
26958 struct sock *sk = sock->sk;
26959 struct inet_sock *inet = inet_sk(sk);
26960 + struct nx_v4_sock_addr nsa;
26961 unsigned short snum;
26964 @@ -462,7 +468,11 @@ int inet_bind(struct socket *sock, struc
26965 if (addr_len < sizeof(struct sockaddr_in))
26968 - chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
26969 + err = v4_map_sock_addr(inet, addr, &nsa);
26973 + chk_addr_ret = inet_addr_type(sock_net(sk), nsa.saddr);
26975 /* Not specified by any standard per-se, however it breaks too
26976 * many applications when removed. It is unfortunate since
26977 @@ -474,7 +484,7 @@ int inet_bind(struct socket *sock, struc
26978 err = -EADDRNOTAVAIL;
26979 if (!sysctl_ip_nonlocal_bind &&
26980 !(inet->freebind || inet->transparent) &&
26981 - addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
26982 + nsa.saddr != htonl(INADDR_ANY) &&
26983 chk_addr_ret != RTN_LOCAL &&
26984 chk_addr_ret != RTN_MULTICAST &&
26985 chk_addr_ret != RTN_BROADCAST)
26986 @@ -499,7 +509,7 @@ int inet_bind(struct socket *sock, struc
26987 if (sk->sk_state != TCP_CLOSE || inet->inet_num)
26988 goto out_release_sock;
26990 - inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
26991 + v4_set_sock_addr(inet, &nsa);
26992 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
26993 inet->inet_saddr = 0; /* Use device */
26995 @@ -701,11 +711,13 @@ int inet_getname(struct socket *sock, st
26998 sin->sin_port = inet->inet_dport;
26999 - sin->sin_addr.s_addr = inet->inet_daddr;
27000 + sin->sin_addr.s_addr =
27001 + nx_map_sock_lback(sk->sk_nx_info, inet->inet_daddr);
27003 __be32 addr = inet->inet_rcv_saddr;
27005 addr = inet->inet_saddr;
27006 + addr = nx_map_sock_lback(sk->sk_nx_info, addr);
27007 sin->sin_port = inet->inet_sport;
27008 sin->sin_addr.s_addr = addr;
27010 diff -NurpP --minimal linux-2.6.34/net/ipv4/devinet.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/devinet.c
27011 --- linux-2.6.34/net/ipv4/devinet.c 2010-05-18 15:07:53.000000000 +0200
27012 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/devinet.c 2010-05-18 18:11:22.000000000 +0200
27013 @@ -417,6 +417,7 @@ struct in_device *inetdev_by_index(struc
27015 EXPORT_SYMBOL(inetdev_by_index);
27018 /* Called only from RTNL semaphored context. No locks. */
27020 struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
27021 @@ -659,6 +660,8 @@ int devinet_ioctl(struct net *net, unsig
27023 in_dev = __in_dev_get_rtnl(dev);
27025 + struct nx_info *nxi = current_nx_info();
27027 if (tryaddrmatch) {
27028 /* Matthias Andree */
27029 /* compare label and address (4.4BSD style) */
27030 @@ -667,6 +670,8 @@ int devinet_ioctl(struct net *net, unsig
27031 This is checked above. */
27032 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
27033 ifap = &ifa->ifa_next) {
27034 + if (!nx_v4_ifa_visible(nxi, ifa))
27036 if (!strcmp(ifr.ifr_name, ifa->ifa_label) &&
27037 sin_orig.sin_addr.s_addr ==
27038 ifa->ifa_address) {
27039 @@ -679,9 +684,12 @@ int devinet_ioctl(struct net *net, unsig
27040 comparing just the label */
27042 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
27043 - ifap = &ifa->ifa_next)
27044 + ifap = &ifa->ifa_next) {
27045 + if (!nx_v4_ifa_visible(nxi, ifa))
27047 if (!strcmp(ifr.ifr_name, ifa->ifa_label))
27053 @@ -833,6 +841,8 @@ static int inet_gifconf(struct net_devic
27056 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
27057 + if (!nx_v4_ifa_visible(current_nx_info(), ifa))
27060 done += sizeof(ifr);
27062 @@ -1181,6 +1191,7 @@ static int inet_dump_ifaddr(struct sk_bu
27063 struct net_device *dev;
27064 struct in_device *in_dev;
27065 struct in_ifaddr *ifa;
27066 + struct sock *sk = skb->sk;
27067 struct hlist_head *head;
27068 struct hlist_node *node;
27070 @@ -1203,6 +1214,8 @@ static int inet_dump_ifaddr(struct sk_bu
27072 for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
27073 ifa = ifa->ifa_next, ip_idx++) {
27074 + if (sk && !nx_v4_ifa_visible(sk->sk_nx_info, ifa))
27076 if (ip_idx < s_ip_idx)
27078 if (inet_fill_ifaddr(skb, ifa,
27079 diff -NurpP --minimal linux-2.6.34/net/ipv4/fib_hash.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/fib_hash.c
27080 --- linux-2.6.34/net/ipv4/fib_hash.c 2010-05-18 15:07:53.000000000 +0200
27081 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/fib_hash.c 2010-05-18 18:11:22.000000000 +0200
27082 @@ -1017,7 +1017,7 @@ static int fib_seq_show(struct seq_file
27083 prefix = f->fn_key;
27084 mask = FZ_MASK(iter->zone);
27085 flags = fib_flag_trans(fa->fa_type, mask, fi);
27087 + if (fi && nx_dev_visible(current_nx_info(), fi->fib_dev))
27089 "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u%n",
27090 fi->fib_dev ? fi->fib_dev->name : "*", prefix,
27091 diff -NurpP --minimal linux-2.6.34/net/ipv4/inet_connection_sock.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/inet_connection_sock.c
27092 --- linux-2.6.34/net/ipv4/inet_connection_sock.c 2010-05-18 15:07:53.000000000 +0200
27093 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/inet_connection_sock.c 2010-05-18 18:11:22.000000000 +0200
27094 @@ -49,10 +49,40 @@ void inet_get_local_port_range(int *low,
27096 EXPORT_SYMBOL(inet_get_local_port_range);
27098 +int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
27100 + __be32 sk1_rcv_saddr = inet_rcv_saddr(sk1),
27101 + sk2_rcv_saddr = inet_rcv_saddr(sk2);
27103 + if (inet_v6_ipv6only(sk2))
27106 + if (sk1_rcv_saddr &&
27108 + sk1_rcv_saddr == sk2_rcv_saddr)
27111 + if (sk1_rcv_saddr &&
27112 + !sk2_rcv_saddr &&
27113 + v4_addr_in_nx_info(sk2->sk_nx_info, sk1_rcv_saddr, NXA_MASK_BIND))
27116 + if (sk2_rcv_saddr &&
27117 + !sk1_rcv_saddr &&
27118 + v4_addr_in_nx_info(sk1->sk_nx_info, sk2_rcv_saddr, NXA_MASK_BIND))
27121 + if (!sk1_rcv_saddr &&
27122 + !sk2_rcv_saddr &&
27123 + nx_v4_addr_conflict(sk1->sk_nx_info, sk2->sk_nx_info))
27129 int inet_csk_bind_conflict(const struct sock *sk,
27130 const struct inet_bind_bucket *tb)
27132 - const __be32 sk_rcv_saddr = inet_rcv_saddr(sk);
27134 struct hlist_node *node;
27135 int reuse = sk->sk_reuse;
27136 @@ -72,9 +102,7 @@ int inet_csk_bind_conflict(const struct
27137 sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
27138 if (!reuse || !sk2->sk_reuse ||
27139 sk2->sk_state == TCP_LISTEN) {
27140 - const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
27141 - if (!sk2_rcv_saddr || !sk_rcv_saddr ||
27142 - sk2_rcv_saddr == sk_rcv_saddr)
27143 + if (ipv4_rcv_saddr_equal(sk, sk2))
27147 diff -NurpP --minimal linux-2.6.34/net/ipv4/inet_diag.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/inet_diag.c
27148 --- linux-2.6.34/net/ipv4/inet_diag.c 2010-05-18 15:07:53.000000000 +0200
27149 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/inet_diag.c 2010-05-18 18:11:22.000000000 +0200
27151 #include <linux/stddef.h>
27153 #include <linux/inet_diag.h>
27154 +#include <linux/vs_network.h>
27155 +#include <linux/vs_inet.h>
27157 static const struct inet_diag_handler **inet_diag_table;
27159 @@ -119,8 +121,10 @@ static int inet_csk_diag_fill(struct soc
27161 r->id.idiag_sport = inet->inet_sport;
27162 r->id.idiag_dport = inet->inet_dport;
27163 - r->id.idiag_src[0] = inet->inet_rcv_saddr;
27164 - r->id.idiag_dst[0] = inet->inet_daddr;
27165 + r->id.idiag_src[0] = nx_map_sock_lback(sk->sk_nx_info,
27166 + inet->inet_rcv_saddr);
27167 + r->id.idiag_dst[0] = nx_map_sock_lback(sk->sk_nx_info,
27168 + inet->inet_daddr);
27170 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
27171 if (r->idiag_family == AF_INET6) {
27172 @@ -205,8 +209,8 @@ static int inet_twsk_diag_fill(struct in
27173 r->id.idiag_cookie[1] = (u32)(((unsigned long)tw >> 31) >> 1);
27174 r->id.idiag_sport = tw->tw_sport;
27175 r->id.idiag_dport = tw->tw_dport;
27176 - r->id.idiag_src[0] = tw->tw_rcv_saddr;
27177 - r->id.idiag_dst[0] = tw->tw_daddr;
27178 + r->id.idiag_src[0] = nx_map_sock_lback(tw->tw_nx_info, tw->tw_rcv_saddr);
27179 + r->id.idiag_dst[0] = nx_map_sock_lback(tw->tw_nx_info, tw->tw_daddr);
27180 r->idiag_state = tw->tw_substate;
27181 r->idiag_timer = 3;
27182 r->idiag_expires = DIV_ROUND_UP(tmo * 1000, HZ);
27183 @@ -263,6 +267,7 @@ static int inet_diag_get_exact(struct sk
27186 if (req->idiag_family == AF_INET) {
27187 + /* TODO: lback */
27188 sk = inet_lookup(&init_net, hashinfo, req->id.idiag_dst[0],
27189 req->id.idiag_dport, req->id.idiag_src[0],
27190 req->id.idiag_sport, req->id.idiag_if);
27191 @@ -505,6 +510,7 @@ static int inet_csk_diag_dump(struct soc
27195 + /* TODO: lback */
27196 entry.saddr = &inet->inet_rcv_saddr;
27197 entry.daddr = &inet->inet_daddr;
27199 @@ -541,6 +547,7 @@ static int inet_twsk_diag_dump(struct in
27203 + /* TODO: lback */
27204 entry.saddr = &tw->tw_rcv_saddr;
27205 entry.daddr = &tw->tw_daddr;
27207 @@ -587,8 +594,8 @@ static int inet_diag_fill_req(struct sk_
27209 r->id.idiag_sport = inet->inet_sport;
27210 r->id.idiag_dport = ireq->rmt_port;
27211 - r->id.idiag_src[0] = ireq->loc_addr;
27212 - r->id.idiag_dst[0] = ireq->rmt_addr;
27213 + r->id.idiag_src[0] = nx_map_sock_lback(sk->sk_nx_info, ireq->loc_addr);
27214 + r->id.idiag_dst[0] = nx_map_sock_lback(sk->sk_nx_info, ireq->rmt_addr);
27215 r->idiag_expires = jiffies_to_msecs(tmo);
27216 r->idiag_rqueue = 0;
27217 r->idiag_wqueue = 0;
27218 @@ -658,6 +665,7 @@ static int inet_diag_dump_reqs(struct sk
27222 + /* TODO: lback */
27224 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
27225 (entry.family == AF_INET6) ?
27226 @@ -728,6 +736,8 @@ static int inet_diag_dump(struct sk_buff
27227 sk_nulls_for_each(sk, node, &ilb->head) {
27228 struct inet_sock *inet = inet_sk(sk);
27230 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27235 @@ -794,6 +804,8 @@ skip_listen_ht:
27236 sk_nulls_for_each(sk, node, &head->chain) {
27237 struct inet_sock *inet = inet_sk(sk);
27239 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27243 if (!(r->idiag_states & (1 << sk->sk_state)))
27244 @@ -818,6 +830,8 @@ next_normal:
27245 inet_twsk_for_each(tw, node,
27248 + if (!nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))
27252 if (r->id.idiag_sport != tw->tw_sport &&
27253 diff -NurpP --minimal linux-2.6.34/net/ipv4/inet_hashtables.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/inet_hashtables.c
27254 --- linux-2.6.34/net/ipv4/inet_hashtables.c 2010-02-25 11:52:10.000000000 +0100
27255 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/inet_hashtables.c 2010-05-18 18:11:22.000000000 +0200
27258 #include <net/inet_connection_sock.h>
27259 #include <net/inet_hashtables.h>
27260 +#include <net/route.h>
27261 #include <net/ip.h>
27264 @@ -134,6 +135,11 @@ static inline int compute_score(struct s
27265 if (rcv_saddr != daddr)
27269 + /* block non nx_info ips */
27270 + if (!v4_addr_in_nx_info(sk->sk_nx_info,
27271 + daddr, NXA_MASK_BIND))
27274 if (sk->sk_bound_dev_if) {
27275 if (sk->sk_bound_dev_if != dif)
27276 @@ -151,7 +157,6 @@ static inline int compute_score(struct s
27277 * wildcarded during the search since they can never be otherwise.
27281 struct sock *__inet_lookup_listener(struct net *net,
27282 struct inet_hashinfo *hashinfo,
27283 const __be32 daddr, const unsigned short hnum,
27284 @@ -174,6 +179,7 @@ begin:
27290 * if the nulls value we got at the end of this lookup is
27291 * not the expected one, we must restart lookup.
27292 diff -NurpP --minimal linux-2.6.34/net/ipv4/netfilter/nf_nat_helper.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/netfilter/nf_nat_helper.c
27293 --- linux-2.6.34/net/ipv4/netfilter/nf_nat_helper.c 2010-05-18 15:07:53.000000000 +0200
27294 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/netfilter/nf_nat_helper.c 2010-05-18 18:11:22.000000000 +0200
27296 #include <net/route.h>
27298 #include <linux/netfilter_ipv4.h>
27299 +#include <net/route.h>
27300 #include <net/netfilter/nf_conntrack.h>
27301 #include <net/netfilter/nf_conntrack_helper.h>
27302 #include <net/netfilter/nf_conntrack_ecache.h>
27303 diff -NurpP --minimal linux-2.6.34/net/ipv4/netfilter.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/netfilter.c
27304 --- linux-2.6.34/net/ipv4/netfilter.c 2010-05-18 15:07:53.000000000 +0200
27305 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/netfilter.c 2010-05-18 18:11:22.000000000 +0200
27307 #include <linux/ip.h>
27308 #include <linux/skbuff.h>
27309 #include <linux/gfp.h>
27310 -#include <net/route.h>
27311 +// #include <net/route.h>
27312 #include <net/xfrm.h>
27313 #include <net/ip.h>
27314 #include <net/netfilter/nf_queue.h>
27315 diff -NurpP --minimal linux-2.6.34/net/ipv4/raw.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/raw.c
27316 --- linux-2.6.34/net/ipv4/raw.c 2010-05-18 15:07:53.000000000 +0200
27317 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/raw.c 2010-05-18 18:11:22.000000000 +0200
27318 @@ -116,7 +116,7 @@ static struct sock *__raw_v4_lookup(stru
27320 if (net_eq(sock_net(sk), net) && inet->inet_num == num &&
27321 !(inet->inet_daddr && inet->inet_daddr != raddr) &&
27322 - !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
27323 + v4_sock_addr_match(sk->sk_nx_info, inet, laddr) &&
27324 !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
27325 goto found; /* gotcha */
27327 @@ -381,6 +381,12 @@ static int raw_send_hdrinc(struct sock *
27328 icmp_out_count(net, ((struct icmphdr *)
27329 skb_transport_header(skb))->type);
27332 + if (!nx_check(0, VS_ADMIN) && !capable(CAP_NET_RAW) &&
27333 + sk->sk_nx_info &&
27334 + !v4_addr_in_nx_info(sk->sk_nx_info, iph->saddr, NXA_MASK_BIND))
27337 err = NF_HOOK(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
27340 @@ -561,6 +567,13 @@ static int raw_sendmsg(struct kiocb *ioc
27343 security_sk_classify_flow(sk, &fl);
27344 + if (sk->sk_nx_info) {
27345 + err = ip_v4_find_src(sock_net(sk),
27346 + sk->sk_nx_info, &rt, &fl);
27351 err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1);
27354 @@ -633,17 +646,19 @@ static int raw_bind(struct sock *sk, str
27356 struct inet_sock *inet = inet_sk(sk);
27357 struct sockaddr_in *addr = (struct sockaddr_in *) uaddr;
27358 + struct nx_v4_sock_addr nsa = { 0 };
27362 if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in))
27364 - chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
27365 + v4_map_sock_addr(inet, addr, &nsa);
27366 + chk_addr_ret = inet_addr_type(sock_net(sk), nsa.saddr);
27367 ret = -EADDRNOTAVAIL;
27368 - if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL &&
27369 + if (nsa.saddr && chk_addr_ret != RTN_LOCAL &&
27370 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
27372 - inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
27373 + v4_set_sock_addr(inet, &nsa);
27374 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
27375 inet->inet_saddr = 0; /* Use device */
27377 @@ -695,7 +710,8 @@ static int raw_recvmsg(struct kiocb *ioc
27378 /* Copy the address. */
27380 sin->sin_family = AF_INET;
27381 - sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
27382 + sin->sin_addr.s_addr =
27383 + nx_map_sock_lback(sk->sk_nx_info, ip_hdr(skb)->saddr);
27385 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
27387 @@ -873,7 +889,8 @@ static struct sock *raw_get_first(struct
27388 struct hlist_node *node;
27390 sk_for_each(sk, node, &state->h->ht[state->bucket])
27391 - if (sock_net(sk) == seq_file_net(seq))
27392 + if ((sock_net(sk) == seq_file_net(seq)) &&
27393 + nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27397 @@ -889,7 +906,8 @@ static struct sock *raw_get_next(struct
27401 - } while (sk && sock_net(sk) != seq_file_net(seq));
27402 + } while (sk && ((sock_net(sk) != seq_file_net(seq)) ||
27403 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
27405 if (!sk && ++state->bucket < RAW_HTABLE_SIZE) {
27406 sk = sk_head(&state->h->ht[state->bucket]);
27407 @@ -948,7 +966,10 @@ static void raw_sock_seq_show(struct seq
27409 seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
27410 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",
27411 - i, src, srcp, dest, destp, sp->sk_state,
27413 + nx_map_sock_lback(current_nx_info(), src), srcp,
27414 + nx_map_sock_lback(current_nx_info(), dest), destp,
27416 sk_wmem_alloc_get(sp),
27417 sk_rmem_alloc_get(sp),
27418 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
27419 diff -NurpP --minimal linux-2.6.34/net/ipv4/tcp.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/tcp.c
27420 --- linux-2.6.34/net/ipv4/tcp.c 2010-05-18 15:07:53.000000000 +0200
27421 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/tcp.c 2010-05-18 18:11:22.000000000 +0200
27422 @@ -266,6 +266,7 @@
27423 #include <linux/crypto.h>
27424 #include <linux/time.h>
27425 #include <linux/slab.h>
27426 +#include <linux/in.h>
27428 #include <net/icmp.h>
27429 #include <net/tcp.h>
27430 diff -NurpP --minimal linux-2.6.34/net/ipv4/tcp_ipv4.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/tcp_ipv4.c
27431 --- linux-2.6.34/net/ipv4/tcp_ipv4.c 2010-05-18 15:07:53.000000000 +0200
27432 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/tcp_ipv4.c 2010-05-18 18:11:22.000000000 +0200
27433 @@ -2004,6 +2004,12 @@ static void *listening_get_next(struct s
27434 req = req->dl_next;
27437 + vxdprintk(VXD_CBIT(net, 6),
27438 + "sk,req: %p [#%d] (from %d)", req->sk,
27439 + (req->sk)?req->sk->sk_nid:0, nx_current_nid());
27441 + !nx_check(req->sk->sk_nid, VS_WATCH_P | VS_IDENT))
27443 if (req->rsk_ops->family == st->family) {
27446 @@ -2028,6 +2034,10 @@ get_req:
27449 sk_nulls_for_each_from(sk, node) {
27450 + vxdprintk(VXD_CBIT(net, 6), "sk: %p [#%d] (from %d)",
27451 + sk, sk->sk_nid, nx_current_nid());
27452 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27454 if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) {
27457 @@ -2091,6 +2101,11 @@ static void *established_get_first(struc
27459 spin_lock_bh(lock);
27460 sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
27461 + vxdprintk(VXD_CBIT(net, 6),
27462 + "sk,egf: %p [#%d] (from %d)",
27463 + sk, sk->sk_nid, nx_current_nid());
27464 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27466 if (sk->sk_family != st->family ||
27467 !net_eq(sock_net(sk), net)) {
27469 @@ -2101,6 +2116,11 @@ static void *established_get_first(struc
27470 st->state = TCP_SEQ_STATE_TIME_WAIT;
27471 inet_twsk_for_each(tw, node,
27472 &tcp_hashinfo.ehash[st->bucket].twchain) {
27473 + vxdprintk(VXD_CBIT(net, 6),
27474 + "tw: %p [#%d] (from %d)",
27475 + tw, tw->tw_nid, nx_current_nid());
27476 + if (!nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))
27478 if (tw->tw_family != st->family ||
27479 !net_eq(twsk_net(tw), net)) {
27481 @@ -2129,7 +2149,9 @@ static void *established_get_next(struct
27485 - while (tw && (tw->tw_family != st->family || !net_eq(twsk_net(tw), net))) {
27486 + while (tw && (tw->tw_family != st->family ||
27487 + !net_eq(twsk_net(tw), net) ||
27488 + !nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))) {
27492 @@ -2152,6 +2174,11 @@ get_tw:
27493 sk = sk_nulls_next(sk);
27495 sk_nulls_for_each_from(sk, node) {
27496 + vxdprintk(VXD_CBIT(net, 6),
27497 + "sk,egn: %p [#%d] (from %d)",
27498 + sk, sk->sk_nid, nx_current_nid());
27499 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27501 if (sk->sk_family == st->family && net_eq(sock_net(sk), net))
27504 @@ -2303,9 +2330,9 @@ static void get_openreq4(struct sock *sk
27505 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
27506 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %p%n",
27509 + nx_map_sock_lback(current_nx_info(), ireq->loc_addr),
27510 ntohs(inet_sk(sk)->inet_sport),
27512 + nx_map_sock_lback(current_nx_info(), ireq->rmt_addr),
27513 ntohs(ireq->rmt_port),
27515 0, 0, /* could print option size, but that is af dependent. */
27516 @@ -2357,7 +2384,10 @@ static void get_tcp4_sock(struct sock *s
27518 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
27519 "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
27520 - i, src, srcp, dest, destp, sk->sk_state,
27522 + nx_map_sock_lback(current_nx_info(), src), srcp,
27523 + nx_map_sock_lback(current_nx_info(), dest), destp,
27525 tp->write_seq - tp->snd_una,
27528 @@ -2392,7 +2422,10 @@ static void get_timewait4_sock(struct in
27530 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
27531 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p%n",
27532 - i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
27534 + nx_map_sock_lback(current_nx_info(), src), srcp,
27535 + nx_map_sock_lback(current_nx_info(), dest), destp,
27536 + tw->tw_substate, 0, 0,
27537 3, jiffies_to_clock_t(ttd), 0, 0, 0, 0,
27538 atomic_read(&tw->tw_refcnt), tw, len);
27540 diff -NurpP --minimal linux-2.6.34/net/ipv4/tcp_minisocks.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/tcp_minisocks.c
27541 --- linux-2.6.34/net/ipv4/tcp_minisocks.c 2010-05-18 15:07:53.000000000 +0200
27542 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/tcp_minisocks.c 2010-05-18 18:11:22.000000000 +0200
27544 #include <linux/slab.h>
27545 #include <linux/sysctl.h>
27546 #include <linux/workqueue.h>
27547 +#include <linux/vs_limit.h>
27548 +#include <linux/vs_socket.h>
27549 +#include <linux/vs_context.h>
27550 #include <net/tcp.h>
27551 #include <net/inet_common.h>
27552 #include <net/xfrm.h>
27553 @@ -290,6 +293,11 @@ void tcp_time_wait(struct sock *sk, int
27554 tcptw->tw_ts_recent = tp->rx_opt.ts_recent;
27555 tcptw->tw_ts_recent_stamp = tp->rx_opt.ts_recent_stamp;
27557 + tw->tw_xid = sk->sk_xid;
27558 + tw->tw_vx_info = NULL;
27559 + tw->tw_nid = sk->sk_nid;
27560 + tw->tw_nx_info = NULL;
27562 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
27563 if (tw->tw_family == PF_INET6) {
27564 struct ipv6_pinfo *np = inet6_sk(sk);
27565 diff -NurpP --minimal linux-2.6.34/net/ipv4/udp.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/udp.c
27566 --- linux-2.6.34/net/ipv4/udp.c 2010-05-18 15:07:53.000000000 +0200
27567 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv4/udp.c 2010-05-18 18:11:22.000000000 +0200
27568 @@ -295,14 +295,7 @@ fail:
27570 EXPORT_SYMBOL(udp_lib_get_port);
27572 -static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
27574 - struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2);
27576 - return (!ipv6_only_sock(sk2) &&
27577 - (!inet1->inet_rcv_saddr || !inet2->inet_rcv_saddr ||
27578 - inet1->inet_rcv_saddr == inet2->inet_rcv_saddr));
27580 +extern int ipv4_rcv_saddr_equal(const struct sock *, const struct sock *);
27582 static unsigned int udp4_portaddr_hash(struct net *net, __be32 saddr,
27584 @@ -337,6 +330,11 @@ static inline int compute_score(struct s
27585 if (inet->inet_rcv_saddr != daddr)
27589 + /* block non nx_info ips */
27590 + if (!v4_addr_in_nx_info(sk->sk_nx_info,
27591 + daddr, NXA_MASK_BIND))
27594 if (inet->inet_daddr) {
27595 if (inet->inet_daddr != saddr)
27596 @@ -440,6 +438,7 @@ exact_match:
27601 /* UDP is nearly always wildcards out the wazoo, it makes no sense to try
27602 * harder than this. -DaveM
27604 @@ -485,6 +484,11 @@ begin:
27605 sk_nulls_for_each_rcu(sk, node, &hslot->head) {
27606 score = compute_score(sk, net, saddr, hnum, sport,
27607 daddr, dport, dif);
27608 + /* FIXME: disabled?
27609 + if (score == 9) {
27613 if (score > badness) {
27616 @@ -498,6 +502,7 @@ begin:
27617 if (get_nulls_value(node) != slot)
27622 if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
27624 @@ -507,6 +512,7 @@ begin:
27632 @@ -549,8 +555,7 @@ static inline struct sock *udp_v4_mcast_
27633 udp_sk(s)->udp_port_hash != hnum ||
27634 (inet->inet_daddr && inet->inet_daddr != rmt_addr) ||
27635 (inet->inet_dport != rmt_port && inet->inet_dport) ||
27636 - (inet->inet_rcv_saddr &&
27637 - inet->inet_rcv_saddr != loc_addr) ||
27638 + !v4_sock_addr_match(sk->sk_nx_info, inet, loc_addr) ||
27639 ipv6_only_sock(s) ||
27640 (s->sk_bound_dev_if && s->sk_bound_dev_if != dif))
27642 @@ -899,8 +904,13 @@ int udp_sendmsg(struct kiocb *iocb, stru
27643 { .sport = inet->inet_sport,
27644 .dport = dport } } };
27645 struct net *net = sock_net(sk);
27646 + struct nx_info *nxi = sk->sk_nx_info;
27648 security_sk_classify_flow(sk, &fl);
27649 + err = ip_v4_find_src(net, nxi, &rt, &fl);
27653 err = ip_route_output_flow(net, &rt, &fl, sk, 1);
27655 if (err == -ENETUNREACH)
27656 @@ -1180,7 +1190,8 @@ try_again:
27658 sin->sin_family = AF_INET;
27659 sin->sin_port = udp_hdr(skb)->source;
27660 - sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
27661 + sin->sin_addr.s_addr = nx_map_sock_lback(
27662 + skb->sk->sk_nx_info, ip_hdr(skb)->saddr);
27663 memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
27665 if (inet->cmsg_flags)
27666 @@ -1867,6 +1878,8 @@ static struct sock *udp_get_first(struct
27667 sk_nulls_for_each(sk, node, &hslot->head) {
27668 if (!net_eq(sock_net(sk), net))
27670 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
27672 if (sk->sk_family == state->family)
27675 @@ -1884,7 +1897,9 @@ static struct sock *udp_get_next(struct
27678 sk = sk_nulls_next(sk);
27679 - } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family));
27680 + } while (sk && (!net_eq(sock_net(sk), net) ||
27681 + sk->sk_family != state->family ||
27682 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
27685 if (state->bucket <= state->udp_table->mask)
27686 @@ -1991,7 +2006,10 @@ static void udp4_format_sock(struct sock
27688 seq_printf(f, "%5d: %08X:%04X %08X:%04X"
27689 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n",
27690 - bucket, src, srcp, dest, destp, sp->sk_state,
27692 + nx_map_sock_lback(current_nx_info(), src), srcp,
27693 + nx_map_sock_lback(current_nx_info(), dest), destp,
27695 sk_wmem_alloc_get(sp),
27696 sk_rmem_alloc_get(sp),
27697 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
27698 diff -NurpP --minimal linux-2.6.34/net/ipv6/addrconf.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/addrconf.c
27699 --- linux-2.6.34/net/ipv6/addrconf.c 2010-05-18 15:07:53.000000000 +0200
27700 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/addrconf.c 2010-05-18 18:11:22.000000000 +0200
27703 #include <linux/proc_fs.h>
27704 #include <linux/seq_file.h>
27705 +#include <linux/vs_network.h>
27706 +#include <linux/vs_inet6.h>
27708 /* Set to 3 to get tracing... */
27709 #define ACONF_DEBUG 2
27710 @@ -1120,7 +1122,7 @@ out:
27712 int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
27713 const struct in6_addr *daddr, unsigned int prefs,
27714 - struct in6_addr *saddr)
27715 + struct in6_addr *saddr, struct nx_info *nxi)
27717 struct ipv6_saddr_score scores[2],
27718 *score = &scores[0], *hiscore = &scores[1];
27719 @@ -1192,6 +1194,8 @@ int ipv6_dev_get_saddr(struct net *net,
27723 + if (!v6_addr_in_nx_info(nxi, &score->ifa->addr, -1))
27727 bitmap_zero(score->scorebits, IPV6_SADDR_RULE_MAX);
27728 @@ -3037,7 +3041,10 @@ static void if6_seq_stop(struct seq_file
27729 static int if6_seq_show(struct seq_file *seq, void *v)
27731 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
27732 - seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
27734 + if (nx_check(0, VS_ADMIN|VS_WATCH) ||
27735 + v6_addr_in_nx_info(current_nx_info(), &ifp->addr, -1))
27736 + seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
27738 ifp->idev->dev->ifindex,
27740 @@ -3532,6 +3539,11 @@ static int in6_dump_addrs(struct inet6_d
27741 struct ifacaddr6 *ifaca;
27743 int ip_idx = *p_ip_idx;
27744 + struct nx_info *nxi = skb->sk ? skb->sk->sk_nx_info : NULL;
27746 + /* disable ipv6 on non v6 guests */
27747 + if (nxi && !nx_info_has_v6(nxi))
27750 read_lock_bh(&idev->lock);
27752 @@ -3541,6 +3553,8 @@ static int in6_dump_addrs(struct inet6_d
27753 ifa = ifa->if_next, ip_idx++) {
27754 if (ip_idx < s_ip_idx)
27756 + if (!v6_addr_in_nx_info(nxi, &ifa->addr, -1))
27758 err = inet6_fill_ifaddr(skb, ifa,
27759 NETLINK_CB(cb->skb).pid,
27760 cb->nlh->nlmsg_seq,
27761 @@ -3556,6 +3570,8 @@ static int in6_dump_addrs(struct inet6_d
27762 ifmca = ifmca->next, ip_idx++) {
27763 if (ip_idx < s_ip_idx)
27765 + if (!v6_addr_in_nx_info(nxi, &ifmca->mca_addr, -1))
27767 err = inet6_fill_ifmcaddr(skb, ifmca,
27768 NETLINK_CB(cb->skb).pid,
27769 cb->nlh->nlmsg_seq,
27770 @@ -3571,6 +3587,8 @@ static int in6_dump_addrs(struct inet6_d
27771 ifaca = ifaca->aca_next, ip_idx++) {
27772 if (ip_idx < s_ip_idx)
27774 + if (!v6_addr_in_nx_info(nxi, &ifaca->aca_addr, -1))
27776 err = inet6_fill_ifacaddr(skb, ifaca,
27777 NETLINK_CB(cb->skb).pid,
27778 cb->nlh->nlmsg_seq,
27779 @@ -3899,6 +3917,11 @@ static int inet6_dump_ifinfo(struct sk_b
27780 struct inet6_dev *idev;
27781 struct hlist_head *head;
27782 struct hlist_node *node;
27783 + struct nx_info *nxi = skb->sk ? skb->sk->sk_nx_info : NULL;
27785 + /* FIXME: maybe disable ipv6 on non v6 guests?
27786 + if (skb->sk && skb->sk->sk_vx_info)
27787 + return skb->len; */
27790 s_idx = cb->args[1];
27791 @@ -3910,6 +3933,8 @@ static int inet6_dump_ifinfo(struct sk_b
27792 hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
27795 + if (!v6_dev_in_nx_info(dev, nxi))
27797 idev = __in6_dev_get(dev);
27800 diff -NurpP --minimal linux-2.6.34/net/ipv6/af_inet6.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/af_inet6.c
27801 --- linux-2.6.34/net/ipv6/af_inet6.c 2010-05-18 15:07:53.000000000 +0200
27802 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/af_inet6.c 2010-05-18 18:11:22.000000000 +0200
27804 #include <linux/netdevice.h>
27805 #include <linux/icmpv6.h>
27806 #include <linux/netfilter_ipv6.h>
27807 +#include <linux/vs_inet.h>
27808 +#include <linux/vs_inet6.h>
27810 #include <net/ip.h>
27811 #include <net/ipv6.h>
27812 @@ -160,9 +162,12 @@ lookup_protocol:
27816 + if ((protocol == IPPROTO_ICMPV6) &&
27817 + nx_capable(CAP_NET_RAW, NXC_RAW_ICMP))
27819 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
27820 goto out_rcu_unlock;
27823 sock->ops = answer->ops;
27824 answer_prot = answer->prot;
27825 answer_no_check = answer->no_check;
27826 @@ -261,6 +266,7 @@ int inet6_bind(struct socket *sock, stru
27827 struct inet_sock *inet = inet_sk(sk);
27828 struct ipv6_pinfo *np = inet6_sk(sk);
27829 struct net *net = sock_net(sk);
27830 + struct nx_v6_sock_addr nsa;
27832 unsigned short snum;
27834 @@ -272,6 +278,11 @@ int inet6_bind(struct socket *sock, stru
27836 if (addr_len < SIN6_LEN_RFC2133)
27839 + err = v6_map_sock_addr(inet, addr, &nsa);
27843 addr_type = ipv6_addr_type(&addr->sin6_addr);
27844 if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM)
27846 @@ -303,6 +314,7 @@ int inet6_bind(struct socket *sock, stru
27847 /* Reproduce AF_INET checks to make the bindings consitant */
27848 v4addr = addr->sin6_addr.s6_addr32[3];
27849 chk_addr_ret = inet_addr_type(net, v4addr);
27851 if (!sysctl_ip_nonlocal_bind &&
27852 !(inet->freebind || inet->transparent) &&
27853 v4addr != htonl(INADDR_ANY) &&
27854 @@ -312,6 +324,10 @@ int inet6_bind(struct socket *sock, stru
27855 err = -EADDRNOTAVAIL;
27858 + if (!v4_addr_in_nx_info(sk->sk_nx_info, v4addr, NXA_MASK_BIND)) {
27859 + err = -EADDRNOTAVAIL;
27863 if (addr_type != IPV6_ADDR_ANY) {
27864 struct net_device *dev = NULL;
27865 @@ -338,6 +354,11 @@ int inet6_bind(struct socket *sock, stru
27869 + if (!v6_addr_in_nx_info(sk->sk_nx_info, &addr->sin6_addr, -1)) {
27870 + err = -EADDRNOTAVAIL;
27874 /* ipv4 addr of the socket is invalid. Only the
27875 * unspecified and mapped address have a v4 equivalent.
27877 @@ -353,6 +374,9 @@ int inet6_bind(struct socket *sock, stru
27881 + /* what's that for? */
27882 + v6_set_sock_addr(inet, &nsa);
27884 inet->inet_rcv_saddr = v4addr;
27885 inet->inet_saddr = v4addr;
27887 @@ -451,9 +475,11 @@ int inet6_getname(struct socket *sock, s
27889 sin->sin6_port = inet->inet_dport;
27890 ipv6_addr_copy(&sin->sin6_addr, &np->daddr);
27891 + /* FIXME: remap lback? */
27893 sin->sin6_flowinfo = np->flow_label;
27895 + /* FIXME: remap lback? */
27896 if (ipv6_addr_any(&np->rcv_saddr))
27897 ipv6_addr_copy(&sin->sin6_addr, &np->saddr);
27899 diff -NurpP --minimal linux-2.6.34/net/ipv6/fib6_rules.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/fib6_rules.c
27900 --- linux-2.6.34/net/ipv6/fib6_rules.c 2010-05-18 15:07:53.000000000 +0200
27901 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/fib6_rules.c 2010-05-18 18:11:22.000000000 +0200
27902 @@ -89,7 +89,7 @@ static int fib6_rule_action(struct fib_r
27903 ip6_dst_idev(&rt->u.dst)->dev,
27905 rt6_flags2srcprefs(flags),
27909 if (!ipv6_prefix_equal(&saddr, &r->src.addr,
27911 diff -NurpP --minimal linux-2.6.34/net/ipv6/inet6_hashtables.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/inet6_hashtables.c
27912 --- linux-2.6.34/net/ipv6/inet6_hashtables.c 2010-02-25 11:52:10.000000000 +0100
27913 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/inet6_hashtables.c 2010-05-18 18:11:22.000000000 +0200
27916 #include <linux/module.h>
27917 #include <linux/random.h>
27918 +#include <linux/vs_inet6.h>
27920 #include <net/inet_connection_sock.h>
27921 #include <net/inet_hashtables.h>
27922 @@ -82,7 +83,6 @@ struct sock *__inet6_lookup_established(
27923 unsigned int slot = hash & hashinfo->ehash_mask;
27924 struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
27929 sk_nulls_for_each_rcu(sk, node, &head->chain) {
27930 @@ -94,7 +94,7 @@ begin:
27938 if (get_nulls_value(node) != slot)
27939 @@ -140,6 +140,9 @@ static int inline compute_score(struct s
27940 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
27944 + if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
27947 if (sk->sk_bound_dev_if) {
27948 if (sk->sk_bound_dev_if != dif)
27949 diff -NurpP --minimal linux-2.6.34/net/ipv6/ip6_output.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/ip6_output.c
27950 --- linux-2.6.34/net/ipv6/ip6_output.c 2010-05-18 15:07:53.000000000 +0200
27951 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/ip6_output.c 2010-05-18 18:11:22.000000000 +0200
27952 @@ -937,7 +937,7 @@ static int ip6_dst_lookup_tail(struct so
27953 err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev,
27955 sk ? inet6_sk(sk)->srcprefs : 0,
27957 + &fl->fl6_src, sk->sk_nx_info);
27959 goto out_err_release;
27961 diff -NurpP --minimal linux-2.6.34/net/ipv6/Kconfig linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/Kconfig
27962 --- linux-2.6.34/net/ipv6/Kconfig 2010-02-25 11:52:10.000000000 +0100
27963 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/Kconfig 2010-05-18 18:11:22.000000000 +0200
27966 # IPv6 as module will cause a CRASH if you try to unload it
27968 - tristate "The IPv6 protocol"
27970 + bool "The IPv6 protocol"
27973 This is complemental support for the IP version 6.
27974 You will still be able to do traditional IPv4 networking as well.
27975 diff -NurpP --minimal linux-2.6.34/net/ipv6/ndisc.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/ndisc.c
27976 --- linux-2.6.34/net/ipv6/ndisc.c 2010-05-18 15:07:53.000000000 +0200
27977 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/ndisc.c 2010-05-18 18:11:22.000000000 +0200
27978 @@ -590,7 +590,7 @@ static void ndisc_send_na(struct net_dev
27980 if (ipv6_dev_get_saddr(dev_net(dev), dev, daddr,
27981 inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs,
27983 + &tmpaddr, NULL /* FIXME: ? */ ))
27985 src_addr = &tmpaddr;
27987 diff -NurpP --minimal linux-2.6.34/net/ipv6/raw.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/raw.c
27988 --- linux-2.6.34/net/ipv6/raw.c 2010-05-18 15:07:53.000000000 +0200
27989 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/raw.c 2010-05-18 18:11:22.000000000 +0200
27991 #include <linux/icmpv6.h>
27992 #include <linux/netfilter.h>
27993 #include <linux/netfilter_ipv6.h>
27994 +#include <linux/vs_inet6.h>
27995 #include <linux/skbuff.h>
27996 #include <asm/uaccess.h>
27997 #include <asm/ioctls.h>
27998 @@ -283,6 +284,13 @@ static int rawv6_bind(struct sock *sk, s
28002 + if (!v6_addr_in_nx_info(sk->sk_nx_info, &addr->sin6_addr, -1)) {
28003 + err = -EADDRNOTAVAIL;
28009 /* ipv4 addr of the socket is invalid. Only the
28010 * unspecified and mapped address have a v4 equivalent.
28012 diff -NurpP --minimal linux-2.6.34/net/ipv6/route.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/route.c
28013 --- linux-2.6.34/net/ipv6/route.c 2010-05-18 15:07:53.000000000 +0200
28014 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/route.c 2010-05-18 18:11:22.000000000 +0200
28015 @@ -2257,7 +2257,8 @@ static int rt6_fill_node(struct net *net
28016 struct inet6_dev *idev = ip6_dst_idev(&rt->u.dst);
28017 struct in6_addr saddr_buf;
28018 if (ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
28019 - dst, 0, &saddr_buf) == 0)
28020 + dst, 0, &saddr_buf,
28021 + (skb->sk ? skb->sk->sk_nx_info : NULL)) == 0)
28022 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
28025 diff -NurpP --minimal linux-2.6.34/net/ipv6/tcp_ipv6.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/tcp_ipv6.c
28026 --- linux-2.6.34/net/ipv6/tcp_ipv6.c 2010-05-18 15:07:53.000000000 +0200
28027 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/tcp_ipv6.c 2010-05-18 18:11:22.000000000 +0200
28030 #include <linux/crypto.h>
28031 #include <linux/scatterlist.h>
28032 +#include <linux/vs_inet6.h>
28034 static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb);
28035 static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
28036 @@ -157,8 +158,15 @@ static int tcp_v6_connect(struct sock *s
28037 * connect() to INADDR_ANY means loopback (BSD'ism).
28040 - if(ipv6_addr_any(&usin->sin6_addr))
28041 - usin->sin6_addr.s6_addr[15] = 0x1;
28042 + if(ipv6_addr_any(&usin->sin6_addr)) {
28043 + struct nx_info *nxi = sk->sk_nx_info;
28045 + if (nxi && nx_info_has_v6(nxi))
28046 + /* FIXME: remap lback? */
28047 + usin->sin6_addr = nxi->v6.ip;
28049 + usin->sin6_addr.s6_addr[15] = 0x1;
28052 addr_type = ipv6_addr_type(&usin->sin6_addr);
28054 diff -NurpP --minimal linux-2.6.34/net/ipv6/udp.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/udp.c
28055 --- linux-2.6.34/net/ipv6/udp.c 2010-05-18 15:07:53.000000000 +0200
28056 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/udp.c 2010-05-18 18:11:22.000000000 +0200
28057 @@ -48,13 +48,14 @@
28059 #include <linux/proc_fs.h>
28060 #include <linux/seq_file.h>
28061 +#include <linux/vs_inet6.h>
28062 #include "udp_impl.h"
28064 int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
28066 const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr;
28067 const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2);
28068 - __be32 sk1_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
28069 + __be32 sk_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
28070 __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
28071 int sk_ipv6only = ipv6_only_sock(sk);
28072 int sk2_ipv6only = inet_v6_ipv6only(sk2);
28073 @@ -62,24 +63,49 @@ int ipv6_rcv_saddr_equal(const struct so
28074 int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
28076 /* if both are mapped, treat as IPv4 */
28077 - if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED)
28078 - return (!sk2_ipv6only &&
28079 - (!sk1_rcv_saddr || !sk2_rcv_saddr ||
28080 - sk1_rcv_saddr == sk2_rcv_saddr));
28081 + if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) {
28082 + if (!sk2_ipv6only &&
28083 + (!sk_rcv_saddr || !sk2_rcv_saddr ||
28084 + sk_rcv_saddr == sk2_rcv_saddr))
28090 if (addr_type2 == IPV6_ADDR_ANY &&
28091 !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
28095 if (addr_type == IPV6_ADDR_ANY &&
28096 !(sk_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
28100 if (sk2_rcv_saddr6 &&
28101 ipv6_addr_equal(sk_rcv_saddr6, sk2_rcv_saddr6))
28108 + if (!sk_rcv_saddr && !sk2_rcv_saddr)
28109 + return nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28110 + if (!sk2_rcv_saddr)
28111 + return v4_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr, -1);
28112 + if (!sk_rcv_saddr)
28113 + return v4_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr, -1);
28116 + if (addr_type2 == IPV6_ADDR_ANY && addr_type == IPV6_ADDR_ANY)
28117 + return nx_v6_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28118 + else if (addr_type2 == IPV6_ADDR_ANY)
28119 + return v6_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr6, -1);
28120 + else if (addr_type == IPV6_ADDR_ANY) {
28121 + if (addr_type2 == IPV6_ADDR_MAPPED)
28122 + return nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28124 + return v6_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr6, -1);
28129 static unsigned int udp6_portaddr_hash(struct net *net,
28130 @@ -134,6 +160,10 @@ static inline int compute_score(struct s
28131 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
28135 + /* block non nx_info ips */
28136 + if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
28139 if (!ipv6_addr_any(&np->daddr)) {
28140 if (!ipv6_addr_equal(&np->daddr, saddr))
28141 diff -NurpP --minimal linux-2.6.34/net/ipv6/xfrm6_policy.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/xfrm6_policy.c
28142 --- linux-2.6.34/net/ipv6/xfrm6_policy.c 2010-05-18 15:07:53.000000000 +0200
28143 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/ipv6/xfrm6_policy.c 2010-05-18 18:11:22.000000000 +0200
28144 @@ -62,7 +62,7 @@ static int xfrm6_get_saddr(struct net *n
28145 dev = ip6_dst_idev(dst)->dev;
28146 ipv6_dev_get_saddr(dev_net(dev), dev,
28147 (struct in6_addr *)&daddr->a6, 0,
28148 - (struct in6_addr *)&saddr->a6);
28149 + (struct in6_addr *)&saddr->a6, NULL);
28153 diff -NurpP --minimal linux-2.6.34/net/netlink/af_netlink.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/netlink/af_netlink.c
28154 --- linux-2.6.34/net/netlink/af_netlink.c 2010-05-18 15:07:53.000000000 +0200
28155 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/netlink/af_netlink.c 2010-05-18 18:11:22.000000000 +0200
28157 #include <linux/types.h>
28158 #include <linux/audit.h>
28159 #include <linux/mutex.h>
28160 +#include <linux/vs_context.h>
28161 +#include <linux/vs_network.h>
28162 +#include <linux/vs_limit.h>
28164 #include <net/net_namespace.h>
28165 #include <net/sock.h>
28166 @@ -1919,6 +1922,8 @@ static struct sock *netlink_seq_socket_i
28167 sk_for_each(s, node, &hash->table[j]) {
28168 if (sock_net(s) != seq_file_net(seq))
28170 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
28174 iter->hash_idx = j;
28175 @@ -1953,7 +1958,8 @@ static void *netlink_seq_next(struct seq
28179 - } while (s && sock_net(s) != seq_file_net(seq));
28180 + } while (s && (sock_net(s) != seq_file_net(seq) ||
28181 + !nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT)));
28185 @@ -1965,7 +1971,8 @@ static void *netlink_seq_next(struct seq
28187 for (; j <= hash->mask; j++) {
28188 s = sk_head(&hash->table[j]);
28189 - while (s && sock_net(s) != seq_file_net(seq))
28190 + while (s && (sock_net(s) != seq_file_net(seq) ||
28191 + !nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT)))
28195 diff -NurpP --minimal linux-2.6.34/net/sctp/ipv6.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/sctp/ipv6.c
28196 --- linux-2.6.34/net/sctp/ipv6.c 2010-05-18 15:07:53.000000000 +0200
28197 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/sctp/ipv6.c 2010-05-18 18:11:22.000000000 +0200
28198 @@ -317,7 +317,8 @@ static void sctp_v6_get_saddr(struct sct
28199 dst ? ip6_dst_idev(dst)->dev : NULL,
28200 &daddr->v6.sin6_addr,
28201 inet6_sk(&sk->inet.sk)->srcprefs,
28202 - &saddr->v6.sin6_addr);
28203 + &saddr->v6.sin6_addr,
28204 + asoc->base.sk->sk_nx_info);
28205 SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: %pI6\n",
28206 &saddr->v6.sin6_addr);
28208 diff -NurpP --minimal linux-2.6.34/net/socket.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/socket.c
28209 --- linux-2.6.34/net/socket.c 2010-05-18 15:07:53.000000000 +0200
28210 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/socket.c 2010-05-18 18:11:22.000000000 +0200
28213 #include <net/sock.h>
28214 #include <linux/netfilter.h>
28215 +#include <linux/vs_base.h>
28216 +#include <linux/vs_socket.h>
28217 +#include <linux/vs_inet.h>
28218 +#include <linux/vs_inet6.h>
28220 #include <linux/if_tun.h>
28221 #include <linux/ipv6_route.h>
28222 @@ -540,7 +544,7 @@ static inline int __sock_sendmsg(struct
28223 struct msghdr *msg, size_t size)
28225 struct sock_iocb *si = kiocb_to_siocb(iocb);
28231 @@ -551,7 +555,22 @@ static inline int __sock_sendmsg(struct
28235 - return sock->ops->sendmsg(iocb, sock, msg, size);
28236 + len = sock->ops->sendmsg(iocb, sock, msg, size);
28239 + vx_sock_send(sock->sk, size);
28241 + vx_sock_fail(sock->sk, size);
28243 + vxdprintk(VXD_CBIT(net, 7),
28244 + "__sock_sendmsg: %p[%p,%p,%p;%d/%d]:%d/%d",
28246 + (sock->sk)?sock->sk->sk_nx_info:0,
28247 + (sock->sk)?sock->sk->sk_vx_info:0,
28248 + (sock->sk)?sock->sk->sk_xid:0,
28249 + (sock->sk)?sock->sk->sk_nid:0,
28250 + (unsigned int)size, len);
28254 int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
28255 @@ -668,6 +687,7 @@ static inline int __sock_recvmsg_nosec(s
28256 struct msghdr *msg, size_t size, int flags)
28258 struct sock_iocb *si = kiocb_to_siocb(iocb);
28263 @@ -675,7 +695,18 @@ static inline int __sock_recvmsg_nosec(s
28267 - return sock->ops->recvmsg(iocb, sock, msg, size, flags);
28268 + len = sock->ops->recvmsg(iocb, sock, msg, size, flags);
28269 + if ((len >= 0) && sock->sk)
28270 + vx_sock_recv(sock->sk, len);
28271 + vxdprintk(VXD_CBIT(net, 7),
28272 + "__sock_recvmsg: %p[%p,%p,%p;%d/%d]:%d/%d",
28274 + (sock->sk)?sock->sk->sk_nx_info:0,
28275 + (sock->sk)?sock->sk->sk_vx_info:0,
28276 + (sock->sk)?sock->sk->sk_xid:0,
28277 + (sock->sk)?sock->sk->sk_nid:0,
28278 + (unsigned int)size, len);
28282 static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock,
28283 @@ -1183,6 +1214,13 @@ static int __sock_create(struct net *net
28284 if (type < 0 || type >= SOCK_MAX)
28287 + if (!nx_check(0, VS_ADMIN)) {
28288 + if (family == PF_INET && !current_nx_info_has_v4())
28289 + return -EAFNOSUPPORT;
28290 + if (family == PF_INET6 && !current_nx_info_has_v6())
28291 + return -EAFNOSUPPORT;
28296 This uglymoron is moved from INET layer to here to avoid
28297 @@ -1315,6 +1353,7 @@ SYSCALL_DEFINE3(socket, int, family, int
28301 + set_bit(SOCK_USER_SOCKET, &sock->flags);
28302 retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
28305 @@ -1356,10 +1395,12 @@ SYSCALL_DEFINE4(socketpair, int, family,
28306 err = sock_create(family, type, protocol, &sock1);
28309 + set_bit(SOCK_USER_SOCKET, &sock1->flags);
28311 err = sock_create(family, type, protocol, &sock2);
28313 goto out_release_1;
28314 + set_bit(SOCK_USER_SOCKET, &sock2->flags);
28316 err = sock1->ops->socketpair(sock1, sock2);
28318 diff -NurpP --minimal linux-2.6.34/net/sunrpc/auth.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/sunrpc/auth.c
28319 --- linux-2.6.34/net/sunrpc/auth.c 2010-05-18 15:07:53.000000000 +0200
28320 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/sunrpc/auth.c 2010-05-18 18:11:22.000000000 +0200
28322 #include <linux/hash.h>
28323 #include <linux/sunrpc/clnt.h>
28324 #include <linux/spinlock.h>
28325 +#include <linux/vs_tag.h>
28328 # define RPCDBG_FACILITY RPCDBG_AUTH
28329 @@ -363,6 +364,7 @@ rpcauth_lookupcred(struct rpc_auth *auth
28330 memset(&acred, 0, sizeof(acred));
28331 acred.uid = cred->fsuid;
28332 acred.gid = cred->fsgid;
28333 + acred.tag = dx_current_tag();
28334 acred.group_info = get_group_info(((struct cred *)cred)->group_info);
28336 ret = auth->au_ops->lookup_cred(auth, &acred, flags);
28337 @@ -403,6 +405,7 @@ rpcauth_bind_root_cred(struct rpc_task *
28338 struct auth_cred acred = {
28341 + .tag = dx_current_tag(),
28343 struct rpc_cred *ret;
28345 diff -NurpP --minimal linux-2.6.34/net/sunrpc/auth_unix.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/sunrpc/auth_unix.c
28346 --- linux-2.6.34/net/sunrpc/auth_unix.c 2010-05-18 15:07:53.000000000 +0200
28347 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/sunrpc/auth_unix.c 2010-05-18 18:11:22.000000000 +0200
28348 @@ -12,12 +12,14 @@
28349 #include <linux/module.h>
28350 #include <linux/sunrpc/clnt.h>
28351 #include <linux/sunrpc/auth.h>
28352 +#include <linux/vs_tag.h>
28354 #define NFS_NGROUPS 16
28357 struct rpc_cred uc_base;
28360 gid_t uc_gids[NFS_NGROUPS];
28362 #define uc_uid uc_base.cr_uid
28363 @@ -79,6 +81,7 @@ unx_create_cred(struct rpc_auth *auth, s
28364 groups = NFS_NGROUPS;
28366 cred->uc_gid = acred->gid;
28367 + cred->uc_tag = acred->tag;
28368 for (i = 0; i < groups; i++)
28369 cred->uc_gids[i] = GROUP_AT(acred->group_info, i);
28370 if (i < NFS_NGROUPS)
28371 @@ -120,7 +123,9 @@ unx_match(struct auth_cred *acred, struc
28375 - if (cred->uc_uid != acred->uid || cred->uc_gid != acred->gid)
28376 + if (cred->uc_uid != acred->uid ||
28377 + cred->uc_gid != acred->gid ||
28378 + cred->uc_tag != acred->tag)
28381 if (acred->group_info != NULL)
28382 @@ -143,7 +148,7 @@ unx_marshal(struct rpc_task *task, __be3
28383 struct rpc_clnt *clnt = task->tk_client;
28384 struct unx_cred *cred = container_of(task->tk_msg.rpc_cred, struct unx_cred, uc_base);
28385 __be32 *base, *hold;
28389 *p++ = htonl(RPC_AUTH_UNIX);
28391 @@ -153,9 +158,12 @@ unx_marshal(struct rpc_task *task, __be3
28392 * Copy the UTS nodename captured when the client was created.
28394 p = xdr_encode_array(p, clnt->cl_nodename, clnt->cl_nodelen);
28395 + tag = task->tk_client->cl_tag;
28397 - *p++ = htonl((u32) cred->uc_uid);
28398 - *p++ = htonl((u32) cred->uc_gid);
28399 + *p++ = htonl((u32) TAGINO_UID(tag,
28400 + cred->uc_uid, cred->uc_tag));
28401 + *p++ = htonl((u32) TAGINO_GID(tag,
28402 + cred->uc_gid, cred->uc_tag));
28404 for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++)
28405 *p++ = htonl((u32) cred->uc_gids[i]);
28406 diff -NurpP --minimal linux-2.6.34/net/sunrpc/clnt.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/sunrpc/clnt.c
28407 --- linux-2.6.34/net/sunrpc/clnt.c 2010-05-18 15:07:53.000000000 +0200
28408 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/sunrpc/clnt.c 2010-05-18 18:11:22.000000000 +0200
28410 #include <linux/utsname.h>
28411 #include <linux/workqueue.h>
28412 #include <linux/in6.h>
28413 +#include <linux/vs_cvirt.h>
28415 #include <linux/sunrpc/clnt.h>
28416 #include <linux/sunrpc/rpc_pipe_fs.h>
28417 @@ -358,6 +359,9 @@ struct rpc_clnt *rpc_create(struct rpc_c
28418 if (!(args->flags & RPC_CLNT_CREATE_QUIET))
28419 clnt->cl_chatty = 1;
28421 + /* TODO: handle RPC_CLNT_CREATE_TAGGED
28422 + if (args->flags & RPC_CLNT_CREATE_TAGGED)
28423 + clnt->cl_tag = 1; */
28426 EXPORT_SYMBOL_GPL(rpc_create);
28427 diff -NurpP --minimal linux-2.6.34/net/unix/af_unix.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/unix/af_unix.c
28428 --- linux-2.6.34/net/unix/af_unix.c 2010-05-18 15:07:53.000000000 +0200
28429 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/unix/af_unix.c 2010-05-18 18:11:22.000000000 +0200
28430 @@ -114,6 +114,8 @@
28431 #include <linux/mount.h>
28432 #include <net/checksum.h>
28433 #include <linux/security.h>
28434 +#include <linux/vs_context.h>
28435 +#include <linux/vs_limit.h>
28437 static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
28438 static DEFINE_SPINLOCK(unix_table_lock);
28439 @@ -258,6 +260,8 @@ static struct sock *__unix_find_socket_b
28440 if (!net_eq(sock_net(s), net))
28443 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
28445 if (u->addr->len == len &&
28446 !memcmp(u->addr->name, sunname, len))
28448 @@ -2115,6 +2119,8 @@ static struct sock *unix_seq_idx(struct
28449 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) {
28450 if (sock_net(s) != seq_file_net(seq))
28452 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
28457 @@ -2139,7 +2145,8 @@ static void *unix_seq_next(struct seq_fi
28458 sk = first_unix_socket(&iter->i);
28460 sk = next_unix_socket(&iter->i, sk);
28461 - while (sk && (sock_net(sk) != seq_file_net(seq)))
28462 + while (sk && (sock_net(sk) != seq_file_net(seq) ||
28463 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)))
28464 sk = next_unix_socket(&iter->i, sk);
28467 diff -NurpP --minimal linux-2.6.34/net/x25/af_x25.c linux-2.6.34-vs2.3.0.36.30.4.pre6/net/x25/af_x25.c
28468 --- linux-2.6.34/net/x25/af_x25.c 2010-05-18 15:07:53.000000000 +0200
28469 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/net/x25/af_x25.c 2010-05-18 18:11:22.000000000 +0200
28470 @@ -569,7 +569,10 @@ static int x25_create(struct net *net, s
28474 - sock_init_data(sock, sk);
28475 + sk->sk_socket = sock;
28476 + sk->sk_type = sock->type;
28477 + sk->sk_sleep = &sock->wait;
28480 x25_init_timers(sk);
28482 diff -NurpP --minimal linux-2.6.34/scripts/checksyscalls.sh linux-2.6.34-vs2.3.0.36.30.4.pre6/scripts/checksyscalls.sh
28483 --- linux-2.6.34/scripts/checksyscalls.sh 2009-09-10 15:26:31.000000000 +0200
28484 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/scripts/checksyscalls.sh 2010-05-18 18:11:22.000000000 +0200
28485 @@ -194,7 +194,6 @@ cat << EOF
28486 #define __IGNORE_afs_syscall
28487 #define __IGNORE_getpmsg
28488 #define __IGNORE_putpmsg
28489 -#define __IGNORE_vserver
28493 diff -NurpP --minimal linux-2.6.34/security/commoncap.c linux-2.6.34-vs2.3.0.36.30.4.pre6/security/commoncap.c
28494 --- linux-2.6.34/security/commoncap.c 2010-05-18 15:07:53.000000000 +0200
28495 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/security/commoncap.c 2010-05-18 18:11:22.000000000 +0200
28497 #include <linux/prctl.h>
28498 #include <linux/securebits.h>
28499 #include <linux/syslog.h>
28500 +#include <linux/vs_context.h>
28503 * If a non-root user executes a setuid-root binary in
28504 @@ -53,7 +54,7 @@ static void warn_setuid_and_fcaps_mixed(
28506 int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
28508 - NETLINK_CB(skb).eff_cap = current_cap();
28509 + NETLINK_CB(skb).eff_cap = vx_mbcaps(current_cap());
28513 @@ -63,6 +64,7 @@ int cap_netlink_recv(struct sk_buff *skb
28518 EXPORT_SYMBOL(cap_netlink_recv);
28521 @@ -83,7 +85,22 @@ EXPORT_SYMBOL(cap_netlink_recv);
28522 int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap,
28525 - return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;
28526 + struct vx_info *vxi = tsk->vx_info;
28529 + printk("cap_capable() VXF_STATE_SETUP = %llx, raised = %x, eff = %08x:%08x\n",
28530 + vx_info_flags(vxi, VXF_STATE_SETUP, 0),
28531 + cap_raised(tsk->cap_effective, cap),
28532 + tsk->cap_effective.cap[1], tsk->cap_effective.cap[0]);
28535 + /* special case SETUP */
28536 + if (vx_info_flags(vxi, VXF_STATE_SETUP, 0) &&
28537 + /* FIXME: maybe use cred instead? */
28538 + cap_raised(tsk->cred->cap_effective, cap))
28541 + return vx_cap_raised(vxi, cred->cap_effective, cap) ? 0 : -EPERM;
28545 @@ -571,7 +588,7 @@ int cap_inode_setxattr(struct dentry *de
28547 if (!strncmp(name, XATTR_SECURITY_PREFIX,
28548 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
28549 - !capable(CAP_SYS_ADMIN))
28550 + !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
28554 @@ -597,7 +614,7 @@ int cap_inode_removexattr(struct dentry
28556 if (!strncmp(name, XATTR_SECURITY_PREFIX,
28557 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
28558 - !capable(CAP_SYS_ADMIN))
28559 + !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
28563 @@ -899,7 +916,8 @@ int cap_syslog(int type, bool from_file)
28564 if (type != SYSLOG_ACTION_OPEN && from_file)
28566 if ((type != SYSLOG_ACTION_READ_ALL &&
28567 - type != SYSLOG_ACTION_SIZE_BUFFER) && !capable(CAP_SYS_ADMIN))
28568 + type != SYSLOG_ACTION_SIZE_BUFFER) &&
28569 + !vx_capable(CAP_SYS_ADMIN, VXC_SYSLOG))
28573 @@ -951,3 +969,4 @@ int cap_file_mmap(struct file *file, uns
28578 diff -NurpP --minimal linux-2.6.34/security/selinux/av_permissions.h linux-2.6.34-vs2.3.0.36.30.4.pre6/security/selinux/av_permissions.h
28579 --- linux-2.6.34/security/selinux/av_permissions.h 1970-01-01 01:00:00.000000000 +0100
28580 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/security/selinux/av_permissions.h 2010-05-18 18:11:22.000000000 +0200
28582 +/* This file is automatically generated. Do not edit. */
28583 +#ifndef _SELINUX_AV_PERMISSIONS_H_
28584 +#define _SELINUX_AV_PERMISSIONS_H_
28586 +#define SECURITY__COMPUTE_AV 0x00000001UL
28587 +#define SECURITY__COMPUTE_CREATE 0x00000002UL
28588 +#define SECURITY__COMPUTE_MEMBER 0x00000004UL
28589 +#define SECURITY__CHECK_CONTEXT 0x00000008UL
28590 +#define SECURITY__LOAD_POLICY 0x00000010UL
28591 +#define SECURITY__COMPUTE_RELABEL 0x00000020UL
28592 +#define SECURITY__COMPUTE_USER 0x00000040UL
28593 +#define SECURITY__SETENFORCE 0x00000080UL
28594 +#define SECURITY__SETBOOL 0x00000100UL
28595 +#define SECURITY__SETSECPARAM 0x00000200UL
28596 +#define SECURITY__SETCHECKREQPROT 0x00000400UL
28597 +#define PROCESS__FORK 0x00000001UL
28598 +#define PROCESS__TRANSITION 0x00000002UL
28599 +#define PROCESS__SIGCHLD 0x00000004UL
28600 +#define PROCESS__SIGKILL 0x00000008UL
28601 +#define PROCESS__SIGSTOP 0x00000010UL
28602 +#define PROCESS__SIGNULL 0x00000020UL
28603 +#define PROCESS__SIGNAL 0x00000040UL
28604 +#define PROCESS__PTRACE 0x00000080UL
28605 +#define PROCESS__GETSCHED 0x00000100UL
28606 +#define PROCESS__SETSCHED 0x00000200UL
28607 +#define PROCESS__GETSESSION 0x00000400UL
28608 +#define PROCESS__GETPGID 0x00000800UL
28609 +#define PROCESS__SETPGID 0x00001000UL
28610 +#define PROCESS__GETCAP 0x00002000UL
28611 +#define PROCESS__SETCAP 0x00004000UL
28612 +#define PROCESS__SHARE 0x00008000UL
28613 +#define PROCESS__GETATTR 0x00010000UL
28614 +#define PROCESS__SETEXEC 0x00020000UL
28615 +#define PROCESS__SETFSCREATE 0x00040000UL
28616 +#define PROCESS__NOATSECURE 0x00080000UL
28617 +#define PROCESS__SIGINH 0x00100000UL
28618 +#define PROCESS__SETRLIMIT 0x00200000UL
28619 +#define PROCESS__RLIMITINH 0x00400000UL
28620 +#define PROCESS__DYNTRANSITION 0x00800000UL
28621 +#define PROCESS__SETCURRENT 0x01000000UL
28622 +#define PROCESS__EXECMEM 0x02000000UL
28623 +#define PROCESS__EXECSTACK 0x04000000UL
28624 +#define PROCESS__EXECHEAP 0x08000000UL
28625 +#define PROCESS__SETKEYCREATE 0x10000000UL
28626 +#define PROCESS__SETSOCKCREATE 0x20000000UL
28627 +#define SYSTEM__IPC_INFO 0x00000001UL
28628 +#define SYSTEM__SYSLOG_READ 0x00000002UL
28629 +#define SYSTEM__SYSLOG_MOD 0x00000004UL
28630 +#define SYSTEM__SYSLOG_CONSOLE 0x00000008UL
28631 +#define SYSTEM__MODULE_REQUEST 0x00000010UL
28632 +#define CAPABILITY__CHOWN 0x00000001UL
28633 +#define CAPABILITY__DAC_OVERRIDE 0x00000002UL
28634 +#define CAPABILITY__DAC_READ_SEARCH 0x00000004UL
28635 +#define CAPABILITY__FOWNER 0x00000008UL
28636 +#define CAPABILITY__FSETID 0x00000010UL
28637 +#define CAPABILITY__KILL 0x00000020UL
28638 +#define CAPABILITY__SETGID 0x00000040UL
28639 +#define CAPABILITY__SETUID 0x00000080UL
28640 +#define CAPABILITY__SETPCAP 0x00000100UL
28641 +#define CAPABILITY__LINUX_IMMUTABLE 0x00000200UL
28642 +#define CAPABILITY__NET_BIND_SERVICE 0x00000400UL
28643 +#define CAPABILITY__NET_BROADCAST 0x00000800UL
28644 +#define CAPABILITY__NET_ADMIN 0x00001000UL
28645 +#define CAPABILITY__NET_RAW 0x00002000UL
28646 +#define CAPABILITY__IPC_LOCK 0x00004000UL
28647 +#define CAPABILITY__IPC_OWNER 0x00008000UL
28648 +#define CAPABILITY__SYS_MODULE 0x00010000UL
28649 +#define CAPABILITY__SYS_RAWIO 0x00020000UL
28650 +#define CAPABILITY__SYS_CHROOT 0x00040000UL
28651 +#define CAPABILITY__SYS_PTRACE 0x00080000UL
28652 +#define CAPABILITY__SYS_PACCT 0x00100000UL
28653 +#define CAPABILITY__SYS_ADMIN 0x00200000UL
28654 +#define CAPABILITY__SYS_BOOT 0x00400000UL
28655 +#define CAPABILITY__SYS_NICE 0x00800000UL
28656 +#define CAPABILITY__SYS_RESOURCE 0x01000000UL
28657 +#define CAPABILITY__SYS_TIME 0x02000000UL
28658 +#define CAPABILITY__SYS_TTY_CONFIG 0x04000000UL
28659 +#define CAPABILITY__MKNOD 0x08000000UL
28660 +#define CAPABILITY__LEASE 0x10000000UL
28661 +#define CAPABILITY__AUDIT_WRITE 0x20000000UL
28662 +#define CAPABILITY__AUDIT_CONTROL 0x40000000UL
28663 +#define CAPABILITY__SETFCAP 0x80000000UL
28664 +#define FILESYSTEM__MOUNT 0x00000001UL
28665 +#define FILESYSTEM__REMOUNT 0x00000002UL
28666 +#define FILESYSTEM__UNMOUNT 0x00000004UL
28667 +#define FILESYSTEM__GETATTR 0x00000008UL
28668 +#define FILESYSTEM__RELABELFROM 0x00000010UL
28669 +#define FILESYSTEM__RELABELTO 0x00000020UL
28670 +#define FILESYSTEM__TRANSITION 0x00000040UL
28671 +#define FILESYSTEM__ASSOCIATE 0x00000080UL
28672 +#define FILESYSTEM__QUOTAMOD 0x00000100UL
28673 +#define FILESYSTEM__QUOTAGET 0x00000200UL
28674 +#define FILE__IOCTL 0x00000001UL
28675 +#define FILE__READ 0x00000002UL
28676 +#define FILE__WRITE 0x00000004UL
28677 +#define FILE__CREATE 0x00000008UL
28678 +#define FILE__GETATTR 0x00000010UL
28679 +#define FILE__SETATTR 0x00000020UL
28680 +#define FILE__LOCK 0x00000040UL
28681 +#define FILE__RELABELFROM 0x00000080UL
28682 +#define FILE__RELABELTO 0x00000100UL
28683 +#define FILE__APPEND 0x00000200UL
28684 +#define FILE__UNLINK 0x00000400UL
28685 +#define FILE__LINK 0x00000800UL
28686 +#define FILE__RENAME 0x00001000UL
28687 +#define FILE__EXECUTE 0x00002000UL
28688 +#define FILE__SWAPON 0x00004000UL
28689 +#define FILE__QUOTAON 0x00008000UL
28690 +#define FILE__MOUNTON 0x00010000UL
28691 +#define FILE__EXECUTE_NO_TRANS 0x00020000UL
28692 +#define FILE__ENTRYPOINT 0x00040000UL
28693 +#define FILE__EXECMOD 0x00080000UL
28694 +#define FILE__OPEN 0x00100000UL
28695 +#define DIR__IOCTL 0x00000001UL
28696 +#define DIR__READ 0x00000002UL
28697 +#define DIR__WRITE 0x00000004UL
28698 +#define DIR__CREATE 0x00000008UL
28699 +#define DIR__GETATTR 0x00000010UL
28700 +#define DIR__SETATTR 0x00000020UL
28701 +#define DIR__LOCK 0x00000040UL
28702 +#define DIR__RELABELFROM 0x00000080UL
28703 +#define DIR__RELABELTO 0x00000100UL
28704 +#define DIR__APPEND 0x00000200UL
28705 +#define DIR__UNLINK 0x00000400UL
28706 +#define DIR__LINK 0x00000800UL
28707 +#define DIR__RENAME 0x00001000UL
28708 +#define DIR__EXECUTE 0x00002000UL
28709 +#define DIR__SWAPON 0x00004000UL
28710 +#define DIR__QUOTAON 0x00008000UL
28711 +#define DIR__MOUNTON 0x00010000UL
28712 +#define DIR__ADD_NAME 0x00020000UL
28713 +#define DIR__REMOVE_NAME 0x00040000UL
28714 +#define DIR__REPARENT 0x00080000UL
28715 +#define DIR__SEARCH 0x00100000UL
28716 +#define DIR__RMDIR 0x00200000UL
28717 +#define DIR__OPEN 0x00400000UL
28718 +#define FD__USE 0x00000001UL
28719 +#define LNK_FILE__IOCTL 0x00000001UL
28720 +#define LNK_FILE__READ 0x00000002UL
28721 +#define LNK_FILE__WRITE 0x00000004UL
28722 +#define LNK_FILE__CREATE 0x00000008UL
28723 +#define LNK_FILE__GETATTR 0x00000010UL
28724 +#define LNK_FILE__SETATTR 0x00000020UL
28725 +#define LNK_FILE__LOCK 0x00000040UL
28726 +#define LNK_FILE__RELABELFROM 0x00000080UL
28727 +#define LNK_FILE__RELABELTO 0x00000100UL
28728 +#define LNK_FILE__APPEND 0x00000200UL
28729 +#define LNK_FILE__UNLINK 0x00000400UL
28730 +#define LNK_FILE__LINK 0x00000800UL
28731 +#define LNK_FILE__RENAME 0x00001000UL
28732 +#define LNK_FILE__EXECUTE 0x00002000UL
28733 +#define LNK_FILE__SWAPON 0x00004000UL
28734 +#define LNK_FILE__QUOTAON 0x00008000UL
28735 +#define LNK_FILE__MOUNTON 0x00010000UL
28736 +#define CHR_FILE__IOCTL 0x00000001UL
28737 +#define CHR_FILE__READ 0x00000002UL
28738 +#define CHR_FILE__WRITE 0x00000004UL
28739 +#define CHR_FILE__CREATE 0x00000008UL
28740 +#define CHR_FILE__GETATTR 0x00000010UL
28741 +#define CHR_FILE__SETATTR 0x00000020UL
28742 +#define CHR_FILE__LOCK 0x00000040UL
28743 +#define CHR_FILE__RELABELFROM 0x00000080UL
28744 +#define CHR_FILE__RELABELTO 0x00000100UL
28745 +#define CHR_FILE__APPEND 0x00000200UL
28746 +#define CHR_FILE__UNLINK 0x00000400UL
28747 +#define CHR_FILE__LINK 0x00000800UL
28748 +#define CHR_FILE__RENAME 0x00001000UL
28749 +#define CHR_FILE__EXECUTE 0x00002000UL
28750 +#define CHR_FILE__SWAPON 0x00004000UL
28751 +#define CHR_FILE__QUOTAON 0x00008000UL
28752 +#define CHR_FILE__MOUNTON 0x00010000UL
28753 +#define CHR_FILE__EXECUTE_NO_TRANS 0x00020000UL
28754 +#define CHR_FILE__ENTRYPOINT 0x00040000UL
28755 +#define CHR_FILE__EXECMOD 0x00080000UL
28756 +#define CHR_FILE__OPEN 0x00100000UL
28757 +#define BLK_FILE__IOCTL 0x00000001UL
28758 +#define BLK_FILE__READ 0x00000002UL
28759 +#define BLK_FILE__WRITE 0x00000004UL
28760 +#define BLK_FILE__CREATE 0x00000008UL
28761 +#define BLK_FILE__GETATTR 0x00000010UL
28762 +#define BLK_FILE__SETATTR 0x00000020UL
28763 +#define BLK_FILE__LOCK 0x00000040UL
28764 +#define BLK_FILE__RELABELFROM 0x00000080UL
28765 +#define BLK_FILE__RELABELTO 0x00000100UL
28766 +#define BLK_FILE__APPEND 0x00000200UL
28767 +#define BLK_FILE__UNLINK 0x00000400UL
28768 +#define BLK_FILE__LINK 0x00000800UL
28769 +#define BLK_FILE__RENAME 0x00001000UL
28770 +#define BLK_FILE__EXECUTE 0x00002000UL
28771 +#define BLK_FILE__SWAPON 0x00004000UL
28772 +#define BLK_FILE__QUOTAON 0x00008000UL
28773 +#define BLK_FILE__MOUNTON 0x00010000UL
28774 +#define BLK_FILE__OPEN 0x00020000UL
28775 +#define SOCK_FILE__IOCTL 0x00000001UL
28776 +#define SOCK_FILE__READ 0x00000002UL
28777 +#define SOCK_FILE__WRITE 0x00000004UL
28778 +#define SOCK_FILE__CREATE 0x00000008UL
28779 +#define SOCK_FILE__GETATTR 0x00000010UL
28780 +#define SOCK_FILE__SETATTR 0x00000020UL
28781 +#define SOCK_FILE__LOCK 0x00000040UL
28782 +#define SOCK_FILE__RELABELFROM 0x00000080UL
28783 +#define SOCK_FILE__RELABELTO 0x00000100UL
28784 +#define SOCK_FILE__APPEND 0x00000200UL
28785 +#define SOCK_FILE__UNLINK 0x00000400UL
28786 +#define SOCK_FILE__LINK 0x00000800UL
28787 +#define SOCK_FILE__RENAME 0x00001000UL
28788 +#define SOCK_FILE__EXECUTE 0x00002000UL
28789 +#define SOCK_FILE__SWAPON 0x00004000UL
28790 +#define SOCK_FILE__QUOTAON 0x00008000UL
28791 +#define SOCK_FILE__MOUNTON 0x00010000UL
28792 +#define SOCK_FILE__OPEN 0x00020000UL
28793 +#define FIFO_FILE__IOCTL 0x00000001UL
28794 +#define FIFO_FILE__READ 0x00000002UL
28795 +#define FIFO_FILE__WRITE 0x00000004UL
28796 +#define FIFO_FILE__CREATE 0x00000008UL
28797 +#define FIFO_FILE__GETATTR 0x00000010UL
28798 +#define FIFO_FILE__SETATTR 0x00000020UL
28799 +#define FIFO_FILE__LOCK 0x00000040UL
28800 +#define FIFO_FILE__RELABELFROM 0x00000080UL
28801 +#define FIFO_FILE__RELABELTO 0x00000100UL
28802 +#define FIFO_FILE__APPEND 0x00000200UL
28803 +#define FIFO_FILE__UNLINK 0x00000400UL
28804 +#define FIFO_FILE__LINK 0x00000800UL
28805 +#define FIFO_FILE__RENAME 0x00001000UL
28806 +#define FIFO_FILE__EXECUTE 0x00002000UL
28807 +#define FIFO_FILE__SWAPON 0x00004000UL
28808 +#define FIFO_FILE__QUOTAON 0x00008000UL
28809 +#define FIFO_FILE__MOUNTON 0x00010000UL
28810 +#define FIFO_FILE__OPEN 0x00020000UL
28811 +#define SOCKET__IOCTL 0x00000001UL
28812 +#define SOCKET__READ 0x00000002UL
28813 +#define SOCKET__WRITE 0x00000004UL
28814 +#define SOCKET__CREATE 0x00000008UL
28815 +#define SOCKET__GETATTR 0x00000010UL
28816 +#define SOCKET__SETATTR 0x00000020UL
28817 +#define SOCKET__LOCK 0x00000040UL
28818 +#define SOCKET__RELABELFROM 0x00000080UL
28819 +#define SOCKET__RELABELTO 0x00000100UL
28820 +#define SOCKET__APPEND 0x00000200UL
28821 +#define SOCKET__BIND 0x00000400UL
28822 +#define SOCKET__CONNECT 0x00000800UL
28823 +#define SOCKET__LISTEN 0x00001000UL
28824 +#define SOCKET__ACCEPT 0x00002000UL
28825 +#define SOCKET__GETOPT 0x00004000UL
28826 +#define SOCKET__SETOPT 0x00008000UL
28827 +#define SOCKET__SHUTDOWN 0x00010000UL
28828 +#define SOCKET__RECVFROM 0x00020000UL
28829 +#define SOCKET__SENDTO 0x00040000UL
28830 +#define SOCKET__RECV_MSG 0x00080000UL
28831 +#define SOCKET__SEND_MSG 0x00100000UL
28832 +#define SOCKET__NAME_BIND 0x00200000UL
28833 +#define TCP_SOCKET__IOCTL 0x00000001UL
28834 +#define TCP_SOCKET__READ 0x00000002UL
28835 +#define TCP_SOCKET__WRITE 0x00000004UL
28836 +#define TCP_SOCKET__CREATE 0x00000008UL
28837 +#define TCP_SOCKET__GETATTR 0x00000010UL
28838 +#define TCP_SOCKET__SETATTR 0x00000020UL
28839 +#define TCP_SOCKET__LOCK 0x00000040UL
28840 +#define TCP_SOCKET__RELABELFROM 0x00000080UL
28841 +#define TCP_SOCKET__RELABELTO 0x00000100UL
28842 +#define TCP_SOCKET__APPEND 0x00000200UL
28843 +#define TCP_SOCKET__BIND 0x00000400UL
28844 +#define TCP_SOCKET__CONNECT 0x00000800UL
28845 +#define TCP_SOCKET__LISTEN 0x00001000UL
28846 +#define TCP_SOCKET__ACCEPT 0x00002000UL
28847 +#define TCP_SOCKET__GETOPT 0x00004000UL
28848 +#define TCP_SOCKET__SETOPT 0x00008000UL
28849 +#define TCP_SOCKET__SHUTDOWN 0x00010000UL
28850 +#define TCP_SOCKET__RECVFROM 0x00020000UL
28851 +#define TCP_SOCKET__SENDTO 0x00040000UL
28852 +#define TCP_SOCKET__RECV_MSG 0x00080000UL
28853 +#define TCP_SOCKET__SEND_MSG 0x00100000UL
28854 +#define TCP_SOCKET__NAME_BIND 0x00200000UL
28855 +#define TCP_SOCKET__CONNECTTO 0x00400000UL
28856 +#define TCP_SOCKET__NEWCONN 0x00800000UL
28857 +#define TCP_SOCKET__ACCEPTFROM 0x01000000UL
28858 +#define TCP_SOCKET__NODE_BIND 0x02000000UL
28859 +#define TCP_SOCKET__NAME_CONNECT 0x04000000UL
28860 +#define UDP_SOCKET__IOCTL 0x00000001UL
28861 +#define UDP_SOCKET__READ 0x00000002UL
28862 +#define UDP_SOCKET__WRITE 0x00000004UL
28863 +#define UDP_SOCKET__CREATE 0x00000008UL
28864 +#define UDP_SOCKET__GETATTR 0x00000010UL
28865 +#define UDP_SOCKET__SETATTR 0x00000020UL
28866 +#define UDP_SOCKET__LOCK 0x00000040UL
28867 +#define UDP_SOCKET__RELABELFROM 0x00000080UL
28868 +#define UDP_SOCKET__RELABELTO 0x00000100UL
28869 +#define UDP_SOCKET__APPEND 0x00000200UL
28870 +#define UDP_SOCKET__BIND 0x00000400UL
28871 +#define UDP_SOCKET__CONNECT 0x00000800UL
28872 +#define UDP_SOCKET__LISTEN 0x00001000UL
28873 +#define UDP_SOCKET__ACCEPT 0x00002000UL
28874 +#define UDP_SOCKET__GETOPT 0x00004000UL
28875 +#define UDP_SOCKET__SETOPT 0x00008000UL
28876 +#define UDP_SOCKET__SHUTDOWN 0x00010000UL
28877 +#define UDP_SOCKET__RECVFROM 0x00020000UL
28878 +#define UDP_SOCKET__SENDTO 0x00040000UL
28879 +#define UDP_SOCKET__RECV_MSG 0x00080000UL
28880 +#define UDP_SOCKET__SEND_MSG 0x00100000UL
28881 +#define UDP_SOCKET__NAME_BIND 0x00200000UL
28882 +#define UDP_SOCKET__NODE_BIND 0x00400000UL
28883 +#define RAWIP_SOCKET__IOCTL 0x00000001UL
28884 +#define RAWIP_SOCKET__READ 0x00000002UL
28885 +#define RAWIP_SOCKET__WRITE 0x00000004UL
28886 +#define RAWIP_SOCKET__CREATE 0x00000008UL
28887 +#define RAWIP_SOCKET__GETATTR 0x00000010UL
28888 +#define RAWIP_SOCKET__SETATTR 0x00000020UL
28889 +#define RAWIP_SOCKET__LOCK 0x00000040UL
28890 +#define RAWIP_SOCKET__RELABELFROM 0x00000080UL
28891 +#define RAWIP_SOCKET__RELABELTO 0x00000100UL
28892 +#define RAWIP_SOCKET__APPEND 0x00000200UL
28893 +#define RAWIP_SOCKET__BIND 0x00000400UL
28894 +#define RAWIP_SOCKET__CONNECT 0x00000800UL
28895 +#define RAWIP_SOCKET__LISTEN 0x00001000UL
28896 +#define RAWIP_SOCKET__ACCEPT 0x00002000UL
28897 +#define RAWIP_SOCKET__GETOPT 0x00004000UL
28898 +#define RAWIP_SOCKET__SETOPT 0x00008000UL
28899 +#define RAWIP_SOCKET__SHUTDOWN 0x00010000UL
28900 +#define RAWIP_SOCKET__RECVFROM 0x00020000UL
28901 +#define RAWIP_SOCKET__SENDTO 0x00040000UL
28902 +#define RAWIP_SOCKET__RECV_MSG 0x00080000UL
28903 +#define RAWIP_SOCKET__SEND_MSG 0x00100000UL
28904 +#define RAWIP_SOCKET__NAME_BIND 0x00200000UL
28905 +#define RAWIP_SOCKET__NODE_BIND 0x00400000UL
28906 +#define NODE__TCP_RECV 0x00000001UL
28907 +#define NODE__TCP_SEND 0x00000002UL
28908 +#define NODE__UDP_RECV 0x00000004UL
28909 +#define NODE__UDP_SEND 0x00000008UL
28910 +#define NODE__RAWIP_RECV 0x00000010UL
28911 +#define NODE__RAWIP_SEND 0x00000020UL
28912 +#define NODE__ENFORCE_DEST 0x00000040UL
28913 +#define NODE__DCCP_RECV 0x00000080UL
28914 +#define NODE__DCCP_SEND 0x00000100UL
28915 +#define NODE__RECVFROM 0x00000200UL
28916 +#define NODE__SENDTO 0x00000400UL
28917 +#define NETIF__TCP_RECV 0x00000001UL
28918 +#define NETIF__TCP_SEND 0x00000002UL
28919 +#define NETIF__UDP_RECV 0x00000004UL
28920 +#define NETIF__UDP_SEND 0x00000008UL
28921 +#define NETIF__RAWIP_RECV 0x00000010UL
28922 +#define NETIF__RAWIP_SEND 0x00000020UL
28923 +#define NETIF__DCCP_RECV 0x00000040UL
28924 +#define NETIF__DCCP_SEND 0x00000080UL
28925 +#define NETIF__INGRESS 0x00000100UL
28926 +#define NETIF__EGRESS 0x00000200UL
28927 +#define NETLINK_SOCKET__IOCTL 0x00000001UL
28928 +#define NETLINK_SOCKET__READ 0x00000002UL
28929 +#define NETLINK_SOCKET__WRITE 0x00000004UL
28930 +#define NETLINK_SOCKET__CREATE 0x00000008UL
28931 +#define NETLINK_SOCKET__GETATTR 0x00000010UL
28932 +#define NETLINK_SOCKET__SETATTR 0x00000020UL
28933 +#define NETLINK_SOCKET__LOCK 0x00000040UL
28934 +#define NETLINK_SOCKET__RELABELFROM 0x00000080UL
28935 +#define NETLINK_SOCKET__RELABELTO 0x00000100UL
28936 +#define NETLINK_SOCKET__APPEND 0x00000200UL
28937 +#define NETLINK_SOCKET__BIND 0x00000400UL
28938 +#define NETLINK_SOCKET__CONNECT 0x00000800UL
28939 +#define NETLINK_SOCKET__LISTEN 0x00001000UL
28940 +#define NETLINK_SOCKET__ACCEPT 0x00002000UL
28941 +#define NETLINK_SOCKET__GETOPT 0x00004000UL
28942 +#define NETLINK_SOCKET__SETOPT 0x00008000UL
28943 +#define NETLINK_SOCKET__SHUTDOWN 0x00010000UL
28944 +#define NETLINK_SOCKET__RECVFROM 0x00020000UL
28945 +#define NETLINK_SOCKET__SENDTO 0x00040000UL
28946 +#define NETLINK_SOCKET__RECV_MSG 0x00080000UL
28947 +#define NETLINK_SOCKET__SEND_MSG 0x00100000UL
28948 +#define NETLINK_SOCKET__NAME_BIND 0x00200000UL
28949 +#define PACKET_SOCKET__IOCTL 0x00000001UL
28950 +#define PACKET_SOCKET__READ 0x00000002UL
28951 +#define PACKET_SOCKET__WRITE 0x00000004UL
28952 +#define PACKET_SOCKET__CREATE 0x00000008UL
28953 +#define PACKET_SOCKET__GETATTR 0x00000010UL
28954 +#define PACKET_SOCKET__SETATTR 0x00000020UL
28955 +#define PACKET_SOCKET__LOCK 0x00000040UL
28956 +#define PACKET_SOCKET__RELABELFROM 0x00000080UL
28957 +#define PACKET_SOCKET__RELABELTO 0x00000100UL
28958 +#define PACKET_SOCKET__APPEND 0x00000200UL
28959 +#define PACKET_SOCKET__BIND 0x00000400UL
28960 +#define PACKET_SOCKET__CONNECT 0x00000800UL
28961 +#define PACKET_SOCKET__LISTEN 0x00001000UL
28962 +#define PACKET_SOCKET__ACCEPT 0x00002000UL
28963 +#define PACKET_SOCKET__GETOPT 0x00004000UL
28964 +#define PACKET_SOCKET__SETOPT 0x00008000UL
28965 +#define PACKET_SOCKET__SHUTDOWN 0x00010000UL
28966 +#define PACKET_SOCKET__RECVFROM 0x00020000UL
28967 +#define PACKET_SOCKET__SENDTO 0x00040000UL
28968 +#define PACKET_SOCKET__RECV_MSG 0x00080000UL
28969 +#define PACKET_SOCKET__SEND_MSG 0x00100000UL
28970 +#define PACKET_SOCKET__NAME_BIND 0x00200000UL
28971 +#define KEY_SOCKET__IOCTL 0x00000001UL
28972 +#define KEY_SOCKET__READ 0x00000002UL
28973 +#define KEY_SOCKET__WRITE 0x00000004UL
28974 +#define KEY_SOCKET__CREATE 0x00000008UL
28975 +#define KEY_SOCKET__GETATTR 0x00000010UL
28976 +#define KEY_SOCKET__SETATTR 0x00000020UL
28977 +#define KEY_SOCKET__LOCK 0x00000040UL
28978 +#define KEY_SOCKET__RELABELFROM 0x00000080UL
28979 +#define KEY_SOCKET__RELABELTO 0x00000100UL
28980 +#define KEY_SOCKET__APPEND 0x00000200UL
28981 +#define KEY_SOCKET__BIND 0x00000400UL
28982 +#define KEY_SOCKET__CONNECT 0x00000800UL
28983 +#define KEY_SOCKET__LISTEN 0x00001000UL
28984 +#define KEY_SOCKET__ACCEPT 0x00002000UL
28985 +#define KEY_SOCKET__GETOPT 0x00004000UL
28986 +#define KEY_SOCKET__SETOPT 0x00008000UL
28987 +#define KEY_SOCKET__SHUTDOWN 0x00010000UL
28988 +#define KEY_SOCKET__RECVFROM 0x00020000UL
28989 +#define KEY_SOCKET__SENDTO 0x00040000UL
28990 +#define KEY_SOCKET__RECV_MSG 0x00080000UL
28991 +#define KEY_SOCKET__SEND_MSG 0x00100000UL
28992 +#define KEY_SOCKET__NAME_BIND 0x00200000UL
28993 +#define UNIX_STREAM_SOCKET__IOCTL 0x00000001UL
28994 +#define UNIX_STREAM_SOCKET__READ 0x00000002UL
28995 +#define UNIX_STREAM_SOCKET__WRITE 0x00000004UL
28996 +#define UNIX_STREAM_SOCKET__CREATE 0x00000008UL
28997 +#define UNIX_STREAM_SOCKET__GETATTR 0x00000010UL
28998 +#define UNIX_STREAM_SOCKET__SETATTR 0x00000020UL
28999 +#define UNIX_STREAM_SOCKET__LOCK 0x00000040UL
29000 +#define UNIX_STREAM_SOCKET__RELABELFROM 0x00000080UL
29001 +#define UNIX_STREAM_SOCKET__RELABELTO 0x00000100UL
29002 +#define UNIX_STREAM_SOCKET__APPEND 0x00000200UL
29003 +#define UNIX_STREAM_SOCKET__BIND 0x00000400UL
29004 +#define UNIX_STREAM_SOCKET__CONNECT 0x00000800UL
29005 +#define UNIX_STREAM_SOCKET__LISTEN 0x00001000UL
29006 +#define UNIX_STREAM_SOCKET__ACCEPT 0x00002000UL
29007 +#define UNIX_STREAM_SOCKET__GETOPT 0x00004000UL
29008 +#define UNIX_STREAM_SOCKET__SETOPT 0x00008000UL
29009 +#define UNIX_STREAM_SOCKET__SHUTDOWN 0x00010000UL
29010 +#define UNIX_STREAM_SOCKET__RECVFROM 0x00020000UL
29011 +#define UNIX_STREAM_SOCKET__SENDTO 0x00040000UL
29012 +#define UNIX_STREAM_SOCKET__RECV_MSG 0x00080000UL
29013 +#define UNIX_STREAM_SOCKET__SEND_MSG 0x00100000UL
29014 +#define UNIX_STREAM_SOCKET__NAME_BIND 0x00200000UL
29015 +#define UNIX_STREAM_SOCKET__CONNECTTO 0x00400000UL
29016 +#define UNIX_STREAM_SOCKET__NEWCONN 0x00800000UL
29017 +#define UNIX_STREAM_SOCKET__ACCEPTFROM 0x01000000UL
29018 +#define UNIX_DGRAM_SOCKET__IOCTL 0x00000001UL
29019 +#define UNIX_DGRAM_SOCKET__READ 0x00000002UL
29020 +#define UNIX_DGRAM_SOCKET__WRITE 0x00000004UL
29021 +#define UNIX_DGRAM_SOCKET__CREATE 0x00000008UL
29022 +#define UNIX_DGRAM_SOCKET__GETATTR 0x00000010UL
29023 +#define UNIX_DGRAM_SOCKET__SETATTR 0x00000020UL
29024 +#define UNIX_DGRAM_SOCKET__LOCK 0x00000040UL
29025 +#define UNIX_DGRAM_SOCKET__RELABELFROM 0x00000080UL
29026 +#define UNIX_DGRAM_SOCKET__RELABELTO 0x00000100UL
29027 +#define UNIX_DGRAM_SOCKET__APPEND 0x00000200UL
29028 +#define UNIX_DGRAM_SOCKET__BIND 0x00000400UL
29029 +#define UNIX_DGRAM_SOCKET__CONNECT 0x00000800UL
29030 +#define UNIX_DGRAM_SOCKET__LISTEN 0x00001000UL
29031 +#define UNIX_DGRAM_SOCKET__ACCEPT 0x00002000UL
29032 +#define UNIX_DGRAM_SOCKET__GETOPT 0x00004000UL
29033 +#define UNIX_DGRAM_SOCKET__SETOPT 0x00008000UL
29034 +#define UNIX_DGRAM_SOCKET__SHUTDOWN 0x00010000UL
29035 +#define UNIX_DGRAM_SOCKET__RECVFROM 0x00020000UL
29036 +#define UNIX_DGRAM_SOCKET__SENDTO 0x00040000UL
29037 +#define UNIX_DGRAM_SOCKET__RECV_MSG 0x00080000UL
29038 +#define UNIX_DGRAM_SOCKET__SEND_MSG 0x00100000UL
29039 +#define UNIX_DGRAM_SOCKET__NAME_BIND 0x00200000UL
29040 +#define SEM__CREATE 0x00000001UL
29041 +#define SEM__DESTROY 0x00000002UL
29042 +#define SEM__GETATTR 0x00000004UL
29043 +#define SEM__SETATTR 0x00000008UL
29044 +#define SEM__READ 0x00000010UL
29045 +#define SEM__WRITE 0x00000020UL
29046 +#define SEM__ASSOCIATE 0x00000040UL
29047 +#define SEM__UNIX_READ 0x00000080UL
29048 +#define SEM__UNIX_WRITE 0x00000100UL
29049 +#define MSG__SEND 0x00000001UL
29050 +#define MSG__RECEIVE 0x00000002UL
29051 +#define MSGQ__CREATE 0x00000001UL
29052 +#define MSGQ__DESTROY 0x00000002UL
29053 +#define MSGQ__GETATTR 0x00000004UL
29054 +#define MSGQ__SETATTR 0x00000008UL
29055 +#define MSGQ__READ 0x00000010UL
29056 +#define MSGQ__WRITE 0x00000020UL
29057 +#define MSGQ__ASSOCIATE 0x00000040UL
29058 +#define MSGQ__UNIX_READ 0x00000080UL
29059 +#define MSGQ__UNIX_WRITE 0x00000100UL
29060 +#define MSGQ__ENQUEUE 0x00000200UL
29061 +#define SHM__CREATE 0x00000001UL
29062 +#define SHM__DESTROY 0x00000002UL
29063 +#define SHM__GETATTR 0x00000004UL
29064 +#define SHM__SETATTR 0x00000008UL
29065 +#define SHM__READ 0x00000010UL
29066 +#define SHM__WRITE 0x00000020UL
29067 +#define SHM__ASSOCIATE 0x00000040UL
29068 +#define SHM__UNIX_READ 0x00000080UL
29069 +#define SHM__UNIX_WRITE 0x00000100UL
29070 +#define SHM__LOCK 0x00000200UL
29071 +#define IPC__CREATE 0x00000001UL
29072 +#define IPC__DESTROY 0x00000002UL
29073 +#define IPC__GETATTR 0x00000004UL
29074 +#define IPC__SETATTR 0x00000008UL
29075 +#define IPC__READ 0x00000010UL
29076 +#define IPC__WRITE 0x00000020UL
29077 +#define IPC__ASSOCIATE 0x00000040UL
29078 +#define IPC__UNIX_READ 0x00000080UL
29079 +#define IPC__UNIX_WRITE 0x00000100UL
29080 +#define NETLINK_ROUTE_SOCKET__IOCTL 0x00000001UL
29081 +#define NETLINK_ROUTE_SOCKET__READ 0x00000002UL
29082 +#define NETLINK_ROUTE_SOCKET__WRITE 0x00000004UL
29083 +#define NETLINK_ROUTE_SOCKET__CREATE 0x00000008UL
29084 +#define NETLINK_ROUTE_SOCKET__GETATTR 0x00000010UL
29085 +#define NETLINK_ROUTE_SOCKET__SETATTR 0x00000020UL
29086 +#define NETLINK_ROUTE_SOCKET__LOCK 0x00000040UL
29087 +#define NETLINK_ROUTE_SOCKET__RELABELFROM 0x00000080UL
29088 +#define NETLINK_ROUTE_SOCKET__RELABELTO 0x00000100UL
29089 +#define NETLINK_ROUTE_SOCKET__APPEND 0x00000200UL
29090 +#define NETLINK_ROUTE_SOCKET__BIND 0x00000400UL
29091 +#define NETLINK_ROUTE_SOCKET__CONNECT 0x00000800UL
29092 +#define NETLINK_ROUTE_SOCKET__LISTEN 0x00001000UL
29093 +#define NETLINK_ROUTE_SOCKET__ACCEPT 0x00002000UL
29094 +#define NETLINK_ROUTE_SOCKET__GETOPT 0x00004000UL
29095 +#define NETLINK_ROUTE_SOCKET__SETOPT 0x00008000UL
29096 +#define NETLINK_ROUTE_SOCKET__SHUTDOWN 0x00010000UL
29097 +#define NETLINK_ROUTE_SOCKET__RECVFROM 0x00020000UL
29098 +#define NETLINK_ROUTE_SOCKET__SENDTO 0x00040000UL
29099 +#define NETLINK_ROUTE_SOCKET__RECV_MSG 0x00080000UL
29100 +#define NETLINK_ROUTE_SOCKET__SEND_MSG 0x00100000UL
29101 +#define NETLINK_ROUTE_SOCKET__NAME_BIND 0x00200000UL
29102 +#define NETLINK_ROUTE_SOCKET__NLMSG_READ 0x00400000UL
29103 +#define NETLINK_ROUTE_SOCKET__NLMSG_WRITE 0x00800000UL
29104 +#define NETLINK_FIREWALL_SOCKET__IOCTL 0x00000001UL
29105 +#define NETLINK_FIREWALL_SOCKET__READ 0x00000002UL
29106 +#define NETLINK_FIREWALL_SOCKET__WRITE 0x00000004UL
29107 +#define NETLINK_FIREWALL_SOCKET__CREATE 0x00000008UL
29108 +#define NETLINK_FIREWALL_SOCKET__GETATTR 0x00000010UL
29109 +#define NETLINK_FIREWALL_SOCKET__SETATTR 0x00000020UL
29110 +#define NETLINK_FIREWALL_SOCKET__LOCK 0x00000040UL
29111 +#define NETLINK_FIREWALL_SOCKET__RELABELFROM 0x00000080UL
29112 +#define NETLINK_FIREWALL_SOCKET__RELABELTO 0x00000100UL
29113 +#define NETLINK_FIREWALL_SOCKET__APPEND 0x00000200UL
29114 +#define NETLINK_FIREWALL_SOCKET__BIND 0x00000400UL
29115 +#define NETLINK_FIREWALL_SOCKET__CONNECT 0x00000800UL
29116 +#define NETLINK_FIREWALL_SOCKET__LISTEN 0x00001000UL
29117 +#define NETLINK_FIREWALL_SOCKET__ACCEPT 0x00002000UL
29118 +#define NETLINK_FIREWALL_SOCKET__GETOPT 0x00004000UL
29119 +#define NETLINK_FIREWALL_SOCKET__SETOPT 0x00008000UL
29120 +#define NETLINK_FIREWALL_SOCKET__SHUTDOWN 0x00010000UL
29121 +#define NETLINK_FIREWALL_SOCKET__RECVFROM 0x00020000UL
29122 +#define NETLINK_FIREWALL_SOCKET__SENDTO 0x00040000UL
29123 +#define NETLINK_FIREWALL_SOCKET__RECV_MSG 0x00080000UL
29124 +#define NETLINK_FIREWALL_SOCKET__SEND_MSG 0x00100000UL
29125 +#define NETLINK_FIREWALL_SOCKET__NAME_BIND 0x00200000UL
29126 +#define NETLINK_FIREWALL_SOCKET__NLMSG_READ 0x00400000UL
29127 +#define NETLINK_FIREWALL_SOCKET__NLMSG_WRITE 0x00800000UL
29128 +#define NETLINK_TCPDIAG_SOCKET__IOCTL 0x00000001UL
29129 +#define NETLINK_TCPDIAG_SOCKET__READ 0x00000002UL
29130 +#define NETLINK_TCPDIAG_SOCKET__WRITE 0x00000004UL
29131 +#define NETLINK_TCPDIAG_SOCKET__CREATE 0x00000008UL
29132 +#define NETLINK_TCPDIAG_SOCKET__GETATTR 0x00000010UL
29133 +#define NETLINK_TCPDIAG_SOCKET__SETATTR 0x00000020UL
29134 +#define NETLINK_TCPDIAG_SOCKET__LOCK 0x00000040UL
29135 +#define NETLINK_TCPDIAG_SOCKET__RELABELFROM 0x00000080UL
29136 +#define NETLINK_TCPDIAG_SOCKET__RELABELTO 0x00000100UL
29137 +#define NETLINK_TCPDIAG_SOCKET__APPEND 0x00000200UL
29138 +#define NETLINK_TCPDIAG_SOCKET__BIND 0x00000400UL
29139 +#define NETLINK_TCPDIAG_SOCKET__CONNECT 0x00000800UL
29140 +#define NETLINK_TCPDIAG_SOCKET__LISTEN 0x00001000UL
29141 +#define NETLINK_TCPDIAG_SOCKET__ACCEPT 0x00002000UL
29142 +#define NETLINK_TCPDIAG_SOCKET__GETOPT 0x00004000UL
29143 +#define NETLINK_TCPDIAG_SOCKET__SETOPT 0x00008000UL
29144 +#define NETLINK_TCPDIAG_SOCKET__SHUTDOWN 0x00010000UL
29145 +#define NETLINK_TCPDIAG_SOCKET__RECVFROM 0x00020000UL
29146 +#define NETLINK_TCPDIAG_SOCKET__SENDTO 0x00040000UL
29147 +#define NETLINK_TCPDIAG_SOCKET__RECV_MSG 0x00080000UL
29148 +#define NETLINK_TCPDIAG_SOCKET__SEND_MSG 0x00100000UL
29149 +#define NETLINK_TCPDIAG_SOCKET__NAME_BIND 0x00200000UL
29150 +#define NETLINK_TCPDIAG_SOCKET__NLMSG_READ 0x00400000UL
29151 +#define NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE 0x00800000UL
29152 +#define NETLINK_NFLOG_SOCKET__IOCTL 0x00000001UL
29153 +#define NETLINK_NFLOG_SOCKET__READ 0x00000002UL
29154 +#define NETLINK_NFLOG_SOCKET__WRITE 0x00000004UL
29155 +#define NETLINK_NFLOG_SOCKET__CREATE 0x00000008UL
29156 +#define NETLINK_NFLOG_SOCKET__GETATTR 0x00000010UL
29157 +#define NETLINK_NFLOG_SOCKET__SETATTR 0x00000020UL
29158 +#define NETLINK_NFLOG_SOCKET__LOCK 0x00000040UL
29159 +#define NETLINK_NFLOG_SOCKET__RELABELFROM 0x00000080UL
29160 +#define NETLINK_NFLOG_SOCKET__RELABELTO 0x00000100UL
29161 +#define NETLINK_NFLOG_SOCKET__APPEND 0x00000200UL
29162 +#define NETLINK_NFLOG_SOCKET__BIND 0x00000400UL
29163 +#define NETLINK_NFLOG_SOCKET__CONNECT 0x00000800UL
29164 +#define NETLINK_NFLOG_SOCKET__LISTEN 0x00001000UL
29165 +#define NETLINK_NFLOG_SOCKET__ACCEPT 0x00002000UL
29166 +#define NETLINK_NFLOG_SOCKET__GETOPT 0x00004000UL
29167 +#define NETLINK_NFLOG_SOCKET__SETOPT 0x00008000UL
29168 +#define NETLINK_NFLOG_SOCKET__SHUTDOWN 0x00010000UL
29169 +#define NETLINK_NFLOG_SOCKET__RECVFROM 0x00020000UL
29170 +#define NETLINK_NFLOG_SOCKET__SENDTO 0x00040000UL
29171 +#define NETLINK_NFLOG_SOCKET__RECV_MSG 0x00080000UL
29172 +#define NETLINK_NFLOG_SOCKET__SEND_MSG 0x00100000UL
29173 +#define NETLINK_NFLOG_SOCKET__NAME_BIND 0x00200000UL
29174 +#define NETLINK_XFRM_SOCKET__IOCTL 0x00000001UL
29175 +#define NETLINK_XFRM_SOCKET__READ 0x00000002UL
29176 +#define NETLINK_XFRM_SOCKET__WRITE 0x00000004UL
29177 +#define NETLINK_XFRM_SOCKET__CREATE 0x00000008UL
29178 +#define NETLINK_XFRM_SOCKET__GETATTR 0x00000010UL
29179 +#define NETLINK_XFRM_SOCKET__SETATTR 0x00000020UL
29180 +#define NETLINK_XFRM_SOCKET__LOCK 0x00000040UL
29181 +#define NETLINK_XFRM_SOCKET__RELABELFROM 0x00000080UL
29182 +#define NETLINK_XFRM_SOCKET__RELABELTO 0x00000100UL
29183 +#define NETLINK_XFRM_SOCKET__APPEND 0x00000200UL
29184 +#define NETLINK_XFRM_SOCKET__BIND 0x00000400UL
29185 +#define NETLINK_XFRM_SOCKET__CONNECT 0x00000800UL
29186 +#define NETLINK_XFRM_SOCKET__LISTEN 0x00001000UL
29187 +#define NETLINK_XFRM_SOCKET__ACCEPT 0x00002000UL
29188 +#define NETLINK_XFRM_SOCKET__GETOPT 0x00004000UL
29189 +#define NETLINK_XFRM_SOCKET__SETOPT 0x00008000UL
29190 +#define NETLINK_XFRM_SOCKET__SHUTDOWN 0x00010000UL
29191 +#define NETLINK_XFRM_SOCKET__RECVFROM 0x00020000UL
29192 +#define NETLINK_XFRM_SOCKET__SENDTO 0x00040000UL
29193 +#define NETLINK_XFRM_SOCKET__RECV_MSG 0x00080000UL
29194 +#define NETLINK_XFRM_SOCKET__SEND_MSG 0x00100000UL
29195 +#define NETLINK_XFRM_SOCKET__NAME_BIND 0x00200000UL
29196 +#define NETLINK_XFRM_SOCKET__NLMSG_READ 0x00400000UL
29197 +#define NETLINK_XFRM_SOCKET__NLMSG_WRITE 0x00800000UL
29198 +#define NETLINK_SELINUX_SOCKET__IOCTL 0x00000001UL
29199 +#define NETLINK_SELINUX_SOCKET__READ 0x00000002UL
29200 +#define NETLINK_SELINUX_SOCKET__WRITE 0x00000004UL
29201 +#define NETLINK_SELINUX_SOCKET__CREATE 0x00000008UL
29202 +#define NETLINK_SELINUX_SOCKET__GETATTR 0x00000010UL
29203 +#define NETLINK_SELINUX_SOCKET__SETATTR 0x00000020UL
29204 +#define NETLINK_SELINUX_SOCKET__LOCK 0x00000040UL
29205 +#define NETLINK_SELINUX_SOCKET__RELABELFROM 0x00000080UL
29206 +#define NETLINK_SELINUX_SOCKET__RELABELTO 0x00000100UL
29207 +#define NETLINK_SELINUX_SOCKET__APPEND 0x00000200UL
29208 +#define NETLINK_SELINUX_SOCKET__BIND 0x00000400UL
29209 +#define NETLINK_SELINUX_SOCKET__CONNECT 0x00000800UL
29210 +#define NETLINK_SELINUX_SOCKET__LISTEN 0x00001000UL
29211 +#define NETLINK_SELINUX_SOCKET__ACCEPT 0x00002000UL
29212 +#define NETLINK_SELINUX_SOCKET__GETOPT 0x00004000UL
29213 +#define NETLINK_SELINUX_SOCKET__SETOPT 0x00008000UL
29214 +#define NETLINK_SELINUX_SOCKET__SHUTDOWN 0x00010000UL
29215 +#define NETLINK_SELINUX_SOCKET__RECVFROM 0x00020000UL
29216 +#define NETLINK_SELINUX_SOCKET__SENDTO 0x00040000UL
29217 +#define NETLINK_SELINUX_SOCKET__RECV_MSG 0x00080000UL
29218 +#define NETLINK_SELINUX_SOCKET__SEND_MSG 0x00100000UL
29219 +#define NETLINK_SELINUX_SOCKET__NAME_BIND 0x00200000UL
29220 +#define NETLINK_AUDIT_SOCKET__IOCTL 0x00000001UL
29221 +#define NETLINK_AUDIT_SOCKET__READ 0x00000002UL
29222 +#define NETLINK_AUDIT_SOCKET__WRITE 0x00000004UL
29223 +#define NETLINK_AUDIT_SOCKET__CREATE 0x00000008UL
29224 +#define NETLINK_AUDIT_SOCKET__GETATTR 0x00000010UL
29225 +#define NETLINK_AUDIT_SOCKET__SETATTR 0x00000020UL
29226 +#define NETLINK_AUDIT_SOCKET__LOCK 0x00000040UL
29227 +#define NETLINK_AUDIT_SOCKET__RELABELFROM 0x00000080UL
29228 +#define NETLINK_AUDIT_SOCKET__RELABELTO 0x00000100UL
29229 +#define NETLINK_AUDIT_SOCKET__APPEND 0x00000200UL
29230 +#define NETLINK_AUDIT_SOCKET__BIND 0x00000400UL
29231 +#define NETLINK_AUDIT_SOCKET__CONNECT 0x00000800UL
29232 +#define NETLINK_AUDIT_SOCKET__LISTEN 0x00001000UL
29233 +#define NETLINK_AUDIT_SOCKET__ACCEPT 0x00002000UL
29234 +#define NETLINK_AUDIT_SOCKET__GETOPT 0x00004000UL
29235 +#define NETLINK_AUDIT_SOCKET__SETOPT 0x00008000UL
29236 +#define NETLINK_AUDIT_SOCKET__SHUTDOWN 0x00010000UL
29237 +#define NETLINK_AUDIT_SOCKET__RECVFROM 0x00020000UL
29238 +#define NETLINK_AUDIT_SOCKET__SENDTO 0x00040000UL
29239 +#define NETLINK_AUDIT_SOCKET__RECV_MSG 0x00080000UL
29240 +#define NETLINK_AUDIT_SOCKET__SEND_MSG 0x00100000UL
29241 +#define NETLINK_AUDIT_SOCKET__NAME_BIND 0x00200000UL
29242 +#define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL
29243 +#define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL
29244 +#define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL
29245 +#define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL
29246 +#define NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT 0x04000000UL
29247 +#define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL
29248 +#define NETLINK_IP6FW_SOCKET__READ 0x00000002UL
29249 +#define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL
29250 +#define NETLINK_IP6FW_SOCKET__CREATE 0x00000008UL
29251 +#define NETLINK_IP6FW_SOCKET__GETATTR 0x00000010UL
29252 +#define NETLINK_IP6FW_SOCKET__SETATTR 0x00000020UL
29253 +#define NETLINK_IP6FW_SOCKET__LOCK 0x00000040UL
29254 +#define NETLINK_IP6FW_SOCKET__RELABELFROM 0x00000080UL
29255 +#define NETLINK_IP6FW_SOCKET__RELABELTO 0x00000100UL
29256 +#define NETLINK_IP6FW_SOCKET__APPEND 0x00000200UL
29257 +#define NETLINK_IP6FW_SOCKET__BIND 0x00000400UL
29258 +#define NETLINK_IP6FW_SOCKET__CONNECT 0x00000800UL
29259 +#define NETLINK_IP6FW_SOCKET__LISTEN 0x00001000UL
29260 +#define NETLINK_IP6FW_SOCKET__ACCEPT 0x00002000UL
29261 +#define NETLINK_IP6FW_SOCKET__GETOPT 0x00004000UL
29262 +#define NETLINK_IP6FW_SOCKET__SETOPT 0x00008000UL
29263 +#define NETLINK_IP6FW_SOCKET__SHUTDOWN 0x00010000UL
29264 +#define NETLINK_IP6FW_SOCKET__RECVFROM 0x00020000UL
29265 +#define NETLINK_IP6FW_SOCKET__SENDTO 0x00040000UL
29266 +#define NETLINK_IP6FW_SOCKET__RECV_MSG 0x00080000UL
29267 +#define NETLINK_IP6FW_SOCKET__SEND_MSG 0x00100000UL
29268 +#define NETLINK_IP6FW_SOCKET__NAME_BIND 0x00200000UL
29269 +#define NETLINK_IP6FW_SOCKET__NLMSG_READ 0x00400000UL
29270 +#define NETLINK_IP6FW_SOCKET__NLMSG_WRITE 0x00800000UL
29271 +#define NETLINK_DNRT_SOCKET__IOCTL 0x00000001UL
29272 +#define NETLINK_DNRT_SOCKET__READ 0x00000002UL
29273 +#define NETLINK_DNRT_SOCKET__WRITE 0x00000004UL
29274 +#define NETLINK_DNRT_SOCKET__CREATE 0x00000008UL
29275 +#define NETLINK_DNRT_SOCKET__GETATTR 0x00000010UL
29276 +#define NETLINK_DNRT_SOCKET__SETATTR 0x00000020UL
29277 +#define NETLINK_DNRT_SOCKET__LOCK 0x00000040UL
29278 +#define NETLINK_DNRT_SOCKET__RELABELFROM 0x00000080UL
29279 +#define NETLINK_DNRT_SOCKET__RELABELTO 0x00000100UL
29280 +#define NETLINK_DNRT_SOCKET__APPEND 0x00000200UL
29281 +#define NETLINK_DNRT_SOCKET__BIND 0x00000400UL
29282 +#define NETLINK_DNRT_SOCKET__CONNECT 0x00000800UL
29283 +#define NETLINK_DNRT_SOCKET__LISTEN 0x00001000UL
29284 +#define NETLINK_DNRT_SOCKET__ACCEPT 0x00002000UL
29285 +#define NETLINK_DNRT_SOCKET__GETOPT 0x00004000UL
29286 +#define NETLINK_DNRT_SOCKET__SETOPT 0x00008000UL
29287 +#define NETLINK_DNRT_SOCKET__SHUTDOWN 0x00010000UL
29288 +#define NETLINK_DNRT_SOCKET__RECVFROM 0x00020000UL
29289 +#define NETLINK_DNRT_SOCKET__SENDTO 0x00040000UL
29290 +#define NETLINK_DNRT_SOCKET__RECV_MSG 0x00080000UL
29291 +#define NETLINK_DNRT_SOCKET__SEND_MSG 0x00100000UL
29292 +#define NETLINK_DNRT_SOCKET__NAME_BIND 0x00200000UL
29293 +#define ASSOCIATION__SENDTO 0x00000001UL
29294 +#define ASSOCIATION__RECVFROM 0x00000002UL
29295 +#define ASSOCIATION__SETCONTEXT 0x00000004UL
29296 +#define ASSOCIATION__POLMATCH 0x00000008UL
29297 +#define NETLINK_KOBJECT_UEVENT_SOCKET__IOCTL 0x00000001UL
29298 +#define NETLINK_KOBJECT_UEVENT_SOCKET__READ 0x00000002UL
29299 +#define NETLINK_KOBJECT_UEVENT_SOCKET__WRITE 0x00000004UL
29300 +#define NETLINK_KOBJECT_UEVENT_SOCKET__CREATE 0x00000008UL
29301 +#define NETLINK_KOBJECT_UEVENT_SOCKET__GETATTR 0x00000010UL
29302 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SETATTR 0x00000020UL
29303 +#define NETLINK_KOBJECT_UEVENT_SOCKET__LOCK 0x00000040UL
29304 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELFROM 0x00000080UL
29305 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELTO 0x00000100UL
29306 +#define NETLINK_KOBJECT_UEVENT_SOCKET__APPEND 0x00000200UL
29307 +#define NETLINK_KOBJECT_UEVENT_SOCKET__BIND 0x00000400UL
29308 +#define NETLINK_KOBJECT_UEVENT_SOCKET__CONNECT 0x00000800UL
29309 +#define NETLINK_KOBJECT_UEVENT_SOCKET__LISTEN 0x00001000UL
29310 +#define NETLINK_KOBJECT_UEVENT_SOCKET__ACCEPT 0x00002000UL
29311 +#define NETLINK_KOBJECT_UEVENT_SOCKET__GETOPT 0x00004000UL
29312 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SETOPT 0x00008000UL
29313 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SHUTDOWN 0x00010000UL
29314 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RECVFROM 0x00020000UL
29315 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SENDTO 0x00040000UL
29316 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RECV_MSG 0x00080000UL
29317 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SEND_MSG 0x00100000UL
29318 +#define NETLINK_KOBJECT_UEVENT_SOCKET__NAME_BIND 0x00200000UL
29319 +#define APPLETALK_SOCKET__IOCTL 0x00000001UL
29320 +#define APPLETALK_SOCKET__READ 0x00000002UL
29321 +#define APPLETALK_SOCKET__WRITE 0x00000004UL
29322 +#define APPLETALK_SOCKET__CREATE 0x00000008UL
29323 +#define APPLETALK_SOCKET__GETATTR 0x00000010UL
29324 +#define APPLETALK_SOCKET__SETATTR 0x00000020UL
29325 +#define APPLETALK_SOCKET__LOCK 0x00000040UL
29326 +#define APPLETALK_SOCKET__RELABELFROM 0x00000080UL
29327 +#define APPLETALK_SOCKET__RELABELTO 0x00000100UL
29328 +#define APPLETALK_SOCKET__APPEND 0x00000200UL
29329 +#define APPLETALK_SOCKET__BIND 0x00000400UL
29330 +#define APPLETALK_SOCKET__CONNECT 0x00000800UL
29331 +#define APPLETALK_SOCKET__LISTEN 0x00001000UL
29332 +#define APPLETALK_SOCKET__ACCEPT 0x00002000UL
29333 +#define APPLETALK_SOCKET__GETOPT 0x00004000UL
29334 +#define APPLETALK_SOCKET__SETOPT 0x00008000UL
29335 +#define APPLETALK_SOCKET__SHUTDOWN 0x00010000UL
29336 +#define APPLETALK_SOCKET__RECVFROM 0x00020000UL
29337 +#define APPLETALK_SOCKET__SENDTO 0x00040000UL
29338 +#define APPLETALK_SOCKET__RECV_MSG 0x00080000UL
29339 +#define APPLETALK_SOCKET__SEND_MSG 0x00100000UL
29340 +#define APPLETALK_SOCKET__NAME_BIND 0x00200000UL
29341 +#define PACKET__SEND 0x00000001UL
29342 +#define PACKET__RECV 0x00000002UL
29343 +#define PACKET__RELABELTO 0x00000004UL
29344 +#define PACKET__FLOW_IN 0x00000008UL
29345 +#define PACKET__FLOW_OUT 0x00000010UL
29346 +#define PACKET__FORWARD_IN 0x00000020UL
29347 +#define PACKET__FORWARD_OUT 0x00000040UL
29348 +#define KEY__VIEW 0x00000001UL
29349 +#define KEY__READ 0x00000002UL
29350 +#define KEY__WRITE 0x00000004UL
29351 +#define KEY__SEARCH 0x00000008UL
29352 +#define KEY__LINK 0x00000010UL
29353 +#define KEY__SETATTR 0x00000020UL
29354 +#define KEY__CREATE 0x00000040UL
29355 +#define DCCP_SOCKET__IOCTL 0x00000001UL
29356 +#define DCCP_SOCKET__READ 0x00000002UL
29357 +#define DCCP_SOCKET__WRITE 0x00000004UL
29358 +#define DCCP_SOCKET__CREATE 0x00000008UL
29359 +#define DCCP_SOCKET__GETATTR 0x00000010UL
29360 +#define DCCP_SOCKET__SETATTR 0x00000020UL
29361 +#define DCCP_SOCKET__LOCK 0x00000040UL
29362 +#define DCCP_SOCKET__RELABELFROM 0x00000080UL
29363 +#define DCCP_SOCKET__RELABELTO 0x00000100UL
29364 +#define DCCP_SOCKET__APPEND 0x00000200UL
29365 +#define DCCP_SOCKET__BIND 0x00000400UL
29366 +#define DCCP_SOCKET__CONNECT 0x00000800UL
29367 +#define DCCP_SOCKET__LISTEN 0x00001000UL
29368 +#define DCCP_SOCKET__ACCEPT 0x00002000UL
29369 +#define DCCP_SOCKET__GETOPT 0x00004000UL
29370 +#define DCCP_SOCKET__SETOPT 0x00008000UL
29371 +#define DCCP_SOCKET__SHUTDOWN 0x00010000UL
29372 +#define DCCP_SOCKET__RECVFROM 0x00020000UL
29373 +#define DCCP_SOCKET__SENDTO 0x00040000UL
29374 +#define DCCP_SOCKET__RECV_MSG 0x00080000UL
29375 +#define DCCP_SOCKET__SEND_MSG 0x00100000UL
29376 +#define DCCP_SOCKET__NAME_BIND 0x00200000UL
29377 +#define DCCP_SOCKET__NODE_BIND 0x00400000UL
29378 +#define DCCP_SOCKET__NAME_CONNECT 0x00800000UL
29379 +#define MEMPROTECT__MMAP_ZERO 0x00000001UL
29380 +#define PEER__RECV 0x00000001UL
29381 +#define CAPABILITY2__MAC_OVERRIDE 0x00000001UL
29382 +#define CAPABILITY2__MAC_ADMIN 0x00000002UL
29383 +#define KERNEL_SERVICE__USE_AS_OVERRIDE 0x00000001UL
29384 +#define KERNEL_SERVICE__CREATE_FILES_AS 0x00000002UL
29385 +#define TUN_SOCKET__IOCTL 0x00000001UL
29386 +#define TUN_SOCKET__READ 0x00000002UL
29387 +#define TUN_SOCKET__WRITE 0x00000004UL
29388 +#define TUN_SOCKET__CREATE 0x00000008UL
29389 +#define TUN_SOCKET__GETATTR 0x00000010UL
29390 +#define TUN_SOCKET__SETATTR 0x00000020UL
29391 +#define TUN_SOCKET__LOCK 0x00000040UL
29392 +#define TUN_SOCKET__RELABELFROM 0x00000080UL
29393 +#define TUN_SOCKET__RELABELTO 0x00000100UL
29394 +#define TUN_SOCKET__APPEND 0x00000200UL
29395 +#define TUN_SOCKET__BIND 0x00000400UL
29396 +#define TUN_SOCKET__CONNECT 0x00000800UL
29397 +#define TUN_SOCKET__LISTEN 0x00001000UL
29398 +#define TUN_SOCKET__ACCEPT 0x00002000UL
29399 +#define TUN_SOCKET__GETOPT 0x00004000UL
29400 +#define TUN_SOCKET__SETOPT 0x00008000UL
29401 +#define TUN_SOCKET__SHUTDOWN 0x00010000UL
29402 +#define TUN_SOCKET__RECVFROM 0x00020000UL
29403 +#define TUN_SOCKET__SENDTO 0x00040000UL
29404 +#define TUN_SOCKET__RECV_MSG 0x00080000UL
29405 +#define TUN_SOCKET__SEND_MSG 0x00100000UL
29406 +#define TUN_SOCKET__NAME_BIND 0x00200000UL
29409 diff -NurpP --minimal linux-2.6.34/security/selinux/hooks.c linux-2.6.34-vs2.3.0.36.30.4.pre6/security/selinux/hooks.c
29410 --- linux-2.6.34/security/selinux/hooks.c 2010-05-18 15:07:53.000000000 +0200
29411 +++ linux-2.6.34-vs2.3.0.36.30.4.pre6/security/selinux/hooks.c 2010-05-18 18:11:22.000000000 +0200
29413 #include <linux/dccp.h>
29414 #include <linux/quota.h>
29415 #include <linux/un.h> /* for Unix socket types */
29416 -#include <net/af_unix.h> /* for Unix socket types */
29417 #include <linux/parser.h>
29418 #include <linux/nfs_mount.h>
29419 #include <net/ipv6.h>