1 diff -NurpP --minimal linux-2.6.33.2/arch/alpha/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/Kconfig
2 --- linux-2.6.33.2/arch/alpha/Kconfig 2010-02-25 11:51:18.000000000 +0100
3 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/Kconfig 2010-02-25 12:02:16.000000000 +0100
4 @@ -675,6 +675,8 @@ config DUMMY_CONSOLE
8 +source "kernel/vserver/Kconfig"
10 source "security/Kconfig"
12 source "crypto/Kconfig"
13 diff -NurpP --minimal linux-2.6.33.2/arch/alpha/kernel/entry.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/entry.S
14 --- linux-2.6.33.2/arch/alpha/kernel/entry.S 2009-06-11 17:11:46.000000000 +0200
15 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/entry.S 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/alpha/kernel/osf_sys.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/osf_sys.c
49 --- linux-2.6.33.2/arch/alpha/kernel/osf_sys.c 2010-02-25 11:51:19.000000000 +0100
50 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/osf_sys.c 2010-02-25 12:02:16.000000000 +0100
51 @@ -865,7 +865,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.33.2/arch/alpha/kernel/ptrace.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/ptrace.c
61 --- linux-2.6.33.2/arch/alpha/kernel/ptrace.c 2009-09-10 15:25:14.000000000 +0200
62 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/ptrace.c 2010-02-25 12:02:16.000000000 +0100
64 #include <linux/slab.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.33.2/arch/alpha/kernel/systbls.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/systbls.S
72 --- linux-2.6.33.2/arch/alpha/kernel/systbls.S 2010-02-25 11:51:19.000000000 +0100
73 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/systbls.S 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/alpha/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/traps.c
84 --- linux-2.6.33.2/arch/alpha/kernel/traps.c 2009-06-11 17:11:46.000000000 +0200
85 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
86 @@ -183,7 +183,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.33.2/arch/alpha/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/mm/fault.c
97 --- linux-2.6.33.2/arch/alpha/mm/fault.c 2009-09-10 15:25:14.000000000 +0200
98 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/alpha/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/arm/include/asm/tlb.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/include/asm/tlb.h
111 --- linux-2.6.33.2/arch/arm/include/asm/tlb.h 2009-09-10 15:25:15.000000000 +0200
112 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/include/asm/tlb.h 2010-02-25 12:02:16.000000000 +0100
115 #else /* !CONFIG_MMU */
117 +#include <linux/vs_memory.h>
118 #include <asm/pgalloc.h>
121 diff -NurpP --minimal linux-2.6.33.2/arch/arm/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/Kconfig
122 --- linux-2.6.33.2/arch/arm/Kconfig 2010-02-25 11:51:19.000000000 +0100
123 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/Kconfig 2010-02-25 12:02:16.000000000 +0100
124 @@ -1542,6 +1542,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.33.2/arch/arm/kernel/calls.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/kernel/calls.S
134 --- linux-2.6.33.2/arch/arm/kernel/calls.S 2010-02-25 11:51:20.000000000 +0100
135 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/kernel/calls.S 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/arm/kernel/process.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/kernel/process.c
146 --- linux-2.6.33.2/arch/arm/kernel/process.c 2010-02-25 11:51:20.000000000 +0100
147 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/kernel/process.c 2010-02-25 12:02:16.000000000 +0100
148 @@ -270,7 +270,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.33.2/arch/arm/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/kernel/traps.c
159 --- linux-2.6.33.2/arch/arm/kernel/traps.c 2009-12-03 20:01:50.000000000 +0100
160 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/arm/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
161 @@ -234,8 +234,8 @@ static void __die(const char *str, int e
162 sysfs_printk_last_file();
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.33.2/arch/avr32/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/avr32/mm/fault.c
173 --- linux-2.6.33.2/arch/avr32/mm/fault.c 2009-09-10 15:25:20.000000000 +0200
174 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/avr32/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/cris/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/cris/Kconfig
186 --- linux-2.6.33.2/arch/cris/Kconfig 2009-06-11 17:11:56.000000000 +0200
187 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/cris/Kconfig 2010-02-25 12:02:16.000000000 +0100
188 @@ -685,6 +685,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.33.2/arch/cris/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/cris/mm/fault.c
198 --- linux-2.6.33.2/arch/cris/mm/fault.c 2010-02-25 11:51:26.000000000 +0100
199 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/cris/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/frv/kernel/kernel_thread.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/frv/kernel/kernel_thread.S
211 --- linux-2.6.33.2/arch/frv/kernel/kernel_thread.S 2008-12-25 00:26:37.000000000 +0100
212 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/frv/kernel/kernel_thread.S 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/frv/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/frv/mm/fault.c
223 --- linux-2.6.33.2/arch/frv/mm/fault.c 2009-09-10 15:25:22.000000000 +0200
224 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/frv/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/h8300/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/h8300/Kconfig
236 --- linux-2.6.33.2/arch/h8300/Kconfig 2010-02-25 11:51:26.000000000 +0100
237 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/h8300/Kconfig 2010-02-25 12:02:16.000000000 +0100
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.33.2/arch/ia64/ia32/ia32_entry.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/ia32/ia32_entry.S
248 --- linux-2.6.33.2/arch/ia64/ia32/ia32_entry.S 2010-02-25 11:51:26.000000000 +0100
249 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/ia32/ia32_entry.S 2010-02-25 12:02:16.000000000 +0100
250 @@ -451,7 +451,7 @@ ia32_syscall_table:
251 data8 sys_tgkill /* 270 */
252 data8 compat_sys_utimes
253 data8 sys32_fadvise64_64
254 - data8 sys_ni_syscall
255 + data8 sys32_vserver
257 data8 sys_ni_syscall /* 275 */
259 diff -NurpP --minimal linux-2.6.33.2/arch/ia64/include/asm/tlb.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/include/asm/tlb.h
260 --- linux-2.6.33.2/arch/ia64/include/asm/tlb.h 2010-02-25 11:51:26.000000000 +0100
261 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/include/asm/tlb.h 2010-02-25 12:02:16.000000000 +0100
263 #include <linux/mm.h>
264 #include <linux/pagemap.h>
265 #include <linux/swap.h>
266 +#include <linux/vs_memory.h>
268 #include <asm/pgalloc.h>
269 #include <asm/processor.h>
270 diff -NurpP --minimal linux-2.6.33.2/arch/ia64/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/Kconfig
271 --- linux-2.6.33.2/arch/ia64/Kconfig 2010-02-25 11:51:26.000000000 +0100
272 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/Kconfig 2010-02-25 12:02:16.000000000 +0100
273 @@ -682,6 +682,8 @@ source "fs/Kconfig"
275 source "arch/ia64/Kconfig.debug"
277 +source "kernel/vserver/Kconfig"
279 source "security/Kconfig"
281 source "crypto/Kconfig"
282 diff -NurpP --minimal linux-2.6.33.2/arch/ia64/kernel/entry.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/entry.S
283 --- linux-2.6.33.2/arch/ia64/kernel/entry.S 2010-02-25 11:51:26.000000000 +0100
284 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/entry.S 2010-02-25 12:02:16.000000000 +0100
285 @@ -1753,7 +1753,7 @@ sys_call_table:
287 data8 sys_mq_getsetattr
289 - data8 sys_ni_syscall // reserved for vserver
291 data8 sys_waitid // 1270
293 data8 sys_request_key
294 diff -NurpP --minimal linux-2.6.33.2/arch/ia64/kernel/perfmon.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/perfmon.c
295 --- linux-2.6.33.2/arch/ia64/kernel/perfmon.c 2010-02-25 11:51:26.000000000 +0100
296 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/perfmon.c 2010-02-25 12:02:16.000000000 +0100
298 #include <linux/rcupdate.h>
299 #include <linux/completion.h>
300 #include <linux/tracehook.h>
301 +#include <linux/vs_memory.h>
303 #include <asm/errno.h>
304 #include <asm/intrinsics.h>
305 @@ -2367,7 +2368,7 @@ pfm_smpl_buffer_alloc(struct task_struct
307 insert_vm_struct(mm, vma);
309 - mm->total_vm += size >> PAGE_SHIFT;
310 + vx_vmpages_add(mm, size >> PAGE_SHIFT);
311 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
313 up_write(&task->mm->mmap_sem);
314 diff -NurpP --minimal linux-2.6.33.2/arch/ia64/kernel/process.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/process.c
315 --- linux-2.6.33.2/arch/ia64/kernel/process.c 2009-12-03 20:01:56.000000000 +0100
316 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/process.c 2010-02-25 12:02:16.000000000 +0100
317 @@ -110,8 +110,8 @@ show_regs (struct pt_regs *regs)
318 unsigned long ip = regs->cr_iip + ia64_psr(regs)->ri;
321 - printk("\nPid: %d, CPU %d, comm: %20s\n", task_pid_nr(current),
322 - smp_processor_id(), current->comm);
323 + printk("\nPid: %d[#%u], CPU %d, comm: %20s\n", task_pid_nr(current),
324 + current->xid, smp_processor_id(), current->comm);
325 printk("psr : %016lx ifs : %016lx ip : [<%016lx>] %s (%s)\n",
326 regs->cr_ipsr, regs->cr_ifs, ip, print_tainted(),
327 init_utsname()->release);
328 diff -NurpP --minimal linux-2.6.33.2/arch/ia64/kernel/ptrace.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/ptrace.c
329 --- linux-2.6.33.2/arch/ia64/kernel/ptrace.c 2009-09-10 15:25:22.000000000 +0200
330 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/ptrace.c 2010-02-25 12:02:16.000000000 +0100
332 #include <linux/regset.h>
333 #include <linux/elf.h>
334 #include <linux/tracehook.h>
335 +#include <linux/vs_base.h>
337 #include <asm/pgtable.h>
338 #include <asm/processor.h>
339 diff -NurpP --minimal linux-2.6.33.2/arch/ia64/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/traps.c
340 --- linux-2.6.33.2/arch/ia64/kernel/traps.c 2008-12-25 00:26:37.000000000 +0100
341 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
342 @@ -60,8 +60,9 @@ die (const char *str, struct pt_regs *re
345 if (++die.lock_owner_depth < 3) {
346 - printk("%s[%d]: %s %ld [%d]\n",
347 - current->comm, task_pid_nr(current), str, err, ++die_counter);
348 + printk("%s[%d[#%u]]: %s %ld [%d]\n",
349 + current->comm, task_pid_nr(current), current->xid,
350 + str, err, ++die_counter);
351 if (notify_die(DIE_OOPS, str, regs, err, 255, SIGSEGV)
354 @@ -324,8 +325,9 @@ handle_fpu_swa (int fp_fault, struct pt_
355 if ((last.count & 15) < 5 && (ia64_fetchadd(1, &last.count, acq) & 15) < 5) {
356 last.time = current_jiffies + 5 * HZ;
358 - "%s(%d): floating-point assist fault at ip %016lx, isr %016lx\n",
359 - current->comm, task_pid_nr(current), regs->cr_iip + ia64_psr(regs)->ri, isr);
360 + "%s(%d[#%u]): floating-point assist fault at ip %016lx, isr %016lx\n",
361 + current->comm, task_pid_nr(current), current->xid,
362 + regs->cr_iip + ia64_psr(regs)->ri, isr);
366 diff -NurpP --minimal linux-2.6.33.2/arch/ia64/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/mm/fault.c
367 --- linux-2.6.33.2/arch/ia64/mm/fault.c 2009-09-10 15:25:23.000000000 +0200
368 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/ia64/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
370 #include <linux/interrupt.h>
371 #include <linux/kprobes.h>
372 #include <linux/kdebug.h>
373 +#include <linux/vs_memory.h>
375 #include <asm/pgtable.h>
376 #include <asm/processor.h>
377 @@ -281,7 +282,8 @@ ia64_do_page_fault (unsigned long addres
378 down_read(&mm->mmap_sem);
381 - printk(KERN_CRIT "VM: killing process %s\n", current->comm);
382 + printk(KERN_CRIT "VM: killing process %s(%d:#%u)\n",
383 + current->comm, task_pid_nr(current), current->xid);
385 do_group_exit(SIGKILL);
387 diff -NurpP --minimal linux-2.6.33.2/arch/m32r/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/m32r/kernel/traps.c
388 --- linux-2.6.33.2/arch/m32r/kernel/traps.c 2009-12-03 20:01:57.000000000 +0100
389 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/m32r/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
390 @@ -196,8 +196,9 @@ static void show_registers(struct pt_reg
392 printk("SPI: %08lx\n", sp);
394 - printk("Process %s (pid: %d, process nr: %d, stackpage=%08lx)",
395 - current->comm, task_pid_nr(current), 0xffff & i, 4096+(unsigned long)current);
396 + printk("Process %s (pid: %d[#%u], process nr: %d, stackpage=%08lx)",
397 + current->comm, task_pid_nr(current), current->xid,
398 + 0xffff & i, 4096+(unsigned long)current);
401 * When in-kernel, we also print out the stack and code at the
402 diff -NurpP --minimal linux-2.6.33.2/arch/m32r/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/m32r/mm/fault.c
403 --- linux-2.6.33.2/arch/m32r/mm/fault.c 2009-09-10 15:25:23.000000000 +0200
404 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/m32r/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
405 @@ -276,7 +276,8 @@ out_of_memory:
406 down_read(&mm->mmap_sem);
409 - printk("VM: killing process %s\n", tsk->comm);
410 + printk("VM: killing process %s(%d:#%u)\n",
411 + tsk->comm, task_pid_nr(tsk), tsk->xid);
412 if (error_code & ACE_USERMODE)
413 do_group_exit(SIGKILL);
415 diff -NurpP --minimal linux-2.6.33.2/arch/m68k/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68k/Kconfig
416 --- linux-2.6.33.2/arch/m68k/Kconfig 2009-12-03 20:01:57.000000000 +0100
417 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68k/Kconfig 2010-02-25 12:02:16.000000000 +0100
418 @@ -622,6 +622,8 @@ source "fs/Kconfig"
420 source "arch/m68k/Kconfig.debug"
422 +source "kernel/vserver/Kconfig"
424 source "security/Kconfig"
426 source "crypto/Kconfig"
427 diff -NurpP --minimal linux-2.6.33.2/arch/m68k/kernel/ptrace.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68k/kernel/ptrace.c
428 --- linux-2.6.33.2/arch/m68k/kernel/ptrace.c 2010-02-25 11:51:27.000000000 +0100
429 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68k/kernel/ptrace.c 2010-02-25 12:02:16.000000000 +0100
431 #include <linux/ptrace.h>
432 #include <linux/user.h>
433 #include <linux/signal.h>
434 +#include <linux/vs_base.h>
436 #include <asm/uaccess.h>
437 #include <asm/page.h>
438 @@ -249,6 +250,8 @@ long arch_ptrace(struct task_struct *chi
439 ret = ptrace_request(child, request, addr, data);
442 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
447 diff -NurpP --minimal linux-2.6.33.2/arch/m68k/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68k/kernel/traps.c
448 --- linux-2.6.33.2/arch/m68k/kernel/traps.c 2009-09-10 15:25:23.000000000 +0200
449 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68k/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
450 @@ -906,8 +906,8 @@ void show_registers(struct pt_regs *regs
451 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
452 regs->d4, regs->d5, regs->a0, regs->a1);
454 - printk("Process %s (pid: %d, task=%p)\n",
455 - current->comm, task_pid_nr(current), current);
456 + printk("Process %s (pid: %d[#%u], task=%p)\n",
457 + current->comm, task_pid_nr(current), current->xid, current);
458 addr = (unsigned long)&fp->un;
459 printk("Frame format=%X ", regs->format);
460 switch (regs->format) {
461 diff -NurpP --minimal linux-2.6.33.2/arch/m68k/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68k/mm/fault.c
462 --- linux-2.6.33.2/arch/m68k/mm/fault.c 2009-09-10 15:25:23.000000000 +0200
463 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68k/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
464 @@ -186,7 +186,8 @@ out_of_memory:
468 - printk("VM: killing process %s\n", current->comm);
469 + printk("VM: killing process %s(%d:#%u)\n",
470 + current->comm, task_pid_nr(current), current->xid);
472 do_group_exit(SIGKILL);
474 diff -NurpP --minimal linux-2.6.33.2/arch/m68knommu/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68knommu/Kconfig
475 --- linux-2.6.33.2/arch/m68knommu/Kconfig 2010-02-25 11:51:27.000000000 +0100
476 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68knommu/Kconfig 2010-02-25 12:02:16.000000000 +0100
477 @@ -734,6 +734,8 @@ source "fs/Kconfig"
479 source "arch/m68knommu/Kconfig.debug"
481 +source "kernel/vserver/Kconfig"
483 source "security/Kconfig"
485 source "crypto/Kconfig"
486 diff -NurpP --minimal linux-2.6.33.2/arch/m68knommu/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68knommu/kernel/traps.c
487 --- linux-2.6.33.2/arch/m68knommu/kernel/traps.c 2009-09-10 15:25:23.000000000 +0200
488 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/m68knommu/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
489 @@ -78,8 +78,9 @@ void die_if_kernel(char *str, struct pt_
490 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
491 fp->d4, fp->d5, fp->a0, fp->a1);
493 - printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
494 - current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
495 + printk(KERN_EMERG "Process %s (pid: %d[#%u], stackpage=%08lx)\n",
496 + current->comm, task_pid_nr(current), current->xid,
497 + PAGE_SIZE+(unsigned long)current);
498 show_stack(NULL, (unsigned long *)(fp + 1));
499 add_taint(TAINT_DIE);
501 diff -NurpP --minimal linux-2.6.33.2/arch/microblaze/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/microblaze/mm/fault.c
502 --- linux-2.6.33.2/arch/microblaze/mm/fault.c 2009-09-10 15:25:24.000000000 +0200
503 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/microblaze/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
504 @@ -279,7 +279,8 @@ out_of_memory:
507 up_read(&mm->mmap_sem);
508 - printk(KERN_WARNING "VM: killing process %s\n", current->comm);
509 + printk(KERN_WARNING "VM: killing process %s(%d:#%u)\n",
510 + current->comm, task_pid_nr(current), current->xid);
513 bad_page_fault(regs, address, SIGKILL);
514 diff -NurpP --minimal linux-2.6.33.2/arch/mips/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/Kconfig
515 --- linux-2.6.33.2/arch/mips/Kconfig 2010-02-25 11:51:27.000000000 +0100
516 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/Kconfig 2010-02-25 12:02:16.000000000 +0100
517 @@ -2220,6 +2220,8 @@ source "fs/Kconfig"
519 source "arch/mips/Kconfig.debug"
521 +source "kernel/vserver/Kconfig"
523 source "security/Kconfig"
525 source "crypto/Kconfig"
526 diff -NurpP --minimal linux-2.6.33.2/arch/mips/kernel/ptrace.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/ptrace.c
527 --- linux-2.6.33.2/arch/mips/kernel/ptrace.c 2008-12-25 00:26:37.000000000 +0100
528 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/ptrace.c 2010-02-25 12:02:16.000000000 +0100
530 #include <linux/security.h>
531 #include <linux/audit.h>
532 #include <linux/seccomp.h>
533 +#include <linux/vs_base.h>
535 #include <asm/byteorder.h>
537 @@ -259,6 +260,9 @@ long arch_ptrace(struct task_struct *chi
541 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
545 /* when I and D space are separate, these will need to be fixed. */
546 case PTRACE_PEEKTEXT: /* read word at location addr. */
547 diff -NurpP --minimal linux-2.6.33.2/arch/mips/kernel/scall32-o32.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/scall32-o32.S
548 --- linux-2.6.33.2/arch/mips/kernel/scall32-o32.S 2010-02-25 11:51:28.000000000 +0100
549 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/scall32-o32.S 2010-02-25 12:02:16.000000000 +0100
550 @@ -525,7 +525,7 @@ einval: li v0, -ENOSYS
551 sys sys_mq_timedreceive 5
552 sys sys_mq_notify 2 /* 4275 */
553 sys sys_mq_getsetattr 3
554 - sys sys_ni_syscall 0 /* sys_vserver */
557 sys sys_ni_syscall 0 /* available, was setaltroot */
558 sys sys_add_key 5 /* 4280 */
559 diff -NurpP --minimal linux-2.6.33.2/arch/mips/kernel/scall64-64.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/scall64-64.S
560 --- linux-2.6.33.2/arch/mips/kernel/scall64-64.S 2010-02-25 11:51:28.000000000 +0100
561 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/scall64-64.S 2010-02-25 12:02:16.000000000 +0100
562 @@ -362,7 +362,7 @@ sys_call_table:
563 PTR sys_mq_timedreceive
565 PTR sys_mq_getsetattr /* 5235 */
566 - PTR sys_ni_syscall /* sys_vserver */
569 PTR sys_ni_syscall /* available, was setaltroot */
571 diff -NurpP --minimal linux-2.6.33.2/arch/mips/kernel/scall64-n32.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/scall64-n32.S
572 --- linux-2.6.33.2/arch/mips/kernel/scall64-n32.S 2010-02-25 11:51:28.000000000 +0100
573 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/scall64-n32.S 2010-02-25 12:02:16.000000000 +0100
574 @@ -360,7 +360,7 @@ EXPORT(sysn32_call_table)
575 PTR compat_sys_mq_timedreceive
576 PTR compat_sys_mq_notify
577 PTR compat_sys_mq_getsetattr
578 - PTR sys_ni_syscall /* 6240, sys_vserver */
579 + PTR sys32_vserver /* 6240 */
580 PTR compat_sys_waitid
581 PTR sys_ni_syscall /* available, was setaltroot */
583 diff -NurpP --minimal linux-2.6.33.2/arch/mips/kernel/scall64-o32.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/scall64-o32.S
584 --- linux-2.6.33.2/arch/mips/kernel/scall64-o32.S 2010-02-25 11:51:28.000000000 +0100
585 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/scall64-o32.S 2010-02-25 12:02:16.000000000 +0100
586 @@ -480,7 +480,7 @@ sys_call_table:
587 PTR compat_sys_mq_timedreceive
588 PTR compat_sys_mq_notify /* 4275 */
589 PTR compat_sys_mq_getsetattr
590 - PTR sys_ni_syscall /* sys_vserver */
593 PTR sys_ni_syscall /* available, was setaltroot */
594 PTR sys_add_key /* 4280 */
595 diff -NurpP --minimal linux-2.6.33.2/arch/mips/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/traps.c
596 --- linux-2.6.33.2/arch/mips/kernel/traps.c 2010-02-25 11:51:28.000000000 +0100
597 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/mips/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
598 @@ -333,9 +333,10 @@ void show_registers(const struct pt_regs
602 - printk("Process %s (pid: %d, threadinfo=%p, task=%p, tls=%0*lx)\n",
603 - current->comm, current->pid, current_thread_info(), current,
604 - field, current_thread_info()->tp_value);
605 + printk("Process %s (pid: %d:#%u, threadinfo=%p, task=%p, tls=%0*lx)\n",
606 + current->comm, task_pid_nr(current), current->xid,
607 + current_thread_info(), current,
608 + field, current_thread_info()->tp_value);
609 if (cpu_has_userlocal) {
612 diff -NurpP --minimal linux-2.6.33.2/arch/mn10300/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/mn10300/mm/fault.c
613 --- linux-2.6.33.2/arch/mn10300/mm/fault.c 2009-09-10 15:25:39.000000000 +0200
614 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/mn10300/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
615 @@ -339,7 +339,8 @@ no_context:
617 up_read(&mm->mmap_sem);
618 monitor_signal(regs);
619 - printk(KERN_ALERT "VM: killing process %s\n", tsk->comm);
620 + printk(KERN_ALERT "VM: killing process %s(%d:#%u)\n",
621 + tsk->comm, task_pid_nr(tsk), tsk->xid);
622 if ((fault_code & MMUFCR_xFC_ACCESS) == MMUFCR_xFC_ACCESS_USR)
625 diff -NurpP --minimal linux-2.6.33.2/arch/parisc/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/parisc/Kconfig
626 --- linux-2.6.33.2/arch/parisc/Kconfig 2010-02-25 11:51:29.000000000 +0100
627 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/parisc/Kconfig 2010-02-25 12:02:16.000000000 +0100
628 @@ -293,6 +293,8 @@ source "fs/Kconfig"
630 source "arch/parisc/Kconfig.debug"
632 +source "kernel/vserver/Kconfig"
634 source "security/Kconfig"
636 source "crypto/Kconfig"
637 diff -NurpP --minimal linux-2.6.33.2/arch/parisc/kernel/syscall_table.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/parisc/kernel/syscall_table.S
638 --- linux-2.6.33.2/arch/parisc/kernel/syscall_table.S 2010-02-25 11:51:29.000000000 +0100
639 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/parisc/kernel/syscall_table.S 2010-02-25 12:02:16.000000000 +0100
641 ENTRY_COMP(mbind) /* 260 */
642 ENTRY_COMP(get_mempolicy)
643 ENTRY_COMP(set_mempolicy)
644 - ENTRY_SAME(ni_syscall) /* 263: reserved for vserver */
645 + ENTRY_DIFF(vserver)
647 ENTRY_SAME(request_key) /* 265 */
649 diff -NurpP --minimal linux-2.6.33.2/arch/parisc/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/parisc/kernel/traps.c
650 --- linux-2.6.33.2/arch/parisc/kernel/traps.c 2009-09-10 15:25:40.000000000 +0200
651 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/parisc/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
652 @@ -236,8 +236,9 @@ void die_if_kernel(char *str, struct pt_
656 - printk(KERN_CRIT "%s (pid %d): %s (code %ld) at " RFMT "\n",
657 - current->comm, task_pid_nr(current), str, err, regs->iaoq[0]);
658 + printk(KERN_CRIT "%s (pid %d:#%u): %s (code %ld) at " RFMT "\n",
659 + current->comm, task_pid_nr(current), current->xid,
660 + str, err, regs->iaoq[0]);
661 #ifdef PRINT_USER_FAULTS
662 /* XXX for debugging only */
664 @@ -270,8 +271,8 @@ void die_if_kernel(char *str, struct pt_
665 pdc_console_restart();
668 - printk(KERN_CRIT "%s (pid %d): %s (code %ld)\n",
669 - current->comm, task_pid_nr(current), str, err);
670 + printk(KERN_CRIT "%s (pid %d:#%u): %s (code %ld)\n",
671 + current->comm, task_pid_nr(current), current->xid, str, err);
673 /* Wot's wrong wif bein' racy? */
674 if (current->thread.flags & PARISC_KERNEL_DEATH) {
675 diff -NurpP --minimal linux-2.6.33.2/arch/parisc/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/parisc/mm/fault.c
676 --- linux-2.6.33.2/arch/parisc/mm/fault.c 2009-09-10 15:25:40.000000000 +0200
677 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/parisc/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
678 @@ -237,8 +237,9 @@ bad_area:
680 #ifdef PRINT_USER_FAULTS
681 printk(KERN_DEBUG "\n");
682 - printk(KERN_DEBUG "do_page_fault() pid=%d command='%s' type=%lu address=0x%08lx\n",
683 - task_pid_nr(tsk), tsk->comm, code, address);
684 + printk(KERN_DEBUG "do_page_fault() pid=%d:#%u "
685 + "command='%s' type=%lu address=0x%08lx\n",
686 + task_pid_nr(tsk), tsk->xid, tsk->comm, code, address);
688 printk(KERN_DEBUG "vm_start = 0x%08lx, vm_end = 0x%08lx\n",
689 vma->vm_start, vma->vm_end);
690 @@ -264,7 +265,8 @@ no_context:
693 up_read(&mm->mmap_sem);
694 - printk(KERN_CRIT "VM: killing process %s\n", current->comm);
695 + printk(KERN_CRIT "VM: killing process %s(%d:#%u)\n",
696 + current->comm, current->pid, current->xid);
698 do_group_exit(SIGKILL);
700 diff -NurpP --minimal linux-2.6.33.2/arch/powerpc/include/asm/unistd.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/include/asm/unistd.h
701 --- linux-2.6.33.2/arch/powerpc/include/asm/unistd.h 2009-12-03 20:02:01.000000000 +0100
702 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/include/asm/unistd.h 2010-02-25 12:02:16.000000000 +0100
705 #define __NR_rtas 255
706 #define __NR_sys_debug_setcontext 256
707 -/* Number 257 is reserved for vserver */
708 +#define __NR_vserver 257
709 #define __NR_migrate_pages 258
710 #define __NR_mbind 259
711 #define __NR_get_mempolicy 260
712 diff -NurpP --minimal linux-2.6.33.2/arch/powerpc/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/Kconfig
713 --- linux-2.6.33.2/arch/powerpc/Kconfig 2010-02-25 11:51:29.000000000 +0100
714 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/Kconfig 2010-02-25 12:02:16.000000000 +0100
715 @@ -968,6 +968,8 @@ source "lib/Kconfig"
717 source "arch/powerpc/Kconfig.debug"
719 +source "kernel/vserver/Kconfig"
721 source "security/Kconfig"
724 diff -NurpP --minimal linux-2.6.33.2/arch/powerpc/kernel/irq.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/kernel/irq.c
725 --- linux-2.6.33.2/arch/powerpc/kernel/irq.c 2010-02-25 11:51:31.000000000 +0100
726 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/kernel/irq.c 2010-02-25 12:02:16.000000000 +0100
728 #include <linux/pci.h>
729 #include <linux/debugfs.h>
730 #include <linux/perf_event.h>
731 +// #include <linux/vs_context.h>
733 #include <asm/uaccess.h>
734 #include <asm/system.h>
735 diff -NurpP --minimal linux-2.6.33.2/arch/powerpc/kernel/process.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/kernel/process.c
736 --- linux-2.6.33.2/arch/powerpc/kernel/process.c 2010-02-25 11:51:31.000000000 +0100
737 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/kernel/process.c 2010-02-25 12:02:16.000000000 +0100
738 @@ -519,8 +519,9 @@ void show_regs(struct pt_regs * regs)
740 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
742 - printk("TASK = %p[%d] '%s' THREAD: %p",
743 - current, task_pid_nr(current), current->comm, task_thread_info(current));
744 + printk("TASK = %p[%d,#%u] '%s' THREAD: %p",
745 + current, task_pid_nr(current), current->xid,
746 + current->comm, task_thread_info(current));
749 printk(" CPU: %d", raw_smp_processor_id());
750 diff -NurpP --minimal linux-2.6.33.2/arch/powerpc/kernel/traps.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/kernel/traps.c
751 --- linux-2.6.33.2/arch/powerpc/kernel/traps.c 2010-02-25 11:51:31.000000000 +0100
752 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/kernel/traps.c 2010-02-25 12:02:16.000000000 +0100
753 @@ -918,8 +918,9 @@ void nonrecoverable_exception(struct pt_
755 void trace_syscall(struct pt_regs *regs)
757 - printk("Task: %p(%d), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
758 - current, task_pid_nr(current), regs->nip, regs->link, regs->gpr[0],
759 + printk("Task: %p(%d[#%u]), PC: %08lX/%08lX, Syscall: %3ld, Result: %s%ld %s\n",
760 + current, task_pid_nr(current), current->xid,
761 + regs->nip, regs->link, regs->gpr[0],
762 regs->ccr&0x10000000?"Error=":"", regs->gpr[3], print_tainted());
765 diff -NurpP --minimal linux-2.6.33.2/arch/powerpc/kernel/vdso.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/kernel/vdso.c
766 --- linux-2.6.33.2/arch/powerpc/kernel/vdso.c 2010-02-25 11:51:31.000000000 +0100
767 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/kernel/vdso.c 2010-02-25 12:02:16.000000000 +0100
769 #include <linux/security.h>
770 #include <linux/bootmem.h>
771 #include <linux/lmb.h>
772 +#include <linux/vs_memory.h>
774 #include <asm/pgtable.h>
775 #include <asm/system.h>
776 diff -NurpP --minimal linux-2.6.33.2/arch/powerpc/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/mm/fault.c
777 --- linux-2.6.33.2/arch/powerpc/mm/fault.c 2010-02-25 11:51:31.000000000 +0100
778 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/powerpc/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
779 @@ -364,7 +364,8 @@ out_of_memory:
780 down_read(&mm->mmap_sem);
783 - printk("VM: killing process %s\n", current->comm);
784 + printk("VM: killing process %s(%d:#%u)\n",
785 + current->comm, current->pid, current->xid);
787 do_group_exit(SIGKILL);
789 diff -NurpP --minimal linux-2.6.33.2/arch/s390/include/asm/tlb.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/include/asm/tlb.h
790 --- linux-2.6.33.2/arch/s390/include/asm/tlb.h 2009-09-10 15:25:43.000000000 +0200
791 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/include/asm/tlb.h 2010-02-25 12:02:16.000000000 +0100
794 #include <linux/mm.h>
795 #include <linux/swap.h>
796 +#include <linux/vs_memory.h>
798 #include <asm/processor.h>
799 #include <asm/pgalloc.h>
801 diff -NurpP --minimal linux-2.6.33.2/arch/s390/include/asm/unistd.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/include/asm/unistd.h
802 --- linux-2.6.33.2/arch/s390/include/asm/unistd.h 2010-02-25 11:51:32.000000000 +0100
803 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/include/asm/unistd.h 2010-02-25 12:02:16.000000000 +0100
805 #define __NR_clock_gettime (__NR_timer_create+6)
806 #define __NR_clock_getres (__NR_timer_create+7)
807 #define __NR_clock_nanosleep (__NR_timer_create+8)
808 -/* Number 263 is reserved for vserver */
809 +#define __NR_vserver 263
810 #define __NR_statfs64 265
811 #define __NR_fstatfs64 266
812 #define __NR_remap_file_pages 267
813 diff -NurpP --minimal linux-2.6.33.2/arch/s390/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/Kconfig
814 --- linux-2.6.33.2/arch/s390/Kconfig 2010-02-25 11:51:32.000000000 +0100
815 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/Kconfig 2010-02-25 12:02:16.000000000 +0100
816 @@ -629,6 +629,8 @@ source "fs/Kconfig"
818 source "arch/s390/Kconfig.debug"
820 +source "kernel/vserver/Kconfig"
822 source "security/Kconfig"
824 source "crypto/Kconfig"
825 diff -NurpP --minimal linux-2.6.33.2/arch/s390/kernel/ptrace.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/kernel/ptrace.c
826 --- linux-2.6.33.2/arch/s390/kernel/ptrace.c 2010-02-25 11:51:32.000000000 +0100
827 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/kernel/ptrace.c 2010-02-25 12:02:16.000000000 +0100
829 #include <linux/regset.h>
830 #include <linux/tracehook.h>
831 #include <linux/seccomp.h>
832 +#include <linux/vs_base.h>
833 #include <trace/syscall.h>
834 #include <asm/compat.h>
835 #include <asm/segment.h>
836 diff -NurpP --minimal linux-2.6.33.2/arch/s390/kernel/syscalls.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/kernel/syscalls.S
837 --- linux-2.6.33.2/arch/s390/kernel/syscalls.S 2009-12-03 20:02:03.000000000 +0100
838 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/s390/kernel/syscalls.S 2010-02-25 12:02:16.000000000 +0100
839 @@ -271,7 +271,7 @@ SYSCALL(sys_clock_settime,sys_clock_sett
840 SYSCALL(sys_clock_gettime,sys_clock_gettime,sys32_clock_gettime_wrapper) /* 260 */
841 SYSCALL(sys_clock_getres,sys_clock_getres,sys32_clock_getres_wrapper)
842 SYSCALL(sys_clock_nanosleep,sys_clock_nanosleep,sys32_clock_nanosleep_wrapper)
843 -NI_SYSCALL /* reserved for vserver */
844 +SYSCALL(sys_vserver,sys_vserver,sys32_vserver)
845 SYSCALL(sys_s390_fadvise64_64,sys_ni_syscall,sys32_fadvise64_64_wrapper)
846 SYSCALL(sys_statfs64,sys_statfs64,compat_sys_statfs64_wrapper)
847 SYSCALL(sys_fstatfs64,sys_fstatfs64,compat_sys_fstatfs64_wrapper)
848 diff -NurpP --minimal linux-2.6.33.2/arch/sh/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/Kconfig
849 --- linux-2.6.33.2/arch/sh/Kconfig 2010-02-25 11:51:32.000000000 +0100
850 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/Kconfig 2010-02-25 12:02:16.000000000 +0100
851 @@ -860,6 +860,8 @@ source "fs/Kconfig"
853 source "arch/sh/Kconfig.debug"
855 +source "kernel/vserver/Kconfig"
857 source "security/Kconfig"
859 source "crypto/Kconfig"
860 diff -NurpP --minimal linux-2.6.33.2/arch/sh/kernel/irq.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/kernel/irq.c
861 --- linux-2.6.33.2/arch/sh/kernel/irq.c 2010-02-25 11:51:33.000000000 +0100
862 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/kernel/irq.c 2010-02-25 12:02:16.000000000 +0100
864 #include <linux/kernel_stat.h>
865 #include <linux/seq_file.h>
866 #include <linux/ftrace.h>
867 +// #include <linux/vs_context.h>
868 #include <asm/processor.h>
869 #include <asm/machvec.h>
870 #include <asm/uaccess.h>
871 diff -NurpP --minimal linux-2.6.33.2/arch/sh/kernel/vsyscall/vsyscall.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/kernel/vsyscall/vsyscall.c
872 --- linux-2.6.33.2/arch/sh/kernel/vsyscall/vsyscall.c 2009-03-24 14:18:42.000000000 +0100
873 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/kernel/vsyscall/vsyscall.c 2010-02-25 12:02:16.000000000 +0100
875 #include <linux/elf.h>
876 #include <linux/sched.h>
877 #include <linux/err.h>
878 +#include <linux/vs_memory.h>
881 * Should the kernel map a VDSO page into processes and pass its
882 diff -NurpP --minimal linux-2.6.33.2/arch/sh/mm/fault_32.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/mm/fault_32.c
883 --- linux-2.6.33.2/arch/sh/mm/fault_32.c 2009-12-03 20:02:14.000000000 +0100
884 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/mm/fault_32.c 2010-02-25 12:02:16.000000000 +0100
885 @@ -292,7 +292,8 @@ out_of_memory:
886 down_read(&mm->mmap_sem);
889 - printk("VM: killing process %s\n", tsk->comm);
890 + printk("VM: killing process %s(%d:#%u)\n",
891 + tsk->comm, task_pid_nr(tsk), tsk->xid);
893 do_group_exit(SIGKILL);
895 diff -NurpP --minimal linux-2.6.33.2/arch/sh/mm/tlbflush_64.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/mm/tlbflush_64.c
896 --- linux-2.6.33.2/arch/sh/mm/tlbflush_64.c 2009-12-03 20:02:14.000000000 +0100
897 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sh/mm/tlbflush_64.c 2010-02-25 12:02:16.000000000 +0100
898 @@ -306,7 +306,8 @@ out_of_memory:
899 down_read(&mm->mmap_sem);
902 - printk("VM: killing process %s\n", tsk->comm);
903 + printk("VM: killing process %s(%d:#%u)\n",
904 + tsk->comm, task_pid_nr(tsk), tsk->xid);
906 do_group_exit(SIGKILL);
908 diff -NurpP --minimal linux-2.6.33.2/arch/sparc/include/asm/tlb_64.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/include/asm/tlb_64.h
909 --- linux-2.6.33.2/arch/sparc/include/asm/tlb_64.h 2009-09-10 15:25:45.000000000 +0200
910 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/include/asm/tlb_64.h 2010-02-25 12:02:16.000000000 +0100
913 #include <linux/swap.h>
914 #include <linux/pagemap.h>
915 +#include <linux/vs_memory.h>
916 #include <asm/pgalloc.h>
917 #include <asm/tlbflush.h>
918 #include <asm/mmu_context.h>
919 diff -NurpP --minimal linux-2.6.33.2/arch/sparc/include/asm/unistd.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/include/asm/unistd.h
920 --- linux-2.6.33.2/arch/sparc/include/asm/unistd.h 2010-02-25 11:51:34.000000000 +0100
921 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/include/asm/unistd.h 2010-02-25 12:02:16.000000000 +0100
923 #define __NR_timer_getoverrun 264
924 #define __NR_timer_delete 265
925 #define __NR_timer_create 266
926 -/* #define __NR_vserver 267 Reserved for VSERVER */
927 +#define __NR_vserver 267
928 #define __NR_io_setup 268
929 #define __NR_io_destroy 269
930 #define __NR_io_submit 270
931 diff -NurpP --minimal linux-2.6.33.2/arch/sparc/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/Kconfig
932 --- linux-2.6.33.2/arch/sparc/Kconfig 2010-02-25 11:51:33.000000000 +0100
933 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/Kconfig 2010-02-25 12:02:16.000000000 +0100
934 @@ -561,6 +561,8 @@ source "fs/Kconfig"
936 source "arch/sparc/Kconfig.debug"
938 +source "kernel/vserver/Kconfig"
940 source "security/Kconfig"
942 source "crypto/Kconfig"
943 diff -NurpP --minimal linux-2.6.33.2/arch/sparc/kernel/systbls_32.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/kernel/systbls_32.S
944 --- linux-2.6.33.2/arch/sparc/kernel/systbls_32.S 2010-02-25 11:51:34.000000000 +0100
945 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/kernel/systbls_32.S 2010-02-25 12:02:16.000000000 +0100
946 @@ -70,7 +70,7 @@ sys_call_table:
947 /*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
948 /*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
949 /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
950 -/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
951 +/*265*/ .long sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
952 /*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
953 /*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
954 /*280*/ .long sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
955 diff -NurpP --minimal linux-2.6.33.2/arch/sparc/kernel/systbls_64.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/kernel/systbls_64.S
956 --- linux-2.6.33.2/arch/sparc/kernel/systbls_64.S 2010-02-25 11:51:34.000000000 +0100
957 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/sparc/kernel/systbls_64.S 2010-02-25 12:02:16.000000000 +0100
958 @@ -71,7 +71,7 @@ sys_call_table32:
959 /*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
960 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
961 /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
962 - .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
963 + .word sys_timer_delete, compat_sys_timer_create, sys32_vserver, compat_sys_io_setup, sys_io_destroy
964 /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
965 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
966 /*280*/ .word sys32_tee, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
967 @@ -146,7 +146,7 @@ sys_call_table:
968 /*250*/ .word sys_64_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
969 .word sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
970 /*260*/ .word sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
971 - .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
972 + .word sys_timer_delete, sys_timer_create, sys_vserver, sys_io_setup, sys_io_destroy
973 /*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
974 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
975 /*280*/ .word sys_tee, sys_add_key, sys_request_key, sys_keyctl, sys_openat
976 diff -NurpP --minimal linux-2.6.33.2/arch/um/include/asm/tlb.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/include/asm/tlb.h
977 --- linux-2.6.33.2/arch/um/include/asm/tlb.h 2009-09-10 15:25:46.000000000 +0200
978 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/include/asm/tlb.h 2010-03-10 20:29:12.000000000 +0100
981 #include <linux/pagemap.h>
982 #include <linux/swap.h>
983 +#include <linux/vs_memory.h>
984 #include <asm/percpu.h>
985 #include <asm/pgalloc.h>
986 #include <asm/tlbflush.h>
987 diff -NurpP --minimal linux-2.6.33.2/arch/um/include/shared/kern_constants.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/include/shared/kern_constants.h
988 --- linux-2.6.33.2/arch/um/include/shared/kern_constants.h 1970-01-01 01:00:00.000000000 +0100
989 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/include/shared/kern_constants.h 2010-03-10 20:12:12.000000000 +0100
991 +#include "../../../../include/generated/asm-offsets.h"
992 diff -NurpP --minimal linux-2.6.33.2/arch/um/include/shared/user_constants.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/include/shared/user_constants.h
993 --- linux-2.6.33.2/arch/um/include/shared/user_constants.h 1970-01-01 01:00:00.000000000 +0100
994 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/include/shared/user_constants.h 2010-03-10 20:12:12.000000000 +0100
999 + * This file was generated by arch/um/Makefile
1003 +#define HOST_SC_CR2 176 /* offsetof(struct sigcontext, cr2) # */
1004 +#define HOST_SC_ERR 152 /* offsetof(struct sigcontext, err) # */
1005 +#define HOST_SC_TRAPNO 160 /* offsetof(struct sigcontext, trapno) # */
1006 +#define HOST_FP_SIZE 64 /* sizeof(struct _fpstate) / sizeof(unsigned long) # */
1007 +#define HOST_RBX 5 /* RBX # */
1008 +#define HOST_RCX 11 /* RCX # */
1009 +#define HOST_RDI 14 /* RDI # */
1010 +#define HOST_RSI 13 /* RSI # */
1011 +#define HOST_RDX 12 /* RDX # */
1012 +#define HOST_RBP 4 /* RBP # */
1013 +#define HOST_RAX 10 /* RAX # */
1014 +#define HOST_R8 9 /* R8 # */
1015 +#define HOST_R9 8 /* R9 # */
1016 +#define HOST_R10 7 /* R10 # */
1017 +#define HOST_R11 6 /* R11 # */
1018 +#define HOST_R12 3 /* R12 # */
1019 +#define HOST_R13 2 /* R13 # */
1020 +#define HOST_R14 1 /* R14 # */
1021 +#define HOST_R15 0 /* R15 # */
1022 +#define HOST_ORIG_RAX 15 /* ORIG_RAX # */
1023 +#define HOST_CS 17 /* CS # */
1024 +#define HOST_SS 20 /* SS # */
1025 +#define HOST_EFLAGS 18 /* EFLAGS # */
1026 +#define HOST_IP 16 /* RIP # */
1027 +#define HOST_SP 19 /* RSP # */
1028 +#define UM_FRAME_SIZE 216 /* sizeof(struct user_regs_struct) # */
1029 +#define UM_POLLIN 1 /* POLLIN # */
1030 +#define UM_POLLPRI 2 /* POLLPRI # */
1031 +#define UM_POLLOUT 4 /* POLLOUT # */
1032 +#define UM_PROT_READ 1 /* PROT_READ # */
1033 +#define UM_PROT_WRITE 2 /* PROT_WRITE # */
1034 +#define UM_PROT_EXEC 4 /* PROT_EXEC # */
1036 diff -NurpP --minimal linux-2.6.33.2/arch/um/Kconfig.rest linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/Kconfig.rest
1037 --- linux-2.6.33.2/arch/um/Kconfig.rest 2009-06-11 17:12:19.000000000 +0200
1038 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/Kconfig.rest 2010-03-10 20:23:16.000000000 +0100
1039 @@ -18,6 +18,8 @@ source "drivers/connector/Kconfig"
1043 +source "kernel/vserver/Kconfig"
1045 source "security/Kconfig"
1047 source "crypto/Kconfig"
1048 diff -NurpP --minimal linux-2.6.33.2/arch/um/kernel/config.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/kernel/config.c
1049 --- linux-2.6.33.2/arch/um/kernel/config.c 1970-01-01 01:00:00.000000000 +0100
1050 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/kernel/config.c 2010-03-10 20:29:55.000000000 +0100
1053 + * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
1054 + * Licensed under the GPL
1058 +#include <stdlib.h>
1061 +static __initdata const char *config[] = {
1064 +"# Automatically generated make config: don't edit\n",
1065 +"# Linux kernel version: 2.6.33-vs2.3.0.36.29.1\n",
1066 +"# Wed Mar 10 20:29:46 2010\n",
1068 +"CONFIG_DEFCONFIG_LIST=\"arch/$ARCH/defconfig\"\n",
1069 +"CONFIG_GENERIC_HARDIRQS=y\n",
1072 +"CONFIG_NO_IOMEM=y\n",
1073 +"# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set\n",
1074 +"CONFIG_LOCKDEP_SUPPORT=y\n",
1075 +"# CONFIG_STACKTRACE_SUPPORT is not set\n",
1076 +"CONFIG_GENERIC_CALIBRATE_DELAY=y\n",
1077 +"CONFIG_GENERIC_BUG=y\n",
1078 +"CONFIG_GENERIC_TIME=y\n",
1079 +"CONFIG_GENERIC_CLOCKEVENTS=y\n",
1080 +"CONFIG_IRQ_RELEASE_METHOD=y\n",
1084 +"# UML-specific options\n",
1088 +"# Host processor type and features\n",
1090 +"# CONFIG_M386 is not set\n",
1091 +"# CONFIG_M486 is not set\n",
1092 +"# CONFIG_M586 is not set\n",
1093 +"# CONFIG_M586TSC is not set\n",
1094 +"# CONFIG_M586MMX is not set\n",
1095 +"# CONFIG_M686 is not set\n",
1096 +"# CONFIG_MPENTIUMII is not set\n",
1097 +"# CONFIG_MPENTIUMIII is not set\n",
1098 +"# CONFIG_MPENTIUMM is not set\n",
1099 +"# CONFIG_MPENTIUM4 is not set\n",
1100 +"# CONFIG_MK6 is not set\n",
1101 +"# CONFIG_MK7 is not set\n",
1103 +"# CONFIG_MCRUSOE is not set\n",
1104 +"# CONFIG_MEFFICEON is not set\n",
1105 +"# CONFIG_MWINCHIPC6 is not set\n",
1106 +"# CONFIG_MWINCHIP3D is not set\n",
1107 +"# CONFIG_MGEODEGX1 is not set\n",
1108 +"# CONFIG_MGEODE_LX is not set\n",
1109 +"# CONFIG_MCYRIXIII is not set\n",
1110 +"# CONFIG_MVIAC3_2 is not set\n",
1111 +"# CONFIG_MVIAC7 is not set\n",
1112 +"# CONFIG_MPSC is not set\n",
1113 +"# CONFIG_MCORE2 is not set\n",
1114 +"# CONFIG_MATOM is not set\n",
1115 +"# CONFIG_GENERIC_CPU is not set\n",
1116 +"CONFIG_X86_CPU=y\n",
1117 +"CONFIG_X86_INTERNODE_CACHE_SHIFT=6\n",
1118 +"# CONFIG_X86_CMPXCHG is not set\n",
1119 +"CONFIG_X86_L1_CACHE_SHIFT=6\n",
1120 +"CONFIG_X86_WP_WORKS_OK=y\n",
1121 +"CONFIG_X86_INTEL_USERCOPY=y\n",
1122 +"CONFIG_X86_USE_PPRO_CHECKSUM=y\n",
1123 +"CONFIG_X86_TSC=y\n",
1124 +"CONFIG_X86_CMOV=y\n",
1125 +"CONFIG_X86_MINIMUM_CPU_FAMILY=3\n",
1126 +"CONFIG_CPU_SUP_INTEL=y\n",
1127 +"CONFIG_CPU_SUP_AMD=y\n",
1128 +"CONFIG_CPU_SUP_CENTAUR=y\n",
1129 +"CONFIG_UML_X86=y\n",
1130 +"CONFIG_64BIT=y\n",
1131 +"# CONFIG_X86_32 is not set\n",
1132 +"# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set\n",
1133 +"CONFIG_RWSEM_GENERIC_SPINLOCK=y\n",
1134 +"# CONFIG_ARCH_HAS_SC_SIGNALS is not set\n",
1135 +"# CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA is not set\n",
1136 +"CONFIG_SMP_BROKEN=y\n",
1137 +"CONFIG_GENERIC_HWEIGHT=y\n",
1138 +"# CONFIG_STATIC_LINK is not set\n",
1139 +"CONFIG_FLATMEM=y\n",
1140 +"CONFIG_FLAT_NODE_MEM_MAP=y\n",
1141 +"CONFIG_PAGEFLAGS_EXTENDED=y\n",
1142 +"CONFIG_SPLIT_PTLOCK_CPUS=4\n",
1143 +"CONFIG_PHYS_ADDR_T_64BIT=y\n",
1144 +"CONFIG_ZONE_DMA_FLAG=0\n",
1145 +"CONFIG_VIRT_TO_BUS=y\n",
1146 +"# CONFIG_KSM is not set\n",
1147 +"CONFIG_DEFAULT_MMAP_MIN_ADDR=4096\n",
1148 +"# CONFIG_NO_HZ is not set\n",
1149 +"# CONFIG_HIGH_RES_TIMERS is not set\n",
1150 +"CONFIG_GENERIC_CLOCKEVENTS_BUILD=y\n",
1151 +"CONFIG_LD_SCRIPT_DYN=y\n",
1152 +"# CONFIG_BINFMT_ELF is not set\n",
1153 +"# CONFIG_HAVE_AOUT is not set\n",
1154 +"# CONFIG_BINFMT_MISC is not set\n",
1155 +"# CONFIG_HOSTFS is not set\n",
1156 +"# CONFIG_MCONSOLE is not set\n",
1157 +"CONFIG_KERNEL_STACK_ORDER=1\n",
1160 +"# General setup\n",
1162 +"# CONFIG_EXPERIMENTAL is not set\n",
1163 +"CONFIG_BROKEN_ON_SMP=y\n",
1164 +"CONFIG_INIT_ENV_ARG_LIMIT=128\n",
1165 +"CONFIG_LOCALVERSION=\"\"\n",
1166 +"# CONFIG_LOCALVERSION_AUTO is not set\n",
1167 +"# CONFIG_SWAP is not set\n",
1168 +"CONFIG_SYSVIPC=y\n",
1169 +"CONFIG_SYSVIPC_SYSCTL=y\n",
1170 +"# CONFIG_BSD_PROCESS_ACCT is not set\n",
1173 +"# RCU Subsystem\n",
1175 +"CONFIG_TREE_RCU=y\n",
1176 +"# CONFIG_TREE_PREEMPT_RCU is not set\n",
1177 +"# CONFIG_TINY_RCU is not set\n",
1178 +"# CONFIG_RCU_TRACE is not set\n",
1179 +"CONFIG_RCU_FANOUT=64\n",
1180 +"# CONFIG_RCU_FANOUT_EXACT is not set\n",
1181 +"# CONFIG_TREE_RCU_TRACE is not set\n",
1182 +"# CONFIG_IKCONFIG is not set\n",
1183 +"CONFIG_LOG_BUF_SHIFT=17\n",
1184 +"# CONFIG_CGROUPS is not set\n",
1185 +"# CONFIG_SYSFS_DEPRECATED_V2 is not set\n",
1186 +"# CONFIG_RELAY is not set\n",
1187 +"CONFIG_NAMESPACES=y\n",
1188 +"CONFIG_UTS_NS=y\n",
1189 +"CONFIG_IPC_NS=y\n",
1190 +"CONFIG_USER_NS=y\n",
1191 +"# CONFIG_BLK_DEV_INITRD is not set\n",
1192 +"# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set\n",
1193 +"CONFIG_SYSCTL=y\n",
1194 +"CONFIG_ANON_INODES=y\n",
1195 +"# CONFIG_EMBEDDED is not set\n",
1196 +"CONFIG_UID16=y\n",
1197 +"CONFIG_SYSCTL_SYSCALL=y\n",
1198 +"CONFIG_KALLSYMS=y\n",
1199 +"# CONFIG_KALLSYMS_EXTRA_PASS is not set\n",
1200 +"CONFIG_HOTPLUG=y\n",
1201 +"CONFIG_PRINTK=y\n",
1203 +"CONFIG_ELF_CORE=y\n",
1204 +"CONFIG_BASE_FULL=y\n",
1205 +"CONFIG_FUTEX=y\n",
1206 +"CONFIG_EPOLL=y\n",
1207 +"CONFIG_SIGNALFD=y\n",
1208 +"CONFIG_TIMERFD=y\n",
1209 +"CONFIG_EVENTFD=y\n",
1210 +"CONFIG_SHMEM=y\n",
1214 +"# Kernel Performance Events And Counters\n",
1216 +"CONFIG_VM_EVENT_COUNTERS=y\n",
1217 +"CONFIG_SLUB_DEBUG=y\n",
1218 +"# CONFIG_COMPAT_BRK is not set\n",
1219 +"# CONFIG_SLAB is not set\n",
1221 +"# CONFIG_SLOB is not set\n",
1222 +"# CONFIG_PROFILING is not set\n",
1225 +"# GCOV-based kernel profiling\n",
1227 +"# CONFIG_SLOW_WORK is not set\n",
1228 +"# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set\n",
1229 +"CONFIG_SLABINFO=y\n",
1230 +"CONFIG_RT_MUTEXES=y\n",
1231 +"CONFIG_BASE_SMALL=0\n",
1232 +"# CONFIG_MODULES is not set\n",
1233 +"CONFIG_BLOCK=y\n",
1234 +"# CONFIG_BLK_DEV_BSG is not set\n",
1235 +"# CONFIG_BLK_DEV_INTEGRITY is not set\n",
1238 +"# IO Schedulers\n",
1240 +"CONFIG_IOSCHED_NOOP=y\n",
1241 +"# CONFIG_IOSCHED_DEADLINE is not set\n",
1242 +"# CONFIG_IOSCHED_CFQ is not set\n",
1243 +"# CONFIG_DEFAULT_DEADLINE is not set\n",
1244 +"# CONFIG_DEFAULT_CFQ is not set\n",
1245 +"CONFIG_DEFAULT_NOOP=y\n",
1246 +"CONFIG_DEFAULT_IOSCHED=\"noop\"\n",
1247 +"# CONFIG_INLINE_SPIN_TRYLOCK is not set\n",
1248 +"# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set\n",
1249 +"# CONFIG_INLINE_SPIN_LOCK is not set\n",
1250 +"# CONFIG_INLINE_SPIN_LOCK_BH is not set\n",
1251 +"# CONFIG_INLINE_SPIN_LOCK_IRQ is not set\n",
1252 +"# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set\n",
1253 +"CONFIG_INLINE_SPIN_UNLOCK=y\n",
1254 +"# CONFIG_INLINE_SPIN_UNLOCK_BH is not set\n",
1255 +"CONFIG_INLINE_SPIN_UNLOCK_IRQ=y\n",
1256 +"# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set\n",
1257 +"# CONFIG_INLINE_READ_TRYLOCK is not set\n",
1258 +"# CONFIG_INLINE_READ_LOCK is not set\n",
1259 +"# CONFIG_INLINE_READ_LOCK_BH is not set\n",
1260 +"# CONFIG_INLINE_READ_LOCK_IRQ is not set\n",
1261 +"# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set\n",
1262 +"CONFIG_INLINE_READ_UNLOCK=y\n",
1263 +"# CONFIG_INLINE_READ_UNLOCK_BH is not set\n",
1264 +"CONFIG_INLINE_READ_UNLOCK_IRQ=y\n",
1265 +"# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set\n",
1266 +"# CONFIG_INLINE_WRITE_TRYLOCK is not set\n",
1267 +"# CONFIG_INLINE_WRITE_LOCK is not set\n",
1268 +"# CONFIG_INLINE_WRITE_LOCK_BH is not set\n",
1269 +"# CONFIG_INLINE_WRITE_LOCK_IRQ is not set\n",
1270 +"# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set\n",
1271 +"CONFIG_INLINE_WRITE_UNLOCK=y\n",
1272 +"# CONFIG_INLINE_WRITE_UNLOCK_BH is not set\n",
1273 +"CONFIG_INLINE_WRITE_UNLOCK_IRQ=y\n",
1274 +"# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set\n",
1275 +"# CONFIG_MUTEX_SPIN_ON_OWNER is not set\n",
1276 +"# CONFIG_FREEZER is not set\n",
1277 +"# CONFIG_BLK_DEV is not set\n",
1280 +"# Character Devices\n",
1282 +"# CONFIG_STDERR_CONSOLE is not set\n",
1283 +"CONFIG_STDIO_CONSOLE=y\n",
1284 +"# CONFIG_SSL is not set\n",
1285 +"# CONFIG_NULL_CHAN is not set\n",
1286 +"# CONFIG_PORT_CHAN is not set\n",
1287 +"# CONFIG_PTY_CHAN is not set\n",
1288 +"# CONFIG_TTY_CHAN is not set\n",
1289 +"# CONFIG_XTERM_CHAN is not set\n",
1290 +"CONFIG_NOCONFIG_CHAN=y\n",
1291 +"CONFIG_CON_ZERO_CHAN=\"fd:0,fd:1\"\n",
1292 +"CONFIG_CON_CHAN=\"xterm\"\n",
1293 +"CONFIG_SSL_CHAN=\"pty\"\n",
1294 +"# CONFIG_UNIX98_PTYS is not set\n",
1295 +"# CONFIG_LEGACY_PTYS is not set\n",
1296 +"# CONFIG_RAW_DRIVER is not set\n",
1297 +"# CONFIG_WATCHDOG is not set\n",
1298 +"# CONFIG_UML_SOUND is not set\n",
1299 +"# CONFIG_SOUND is not set\n",
1300 +"# CONFIG_SOUND_OSS_CORE is not set\n",
1301 +"# CONFIG_HOSTAUDIO is not set\n",
1302 +"# CONFIG_HW_RANDOM is not set\n",
1303 +"# CONFIG_UML_RANDOM is not set\n",
1304 +"# CONFIG_MMAPPER is not set\n",
1307 +"# Generic Driver Options\n",
1309 +"CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\"\n",
1310 +"CONFIG_STANDALONE=y\n",
1311 +"# CONFIG_PREVENT_FIRMWARE_BUILD is not set\n",
1312 +"CONFIG_FW_LOADER=y\n",
1313 +"# CONFIG_FIRMWARE_IN_KERNEL is not set\n",
1314 +"CONFIG_EXTRA_FIRMWARE=\"\"\n",
1315 +"# CONFIG_SYS_HYPERVISOR is not set\n",
1316 +"# CONFIG_NET is not set\n",
1319 +"# File systems\n",
1321 +"# CONFIG_EXT2_FS is not set\n",
1322 +"# CONFIG_EXT3_FS is not set\n",
1323 +"# CONFIG_EXT4_FS is not set\n",
1324 +"# CONFIG_REISERFS_FS is not set\n",
1325 +"# CONFIG_JFS_FS is not set\n",
1326 +"# CONFIG_FS_POSIX_ACL is not set\n",
1327 +"# CONFIG_XFS_FS is not set\n",
1328 +"CONFIG_FILE_LOCKING=y\n",
1329 +"# CONFIG_FSNOTIFY is not set\n",
1330 +"# CONFIG_DNOTIFY is not set\n",
1331 +"# CONFIG_INOTIFY is not set\n",
1332 +"# CONFIG_INOTIFY_USER is not set\n",
1333 +"# CONFIG_QUOTA is not set\n",
1334 +"# CONFIG_AUTOFS_FS is not set\n",
1335 +"# CONFIG_AUTOFS4_FS is not set\n",
1336 +"# CONFIG_FUSE_FS is not set\n",
1343 +"# CD-ROM/DVD Filesystems\n",
1345 +"# CONFIG_ISO9660_FS is not set\n",
1346 +"# CONFIG_UDF_FS is not set\n",
1349 +"# DOS/FAT/NT Filesystems\n",
1351 +"# CONFIG_MSDOS_FS is not set\n",
1352 +"# CONFIG_VFAT_FS is not set\n",
1353 +"# CONFIG_NTFS_FS is not set\n",
1356 +"# Pseudo filesystems\n",
1358 +"CONFIG_PROC_FS=y\n",
1359 +"# CONFIG_PROC_KCORE is not set\n",
1360 +"CONFIG_PROC_SYSCTL=y\n",
1361 +"CONFIG_PROC_PAGE_MONITOR=y\n",
1362 +"CONFIG_SYSFS=y\n",
1363 +"# CONFIG_TMPFS is not set\n",
1364 +"# CONFIG_HUGETLB_PAGE is not set\n",
1365 +"# CONFIG_CONFIGFS_FS is not set\n",
1366 +"# CONFIG_MISC_FILESYSTEMS is not set\n",
1369 +"# Partition Types\n",
1371 +"# CONFIG_PARTITION_ADVANCED is not set\n",
1372 +"CONFIG_MSDOS_PARTITION=y\n",
1373 +"# CONFIG_NLS is not set\n",
1376 +"# Linux VServer\n",
1378 +"# CONFIG_VSERVER_AUTO_LBACK is not set\n",
1379 +"# CONFIG_VSERVER_COWBL is not set\n",
1380 +"# CONFIG_VSERVER_PROC_SECURE is not set\n",
1381 +"# CONFIG_VSERVER_HARDCPU is not set\n",
1382 +"# CONFIG_TAGGING_NONE is not set\n",
1383 +"# CONFIG_TAGGING_UID16 is not set\n",
1384 +"# CONFIG_TAGGING_GID16 is not set\n",
1385 +"CONFIG_TAGGING_ID24=y\n",
1386 +"# CONFIG_TAGGING_INTERN is not set\n",
1387 +"# CONFIG_TAG_NFSD is not set\n",
1388 +"# CONFIG_VSERVER_PRIVACY is not set\n",
1389 +"CONFIG_VSERVER_CONTEXTS=768\n",
1390 +"# CONFIG_VSERVER_WARN is not set\n",
1391 +"# CONFIG_VSERVER_DEBUG is not set\n",
1392 +"CONFIG_VSERVER=y\n",
1395 +"# Security options\n",
1397 +"# CONFIG_KEYS is not set\n",
1398 +"# CONFIG_SECURITY is not set\n",
1399 +"# CONFIG_SECURITYFS is not set\n",
1400 +"# CONFIG_DEFAULT_SECURITY_SELINUX is not set\n",
1401 +"# CONFIG_DEFAULT_SECURITY_SMACK is not set\n",
1402 +"# CONFIG_DEFAULT_SECURITY_TOMOYO is not set\n",
1403 +"CONFIG_DEFAULT_SECURITY_DAC=y\n",
1404 +"CONFIG_DEFAULT_SECURITY=\"\"\n",
1405 +"# CONFIG_CRYPTO is not set\n",
1406 +"# CONFIG_BINARY_PRINTF is not set\n",
1409 +"# Library routines\n",
1411 +"CONFIG_GENERIC_FIND_FIRST_BIT=y\n",
1412 +"CONFIG_GENERIC_FIND_NEXT_BIT=y\n",
1413 +"CONFIG_GENERIC_FIND_LAST_BIT=y\n",
1414 +"# CONFIG_CRC_CCITT is not set\n",
1415 +"# CONFIG_CRC16 is not set\n",
1416 +"# CONFIG_CRC_T10DIF is not set\n",
1417 +"# CONFIG_CRC_ITU_T is not set\n",
1418 +"# CONFIG_CRC32 is not set\n",
1419 +"# CONFIG_CRC7 is not set\n",
1420 +"# CONFIG_LIBCRC32C is not set\n",
1421 +"CONFIG_HAS_DMA=y\n",
1424 +"# SCSI device support\n",
1426 +"# CONFIG_RAID_ATTRS is not set\n",
1427 +"# CONFIG_SCSI is not set\n",
1428 +"# CONFIG_SCSI_DMA is not set\n",
1429 +"# CONFIG_SCSI_NETLINK is not set\n",
1430 +"# CONFIG_MD is not set\n",
1431 +"# CONFIG_NEW_LEDS is not set\n",
1432 +"# CONFIG_INPUT is not set\n",
1435 +"# Kernel hacking\n",
1437 +"# CONFIG_PRINTK_TIME is not set\n",
1438 +"# CONFIG_ENABLE_WARN_DEPRECATED is not set\n",
1439 +"# CONFIG_ENABLE_MUST_CHECK is not set\n",
1440 +"CONFIG_FRAME_WARN=2048\n",
1441 +"# CONFIG_STRIP_ASM_SYMS is not set\n",
1442 +"# CONFIG_UNUSED_SYMBOLS is not set\n",
1443 +"# CONFIG_DEBUG_FS is not set\n",
1444 +"# CONFIG_DEBUG_KERNEL is not set\n",
1445 +"# CONFIG_SLUB_DEBUG_ON is not set\n",
1446 +"# CONFIG_SLUB_STATS is not set\n",
1447 +"CONFIG_DEBUG_BUGVERBOSE=y\n",
1448 +"CONFIG_DEBUG_MEMORY_INIT=y\n",
1449 +"# CONFIG_RCU_CPU_STALL_DETECTOR is not set\n",
1450 +"# CONFIG_SYSCTL_SYSCALL_CHECK is not set\n",
1451 +"# CONFIG_SAMPLES is not set\n",
1452 +"# CONFIG_DEBUG_STACK_USAGE is not set\n",
1456 +static int __init print_config(char *line, int *add)
1459 + for (i = 0; i < sizeof(config)/sizeof(config[0]); i++)
1460 + printf("%s", config[i]);
1464 +__uml_setup("--showconfig", print_config,
1466 +" Prints the config file that this UML binary was generated from.\n\n"
1469 diff -NurpP --minimal linux-2.6.33.2/arch/um/kernel/config.tmp linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/kernel/config.tmp
1470 --- linux-2.6.33.2/arch/um/kernel/config.tmp 1970-01-01 01:00:00.000000000 +0100
1471 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/kernel/config.tmp 2010-03-10 20:29:55.000000000 +0100
1474 +"# Automatically generated make config: don't edit\n",
1475 +"# Linux kernel version: 2.6.33-vs2.3.0.36.29.1\n",
1476 +"# Wed Mar 10 20:29:46 2010\n",
1478 +"CONFIG_DEFCONFIG_LIST=\"arch/$ARCH/defconfig\"\n",
1479 +"CONFIG_GENERIC_HARDIRQS=y\n",
1482 +"CONFIG_NO_IOMEM=y\n",
1483 +"# CONFIG_TRACE_IRQFLAGS_SUPPORT is not set\n",
1484 +"CONFIG_LOCKDEP_SUPPORT=y\n",
1485 +"# CONFIG_STACKTRACE_SUPPORT is not set\n",
1486 +"CONFIG_GENERIC_CALIBRATE_DELAY=y\n",
1487 +"CONFIG_GENERIC_BUG=y\n",
1488 +"CONFIG_GENERIC_TIME=y\n",
1489 +"CONFIG_GENERIC_CLOCKEVENTS=y\n",
1490 +"CONFIG_IRQ_RELEASE_METHOD=y\n",
1494 +"# UML-specific options\n",
1498 +"# Host processor type and features\n",
1500 +"# CONFIG_M386 is not set\n",
1501 +"# CONFIG_M486 is not set\n",
1502 +"# CONFIG_M586 is not set\n",
1503 +"# CONFIG_M586TSC is not set\n",
1504 +"# CONFIG_M586MMX is not set\n",
1505 +"# CONFIG_M686 is not set\n",
1506 +"# CONFIG_MPENTIUMII is not set\n",
1507 +"# CONFIG_MPENTIUMIII is not set\n",
1508 +"# CONFIG_MPENTIUMM is not set\n",
1509 +"# CONFIG_MPENTIUM4 is not set\n",
1510 +"# CONFIG_MK6 is not set\n",
1511 +"# CONFIG_MK7 is not set\n",
1513 +"# CONFIG_MCRUSOE is not set\n",
1514 +"# CONFIG_MEFFICEON is not set\n",
1515 +"# CONFIG_MWINCHIPC6 is not set\n",
1516 +"# CONFIG_MWINCHIP3D is not set\n",
1517 +"# CONFIG_MGEODEGX1 is not set\n",
1518 +"# CONFIG_MGEODE_LX is not set\n",
1519 +"# CONFIG_MCYRIXIII is not set\n",
1520 +"# CONFIG_MVIAC3_2 is not set\n",
1521 +"# CONFIG_MVIAC7 is not set\n",
1522 +"# CONFIG_MPSC is not set\n",
1523 +"# CONFIG_MCORE2 is not set\n",
1524 +"# CONFIG_MATOM is not set\n",
1525 +"# CONFIG_GENERIC_CPU is not set\n",
1526 +"CONFIG_X86_CPU=y\n",
1527 +"CONFIG_X86_INTERNODE_CACHE_SHIFT=6\n",
1528 +"# CONFIG_X86_CMPXCHG is not set\n",
1529 +"CONFIG_X86_L1_CACHE_SHIFT=6\n",
1530 +"CONFIG_X86_WP_WORKS_OK=y\n",
1531 +"CONFIG_X86_INTEL_USERCOPY=y\n",
1532 +"CONFIG_X86_USE_PPRO_CHECKSUM=y\n",
1533 +"CONFIG_X86_TSC=y\n",
1534 +"CONFIG_X86_CMOV=y\n",
1535 +"CONFIG_X86_MINIMUM_CPU_FAMILY=3\n",
1536 +"CONFIG_CPU_SUP_INTEL=y\n",
1537 +"CONFIG_CPU_SUP_AMD=y\n",
1538 +"CONFIG_CPU_SUP_CENTAUR=y\n",
1539 +"CONFIG_UML_X86=y\n",
1540 +"CONFIG_64BIT=y\n",
1541 +"# CONFIG_X86_32 is not set\n",
1542 +"# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set\n",
1543 +"CONFIG_RWSEM_GENERIC_SPINLOCK=y\n",
1544 +"# CONFIG_ARCH_HAS_SC_SIGNALS is not set\n",
1545 +"# CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA is not set\n",
1546 +"CONFIG_SMP_BROKEN=y\n",
1547 +"CONFIG_GENERIC_HWEIGHT=y\n",
1548 +"# CONFIG_STATIC_LINK is not set\n",
1549 +"CONFIG_FLATMEM=y\n",
1550 +"CONFIG_FLAT_NODE_MEM_MAP=y\n",
1551 +"CONFIG_PAGEFLAGS_EXTENDED=y\n",
1552 +"CONFIG_SPLIT_PTLOCK_CPUS=4\n",
1553 +"CONFIG_PHYS_ADDR_T_64BIT=y\n",
1554 +"CONFIG_ZONE_DMA_FLAG=0\n",
1555 +"CONFIG_VIRT_TO_BUS=y\n",
1556 +"# CONFIG_KSM is not set\n",
1557 +"CONFIG_DEFAULT_MMAP_MIN_ADDR=4096\n",
1558 +"# CONFIG_NO_HZ is not set\n",
1559 +"# CONFIG_HIGH_RES_TIMERS is not set\n",
1560 +"CONFIG_GENERIC_CLOCKEVENTS_BUILD=y\n",
1561 +"CONFIG_LD_SCRIPT_DYN=y\n",
1562 +"# CONFIG_BINFMT_ELF is not set\n",
1563 +"# CONFIG_HAVE_AOUT is not set\n",
1564 +"# CONFIG_BINFMT_MISC is not set\n",
1565 +"# CONFIG_HOSTFS is not set\n",
1566 +"# CONFIG_MCONSOLE is not set\n",
1567 +"CONFIG_KERNEL_STACK_ORDER=1\n",
1570 +"# General setup\n",
1572 +"# CONFIG_EXPERIMENTAL is not set\n",
1573 +"CONFIG_BROKEN_ON_SMP=y\n",
1574 +"CONFIG_INIT_ENV_ARG_LIMIT=128\n",
1575 +"CONFIG_LOCALVERSION=\"\"\n",
1576 +"# CONFIG_LOCALVERSION_AUTO is not set\n",
1577 +"# CONFIG_SWAP is not set\n",
1578 +"CONFIG_SYSVIPC=y\n",
1579 +"CONFIG_SYSVIPC_SYSCTL=y\n",
1580 +"# CONFIG_BSD_PROCESS_ACCT is not set\n",
1583 +"# RCU Subsystem\n",
1585 +"CONFIG_TREE_RCU=y\n",
1586 +"# CONFIG_TREE_PREEMPT_RCU is not set\n",
1587 +"# CONFIG_TINY_RCU is not set\n",
1588 +"# CONFIG_RCU_TRACE is not set\n",
1589 +"CONFIG_RCU_FANOUT=64\n",
1590 +"# CONFIG_RCU_FANOUT_EXACT is not set\n",
1591 +"# CONFIG_TREE_RCU_TRACE is not set\n",
1592 +"# CONFIG_IKCONFIG is not set\n",
1593 +"CONFIG_LOG_BUF_SHIFT=17\n",
1594 +"# CONFIG_CGROUPS is not set\n",
1595 +"# CONFIG_SYSFS_DEPRECATED_V2 is not set\n",
1596 +"# CONFIG_RELAY is not set\n",
1597 +"CONFIG_NAMESPACES=y\n",
1598 +"CONFIG_UTS_NS=y\n",
1599 +"CONFIG_IPC_NS=y\n",
1600 +"CONFIG_USER_NS=y\n",
1601 +"# CONFIG_BLK_DEV_INITRD is not set\n",
1602 +"# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set\n",
1603 +"CONFIG_SYSCTL=y\n",
1604 +"CONFIG_ANON_INODES=y\n",
1605 +"# CONFIG_EMBEDDED is not set\n",
1606 +"CONFIG_UID16=y\n",
1607 +"CONFIG_SYSCTL_SYSCALL=y\n",
1608 +"CONFIG_KALLSYMS=y\n",
1609 +"# CONFIG_KALLSYMS_EXTRA_PASS is not set\n",
1610 +"CONFIG_HOTPLUG=y\n",
1611 +"CONFIG_PRINTK=y\n",
1613 +"CONFIG_ELF_CORE=y\n",
1614 +"CONFIG_BASE_FULL=y\n",
1615 +"CONFIG_FUTEX=y\n",
1616 +"CONFIG_EPOLL=y\n",
1617 +"CONFIG_SIGNALFD=y\n",
1618 +"CONFIG_TIMERFD=y\n",
1619 +"CONFIG_EVENTFD=y\n",
1620 +"CONFIG_SHMEM=y\n",
1624 +"# Kernel Performance Events And Counters\n",
1626 +"CONFIG_VM_EVENT_COUNTERS=y\n",
1627 +"CONFIG_SLUB_DEBUG=y\n",
1628 +"# CONFIG_COMPAT_BRK is not set\n",
1629 +"# CONFIG_SLAB is not set\n",
1631 +"# CONFIG_SLOB is not set\n",
1632 +"# CONFIG_PROFILING is not set\n",
1635 +"# GCOV-based kernel profiling\n",
1637 +"# CONFIG_SLOW_WORK is not set\n",
1638 +"# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set\n",
1639 +"CONFIG_SLABINFO=y\n",
1640 +"CONFIG_RT_MUTEXES=y\n",
1641 +"CONFIG_BASE_SMALL=0\n",
1642 +"# CONFIG_MODULES is not set\n",
1643 +"CONFIG_BLOCK=y\n",
1644 +"# CONFIG_BLK_DEV_BSG is not set\n",
1645 +"# CONFIG_BLK_DEV_INTEGRITY is not set\n",
1648 +"# IO Schedulers\n",
1650 +"CONFIG_IOSCHED_NOOP=y\n",
1651 +"# CONFIG_IOSCHED_DEADLINE is not set\n",
1652 +"# CONFIG_IOSCHED_CFQ is not set\n",
1653 +"# CONFIG_DEFAULT_DEADLINE is not set\n",
1654 +"# CONFIG_DEFAULT_CFQ is not set\n",
1655 +"CONFIG_DEFAULT_NOOP=y\n",
1656 +"CONFIG_DEFAULT_IOSCHED=\"noop\"\n",
1657 +"# CONFIG_INLINE_SPIN_TRYLOCK is not set\n",
1658 +"# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set\n",
1659 +"# CONFIG_INLINE_SPIN_LOCK is not set\n",
1660 +"# CONFIG_INLINE_SPIN_LOCK_BH is not set\n",
1661 +"# CONFIG_INLINE_SPIN_LOCK_IRQ is not set\n",
1662 +"# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set\n",
1663 +"CONFIG_INLINE_SPIN_UNLOCK=y\n",
1664 +"# CONFIG_INLINE_SPIN_UNLOCK_BH is not set\n",
1665 +"CONFIG_INLINE_SPIN_UNLOCK_IRQ=y\n",
1666 +"# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set\n",
1667 +"# CONFIG_INLINE_READ_TRYLOCK is not set\n",
1668 +"# CONFIG_INLINE_READ_LOCK is not set\n",
1669 +"# CONFIG_INLINE_READ_LOCK_BH is not set\n",
1670 +"# CONFIG_INLINE_READ_LOCK_IRQ is not set\n",
1671 +"# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set\n",
1672 +"CONFIG_INLINE_READ_UNLOCK=y\n",
1673 +"# CONFIG_INLINE_READ_UNLOCK_BH is not set\n",
1674 +"CONFIG_INLINE_READ_UNLOCK_IRQ=y\n",
1675 +"# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set\n",
1676 +"# CONFIG_INLINE_WRITE_TRYLOCK is not set\n",
1677 +"# CONFIG_INLINE_WRITE_LOCK is not set\n",
1678 +"# CONFIG_INLINE_WRITE_LOCK_BH is not set\n",
1679 +"# CONFIG_INLINE_WRITE_LOCK_IRQ is not set\n",
1680 +"# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set\n",
1681 +"CONFIG_INLINE_WRITE_UNLOCK=y\n",
1682 +"# CONFIG_INLINE_WRITE_UNLOCK_BH is not set\n",
1683 +"CONFIG_INLINE_WRITE_UNLOCK_IRQ=y\n",
1684 +"# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set\n",
1685 +"# CONFIG_MUTEX_SPIN_ON_OWNER is not set\n",
1686 +"# CONFIG_FREEZER is not set\n",
1687 +"# CONFIG_BLK_DEV is not set\n",
1690 +"# Character Devices\n",
1692 +"# CONFIG_STDERR_CONSOLE is not set\n",
1693 +"CONFIG_STDIO_CONSOLE=y\n",
1694 +"# CONFIG_SSL is not set\n",
1695 +"# CONFIG_NULL_CHAN is not set\n",
1696 +"# CONFIG_PORT_CHAN is not set\n",
1697 +"# CONFIG_PTY_CHAN is not set\n",
1698 +"# CONFIG_TTY_CHAN is not set\n",
1699 +"# CONFIG_XTERM_CHAN is not set\n",
1700 +"CONFIG_NOCONFIG_CHAN=y\n",
1701 +"CONFIG_CON_ZERO_CHAN=\"fd:0,fd:1\"\n",
1702 +"CONFIG_CON_CHAN=\"xterm\"\n",
1703 +"CONFIG_SSL_CHAN=\"pty\"\n",
1704 +"# CONFIG_UNIX98_PTYS is not set\n",
1705 +"# CONFIG_LEGACY_PTYS is not set\n",
1706 +"# CONFIG_RAW_DRIVER is not set\n",
1707 +"# CONFIG_WATCHDOG is not set\n",
1708 +"# CONFIG_UML_SOUND is not set\n",
1709 +"# CONFIG_SOUND is not set\n",
1710 +"# CONFIG_SOUND_OSS_CORE is not set\n",
1711 +"# CONFIG_HOSTAUDIO is not set\n",
1712 +"# CONFIG_HW_RANDOM is not set\n",
1713 +"# CONFIG_UML_RANDOM is not set\n",
1714 +"# CONFIG_MMAPPER is not set\n",
1717 +"# Generic Driver Options\n",
1719 +"CONFIG_UEVENT_HELPER_PATH=\"/sbin/hotplug\"\n",
1720 +"CONFIG_STANDALONE=y\n",
1721 +"# CONFIG_PREVENT_FIRMWARE_BUILD is not set\n",
1722 +"CONFIG_FW_LOADER=y\n",
1723 +"# CONFIG_FIRMWARE_IN_KERNEL is not set\n",
1724 +"CONFIG_EXTRA_FIRMWARE=\"\"\n",
1725 +"# CONFIG_SYS_HYPERVISOR is not set\n",
1726 +"# CONFIG_NET is not set\n",
1729 +"# File systems\n",
1731 +"# CONFIG_EXT2_FS is not set\n",
1732 +"# CONFIG_EXT3_FS is not set\n",
1733 +"# CONFIG_EXT4_FS is not set\n",
1734 +"# CONFIG_REISERFS_FS is not set\n",
1735 +"# CONFIG_JFS_FS is not set\n",
1736 +"# CONFIG_FS_POSIX_ACL is not set\n",
1737 +"# CONFIG_XFS_FS is not set\n",
1738 +"CONFIG_FILE_LOCKING=y\n",
1739 +"# CONFIG_FSNOTIFY is not set\n",
1740 +"# CONFIG_DNOTIFY is not set\n",
1741 +"# CONFIG_INOTIFY is not set\n",
1742 +"# CONFIG_INOTIFY_USER is not set\n",
1743 +"# CONFIG_QUOTA is not set\n",
1744 +"# CONFIG_AUTOFS_FS is not set\n",
1745 +"# CONFIG_AUTOFS4_FS is not set\n",
1746 +"# CONFIG_FUSE_FS is not set\n",
1753 +"# CD-ROM/DVD Filesystems\n",
1755 +"# CONFIG_ISO9660_FS is not set\n",
1756 +"# CONFIG_UDF_FS is not set\n",
1759 +"# DOS/FAT/NT Filesystems\n",
1761 +"# CONFIG_MSDOS_FS is not set\n",
1762 +"# CONFIG_VFAT_FS is not set\n",
1763 +"# CONFIG_NTFS_FS is not set\n",
1766 +"# Pseudo filesystems\n",
1768 +"CONFIG_PROC_FS=y\n",
1769 +"# CONFIG_PROC_KCORE is not set\n",
1770 +"CONFIG_PROC_SYSCTL=y\n",
1771 +"CONFIG_PROC_PAGE_MONITOR=y\n",
1772 +"CONFIG_SYSFS=y\n",
1773 +"# CONFIG_TMPFS is not set\n",
1774 +"# CONFIG_HUGETLB_PAGE is not set\n",
1775 +"# CONFIG_CONFIGFS_FS is not set\n",
1776 +"# CONFIG_MISC_FILESYSTEMS is not set\n",
1779 +"# Partition Types\n",
1781 +"# CONFIG_PARTITION_ADVANCED is not set\n",
1782 +"CONFIG_MSDOS_PARTITION=y\n",
1783 +"# CONFIG_NLS is not set\n",
1786 +"# Linux VServer\n",
1788 +"# CONFIG_VSERVER_AUTO_LBACK is not set\n",
1789 +"# CONFIG_VSERVER_COWBL is not set\n",
1790 +"# CONFIG_VSERVER_PROC_SECURE is not set\n",
1791 +"# CONFIG_VSERVER_HARDCPU is not set\n",
1792 +"# CONFIG_TAGGING_NONE is not set\n",
1793 +"# CONFIG_TAGGING_UID16 is not set\n",
1794 +"# CONFIG_TAGGING_GID16 is not set\n",
1795 +"CONFIG_TAGGING_ID24=y\n",
1796 +"# CONFIG_TAGGING_INTERN is not set\n",
1797 +"# CONFIG_TAG_NFSD is not set\n",
1798 +"# CONFIG_VSERVER_PRIVACY is not set\n",
1799 +"CONFIG_VSERVER_CONTEXTS=768\n",
1800 +"# CONFIG_VSERVER_WARN is not set\n",
1801 +"# CONFIG_VSERVER_DEBUG is not set\n",
1802 +"CONFIG_VSERVER=y\n",
1805 +"# Security options\n",
1807 +"# CONFIG_KEYS is not set\n",
1808 +"# CONFIG_SECURITY is not set\n",
1809 +"# CONFIG_SECURITYFS is not set\n",
1810 +"# CONFIG_DEFAULT_SECURITY_SELINUX is not set\n",
1811 +"# CONFIG_DEFAULT_SECURITY_SMACK is not set\n",
1812 +"# CONFIG_DEFAULT_SECURITY_TOMOYO is not set\n",
1813 +"CONFIG_DEFAULT_SECURITY_DAC=y\n",
1814 +"CONFIG_DEFAULT_SECURITY=\"\"\n",
1815 +"# CONFIG_CRYPTO is not set\n",
1816 +"# CONFIG_BINARY_PRINTF is not set\n",
1819 +"# Library routines\n",
1821 +"CONFIG_GENERIC_FIND_FIRST_BIT=y\n",
1822 +"CONFIG_GENERIC_FIND_NEXT_BIT=y\n",
1823 +"CONFIG_GENERIC_FIND_LAST_BIT=y\n",
1824 +"# CONFIG_CRC_CCITT is not set\n",
1825 +"# CONFIG_CRC16 is not set\n",
1826 +"# CONFIG_CRC_T10DIF is not set\n",
1827 +"# CONFIG_CRC_ITU_T is not set\n",
1828 +"# CONFIG_CRC32 is not set\n",
1829 +"# CONFIG_CRC7 is not set\n",
1830 +"# CONFIG_LIBCRC32C is not set\n",
1831 +"CONFIG_HAS_DMA=y\n",
1834 +"# SCSI device support\n",
1836 +"# CONFIG_RAID_ATTRS is not set\n",
1837 +"# CONFIG_SCSI is not set\n",
1838 +"# CONFIG_SCSI_DMA is not set\n",
1839 +"# CONFIG_SCSI_NETLINK is not set\n",
1840 +"# CONFIG_MD is not set\n",
1841 +"# CONFIG_NEW_LEDS is not set\n",
1842 +"# CONFIG_INPUT is not set\n",
1845 +"# Kernel hacking\n",
1847 +"# CONFIG_PRINTK_TIME is not set\n",
1848 +"# CONFIG_ENABLE_WARN_DEPRECATED is not set\n",
1849 +"# CONFIG_ENABLE_MUST_CHECK is not set\n",
1850 +"CONFIG_FRAME_WARN=2048\n",
1851 +"# CONFIG_STRIP_ASM_SYMS is not set\n",
1852 +"# CONFIG_UNUSED_SYMBOLS is not set\n",
1853 +"# CONFIG_DEBUG_FS is not set\n",
1854 +"# CONFIG_DEBUG_KERNEL is not set\n",
1855 +"# CONFIG_SLUB_DEBUG_ON is not set\n",
1856 +"# CONFIG_SLUB_STATS is not set\n",
1857 +"CONFIG_DEBUG_BUGVERBOSE=y\n",
1858 +"CONFIG_DEBUG_MEMORY_INIT=y\n",
1859 +"# CONFIG_RCU_CPU_STALL_DETECTOR is not set\n",
1860 +"# CONFIG_SYSCTL_SYSCALL_CHECK is not set\n",
1861 +"# CONFIG_SAMPLES is not set\n",
1862 +"# CONFIG_DEBUG_STACK_USAGE is not set\n",
1863 diff -NurpP --minimal linux-2.6.33.2/arch/um/kernel/vmlinux.lds linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/kernel/vmlinux.lds
1864 --- linux-2.6.33.2/arch/um/kernel/vmlinux.lds 1970-01-01 01:00:00.000000000 +0100
1865 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/um/kernel/vmlinux.lds 2010-03-10 20:12:32.000000000 +0100
1870 + * Automatically generated C config: don't edit
1871 + * Linux kernel version: 2.6.33-vs2.3.0.36.29.1
1872 + * Wed Mar 10 20:12:10 2010
1874 +KERNEL_STACK_SIZE = 4096 * (1 << 1);
1876 + * Helper macros to support writing architecture specific
1879 + * A minimal linker scripts has following content:
1880 + * [This is a sample, architectures may have special requiriements]
1882 + * OUTPUT_FORMAT(...)
1883 + * OUTPUT_ARCH(...)
1888 + * __init_begin = .;
1889 + * HEAD_TEXT_SECTION
1890 + * INIT_TEXT_SECTION(PAGE_SIZE)
1891 + * INIT_DATA_SECTION(...)
1892 + * PERCPU(PAGE_SIZE)
1896 + * TEXT_SECTION = 0
1900 + * RO_DATA_SECTION(PAGE_SIZE)
1901 + * RW_DATA_SECTION(...)
1904 + * EXCEPTION_TABLE(...)
1907 + * BSS_SECTION(0, 0, 0)
1913 + * DISCARDS // must be the last
1916 + * [__init_begin, __init_end] is the init section that may be freed after init
1917 + * [_stext, _etext] is the text section
1918 + * [_sdata, _edata] is the data section
1920 + * Some of the included output section have their own set of constants.
1921 + * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
1922 + * [__nosave_begin, __nosave_end] for the nosave data
1931 +/* Align . to a 8 byte boundary equals to maximum function alignment. */
1934 +/* The actual configuration determine if the init/exit sections
1935 + * are handled as text/data or they can be discarded (which
1936 + * often happens at runtime)
1938 +/* .data section */
1940 + * Data section helpers
1945 +/* RODATA & RO_DATA provided for backward compatibility.
1946 + * All archs are supposed to use RO_DATA() */
1947 +/* .text section. Map to function alignment to avoid address changes
1948 + * during second ld run in second ld pass when generating System.map */
1949 +/* sched.text is aling to function alignment to secure we have same
1950 + * address even at second ld pass when generating System.map */
1951 +/* spinlock.text is aling to function alignment to secure we have same
1952 + * address even at second ld pass when generating System.map */
1953 +/* Section used for early init (in .S files) */
1960 +/* init and exit section handling */
1962 + * bss (Block Started by Symbol) - uninitialized data
1963 + * zeroed during startup
1966 + * DWARF debug sections.
1967 + * Symbols in the DWARF debugging sections are relative to
1968 + * the beginning of the section so we begin them at 0.
1970 + /* Stabs debugging sections. */
1972 + * Default discarded sections.
1974 + * Some archs want to discard exit text/data at runtime rather than
1975 + * link time due to cross-section references such as alt instructions,
1976 + * bug table, eh_frame, etc. DISCARDS must be the last of output
1977 + * section definitions so that such archs put those in earlier section
1981 + * PERCPU_VADDR - define output section for percpu area
1982 + * @vaddr: explicit base address (optional)
1983 + * @phdr: destination PHDR (optional)
1985 + * Macro which expands to output section for percpu area. If @vaddr
1986 + * is not blank, it specifies explicit base address and all percpu
1987 + * symbols will be offset from the given address. If blank, @vaddr
1988 + * always equals @laddr + LOAD_OFFSET.
1990 + * @phdr defines the output PHDR to use if not blank. Be warned that
1991 + * output PHDR is sticky. If @phdr is specified, the next output
1992 + * section in the linker script will go there too. @phdr should have
1993 + * a leading colon.
1995 + * Note that this macros defines __per_cpu_load as an absolute symbol.
1996 + * If there is no need to put the percpu section at a predetermined
1997 + * address, use PERCPU().
2000 + * PERCPU - define output section for percpu area, simple version
2001 + * @align: required alignment
2003 + * Align to @align and outputs output section for percpu area. This
2004 + * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
2005 + * __per_cpu_start will be identical.
2007 + * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
2008 + * that __per_cpu_load is defined as a relative symbol against
2009 + * .data.percpu which is required for relocatable x86_32
2013 + * Definition of the high level *_SECTION macros
2014 + * They will fit only a subset of the architectures
2018 + * All sections are combined in a single .data section.
2019 + * The sections following CONSTRUCTORS are arranged so their
2020 + * typical alignment matches.
2021 + * A cacheline is typical/always less than a PAGE_SIZE so
2022 + * the sections that has this restriction (or similar)
2023 + * is located before the ones requiring PAGE_SIZE alignment.
2024 + * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
2025 + * matches the requirment of PAGE_ALIGNED_DATA.
2027 + * use 0 as page_align if page_aligned data is not used */
2029 + * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
2030 + * Copyright 2003 PathScale, Inc.
2031 + * Licensed under the GPL
2033 +/* const.h: Macros for dealing with constants. */
2034 +/* Some constant macros are used in both assembler and
2035 + * C code. Therefore we cannot annotate them always with
2036 + * 'UL' and other type specifiers unilaterally. We
2037 + * use the following macros to deal with this.
2039 + * Similarly, _AT() will cast an expression with a type in C, but
2040 + * leave it unchanged in asm.
2042 +/* PAGE_SHIFT determines the page size */
2043 +OUTPUT_FORMAT(elf64-x86-64)
2044 +OUTPUT_ARCH(i386:x86-64)
2046 +jiffies = jiffies_64;
2049 + PROVIDE (__executable_start = 0x60000000);
2050 + . = 0x60000000 + SIZEOF_HEADERS;
2051 + .interp : { *(.interp) }
2052 + __binary_start = .;
2053 + . = ALIGN(4096); /* Init code and data */
2057 + . = ALIGN((1 << 12)); .init.text : AT(ADDR(.init.text) - 0) { _sinittext = .; *(.init.text) *(.cpuinit.text) *(.meminit.text) _einittext = .; }
2058 + . = ALIGN((1 << 12));
2059 + /* Read-only sections, merged into text segment: */
2060 + .hash : { *(.hash) }
2061 + .gnu.hash : { *(.gnu.hash) }
2062 + .dynsym : { *(.dynsym) }
2063 + .dynstr : { *(.dynstr) }
2064 + .gnu.version : { *(.gnu.version) }
2065 + .gnu.version_d : { *(.gnu.version_d) }
2066 + .gnu.version_r : { *(.gnu.version_r) }
2067 + .rel.init : { *(.rel.init) }
2068 + .rela.init : { *(.rela.init) }
2069 + .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
2070 + .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
2071 + .rel.fini : { *(.rel.fini) }
2072 + .rela.fini : { *(.rela.fini) }
2073 + .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
2074 + .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
2075 + .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
2076 + .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
2077 + .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
2078 + .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
2079 + .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
2080 + .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
2081 + .rel.ctors : { *(.rel.ctors) }
2082 + .rela.ctors : { *(.rela.ctors) }
2083 + .rel.dtors : { *(.rel.dtors) }
2084 + .rela.dtors : { *(.rela.dtors) }
2085 + .rel.got : { *(.rel.got) }
2086 + .rela.got : { *(.rela.got) }
2087 + .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
2088 + .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
2089 + .rel.plt : { *(.rel.plt) }
2090 + .rela.plt : { *(.rela.plt) }
2094 + .plt : { *(.plt) }
2096 + . = ALIGN(8); *(.text.hot) *(.text) *(.ref.text) *(.devinit.text) *(.devexit.text) *(.text.unlikely)
2097 + . = ALIGN(8); __sched_text_start = .; *(.sched.text) __sched_text_end = .;
2098 + . = ALIGN(8); __lock_text_start = .; *(.spinlock.text) __lock_text_end = .;
2100 + *(.stub .text.* .gnu.linkonce.t.*)
2101 + /* .gnu.warning sections are handled specially by elf32.em. */
2103 + . = ALIGN((1 << 12));
2105 + . = ALIGN((1 << 12));
2107 + __syscall_stub_start = .;
2108 + *(.__syscall_stub*)
2109 + __syscall_stub_end = .;
2114 + .kstrtab : { *(.kstrtab) }
2116 + * Helper macros to support writing architecture specific
2119 + * A minimal linker scripts has following content:
2120 + * [This is a sample, architectures may have special requiriements]
2122 + * OUTPUT_FORMAT(...)
2123 + * OUTPUT_ARCH(...)
2128 + * __init_begin = .;
2129 + * HEAD_TEXT_SECTION
2130 + * INIT_TEXT_SECTION(PAGE_SIZE)
2131 + * INIT_DATA_SECTION(...)
2132 + * PERCPU(PAGE_SIZE)
2136 + * TEXT_SECTION = 0
2140 + * RO_DATA_SECTION(PAGE_SIZE)
2141 + * RW_DATA_SECTION(...)
2144 + * EXCEPTION_TABLE(...)
2147 + * BSS_SECTION(0, 0, 0)
2153 + * DISCARDS // must be the last
2156 + * [__init_begin, __init_end] is the init section that may be freed after init
2157 + * [_stext, _etext] is the text section
2158 + * [_sdata, _edata] is the data section
2160 + * Some of the included output section have their own set of constants.
2161 + * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
2162 + * [__nosave_begin, __nosave_end] for the nosave data
2164 +/* Align . to a 8 byte boundary equals to maximum function alignment. */
2165 +/* The actual configuration determine if the init/exit sections
2166 + * are handled as text/data or they can be discarded (which
2167 + * often happens at runtime)
2169 +/* .data section */
2171 + * Data section helpers
2176 +/* RODATA & RO_DATA provided for backward compatibility.
2177 + * All archs are supposed to use RO_DATA() */
2178 +/* .text section. Map to function alignment to avoid address changes
2179 + * during second ld run in second ld pass when generating System.map */
2180 +/* sched.text is aling to function alignment to secure we have same
2181 + * address even at second ld pass when generating System.map */
2182 +/* spinlock.text is aling to function alignment to secure we have same
2183 + * address even at second ld pass when generating System.map */
2184 +/* Section used for early init (in .S files) */
2191 +/* init and exit section handling */
2193 + * bss (Block Started by Symbol) - uninitialized data
2194 + * zeroed during startup
2197 + * DWARF debug sections.
2198 + * Symbols in the DWARF debugging sections are relative to
2199 + * the beginning of the section so we begin them at 0.
2201 + /* Stabs debugging sections. */
2203 + * Default discarded sections.
2205 + * Some archs want to discard exit text/data at runtime rather than
2206 + * link time due to cross-section references such as alt instructions,
2207 + * bug table, eh_frame, etc. DISCARDS must be the last of output
2208 + * section definitions so that such archs put those in earlier section
2212 + * PERCPU_VADDR - define output section for percpu area
2213 + * @vaddr: explicit base address (optional)
2214 + * @phdr: destination PHDR (optional)
2216 + * Macro which expands to output section for percpu area. If @vaddr
2217 + * is not blank, it specifies explicit base address and all percpu
2218 + * symbols will be offset from the given address. If blank, @vaddr
2219 + * always equals @laddr + LOAD_OFFSET.
2221 + * @phdr defines the output PHDR to use if not blank. Be warned that
2222 + * output PHDR is sticky. If @phdr is specified, the next output
2223 + * section in the linker script will go there too. @phdr should have
2224 + * a leading colon.
2226 + * Note that this macros defines __per_cpu_load as an absolute symbol.
2227 + * If there is no need to put the percpu section at a predetermined
2228 + * address, use PERCPU().
2231 + * PERCPU - define output section for percpu area, simple version
2232 + * @align: required alignment
2234 + * Align to @align and outputs output section for percpu area. This
2235 + * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
2236 + * __per_cpu_start will be identical.
2238 + * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
2239 + * that __per_cpu_load is defined as a relative symbol against
2240 + * .data.percpu which is required for relocatable x86_32
2244 + * Definition of the high level *_SECTION macros
2245 + * They will fit only a subset of the architectures
2249 + * All sections are combined in a single .data section.
2250 + * The sections following CONSTRUCTORS are arranged so their
2251 + * typical alignment matches.
2252 + * A cacheline is typical/always less than a PAGE_SIZE so
2253 + * the sections that has this restriction (or similar)
2254 + * is located before the ones requiring PAGE_SIZE alignment.
2255 + * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
2256 + * matches the requirment of PAGE_ALIGNED_DATA.
2258 + * use 0 as page_align if page_aligned data is not used */
2259 + .fini : { *(.fini) } =0x9090
2261 + PROVIDE (etext = .);
2264 + PROVIDE (sdata = .);
2265 + . = 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));
2266 + .unprotected : { *(.unprotected) }
2268 + PROVIDE (_unprotected_end = .);
2270 + .note : { *(.note.*) }
2271 + . = ALIGN(0); __ex_table : AT(ADDR(__ex_table) - 0) { __start___ex_table = .; *(__ex_table) __stop___ex_table = .; }
2272 + . = ALIGN(8); __bug_table : AT(ADDR(__bug_table) - 0) { __start___bug_table = .; *(__bug_table) __stop___bug_table = .; }
2273 + .uml.setup.init : {
2274 + __uml_setup_start = .;
2275 + *(.uml.setup.init)
2276 + __uml_setup_end = .;
2278 + .uml.help.init : {
2279 + __uml_help_start = .;
2281 + __uml_help_end = .;
2283 + .uml.postsetup.init : {
2284 + __uml_postsetup_start = .;
2285 + *(.uml.postsetup.init)
2286 + __uml_postsetup_end = .;
2289 + . = ALIGN(0); __setup_start = .; *(.init.setup) __setup_end = .;
2291 + . = 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 = .; }
2292 + .initcall.init : {
2293 + __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 = .;
2295 + .con_initcall.init : {
2296 + __con_initcall_start = .; *(.con_initcall.init) __con_initcall_end = .;
2298 + .uml.initcall.init : {
2299 + __uml_initcall_start = .;
2300 + *(.uml.initcall.init)
2301 + __uml_initcall_end = .;
2304 + .security_initcall.init : AT(ADDR(.security_initcall.init) - 0) { __security_initcall_start = .; *(.security_initcall.init) __security_initcall_end = .; }
2306 + __exitcall_begin = .;
2308 + __exitcall_end = .;
2311 + __uml_exitcall_begin = .;
2312 + *(.uml.exitcall.exit)
2313 + __uml_exitcall_end = .;
2316 + .altinstructions : {
2317 + __alt_instructions = .;
2318 + *(.altinstructions)
2319 + __alt_instructions_end = .;
2321 + .altinstr_replacement : { *(.altinstr_replacement) }
2322 + /* .exit.text is discard at runtime, not link time, to deal with references
2323 + from .altinstructions and .eh_frame */
2324 + .exit.text : { *(.exit.text) }
2325 + .exit.data : { *(.exit.data) }
2326 + .preinit_array : {
2327 + __preinit_array_start = .;
2329 + __preinit_array_end = .;
2332 + __init_array_start = .;
2334 + __init_array_end = .;
2337 + __fini_array_start = .;
2339 + __fini_array_end = .;
2345 + init.data : { *(.init.data) *(.cpuinit.data) *(.meminit.data) *(.init.rodata) *(.cpuinit.rodata) *(.meminit.rodata) }
2346 + /* Ensure the __preinit_array_start label is properly aligned. We
2347 + could instead move the label definition inside the section, but
2348 + the linker would then create the section even if it turns out to
2349 + be empty, which isn't pretty. */
2350 + . = ALIGN(32 / 8);
2351 + .preinit_array : { *(.preinit_array) }
2352 + .init_array : { *(.init_array) }
2353 + .fini_array : { *(.fini_array) }
2355 + . = ALIGN(KERNEL_STACK_SIZE); *(.data.init_task)
2356 + . = ALIGN(KERNEL_STACK_SIZE);
2357 + *(.data.init_irqstack)
2358 + *(.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 = .;
2359 + *(.data.* .gnu.linkonce.d.*)
2360 + SORT(CONSTRUCTORS)
2362 + .data1 : { *(.data1) }
2363 + .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
2364 + .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
2365 + .eh_frame : { KEEP (*(.eh_frame)) }
2366 + .gcc_except_table : { *(.gcc_except_table) }
2367 + .dynamic : { *(.dynamic) }
2369 + /* gcc uses crtbegin.o to find the start of
2370 + the constructors, so we make sure it is
2371 + first. Because this is a wildcard, it
2372 + doesn't matter if the user does not
2373 + actually link against crtbegin.o; the
2374 + linker won't look for a file to match a
2375 + wildcard. The wildcard also means that it
2376 + doesn't matter which directory crtbegin.o
2378 + KEEP (*crtbegin.o(.ctors))
2379 + /* We don't want to include the .ctor section from
2380 + from the crtend.o file until after the sorted ctors.
2381 + The .ctor section from the crtend file contains the
2382 + end of ctors marker and it must be last */
2383 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
2384 + KEEP (*(SORT(.ctors.*)))
2388 + KEEP (*crtbegin.o(.dtors))
2389 + KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
2390 + KEEP (*(SORT(.dtors.*)))
2393 + .jcr : { KEEP (*(.jcr)) }
2394 + .got : { *(.got.plt) *(.got) }
2396 + PROVIDE (edata = .);
2400 + *(.bss .bss.* .gnu.linkonce.b.*)
2402 + /* Align here to ensure that the .bss section occupies space up to
2403 + _end. Align after .bss to ensure correct alignment even if the
2404 + .bss section disappears because there are no input sections. */
2405 + . = ALIGN(32 / 8);
2406 + . = ALIGN(32 / 8);
2409 + PROVIDE (end = .);
2410 + .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) }
2411 + .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) }
2412 + /DISCARD/ : { *(.exit.text) *(.cpuexit.text) *(.memexit.text) *(.exit.data) *(.cpuexit.data) *(.cpuexit.rodata) *(.memexit.data) *(.memexit.rodata) *(.exitcall.exit) *(.discard) }
2414 diff -NurpP --minimal linux-2.6.33.2/arch/x86/ia32/ia32entry.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/x86/ia32/ia32entry.S
2415 --- linux-2.6.33.2/arch/x86/ia32/ia32entry.S 2010-02-25 11:51:34.000000000 +0100
2416 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/x86/ia32/ia32entry.S 2010-02-25 12:02:16.000000000 +0100
2417 @@ -777,7 +777,7 @@ ia32_sys_call_table:
2418 .quad sys_tgkill /* 270 */
2419 .quad compat_sys_utimes
2420 .quad sys32_fadvise64_64
2421 - .quad quiet_ni_syscall /* sys_vserver */
2422 + .quad sys32_vserver
2424 .quad compat_sys_get_mempolicy /* 275 */
2425 .quad sys_set_mempolicy
2426 diff -NurpP --minimal linux-2.6.33.2/arch/x86/include/asm/unistd_64.h linux-2.6.33.2-vs2.3.0.36.30.4/arch/x86/include/asm/unistd_64.h
2427 --- linux-2.6.33.2/arch/x86/include/asm/unistd_64.h 2010-02-25 11:51:34.000000000 +0100
2428 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/x86/include/asm/unistd_64.h 2010-02-25 12:02:16.000000000 +0100
2429 @@ -535,7 +535,7 @@ __SYSCALL(__NR_tgkill, sys_tgkill)
2430 #define __NR_utimes 235
2431 __SYSCALL(__NR_utimes, sys_utimes)
2432 #define __NR_vserver 236
2433 -__SYSCALL(__NR_vserver, sys_ni_syscall)
2434 +__SYSCALL(__NR_vserver, sys_vserver)
2435 #define __NR_mbind 237
2436 __SYSCALL(__NR_mbind, sys_mbind)
2437 #define __NR_set_mempolicy 238
2438 diff -NurpP --minimal linux-2.6.33.2/arch/x86/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/arch/x86/Kconfig
2439 --- linux-2.6.33.2/arch/x86/Kconfig 2010-02-25 11:51:34.000000000 +0100
2440 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/x86/Kconfig 2010-02-25 12:02:16.000000000 +0100
2441 @@ -2083,6 +2083,8 @@ source "fs/Kconfig"
2443 source "arch/x86/Kconfig.debug"
2445 +source "kernel/vserver/Kconfig"
2447 source "security/Kconfig"
2449 source "crypto/Kconfig"
2450 diff -NurpP --minimal linux-2.6.33.2/arch/x86/kernel/syscall_table_32.S linux-2.6.33.2-vs2.3.0.36.30.4/arch/x86/kernel/syscall_table_32.S
2451 --- linux-2.6.33.2/arch/x86/kernel/syscall_table_32.S 2010-02-25 11:51:35.000000000 +0100
2452 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/x86/kernel/syscall_table_32.S 2010-02-25 12:02:16.000000000 +0100
2453 @@ -272,7 +272,7 @@ ENTRY(sys_call_table)
2454 .long sys_tgkill /* 270 */
2456 .long sys_fadvise64_64
2457 - .long sys_ni_syscall /* sys_vserver */
2460 .long sys_get_mempolicy
2461 .long sys_set_mempolicy
2462 diff -NurpP --minimal linux-2.6.33.2/arch/xtensa/mm/fault.c linux-2.6.33.2-vs2.3.0.36.30.4/arch/xtensa/mm/fault.c
2463 --- linux-2.6.33.2/arch/xtensa/mm/fault.c 2009-09-10 15:25:48.000000000 +0200
2464 +++ linux-2.6.33.2-vs2.3.0.36.30.4/arch/xtensa/mm/fault.c 2010-02-25 12:02:16.000000000 +0100
2465 @@ -151,7 +151,8 @@ out_of_memory:
2466 down_read(&mm->mmap_sem);
2469 - printk("VM: killing process %s\n", current->comm);
2470 + printk("VM: killing process %s(%d:#%u)\n",
2471 + current->comm, task_pid_nr(current), current->xid);
2472 if (user_mode(regs))
2473 do_group_exit(SIGKILL);
2474 bad_page_fault(regs, address, SIGKILL);
2475 diff -NurpP --minimal linux-2.6.33.2/Documentation/vserver/debug.txt linux-2.6.33.2-vs2.3.0.36.30.4/Documentation/vserver/debug.txt
2476 --- linux-2.6.33.2/Documentation/vserver/debug.txt 1970-01-01 01:00:00.000000000 +0100
2477 +++ linux-2.6.33.2-vs2.3.0.36.30.4/Documentation/vserver/debug.txt 2010-02-25 12:02:16.000000000 +0100
2482 + 2 4 "vx_map_tgid: %p/%llx: %d -> %d"
2483 + "vx_rmap_tgid: %p/%llx: %d -> %d"
2487 + 0 1 "ALLOC (%p,#%d)%c inode (%d)"
2488 + "FREE (%p,#%d)%c inode"
2489 + 1 2 "ALLOC (%p,#%d)%c %lld bytes (%d)"
2490 + "FREE (%p,#%d)%c %lld bytes"
2491 + 2 4 "ADJUST: %lld,%lld on %ld,%ld [mult=%d]"
2492 + 3 8 "ext3_has_free_blocks(%p): %lu<%lu+1, %c, %u!=%u r=%d"
2493 + "ext3_has_free_blocks(%p): free=%lu, root=%lu"
2494 + "rcu_free_dl_info(%p)"
2495 + 4 10 "alloc_dl_info(%p,%d) = %p"
2496 + "dealloc_dl_info(%p)"
2497 + "get_dl_info(%p[#%d.%d])"
2498 + "put_dl_info(%p[#%d.%d])"
2499 + 5 20 "alloc_dl_info(%p,%d)*"
2500 + 6 40 "__hash_dl_info: %p[#%d]"
2501 + "__unhash_dl_info: %p[#%d]"
2502 + 7 80 "locate_dl_info(%p,#%d) = %p"
2506 + 0 1 "destroy_dqhash: %p [#0x%08x] c=%d"
2507 + "new_dqhash: %p [#0x%08x]"
2508 + "vroot[%d]_clr_dev: dev=%p[%lu,%d:%d]"
2509 + "vroot[%d]_get_real_bdev: dev=%p[%lu,%d:%d]"
2510 + "vroot[%d]_set_dev: dev=%p[%lu,%d:%d]"
2511 + "vroot_get_real_bdev not set"
2512 + 1 2 "cow_break_link(»%s«)"
2513 + "temp copy »%s«"
2514 + 2 4 "dentry_open(new): %p"
2515 + "dentry_open(old): %p"
2516 + "lookup_create(new): %p"
2518 + "path_lookup(old): %d"
2519 + "vfs_create(new): %d"
2521 + "vfs_sendfile: %d"
2522 + 3 8 "fput(new_file=%p[#%d])"
2523 + "fput(old_file=%p[#%d])"
2524 + 4 10 "vx_info_kill(%p[#%d],%d,%d) = %d"
2525 + "vx_info_kill(%p[#%d],%d,%d)*"
2526 + 5 20 "vs_reboot(%p[#%d],%d)"
2527 + 6 40 "dropping task %p[#%u,%u] for %p[#%u,%u]"
2531 + 2 4 "nx_addr_conflict(%p,%p) %d.%d,%d.%d"
2532 + 3 8 "inet_bind(%p) %d.%d.%d.%d, %d.%d.%d.%d, %d.%d.%d.%d"
2533 + "inet_bind(%p)* %p,%p;%lx %d.%d.%d.%d"
2534 + 4 10 "ip_route_connect(%p) %p,%p;%lx"
2535 + 5 20 "__addr_in_socket(%p,%d.%d.%d.%d) %p:%d.%d.%d.%d %p;%lx"
2536 + 6 40 "sk,egf: %p [#%d] (from %d)"
2537 + "sk,egn: %p [#%d] (from %d)"
2538 + "sk,req: %p [#%d] (from %d)"
2539 + "sk: %p [#%d] (from %d)"
2540 + "tw: %p [#%d] (from %d)"
2541 + 7 80 "__sock_recvmsg: %p[%p,%p,%p;%d]:%d/%d"
2542 + "__sock_sendmsg: %p[%p,%p,%p;%d]:%d/%d"
2546 + 0 1 "__lookup_nx_info(#%u): %p[#%u]"
2547 + "alloc_nx_info(%d) = %p"
2548 + "create_nx_info(%d) (dynamic rejected)"
2549 + "create_nx_info(%d) = %p (already there)"
2550 + "create_nx_info(%d) = %p (new)"
2551 + "dealloc_nx_info(%p)"
2552 + 1 2 "alloc_nx_info(%d)*"
2553 + "create_nx_info(%d)*"
2554 + 2 4 "get_nx_info(%p[#%d.%d])"
2555 + "put_nx_info(%p[#%d.%d])"
2556 + 3 8 "claim_nx_info(%p[#%d.%d.%d]) %p"
2557 + "clr_nx_info(%p[#%d.%d])"
2558 + "init_nx_info(%p[#%d.%d])"
2559 + "release_nx_info(%p[#%d.%d.%d]) %p"
2560 + "set_nx_info(%p[#%d.%d])"
2561 + 4 10 "__hash_nx_info: %p[#%d]"
2562 + "__nx_dynamic_id: [#%d]"
2563 + "__unhash_nx_info: %p[#%d.%d.%d]"
2564 + 5 20 "moved task %p into nxi:%p[#%d]"
2565 + "nx_migrate_task(%p,%p[#%d.%d.%d])"
2566 + "task_get_nx_info(%p)"
2567 + 6 40 "nx_clear_persistent(%p[#%d])"
2571 + 0 1 "quota_sync_dqh(%p,%d) discard inode %p"
2572 + 1 2 "quota_sync_dqh(%p,%d)"
2573 + "sync_dquots(%p,%d)"
2574 + "sync_dquots_dqh(%p,%d)"
2575 + 3 8 "do_quotactl(%p,%d,cmd=%d,id=%d,%p)"
2579 + 0 1 "vc: VCMD_%02d_%d[%d], %d,%p [%d,%d,%x,%x]"
2580 + 1 2 "vc: VCMD_%02d_%d[%d] = %08lx(%ld) [%d,%d]"
2581 + 4 10 "%s: (%s %s) returned %s with %d"
2585 + 7 80 "dx_parse_tag(»%s«): %d:#%d"
2586 + "dx_propagate_tag(%p[#%lu.%d]): %d,%d"
2590 + 0 1 "__lookup_vx_info(#%u): %p[#%u]"
2591 + "alloc_vx_info(%d) = %p"
2592 + "alloc_vx_info(%d)*"
2593 + "create_vx_info(%d) (dynamic rejected)"
2594 + "create_vx_info(%d) = %p (already there)"
2595 + "create_vx_info(%d) = %p (new)"
2596 + "dealloc_vx_info(%p)"
2597 + "loc_vx_info(%d) = %p (found)"
2598 + "loc_vx_info(%d) = %p (new)"
2599 + "loc_vx_info(%d) = %p (not available)"
2600 + 1 2 "create_vx_info(%d)*"
2601 + "loc_vx_info(%d)*"
2602 + 2 4 "get_vx_info(%p[#%d.%d])"
2603 + "put_vx_info(%p[#%d.%d])"
2604 + 3 8 "claim_vx_info(%p[#%d.%d.%d]) %p"
2605 + "clr_vx_info(%p[#%d.%d])"
2606 + "init_vx_info(%p[#%d.%d])"
2607 + "release_vx_info(%p[#%d.%d.%d]) %p"
2608 + "set_vx_info(%p[#%d.%d])"
2609 + 4 10 "__hash_vx_info: %p[#%d]"
2610 + "__unhash_vx_info: %p[#%d.%d.%d]"
2611 + "__vx_dynamic_id: [#%d]"
2612 + 5 20 "enter_vx_info(%p[#%d],%p) %p[#%d,%p]"
2613 + "leave_vx_info(%p[#%d,%p]) %p[#%d,%p]"
2614 + "moved task %p into vxi:%p[#%d]"
2615 + "task_get_vx_info(%p)"
2616 + "vx_migrate_task(%p,%p[#%d.%d])"
2617 + 6 40 "vx_clear_persistent(%p[#%d])"
2618 + "vx_exit_init(%p[#%d],%p[#%d,%d,%d])"
2619 + "vx_set_init(%p[#%d],%p[#%d,%d,%d])"
2620 + "vx_set_persistent(%p[#%d])"
2621 + "vx_set_reaper(%p[#%d],%p[#%d,%d])"
2622 + 7 80 "vx_child_reaper(%p[#%u,%u]) = %p[#%u,%u]"
2627 + n 2^n "vx_acc_cres[%5d,%s,%2d]: %5d%s"
2628 + "vx_cres_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
2630 + m 2^m "vx_acc_page[%5d,%s,%2d]: %5d%s"
2631 + "vx_acc_pages[%5d,%s,%2d]: %5d += %5d"
2632 + "vx_pages_avail[%5d,%s,%2d]: %5ld > %5d + %5d"
2633 diff -NurpP --minimal linux-2.6.33.2/drivers/block/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/drivers/block/Kconfig
2634 --- linux-2.6.33.2/drivers/block/Kconfig 2010-02-25 11:51:36.000000000 +0100
2635 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/block/Kconfig 2010-02-25 12:02:16.000000000 +0100
2636 @@ -273,6 +273,13 @@ config BLK_DEV_CRYPTOLOOP
2638 source "drivers/block/drbd/Kconfig"
2640 +config BLK_DEV_VROOT
2641 + tristate "Virtual Root device support"
2642 + depends on QUOTACTL
2644 + Saying Y here will allow you to use quota/fs ioctls on a shared
2645 + partition within a virtual server without compromising security.
2648 tristate "Network block device support"
2650 diff -NurpP --minimal linux-2.6.33.2/drivers/block/loop.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/block/loop.c
2651 --- linux-2.6.33.2/drivers/block/loop.c 2009-12-03 20:02:19.000000000 +0100
2652 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/block/loop.c 2010-02-25 12:02:16.000000000 +0100
2654 #include <linux/gfp.h>
2655 #include <linux/kthread.h>
2656 #include <linux/splice.h>
2657 +#include <linux/vs_context.h>
2659 #include <asm/uaccess.h>
2661 @@ -812,6 +813,7 @@ static int loop_set_fd(struct loop_devic
2662 lo->lo_blocksize = lo_blocksize;
2663 lo->lo_device = bdev;
2664 lo->lo_flags = lo_flags;
2665 + lo->lo_xid = vx_current_xid();
2666 lo->lo_backing_file = file;
2667 lo->transfer = transfer_none;
2669 @@ -937,6 +939,7 @@ static int loop_clr_fd(struct loop_devic
2670 lo->lo_encrypt_key_size = 0;
2672 lo->lo_thread = NULL;
2674 memset(lo->lo_encrypt_key, 0, LO_KEY_SIZE);
2675 memset(lo->lo_crypt_name, 0, LO_NAME_SIZE);
2676 memset(lo->lo_file_name, 0, LO_NAME_SIZE);
2677 @@ -971,7 +974,7 @@ loop_set_status(struct loop_device *lo,
2679 if (lo->lo_encrypt_key_size &&
2680 lo->lo_key_owner != uid &&
2681 - !capable(CAP_SYS_ADMIN))
2682 + !vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_CLOOP))
2684 if (lo->lo_state != Lo_bound)
2686 @@ -1055,7 +1058,8 @@ loop_get_status(struct loop_device *lo,
2687 memcpy(info->lo_crypt_name, lo->lo_crypt_name, LO_NAME_SIZE);
2688 info->lo_encrypt_type =
2689 lo->lo_encryption ? lo->lo_encryption->number : 0;
2690 - if (lo->lo_encrypt_key_size && capable(CAP_SYS_ADMIN)) {
2691 + if (lo->lo_encrypt_key_size &&
2692 + vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_CLOOP)) {
2693 info->lo_encrypt_key_size = lo->lo_encrypt_key_size;
2694 memcpy(info->lo_encrypt_key, lo->lo_encrypt_key,
2695 lo->lo_encrypt_key_size);
2696 @@ -1399,6 +1403,9 @@ static int lo_open(struct block_device *
2698 struct loop_device *lo = bdev->bd_disk->private_data;
2700 + if (!vx_check(lo->lo_xid, VS_IDENT|VS_HOSTID|VS_ADMIN_P))
2703 mutex_lock(&lo->lo_ctl_mutex);
2705 mutex_unlock(&lo->lo_ctl_mutex);
2706 diff -NurpP --minimal linux-2.6.33.2/drivers/block/Makefile linux-2.6.33.2-vs2.3.0.36.30.4/drivers/block/Makefile
2707 --- linux-2.6.33.2/drivers/block/Makefile 2010-02-25 11:51:36.000000000 +0100
2708 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/block/Makefile 2010-02-25 12:02:16.000000000 +0100
2709 @@ -34,6 +34,7 @@ obj-$(CONFIG_VIODASD) += viodasd.o
2710 obj-$(CONFIG_BLK_DEV_SX8) += sx8.o
2711 obj-$(CONFIG_BLK_DEV_UB) += ub.o
2712 obj-$(CONFIG_BLK_DEV_HD) += hd.o
2713 +obj-$(CONFIG_BLK_DEV_VROOT) += vroot.o
2715 obj-$(CONFIG_XEN_BLKDEV_FRONTEND) += xen-blkfront.o
2716 obj-$(CONFIG_BLK_DEV_DRBD) += drbd/
2717 diff -NurpP --minimal linux-2.6.33.2/drivers/block/vroot.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/block/vroot.c
2718 --- linux-2.6.33.2/drivers/block/vroot.c 1970-01-01 01:00:00.000000000 +0100
2719 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/block/vroot.c 2010-02-25 12:02:16.000000000 +0100
2722 + * linux/drivers/block/vroot.c
2724 + * written by Herbert Pötzl, 9/11/2002
2725 + * ported to 2.6.10 by Herbert Pötzl, 30/12/2004
2727 + * based on the loop.c code by Theodore Ts'o.
2729 + * Copyright (C) 2002-2007 by Herbert Pötzl.
2730 + * Redistribution of this file is permitted under the
2731 + * GNU General Public License.
2735 +#include <linux/module.h>
2736 +#include <linux/moduleparam.h>
2737 +#include <linux/file.h>
2738 +#include <linux/major.h>
2739 +#include <linux/blkdev.h>
2741 +#include <linux/vroot.h>
2742 +#include <linux/vs_context.h>
2745 +static int max_vroot = 8;
2747 +static struct vroot_device *vroot_dev;
2748 +static struct gendisk **disks;
2751 +static int vroot_set_dev(
2752 + struct vroot_device *vr,
2753 + struct block_device *bdev,
2756 + struct block_device *real_bdev;
2757 + struct file *file;
2758 + struct inode *inode;
2762 + if (vr->vr_state != Vr_unbound)
2771 + inode = file->f_dentry->d_inode;
2774 + if (S_ISBLK(inode->i_mode)) {
2775 + real_bdev = inode->i_bdev;
2776 + vr->vr_device = real_bdev;
2777 + __iget(real_bdev->bd_inode);
2781 + vxdprintk(VXD_CBIT(misc, 0),
2782 + "vroot[%d]_set_dev: dev=" VXF_DEV,
2783 + vr->vr_number, VXD_DEV(real_bdev));
2785 + vr->vr_state = Vr_bound;
2794 +static int vroot_clr_dev(
2795 + struct vroot_device *vr,
2796 + struct block_device *bdev)
2798 + struct block_device *real_bdev;
2800 + if (vr->vr_state != Vr_bound)
2802 + if (vr->vr_refcnt > 1) /* we needed one fd for the ioctl */
2805 + real_bdev = vr->vr_device;
2807 + vxdprintk(VXD_CBIT(misc, 0),
2808 + "vroot[%d]_clr_dev: dev=" VXF_DEV,
2809 + vr->vr_number, VXD_DEV(real_bdev));
2812 + vr->vr_state = Vr_unbound;
2813 + vr->vr_device = NULL;
2818 +static int vr_ioctl(struct block_device *bdev, fmode_t mode,
2819 + unsigned int cmd, unsigned long arg)
2821 + struct vroot_device *vr = bdev->bd_disk->private_data;
2824 + down(&vr->vr_ctl_mutex);
2826 + case VROOT_SET_DEV:
2827 + err = vroot_set_dev(vr, bdev, arg);
2829 + case VROOT_CLR_DEV:
2830 + err = vroot_clr_dev(vr, bdev);
2836 + up(&vr->vr_ctl_mutex);
2840 +static int vr_open(struct block_device *bdev, fmode_t mode)
2842 + struct vroot_device *vr = bdev->bd_disk->private_data;
2844 + down(&vr->vr_ctl_mutex);
2846 + up(&vr->vr_ctl_mutex);
2850 +static int vr_release(struct gendisk *disk, fmode_t mode)
2852 + struct vroot_device *vr = disk->private_data;
2854 + down(&vr->vr_ctl_mutex);
2856 + up(&vr->vr_ctl_mutex);
2860 +static struct block_device_operations vr_fops = {
2861 + .owner = THIS_MODULE,
2863 + .release = vr_release,
2864 + .ioctl = vr_ioctl,
2867 +struct block_device *__vroot_get_real_bdev(struct block_device *bdev)
2869 + struct inode *inode = bdev->bd_inode;
2870 + struct vroot_device *vr;
2871 + struct block_device *real_bdev;
2872 + int minor = iminor(inode);
2874 + vr = &vroot_dev[minor];
2875 + real_bdev = vr->vr_device;
2877 + vxdprintk(VXD_CBIT(misc, 0),
2878 + "vroot[%d]_get_real_bdev: dev=" VXF_DEV,
2879 + vr->vr_number, VXD_DEV(real_bdev));
2881 + if (vr->vr_state != Vr_bound)
2882 + return ERR_PTR(-ENXIO);
2884 + __iget(real_bdev->bd_inode);
2889 + * And now the modules code and kernel interface.
2892 +module_param(max_vroot, int, 0);
2894 +MODULE_PARM_DESC(max_vroot, "Maximum number of vroot devices (1-256)");
2895 +MODULE_LICENSE("GPL");
2896 +MODULE_ALIAS_BLOCKDEV_MAJOR(VROOT_MAJOR);
2898 +MODULE_AUTHOR ("Herbert Pötzl");
2899 +MODULE_DESCRIPTION ("Virtual Root Device Mapper");
2902 +int __init vroot_init(void)
2906 + if (max_vroot < 1 || max_vroot > 256) {
2907 + max_vroot = MAX_VROOT_DEFAULT;
2908 + printk(KERN_WARNING "vroot: invalid max_vroot "
2909 + "(must be between 1 and 256), "
2910 + "using default (%d)\n", max_vroot);
2913 + if (register_blkdev(VROOT_MAJOR, "vroot"))
2917 + vroot_dev = kmalloc(max_vroot * sizeof(struct vroot_device), GFP_KERNEL);
2920 + memset(vroot_dev, 0, max_vroot * sizeof(struct vroot_device));
2922 + disks = kmalloc(max_vroot * sizeof(struct gendisk *), GFP_KERNEL);
2926 + for (i = 0; i < max_vroot; i++) {
2927 + disks[i] = alloc_disk(1);
2930 + disks[i]->queue = blk_alloc_queue(GFP_KERNEL);
2931 + if (!disks[i]->queue)
2935 + for (i = 0; i < max_vroot; i++) {
2936 + struct vroot_device *vr = &vroot_dev[i];
2937 + struct gendisk *disk = disks[i];
2939 + memset(vr, 0, sizeof(*vr));
2940 + init_MUTEX(&vr->vr_ctl_mutex);
2941 + vr->vr_number = i;
2942 + disk->major = VROOT_MAJOR;
2943 + disk->first_minor = i;
2944 + disk->fops = &vr_fops;
2945 + sprintf(disk->disk_name, "vroot%d", i);
2946 + disk->private_data = vr;
2949 + err = register_vroot_grb(&__vroot_get_real_bdev);
2953 + for (i = 0; i < max_vroot; i++)
2954 + add_disk(disks[i]);
2955 + printk(KERN_INFO "vroot: loaded (max %d devices)\n", max_vroot);
2960 + put_disk(disks[i]);
2965 + unregister_blkdev(VROOT_MAJOR, "vroot");
2966 + printk(KERN_ERR "vroot: ran out of memory\n");
2970 +void vroot_exit(void)
2974 + if (unregister_vroot_grb(&__vroot_get_real_bdev))
2975 + printk(KERN_WARNING "vroot: cannot unregister grb\n");
2977 + for (i = 0; i < max_vroot; i++) {
2978 + del_gendisk(disks[i]);
2979 + put_disk(disks[i]);
2981 + unregister_blkdev(VROOT_MAJOR, "vroot");
2987 +module_init(vroot_init);
2988 +module_exit(vroot_exit);
2992 +static int __init max_vroot_setup(char *str)
2994 + max_vroot = simple_strtol(str, NULL, 0);
2998 +__setup("max_vroot=", max_vroot_setup);
3002 diff -NurpP --minimal linux-2.6.33.2/drivers/char/sysrq.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/char/sysrq.c
3003 --- linux-2.6.33.2/drivers/char/sysrq.c 2010-02-25 11:51:37.000000000 +0100
3004 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/char/sysrq.c 2010-02-25 12:02:16.000000000 +0100
3006 #include <linux/workqueue.h>
3007 #include <linux/hrtimer.h>
3008 #include <linux/oom.h>
3009 +#include <linux/vserver/debug.h>
3011 #include <asm/ptrace.h>
3012 #include <asm/irq_regs.h>
3013 @@ -391,6 +392,21 @@ static struct sysrq_key_op sysrq_unrt_op
3014 .enable_mask = SYSRQ_ENABLE_RTNICE,
3018 +#ifdef CONFIG_VSERVER_DEBUG
3019 +static void sysrq_handle_vxinfo(int key, struct tty_struct *tty)
3021 + dump_vx_info_inactive((key == 'x')?0:1);
3024 +static struct sysrq_key_op sysrq_showvxinfo_op = {
3025 + .handler = sysrq_handle_vxinfo,
3026 + .help_msg = "conteXt",
3027 + .action_msg = "Show Context Info",
3028 + .enable_mask = SYSRQ_ENABLE_DUMP,
3032 /* Key Operations table and lock */
3033 static DEFINE_SPINLOCK(sysrq_key_table_lock);
3035 @@ -445,7 +461,11 @@ static struct sysrq_key_op *sysrq_key_ta
3037 &sysrq_showstate_blocked_op, /* w */
3038 /* x: May be registered on ppc/powerpc for xmon */
3039 +#ifdef CONFIG_VSERVER_DEBUG
3040 + &sysrq_showvxinfo_op, /* x */
3044 /* y: May be registered on sparc64 for global register dump */
3046 &sysrq_ftrace_dump_op, /* z */
3047 @@ -460,6 +480,8 @@ static int sysrq_key_table_key2index(int
3049 else if ((key >= 'a') && (key <= 'z'))
3050 retval = key + 10 - 'a';
3051 + else if ((key >= 'A') && (key <= 'Z'))
3052 + retval = key + 10 - 'A';
3056 diff -NurpP --minimal linux-2.6.33.2/drivers/char/tty_io.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/char/tty_io.c
3057 --- linux-2.6.33.2/drivers/char/tty_io.c 2010-02-25 11:51:37.000000000 +0100
3058 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/char/tty_io.c 2010-02-25 12:02:16.000000000 +0100
3061 #include <linux/kmod.h>
3062 #include <linux/nsproxy.h>
3063 +#include <linux/vs_pid.h>
3065 #undef TTY_DEBUG_HANGUP
3067 @@ -1989,7 +1990,8 @@ static int tiocsti(struct tty_struct *tt
3069 struct tty_ldisc *ld;
3071 - if ((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN))
3072 + if (((current->signal->tty != tty) && !capable(CAP_SYS_ADMIN)) ||
3073 + !vx_ccaps(VXC_TIOCSTI))
3075 if (get_user(ch, p))
3077 @@ -2277,6 +2279,7 @@ static int tiocspgrp(struct tty_struct *
3079 if (get_user(pgrp_nr, p))
3081 + pgrp_nr = vx_rmap_pid(pgrp_nr);
3085 diff -NurpP --minimal linux-2.6.33.2/drivers/gpu/drm/radeon/r100_reg_safe.h linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r100_reg_safe.h
3086 --- linux-2.6.33.2/drivers/gpu/drm/radeon/r100_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3087 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r100_reg_safe.h 2010-02-27 15:52:40.000000000 +0100
3089 +static const unsigned r100_reg_safe_bm[102] = {
3090 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3091 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3092 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3093 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3094 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3095 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3096 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3097 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3098 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3099 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3100 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3101 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3102 + 0xFFFFFFCF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3103 + 0xFFFFFF9F, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3104 + 0x38E7FE1F, 0xFFC3FF8E, 0x7FF8FFFF, 0xFFFF803C,
3105 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3106 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFEFFFF, 0xFFFFFFFF,
3107 + 0x00000000, 0xFFFFFFFD, 0xFFFFFFFF, 0xFFFFFFFF,
3108 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3109 + 0xFFFFFFFF, 0xFFFCFFFF, 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, 0xFFFFFFEF,
3117 diff -NurpP --minimal linux-2.6.33.2/drivers/gpu/drm/radeon/r200_reg_safe.h linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r200_reg_safe.h
3118 --- linux-2.6.33.2/drivers/gpu/drm/radeon/r200_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3119 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r200_reg_safe.h 2010-02-27 15:52:44.000000000 +0100
3121 +static const unsigned r200_reg_safe_bm[102] = {
3122 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3123 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3124 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3125 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3126 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3127 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3128 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3129 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3130 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3131 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3132 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3133 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3134 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3135 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3136 + 0xFFE7FE1F, 0xF003FFFF, 0x7EFFFFFF, 0xFFFF803C,
3137 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3138 + 0xFFFFFFFF, 0xFFFFEFCE, 0xFFFEFFFF, 0xFFFFFFFE,
3139 + 0x020E0FF0, 0xFFCC83FD, 0xFFFFFFFF, 0xFFFFFFFF,
3140 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3141 + 0xFFFBFFFF, 0xEFFCFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3142 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3143 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3144 + 0xDFDFDFDF, 0x3FFDDFDF, 0xFFFFFFFF, 0xFFFFFF7F,
3145 + 0xFFFFFFFF, 0x00FFFFFF, 0x00000000, 0x00000000,
3146 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3147 + 0xFFFFFE3F, 0xFFFFFFEF,
3149 diff -NurpP --minimal linux-2.6.33.2/drivers/gpu/drm/radeon/r300_reg_safe.h linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r300_reg_safe.h
3150 --- linux-2.6.33.2/drivers/gpu/drm/radeon/r300_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3151 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r300_reg_safe.h 2010-02-27 15:52:41.000000000 +0100
3153 +static const unsigned r300_reg_safe_bm[159] = {
3154 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
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 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3165 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3166 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3167 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3168 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3169 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3170 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3171 + 0xF0000078, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3172 + 0xFFFFFFFF, 0xFFFFFFFF, 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 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3181 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3182 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3183 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3184 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3185 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3186 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3187 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3188 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3189 + 0x00000000, 0x0000C100, 0x00000000, 0x00000000,
3190 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3191 + 0x00000000, 0xFFFF0000, 0xFFFFFFFF, 0xFF80FFFF,
3192 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3193 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19,
3195 diff -NurpP --minimal linux-2.6.33.2/drivers/gpu/drm/radeon/r420_reg_safe.h linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r420_reg_safe.h
3196 --- linux-2.6.33.2/drivers/gpu/drm/radeon/r420_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3197 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r420_reg_safe.h 2010-02-27 15:52:41.000000000 +0100
3199 +static const unsigned r420_reg_safe_bm[159] = {
3200 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3201 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3202 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3203 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3204 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3205 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3206 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3207 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3208 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3209 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3210 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3211 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3212 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3213 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3214 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3215 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3216 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3217 + 0xF0000078, 0xFF000009, 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 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3227 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3228 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3229 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3230 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3231 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3232 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3233 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3234 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3235 + 0x00000000, 0x00000100, 0x00000000, 0x00000000,
3236 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3237 + 0x00000000, 0x00000000, 0x00000000, 0xFF800000,
3238 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3239 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19,
3241 diff -NurpP --minimal linux-2.6.33.2/drivers/gpu/drm/radeon/rn50_reg_safe.h linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rn50_reg_safe.h
3242 --- linux-2.6.33.2/drivers/gpu/drm/radeon/rn50_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3243 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rn50_reg_safe.h 2010-02-27 15:52:40.000000000 +0100
3245 +static const unsigned rn50_reg_safe_bm[102] = {
3246 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3247 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3248 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3249 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3250 + 0xFFFFFFFF, 0xFFFFFFFF, 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 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3257 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3258 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3259 + 0xFFFFFFFF, 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 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3266 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3267 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3268 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3269 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3270 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3271 + 0xFFFFFFFF, 0xFFFFFFFF,
3273 diff -NurpP --minimal linux-2.6.33.2/drivers/gpu/drm/radeon/rs600_reg_safe.h linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rs600_reg_safe.h
3274 --- linux-2.6.33.2/drivers/gpu/drm/radeon/rs600_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3275 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rs600_reg_safe.h 2010-02-27 15:52:42.000000000 +0100
3277 +static const unsigned rs600_reg_safe_bm[219] = {
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, 0xFFFFFFFF,
3288 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3289 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3290 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3291 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3292 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3293 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3294 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3295 + 0xF0000078, 0xFF000009, 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 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3305 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3306 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3307 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3308 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3309 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3310 + 0xFFFFFC78, 0xFFFFFFFF, 0xFFFFFFFE, 0xFFFFFFFF,
3311 + 0x38FF8F50, 0xFFF88082, 0xF000000C, 0xFAE009FF,
3312 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3313 + 0x00000000, 0x00000100, 0x00000000, 0x00000000,
3314 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3315 + 0x00000000, 0x00000000, 0x00000000, 0xFF800000,
3316 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3317 + 0x0003FC01, 0xFFFFFCF8, 0xFF800B19, 0xFFFFFFFF,
3318 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3319 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3320 + 0xFFFFFFFF, 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 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3327 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3328 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3329 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3330 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3331 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3332 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3334 diff -NurpP --minimal linux-2.6.33.2/drivers/gpu/drm/radeon/rv515_reg_safe.h linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rv515_reg_safe.h
3335 --- linux-2.6.33.2/drivers/gpu/drm/radeon/rv515_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3336 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rv515_reg_safe.h 2010-02-27 15:52:42.000000000 +0100
3338 +static const unsigned rv515_reg_safe_bm[219] = {
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, 0xFFFFFFFF,
3349 + 0x17FF1FFF, 0xFFFFFFFC, 0xFFFFFFFF, 0xFF30FFBF,
3350 + 0xFFFFFFF8, 0xC3E6FFFF, 0xFFFFF6DF, 0xFFFFFFFF,
3351 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3352 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3353 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFF03F,
3354 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3355 + 0xFFFFFFFF, 0xFFFFEFCE, 0xF00EBFFF, 0x007C0000,
3356 + 0xF0000038, 0xFF000009, 0xFFFFFFFF, 0xFFFFFFFF,
3357 + 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFF,
3358 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3359 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3360 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3361 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3362 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3363 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3364 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3365 + 0xFFFFF7FF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3366 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3367 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3368 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3369 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3370 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3371 + 0x1FFFF878, 0xFFFFE000, 0xFFFFFE1E, 0xFFFFFFFF,
3372 + 0x388F8F50, 0xFFF88082, 0xFF0000FC, 0xFAE009FF,
3373 + 0x0000FFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000,
3374 + 0xFFFF8CFC, 0xFFFFC1FF, 0xFFFFFFFF, 0xFFFFFFFF,
3375 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3376 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFF80FFFF,
3377 + 0x00000000, 0x00000000, 0x00000000, 0x00000000,
3378 + 0x0003FC01, 0x3FFFFCF8, 0xFF800B19, 0xFFDFFFFF,
3379 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3380 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3381 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3382 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3383 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3384 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3385 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3386 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3387 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3388 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3389 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3390 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3391 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3392 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3393 + 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
3395 diff -NurpP --minimal linux-2.6.33.2/drivers/infiniband/core/addr.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/infiniband/core/addr.c
3396 --- linux-2.6.33.2/drivers/infiniband/core/addr.c 2010-02-25 11:51:39.000000000 +0100
3397 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/infiniband/core/addr.c 2010-02-26 10:39:59.000000000 +0100
3398 @@ -251,7 +251,7 @@ static int addr6_resolve(struct sockaddr
3400 if (ipv6_addr_any(&fl.fl6_src)) {
3401 ret = ipv6_dev_get_saddr(&init_net, ip6_dst_idev(dst)->dev,
3402 - &fl.fl6_dst, 0, &fl.fl6_src);
3403 + &fl.fl6_dst, 0, &fl.fl6_src, NULL);
3407 diff -NurpP --minimal linux-2.6.33.2/drivers/infiniband/hw/ipath/ipath_user_pages.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/infiniband/hw/ipath/ipath_user_pages.c
3408 --- linux-2.6.33.2/drivers/infiniband/hw/ipath/ipath_user_pages.c 2009-12-03 20:02:23.000000000 +0100
3409 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/infiniband/hw/ipath/ipath_user_pages.c 2010-02-25 12:02:16.000000000 +0100
3411 #include <linux/mm.h>
3412 #include <linux/device.h>
3413 #include <linux/sched.h>
3414 +#include <linux/vs_memory.h>
3416 #include "ipath_kernel.h"
3418 @@ -62,7 +63,8 @@ static int __get_user_pages(unsigned lon
3419 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >>
3422 - if (num_pages > lock_limit) {
3423 + if (num_pages > lock_limit ||
3424 + !vx_vmlocked_avail(current->mm, num_pages)) {
3428 @@ -79,7 +81,7 @@ static int __get_user_pages(unsigned lon
3432 - current->mm->locked_vm += num_pages;
3433 + vx_vmlocked_add(current->mm, num_pages);
3437 @@ -178,7 +180,7 @@ void ipath_release_user_pages(struct pag
3439 __ipath_release_user_pages(p, num_pages, 1);
3441 - current->mm->locked_vm -= num_pages;
3442 + vx_vmlocked_sub(current->mm, num_pages);
3444 up_write(¤t->mm->mmap_sem);
3446 @@ -195,7 +197,7 @@ static void user_pages_account(struct wo
3447 container_of(_work, struct ipath_user_pages_work, work);
3449 down_write(&work->mm->mmap_sem);
3450 - work->mm->locked_vm -= work->num_pages;
3451 + vx_vmlocked_sub(work->mm, work->num_pages);
3452 up_write(&work->mm->mmap_sem);
3455 diff -NurpP --minimal linux-2.6.33.2/drivers/md/dm.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/md/dm.c
3456 --- linux-2.6.33.2/drivers/md/dm.c 2010-04-06 01:47:45.000000000 +0200
3457 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/md/dm.c 2010-04-06 01:59:25.000000000 +0200
3459 #include <linux/slab.h>
3460 #include <linux/idr.h>
3461 #include <linux/hdreg.h>
3462 +#include <linux/vs_base.h>
3464 #include <trace/events/block.h>
3466 @@ -119,6 +120,7 @@ struct mapped_device {
3469 atomic_t open_count;
3472 unsigned long flags;
3474 @@ -337,6 +339,7 @@ int dm_deleting_md(struct mapped_device
3475 static int dm_blk_open(struct block_device *bdev, fmode_t mode)
3477 struct mapped_device *md;
3480 spin_lock(&_minor_lock);
3482 @@ -345,18 +348,19 @@ static int dm_blk_open(struct block_devi
3485 if (test_bit(DMF_FREEING, &md->flags) ||
3486 - dm_deleting_md(md)) {
3488 + dm_deleting_md(md))
3492 + if (!vx_check(md->xid, VS_IDENT|VS_HOSTID))
3497 atomic_inc(&md->open_count);
3501 spin_unlock(&_minor_lock);
3503 - return md ? 0 : -ENXIO;
3507 static int dm_blk_close(struct gendisk *disk, fmode_t mode)
3508 @@ -574,6 +578,14 @@ int dm_set_geometry(struct mapped_device
3513 + * Get the xid associated with a dm device
3515 +xid_t dm_get_xid(struct mapped_device *md)
3520 /*-----------------------------------------------------------------
3522 * A more elegant soln is in the works that uses the queue
3523 @@ -1886,6 +1898,7 @@ static struct mapped_device *alloc_dev(i
3524 INIT_LIST_HEAD(&md->uevent_list);
3525 spin_lock_init(&md->uevent_lock);
3527 + md->xid = vx_current_xid();
3528 md->queue = blk_init_queue(dm_request_fn, NULL);
3531 diff -NurpP --minimal linux-2.6.33.2/drivers/md/dm.h linux-2.6.33.2-vs2.3.0.36.30.4/drivers/md/dm.h
3532 --- linux-2.6.33.2/drivers/md/dm.h 2010-02-25 11:51:41.000000000 +0100
3533 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/md/dm.h 2010-02-25 12:02:16.000000000 +0100
3534 @@ -41,6 +41,8 @@ struct dm_dev_internal {
3536 struct dm_md_mempools;
3538 +xid_t dm_get_xid(struct mapped_device *md);
3540 /*-----------------------------------------------------------------
3541 * Internal table functions.
3542 *---------------------------------------------------------------*/
3543 diff -NurpP --minimal linux-2.6.33.2/drivers/md/dm-ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/md/dm-ioctl.c
3544 --- linux-2.6.33.2/drivers/md/dm-ioctl.c 2010-04-06 01:47:45.000000000 +0200
3545 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/md/dm-ioctl.c 2010-04-06 01:59:25.000000000 +0200
3547 #include <linux/dm-ioctl.h>
3548 #include <linux/hdreg.h>
3549 #include <linux/compat.h>
3550 +#include <linux/vs_context.h>
3552 #include <asm/uaccess.h>
3554 @@ -106,7 +107,8 @@ static struct hash_cell *__get_name_cell
3555 unsigned int h = hash_str(str);
3557 list_for_each_entry (hc, _name_buckets + h, name_list)
3558 - if (!strcmp(hc->name, str)) {
3559 + if (vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT) &&
3560 + !strcmp(hc->name, str)) {
3564 @@ -120,7 +122,8 @@ static struct hash_cell *__get_uuid_cell
3565 unsigned int h = hash_str(str);
3567 list_for_each_entry (hc, _uuid_buckets + h, uuid_list)
3568 - if (!strcmp(hc->uuid, str)) {
3569 + if (vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT) &&
3570 + !strcmp(hc->uuid, str)) {
3574 @@ -363,6 +366,9 @@ typedef int (*ioctl_fn)(struct dm_ioctl
3576 static int remove_all(struct dm_ioctl *param, size_t param_size)
3578 + if (!vx_check(0, VS_ADMIN))
3581 dm_hash_remove_all(1);
3582 param->data_size = 0;
3584 @@ -410,6 +416,8 @@ static int list_devices(struct dm_ioctl
3586 for (i = 0; i < NUM_BUCKETS; i++) {
3587 list_for_each_entry (hc, _name_buckets + i, name_list) {
3588 + if (!vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT))
3590 needed += sizeof(struct dm_name_list);
3591 needed += strlen(hc->name) + 1;
3592 needed += ALIGN_MASK;
3593 @@ -433,6 +441,8 @@ static int list_devices(struct dm_ioctl
3595 for (i = 0; i < NUM_BUCKETS; i++) {
3596 list_for_each_entry (hc, _name_buckets + i, name_list) {
3597 + if (!vx_check(dm_get_xid(hc->md), VS_WATCH_P | VS_IDENT))
3600 old_nl->next = (uint32_t) ((void *) nl -
3602 @@ -667,10 +677,11 @@ static struct hash_cell *__find_device_h
3606 - mdptr = dm_get_mdptr(md);
3607 + if (vx_check(dm_get_xid(md), VS_WATCH_P | VS_IDENT))
3608 + mdptr = dm_get_mdptr(md);
3616 @@ -1509,8 +1520,8 @@ static int ctl_ioctl(uint command, struc
3620 - /* only root can play with this */
3621 - if (!capable(CAP_SYS_ADMIN))
3622 + /* only root and certain contexts can play with this */
3623 + if (!vx_capable(CAP_SYS_ADMIN, VXC_ADMIN_MAPPER))
3626 if (_IOC_TYPE(command) != DM_IOCTL)
3627 diff -NurpP --minimal linux-2.6.33.2/drivers/net/tun.c linux-2.6.33.2-vs2.3.0.36.30.4/drivers/net/tun.c
3628 --- linux-2.6.33.2/drivers/net/tun.c 2010-02-25 11:51:53.000000000 +0100
3629 +++ linux-2.6.33.2-vs2.3.0.36.30.4/drivers/net/tun.c 2010-02-25 12:02:16.000000000 +0100
3631 #include <linux/crc32.h>
3632 #include <linux/nsproxy.h>
3633 #include <linux/virtio_net.h>
3634 +#include <linux/vs_network.h>
3635 #include <net/net_namespace.h>
3636 #include <net/netns/generic.h>
3637 #include <net/rtnetlink.h>
3638 @@ -102,6 +103,7 @@ struct tun_struct {
3644 struct net_device *dev;
3645 struct fasync_struct *fasync;
3646 @@ -816,6 +818,7 @@ static void tun_setup(struct net_device
3650 + tun->nid = current->nid;
3652 dev->ethtool_ops = &tun_ethtool_ops;
3653 dev->destructor = tun_free_netdev;
3654 @@ -932,7 +935,7 @@ static int tun_set_iff(struct net *net,
3656 if (((tun->owner != -1 && cred->euid != tun->owner) ||
3657 (tun->group != -1 && !in_egroup_p(tun->group))) &&
3658 - !capable(CAP_NET_ADMIN))
3659 + !cap_raised(current_cap(), CAP_NET_ADMIN))
3661 err = security_tun_dev_attach(tun->socket.sk);
3663 @@ -946,7 +949,7 @@ static int tun_set_iff(struct net *net,
3665 unsigned long flags = 0;
3667 - if (!capable(CAP_NET_ADMIN))
3668 + if (!nx_capable(CAP_NET_ADMIN, NXC_TUN_CREATE))
3670 err = security_tun_dev_create();
3672 @@ -1013,6 +1016,9 @@ static int tun_set_iff(struct net *net,
3674 sk->sk_destruct = tun_sock_destruct;
3676 + if (!nx_check(tun->nid, VS_IDENT | VS_HOSTID | VS_ADMIN_P))
3679 err = tun_attach(tun, file);
3682 @@ -1202,6 +1208,16 @@ static long __tun_chr_ioctl(struct file
3683 DBG(KERN_INFO "%s: group set to %d\n", tun->dev->name, tun->group);
3687 + if (!capable(CAP_CONTEXT))
3690 + /* Set nid owner of the device */
3691 + tun->nid = (nid_t) arg;
3693 + DBG(KERN_INFO "%s: nid owner set to %u\n", tun->dev->name, tun->nid);
3697 /* Only allow setting the type when the interface is down */
3698 if (tun->dev->flags & IFF_UP) {
3699 diff -NurpP --minimal linux-2.6.33.2/fs/attr.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/attr.c
3700 --- linux-2.6.33.2/fs/attr.c 2009-12-03 20:02:51.000000000 +0100
3701 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/attr.c 2010-02-25 12:02:16.000000000 +0100
3703 #include <linux/fcntl.h>
3704 #include <linux/quotaops.h>
3705 #include <linux/security.h>
3706 +#include <linux/proc_fs.h>
3707 +#include <linux/devpts_fs.h>
3708 +#include <linux/vs_tag.h>
3710 /* Taken over from the old code... */
3712 @@ -55,6 +58,10 @@ int inode_change_ok(const struct inode *
3713 if (!is_owner_or_cap(inode))
3717 + if (dx_permission(inode, MAY_WRITE))
3723 @@ -120,6 +127,8 @@ int inode_setattr(struct inode * inode,
3724 inode->i_uid = attr->ia_uid;
3725 if (ia_valid & ATTR_GID)
3726 inode->i_gid = attr->ia_gid;
3727 + if ((ia_valid & ATTR_TAG) && IS_TAGGED(inode))
3728 + inode->i_tag = attr->ia_tag;
3729 if (ia_valid & ATTR_ATIME)
3730 inode->i_atime = timespec_trunc(attr->ia_atime,
3731 inode->i_sb->s_time_gran);
3732 @@ -214,7 +223,8 @@ int notify_change(struct dentry * dentry
3733 error = inode_change_ok(inode, attr);
3735 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
3736 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid))
3737 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
3738 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag))
3739 error = vfs_dq_transfer(inode, attr) ?
3742 diff -NurpP --minimal linux-2.6.33.2/fs/binfmt_aout.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/binfmt_aout.c
3743 --- linux-2.6.33.2/fs/binfmt_aout.c 2010-02-25 11:52:04.000000000 +0100
3744 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/binfmt_aout.c 2010-02-25 12:02:16.000000000 +0100
3746 #include <linux/binfmts.h>
3747 #include <linux/personality.h>
3748 #include <linux/init.h>
3749 +#include <linux/vs_memory.h>
3751 #include <asm/system.h>
3752 #include <asm/uaccess.h>
3753 diff -NurpP --minimal linux-2.6.33.2/fs/binfmt_elf.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/binfmt_elf.c
3754 --- linux-2.6.33.2/fs/binfmt_elf.c 2010-02-25 11:52:04.000000000 +0100
3755 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/binfmt_elf.c 2010-02-25 12:02:16.000000000 +0100
3757 #include <linux/random.h>
3758 #include <linux/elf.h>
3759 #include <linux/utsname.h>
3760 +#include <linux/vs_memory.h>
3761 #include <asm/uaccess.h>
3762 #include <asm/param.h>
3763 #include <asm/page.h>
3764 diff -NurpP --minimal linux-2.6.33.2/fs/binfmt_flat.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/binfmt_flat.c
3765 --- linux-2.6.33.2/fs/binfmt_flat.c 2010-02-25 11:52:04.000000000 +0100
3766 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/binfmt_flat.c 2010-02-25 12:02:16.000000000 +0100
3768 #include <linux/init.h>
3769 #include <linux/flat.h>
3770 #include <linux/syscalls.h>
3771 +#include <linux/vs_memory.h>
3773 #include <asm/byteorder.h>
3774 #include <asm/system.h>
3775 diff -NurpP --minimal linux-2.6.33.2/fs/binfmt_som.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/binfmt_som.c
3776 --- linux-2.6.33.2/fs/binfmt_som.c 2010-02-25 11:52:04.000000000 +0100
3777 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/binfmt_som.c 2010-02-25 12:02:16.000000000 +0100
3779 #include <linux/shm.h>
3780 #include <linux/personality.h>
3781 #include <linux/init.h>
3782 +#include <linux/vs_memory.h>
3784 #include <asm/uaccess.h>
3785 #include <asm/pgtable.h>
3786 diff -NurpP --minimal linux-2.6.33.2/fs/block_dev.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/block_dev.c
3787 --- linux-2.6.33.2/fs/block_dev.c 2010-02-25 11:52:04.000000000 +0100
3788 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/block_dev.c 2010-02-25 12:02:16.000000000 +0100
3790 #include <linux/namei.h>
3791 #include <linux/log2.h>
3792 #include <linux/kmemleak.h>
3793 +#include <linux/vs_device.h>
3794 #include <asm/uaccess.h>
3795 #include "internal.h"
3797 @@ -566,6 +567,7 @@ struct block_device *bdget(dev_t dev)
3798 bdev->bd_invalidated = 0;
3799 inode->i_mode = S_IFBLK;
3800 inode->i_rdev = dev;
3801 + inode->i_mdev = dev;
3802 inode->i_bdev = bdev;
3803 inode->i_data.a_ops = &def_blk_aops;
3804 mapping_set_gfp_mask(&inode->i_data, GFP_USER);
3805 @@ -612,6 +614,11 @@ EXPORT_SYMBOL(bdput);
3806 static struct block_device *bd_acquire(struct inode *inode)
3808 struct block_device *bdev;
3811 + if (!vs_map_blkdev(inode->i_rdev, &mdev, DATTR_OPEN))
3813 + inode->i_mdev = mdev;
3815 spin_lock(&bdev_lock);
3816 bdev = inode->i_bdev;
3817 @@ -622,7 +629,7 @@ static struct block_device *bd_acquire(s
3819 spin_unlock(&bdev_lock);
3821 - bdev = bdget(inode->i_rdev);
3822 + bdev = bdget(mdev);
3824 spin_lock(&bdev_lock);
3825 if (!inode->i_bdev) {
3826 diff -NurpP --minimal linux-2.6.33.2/fs/btrfs/ctree.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/ctree.h
3827 --- linux-2.6.33.2/fs/btrfs/ctree.h 2010-02-25 11:52:04.000000000 +0100
3828 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/ctree.h 2010-02-25 12:02:16.000000000 +0100
3829 @@ -547,11 +547,14 @@ struct btrfs_inode_item {
3830 /* modification sequence number for NFS */
3835 * a little future expansion, for more than this we can
3836 * just grow the inode item and version it
3838 - __le64 reserved[4];
3839 + __le16 reserved16;
3840 + __le32 reserved32;
3841 + __le64 reserved[3];
3842 struct btrfs_timespec atime;
3843 struct btrfs_timespec ctime;
3844 struct btrfs_timespec mtime;
3845 @@ -1163,6 +1166,8 @@ struct btrfs_root {
3846 #define BTRFS_MOUNT_DISCARD (1 << 10)
3847 #define BTRFS_MOUNT_FORCE_COMPRESS (1 << 11)
3849 +#define BTRFS_MOUNT_TAGGED (1 << 24)
3851 #define btrfs_clear_opt(o, opt) ((o) &= ~BTRFS_MOUNT_##opt)
3852 #define btrfs_set_opt(o, opt) ((o) |= BTRFS_MOUNT_##opt)
3853 #define btrfs_test_opt(root, opt) ((root)->fs_info->mount_opt & \
3854 @@ -1182,6 +1187,10 @@ struct btrfs_root {
3855 #define BTRFS_INODE_NOATIME (1 << 9)
3856 #define BTRFS_INODE_DIRSYNC (1 << 10)
3858 +#define BTRFS_INODE_IXUNLINK (1 << 24)
3859 +#define BTRFS_INODE_BARRIER (1 << 25)
3860 +#define BTRFS_INODE_COW (1 << 26)
3863 /* some macros to generate set/get funcs for the struct fields. This
3864 * assumes there is a lefoo_to_cpu for every type, so lets make a simple
3865 @@ -1384,6 +1393,7 @@ BTRFS_SETGET_FUNCS(inode_block_group, st
3866 BTRFS_SETGET_FUNCS(inode_nlink, struct btrfs_inode_item, nlink, 32);
3867 BTRFS_SETGET_FUNCS(inode_uid, struct btrfs_inode_item, uid, 32);
3868 BTRFS_SETGET_FUNCS(inode_gid, struct btrfs_inode_item, gid, 32);
3869 +BTRFS_SETGET_FUNCS(inode_tag, struct btrfs_inode_item, tag, 16);
3870 BTRFS_SETGET_FUNCS(inode_mode, struct btrfs_inode_item, mode, 32);
3871 BTRFS_SETGET_FUNCS(inode_rdev, struct btrfs_inode_item, rdev, 64);
3872 BTRFS_SETGET_FUNCS(inode_flags, struct btrfs_inode_item, flags, 64);
3873 @@ -2357,6 +2367,7 @@ extern const struct dentry_operations bt
3874 long btrfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
3875 void btrfs_update_iflags(struct inode *inode);
3876 void btrfs_inherit_iflags(struct inode *inode, struct inode *dir);
3877 +int btrfs_sync_flags(struct inode *inode, int, int);
3880 int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync);
3881 diff -NurpP --minimal linux-2.6.33.2/fs/btrfs/disk-io.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/disk-io.c
3882 --- linux-2.6.33.2/fs/btrfs/disk-io.c 2010-02-25 11:52:04.000000000 +0100
3883 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/disk-io.c 2010-02-25 12:02:16.000000000 +0100
3884 @@ -1726,6 +1726,9 @@ struct btrfs_root *open_ctree(struct sup
3888 + if (btrfs_test_opt(tree_root, TAGGED))
3889 + sb->s_flags |= MS_TAGGED;
3891 features = btrfs_super_incompat_flags(disk_super) &
3892 ~BTRFS_FEATURE_INCOMPAT_SUPP;
3894 diff -NurpP --minimal linux-2.6.33.2/fs/btrfs/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/inode.c
3895 --- linux-2.6.33.2/fs/btrfs/inode.c 2010-02-25 11:52:04.000000000 +0100
3896 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/inode.c 2010-02-25 12:02:16.000000000 +0100
3898 #include <linux/xattr.h>
3899 #include <linux/posix_acl.h>
3900 #include <linux/falloc.h>
3901 +#include <linux/vs_tag.h>
3905 #include "disk-io.h"
3906 @@ -2264,6 +2266,8 @@ static void btrfs_read_locked_inode(stru
3908 u64 alloc_group_block;
3914 path = btrfs_alloc_path();
3915 @@ -2280,8 +2284,13 @@ static void btrfs_read_locked_inode(stru
3917 inode->i_mode = btrfs_inode_mode(leaf, inode_item);
3918 inode->i_nlink = btrfs_inode_nlink(leaf, inode_item);
3919 - inode->i_uid = btrfs_inode_uid(leaf, inode_item);
3920 - inode->i_gid = btrfs_inode_gid(leaf, inode_item);
3922 + uid = btrfs_inode_uid(leaf, inode_item);
3923 + gid = btrfs_inode_gid(leaf, inode_item);
3924 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
3925 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
3926 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
3927 + btrfs_inode_tag(leaf, inode_item));
3928 btrfs_i_size_write(inode, btrfs_inode_size(leaf, inode_item));
3930 tspec = btrfs_inode_atime(inode_item);
3931 @@ -2363,8 +2372,15 @@ static void fill_inode_item(struct btrfs
3932 struct btrfs_inode_item *item,
3933 struct inode *inode)
3935 - btrfs_set_inode_uid(leaf, item, inode->i_uid);
3936 - btrfs_set_inode_gid(leaf, item, inode->i_gid);
3937 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
3938 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
3940 + btrfs_set_inode_uid(leaf, item, uid);
3941 + btrfs_set_inode_gid(leaf, item, gid);
3942 +#ifdef CONFIG_TAGGING_INTERN
3943 + btrfs_set_inode_tag(leaf, item, inode->i_tag);
3946 btrfs_set_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size);
3947 btrfs_set_inode_mode(leaf, item, inode->i_mode);
3948 btrfs_set_inode_nlink(leaf, item, inode->i_nlink);
3949 @@ -4154,6 +4170,7 @@ static struct inode *btrfs_new_inode(str
3951 inode->i_gid = current_fsgid();
3953 + inode->i_tag = dx_current_fstag(root->fs_info->sb);
3954 inode->i_mode = mode;
3955 inode->i_ino = objectid;
3956 inode_set_bytes(inode, 0);
3957 @@ -5955,6 +5972,7 @@ static const struct inode_operations btr
3958 .listxattr = btrfs_listxattr,
3959 .removexattr = btrfs_removexattr,
3960 .permission = btrfs_permission,
3961 + .sync_flags = btrfs_sync_flags,
3963 static const struct inode_operations btrfs_dir_ro_inode_operations = {
3964 .lookup = btrfs_lookup,
3965 @@ -6030,6 +6048,7 @@ static const struct inode_operations btr
3966 .permission = btrfs_permission,
3967 .fallocate = btrfs_fallocate,
3968 .fiemap = btrfs_fiemap,
3969 + .sync_flags = btrfs_sync_flags,
3971 static const struct inode_operations btrfs_special_inode_operations = {
3972 .getattr = btrfs_getattr,
3973 diff -NurpP --minimal linux-2.6.33.2/fs/btrfs/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/ioctl.c
3974 --- linux-2.6.33.2/fs/btrfs/ioctl.c 2010-02-25 11:52:04.000000000 +0100
3975 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/ioctl.c 2010-02-25 12:02:16.000000000 +0100
3976 @@ -67,10 +67,13 @@ static unsigned int btrfs_flags_to_ioctl
3978 unsigned int iflags = 0;
3980 - if (flags & BTRFS_INODE_SYNC)
3981 - iflags |= FS_SYNC_FL;
3982 if (flags & BTRFS_INODE_IMMUTABLE)
3983 iflags |= FS_IMMUTABLE_FL;
3984 + if (flags & BTRFS_INODE_IXUNLINK)
3985 + iflags |= FS_IXUNLINK_FL;
3987 + if (flags & BTRFS_INODE_SYNC)
3988 + iflags |= FS_SYNC_FL;
3989 if (flags & BTRFS_INODE_APPEND)
3990 iflags |= FS_APPEND_FL;
3991 if (flags & BTRFS_INODE_NODUMP)
3992 @@ -80,28 +83,78 @@ static unsigned int btrfs_flags_to_ioctl
3993 if (flags & BTRFS_INODE_DIRSYNC)
3994 iflags |= FS_DIRSYNC_FL;
3996 + if (flags & BTRFS_INODE_BARRIER)
3997 + iflags |= FS_BARRIER_FL;
3998 + if (flags & BTRFS_INODE_COW)
3999 + iflags |= FS_COW_FL;
4004 - * Update inode->i_flags based on the btrfs internal flags.
4005 + * Update inode->i_(v)flags based on the btrfs internal flags.
4007 void btrfs_update_iflags(struct inode *inode)
4009 struct btrfs_inode *ip = BTRFS_I(inode);
4011 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4012 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
4013 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
4015 - if (ip->flags & BTRFS_INODE_SYNC)
4016 - inode->i_flags |= S_SYNC;
4017 if (ip->flags & BTRFS_INODE_IMMUTABLE)
4018 inode->i_flags |= S_IMMUTABLE;
4019 + if (ip->flags & BTRFS_INODE_IXUNLINK)
4020 + inode->i_flags |= S_IXUNLINK;
4022 + if (ip->flags & BTRFS_INODE_SYNC)
4023 + inode->i_flags |= S_SYNC;
4024 if (ip->flags & BTRFS_INODE_APPEND)
4025 inode->i_flags |= S_APPEND;
4026 if (ip->flags & BTRFS_INODE_NOATIME)
4027 inode->i_flags |= S_NOATIME;
4028 if (ip->flags & BTRFS_INODE_DIRSYNC)
4029 inode->i_flags |= S_DIRSYNC;
4031 + inode->i_vflags &= ~(V_BARRIER | V_COW);
4033 + if (ip->flags & BTRFS_INODE_BARRIER)
4034 + inode->i_vflags |= V_BARRIER;
4035 + if (ip->flags & BTRFS_INODE_COW)
4036 + inode->i_vflags |= V_COW;
4040 + * Update btrfs internal flags from inode->i_(v)flags.
4042 +void btrfs_update_flags(struct inode *inode)
4044 + struct btrfs_inode *ip = BTRFS_I(inode);
4046 + unsigned int flags = inode->i_flags;
4047 + unsigned int vflags = inode->i_vflags;
4049 + ip->flags &= ~(BTRFS_INODE_SYNC | BTRFS_INODE_APPEND |
4050 + BTRFS_INODE_IMMUTABLE | BTRFS_INODE_IXUNLINK |
4051 + BTRFS_INODE_NOATIME | BTRFS_INODE_DIRSYNC |
4052 + BTRFS_INODE_BARRIER | BTRFS_INODE_COW);
4054 + if (flags & S_IMMUTABLE)
4055 + ip->flags |= BTRFS_INODE_IMMUTABLE;
4056 + if (flags & S_IXUNLINK)
4057 + ip->flags |= BTRFS_INODE_IXUNLINK;
4059 + if (flags & S_SYNC)
4060 + ip->flags |= BTRFS_INODE_SYNC;
4061 + if (flags & S_APPEND)
4062 + ip->flags |= BTRFS_INODE_APPEND;
4063 + if (flags & S_NOATIME)
4064 + ip->flags |= BTRFS_INODE_NOATIME;
4065 + if (flags & S_DIRSYNC)
4066 + ip->flags |= BTRFS_INODE_DIRSYNC;
4068 + if (vflags & V_BARRIER)
4069 + ip->flags |= BTRFS_INODE_BARRIER;
4070 + if (vflags & V_COW)
4071 + ip->flags |= BTRFS_INODE_COW;
4075 @@ -119,7 +172,7 @@ void btrfs_inherit_iflags(struct inode *
4076 flags = BTRFS_I(dir)->flags;
4078 if (S_ISREG(inode->i_mode))
4079 - flags &= ~BTRFS_INODE_DIRSYNC;
4080 + flags &= ~(BTRFS_INODE_DIRSYNC | BTRFS_INODE_BARRIER);
4081 else if (!S_ISDIR(inode->i_mode))
4082 flags &= (BTRFS_INODE_NODUMP | BTRFS_INODE_NOATIME);
4084 @@ -127,6 +180,30 @@ void btrfs_inherit_iflags(struct inode *
4085 btrfs_update_iflags(inode);
4088 +int btrfs_sync_flags(struct inode *inode, int flags, int vflags)
4090 + struct btrfs_inode *ip = BTRFS_I(inode);
4091 + struct btrfs_root *root = ip->root;
4092 + struct btrfs_trans_handle *trans;
4095 + trans = btrfs_join_transaction(root, 1);
4098 + inode->i_flags = flags;
4099 + inode->i_vflags = vflags;
4100 + btrfs_update_flags(inode);
4102 + ret = btrfs_update_inode(trans, root, inode);
4105 + btrfs_update_iflags(inode);
4106 + inode->i_ctime = CURRENT_TIME;
4107 + btrfs_end_transaction(trans, root);
4112 static int btrfs_ioctl_getflags(struct file *file, void __user *arg)
4114 struct btrfs_inode *ip = BTRFS_I(file->f_path.dentry->d_inode);
4115 @@ -149,6 +226,7 @@ static int btrfs_ioctl_setflags(struct f
4116 if (copy_from_user(&flags, arg, sizeof(flags)))
4119 + /* maybe add FS_IXUNLINK_FL ? */
4120 if (flags & ~(FS_IMMUTABLE_FL | FS_APPEND_FL | \
4121 FS_NOATIME_FL | FS_NODUMP_FL | \
4122 FS_SYNC_FL | FS_DIRSYNC_FL))
4123 @@ -161,7 +239,8 @@ static int btrfs_ioctl_setflags(struct f
4125 flags = btrfs_mask_flags(inode->i_mode, flags);
4126 oldflags = btrfs_flags_to_ioctl(ip->flags);
4127 - if ((flags ^ oldflags) & (FS_APPEND_FL | FS_IMMUTABLE_FL)) {
4128 + if ((flags ^ oldflags) & (FS_APPEND_FL |
4129 + FS_IMMUTABLE_FL | FS_IXUNLINK_FL)) {
4130 if (!capable(CAP_LINUX_IMMUTABLE)) {
4133 @@ -172,14 +251,19 @@ static int btrfs_ioctl_setflags(struct f
4137 - if (flags & FS_SYNC_FL)
4138 - ip->flags |= BTRFS_INODE_SYNC;
4140 - ip->flags &= ~BTRFS_INODE_SYNC;
4141 if (flags & FS_IMMUTABLE_FL)
4142 ip->flags |= BTRFS_INODE_IMMUTABLE;
4144 ip->flags &= ~BTRFS_INODE_IMMUTABLE;
4145 + if (flags & FS_IXUNLINK_FL)
4146 + ip->flags |= BTRFS_INODE_IXUNLINK;
4148 + ip->flags &= ~BTRFS_INODE_IXUNLINK;
4150 + if (flags & FS_SYNC_FL)
4151 + ip->flags |= BTRFS_INODE_SYNC;
4153 + ip->flags &= ~BTRFS_INODE_SYNC;
4154 if (flags & FS_APPEND_FL)
4155 ip->flags |= BTRFS_INODE_APPEND;
4157 diff -NurpP --minimal linux-2.6.33.2/fs/btrfs/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/super.c
4158 --- linux-2.6.33.2/fs/btrfs/super.c 2010-02-25 11:52:04.000000000 +0100
4159 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/btrfs/super.c 2010-02-25 15:33:43.000000000 +0100
4160 @@ -68,7 +68,7 @@ enum {
4161 Opt_ssd, Opt_nossd, Opt_ssd_spread, Opt_thread_pool, Opt_noacl,
4162 Opt_compress, Opt_compress_force, Opt_notreelog, Opt_ratio,
4164 - Opt_discard, Opt_err,
4165 + Opt_tag, Opt_notag, Opt_tagid, Opt_discard, Opt_err,
4168 static match_table_t tokens = {
4169 @@ -92,6 +92,9 @@ static match_table_t tokens = {
4170 {Opt_flushoncommit, "flushoncommit"},
4171 {Opt_ratio, "metadata_ratio=%d"},
4172 {Opt_discard, "discard"},
4174 + {Opt_notag, "notag"},
4175 + {Opt_tagid, "tagid=%u"},
4179 @@ -270,6 +273,22 @@ int btrfs_parse_options(struct btrfs_roo
4181 btrfs_set_opt(info->mount_opt, DISCARD);
4183 +#ifndef CONFIG_TAGGING_NONE
4185 + printk(KERN_INFO "btrfs: use tagging\n");
4186 + btrfs_set_opt(info->mount_opt, TAGGED);
4189 + printk(KERN_INFO "btrfs: disabled tagging\n");
4190 + btrfs_clear_opt(info->mount_opt, TAGGED);
4193 +#ifdef CONFIG_PROPAGATE
4196 + btrfs_set_opt(info->mount_opt, TAGGED);
4200 printk(KERN_INFO "btrfs: unrecognized mount option "
4202 @@ -591,6 +610,12 @@ static int btrfs_remount(struct super_bl
4206 + if (btrfs_test_opt(root, TAGGED) && !(sb->s_flags & MS_TAGGED)) {
4207 + printk("btrfs: %s: tagging not permitted on remount.\n",
4212 if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
4215 diff -NurpP --minimal linux-2.6.33.2/fs/char_dev.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/char_dev.c
4216 --- linux-2.6.33.2/fs/char_dev.c 2009-12-03 20:02:51.000000000 +0100
4217 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/char_dev.c 2010-02-25 12:02:16.000000000 +0100
4219 #include <linux/cdev.h>
4220 #include <linux/mutex.h>
4221 #include <linux/backing-dev.h>
4222 +#include <linux/vs_context.h>
4223 +#include <linux/vs_device.h>
4225 #include "internal.h"
4227 @@ -368,14 +370,21 @@ static int chrdev_open(struct inode *ino
4229 struct cdev *new = NULL;
4233 + if (!vs_map_chrdev(inode->i_rdev, &mdev, DATTR_OPEN))
4235 + inode->i_mdev = mdev;
4237 spin_lock(&cdev_lock);
4240 struct kobject *kobj;
4243 spin_unlock(&cdev_lock);
4244 - kobj = kobj_lookup(cdev_map, inode->i_rdev, &idx);
4246 + kobj = kobj_lookup(cdev_map, mdev, &idx);
4249 new = container_of(kobj, struct cdev, kobj);
4250 diff -NurpP --minimal linux-2.6.33.2/fs/dcache.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/dcache.c
4251 --- linux-2.6.33.2/fs/dcache.c 2010-02-25 11:52:05.000000000 +0100
4252 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/dcache.c 2010-02-25 12:02:16.000000000 +0100
4254 #include <linux/bootmem.h>
4255 #include <linux/fs_struct.h>
4256 #include <linux/hardirq.h>
4257 +#include <linux/vs_limit.h>
4258 #include "internal.h"
4260 int sysctl_vfs_cache_pressure __read_mostly = 100;
4261 @@ -230,6 +231,8 @@ repeat:
4265 + vx_dentry_dec(dentry);
4268 * AV: ->d_delete() is _NOT_ allowed to block now.
4270 @@ -321,6 +324,7 @@ static inline struct dentry * __dget_loc
4272 atomic_inc(&dentry->d_count);
4273 dentry_lru_del_init(dentry);
4274 + vx_dentry_inc(dentry);
4278 @@ -919,6 +923,9 @@ struct dentry *d_alloc(struct dentry * p
4279 struct dentry *dentry;
4282 + if (!vx_dentry_avail(1))
4285 dentry = kmem_cache_alloc(dentry_cache, GFP_KERNEL);
4288 @@ -964,6 +971,7 @@ struct dentry *d_alloc(struct dentry * p
4290 list_add(&dentry->d_u.d_child, &parent->d_subdirs);
4291 dentry_stat.nr_dentry++;
4292 + vx_dentry_inc(dentry);
4293 spin_unlock(&dcache_lock);
4296 @@ -1408,6 +1416,7 @@ struct dentry * __d_lookup(struct dentry
4299 atomic_inc(&dentry->d_count);
4300 + vx_dentry_inc(dentry);
4302 spin_unlock(&dentry->d_lock);
4304 diff -NurpP --minimal linux-2.6.33.2/fs/devpts/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/devpts/inode.c
4305 --- linux-2.6.33.2/fs/devpts/inode.c 2010-02-25 11:52:05.000000000 +0100
4306 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/devpts/inode.c 2010-02-25 12:02:16.000000000 +0100
4308 #include <linux/parser.h>
4309 #include <linux/fsnotify.h>
4310 #include <linux/seq_file.h>
4311 +#include <linux/vs_base.h>
4313 #define DEVPTS_DEFAULT_MODE 0600
4316 #define DEVPTS_DEFAULT_PTMX_MODE 0000
4317 #define PTMX_MINOR 2
4319 +static int devpts_permission(struct inode *inode, int mask)
4321 + int ret = -EACCES;
4323 + /* devpts is xid tagged */
4324 + if (vx_check((xid_t)inode->i_tag, VS_WATCH_P | VS_IDENT))
4325 + ret = generic_permission(inode, mask, NULL);
4329 +static struct inode_operations devpts_file_inode_operations = {
4330 + .permission = devpts_permission,
4333 extern int pty_limit; /* Config limit on Unix98 ptys */
4334 static DEFINE_MUTEX(allocated_ptys_lock);
4336 @@ -262,6 +277,25 @@ static int devpts_show_options(struct se
4340 +static int devpts_filter(struct dentry *de)
4342 + /* devpts is xid tagged */
4343 + return vx_check((xid_t)de->d_inode->i_tag, VS_WATCH_P | VS_IDENT);
4346 +static int devpts_readdir(struct file * filp, void * dirent, filldir_t filldir)
4348 + return dcache_readdir_filter(filp, dirent, filldir, devpts_filter);
4351 +static struct file_operations devpts_dir_operations = {
4352 + .open = dcache_dir_open,
4353 + .release = dcache_dir_close,
4354 + .llseek = dcache_dir_lseek,
4355 + .read = generic_read_dir,
4356 + .readdir = devpts_readdir,
4359 static const struct super_operations devpts_sops = {
4360 .statfs = simple_statfs,
4361 .remount_fs = devpts_remount,
4362 @@ -301,12 +335,15 @@ devpts_fill_super(struct super_block *s,
4363 inode = new_inode(s);
4368 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
4369 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
4370 inode->i_op = &simple_dir_inode_operations;
4371 - inode->i_fop = &simple_dir_operations;
4372 + inode->i_fop = &devpts_dir_operations;
4374 + /* devpts is xid tagged */
4375 + inode->i_tag = (tag_t)vx_current_xid();
4377 s->s_root = d_alloc_root(inode);
4379 @@ -497,6 +534,9 @@ int devpts_pty_new(struct inode *ptmx_in
4380 inode->i_gid = opts->setgid ? opts->gid : current_fsgid();
4381 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
4382 init_special_inode(inode, S_IFCHR|opts->mode, device);
4383 + /* devpts is xid tagged */
4384 + inode->i_tag = (tag_t)vx_current_xid();
4385 + inode->i_op = &devpts_file_inode_operations;
4386 inode->i_private = tty;
4387 tty->driver_data = inode;
4389 diff -NurpP --minimal linux-2.6.33.2/fs/exec.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/exec.c
4390 --- linux-2.6.33.2/fs/exec.c 2010-04-06 01:47:46.000000000 +0200
4391 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/exec.c 2010-04-06 01:59:25.000000000 +0200
4392 @@ -250,7 +250,9 @@ static int __bprm_mm_init(struct linux_b
4396 - mm->stack_vm = mm->total_vm = 1;
4398 + vx_vmpages_inc(mm);
4400 up_write(&mm->mmap_sem);
4401 bprm->p = vma->vm_end - sizeof(void *);
4403 @@ -1503,7 +1505,7 @@ static int format_corename(char *corenam
4404 /* UNIX time of coredump */
4407 - do_gettimeofday(&tv);
4408 + vx_gettimeofday(&tv);
4409 rc = snprintf(out_ptr, out_end - out_ptr,
4411 if (rc > out_end - out_ptr)
4412 diff -NurpP --minimal linux-2.6.33.2/fs/ext2/balloc.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/balloc.c
4413 --- linux-2.6.33.2/fs/ext2/balloc.c 2009-06-11 17:13:03.000000000 +0200
4414 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/balloc.c 2010-02-25 12:02:16.000000000 +0100
4415 @@ -701,7 +701,6 @@ ext2_try_to_allocate(struct super_block
4417 end = EXT2_BLOCKS_PER_GROUP(sb);
4420 BUG_ON(start > EXT2_BLOCKS_PER_GROUP(sb));
4423 diff -NurpP --minimal linux-2.6.33.2/fs/ext2/ext2.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/ext2.h
4424 --- linux-2.6.33.2/fs/ext2/ext2.h 2010-02-25 11:52:05.000000000 +0100
4425 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/ext2.h 2010-02-25 12:02:16.000000000 +0100
4426 @@ -131,6 +131,7 @@ extern int ext2_fiemap(struct inode *ino
4427 int __ext2_write_begin(struct file *file, struct address_space *mapping,
4428 loff_t pos, unsigned len, unsigned flags,
4429 struct page **pagep, void **fsdata);
4430 +extern int ext2_sync_flags(struct inode *, int, int);
4433 extern long ext2_ioctl(struct file *, unsigned int, unsigned long);
4434 diff -NurpP --minimal linux-2.6.33.2/fs/ext2/file.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/file.c
4435 --- linux-2.6.33.2/fs/ext2/file.c 2010-02-25 11:52:05.000000000 +0100
4436 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/file.c 2010-02-25 12:02:16.000000000 +0100
4437 @@ -104,4 +104,5 @@ const struct inode_operations ext2_file_
4438 .setattr = ext2_setattr,
4439 .check_acl = ext2_check_acl,
4440 .fiemap = ext2_fiemap,
4441 + .sync_flags = ext2_sync_flags,
4443 diff -NurpP --minimal linux-2.6.33.2/fs/ext2/ialloc.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/ialloc.c
4444 --- linux-2.6.33.2/fs/ext2/ialloc.c 2009-06-11 17:13:03.000000000 +0200
4445 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/ialloc.c 2010-02-25 12:02:16.000000000 +0100
4447 #include <linux/backing-dev.h>
4448 #include <linux/buffer_head.h>
4449 #include <linux/random.h>
4450 +#include <linux/vs_tag.h>
4454 @@ -560,6 +561,7 @@ got:
4456 inode->i_gid = current_fsgid();
4457 inode->i_mode = mode;
4458 + inode->i_tag = dx_current_fstag(sb);
4461 inode->i_blocks = 0;
4462 diff -NurpP --minimal linux-2.6.33.2/fs/ext2/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/inode.c
4463 --- linux-2.6.33.2/fs/ext2/inode.c 2010-02-25 11:52:05.000000000 +0100
4464 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/inode.c 2010-02-25 12:02:16.000000000 +0100
4466 #include <linux/mpage.h>
4467 #include <linux/fiemap.h>
4468 #include <linux/namei.h>
4469 +#include <linux/vs_tag.h>
4473 @@ -1042,7 +1043,7 @@ void ext2_truncate(struct inode *inode)
4475 if (ext2_inode_is_fast_symlink(inode))
4477 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
4478 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
4481 blocksize = inode->i_sb->s_blocksize;
4482 @@ -1180,36 +1181,61 @@ void ext2_set_inode_flags(struct inode *
4484 unsigned int flags = EXT2_I(inode)->i_flags;
4486 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4487 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
4488 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
4491 + if (flags & EXT2_IMMUTABLE_FL)
4492 + inode->i_flags |= S_IMMUTABLE;
4493 + if (flags & EXT2_IXUNLINK_FL)
4494 + inode->i_flags |= S_IXUNLINK;
4496 if (flags & EXT2_SYNC_FL)
4497 inode->i_flags |= S_SYNC;
4498 if (flags & EXT2_APPEND_FL)
4499 inode->i_flags |= S_APPEND;
4500 - if (flags & EXT2_IMMUTABLE_FL)
4501 - inode->i_flags |= S_IMMUTABLE;
4502 if (flags & EXT2_NOATIME_FL)
4503 inode->i_flags |= S_NOATIME;
4504 if (flags & EXT2_DIRSYNC_FL)
4505 inode->i_flags |= S_DIRSYNC;
4507 + inode->i_vflags &= ~(V_BARRIER | V_COW);
4509 + if (flags & EXT2_BARRIER_FL)
4510 + inode->i_vflags |= V_BARRIER;
4511 + if (flags & EXT2_COW_FL)
4512 + inode->i_vflags |= V_COW;
4515 /* Propagate flags from i_flags to EXT2_I(inode)->i_flags */
4516 void ext2_get_inode_flags(struct ext2_inode_info *ei)
4518 unsigned int flags = ei->vfs_inode.i_flags;
4519 + unsigned int vflags = ei->vfs_inode.i_vflags;
4521 + ei->i_flags &= ~(EXT2_SYNC_FL | EXT2_APPEND_FL |
4522 + EXT2_IMMUTABLE_FL | EXT2_IXUNLINK_FL |
4523 + EXT2_NOATIME_FL | EXT2_DIRSYNC_FL |
4524 + EXT2_BARRIER_FL | EXT2_COW_FL);
4526 + if (flags & S_IMMUTABLE)
4527 + ei->i_flags |= EXT2_IMMUTABLE_FL;
4528 + if (flags & S_IXUNLINK)
4529 + ei->i_flags |= EXT2_IXUNLINK_FL;
4531 - ei->i_flags &= ~(EXT2_SYNC_FL|EXT2_APPEND_FL|
4532 - EXT2_IMMUTABLE_FL|EXT2_NOATIME_FL|EXT2_DIRSYNC_FL);
4534 ei->i_flags |= EXT2_SYNC_FL;
4535 if (flags & S_APPEND)
4536 ei->i_flags |= EXT2_APPEND_FL;
4537 - if (flags & S_IMMUTABLE)
4538 - ei->i_flags |= EXT2_IMMUTABLE_FL;
4539 if (flags & S_NOATIME)
4540 ei->i_flags |= EXT2_NOATIME_FL;
4541 if (flags & S_DIRSYNC)
4542 ei->i_flags |= EXT2_DIRSYNC_FL;
4544 + if (vflags & V_BARRIER)
4545 + ei->i_flags |= EXT2_BARRIER_FL;
4546 + if (vflags & V_COW)
4547 + ei->i_flags |= EXT2_COW_FL;
4550 struct inode *ext2_iget (struct super_block *sb, unsigned long ino)
4551 @@ -1219,6 +1245,8 @@ struct inode *ext2_iget (struct super_bl
4552 struct ext2_inode *raw_inode;
4553 struct inode *inode;
4559 inode = iget_locked(sb, ino);
4560 @@ -1237,12 +1265,17 @@ struct inode *ext2_iget (struct super_bl
4563 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
4564 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4565 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4566 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4567 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4568 if (!(test_opt (inode->i_sb, NO_UID32))) {
4569 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4570 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4571 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4572 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4574 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
4575 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
4576 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
4577 + le16_to_cpu(raw_inode->i_raw_tag));
4579 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
4580 inode->i_size = le32_to_cpu(raw_inode->i_size);
4581 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
4582 @@ -1340,8 +1373,8 @@ int ext2_write_inode(struct inode *inode
4583 struct ext2_inode_info *ei = EXT2_I(inode);
4584 struct super_block *sb = inode->i_sb;
4585 ino_t ino = inode->i_ino;
4586 - uid_t uid = inode->i_uid;
4587 - gid_t gid = inode->i_gid;
4588 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
4589 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
4590 struct buffer_head * bh;
4591 struct ext2_inode * raw_inode = ext2_get_inode(sb, ino, &bh);
4593 @@ -1377,6 +1410,9 @@ int ext2_write_inode(struct inode *inode
4594 raw_inode->i_uid_high = 0;
4595 raw_inode->i_gid_high = 0;
4597 +#ifdef CONFIG_TAGGING_INTERN
4598 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
4600 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
4601 raw_inode->i_size = cpu_to_le32(inode->i_size);
4602 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
4603 @@ -1458,7 +1494,8 @@ int ext2_setattr(struct dentry *dentry,
4606 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
4607 - (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
4608 + (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
4609 + (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
4610 error = vfs_dq_transfer(inode, iattr) ? -EDQUOT : 0;
4613 diff -NurpP --minimal linux-2.6.33.2/fs/ext2/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/ioctl.c
4614 --- linux-2.6.33.2/fs/ext2/ioctl.c 2009-09-10 15:26:21.000000000 +0200
4615 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/ioctl.c 2010-02-25 12:02:16.000000000 +0100
4617 #include <asm/uaccess.h>
4620 +int ext2_sync_flags(struct inode *inode, int flags, int vflags)
4622 + inode->i_flags = flags;
4623 + inode->i_vflags = vflags;
4624 + ext2_get_inode_flags(EXT2_I(inode));
4625 + inode->i_ctime = CURRENT_TIME_SEC;
4626 + mark_inode_dirty(inode);
4630 long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
4632 struct inode *inode = filp->f_dentry->d_inode;
4633 @@ -51,6 +61,11 @@ long ext2_ioctl(struct file *filp, unsig
4635 flags = ext2_mask_flags(inode->i_mode, flags);
4637 + if (IS_BARRIER(inode)) {
4638 + vxwprintk_task(1, "messing with the barrier.");
4642 mutex_lock(&inode->i_mutex);
4643 /* Is it quota file? Do not allow user to mess with it */
4644 if (IS_NOQUOTA(inode)) {
4645 @@ -66,7 +81,9 @@ long ext2_ioctl(struct file *filp, unsig
4647 * This test looks nicer. Thanks to Pauline Middelink
4649 - if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) {
4650 + if ((oldflags & EXT2_IMMUTABLE_FL) ||
4651 + ((flags ^ oldflags) & (EXT2_APPEND_FL |
4652 + EXT2_IMMUTABLE_FL | EXT2_IXUNLINK_FL))) {
4653 if (!capable(CAP_LINUX_IMMUTABLE)) {
4654 mutex_unlock(&inode->i_mutex);
4656 @@ -74,7 +91,7 @@ long ext2_ioctl(struct file *filp, unsig
4660 - flags = flags & EXT2_FL_USER_MODIFIABLE;
4661 + flags &= EXT2_FL_USER_MODIFIABLE;
4662 flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE;
4663 ei->i_flags = flags;
4664 mutex_unlock(&inode->i_mutex);
4665 diff -NurpP --minimal linux-2.6.33.2/fs/ext2/namei.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/namei.c
4666 --- linux-2.6.33.2/fs/ext2/namei.c 2009-12-03 20:02:51.000000000 +0100
4667 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/namei.c 2010-02-25 12:02:16.000000000 +0100
4671 #include <linux/pagemap.h>
4672 +#include <linux/vs_tag.h>
4676 @@ -74,6 +75,7 @@ static struct dentry *ext2_lookup(struct
4677 return ERR_PTR(-EIO);
4679 return ERR_CAST(inode);
4680 + dx_propagate_tag(nd, inode);
4684 @@ -401,6 +403,7 @@ const struct inode_operations ext2_dir_i
4686 .setattr = ext2_setattr,
4687 .check_acl = ext2_check_acl,
4688 + .sync_flags = ext2_sync_flags,
4691 const struct inode_operations ext2_special_inode_operations = {
4692 diff -NurpP --minimal linux-2.6.33.2/fs/ext2/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/super.c
4693 --- linux-2.6.33.2/fs/ext2/super.c 2010-02-25 11:52:05.000000000 +0100
4694 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext2/super.c 2010-02-25 12:02:16.000000000 +0100
4695 @@ -382,7 +382,8 @@ enum {
4696 Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug,
4697 Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr,
4698 Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota,
4699 - Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation
4700 + Opt_usrquota, Opt_grpquota, Opt_reservation, Opt_noreservation,
4701 + Opt_tag, Opt_notag, Opt_tagid
4704 static const match_table_t tokens = {
4705 @@ -410,6 +411,9 @@ static const match_table_t tokens = {
4707 {Opt_noacl, "noacl"},
4710 + {Opt_notag, "notag"},
4711 + {Opt_tagid, "tagid=%u"},
4712 {Opt_grpquota, "grpquota"},
4713 {Opt_ignore, "noquota"},
4714 {Opt_quota, "quota"},
4715 @@ -480,6 +484,20 @@ static int parse_options(char *options,
4717 set_opt (sbi->s_mount_opt, NO_UID32);
4719 +#ifndef CONFIG_TAGGING_NONE
4721 + set_opt (sbi->s_mount_opt, TAGGED);
4724 + clear_opt (sbi->s_mount_opt, TAGGED);
4727 +#ifdef CONFIG_PROPAGATE
4730 + set_opt (sbi->s_mount_opt, TAGGED);
4734 clear_opt (sbi->s_mount_opt, CHECK);
4736 @@ -836,6 +854,8 @@ static int ext2_fill_super(struct super_
4737 if (!parse_options((char *) data, sb))
4740 + if (EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_TAGGED)
4741 + sb->s_flags |= MS_TAGGED;
4742 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4743 ((EXT2_SB(sb)->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ?
4745 @@ -1229,6 +1249,14 @@ static int ext2_remount (struct super_bl
4749 + if ((sbi->s_mount_opt & EXT2_MOUNT_TAGGED) &&
4750 + !(sb->s_flags & MS_TAGGED)) {
4751 + printk("EXT2-fs: %s: tagging not permitted on remount.\n",
4754 + goto restore_opts;
4757 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
4758 ((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
4760 diff -NurpP --minimal linux-2.6.33.2/fs/ext3/file.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/file.c
4761 --- linux-2.6.33.2/fs/ext3/file.c 2009-12-03 20:02:51.000000000 +0100
4762 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/file.c 2010-02-25 12:02:16.000000000 +0100
4763 @@ -80,5 +80,6 @@ const struct inode_operations ext3_file_
4765 .check_acl = ext3_check_acl,
4766 .fiemap = ext3_fiemap,
4767 + .sync_flags = ext3_sync_flags,
4770 diff -NurpP --minimal linux-2.6.33.2/fs/ext3/ialloc.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/ialloc.c
4771 --- linux-2.6.33.2/fs/ext3/ialloc.c 2009-09-10 15:26:21.000000000 +0200
4772 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/ialloc.c 2010-02-25 12:02:16.000000000 +0100
4774 #include <linux/buffer_head.h>
4775 #include <linux/random.h>
4776 #include <linux/bitops.h>
4777 +#include <linux/vs_tag.h>
4779 #include <asm/byteorder.h>
4781 @@ -548,6 +549,7 @@ got:
4783 inode->i_gid = current_fsgid();
4784 inode->i_mode = mode;
4785 + inode->i_tag = dx_current_fstag(sb);
4788 /* This is the optimal IO size (for stat), not the fs block size */
4789 diff -NurpP --minimal linux-2.6.33.2/fs/ext3/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/inode.c
4790 --- linux-2.6.33.2/fs/ext3/inode.c 2010-02-25 11:52:05.000000000 +0100
4791 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/inode.c 2010-02-25 12:02:16.000000000 +0100
4793 #include <linux/bio.h>
4794 #include <linux/fiemap.h>
4795 #include <linux/namei.h>
4796 +#include <linux/vs_tag.h>
4800 @@ -2343,7 +2344,7 @@ static void ext3_free_branches(handle_t
4802 int ext3_can_truncate(struct inode *inode)
4804 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
4805 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
4807 if (S_ISREG(inode->i_mode))
4809 @@ -2728,36 +2729,60 @@ void ext3_set_inode_flags(struct inode *
4811 unsigned int flags = EXT3_I(inode)->i_flags;
4813 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
4814 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
4815 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
4817 + if (flags & EXT3_IMMUTABLE_FL)
4818 + inode->i_flags |= S_IMMUTABLE;
4819 + if (flags & EXT3_IXUNLINK_FL)
4820 + inode->i_flags |= S_IXUNLINK;
4822 if (flags & EXT3_SYNC_FL)
4823 inode->i_flags |= S_SYNC;
4824 if (flags & EXT3_APPEND_FL)
4825 inode->i_flags |= S_APPEND;
4826 - if (flags & EXT3_IMMUTABLE_FL)
4827 - inode->i_flags |= S_IMMUTABLE;
4828 if (flags & EXT3_NOATIME_FL)
4829 inode->i_flags |= S_NOATIME;
4830 if (flags & EXT3_DIRSYNC_FL)
4831 inode->i_flags |= S_DIRSYNC;
4833 + inode->i_vflags &= ~(V_BARRIER | V_COW);
4835 + if (flags & EXT3_BARRIER_FL)
4836 + inode->i_vflags |= V_BARRIER;
4837 + if (flags & EXT3_COW_FL)
4838 + inode->i_vflags |= V_COW;
4841 /* Propagate flags from i_flags to EXT3_I(inode)->i_flags */
4842 void ext3_get_inode_flags(struct ext3_inode_info *ei)
4844 unsigned int flags = ei->vfs_inode.i_flags;
4845 + unsigned int vflags = ei->vfs_inode.i_vflags;
4847 + ei->i_flags &= ~(EXT3_SYNC_FL | EXT3_APPEND_FL |
4848 + EXT3_IMMUTABLE_FL | EXT3_IXUNLINK_FL |
4849 + EXT3_NOATIME_FL | EXT3_DIRSYNC_FL |
4850 + EXT3_BARRIER_FL | EXT3_COW_FL);
4852 + if (flags & S_IMMUTABLE)
4853 + ei->i_flags |= EXT3_IMMUTABLE_FL;
4854 + if (flags & S_IXUNLINK)
4855 + ei->i_flags |= EXT3_IXUNLINK_FL;
4857 - ei->i_flags &= ~(EXT3_SYNC_FL|EXT3_APPEND_FL|
4858 - EXT3_IMMUTABLE_FL|EXT3_NOATIME_FL|EXT3_DIRSYNC_FL);
4860 ei->i_flags |= EXT3_SYNC_FL;
4861 if (flags & S_APPEND)
4862 ei->i_flags |= EXT3_APPEND_FL;
4863 - if (flags & S_IMMUTABLE)
4864 - ei->i_flags |= EXT3_IMMUTABLE_FL;
4865 if (flags & S_NOATIME)
4866 ei->i_flags |= EXT3_NOATIME_FL;
4867 if (flags & S_DIRSYNC)
4868 ei->i_flags |= EXT3_DIRSYNC_FL;
4870 + if (vflags & V_BARRIER)
4871 + ei->i_flags |= EXT3_BARRIER_FL;
4872 + if (vflags & V_COW)
4873 + ei->i_flags |= EXT3_COW_FL;
4876 struct inode *ext3_iget(struct super_block *sb, unsigned long ino)
4877 @@ -2771,6 +2796,8 @@ struct inode *ext3_iget(struct super_blo
4878 transaction_t *transaction;
4884 inode = iget_locked(sb, ino);
4886 @@ -2787,12 +2814,17 @@ struct inode *ext3_iget(struct super_blo
4888 raw_inode = ext3_raw_inode(&iloc);
4889 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
4890 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4891 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4892 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
4893 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
4894 if(!(test_opt (inode->i_sb, NO_UID32))) {
4895 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4896 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4897 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
4898 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
4900 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
4901 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
4902 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
4903 + le16_to_cpu(raw_inode->i_raw_tag));
4905 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
4906 inode->i_size = le32_to_cpu(raw_inode->i_size);
4907 inode->i_atime.tv_sec = (signed)le32_to_cpu(raw_inode->i_atime);
4908 @@ -2947,6 +2979,8 @@ static int ext3_do_update_inode(handle_t
4909 struct ext3_inode *raw_inode = ext3_raw_inode(iloc);
4910 struct ext3_inode_info *ei = EXT3_I(inode);
4911 struct buffer_head *bh = iloc->bh;
4912 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
4913 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
4914 int err = 0, rc, block;
4917 @@ -2961,29 +2995,32 @@ again:
4918 ext3_get_inode_flags(ei);
4919 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
4920 if(!(test_opt(inode->i_sb, NO_UID32))) {
4921 - raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
4922 - raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
4923 + raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
4924 + raw_inode->i_gid_low = cpu_to_le16(low_16_bits(gid));
4926 * Fix up interoperability with old kernels. Otherwise, old inodes get
4927 * re-used with the upper 16 bits of the uid/gid intact
4930 raw_inode->i_uid_high =
4931 - cpu_to_le16(high_16_bits(inode->i_uid));
4932 + cpu_to_le16(high_16_bits(uid));
4933 raw_inode->i_gid_high =
4934 - cpu_to_le16(high_16_bits(inode->i_gid));
4935 + cpu_to_le16(high_16_bits(gid));
4937 raw_inode->i_uid_high = 0;
4938 raw_inode->i_gid_high = 0;
4941 raw_inode->i_uid_low =
4942 - cpu_to_le16(fs_high2lowuid(inode->i_uid));
4943 + cpu_to_le16(fs_high2lowuid(uid));
4944 raw_inode->i_gid_low =
4945 - cpu_to_le16(fs_high2lowgid(inode->i_gid));
4946 + cpu_to_le16(fs_high2lowgid(gid));
4947 raw_inode->i_uid_high = 0;
4948 raw_inode->i_gid_high = 0;
4950 +#ifdef CONFIG_TAGGING_INTERN
4951 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
4953 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
4954 raw_inode->i_size = cpu_to_le32(ei->i_disksize);
4955 raw_inode->i_atime = cpu_to_le32(inode->i_atime.tv_sec);
4956 @@ -3141,7 +3178,8 @@ int ext3_setattr(struct dentry *dentry,
4959 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
4960 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
4961 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
4962 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
4965 /* (user+group)*(old+new) structure, inode write (sb,
4966 @@ -3163,6 +3201,8 @@ int ext3_setattr(struct dentry *dentry,
4967 inode->i_uid = attr->ia_uid;
4968 if (attr->ia_valid & ATTR_GID)
4969 inode->i_gid = attr->ia_gid;
4970 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
4971 + inode->i_tag = attr->ia_tag;
4972 error = ext3_mark_inode_dirty(handle, inode);
4973 ext3_journal_stop(handle);
4975 diff -NurpP --minimal linux-2.6.33.2/fs/ext3/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/ioctl.c
4976 --- linux-2.6.33.2/fs/ext3/ioctl.c 2009-06-11 17:13:03.000000000 +0200
4977 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/ioctl.c 2010-02-25 12:02:16.000000000 +0100
4981 #include <linux/fs.h>
4982 +#include <linux/mount.h>
4983 #include <linux/jbd.h>
4984 #include <linux/capability.h>
4985 #include <linux/ext3_fs.h>
4987 #include <linux/compat.h>
4988 #include <asm/uaccess.h>
4991 +int ext3_sync_flags(struct inode *inode, int flags, int vflags)
4993 + handle_t *handle = NULL;
4994 + struct ext3_iloc iloc;
4997 + handle = ext3_journal_start(inode, 1);
4998 + if (IS_ERR(handle))
4999 + return PTR_ERR(handle);
5001 + if (IS_SYNC(inode))
5002 + handle->h_sync = 1;
5003 + err = ext3_reserve_inode_write(handle, inode, &iloc);
5007 + inode->i_flags = flags;
5008 + inode->i_vflags = vflags;
5009 + ext3_get_inode_flags(EXT3_I(inode));
5010 + inode->i_ctime = CURRENT_TIME_SEC;
5012 + err = ext3_mark_iloc_dirty(handle, inode, &iloc);
5014 + ext3_journal_stop(handle);
5018 long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5020 struct inode *inode = filp->f_dentry->d_inode;
5021 @@ -50,6 +79,11 @@ long ext3_ioctl(struct file *filp, unsig
5023 flags = ext3_mask_flags(inode->i_mode, flags);
5025 + if (IS_BARRIER(inode)) {
5026 + vxwprintk_task(1, "messing with the barrier.");
5030 mutex_lock(&inode->i_mutex);
5032 /* Is it quota file? Do not allow user to mess with it */
5033 @@ -68,7 +102,9 @@ long ext3_ioctl(struct file *filp, unsig
5035 * This test looks nicer. Thanks to Pauline Middelink
5037 - if ((flags ^ oldflags) & (EXT3_APPEND_FL | EXT3_IMMUTABLE_FL)) {
5038 + if ((oldflags & EXT3_IMMUTABLE_FL) ||
5039 + ((flags ^ oldflags) & (EXT3_APPEND_FL |
5040 + EXT3_IMMUTABLE_FL | EXT3_IXUNLINK_FL))) {
5041 if (!capable(CAP_LINUX_IMMUTABLE))
5044 @@ -93,7 +129,7 @@ long ext3_ioctl(struct file *filp, unsig
5048 - flags = flags & EXT3_FL_USER_MODIFIABLE;
5049 + flags &= EXT3_FL_USER_MODIFIABLE;
5050 flags |= oldflags & ~EXT3_FL_USER_MODIFIABLE;
5051 ei->i_flags = flags;
5053 diff -NurpP --minimal linux-2.6.33.2/fs/ext3/namei.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/namei.c
5054 --- linux-2.6.33.2/fs/ext3/namei.c 2010-02-25 11:52:05.000000000 +0100
5055 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/namei.c 2010-02-25 12:02:16.000000000 +0100
5057 #include <linux/quotaops.h>
5058 #include <linux/buffer_head.h>
5059 #include <linux/bio.h>
5060 +#include <linux/vs_tag.h>
5064 @@ -912,6 +913,7 @@ restart:
5066 ll_rw_block(READ_META, 1, &bh);
5068 + dx_propagate_tag(nd, inode);
5070 if ((bh = bh_use[ra_ptr++]) == NULL)
5072 @@ -2448,6 +2450,7 @@ const struct inode_operations ext3_dir_i
5073 .removexattr = generic_removexattr,
5075 .check_acl = ext3_check_acl,
5076 + .sync_flags = ext3_sync_flags,
5079 const struct inode_operations ext3_special_inode_operations = {
5080 diff -NurpP --minimal linux-2.6.33.2/fs/ext3/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/super.c
5081 --- linux-2.6.33.2/fs/ext3/super.c 2010-02-25 11:52:05.000000000 +0100
5082 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext3/super.c 2010-02-25 13:29:21.000000000 +0100
5083 @@ -817,7 +817,7 @@ enum {
5084 Opt_usrjquota, Opt_grpjquota, Opt_offusrjquota, Opt_offgrpjquota,
5085 Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota,
5086 Opt_noquota, Opt_ignore, Opt_barrier, Opt_err, Opt_resize,
5087 - Opt_usrquota, Opt_grpquota
5088 + Opt_usrquota, Opt_grpquota, Opt_tag, Opt_notag, Opt_tagid
5091 static const match_table_t tokens = {
5092 @@ -872,6 +872,9 @@ static const match_table_t tokens = {
5093 {Opt_usrquota, "usrquota"},
5094 {Opt_barrier, "barrier=%u"},
5095 {Opt_resize, "resize"},
5097 + {Opt_notag, "notag"},
5098 + {Opt_tagid, "tagid=%u"},
5102 @@ -964,6 +967,20 @@ static int parse_options (char *options,
5104 set_opt (sbi->s_mount_opt, NO_UID32);
5106 +#ifndef CONFIG_TAGGING_NONE
5108 + set_opt (sbi->s_mount_opt, TAGGED);
5111 + clear_opt (sbi->s_mount_opt, TAGGED);
5114 +#ifdef CONFIG_PROPAGATE
5117 + set_opt (sbi->s_mount_opt, TAGGED);
5121 clear_opt (sbi->s_mount_opt, CHECK);
5123 @@ -1693,6 +1710,9 @@ static int ext3_fill_super (struct super
5127 + if (EXT3_SB(sb)->s_mount_opt & EXT3_MOUNT_TAGGED)
5128 + sb->s_flags |= MS_TAGGED;
5130 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5131 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
5133 @@ -2564,6 +2584,14 @@ static int ext3_remount (struct super_bl
5134 if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
5135 ext3_abort(sb, __func__, "Abort forced by user");
5137 + if ((sbi->s_mount_opt & EXT3_MOUNT_TAGGED) &&
5138 + !(sb->s_flags & MS_TAGGED)) {
5139 + printk("EXT3-fs: %s: tagging not permitted on remount.\n",
5142 + goto restore_opts;
5145 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5146 ((sbi->s_mount_opt & EXT3_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
5148 diff -NurpP --minimal linux-2.6.33.2/fs/ext4/ext4.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/ext4.h
5149 --- linux-2.6.33.2/fs/ext4/ext4.h 2010-02-25 11:52:05.000000000 +0100
5150 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/ext4.h 2010-02-25 12:02:16.000000000 +0100
5151 @@ -284,8 +284,12 @@ struct flex_groups {
5152 #define EXT4_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
5153 #define EXT4_HUGE_FILE_FL 0x00040000 /* Set to each huge file */
5154 #define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
5155 +#define EXT4_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
5156 #define EXT4_RESERVED_FL 0x80000000 /* reserved for ext4 lib */
5158 +#define EXT4_BARRIER_FL 0x04000000 /* Barrier for chroot() */
5159 +#define EXT4_COW_FL 0x20000000 /* Copy on Write marker */
5161 #define EXT4_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
5162 #define EXT4_FL_USER_MODIFIABLE 0x000B80FF /* User modifiable flags */
5164 @@ -472,7 +476,8 @@ struct ext4_inode {
5165 __le16 l_i_file_acl_high;
5166 __le16 l_i_uid_high; /* these 2 fields */
5167 __le16 l_i_gid_high; /* were reserved2[0] */
5168 - __u32 l_i_reserved2;
5169 + __le16 l_i_tag; /* Context Tag */
5170 + __u16 l_i_reserved2;
5173 __le16 h_i_reserved1; /* Obsoleted fragment number/size which are removed in ext4 */
5174 @@ -586,6 +591,7 @@ do { \
5175 #define i_gid_low i_gid
5176 #define i_uid_high osd2.linux2.l_i_uid_high
5177 #define i_gid_high osd2.linux2.l_i_gid_high
5178 +#define i_raw_tag osd2.linux2.l_i_tag
5179 #define i_reserved2 osd2.linux2.l_i_reserved2
5181 #elif defined(__GNU__)
5182 @@ -760,6 +766,7 @@ struct ext4_inode_info {
5183 #define EXT4_MOUNT_QUOTA 0x80000 /* Some quota option set */
5184 #define EXT4_MOUNT_USRQUOTA 0x100000 /* "old" user quota */
5185 #define EXT4_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
5186 +#define EXT4_MOUNT_TAGGED 0x400000 /* Enable Context Tags */
5187 #define EXT4_MOUNT_JOURNAL_CHECKSUM 0x800000 /* Journal checksums */
5188 #define EXT4_MOUNT_JOURNAL_ASYNC_COMMIT 0x1000000 /* Journal Async Commit */
5189 #define EXT4_MOUNT_I_VERSION 0x2000000 /* i_version support */
5190 @@ -1750,6 +1757,7 @@ extern int ext4_get_blocks(handle_t *han
5191 struct buffer_head *bh, int flags);
5192 extern int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
5193 __u64 start, __u64 len);
5194 +extern int ext4_sync_flags(struct inode *, int, int);
5196 extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
5197 __u64 start_orig, __u64 start_donor,
5198 diff -NurpP --minimal linux-2.6.33.2/fs/ext4/file.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/file.c
5199 --- linux-2.6.33.2/fs/ext4/file.c 2009-12-03 20:02:51.000000000 +0100
5200 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/file.c 2010-02-25 12:02:16.000000000 +0100
5201 @@ -161,5 +161,6 @@ const struct inode_operations ext4_file_
5202 .check_acl = ext4_check_acl,
5203 .fallocate = ext4_fallocate,
5204 .fiemap = ext4_fiemap,
5205 + .sync_flags = ext4_sync_flags,
5208 diff -NurpP --minimal linux-2.6.33.2/fs/ext4/ialloc.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/ialloc.c
5209 --- linux-2.6.33.2/fs/ext4/ialloc.c 2009-12-03 20:02:51.000000000 +0100
5210 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/ialloc.c 2010-02-25 12:02:16.000000000 +0100
5212 #include <linux/random.h>
5213 #include <linux/bitops.h>
5214 #include <linux/blkdev.h>
5215 +#include <linux/vs_tag.h>
5216 #include <asm/byteorder.h>
5219 @@ -995,6 +996,7 @@ got:
5221 inode->i_gid = current_fsgid();
5222 inode->i_mode = mode;
5223 + inode->i_tag = dx_current_fstag(sb);
5225 inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb);
5226 /* This is the optimal IO size (for stat), not the fs block size */
5227 diff -NurpP --minimal linux-2.6.33.2/fs/ext4/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/inode.c
5228 --- linux-2.6.33.2/fs/ext4/inode.c 2010-02-25 11:52:05.000000000 +0100
5229 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/inode.c 2010-02-25 12:02:16.000000000 +0100
5231 #include <linux/uio.h>
5232 #include <linux/bio.h>
5233 #include <linux/workqueue.h>
5234 +#include <linux/vs_tag.h>
5236 #include "ext4_jbd2.h"
5238 @@ -4376,7 +4377,7 @@ static void ext4_free_branches(handle_t
5240 int ext4_can_truncate(struct inode *inode)
5242 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
5243 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
5245 if (S_ISREG(inode->i_mode))
5247 @@ -4727,36 +4728,60 @@ void ext4_set_inode_flags(struct inode *
5249 unsigned int flags = EXT4_I(inode)->i_flags;
5251 - inode->i_flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
5252 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
5253 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
5255 + if (flags & EXT4_IMMUTABLE_FL)
5256 + inode->i_flags |= S_IMMUTABLE;
5257 + if (flags & EXT4_IXUNLINK_FL)
5258 + inode->i_flags |= S_IXUNLINK;
5260 if (flags & EXT4_SYNC_FL)
5261 inode->i_flags |= S_SYNC;
5262 if (flags & EXT4_APPEND_FL)
5263 inode->i_flags |= S_APPEND;
5264 - if (flags & EXT4_IMMUTABLE_FL)
5265 - inode->i_flags |= S_IMMUTABLE;
5266 if (flags & EXT4_NOATIME_FL)
5267 inode->i_flags |= S_NOATIME;
5268 if (flags & EXT4_DIRSYNC_FL)
5269 inode->i_flags |= S_DIRSYNC;
5271 + inode->i_vflags &= ~(V_BARRIER | V_COW);
5273 + if (flags & EXT4_BARRIER_FL)
5274 + inode->i_vflags |= V_BARRIER;
5275 + if (flags & EXT4_COW_FL)
5276 + inode->i_vflags |= V_COW;
5279 /* Propagate flags from i_flags to EXT4_I(inode)->i_flags */
5280 void ext4_get_inode_flags(struct ext4_inode_info *ei)
5282 unsigned int flags = ei->vfs_inode.i_flags;
5283 + unsigned int vflags = ei->vfs_inode.i_vflags;
5285 + ei->i_flags &= ~(EXT4_SYNC_FL | EXT4_APPEND_FL |
5286 + EXT4_IMMUTABLE_FL | EXT4_IXUNLINK_FL |
5287 + EXT4_NOATIME_FL | EXT4_DIRSYNC_FL |
5288 + EXT4_BARRIER_FL | EXT4_COW_FL);
5290 + if (flags & S_IMMUTABLE)
5291 + ei->i_flags |= EXT4_IMMUTABLE_FL;
5292 + if (flags & S_IXUNLINK)
5293 + ei->i_flags |= EXT4_IXUNLINK_FL;
5295 - ei->i_flags &= ~(EXT4_SYNC_FL|EXT4_APPEND_FL|
5296 - EXT4_IMMUTABLE_FL|EXT4_NOATIME_FL|EXT4_DIRSYNC_FL);
5298 ei->i_flags |= EXT4_SYNC_FL;
5299 if (flags & S_APPEND)
5300 ei->i_flags |= EXT4_APPEND_FL;
5301 - if (flags & S_IMMUTABLE)
5302 - ei->i_flags |= EXT4_IMMUTABLE_FL;
5303 if (flags & S_NOATIME)
5304 ei->i_flags |= EXT4_NOATIME_FL;
5305 if (flags & S_DIRSYNC)
5306 ei->i_flags |= EXT4_DIRSYNC_FL;
5308 + if (vflags & V_BARRIER)
5309 + ei->i_flags |= EXT4_BARRIER_FL;
5310 + if (vflags & V_COW)
5311 + ei->i_flags |= EXT4_COW_FL;
5314 static blkcnt_t ext4_inode_blocks(struct ext4_inode *raw_inode,
5315 @@ -4791,6 +4816,8 @@ struct inode *ext4_iget(struct super_blo
5316 journal_t *journal = EXT4_SB(sb)->s_journal;
5322 inode = iget_locked(sb, ino);
5324 @@ -4806,12 +4833,16 @@ struct inode *ext4_iget(struct super_blo
5326 raw_inode = ext4_raw_inode(&iloc);
5327 inode->i_mode = le16_to_cpu(raw_inode->i_mode);
5328 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
5329 - inode->i_gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
5330 + uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
5331 + gid = (gid_t)le16_to_cpu(raw_inode->i_gid_low);
5332 if (!(test_opt(inode->i_sb, NO_UID32))) {
5333 - inode->i_uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
5334 - inode->i_gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
5335 + uid |= le16_to_cpu(raw_inode->i_uid_high) << 16;
5336 + gid |= le16_to_cpu(raw_inode->i_gid_high) << 16;
5338 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
5339 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
5340 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
5341 + le16_to_cpu(raw_inode->i_raw_tag));
5342 inode->i_nlink = le16_to_cpu(raw_inode->i_links_count);
5345 @@ -5033,6 +5064,8 @@ static int ext4_do_update_inode(handle_t
5346 struct ext4_inode *raw_inode = ext4_raw_inode(iloc);
5347 struct ext4_inode_info *ei = EXT4_I(inode);
5348 struct buffer_head *bh = iloc->bh;
5349 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
5350 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
5351 int err = 0, rc, block;
5353 /* For fields not not tracking in the in-memory inode,
5354 @@ -5043,29 +5076,32 @@ static int ext4_do_update_inode(handle_t
5355 ext4_get_inode_flags(ei);
5356 raw_inode->i_mode = cpu_to_le16(inode->i_mode);
5357 if (!(test_opt(inode->i_sb, NO_UID32))) {
5358 - raw_inode->i_uid_low = cpu_to_le16(low_16_bits(inode->i_uid));
5359 - raw_inode->i_gid_low = cpu_to_le16(low_16_bits(inode->i_gid));
5360 + raw_inode->i_uid_low = cpu_to_le16(low_16_bits(uid));
5361 + raw_inode->i_gid_low = cpu_to_le16(low_16_bits(gid));
5363 * Fix up interoperability with old kernels. Otherwise, old inodes get
5364 * re-used with the upper 16 bits of the uid/gid intact
5367 raw_inode->i_uid_high =
5368 - cpu_to_le16(high_16_bits(inode->i_uid));
5369 + cpu_to_le16(high_16_bits(uid));
5370 raw_inode->i_gid_high =
5371 - cpu_to_le16(high_16_bits(inode->i_gid));
5372 + cpu_to_le16(high_16_bits(gid));
5374 raw_inode->i_uid_high = 0;
5375 raw_inode->i_gid_high = 0;
5378 raw_inode->i_uid_low =
5379 - cpu_to_le16(fs_high2lowuid(inode->i_uid));
5380 + cpu_to_le16(fs_high2lowuid(uid));
5381 raw_inode->i_gid_low =
5382 - cpu_to_le16(fs_high2lowgid(inode->i_gid));
5383 + cpu_to_le16(fs_high2lowgid(gid));
5384 raw_inode->i_uid_high = 0;
5385 raw_inode->i_gid_high = 0;
5387 +#ifdef CONFIG_TAGGING_INTERN
5388 + raw_inode->i_raw_tag = cpu_to_le16(inode->i_tag);
5390 raw_inode->i_links_count = cpu_to_le16(inode->i_nlink);
5392 EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode);
5393 @@ -5250,7 +5286,8 @@ int ext4_setattr(struct dentry *dentry,
5396 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
5397 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
5398 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
5399 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
5402 /* (user+group)*(old+new) structure, inode write (sb,
5403 @@ -5272,6 +5309,8 @@ int ext4_setattr(struct dentry *dentry,
5404 inode->i_uid = attr->ia_uid;
5405 if (attr->ia_valid & ATTR_GID)
5406 inode->i_gid = attr->ia_gid;
5407 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
5408 + inode->i_tag = attr->ia_tag;
5409 error = ext4_mark_inode_dirty(handle, inode);
5410 ext4_journal_stop(handle);
5412 diff -NurpP --minimal linux-2.6.33.2/fs/ext4/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/ioctl.c
5413 --- linux-2.6.33.2/fs/ext4/ioctl.c 2010-02-25 11:52:05.000000000 +0100
5414 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/ioctl.c 2010-02-25 12:02:16.000000000 +0100
5416 #include <linux/compat.h>
5417 #include <linux/mount.h>
5418 #include <linux/file.h>
5419 +#include <linux/vs_tag.h>
5420 #include <asm/uaccess.h>
5421 #include "ext4_jbd2.h"
5425 +int ext4_sync_flags(struct inode *inode, int flags, int vflags)
5427 + handle_t *handle = NULL;
5428 + struct ext4_iloc iloc;
5431 + handle = ext4_journal_start(inode, 1);
5432 + if (IS_ERR(handle))
5433 + return PTR_ERR(handle);
5435 + if (IS_SYNC(inode))
5436 + ext4_handle_sync(handle);
5437 + err = ext4_reserve_inode_write(handle, inode, &iloc);
5441 + inode->i_flags = flags;
5442 + inode->i_vflags = vflags;
5443 + ext4_get_inode_flags(EXT4_I(inode));
5444 + inode->i_ctime = ext4_current_time(inode);
5446 + err = ext4_mark_iloc_dirty(handle, inode, &iloc);
5448 + ext4_journal_stop(handle);
5452 long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5454 struct inode *inode = filp->f_dentry->d_inode;
5455 @@ -50,6 +79,11 @@ long ext4_ioctl(struct file *filp, unsig
5457 flags = ext4_mask_flags(inode->i_mode, flags);
5459 + if (IS_BARRIER(inode)) {
5460 + vxwprintk_task(1, "messing with the barrier.");
5465 mutex_lock(&inode->i_mutex);
5466 /* Is it quota file? Do not allow user to mess with it */
5467 @@ -67,7 +101,9 @@ long ext4_ioctl(struct file *filp, unsig
5469 * This test looks nicer. Thanks to Pauline Middelink
5471 - if ((flags ^ oldflags) & (EXT4_APPEND_FL | EXT4_IMMUTABLE_FL)) {
5472 + if ((oldflags & EXT4_IMMUTABLE_FL) ||
5473 + ((flags ^ oldflags) & (EXT4_APPEND_FL |
5474 + EXT4_IMMUTABLE_FL | EXT4_IXUNLINK_FL))) {
5475 if (!capable(CAP_LINUX_IMMUTABLE))
5478 diff -NurpP --minimal linux-2.6.33.2/fs/ext4/namei.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/namei.c
5479 --- linux-2.6.33.2/fs/ext4/namei.c 2010-02-25 11:52:05.000000000 +0100
5480 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/namei.c 2010-02-25 12:02:16.000000000 +0100
5482 #include <linux/quotaops.h>
5483 #include <linux/buffer_head.h>
5484 #include <linux/bio.h>
5485 +#include <linux/vs_tag.h>
5487 #include "ext4_jbd2.h"
5489 @@ -941,6 +942,7 @@ restart:
5491 ll_rw_block(READ_META, 1, &bh);
5493 + dx_propagate_tag(nd, inode);
5495 if ((bh = bh_use[ra_ptr++]) == NULL)
5497 @@ -2533,6 +2535,7 @@ const struct inode_operations ext4_dir_i
5499 .check_acl = ext4_check_acl,
5500 .fiemap = ext4_fiemap,
5501 + .sync_flags = ext4_sync_flags,
5504 const struct inode_operations ext4_special_inode_operations = {
5505 diff -NurpP --minimal linux-2.6.33.2/fs/ext4/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/super.c
5506 --- linux-2.6.33.2/fs/ext4/super.c 2010-02-25 11:52:05.000000000 +0100
5507 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ext4/super.c 2010-02-25 12:02:16.000000000 +0100
5508 @@ -1110,6 +1110,7 @@ enum {
5509 Opt_block_validity, Opt_noblock_validity,
5510 Opt_inode_readahead_blks, Opt_journal_ioprio,
5511 Opt_discard, Opt_nodiscard,
5512 + Opt_tag, Opt_notag, Opt_tagid
5515 static const match_table_t tokens = {
5516 @@ -1178,6 +1179,9 @@ static const match_table_t tokens = {
5517 {Opt_noauto_da_alloc, "noauto_da_alloc"},
5518 {Opt_discard, "discard"},
5519 {Opt_nodiscard, "nodiscard"},
5521 + {Opt_notag, "notag"},
5522 + {Opt_tagid, "tagid=%u"},
5526 @@ -1275,6 +1279,20 @@ static int parse_options(char *options,
5528 set_opt(sbi->s_mount_opt, NO_UID32);
5530 +#ifndef CONFIG_TAGGING_NONE
5532 + set_opt (sbi->s_mount_opt, TAGGED);
5535 + clear_opt (sbi->s_mount_opt, TAGGED);
5538 +#ifdef CONFIG_PROPAGATE
5541 + set_opt (sbi->s_mount_opt, TAGGED);
5545 set_opt(sbi->s_mount_opt, DEBUG);
5547 @@ -2476,6 +2494,9 @@ static int ext4_fill_super(struct super_
5548 &journal_ioprio, NULL, 0))
5551 + if (EXT4_SB(sb)->s_mount_opt & EXT4_MOUNT_TAGGED)
5552 + sb->s_flags |= MS_TAGGED;
5554 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5555 ((sbi->s_mount_opt & EXT4_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
5557 @@ -3513,6 +3534,14 @@ static int ext4_remount(struct super_blo
5558 if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED)
5559 ext4_abort(sb, __func__, "Abort forced by user");
5561 + if ((sbi->s_mount_opt & EXT4_MOUNT_TAGGED) &&
5562 + !(sb->s_flags & MS_TAGGED)) {
5563 + printk("EXT4-fs: %s: tagging not permitted on remount.\n",
5566 + goto restore_opts;
5569 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
5570 ((sbi->s_mount_opt & EXT4_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
5572 diff -NurpP --minimal linux-2.6.33.2/fs/fcntl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/fcntl.c
5573 --- linux-2.6.33.2/fs/fcntl.c 2010-02-25 11:52:05.000000000 +0100
5574 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/fcntl.c 2010-02-25 12:02:16.000000000 +0100
5576 #include <linux/signal.h>
5577 #include <linux/rcupdate.h>
5578 #include <linux/pid_namespace.h>
5579 +#include <linux/vs_limit.h>
5581 #include <asm/poll.h>
5582 #include <asm/siginfo.h>
5583 @@ -102,6 +103,8 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldf
5586 filp_close(tofree, files);
5588 + vx_openfd_inc(newfd); /* fd was unused */
5592 @@ -426,6 +429,8 @@ SYSCALL_DEFINE3(fcntl, unsigned int, fd,
5596 + if (!vx_files_avail(1))
5599 err = security_file_fcntl(filp, cmd, arg);
5601 diff -NurpP --minimal linux-2.6.33.2/fs/file.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/file.c
5602 --- linux-2.6.33.2/fs/file.c 2009-12-03 20:02:51.000000000 +0100
5603 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/file.c 2010-02-25 12:02:16.000000000 +0100
5605 #include <linux/spinlock.h>
5606 #include <linux/rcupdate.h>
5607 #include <linux/workqueue.h>
5608 +#include <linux/vs_limit.h>
5610 struct fdtable_defer {
5612 @@ -368,6 +369,8 @@ struct files_struct *dup_fd(struct files
5613 struct file *f = *old_fds++;
5616 + /* TODO: sum it first for check and performance */
5617 + vx_openfd_inc(open_files - i);
5620 * The fd may be claimed in the fd bitmap but not yet
5621 @@ -476,6 +479,7 @@ repeat:
5623 FD_CLR(fd, fdt->close_on_exec);
5625 + vx_openfd_inc(fd);
5628 if (rcu_dereference(fdt->fd[fd]) != NULL) {
5629 diff -NurpP --minimal linux-2.6.33.2/fs/file_table.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/file_table.c
5630 --- linux-2.6.33.2/fs/file_table.c 2010-04-06 01:47:46.000000000 +0200
5631 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/file_table.c 2010-04-06 01:59:25.000000000 +0200
5633 #include <linux/sysctl.h>
5634 #include <linux/percpu_counter.h>
5635 #include <linux/ima.h>
5636 +#include <linux/vs_limit.h>
5637 +#include <linux/vs_context.h>
5639 #include <asm/atomic.h>
5641 @@ -133,6 +135,8 @@ struct file *get_empty_filp(void)
5642 spin_lock_init(&f->f_lock);
5643 eventpoll_init_file(f);
5644 /* f->f_version: 0 */
5645 + f->f_xid = vx_current_xid();
5650 @@ -258,6 +262,8 @@ void __fput(struct file *file)
5651 cdev_put(inode->i_cdev);
5652 fops_put(file->f_op);
5653 put_pid(file->f_owner.pid);
5654 + vx_files_dec(file);
5657 if (file->f_mode & FMODE_WRITE)
5658 drop_file_write_access(file);
5659 @@ -325,6 +331,8 @@ void put_filp(struct file *file)
5661 if (atomic_long_dec_and_test(&file->f_count)) {
5662 security_file_free(file);
5663 + vx_files_dec(file);
5668 diff -NurpP --minimal linux-2.6.33.2/fs/fs_struct.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/fs_struct.c
5669 --- linux-2.6.33.2/fs/fs_struct.c 2009-06-11 17:13:04.000000000 +0200
5670 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/fs_struct.c 2010-02-25 12:02:16.000000000 +0100
5672 #include <linux/path.h>
5673 #include <linux/slab.h>
5674 #include <linux/fs_struct.h>
5675 +#include <linux/vserver/global.h>
5678 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
5679 @@ -77,6 +78,7 @@ void free_fs_struct(struct fs_struct *fs
5681 path_put(&fs->root);
5683 + atomic_dec(&vs_global_fs);
5684 kmem_cache_free(fs_cachep, fs);
5687 @@ -112,6 +114,7 @@ struct fs_struct *copy_fs_struct(struct
5689 path_get(&old->pwd);
5690 read_unlock(&old->lock);
5691 + atomic_inc(&vs_global_fs);
5695 diff -NurpP --minimal linux-2.6.33.2/fs/gfs2/file.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/gfs2/file.c
5696 --- linux-2.6.33.2/fs/gfs2/file.c 2010-04-06 01:47:46.000000000 +0200
5697 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/gfs2/file.c 2010-04-06 01:59:25.000000000 +0200
5698 @@ -132,6 +132,9 @@ static const u32 fsflags_to_gfs2[32] = {
5699 [7] = GFS2_DIF_NOATIME,
5700 [12] = GFS2_DIF_EXHASH,
5701 [14] = GFS2_DIF_INHERIT_JDATA,
5702 + [27] = GFS2_DIF_IXUNLINK,
5703 + [26] = GFS2_DIF_BARRIER,
5704 + [29] = GFS2_DIF_COW,
5707 static const u32 gfs2_to_fsflags[32] = {
5708 @@ -141,6 +144,9 @@ static const u32 gfs2_to_fsflags[32] = {
5709 [gfs2fl_NoAtime] = FS_NOATIME_FL,
5710 [gfs2fl_ExHash] = FS_INDEX_FL,
5711 [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL,
5712 + [gfs2fl_IXUnlink] = FS_IXUNLINK_FL,
5713 + [gfs2fl_Barrier] = FS_BARRIER_FL,
5714 + [gfs2fl_Cow] = FS_COW_FL,
5717 static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
5718 @@ -171,10 +177,16 @@ void gfs2_set_inode_flags(struct inode *
5720 struct gfs2_inode *ip = GFS2_I(inode);
5721 unsigned int flags = inode->i_flags;
5722 + unsigned int vflags = inode->i_vflags;
5724 + flags &= ~(S_IMMUTABLE | S_IXUNLINK |
5725 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
5727 - flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
5728 if (ip->i_diskflags & GFS2_DIF_IMMUTABLE)
5729 flags |= S_IMMUTABLE;
5730 + if (ip->i_diskflags & GFS2_DIF_IXUNLINK)
5731 + flags |= S_IXUNLINK;
5733 if (ip->i_diskflags & GFS2_DIF_APPENDONLY)
5735 if (ip->i_diskflags & GFS2_DIF_NOATIME)
5736 @@ -182,6 +194,43 @@ void gfs2_set_inode_flags(struct inode *
5737 if (ip->i_diskflags & GFS2_DIF_SYNC)
5739 inode->i_flags = flags;
5741 + vflags &= ~(V_BARRIER | V_COW);
5743 + if (ip->i_diskflags & GFS2_DIF_BARRIER)
5744 + vflags |= V_BARRIER;
5745 + if (ip->i_diskflags & GFS2_DIF_COW)
5747 + inode->i_vflags = vflags;
5750 +void gfs2_get_inode_flags(struct inode *inode)
5752 + struct gfs2_inode *ip = GFS2_I(inode);
5753 + unsigned int flags = inode->i_flags;
5754 + unsigned int vflags = inode->i_vflags;
5756 + ip->i_diskflags &= ~(GFS2_DIF_APPENDONLY |
5757 + GFS2_DIF_NOATIME | GFS2_DIF_SYNC |
5758 + GFS2_DIF_IMMUTABLE | GFS2_DIF_IXUNLINK |
5759 + GFS2_DIF_BARRIER | GFS2_DIF_COW);
5761 + if (flags & S_IMMUTABLE)
5762 + ip->i_diskflags |= GFS2_DIF_IMMUTABLE;
5763 + if (flags & S_IXUNLINK)
5764 + ip->i_diskflags |= GFS2_DIF_IXUNLINK;
5766 + if (flags & S_APPEND)
5767 + ip->i_diskflags |= GFS2_DIF_APPENDONLY;
5768 + if (flags & S_NOATIME)
5769 + ip->i_diskflags |= GFS2_DIF_NOATIME;
5770 + if (flags & S_SYNC)
5771 + ip->i_diskflags |= GFS2_DIF_SYNC;
5773 + if (vflags & V_BARRIER)
5774 + ip->i_diskflags |= GFS2_DIF_BARRIER;
5775 + if (vflags & V_COW)
5776 + ip->i_diskflags |= GFS2_DIF_COW;
5779 /* Flags that can be set by user space */
5780 @@ -286,6 +335,37 @@ static int gfs2_set_flags(struct file *f
5781 return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_JDATA);
5784 +int gfs2_sync_flags(struct inode *inode, int flags, int vflags)
5786 + struct gfs2_inode *ip = GFS2_I(inode);
5787 + struct gfs2_sbd *sdp = GFS2_SB(inode);
5788 + struct buffer_head *bh;
5789 + struct gfs2_holder gh;
5792 + error = gfs2_glock_nq_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, &gh);
5795 + error = gfs2_trans_begin(sdp, RES_DINODE, 0);
5798 + error = gfs2_meta_inode_buffer(ip, &bh);
5800 + goto out_trans_end;
5801 + gfs2_trans_add_bh(ip->i_gl, bh, 1);
5802 + inode->i_flags = flags;
5803 + inode->i_vflags = vflags;
5804 + gfs2_get_inode_flags(inode);
5805 + gfs2_dinode_out(ip, bh->b_data);
5807 + gfs2_set_aops(inode);
5809 + gfs2_trans_end(sdp);
5811 + gfs2_glock_dq_uninit(&gh);
5815 static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5818 diff -NurpP --minimal linux-2.6.33.2/fs/gfs2/inode.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/gfs2/inode.h
5819 --- linux-2.6.33.2/fs/gfs2/inode.h 2009-09-10 15:26:22.000000000 +0200
5820 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/gfs2/inode.h 2010-02-25 12:02:16.000000000 +0100
5821 @@ -109,6 +109,7 @@ extern const struct file_operations gfs2
5822 extern const struct file_operations gfs2_dir_fops_nolock;
5824 extern void gfs2_set_inode_flags(struct inode *inode);
5825 +extern int gfs2_sync_flags(struct inode *inode, int flags, int vflags);
5827 #ifdef CONFIG_GFS2_FS_LOCKING_DLM
5828 extern const struct file_operations gfs2_file_fops;
5829 diff -NurpP --minimal linux-2.6.33.2/fs/gfs2/ops_inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/gfs2/ops_inode.c
5830 --- linux-2.6.33.2/fs/gfs2/ops_inode.c 2010-02-25 11:52:05.000000000 +0100
5831 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/gfs2/ops_inode.c 2010-02-25 12:02:16.000000000 +0100
5832 @@ -1403,6 +1403,7 @@ const struct inode_operations gfs2_file_
5833 .listxattr = gfs2_listxattr,
5834 .removexattr = gfs2_removexattr,
5835 .fiemap = gfs2_fiemap,
5836 + .sync_flags = gfs2_sync_flags,
5839 const struct inode_operations gfs2_dir_iops = {
5840 @@ -1423,6 +1424,7 @@ const struct inode_operations gfs2_dir_i
5841 .listxattr = gfs2_listxattr,
5842 .removexattr = gfs2_removexattr,
5843 .fiemap = gfs2_fiemap,
5844 + .sync_flags = gfs2_sync_flags,
5847 const struct inode_operations gfs2_symlink_iops = {
5848 diff -NurpP --minimal linux-2.6.33.2/fs/hfsplus/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/hfsplus/ioctl.c
5849 --- linux-2.6.33.2/fs/hfsplus/ioctl.c 2008-12-25 00:26:37.000000000 +0100
5850 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/hfsplus/ioctl.c 2010-02-25 12:02:16.000000000 +0100
5852 #include <linux/mount.h>
5853 #include <linux/sched.h>
5854 #include <linux/xattr.h>
5855 +#include <linux/mount.h>
5856 #include <asm/uaccess.h>
5857 #include "hfsplus_fs.h"
5859 diff -NurpP --minimal linux-2.6.33.2/fs/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/inode.c
5860 --- linux-2.6.33.2/fs/inode.c 2010-02-25 11:52:05.000000000 +0100
5861 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/inode.c 2010-02-25 12:02:16.000000000 +0100
5862 @@ -132,6 +132,9 @@ int inode_init_always(struct super_block
5863 struct address_space *const mapping = &inode->i_data;
5867 + /* essential because of inode slab reuse */
5869 inode->i_blkbits = sb->s_blocksize_bits;
5871 atomic_set(&inode->i_count, 1);
5872 @@ -152,6 +155,7 @@ int inode_init_always(struct super_block
5873 inode->i_bdev = NULL;
5874 inode->i_cdev = NULL;
5876 + inode->i_mdev = 0;
5877 inode->dirtied_when = 0;
5879 if (security_inode_alloc(inode))
5880 @@ -297,6 +301,8 @@ void __iget(struct inode *inode)
5881 inodes_stat.nr_unused--;
5884 +EXPORT_SYMBOL_GPL(__iget);
5887 * clear_inode - clear an inode
5888 * @inode: inode to clear
5889 @@ -1601,9 +1607,11 @@ void init_special_inode(struct inode *in
5890 if (S_ISCHR(mode)) {
5891 inode->i_fop = &def_chr_fops;
5892 inode->i_rdev = rdev;
5893 + inode->i_mdev = rdev;
5894 } else if (S_ISBLK(mode)) {
5895 inode->i_fop = &def_blk_fops;
5896 inode->i_rdev = rdev;
5897 + inode->i_mdev = rdev;
5898 } else if (S_ISFIFO(mode))
5899 inode->i_fop = &def_fifo_fops;
5900 else if (S_ISSOCK(mode))
5901 diff -NurpP --minimal linux-2.6.33.2/fs/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ioctl.c
5902 --- linux-2.6.33.2/fs/ioctl.c 2009-12-03 20:02:52.000000000 +0100
5903 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ioctl.c 2010-02-25 12:02:16.000000000 +0100
5905 #include <linux/writeback.h>
5906 #include <linux/buffer_head.h>
5907 #include <linux/falloc.h>
5908 +#include <linux/proc_fs.h>
5909 +#include <linux/vserver/inode.h>
5910 +#include <linux/vs_tag.h>
5912 #include <asm/ioctls.h>
5914 diff -NurpP --minimal linux-2.6.33.2/fs/ioprio.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ioprio.c
5915 --- linux-2.6.33.2/fs/ioprio.c 2009-03-24 14:22:26.000000000 +0100
5916 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ioprio.c 2010-02-25 12:02:16.000000000 +0100
5918 #include <linux/syscalls.h>
5919 #include <linux/security.h>
5920 #include <linux/pid_namespace.h>
5921 +#include <linux/vs_base.h>
5923 int set_task_ioprio(struct task_struct *task, int ioprio)
5925 @@ -123,6 +124,8 @@ SYSCALL_DEFINE3(ioprio_set, int, which,
5927 pgrp = find_vpid(who);
5928 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
5929 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
5931 ret = set_task_ioprio(p, ioprio);
5934 @@ -212,6 +215,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which,
5936 pgrp = find_vpid(who);
5937 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
5938 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
5940 tmpio = get_task_ioprio(p);
5943 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/acl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/acl.c
5944 --- linux-2.6.33.2/fs/jfs/acl.c 2009-12-03 20:02:52.000000000 +0100
5945 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/acl.c 2010-02-25 12:02:16.000000000 +0100
5946 @@ -216,7 +216,8 @@ int jfs_setattr(struct dentry *dentry, s
5949 if ((iattr->ia_valid & ATTR_UID && iattr->ia_uid != inode->i_uid) ||
5950 - (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid)) {
5951 + (iattr->ia_valid & ATTR_GID && iattr->ia_gid != inode->i_gid) ||
5952 + (iattr->ia_valid & ATTR_TAG && iattr->ia_tag != inode->i_tag)) {
5953 if (vfs_dq_transfer(inode, iattr))
5956 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/file.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/file.c
5957 --- linux-2.6.33.2/fs/jfs/file.c 2009-12-03 20:02:52.000000000 +0100
5958 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/file.c 2010-02-25 12:02:16.000000000 +0100
5959 @@ -98,6 +98,7 @@ const struct inode_operations jfs_file_i
5960 .setattr = jfs_setattr,
5961 .check_acl = jfs_check_acl,
5963 + .sync_flags = jfs_sync_flags,
5966 const struct file_operations jfs_file_operations = {
5967 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/ioctl.c
5968 --- linux-2.6.33.2/fs/jfs/ioctl.c 2008-12-25 00:26:37.000000000 +0100
5969 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/ioctl.c 2010-02-25 12:02:16.000000000 +0100
5971 #include <linux/mount.h>
5972 #include <linux/time.h>
5973 #include <linux/sched.h>
5974 +#include <linux/mount.h>
5975 #include <asm/current.h>
5976 #include <asm/uaccess.h>
5978 @@ -52,6 +53,16 @@ static long jfs_map_ext2(unsigned long f
5982 +int jfs_sync_flags(struct inode *inode, int flags, int vflags)
5984 + inode->i_flags = flags;
5985 + inode->i_vflags = vflags;
5986 + jfs_get_inode_flags(JFS_IP(inode));
5987 + inode->i_ctime = CURRENT_TIME_SEC;
5988 + mark_inode_dirty(inode);
5992 long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
5994 struct inode *inode = filp->f_dentry->d_inode;
5995 @@ -85,6 +96,11 @@ long jfs_ioctl(struct file *filp, unsign
5996 if (!S_ISDIR(inode->i_mode))
5997 flags &= ~JFS_DIRSYNC_FL;
5999 + if (IS_BARRIER(inode)) {
6000 + vxwprintk_task(1, "messing with the barrier.");
6004 /* Is it quota file? Do not allow user to mess with it */
6005 if (IS_NOQUOTA(inode)) {
6007 @@ -102,8 +118,8 @@ long jfs_ioctl(struct file *filp, unsign
6008 * the relevant capability.
6010 if ((oldflags & JFS_IMMUTABLE_FL) ||
6011 - ((flags ^ oldflags) &
6012 - (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) {
6013 + ((flags ^ oldflags) & (JFS_APPEND_FL |
6014 + JFS_IMMUTABLE_FL | JFS_IXUNLINK_FL))) {
6015 if (!capable(CAP_LINUX_IMMUTABLE)) {
6016 mutex_unlock(&inode->i_mutex);
6018 @@ -111,7 +127,7 @@ long jfs_ioctl(struct file *filp, unsign
6022 - flags = flags & JFS_FL_USER_MODIFIABLE;
6023 + flags &= JFS_FL_USER_MODIFIABLE;
6024 flags |= oldflags & ~JFS_FL_USER_MODIFIABLE;
6025 jfs_inode->mode2 = flags;
6027 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/jfs_dinode.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_dinode.h
6028 --- linux-2.6.33.2/fs/jfs/jfs_dinode.h 2008-12-25 00:26:37.000000000 +0100
6029 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_dinode.h 2010-02-25 12:02:16.000000000 +0100
6030 @@ -161,9 +161,13 @@ struct dinode {
6032 #define JFS_APPEND_FL 0x01000000 /* writes to file may only append */
6033 #define JFS_IMMUTABLE_FL 0x02000000 /* Immutable file */
6034 +#define JFS_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
6036 -#define JFS_FL_USER_VISIBLE 0x03F80000
6037 -#define JFS_FL_USER_MODIFIABLE 0x03F80000
6038 +#define JFS_BARRIER_FL 0x04000000 /* Barrier for chroot() */
6039 +#define JFS_COW_FL 0x20000000 /* Copy on Write marker */
6041 +#define JFS_FL_USER_VISIBLE 0x07F80000
6042 +#define JFS_FL_USER_MODIFIABLE 0x07F80000
6043 #define JFS_FL_INHERIT 0x03C80000
6045 /* These are identical to EXT[23]_IOC_GETFLAGS/SETFLAGS */
6046 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/jfs_filsys.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_filsys.h
6047 --- linux-2.6.33.2/fs/jfs/jfs_filsys.h 2008-12-25 00:26:37.000000000 +0100
6048 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_filsys.h 2010-02-25 12:02:16.000000000 +0100
6050 #define JFS_NAME_MAX 255
6051 #define JFS_PATH_MAX BPSIZE
6053 +#define JFS_TAGGED 0x00800000 /* Context Tagging */
6056 * file system state (superblock state)
6057 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/jfs_imap.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_imap.c
6058 --- linux-2.6.33.2/fs/jfs/jfs_imap.c 2009-09-10 15:26:22.000000000 +0200
6059 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_imap.c 2010-02-25 12:02:16.000000000 +0100
6061 #include <linux/buffer_head.h>
6062 #include <linux/pagemap.h>
6063 #include <linux/quotaops.h>
6064 +#include <linux/vs_tag.h>
6066 #include "jfs_incore.h"
6067 #include "jfs_inode.h"
6068 @@ -3059,6 +3060,8 @@ static int copy_from_dinode(struct dinod
6070 struct jfs_inode_info *jfs_ip = JFS_IP(ip);
6071 struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
6075 jfs_ip->fileset = le32_to_cpu(dip->di_fileset);
6076 jfs_ip->mode2 = le32_to_cpu(dip->di_mode);
6077 @@ -3079,14 +3082,18 @@ static int copy_from_dinode(struct dinod
6079 ip->i_nlink = le32_to_cpu(dip->di_nlink);
6081 - jfs_ip->saved_uid = le32_to_cpu(dip->di_uid);
6082 + uid = le32_to_cpu(dip->di_uid);
6083 + gid = le32_to_cpu(dip->di_gid);
6084 + ip->i_tag = INOTAG_TAG(DX_TAG(ip), uid, gid, 0);
6086 + jfs_ip->saved_uid = INOTAG_UID(DX_TAG(ip), uid, gid);
6088 ip->i_uid = jfs_ip->saved_uid;
6090 ip->i_uid = sbi->uid;
6093 - jfs_ip->saved_gid = le32_to_cpu(dip->di_gid);
6094 + jfs_ip->saved_gid = INOTAG_GID(DX_TAG(ip), uid, gid);
6096 ip->i_gid = jfs_ip->saved_gid;
6098 @@ -3151,14 +3158,12 @@ static void copy_to_dinode(struct dinode
6099 dip->di_size = cpu_to_le64(ip->i_size);
6100 dip->di_nblocks = cpu_to_le64(PBLK2LBLK(ip->i_sb, ip->i_blocks));
6101 dip->di_nlink = cpu_to_le32(ip->i_nlink);
6102 - if (sbi->uid == -1)
6103 - dip->di_uid = cpu_to_le32(ip->i_uid);
6105 - dip->di_uid = cpu_to_le32(jfs_ip->saved_uid);
6106 - if (sbi->gid == -1)
6107 - dip->di_gid = cpu_to_le32(ip->i_gid);
6109 - dip->di_gid = cpu_to_le32(jfs_ip->saved_gid);
6111 + dip->di_uid = cpu_to_le32(TAGINO_UID(DX_TAG(ip),
6112 + (sbi->uid == -1) ? ip->i_uid : jfs_ip->saved_uid, ip->i_tag));
6113 + dip->di_gid = cpu_to_le32(TAGINO_GID(DX_TAG(ip),
6114 + (sbi->gid == -1) ? ip->i_gid : jfs_ip->saved_gid, ip->i_tag));
6116 jfs_get_inode_flags(jfs_ip);
6118 * mode2 is only needed for storing the higher order bits.
6119 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/jfs_inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_inode.c
6120 --- linux-2.6.33.2/fs/jfs/jfs_inode.c 2009-06-11 17:13:05.000000000 +0200
6121 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_inode.c 2010-02-25 12:02:16.000000000 +0100
6124 #include <linux/fs.h>
6125 #include <linux/quotaops.h>
6126 +#include <linux/vs_tag.h>
6127 #include "jfs_incore.h"
6128 #include "jfs_inode.h"
6129 #include "jfs_filsys.h"
6130 @@ -30,29 +31,46 @@ void jfs_set_inode_flags(struct inode *i
6132 unsigned int flags = JFS_IP(inode)->mode2;
6134 - inode->i_flags &= ~(S_IMMUTABLE | S_APPEND |
6135 - S_NOATIME | S_DIRSYNC | S_SYNC);
6136 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
6137 + S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
6139 if (flags & JFS_IMMUTABLE_FL)
6140 inode->i_flags |= S_IMMUTABLE;
6141 + if (flags & JFS_IXUNLINK_FL)
6142 + inode->i_flags |= S_IXUNLINK;
6144 + if (flags & JFS_SYNC_FL)
6145 + inode->i_flags |= S_SYNC;
6146 if (flags & JFS_APPEND_FL)
6147 inode->i_flags |= S_APPEND;
6148 if (flags & JFS_NOATIME_FL)
6149 inode->i_flags |= S_NOATIME;
6150 if (flags & JFS_DIRSYNC_FL)
6151 inode->i_flags |= S_DIRSYNC;
6152 - if (flags & JFS_SYNC_FL)
6153 - inode->i_flags |= S_SYNC;
6155 + inode->i_vflags &= ~(V_BARRIER | V_COW);
6157 + if (flags & JFS_BARRIER_FL)
6158 + inode->i_vflags |= V_BARRIER;
6159 + if (flags & JFS_COW_FL)
6160 + inode->i_vflags |= V_COW;
6163 void jfs_get_inode_flags(struct jfs_inode_info *jfs_ip)
6165 unsigned int flags = jfs_ip->vfs_inode.i_flags;
6166 + unsigned int vflags = jfs_ip->vfs_inode.i_vflags;
6168 + jfs_ip->mode2 &= ~(JFS_IMMUTABLE_FL | JFS_IXUNLINK_FL |
6169 + JFS_APPEND_FL | JFS_NOATIME_FL |
6170 + JFS_DIRSYNC_FL | JFS_SYNC_FL |
6171 + JFS_BARRIER_FL | JFS_COW_FL);
6173 - jfs_ip->mode2 &= ~(JFS_IMMUTABLE_FL | JFS_APPEND_FL | JFS_NOATIME_FL |
6174 - JFS_DIRSYNC_FL | JFS_SYNC_FL);
6175 if (flags & S_IMMUTABLE)
6176 jfs_ip->mode2 |= JFS_IMMUTABLE_FL;
6177 + if (flags & S_IXUNLINK)
6178 + jfs_ip->mode2 |= JFS_IXUNLINK_FL;
6180 if (flags & S_APPEND)
6181 jfs_ip->mode2 |= JFS_APPEND_FL;
6182 if (flags & S_NOATIME)
6183 @@ -61,6 +79,11 @@ void jfs_get_inode_flags(struct jfs_inod
6184 jfs_ip->mode2 |= JFS_DIRSYNC_FL;
6186 jfs_ip->mode2 |= JFS_SYNC_FL;
6188 + if (vflags & V_BARRIER)
6189 + jfs_ip->mode2 |= JFS_BARRIER_FL;
6190 + if (vflags & V_COW)
6191 + jfs_ip->mode2 |= JFS_COW_FL;
6195 @@ -105,6 +128,7 @@ struct inode *ialloc(struct inode *paren
6198 inode->i_gid = current_fsgid();
6199 + inode->i_tag = dx_current_fstag(sb);
6202 * New inodes need to save sane values on disk when
6203 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/jfs_inode.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_inode.h
6204 --- linux-2.6.33.2/fs/jfs/jfs_inode.h 2009-06-11 17:13:05.000000000 +0200
6205 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/jfs_inode.h 2010-02-25 12:02:16.000000000 +0100
6206 @@ -39,6 +39,7 @@ extern struct dentry *jfs_fh_to_dentry(s
6207 extern struct dentry *jfs_fh_to_parent(struct super_block *sb, struct fid *fid,
6208 int fh_len, int fh_type);
6209 extern void jfs_set_inode_flags(struct inode *);
6210 +extern int jfs_sync_flags(struct inode *, int, int);
6211 extern int jfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
6213 extern const struct address_space_operations jfs_aops;
6214 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/namei.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/namei.c
6215 --- linux-2.6.33.2/fs/jfs/namei.c 2009-12-03 20:02:52.000000000 +0100
6216 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/namei.c 2010-02-25 12:02:16.000000000 +0100
6218 #include <linux/ctype.h>
6219 #include <linux/quotaops.h>
6220 #include <linux/exportfs.h>
6221 +#include <linux/vs_tag.h>
6222 #include "jfs_incore.h"
6223 #include "jfs_superblock.h"
6224 #include "jfs_inode.h"
6225 @@ -1476,6 +1477,7 @@ static struct dentry *jfs_lookup(struct
6226 return ERR_CAST(ip);
6229 + dx_propagate_tag(nd, ip);
6230 dentry = d_splice_alias(ip, dentry);
6232 if (dentry && (JFS_SBI(dip->i_sb)->mntflag & JFS_OS2))
6233 @@ -1545,6 +1547,7 @@ const struct inode_operations jfs_dir_in
6234 .setattr = jfs_setattr,
6235 .check_acl = jfs_check_acl,
6237 + .sync_flags = jfs_sync_flags,
6240 const struct file_operations jfs_dir_operations = {
6241 diff -NurpP --minimal linux-2.6.33.2/fs/jfs/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/super.c
6242 --- linux-2.6.33.2/fs/jfs/super.c 2010-02-25 11:52:05.000000000 +0100
6243 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/jfs/super.c 2010-02-25 12:02:16.000000000 +0100
6244 @@ -192,7 +192,8 @@ static void jfs_put_super(struct super_b
6246 Opt_integrity, Opt_nointegrity, Opt_iocharset, Opt_resize,
6247 Opt_resize_nosize, Opt_errors, Opt_ignore, Opt_err, Opt_quota,
6248 - Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask
6249 + Opt_usrquota, Opt_grpquota, Opt_uid, Opt_gid, Opt_umask,
6250 + Opt_tag, Opt_notag, Opt_tagid
6253 static const match_table_t tokens = {
6254 @@ -202,6 +203,10 @@ static const match_table_t tokens = {
6255 {Opt_resize, "resize=%u"},
6256 {Opt_resize_nosize, "resize"},
6257 {Opt_errors, "errors=%s"},
6259 + {Opt_notag, "notag"},
6260 + {Opt_tagid, "tagid=%u"},
6261 + {Opt_tag, "tagxid"},
6262 {Opt_ignore, "noquota"},
6263 {Opt_ignore, "quota"},
6264 {Opt_usrquota, "usrquota"},
6265 @@ -336,6 +341,20 @@ static int parse_options(char *options,
6269 +#ifndef CONFIG_TAGGING_NONE
6271 + *flag |= JFS_TAGGED;
6274 + *flag &= JFS_TAGGED;
6277 +#ifdef CONFIG_PROPAGATE
6280 + *flag |= JFS_TAGGED;
6284 printk("jfs: Unrecognized mount option \"%s\" "
6285 " or missing value\n", p);
6286 @@ -366,6 +385,12 @@ static int jfs_remount(struct super_bloc
6287 if (!parse_options(data, sb, &newLVSize, &flag)) {
6290 + if ((flag & JFS_TAGGED) && !(sb->s_flags & MS_TAGGED)) {
6291 + printk(KERN_ERR "JFS: %s: tagging not permitted on remount.\n",
6298 if (sb->s_flags & MS_RDONLY) {
6299 @@ -449,6 +474,9 @@ static int jfs_fill_super(struct super_b
6300 #ifdef CONFIG_JFS_POSIX_ACL
6301 sb->s_flags |= MS_POSIXACL;
6303 + /* map mount option tagxid */
6304 + if (sbi->flag & JFS_TAGGED)
6305 + sb->s_flags |= MS_TAGGED;
6308 printk(KERN_ERR "resize option for remount only\n");
6309 diff -NurpP --minimal linux-2.6.33.2/fs/libfs.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/libfs.c
6310 --- linux-2.6.33.2/fs/libfs.c 2010-02-25 11:52:05.000000000 +0100
6311 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/libfs.c 2010-02-25 12:02:16.000000000 +0100
6312 @@ -127,7 +127,8 @@ static inline unsigned char dt_type(stru
6313 * both impossible due to the lock on directory.
6316 -int dcache_readdir(struct file * filp, void * dirent, filldir_t filldir)
6317 +static inline int do_dcache_readdir_filter(struct file *filp,
6318 + void *dirent, filldir_t filldir, int (*filter)(struct dentry *dentry))
6320 struct dentry *dentry = filp->f_path.dentry;
6321 struct dentry *cursor = filp->private_data;
6322 @@ -160,6 +161,8 @@ int dcache_readdir(struct file * filp, v
6323 next = list_entry(p, struct dentry, d_u.d_child);
6324 if (d_unhashed(next) || !next->d_inode)
6326 + if (filter && !filter(next))
6329 spin_unlock(&dcache_lock);
6330 if (filldir(dirent, next->d_name.name,
6331 @@ -178,6 +181,18 @@ int dcache_readdir(struct file * filp, v
6335 +int dcache_readdir(struct file *filp, void *dirent, filldir_t filldir)
6337 + return do_dcache_readdir_filter(filp, dirent, filldir, NULL);
6340 +int dcache_readdir_filter(struct file *filp, void *dirent, filldir_t filldir,
6341 + int (*filter)(struct dentry *))
6343 + return do_dcache_readdir_filter(filp, dirent, filldir, filter);
6347 ssize_t generic_read_dir(struct file *filp, char __user *buf, size_t siz, loff_t *ppos)
6350 @@ -841,6 +856,7 @@ EXPORT_SYMBOL(dcache_dir_close);
6351 EXPORT_SYMBOL(dcache_dir_lseek);
6352 EXPORT_SYMBOL(dcache_dir_open);
6353 EXPORT_SYMBOL(dcache_readdir);
6354 +EXPORT_SYMBOL(dcache_readdir_filter);
6355 EXPORT_SYMBOL(generic_read_dir);
6356 EXPORT_SYMBOL(get_sb_pseudo);
6357 EXPORT_SYMBOL(simple_write_begin);
6358 diff -NurpP --minimal linux-2.6.33.2/fs/locks.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/locks.c
6359 --- linux-2.6.33.2/fs/locks.c 2009-12-03 20:02:52.000000000 +0100
6360 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/locks.c 2010-02-25 12:02:16.000000000 +0100
6362 #include <linux/time.h>
6363 #include <linux/rcupdate.h>
6364 #include <linux/pid_namespace.h>
6365 +#include <linux/vs_base.h>
6366 +#include <linux/vs_limit.h>
6368 #include <asm/uaccess.h>
6370 @@ -148,6 +150,8 @@ static struct kmem_cache *filelock_cache
6371 /* Allocate an empty lock structure. */
6372 static struct file_lock *locks_alloc_lock(void)
6374 + if (!vx_locks_avail(1))
6376 return kmem_cache_alloc(filelock_cache, GFP_KERNEL);
6379 @@ -174,6 +178,7 @@ static void locks_free_lock(struct file_
6380 BUG_ON(!list_empty(&fl->fl_block));
6381 BUG_ON(!list_empty(&fl->fl_link));
6384 locks_release_private(fl);
6385 kmem_cache_free(filelock_cache, fl);
6387 @@ -194,6 +199,7 @@ void locks_init_lock(struct file_lock *f
6388 fl->fl_start = fl->fl_end = 0;
6390 fl->fl_lmops = NULL;
6394 EXPORT_SYMBOL(locks_init_lock);
6395 @@ -248,6 +254,7 @@ void locks_copy_lock(struct file_lock *n
6396 new->fl_file = fl->fl_file;
6397 new->fl_ops = fl->fl_ops;
6398 new->fl_lmops = fl->fl_lmops;
6399 + new->fl_xid = fl->fl_xid;
6401 locks_copy_private(new, fl);
6403 @@ -286,6 +293,11 @@ static int flock_make_lock(struct file *
6404 fl->fl_flags = FL_FLOCK;
6406 fl->fl_end = OFFSET_MAX;
6408 + vxd_assert(filp->f_xid == vx_current_xid(),
6409 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6410 + fl->fl_xid = filp->f_xid;
6415 @@ -451,6 +463,7 @@ static int lease_init(struct file *filp,
6417 fl->fl_owner = current->files;
6418 fl->fl_pid = current->tgid;
6419 + fl->fl_xid = vx_current_xid();
6422 fl->fl_flags = FL_LEASE;
6423 @@ -470,6 +483,11 @@ static struct file_lock *lease_alloc(str
6425 return ERR_PTR(error);
6427 + fl->fl_xid = vx_current_xid();
6429 + vxd_assert(filp->f_xid == fl->fl_xid,
6430 + "f_xid(%d) == fl_xid(%d)", filp->f_xid, fl->fl_xid);
6432 error = lease_init(filp, type, fl);
6434 locks_free_lock(fl);
6435 @@ -770,6 +788,7 @@ static int flock_lock_file(struct file *
6439 + new_fl->fl_xid = -1;
6441 for_each_lock(inode, before) {
6442 struct file_lock *fl = *before;
6443 @@ -790,6 +809,7 @@ find_conflict:
6445 locks_copy_lock(new_fl, request);
6446 locks_insert_lock(before, new_fl);
6447 + vx_locks_inc(new_fl);
6451 @@ -800,7 +820,8 @@ out:
6455 -static int __posix_lock_file(struct inode *inode, struct file_lock *request, struct file_lock *conflock)
6456 +static int __posix_lock_file(struct inode *inode, struct file_lock *request,
6457 + struct file_lock *conflock, xid_t xid)
6459 struct file_lock *fl;
6460 struct file_lock *new_fl = NULL;
6461 @@ -810,6 +831,8 @@ static int __posix_lock_file(struct inod
6462 struct file_lock **before;
6463 int error, added = 0;
6465 + vxd_assert(xid == vx_current_xid(),
6466 + "xid(%d) == current(%d)", xid, vx_current_xid());
6468 * We may need two file_lock structures for this operation,
6469 * so we get them in advance to avoid races.
6470 @@ -820,7 +843,11 @@ static int __posix_lock_file(struct inod
6471 (request->fl_type != F_UNLCK ||
6472 request->fl_start != 0 || request->fl_end != OFFSET_MAX)) {
6473 new_fl = locks_alloc_lock();
6474 + new_fl->fl_xid = xid;
6475 + vx_locks_inc(new_fl);
6476 new_fl2 = locks_alloc_lock();
6477 + new_fl2->fl_xid = xid;
6478 + vx_locks_inc(new_fl2);
6482 @@ -1019,7 +1046,8 @@ static int __posix_lock_file(struct inod
6483 int posix_lock_file(struct file *filp, struct file_lock *fl,
6484 struct file_lock *conflock)
6486 - return __posix_lock_file(filp->f_path.dentry->d_inode, fl, conflock);
6487 + return __posix_lock_file(filp->f_path.dentry->d_inode,
6488 + fl, conflock, filp->f_xid);
6490 EXPORT_SYMBOL(posix_lock_file);
6492 @@ -1109,7 +1137,7 @@ int locks_mandatory_area(int read_write,
6493 fl.fl_end = offset + count - 1;
6496 - error = __posix_lock_file(inode, &fl, NULL);
6497 + error = __posix_lock_file(inode, &fl, NULL, filp->f_xid);
6498 if (error != FILE_LOCK_DEFERRED)
6500 error = wait_event_interruptible(fl.fl_wait, !fl.fl_next);
6501 @@ -1424,6 +1452,7 @@ int generic_setlease(struct file *filp,
6503 locks_copy_lock(new_fl, lease);
6504 locks_insert_lock(before, new_fl);
6505 + vx_locks_inc(new_fl);
6509 @@ -1779,6 +1808,11 @@ int fcntl_setlk(unsigned int fd, struct
6510 if (file_lock == NULL)
6513 + vxd_assert(filp->f_xid == vx_current_xid(),
6514 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6515 + file_lock->fl_xid = filp->f_xid;
6516 + vx_locks_inc(file_lock);
6519 * This might block, so we do it before checking the inode.
6521 @@ -1897,6 +1931,11 @@ int fcntl_setlk64(unsigned int fd, struc
6522 if (file_lock == NULL)
6525 + vxd_assert(filp->f_xid == vx_current_xid(),
6526 + "f_xid(%d) == current(%d)", filp->f_xid, vx_current_xid());
6527 + file_lock->fl_xid = filp->f_xid;
6528 + vx_locks_inc(file_lock);
6531 * This might block, so we do it before checking the inode.
6533 @@ -2162,8 +2201,11 @@ static int locks_show(struct seq_file *f
6535 lock_get_status(f, fl, (long)f->private, "");
6537 - list_for_each_entry(bfl, &fl->fl_block, fl_block)
6538 + list_for_each_entry(bfl, &fl->fl_block, fl_block) {
6539 + if (!vx_check(fl->fl_xid, VS_WATCH_P | VS_IDENT))
6541 lock_get_status(f, bfl, (long)f->private, " ->");
6546 diff -NurpP --minimal linux-2.6.33.2/fs/namei.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/namei.c
6547 --- linux-2.6.33.2/fs/namei.c 2010-02-25 11:52:05.000000000 +0100
6548 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/namei.c 2010-02-25 15:31:15.000000000 +0100
6550 #include <linux/fcntl.h>
6551 #include <linux/device_cgroup.h>
6552 #include <linux/fs_struct.h>
6553 +#include <linux/proc_fs.h>
6554 +#include <linux/vserver/inode.h>
6555 +#include <linux/vs_base.h>
6556 +#include <linux/vs_tag.h>
6557 +#include <linux/vs_cowbl.h>
6558 +#include <linux/vs_device.h>
6559 +#include <linux/vs_context.h>
6560 +#include <linux/pid_namespace.h>
6561 #include <asm/uaccess.h>
6563 #include "internal.h"
6564 @@ -167,6 +175,77 @@ void putname(const char *name)
6565 EXPORT_SYMBOL(putname);
6568 +static inline int dx_barrier(const struct inode *inode)
6570 + if (IS_BARRIER(inode) && !vx_check(0, VS_ADMIN | VS_WATCH)) {
6571 + vxwprintk_task(1, "did hit the barrier.");
6577 +static int __dx_permission(const struct inode *inode, int mask)
6579 + if (dx_barrier(inode))
6582 + if (inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC) {
6583 + /* devpts is xid tagged */
6584 + if (S_ISDIR(inode->i_mode) ||
6585 + vx_check((xid_t)inode->i_tag, VS_IDENT | VS_WATCH_P))
6588 + else if (inode->i_sb->s_magic == PROC_SUPER_MAGIC) {
6589 + struct proc_dir_entry *de = PDE(inode);
6591 + if (de && !vx_hide_check(0, de->vx_flags))
6594 + if ((mask & (MAY_WRITE | MAY_APPEND))) {
6596 + struct task_struct *tsk;
6598 + if (vx_check(0, VS_ADMIN | VS_WATCH_P) ||
6599 + vx_flags(VXF_STATE_SETUP, 0))
6602 + pid = PROC_I(inode)->pid;
6606 + tsk = pid_task(pid, PIDTYPE_PID);
6607 + vxdprintk(VXD_CBIT(tag, 0), "accessing %p[#%u]",
6608 + tsk, (tsk ? vx_task_xid(tsk) : 0));
6609 + if (tsk && vx_check(vx_task_xid(tsk), VS_IDENT | VS_WATCH_P))
6613 + /* FIXME: Should we block some entries here? */
6618 + if (dx_notagcheck(inode->i_sb) ||
6619 + dx_check(inode->i_tag, DX_HOSTID | DX_ADMIN | DX_WATCH |
6628 +int dx_permission(const struct inode *inode, int mask)
6630 + int ret = __dx_permission(inode, mask);
6631 + if (unlikely(ret)) {
6632 + vxwprintk_task(1, "denied %x access to %s:%p[#%d,%lu]",
6633 + mask, inode->i_sb->s_id, inode, inode->i_tag,
6640 * This does basic POSIX ACL permission checking
6642 @@ -267,10 +346,14 @@ int inode_permission(struct inode *inode
6644 * Nobody gets write access to an immutable file.
6646 - if (IS_IMMUTABLE(inode))
6647 + if (IS_IMMUTABLE(inode) && !IS_COW(inode))
6651 + retval = dx_permission(inode, mask);
6655 if (inode->i_op->permission)
6656 retval = inode->i_op->permission(inode, mask);
6658 @@ -465,6 +548,9 @@ static int exec_permission(struct inode
6662 + if (dx_barrier(inode))
6665 if (inode->i_op->permission) {
6666 ret = inode->i_op->permission(inode, MAY_EXEC);
6668 @@ -694,7 +780,8 @@ static __always_inline void follow_dotdo
6670 if (nd->path.dentry == nd->root.dentry &&
6671 nd->path.mnt == nd->root.mnt) {
6673 + /* for sane '/' avoid follow_mount() */
6676 spin_lock(&dcache_lock);
6677 if (nd->path.dentry != nd->path.mnt->mnt_root) {
6678 @@ -730,7 +817,7 @@ static int do_lookup(struct nameidata *n
6680 struct vfsmount *mnt = nd->path.mnt;
6681 struct dentry *dentry, *parent;
6682 - struct inode *dir;
6683 + struct inode *dir, *inode;
6685 * See if the low-level filesystem might want
6686 * to use its own hash..
6687 @@ -746,12 +833,26 @@ static int do_lookup(struct nameidata *n
6689 if (dentry->d_op && dentry->d_op->d_revalidate)
6690 goto need_revalidate;
6692 + inode = dentry->d_inode;
6696 + if (__dx_permission(inode, MAY_ACCESS))
6700 path->dentry = dentry;
6701 __follow_mount(path);
6705 + vxwprintk_task(1, "did lookup hidden %s:%p[#%d,%lu] »%s/%.*s«.",
6706 + inode->i_sb->s_id, inode, inode->i_tag, inode->i_ino,
6707 + vxd_path(&nd->path), name->len, name->name);
6712 parent = nd->path.dentry;
6713 dir = parent->d_inode;
6714 @@ -1355,7 +1456,7 @@ static int may_delete(struct inode *dir,
6717 if (check_sticky(dir, victim->d_inode)||IS_APPEND(victim->d_inode)||
6718 - IS_IMMUTABLE(victim->d_inode) || IS_SWAPFILE(victim->d_inode))
6719 + IS_IXORUNLINK(victim->d_inode) || IS_SWAPFILE(victim->d_inode))
6722 if (!S_ISDIR(victim->d_inode->i_mode))
6723 @@ -1495,6 +1596,14 @@ int may_open(struct path *path, int acc_
6727 +#ifdef CONFIG_VSERVER_COWBL
6728 + if (IS_COW(inode) && (flag & FMODE_WRITE)) {
6729 + if (IS_COW_LINK(inode))
6731 + inode->i_flags &= ~(S_IXUNLINK|S_IMMUTABLE);
6732 + mark_inode_dirty(inode);
6735 error = inode_permission(inode, acc_mode);
6738 @@ -1621,6 +1730,11 @@ struct file *do_filp_open(int dfd, const
6739 int flag = open_to_namei_flags(open_flag);
6740 int force_reval = 0;
6742 +#ifdef CONFIG_VSERVER_COWBL
6748 * O_SYNC is implemented as __O_SYNC|O_DSYNC. As many places only
6749 * check for O_DSYNC if the need any syncing at all we enforce it's
6750 @@ -1799,6 +1913,25 @@ ok:
6753 error = may_open(&nd.path, acc_mode, flag);
6754 +#ifdef CONFIG_VSERVER_COWBL
6755 + if (error == -EMLINK) {
6756 + struct dentry *dentry;
6757 + dentry = cow_break_link(pathname);
6758 + if (IS_ERR(dentry)) {
6759 + error = PTR_ERR(dentry);
6763 + if (will_truncate)
6764 + mnt_drop_write(nd.path.mnt);
6765 + release_open_intent(&nd);
6766 + path_put(&nd.path);
6775 mnt_drop_write(nd.path.mnt);
6776 @@ -1982,9 +2115,17 @@ int vfs_mknod(struct inode *dir, struct
6780 - if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
6781 + if (!(S_ISCHR(mode) || S_ISBLK(mode)))
6784 + if (!capable(CAP_MKNOD))
6787 + if (S_ISCHR(mode) && !vs_chrdev_perm(dev, DATTR_CREATE))
6789 + if (S_ISBLK(mode) && !vs_blkdev_perm(dev, DATTR_CREATE))
6792 if (!dir->i_op->mknod)
6795 @@ -2451,7 +2592,7 @@ int vfs_link(struct dentry *old_dentry,
6797 * A link to an append-only or immutable file cannot be created.
6799 - if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
6800 + if (IS_APPEND(inode) || IS_IXORUNLINK(inode))
6802 if (!dir->i_op->link)
6804 @@ -2824,6 +2965,219 @@ int vfs_follow_link(struct nameidata *nd
6805 return __vfs_follow_link(nd, link);
6809 +#ifdef CONFIG_VSERVER_COWBL
6811 +#include <linux/file.h>
6814 +long do_cow_splice(struct file *in, struct file *out, size_t len)
6818 + return do_splice_direct(in, &ppos, out, len, 0);
6821 +struct dentry *cow_break_link(const char *pathname)
6823 + int ret, mode, pathlen, redo = 0;
6824 + struct nameidata old_nd, dir_nd;
6825 + struct path old_path, new_path;
6826 + struct dentry *dir, *res = NULL;
6827 + struct file *old_file;
6828 + struct file *new_file;
6829 + char *to, *path, pad='\251';
6832 + vxdprintk(VXD_CBIT(misc, 1), "cow_break_link(»%s«)", pathname);
6833 + path = kmalloc(PATH_MAX, GFP_KERNEL);
6838 + /* old_nd will have refs to dentry and mnt */
6839 + ret = path_lookup(pathname, LOOKUP_FOLLOW, &old_nd);
6840 + vxdprintk(VXD_CBIT(misc, 2), "path_lookup(old): %d", ret);
6842 + goto out_free_path;
6844 + old_path = old_nd.path;
6845 + mode = old_path.dentry->d_inode->i_mode;
6847 + to = d_path(&old_path, path, PATH_MAX-2);
6848 + pathlen = strlen(to);
6849 + vxdprintk(VXD_CBIT(misc, 2), "old path »%s« [»%.*s«:%d]", to,
6850 + old_path.dentry->d_name.len, old_path.dentry->d_name.name,
6851 + old_path.dentry->d_name.len);
6853 + to[pathlen + 1] = 0;
6855 + to[pathlen] = pad--;
6857 + if (pad <= '\240')
6860 + vxdprintk(VXD_CBIT(misc, 1), "temp copy »%s«", to);
6861 + /* dir_nd will have refs to dentry and mnt */
6862 + ret = path_lookup(to,
6863 + LOOKUP_PARENT | LOOKUP_OPEN | LOOKUP_CREATE, &dir_nd);
6864 + vxdprintk(VXD_CBIT(misc, 2),
6865 + "path_lookup(new): %d", ret);
6869 + /* this puppy downs the inode mutex */
6870 + new_path.dentry = lookup_create(&dir_nd, 0);
6871 + if (!new_path.dentry || IS_ERR(new_path.dentry)) {
6872 + vxdprintk(VXD_CBIT(misc, 2),
6873 + "lookup_create(new): %p", new_path.dentry);
6874 + mutex_unlock(&dir_nd.path.dentry->d_inode->i_mutex);
6875 + path_put(&dir_nd.path);
6878 + vxdprintk(VXD_CBIT(misc, 2),
6879 + "lookup_create(new): %p [»%.*s«:%d]", new_path.dentry,
6880 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
6881 + new_path.dentry->d_name.len);
6882 + dir = dir_nd.path.dentry;
6884 + ret = vfs_create(dir_nd.path.dentry->d_inode, new_path.dentry, mode, &dir_nd);
6885 + vxdprintk(VXD_CBIT(misc, 2),
6886 + "vfs_create(new): %d", ret);
6887 + if (ret == -EEXIST) {
6888 + mutex_unlock(&dir->d_inode->i_mutex);
6889 + dput(new_path.dentry);
6890 + path_put(&dir_nd.path);
6894 + goto out_unlock_new;
6896 + /* drop out early, ret passes ENOENT */
6898 + if ((redo = d_unhashed(old_path.dentry)))
6899 + goto out_unlock_new;
6901 + new_path.mnt = dir_nd.path.mnt;
6902 + dget(old_path.dentry);
6903 + mntget(old_path.mnt);
6904 + /* this one cleans up the dentry/mnt in case of failure */
6905 + old_file = dentry_open(old_path.dentry, old_path.mnt,
6906 + O_RDONLY, current_cred());
6907 + vxdprintk(VXD_CBIT(misc, 2),
6908 + "dentry_open(old): %p", old_file);
6909 + if (!old_file || IS_ERR(old_file)) {
6910 + res = IS_ERR(old_file) ? (void *) old_file : res;
6911 + goto out_unlock_new;
6914 + dget(new_path.dentry);
6915 + mntget(new_path.mnt);
6916 + /* this one cleans up the dentry/mnt in case of failure */
6917 + new_file = dentry_open(new_path.dentry, new_path.mnt,
6918 + O_WRONLY, current_cred());
6919 + vxdprintk(VXD_CBIT(misc, 2),
6920 + "dentry_open(new): %p", new_file);
6922 + ret = IS_ERR(new_file) ? PTR_ERR(new_file) : -ENOENT;
6923 + if (!new_file || IS_ERR(new_file))
6924 + goto out_fput_old;
6926 + size = i_size_read(old_file->f_dentry->d_inode);
6927 + ret = do_cow_splice(old_file, new_file, size);
6928 + vxdprintk(VXD_CBIT(misc, 2), "do_splice_direct: %d", ret);
6930 + goto out_fput_both;
6931 + } else if (ret < size) {
6933 + goto out_fput_both;
6935 + struct inode *old_inode = old_path.dentry->d_inode;
6936 + struct inode *new_inode = new_path.dentry->d_inode;
6937 + struct iattr attr = {
6938 + .ia_uid = old_inode->i_uid,
6939 + .ia_gid = old_inode->i_gid,
6940 + .ia_valid = ATTR_UID | ATTR_GID
6943 + ret = inode_setattr(new_inode, &attr);
6945 + goto out_fput_both;
6948 + mutex_lock(&old_path.dentry->d_inode->i_sb->s_vfs_rename_mutex);
6950 + /* drop out late */
6952 + if ((redo = d_unhashed(old_path.dentry)))
6955 + vxdprintk(VXD_CBIT(misc, 2),
6956 + "vfs_rename: [»%*s«:%d] -> [»%*s«:%d]",
6957 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
6958 + new_path.dentry->d_name.len,
6959 + old_path.dentry->d_name.len, old_path.dentry->d_name.name,
6960 + old_path.dentry->d_name.len);
6961 + ret = vfs_rename(dir_nd.path.dentry->d_inode, new_path.dentry,
6962 + old_nd.path.dentry->d_parent->d_inode, old_path.dentry);
6963 + vxdprintk(VXD_CBIT(misc, 2), "vfs_rename: %d", ret);
6964 + res = new_path.dentry;
6967 + mutex_unlock(&old_path.dentry->d_inode->i_sb->s_vfs_rename_mutex);
6970 + vxdprintk(VXD_CBIT(misc, 3),
6971 + "fput(new_file=%p[#%ld])", new_file,
6972 + atomic_long_read(&new_file->f_count));
6976 + vxdprintk(VXD_CBIT(misc, 3),
6977 + "fput(old_file=%p[#%ld])", old_file,
6978 + atomic_long_read(&old_file->f_count));
6982 + mutex_unlock(&dir->d_inode->i_mutex);
6986 + /* error path cleanup */
6987 + vfs_unlink(dir->d_inode, new_path.dentry);
6988 + dput(new_path.dentry);
6992 + goto out_rel_both;
6993 + /* lookup dentry once again */
6994 + path_put(&old_nd.path);
6995 + ret = path_lookup(pathname, LOOKUP_FOLLOW, &old_nd);
6997 + goto out_rel_both;
6999 + new_path.dentry = old_nd.path.dentry;
7000 + vxdprintk(VXD_CBIT(misc, 2),
7001 + "path_lookup(redo): %p [»%.*s«:%d]", new_path.dentry,
7002 + new_path.dentry->d_name.len, new_path.dentry->d_name.name,
7003 + new_path.dentry->d_name.len);
7004 + dget(new_path.dentry);
7005 + res = new_path.dentry;
7008 + path_put(&dir_nd.path);
7010 + path_put(&old_nd.path);
7015 + res = ERR_PTR(ret);
7021 /* get the link contents into pagecache */
7022 static char *page_getlink(struct dentry * dentry, struct page **ppage)
7024 diff -NurpP --minimal linux-2.6.33.2/fs/namespace.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/namespace.c
7025 --- linux-2.6.33.2/fs/namespace.c 2010-02-25 11:52:05.000000000 +0100
7026 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/namespace.c 2010-02-25 12:02:16.000000000 +0100
7028 #include <linux/log2.h>
7029 #include <linux/idr.h>
7030 #include <linux/fs_struct.h>
7031 +#include <linux/vs_base.h>
7032 +#include <linux/vs_context.h>
7033 +#include <linux/vs_tag.h>
7034 +#include <linux/vserver/space.h>
7035 +#include <linux/vserver/global.h>
7036 #include <asm/uaccess.h>
7037 #include <asm/unistd.h>
7039 @@ -567,6 +572,7 @@ static struct vfsmount *clone_mnt(struct
7040 mnt->mnt_root = dget(root);
7041 mnt->mnt_mountpoint = mnt->mnt_root;
7042 mnt->mnt_parent = mnt;
7043 + mnt->mnt_tag = old->mnt_tag;
7045 if (flag & CL_SLAVE) {
7046 list_add(&mnt->mnt_slave, &old->mnt_slave_list);
7047 @@ -661,6 +667,31 @@ static inline void mangle(struct seq_fil
7048 seq_escape(m, s, " \t\n\\");
7051 +static int mnt_is_reachable(struct vfsmount *mnt)
7054 + struct dentry *point;
7057 + if (mnt == mnt->mnt_ns->root)
7060 + spin_lock(&vfsmount_lock);
7061 + root = current->fs->root;
7062 + point = root.dentry;
7064 + while ((mnt != mnt->mnt_parent) && (mnt != root.mnt)) {
7065 + point = mnt->mnt_mountpoint;
7066 + mnt = mnt->mnt_parent;
7069 + ret = (mnt == root.mnt) && is_subdir(point, root.dentry);
7071 + spin_unlock(&vfsmount_lock);
7077 * Simple .show_options callback for filesystems which don't want to
7078 * implement more complex mount option showing.
7079 @@ -748,6 +779,8 @@ static int show_sb_opts(struct seq_file
7080 { MS_SYNCHRONOUS, ",sync" },
7081 { MS_DIRSYNC, ",dirsync" },
7082 { MS_MANDLOCK, ",mand" },
7083 + { MS_TAGGED, ",tag" },
7084 + { MS_NOTAGCHECK, ",notagcheck" },
7087 const struct proc_fs_info *fs_infop;
7088 @@ -795,10 +828,20 @@ static int show_vfsmnt(struct seq_file *
7090 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
7092 - mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
7094 - seq_path(m, &mnt_path, " \t\n\\");
7096 + if (vx_flags(VXF_HIDE_MOUNT, 0))
7098 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
7101 + if (!vx_check(0, VS_ADMIN|VS_WATCH) &&
7102 + mnt == current->fs->root.mnt) {
7103 + seq_puts(m, "/dev/root / ");
7105 + mangle(m, mnt->mnt_devname ? mnt->mnt_devname : "none");
7107 + seq_path(m, &mnt_path, " \t\n\\");
7110 show_type(m, mnt->mnt_sb);
7111 seq_puts(m, __mnt_is_readonly(mnt) ? " ro" : " rw");
7112 err = show_sb_opts(m, mnt->mnt_sb);
7113 @@ -828,6 +871,11 @@ static int show_mountinfo(struct seq_fil
7114 struct path root = p->root;
7117 + if (vx_flags(VXF_HIDE_MOUNT, 0))
7119 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
7122 seq_printf(m, "%i %i %u:%u ", mnt->mnt_id, mnt->mnt_parent->mnt_id,
7123 MAJOR(sb->s_dev), MINOR(sb->s_dev));
7124 seq_dentry(m, mnt->mnt_root, " \t\n\\");
7125 @@ -886,17 +934,27 @@ static int show_vfsstat(struct seq_file
7126 struct path mnt_path = { .dentry = mnt->mnt_root, .mnt = mnt };
7130 - if (mnt->mnt_devname) {
7131 - seq_puts(m, "device ");
7132 - mangle(m, mnt->mnt_devname);
7134 - seq_puts(m, "no device");
7135 + if (vx_flags(VXF_HIDE_MOUNT, 0))
7137 + if (!mnt_is_reachable(mnt) && !vx_check(0, VS_WATCH_P))
7141 - seq_puts(m, " mounted on ");
7142 - seq_path(m, &mnt_path, " \t\n\\");
7144 + if (!vx_check(0, VS_ADMIN|VS_WATCH) &&
7145 + mnt == current->fs->root.mnt) {
7146 + seq_puts(m, "device /dev/root mounted on / ");
7149 + if (mnt->mnt_devname) {
7150 + seq_puts(m, "device ");
7151 + mangle(m, mnt->mnt_devname);
7153 + seq_puts(m, "no device");
7156 + seq_puts(m, " mounted on ");
7157 + seq_path(m, &mnt_path, " \t\n\\");
7161 /* file system type */
7162 seq_puts(m, "with fstype ");
7163 @@ -1132,7 +1190,7 @@ SYSCALL_DEFINE2(umount, char __user *, n
7167 - if (!capable(CAP_SYS_ADMIN))
7168 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7171 retval = do_umount(path.mnt, flags);
7172 @@ -1158,7 +1216,7 @@ SYSCALL_DEFINE1(oldumount, char __user *
7174 static int mount_is_safe(struct path *path)
7176 - if (capable(CAP_SYS_ADMIN))
7177 + if (vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7181 @@ -1422,7 +1480,7 @@ static int do_change_type(struct path *p
7182 int type = flag & ~MS_REC;
7185 - if (!capable(CAP_SYS_ADMIN))
7186 + if (!vx_capable(CAP_SYS_ADMIN, VXC_NAMESPACE))
7189 if (path->dentry != path->mnt->mnt_root)
7190 @@ -1449,11 +1507,13 @@ static int do_change_type(struct path *p
7191 * do loopback mount.
7193 static int do_loopback(struct path *path, char *old_name,
7195 + tag_t tag, unsigned long flags, int mnt_flags)
7197 struct path old_path;
7198 struct vfsmount *mnt = NULL;
7199 int err = mount_is_safe(path);
7200 + int recurse = flags & MS_REC;
7204 if (!old_name || !*old_name)
7205 @@ -1487,6 +1547,7 @@ static int do_loopback(struct path *path
7206 spin_unlock(&vfsmount_lock);
7207 release_mounts(&umount_list);
7209 + mnt->mnt_flags = mnt_flags;
7212 up_write(&namespace_sem);
7213 @@ -1517,12 +1578,12 @@ static int change_mount_flags(struct vfs
7214 * on it - tough luck.
7216 static int do_remount(struct path *path, int flags, int mnt_flags,
7218 + void *data, xid_t xid)
7221 struct super_block *sb = path->mnt->mnt_sb;
7223 - if (!capable(CAP_SYS_ADMIN))
7224 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_REMOUNT))
7227 if (!check_mnt(path->mnt))
7228 @@ -1568,7 +1629,7 @@ static int do_move_mount(struct path *pa
7229 struct path old_path, parent_path;
7232 - if (!capable(CAP_SYS_ADMIN))
7233 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7235 if (!old_name || !*old_name)
7237 @@ -1650,7 +1711,7 @@ static int do_new_mount(struct path *pat
7240 /* we need capabilities... */
7241 - if (!capable(CAP_SYS_ADMIN))
7242 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SECURE_MOUNT))
7246 @@ -1916,6 +1977,7 @@ long do_mount(char *dev_name, char *dir_
7253 if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
7254 @@ -1943,6 +2005,12 @@ long do_mount(char *dev_name, char *dir_
7255 if (!(flags & MS_NOATIME))
7256 mnt_flags |= MNT_RELATIME;
7258 + if (dx_parse_tag(data_page, &tag, 1, &mnt_flags, &flags)) {
7259 + /* FIXME: bind and re-mounts get the tag flag? */
7260 + if (flags & (MS_BIND|MS_REMOUNT))
7261 + flags |= MS_TAGID;
7264 /* Separate the per-mountpoint flags */
7265 if (flags & MS_NOSUID)
7266 mnt_flags |= MNT_NOSUID;
7267 @@ -1959,15 +2027,17 @@ long do_mount(char *dev_name, char *dir_
7268 if (flags & MS_RDONLY)
7269 mnt_flags |= MNT_READONLY;
7271 + if (!capable(CAP_SYS_ADMIN))
7272 + mnt_flags |= MNT_NODEV;
7273 flags &= ~(MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_ACTIVE |
7274 MS_NOATIME | MS_NODIRATIME | MS_RELATIME| MS_KERNMOUNT |
7277 if (flags & MS_REMOUNT)
7278 retval = do_remount(&path, flags & ~MS_REMOUNT, mnt_flags,
7281 else if (flags & MS_BIND)
7282 - retval = do_loopback(&path, dev_name, flags & MS_REC);
7283 + retval = do_loopback(&path, dev_name, tag, flags, mnt_flags);
7284 else if (flags & (MS_SHARED | MS_PRIVATE | MS_SLAVE | MS_UNBINDABLE))
7285 retval = do_change_type(&path, flags);
7286 else if (flags & MS_MOVE)
7287 @@ -2046,6 +2116,7 @@ static struct mnt_namespace *dup_mnt_ns(
7288 q = next_mnt(q, new_ns->root);
7290 up_write(&namespace_sem);
7291 + atomic_inc(&vs_global_mnt_ns);
7295 @@ -2190,9 +2261,10 @@ SYSCALL_DEFINE2(pivot_root, const char _
7296 down_write(&namespace_sem);
7297 mutex_lock(&old.dentry->d_inode->i_mutex);
7299 - if (IS_MNT_SHARED(old.mnt) ||
7300 + if ((IS_MNT_SHARED(old.mnt) ||
7301 IS_MNT_SHARED(new.mnt->mnt_parent) ||
7302 - IS_MNT_SHARED(root.mnt->mnt_parent))
7303 + IS_MNT_SHARED(root.mnt->mnt_parent)) &&
7304 + !vx_flags(VXF_STATE_SETUP, 0))
7306 if (!check_mnt(root.mnt))
7308 @@ -2328,6 +2400,7 @@ void put_mnt_ns(struct mnt_namespace *ns
7309 spin_unlock(&vfsmount_lock);
7310 up_write(&namespace_sem);
7311 release_mounts(&umount_list);
7312 + atomic_dec(&vs_global_mnt_ns);
7315 EXPORT_SYMBOL(put_mnt_ns);
7316 diff -NurpP --minimal linux-2.6.33.2/fs/nfs/client.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/client.c
7317 --- linux-2.6.33.2/fs/nfs/client.c 2010-02-25 11:52:05.000000000 +0100
7318 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/client.c 2010-02-25 12:02:16.000000000 +0100
7319 @@ -738,6 +738,9 @@ static int nfs_init_server_rpcclient(str
7320 if (server->flags & NFS_MOUNT_SOFT)
7321 server->client->cl_softrtry = 1;
7323 + server->client->cl_tag = 0;
7324 + if (server->flags & NFS_MOUNT_TAGGED)
7325 + server->client->cl_tag = 1;
7329 @@ -909,6 +912,10 @@ static void nfs_server_set_fsinfo(struct
7330 server->acdirmin = server->acdirmax = 0;
7333 + /* FIXME: needs fsinfo
7334 + if (server->flags & NFS_MOUNT_TAGGED)
7335 + sb->s_flags |= MS_TAGGED; */
7337 server->maxfilesize = fsinfo->maxfilesize;
7339 /* We're airborne Set socket buffersize */
7340 diff -NurpP --minimal linux-2.6.33.2/fs/nfs/dir.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/dir.c
7341 --- linux-2.6.33.2/fs/nfs/dir.c 2010-04-06 01:47:46.000000000 +0200
7342 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/dir.c 2010-04-06 01:59:25.000000000 +0200
7344 #include <linux/namei.h>
7345 #include <linux/mount.h>
7346 #include <linux/sched.h>
7347 +#include <linux/vs_tag.h>
7349 #include "nfs4_fs.h"
7350 #include "delegation.h"
7351 @@ -949,6 +950,7 @@ static struct dentry *nfs_lookup(struct
7353 goto out_unblock_sillyrename;
7355 + dx_propagate_tag(nd, inode);
7357 res = d_materialise_unique(dentry, inode);
7359 diff -NurpP --minimal linux-2.6.33.2/fs/nfs/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/inode.c
7360 --- linux-2.6.33.2/fs/nfs/inode.c 2010-04-06 01:47:46.000000000 +0200
7361 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/inode.c 2010-04-06 01:59:25.000000000 +0200
7363 #include <linux/vfs.h>
7364 #include <linux/inet.h>
7365 #include <linux/nfs_xdr.h>
7366 +#include <linux/vs_tag.h>
7368 #include <asm/system.h>
7369 #include <asm/uaccess.h>
7370 @@ -279,6 +280,8 @@ nfs_fhget(struct super_block *sb, struct
7371 if (inode->i_state & I_NEW) {
7372 struct nfs_inode *nfsi = NFS_I(inode);
7373 unsigned long now = jiffies;
7377 /* We set i_ino for the few things that still rely on it,
7378 * such as stat(2) */
7379 @@ -327,8 +330,8 @@ nfs_fhget(struct super_block *sb, struct
7380 nfsi->change_attr = 0;
7383 - inode->i_uid = -2;
7384 - inode->i_gid = -2;
7387 inode->i_blocks = 0;
7388 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
7390 @@ -365,13 +368,13 @@ nfs_fhget(struct super_block *sb, struct
7391 else if (nfs_server_capable(inode, NFS_CAP_NLINK))
7392 nfsi->cache_validity |= NFS_INO_INVALID_ATTR;
7393 if (fattr->valid & NFS_ATTR_FATTR_OWNER)
7394 - inode->i_uid = fattr->uid;
7396 else if (nfs_server_capable(inode, NFS_CAP_OWNER))
7397 nfsi->cache_validity |= NFS_INO_INVALID_ATTR
7398 | NFS_INO_INVALID_ACCESS
7399 | NFS_INO_INVALID_ACL;
7400 if (fattr->valid & NFS_ATTR_FATTR_GROUP)
7401 - inode->i_gid = fattr->gid;
7403 else if (nfs_server_capable(inode, NFS_CAP_OWNER_GROUP))
7404 nfsi->cache_validity |= NFS_INO_INVALID_ATTR
7405 | NFS_INO_INVALID_ACCESS
7406 @@ -384,6 +387,11 @@ nfs_fhget(struct super_block *sb, struct
7408 inode->i_blocks = nfs_calc_block_size(fattr->du.nfs3.used);
7410 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
7411 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
7412 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid, 0);
7413 + /* maybe fattr->xid someday */
7415 nfsi->attrtimeo = NFS_MINATTRTIMEO(inode);
7416 nfsi->attrtimeo_timestamp = now;
7417 nfsi->access_cache = RB_ROOT;
7418 @@ -496,6 +504,8 @@ void nfs_setattr_update_inode(struct ino
7419 inode->i_uid = attr->ia_uid;
7420 if ((attr->ia_valid & ATTR_GID) != 0)
7421 inode->i_gid = attr->ia_gid;
7422 + if ((attr->ia_valid & ATTR_TAG) && IS_TAGGED(inode))
7423 + inode->i_tag = attr->ia_tag;
7424 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7425 spin_unlock(&inode->i_lock);
7427 @@ -906,6 +916,9 @@ static int nfs_check_inode_attributes(st
7428 struct nfs_inode *nfsi = NFS_I(inode);
7429 loff_t cur_size, new_isize;
7430 unsigned long invalid = 0;
7436 /* Has the inode gone and changed behind our back? */
7437 @@ -929,13 +942,18 @@ static int nfs_check_inode_attributes(st
7438 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_REVAL_PAGECACHE;
7441 + uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
7442 + gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
7443 + tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
7445 /* Have any file permissions changed? */
7446 if ((fattr->valid & NFS_ATTR_FATTR_MODE) && (inode->i_mode & S_IALLUGO) != (fattr->mode & S_IALLUGO))
7447 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7448 - if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && inode->i_uid != fattr->uid)
7449 + if ((fattr->valid & NFS_ATTR_FATTR_OWNER) && uid != fattr->uid)
7450 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7451 - if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && inode->i_gid != fattr->gid)
7452 + if ((fattr->valid & NFS_ATTR_FATTR_GROUP) && gid != fattr->gid)
7453 invalid |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS | NFS_INO_INVALID_ACL;
7454 + /* maybe check for tag too? */
7456 /* Has the link count changed? */
7457 if ((fattr->valid & NFS_ATTR_FATTR_NLINK) && inode->i_nlink != fattr->nlink)
7458 @@ -1150,6 +1168,9 @@ static int nfs_update_inode(struct inode
7459 unsigned long invalid = 0;
7460 unsigned long now = jiffies;
7461 unsigned long save_cache_validity;
7466 dfprintk(VFS, "NFS: %s(%s/%ld ct=%d info=0x%x)\n",
7467 __func__, inode->i_sb->s_id, inode->i_ino,
7468 @@ -1252,6 +1273,9 @@ static int nfs_update_inode(struct inode
7469 | NFS_INO_REVAL_PAGECACHE
7470 | NFS_INO_REVAL_FORCED);
7472 + uid = INOTAG_UID(DX_TAG(inode), fattr->uid, fattr->gid);
7473 + gid = INOTAG_GID(DX_TAG(inode), fattr->uid, fattr->gid);
7474 + tag = INOTAG_TAG(DX_TAG(inode), fattr->uid, fattr->gid, 0);
7476 if (fattr->valid & NFS_ATTR_FATTR_ATIME)
7477 memcpy(&inode->i_atime, &fattr->atime, sizeof(inode->i_atime));
7478 @@ -1273,9 +1297,9 @@ static int nfs_update_inode(struct inode
7479 | NFS_INO_REVAL_FORCED);
7481 if (fattr->valid & NFS_ATTR_FATTR_OWNER) {
7482 - if (inode->i_uid != fattr->uid) {
7483 + if (uid != fattr->uid) {
7484 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7485 - inode->i_uid = fattr->uid;
7488 } else if (server->caps & NFS_CAP_OWNER)
7489 invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
7490 @@ -1284,9 +1308,9 @@ static int nfs_update_inode(struct inode
7491 | NFS_INO_REVAL_FORCED);
7493 if (fattr->valid & NFS_ATTR_FATTR_GROUP) {
7494 - if (inode->i_gid != fattr->gid) {
7495 + if (gid != fattr->gid) {
7496 invalid |= NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ACCESS|NFS_INO_INVALID_ACL;
7497 - inode->i_gid = fattr->gid;
7500 } else if (server->caps & NFS_CAP_OWNER_GROUP)
7501 invalid |= save_cache_validity & (NFS_INO_INVALID_ATTR
7502 @@ -1294,6 +1318,10 @@ static int nfs_update_inode(struct inode
7503 | NFS_INO_INVALID_ACL
7504 | NFS_INO_REVAL_FORCED);
7506 + inode->i_uid = uid;
7507 + inode->i_gid = gid;
7508 + inode->i_tag = tag;
7510 if (fattr->valid & NFS_ATTR_FATTR_NLINK) {
7511 if (inode->i_nlink != fattr->nlink) {
7512 invalid |= NFS_INO_INVALID_ATTR;
7513 diff -NurpP --minimal linux-2.6.33.2/fs/nfs/nfs3xdr.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/nfs3xdr.c
7514 --- linux-2.6.33.2/fs/nfs/nfs3xdr.c 2009-12-03 20:02:52.000000000 +0100
7515 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/nfs3xdr.c 2010-02-25 12:02:16.000000000 +0100
7517 #include <linux/nfs3.h>
7518 #include <linux/nfs_fs.h>
7519 #include <linux/nfsacl.h>
7520 +#include <linux/vs_tag.h>
7521 #include "internal.h"
7523 #define NFSDBG_FACILITY NFSDBG_XDR
7524 @@ -176,7 +177,7 @@ xdr_decode_fattr(__be32 *p, struct nfs_f
7527 static inline __be32 *
7528 -xdr_encode_sattr(__be32 *p, struct iattr *attr)
7529 +xdr_encode_sattr(__be32 *p, struct iattr *attr, int tag)
7531 if (attr->ia_valid & ATTR_MODE) {
7533 @@ -184,15 +185,17 @@ xdr_encode_sattr(__be32 *p, struct iattr
7537 - if (attr->ia_valid & ATTR_UID) {
7538 + if (attr->ia_valid & ATTR_UID ||
7539 + (tag && (attr->ia_valid & ATTR_TAG))) {
7541 - *p++ = htonl(attr->ia_uid);
7542 + *p++ = htonl(TAGINO_UID(tag, attr->ia_uid, attr->ia_tag));
7546 - if (attr->ia_valid & ATTR_GID) {
7547 + if (attr->ia_valid & ATTR_GID ||
7548 + (tag && (attr->ia_valid & ATTR_TAG))) {
7550 - *p++ = htonl(attr->ia_gid);
7551 + *p++ = htonl(TAGINO_GID(tag, attr->ia_gid, attr->ia_tag));
7555 @@ -279,7 +282,8 @@ static int
7556 nfs3_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs3_sattrargs *args)
7558 p = xdr_encode_fhandle(p, args->fh);
7559 - p = xdr_encode_sattr(p, args->sattr);
7560 + p = xdr_encode_sattr(p, args->sattr,
7561 + req->rq_task->tk_client->cl_tag);
7562 *p++ = htonl(args->guard);
7564 p = xdr_encode_time3(p, &args->guardtime);
7565 @@ -384,7 +388,8 @@ nfs3_xdr_createargs(struct rpc_rqst *req
7566 *p++ = args->verifier[0];
7567 *p++ = args->verifier[1];
7569 - p = xdr_encode_sattr(p, args->sattr);
7570 + p = xdr_encode_sattr(p, args->sattr,
7571 + req->rq_task->tk_client->cl_tag);
7573 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7575 @@ -398,7 +403,8 @@ nfs3_xdr_mkdirargs(struct rpc_rqst *req,
7577 p = xdr_encode_fhandle(p, args->fh);
7578 p = xdr_encode_array(p, args->name, args->len);
7579 - p = xdr_encode_sattr(p, args->sattr);
7580 + p = xdr_encode_sattr(p, args->sattr,
7581 + req->rq_task->tk_client->cl_tag);
7582 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7585 @@ -411,7 +417,8 @@ nfs3_xdr_symlinkargs(struct rpc_rqst *re
7587 p = xdr_encode_fhandle(p, args->fromfh);
7588 p = xdr_encode_array(p, args->fromname, args->fromlen);
7589 - p = xdr_encode_sattr(p, args->sattr);
7590 + p = xdr_encode_sattr(p, args->sattr,
7591 + req->rq_task->tk_client->cl_tag);
7592 *p++ = htonl(args->pathlen);
7593 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
7595 @@ -429,7 +436,8 @@ nfs3_xdr_mknodargs(struct rpc_rqst *req,
7596 p = xdr_encode_fhandle(p, args->fh);
7597 p = xdr_encode_array(p, args->name, args->len);
7598 *p++ = htonl(args->type);
7599 - p = xdr_encode_sattr(p, args->sattr);
7600 + p = xdr_encode_sattr(p, args->sattr,
7601 + req->rq_task->tk_client->cl_tag);
7602 if (args->type == NF3CHR || args->type == NF3BLK) {
7603 *p++ = htonl(MAJOR(args->rdev));
7604 *p++ = htonl(MINOR(args->rdev));
7605 diff -NurpP --minimal linux-2.6.33.2/fs/nfs/nfsroot.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/nfsroot.c
7606 --- linux-2.6.33.2/fs/nfs/nfsroot.c 2009-09-10 15:26:23.000000000 +0200
7607 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/nfsroot.c 2010-02-25 12:02:16.000000000 +0100
7608 @@ -122,12 +122,12 @@ static int mount_port __initdata = 0; /
7610 /* Options that take integer arguments */
7611 Opt_port, Opt_rsize, Opt_wsize, Opt_timeo, Opt_retrans, Opt_acregmin,
7612 - Opt_acregmax, Opt_acdirmin, Opt_acdirmax,
7613 + Opt_acregmax, Opt_acdirmin, Opt_acdirmax, Opt_tagid,
7614 /* Options that take no arguments */
7615 Opt_soft, Opt_hard, Opt_intr,
7616 Opt_nointr, Opt_posix, Opt_noposix, Opt_cto, Opt_nocto, Opt_ac,
7617 Opt_noac, Opt_lock, Opt_nolock, Opt_v2, Opt_v3, Opt_udp, Opt_tcp,
7618 - Opt_acl, Opt_noacl,
7619 + Opt_acl, Opt_noacl, Opt_tag, Opt_notag,
7623 @@ -164,6 +164,9 @@ static const match_table_t tokens __init
7626 {Opt_noacl, "noacl"},
7628 + {Opt_notag, "notag"},
7629 + {Opt_tagid, "tagid=%u"},
7633 @@ -275,6 +278,20 @@ static int __init root_nfs_parse(char *n
7635 nfs_data.flags |= NFS_MOUNT_NOACL;
7637 +#ifndef CONFIG_TAGGING_NONE
7639 + nfs_data.flags |= NFS_MOUNT_TAGGED;
7642 + nfs_data.flags &= ~NFS_MOUNT_TAGGED;
7645 +#ifdef CONFIG_PROPAGATE
7648 + nfs_data.flags |= NFS_MOUNT_TAGGED;
7652 printk(KERN_WARNING "Root-NFS: unknown "
7654 diff -NurpP --minimal linux-2.6.33.2/fs/nfs/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/super.c
7655 --- linux-2.6.33.2/fs/nfs/super.c 2010-02-25 11:52:05.000000000 +0100
7656 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfs/super.c 2010-02-25 12:02:16.000000000 +0100
7658 #include <linux/nfs_xdr.h>
7659 #include <linux/magic.h>
7660 #include <linux/parser.h>
7661 +#include <linux/vs_tag.h>
7663 #include <asm/system.h>
7664 #include <asm/uaccess.h>
7665 @@ -585,6 +586,7 @@ static void nfs_show_mount_options(struc
7666 { NFS_MOUNT_NORDIRPLUS, ",nordirplus", "" },
7667 { NFS_MOUNT_UNSHARED, ",nosharecache", "" },
7668 { NFS_MOUNT_NORESVPORT, ",noresvport", "" },
7669 + { NFS_MOUNT_TAGGED, ",tag", "" },
7672 const struct proc_nfs_info *nfs_infop;
7673 diff -NurpP --minimal linux-2.6.33.2/fs/nfsd/auth.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfsd/auth.c
7674 --- linux-2.6.33.2/fs/nfsd/auth.c 2010-02-25 11:52:05.000000000 +0100
7675 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfsd/auth.c 2010-02-25 13:17:41.000000000 +0100
7677 /* Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> */
7679 #include <linux/sched.h>
7680 +#include <linux/vs_tag.h>
7684 @@ -36,6 +37,9 @@ int nfsd_setuser(struct svc_rqst *rqstp,
7686 new->fsuid = rqstp->rq_cred.cr_uid;
7687 new->fsgid = rqstp->rq_cred.cr_gid;
7688 + /* FIXME: this desperately needs a tag :)
7689 + new->xid = (xid_t)INOTAG_TAG(DX_TAG_NFSD, cred.cr_uid, cred.cr_gid, 0);
7692 rqgi = rqstp->rq_cred.cr_group_info;
7694 diff -NurpP --minimal linux-2.6.33.2/fs/nfsd/nfs3xdr.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfsd/nfs3xdr.c
7695 --- linux-2.6.33.2/fs/nfsd/nfs3xdr.c 2010-02-25 11:52:05.000000000 +0100
7696 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfsd/nfs3xdr.c 2010-02-25 13:18:45.000000000 +0100
7700 #include <linux/namei.h>
7701 +#include <linux/vs_tag.h>
7705 @@ -95,6 +96,8 @@ static __be32 *
7706 decode_sattr3(__be32 *p, struct iattr *iap)
7714 @@ -104,12 +107,15 @@ decode_sattr3(__be32 *p, struct iattr *i
7717 iap->ia_valid |= ATTR_UID;
7718 - iap->ia_uid = ntohl(*p++);
7719 + uid = ntohl(*p++);
7722 iap->ia_valid |= ATTR_GID;
7723 - iap->ia_gid = ntohl(*p++);
7724 + gid = ntohl(*p++);
7726 + iap->ia_uid = INOTAG_UID(DX_TAG_NFSD, uid, gid);
7727 + iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid);
7728 + iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0);
7732 @@ -165,8 +171,12 @@ encode_fattr3(struct svc_rqst *rqstp, __
7733 *p++ = htonl(nfs3_ftypes[(stat->mode & S_IFMT) >> 12]);
7734 *p++ = htonl((u32) stat->mode);
7735 *p++ = htonl((u32) stat->nlink);
7736 - *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
7737 - *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
7738 + *p++ = htonl((u32) nfsd_ruid(rqstp,
7739 + TAGINO_UID(0 /* FIXME: DX_TAG(dentry->d_inode) */,
7740 + stat->uid, stat->tag)));
7741 + *p++ = htonl((u32) nfsd_rgid(rqstp,
7742 + TAGINO_GID(0 /* FIXME: DX_TAG(dentry->d_inode) */,
7743 + stat->gid, stat->tag)));
7744 if (S_ISLNK(stat->mode) && stat->size > NFS3_MAXPATHLEN) {
7745 p = xdr_encode_hyper(p, (u64) NFS3_MAXPATHLEN);
7747 diff -NurpP --minimal linux-2.6.33.2/fs/nfsd/nfs4xdr.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfsd/nfs4xdr.c
7748 --- linux-2.6.33.2/fs/nfsd/nfs4xdr.c 2010-02-25 11:52:05.000000000 +0100
7749 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfsd/nfs4xdr.c 2010-02-25 12:02:16.000000000 +0100
7751 #include <linux/nfsd_idmap.h>
7752 #include <linux/nfs4_acl.h>
7753 #include <linux/sunrpc/svcauth_gss.h>
7754 +#include <linux/vs_tag.h>
7758 @@ -2042,14 +2043,18 @@ out_acl:
7759 WRITE32(stat.nlink);
7761 if (bmval1 & FATTR4_WORD1_OWNER) {
7762 - status = nfsd4_encode_user(rqstp, stat.uid, &p, &buflen);
7763 + status = nfsd4_encode_user(rqstp,
7764 + TAGINO_UID(DX_TAG(dentry->d_inode),
7765 + stat.uid, stat.tag), &p, &buflen);
7766 if (status == nfserr_resource)
7771 if (bmval1 & FATTR4_WORD1_OWNER_GROUP) {
7772 - status = nfsd4_encode_group(rqstp, stat.gid, &p, &buflen);
7773 + status = nfsd4_encode_group(rqstp,
7774 + TAGINO_GID(DX_TAG(dentry->d_inode),
7775 + stat.gid, stat.tag), &p, &buflen);
7776 if (status == nfserr_resource)
7779 diff -NurpP --minimal linux-2.6.33.2/fs/nfsd/nfsxdr.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfsd/nfsxdr.c
7780 --- linux-2.6.33.2/fs/nfsd/nfsxdr.c 2010-02-25 11:52:05.000000000 +0100
7781 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/nfsd/nfsxdr.c 2010-02-25 13:18:10.000000000 +0100
7786 +#include <linux/vs_tag.h>
7788 #define NFSDDBG_FACILITY NFSDDBG_XDR
7790 @@ -88,6 +89,8 @@ static __be32 *
7791 decode_sattr(__be32 *p, struct iattr *iap)
7799 @@ -101,12 +104,15 @@ decode_sattr(__be32 *p, struct iattr *ia
7801 if ((tmp = ntohl(*p++)) != (u32)-1) {
7802 iap->ia_valid |= ATTR_UID;
7803 - iap->ia_uid = tmp;
7806 if ((tmp = ntohl(*p++)) != (u32)-1) {
7807 iap->ia_valid |= ATTR_GID;
7808 - iap->ia_gid = tmp;
7811 + iap->ia_uid = INOTAG_UID(DX_TAG_NFSD, uid, gid);
7812 + iap->ia_gid = INOTAG_GID(DX_TAG_NFSD, uid, gid);
7813 + iap->ia_tag = INOTAG_TAG(DX_TAG_NFSD, uid, gid, 0);
7814 if ((tmp = ntohl(*p++)) != (u32)-1) {
7815 iap->ia_valid |= ATTR_SIZE;
7817 @@ -151,8 +157,10 @@ encode_fattr(struct svc_rqst *rqstp, __b
7818 *p++ = htonl(nfs_ftypes[type >> 12]);
7819 *p++ = htonl((u32) stat->mode);
7820 *p++ = htonl((u32) stat->nlink);
7821 - *p++ = htonl((u32) nfsd_ruid(rqstp, stat->uid));
7822 - *p++ = htonl((u32) nfsd_rgid(rqstp, stat->gid));
7823 + *p++ = htonl((u32) nfsd_ruid(rqstp,
7824 + TAGINO_UID(DX_TAG(dentry->d_inode), stat->uid, stat->tag)));
7825 + *p++ = htonl((u32) nfsd_rgid(rqstp,
7826 + TAGINO_GID(DX_TAG(dentry->d_inode), stat->gid, stat->tag)));
7828 if (S_ISLNK(type) && stat->size > NFS_MAXPATHLEN) {
7829 *p++ = htonl(NFS_MAXPATHLEN);
7830 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/dlm/dlmfs.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/dlm/dlmfs.c
7831 --- linux-2.6.33.2/fs/ocfs2/dlm/dlmfs.c 2009-12-03 20:02:53.000000000 +0100
7832 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/dlm/dlmfs.c 2010-02-25 12:02:16.000000000 +0100
7834 #include <linux/init.h>
7835 #include <linux/string.h>
7836 #include <linux/backing-dev.h>
7837 +#include <linux/vs_tag.h>
7839 #include <asm/uaccess.h>
7841 @@ -342,6 +343,7 @@ static struct inode *dlmfs_get_root_inod
7842 inode->i_mode = mode;
7843 inode->i_uid = current_fsuid();
7844 inode->i_gid = current_fsgid();
7845 + inode->i_tag = dx_current_fstag(sb);
7846 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
7847 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
7849 @@ -367,6 +369,7 @@ static struct inode *dlmfs_get_inode(str
7850 inode->i_mode = mode;
7851 inode->i_uid = current_fsuid();
7852 inode->i_gid = current_fsgid();
7853 + inode->i_tag = dx_current_fstag(sb);
7854 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
7855 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
7857 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/dlmglue.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/dlmglue.c
7858 --- linux-2.6.33.2/fs/ocfs2/dlmglue.c 2010-02-25 11:52:06.000000000 +0100
7859 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/dlmglue.c 2010-02-25 12:02:16.000000000 +0100
7860 @@ -2023,6 +2023,7 @@ static void __ocfs2_stuff_meta_lvb(struc
7861 lvb->lvb_iclusters = cpu_to_be32(oi->ip_clusters);
7862 lvb->lvb_iuid = cpu_to_be32(inode->i_uid);
7863 lvb->lvb_igid = cpu_to_be32(inode->i_gid);
7864 + lvb->lvb_itag = cpu_to_be16(inode->i_tag);
7865 lvb->lvb_imode = cpu_to_be16(inode->i_mode);
7866 lvb->lvb_inlink = cpu_to_be16(inode->i_nlink);
7867 lvb->lvb_iatime_packed =
7868 @@ -2077,6 +2078,7 @@ static void ocfs2_refresh_inode_from_lvb
7870 inode->i_uid = be32_to_cpu(lvb->lvb_iuid);
7871 inode->i_gid = be32_to_cpu(lvb->lvb_igid);
7872 + inode->i_tag = be16_to_cpu(lvb->lvb_itag);
7873 inode->i_mode = be16_to_cpu(lvb->lvb_imode);
7874 inode->i_nlink = be16_to_cpu(lvb->lvb_inlink);
7875 ocfs2_unpack_timespec(&inode->i_atime,
7876 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/dlmglue.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/dlmglue.h
7877 --- linux-2.6.33.2/fs/ocfs2/dlmglue.h 2009-12-03 20:02:53.000000000 +0100
7878 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/dlmglue.h 2010-02-25 12:02:16.000000000 +0100
7879 @@ -46,7 +46,8 @@ struct ocfs2_meta_lvb {
7882 __be32 lvb_igeneration;
7883 - __be32 lvb_reserved2;
7885 + __be16 lvb_reserved2;
7888 #define OCFS2_QINFO_LVB_VERSION 1
7889 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/file.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/file.c
7890 --- linux-2.6.33.2/fs/ocfs2/file.c 2010-02-25 11:52:06.000000000 +0100
7891 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/file.c 2010-02-25 12:02:16.000000000 +0100
7892 @@ -960,13 +960,15 @@ int ocfs2_setattr(struct dentry *dentry,
7893 mlog(0, "uid change: %d\n", attr->ia_uid);
7894 if (attr->ia_valid & ATTR_GID)
7895 mlog(0, "gid change: %d\n", attr->ia_gid);
7896 + if (attr->ia_valid & ATTR_TAG)
7897 + mlog(0, "tag change: %d\n", attr->ia_tag);
7898 if (attr->ia_valid & ATTR_SIZE)
7899 mlog(0, "size change...\n");
7900 if (attr->ia_valid & (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME))
7901 mlog(0, "time change...\n");
7903 #define OCFS2_VALID_ATTRS (ATTR_ATIME | ATTR_MTIME | ATTR_CTIME | ATTR_SIZE \
7904 - | ATTR_GID | ATTR_UID | ATTR_MODE)
7905 + | ATTR_GID | ATTR_UID | ATTR_TAG | ATTR_MODE)
7906 if (!(attr->ia_valid & OCFS2_VALID_ATTRS)) {
7907 mlog(0, "can't handle attrs: 0x%x\n", attr->ia_valid);
7909 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/inode.c
7910 --- linux-2.6.33.2/fs/ocfs2/inode.c 2010-02-25 11:52:06.000000000 +0100
7911 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/inode.c 2010-02-25 12:02:16.000000000 +0100
7913 #include <linux/highmem.h>
7914 #include <linux/pagemap.h>
7915 #include <linux/quotaops.h>
7916 +#include <linux/vs_tag.h>
7918 #include <asm/byteorder.h>
7920 @@ -79,11 +80,13 @@ void ocfs2_set_inode_flags(struct inode
7922 unsigned int flags = OCFS2_I(inode)->ip_attr;
7924 - inode->i_flags &= ~(S_IMMUTABLE |
7925 + inode->i_flags &= ~(S_IMMUTABLE | S_IXUNLINK |
7926 S_SYNC | S_APPEND | S_NOATIME | S_DIRSYNC);
7928 if (flags & OCFS2_IMMUTABLE_FL)
7929 inode->i_flags |= S_IMMUTABLE;
7930 + if (flags & OCFS2_IXUNLINK_FL)
7931 + inode->i_flags |= S_IXUNLINK;
7933 if (flags & OCFS2_SYNC_FL)
7934 inode->i_flags |= S_SYNC;
7935 @@ -93,25 +96,44 @@ void ocfs2_set_inode_flags(struct inode
7936 inode->i_flags |= S_NOATIME;
7937 if (flags & OCFS2_DIRSYNC_FL)
7938 inode->i_flags |= S_DIRSYNC;
7940 + inode->i_vflags &= ~(V_BARRIER | V_COW);
7942 + if (flags & OCFS2_BARRIER_FL)
7943 + inode->i_vflags |= V_BARRIER;
7944 + if (flags & OCFS2_COW_FL)
7945 + inode->i_vflags |= V_COW;
7948 /* Propagate flags from i_flags to OCFS2_I(inode)->ip_attr */
7949 void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi)
7951 unsigned int flags = oi->vfs_inode.i_flags;
7952 + unsigned int vflags = oi->vfs_inode.i_vflags;
7954 + oi->ip_attr &= ~(OCFS2_SYNC_FL | OCFS2_APPEND_FL |
7955 + OCFS2_IMMUTABLE_FL | OCFS2_IXUNLINK_FL |
7956 + OCFS2_NOATIME_FL | OCFS2_DIRSYNC_FL |
7957 + OCFS2_BARRIER_FL | OCFS2_COW_FL);
7959 + if (flags & S_IMMUTABLE)
7960 + oi->ip_attr |= OCFS2_IMMUTABLE_FL;
7961 + if (flags & S_IXUNLINK)
7962 + oi->ip_attr |= OCFS2_IXUNLINK_FL;
7964 - oi->ip_attr &= ~(OCFS2_SYNC_FL|OCFS2_APPEND_FL|
7965 - OCFS2_IMMUTABLE_FL|OCFS2_NOATIME_FL|OCFS2_DIRSYNC_FL);
7967 oi->ip_attr |= OCFS2_SYNC_FL;
7968 if (flags & S_APPEND)
7969 oi->ip_attr |= OCFS2_APPEND_FL;
7970 - if (flags & S_IMMUTABLE)
7971 - oi->ip_attr |= OCFS2_IMMUTABLE_FL;
7972 if (flags & S_NOATIME)
7973 oi->ip_attr |= OCFS2_NOATIME_FL;
7974 if (flags & S_DIRSYNC)
7975 oi->ip_attr |= OCFS2_DIRSYNC_FL;
7977 + if (vflags & V_BARRIER)
7978 + oi->ip_attr |= OCFS2_BARRIER_FL;
7979 + if (vflags & V_COW)
7980 + oi->ip_attr |= OCFS2_COW_FL;
7983 struct inode *ocfs2_ilookup(struct super_block *sb, u64 blkno)
7984 @@ -246,6 +268,8 @@ void ocfs2_populate_inode(struct inode *
7985 struct super_block *sb;
7986 struct ocfs2_super *osb;
7991 mlog_entry("(0x%p, size:%llu)\n", inode,
7992 (unsigned long long)le64_to_cpu(fe->i_size));
7993 @@ -277,8 +301,12 @@ void ocfs2_populate_inode(struct inode *
7994 inode->i_generation = le32_to_cpu(fe->i_generation);
7995 inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
7996 inode->i_mode = le16_to_cpu(fe->i_mode);
7997 - inode->i_uid = le32_to_cpu(fe->i_uid);
7998 - inode->i_gid = le32_to_cpu(fe->i_gid);
7999 + uid = le32_to_cpu(fe->i_uid);
8000 + gid = le32_to_cpu(fe->i_gid);
8001 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
8002 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
8003 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid,
8004 + /* le16_to_cpu(raw_inode->i_raw_tag)i */ 0);
8006 /* Fast symlinks will have i_size but no allocated clusters. */
8007 if (S_ISLNK(inode->i_mode) && !fe->i_clusters)
8008 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/inode.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/inode.h
8009 --- linux-2.6.33.2/fs/ocfs2/inode.h 2009-12-03 20:02:53.000000000 +0100
8010 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/inode.h 2010-02-25 12:02:16.000000000 +0100
8011 @@ -150,6 +150,7 @@ struct buffer_head *ocfs2_bread(struct i
8013 void ocfs2_set_inode_flags(struct inode *inode);
8014 void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi);
8015 +int ocfs2_sync_flags(struct inode *inode, int, int);
8017 static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode)
8019 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/ioctl.c
8020 --- linux-2.6.33.2/fs/ocfs2/ioctl.c 2010-02-25 11:52:06.000000000 +0100
8021 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/ioctl.c 2010-02-25 12:02:16.000000000 +0100
8022 @@ -43,7 +43,41 @@ static int ocfs2_get_inode_attr(struct i
8026 -static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
8027 +int ocfs2_sync_flags(struct inode *inode, int flags, int vflags)
8029 + struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
8030 + struct buffer_head *bh = NULL;
8031 + handle_t *handle = NULL;
8034 + status = ocfs2_inode_lock(inode, &bh, 1);
8036 + mlog_errno(status);
8039 + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
8040 + if (IS_ERR(handle)) {
8041 + status = PTR_ERR(handle);
8042 + mlog_errno(status);
8046 + inode->i_flags = flags;
8047 + inode->i_vflags = vflags;
8048 + ocfs2_get_inode_flags(OCFS2_I(inode));
8050 + status = ocfs2_mark_inode_dirty(handle, inode, bh);
8052 + mlog_errno(status);
8054 + ocfs2_commit_trans(osb, handle);
8056 + ocfs2_inode_unlock(inode, 1);
8061 +int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
8064 struct ocfs2_inode_info *ocfs2_inode = OCFS2_I(inode);
8065 @@ -68,6 +102,11 @@ static int ocfs2_set_inode_attr(struct i
8066 if (!S_ISDIR(inode->i_mode))
8067 flags &= ~OCFS2_DIRSYNC_FL;
8069 + if (IS_BARRIER(inode)) {
8070 + vxwprintk_task(1, "messing with the barrier.");
8074 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
8075 if (IS_ERR(handle)) {
8076 status = PTR_ERR(handle);
8077 @@ -109,6 +148,7 @@ bail:
8082 long ocfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
8084 struct inode *inode = filp->f_path.dentry->d_inode;
8085 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/namei.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/namei.c
8086 --- linux-2.6.33.2/fs/ocfs2/namei.c 2010-02-25 11:52:06.000000000 +0100
8087 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/namei.c 2010-02-25 12:02:16.000000000 +0100
8089 #include <linux/slab.h>
8090 #include <linux/highmem.h>
8091 #include <linux/quotaops.h>
8092 +#include <linux/vs_tag.h>
8094 #define MLOG_MASK_PREFIX ML_NAMEI
8095 #include <cluster/masklog.h>
8096 @@ -481,6 +482,7 @@ static int ocfs2_mknod_locked(struct ocf
8104 @@ -524,8 +526,11 @@ static int ocfs2_mknod_locked(struct ocf
8105 fe->i_blkno = cpu_to_le64(fe_blkno);
8106 fe->i_suballoc_bit = cpu_to_le16(suballoc_bit);
8107 fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot);
8108 - fe->i_uid = cpu_to_le32(inode->i_uid);
8109 - fe->i_gid = cpu_to_le32(inode->i_gid);
8111 + tag = dx_current_fstag(osb->sb);
8112 + fe->i_uid = cpu_to_le32(TAGINO_UID(DX_TAG(inode), inode->i_uid, tag));
8113 + fe->i_gid = cpu_to_le32(TAGINO_GID(DX_TAG(inode), inode->i_gid, tag));
8114 + inode->i_tag = tag;
8115 fe->i_mode = cpu_to_le16(inode->i_mode);
8116 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
8117 fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev));
8118 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/ocfs2_fs.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/ocfs2_fs.h
8119 --- linux-2.6.33.2/fs/ocfs2/ocfs2_fs.h 2010-02-25 11:52:06.000000000 +0100
8120 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/ocfs2_fs.h 2010-02-25 12:02:16.000000000 +0100
8121 @@ -231,18 +231,23 @@
8122 #define OCFS2_HAS_REFCOUNT_FL (0x0010)
8124 /* Inode attributes, keep in sync with EXT2 */
8125 -#define OCFS2_SECRM_FL (0x00000001) /* Secure deletion */
8126 -#define OCFS2_UNRM_FL (0x00000002) /* Undelete */
8127 -#define OCFS2_COMPR_FL (0x00000004) /* Compress file */
8128 -#define OCFS2_SYNC_FL (0x00000008) /* Synchronous updates */
8129 -#define OCFS2_IMMUTABLE_FL (0x00000010) /* Immutable file */
8130 -#define OCFS2_APPEND_FL (0x00000020) /* writes to file may only append */
8131 -#define OCFS2_NODUMP_FL (0x00000040) /* do not dump file */
8132 -#define OCFS2_NOATIME_FL (0x00000080) /* do not update atime */
8133 -#define OCFS2_DIRSYNC_FL (0x00010000) /* dirsync behaviour (directories only) */
8134 +#define OCFS2_SECRM_FL FS_SECRM_FL /* Secure deletion */
8135 +#define OCFS2_UNRM_FL FS_UNRM_FL /* Undelete */
8136 +#define OCFS2_COMPR_FL FS_COMPR_FL /* Compress file */
8137 +#define OCFS2_SYNC_FL FS_SYNC_FL /* Synchronous updates */
8138 +#define OCFS2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */
8139 +#define OCFS2_APPEND_FL FS_APPEND_FL /* writes to file may only append */
8140 +#define OCFS2_NODUMP_FL FS_NODUMP_FL /* do not dump file */
8141 +#define OCFS2_NOATIME_FL FS_NOATIME_FL /* do not update atime */
8143 -#define OCFS2_FL_VISIBLE (0x000100FF) /* User visible flags */
8144 -#define OCFS2_FL_MODIFIABLE (0x000100FF) /* User modifiable flags */
8145 +#define OCFS2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
8146 +#define OCFS2_IXUNLINK_FL FS_IXUNLINK_FL /* Immutable invert on unlink */
8148 +#define OCFS2_BARRIER_FL FS_BARRIER_FL /* Barrier for chroot() */
8149 +#define OCFS2_COW_FL FS_COW_FL /* Copy on Write marker */
8151 +#define OCFS2_FL_VISIBLE (0x010300FF) /* User visible flags */
8152 +#define OCFS2_FL_MODIFIABLE (0x010300FF) /* User modifiable flags */
8155 * Extent record flags (e_node.leaf.flags)
8156 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/ocfs2.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/ocfs2.h
8157 --- linux-2.6.33.2/fs/ocfs2/ocfs2.h 2010-02-25 11:52:06.000000000 +0100
8158 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/ocfs2.h 2010-02-25 13:22:33.000000000 +0100
8159 @@ -254,6 +254,7 @@ enum ocfs2_mount_options
8161 OCFS2_MOUNT_USRQUOTA = 1 << 10, /* We support user quotas */
8162 OCFS2_MOUNT_GRPQUOTA = 1 << 11, /* We support group quotas */
8163 + OCFS2_MOUNT_TAGGED = 1 << 12, /* use tagging */
8166 #define OCFS2_OSB_SOFT_RO 0x0001
8167 diff -NurpP --minimal linux-2.6.33.2/fs/ocfs2/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/super.c
8168 --- linux-2.6.33.2/fs/ocfs2/super.c 2010-02-25 11:52:06.000000000 +0100
8169 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/ocfs2/super.c 2010-02-25 13:23:24.000000000 +0100
8170 @@ -175,6 +175,7 @@ enum {
8174 + Opt_tag, Opt_notag, Opt_tagid,
8178 @@ -201,6 +202,9 @@ static const match_table_t tokens = {
8179 {Opt_noacl, "noacl"},
8180 {Opt_usrquota, "usrquota"},
8181 {Opt_grpquota, "grpquota"},
8183 + {Opt_notag, "notag"},
8184 + {Opt_tagid, "tagid=%u"},
8188 @@ -608,6 +612,13 @@ static int ocfs2_remount(struct super_bl
8192 + if ((osb->s_mount_opt & OCFS2_MOUNT_TAGGED) !=
8193 + (parsed_options.mount_opt & OCFS2_MOUNT_TAGGED)) {
8195 + mlog(ML_ERROR, "Cannot change tagging on remount\n");
8199 if ((osb->s_mount_opt & OCFS2_MOUNT_HB_LOCAL) !=
8200 (parsed_options.mount_opt & OCFS2_MOUNT_HB_LOCAL)) {
8202 @@ -1138,6 +1149,9 @@ static int ocfs2_fill_super(struct super
8204 ocfs2_complete_mount_recovery(osb);
8206 + if (osb->s_mount_opt & OCFS2_MOUNT_TAGGED)
8207 + sb->s_flags |= MS_TAGGED;
8209 if (ocfs2_mount_local(osb))
8210 snprintf(nodestr, sizeof(nodestr), "local");
8212 @@ -1429,6 +1443,20 @@ static int ocfs2_parse_options(struct su
8213 mopt->mount_opt |= OCFS2_MOUNT_NO_POSIX_ACL;
8214 mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
8216 +#ifndef CONFIG_TAGGING_NONE
8218 + mopt->mount_opt |= OCFS2_MOUNT_TAGGED;
8221 + mopt->mount_opt &= ~OCFS2_MOUNT_TAGGED;
8224 +#ifdef CONFIG_PROPAGATE
8227 + mopt->mount_opt |= OCFS2_MOUNT_TAGGED;
8232 "Unrecognized mount option \"%s\" "
8233 diff -NurpP --minimal linux-2.6.33.2/fs/open.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/open.c
8234 --- linux-2.6.33.2/fs/open.c 2010-02-25 11:52:06.000000000 +0100
8235 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/open.c 2010-02-25 13:17:13.000000000 +0100
8237 #include <linux/falloc.h>
8238 #include <linux/fs_struct.h>
8239 #include <linux/ima.h>
8240 +#include <linux/vs_base.h>
8241 +#include <linux/vs_limit.h>
8242 +#include <linux/vs_tag.h>
8243 +#include <linux/vs_cowbl.h>
8245 #include "internal.h"
8247 @@ -39,16 +43,20 @@ int vfs_statfs(struct dentry *dentry, st
8248 int retval = -ENODEV;
8251 + struct super_block *sb = dentry->d_sb;
8254 - if (dentry->d_sb->s_op->statfs) {
8255 + if (sb->s_op->statfs) {
8256 memset(buf, 0, sizeof(*buf));
8257 retval = security_sb_statfs(dentry);
8260 - retval = dentry->d_sb->s_op->statfs(dentry, buf);
8261 + retval = sb->s_op->statfs(dentry, buf);
8262 if (retval == 0 && buf->f_frsize == 0)
8263 buf->f_frsize = buf->f_bsize;
8265 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
8266 + vx_vsi_statfs(sb, buf);
8270 @@ -650,6 +658,10 @@ SYSCALL_DEFINE3(fchmodat, int, dfd, cons
8271 error = user_path_at(dfd, filename, LOOKUP_FOLLOW, &path);
8275 + error = cow_check_and_break(&path);
8277 + goto dput_and_out;
8278 inode = path.dentry->d_inode;
8280 error = mnt_want_write(path.mnt);
8281 @@ -687,11 +699,11 @@ static int chown_common(struct path *pat
8282 newattrs.ia_valid = ATTR_CTIME;
8283 if (user != (uid_t) -1) {
8284 newattrs.ia_valid |= ATTR_UID;
8285 - newattrs.ia_uid = user;
8286 + newattrs.ia_uid = dx_map_uid(user);
8288 if (group != (gid_t) -1) {
8289 newattrs.ia_valid |= ATTR_GID;
8290 - newattrs.ia_gid = group;
8291 + newattrs.ia_gid = dx_map_gid(group);
8293 if (!S_ISDIR(inode->i_mode))
8294 newattrs.ia_valid |=
8295 @@ -716,6 +728,10 @@ SYSCALL_DEFINE3(chown, const char __user
8296 error = mnt_want_write(path.mnt);
8299 +#ifdef CONFIG_VSERVER_COWBL
8300 + error = cow_check_and_break(&path);
8303 error = chown_common(&path, user, group);
8304 mnt_drop_write(path.mnt);
8306 @@ -741,6 +757,10 @@ SYSCALL_DEFINE5(fchownat, int, dfd, cons
8307 error = mnt_want_write(path.mnt);
8310 +#ifdef CONFIG_VSERVER_COWBL
8311 + error = cow_check_and_break(&path);
8314 error = chown_common(&path, user, group);
8315 mnt_drop_write(path.mnt);
8317 @@ -760,6 +780,10 @@ SYSCALL_DEFINE3(lchown, const char __use
8318 error = mnt_want_write(path.mnt);
8321 +#ifdef CONFIG_VSERVER_COWBL
8322 + error = cow_check_and_break(&path);
8325 error = chown_common(&path, user, group);
8326 mnt_drop_write(path.mnt);
8328 @@ -1006,6 +1030,7 @@ static void __put_unused_fd(struct files
8329 __FD_CLR(fd, fdt->open_fds);
8330 if (fd < files->next_fd)
8331 files->next_fd = fd;
8332 + vx_openfd_dec(fd);
8335 void put_unused_fd(unsigned int fd)
8336 diff -NurpP --minimal linux-2.6.33.2/fs/proc/array.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/array.c
8337 --- linux-2.6.33.2/fs/proc/array.c 2010-02-25 11:52:06.000000000 +0100
8338 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/array.c 2010-02-25 12:02:16.000000000 +0100
8340 #include <linux/ptrace.h>
8341 #include <linux/tracehook.h>
8342 #include <linux/swapops.h>
8343 +#include <linux/vs_context.h>
8344 +#include <linux/vs_network.h>
8346 #include <asm/pgtable.h>
8347 #include <asm/processor.h>
8348 @@ -172,6 +174,9 @@ static inline void task_state(struct seq
8350 ppid = pid_alive(p) ?
8351 task_tgid_nr_ns(rcu_dereference(p->real_parent), ns) : 0;
8352 + if (unlikely(vx_current_initpid(p->pid)))
8357 struct task_struct *tracer = tracehook_tracer_task(p);
8358 @@ -287,7 +292,7 @@ static inline void task_sig(struct seq_f
8361 static void render_cap_t(struct seq_file *m, const char *header,
8363 + struct vx_info *vxi, kernel_cap_t *a)
8367 @@ -312,10 +317,11 @@ static inline void task_cap(struct seq_f
8368 cap_bset = cred->cap_bset;
8371 - render_cap_t(m, "CapInh:\t", &cap_inheritable);
8372 - render_cap_t(m, "CapPrm:\t", &cap_permitted);
8373 - render_cap_t(m, "CapEff:\t", &cap_effective);
8374 - render_cap_t(m, "CapBnd:\t", &cap_bset);
8375 + /* FIXME: maybe move the p->vx_info masking to __task_cred() ? */
8376 + render_cap_t(m, "CapInh:\t", p->vx_info, &cap_inheritable);
8377 + render_cap_t(m, "CapPrm:\t", p->vx_info, &cap_permitted);
8378 + render_cap_t(m, "CapEff:\t", p->vx_info, &cap_effective);
8379 + render_cap_t(m, "CapBnd:\t", p->vx_info, &cap_bset);
8382 static inline void task_context_switch_counts(struct seq_file *m,
8383 @@ -337,6 +343,42 @@ static void task_cpus_allowed(struct seq
8384 seq_printf(m, "\n");
8387 +int proc_pid_nsproxy(struct seq_file *m, struct pid_namespace *ns,
8388 + struct pid *pid, struct task_struct *task)
8390 + seq_printf(m, "Proxy:\t%p(%c)\n"
8398 + (task->nsproxy == init_task.nsproxy ? 'I' : '-'),
8399 + atomic_read(&task->nsproxy->count),
8400 + task->nsproxy->uts_ns,
8401 + (task->nsproxy->uts_ns == init_task.nsproxy->uts_ns ? 'I' : '-'),
8402 + task->nsproxy->ipc_ns,
8403 + (task->nsproxy->ipc_ns == init_task.nsproxy->ipc_ns ? 'I' : '-'),
8404 + task->nsproxy->mnt_ns,
8405 + (task->nsproxy->mnt_ns == init_task.nsproxy->mnt_ns ? 'I' : '-'),
8406 + task->nsproxy->pid_ns,
8407 + (task->nsproxy->pid_ns == init_task.nsproxy->pid_ns ? 'I' : '-'),
8408 + task->nsproxy->net_ns,
8409 + (task->nsproxy->net_ns == init_task.nsproxy->net_ns ? 'I' : '-'));
8413 +void task_vs_id(struct seq_file *m, struct task_struct *task)
8415 + if (task_vx_flags(task, VXF_HIDE_VINFO, 0))
8418 + seq_printf(m, "VxID: %d\n", vx_task_xid(task));
8419 + seq_printf(m, "NxID: %d\n", nx_task_nid(task));
8423 int proc_pid_status(struct seq_file *m, struct pid_namespace *ns,
8424 struct pid *pid, struct task_struct *task)
8426 @@ -353,6 +395,7 @@ int proc_pid_status(struct seq_file *m,
8428 task_cpus_allowed(m, task);
8429 cpuset_task_status_allowed(m, task);
8430 + task_vs_id(m, task);
8431 #if defined(CONFIG_S390)
8432 task_show_regs(m, task);
8434 @@ -465,6 +508,17 @@ static int do_task_stat(struct seq_file
8435 /* convert nsec -> ticks */
8436 start_time = nsec_to_clock_t(start_time);
8438 + /* fixup start time for virt uptime */
8439 + if (vx_flags(VXF_VIRT_UPTIME, 0)) {
8440 + unsigned long long bias =
8441 + current->vx_info->cvirt.bias_clock;
8443 + if (start_time > bias)
8444 + start_time -= bias;
8449 seq_printf(m, "%d (%s) %c %d %d %d %d %d %u %lu \
8450 %lu %lu %lu %lu %lu %ld %ld %ld %ld %d 0 %llu %lu %ld %lu %lu %lu %lu %lu \
8451 %lu %lu %lu %lu %lu %lu %lu %lu %d %d %u %u %llu %lu %ld\n",
8452 diff -NurpP --minimal linux-2.6.33.2/fs/proc/base.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/base.c
8453 --- linux-2.6.33.2/fs/proc/base.c 2010-02-25 11:52:06.000000000 +0100
8454 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/base.c 2010-02-25 12:02:16.000000000 +0100
8456 #include <linux/elf.h>
8457 #include <linux/pid_namespace.h>
8458 #include <linux/fs_struct.h>
8459 +#include <linux/vs_context.h>
8460 +#include <linux/vs_network.h>
8461 #include "internal.h"
8464 @@ -1047,12 +1049,17 @@ static ssize_t oom_adjust_write(struct f
8468 - if (oom_adjust < task->signal->oom_adj && !capable(CAP_SYS_RESOURCE)) {
8469 + if (oom_adjust < task->signal->oom_adj &&
8470 + !vx_capable(CAP_SYS_RESOURCE, VXC_OOM_ADJUST)) {
8471 unlock_task_sighand(task, &flags);
8472 put_task_struct(task);
8476 + /* prevent guest processes from circumventing the oom killer */
8477 + if (vx_current_xid() && (oom_adjust == OOM_DISABLE))
8478 + oom_adjust = OOM_ADJUST_MIN;
8480 task->signal->oom_adj = oom_adjust;
8482 unlock_task_sighand(task, &flags);
8483 @@ -1092,7 +1099,7 @@ static ssize_t proc_loginuid_write(struc
8487 - if (!capable(CAP_AUDIT_CONTROL))
8488 + if (!vx_capable(CAP_AUDIT_CONTROL, VXC_AUDIT_CONTROL))
8491 if (current != pid_task(proc_pid(inode), PIDTYPE_PID))
8492 @@ -1523,6 +1530,8 @@ static struct inode *proc_pid_make_inode
8493 inode->i_gid = cred->egid;
8496 + /* procfs is xid tagged */
8497 + inode->i_tag = (tag_t)vx_task_xid(task);
8498 security_task_to_inode(task, inode);
8501 @@ -2073,6 +2082,13 @@ static struct dentry *proc_pident_lookup
8505 + /* TODO: maybe we can come up with a generic approach? */
8506 + if (task_vx_flags(task, VXF_HIDE_VINFO, 0) &&
8507 + (dentry->d_name.len == 5) &&
8508 + (!memcmp(dentry->d_name.name, "vinfo", 5) ||
8509 + !memcmp(dentry->d_name.name, "ninfo", 5)))
8513 * Yes, it does not scale. And it should not. Don't add
8514 * new entries into /proc/<tgid>/ without very good reasons.
8515 @@ -2478,7 +2494,7 @@ out_iput:
8516 static struct dentry *proc_base_lookup(struct inode *dir, struct dentry *dentry)
8518 struct dentry *error;
8519 - struct task_struct *task = get_proc_task(dir);
8520 + struct task_struct *task = get_proc_task_real(dir);
8521 const struct pid_entry *p, *last;
8523 error = ERR_PTR(-ENOENT);
8524 @@ -2568,6 +2584,9 @@ static int proc_pid_personality(struct s
8525 static const struct file_operations proc_task_operations;
8526 static const struct inode_operations proc_task_inode_operations;
8528 +extern int proc_pid_vx_info(struct task_struct *, char *);
8529 +extern int proc_pid_nx_info(struct task_struct *, char *);
8531 static const struct pid_entry tgid_base_stuff[] = {
8532 DIR("task", S_IRUGO|S_IXUGO, proc_task_inode_operations, proc_task_operations),
8533 DIR("fd", S_IRUSR|S_IXUSR, proc_fd_inode_operations, proc_fd_operations),
8534 @@ -2627,6 +2646,8 @@ static const struct pid_entry tgid_base_
8535 #ifdef CONFIG_CGROUPS
8536 REG("cgroup", S_IRUGO, proc_cgroup_operations),
8538 + INF("vinfo", S_IRUGO, proc_pid_vx_info),
8539 + INF("ninfo", S_IRUGO, proc_pid_nx_info),
8540 INF("oom_score", S_IRUGO, proc_oom_score),
8541 REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adjust_operations),
8542 #ifdef CONFIG_AUDITSYSCALL
8543 @@ -2642,6 +2663,7 @@ static const struct pid_entry tgid_base_
8544 #ifdef CONFIG_TASK_IO_ACCOUNTING
8545 INF("io", S_IRUGO, proc_tgid_io_accounting),
8547 + ONE("nsproxy", S_IRUGO, proc_pid_nsproxy),
8550 static int proc_tgid_base_readdir(struct file * filp,
8551 @@ -2833,7 +2855,7 @@ retry:
8553 pid = find_ge_pid(iter.tgid, ns);
8555 - iter.tgid = pid_nr_ns(pid, ns);
8556 + iter.tgid = pid_unmapped_nr_ns(pid, ns);
8557 iter.task = pid_task(pid, PIDTYPE_PID);
8558 /* What we to know is if the pid we have find is the
8559 * pid of a thread_group_leader. Testing for task
8560 @@ -2863,7 +2885,7 @@ static int proc_pid_fill_cache(struct fi
8561 struct tgid_iter iter)
8563 char name[PROC_NUMBUF];
8564 - int len = snprintf(name, sizeof(name), "%d", iter.tgid);
8565 + int len = snprintf(name, sizeof(name), "%d", vx_map_tgid(iter.tgid));
8566 return proc_fill_cache(filp, dirent, filldir, name, len,
8567 proc_pid_instantiate, iter.task, NULL);
8569 @@ -2872,7 +2894,7 @@ static int proc_pid_fill_cache(struct fi
8570 int proc_pid_readdir(struct file * filp, void * dirent, filldir_t filldir)
8572 unsigned int nr = filp->f_pos - FIRST_PROCESS_ENTRY;
8573 - struct task_struct *reaper = get_proc_task(filp->f_path.dentry->d_inode);
8574 + struct task_struct *reaper = get_proc_task_real(filp->f_path.dentry->d_inode);
8575 struct tgid_iter iter;
8576 struct pid_namespace *ns;
8578 @@ -2892,6 +2914,8 @@ int proc_pid_readdir(struct file * filp,
8580 iter.tgid += 1, iter = next_tgid(ns, iter)) {
8581 filp->f_pos = iter.tgid + TGID_OFFSET;
8582 + if (!vx_proc_task_visible(iter.task))
8584 if (proc_pid_fill_cache(filp, dirent, filldir, iter) < 0) {
8585 put_task_struct(iter.task);
8587 @@ -3039,6 +3063,8 @@ static struct dentry *proc_task_lookup(s
8588 tid = name_to_int(dentry);
8591 + if (vx_current_initpid(tid))
8594 ns = dentry->d_sb->s_fs_info;
8596 diff -NurpP --minimal linux-2.6.33.2/fs/proc/generic.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/generic.c
8597 --- linux-2.6.33.2/fs/proc/generic.c 2010-02-25 11:52:06.000000000 +0100
8598 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/generic.c 2010-02-25 13:20:40.000000000 +0100
8600 #include <linux/bitops.h>
8601 #include <linux/spinlock.h>
8602 #include <linux/completion.h>
8603 +#include <linux/vserver/inode.h>
8604 #include <asm/uaccess.h>
8606 #include "internal.h"
8607 @@ -425,6 +426,8 @@ struct dentry *proc_lookup_de(struct pro
8608 for (de = de->subdir; de ; de = de->next) {
8609 if (de->namelen != dentry->d_name.len)
8611 + if (!vx_hide_check(0, de->vx_flags))
8613 if (!memcmp(dentry->d_name.name, de->name, de->namelen)) {
8616 @@ -433,6 +436,8 @@ struct dentry *proc_lookup_de(struct pro
8617 spin_unlock(&proc_subdir_lock);
8619 inode = proc_get_inode(dir->i_sb, ino, de);
8620 + /* generic proc entries belong to the host */
8625 @@ -510,6 +515,8 @@ int proc_readdir_de(struct proc_dir_entr
8627 /* filldir passes info to user space */
8629 + if (!vx_hide_check(0, de->vx_flags))
8631 spin_unlock(&proc_subdir_lock);
8632 if (filldir(dirent, de->name, de->namelen, filp->f_pos,
8633 de->low_ino, de->mode >> 12) < 0) {
8634 @@ -517,6 +524,7 @@ int proc_readdir_de(struct proc_dir_entr
8637 spin_lock(&proc_subdir_lock);
8642 @@ -631,6 +639,7 @@ static struct proc_dir_entry *__proc_cre
8644 atomic_set(&ent->count, 1);
8646 + ent->vx_flags = IATTR_PROC_DEFAULT;
8647 spin_lock_init(&ent->pde_unload_lock);
8648 ent->pde_unload_completion = NULL;
8649 INIT_LIST_HEAD(&ent->pde_openers);
8650 @@ -654,7 +663,8 @@ struct proc_dir_entry *proc_symlink(cons
8656 + ent->vx_flags = IATTR_PROC_SYMLINK;
8660 diff -NurpP --minimal linux-2.6.33.2/fs/proc/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/inode.c
8661 --- linux-2.6.33.2/fs/proc/inode.c 2010-02-25 11:52:06.000000000 +0100
8662 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/inode.c 2010-02-25 12:02:16.000000000 +0100
8663 @@ -436,6 +436,8 @@ struct inode *proc_get_inode(struct supe
8664 inode->i_uid = de->uid;
8665 inode->i_gid = de->gid;
8668 + PROC_I(inode)->vx_flags = de->vx_flags;
8670 inode->i_size = de->size;
8672 diff -NurpP --minimal linux-2.6.33.2/fs/proc/internal.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/internal.h
8673 --- linux-2.6.33.2/fs/proc/internal.h 2010-02-25 11:52:06.000000000 +0100
8674 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/internal.h 2010-02-25 12:02:16.000000000 +0100
8678 #include <linux/proc_fs.h>
8679 +#include <linux/vs_pid.h>
8681 extern struct proc_dir_entry proc_root;
8682 #ifdef CONFIG_PROC_SYSCTL
8683 @@ -51,6 +52,9 @@ extern int proc_pid_status(struct seq_fi
8684 struct pid *pid, struct task_struct *task);
8685 extern int proc_pid_statm(struct seq_file *m, struct pid_namespace *ns,
8686 struct pid *pid, struct task_struct *task);
8687 +extern int proc_pid_nsproxy(struct seq_file *m, struct pid_namespace *ns,
8688 + struct pid *pid, struct task_struct *task);
8690 extern loff_t mem_lseek(struct file *file, loff_t offset, int orig);
8692 extern const struct file_operations proc_maps_operations;
8693 @@ -68,11 +72,16 @@ static inline struct pid *proc_pid(struc
8694 return PROC_I(inode)->pid;
8697 -static inline struct task_struct *get_proc_task(struct inode *inode)
8698 +static inline struct task_struct *get_proc_task_real(struct inode *inode)
8700 return get_pid_task(proc_pid(inode), PIDTYPE_PID);
8703 +static inline struct task_struct *get_proc_task(struct inode *inode)
8705 + return vx_get_proc_task(inode, proc_pid(inode));
8708 static inline int proc_fd(struct inode *inode)
8710 return PROC_I(inode)->fd;
8711 diff -NurpP --minimal linux-2.6.33.2/fs/proc/loadavg.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/loadavg.c
8712 --- linux-2.6.33.2/fs/proc/loadavg.c 2009-09-10 15:26:23.000000000 +0200
8713 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/loadavg.c 2010-02-25 12:02:16.000000000 +0100
8716 static int loadavg_proc_show(struct seq_file *m, void *v)
8718 + unsigned long running;
8719 + unsigned int threads;
8720 unsigned long avnrun[3];
8722 get_avenrun(avnrun, FIXED_1/200, 0);
8724 + if (vx_flags(VXF_VIRT_LOAD, 0)) {
8725 + struct vx_info *vxi = current_vx_info();
8727 + running = atomic_read(&vxi->cvirt.nr_running);
8728 + threads = atomic_read(&vxi->cvirt.nr_threads);
8730 + running = nr_running();
8731 + threads = nr_threads;
8734 seq_printf(m, "%lu.%02lu %lu.%02lu %lu.%02lu %ld/%d %d\n",
8735 LOAD_INT(avnrun[0]), LOAD_FRAC(avnrun[0]),
8736 LOAD_INT(avnrun[1]), LOAD_FRAC(avnrun[1]),
8737 LOAD_INT(avnrun[2]), LOAD_FRAC(avnrun[2]),
8738 - nr_running(), nr_threads,
8740 task_active_pid_ns(current)->last_pid);
8743 diff -NurpP --minimal linux-2.6.33.2/fs/proc/meminfo.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/meminfo.c
8744 --- linux-2.6.33.2/fs/proc/meminfo.c 2009-12-03 20:02:53.000000000 +0100
8745 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/meminfo.c 2010-02-25 12:02:16.000000000 +0100
8746 @@ -39,7 +39,8 @@ static int meminfo_proc_show(struct seq_
8747 allowed = ((totalram_pages - hugetlb_total_pages())
8748 * sysctl_overcommit_ratio / 100) + total_swap_pages;
8750 - cached = global_page_state(NR_FILE_PAGES) -
8751 + cached = vx_flags(VXF_VIRT_MEM, 0) ?
8752 + vx_vsi_cached(&i) : global_page_state(NR_FILE_PAGES) -
8753 total_swapcache_pages - i.bufferram;
8756 diff -NurpP --minimal linux-2.6.33.2/fs/proc/root.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/root.c
8757 --- linux-2.6.33.2/fs/proc/root.c 2009-06-11 17:13:07.000000000 +0200
8758 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/root.c 2010-02-25 12:02:16.000000000 +0100
8760 #include <linux/bitops.h>
8761 #include <linux/mount.h>
8762 #include <linux/pid_namespace.h>
8763 +#include <linux/vserver/inode.h>
8765 #include "internal.h"
8767 +struct proc_dir_entry *proc_virtual;
8769 +extern void proc_vx_init(void);
8771 static int proc_test_super(struct super_block *sb, void *data)
8773 return sb->s_fs_info == data;
8774 @@ -136,6 +141,7 @@ void __init proc_root_init(void)
8776 proc_mkdir("bus", NULL);
8781 static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat
8782 @@ -203,6 +209,7 @@ struct proc_dir_entry proc_root = {
8783 .proc_iops = &proc_root_inode_operations,
8784 .proc_fops = &proc_root_operations,
8785 .parent = &proc_root,
8786 + .vx_flags = IATTR_ADMIN | IATTR_WATCH,
8789 int pid_ns_prepare_proc(struct pid_namespace *ns)
8790 diff -NurpP --minimal linux-2.6.33.2/fs/proc/uptime.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/uptime.c
8791 --- linux-2.6.33.2/fs/proc/uptime.c 2009-12-03 20:02:53.000000000 +0100
8792 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/proc/uptime.c 2010-02-25 12:02:16.000000000 +0100
8794 #include <linux/sched.h>
8795 #include <linux/seq_file.h>
8796 #include <linux/time.h>
8797 -#include <linux/kernel_stat.h>
8798 +#include <linux/vserver/cvirt.h>
8799 #include <asm/cputime.h>
8801 static int uptime_proc_show(struct seq_file *m, void *v)
8803 struct timespec uptime;
8804 struct timespec idle;
8806 - cputime_t idletime = cputime_zero;
8808 - for_each_possible_cpu(i)
8809 - idletime = cputime64_add(idletime, kstat_cpu(i).cpustat.idle);
8810 + cputime_t idletime = cputime_add(init_task.utime, init_task.stime);
8812 do_posix_clock_monotonic_gettime(&uptime);
8813 monotonic_to_bootbased(&uptime);
8814 cputime_to_timespec(idletime, &idle);
8816 + if (vx_flags(VXF_VIRT_UPTIME, 0))
8817 + vx_vsi_uptime(&uptime, &idle);
8819 seq_printf(m, "%lu.%02lu %lu.%02lu\n",
8820 (unsigned long) uptime.tv_sec,
8821 (uptime.tv_nsec / (NSEC_PER_SEC / 100)),
8822 diff -NurpP --minimal linux-2.6.33.2/fs/quota/quota.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/quota/quota.c
8823 --- linux-2.6.33.2/fs/quota/quota.c 2010-02-25 11:52:06.000000000 +0100
8824 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/quota/quota.c 2010-02-25 13:25:13.000000000 +0100
8826 #include <linux/capability.h>
8827 #include <linux/quotaops.h>
8828 #include <linux/types.h>
8829 +#include <linux/vs_context.h>
8830 #include <net/netlink.h>
8831 #include <net/genetlink.h>
8833 @@ -85,11 +86,11 @@ static int generic_quotactl_valid(struct
8834 if (cmd == Q_GETQUOTA) {
8835 if (((type == USRQUOTA && current_euid() != id) ||
8836 (type == GRPQUOTA && !in_egroup_p(id))) &&
8837 - !capable(CAP_SYS_ADMIN))
8838 + !vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
8841 else if (cmd != Q_GETFMT && cmd != Q_SYNC && cmd != Q_GETINFO)
8842 - if (!capable(CAP_SYS_ADMIN))
8843 + if (!vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
8847 @@ -137,10 +138,10 @@ static int xqm_quotactl_valid(struct sup
8848 if (cmd == Q_XGETQUOTA) {
8849 if (((type == XQM_USRQUOTA && current_euid() != id) ||
8850 (type == XQM_GRPQUOTA && !in_egroup_p(id))) &&
8851 - !capable(CAP_SYS_ADMIN))
8852 + !vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
8854 } else if (cmd != Q_XGETQSTAT && cmd != Q_XQUOTASYNC) {
8855 - if (!capable(CAP_SYS_ADMIN))
8856 + if (!vx_capable(CAP_SYS_ADMIN, VXC_QUOTA_CTL))
8860 @@ -353,6 +354,46 @@ static int do_quotactl(struct super_bloc
8864 +#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
8866 +#include <linux/vroot.h>
8867 +#include <linux/major.h>
8868 +#include <linux/module.h>
8869 +#include <linux/kallsyms.h>
8870 +#include <linux/vserver/debug.h>
8872 +static vroot_grb_func *vroot_get_real_bdev = NULL;
8874 +static spinlock_t vroot_grb_lock = SPIN_LOCK_UNLOCKED;
8876 +int register_vroot_grb(vroot_grb_func *func) {
8879 + spin_lock(&vroot_grb_lock);
8880 + if (!vroot_get_real_bdev) {
8881 + vroot_get_real_bdev = func;
8884 + spin_unlock(&vroot_grb_lock);
8887 +EXPORT_SYMBOL(register_vroot_grb);
8889 +int unregister_vroot_grb(vroot_grb_func *func) {
8890 + int ret = -EINVAL;
8892 + spin_lock(&vroot_grb_lock);
8893 + if (vroot_get_real_bdev) {
8894 + vroot_get_real_bdev = NULL;
8897 + spin_unlock(&vroot_grb_lock);
8900 +EXPORT_SYMBOL(unregister_vroot_grb);
8905 * look up a superblock on which quota ops will be performed
8906 * - use the name of a block device to find the superblock thereon
8907 @@ -370,6 +411,22 @@ static struct super_block *quotactl_bloc
8910 return ERR_CAST(bdev);
8911 +#if defined(CONFIG_BLK_DEV_VROOT) || defined(CONFIG_BLK_DEV_VROOT_MODULE)
8912 + if (bdev && bdev->bd_inode &&
8913 + imajor(bdev->bd_inode) == VROOT_MAJOR) {
8914 + struct block_device *bdnew = (void *)-EINVAL;
8916 + if (vroot_get_real_bdev)
8917 + bdnew = vroot_get_real_bdev(bdev);
8919 + vxdprintk(VXD_CBIT(misc, 0),
8920 + "vroot_get_real_bdev not set");
8922 + if (IS_ERR(bdnew))
8923 + return ERR_PTR(PTR_ERR(bdnew));
8927 sb = get_super(bdev);
8930 diff -NurpP --minimal linux-2.6.33.2/fs/reiserfs/file.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/file.c
8931 --- linux-2.6.33.2/fs/reiserfs/file.c 2010-02-25 11:52:06.000000000 +0100
8932 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/file.c 2010-02-25 12:02:16.000000000 +0100
8933 @@ -307,4 +307,5 @@ const struct inode_operations reiserfs_f
8934 .listxattr = reiserfs_listxattr,
8935 .removexattr = reiserfs_removexattr,
8936 .permission = reiserfs_permission,
8937 + .sync_flags = reiserfs_sync_flags,
8939 diff -NurpP --minimal linux-2.6.33.2/fs/reiserfs/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/inode.c
8940 --- linux-2.6.33.2/fs/reiserfs/inode.c 2010-02-25 11:52:06.000000000 +0100
8941 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/inode.c 2010-02-25 12:02:16.000000000 +0100
8943 #include <linux/writeback.h>
8944 #include <linux/quotaops.h>
8945 #include <linux/swap.h>
8946 +#include <linux/vs_tag.h>
8948 int reiserfs_commit_write(struct file *f, struct page *page,
8949 unsigned from, unsigned to);
8950 @@ -1121,6 +1122,8 @@ static void init_inode(struct inode *ino
8951 struct buffer_head *bh;
8952 struct item_head *ih;
8956 //int version = ITEM_VERSION_1;
8958 bh = PATH_PLAST_BUFFER(path);
8959 @@ -1142,12 +1145,13 @@ static void init_inode(struct inode *ino
8960 (struct stat_data_v1 *)B_I_PITEM(bh, ih);
8961 unsigned long blocks;
8963 + uid = sd_v1_uid(sd);
8964 + gid = sd_v1_gid(sd);
8966 set_inode_item_key_version(inode, KEY_FORMAT_3_5);
8967 set_inode_sd_version(inode, STAT_DATA_V1);
8968 inode->i_mode = sd_v1_mode(sd);
8969 inode->i_nlink = sd_v1_nlink(sd);
8970 - inode->i_uid = sd_v1_uid(sd);
8971 - inode->i_gid = sd_v1_gid(sd);
8972 inode->i_size = sd_v1_size(sd);
8973 inode->i_atime.tv_sec = sd_v1_atime(sd);
8974 inode->i_mtime.tv_sec = sd_v1_mtime(sd);
8975 @@ -1189,11 +1193,12 @@ static void init_inode(struct inode *ino
8976 // (directories and symlinks)
8977 struct stat_data *sd = (struct stat_data *)B_I_PITEM(bh, ih);
8979 + uid = sd_v2_uid(sd);
8980 + gid = sd_v2_gid(sd);
8982 inode->i_mode = sd_v2_mode(sd);
8983 inode->i_nlink = sd_v2_nlink(sd);
8984 - inode->i_uid = sd_v2_uid(sd);
8985 inode->i_size = sd_v2_size(sd);
8986 - inode->i_gid = sd_v2_gid(sd);
8987 inode->i_mtime.tv_sec = sd_v2_mtime(sd);
8988 inode->i_atime.tv_sec = sd_v2_atime(sd);
8989 inode->i_ctime.tv_sec = sd_v2_ctime(sd);
8990 @@ -1223,6 +1228,10 @@ static void init_inode(struct inode *ino
8991 sd_attrs_to_i_attrs(sd_v2_attrs(sd), inode);
8994 + inode->i_uid = INOTAG_UID(DX_TAG(inode), uid, gid);
8995 + inode->i_gid = INOTAG_GID(DX_TAG(inode), uid, gid);
8996 + inode->i_tag = INOTAG_TAG(DX_TAG(inode), uid, gid, 0);
8999 if (S_ISREG(inode->i_mode)) {
9000 inode->i_op = &reiserfs_file_inode_operations;
9001 @@ -1245,13 +1254,15 @@ static void init_inode(struct inode *ino
9002 static void inode2sd(void *sd, struct inode *inode, loff_t size)
9004 struct stat_data *sd_v2 = (struct stat_data *)sd;
9005 + uid_t uid = TAGINO_UID(DX_TAG(inode), inode->i_uid, inode->i_tag);
9006 + gid_t gid = TAGINO_GID(DX_TAG(inode), inode->i_gid, inode->i_tag);
9009 + set_sd_v2_uid(sd_v2, uid);
9010 + set_sd_v2_gid(sd_v2, gid);
9011 set_sd_v2_mode(sd_v2, inode->i_mode);
9012 set_sd_v2_nlink(sd_v2, inode->i_nlink);
9013 - set_sd_v2_uid(sd_v2, inode->i_uid);
9014 set_sd_v2_size(sd_v2, size);
9015 - set_sd_v2_gid(sd_v2, inode->i_gid);
9016 set_sd_v2_mtime(sd_v2, inode->i_mtime.tv_sec);
9017 set_sd_v2_atime(sd_v2, inode->i_atime.tv_sec);
9018 set_sd_v2_ctime(sd_v2, inode->i_ctime.tv_sec);
9019 @@ -2852,14 +2863,19 @@ int reiserfs_commit_write(struct file *f
9020 void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode)
9022 if (reiserfs_attrs(inode->i_sb)) {
9023 - if (sd_attrs & REISERFS_SYNC_FL)
9024 - inode->i_flags |= S_SYNC;
9026 - inode->i_flags &= ~S_SYNC;
9027 if (sd_attrs & REISERFS_IMMUTABLE_FL)
9028 inode->i_flags |= S_IMMUTABLE;
9030 inode->i_flags &= ~S_IMMUTABLE;
9031 + if (sd_attrs & REISERFS_IXUNLINK_FL)
9032 + inode->i_flags |= S_IXUNLINK;
9034 + inode->i_flags &= ~S_IXUNLINK;
9036 + if (sd_attrs & REISERFS_SYNC_FL)
9037 + inode->i_flags |= S_SYNC;
9039 + inode->i_flags &= ~S_SYNC;
9040 if (sd_attrs & REISERFS_APPEND_FL)
9041 inode->i_flags |= S_APPEND;
9043 @@ -2872,6 +2888,15 @@ void sd_attrs_to_i_attrs(__u16 sd_attrs,
9044 REISERFS_I(inode)->i_flags |= i_nopack_mask;
9046 REISERFS_I(inode)->i_flags &= ~i_nopack_mask;
9048 + if (sd_attrs & REISERFS_BARRIER_FL)
9049 + inode->i_vflags |= V_BARRIER;
9051 + inode->i_vflags &= ~V_BARRIER;
9052 + if (sd_attrs & REISERFS_COW_FL)
9053 + inode->i_vflags |= V_COW;
9055 + inode->i_vflags &= ~V_COW;
9059 @@ -2882,6 +2907,11 @@ void i_attrs_to_sd_attrs(struct inode *i
9060 *sd_attrs |= REISERFS_IMMUTABLE_FL;
9062 *sd_attrs &= ~REISERFS_IMMUTABLE_FL;
9063 + if (inode->i_flags & S_IXUNLINK)
9064 + *sd_attrs |= REISERFS_IXUNLINK_FL;
9066 + *sd_attrs &= ~REISERFS_IXUNLINK_FL;
9068 if (inode->i_flags & S_SYNC)
9069 *sd_attrs |= REISERFS_SYNC_FL;
9071 @@ -2894,6 +2924,15 @@ void i_attrs_to_sd_attrs(struct inode *i
9072 *sd_attrs |= REISERFS_NOTAIL_FL;
9074 *sd_attrs &= ~REISERFS_NOTAIL_FL;
9076 + if (inode->i_vflags & V_BARRIER)
9077 + *sd_attrs |= REISERFS_BARRIER_FL;
9079 + *sd_attrs &= ~REISERFS_BARRIER_FL;
9080 + if (inode->i_vflags & V_COW)
9081 + *sd_attrs |= REISERFS_COW_FL;
9083 + *sd_attrs &= ~REISERFS_COW_FL;
9087 @@ -3115,9 +3154,11 @@ int reiserfs_setattr(struct dentry *dent
9090 error = inode_change_ok(inode, attr);
9093 if ((ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
9094 - (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
9095 + (ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid) ||
9096 + (ia_valid & ATTR_TAG && attr->ia_tag != inode->i_tag)) {
9097 error = reiserfs_chown_xattrs(inode, attr);
9100 @@ -3147,6 +3188,9 @@ int reiserfs_setattr(struct dentry *dent
9101 inode->i_uid = attr->ia_uid;
9102 if (attr->ia_valid & ATTR_GID)
9103 inode->i_gid = attr->ia_gid;
9104 + if ((attr->ia_valid & ATTR_TAG) &&
9106 + inode->i_tag = attr->ia_tag;
9107 mark_inode_dirty(inode);
9109 journal_end(&th, inode->i_sb, jbegin_count);
9110 diff -NurpP --minimal linux-2.6.33.2/fs/reiserfs/ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/ioctl.c
9111 --- linux-2.6.33.2/fs/reiserfs/ioctl.c 2010-02-25 11:52:06.000000000 +0100
9112 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/ioctl.c 2010-02-25 13:21:56.000000000 +0100
9114 #include <linux/mount.h>
9115 #include <linux/reiserfs_fs.h>
9116 #include <linux/time.h>
9117 +#include <linux/mount.h>
9118 #include <asm/uaccess.h>
9119 #include <linux/pagemap.h>
9120 #include <linux/smp_lock.h>
9121 #include <linux/compat.h>
9124 +int reiserfs_sync_flags(struct inode *inode, int flags, int vflags)
9126 + __u16 sd_attrs = 0;
9128 + inode->i_flags = flags;
9129 + inode->i_vflags = vflags;
9131 + i_attrs_to_sd_attrs(inode, &sd_attrs);
9132 + REISERFS_I(inode)->i_attrs = sd_attrs;
9133 + inode->i_ctime = CURRENT_TIME_SEC;
9134 + mark_inode_dirty(inode);
9139 * reiserfs_ioctl - handler for ioctl for inode
9140 * supported commands:
9142 long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
9144 struct inode *inode = filp->f_path.dentry->d_inode;
9145 - unsigned int flags;
9146 + unsigned int flags, oldflags;
9149 reiserfs_write_lock(inode->i_sb);
9150 @@ -48,6 +64,7 @@ long reiserfs_ioctl(struct file *filp, u
9152 flags = REISERFS_I(inode)->i_attrs;
9153 i_attrs_to_sd_attrs(inode, (__u16 *) & flags);
9154 + flags &= REISERFS_FL_USER_VISIBLE;
9155 err = put_user(flags, (int __user *)arg);
9157 case REISERFS_IOC_SETFLAGS:{
9158 @@ -68,6 +85,10 @@ long reiserfs_ioctl(struct file *filp, u
9162 + if (IS_BARRIER(inode)) {
9163 + vxwprintk_task(1, "messing with the barrier.");
9167 * Is it quota file? Do not allow user to mess with it
9169 @@ -92,6 +113,10 @@ long reiserfs_ioctl(struct file *filp, u
9174 + oldflags = REISERFS_I(inode)->i_attrs;
9175 + flags &= REISERFS_FL_USER_MODIFIABLE;
9176 + flags |= oldflags & ~REISERFS_FL_USER_MODIFIABLE;
9177 sd_attrs_to_i_attrs(flags, inode);
9178 REISERFS_I(inode)->i_attrs = flags;
9179 inode->i_ctime = CURRENT_TIME_SEC;
9180 diff -NurpP --minimal linux-2.6.33.2/fs/reiserfs/namei.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/namei.c
9181 --- linux-2.6.33.2/fs/reiserfs/namei.c 2010-02-25 11:52:06.000000000 +0100
9182 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/namei.c 2010-02-25 12:02:16.000000000 +0100
9184 #include <linux/reiserfs_acl.h>
9185 #include <linux/reiserfs_xattr.h>
9186 #include <linux/quotaops.h>
9187 +#include <linux/vs_tag.h>
9189 #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; }
9190 #define DEC_DIR_INODE_NLINK(i) if (i->i_nlink != 1) drop_nlink(i);
9191 @@ -361,6 +362,7 @@ static struct dentry *reiserfs_lookup(st
9192 if (retval == IO_ERROR) {
9193 return ERR_PTR(-EIO);
9195 + dx_propagate_tag(nd, inode);
9197 return d_splice_alias(inode, dentry);
9199 @@ -577,6 +579,7 @@ static int new_inode_init(struct inode *
9201 inode->i_gid = current_fsgid();
9203 + inode->i_tag = dx_current_fstag(inode->i_sb);
9207 @@ -1524,6 +1527,7 @@ const struct inode_operations reiserfs_d
9208 .listxattr = reiserfs_listxattr,
9209 .removexattr = reiserfs_removexattr,
9210 .permission = reiserfs_permission,
9211 + .sync_flags = reiserfs_sync_flags,
9215 diff -NurpP --minimal linux-2.6.33.2/fs/reiserfs/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/super.c
9216 --- linux-2.6.33.2/fs/reiserfs/super.c 2010-02-25 11:52:06.000000000 +0100
9217 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/super.c 2010-02-25 12:02:16.000000000 +0100
9218 @@ -887,6 +887,14 @@ static int reiserfs_parse_options(struct
9219 {"user_xattr",.setmask = 1 << REISERFS_UNSUPPORTED_OPT},
9220 {"nouser_xattr",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT},
9222 +#ifndef CONFIG_TAGGING_NONE
9223 + {"tagxid",.setmask = 1 << REISERFS_TAGGED},
9224 + {"tag",.setmask = 1 << REISERFS_TAGGED},
9225 + {"notag",.clrmask = 1 << REISERFS_TAGGED},
9227 +#ifdef CONFIG_PROPAGATE
9228 + {"tag",.arg_required = 'T',.values = NULL},
9230 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
9231 {"acl",.setmask = 1 << REISERFS_POSIXACL},
9232 {"noacl",.clrmask = 1 << REISERFS_POSIXACL},
9233 @@ -1196,6 +1204,14 @@ static int reiserfs_remount(struct super
9234 handle_quota_files(s, qf_names, &qfmt);
9237 + if ((mount_options & (1 << REISERFS_TAGGED)) &&
9238 + !(s->s_flags & MS_TAGGED)) {
9239 + reiserfs_warning(s, "super-vs01",
9240 + "reiserfs: tagging not permitted on remount.");
9247 /* Add options that are safe here */
9248 @@ -1674,6 +1690,10 @@ static int reiserfs_fill_super(struct su
9252 + /* map mount option tagxid */
9253 + if (REISERFS_SB(s)->s_mount_opt & (1 << REISERFS_TAGGED))
9254 + s->s_flags |= MS_TAGGED;
9256 rs = SB_DISK_SUPER_BLOCK(s);
9257 /* Let's do basic sanity check to verify that underlying device is not
9258 smaller than the filesystem. If the check fails then abort and scream,
9259 diff -NurpP --minimal linux-2.6.33.2/fs/reiserfs/xattr.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/xattr.c
9260 --- linux-2.6.33.2/fs/reiserfs/xattr.c 2010-02-25 11:52:06.000000000 +0100
9261 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/reiserfs/xattr.c 2010-02-25 12:02:16.000000000 +0100
9263 #include <linux/namei.h>
9264 #include <linux/errno.h>
9265 #include <linux/fs.h>
9266 +#include <linux/mount.h>
9267 #include <linux/file.h>
9268 #include <linux/pagemap.h>
9269 #include <linux/xattr.h>
9270 diff -NurpP --minimal linux-2.6.33.2/fs/stat.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/stat.c
9271 --- linux-2.6.33.2/fs/stat.c 2010-02-25 11:52:06.000000000 +0100
9272 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/stat.c 2010-02-25 12:02:16.000000000 +0100
9273 @@ -26,6 +26,7 @@ void generic_fillattr(struct inode *inod
9274 stat->nlink = inode->i_nlink;
9275 stat->uid = inode->i_uid;
9276 stat->gid = inode->i_gid;
9277 + stat->tag = inode->i_tag;
9278 stat->rdev = inode->i_rdev;
9279 stat->atime = inode->i_atime;
9280 stat->mtime = inode->i_mtime;
9281 diff -NurpP --minimal linux-2.6.33.2/fs/super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/super.c
9282 --- linux-2.6.33.2/fs/super.c 2010-02-25 11:52:06.000000000 +0100
9283 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/super.c 2010-02-25 12:02:16.000000000 +0100
9285 #include <linux/kobject.h>
9286 #include <linux/mutex.h>
9287 #include <linux/file.h>
9288 +#include <linux/devpts_fs.h>
9289 +#include <linux/proc_fs.h>
9290 +#include <linux/vs_context.h>
9291 #include <asm/uaccess.h>
9292 #include "internal.h"
9294 @@ -914,12 +917,18 @@ struct vfsmount *
9295 vfs_kern_mount(struct file_system_type *type, int flags, const char *name, void *data)
9297 struct vfsmount *mnt;
9298 + struct super_block *sb;
9299 char *secdata = NULL;
9303 return ERR_PTR(-ENODEV);
9306 + if ((type->fs_flags & FS_BINARY_MOUNTDATA) &&
9307 + !vx_capable(CAP_SYS_ADMIN, VXC_BINARY_MOUNT))
9311 mnt = alloc_vfsmnt(name);
9313 @@ -938,9 +947,17 @@ vfs_kern_mount(struct file_system_type *
9314 error = type->get_sb(type, flags, name, data, mnt);
9316 goto out_free_secdata;
9317 - BUG_ON(!mnt->mnt_sb);
9319 - error = security_sb_kern_mount(mnt->mnt_sb, flags, secdata);
9324 + if (!vx_capable(CAP_SYS_ADMIN, VXC_BINARY_MOUNT) && !sb->s_bdev &&
9325 + (sb->s_magic != PROC_SUPER_MAGIC) &&
9326 + (sb->s_magic != DEVPTS_SUPER_MAGIC))
9329 + error = security_sb_kern_mount(sb, flags, secdata);
9333 diff -NurpP --minimal linux-2.6.33.2/fs/sysfs/mount.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/sysfs/mount.c
9334 --- linux-2.6.33.2/fs/sysfs/mount.c 2009-06-11 17:13:08.000000000 +0200
9335 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/sysfs/mount.c 2010-02-25 12:02:16.000000000 +0100
9336 @@ -47,7 +47,7 @@ static int sysfs_fill_super(struct super
9338 sb->s_blocksize = PAGE_CACHE_SIZE;
9339 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
9340 - sb->s_magic = SYSFS_MAGIC;
9341 + sb->s_magic = SYSFS_SUPER_MAGIC;
9342 sb->s_op = &sysfs_ops;
9343 sb->s_time_gran = 1;
9345 diff -NurpP --minimal linux-2.6.33.2/fs/utimes.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/utimes.c
9346 --- linux-2.6.33.2/fs/utimes.c 2009-03-24 14:22:37.000000000 +0100
9347 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/utimes.c 2010-02-25 12:02:16.000000000 +0100
9349 #include <linux/stat.h>
9350 #include <linux/utime.h>
9351 #include <linux/syscalls.h>
9352 +#include <linux/mount.h>
9353 +#include <linux/vs_cowbl.h>
9354 #include <asm/uaccess.h>
9355 #include <asm/unistd.h>
9357 diff -NurpP --minimal linux-2.6.33.2/fs/xattr.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xattr.c
9358 --- linux-2.6.33.2/fs/xattr.c 2010-02-25 11:52:06.000000000 +0100
9359 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xattr.c 2010-03-05 19:55:41.000000000 +0100
9361 #include <linux/module.h>
9362 #include <linux/fsnotify.h>
9363 #include <linux/audit.h>
9364 +#include <linux/mount.h>
9365 #include <asm/uaccess.h>
9368 @@ -49,7 +50,7 @@ xattr_permission(struct inode *inode, co
9369 * The trusted.* namespace can only be accessed by a privileged user.
9371 if (!strncmp(name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN))
9372 - return (capable(CAP_SYS_ADMIN) ? 0 : -EPERM);
9373 + return (vx_capable(CAP_SYS_ADMIN, VXC_FS_TRUSTED) ? 0 : -EPERM);
9375 /* In user.* namespace, only regular files and directories can have
9376 * extended attributes. For sticky directories, only the owner and
9377 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_ioctl.c
9378 --- linux-2.6.33.2/fs/xfs/linux-2.6/xfs_ioctl.c 2010-02-25 11:52:06.000000000 +0100
9379 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_ioctl.c 2010-02-25 12:02:16.000000000 +0100
9381 #include "xfs_dir2_sf.h"
9382 #include "xfs_dinode.h"
9383 #include "xfs_inode.h"
9384 -#include "xfs_ioctl.h"
9385 #include "xfs_btree.h"
9386 #include "xfs_ialloc.h"
9387 #include "xfs_rtalloc.h"
9388 @@ -743,6 +742,10 @@ xfs_merge_ioc_xflags(
9389 xflags |= XFS_XFLAG_IMMUTABLE;
9391 xflags &= ~XFS_XFLAG_IMMUTABLE;
9392 + if (flags & FS_IXUNLINK_FL)
9393 + xflags |= XFS_XFLAG_IXUNLINK;
9395 + xflags &= ~XFS_XFLAG_IXUNLINK;
9396 if (flags & FS_APPEND_FL)
9397 xflags |= XFS_XFLAG_APPEND;
9399 @@ -771,6 +774,8 @@ xfs_di2lxflags(
9401 if (di_flags & XFS_DIFLAG_IMMUTABLE)
9402 flags |= FS_IMMUTABLE_FL;
9403 + if (di_flags & XFS_DIFLAG_IXUNLINK)
9404 + flags |= FS_IXUNLINK_FL;
9405 if (di_flags & XFS_DIFLAG_APPEND)
9406 flags |= FS_APPEND_FL;
9407 if (di_flags & XFS_DIFLAG_SYNC)
9408 @@ -829,6 +834,8 @@ xfs_set_diflags(
9409 di_flags = (ip->i_d.di_flags & XFS_DIFLAG_PREALLOC);
9410 if (xflags & XFS_XFLAG_IMMUTABLE)
9411 di_flags |= XFS_DIFLAG_IMMUTABLE;
9412 + if (xflags & XFS_XFLAG_IXUNLINK)
9413 + di_flags |= XFS_DIFLAG_IXUNLINK;
9414 if (xflags & XFS_XFLAG_APPEND)
9415 di_flags |= XFS_DIFLAG_APPEND;
9416 if (xflags & XFS_XFLAG_SYNC)
9417 @@ -871,6 +878,10 @@ xfs_diflags_to_linux(
9418 inode->i_flags |= S_IMMUTABLE;
9420 inode->i_flags &= ~S_IMMUTABLE;
9421 + if (xflags & XFS_XFLAG_IXUNLINK)
9422 + inode->i_flags |= S_IXUNLINK;
9424 + inode->i_flags &= ~S_IXUNLINK;
9425 if (xflags & XFS_XFLAG_APPEND)
9426 inode->i_flags |= S_APPEND;
9428 @@ -1347,10 +1358,18 @@ xfs_file_ioctl(
9429 case XFS_IOC_FSGETXATTRA:
9430 return xfs_ioc_fsgetxattr(ip, 1, arg);
9431 case XFS_IOC_FSSETXATTR:
9432 + if (IS_BARRIER(inode)) {
9433 + vxwprintk_task(1, "messing with the barrier.");
9434 + return -XFS_ERROR(EACCES);
9436 return xfs_ioc_fssetxattr(ip, filp, arg);
9437 case XFS_IOC_GETXFLAGS:
9438 return xfs_ioc_getxflags(ip, arg);
9439 case XFS_IOC_SETXFLAGS:
9440 + if (IS_BARRIER(inode)) {
9441 + vxwprintk_task(1, "messing with the barrier.");
9442 + return -XFS_ERROR(EACCES);
9444 return xfs_ioc_setxflags(ip, filp, arg);
9446 case XFS_IOC_FSSETDM: {
9447 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/linux-2.6/xfs_ioctl.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_ioctl.h
9448 --- linux-2.6.33.2/fs/xfs/linux-2.6/xfs_ioctl.h 2009-03-24 14:22:37.000000000 +0100
9449 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_ioctl.h 2010-02-25 12:02:16.000000000 +0100
9450 @@ -70,6 +70,12 @@ xfs_handle_to_dentry(
9451 void __user *uhandle,
9456 + struct inode *inode,
9463 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_iops.c
9464 --- linux-2.6.33.2/fs/xfs/linux-2.6/xfs_iops.c 2010-02-25 11:52:06.000000000 +0100
9465 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_iops.c 2010-02-25 12:02:16.000000000 +0100
9467 #include "xfs_attr_sf.h"
9468 #include "xfs_dinode.h"
9469 #include "xfs_inode.h"
9470 +#include "xfs_ioctl.h"
9471 #include "xfs_bmap.h"
9472 #include "xfs_btree.h"
9473 #include "xfs_ialloc.h"
9475 #include <linux/security.h>
9476 #include <linux/falloc.h>
9477 #include <linux/fiemap.h>
9478 +#include <linux/vs_tag.h>
9481 * Bring the timestamps in the XFS inode uptodate.
9482 @@ -496,6 +498,7 @@ xfs_vn_getattr(
9483 stat->nlink = ip->i_d.di_nlink;
9484 stat->uid = ip->i_d.di_uid;
9485 stat->gid = ip->i_d.di_gid;
9486 + stat->tag = ip->i_d.di_tag;
9487 stat->ino = ip->i_ino;
9488 stat->atime = inode->i_atime;
9489 stat->mtime = inode->i_mtime;
9490 @@ -687,6 +690,7 @@ static const struct inode_operations xfs
9491 .listxattr = xfs_vn_listxattr,
9492 .fallocate = xfs_vn_fallocate,
9493 .fiemap = xfs_vn_fiemap,
9494 + .sync_flags = xfs_sync_flags,
9497 static const struct inode_operations xfs_dir_inode_operations = {
9498 @@ -712,6 +716,7 @@ static const struct inode_operations xfs
9499 .getxattr = generic_getxattr,
9500 .removexattr = generic_removexattr,
9501 .listxattr = xfs_vn_listxattr,
9502 + .sync_flags = xfs_sync_flags,
9505 static const struct inode_operations xfs_dir_ci_inode_operations = {
9506 @@ -761,6 +766,10 @@ xfs_diflags_to_iflags(
9507 inode->i_flags |= S_IMMUTABLE;
9509 inode->i_flags &= ~S_IMMUTABLE;
9510 + if (ip->i_d.di_flags & XFS_DIFLAG_IXUNLINK)
9511 + inode->i_flags |= S_IXUNLINK;
9513 + inode->i_flags &= ~S_IXUNLINK;
9514 if (ip->i_d.di_flags & XFS_DIFLAG_APPEND)
9515 inode->i_flags |= S_APPEND;
9517 @@ -773,6 +782,15 @@ xfs_diflags_to_iflags(
9518 inode->i_flags |= S_NOATIME;
9520 inode->i_flags &= ~S_NOATIME;
9522 + if (ip->i_d.di_vflags & XFS_DIVFLAG_BARRIER)
9523 + inode->i_vflags |= V_BARRIER;
9525 + inode->i_vflags &= ~V_BARRIER;
9526 + if (ip->i_d.di_vflags & XFS_DIVFLAG_COW)
9527 + inode->i_vflags |= V_COW;
9529 + inode->i_vflags &= ~V_COW;
9533 @@ -801,6 +819,7 @@ xfs_setup_inode(
9534 inode->i_nlink = ip->i_d.di_nlink;
9535 inode->i_uid = ip->i_d.di_uid;
9536 inode->i_gid = ip->i_d.di_gid;
9537 + inode->i_tag = ip->i_d.di_tag;
9539 switch (inode->i_mode & S_IFMT) {
9541 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/linux-2.6/xfs_linux.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_linux.h
9542 --- linux-2.6.33.2/fs/xfs/linux-2.6/xfs_linux.h 2010-02-25 11:52:06.000000000 +0100
9543 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_linux.h 2010-02-25 12:02:16.000000000 +0100
9546 #define current_cpu() (raw_smp_processor_id())
9547 #define current_pid() (current->pid)
9548 +#define current_fstag(cred,vp) (dx_current_fstag((vp)->i_sb))
9549 #define current_test_flags(f) (current->flags & (f))
9550 #define current_set_flags_nested(sp, f) \
9551 (*(sp) = current->flags, current->flags |= (f))
9552 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/linux-2.6/xfs_super.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_super.c
9553 --- linux-2.6.33.2/fs/xfs/linux-2.6/xfs_super.c 2010-02-25 11:52:06.000000000 +0100
9554 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_super.c 2010-02-25 12:02:16.000000000 +0100
9555 @@ -118,6 +118,9 @@ mempool_t *xfs_ioend_pool;
9556 #define MNTOPT_DMAPI "dmapi" /* DMI enabled (DMAPI / XDSM) */
9557 #define MNTOPT_XDSM "xdsm" /* DMI enabled (DMAPI / XDSM) */
9558 #define MNTOPT_DMI "dmi" /* DMI enabled (DMAPI / XDSM) */
9559 +#define MNTOPT_TAGXID "tagxid" /* context tagging for inodes */
9560 +#define MNTOPT_TAGGED "tag" /* context tagging for inodes */
9561 +#define MNTOPT_NOTAGTAG "notag" /* do not use context tagging */
9564 * Table driven mount option parser.
9565 @@ -126,10 +129,14 @@ mempool_t *xfs_ioend_pool;
9566 * in the future, too.
9569 + Opt_tag, Opt_notag,
9570 Opt_barrier, Opt_nobarrier, Opt_err
9573 static const match_table_t tokens = {
9574 + {Opt_tag, "tagxid"},
9576 + {Opt_notag, "notag"},
9577 {Opt_barrier, "barrier"},
9578 {Opt_nobarrier, "nobarrier"},
9580 @@ -383,6 +390,19 @@ xfs_parseargs(
9581 } else if (!strcmp(this_char, "irixsgid")) {
9583 "XFS: irixsgid is now a sysctl(2) variable, option is deprecated.");
9584 +#ifndef CONFIG_TAGGING_NONE
9585 + } else if (!strcmp(this_char, MNTOPT_TAGGED)) {
9586 + mp->m_flags |= XFS_MOUNT_TAGGED;
9587 + } else if (!strcmp(this_char, MNTOPT_NOTAGTAG)) {
9588 + mp->m_flags &= ~XFS_MOUNT_TAGGED;
9589 + } else if (!strcmp(this_char, MNTOPT_TAGXID)) {
9590 + mp->m_flags |= XFS_MOUNT_TAGGED;
9592 +#ifdef CONFIG_PROPAGATE
9593 + } else if (!strcmp(this_char, MNTOPT_TAGGED)) {
9595 + mp->m_flags |= XFS_MOUNT_TAGGED;
9599 "XFS: unknown mount option [%s].", this_char);
9600 @@ -1290,6 +1310,16 @@ xfs_fs_remount(
9602 mp->m_flags &= ~XFS_MOUNT_BARRIER;
9605 + if (!(sb->s_flags & MS_TAGGED)) {
9607 + "XFS: %s: tagging not permitted on remount.\n",
9616 * Logically we would return an error here to prevent
9617 @@ -1497,6 +1527,9 @@ xfs_fs_fill_super(
9619 XFS_SEND_MOUNT(mp, DM_RIGHT_NULL, mtpt, mp->m_fsname);
9621 + if (mp->m_flags & XFS_MOUNT_TAGGED)
9622 + sb->s_flags |= MS_TAGGED;
9624 sb->s_magic = XFS_SB_MAGIC;
9625 sb->s_blocksize = mp->m_sb.sb_blocksize;
9626 sb->s_blocksize_bits = ffs(sb->s_blocksize) - 1;
9627 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_dinode.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_dinode.h
9628 --- linux-2.6.33.2/fs/xfs/xfs_dinode.h 2009-06-11 17:13:09.000000000 +0200
9629 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_dinode.h 2010-02-25 12:02:16.000000000 +0100
9630 @@ -50,7 +50,9 @@ typedef struct xfs_dinode {
9631 __be32 di_gid; /* owner's group id */
9632 __be32 di_nlink; /* number of links to file */
9633 __be16 di_projid; /* owner's project id */
9634 - __u8 di_pad[8]; /* unused, zeroed space */
9635 + __be16 di_tag; /* context tagging */
9636 + __be16 di_vflags; /* vserver specific flags */
9637 + __u8 di_pad[4]; /* unused, zeroed space */
9638 __be16 di_flushiter; /* incremented on flush */
9639 xfs_timestamp_t di_atime; /* time last accessed */
9640 xfs_timestamp_t di_mtime; /* time last modified */
9641 @@ -183,6 +185,8 @@ static inline void xfs_dinode_put_rdev(s
9642 #define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */
9643 #define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */
9644 #define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */
9645 +#define XFS_DIFLAG_IXUNLINK_BIT 15 /* Immutable inver on unlink */
9647 #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT)
9648 #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT)
9649 #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
9650 @@ -198,6 +202,7 @@ static inline void xfs_dinode_put_rdev(s
9651 #define XFS_DIFLAG_EXTSZINHERIT (1 << XFS_DIFLAG_EXTSZINHERIT_BIT)
9652 #define XFS_DIFLAG_NODEFRAG (1 << XFS_DIFLAG_NODEFRAG_BIT)
9653 #define XFS_DIFLAG_FILESTREAM (1 << XFS_DIFLAG_FILESTREAM_BIT)
9654 +#define XFS_DIFLAG_IXUNLINK (1 << XFS_DIFLAG_IXUNLINK_BIT)
9656 #ifdef CONFIG_XFS_RT
9657 #define XFS_IS_REALTIME_INODE(ip) ((ip)->i_d.di_flags & XFS_DIFLAG_REALTIME)
9658 @@ -210,6 +215,10 @@ static inline void xfs_dinode_put_rdev(s
9659 XFS_DIFLAG_IMMUTABLE | XFS_DIFLAG_APPEND | XFS_DIFLAG_SYNC | \
9660 XFS_DIFLAG_NOATIME | XFS_DIFLAG_NODUMP | XFS_DIFLAG_RTINHERIT | \
9661 XFS_DIFLAG_PROJINHERIT | XFS_DIFLAG_NOSYMLINKS | XFS_DIFLAG_EXTSIZE | \
9662 - XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM)
9663 + XFS_DIFLAG_EXTSZINHERIT | XFS_DIFLAG_NODEFRAG | XFS_DIFLAG_FILESTREAM | \
9664 + XFS_DIFLAG_IXUNLINK)
9666 +#define XFS_DIVFLAG_BARRIER 0x01
9667 +#define XFS_DIVFLAG_COW 0x02
9669 #endif /* __XFS_DINODE_H__ */
9670 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_fs.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_fs.h
9671 --- linux-2.6.33.2/fs/xfs/xfs_fs.h 2009-12-03 20:02:53.000000000 +0100
9672 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_fs.h 2010-02-25 12:02:16.000000000 +0100
9673 @@ -67,6 +67,9 @@ struct fsxattr {
9674 #define XFS_XFLAG_EXTSZINHERIT 0x00001000 /* inherit inode extent size */
9675 #define XFS_XFLAG_NODEFRAG 0x00002000 /* do not defragment */
9676 #define XFS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
9677 +#define XFS_XFLAG_IXUNLINK 0x00008000 /* immutable invert on unlink */
9678 +#define XFS_XFLAG_BARRIER 0x10000000 /* chroot() barrier */
9679 +#define XFS_XFLAG_COW 0x20000000 /* copy on write mark */
9680 #define XFS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
9683 @@ -292,7 +295,8 @@ typedef struct xfs_bstat {
9684 __s32 bs_extents; /* number of extents */
9685 __u32 bs_gen; /* generation count */
9686 __u16 bs_projid; /* project id */
9687 - unsigned char bs_pad[14]; /* pad space, unused */
9688 + __u16 bs_tag; /* context tagging */
9689 + unsigned char bs_pad[12]; /* pad space, unused */
9690 __u32 bs_dmevmask; /* DMIG event mask */
9691 __u16 bs_dmstate; /* DMIG state info */
9692 __u16 bs_aextents; /* attribute number of extents */
9693 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_ialloc.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_ialloc.c
9694 --- linux-2.6.33.2/fs/xfs/xfs_ialloc.c 2010-02-25 11:52:06.000000000 +0100
9695 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_ialloc.c 2010-02-25 12:02:16.000000000 +0100
9697 #include "xfs_error.h"
9698 #include "xfs_bmap.h"
9702 * Allocation group level functions.
9704 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_inode.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_inode.c
9705 --- linux-2.6.33.2/fs/xfs/xfs_inode.c 2010-02-25 11:52:06.000000000 +0100
9706 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_inode.c 2010-02-25 12:02:16.000000000 +0100
9707 @@ -249,6 +249,7 @@ xfs_inotobp(
9711 +#include <linux/vs_tag.h>
9714 * This routine is called to map an inode to the buffer containing
9715 @@ -654,15 +655,25 @@ xfs_iformat_btree(
9717 xfs_dinode_from_disk(
9719 - xfs_dinode_t *from)
9720 + xfs_dinode_t *from,
9723 + uint32_t uid, gid, tag;
9725 to->di_magic = be16_to_cpu(from->di_magic);
9726 to->di_mode = be16_to_cpu(from->di_mode);
9727 to->di_version = from ->di_version;
9728 to->di_format = from->di_format;
9729 to->di_onlink = be16_to_cpu(from->di_onlink);
9730 - to->di_uid = be32_to_cpu(from->di_uid);
9731 - to->di_gid = be32_to_cpu(from->di_gid);
9733 + uid = be32_to_cpu(from->di_uid);
9734 + gid = be32_to_cpu(from->di_gid);
9735 + tag = be16_to_cpu(from->di_tag);
9737 + to->di_uid = INOTAG_UID(tagged, uid, gid);
9738 + to->di_gid = INOTAG_GID(tagged, uid, gid);
9739 + to->di_tag = INOTAG_TAG(tagged, uid, gid, tag);
9741 to->di_nlink = be32_to_cpu(from->di_nlink);
9742 to->di_projid = be16_to_cpu(from->di_projid);
9743 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
9744 @@ -683,21 +694,26 @@ xfs_dinode_from_disk(
9745 to->di_dmevmask = be32_to_cpu(from->di_dmevmask);
9746 to->di_dmstate = be16_to_cpu(from->di_dmstate);
9747 to->di_flags = be16_to_cpu(from->di_flags);
9748 + to->di_vflags = be16_to_cpu(from->di_vflags);
9749 to->di_gen = be32_to_cpu(from->di_gen);
9755 - xfs_icdinode_t *from)
9756 + xfs_icdinode_t *from,
9759 to->di_magic = cpu_to_be16(from->di_magic);
9760 to->di_mode = cpu_to_be16(from->di_mode);
9761 to->di_version = from ->di_version;
9762 to->di_format = from->di_format;
9763 to->di_onlink = cpu_to_be16(from->di_onlink);
9764 - to->di_uid = cpu_to_be32(from->di_uid);
9765 - to->di_gid = cpu_to_be32(from->di_gid);
9767 + to->di_uid = cpu_to_be32(TAGINO_UID(tagged, from->di_uid, from->di_tag));
9768 + to->di_gid = cpu_to_be32(TAGINO_GID(tagged, from->di_gid, from->di_tag));
9769 + to->di_tag = cpu_to_be16(TAGINO_TAG(tagged, from->di_tag));
9771 to->di_nlink = cpu_to_be32(from->di_nlink);
9772 to->di_projid = cpu_to_be16(from->di_projid);
9773 memcpy(to->di_pad, from->di_pad, sizeof(to->di_pad));
9774 @@ -718,12 +734,14 @@ xfs_dinode_to_disk(
9775 to->di_dmevmask = cpu_to_be32(from->di_dmevmask);
9776 to->di_dmstate = cpu_to_be16(from->di_dmstate);
9777 to->di_flags = cpu_to_be16(from->di_flags);
9778 + to->di_vflags = cpu_to_be16(from->di_vflags);
9779 to->di_gen = cpu_to_be32(from->di_gen);
9784 - __uint16_t di_flags)
9785 + __uint16_t di_flags,
9786 + __uint16_t di_vflags)
9790 @@ -734,6 +752,8 @@ _xfs_dic2xflags(
9791 flags |= XFS_XFLAG_PREALLOC;
9792 if (di_flags & XFS_DIFLAG_IMMUTABLE)
9793 flags |= XFS_XFLAG_IMMUTABLE;
9794 + if (di_flags & XFS_DIFLAG_IXUNLINK)
9795 + flags |= XFS_XFLAG_IXUNLINK;
9796 if (di_flags & XFS_DIFLAG_APPEND)
9797 flags |= XFS_XFLAG_APPEND;
9798 if (di_flags & XFS_DIFLAG_SYNC)
9799 @@ -758,6 +778,10 @@ _xfs_dic2xflags(
9800 flags |= XFS_XFLAG_FILESTREAM;
9803 + if (di_vflags & XFS_DIVFLAG_BARRIER)
9804 + flags |= FS_BARRIER_FL;
9805 + if (di_vflags & XFS_DIVFLAG_COW)
9806 + flags |= FS_COW_FL;
9810 @@ -767,7 +791,7 @@ xfs_ip2xflags(
9812 xfs_icdinode_t *dic = &ip->i_d;
9814 - return _xfs_dic2xflags(dic->di_flags) |
9815 + return _xfs_dic2xflags(dic->di_flags, dic->di_vflags) |
9816 (XFS_IFORK_Q(ip) ? XFS_XFLAG_HASATTR : 0);
9819 @@ -775,7 +799,8 @@ uint
9823 - return _xfs_dic2xflags(be16_to_cpu(dip->di_flags)) |
9824 + return _xfs_dic2xflags(be16_to_cpu(dip->di_flags),
9825 + be16_to_cpu(dip->di_vflags)) |
9826 (XFS_DFORK_Q(dip) ? XFS_XFLAG_HASATTR : 0);
9829 @@ -811,7 +836,6 @@ xfs_iread(
9832 dip = (xfs_dinode_t *)xfs_buf_offset(bp, ip->i_imap.im_boffset);
9835 * If we got something that isn't an inode it means someone
9836 * (nfs or dmi) has a stale handle.
9837 @@ -836,7 +860,8 @@ xfs_iread(
9838 * Otherwise, just get the truly permanent information.
9841 - xfs_dinode_from_disk(&ip->i_d, dip);
9842 + xfs_dinode_from_disk(&ip->i_d, dip,
9843 + mp->m_flags & XFS_MOUNT_TAGGED);
9844 error = xfs_iformat(ip, dip);
9847 @@ -1036,6 +1061,7 @@ xfs_ialloc(
9848 ASSERT(ip->i_d.di_nlink == nlink);
9849 ip->i_d.di_uid = current_fsuid();
9850 ip->i_d.di_gid = current_fsgid();
9851 + ip->i_d.di_tag = current_fstag(cr, &ip->i_vnode);
9852 ip->i_d.di_projid = prid;
9853 memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
9855 @@ -1096,6 +1122,7 @@ xfs_ialloc(
9856 ip->i_d.di_dmevmask = 0;
9857 ip->i_d.di_dmstate = 0;
9858 ip->i_d.di_flags = 0;
9859 + ip->i_d.di_vflags = 0;
9860 flags = XFS_ILOG_CORE;
9861 switch (mode & S_IFMT) {
9863 @@ -2136,6 +2163,7 @@ xfs_ifree(
9865 ip->i_d.di_mode = 0; /* mark incore inode as free */
9866 ip->i_d.di_flags = 0;
9867 + ip->i_d.di_vflags = 0;
9868 ip->i_d.di_dmevmask = 0;
9869 ip->i_d.di_forkoff = 0; /* mark the attr fork not in use */
9870 ip->i_df.if_ext_max =
9871 @@ -3116,7 +3144,8 @@ xfs_iflush_int(
9872 * because if the inode is dirty at all the core must
9875 - xfs_dinode_to_disk(dip, &ip->i_d);
9876 + xfs_dinode_to_disk(dip, &ip->i_d,
9877 + mp->m_flags & XFS_MOUNT_TAGGED);
9879 /* Wrap, we never let the log put out DI_MAX_FLUSH */
9880 if (ip->i_d.di_flushiter == DI_MAX_FLUSH)
9881 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_inode.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_inode.h
9882 --- linux-2.6.33.2/fs/xfs/xfs_inode.h 2010-02-25 11:52:06.000000000 +0100
9883 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_inode.h 2010-02-25 12:02:16.000000000 +0100
9884 @@ -135,7 +135,9 @@ typedef struct xfs_icdinode {
9885 __uint32_t di_gid; /* owner's group id */
9886 __uint32_t di_nlink; /* number of links to file */
9887 __uint16_t di_projid; /* owner's project id */
9888 - __uint8_t di_pad[8]; /* unused, zeroed space */
9889 + __uint16_t di_tag; /* context tagging */
9890 + __uint16_t di_vflags; /* vserver specific flags */
9891 + __uint8_t di_pad[4]; /* unused, zeroed space */
9892 __uint16_t di_flushiter; /* incremented on flush */
9893 xfs_ictimestamp_t di_atime; /* time last accessed */
9894 xfs_ictimestamp_t di_mtime; /* time last modified */
9895 @@ -521,7 +523,7 @@ int xfs_itobp(struct xfs_mount *, struc
9896 int xfs_iread(struct xfs_mount *, struct xfs_trans *,
9897 struct xfs_inode *, xfs_daddr_t, uint);
9898 void xfs_dinode_to_disk(struct xfs_dinode *,
9899 - struct xfs_icdinode *);
9900 + struct xfs_icdinode *, int);
9901 void xfs_idestroy_fork(struct xfs_inode *, int);
9902 void xfs_idata_realloc(struct xfs_inode *, int, int);
9903 void xfs_iroot_realloc(struct xfs_inode *, int, int);
9904 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_itable.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_itable.c
9905 --- linux-2.6.33.2/fs/xfs/xfs_itable.c 2009-12-03 20:02:54.000000000 +0100
9906 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_itable.c 2010-02-25 12:02:16.000000000 +0100
9907 @@ -84,6 +84,7 @@ xfs_bulkstat_one_iget(
9908 buf->bs_mode = dic->di_mode;
9909 buf->bs_uid = dic->di_uid;
9910 buf->bs_gid = dic->di_gid;
9911 + buf->bs_tag = dic->di_tag;
9912 buf->bs_size = dic->di_size;
9915 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_log_recover.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_log_recover.c
9916 --- linux-2.6.33.2/fs/xfs/xfs_log_recover.c 2010-02-25 11:52:06.000000000 +0100
9917 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_log_recover.c 2010-02-25 12:02:16.000000000 +0100
9918 @@ -2462,7 +2462,8 @@ xlog_recover_do_inode_trans(
9921 /* The core is in in-core format */
9922 - xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr);
9923 + xfs_dinode_to_disk(dip, (xfs_icdinode_t *)item->ri_buf[1].i_addr,
9924 + mp->m_flags & XFS_MOUNT_TAGGED);
9926 /* the rest is in on-disk format */
9927 if (item->ri_buf[1].i_len > sizeof(struct xfs_icdinode)) {
9928 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_mount.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_mount.h
9929 --- linux-2.6.33.2/fs/xfs/xfs_mount.h 2010-02-25 11:52:06.000000000 +0100
9930 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_mount.h 2010-02-25 12:02:16.000000000 +0100
9931 @@ -298,6 +298,7 @@ typedef struct xfs_mount {
9933 #define XFS_MOUNT_NOATTR2 (1ULL << 25) /* disable use of attr2 format */
9935 +#define XFS_MOUNT_TAGGED (1ULL << 31) /* context tagging */
9938 * Default minimum read and write sizes.
9939 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_vnodeops.c linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_vnodeops.c
9940 --- linux-2.6.33.2/fs/xfs/xfs_vnodeops.c 2010-02-25 11:52:06.000000000 +0100
9941 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_vnodeops.c 2010-02-25 13:24:14.000000000 +0100
9943 #include "xfs_vnodeops.h"
9944 #include "xfs_trace.h"
9948 +xfs_get_inode_flags(
9951 + struct inode *inode = VFS_I(ip);
9952 + unsigned int flags = inode->i_flags;
9953 + unsigned int vflags = inode->i_vflags;
9955 + if (flags & S_IMMUTABLE)
9956 + ip->i_d.di_flags |= XFS_DIFLAG_IMMUTABLE;
9958 + ip->i_d.di_flags &= ~XFS_DIFLAG_IMMUTABLE;
9959 + if (flags & S_IXUNLINK)
9960 + ip->i_d.di_flags |= XFS_DIFLAG_IXUNLINK;
9962 + ip->i_d.di_flags &= ~XFS_DIFLAG_IXUNLINK;
9964 + if (vflags & V_BARRIER)
9965 + ip->i_d.di_vflags |= XFS_DIVFLAG_BARRIER;
9967 + ip->i_d.di_vflags &= ~XFS_DIVFLAG_BARRIER;
9968 + if (vflags & V_COW)
9969 + ip->i_d.di_vflags |= XFS_DIVFLAG_COW;
9971 + ip->i_d.di_vflags &= ~XFS_DIVFLAG_COW;
9976 + struct inode *inode,
9980 + struct xfs_inode *ip = XFS_I(inode);
9981 + struct xfs_mount *mp = ip->i_mount;
9982 + struct xfs_trans *tp;
9983 + unsigned int lock_flags = 0;
9986 + tp = xfs_trans_alloc(mp, XFS_TRANS_SETATTR_NOT_SIZE);
9987 + code = xfs_trans_reserve(tp, 0, XFS_ICHANGE_LOG_RES(mp), 0, 0, 0);
9991 + lock_flags = XFS_ILOCK_EXCL;
9992 + xfs_ilock(ip, lock_flags);
9994 + xfs_trans_ijoin(tp, ip, lock_flags);
9995 + xfs_trans_ihold(tp, ip);
9997 + inode->i_flags = flags;
9998 + inode->i_vflags = vflags;
9999 + xfs_get_inode_flags(ip);
10001 + xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
10002 + xfs_ichgtime(ip, XFS_ICHGTIME_CHG);
10004 + XFS_STATS_INC(xs_ig_attrchg);
10006 + if (mp->m_flags & XFS_MOUNT_WSYNC)
10007 + xfs_trans_set_sync(tp);
10008 + code = xfs_trans_commit(tp, 0);
10009 + xfs_iunlock(ip, lock_flags);
10013 + xfs_trans_cancel(tp, 0);
10015 + xfs_iunlock(ip, lock_flags);
10022 struct xfs_inode *ip,
10023 @@ -70,6 +144,7 @@ xfs_setattr(
10024 uint commit_flags=0;
10025 uid_t uid=0, iuid=0;
10026 gid_t gid=0, igid=0;
10027 + tag_t tag=0, itag=0;
10028 struct xfs_dquot *udqp, *gdqp, *olddquot1, *olddquot2;
10029 int need_iolock = 1;
10031 @@ -162,7 +237,7 @@ xfs_setattr(
10033 * Change file ownership. Must be the owner or privileged.
10035 - if (mask & (ATTR_UID|ATTR_GID)) {
10036 + if (mask & (ATTR_UID|ATTR_GID|ATTR_TAG)) {
10038 * These IDs could have changed since we last looked at them.
10039 * But, we're assured that if the ownership did change
10040 @@ -171,8 +246,10 @@ xfs_setattr(
10042 iuid = ip->i_d.di_uid;
10043 igid = ip->i_d.di_gid;
10044 + itag = ip->i_d.di_tag;
10045 gid = (mask & ATTR_GID) ? iattr->ia_gid : igid;
10046 uid = (mask & ATTR_UID) ? iattr->ia_uid : iuid;
10047 + tag = (mask & ATTR_TAG) ? iattr->ia_tag : itag;
10050 * Do a quota reservation only if uid/gid is actually
10051 @@ -180,7 +257,8 @@ xfs_setattr(
10053 if (XFS_IS_QUOTA_RUNNING(mp) &&
10054 ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) ||
10055 - (XFS_IS_GQUOTA_ON(mp) && igid != gid))) {
10056 + (XFS_IS_GQUOTA_ON(mp) && igid != gid) ||
10057 + (XFS_IS_GQUOTA_ON(mp) && itag != tag))) {
10059 code = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp,
10060 capable(CAP_FOWNER) ?
10061 @@ -341,7 +419,7 @@ xfs_setattr(
10063 * Change file ownership. Must be the owner or privileged.
10065 - if (mask & (ATTR_UID|ATTR_GID)) {
10066 + if (mask & (ATTR_UID|ATTR_GID|ATTR_TAG)) {
10068 * CAP_FSETID overrides the following restrictions:
10070 @@ -357,6 +435,10 @@ xfs_setattr(
10071 * Change the ownerships and register quota modifications
10072 * in the transaction.
10074 + if (itag != tag) {
10075 + ip->i_d.di_tag = tag;
10076 + inode->i_tag = tag;
10079 if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_UQUOTA_ON(mp)) {
10080 ASSERT(mask & ATTR_UID);
10081 diff -NurpP --minimal linux-2.6.33.2/fs/xfs/xfs_vnodeops.h linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_vnodeops.h
10082 --- linux-2.6.33.2/fs/xfs/xfs_vnodeops.h 2010-02-25 11:52:06.000000000 +0100
10083 +++ linux-2.6.33.2-vs2.3.0.36.30.4/fs/xfs/xfs_vnodeops.h 2010-02-25 12:02:16.000000000 +0100
10084 @@ -14,6 +14,7 @@ struct xfs_inode;
10088 +int xfs_sync_xflags(struct xfs_inode *ip);
10089 int xfs_setattr(struct xfs_inode *ip, struct iattr *vap, int flags);
10090 #define XFS_ATTR_DMI 0x01 /* invocation from a DMI function */
10091 #define XFS_ATTR_NONBLOCK 0x02 /* return EAGAIN if operation would block */
10092 diff -NurpP --minimal linux-2.6.33.2/include/asm-generic/tlb.h linux-2.6.33.2-vs2.3.0.36.30.4/include/asm-generic/tlb.h
10093 --- linux-2.6.33.2/include/asm-generic/tlb.h 2009-09-10 15:26:24.000000000 +0200
10094 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/asm-generic/tlb.h 2010-02-25 12:02:16.000000000 +0100
10096 #define _ASM_GENERIC__TLB_H
10098 #include <linux/swap.h>
10099 +#include <linux/vs_memory.h>
10100 #include <asm/pgalloc.h>
10101 #include <asm/tlbflush.h>
10103 diff -NurpP --minimal linux-2.6.33.2/include/linux/capability.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/capability.h
10104 --- linux-2.6.33.2/include/linux/capability.h 2010-02-25 11:52:07.000000000 +0100
10105 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/capability.h 2010-02-25 12:02:16.000000000 +0100
10106 @@ -283,6 +283,7 @@ struct cpu_vfs_cap_data {
10107 arbitrary SCSI commands */
10108 /* Allow setting encryption key on loopback filesystem */
10109 /* Allow setting zone reclaim policy */
10110 +/* Allow the selection of a security context */
10112 #define CAP_SYS_ADMIN 21
10114 @@ -355,7 +356,13 @@ struct cpu_vfs_cap_data {
10116 #define CAP_MAC_ADMIN 33
10118 -#define CAP_LAST_CAP CAP_MAC_ADMIN
10119 +/* Allow context manipulations */
10120 +/* Allow changing context info on files */
10122 +#define CAP_CONTEXT 34
10125 +#define CAP_LAST_CAP CAP_CONTEXT
10127 #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP)
10129 diff -NurpP --minimal linux-2.6.33.2/include/linux/devpts_fs.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/devpts_fs.h
10130 --- linux-2.6.33.2/include/linux/devpts_fs.h 2008-12-25 00:26:37.000000000 +0100
10131 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/devpts_fs.h 2010-02-25 12:02:16.000000000 +0100
10132 @@ -45,5 +45,4 @@ static inline void devpts_pty_kill(struc
10137 #endif /* _LINUX_DEVPTS_FS_H */
10138 diff -NurpP --minimal linux-2.6.33.2/include/linux/ext2_fs.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/ext2_fs.h
10139 --- linux-2.6.33.2/include/linux/ext2_fs.h 2010-02-25 11:52:07.000000000 +0100
10140 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/ext2_fs.h 2010-02-25 12:02:16.000000000 +0100
10141 @@ -189,8 +189,12 @@ struct ext2_group_desc
10142 #define EXT2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */
10143 #define EXT2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */
10144 #define EXT2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/
10145 +#define EXT2_IXUNLINK_FL FS_IXUNLINK_FL /* Immutable invert on unlink */
10146 #define EXT2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */
10148 +#define EXT2_BARRIER_FL FS_BARRIER_FL /* Barrier for chroot() */
10149 +#define EXT2_COW_FL FS_COW_FL /* Copy on Write marker */
10151 #define EXT2_FL_USER_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */
10152 #define EXT2_FL_USER_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */
10154 @@ -274,7 +278,8 @@ struct ext2_inode {
10156 __le16 l_i_uid_high; /* these 2 fields */
10157 __le16 l_i_gid_high; /* were reserved2[0] */
10158 - __u32 l_i_reserved2;
10159 + __le16 l_i_tag; /* Context Tag */
10160 + __u16 l_i_reserved2;
10163 __u8 h_i_frag; /* Fragment number */
10164 @@ -303,6 +308,7 @@ struct ext2_inode {
10165 #define i_gid_low i_gid
10166 #define i_uid_high osd2.linux2.l_i_uid_high
10167 #define i_gid_high osd2.linux2.l_i_gid_high
10168 +#define i_raw_tag osd2.linux2.l_i_tag
10169 #define i_reserved2 osd2.linux2.l_i_reserved2
10172 @@ -347,6 +353,7 @@ struct ext2_inode {
10173 #define EXT2_MOUNT_USRQUOTA 0x020000 /* user quota */
10174 #define EXT2_MOUNT_GRPQUOTA 0x040000 /* group quota */
10175 #define EXT2_MOUNT_RESERVATION 0x080000 /* Preallocation */
10176 +#define EXT2_MOUNT_TAGGED (1<<24) /* Enable Context Tags */
10179 #define clear_opt(o, opt) o &= ~EXT2_MOUNT_##opt
10180 diff -NurpP --minimal linux-2.6.33.2/include/linux/ext3_fs.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/ext3_fs.h
10181 --- linux-2.6.33.2/include/linux/ext3_fs.h 2010-02-25 11:52:07.000000000 +0100
10182 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/ext3_fs.h 2010-02-25 12:02:16.000000000 +0100
10183 @@ -173,10 +173,14 @@ struct ext3_group_desc
10184 #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
10185 #define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
10186 #define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
10187 +#define EXT3_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
10188 #define EXT3_RESERVED_FL 0x80000000 /* reserved for ext3 lib */
10190 -#define EXT3_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
10191 -#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
10192 +#define EXT3_BARRIER_FL 0x04000000 /* Barrier for chroot() */
10193 +#define EXT3_COW_FL 0x20000000 /* Copy on Write marker */
10195 +#define EXT3_FL_USER_VISIBLE 0x0103DFFF /* User visible flags */
10196 +#define EXT3_FL_USER_MODIFIABLE 0x010380FF /* User modifiable flags */
10198 /* Flags that should be inherited by new inodes from their parent. */
10199 #define EXT3_FL_INHERITED (EXT3_SECRM_FL | EXT3_UNRM_FL | EXT3_COMPR_FL |\
10200 @@ -320,7 +324,8 @@ struct ext3_inode {
10202 __le16 l_i_uid_high; /* these 2 fields */
10203 __le16 l_i_gid_high; /* were reserved2[0] */
10204 - __u32 l_i_reserved2;
10205 + __le16 l_i_tag; /* Context Tag */
10206 + __u16 l_i_reserved2;
10209 __u8 h_i_frag; /* Fragment number */
10210 @@ -351,6 +356,7 @@ struct ext3_inode {
10211 #define i_gid_low i_gid
10212 #define i_uid_high osd2.linux2.l_i_uid_high
10213 #define i_gid_high osd2.linux2.l_i_gid_high
10214 +#define i_raw_tag osd2.linux2.l_i_tag
10215 #define i_reserved2 osd2.linux2.l_i_reserved2
10217 #elif defined(__GNU__)
10218 @@ -414,6 +420,7 @@ struct ext3_inode {
10219 #define EXT3_MOUNT_GRPQUOTA 0x200000 /* "old" group quota */
10220 #define EXT3_MOUNT_DATA_ERR_ABORT 0x400000 /* Abort on file data write
10221 * error in ordered mode */
10222 +#define EXT3_MOUNT_TAGGED (1<<24) /* Enable Context Tags */
10224 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
10225 #ifndef _LINUX_EXT2_FS_H
10226 @@ -892,6 +899,7 @@ extern void ext3_get_inode_flags(struct
10227 extern void ext3_set_aops(struct inode *inode);
10228 extern int ext3_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
10229 u64 start, u64 len);
10230 +extern int ext3_sync_flags(struct inode *, int, int);
10233 extern long ext3_ioctl(struct file *, unsigned int, unsigned long);
10234 diff -NurpP --minimal linux-2.6.33.2/include/linux/fs.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/fs.h
10235 --- linux-2.6.33.2/include/linux/fs.h 2010-04-06 01:47:46.000000000 +0200
10236 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/fs.h 2010-04-06 01:59:25.000000000 +0200
10237 @@ -209,6 +209,9 @@ struct inodes_stat_t {
10238 #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
10239 #define MS_I_VERSION (1<<23) /* Update inode I_version field */
10240 #define MS_STRICTATIME (1<<24) /* Always perform atime updates */
10241 +#define MS_TAGGED (1<<25) /* use generic inode tagging */
10242 +#define MS_TAGID (1<<26) /* use specific tag for this mount */
10243 +#define MS_NOTAGCHECK (1<<27) /* don't check tags */
10244 #define MS_ACTIVE (1<<30)
10245 #define MS_NOUSER (1<<31)
10247 @@ -235,6 +238,14 @@ struct inodes_stat_t {
10248 #define S_NOCMTIME 128 /* Do not update file c/mtime */
10249 #define S_SWAPFILE 256 /* Do not truncate: swapon got its bmaps */
10250 #define S_PRIVATE 512 /* Inode is fs-internal */
10251 +#define S_IXUNLINK 1024 /* Immutable Invert on unlink */
10253 +/* Linux-VServer related Inode flags */
10257 +#define V_BARRIER 4 /* Barrier for chroot() */
10258 +#define V_COW 8 /* Copy on Write */
10261 * Note that nosuid etc flags are inode-specific: setting some file-system
10262 @@ -257,12 +268,15 @@ struct inodes_stat_t {
10263 #define IS_DIRSYNC(inode) (__IS_FLG(inode, MS_SYNCHRONOUS|MS_DIRSYNC) || \
10264 ((inode)->i_flags & (S_SYNC|S_DIRSYNC)))
10265 #define IS_MANDLOCK(inode) __IS_FLG(inode, MS_MANDLOCK)
10266 -#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
10267 -#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
10268 +#define IS_NOATIME(inode) __IS_FLG(inode, MS_RDONLY|MS_NOATIME)
10269 +#define IS_I_VERSION(inode) __IS_FLG(inode, MS_I_VERSION)
10270 +#define IS_TAGGED(inode) __IS_FLG(inode, MS_TAGGED)
10272 #define IS_NOQUOTA(inode) ((inode)->i_flags & S_NOQUOTA)
10273 #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND)
10274 #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE)
10275 +#define IS_IXUNLINK(inode) ((inode)->i_flags & S_IXUNLINK)
10276 +#define IS_IXORUNLINK(inode) ((IS_IXUNLINK(inode) ? S_IMMUTABLE : 0) ^ IS_IMMUTABLE(inode))
10277 #define IS_POSIXACL(inode) __IS_FLG(inode, MS_POSIXACL)
10279 #define IS_DEADDIR(inode) ((inode)->i_flags & S_DEAD)
10280 @@ -270,6 +284,16 @@ struct inodes_stat_t {
10281 #define IS_SWAPFILE(inode) ((inode)->i_flags & S_SWAPFILE)
10282 #define IS_PRIVATE(inode) ((inode)->i_flags & S_PRIVATE)
10284 +#define IS_BARRIER(inode) (S_ISDIR((inode)->i_mode) && ((inode)->i_vflags & V_BARRIER))
10286 +#ifdef CONFIG_VSERVER_COWBL
10287 +# define IS_COW(inode) (IS_IXUNLINK(inode) && IS_IMMUTABLE(inode))
10288 +# define IS_COW_LINK(inode) (S_ISREG((inode)->i_mode) && ((inode)->i_nlink > 1))
10290 +# define IS_COW(inode) (0)
10291 +# define IS_COW_LINK(inode) (0)
10294 /* the read-only stuff doesn't really belong here, but any other place is
10295 probably as bad and I don't want to create yet another include file. */
10297 @@ -352,11 +376,14 @@ struct inodes_stat_t {
10298 #define FS_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
10299 #define FS_EXTENT_FL 0x00080000 /* Extents */
10300 #define FS_DIRECTIO_FL 0x00100000 /* Use direct i/o */
10301 +#define FS_IXUNLINK_FL 0x08000000 /* Immutable invert on unlink */
10302 #define FS_RESERVED_FL 0x80000000 /* reserved for ext2 lib */
10304 -#define FS_FL_USER_VISIBLE 0x0003DFFF /* User visible flags */
10305 -#define FS_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
10306 +#define FS_BARRIER_FL 0x04000000 /* Barrier for chroot() */
10307 +#define FS_COW_FL 0x20000000 /* Copy on Write marker */
10309 +#define FS_FL_USER_VISIBLE 0x0103DFFF /* User visible flags */
10310 +#define FS_FL_USER_MODIFIABLE 0x010380FF /* User modifiable flags */
10312 #define SYNC_FILE_RANGE_WAIT_BEFORE 1
10313 #define SYNC_FILE_RANGE_WRITE 2
10314 @@ -438,6 +465,7 @@ typedef void (dio_iodone_t)(struct kiocb
10315 #define ATTR_KILL_PRIV (1 << 14)
10316 #define ATTR_OPEN (1 << 15) /* Truncating from open(O_TRUNC) */
10317 #define ATTR_TIMES_SET (1 << 16)
10318 +#define ATTR_TAG (1 << 17)
10321 * This is the Inode Attributes structure, used for notify_change(). It
10322 @@ -453,6 +481,7 @@ struct iattr {
10328 struct timespec ia_atime;
10329 struct timespec ia_mtime;
10330 @@ -466,6 +495,9 @@ struct iattr {
10331 struct file *ia_file;
10334 +#define ATTR_FLAG_BARRIER 512 /* Barrier for chroot() */
10335 +#define ATTR_FLAG_IXUNLINK 1024 /* Immutable invert on unlink */
10338 * Includes for diskquotas.
10340 @@ -731,7 +763,9 @@ struct inode {
10341 unsigned int i_nlink;
10347 unsigned int i_blkbits;
10350 @@ -778,7 +812,8 @@ struct inode {
10351 unsigned long i_state;
10352 unsigned long dirtied_when; /* jiffies of first dirtying */
10354 - unsigned int i_flags;
10355 + unsigned short i_flags;
10356 + unsigned short i_vflags;
10358 atomic_t i_writecount;
10359 #ifdef CONFIG_SECURITY
10360 @@ -866,12 +901,12 @@ static inline void i_size_write(struct i
10362 static inline unsigned iminor(const struct inode *inode)
10364 - return MINOR(inode->i_rdev);
10365 + return MINOR(inode->i_mdev);
10368 static inline unsigned imajor(const struct inode *inode)
10370 - return MAJOR(inode->i_rdev);
10371 + return MAJOR(inode->i_mdev);
10374 extern struct block_device *I_BDEV(struct inode *inode);
10375 @@ -930,6 +965,7 @@ struct file {
10377 struct fown_struct f_owner;
10378 const struct cred *f_cred;
10380 struct file_ra_state f_ra;
10383 @@ -1071,6 +1107,7 @@ struct file_lock {
10384 struct file *fl_file;
10389 struct fasync_struct * fl_fasync; /* for lease break notifications */
10390 unsigned long fl_break_time; /* for nonblocking lease breaks */
10391 @@ -1532,6 +1569,7 @@ struct inode_operations {
10392 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
10393 ssize_t (*listxattr) (struct dentry *, char *, size_t);
10394 int (*removexattr) (struct dentry *, const char *);
10395 + int (*sync_flags) (struct inode *, int, int);
10396 void (*truncate_range)(struct inode *, loff_t, loff_t);
10397 long (*fallocate)(struct inode *inode, int mode, loff_t offset,
10399 @@ -1552,6 +1590,7 @@ extern ssize_t vfs_readv(struct file *,
10400 unsigned long, loff_t *);
10401 extern ssize_t vfs_writev(struct file *, const struct iovec __user *,
10402 unsigned long, loff_t *);
10403 +ssize_t vfs_sendfile(struct file *, struct file *, loff_t *, size_t, loff_t);
10405 struct super_operations {
10406 struct inode *(*alloc_inode)(struct super_block *sb);
10407 @@ -2334,6 +2373,7 @@ extern int dcache_dir_open(struct inode
10408 extern int dcache_dir_close(struct inode *, struct file *);
10409 extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
10410 extern int dcache_readdir(struct file *, void *, filldir_t);
10411 +extern int dcache_readdir_filter(struct file *, void *, filldir_t, int (*)(struct dentry *));
10412 extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
10413 extern int simple_statfs(struct dentry *, struct kstatfs *);
10414 extern int simple_link(struct dentry *, struct inode *, struct dentry *);
10415 diff -NurpP --minimal linux-2.6.33.2/include/linux/gfs2_ondisk.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/gfs2_ondisk.h
10416 --- linux-2.6.33.2/include/linux/gfs2_ondisk.h 2010-02-25 11:52:07.000000000 +0100
10417 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/gfs2_ondisk.h 2010-02-25 12:02:16.000000000 +0100
10418 @@ -239,6 +239,9 @@ enum {
10419 gfs2fl_NoAtime = 7,
10422 + gfs2fl_IXUnlink = 16,
10423 + gfs2fl_Barrier = 17,
10425 gfs2fl_TruncInProg = 29,
10426 gfs2fl_InheritDirectio = 30,
10427 gfs2fl_InheritJdata = 31,
10428 @@ -255,6 +258,9 @@ enum {
10429 #define GFS2_DIF_NOATIME 0x00000080
10430 #define GFS2_DIF_SYNC 0x00000100
10431 #define GFS2_DIF_SYSTEM 0x00000200 /* New in gfs2 */
10432 +#define GFS2_DIF_IXUNLINK 0x00010000
10433 +#define GFS2_DIF_BARRIER 0x00020000
10434 +#define GFS2_DIF_COW 0x00040000
10435 #define GFS2_DIF_TRUNC_IN_PROG 0x20000000 /* New in gfs2 */
10436 #define GFS2_DIF_INHERIT_DIRECTIO 0x40000000
10437 #define GFS2_DIF_INHERIT_JDATA 0x80000000
10438 diff -NurpP --minimal linux-2.6.33.2/include/linux/if_tun.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/if_tun.h
10439 --- linux-2.6.33.2/include/linux/if_tun.h 2009-12-03 20:02:55.000000000 +0100
10440 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/if_tun.h 2010-02-25 12:02:16.000000000 +0100
10442 #define TUNGETIFF _IOR('T', 210, unsigned int)
10443 #define TUNGETSNDBUF _IOR('T', 211, int)
10444 #define TUNSETSNDBUF _IOW('T', 212, int)
10445 +#define TUNSETNID _IOW('T', 215, int)
10447 /* TUNSETIFF ifr flags */
10448 #define IFF_TUN 0x0001
10449 diff -NurpP --minimal linux-2.6.33.2/include/linux/init_task.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/init_task.h
10450 --- linux-2.6.33.2/include/linux/init_task.h 2010-02-25 11:52:07.000000000 +0100
10451 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/init_task.h 2010-02-25 12:02:16.000000000 +0100
10452 @@ -180,6 +180,10 @@ extern struct cred init_cred;
10453 INIT_FTRACE_GRAPH \
10454 INIT_TRACE_RECURSION \
10455 INIT_TASK_RCU_PREEMPT(tsk) \
10457 + .vx_info = NULL, \
10459 + .nx_info = NULL, \
10463 diff -NurpP --minimal linux-2.6.33.2/include/linux/ipc.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/ipc.h
10464 --- linux-2.6.33.2/include/linux/ipc.h 2009-12-03 20:02:55.000000000 +0100
10465 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/ipc.h 2010-02-25 12:02:16.000000000 +0100
10466 @@ -91,6 +91,7 @@ struct kern_ipc_perm
10474 diff -NurpP --minimal linux-2.6.33.2/include/linux/Kbuild linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/Kbuild
10475 --- linux-2.6.33.2/include/linux/Kbuild 2010-02-25 11:52:07.000000000 +0100
10476 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/Kbuild 2010-02-25 12:02:16.000000000 +0100
10477 @@ -383,5 +383,8 @@ unifdef-y += xattr.h
10478 unifdef-y += xfrm.h
10480 objhdr-y += version.h
10482 +header-y += vserver/
10483 header-y += wimax.h
10486 diff -NurpP --minimal linux-2.6.33.2/include/linux/loop.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/loop.h
10487 --- linux-2.6.33.2/include/linux/loop.h 2009-09-10 15:26:25.000000000 +0200
10488 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/loop.h 2010-02-25 12:02:16.000000000 +0100
10489 @@ -45,6 +45,7 @@ struct loop_device {
10490 struct loop_func_table *lo_encryption;
10492 uid_t lo_key_owner; /* Who set the key */
10494 int (*ioctl)(struct loop_device *, int cmd,
10495 unsigned long arg);
10497 diff -NurpP --minimal linux-2.6.33.2/include/linux/magic.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/magic.h
10498 --- linux-2.6.33.2/include/linux/magic.h 2009-12-03 20:02:55.000000000 +0100
10499 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/magic.h 2010-02-25 12:02:16.000000000 +0100
10502 #define ADFS_SUPER_MAGIC 0xadf5
10503 #define AFFS_SUPER_MAGIC 0xadff
10504 -#define AFS_SUPER_MAGIC 0x5346414F
10505 +#define AFS_SUPER_MAGIC 0x5346414F
10506 #define AUTOFS_SUPER_MAGIC 0x0187
10507 #define CODA_SUPER_MAGIC 0x73757245
10508 #define CRAMFS_MAGIC 0x28cd3d45 /* some random number */
10510 #define NFS_SUPER_MAGIC 0x6969
10511 #define OPENPROM_SUPER_MAGIC 0x9fa1
10512 #define PROC_SUPER_MAGIC 0x9fa0
10513 +#define DEVPTS_SUPER_MAGIC 0x1cd1
10514 #define QNX4_SUPER_MAGIC 0x002f /* qnx4 fs detection */
10516 #define REISERFS_SUPER_MAGIC 0x52654973 /* used by gcc */
10517 diff -NurpP --minimal linux-2.6.33.2/include/linux/major.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/major.h
10518 --- linux-2.6.33.2/include/linux/major.h 2009-09-10 15:26:25.000000000 +0200
10519 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/major.h 2010-02-25 12:02:16.000000000 +0100
10521 #define HD_MAJOR IDE0_MAJOR
10522 #define PTY_SLAVE_MAJOR 3
10523 #define TTY_MAJOR 4
10524 +#define VROOT_MAJOR 4
10525 #define TTYAUX_MAJOR 5
10527 #define VCS_MAJOR 7
10528 diff -NurpP --minimal linux-2.6.33.2/include/linux/memcontrol.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/memcontrol.h
10529 --- linux-2.6.33.2/include/linux/memcontrol.h 2010-02-25 11:52:07.000000000 +0100
10530 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/memcontrol.h 2010-02-25 12:02:16.000000000 +0100
10531 @@ -76,6 +76,13 @@ int task_in_mem_cgroup(struct task_struc
10532 extern struct mem_cgroup *try_get_mem_cgroup_from_page(struct page *page);
10533 extern struct mem_cgroup *mem_cgroup_from_task(struct task_struct *p);
10535 +extern u64 mem_cgroup_res_read_u64(struct mem_cgroup *mem, int member);
10536 +extern u64 mem_cgroup_memsw_read_u64(struct mem_cgroup *mem, int member);
10538 +extern s64 mem_cgroup_stat_read_cache(struct mem_cgroup *mem);
10539 +extern s64 mem_cgroup_stat_read_anon(struct mem_cgroup *mem);
10540 +extern s64 mem_cgroup_stat_read_mapped(struct mem_cgroup *mem);
10543 int mm_match_cgroup(const struct mm_struct *mm, const struct mem_cgroup *cgroup)
10545 diff -NurpP --minimal linux-2.6.33.2/include/linux/mm_types.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/mm_types.h
10546 --- linux-2.6.33.2/include/linux/mm_types.h 2010-02-25 11:52:07.000000000 +0100
10547 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/mm_types.h 2010-02-25 12:02:16.000000000 +0100
10548 @@ -250,6 +250,7 @@ struct mm_struct {
10550 /* Architecture-specific MM context */
10551 mm_context_t context;
10552 + struct vx_info *mm_vx_info;
10554 /* Swap token stuff */
10556 diff -NurpP --minimal linux-2.6.33.2/include/linux/mount.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/mount.h
10557 --- linux-2.6.33.2/include/linux/mount.h 2009-09-10 15:26:25.000000000 +0200
10558 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/mount.h 2010-02-25 12:02:16.000000000 +0100
10559 @@ -36,6 +36,9 @@ struct mnt_namespace;
10560 #define MNT_UNBINDABLE 0x2000 /* if the vfsmount is a unbindable mount */
10561 #define MNT_PNODE_MASK 0x3000 /* propagation flag mask */
10563 +#define MNT_TAGID 0x10000
10564 +#define MNT_NOTAG 0x20000
10567 struct list_head mnt_hash;
10568 struct vfsmount *mnt_parent; /* fs we are mounted on */
10569 @@ -70,6 +73,7 @@ struct vfsmount {
10573 + tag_t mnt_tag; /* tagging used for vfsmount */
10576 static inline int *get_mnt_writers_ptr(struct vfsmount *mnt)
10577 diff -NurpP --minimal linux-2.6.33.2/include/linux/net.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/net.h
10578 --- linux-2.6.33.2/include/linux/net.h 2010-02-25 11:52:07.000000000 +0100
10579 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/net.h 2010-02-25 12:02:16.000000000 +0100
10580 @@ -70,6 +70,7 @@ struct net;
10581 #define SOCK_NOSPACE 2
10582 #define SOCK_PASSCRED 3
10583 #define SOCK_PASSSEC 4
10584 +#define SOCK_USER_SOCKET 5
10586 #ifndef ARCH_HAS_SOCKET_TYPES
10588 diff -NurpP --minimal linux-2.6.33.2/include/linux/nfs_mount.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/nfs_mount.h
10589 --- linux-2.6.33.2/include/linux/nfs_mount.h 2009-03-24 14:22:43.000000000 +0100
10590 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/nfs_mount.h 2010-02-25 12:02:16.000000000 +0100
10591 @@ -63,7 +63,8 @@ struct nfs_mount_data {
10592 #define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */
10593 #define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */
10594 #define NFS_MOUNT_UNSHARED 0x8000 /* 5 */
10595 -#define NFS_MOUNT_FLAGMASK 0xFFFF
10596 +#define NFS_MOUNT_TAGGED 0x10000 /* context tagging */
10597 +#define NFS_MOUNT_FLAGMASK 0x1FFFF
10599 /* The following are for internal use only */
10600 #define NFS_MOUNT_LOOKUP_CACHE_NONEG 0x10000
10601 diff -NurpP --minimal linux-2.6.33.2/include/linux/nsproxy.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/nsproxy.h
10602 --- linux-2.6.33.2/include/linux/nsproxy.h 2009-06-11 17:13:17.000000000 +0200
10603 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/nsproxy.h 2010-02-25 12:02:16.000000000 +0100
10606 #include <linux/spinlock.h>
10607 #include <linux/sched.h>
10608 +#include <linux/vserver/debug.h>
10610 struct mnt_namespace;
10611 struct uts_namespace;
10612 @@ -63,22 +64,33 @@ static inline struct nsproxy *task_nspro
10615 int copy_namespaces(unsigned long flags, struct task_struct *tsk);
10616 +struct nsproxy *copy_nsproxy(struct nsproxy *orig);
10617 void exit_task_namespaces(struct task_struct *tsk);
10618 void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new);
10619 void free_nsproxy(struct nsproxy *ns);
10620 int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **,
10621 struct fs_struct *);
10623 -static inline void put_nsproxy(struct nsproxy *ns)
10624 +#define get_nsproxy(n) __get_nsproxy(n, __FILE__, __LINE__)
10626 +static inline void __get_nsproxy(struct nsproxy *ns,
10627 + const char *_file, int _line)
10629 - if (atomic_dec_and_test(&ns->count)) {
10630 - free_nsproxy(ns);
10632 + vxlprintk(VXD_CBIT(space, 0), "get_nsproxy(%p[%u])",
10633 + ns, atomic_read(&ns->count), _file, _line);
10634 + atomic_inc(&ns->count);
10637 -static inline void get_nsproxy(struct nsproxy *ns)
10638 +#define put_nsproxy(n) __put_nsproxy(n, __FILE__, __LINE__)
10640 +static inline void __put_nsproxy(struct nsproxy *ns,
10641 + const char *_file, int _line)
10643 - atomic_inc(&ns->count);
10644 + vxlprintk(VXD_CBIT(space, 0), "put_nsproxy(%p[%u])",
10645 + ns, atomic_read(&ns->count), _file, _line);
10646 + if (atomic_dec_and_test(&ns->count)) {
10647 + free_nsproxy(ns);
10651 #ifdef CONFIG_CGROUP_NS
10652 diff -NurpP --minimal linux-2.6.33.2/include/linux/pid.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/pid.h
10653 --- linux-2.6.33.2/include/linux/pid.h 2009-03-24 14:22:43.000000000 +0100
10654 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/pid.h 2010-02-25 12:02:16.000000000 +0100
10655 @@ -8,7 +8,8 @@ enum pid_type
10665 @@ -160,6 +161,7 @@ static inline pid_t pid_nr(struct pid *p
10668 pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
10669 +pid_t pid_unmapped_nr_ns(struct pid *pid, struct pid_namespace *ns);
10670 pid_t pid_vnr(struct pid *pid);
10672 #define do_each_pid_task(pid, type, task) \
10673 diff -NurpP --minimal linux-2.6.33.2/include/linux/proc_fs.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/proc_fs.h
10674 --- linux-2.6.33.2/include/linux/proc_fs.h 2009-12-03 20:02:56.000000000 +0100
10675 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/proc_fs.h 2010-02-25 12:02:16.000000000 +0100
10676 @@ -56,6 +56,7 @@ struct proc_dir_entry {
10682 const struct inode_operations *proc_iops;
10684 @@ -250,12 +251,18 @@ kclist_add(struct kcore_list *new, void
10685 extern void kclist_add(struct kcore_list *, void *, size_t, int type);
10692 int (*proc_get_link)(struct inode *, struct path *);
10693 int (*proc_read)(struct task_struct *task, char *page);
10694 int (*proc_show)(struct seq_file *m,
10695 struct pid_namespace *ns, struct pid *pid,
10696 struct task_struct *task);
10697 + int (*proc_vs_read)(char *page);
10698 + int (*proc_vxi_read)(struct vx_info *vxi, char *page);
10699 + int (*proc_nxi_read)(struct nx_info *nxi, char *page);
10702 struct ctl_table_header;
10703 @@ -263,6 +270,7 @@ struct ctl_table;
10705 struct proc_inode {
10710 struct proc_dir_entry *pde;
10711 diff -NurpP --minimal linux-2.6.33.2/include/linux/quotaops.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/quotaops.h
10712 --- linux-2.6.33.2/include/linux/quotaops.h 2010-04-06 01:47:46.000000000 +0200
10713 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/quotaops.h 2010-04-06 02:00:16.000000000 +0200
10715 #define _LINUX_QUOTAOPS_
10717 #include <linux/fs.h>
10718 +#include <linux/vs_dlimit.h>
10720 static inline struct quota_info *sb_dqopt(struct super_block *sb)
10722 @@ -157,10 +158,14 @@ static inline void vfs_dq_init(struct in
10723 * a transaction (deadlocks possible otherwise) */
10724 static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
10726 + if (dl_alloc_space(inode, nr))
10728 if (sb_any_quota_active(inode->i_sb)) {
10729 /* Used space is updated in alloc_space() */
10730 - if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
10731 + if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) {
10732 + dl_free_space(inode, nr);
10737 inode_add_bytes(inode, nr);
10738 @@ -177,10 +182,14 @@ static inline int vfs_dq_prealloc_space(
10740 static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
10742 + if (dl_alloc_space(inode, nr))
10744 if (sb_any_quota_active(inode->i_sb)) {
10745 /* Used space is updated in alloc_space() */
10746 - if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
10747 + if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) {
10748 + dl_free_space(inode, nr);
10753 inode_add_bytes(inode, nr);
10754 @@ -197,10 +206,14 @@ static inline int vfs_dq_alloc_space(str
10756 static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
10758 + if (dl_reserve_space(inode, nr))
10760 if (sb_any_quota_active(inode->i_sb)) {
10761 /* Used space is updated in alloc_space() */
10762 - if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA)
10763 + if (inode->i_sb->dq_op->reserve_space(inode, nr, 0) == NO_QUOTA) {
10764 + dl_release_space(inode, nr);
10769 inode_add_rsv_space(inode, nr);
10770 @@ -209,10 +222,14 @@ static inline int vfs_dq_reserve_space(s
10772 static inline int vfs_dq_alloc_inode(struct inode *inode)
10774 + if (dl_alloc_inode(inode))
10776 if (sb_any_quota_active(inode->i_sb)) {
10777 vfs_dq_init(inode);
10778 - if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
10779 + if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) {
10780 + dl_free_inode(inode);
10786 @@ -222,9 +239,13 @@ static inline int vfs_dq_alloc_inode(str
10788 static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
10790 + if (dl_claim_space(inode, nr))
10792 if (sb_any_quota_active(inode->i_sb)) {
10793 - if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
10794 + if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA) {
10795 + dl_release_space(inode, nr);
10799 inode_claim_rsv_space(inode, nr);
10801 @@ -242,6 +263,7 @@ void vfs_dq_release_reservation_space(st
10802 inode->i_sb->dq_op->release_rsv(inode, nr);
10804 inode_sub_rsv_space(inode, nr);
10805 + dl_release_space(inode, nr);
10808 static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
10809 @@ -250,6 +272,7 @@ static inline void vfs_dq_free_space_nod
10810 inode->i_sb->dq_op->free_space(inode, nr);
10812 inode_sub_bytes(inode, nr);
10813 + dl_free_space(inode, nr);
10816 static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
10817 @@ -262,6 +285,7 @@ static inline void vfs_dq_free_inode(str
10819 if (sb_any_quota_active(inode->i_sb))
10820 inode->i_sb->dq_op->free_inode(inode, 1);
10821 + dl_free_inode(inode);
10824 /* Cannot be called inside a transaction */
10825 @@ -365,6 +389,8 @@ static inline int vfs_dq_transfer(struct
10827 static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
10829 + if (dl_alloc_space(inode, nr))
10831 inode_add_bytes(inode, nr);
10834 @@ -378,6 +404,8 @@ static inline int vfs_dq_prealloc_space(
10836 static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
10838 + if (dl_alloc_space(inode, nr))
10840 inode_add_bytes(inode, nr);
10843 @@ -391,22 +419,28 @@ static inline int vfs_dq_alloc_space(str
10845 static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
10847 + if (dl_reserve_space(inode, nr))
10852 static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
10854 + if (dl_claim_space(inode, nr))
10856 return vfs_dq_alloc_space(inode, nr);
10860 int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
10862 + dl_release_space(inode, nr);
10866 static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
10868 + dl_free_space(inode, nr);
10869 inode_sub_bytes(inode, nr);
10872 diff -NurpP --minimal linux-2.6.33.2/include/linux/reboot.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/reboot.h
10873 --- linux-2.6.33.2/include/linux/reboot.h 2008-12-25 00:26:37.000000000 +0100
10874 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/reboot.h 2010-02-25 12:02:16.000000000 +0100
10876 #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
10877 #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
10878 #define LINUX_REBOOT_CMD_KEXEC 0x45584543
10879 +#define LINUX_REBOOT_CMD_OOM 0xDEADBEEF
10883 diff -NurpP --minimal linux-2.6.33.2/include/linux/reiserfs_fs.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/reiserfs_fs.h
10884 --- linux-2.6.33.2/include/linux/reiserfs_fs.h 2010-02-25 11:52:07.000000000 +0100
10885 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/reiserfs_fs.h 2010-02-25 12:02:16.000000000 +0100
10886 @@ -977,6 +977,11 @@ struct stat_data_v1 {
10887 #define REISERFS_COMPR_FL FS_COMPR_FL
10888 #define REISERFS_NOTAIL_FL FS_NOTAIL_FL
10890 +/* unfortunately reiserfs sdattr is only 16 bit */
10891 +#define REISERFS_IXUNLINK_FL (FS_IXUNLINK_FL >> 16)
10892 +#define REISERFS_BARRIER_FL (FS_BARRIER_FL >> 16)
10893 +#define REISERFS_COW_FL (FS_COW_FL >> 16)
10895 /* persistent flags that file inherits from the parent directory */
10896 #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \
10897 REISERFS_SYNC_FL | \
10898 @@ -986,6 +991,9 @@ struct stat_data_v1 {
10899 REISERFS_COMPR_FL | \
10900 REISERFS_NOTAIL_FL )
10902 +#define REISERFS_FL_USER_VISIBLE 0x80FF
10903 +#define REISERFS_FL_USER_MODIFIABLE 0x80FF
10905 /* Stat Data on disk (reiserfs version of UFS disk inode minus the
10908 @@ -2071,6 +2079,7 @@ static inline void reiserfs_update_sd(st
10909 void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
10910 void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
10911 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
10912 +int reiserfs_sync_flags(struct inode *inode, int, int);
10915 void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
10916 diff -NurpP --minimal linux-2.6.33.2/include/linux/reiserfs_fs_sb.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/reiserfs_fs_sb.h
10917 --- linux-2.6.33.2/include/linux/reiserfs_fs_sb.h 2010-02-25 11:52:07.000000000 +0100
10918 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/reiserfs_fs_sb.h 2010-02-25 12:02:16.000000000 +0100
10919 @@ -476,6 +476,7 @@ enum reiserfs_mount_options {
10920 REISERFS_EXPOSE_PRIVROOT,
10921 REISERFS_BARRIER_NONE,
10922 REISERFS_BARRIER_FLUSH,
10925 /* Actions on error */
10926 REISERFS_ERROR_PANIC,
10927 diff -NurpP --minimal linux-2.6.33.2/include/linux/sched.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sched.h
10928 --- linux-2.6.33.2/include/linux/sched.h 2010-04-06 01:47:46.000000000 +0200
10929 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sched.h 2010-04-06 01:59:25.000000000 +0200
10930 @@ -401,25 +401,28 @@ static inline void arch_pick_mmap_layout
10931 * The mm counters are not protected by its page_table_lock,
10932 * so must be incremented atomically.
10934 -#define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value)
10935 -#define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member))
10936 -#define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member)
10937 -#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
10938 -#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
10939 +#define __set_mm_counter(mm, member, value) \
10940 + atomic_long_set(&(mm)->_##member, value)
10941 +#define get_mm_counter(mm, member) \
10942 + ((unsigned long)atomic_long_read(&(mm)->_##member))
10944 #else /* !USE_SPLIT_PTLOCKS */
10946 * The mm counters are protected by its page_table_lock,
10947 * so can be incremented directly.
10949 -#define set_mm_counter(mm, member, value) (mm)->_##member = (value)
10950 +#define __set_mm_counter(mm, member, value) (mm)->_##member = (value)
10951 #define get_mm_counter(mm, member) ((mm)->_##member)
10952 -#define add_mm_counter(mm, member, value) (mm)->_##member += (value)
10953 -#define inc_mm_counter(mm, member) (mm)->_##member++
10954 -#define dec_mm_counter(mm, member) (mm)->_##member--
10956 #endif /* !USE_SPLIT_PTLOCKS */
10958 +#define set_mm_counter(mm, member, value) \
10959 + vx_ ## member ## pages_sub((mm), (get_mm_counter(mm, member) - value))
10960 +#define add_mm_counter(mm, member, value) \
10961 + vx_ ## member ## pages_add((mm), (value))
10962 +#define inc_mm_counter(mm, member) vx_ ## member ## pages_inc((mm))
10963 +#define dec_mm_counter(mm, member) vx_ ## member ## pages_dec((mm))
10965 #define get_mm_rss(mm) \
10966 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
10967 #define update_hiwater_rss(mm) do { \
10968 @@ -1415,6 +1418,14 @@ struct task_struct {
10972 +/* vserver context data */
10973 + struct vx_info *vx_info;
10974 + struct nx_info *nx_info;
10980 /* Thread group tracking */
10981 u32 parent_exec_id;
10983 @@ -1648,6 +1659,11 @@ struct pid_namespace;
10984 pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
10985 struct pid_namespace *ns);
10987 +#include <linux/vserver/base.h>
10988 +#include <linux/vserver/context.h>
10989 +#include <linux/vserver/debug.h>
10990 +#include <linux/vserver/pid.h>
10992 static inline pid_t task_pid_nr(struct task_struct *tsk)
10995 @@ -1661,7 +1677,8 @@ static inline pid_t task_pid_nr_ns(struc
10997 static inline pid_t task_pid_vnr(struct task_struct *tsk)
10999 - return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
11000 + // return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
11001 + return vx_map_pid(__task_pid_nr_ns(tsk, PIDTYPE_PID, NULL));
11005 @@ -1674,7 +1691,7 @@ pid_t task_tgid_nr_ns(struct task_struct
11007 static inline pid_t task_tgid_vnr(struct task_struct *tsk)
11009 - return pid_vnr(task_tgid(tsk));
11010 + return vx_map_tgid(pid_vnr(task_tgid(tsk)));
11014 diff -NurpP --minimal linux-2.6.33.2/include/linux/shmem_fs.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/shmem_fs.h
11015 --- linux-2.6.33.2/include/linux/shmem_fs.h 2010-02-25 11:52:08.000000000 +0100
11016 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/shmem_fs.h 2010-02-25 12:02:16.000000000 +0100
11019 #define SHMEM_NR_DIRECT 16
11021 +#define TMPFS_SUPER_MAGIC 0x01021994
11024 struct shmem_inode_info {
11026 unsigned long flags;
11027 diff -NurpP --minimal linux-2.6.33.2/include/linux/stat.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/stat.h
11028 --- linux-2.6.33.2/include/linux/stat.h 2008-12-25 00:26:37.000000000 +0100
11029 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/stat.h 2010-02-25 12:02:16.000000000 +0100
11030 @@ -66,6 +66,7 @@ struct kstat {
11031 unsigned int nlink;
11037 struct timespec atime;
11038 diff -NurpP --minimal linux-2.6.33.2/include/linux/sunrpc/auth.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sunrpc/auth.h
11039 --- linux-2.6.33.2/include/linux/sunrpc/auth.h 2009-12-03 20:02:56.000000000 +0100
11040 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sunrpc/auth.h 2010-02-25 12:02:16.000000000 +0100
11046 struct group_info *group_info;
11047 unsigned char machine_cred : 1;
11049 diff -NurpP --minimal linux-2.6.33.2/include/linux/sunrpc/clnt.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sunrpc/clnt.h
11050 --- linux-2.6.33.2/include/linux/sunrpc/clnt.h 2009-12-03 20:02:56.000000000 +0100
11051 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sunrpc/clnt.h 2010-02-25 12:02:16.000000000 +0100
11052 @@ -49,7 +49,8 @@ struct rpc_clnt {
11053 unsigned int cl_softrtry : 1,/* soft timeouts */
11054 cl_discrtry : 1,/* disconnect before retry */
11055 cl_autobind : 1,/* use getport() */
11056 - cl_chatty : 1;/* be verbose */
11057 + cl_chatty : 1,/* be verbose */
11058 + cl_tag : 1;/* context tagging */
11060 struct rpc_rtt * cl_rtt; /* RTO estimator data */
11061 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
11062 diff -NurpP --minimal linux-2.6.33.2/include/linux/syscalls.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/syscalls.h
11063 --- linux-2.6.33.2/include/linux/syscalls.h 2010-04-06 01:47:46.000000000 +0200
11064 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/syscalls.h 2010-04-06 01:59:25.000000000 +0200
11065 @@ -498,6 +498,8 @@ asmlinkage long sys_symlink(const char _
11066 asmlinkage long sys_unlink(const char __user *pathname);
11067 asmlinkage long sys_rename(const char __user *oldname,
11068 const char __user *newname);
11069 +asmlinkage long sys_copyfile(const char __user *from, const char __user *to,
11071 asmlinkage long sys_chmod(const char __user *filename, mode_t mode);
11072 asmlinkage long sys_fchmod(unsigned int fd, mode_t mode);
11074 diff -NurpP --minimal linux-2.6.33.2/include/linux/sysctl.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sysctl.h
11075 --- linux-2.6.33.2/include/linux/sysctl.h 2010-02-25 11:52:08.000000000 +0100
11076 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sysctl.h 2010-02-25 12:02:16.000000000 +0100
11077 @@ -60,6 +60,7 @@ enum
11078 CTL_ABI=9, /* Binary emulation */
11079 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
11080 CTL_ARLAN=254, /* arlan wireless driver */
11081 + CTL_VSERVER=4242, /* Linux-VServer debug */
11082 CTL_S390DBF=5677, /* s390 debug */
11083 CTL_SUNRPC=7249, /* sunrpc debug */
11084 CTL_PM=9899, /* frv power management */
11085 @@ -94,6 +95,7 @@ enum
11087 KERN_PANIC=15, /* int: panic timeout */
11088 KERN_REALROOTDEV=16, /* real root device to mount after initrd */
11089 + KERN_VSHELPER=17, /* string: path to vshelper policy agent */
11091 KERN_SPARC_REBOOT=21, /* reboot command on Sparc */
11092 KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
11093 diff -NurpP --minimal linux-2.6.33.2/include/linux/sysfs.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sysfs.h
11094 --- linux-2.6.33.2/include/linux/sysfs.h 2010-02-25 11:52:08.000000000 +0100
11095 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/sysfs.h 2010-02-25 12:02:16.000000000 +0100
11097 #include <linux/list.h>
11098 #include <asm/atomic.h>
11100 +#define SYSFS_SUPER_MAGIC 0x62656572
11105 diff -NurpP --minimal linux-2.6.33.2/include/linux/time.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/time.h
11106 --- linux-2.6.33.2/include/linux/time.h 2010-02-25 11:52:08.000000000 +0100
11107 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/time.h 2010-02-25 12:02:16.000000000 +0100
11108 @@ -238,6 +238,9 @@ static __always_inline void timespec_add
11109 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
11113 +#include <linux/vs_time.h>
11115 #endif /* __KERNEL__ */
11117 #define NFDBITS __NFDBITS
11118 diff -NurpP --minimal linux-2.6.33.2/include/linux/types.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/types.h
11119 --- linux-2.6.33.2/include/linux/types.h 2009-09-10 15:26:26.000000000 +0200
11120 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/types.h 2010-02-25 12:02:16.000000000 +0100
11121 @@ -37,6 +37,9 @@ typedef __kernel_uid32_t uid_t;
11122 typedef __kernel_gid32_t gid_t;
11123 typedef __kernel_uid16_t uid16_t;
11124 typedef __kernel_gid16_t gid16_t;
11125 +typedef unsigned int xid_t;
11126 +typedef unsigned int nid_t;
11127 +typedef unsigned int tag_t;
11129 typedef unsigned long uintptr_t;
11131 diff -NurpP --minimal linux-2.6.33.2/include/linux/vroot.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vroot.h
11132 --- linux-2.6.33.2/include/linux/vroot.h 1970-01-01 01:00:00.000000000 +0100
11133 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vroot.h 2010-02-25 12:02:16.000000000 +0100
11137 + * include/linux/vroot.h
11139 + * written by Herbert Pötzl, 9/11/2002
11140 + * ported to 2.6 by Herbert Pötzl, 30/12/2004
11142 + * Copyright (C) 2002-2007 by Herbert Pötzl.
11143 + * Redistribution of this file is permitted under the
11144 + * GNU General Public License.
11147 +#ifndef _LINUX_VROOT_H
11148 +#define _LINUX_VROOT_H
11153 +/* Possible states of device */
11159 +struct vroot_device {
11163 + struct semaphore vr_ctl_mutex;
11164 + struct block_device *vr_device;
11169 +typedef struct block_device *(vroot_grb_func)(struct block_device *);
11171 +extern int register_vroot_grb(vroot_grb_func *);
11172 +extern int unregister_vroot_grb(vroot_grb_func *);
11174 +#endif /* __KERNEL__ */
11176 +#define MAX_VROOT_DEFAULT 8
11179 + * IOCTL commands --- we will commandeer 0x56 ('V')
11182 +#define VROOT_SET_DEV 0x5600
11183 +#define VROOT_CLR_DEV 0x5601
11185 +#endif /* _LINUX_VROOT_H */
11186 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_base.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_base.h
11187 --- linux-2.6.33.2/include/linux/vs_base.h 1970-01-01 01:00:00.000000000 +0100
11188 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_base.h 2010-02-25 12:02:16.000000000 +0100
11190 +#ifndef _VS_BASE_H
11191 +#define _VS_BASE_H
11193 +#include "vserver/base.h"
11194 +#include "vserver/check.h"
11195 +#include "vserver/debug.h"
11198 +#warning duplicate inclusion
11200 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_context.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_context.h
11201 --- linux-2.6.33.2/include/linux/vs_context.h 1970-01-01 01:00:00.000000000 +0100
11202 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_context.h 2010-02-25 12:02:16.000000000 +0100
11204 +#ifndef _VS_CONTEXT_H
11205 +#define _VS_CONTEXT_H
11207 +#include "vserver/base.h"
11208 +#include "vserver/check.h"
11209 +#include "vserver/context.h"
11210 +#include "vserver/history.h"
11211 +#include "vserver/debug.h"
11213 +#include <linux/sched.h>
11216 +#define get_vx_info(i) __get_vx_info(i, __FILE__, __LINE__, __HERE__)
11218 +static inline struct vx_info *__get_vx_info(struct vx_info *vxi,
11219 + const char *_file, int _line, void *_here)
11224 + vxlprintk(VXD_CBIT(xid, 2), "get_vx_info(%p[#%d.%d])",
11225 + vxi, vxi ? vxi->vx_id : 0,
11226 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11228 + __vxh_get_vx_info(vxi, _here);
11230 + atomic_inc(&vxi->vx_usecnt);
11235 +extern void free_vx_info(struct vx_info *);
11237 +#define put_vx_info(i) __put_vx_info(i, __FILE__, __LINE__, __HERE__)
11239 +static inline void __put_vx_info(struct vx_info *vxi,
11240 + const char *_file, int _line, void *_here)
11245 + vxlprintk(VXD_CBIT(xid, 2), "put_vx_info(%p[#%d.%d])",
11246 + vxi, vxi ? vxi->vx_id : 0,
11247 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11249 + __vxh_put_vx_info(vxi, _here);
11251 + if (atomic_dec_and_test(&vxi->vx_usecnt))
11252 + free_vx_info(vxi);
11256 +#define init_vx_info(p, i) \
11257 + __init_vx_info(p, i, __FILE__, __LINE__, __HERE__)
11259 +static inline void __init_vx_info(struct vx_info **vxp, struct vx_info *vxi,
11260 + const char *_file, int _line, void *_here)
11263 + vxlprintk(VXD_CBIT(xid, 3),
11264 + "init_vx_info(%p[#%d.%d])",
11265 + vxi, vxi ? vxi->vx_id : 0,
11266 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11268 + __vxh_init_vx_info(vxi, vxp, _here);
11270 + atomic_inc(&vxi->vx_usecnt);
11276 +#define set_vx_info(p, i) \
11277 + __set_vx_info(p, i, __FILE__, __LINE__, __HERE__)
11279 +static inline void __set_vx_info(struct vx_info **vxp, struct vx_info *vxi,
11280 + const char *_file, int _line, void *_here)
11282 + struct vx_info *vxo;
11287 + vxlprintk(VXD_CBIT(xid, 3), "set_vx_info(%p[#%d.%d])",
11288 + vxi, vxi ? vxi->vx_id : 0,
11289 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11291 + __vxh_set_vx_info(vxi, vxp, _here);
11293 + atomic_inc(&vxi->vx_usecnt);
11294 + vxo = xchg(vxp, vxi);
11299 +#define clr_vx_info(p) __clr_vx_info(p, __FILE__, __LINE__, __HERE__)
11301 +static inline void __clr_vx_info(struct vx_info **vxp,
11302 + const char *_file, int _line, void *_here)
11304 + struct vx_info *vxo;
11306 + vxo = xchg(vxp, NULL);
11310 + vxlprintk(VXD_CBIT(xid, 3), "clr_vx_info(%p[#%d.%d])",
11311 + vxo, vxo ? vxo->vx_id : 0,
11312 + vxo ? atomic_read(&vxo->vx_usecnt) : 0,
11314 + __vxh_clr_vx_info(vxo, vxp, _here);
11316 + if (atomic_dec_and_test(&vxo->vx_usecnt))
11317 + free_vx_info(vxo);
11321 +#define claim_vx_info(v, p) \
11322 + __claim_vx_info(v, p, __FILE__, __LINE__, __HERE__)
11324 +static inline void __claim_vx_info(struct vx_info *vxi,
11325 + struct task_struct *task,
11326 + const char *_file, int _line, void *_here)
11328 + vxlprintk(VXD_CBIT(xid, 3), "claim_vx_info(%p[#%d.%d.%d]) %p",
11329 + vxi, vxi ? vxi->vx_id : 0,
11330 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11331 + vxi ? atomic_read(&vxi->vx_tasks) : 0,
11332 + task, _file, _line);
11333 + __vxh_claim_vx_info(vxi, task, _here);
11335 + atomic_inc(&vxi->vx_tasks);
11339 +extern void unhash_vx_info(struct vx_info *);
11341 +#define release_vx_info(v, p) \
11342 + __release_vx_info(v, p, __FILE__, __LINE__, __HERE__)
11344 +static inline void __release_vx_info(struct vx_info *vxi,
11345 + struct task_struct *task,
11346 + const char *_file, int _line, void *_here)
11348 + vxlprintk(VXD_CBIT(xid, 3), "release_vx_info(%p[#%d.%d.%d]) %p",
11349 + vxi, vxi ? vxi->vx_id : 0,
11350 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11351 + vxi ? atomic_read(&vxi->vx_tasks) : 0,
11352 + task, _file, _line);
11353 + __vxh_release_vx_info(vxi, task, _here);
11357 + if (atomic_dec_and_test(&vxi->vx_tasks))
11358 + unhash_vx_info(vxi);
11362 +#define task_get_vx_info(p) \
11363 + __task_get_vx_info(p, __FILE__, __LINE__, __HERE__)
11365 +static inline struct vx_info *__task_get_vx_info(struct task_struct *p,
11366 + const char *_file, int _line, void *_here)
11368 + struct vx_info *vxi;
11371 + vxlprintk(VXD_CBIT(xid, 5), "task_get_vx_info(%p)",
11372 + p, _file, _line);
11373 + vxi = __get_vx_info(p->vx_info, _file, _line, _here);
11379 +static inline void __wakeup_vx_info(struct vx_info *vxi)
11381 + if (waitqueue_active(&vxi->vx_wait))
11382 + wake_up_interruptible(&vxi->vx_wait);
11386 +#define enter_vx_info(v, s) __enter_vx_info(v, s, __FILE__, __LINE__)
11388 +static inline void __enter_vx_info(struct vx_info *vxi,
11389 + struct vx_info_save *vxis, const char *_file, int _line)
11391 + vxlprintk(VXD_CBIT(xid, 5), "enter_vx_info(%p[#%d],%p) %p[#%d,%p]",
11392 + vxi, vxi ? vxi->vx_id : 0, vxis, current,
11393 + current->xid, current->vx_info, _file, _line);
11394 + vxis->vxi = xchg(¤t->vx_info, vxi);
11395 + vxis->xid = current->xid;
11396 + current->xid = vxi ? vxi->vx_id : 0;
11399 +#define leave_vx_info(s) __leave_vx_info(s, __FILE__, __LINE__)
11401 +static inline void __leave_vx_info(struct vx_info_save *vxis,
11402 + const char *_file, int _line)
11404 + vxlprintk(VXD_CBIT(xid, 5), "leave_vx_info(%p[#%d,%p]) %p[#%d,%p]",
11405 + vxis, vxis->xid, vxis->vxi, current,
11406 + current->xid, current->vx_info, _file, _line);
11407 + (void)xchg(¤t->vx_info, vxis->vxi);
11408 + current->xid = vxis->xid;
11412 +static inline void __enter_vx_admin(struct vx_info_save *vxis)
11414 + vxis->vxi = xchg(¤t->vx_info, NULL);
11415 + vxis->xid = xchg(¤t->xid, (xid_t)0);
11418 +static inline void __leave_vx_admin(struct vx_info_save *vxis)
11420 + (void)xchg(¤t->xid, vxis->xid);
11421 + (void)xchg(¤t->vx_info, vxis->vxi);
11424 +#define task_is_init(p) \
11425 + __task_is_init(p, __FILE__, __LINE__, __HERE__)
11427 +static inline int __task_is_init(struct task_struct *p,
11428 + const char *_file, int _line, void *_here)
11430 + int is_init = is_global_init(p);
11434 + is_init = p->vx_info->vx_initpid == p->pid;
11439 +extern void exit_vx_info(struct task_struct *, int);
11440 +extern void exit_vx_info_early(struct task_struct *, int);
11444 +#warning duplicate inclusion
11446 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_cowbl.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_cowbl.h
11447 --- linux-2.6.33.2/include/linux/vs_cowbl.h 1970-01-01 01:00:00.000000000 +0100
11448 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_cowbl.h 2010-02-25 12:02:16.000000000 +0100
11450 +#ifndef _VS_COWBL_H
11451 +#define _VS_COWBL_H
11453 +#include <linux/fs.h>
11454 +#include <linux/dcache.h>
11455 +#include <linux/namei.h>
11457 +extern struct dentry *cow_break_link(const char *pathname);
11459 +static inline int cow_check_and_break(struct path *path)
11461 + struct inode *inode = path->dentry->d_inode;
11464 + /* do we need this check? */
11465 + if (IS_RDONLY(inode))
11468 + if (IS_COW(inode)) {
11469 + if (IS_COW_LINK(inode)) {
11470 + struct dentry *new_dentry, *old_dentry = path->dentry;
11473 + buf = kmalloc(PATH_MAX, GFP_KERNEL);
11477 + pp = d_path(path, buf, PATH_MAX);
11478 + new_dentry = cow_break_link(pp);
11480 + if (!IS_ERR(new_dentry)) {
11481 + path->dentry = new_dentry;
11482 + dput(old_dentry);
11484 + error = PTR_ERR(new_dentry);
11486 + inode->i_flags &= ~(S_IXUNLINK | S_IMMUTABLE);
11487 + inode->i_ctime = CURRENT_TIME;
11488 + mark_inode_dirty(inode);
11495 +#warning duplicate inclusion
11497 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_cvirt.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_cvirt.h
11498 --- linux-2.6.33.2/include/linux/vs_cvirt.h 1970-01-01 01:00:00.000000000 +0100
11499 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_cvirt.h 2010-02-25 12:02:16.000000000 +0100
11501 +#ifndef _VS_CVIRT_H
11502 +#define _VS_CVIRT_H
11504 +#include "vserver/cvirt.h"
11505 +#include "vserver/context.h"
11506 +#include "vserver/base.h"
11507 +#include "vserver/check.h"
11508 +#include "vserver/debug.h"
11511 +static inline void vx_activate_task(struct task_struct *p)
11513 + struct vx_info *vxi;
11515 + if ((vxi = p->vx_info)) {
11516 + vx_update_load(vxi);
11517 + atomic_inc(&vxi->cvirt.nr_running);
11521 +static inline void vx_deactivate_task(struct task_struct *p)
11523 + struct vx_info *vxi;
11525 + if ((vxi = p->vx_info)) {
11526 + vx_update_load(vxi);
11527 + atomic_dec(&vxi->cvirt.nr_running);
11531 +static inline void vx_uninterruptible_inc(struct task_struct *p)
11533 + struct vx_info *vxi;
11535 + if ((vxi = p->vx_info))
11536 + atomic_inc(&vxi->cvirt.nr_uninterruptible);
11539 +static inline void vx_uninterruptible_dec(struct task_struct *p)
11541 + struct vx_info *vxi;
11543 + if ((vxi = p->vx_info))
11544 + atomic_dec(&vxi->cvirt.nr_uninterruptible);
11549 +#warning duplicate inclusion
11551 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_device.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_device.h
11552 --- linux-2.6.33.2/include/linux/vs_device.h 1970-01-01 01:00:00.000000000 +0100
11553 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_device.h 2010-02-25 12:02:16.000000000 +0100
11555 +#ifndef _VS_DEVICE_H
11556 +#define _VS_DEVICE_H
11558 +#include "vserver/base.h"
11559 +#include "vserver/device.h"
11560 +#include "vserver/debug.h"
11563 +#ifdef CONFIG_VSERVER_DEVICE
11565 +int vs_map_device(struct vx_info *, dev_t, dev_t *, umode_t);
11567 +#define vs_device_perm(v, d, m, p) \
11568 + ((vs_map_device(current_vx_info(), d, NULL, m) & (p)) == (p))
11573 +int vs_map_device(struct vx_info *vxi,
11574 + dev_t device, dev_t *target, umode_t mode)
11577 + *target = device;
11581 +#define vs_device_perm(v, d, m, p) ((p) == (p))
11586 +#define vs_map_chrdev(d, t, p) \
11587 + ((vs_map_device(current_vx_info(), d, t, S_IFCHR) & (p)) == (p))
11588 +#define vs_map_blkdev(d, t, p) \
11589 + ((vs_map_device(current_vx_info(), d, t, S_IFBLK) & (p)) == (p))
11591 +#define vs_chrdev_perm(d, p) \
11592 + vs_device_perm(current_vx_info(), d, S_IFCHR, p)
11593 +#define vs_blkdev_perm(d, p) \
11594 + vs_device_perm(current_vx_info(), d, S_IFBLK, p)
11598 +#warning duplicate inclusion
11600 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_dlimit.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_dlimit.h
11601 --- linux-2.6.33.2/include/linux/vs_dlimit.h 1970-01-01 01:00:00.000000000 +0100
11602 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_dlimit.h 2010-03-21 06:38:55.000000000 +0100
11604 +#ifndef _VS_DLIMIT_H
11605 +#define _VS_DLIMIT_H
11607 +#include <linux/fs.h>
11609 +#include "vserver/dlimit.h"
11610 +#include "vserver/base.h"
11611 +#include "vserver/debug.h"
11614 +#define get_dl_info(i) __get_dl_info(i, __FILE__, __LINE__)
11616 +static inline struct dl_info *__get_dl_info(struct dl_info *dli,
11617 + const char *_file, int _line)
11621 + vxlprintk(VXD_CBIT(dlim, 4), "get_dl_info(%p[#%d.%d])",
11622 + dli, dli ? dli->dl_tag : 0,
11623 + dli ? atomic_read(&dli->dl_usecnt) : 0,
11625 + atomic_inc(&dli->dl_usecnt);
11630 +#define free_dl_info(i) \
11631 + call_rcu(&(i)->dl_rcu, rcu_free_dl_info)
11633 +#define put_dl_info(i) __put_dl_info(i, __FILE__, __LINE__)
11635 +static inline void __put_dl_info(struct dl_info *dli,
11636 + const char *_file, int _line)
11640 + vxlprintk(VXD_CBIT(dlim, 4), "put_dl_info(%p[#%d.%d])",
11641 + dli, dli ? dli->dl_tag : 0,
11642 + dli ? atomic_read(&dli->dl_usecnt) : 0,
11644 + if (atomic_dec_and_test(&dli->dl_usecnt))
11645 + free_dl_info(dli);
11649 +#define __dlimit_char(d) ((d) ? '*' : ' ')
11651 +static inline int __dl_alloc_space(struct super_block *sb,
11652 + tag_t tag, dlsize_t nr, const char *file, int line)
11654 + struct dl_info *dli = NULL;
11659 + dli = locate_dl_info(sb, tag);
11663 + spin_lock(&dli->dl_lock);
11664 + ret = (dli->dl_space_used + nr > dli->dl_space_total);
11666 + dli->dl_space_used += nr;
11667 + spin_unlock(&dli->dl_lock);
11668 + put_dl_info(dli);
11670 + vxlprintk(VXD_CBIT(dlim, 1),
11671 + "ALLOC (%p,#%d)%c %lld bytes (%d)",
11672 + sb, tag, __dlimit_char(dli), (long long)nr,
11673 + ret, file, line);
11677 +static inline void __dl_free_space(struct super_block *sb,
11678 + tag_t tag, dlsize_t nr, const char *_file, int _line)
11680 + struct dl_info *dli = NULL;
11684 + dli = locate_dl_info(sb, tag);
11688 + spin_lock(&dli->dl_lock);
11689 + if (dli->dl_space_used > nr)
11690 + dli->dl_space_used -= nr;
11692 + dli->dl_space_used = 0;
11693 + spin_unlock(&dli->dl_lock);
11694 + put_dl_info(dli);
11696 + vxlprintk(VXD_CBIT(dlim, 1),
11697 + "FREE (%p,#%d)%c %lld bytes",
11698 + sb, tag, __dlimit_char(dli), (long long)nr,
11702 +static inline int __dl_alloc_inode(struct super_block *sb,
11703 + tag_t tag, const char *_file, int _line)
11705 + struct dl_info *dli;
11708 + dli = locate_dl_info(sb, tag);
11712 + spin_lock(&dli->dl_lock);
11713 + dli->dl_inodes_used++;
11714 + ret = (dli->dl_inodes_used > dli->dl_inodes_total);
11715 + spin_unlock(&dli->dl_lock);
11716 + put_dl_info(dli);
11718 + vxlprintk(VXD_CBIT(dlim, 0),
11719 + "ALLOC (%p,#%d)%c inode (%d)",
11720 + sb, tag, __dlimit_char(dli), ret, _file, _line);
11724 +static inline void __dl_free_inode(struct super_block *sb,
11725 + tag_t tag, const char *_file, int _line)
11727 + struct dl_info *dli;
11729 + dli = locate_dl_info(sb, tag);
11733 + spin_lock(&dli->dl_lock);
11734 + if (dli->dl_inodes_used > 1)
11735 + dli->dl_inodes_used--;
11737 + dli->dl_inodes_used = 0;
11738 + spin_unlock(&dli->dl_lock);
11739 + put_dl_info(dli);
11741 + vxlprintk(VXD_CBIT(dlim, 0),
11742 + "FREE (%p,#%d)%c inode",
11743 + sb, tag, __dlimit_char(dli), _file, _line);
11746 +static inline void __dl_adjust_block(struct super_block *sb, tag_t tag,
11747 + unsigned long long *free_blocks, unsigned long long *root_blocks,
11748 + const char *_file, int _line)
11750 + struct dl_info *dli;
11751 + uint64_t broot, bfree;
11753 + dli = locate_dl_info(sb, tag);
11757 + spin_lock(&dli->dl_lock);
11758 + broot = (dli->dl_space_total -
11759 + (dli->dl_space_total >> 10) * dli->dl_nrlmult)
11760 + >> sb->s_blocksize_bits;
11761 + bfree = (dli->dl_space_total - dli->dl_space_used)
11762 + >> sb->s_blocksize_bits;
11763 + spin_unlock(&dli->dl_lock);
11765 + vxlprintk(VXD_CBIT(dlim, 2),
11766 + "ADJUST: %lld,%lld on %lld,%lld [mult=%d]",
11767 + (long long)bfree, (long long)broot,
11768 + *free_blocks, *root_blocks, dli->dl_nrlmult,
11770 + if (free_blocks) {
11771 + if (*free_blocks > bfree)
11772 + *free_blocks = bfree;
11774 + if (root_blocks) {
11775 + if (*root_blocks > broot)
11776 + *root_blocks = broot;
11778 + put_dl_info(dli);
11781 +#define dl_prealloc_space(in, bytes) \
11782 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11783 + __FILE__, __LINE__ )
11785 +#define dl_alloc_space(in, bytes) \
11786 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11787 + __FILE__, __LINE__ )
11789 +#define dl_reserve_space(in, bytes) \
11790 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11791 + __FILE__, __LINE__ )
11793 +#define dl_claim_space(in, bytes) (0)
11795 +#define dl_release_space(in, bytes) \
11796 + __dl_free_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11797 + __FILE__, __LINE__ )
11799 +#define dl_free_space(in, bytes) \
11800 + __dl_free_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11801 + __FILE__, __LINE__ )
11805 +#define dl_alloc_inode(in) \
11806 + __dl_alloc_inode((in)->i_sb, (in)->i_tag, __FILE__, __LINE__ )
11808 +#define dl_free_inode(in) \
11809 + __dl_free_inode((in)->i_sb, (in)->i_tag, __FILE__, __LINE__ )
11812 +#define dl_adjust_block(sb, tag, fb, rb) \
11813 + __dl_adjust_block(sb, tag, fb, rb, __FILE__, __LINE__ )
11817 +#warning duplicate inclusion
11819 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/base.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/base.h
11820 --- linux-2.6.33.2/include/linux/vserver/base.h 1970-01-01 01:00:00.000000000 +0100
11821 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/base.h 2010-02-25 12:02:16.000000000 +0100
11823 +#ifndef _VX_BASE_H
11824 +#define _VX_BASE_H
11827 +/* context state changes */
11839 +#define vx_task_xid(t) ((t)->xid)
11841 +#define vx_current_xid() vx_task_xid(current)
11843 +#define current_vx_info() (current->vx_info)
11846 +#define nx_task_nid(t) ((t)->nid)
11848 +#define nx_current_nid() nx_task_nid(current)
11850 +#define current_nx_info() (current->nx_info)
11853 +/* generic flag merging */
11855 +#define vs_check_flags(v, m, f) (((v) & (m)) ^ (f))
11857 +#define vs_mask_flags(v, f, m) (((v) & ~(m)) | ((f) & (m)))
11859 +#define vs_mask_mask(v, f, m) (((v) & ~(m)) | ((v) & (f) & (m)))
11861 +#define vs_check_bit(v, n) ((v) & (1LL << (n)))
11864 +/* context flags */
11866 +#define __vx_flags(v) ((v) ? (v)->vx_flags : 0)
11868 +#define vx_current_flags() __vx_flags(current_vx_info())
11870 +#define vx_info_flags(v, m, f) \
11871 + vs_check_flags(__vx_flags(v), m, f)
11873 +#define task_vx_flags(t, m, f) \
11874 + ((t) && vx_info_flags((t)->vx_info, m, f))
11876 +#define vx_flags(m, f) vx_info_flags(current_vx_info(), m, f)
11879 +/* context caps */
11881 +#define __vx_ccaps(v) ((v) ? (v)->vx_ccaps : 0)
11883 +#define vx_current_ccaps() __vx_ccaps(current_vx_info())
11885 +#define vx_info_ccaps(v, c) (__vx_ccaps(v) & (c))
11887 +#define vx_ccaps(c) vx_info_ccaps(current_vx_info(), (c))
11891 +/* network flags */
11893 +#define __nx_flags(n) ((n) ? (n)->nx_flags : 0)
11895 +#define nx_current_flags() __nx_flags(current_nx_info())
11897 +#define nx_info_flags(n, m, f) \
11898 + vs_check_flags(__nx_flags(n), m, f)
11900 +#define task_nx_flags(t, m, f) \
11901 + ((t) && nx_info_flags((t)->nx_info, m, f))
11903 +#define nx_flags(m, f) nx_info_flags(current_nx_info(), m, f)
11906 +/* network caps */
11908 +#define __nx_ncaps(n) ((n) ? (n)->nx_ncaps : 0)
11910 +#define nx_current_ncaps() __nx_ncaps(current_nx_info())
11912 +#define nx_info_ncaps(n, c) (__nx_ncaps(n) & (c))
11914 +#define nx_ncaps(c) nx_info_ncaps(current_nx_info(), c)
11917 +/* context mask capabilities */
11919 +#define __vx_mcaps(v) ((v) ? (v)->vx_ccaps >> 32UL : ~0 )
11921 +#define vx_info_mcaps(v, c) (__vx_mcaps(v) & (c))
11923 +#define vx_mcaps(c) vx_info_mcaps(current_vx_info(), c)
11926 +/* context bcap mask */
11928 +#define __vx_bcaps(v) ((v)->vx_bcaps)
11930 +#define vx_current_bcaps() __vx_bcaps(current_vx_info())
11933 +/* mask given bcaps */
11935 +#define vx_info_mbcaps(v, c) ((v) ? cap_intersect(__vx_bcaps(v), c) : c)
11937 +#define vx_mbcaps(c) vx_info_mbcaps(current_vx_info(), c)
11940 +/* masked cap_bset */
11942 +#define vx_info_cap_bset(v) vx_info_mbcaps(v, current->cap_bset)
11944 +#define vx_current_cap_bset() vx_info_cap_bset(current_vx_info())
11947 +#define vx_info_mbcap(v, b) \
11948 + (!vx_info_flags(v, VXF_STATE_SETUP, 0) ? \
11949 + vx_info_bcaps(v, b) : (b))
11951 +#define task_vx_mbcap(t, b) \
11952 + vx_info_mbcap((t)->vx_info, (t)->b)
11954 +#define vx_mbcap(b) task_vx_mbcap(current, b)
11957 +#define vx_cap_raised(v, c, f) cap_raised(vx_info_mbcaps(v, c), f)
11959 +#define vx_capable(b, c) (capable(b) || \
11960 + (cap_raised(current_cap(), b) && vx_ccaps(c)))
11962 +#define nx_capable(b, c) (capable(b) || \
11963 + (cap_raised(current_cap(), b) && nx_ncaps(c)))
11965 +#define vx_task_initpid(t, n) \
11966 + ((t)->vx_info && \
11967 + ((t)->vx_info->vx_initpid == (n)))
11969 +#define vx_current_initpid(n) vx_task_initpid(current, n)
11972 +/* context unshare mask */
11974 +#define __vx_umask(v) ((v)->vx_umask)
11976 +#define vx_current_umask() __vx_umask(current_vx_info())
11978 +#define vx_can_unshare(b, f) (capable(b) || \
11979 + (cap_raised(current_cap(), b) && \
11980 + !((f) & ~vx_current_umask())))
11983 +#define __vx_state(v) ((v) ? ((v)->vx_state) : 0)
11985 +#define vx_info_state(v, m) (__vx_state(v) & (m))
11988 +#define __nx_state(n) ((n) ? ((n)->nx_state) : 0)
11990 +#define nx_info_state(n, m) (__nx_state(n) & (m))
11993 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/cacct_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cacct_cmd.h
11994 --- linux-2.6.33.2/include/linux/vserver/cacct_cmd.h 1970-01-01 01:00:00.000000000 +0100
11995 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cacct_cmd.h 2010-02-25 12:02:16.000000000 +0100
11997 +#ifndef _VX_CACCT_CMD_H
11998 +#define _VX_CACCT_CMD_H
12001 +/* virtual host info name commands */
12003 +#define VCMD_sock_stat VC_CMD(VSTAT, 5, 0)
12005 +struct vcmd_sock_stat_v0 {
12007 + uint32_t count[3];
12008 + uint64_t total[3];
12014 +#include <linux/compiler.h>
12016 +extern int vc_sock_stat(struct vx_info *, void __user *);
12018 +#endif /* __KERNEL__ */
12019 +#endif /* _VX_CACCT_CMD_H */
12020 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/cacct_def.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cacct_def.h
12021 --- linux-2.6.33.2/include/linux/vserver/cacct_def.h 1970-01-01 01:00:00.000000000 +0100
12022 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cacct_def.h 2010-02-25 12:02:16.000000000 +0100
12024 +#ifndef _VX_CACCT_DEF_H
12025 +#define _VX_CACCT_DEF_H
12027 +#include <asm/atomic.h>
12028 +#include <linux/vserver/cacct.h>
12031 +struct _vx_sock_acc {
12032 + atomic_long_t count;
12033 + atomic_long_t total;
12036 +/* context sub struct */
12038 +struct _vx_cacct {
12039 + struct _vx_sock_acc sock[VXA_SOCK_SIZE][3];
12040 + atomic_t slab[8];
12041 + atomic_t page[6][8];
12044 +#ifdef CONFIG_VSERVER_DEBUG
12046 +static inline void __dump_vx_cacct(struct _vx_cacct *cacct)
12050 + printk("\t_vx_cacct:");
12051 + for (i = 0; i < 6; i++) {
12052 + struct _vx_sock_acc *ptr = cacct->sock[i];
12054 + printk("\t [%d] =", i);
12055 + for (j = 0; j < 3; j++) {
12056 + printk(" [%d] = %8lu, %8lu", j,
12057 + atomic_long_read(&ptr[j].count),
12058 + atomic_long_read(&ptr[j].total));
12066 +#endif /* _VX_CACCT_DEF_H */
12067 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/cacct.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cacct.h
12068 --- linux-2.6.33.2/include/linux/vserver/cacct.h 1970-01-01 01:00:00.000000000 +0100
12069 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cacct.h 2010-02-25 12:02:16.000000000 +0100
12071 +#ifndef _VX_CACCT_H
12072 +#define _VX_CACCT_H
12075 +enum sock_acc_field {
12076 + VXA_SOCK_UNSPEC = 0,
12082 + VXA_SOCK_SIZE /* array size */
12085 +#endif /* _VX_CACCT_H */
12086 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/cacct_int.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cacct_int.h
12087 --- linux-2.6.33.2/include/linux/vserver/cacct_int.h 1970-01-01 01:00:00.000000000 +0100
12088 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cacct_int.h 2010-02-25 12:02:16.000000000 +0100
12090 +#ifndef _VX_CACCT_INT_H
12091 +#define _VX_CACCT_INT_H
12097 +unsigned long vx_sock_count(struct _vx_cacct *cacct, int type, int pos)
12099 + return atomic_long_read(&cacct->sock[type][pos].count);
12104 +unsigned long vx_sock_total(struct _vx_cacct *cacct, int type, int pos)
12106 + return atomic_long_read(&cacct->sock[type][pos].total);
12109 +#endif /* __KERNEL__ */
12110 +#endif /* _VX_CACCT_INT_H */
12111 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/check.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/check.h
12112 --- linux-2.6.33.2/include/linux/vserver/check.h 1970-01-01 01:00:00.000000000 +0100
12113 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/check.h 2010-02-25 12:02:16.000000000 +0100
12115 +#ifndef _VS_CHECK_H
12116 +#define _VS_CHECK_H
12119 +#define MAX_S_CONTEXT 65535 /* Arbitrary limit */
12121 +#ifdef CONFIG_VSERVER_DYNAMIC_IDS
12122 +#define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
12124 +#define MIN_D_CONTEXT 65536
12127 +/* check conditions */
12129 +#define VS_ADMIN 0x0001
12130 +#define VS_WATCH 0x0002
12131 +#define VS_HIDE 0x0004
12132 +#define VS_HOSTID 0x0008
12134 +#define VS_IDENT 0x0010
12135 +#define VS_EQUIV 0x0020
12136 +#define VS_PARENT 0x0040
12137 +#define VS_CHILD 0x0080
12139 +#define VS_ARG_MASK 0x00F0
12141 +#define VS_DYNAMIC 0x0100
12142 +#define VS_STATIC 0x0200
12144 +#define VS_ATR_MASK 0x0F00
12146 +#ifdef CONFIG_VSERVER_PRIVACY
12147 +#define VS_ADMIN_P (0)
12148 +#define VS_WATCH_P (0)
12150 +#define VS_ADMIN_P VS_ADMIN
12151 +#define VS_WATCH_P VS_WATCH
12154 +#define VS_HARDIRQ 0x1000
12155 +#define VS_SOFTIRQ 0x2000
12156 +#define VS_IRQ 0x4000
12158 +#define VS_IRQ_MASK 0xF000
12160 +#include <linux/hardirq.h>
12163 + * check current context for ADMIN/WATCH and
12164 + * optionally against supplied argument
12166 +static inline int __vs_check(int cid, int id, unsigned int mode)
12168 + if (mode & VS_ARG_MASK) {
12169 + if ((mode & VS_IDENT) && (id == cid))
12172 + if (mode & VS_ATR_MASK) {
12173 + if ((mode & VS_DYNAMIC) &&
12174 + (id >= MIN_D_CONTEXT) &&
12175 + (id <= MAX_S_CONTEXT))
12177 + if ((mode & VS_STATIC) &&
12178 + (id > 1) && (id < MIN_D_CONTEXT))
12181 + if (mode & VS_IRQ_MASK) {
12182 + if ((mode & VS_IRQ) && unlikely(in_interrupt()))
12184 + if ((mode & VS_HARDIRQ) && unlikely(in_irq()))
12186 + if ((mode & VS_SOFTIRQ) && unlikely(in_softirq()))
12189 + return (((mode & VS_ADMIN) && (cid == 0)) ||
12190 + ((mode & VS_WATCH) && (cid == 1)) ||
12191 + ((mode & VS_HOSTID) && (id == 0)));
12194 +#define vx_check(c, m) __vs_check(vx_current_xid(), c, (m) | VS_IRQ)
12196 +#define vx_weak_check(c, m) ((m) ? vx_check(c, m) : 1)
12199 +#define nx_check(c, m) __vs_check(nx_current_nid(), c, m)
12201 +#define nx_weak_check(c, m) ((m) ? nx_check(c, m) : 1)
12204 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/context_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/context_cmd.h
12205 --- linux-2.6.33.2/include/linux/vserver/context_cmd.h 1970-01-01 01:00:00.000000000 +0100
12206 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/context_cmd.h 2010-02-25 12:02:16.000000000 +0100
12208 +#ifndef _VX_CONTEXT_CMD_H
12209 +#define _VX_CONTEXT_CMD_H
12212 +/* vinfo commands */
12214 +#define VCMD_task_xid VC_CMD(VINFO, 1, 0)
12217 +extern int vc_task_xid(uint32_t);
12219 +#endif /* __KERNEL__ */
12221 +#define VCMD_vx_info VC_CMD(VINFO, 5, 0)
12223 +struct vcmd_vx_info_v0 {
12225 + uint32_t initpid;
12226 + /* more to come */
12230 +extern int vc_vx_info(struct vx_info *, void __user *);
12232 +#endif /* __KERNEL__ */
12234 +#define VCMD_ctx_stat VC_CMD(VSTAT, 0, 0)
12236 +struct vcmd_ctx_stat_v0 {
12239 + /* more to come */
12243 +extern int vc_ctx_stat(struct vx_info *, void __user *);
12245 +#endif /* __KERNEL__ */
12247 +/* context commands */
12249 +#define VCMD_ctx_create_v0 VC_CMD(VPROC, 1, 0)
12250 +#define VCMD_ctx_create VC_CMD(VPROC, 1, 1)
12252 +struct vcmd_ctx_create {
12253 + uint64_t flagword;
12256 +#define VCMD_ctx_migrate_v0 VC_CMD(PROCMIG, 1, 0)
12257 +#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 1)
12259 +struct vcmd_ctx_migrate {
12260 + uint64_t flagword;
12264 +extern int vc_ctx_create(uint32_t, void __user *);
12265 +extern int vc_ctx_migrate(struct vx_info *, void __user *);
12267 +#endif /* __KERNEL__ */
12270 +/* flag commands */
12272 +#define VCMD_get_cflags VC_CMD(FLAGS, 1, 0)
12273 +#define VCMD_set_cflags VC_CMD(FLAGS, 2, 0)
12275 +struct vcmd_ctx_flags_v0 {
12276 + uint64_t flagword;
12281 +extern int vc_get_cflags(struct vx_info *, void __user *);
12282 +extern int vc_set_cflags(struct vx_info *, void __user *);
12284 +#endif /* __KERNEL__ */
12287 +/* context caps commands */
12289 +#define VCMD_get_ccaps VC_CMD(FLAGS, 3, 1)
12290 +#define VCMD_set_ccaps VC_CMD(FLAGS, 4, 1)
12292 +struct vcmd_ctx_caps_v1 {
12298 +extern int vc_get_ccaps(struct vx_info *, void __user *);
12299 +extern int vc_set_ccaps(struct vx_info *, void __user *);
12301 +#endif /* __KERNEL__ */
12304 +/* bcaps commands */
12306 +#define VCMD_get_bcaps VC_CMD(FLAGS, 9, 0)
12307 +#define VCMD_set_bcaps VC_CMD(FLAGS, 10, 0)
12309 +struct vcmd_bcaps {
12315 +extern int vc_get_bcaps(struct vx_info *, void __user *);
12316 +extern int vc_set_bcaps(struct vx_info *, void __user *);
12318 +#endif /* __KERNEL__ */
12321 +/* umask commands */
12323 +#define VCMD_get_umask VC_CMD(FLAGS, 13, 0)
12324 +#define VCMD_set_umask VC_CMD(FLAGS, 14, 0)
12326 +struct vcmd_umask {
12332 +extern int vc_get_umask(struct vx_info *, void __user *);
12333 +extern int vc_set_umask(struct vx_info *, void __user *);
12335 +#endif /* __KERNEL__ */
12340 +#define VCMD_get_badness VC_CMD(MEMCTRL, 5, 0)
12341 +#define VCMD_set_badness VC_CMD(MEMCTRL, 6, 0)
12343 +struct vcmd_badness_v0 {
12348 +extern int vc_get_badness(struct vx_info *, void __user *);
12349 +extern int vc_set_badness(struct vx_info *, void __user *);
12351 +#endif /* __KERNEL__ */
12352 +#endif /* _VX_CONTEXT_CMD_H */
12353 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/context.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/context.h
12354 --- linux-2.6.33.2/include/linux/vserver/context.h 1970-01-01 01:00:00.000000000 +0100
12355 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/context.h 2010-03-05 19:53:00.000000000 +0100
12357 +#ifndef _VX_CONTEXT_H
12358 +#define _VX_CONTEXT_H
12360 +#include <linux/types.h>
12361 +#include <linux/capability.h>
12364 +/* context flags */
12366 +#define VXF_INFO_SCHED 0x00000002
12367 +#define VXF_INFO_NPROC 0x00000004
12368 +#define VXF_INFO_PRIVATE 0x00000008
12370 +#define VXF_INFO_INIT 0x00000010
12371 +#define VXF_INFO_HIDE 0x00000020
12372 +#define VXF_INFO_ULIMIT 0x00000040
12373 +#define VXF_INFO_NSPACE 0x00000080
12375 +#define VXF_SCHED_HARD 0x00000100
12376 +#define VXF_SCHED_PRIO 0x00000200
12377 +#define VXF_SCHED_PAUSE 0x00000400
12379 +#define VXF_VIRT_MEM 0x00010000
12380 +#define VXF_VIRT_UPTIME 0x00020000
12381 +#define VXF_VIRT_CPU 0x00040000
12382 +#define VXF_VIRT_LOAD 0x00080000
12383 +#define VXF_VIRT_TIME 0x00100000
12385 +#define VXF_HIDE_MOUNT 0x01000000
12386 +/* was VXF_HIDE_NETIF 0x02000000 */
12387 +#define VXF_HIDE_VINFO 0x04000000
12389 +#define VXF_STATE_SETUP (1ULL << 32)
12390 +#define VXF_STATE_INIT (1ULL << 33)
12391 +#define VXF_STATE_ADMIN (1ULL << 34)
12393 +#define VXF_SC_HELPER (1ULL << 36)
12394 +#define VXF_REBOOT_KILL (1ULL << 37)
12395 +#define VXF_PERSISTENT (1ULL << 38)
12397 +#define VXF_FORK_RSS (1ULL << 48)
12398 +#define VXF_PROLIFIC (1ULL << 49)
12400 +#define VXF_IGNEG_NICE (1ULL << 52)
12402 +#define VXF_ONE_TIME (0x0007ULL << 32)
12404 +#define VXF_INIT_SET (VXF_STATE_SETUP | VXF_STATE_INIT | VXF_STATE_ADMIN)
12407 +/* context migration */
12409 +#define VXM_SET_INIT 0x00000001
12410 +#define VXM_SET_REAPER 0x00000002
12412 +/* context caps */
12414 +#define VXC_CAP_MASK 0x00000000
12416 +#define VXC_SET_UTSNAME 0x00000001
12417 +#define VXC_SET_RLIMIT 0x00000002
12418 +#define VXC_FS_SECURITY 0x00000004
12419 +#define VXC_FS_TRUSTED 0x00000008
12420 +#define VXC_TIOCSTI 0x00000010
12422 +/* was VXC_RAW_ICMP 0x00000100 */
12423 +#define VXC_SYSLOG 0x00001000
12424 +#define VXC_OOM_ADJUST 0x00002000
12425 +#define VXC_AUDIT_CONTROL 0x00004000
12427 +#define VXC_SECURE_MOUNT 0x00010000
12428 +#define VXC_SECURE_REMOUNT 0x00020000
12429 +#define VXC_BINARY_MOUNT 0x00040000
12431 +#define VXC_QUOTA_CTL 0x00100000
12432 +#define VXC_ADMIN_MAPPER 0x00200000
12433 +#define VXC_ADMIN_CLOOP 0x00400000
12435 +#define VXC_KTHREAD 0x01000000
12436 +#define VXC_NAMESPACE 0x02000000
12441 +#include <linux/list.h>
12442 +#include <linux/spinlock.h>
12443 +#include <linux/rcupdate.h>
12445 +#include "limit_def.h"
12446 +#include "sched_def.h"
12447 +#include "cvirt_def.h"
12448 +#include "cacct_def.h"
12449 +#include "device_def.h"
12451 +#define VX_SPACES 2
12453 +struct _vx_info_pc {
12454 + struct _vx_sched_pc sched_pc;
12455 + struct _vx_cvirt_pc cvirt_pc;
12459 + struct hlist_node vx_hlist; /* linked list of contexts */
12460 + xid_t vx_id; /* context id */
12461 + atomic_t vx_usecnt; /* usage count */
12462 + atomic_t vx_tasks; /* tasks count */
12463 + struct vx_info *vx_parent; /* parent context */
12464 + int vx_state; /* context state */
12466 + unsigned long vx_nsmask[VX_SPACES]; /* assignment mask */
12467 + struct nsproxy *vx_nsproxy[VX_SPACES]; /* private namespaces */
12468 + struct fs_struct *vx_fs[VX_SPACES]; /* private namespace fs */
12470 + uint64_t vx_flags; /* context flags */
12471 + uint64_t vx_ccaps; /* context caps (vserver) */
12472 + kernel_cap_t vx_bcaps; /* bounding caps (system) */
12473 + unsigned long vx_umask; /* unshare mask (guest) */
12475 + struct task_struct *vx_reaper; /* guest reaper process */
12476 + pid_t vx_initpid; /* PID of guest init */
12477 + int64_t vx_badness_bias; /* OOM points bias */
12479 + struct _vx_limit limit; /* vserver limits */
12480 + struct _vx_sched sched; /* vserver scheduler */
12481 + struct _vx_cvirt cvirt; /* virtual/bias stuff */
12482 + struct _vx_cacct cacct; /* context accounting */
12484 + struct _vx_device dmap; /* default device map targets */
12486 +#ifndef CONFIG_SMP
12487 + struct _vx_info_pc info_pc; /* per cpu data */
12489 + struct _vx_info_pc *ptr_pc; /* per cpu array */
12492 + wait_queue_head_t vx_wait; /* context exit waitqueue */
12493 + int reboot_cmd; /* last sys_reboot() cmd */
12494 + int exit_code; /* last process exit code */
12496 + char vx_name[65]; /* vserver name */
12499 +#ifndef CONFIG_SMP
12500 +#define vx_ptr_pc(vxi) (&(vxi)->info_pc)
12501 +#define vx_per_cpu(vxi, v, id) vx_ptr_pc(vxi)->v
12503 +#define vx_ptr_pc(vxi) ((vxi)->ptr_pc)
12504 +#define vx_per_cpu(vxi, v, id) per_cpu_ptr(vx_ptr_pc(vxi), id)->v
12507 +#define vx_cpu(vxi, v) vx_per_cpu(vxi, v, smp_processor_id())
12510 +struct vx_info_save {
12511 + struct vx_info *vxi;
12516 +/* status flags */
12518 +#define VXS_HASHED 0x0001
12519 +#define VXS_PAUSED 0x0010
12520 +#define VXS_SHUTDOWN 0x0100
12521 +#define VXS_HELPER 0x1000
12522 +#define VXS_RELEASED 0x8000
12525 +extern void claim_vx_info(struct vx_info *, struct task_struct *);
12526 +extern void release_vx_info(struct vx_info *, struct task_struct *);
12528 +extern struct vx_info *lookup_vx_info(int);
12529 +extern struct vx_info *lookup_or_create_vx_info(int);
12531 +extern int get_xid_list(int, unsigned int *, int);
12532 +extern int xid_is_hashed(xid_t);
12534 +extern int vx_migrate_task(struct task_struct *, struct vx_info *, int);
12536 +extern long vs_state_change(struct vx_info *, unsigned int);
12539 +#endif /* __KERNEL__ */
12540 +#endif /* _VX_CONTEXT_H */
12541 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/cvirt_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cvirt_cmd.h
12542 --- linux-2.6.33.2/include/linux/vserver/cvirt_cmd.h 1970-01-01 01:00:00.000000000 +0100
12543 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cvirt_cmd.h 2010-02-25 12:02:16.000000000 +0100
12545 +#ifndef _VX_CVIRT_CMD_H
12546 +#define _VX_CVIRT_CMD_H
12549 +/* virtual host info name commands */
12551 +#define VCMD_set_vhi_name VC_CMD(VHOST, 1, 0)
12552 +#define VCMD_get_vhi_name VC_CMD(VHOST, 2, 0)
12554 +struct vcmd_vhi_name_v0 {
12560 +enum vhi_name_field {
12561 + VHIN_CONTEXT = 0,
12573 +#include <linux/compiler.h>
12575 +extern int vc_set_vhi_name(struct vx_info *, void __user *);
12576 +extern int vc_get_vhi_name(struct vx_info *, void __user *);
12578 +#endif /* __KERNEL__ */
12580 +#define VCMD_virt_stat VC_CMD(VSTAT, 3, 0)
12582 +struct vcmd_virt_stat_v0 {
12585 + uint32_t nr_threads;
12586 + uint32_t nr_running;
12587 + uint32_t nr_uninterruptible;
12588 + uint32_t nr_onhold;
12589 + uint32_t nr_forks;
12590 + uint32_t load[3];
12594 +extern int vc_virt_stat(struct vx_info *, void __user *);
12596 +#endif /* __KERNEL__ */
12597 +#endif /* _VX_CVIRT_CMD_H */
12598 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/cvirt_def.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cvirt_def.h
12599 --- linux-2.6.33.2/include/linux/vserver/cvirt_def.h 1970-01-01 01:00:00.000000000 +0100
12600 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cvirt_def.h 2010-02-25 12:02:16.000000000 +0100
12602 +#ifndef _VX_CVIRT_DEF_H
12603 +#define _VX_CVIRT_DEF_H
12605 +#include <linux/jiffies.h>
12606 +#include <linux/spinlock.h>
12607 +#include <linux/wait.h>
12608 +#include <linux/time.h>
12609 +#include <asm/atomic.h>
12612 +struct _vx_usage_stat {
12616 + uint64_t softirq;
12622 +struct _vx_syslog {
12623 + wait_queue_head_t log_wait;
12624 + spinlock_t logbuf_lock; /* lock for the log buffer */
12626 + unsigned long log_start; /* next char to be read by syslog() */
12627 + unsigned long con_start; /* next char to be sent to consoles */
12628 + unsigned long log_end; /* most-recently-written-char + 1 */
12629 + unsigned long logged_chars; /* #chars since last read+clear operation */
12631 + char log_buf[1024];
12635 +/* context sub struct */
12637 +struct _vx_cvirt {
12638 + atomic_t nr_threads; /* number of current threads */
12639 + atomic_t nr_running; /* number of running threads */
12640 + atomic_t nr_uninterruptible; /* number of uninterruptible threads */
12642 + atomic_t nr_onhold; /* processes on hold */
12643 + uint32_t onhold_last; /* jiffies when put on hold */
12645 + struct timeval bias_tv; /* time offset to the host */
12646 + struct timespec bias_idle;
12647 + struct timespec bias_uptime; /* context creation point */
12648 + uint64_t bias_clock; /* offset in clock_t */
12650 + spinlock_t load_lock; /* lock for the load averages */
12651 + atomic_t load_updates; /* nr of load updates done so far */
12652 + uint32_t load_last; /* last time load was calculated */
12653 + uint32_t load[3]; /* load averages 1,5,15 */
12655 + atomic_t total_forks; /* number of forks so far */
12657 + struct _vx_syslog syslog;
12660 +struct _vx_cvirt_pc {
12661 + struct _vx_usage_stat cpustat;
12665 +#ifdef CONFIG_VSERVER_DEBUG
12667 +static inline void __dump_vx_cvirt(struct _vx_cvirt *cvirt)
12669 + printk("\t_vx_cvirt:\n");
12670 + printk("\t threads: %4d, %4d, %4d, %4d\n",
12671 + atomic_read(&cvirt->nr_threads),
12672 + atomic_read(&cvirt->nr_running),
12673 + atomic_read(&cvirt->nr_uninterruptible),
12674 + atomic_read(&cvirt->nr_onhold));
12675 + /* add rest here */
12676 + printk("\t total_forks = %d\n", atomic_read(&cvirt->total_forks));
12681 +#endif /* _VX_CVIRT_DEF_H */
12682 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/cvirt.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cvirt.h
12683 --- linux-2.6.33.2/include/linux/vserver/cvirt.h 1970-01-01 01:00:00.000000000 +0100
12684 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/cvirt.h 2010-02-25 12:02:16.000000000 +0100
12686 +#ifndef _VX_CVIRT_H
12687 +#define _VX_CVIRT_H
12694 +void vx_vsi_uptime(struct timespec *, struct timespec *);
12699 +void vx_update_load(struct vx_info *);
12702 +int vx_do_syslog(int, char __user *, int);
12704 +#endif /* __KERNEL__ */
12705 +#endif /* _VX_CVIRT_H */
12706 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/debug_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/debug_cmd.h
12707 --- linux-2.6.33.2/include/linux/vserver/debug_cmd.h 1970-01-01 01:00:00.000000000 +0100
12708 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/debug_cmd.h 2010-02-25 12:02:16.000000000 +0100
12710 +#ifndef _VX_DEBUG_CMD_H
12711 +#define _VX_DEBUG_CMD_H
12714 +/* debug commands */
12716 +#define VCMD_dump_history VC_CMD(DEBUG, 1, 0)
12718 +#define VCMD_read_history VC_CMD(DEBUG, 5, 0)
12719 +#define VCMD_read_monitor VC_CMD(DEBUG, 6, 0)
12721 +struct vcmd_read_history_v0 {
12724 + char __user *data;
12727 +struct vcmd_read_monitor_v0 {
12730 + char __user *data;
12736 +#ifdef CONFIG_COMPAT
12738 +#include <asm/compat.h>
12740 +struct vcmd_read_history_v0_x32 {
12743 + compat_uptr_t data_ptr;
12746 +struct vcmd_read_monitor_v0_x32 {
12749 + compat_uptr_t data_ptr;
12752 +#endif /* CONFIG_COMPAT */
12754 +extern int vc_dump_history(uint32_t);
12756 +extern int vc_read_history(uint32_t, void __user *);
12757 +extern int vc_read_monitor(uint32_t, void __user *);
12759 +#ifdef CONFIG_COMPAT
12761 +extern int vc_read_history_x32(uint32_t, void __user *);
12762 +extern int vc_read_monitor_x32(uint32_t, void __user *);
12764 +#endif /* CONFIG_COMPAT */
12766 +#endif /* __KERNEL__ */
12767 +#endif /* _VX_DEBUG_CMD_H */
12768 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/debug.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/debug.h
12769 --- linux-2.6.33.2/include/linux/vserver/debug.h 1970-01-01 01:00:00.000000000 +0100
12770 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/debug.h 2010-02-25 12:02:16.000000000 +0100
12772 +#ifndef _VX_DEBUG_H
12773 +#define _VX_DEBUG_H
12776 +#define VXD_CBIT(n, m) (vx_debug_ ## n & (1 << (m)))
12777 +#define VXD_CMIN(n, m) (vx_debug_ ## n > (m))
12778 +#define VXD_MASK(n, m) (vx_debug_ ## n & (m))
12780 +#define VXD_DEV(d) (d), (d)->bd_inode->i_ino, \
12781 + imajor((d)->bd_inode), iminor((d)->bd_inode)
12782 +#define VXF_DEV "%p[%lu,%d:%d]"
12785 +#define vxd_path(p) \
12786 + ({ static char _buffer[PATH_MAX]; \
12787 + d_path(p, _buffer, sizeof(_buffer)); })
12789 +#define vxd_cond_path(n) \
12790 + ((n) ? vxd_path(&(n)->path) : "<null>" )
12793 +#ifdef CONFIG_VSERVER_DEBUG
12795 +extern unsigned int vx_debug_switch;
12796 +extern unsigned int vx_debug_xid;
12797 +extern unsigned int vx_debug_nid;
12798 +extern unsigned int vx_debug_tag;
12799 +extern unsigned int vx_debug_net;
12800 +extern unsigned int vx_debug_limit;
12801 +extern unsigned int vx_debug_cres;
12802 +extern unsigned int vx_debug_dlim;
12803 +extern unsigned int vx_debug_quota;
12804 +extern unsigned int vx_debug_cvirt;
12805 +extern unsigned int vx_debug_space;
12806 +extern unsigned int vx_debug_misc;
12809 +#define VX_LOGLEVEL "vxD: "
12810 +#define VX_PROC_FMT "%p: "
12811 +#define VX_PROCESS current
12813 +#define vxdprintk(c, f, x...) \
12816 + printk(VX_LOGLEVEL VX_PROC_FMT f "\n", \
12817 + VX_PROCESS , ##x); \
12820 +#define vxlprintk(c, f, x...) \
12823 + printk(VX_LOGLEVEL f " @%s:%d\n", x); \
12826 +#define vxfprintk(c, f, x...) \
12829 + printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
12835 +void dump_vx_info(struct vx_info *, int);
12836 +void dump_vx_info_inactive(int);
12838 +#else /* CONFIG_VSERVER_DEBUG */
12840 +#define vx_debug_switch 0
12841 +#define vx_debug_xid 0
12842 +#define vx_debug_nid 0
12843 +#define vx_debug_tag 0
12844 +#define vx_debug_net 0
12845 +#define vx_debug_limit 0
12846 +#define vx_debug_cres 0
12847 +#define vx_debug_dlim 0
12848 +#define vx_debug_cvirt 0
12850 +#define vxdprintk(x...) do { } while (0)
12851 +#define vxlprintk(x...) do { } while (0)
12852 +#define vxfprintk(x...) do { } while (0)
12854 +#endif /* CONFIG_VSERVER_DEBUG */
12857 +#ifdef CONFIG_VSERVER_WARN
12859 +#define VX_WARNLEVEL KERN_WARNING "vxW: "
12860 +#define VX_WARN_TASK "[»%s«,%u:#%u|%u|%u] "
12861 +#define VX_WARN_XID "[xid #%u] "
12862 +#define VX_WARN_NID "[nid #%u] "
12863 +#define VX_WARN_TAG "[tag #%u] "
12865 +#define vxwprintk(c, f, x...) \
12868 + printk(VX_WARNLEVEL f "\n", ##x); \
12871 +#else /* CONFIG_VSERVER_WARN */
12873 +#define vxwprintk(x...) do { } while (0)
12875 +#endif /* CONFIG_VSERVER_WARN */
12877 +#define vxwprintk_task(c, f, x...) \
12878 + vxwprintk(c, VX_WARN_TASK f, \
12879 + current->comm, current->pid, \
12880 + current->xid, current->nid, current->tag, ##x)
12881 +#define vxwprintk_xid(c, f, x...) \
12882 + vxwprintk(c, VX_WARN_XID f, current->xid, x)
12883 +#define vxwprintk_nid(c, f, x...) \
12884 + vxwprintk(c, VX_WARN_NID f, current->nid, x)
12885 +#define vxwprintk_tag(c, f, x...) \
12886 + vxwprintk(c, VX_WARN_TAG f, current->tag, x)
12888 +#ifdef CONFIG_VSERVER_DEBUG
12889 +#define vxd_assert_lock(l) assert_spin_locked(l)
12890 +#define vxd_assert(c, f, x...) vxlprintk(!(c), \
12891 + "assertion [" f "] failed.", ##x, __FILE__, __LINE__)
12893 +#define vxd_assert_lock(l) do { } while (0)
12894 +#define vxd_assert(c, f, x...) do { } while (0)
12898 +#endif /* _VX_DEBUG_H */
12899 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/device_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/device_cmd.h
12900 --- linux-2.6.33.2/include/linux/vserver/device_cmd.h 1970-01-01 01:00:00.000000000 +0100
12901 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/device_cmd.h 2010-02-25 12:02:16.000000000 +0100
12903 +#ifndef _VX_DEVICE_CMD_H
12904 +#define _VX_DEVICE_CMD_H
12907 +/* device vserver commands */
12909 +#define VCMD_set_mapping VC_CMD(DEVICE, 1, 0)
12910 +#define VCMD_unset_mapping VC_CMD(DEVICE, 2, 0)
12912 +struct vcmd_set_mapping_v0 {
12913 + const char __user *device;
12914 + const char __user *target;
12921 +#ifdef CONFIG_COMPAT
12923 +#include <asm/compat.h>
12925 +struct vcmd_set_mapping_v0_x32 {
12926 + compat_uptr_t device_ptr;
12927 + compat_uptr_t target_ptr;
12931 +#endif /* CONFIG_COMPAT */
12933 +#include <linux/compiler.h>
12935 +extern int vc_set_mapping(struct vx_info *, void __user *);
12936 +extern int vc_unset_mapping(struct vx_info *, void __user *);
12938 +#ifdef CONFIG_COMPAT
12940 +extern int vc_set_mapping_x32(struct vx_info *, void __user *);
12941 +extern int vc_unset_mapping_x32(struct vx_info *, void __user *);
12943 +#endif /* CONFIG_COMPAT */
12945 +#endif /* __KERNEL__ */
12946 +#endif /* _VX_DEVICE_CMD_H */
12947 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/device_def.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/device_def.h
12948 --- linux-2.6.33.2/include/linux/vserver/device_def.h 1970-01-01 01:00:00.000000000 +0100
12949 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/device_def.h 2010-02-25 12:02:16.000000000 +0100
12951 +#ifndef _VX_DEVICE_DEF_H
12952 +#define _VX_DEVICE_DEF_H
12954 +#include <linux/types.h>
12956 +struct vx_dmap_target {
12961 +struct _vx_device {
12962 +#ifdef CONFIG_VSERVER_DEVICE
12963 + struct vx_dmap_target targets[2];
12967 +#endif /* _VX_DEVICE_DEF_H */
12968 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/device.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/device.h
12969 --- linux-2.6.33.2/include/linux/vserver/device.h 1970-01-01 01:00:00.000000000 +0100
12970 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/device.h 2010-02-25 12:02:16.000000000 +0100
12972 +#ifndef _VX_DEVICE_H
12973 +#define _VX_DEVICE_H
12976 +#define DATTR_CREATE 0x00000001
12977 +#define DATTR_OPEN 0x00000002
12979 +#define DATTR_REMAP 0x00000010
12981 +#define DATTR_MASK 0x00000013
12984 +#else /* _VX_DEVICE_H */
12985 +#warning duplicate inclusion
12986 +#endif /* _VX_DEVICE_H */
12987 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/dlimit_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/dlimit_cmd.h
12988 --- linux-2.6.33.2/include/linux/vserver/dlimit_cmd.h 1970-01-01 01:00:00.000000000 +0100
12989 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/dlimit_cmd.h 2010-02-25 12:02:16.000000000 +0100
12991 +#ifndef _VX_DLIMIT_CMD_H
12992 +#define _VX_DLIMIT_CMD_H
12995 +/* dlimit vserver commands */
12997 +#define VCMD_add_dlimit VC_CMD(DLIMIT, 1, 0)
12998 +#define VCMD_rem_dlimit VC_CMD(DLIMIT, 2, 0)
13000 +#define VCMD_set_dlimit VC_CMD(DLIMIT, 5, 0)
13001 +#define VCMD_get_dlimit VC_CMD(DLIMIT, 6, 0)
13003 +struct vcmd_ctx_dlimit_base_v0 {
13004 + const char __user *name;
13008 +struct vcmd_ctx_dlimit_v0 {
13009 + const char __user *name;
13010 + uint32_t space_used; /* used space in kbytes */
13011 + uint32_t space_total; /* maximum space in kbytes */
13012 + uint32_t inodes_used; /* used inodes */
13013 + uint32_t inodes_total; /* maximum inodes */
13014 + uint32_t reserved; /* reserved for root in % */
13018 +#define CDLIM_UNSET ((uint32_t)0UL)
13019 +#define CDLIM_INFINITY ((uint32_t)~0UL)
13020 +#define CDLIM_KEEP ((uint32_t)~1UL)
13022 +#define DLIME_UNIT 0
13023 +#define DLIME_KILO 1
13024 +#define DLIME_MEGA 2
13025 +#define DLIME_GIGA 3
13027 +#define DLIMF_SHIFT 0x10
13029 +#define DLIMS_USED 0
13030 +#define DLIMS_TOTAL 2
13033 +uint64_t dlimit_space_32to64(uint32_t val, uint32_t flags, int shift)
13035 + int exp = (flags & DLIMF_SHIFT) ?
13036 + (flags >> shift) & DLIME_GIGA : DLIME_KILO;
13037 + return ((uint64_t)val) << (10 * exp);
13041 +uint32_t dlimit_space_64to32(uint64_t val, uint32_t *flags, int shift)
13045 + if (*flags & DLIMF_SHIFT) {
13046 + while (val > (1LL << 32) && (exp < 3)) {
13050 + *flags &= ~(DLIME_GIGA << shift);
13051 + *flags |= exp << shift;
13059 +#ifdef CONFIG_COMPAT
13061 +#include <asm/compat.h>
13063 +struct vcmd_ctx_dlimit_base_v0_x32 {
13064 + compat_uptr_t name_ptr;
13068 +struct vcmd_ctx_dlimit_v0_x32 {
13069 + compat_uptr_t name_ptr;
13070 + uint32_t space_used; /* used space in kbytes */
13071 + uint32_t space_total; /* maximum space in kbytes */
13072 + uint32_t inodes_used; /* used inodes */
13073 + uint32_t inodes_total; /* maximum inodes */
13074 + uint32_t reserved; /* reserved for root in % */
13078 +#endif /* CONFIG_COMPAT */
13080 +#include <linux/compiler.h>
13082 +extern int vc_add_dlimit(uint32_t, void __user *);
13083 +extern int vc_rem_dlimit(uint32_t, void __user *);
13085 +extern int vc_set_dlimit(uint32_t, void __user *);
13086 +extern int vc_get_dlimit(uint32_t, void __user *);
13088 +#ifdef CONFIG_COMPAT
13090 +extern int vc_add_dlimit_x32(uint32_t, void __user *);
13091 +extern int vc_rem_dlimit_x32(uint32_t, void __user *);
13093 +extern int vc_set_dlimit_x32(uint32_t, void __user *);
13094 +extern int vc_get_dlimit_x32(uint32_t, void __user *);
13096 +#endif /* CONFIG_COMPAT */
13098 +#endif /* __KERNEL__ */
13099 +#endif /* _VX_DLIMIT_CMD_H */
13100 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/dlimit.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/dlimit.h
13101 --- linux-2.6.33.2/include/linux/vserver/dlimit.h 1970-01-01 01:00:00.000000000 +0100
13102 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/dlimit.h 2010-02-25 12:02:16.000000000 +0100
13104 +#ifndef _VX_DLIMIT_H
13105 +#define _VX_DLIMIT_H
13107 +#include "switch.h"
13112 +/* keep in sync with CDLIM_INFINITY */
13114 +#define DLIM_INFINITY (~0ULL)
13116 +#include <linux/spinlock.h>
13117 +#include <linux/rcupdate.h>
13119 +struct super_block;
13122 + struct hlist_node dl_hlist; /* linked list of contexts */
13123 + struct rcu_head dl_rcu; /* the rcu head */
13124 + tag_t dl_tag; /* context tag */
13125 + atomic_t dl_usecnt; /* usage count */
13126 + atomic_t dl_refcnt; /* reference count */
13128 + struct super_block *dl_sb; /* associated superblock */
13130 + spinlock_t dl_lock; /* protect the values */
13132 + unsigned long long dl_space_used; /* used space in bytes */
13133 + unsigned long long dl_space_total; /* maximum space in bytes */
13134 + unsigned long dl_inodes_used; /* used inodes */
13135 + unsigned long dl_inodes_total; /* maximum inodes */
13137 + unsigned int dl_nrlmult; /* non root limit mult */
13142 +extern void rcu_free_dl_info(struct rcu_head *);
13143 +extern void unhash_dl_info(struct dl_info *);
13145 +extern struct dl_info *locate_dl_info(struct super_block *, tag_t);
13150 +extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
13152 +typedef uint64_t dlsize_t;
13154 +#endif /* __KERNEL__ */
13155 +#else /* _VX_DLIMIT_H */
13156 +#warning duplicate inclusion
13157 +#endif /* _VX_DLIMIT_H */
13158 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/global.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/global.h
13159 --- linux-2.6.33.2/include/linux/vserver/global.h 1970-01-01 01:00:00.000000000 +0100
13160 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/global.h 2010-02-25 12:02:16.000000000 +0100
13162 +#ifndef _VX_GLOBAL_H
13163 +#define _VX_GLOBAL_H
13166 +extern atomic_t vx_global_ctotal;
13167 +extern atomic_t vx_global_cactive;
13169 +extern atomic_t nx_global_ctotal;
13170 +extern atomic_t nx_global_cactive;
13172 +extern atomic_t vs_global_nsproxy;
13173 +extern atomic_t vs_global_fs;
13174 +extern atomic_t vs_global_mnt_ns;
13175 +extern atomic_t vs_global_uts_ns;
13176 +extern atomic_t vs_global_user_ns;
13177 +extern atomic_t vs_global_pid_ns;
13180 +#endif /* _VX_GLOBAL_H */
13181 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/history.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/history.h
13182 --- linux-2.6.33.2/include/linux/vserver/history.h 1970-01-01 01:00:00.000000000 +0100
13183 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/history.h 2010-02-25 12:02:16.000000000 +0100
13185 +#ifndef _VX_HISTORY_H
13186 +#define _VX_HISTORY_H
13191 + VXH_THROW_OOPS = 1,
13195 + VXH_INIT_VX_INFO,
13198 + VXH_CLAIM_VX_INFO,
13199 + VXH_RELEASE_VX_INFO,
13200 + VXH_ALLOC_VX_INFO,
13201 + VXH_DEALLOC_VX_INFO,
13202 + VXH_HASH_VX_INFO,
13203 + VXH_UNHASH_VX_INFO,
13205 + VXH_LOOKUP_VX_INFO,
13206 + VXH_CREATE_VX_INFO,
13209 +struct _vxhe_vxi {
13210 + struct vx_info *ptr;
13216 +struct _vxhe_set_clr {
13220 +struct _vxhe_loc_lookup {
13224 +struct _vx_hist_entry {
13226 + unsigned short seq;
13227 + unsigned short type;
13228 + struct _vxhe_vxi vxi;
13230 + struct _vxhe_set_clr sc;
13231 + struct _vxhe_loc_lookup ll;
13235 +#ifdef CONFIG_VSERVER_HISTORY
13237 +extern unsigned volatile int vxh_active;
13239 +struct _vx_hist_entry *vxh_advance(void *loc);
13243 +void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
13245 + entry->vxi.ptr = vxi;
13247 + entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
13248 + entry->vxi.tasks = atomic_read(&vxi->vx_tasks);
13249 + entry->vxi.xid = vxi->vx_id;
13254 +#define __HERE__ current_text_addr()
13256 +#define __VXH_BODY(__type, __data, __here) \
13257 + struct _vx_hist_entry *entry; \
13259 + preempt_disable(); \
13260 + entry = vxh_advance(__here); \
13262 + entry->type = __type; \
13263 + preempt_enable();
13266 + /* pass vxi only */
13268 +#define __VXH_SMPL \
13269 + __vxh_copy_vxi(entry, vxi)
13272 +void __vxh_smpl(struct vx_info *vxi, int __type, void *__here)
13274 + __VXH_BODY(__type, __VXH_SMPL, __here)
13277 + /* pass vxi and data (void *) */
13279 +#define __VXH_DATA \
13280 + __vxh_copy_vxi(entry, vxi); \
13281 + entry->sc.data = data
13284 +void __vxh_data(struct vx_info *vxi, void *data,
13285 + int __type, void *__here)
13287 + __VXH_BODY(__type, __VXH_DATA, __here)
13290 + /* pass vxi and arg (long) */
13292 +#define __VXH_LONG \
13293 + __vxh_copy_vxi(entry, vxi); \
13294 + entry->ll.arg = arg
13297 +void __vxh_long(struct vx_info *vxi, long arg,
13298 + int __type, void *__here)
13300 + __VXH_BODY(__type, __VXH_LONG, __here)
13305 +void __vxh_throw_oops(void *__here)
13307 + __VXH_BODY(VXH_THROW_OOPS, {}, __here);
13308 + /* prevent further acquisition */
13313 +#define vxh_throw_oops() __vxh_throw_oops(__HERE__);
13315 +#define __vxh_get_vx_info(v, h) __vxh_smpl(v, VXH_GET_VX_INFO, h);
13316 +#define __vxh_put_vx_info(v, h) __vxh_smpl(v, VXH_PUT_VX_INFO, h);
13318 +#define __vxh_init_vx_info(v, d, h) \
13319 + __vxh_data(v, d, VXH_INIT_VX_INFO, h);
13320 +#define __vxh_set_vx_info(v, d, h) \
13321 + __vxh_data(v, d, VXH_SET_VX_INFO, h);
13322 +#define __vxh_clr_vx_info(v, d, h) \
13323 + __vxh_data(v, d, VXH_CLR_VX_INFO, h);
13325 +#define __vxh_claim_vx_info(v, d, h) \
13326 + __vxh_data(v, d, VXH_CLAIM_VX_INFO, h);
13327 +#define __vxh_release_vx_info(v, d, h) \
13328 + __vxh_data(v, d, VXH_RELEASE_VX_INFO, h);
13330 +#define vxh_alloc_vx_info(v) \
13331 + __vxh_smpl(v, VXH_ALLOC_VX_INFO, __HERE__);
13332 +#define vxh_dealloc_vx_info(v) \
13333 + __vxh_smpl(v, VXH_DEALLOC_VX_INFO, __HERE__);
13335 +#define vxh_hash_vx_info(v) \
13336 + __vxh_smpl(v, VXH_HASH_VX_INFO, __HERE__);
13337 +#define vxh_unhash_vx_info(v) \
13338 + __vxh_smpl(v, VXH_UNHASH_VX_INFO, __HERE__);
13340 +#define vxh_loc_vx_info(v, l) \
13341 + __vxh_long(v, l, VXH_LOC_VX_INFO, __HERE__);
13342 +#define vxh_lookup_vx_info(v, l) \
13343 + __vxh_long(v, l, VXH_LOOKUP_VX_INFO, __HERE__);
13344 +#define vxh_create_vx_info(v, l) \
13345 + __vxh_long(v, l, VXH_CREATE_VX_INFO, __HERE__);
13347 +extern void vxh_dump_history(void);
13350 +#else /* CONFIG_VSERVER_HISTORY */
13352 +#define __HERE__ 0
13354 +#define vxh_throw_oops() do { } while (0)
13356 +#define __vxh_get_vx_info(v, h) do { } while (0)
13357 +#define __vxh_put_vx_info(v, h) do { } while (0)
13359 +#define __vxh_init_vx_info(v, d, h) do { } while (0)
13360 +#define __vxh_set_vx_info(v, d, h) do { } while (0)
13361 +#define __vxh_clr_vx_info(v, d, h) do { } while (0)
13363 +#define __vxh_claim_vx_info(v, d, h) do { } while (0)
13364 +#define __vxh_release_vx_info(v, d, h) do { } while (0)
13366 +#define vxh_alloc_vx_info(v) do { } while (0)
13367 +#define vxh_dealloc_vx_info(v) do { } while (0)
13369 +#define vxh_hash_vx_info(v) do { } while (0)
13370 +#define vxh_unhash_vx_info(v) do { } while (0)
13372 +#define vxh_loc_vx_info(v, l) do { } while (0)
13373 +#define vxh_lookup_vx_info(v, l) do { } while (0)
13374 +#define vxh_create_vx_info(v, l) do { } while (0)
13376 +#define vxh_dump_history() do { } while (0)
13379 +#endif /* CONFIG_VSERVER_HISTORY */
13381 +#endif /* _VX_HISTORY_H */
13382 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/inode_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/inode_cmd.h
13383 --- linux-2.6.33.2/include/linux/vserver/inode_cmd.h 1970-01-01 01:00:00.000000000 +0100
13384 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/inode_cmd.h 2010-02-25 12:02:16.000000000 +0100
13386 +#ifndef _VX_INODE_CMD_H
13387 +#define _VX_INODE_CMD_H
13390 +/* inode vserver commands */
13392 +#define VCMD_get_iattr VC_CMD(INODE, 1, 1)
13393 +#define VCMD_set_iattr VC_CMD(INODE, 2, 1)
13395 +#define VCMD_fget_iattr VC_CMD(INODE, 3, 0)
13396 +#define VCMD_fset_iattr VC_CMD(INODE, 4, 0)
13398 +struct vcmd_ctx_iattr_v1 {
13399 + const char __user *name;
13405 +struct vcmd_ctx_fiattr_v0 {
13415 +#ifdef CONFIG_COMPAT
13417 +#include <asm/compat.h>
13419 +struct vcmd_ctx_iattr_v1_x32 {
13420 + compat_uptr_t name_ptr;
13426 +#endif /* CONFIG_COMPAT */
13428 +#include <linux/compiler.h>
13430 +extern int vc_get_iattr(void __user *);
13431 +extern int vc_set_iattr(void __user *);
13433 +extern int vc_fget_iattr(uint32_t, void __user *);
13434 +extern int vc_fset_iattr(uint32_t, void __user *);
13436 +#ifdef CONFIG_COMPAT
13438 +extern int vc_get_iattr_x32(void __user *);
13439 +extern int vc_set_iattr_x32(void __user *);
13441 +#endif /* CONFIG_COMPAT */
13443 +#endif /* __KERNEL__ */
13444 +#endif /* _VX_INODE_CMD_H */
13445 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/inode.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/inode.h
13446 --- linux-2.6.33.2/include/linux/vserver/inode.h 1970-01-01 01:00:00.000000000 +0100
13447 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/inode.h 2010-02-25 12:02:16.000000000 +0100
13449 +#ifndef _VX_INODE_H
13450 +#define _VX_INODE_H
13453 +#define IATTR_TAG 0x01000000
13455 +#define IATTR_ADMIN 0x00000001
13456 +#define IATTR_WATCH 0x00000002
13457 +#define IATTR_HIDE 0x00000004
13458 +#define IATTR_FLAGS 0x00000007
13460 +#define IATTR_BARRIER 0x00010000
13461 +#define IATTR_IXUNLINK 0x00020000
13462 +#define IATTR_IMMUTABLE 0x00040000
13463 +#define IATTR_COW 0x00080000
13468 +#ifdef CONFIG_VSERVER_PROC_SECURE
13469 +#define IATTR_PROC_DEFAULT ( IATTR_ADMIN | IATTR_HIDE )
13470 +#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
13472 +#define IATTR_PROC_DEFAULT ( IATTR_ADMIN )
13473 +#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
13476 +#define vx_hide_check(c, m) (((m) & IATTR_HIDE) ? vx_check(c, m) : 1)
13478 +#endif /* __KERNEL__ */
13480 +/* inode ioctls */
13482 +#define FIOC_GETXFLG _IOR('x', 5, long)
13483 +#define FIOC_SETXFLG _IOW('x', 6, long)
13485 +#else /* _VX_INODE_H */
13486 +#warning duplicate inclusion
13487 +#endif /* _VX_INODE_H */
13488 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/Kbuild linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/Kbuild
13489 --- linux-2.6.33.2/include/linux/vserver/Kbuild 1970-01-01 01:00:00.000000000 +0100
13490 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/Kbuild 2010-02-25 12:02:16.000000000 +0100
13493 +unifdef-y += context_cmd.h network_cmd.h space_cmd.h \
13494 + cacct_cmd.h cvirt_cmd.h limit_cmd.h dlimit_cmd.h \
13495 + inode_cmd.h tag_cmd.h sched_cmd.h signal_cmd.h \
13496 + debug_cmd.h device_cmd.h
13498 +unifdef-y += switch.h network.h monitor.h inode.h device.h
13500 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/limit_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/limit_cmd.h
13501 --- linux-2.6.33.2/include/linux/vserver/limit_cmd.h 1970-01-01 01:00:00.000000000 +0100
13502 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/limit_cmd.h 2010-02-25 12:02:16.000000000 +0100
13504 +#ifndef _VX_LIMIT_CMD_H
13505 +#define _VX_LIMIT_CMD_H
13508 +/* rlimit vserver commands */
13510 +#define VCMD_get_rlimit VC_CMD(RLIMIT, 1, 0)
13511 +#define VCMD_set_rlimit VC_CMD(RLIMIT, 2, 0)
13512 +#define VCMD_get_rlimit_mask VC_CMD(RLIMIT, 3, 0)
13513 +#define VCMD_reset_hits VC_CMD(RLIMIT, 7, 0)
13514 +#define VCMD_reset_minmax VC_CMD(RLIMIT, 9, 0)
13516 +struct vcmd_ctx_rlimit_v0 {
13518 + uint64_t minimum;
13519 + uint64_t softlimit;
13520 + uint64_t maximum;
13523 +struct vcmd_ctx_rlimit_mask_v0 {
13524 + uint32_t minimum;
13525 + uint32_t softlimit;
13526 + uint32_t maximum;
13529 +#define VCMD_rlimit_stat VC_CMD(VSTAT, 1, 0)
13531 +struct vcmd_rlimit_stat_v0 {
13535 + uint64_t minimum;
13536 + uint64_t maximum;
13539 +#define CRLIM_UNSET (0ULL)
13540 +#define CRLIM_INFINITY (~0ULL)
13541 +#define CRLIM_KEEP (~1ULL)
13545 +#ifdef CONFIG_IA32_EMULATION
13547 +struct vcmd_ctx_rlimit_v0_x32 {
13549 + uint64_t minimum;
13550 + uint64_t softlimit;
13551 + uint64_t maximum;
13552 +} __attribute__ ((packed));
13554 +#endif /* CONFIG_IA32_EMULATION */
13556 +#include <linux/compiler.h>
13558 +extern int vc_get_rlimit_mask(uint32_t, void __user *);
13559 +extern int vc_get_rlimit(struct vx_info *, void __user *);
13560 +extern int vc_set_rlimit(struct vx_info *, void __user *);
13561 +extern int vc_reset_hits(struct vx_info *, void __user *);
13562 +extern int vc_reset_minmax(struct vx_info *, void __user *);
13564 +extern int vc_rlimit_stat(struct vx_info *, void __user *);
13566 +#ifdef CONFIG_IA32_EMULATION
13568 +extern int vc_get_rlimit_x32(struct vx_info *, void __user *);
13569 +extern int vc_set_rlimit_x32(struct vx_info *, void __user *);
13571 +#endif /* CONFIG_IA32_EMULATION */
13573 +#endif /* __KERNEL__ */
13574 +#endif /* _VX_LIMIT_CMD_H */
13575 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/limit_def.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/limit_def.h
13576 --- linux-2.6.33.2/include/linux/vserver/limit_def.h 1970-01-01 01:00:00.000000000 +0100
13577 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/limit_def.h 2010-02-25 12:02:16.000000000 +0100
13579 +#ifndef _VX_LIMIT_DEF_H
13580 +#define _VX_LIMIT_DEF_H
13582 +#include <asm/atomic.h>
13583 +#include <asm/resource.h>
13585 +#include "limit.h"
13588 +struct _vx_res_limit {
13589 + rlim_t soft; /* Context soft limit */
13590 + rlim_t hard; /* Context hard limit */
13592 + rlim_atomic_t rcur; /* Current value */
13593 + rlim_t rmin; /* Context minimum */
13594 + rlim_t rmax; /* Context maximum */
13596 + atomic_t lhit; /* Limit hits */
13599 +/* context sub struct */
13601 +struct _vx_limit {
13602 + struct _vx_res_limit res[NUM_LIMITS];
13605 +#ifdef CONFIG_VSERVER_DEBUG
13607 +static inline void __dump_vx_limit(struct _vx_limit *limit)
13611 + printk("\t_vx_limit:");
13612 + for (i = 0; i < NUM_LIMITS; i++) {
13613 + printk("\t [%2d] = %8lu %8lu/%8lu, %8ld/%8ld, %8d\n",
13614 + i, (unsigned long)__rlim_get(limit, i),
13615 + (unsigned long)__rlim_rmin(limit, i),
13616 + (unsigned long)__rlim_rmax(limit, i),
13617 + (long)__rlim_soft(limit, i),
13618 + (long)__rlim_hard(limit, i),
13619 + atomic_read(&__rlim_lhit(limit, i)));
13625 +#endif /* _VX_LIMIT_DEF_H */
13626 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/limit.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/limit.h
13627 --- linux-2.6.33.2/include/linux/vserver/limit.h 1970-01-01 01:00:00.000000000 +0100
13628 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/limit.h 2010-02-25 12:02:16.000000000 +0100
13630 +#ifndef _VX_LIMIT_H
13631 +#define _VX_LIMIT_H
13633 +#define VLIMIT_NSOCK 16
13634 +#define VLIMIT_OPENFD 17
13635 +#define VLIMIT_ANON 18
13636 +#define VLIMIT_SHMEM 19
13637 +#define VLIMIT_SEMARY 20
13638 +#define VLIMIT_NSEMS 21
13639 +#define VLIMIT_DENTRY 22
13640 +#define VLIMIT_MAPPED 23
13645 +#define VLIM_NOCHECK ((1L << VLIMIT_DENTRY) | (1L << RLIMIT_RSS))
13647 +/* keep in sync with CRLIM_INFINITY */
13649 +#define VLIM_INFINITY (~0ULL)
13651 +#include <asm/atomic.h>
13652 +#include <asm/resource.h>
13654 +#ifndef RLIM_INFINITY
13655 +#warning RLIM_INFINITY is undefined
13658 +#define __rlim_val(l, r, v) ((l)->res[r].v)
13660 +#define __rlim_soft(l, r) __rlim_val(l, r, soft)
13661 +#define __rlim_hard(l, r) __rlim_val(l, r, hard)
13663 +#define __rlim_rcur(l, r) __rlim_val(l, r, rcur)
13664 +#define __rlim_rmin(l, r) __rlim_val(l, r, rmin)
13665 +#define __rlim_rmax(l, r) __rlim_val(l, r, rmax)
13667 +#define __rlim_lhit(l, r) __rlim_val(l, r, lhit)
13668 +#define __rlim_hit(l, r) atomic_inc(&__rlim_lhit(l, r))
13670 +typedef atomic_long_t rlim_atomic_t;
13671 +typedef unsigned long rlim_t;
13673 +#define __rlim_get(l, r) atomic_long_read(&__rlim_rcur(l, r))
13674 +#define __rlim_set(l, r, v) atomic_long_set(&__rlim_rcur(l, r), v)
13675 +#define __rlim_inc(l, r) atomic_long_inc(&__rlim_rcur(l, r))
13676 +#define __rlim_dec(l, r) atomic_long_dec(&__rlim_rcur(l, r))
13677 +#define __rlim_add(l, r, v) atomic_long_add(v, &__rlim_rcur(l, r))
13678 +#define __rlim_sub(l, r, v) atomic_long_sub(v, &__rlim_rcur(l, r))
13681 +#if (RLIM_INFINITY == VLIM_INFINITY)
13682 +#define VX_VLIM(r) ((long long)(long)(r))
13683 +#define VX_RLIM(v) ((rlim_t)(v))
13685 +#define VX_VLIM(r) (((r) == RLIM_INFINITY) \
13686 + ? VLIM_INFINITY : (long long)(r))
13687 +#define VX_RLIM(v) (((v) == VLIM_INFINITY) \
13688 + ? RLIM_INFINITY : (rlim_t)(v))
13693 +void vx_vsi_meminfo(struct sysinfo *);
13694 +void vx_vsi_swapinfo(struct sysinfo *);
13695 +long vx_vsi_cached(struct sysinfo *);
13697 +#define NUM_LIMITS 24
13699 +#endif /* __KERNEL__ */
13700 +#endif /* _VX_LIMIT_H */
13701 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/limit_int.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/limit_int.h
13702 --- linux-2.6.33.2/include/linux/vserver/limit_int.h 1970-01-01 01:00:00.000000000 +0100
13703 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/limit_int.h 2010-02-25 12:02:16.000000000 +0100
13705 +#ifndef _VX_LIMIT_INT_H
13706 +#define _VX_LIMIT_INT_H
13708 +#include "context.h"
13712 +#define VXD_RCRES_COND(r) VXD_CBIT(cres, r)
13713 +#define VXD_RLIMIT_COND(r) VXD_CBIT(limit, r)
13715 +extern const char *vlimit_name[NUM_LIMITS];
13717 +static inline void __vx_acc_cres(struct vx_info *vxi,
13718 + int res, int dir, void *_data, char *_file, int _line)
13720 + if (VXD_RCRES_COND(res))
13721 + vxlprintk(1, "vx_acc_cres[%5d,%s,%2d]: %5ld%s (%p)",
13722 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13723 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13724 + (dir > 0) ? "++" : "--", _data, _file, _line);
13729 + __rlim_inc(&vxi->limit, res);
13731 + __rlim_dec(&vxi->limit, res);
13734 +static inline void __vx_add_cres(struct vx_info *vxi,
13735 + int res, int amount, void *_data, char *_file, int _line)
13737 + if (VXD_RCRES_COND(res))
13738 + vxlprintk(1, "vx_add_cres[%5d,%s,%2d]: %5ld += %5d (%p)",
13739 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13740 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13741 + amount, _data, _file, _line);
13746 + __rlim_add(&vxi->limit, res, amount);
13750 +int __vx_cres_adjust_max(struct _vx_limit *limit, int res, rlim_t value)
13752 + int cond = (value > __rlim_rmax(limit, res));
13755 + __rlim_rmax(limit, res) = value;
13760 +int __vx_cres_adjust_min(struct _vx_limit *limit, int res, rlim_t value)
13762 + int cond = (value < __rlim_rmin(limit, res));
13765 + __rlim_rmin(limit, res) = value;
13770 +void __vx_cres_fixup(struct _vx_limit *limit, int res, rlim_t value)
13772 + if (!__vx_cres_adjust_max(limit, res, value))
13773 + __vx_cres_adjust_min(limit, res, value);
13778 + +1 ... no limit hit
13779 + -1 ... over soft limit
13780 + 0 ... over hard limit */
13782 +static inline int __vx_cres_avail(struct vx_info *vxi,
13783 + int res, int num, char *_file, int _line)
13785 + struct _vx_limit *limit;
13788 + if (VXD_RLIMIT_COND(res))
13789 + vxlprintk(1, "vx_cres_avail[%5d,%s,%2d]: %5ld/%5ld > %5ld + %5d",
13790 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13791 + (vxi ? (long)__rlim_soft(&vxi->limit, res) : -1),
13792 + (vxi ? (long)__rlim_hard(&vxi->limit, res) : -1),
13793 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13794 + num, _file, _line);
13798 + limit = &vxi->limit;
13799 + value = __rlim_get(limit, res);
13801 + if (!__vx_cres_adjust_max(limit, res, value))
13802 + __vx_cres_adjust_min(limit, res, value);
13807 + if (__rlim_soft(limit, res) == RLIM_INFINITY)
13809 + if (value + num <= __rlim_soft(limit, res))
13812 + if (__rlim_hard(limit, res) == RLIM_INFINITY)
13814 + if (value + num <= __rlim_hard(limit, res))
13817 + __rlim_hit(limit, res);
13822 +static const int VLA_RSS[] = { RLIMIT_RSS, VLIMIT_ANON, VLIMIT_MAPPED, 0 };
13825 +rlim_t __vx_cres_array_sum(struct _vx_limit *limit, const int *array)
13827 + rlim_t value, sum = 0;
13830 + while ((res = *array++)) {
13831 + value = __rlim_get(limit, res);
13832 + __vx_cres_fixup(limit, res, value);
13839 +rlim_t __vx_cres_array_fixup(struct _vx_limit *limit, const int *array)
13841 + rlim_t value = __vx_cres_array_sum(limit, array + 1);
13842 + int res = *array;
13844 + if (value == __rlim_get(limit, res))
13847 + __rlim_set(limit, res, value);
13848 + /* now adjust min/max */
13849 + if (!__vx_cres_adjust_max(limit, res, value))
13850 + __vx_cres_adjust_min(limit, res, value);
13855 +static inline int __vx_cres_array_avail(struct vx_info *vxi,
13856 + const int *array, int num, char *_file, int _line)
13858 + struct _vx_limit *limit;
13859 + rlim_t value = 0;
13867 + limit = &vxi->limit;
13869 + value = __vx_cres_array_sum(limit, array + 1);
13871 + __rlim_set(limit, res, value);
13872 + __vx_cres_fixup(limit, res, value);
13874 + return __vx_cres_avail(vxi, res, num, _file, _line);
13878 +static inline void vx_limit_fixup(struct _vx_limit *limit, int id)
13883 + /* complex resources first */
13884 + if ((id < 0) || (id == RLIMIT_RSS))
13885 + __vx_cres_array_fixup(limit, VLA_RSS);
13887 + for (res = 0; res < NUM_LIMITS; res++) {
13888 + if ((id > 0) && (res != id))
13891 + value = __rlim_get(limit, res);
13892 + __vx_cres_fixup(limit, res, value);
13894 + /* not supposed to happen, maybe warn? */
13895 + if (__rlim_rmax(limit, res) > __rlim_hard(limit, res))
13896 + __rlim_rmax(limit, res) = __rlim_hard(limit, res);
13901 +#endif /* __KERNEL__ */
13902 +#endif /* _VX_LIMIT_INT_H */
13903 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/monitor.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/monitor.h
13904 --- linux-2.6.33.2/include/linux/vserver/monitor.h 1970-01-01 01:00:00.000000000 +0100
13905 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/monitor.h 2010-02-25 12:02:16.000000000 +0100
13907 +#ifndef _VX_MONITOR_H
13908 +#define _VX_MONITOR_H
13910 +#include <linux/types.h>
13917 + VXM_UPDATE = 0x20,
13921 + VXM_RQINFO_1 = 0x24,
13924 + VXM_ACTIVATE = 0x40,
13931 + VXM_MIGRATE = 0x48,
13934 + /* all other bits are flags */
13935 + VXM_SCHED = 0x80,
13938 +struct _vxm_update_1 {
13939 + uint32_t tokens_max;
13940 + uint32_t fill_rate;
13941 + uint32_t interval;
13944 +struct _vxm_update_2 {
13945 + uint32_t tokens_min;
13946 + uint32_t fill_rate;
13947 + uint32_t interval;
13950 +struct _vxm_rqinfo_1 {
13951 + uint16_t running;
13955 + uint32_t idle_tokens;
13958 +struct _vxm_rqinfo_2 {
13959 + uint32_t norm_time;
13960 + uint32_t idle_time;
13961 + uint32_t idle_skip;
13964 +struct _vxm_sched {
13966 + uint32_t norm_time;
13967 + uint32_t idle_time;
13970 +struct _vxm_task {
13975 +struct _vxm_event {
13984 + struct _vxm_task tsk;
13988 +struct _vx_mon_entry {
13992 + struct _vxm_event ev;
13993 + struct _vxm_sched sd;
13994 + struct _vxm_update_1 u1;
13995 + struct _vxm_update_2 u2;
13996 + struct _vxm_rqinfo_1 q1;
13997 + struct _vxm_rqinfo_2 q2;
14002 +#endif /* _VX_MONITOR_H */
14003 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/network_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/network_cmd.h
14004 --- linux-2.6.33.2/include/linux/vserver/network_cmd.h 1970-01-01 01:00:00.000000000 +0100
14005 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/network_cmd.h 2010-02-25 12:02:16.000000000 +0100
14007 +#ifndef _VX_NETWORK_CMD_H
14008 +#define _VX_NETWORK_CMD_H
14011 +/* vinfo commands */
14013 +#define VCMD_task_nid VC_CMD(VINFO, 2, 0)
14016 +extern int vc_task_nid(uint32_t);
14018 +#endif /* __KERNEL__ */
14020 +#define VCMD_nx_info VC_CMD(VINFO, 6, 0)
14022 +struct vcmd_nx_info_v0 {
14024 + /* more to come */
14028 +extern int vc_nx_info(struct nx_info *, void __user *);
14030 +#endif /* __KERNEL__ */
14032 +#include <linux/in.h>
14033 +#include <linux/in6.h>
14035 +#define VCMD_net_create_v0 VC_CMD(VNET, 1, 0)
14036 +#define VCMD_net_create VC_CMD(VNET, 1, 1)
14038 +struct vcmd_net_create {
14039 + uint64_t flagword;
14042 +#define VCMD_net_migrate VC_CMD(NETMIG, 1, 0)
14044 +#define VCMD_net_add VC_CMD(NETALT, 1, 0)
14045 +#define VCMD_net_remove VC_CMD(NETALT, 2, 0)
14047 +struct vcmd_net_addr_v0 {
14050 + struct in_addr ip[4];
14051 + struct in_addr mask[4];
14054 +#define VCMD_net_add_ipv4 VC_CMD(NETALT, 1, 1)
14055 +#define VCMD_net_remove_ipv4 VC_CMD(NETALT, 2, 1)
14057 +struct vcmd_net_addr_ipv4_v1 {
14060 + struct in_addr ip;
14061 + struct in_addr mask;
14064 +#define VCMD_net_add_ipv6 VC_CMD(NETALT, 3, 1)
14065 +#define VCMD_net_remove_ipv6 VC_CMD(NETALT, 4, 1)
14067 +struct vcmd_net_addr_ipv6_v1 {
14071 + struct in6_addr ip;
14072 + struct in6_addr mask;
14075 +#define VCMD_add_match_ipv4 VC_CMD(NETALT, 5, 0)
14076 +#define VCMD_get_match_ipv4 VC_CMD(NETALT, 6, 0)
14078 +struct vcmd_match_ipv4_v0 {
14083 + struct in_addr ip;
14084 + struct in_addr ip2;
14085 + struct in_addr mask;
14088 +#define VCMD_add_match_ipv6 VC_CMD(NETALT, 7, 0)
14089 +#define VCMD_get_match_ipv6 VC_CMD(NETALT, 8, 0)
14091 +struct vcmd_match_ipv6_v0 {
14096 + struct in6_addr ip;
14097 + struct in6_addr ip2;
14098 + struct in6_addr mask;
14103 +extern int vc_net_create(uint32_t, void __user *);
14104 +extern int vc_net_migrate(struct nx_info *, void __user *);
14106 +extern int vc_net_add(struct nx_info *, void __user *);
14107 +extern int vc_net_remove(struct nx_info *, void __user *);
14109 +extern int vc_net_add_ipv4(struct nx_info *, void __user *);
14110 +extern int vc_net_remove_ipv4(struct nx_info *, void __user *);
14112 +extern int vc_net_add_ipv6(struct nx_info *, void __user *);
14113 +extern int vc_net_remove_ipv6(struct nx_info *, void __user *);
14115 +extern int vc_add_match_ipv4(struct nx_info *, void __user *);
14116 +extern int vc_get_match_ipv4(struct nx_info *, void __user *);
14118 +extern int vc_add_match_ipv6(struct nx_info *, void __user *);
14119 +extern int vc_get_match_ipv6(struct nx_info *, void __user *);
14121 +#endif /* __KERNEL__ */
14124 +/* flag commands */
14126 +#define VCMD_get_nflags VC_CMD(FLAGS, 5, 0)
14127 +#define VCMD_set_nflags VC_CMD(FLAGS, 6, 0)
14129 +struct vcmd_net_flags_v0 {
14130 + uint64_t flagword;
14135 +extern int vc_get_nflags(struct nx_info *, void __user *);
14136 +extern int vc_set_nflags(struct nx_info *, void __user *);
14138 +#endif /* __KERNEL__ */
14141 +/* network caps commands */
14143 +#define VCMD_get_ncaps VC_CMD(FLAGS, 7, 0)
14144 +#define VCMD_set_ncaps VC_CMD(FLAGS, 8, 0)
14146 +struct vcmd_net_caps_v0 {
14152 +extern int vc_get_ncaps(struct nx_info *, void __user *);
14153 +extern int vc_set_ncaps(struct nx_info *, void __user *);
14155 +#endif /* __KERNEL__ */
14156 +#endif /* _VX_CONTEXT_CMD_H */
14157 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/network.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/network.h
14158 --- linux-2.6.33.2/include/linux/vserver/network.h 1970-01-01 01:00:00.000000000 +0100
14159 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/network.h 2010-02-25 12:02:16.000000000 +0100
14161 +#ifndef _VX_NETWORK_H
14162 +#define _VX_NETWORK_H
14164 +#include <linux/types.h>
14167 +#define MAX_N_CONTEXT 65535 /* Arbitrary limit */
14170 +/* network flags */
14172 +#define NXF_INFO_PRIVATE 0x00000008
14174 +#define NXF_SINGLE_IP 0x00000100
14175 +#define NXF_LBACK_REMAP 0x00000200
14176 +#define NXF_LBACK_ALLOW 0x00000400
14178 +#define NXF_HIDE_NETIF 0x02000000
14179 +#define NXF_HIDE_LBACK 0x04000000
14181 +#define NXF_STATE_SETUP (1ULL << 32)
14182 +#define NXF_STATE_ADMIN (1ULL << 34)
14184 +#define NXF_SC_HELPER (1ULL << 36)
14185 +#define NXF_PERSISTENT (1ULL << 38)
14187 +#define NXF_ONE_TIME (0x0005ULL << 32)
14190 +#define NXF_INIT_SET (__nxf_init_set())
14192 +static inline uint64_t __nxf_init_set(void) {
14193 + return NXF_STATE_ADMIN
14194 +#ifdef CONFIG_VSERVER_AUTO_LBACK
14195 + | NXF_LBACK_REMAP
14198 +#ifdef CONFIG_VSERVER_AUTO_SINGLE
14201 + | NXF_HIDE_NETIF;
14205 +/* network caps */
14207 +#define NXC_TUN_CREATE 0x00000001
14209 +#define NXC_RAW_ICMP 0x00000100
14212 +/* address types */
14214 +#define NXA_TYPE_IPV4 0x0001
14215 +#define NXA_TYPE_IPV6 0x0002
14217 +#define NXA_TYPE_NONE 0x0000
14218 +#define NXA_TYPE_ANY 0x00FF
14220 +#define NXA_TYPE_ADDR 0x0010
14221 +#define NXA_TYPE_MASK 0x0020
14222 +#define NXA_TYPE_RANGE 0x0040
14224 +#define NXA_MASK_ALL (NXA_TYPE_ADDR | NXA_TYPE_MASK | NXA_TYPE_RANGE)
14226 +#define NXA_MOD_BCAST 0x0100
14227 +#define NXA_MOD_LBACK 0x0200
14229 +#define NXA_LOOPBACK 0x1000
14231 +#define NXA_MASK_BIND (NXA_MASK_ALL | NXA_MOD_BCAST | NXA_MOD_LBACK)
14232 +#define NXA_MASK_SHOW (NXA_MASK_ALL | NXA_LOOPBACK)
14236 +#include <linux/list.h>
14237 +#include <linux/spinlock.h>
14238 +#include <linux/rcupdate.h>
14239 +#include <linux/in.h>
14240 +#include <linux/in6.h>
14241 +#include <asm/atomic.h>
14243 +struct nx_addr_v4 {
14244 + struct nx_addr_v4 *next;
14245 + struct in_addr ip[2];
14246 + struct in_addr mask;
14251 +struct nx_addr_v6 {
14252 + struct nx_addr_v6 *next;
14253 + struct in6_addr ip;
14254 + struct in6_addr mask;
14261 + struct hlist_node nx_hlist; /* linked list of nxinfos */
14262 + nid_t nx_id; /* vnet id */
14263 + atomic_t nx_usecnt; /* usage count */
14264 + atomic_t nx_tasks; /* tasks count */
14265 + int nx_state; /* context state */
14267 + uint64_t nx_flags; /* network flag word */
14268 + uint64_t nx_ncaps; /* network capabilities */
14270 + struct in_addr v4_lback; /* Loopback address */
14271 + struct in_addr v4_bcast; /* Broadcast address */
14272 + struct nx_addr_v4 v4; /* First/Single ipv4 address */
14273 +#ifdef CONFIG_IPV6
14274 + struct nx_addr_v6 v6; /* First/Single ipv6 address */
14276 + char nx_name[65]; /* network context name */
14280 +/* status flags */
14282 +#define NXS_HASHED 0x0001
14283 +#define NXS_SHUTDOWN 0x0100
14284 +#define NXS_RELEASED 0x8000
14286 +extern struct nx_info *lookup_nx_info(int);
14288 +extern int get_nid_list(int, unsigned int *, int);
14289 +extern int nid_is_hashed(nid_t);
14291 +extern int nx_migrate_task(struct task_struct *, struct nx_info *);
14293 +extern long vs_net_change(struct nx_info *, unsigned int);
14298 +#define NX_IPV4(n) ((n)->v4.type != NXA_TYPE_NONE)
14299 +#ifdef CONFIG_IPV6
14300 +#define NX_IPV6(n) ((n)->v6.type != NXA_TYPE_NONE)
14302 +#define NX_IPV6(n) (0)
14305 +#endif /* __KERNEL__ */
14306 +#endif /* _VX_NETWORK_H */
14307 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/percpu.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/percpu.h
14308 --- linux-2.6.33.2/include/linux/vserver/percpu.h 1970-01-01 01:00:00.000000000 +0100
14309 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/percpu.h 2010-02-25 12:02:16.000000000 +0100
14311 +#ifndef _VX_PERCPU_H
14312 +#define _VX_PERCPU_H
14314 +#include "cvirt_def.h"
14315 +#include "sched_def.h"
14317 +struct _vx_percpu {
14318 + struct _vx_cvirt_pc cvirt;
14319 + struct _vx_sched_pc sched;
14322 +#define PERCPU_PERCTX (sizeof(struct _vx_percpu))
14324 +#endif /* _VX_PERCPU_H */
14325 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/pid.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/pid.h
14326 --- linux-2.6.33.2/include/linux/vserver/pid.h 1970-01-01 01:00:00.000000000 +0100
14327 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/pid.h 2010-02-25 12:02:16.000000000 +0100
14329 +#ifndef _VSERVER_PID_H
14330 +#define _VSERVER_PID_H
14332 +/* pid faking stuff */
14334 +#define vx_info_map_pid(v, p) \
14335 + __vx_info_map_pid((v), (p), __func__, __FILE__, __LINE__)
14336 +#define vx_info_map_tgid(v,p) vx_info_map_pid(v,p)
14337 +#define vx_map_pid(p) vx_info_map_pid(current_vx_info(), p)
14338 +#define vx_map_tgid(p) vx_map_pid(p)
14340 +static inline int __vx_info_map_pid(struct vx_info *vxi, int pid,
14341 + const char *func, const char *file, int line)
14343 + if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
14344 + vxfprintk(VXD_CBIT(cvirt, 2),
14345 + "vx_map_tgid: %p/%llx: %d -> %d",
14346 + vxi, (long long)vxi->vx_flags, pid,
14347 + (pid && pid == vxi->vx_initpid) ? 1 : pid,
14348 + func, file, line);
14351 + if (pid == vxi->vx_initpid)
14357 +#define vx_info_rmap_pid(v, p) \
14358 + __vx_info_rmap_pid((v), (p), __func__, __FILE__, __LINE__)
14359 +#define vx_rmap_pid(p) vx_info_rmap_pid(current_vx_info(), p)
14360 +#define vx_rmap_tgid(p) vx_rmap_pid(p)
14362 +static inline int __vx_info_rmap_pid(struct vx_info *vxi, int pid,
14363 + const char *func, const char *file, int line)
14365 + if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
14366 + vxfprintk(VXD_CBIT(cvirt, 2),
14367 + "vx_rmap_tgid: %p/%llx: %d -> %d",
14368 + vxi, (long long)vxi->vx_flags, pid,
14369 + (pid == 1) ? vxi->vx_initpid : pid,
14370 + func, file, line);
14371 + if ((pid == 1) && vxi->vx_initpid)
14372 + return vxi->vx_initpid;
14373 + if (pid == vxi->vx_initpid)
14380 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/sched_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/sched_cmd.h
14381 --- linux-2.6.33.2/include/linux/vserver/sched_cmd.h 1970-01-01 01:00:00.000000000 +0100
14382 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/sched_cmd.h 2010-02-25 12:02:16.000000000 +0100
14384 +#ifndef _VX_SCHED_CMD_H
14385 +#define _VX_SCHED_CMD_H
14388 +/* sched vserver commands */
14390 +#define VCMD_set_sched_v2 VC_CMD(SCHED, 1, 2)
14391 +#define VCMD_set_sched_v3 VC_CMD(SCHED, 1, 3)
14392 +#define VCMD_set_sched_v4 VC_CMD(SCHED, 1, 4)
14394 +struct vcmd_set_sched_v2 {
14395 + int32_t fill_rate;
14396 + int32_t interval;
14398 + int32_t tokens_min;
14399 + int32_t tokens_max;
14400 + uint64_t cpu_mask;
14403 +struct vcmd_set_sched_v3 {
14404 + uint32_t set_mask;
14405 + int32_t fill_rate;
14406 + int32_t interval;
14408 + int32_t tokens_min;
14409 + int32_t tokens_max;
14410 + int32_t priority_bias;
14413 +struct vcmd_set_sched_v4 {
14414 + uint32_t set_mask;
14415 + int32_t fill_rate;
14416 + int32_t interval;
14418 + int32_t tokens_min;
14419 + int32_t tokens_max;
14420 + int32_t prio_bias;
14422 + int32_t bucket_id;
14425 +#define VCMD_set_sched VC_CMD(SCHED, 1, 5)
14426 +#define VCMD_get_sched VC_CMD(SCHED, 2, 5)
14428 +struct vcmd_sched_v5 {
14431 + int32_t bucket_id;
14432 + int32_t fill_rate[2];
14433 + int32_t interval[2];
14435 + int32_t tokens_min;
14436 + int32_t tokens_max;
14437 + int32_t prio_bias;
14440 +#define VXSM_FILL_RATE 0x0001
14441 +#define VXSM_INTERVAL 0x0002
14442 +#define VXSM_FILL_RATE2 0x0004
14443 +#define VXSM_INTERVAL2 0x0008
14444 +#define VXSM_TOKENS 0x0010
14445 +#define VXSM_TOKENS_MIN 0x0020
14446 +#define VXSM_TOKENS_MAX 0x0040
14447 +#define VXSM_PRIO_BIAS 0x0100
14449 +#define VXSM_IDLE_TIME 0x0200
14450 +#define VXSM_FORCE 0x0400
14452 +#define VXSM_V3_MASK 0x0173
14453 +#define VXSM_SET_MASK 0x01FF
14455 +#define VXSM_CPU_ID 0x1000
14456 +#define VXSM_BUCKET_ID 0x2000
14458 +#define VXSM_MSEC 0x4000
14460 +#define SCHED_KEEP (-2) /* only for v2 */
14464 +#include <linux/compiler.h>
14466 +extern int vc_set_sched_v2(struct vx_info *, void __user *);
14467 +extern int vc_set_sched_v3(struct vx_info *, void __user *);
14468 +extern int vc_set_sched_v4(struct vx_info *, void __user *);
14469 +extern int vc_set_sched(struct vx_info *, void __user *);
14470 +extern int vc_get_sched(struct vx_info *, void __user *);
14472 +#endif /* __KERNEL__ */
14474 +#define VCMD_sched_info VC_CMD(SCHED, 3, 0)
14476 +struct vcmd_sched_info {
14478 + int32_t bucket_id;
14479 + uint64_t user_msec;
14480 + uint64_t sys_msec;
14481 + uint64_t hold_msec;
14482 + uint32_t token_usec;
14483 + int32_t vavavoom;
14488 +extern int vc_sched_info(struct vx_info *, void __user *);
14490 +#endif /* __KERNEL__ */
14491 +#endif /* _VX_SCHED_CMD_H */
14492 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/sched_def.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/sched_def.h
14493 --- linux-2.6.33.2/include/linux/vserver/sched_def.h 1970-01-01 01:00:00.000000000 +0100
14494 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/sched_def.h 2010-02-25 12:02:16.000000000 +0100
14496 +#ifndef _VX_SCHED_DEF_H
14497 +#define _VX_SCHED_DEF_H
14499 +#include <linux/spinlock.h>
14500 +#include <linux/jiffies.h>
14501 +#include <linux/cpumask.h>
14502 +#include <asm/atomic.h>
14503 +#include <asm/param.h>
14506 +/* context sub struct */
14508 +struct _vx_sched {
14509 + spinlock_t tokens_lock; /* lock for token bucket */
14511 + int tokens; /* number of CPU tokens */
14512 + int fill_rate[2]; /* Fill rate: add X tokens... */
14513 + int interval[2]; /* Divisor: per Y jiffies */
14514 + int tokens_min; /* Limit: minimum for unhold */
14515 + int tokens_max; /* Limit: no more than N tokens */
14517 + int prio_bias; /* bias offset for priority */
14519 + unsigned update_mask; /* which features should be updated */
14520 + cpumask_t update; /* CPUs which should update */
14523 +struct _vx_sched_pc {
14524 + int tokens; /* number of CPU tokens */
14525 + int flags; /* bucket flags */
14527 + int fill_rate[2]; /* Fill rate: add X tokens... */
14528 + int interval[2]; /* Divisor: per Y jiffies */
14529 + int tokens_min; /* Limit: minimum for unhold */
14530 + int tokens_max; /* Limit: no more than N tokens */
14532 + int prio_bias; /* bias offset for priority */
14533 + int vavavoom; /* last calculated vavavoom */
14535 + unsigned long norm_time; /* last time accounted */
14536 + unsigned long idle_time; /* non linear time for fair sched */
14537 + unsigned long token_time; /* token time for accounting */
14538 + unsigned long onhold; /* jiffies when put on hold */
14540 + uint64_t user_ticks; /* token tick events */
14541 + uint64_t sys_ticks; /* token tick events */
14542 + uint64_t hold_ticks; /* token ticks paused */
14546 +#define VXSF_ONHOLD 0x0001
14547 +#define VXSF_IDLE_TIME 0x0100
14549 +#ifdef CONFIG_VSERVER_DEBUG
14551 +static inline void __dump_vx_sched(struct _vx_sched *sched)
14553 + printk("\t_vx_sched:\n");
14554 + printk("\t tokens: %4d/%4d, %4d/%4d, %4d, %4d\n",
14555 + sched->fill_rate[0], sched->interval[0],
14556 + sched->fill_rate[1], sched->interval[1],
14557 + sched->tokens_min, sched->tokens_max);
14558 + printk("\t priority = %4d\n", sched->prio_bias);
14563 +#endif /* _VX_SCHED_DEF_H */
14564 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/sched.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/sched.h
14565 --- linux-2.6.33.2/include/linux/vserver/sched.h 1970-01-01 01:00:00.000000000 +0100
14566 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/sched.h 2010-02-25 12:02:16.000000000 +0100
14568 +#ifndef _VX_SCHED_H
14569 +#define _VX_SCHED_H
14576 +void vx_vsi_uptime(struct timespec *, struct timespec *);
14581 +void vx_update_load(struct vx_info *);
14584 +int vx_tokens_recalc(struct _vx_sched_pc *,
14585 + unsigned long *, unsigned long *, int [2]);
14587 +void vx_update_sched_param(struct _vx_sched *sched,
14588 + struct _vx_sched_pc *sched_pc);
14590 +#endif /* __KERNEL__ */
14591 +#else /* _VX_SCHED_H */
14592 +#warning duplicate inclusion
14593 +#endif /* _VX_SCHED_H */
14594 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/signal_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/signal_cmd.h
14595 --- linux-2.6.33.2/include/linux/vserver/signal_cmd.h 1970-01-01 01:00:00.000000000 +0100
14596 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/signal_cmd.h 2010-02-25 12:02:16.000000000 +0100
14598 +#ifndef _VX_SIGNAL_CMD_H
14599 +#define _VX_SIGNAL_CMD_H
14602 +/* signalling vserver commands */
14604 +#define VCMD_ctx_kill VC_CMD(PROCTRL, 1, 0)
14605 +#define VCMD_wait_exit VC_CMD(EVENT, 99, 0)
14607 +struct vcmd_ctx_kill_v0 {
14612 +struct vcmd_wait_exit_v0 {
14613 + int32_t reboot_cmd;
14614 + int32_t exit_code;
14619 +extern int vc_ctx_kill(struct vx_info *, void __user *);
14620 +extern int vc_wait_exit(struct vx_info *, void __user *);
14622 +#endif /* __KERNEL__ */
14624 +/* process alteration commands */
14626 +#define VCMD_get_pflags VC_CMD(PROCALT, 5, 0)
14627 +#define VCMD_set_pflags VC_CMD(PROCALT, 6, 0)
14629 +struct vcmd_pflags_v0 {
14630 + uint32_t flagword;
14636 +extern int vc_get_pflags(uint32_t pid, void __user *);
14637 +extern int vc_set_pflags(uint32_t pid, void __user *);
14639 +#endif /* __KERNEL__ */
14640 +#endif /* _VX_SIGNAL_CMD_H */
14641 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/signal.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/signal.h
14642 --- linux-2.6.33.2/include/linux/vserver/signal.h 1970-01-01 01:00:00.000000000 +0100
14643 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/signal.h 2010-02-25 12:02:16.000000000 +0100
14645 +#ifndef _VX_SIGNAL_H
14646 +#define _VX_SIGNAL_H
14653 +int vx_info_kill(struct vx_info *, int, int);
14655 +#endif /* __KERNEL__ */
14656 +#else /* _VX_SIGNAL_H */
14657 +#warning duplicate inclusion
14658 +#endif /* _VX_SIGNAL_H */
14659 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/space_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/space_cmd.h
14660 --- linux-2.6.33.2/include/linux/vserver/space_cmd.h 1970-01-01 01:00:00.000000000 +0100
14661 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/space_cmd.h 2010-02-25 12:02:16.000000000 +0100
14663 +#ifndef _VX_SPACE_CMD_H
14664 +#define _VX_SPACE_CMD_H
14667 +#define VCMD_enter_space_v0 VC_CMD(PROCALT, 1, 0)
14668 +#define VCMD_enter_space_v1 VC_CMD(PROCALT, 1, 1)
14669 +#define VCMD_enter_space VC_CMD(PROCALT, 1, 2)
14671 +#define VCMD_set_space_v0 VC_CMD(PROCALT, 3, 0)
14672 +#define VCMD_set_space_v1 VC_CMD(PROCALT, 3, 1)
14673 +#define VCMD_set_space VC_CMD(PROCALT, 3, 2)
14675 +#define VCMD_get_space_mask_v0 VC_CMD(PROCALT, 4, 0)
14677 +#define VCMD_get_space_mask VC_CMD(VSPACE, 0, 1)
14678 +#define VCMD_get_space_default VC_CMD(VSPACE, 1, 0)
14681 +struct vcmd_space_mask_v1 {
14685 +struct vcmd_space_mask_v2 {
14693 +extern int vc_enter_space_v1(struct vx_info *, void __user *);
14694 +extern int vc_set_space_v1(struct vx_info *, void __user *);
14695 +extern int vc_enter_space(struct vx_info *, void __user *);
14696 +extern int vc_set_space(struct vx_info *, void __user *);
14697 +extern int vc_get_space_mask(void __user *, int);
14699 +#endif /* __KERNEL__ */
14700 +#endif /* _VX_SPACE_CMD_H */
14701 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/space.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/space.h
14702 --- linux-2.6.33.2/include/linux/vserver/space.h 1970-01-01 01:00:00.000000000 +0100
14703 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/space.h 2010-02-25 12:02:16.000000000 +0100
14705 +#ifndef _VX_SPACE_H
14706 +#define _VX_SPACE_H
14708 +#include <linux/types.h>
14712 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index);
14714 +#else /* _VX_SPACE_H */
14715 +#warning duplicate inclusion
14716 +#endif /* _VX_SPACE_H */
14717 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/switch.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/switch.h
14718 --- linux-2.6.33.2/include/linux/vserver/switch.h 1970-01-01 01:00:00.000000000 +0100
14719 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/switch.h 2010-02-25 12:02:16.000000000 +0100
14721 +#ifndef _VX_SWITCH_H
14722 +#define _VX_SWITCH_H
14724 +#include <linux/types.h>
14727 +#define VC_CATEGORY(c) (((c) >> 24) & 0x3F)
14728 +#define VC_COMMAND(c) (((c) >> 16) & 0xFF)
14729 +#define VC_VERSION(c) ((c) & 0xFFF)
14731 +#define VC_CMD(c, i, v) ((((VC_CAT_ ## c) & 0x3F) << 24) \
14732 + | (((i) & 0xFF) << 16) | ((v) & 0xFFF))
14736 + Syscall Matrix V2.8
14738 + |VERSION|CREATE |MODIFY |MIGRATE|CONTROL|EXPERIM| |SPECIAL|SPECIAL|
14739 + |STATS |DESTROY|ALTER |CHANGE |LIMIT |TEST | | | |
14740 + |INFO |SETUP | |MOVE | | | | | |
14741 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14742 + SYSTEM |VERSION|VSETUP |VHOST | | | | |DEVICE | |
14743 + HOST | 00| 01| 02| 03| 04| 05| | 06| 07|
14744 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14745 + CPU | |VPROC |PROCALT|PROCMIG|PROCTRL| | |SCHED. | |
14746 + PROCESS| 08| 09| 10| 11| 12| 13| | 14| 15|
14747 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14748 + MEMORY | | | | |MEMCTRL| | |SWAP | |
14749 + | 16| 17| 18| 19| 20| 21| | 22| 23|
14750 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14751 + NETWORK| |VNET |NETALT |NETMIG |NETCTL | | |SERIAL | |
14752 + | 24| 25| 26| 27| 28| 29| | 30| 31|
14753 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14754 + DISK | | | |TAGMIG |DLIMIT | | |INODE | |
14755 + VFS | 32| 33| 34| 35| 36| 37| | 38| 39|
14756 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14757 + OTHER |VSTAT | | | | | | |VINFO | |
14758 + | 40| 41| 42| 43| 44| 45| | 46| 47|
14759 + =======+=======+=======+=======+=======+=======+=======+ +=======+=======+
14760 + SPECIAL|EVENT | | | |FLAGS | | |VSPACE | |
14761 + | 48| 49| 50| 51| 52| 53| | 54| 55|
14762 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14763 + SPECIAL|DEBUG | | | |RLIMIT |SYSCALL| | |COMPAT |
14764 + | 56| 57| 58| 59| 60|TEST 61| | 62| 63|
14765 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14769 +#define VC_CAT_VERSION 0
14771 +#define VC_CAT_VSETUP 1
14772 +#define VC_CAT_VHOST 2
14774 +#define VC_CAT_DEVICE 6
14776 +#define VC_CAT_VPROC 9
14777 +#define VC_CAT_PROCALT 10
14778 +#define VC_CAT_PROCMIG 11
14779 +#define VC_CAT_PROCTRL 12
14781 +#define VC_CAT_SCHED 14
14782 +#define VC_CAT_MEMCTRL 20
14784 +#define VC_CAT_VNET 25
14785 +#define VC_CAT_NETALT 26
14786 +#define VC_CAT_NETMIG 27
14787 +#define VC_CAT_NETCTRL 28
14789 +#define VC_CAT_TAGMIG 35
14790 +#define VC_CAT_DLIMIT 36
14791 +#define VC_CAT_INODE 38
14793 +#define VC_CAT_VSTAT 40
14794 +#define VC_CAT_VINFO 46
14795 +#define VC_CAT_EVENT 48
14797 +#define VC_CAT_FLAGS 52
14798 +#define VC_CAT_VSPACE 54
14799 +#define VC_CAT_DEBUG 56
14800 +#define VC_CAT_RLIMIT 60
14802 +#define VC_CAT_SYSTEST 61
14803 +#define VC_CAT_COMPAT 63
14805 +/* query version */
14807 +#define VCMD_get_version VC_CMD(VERSION, 0, 0)
14808 +#define VCMD_get_vci VC_CMD(VERSION, 1, 0)
14813 +#include <linux/errno.h>
14815 +#endif /* __KERNEL__ */
14817 +#endif /* _VX_SWITCH_H */
14819 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/tag_cmd.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/tag_cmd.h
14820 --- linux-2.6.33.2/include/linux/vserver/tag_cmd.h 1970-01-01 01:00:00.000000000 +0100
14821 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/tag_cmd.h 2010-02-25 12:02:16.000000000 +0100
14823 +#ifndef _VX_TAG_CMD_H
14824 +#define _VX_TAG_CMD_H
14827 +/* vinfo commands */
14829 +#define VCMD_task_tag VC_CMD(VINFO, 3, 0)
14832 +extern int vc_task_tag(uint32_t);
14834 +#endif /* __KERNEL__ */
14836 +/* context commands */
14838 +#define VCMD_tag_migrate VC_CMD(TAGMIG, 1, 0)
14841 +extern int vc_tag_migrate(uint32_t);
14843 +#endif /* __KERNEL__ */
14844 +#endif /* _VX_TAG_CMD_H */
14845 diff -NurpP --minimal linux-2.6.33.2/include/linux/vserver/tag.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/tag.h
14846 --- linux-2.6.33.2/include/linux/vserver/tag.h 1970-01-01 01:00:00.000000000 +0100
14847 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vserver/tag.h 2010-02-25 12:02:16.000000000 +0100
14852 +#include <linux/types.h>
14855 +#define DX_TAG(in) (IS_TAGGED(in))
14858 +#ifdef CONFIG_TAG_NFSD
14859 +#define DX_TAG_NFSD 1
14861 +#define DX_TAG_NFSD 0
14865 +#ifdef CONFIG_TAGGING_NONE
14867 +#define MAX_UID 0xFFFFFFFF
14868 +#define MAX_GID 0xFFFFFFFF
14870 +#define INOTAG_TAG(cond, uid, gid, tag) (0)
14872 +#define TAGINO_UID(cond, uid, tag) (uid)
14873 +#define TAGINO_GID(cond, gid, tag) (gid)
14878 +#ifdef CONFIG_TAGGING_GID16
14880 +#define MAX_UID 0xFFFFFFFF
14881 +#define MAX_GID 0x0000FFFF
14883 +#define INOTAG_TAG(cond, uid, gid, tag) \
14884 + ((cond) ? (((gid) >> 16) & 0xFFFF) : 0)
14886 +#define TAGINO_UID(cond, uid, tag) (uid)
14887 +#define TAGINO_GID(cond, gid, tag) \
14888 + ((cond) ? (((gid) & 0xFFFF) | ((tag) << 16)) : (gid))
14893 +#ifdef CONFIG_TAGGING_ID24
14895 +#define MAX_UID 0x00FFFFFF
14896 +#define MAX_GID 0x00FFFFFF
14898 +#define INOTAG_TAG(cond, uid, gid, tag) \
14899 + ((cond) ? ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) : 0)
14901 +#define TAGINO_UID(cond, uid, tag) \
14902 + ((cond) ? (((uid) & 0xFFFFFF) | (((tag) & 0xFF00) << 16)) : (uid))
14903 +#define TAGINO_GID(cond, gid, tag) \
14904 + ((cond) ? (((gid) & 0xFFFFFF) | (((tag) & 0x00FF) << 24)) : (gid))
14909 +#ifdef CONFIG_TAGGING_UID16
14911 +#define MAX_UID 0x0000FFFF
14912 +#define MAX_GID 0xFFFFFFFF
14914 +#define INOTAG_TAG(cond, uid, gid, tag) \
14915 + ((cond) ? (((uid) >> 16) & 0xFFFF) : 0)
14917 +#define TAGINO_UID(cond, uid, tag) \
14918 + ((cond) ? (((uid) & 0xFFFF) | ((tag) << 16)) : (uid))
14919 +#define TAGINO_GID(cond, gid, tag) (gid)
14924 +#ifdef CONFIG_TAGGING_INTERN
14926 +#define MAX_UID 0xFFFFFFFF
14927 +#define MAX_GID 0xFFFFFFFF
14929 +#define INOTAG_TAG(cond, uid, gid, tag) \
14930 + ((cond) ? (tag) : 0)
14932 +#define TAGINO_UID(cond, uid, tag) (uid)
14933 +#define TAGINO_GID(cond, gid, tag) (gid)
14938 +#ifndef CONFIG_TAGGING_NONE
14939 +#define dx_current_fstag(sb) \
14940 + ((sb)->s_flags & MS_TAGGED ? dx_current_tag() : 0)
14942 +#define dx_current_fstag(sb) (0)
14945 +#ifndef CONFIG_TAGGING_INTERN
14946 +#define TAGINO_TAG(cond, tag) (0)
14948 +#define TAGINO_TAG(cond, tag) ((cond) ? (tag) : 0)
14951 +#define INOTAG_UID(cond, uid, gid) \
14952 + ((cond) ? ((uid) & MAX_UID) : (uid))
14953 +#define INOTAG_GID(cond, uid, gid) \
14954 + ((cond) ? ((gid) & MAX_GID) : (gid))
14957 +static inline uid_t dx_map_uid(uid_t uid)
14959 + if ((uid > MAX_UID) && (uid != -1))
14961 + return (uid & MAX_UID);
14964 +static inline gid_t dx_map_gid(gid_t gid)
14966 + if ((gid > MAX_GID) && (gid != -1))
14968 + return (gid & MAX_GID);
14976 +#define dx_notagcheck(sb) ((sb) && ((sb)->s_flags & MS_NOTAGCHECK))
14978 +int dx_parse_tag(char *string, tag_t *tag, int remove, int *mnt_flags,
14979 + unsigned long *flags);
14981 +#ifdef CONFIG_PROPAGATE
14983 +void __dx_propagate_tag(struct nameidata *nd, struct inode *inode);
14985 +#define dx_propagate_tag(n, i) __dx_propagate_tag(n, i)
14988 +#define dx_propagate_tag(n, i) do { } while (0)
14991 +#endif /* _DX_TAG_H */
14992 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_inet6.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_inet6.h
14993 --- linux-2.6.33.2/include/linux/vs_inet6.h 1970-01-01 01:00:00.000000000 +0100
14994 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_inet6.h 2010-02-25 14:47:08.000000000 +0100
14996 +#ifndef _VS_INET6_H
14997 +#define _VS_INET6_H
14999 +#include "vserver/base.h"
15000 +#include "vserver/network.h"
15001 +#include "vserver/debug.h"
15003 +#include <net/ipv6.h>
15005 +#define NXAV6(a) &(a)->ip, &(a)->mask, (a)->prefix, (a)->type
15006 +#define NXAV6_FMT "[%pI6/%pI6/%d:%04x]"
15009 +#ifdef CONFIG_IPV6
15012 +int v6_addr_match(struct nx_addr_v6 *nxa,
15013 + const struct in6_addr *addr, uint16_t mask)
15017 + switch (nxa->type & mask) {
15018 + case NXA_TYPE_MASK:
15019 + ret = ipv6_masked_addr_cmp(&nxa->ip, &nxa->mask, addr);
15021 + case NXA_TYPE_ADDR:
15022 + ret = ipv6_addr_equal(&nxa->ip, addr);
15024 + case NXA_TYPE_ANY:
15028 + vxdprintk(VXD_CBIT(net, 0),
15029 + "v6_addr_match(%p" NXAV6_FMT ",%pI6,%04x) = %d",
15030 + nxa, NXAV6(nxa), addr, mask, ret);
15035 +int v6_addr_in_nx_info(struct nx_info *nxi,
15036 + const struct in6_addr *addr, uint16_t mask)
15038 + struct nx_addr_v6 *nxa;
15043 + for (nxa = &nxi->v6; nxa; nxa = nxa->next)
15044 + if (v6_addr_match(nxa, addr, mask))
15048 + vxdprintk(VXD_CBIT(net, 0),
15049 + "v6_addr_in_nx_info(%p[#%u],%pI6,%04x) = %d",
15050 + nxi, nxi ? nxi->nx_id : 0, addr, mask, ret);
15055 +int v6_nx_addr_match(struct nx_addr_v6 *nxa, struct nx_addr_v6 *addr, uint16_t mask)
15057 + /* FIXME: needs full range checks */
15058 + return v6_addr_match(nxa, &addr->ip, mask);
15062 +int v6_nx_addr_in_nx_info(struct nx_info *nxi, struct nx_addr_v6 *nxa, uint16_t mask)
15064 + struct nx_addr_v6 *ptr;
15066 + for (ptr = &nxi->v6; ptr; ptr = ptr->next)
15067 + if (v6_nx_addr_match(ptr, nxa, mask))
15074 + * Check if a given address matches for a socket
15076 + * nxi: the socket's nx_info if any
15077 + * addr: to be verified address
15080 +int v6_sock_addr_match (
15081 + struct nx_info *nxi,
15082 + struct inet_sock *inet,
15083 + struct in6_addr *addr)
15085 + struct sock *sk = &inet->sk;
15086 + struct in6_addr *saddr = inet6_rcv_saddr(sk);
15088 + if (!ipv6_addr_any(addr) &&
15089 + ipv6_addr_equal(saddr, addr))
15091 + if (ipv6_addr_any(saddr))
15092 + return v6_addr_in_nx_info(nxi, addr, -1);
15097 + * check if address is covered by socket
15099 + * sk: the socket to check against
15100 + * addr: the address in question (must be != 0)
15104 +int __v6_addr_match_socket(const struct sock *sk, struct nx_addr_v6 *nxa)
15106 + struct nx_info *nxi = sk->sk_nx_info;
15107 + struct in6_addr *saddr = inet6_rcv_saddr(sk);
15109 + vxdprintk(VXD_CBIT(net, 5),
15110 + "__v6_addr_in_socket(%p," NXAV6_FMT ") %p:%pI6 %p;%lx",
15111 + sk, NXAV6(nxa), nxi, saddr, sk->sk_socket,
15112 + (sk->sk_socket?sk->sk_socket->flags:0));
15114 + if (!ipv6_addr_any(saddr)) { /* direct address match */
15115 + return v6_addr_match(nxa, saddr, -1);
15116 + } else if (nxi) { /* match against nx_info */
15117 + return v6_nx_addr_in_nx_info(nxi, nxa, -1);
15118 + } else { /* unrestricted any socket */
15124 +/* inet related checks and helpers */
15128 +struct net_device;
15132 +#include <linux/netdevice.h>
15133 +#include <linux/inetdevice.h>
15134 +#include <net/inet_timewait_sock.h>
15137 +int dev_in_nx_info(struct net_device *, struct nx_info *);
15138 +int v6_dev_in_nx_info(struct net_device *, struct nx_info *);
15139 +int nx_v6_addr_conflict(struct nx_info *, struct nx_info *);
15144 +int v6_ifa_in_nx_info(struct inet6_ifaddr *ifa, struct nx_info *nxi)
15150 + return v6_addr_in_nx_info(nxi, &ifa->addr, -1);
15154 +int nx_v6_ifa_visible(struct nx_info *nxi, struct inet6_ifaddr *ifa)
15156 + vxdprintk(VXD_CBIT(net, 1), "nx_v6_ifa_visible(%p[#%u],%p) %d",
15157 + nxi, nxi ? nxi->nx_id : 0, ifa,
15158 + nxi ? v6_ifa_in_nx_info(ifa, nxi) : 0);
15160 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15162 + if (v6_ifa_in_nx_info(ifa, nxi))
15168 +struct nx_v6_sock_addr {
15169 + struct in6_addr saddr; /* Address used for validation */
15170 + struct in6_addr baddr; /* Address used for socket bind */
15174 +int v6_map_sock_addr(struct inet_sock *inet, struct sockaddr_in6 *addr,
15175 + struct nx_v6_sock_addr *nsa)
15177 + // struct sock *sk = &inet->sk;
15178 + // struct nx_info *nxi = sk->sk_nx_info;
15179 + struct in6_addr saddr = addr->sin6_addr;
15180 + struct in6_addr baddr = saddr;
15182 + nsa->saddr = saddr;
15183 + nsa->baddr = baddr;
15188 +void v6_set_sock_addr(struct inet_sock *inet, struct nx_v6_sock_addr *nsa)
15190 + // struct sock *sk = &inet->sk;
15191 + // struct in6_addr *saddr = inet6_rcv_saddr(sk);
15193 + // *saddr = nsa->baddr;
15194 + // inet->inet_saddr = nsa->baddr;
15198 +int nx_info_has_v6(struct nx_info *nxi)
15202 + if (NX_IPV6(nxi))
15207 +#else /* CONFIG_IPV6 */
15210 +int nx_v6_dev_visible(struct nx_info *n, struct net_device *d)
15217 +int nx_v6_addr_conflict(struct nx_info *n, uint32_t a, const struct sock *s)
15223 +int v6_ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
15229 +int nx_info_has_v6(struct nx_info *nxi)
15234 +#endif /* CONFIG_IPV6 */
15236 +#define current_nx_info_has_v6() \
15237 + nx_info_has_v6(current_nx_info())
15240 +#warning duplicate inclusion
15242 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_inet.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_inet.h
15243 --- linux-2.6.33.2/include/linux/vs_inet.h 1970-01-01 01:00:00.000000000 +0100
15244 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_inet.h 2010-02-25 14:45:44.000000000 +0100
15246 +#ifndef _VS_INET_H
15247 +#define _VS_INET_H
15249 +#include "vserver/base.h"
15250 +#include "vserver/network.h"
15251 +#include "vserver/debug.h"
15253 +#define IPI_LOOPBACK htonl(INADDR_LOOPBACK)
15255 +#define NXAV4(a) NIPQUAD((a)->ip[0]), NIPQUAD((a)->ip[1]), \
15256 + NIPQUAD((a)->mask), (a)->type
15257 +#define NXAV4_FMT "[" NIPQUAD_FMT "-" NIPQUAD_FMT "/" NIPQUAD_FMT ":%04x]"
15261 +int v4_addr_match(struct nx_addr_v4 *nxa, __be32 addr, uint16_t tmask)
15263 + __be32 ip = nxa->ip[0].s_addr;
15264 + __be32 mask = nxa->mask.s_addr;
15265 + __be32 bcast = ip | ~mask;
15268 + switch (nxa->type & tmask) {
15269 + case NXA_TYPE_MASK:
15270 + ret = (ip == (addr & mask));
15272 + case NXA_TYPE_ADDR:
15276 + /* fall through to broadcast */
15277 + case NXA_MOD_BCAST:
15278 + ret = ((tmask & NXA_MOD_BCAST) && (addr == bcast));
15280 + case NXA_TYPE_RANGE:
15281 + ret = ((nxa->ip[0].s_addr <= addr) &&
15282 + (nxa->ip[1].s_addr > addr));
15284 + case NXA_TYPE_ANY:
15289 + vxdprintk(VXD_CBIT(net, 0),
15290 + "v4_addr_match(%p" NXAV4_FMT "," NIPQUAD_FMT ",%04x) = %d",
15291 + nxa, NXAV4(nxa), NIPQUAD(addr), tmask, ret);
15296 +int v4_addr_in_nx_info(struct nx_info *nxi, __be32 addr, uint16_t tmask)
15298 + struct nx_addr_v4 *nxa;
15305 + /* allow 127.0.0.1 when remapping lback */
15306 + if ((tmask & NXA_LOOPBACK) &&
15307 + (addr == IPI_LOOPBACK) &&
15308 + nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15311 + /* check for lback address */
15312 + if ((tmask & NXA_MOD_LBACK) &&
15313 + (nxi->v4_lback.s_addr == addr))
15316 + /* check for broadcast address */
15317 + if ((tmask & NXA_MOD_BCAST) &&
15318 + (nxi->v4_bcast.s_addr == addr))
15321 + /* check for v4 addresses */
15322 + for (nxa = &nxi->v4; nxa; nxa = nxa->next)
15323 + if (v4_addr_match(nxa, addr, tmask))
15327 + vxdprintk(VXD_CBIT(net, 0),
15328 + "v4_addr_in_nx_info(%p[#%u]," NIPQUAD_FMT ",%04x) = %d",
15329 + nxi, nxi ? nxi->nx_id : 0, NIPQUAD(addr), tmask, ret);
15334 +int v4_nx_addr_match(struct nx_addr_v4 *nxa, struct nx_addr_v4 *addr, uint16_t mask)
15336 + /* FIXME: needs full range checks */
15337 + return v4_addr_match(nxa, addr->ip[0].s_addr, mask);
15341 +int v4_nx_addr_in_nx_info(struct nx_info *nxi, struct nx_addr_v4 *nxa, uint16_t mask)
15343 + struct nx_addr_v4 *ptr;
15345 + for (ptr = &nxi->v4; ptr; ptr = ptr->next)
15346 + if (v4_nx_addr_match(ptr, nxa, mask))
15351 +#include <net/inet_sock.h>
15354 + * Check if a given address matches for a socket
15356 + * nxi: the socket's nx_info if any
15357 + * addr: to be verified address
15360 +int v4_sock_addr_match (
15361 + struct nx_info *nxi,
15362 + struct inet_sock *inet,
15365 + __be32 saddr = inet->inet_rcv_saddr;
15366 + __be32 bcast = nxi ? nxi->v4_bcast.s_addr : INADDR_BROADCAST;
15368 + if (addr && (saddr == addr || bcast == addr))
15371 + return v4_addr_in_nx_info(nxi, addr, NXA_MASK_BIND);
15376 +/* inet related checks and helpers */
15380 +struct net_device;
15383 +#ifdef CONFIG_INET
15385 +#include <linux/netdevice.h>
15386 +#include <linux/inetdevice.h>
15387 +#include <net/inet_sock.h>
15388 +#include <net/inet_timewait_sock.h>
15391 +int dev_in_nx_info(struct net_device *, struct nx_info *);
15392 +int v4_dev_in_nx_info(struct net_device *, struct nx_info *);
15393 +int nx_v4_addr_conflict(struct nx_info *, struct nx_info *);
15397 + * check if address is covered by socket
15399 + * sk: the socket to check against
15400 + * addr: the address in question (must be != 0)
15404 +int __v4_addr_match_socket(const struct sock *sk, struct nx_addr_v4 *nxa)
15406 + struct nx_info *nxi = sk->sk_nx_info;
15407 + __be32 saddr = inet_rcv_saddr(sk);
15409 + vxdprintk(VXD_CBIT(net, 5),
15410 + "__v4_addr_in_socket(%p," NXAV4_FMT ") %p:" NIPQUAD_FMT " %p;%lx",
15411 + sk, NXAV4(nxa), nxi, NIPQUAD(saddr), sk->sk_socket,
15412 + (sk->sk_socket?sk->sk_socket->flags:0));
15414 + if (saddr) { /* direct address match */
15415 + return v4_addr_match(nxa, saddr, -1);
15416 + } else if (nxi) { /* match against nx_info */
15417 + return v4_nx_addr_in_nx_info(nxi, nxa, -1);
15418 + } else { /* unrestricted any socket */
15426 +int nx_dev_visible(struct nx_info *nxi, struct net_device *dev)
15428 + vxdprintk(VXD_CBIT(net, 1), "nx_dev_visible(%p[#%u],%p »%s«) %d",
15429 + nxi, nxi ? nxi->nx_id : 0, dev, dev->name,
15430 + nxi ? dev_in_nx_info(dev, nxi) : 0);
15432 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15434 + if (dev_in_nx_info(dev, nxi))
15441 +int v4_ifa_in_nx_info(struct in_ifaddr *ifa, struct nx_info *nxi)
15447 + return v4_addr_in_nx_info(nxi, ifa->ifa_local, NXA_MASK_SHOW);
15451 +int nx_v4_ifa_visible(struct nx_info *nxi, struct in_ifaddr *ifa)
15453 + vxdprintk(VXD_CBIT(net, 1), "nx_v4_ifa_visible(%p[#%u],%p) %d",
15454 + nxi, nxi ? nxi->nx_id : 0, ifa,
15455 + nxi ? v4_ifa_in_nx_info(ifa, nxi) : 0);
15457 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15459 + if (v4_ifa_in_nx_info(ifa, nxi))
15465 +struct nx_v4_sock_addr {
15466 + __be32 saddr; /* Address used for validation */
15467 + __be32 baddr; /* Address used for socket bind */
15471 +int v4_map_sock_addr(struct inet_sock *inet, struct sockaddr_in *addr,
15472 + struct nx_v4_sock_addr *nsa)
15474 + struct sock *sk = &inet->sk;
15475 + struct nx_info *nxi = sk->sk_nx_info;
15476 + __be32 saddr = addr->sin_addr.s_addr;
15477 + __be32 baddr = saddr;
15479 + vxdprintk(VXD_CBIT(net, 3),
15480 + "inet_bind(%p)* %p,%p;%lx " NIPQUAD_FMT,
15481 + sk, sk->sk_nx_info, sk->sk_socket,
15482 + (sk->sk_socket ? sk->sk_socket->flags : 0),
15486 + if (saddr == INADDR_ANY) {
15487 + if (nx_info_flags(nxi, NXF_SINGLE_IP, 0))
15488 + baddr = nxi->v4.ip[0].s_addr;
15489 + } else if (saddr == IPI_LOOPBACK) {
15490 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15491 + baddr = nxi->v4_lback.s_addr;
15492 + } else { /* normal address bind */
15493 + if (!v4_addr_in_nx_info(nxi, saddr, NXA_MASK_BIND))
15494 + return -EADDRNOTAVAIL;
15498 + vxdprintk(VXD_CBIT(net, 3),
15499 + "inet_bind(%p) " NIPQUAD_FMT ", " NIPQUAD_FMT,
15500 + sk, NIPQUAD(saddr), NIPQUAD(baddr));
15502 + nsa->saddr = saddr;
15503 + nsa->baddr = baddr;
15508 +void v4_set_sock_addr(struct inet_sock *inet, struct nx_v4_sock_addr *nsa)
15510 + inet->inet_saddr = nsa->baddr;
15511 + inet->inet_rcv_saddr = nsa->baddr;
15516 + * helper to simplify inet_lookup_listener
15518 + * nxi: the socket's nx_info if any
15519 + * addr: to be verified address
15520 + * saddr: socket address
15522 +static inline int v4_inet_addr_match (
15523 + struct nx_info *nxi,
15527 + if (addr && (saddr == addr))
15530 + return nxi ? v4_addr_in_nx_info(nxi, addr, NXA_MASK_BIND) : 1;
15534 +static inline __be32 nx_map_sock_lback(struct nx_info *nxi, __be32 addr)
15536 + if (nx_info_flags(nxi, NXF_HIDE_LBACK, 0) &&
15537 + (addr == nxi->v4_lback.s_addr))
15538 + return IPI_LOOPBACK;
15543 +int nx_info_has_v4(struct nx_info *nxi)
15547 + if (NX_IPV4(nxi))
15549 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15554 +#else /* CONFIG_INET */
15557 +int nx_dev_visible(struct nx_info *n, struct net_device *d)
15563 +int nx_v4_addr_conflict(struct nx_info *n, uint32_t a, const struct sock *s)
15569 +int v4_ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
15575 +int nx_info_has_v4(struct nx_info *nxi)
15580 +#endif /* CONFIG_INET */
15582 +#define current_nx_info_has_v4() \
15583 + nx_info_has_v4(current_nx_info())
15586 +// #warning duplicate inclusion
15588 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_limit.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_limit.h
15589 --- linux-2.6.33.2/include/linux/vs_limit.h 1970-01-01 01:00:00.000000000 +0100
15590 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_limit.h 2010-02-25 12:02:16.000000000 +0100
15592 +#ifndef _VS_LIMIT_H
15593 +#define _VS_LIMIT_H
15595 +#include "vserver/limit.h"
15596 +#include "vserver/base.h"
15597 +#include "vserver/context.h"
15598 +#include "vserver/debug.h"
15599 +#include "vserver/context.h"
15600 +#include "vserver/limit_int.h"
15603 +#define vx_acc_cres(v, d, p, r) \
15604 + __vx_acc_cres(v, r, d, p, __FILE__, __LINE__)
15606 +#define vx_acc_cres_cond(x, d, p, r) \
15607 + __vx_acc_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \
15608 + r, d, p, __FILE__, __LINE__)
15611 +#define vx_add_cres(v, a, p, r) \
15612 + __vx_add_cres(v, r, a, p, __FILE__, __LINE__)
15613 +#define vx_sub_cres(v, a, p, r) vx_add_cres(v, -(a), p, r)
15615 +#define vx_add_cres_cond(x, a, p, r) \
15616 + __vx_add_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \
15617 + r, a, p, __FILE__, __LINE__)
15618 +#define vx_sub_cres_cond(x, a, p, r) vx_add_cres_cond(x, -(a), p, r)
15621 +/* process and file limits */
15623 +#define vx_nproc_inc(p) \
15624 + vx_acc_cres((p)->vx_info, 1, p, RLIMIT_NPROC)
15626 +#define vx_nproc_dec(p) \
15627 + vx_acc_cres((p)->vx_info,-1, p, RLIMIT_NPROC)
15629 +#define vx_files_inc(f) \
15630 + vx_acc_cres_cond((f)->f_xid, 1, f, RLIMIT_NOFILE)
15632 +#define vx_files_dec(f) \
15633 + vx_acc_cres_cond((f)->f_xid,-1, f, RLIMIT_NOFILE)
15635 +#define vx_locks_inc(l) \
15636 + vx_acc_cres_cond((l)->fl_xid, 1, l, RLIMIT_LOCKS)
15638 +#define vx_locks_dec(l) \
15639 + vx_acc_cres_cond((l)->fl_xid,-1, l, RLIMIT_LOCKS)
15641 +#define vx_openfd_inc(f) \
15642 + vx_acc_cres(current_vx_info(), 1, (void *)(long)(f), VLIMIT_OPENFD)
15644 +#define vx_openfd_dec(f) \
15645 + vx_acc_cres(current_vx_info(),-1, (void *)(long)(f), VLIMIT_OPENFD)
15648 +#define vx_cres_avail(v, n, r) \
15649 + __vx_cres_avail(v, r, n, __FILE__, __LINE__)
15652 +#define vx_nproc_avail(n) \
15653 + vx_cres_avail(current_vx_info(), n, RLIMIT_NPROC)
15655 +#define vx_files_avail(n) \
15656 + vx_cres_avail(current_vx_info(), n, RLIMIT_NOFILE)
15658 +#define vx_locks_avail(n) \
15659 + vx_cres_avail(current_vx_info(), n, RLIMIT_LOCKS)
15661 +#define vx_openfd_avail(n) \
15662 + vx_cres_avail(current_vx_info(), n, VLIMIT_OPENFD)
15665 +/* dentry limits */
15667 +#define vx_dentry_inc(d) do { \
15668 + if (atomic_read(&d->d_count) == 1) \
15669 + vx_acc_cres(current_vx_info(), 1, d, VLIMIT_DENTRY); \
15672 +#define vx_dentry_dec(d) do { \
15673 + if (atomic_read(&d->d_count) == 0) \
15674 + vx_acc_cres(current_vx_info(),-1, d, VLIMIT_DENTRY); \
15677 +#define vx_dentry_avail(n) \
15678 + vx_cres_avail(current_vx_info(), n, VLIMIT_DENTRY)
15681 +/* socket limits */
15683 +#define vx_sock_inc(s) \
15684 + vx_acc_cres((s)->sk_vx_info, 1, s, VLIMIT_NSOCK)
15686 +#define vx_sock_dec(s) \
15687 + vx_acc_cres((s)->sk_vx_info,-1, s, VLIMIT_NSOCK)
15689 +#define vx_sock_avail(n) \
15690 + vx_cres_avail(current_vx_info(), n, VLIMIT_NSOCK)
15693 +/* ipc resource limits */
15695 +#define vx_ipcmsg_add(v, u, a) \
15696 + vx_add_cres(v, a, u, RLIMIT_MSGQUEUE)
15698 +#define vx_ipcmsg_sub(v, u, a) \
15699 + vx_sub_cres(v, a, u, RLIMIT_MSGQUEUE)
15701 +#define vx_ipcmsg_avail(v, a) \
15702 + vx_cres_avail(v, a, RLIMIT_MSGQUEUE)
15705 +#define vx_ipcshm_add(v, k, a) \
15706 + vx_add_cres(v, a, (void *)(long)(k), VLIMIT_SHMEM)
15708 +#define vx_ipcshm_sub(v, k, a) \
15709 + vx_sub_cres(v, a, (void *)(long)(k), VLIMIT_SHMEM)
15711 +#define vx_ipcshm_avail(v, a) \
15712 + vx_cres_avail(v, a, VLIMIT_SHMEM)
15715 +#define vx_semary_inc(a) \
15716 + vx_acc_cres(current_vx_info(), 1, a, VLIMIT_SEMARY)
15718 +#define vx_semary_dec(a) \
15719 + vx_acc_cres(current_vx_info(), -1, a, VLIMIT_SEMARY)
15722 +#define vx_nsems_add(a,n) \
15723 + vx_add_cres(current_vx_info(), n, a, VLIMIT_NSEMS)
15725 +#define vx_nsems_sub(a,n) \
15726 + vx_sub_cres(current_vx_info(), n, a, VLIMIT_NSEMS)
15730 +#warning duplicate inclusion
15732 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_memory.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_memory.h
15733 --- linux-2.6.33.2/include/linux/vs_memory.h 1970-01-01 01:00:00.000000000 +0100
15734 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_memory.h 2010-02-25 12:02:16.000000000 +0100
15736 +#ifndef _VS_MEMORY_H
15737 +#define _VS_MEMORY_H
15739 +#include "vserver/limit.h"
15740 +#include "vserver/base.h"
15741 +#include "vserver/context.h"
15742 +#include "vserver/debug.h"
15743 +#include "vserver/context.h"
15744 +#include "vserver/limit_int.h"
15747 +#define __acc_add_long(a, v) (*(v) += (a))
15748 +#define __acc_inc_long(v) (++*(v))
15749 +#define __acc_dec_long(v) (--*(v))
15751 +#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
15752 +#define __acc_add_atomic(a, v) atomic_long_add(a, v)
15753 +#define __acc_inc_atomic(v) atomic_long_inc(v)
15754 +#define __acc_dec_atomic(v) atomic_long_dec(v)
15755 +#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
15756 +#define __acc_add_atomic(a, v) __acc_add_long(a, v)
15757 +#define __acc_inc_atomic(v) __acc_inc_long(v)
15758 +#define __acc_dec_atomic(v) __acc_dec_long(v)
15759 +#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
15762 +#define vx_acc_page(m, d, v, r) do { \
15764 + __acc_inc_long(&(m)->v); \
15766 + __acc_dec_long(&(m)->v); \
15767 + __vx_acc_cres(m->mm_vx_info, r, d, m, __FILE__, __LINE__); \
15770 +#define vx_acc_page_atomic(m, d, v, r) do { \
15772 + __acc_inc_atomic(&(m)->v); \
15774 + __acc_dec_atomic(&(m)->v); \
15775 + __vx_acc_cres(m->mm_vx_info, r, d, m, __FILE__, __LINE__); \
15779 +#define vx_acc_pages(m, p, v, r) do { \
15780 + unsigned long __p = (p); \
15781 + __acc_add_long(__p, &(m)->v); \
15782 + __vx_add_cres(m->mm_vx_info, r, __p, m, __FILE__, __LINE__); \
15785 +#define vx_acc_pages_atomic(m, p, v, r) do { \
15786 + unsigned long __p = (p); \
15787 + __acc_add_atomic(__p, &(m)->v); \
15788 + __vx_add_cres(m->mm_vx_info, r, __p, m, __FILE__, __LINE__); \
15793 +#define vx_acc_vmpage(m, d) \
15794 + vx_acc_page(m, d, total_vm, RLIMIT_AS)
15795 +#define vx_acc_vmlpage(m, d) \
15796 + vx_acc_page(m, d, locked_vm, RLIMIT_MEMLOCK)
15797 +#define vx_acc_file_rsspage(m, d) \
15798 + vx_acc_page_atomic(m, d, _file_rss, VLIMIT_MAPPED)
15799 +#define vx_acc_anon_rsspage(m, d) \
15800 + vx_acc_page_atomic(m, d, _anon_rss, VLIMIT_ANON)
15802 +#define vx_acc_vmpages(m, p) \
15803 + vx_acc_pages(m, p, total_vm, RLIMIT_AS)
15804 +#define vx_acc_vmlpages(m, p) \
15805 + vx_acc_pages(m, p, locked_vm, RLIMIT_MEMLOCK)
15806 +#define vx_acc_file_rsspages(m, p) \
15807 + vx_acc_pages_atomic(m, p, _file_rss, VLIMIT_MAPPED)
15808 +#define vx_acc_anon_rsspages(m, p) \
15809 + vx_acc_pages_atomic(m, p, _anon_rss, VLIMIT_ANON)
15811 +#define vx_pages_add(s, r, p) __vx_add_cres(s, r, p, 0, __FILE__, __LINE__)
15812 +#define vx_pages_sub(s, r, p) vx_pages_add(s, r, -(p))
15814 +#define vx_vmpages_inc(m) vx_acc_vmpage(m, 1)
15815 +#define vx_vmpages_dec(m) vx_acc_vmpage(m, -1)
15816 +#define vx_vmpages_add(m, p) vx_acc_vmpages(m, p)
15817 +#define vx_vmpages_sub(m, p) vx_acc_vmpages(m, -(p))
15819 +#define vx_vmlocked_inc(m) vx_acc_vmlpage(m, 1)
15820 +#define vx_vmlocked_dec(m) vx_acc_vmlpage(m, -1)
15821 +#define vx_vmlocked_add(m, p) vx_acc_vmlpages(m, p)
15822 +#define vx_vmlocked_sub(m, p) vx_acc_vmlpages(m, -(p))
15824 +#define vx_file_rsspages_inc(m) vx_acc_file_rsspage(m, 1)
15825 +#define vx_file_rsspages_dec(m) vx_acc_file_rsspage(m, -1)
15826 +#define vx_file_rsspages_add(m, p) vx_acc_file_rsspages(m, p)
15827 +#define vx_file_rsspages_sub(m, p) vx_acc_file_rsspages(m, -(p))
15829 +#define vx_anon_rsspages_inc(m) vx_acc_anon_rsspage(m, 1)
15830 +#define vx_anon_rsspages_dec(m) vx_acc_anon_rsspage(m, -1)
15831 +#define vx_anon_rsspages_add(m, p) vx_acc_anon_rsspages(m, p)
15832 +#define vx_anon_rsspages_sub(m, p) vx_acc_anon_rsspages(m, -(p))
15835 +#define vx_pages_avail(m, p, r) \
15836 + __vx_cres_avail((m)->mm_vx_info, r, p, __FILE__, __LINE__)
15838 +#define vx_vmpages_avail(m, p) vx_pages_avail(m, p, RLIMIT_AS)
15839 +#define vx_vmlocked_avail(m, p) vx_pages_avail(m, p, RLIMIT_MEMLOCK)
15840 +#define vx_anon_avail(m, p) vx_pages_avail(m, p, VLIMIT_ANON)
15841 +#define vx_mapped_avail(m, p) vx_pages_avail(m, p, VLIMIT_MAPPED)
15843 +#define vx_rss_avail(m, p) \
15844 + __vx_cres_array_avail((m)->mm_vx_info, VLA_RSS, p, __FILE__, __LINE__)
15848 + VXPT_UNKNOWN = 0,
15857 +#define vx_page_fault(mm, vma, type, ret)
15861 +void __vx_page_fault(struct mm_struct *mm,
15862 + struct vm_area_struct *vma, int type, int ret)
15864 + struct vx_info *vxi = mm->mm_vx_info;
15867 + static char *page_type[6] =
15868 + { "UNKNOWN", "ANON", "NONE", "FILE", "SWAP", "WRITE" };
15869 + static char *page_what[4] =
15870 + { "FAULT_OOM", "FAULT_SIGBUS", "FAULT_MINOR", "FAULT_MAJOR" };
15876 + what = (ret & 0x3);
15878 +/* printk("[%d] page[%d][%d] %2x %s %s\n", vxi->vx_id,
15879 + type, what, ret, page_type[type], page_what[what]);
15881 + if (ret & VM_FAULT_WRITE)
15883 + atomic_inc(&vxi->cacct.page[type][what]);
15886 +#define vx_page_fault(mm, vma, type, ret) __vx_page_fault(mm, vma, type, ret)
15890 +extern unsigned long vx_badness(struct task_struct *task, struct mm_struct *mm);
15893 +#warning duplicate inclusion
15895 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_network.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_network.h
15896 --- linux-2.6.33.2/include/linux/vs_network.h 1970-01-01 01:00:00.000000000 +0100
15897 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_network.h 2010-02-25 12:02:16.000000000 +0100
15899 +#ifndef _NX_VS_NETWORK_H
15900 +#define _NX_VS_NETWORK_H
15902 +#include "vserver/context.h"
15903 +#include "vserver/network.h"
15904 +#include "vserver/base.h"
15905 +#include "vserver/check.h"
15906 +#include "vserver/debug.h"
15908 +#include <linux/sched.h>
15911 +#define get_nx_info(i) __get_nx_info(i, __FILE__, __LINE__)
15913 +static inline struct nx_info *__get_nx_info(struct nx_info *nxi,
15914 + const char *_file, int _line)
15919 + vxlprintk(VXD_CBIT(nid, 2), "get_nx_info(%p[#%d.%d])",
15920 + nxi, nxi ? nxi->nx_id : 0,
15921 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15924 + atomic_inc(&nxi->nx_usecnt);
15929 +extern void free_nx_info(struct nx_info *);
15931 +#define put_nx_info(i) __put_nx_info(i, __FILE__, __LINE__)
15933 +static inline void __put_nx_info(struct nx_info *nxi, const char *_file, int _line)
15938 + vxlprintk(VXD_CBIT(nid, 2), "put_nx_info(%p[#%d.%d])",
15939 + nxi, nxi ? nxi->nx_id : 0,
15940 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15943 + if (atomic_dec_and_test(&nxi->nx_usecnt))
15944 + free_nx_info(nxi);
15948 +#define init_nx_info(p, i) __init_nx_info(p, i, __FILE__, __LINE__)
15950 +static inline void __init_nx_info(struct nx_info **nxp, struct nx_info *nxi,
15951 + const char *_file, int _line)
15954 + vxlprintk(VXD_CBIT(nid, 3),
15955 + "init_nx_info(%p[#%d.%d])",
15956 + nxi, nxi ? nxi->nx_id : 0,
15957 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15960 + atomic_inc(&nxi->nx_usecnt);
15966 +#define set_nx_info(p, i) __set_nx_info(p, i, __FILE__, __LINE__)
15968 +static inline void __set_nx_info(struct nx_info **nxp, struct nx_info *nxi,
15969 + const char *_file, int _line)
15971 + struct nx_info *nxo;
15976 + vxlprintk(VXD_CBIT(nid, 3), "set_nx_info(%p[#%d.%d])",
15977 + nxi, nxi ? nxi->nx_id : 0,
15978 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15981 + atomic_inc(&nxi->nx_usecnt);
15982 + nxo = xchg(nxp, nxi);
15986 +#define clr_nx_info(p) __clr_nx_info(p, __FILE__, __LINE__)
15988 +static inline void __clr_nx_info(struct nx_info **nxp,
15989 + const char *_file, int _line)
15991 + struct nx_info *nxo;
15993 + nxo = xchg(nxp, NULL);
15997 + vxlprintk(VXD_CBIT(nid, 3), "clr_nx_info(%p[#%d.%d])",
15998 + nxo, nxo ? nxo->nx_id : 0,
15999 + nxo ? atomic_read(&nxo->nx_usecnt) : 0,
16002 + if (atomic_dec_and_test(&nxo->nx_usecnt))
16003 + free_nx_info(nxo);
16007 +#define claim_nx_info(v, p) __claim_nx_info(v, p, __FILE__, __LINE__)
16009 +static inline void __claim_nx_info(struct nx_info *nxi,
16010 + struct task_struct *task, const char *_file, int _line)
16012 + vxlprintk(VXD_CBIT(nid, 3), "claim_nx_info(%p[#%d.%d.%d]) %p",
16013 + nxi, nxi ? nxi->nx_id : 0,
16014 + nxi?atomic_read(&nxi->nx_usecnt):0,
16015 + nxi?atomic_read(&nxi->nx_tasks):0,
16016 + task, _file, _line);
16018 + atomic_inc(&nxi->nx_tasks);
16022 +extern void unhash_nx_info(struct nx_info *);
16024 +#define release_nx_info(v, p) __release_nx_info(v, p, __FILE__, __LINE__)
16026 +static inline void __release_nx_info(struct nx_info *nxi,
16027 + struct task_struct *task, const char *_file, int _line)
16029 + vxlprintk(VXD_CBIT(nid, 3), "release_nx_info(%p[#%d.%d.%d]) %p",
16030 + nxi, nxi ? nxi->nx_id : 0,
16031 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
16032 + nxi ? atomic_read(&nxi->nx_tasks) : 0,
16033 + task, _file, _line);
16037 + if (atomic_dec_and_test(&nxi->nx_tasks))
16038 + unhash_nx_info(nxi);
16042 +#define task_get_nx_info(i) __task_get_nx_info(i, __FILE__, __LINE__)
16044 +static __inline__ struct nx_info *__task_get_nx_info(struct task_struct *p,
16045 + const char *_file, int _line)
16047 + struct nx_info *nxi;
16050 + vxlprintk(VXD_CBIT(nid, 5), "task_get_nx_info(%p)",
16051 + p, _file, _line);
16052 + nxi = __get_nx_info(p->nx_info, _file, _line);
16058 +static inline void exit_nx_info(struct task_struct *p)
16061 + release_nx_info(p->nx_info, p);
16066 +#warning duplicate inclusion
16068 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_pid.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_pid.h
16069 --- linux-2.6.33.2/include/linux/vs_pid.h 1970-01-01 01:00:00.000000000 +0100
16070 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_pid.h 2010-02-25 12:02:16.000000000 +0100
16075 +#include "vserver/base.h"
16076 +#include "vserver/check.h"
16077 +#include "vserver/context.h"
16078 +#include "vserver/debug.h"
16079 +#include "vserver/pid.h"
16080 +#include <linux/pid_namespace.h>
16083 +#define VXF_FAKE_INIT (VXF_INFO_INIT | VXF_STATE_INIT)
16086 +int vx_proc_task_visible(struct task_struct *task)
16088 + if ((task->pid == 1) &&
16089 + !vx_flags(VXF_FAKE_INIT, VXF_FAKE_INIT))
16090 + /* show a blend through init */
16092 + if (vx_check(vx_task_xid(task), VS_WATCH | VS_IDENT))
16099 +#define find_task_by_real_pid(pid) find_task_by_pid_ns(pid, &init_pid_ns)
16104 +struct task_struct *vx_find_proc_task_by_pid(int pid)
16106 + struct task_struct *task = find_task_by_real_pid(pid);
16108 + if (task && !vx_proc_task_visible(task)) {
16109 + vxdprintk(VXD_CBIT(misc, 6),
16110 + "dropping task (find) %p[#%u,%u] for %p[#%u,%u]",
16111 + task, task->xid, task->pid,
16112 + current, current->xid, current->pid);
16121 +struct task_struct *vx_get_proc_task(struct inode *inode, struct pid *pid)
16123 + struct task_struct *task = get_pid_task(pid, PIDTYPE_PID);
16125 + if (task && !vx_proc_task_visible(task)) {
16126 + vxdprintk(VXD_CBIT(misc, 6),
16127 + "dropping task (get) %p[#%u,%u] for %p[#%u,%u]",
16128 + task, task->xid, task->pid,
16129 + current, current->xid, current->pid);
16130 + put_task_struct(task);
16139 +struct task_struct *vx_child_reaper(struct task_struct *p)
16141 + struct vx_info *vxi = p->vx_info;
16142 + struct task_struct *reaper = child_reaper(p);
16147 + BUG_ON(!p->vx_info->vx_reaper);
16149 + /* child reaper for the guest reaper */
16150 + if (vxi->vx_reaper == p)
16153 + reaper = vxi->vx_reaper;
16155 + vxdprintk(VXD_CBIT(xid, 7),
16156 + "vx_child_reaper(%p[#%u,%u]) = %p[#%u,%u]",
16157 + p, p->xid, p->pid, reaper, reaper->xid, reaper->pid);
16165 +#warning duplicate inclusion
16167 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_sched.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_sched.h
16168 --- linux-2.6.33.2/include/linux/vs_sched.h 1970-01-01 01:00:00.000000000 +0100
16169 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_sched.h 2010-02-25 12:02:16.000000000 +0100
16171 +#ifndef _VS_SCHED_H
16172 +#define _VS_SCHED_H
16174 +#include "vserver/base.h"
16175 +#include "vserver/context.h"
16176 +#include "vserver/sched.h"
16179 +#define VAVAVOOM_RATIO 50
16181 +#define MAX_PRIO_BIAS 20
16182 +#define MIN_PRIO_BIAS -20
16185 +#ifdef CONFIG_VSERVER_HARDCPU
16188 + * effective_prio - return the priority that is based on the static
16189 + * priority but is modified by bonuses/penalties.
16191 + * We scale the actual sleep average [0 .... MAX_SLEEP_AVG]
16192 + * into a -4 ... 0 ... +4 bonus/penalty range.
16194 + * Additionally, we scale another amount based on the number of
16195 + * CPU tokens currently held by the context, if the process is
16196 + * part of a context (and the appropriate SCHED flag is set).
16197 + * This ranges from -5 ... 0 ... +15, quadratically.
16199 + * So, the total bonus is -9 .. 0 .. +19
16200 + * We use ~50% of the full 0...39 priority range so that:
16202 + * 1) nice +19 interactive tasks do not preempt nice 0 CPU hogs.
16203 + * 2) nice -20 CPU hogs do not get preempted by nice 0 tasks.
16204 + * unless that context is far exceeding its CPU allocation.
16206 + * Both properties are important to certain workloads.
16209 +int vx_effective_vavavoom(struct _vx_sched_pc *sched_pc, int max_prio)
16211 + int vavavoom, max;
16213 + /* lots of tokens = lots of vavavoom
16214 + * no tokens = no vavavoom */
16215 + if ((vavavoom = sched_pc->tokens) >= 0) {
16216 + max = sched_pc->tokens_max;
16217 + vavavoom = max - vavavoom;
16219 + vavavoom = max_prio * VAVAVOOM_RATIO / 100
16220 + * (vavavoom*vavavoom - (max >> 2)) / max;
16228 +int vx_adjust_prio(struct task_struct *p, int prio, int max_user)
16230 + struct vx_info *vxi = p->vx_info;
16231 + struct _vx_sched_pc *sched_pc;
16236 + sched_pc = &vx_cpu(vxi, sched_pc);
16237 + if (vx_info_flags(vxi, VXF_SCHED_PRIO, 0)) {
16238 + int vavavoom = vx_effective_vavavoom(sched_pc, max_user);
16240 + sched_pc->vavavoom = vavavoom;
16241 + prio += vavavoom;
16243 + prio += sched_pc->prio_bias;
16247 +#else /* !CONFIG_VSERVER_HARDCPU */
16250 +int vx_adjust_prio(struct task_struct *p, int prio, int max_user)
16252 + struct vx_info *vxi = p->vx_info;
16255 + prio += vx_cpu(vxi, sched_pc).prio_bias;
16259 +#endif /* CONFIG_VSERVER_HARDCPU */
16262 +static inline void vx_account_user(struct vx_info *vxi,
16263 + cputime_t cputime, int nice)
16267 + vx_cpu(vxi, sched_pc).user_ticks += cputime;
16270 +static inline void vx_account_system(struct vx_info *vxi,
16271 + cputime_t cputime, int idle)
16275 + vx_cpu(vxi, sched_pc).sys_ticks += cputime;
16279 +#warning duplicate inclusion
16281 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_socket.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_socket.h
16282 --- linux-2.6.33.2/include/linux/vs_socket.h 1970-01-01 01:00:00.000000000 +0100
16283 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_socket.h 2010-02-25 12:02:16.000000000 +0100
16285 +#ifndef _VS_SOCKET_H
16286 +#define _VS_SOCKET_H
16288 +#include "vserver/debug.h"
16289 +#include "vserver/base.h"
16290 +#include "vserver/cacct.h"
16291 +#include "vserver/context.h"
16292 +#include "vserver/tag.h"
16295 +/* socket accounting */
16297 +#include <linux/socket.h>
16299 +static inline int vx_sock_type(int family)
16301 + switch (family) {
16303 + return VXA_SOCK_UNSPEC;
16305 + return VXA_SOCK_UNIX;
16307 + return VXA_SOCK_INET;
16309 + return VXA_SOCK_INET6;
16311 + return VXA_SOCK_PACKET;
16313 + return VXA_SOCK_OTHER;
16317 +#define vx_acc_sock(v, f, p, s) \
16318 + __vx_acc_sock(v, f, p, s, __FILE__, __LINE__)
16320 +static inline void __vx_acc_sock(struct vx_info *vxi,
16321 + int family, int pos, int size, char *file, int line)
16324 + int type = vx_sock_type(family);
16326 + atomic_long_inc(&vxi->cacct.sock[type][pos].count);
16327 + atomic_long_add(size, &vxi->cacct.sock[type][pos].total);
16331 +#define vx_sock_recv(sk, s) \
16332 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 0, s)
16333 +#define vx_sock_send(sk, s) \
16334 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 1, s)
16335 +#define vx_sock_fail(sk, s) \
16336 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 2, s)
16339 +#define sock_vx_init(s) do { \
16340 + (s)->sk_xid = 0; \
16341 + (s)->sk_vx_info = NULL; \
16344 +#define sock_nx_init(s) do { \
16345 + (s)->sk_nid = 0; \
16346 + (s)->sk_nx_info = NULL; \
16350 +#warning duplicate inclusion
16352 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_tag.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_tag.h
16353 --- linux-2.6.33.2/include/linux/vs_tag.h 1970-01-01 01:00:00.000000000 +0100
16354 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_tag.h 2010-02-25 12:02:16.000000000 +0100
16359 +#include <linux/vserver/tag.h>
16361 +/* check conditions */
16363 +#define DX_ADMIN 0x0001
16364 +#define DX_WATCH 0x0002
16365 +#define DX_HOSTID 0x0008
16367 +#define DX_IDENT 0x0010
16369 +#define DX_ARG_MASK 0x0010
16372 +#define dx_task_tag(t) ((t)->tag)
16374 +#define dx_current_tag() dx_task_tag(current)
16376 +#define dx_check(c, m) __dx_check(dx_current_tag(), c, m)
16378 +#define dx_weak_check(c, m) ((m) ? dx_check(c, m) : 1)
16382 + * check current context for ADMIN/WATCH and
16383 + * optionally against supplied argument
16385 +static inline int __dx_check(tag_t cid, tag_t id, unsigned int mode)
16387 + if (mode & DX_ARG_MASK) {
16388 + if ((mode & DX_IDENT) && (id == cid))
16391 + return (((mode & DX_ADMIN) && (cid == 0)) ||
16392 + ((mode & DX_WATCH) && (cid == 1)) ||
16393 + ((mode & DX_HOSTID) && (id == 0)));
16397 +int dx_permission(const struct inode *inode, int mask);
16401 +#warning duplicate inclusion
16403 diff -NurpP --minimal linux-2.6.33.2/include/linux/vs_time.h linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_time.h
16404 --- linux-2.6.33.2/include/linux/vs_time.h 1970-01-01 01:00:00.000000000 +0100
16405 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/linux/vs_time.h 2010-02-25 12:02:16.000000000 +0100
16407 +#ifndef _VS_TIME_H
16408 +#define _VS_TIME_H
16411 +/* time faking stuff */
16413 +#ifdef CONFIG_VSERVER_VTIME
16415 +extern void vx_gettimeofday(struct timeval *tv);
16416 +extern int vx_settimeofday(struct timespec *ts);
16419 +#define vx_gettimeofday(t) do_gettimeofday(t)
16420 +#define vx_settimeofday(t) do_settimeofday(t)
16424 +#warning duplicate inclusion
16426 diff -NurpP --minimal linux-2.6.33.2/include/net/addrconf.h linux-2.6.33.2-vs2.3.0.36.30.4/include/net/addrconf.h
16427 --- linux-2.6.33.2/include/net/addrconf.h 2009-12-03 20:02:57.000000000 +0100
16428 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/net/addrconf.h 2010-02-25 12:02:16.000000000 +0100
16429 @@ -84,7 +84,8 @@ extern int ipv6_dev_get_saddr(struct n
16430 struct net_device *dev,
16431 const struct in6_addr *daddr,
16432 unsigned int srcprefs,
16433 - struct in6_addr *saddr);
16434 + struct in6_addr *saddr,
16435 + struct nx_info *nxi);
16436 extern int ipv6_get_lladdr(struct net_device *dev,
16437 struct in6_addr *addr,
16438 unsigned char banned_flags);
16439 diff -NurpP --minimal linux-2.6.33.2/include/net/af_unix.h linux-2.6.33.2-vs2.3.0.36.30.4/include/net/af_unix.h
16440 --- linux-2.6.33.2/include/net/af_unix.h 2008-12-25 00:26:37.000000000 +0100
16441 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/net/af_unix.h 2010-02-25 12:02:16.000000000 +0100
16443 #include <linux/socket.h>
16444 #include <linux/un.h>
16445 #include <linux/mutex.h>
16446 +#include <linux/vs_base.h>
16447 #include <net/sock.h>
16449 extern void unix_inflight(struct file *fp);
16450 diff -NurpP --minimal linux-2.6.33.2/include/net/inet_timewait_sock.h linux-2.6.33.2-vs2.3.0.36.30.4/include/net/inet_timewait_sock.h
16451 --- linux-2.6.33.2/include/net/inet_timewait_sock.h 2010-02-25 11:52:08.000000000 +0100
16452 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/net/inet_timewait_sock.h 2010-02-25 12:02:16.000000000 +0100
16453 @@ -117,6 +117,10 @@ struct inet_timewait_sock {
16454 #define tw_hash __tw_common.skc_hash
16455 #define tw_prot __tw_common.skc_prot
16456 #define tw_net __tw_common.skc_net
16457 +#define tw_xid __tw_common.skc_xid
16458 +#define tw_vx_info __tw_common.skc_vx_info
16459 +#define tw_nid __tw_common.skc_nid
16460 +#define tw_nx_info __tw_common.skc_nx_info
16462 volatile unsigned char tw_substate;
16463 /* 3 bits hole, try to pack */
16464 diff -NurpP --minimal linux-2.6.33.2/include/net/route.h linux-2.6.33.2-vs2.3.0.36.30.4/include/net/route.h
16465 --- linux-2.6.33.2/include/net/route.h 2010-02-25 11:52:08.000000000 +0100
16466 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/net/route.h 2010-02-25 12:02:16.000000000 +0100
16467 @@ -132,6 +132,9 @@ static inline void ip_rt_put(struct rtab
16468 dst_release(&rt->u.dst);
16471 +#include <linux/vs_base.h>
16472 +#include <linux/vs_inet.h>
16474 #define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
16476 extern const __u8 ip_tos2prio[16];
16477 @@ -141,6 +144,9 @@ static inline char rt_tos2priority(u8 to
16478 return ip_tos2prio[IPTOS_TOS(tos)>>1];
16481 +extern int ip_v4_find_src(struct net *net, struct nx_info *,
16482 + struct rtable **, struct flowi *);
16484 static inline int ip_route_connect(struct rtable **rp, __be32 dst,
16485 __be32 src, u32 tos, int oif, u8 protocol,
16486 __be16 sport, __be16 dport, struct sock *sk,
16487 @@ -158,11 +164,24 @@ static inline int ip_route_connect(struc
16490 struct net *net = sock_net(sk);
16491 + struct nx_info *nx_info = current_nx_info();
16493 if (inet_sk(sk)->transparent)
16494 fl.flags |= FLOWI_FLAG_ANYSRC;
16496 - if (!dst || !src) {
16498 + nx_info = sk->sk_nx_info;
16500 + vxdprintk(VXD_CBIT(net, 4),
16501 + "ip_route_connect(%p) %p,%p;%lx",
16502 + sk, nx_info, sk->sk_socket,
16503 + (sk->sk_socket?sk->sk_socket->flags:0));
16505 + err = ip_v4_find_src(net, nx_info, rp, &fl);
16509 + if (!fl.fl4_dst || !fl.fl4_src) {
16510 err = __ip_route_output_key(net, rp, &fl);
16513 diff -NurpP --minimal linux-2.6.33.2/include/net/sock.h linux-2.6.33.2-vs2.3.0.36.30.4/include/net/sock.h
16514 --- linux-2.6.33.2/include/net/sock.h 2010-04-06 01:47:46.000000000 +0200
16515 +++ linux-2.6.33.2-vs2.3.0.36.30.4/include/net/sock.h 2010-04-06 01:59:25.000000000 +0200
16516 @@ -149,6 +149,10 @@ struct sock_common {
16517 #ifdef CONFIG_NET_NS
16518 struct net *skc_net;
16521 + struct vx_info *skc_vx_info;
16523 + struct nx_info *skc_nx_info;
16527 @@ -236,6 +240,10 @@ struct sock {
16528 #define sk_bind_node __sk_common.skc_bind_node
16529 #define sk_prot __sk_common.skc_prot
16530 #define sk_net __sk_common.skc_net
16531 +#define sk_xid __sk_common.skc_xid
16532 +#define sk_vx_info __sk_common.skc_vx_info
16533 +#define sk_nid __sk_common.skc_nid
16534 +#define sk_nx_info __sk_common.skc_nx_info
16535 kmemcheck_bitfield_begin(flags);
16536 unsigned int sk_shutdown : 2,
16538 diff -NurpP --minimal linux-2.6.33.2/init/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/init/Kconfig
16539 --- linux-2.6.33.2/init/Kconfig 2010-02-25 11:52:09.000000000 +0100
16540 +++ linux-2.6.33.2-vs2.3.0.36.30.4/init/Kconfig 2010-02-25 16:27:44.000000000 +0100
16541 @@ -496,8 +496,22 @@ config CGROUP_SCHED
16545 +config CFS_HARD_LIMITS
16546 + bool "Hard Limits for CFS Group Scheduler"
16547 + depends on EXPERIMENTAL
16548 + depends on FAIR_GROUP_SCHED && CGROUP_SCHED
16551 + This option enables hard limiting of CPU time obtained by
16552 + a fair task group. Use this if you want to throttle a group of tasks
16553 + based on its CPU usage. For more details refer to
16554 + Documentation/scheduler/sched-cfs-hard-limits.txt
16559 boolean "Control Group support"
16562 This option adds support for grouping sets of processes together, for
16563 use with process control subsystems such as Cpusets, CFS, memory
16564 @@ -525,6 +539,7 @@ config CGROUP_DEBUG
16566 bool "Namespace cgroup subsystem"
16570 Provides a simple namespace cgroup subsystem to
16571 provide hierarchical naming of sets of namespaces,
16572 diff -NurpP --minimal linux-2.6.33.2/init/main.c linux-2.6.33.2-vs2.3.0.36.30.4/init/main.c
16573 --- linux-2.6.33.2/init/main.c 2010-04-06 01:47:46.000000000 +0200
16574 +++ linux-2.6.33.2-vs2.3.0.36.30.4/init/main.c 2010-04-06 01:59:25.000000000 +0200
16576 #include <linux/sfi.h>
16577 #include <linux/shmem_fs.h>
16578 #include <trace/boot.h>
16579 +#include <linux/vserver/percpu.h>
16581 #include <asm/io.h>
16582 #include <asm/bugs.h>
16583 diff -NurpP --minimal linux-2.6.33.2/ipc/mqueue.c linux-2.6.33.2-vs2.3.0.36.30.4/ipc/mqueue.c
16584 --- linux-2.6.33.2/ipc/mqueue.c 2010-04-06 01:47:46.000000000 +0200
16585 +++ linux-2.6.33.2-vs2.3.0.36.30.4/ipc/mqueue.c 2010-04-06 01:59:25.000000000 +0200
16587 #include <linux/nsproxy.h>
16588 #include <linux/pid.h>
16589 #include <linux/ipc_namespace.h>
16590 +#include <linux/vs_context.h>
16591 +#include <linux/vs_limit.h>
16593 #include <net/sock.h>
16595 @@ -65,6 +67,7 @@ struct mqueue_inode_info {
16596 struct sigevent notify;
16597 struct pid* notify_owner;
16598 struct user_struct *user; /* user who created, for accounting */
16599 + struct vx_info *vxi;
16600 struct sock *notify_sock;
16601 struct sk_buff *notify_cookie;
16603 @@ -124,6 +127,7 @@ static struct inode *mqueue_get_inode(st
16604 if (S_ISREG(mode)) {
16605 struct mqueue_inode_info *info;
16606 struct task_struct *p = current;
16607 + struct vx_info *vxi = p->vx_info;
16608 unsigned long mq_bytes, mq_msg_tblsz;
16610 inode->i_fop = &mqueue_file_operations;
16611 @@ -138,6 +142,7 @@ static struct inode *mqueue_get_inode(st
16612 info->notify_owner = NULL;
16614 info->user = NULL; /* set when all is ok */
16615 + info->vxi = NULL;
16616 memset(&info->attr, 0, sizeof(info->attr));
16617 info->attr.mq_maxmsg = ipc_ns->mq_msg_max;
16618 info->attr.mq_msgsize = ipc_ns->mq_msgsize_max;
16619 @@ -152,22 +157,26 @@ static struct inode *mqueue_get_inode(st
16620 spin_lock(&mq_lock);
16621 if (u->mq_bytes + mq_bytes < u->mq_bytes ||
16622 u->mq_bytes + mq_bytes >
16623 - p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur) {
16624 + p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur ||
16625 + !vx_ipcmsg_avail(vxi, mq_bytes)) {
16626 spin_unlock(&mq_lock);
16629 u->mq_bytes += mq_bytes;
16630 + vx_ipcmsg_add(vxi, u, mq_bytes);
16631 spin_unlock(&mq_lock);
16633 info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL);
16634 if (!info->messages) {
16635 spin_lock(&mq_lock);
16636 u->mq_bytes -= mq_bytes;
16637 + vx_ipcmsg_sub(vxi, u, mq_bytes);
16638 spin_unlock(&mq_lock);
16642 info->user = get_uid(u);
16643 + info->vxi = get_vx_info(vxi);
16644 } else if (S_ISDIR(mode)) {
16646 /* Some things misbehave if size == 0 on a directory */
16647 @@ -268,8 +277,11 @@ static void mqueue_delete_inode(struct i
16648 (info->attr.mq_maxmsg * info->attr.mq_msgsize));
16651 + struct vx_info *vxi = info->vxi;
16653 spin_lock(&mq_lock);
16654 user->mq_bytes -= mq_bytes;
16655 + vx_ipcmsg_sub(vxi, user, mq_bytes);
16657 * get_ns_from_inode() ensures that the
16658 * (ipc_ns = sb->s_fs_info) is either a valid ipc_ns
16659 @@ -279,6 +291,7 @@ static void mqueue_delete_inode(struct i
16661 ipc_ns->mq_queues_count--;
16662 spin_unlock(&mq_lock);
16663 + put_vx_info(vxi);
16667 diff -NurpP --minimal linux-2.6.33.2/ipc/msg.c linux-2.6.33.2-vs2.3.0.36.30.4/ipc/msg.c
16668 --- linux-2.6.33.2/ipc/msg.c 2010-02-25 11:52:09.000000000 +0100
16669 +++ linux-2.6.33.2-vs2.3.0.36.30.4/ipc/msg.c 2010-02-25 12:02:16.000000000 +0100
16671 #include <linux/rwsem.h>
16672 #include <linux/nsproxy.h>
16673 #include <linux/ipc_namespace.h>
16674 +#include <linux/vs_base.h>
16676 #include <asm/current.h>
16677 #include <asm/uaccess.h>
16678 @@ -191,6 +192,7 @@ static int newque(struct ipc_namespace *
16680 msq->q_perm.mode = msgflg & S_IRWXUGO;
16681 msq->q_perm.key = key;
16682 + msq->q_perm.xid = vx_current_xid();
16684 msq->q_perm.security = NULL;
16685 retval = security_msg_queue_alloc(msq);
16686 diff -NurpP --minimal linux-2.6.33.2/ipc/namespace.c linux-2.6.33.2-vs2.3.0.36.30.4/ipc/namespace.c
16687 --- linux-2.6.33.2/ipc/namespace.c 2009-09-10 15:26:27.000000000 +0200
16688 +++ linux-2.6.33.2-vs2.3.0.36.30.4/ipc/namespace.c 2010-02-25 12:02:16.000000000 +0100
16690 #include <linux/slab.h>
16691 #include <linux/fs.h>
16692 #include <linux/mount.h>
16693 +#include <linux/vs_base.h>
16694 +#include <linux/vserver/global.h>
16698 diff -NurpP --minimal linux-2.6.33.2/ipc/sem.c linux-2.6.33.2-vs2.3.0.36.30.4/ipc/sem.c
16699 --- linux-2.6.33.2/ipc/sem.c 2010-02-25 11:52:09.000000000 +0100
16700 +++ linux-2.6.33.2-vs2.3.0.36.30.4/ipc/sem.c 2010-02-25 12:02:16.000000000 +0100
16702 #include <linux/rwsem.h>
16703 #include <linux/nsproxy.h>
16704 #include <linux/ipc_namespace.h>
16705 +#include <linux/vs_base.h>
16706 +#include <linux/vs_limit.h>
16708 #include <asm/uaccess.h>
16710 @@ -257,6 +259,7 @@ static int newary(struct ipc_namespace *
16712 sma->sem_perm.mode = (semflg & S_IRWXUGO);
16713 sma->sem_perm.key = key;
16714 + sma->sem_perm.xid = vx_current_xid();
16716 sma->sem_perm.security = NULL;
16717 retval = security_sem_alloc(sma);
16718 @@ -272,6 +275,9 @@ static int newary(struct ipc_namespace *
16721 ns->used_sems += nsems;
16722 + /* FIXME: obsoleted? */
16723 + vx_semary_inc(sma);
16724 + vx_nsems_add(sma, nsems);
16726 sma->sem_base = (struct sem *) &sma[1];
16728 @@ -595,6 +601,9 @@ static void freeary(struct ipc_namespace
16731 ns->used_sems -= sma->sem_nsems;
16732 + /* FIXME: obsoleted? */
16733 + vx_nsems_sub(sma, sma->sem_nsems);
16734 + vx_semary_dec(sma);
16735 security_sem_free(sma);
16736 ipc_rcu_putref(sma);
16738 diff -NurpP --minimal linux-2.6.33.2/ipc/shm.c linux-2.6.33.2-vs2.3.0.36.30.4/ipc/shm.c
16739 --- linux-2.6.33.2/ipc/shm.c 2010-02-25 11:52:09.000000000 +0100
16740 +++ linux-2.6.33.2-vs2.3.0.36.30.4/ipc/shm.c 2010-02-25 12:23:04.000000000 +0100
16742 #include <linux/nsproxy.h>
16743 #include <linux/mount.h>
16744 #include <linux/ipc_namespace.h>
16745 +#include <linux/vs_context.h>
16746 +#include <linux/vs_limit.h>
16748 #include <asm/uaccess.h>
16750 @@ -169,7 +171,12 @@ static void shm_open(struct vm_area_stru
16752 static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
16754 - ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
16755 + struct vx_info *vxi = lookup_vx_info(shp->shm_perm.xid);
16756 + int numpages = (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
16758 + vx_ipcshm_sub(vxi, shp, numpages);
16759 + ns->shm_tot -= numpages;
16763 if (!is_file_hugepages(shp->shm_file))
16764 @@ -179,6 +186,7 @@ static void shm_destroy(struct ipc_names
16766 fput (shp->shm_file);
16767 security_shm_free(shp);
16768 + put_vx_info(vxi);
16769 ipc_rcu_putref(shp);
16772 @@ -352,11 +360,15 @@ static int newseg(struct ipc_namespace *
16773 if (ns->shm_tot + numpages > ns->shm_ctlall)
16776 + if (!vx_ipcshm_avail(current_vx_info(), numpages))
16779 shp = ipc_rcu_alloc(sizeof(*shp));
16783 shp->shm_perm.key = key;
16784 + shp->shm_perm.xid = vx_current_xid();
16785 shp->shm_perm.mode = (shmflg & S_IRWXUGO);
16786 shp->mlock_user = NULL;
16788 @@ -410,6 +422,7 @@ static int newseg(struct ipc_namespace *
16789 ns->shm_tot += numpages;
16790 error = shp->shm_perm.id;
16792 + vx_ipcshm_add(current_vx_info(), key, numpages);
16796 diff -NurpP --minimal linux-2.6.33.2/kernel/capability.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/capability.c
16797 --- linux-2.6.33.2/kernel/capability.c 2010-02-25 11:52:09.000000000 +0100
16798 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/capability.c 2010-02-25 12:02:16.000000000 +0100
16800 #include <linux/security.h>
16801 #include <linux/syscalls.h>
16802 #include <linux/pid_namespace.h>
16803 +#include <linux/vs_context.h>
16804 #include <asm/uaccess.h>
16805 #include "cred-internals.h"
16807 @@ -120,6 +121,7 @@ static int cap_validate_magic(cap_user_h
16813 * The only thing that can change the capabilities of the current
16814 * process is the current process. As such, we can't be in this code
16815 @@ -290,6 +292,8 @@ error:
16819 +#include <linux/vserver/base.h>
16822 * capable - Determine if the current task has a superior capability in effect
16823 * @cap: The capability to be tested for
16824 @@ -302,6 +306,9 @@ error:
16826 int capable(int cap)
16828 + /* here for now so we don't require task locking */
16829 + if (vs_check_bit(VXC_CAP_MASK, cap) && !vx_mcaps(1L << cap))
16831 if (unlikely(!cap_valid(cap))) {
16832 printk(KERN_CRIT "capable() called with invalid cap=%u\n", cap);
16834 diff -NurpP --minimal linux-2.6.33.2/kernel/compat.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/compat.c
16835 --- linux-2.6.33.2/kernel/compat.c 2009-09-10 15:26:27.000000000 +0200
16836 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/compat.c 2010-02-25 12:02:16.000000000 +0100
16837 @@ -902,7 +902,7 @@ asmlinkage long compat_sys_time(compat_t
16841 - do_gettimeofday(&tv);
16842 + vx_gettimeofday(&tv);
16846 @@ -927,7 +927,7 @@ asmlinkage long compat_sys_stime(compat_
16850 - do_settimeofday(&tv);
16851 + vx_settimeofday(&tv);
16855 diff -NurpP --minimal linux-2.6.33.2/kernel/exit.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/exit.c
16856 --- linux-2.6.33.2/kernel/exit.c 2010-02-25 11:52:09.000000000 +0100
16857 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/exit.c 2010-02-25 12:02:16.000000000 +0100
16859 #include <linux/fs_struct.h>
16860 #include <linux/init_task.h>
16861 #include <linux/perf_event.h>
16862 +#include <linux/vs_limit.h>
16863 +#include <linux/vs_context.h>
16864 +#include <linux/vs_network.h>
16865 +#include <linux/vs_pid.h>
16866 #include <trace/events/sched.h>
16867 #include <linux/hw_breakpoint.h>
16869 @@ -489,9 +493,11 @@ static void close_files(struct files_str
16870 filp_close(file, files);
16873 + vx_openfd_dec(i);
16881 @@ -1019,11 +1025,16 @@ NORET_TYPE void do_exit(long code)
16883 validate_creds_for_do_exit(tsk);
16885 + /* needs to stay after exit_notify() */
16886 + exit_vx_info(tsk, code);
16887 + exit_nx_info(tsk);
16891 /* causes final put_task_struct in finish_task_switch(). */
16892 tsk->state = TASK_DEAD;
16894 + printk("bad task: %p [%lx]\n", current, current->state);
16896 /* Avoid "noreturn function does return". */
16898 diff -NurpP --minimal linux-2.6.33.2/kernel/fork.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/fork.c
16899 --- linux-2.6.33.2/kernel/fork.c 2010-02-25 11:52:09.000000000 +0100
16900 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/fork.c 2010-02-25 12:23:31.000000000 +0100
16902 #include <linux/perf_event.h>
16903 #include <linux/posix-timers.h>
16904 #include <linux/user-return-notifier.h>
16905 +#include <linux/vs_context.h>
16906 +#include <linux/vs_network.h>
16907 +#include <linux/vs_limit.h>
16908 +#include <linux/vs_memory.h>
16910 #include <asm/pgtable.h>
16911 #include <asm/pgalloc.h>
16912 @@ -152,6 +156,8 @@ void free_task(struct task_struct *tsk)
16913 account_kernel_stack(tsk->stack, -1);
16914 free_thread_info(tsk->stack);
16915 rt_mutex_debug_task_free(tsk);
16916 + clr_vx_info(&tsk->vx_info);
16917 + clr_nx_info(&tsk->nx_info);
16918 ftrace_graph_exit_task(tsk);
16919 free_task_struct(tsk);
16921 @@ -298,6 +304,8 @@ static int dup_mmap(struct mm_struct *mm
16922 mm->free_area_cache = oldmm->mmap_base;
16923 mm->cached_hole_size = ~0UL;
16925 + __set_mm_counter(mm, file_rss, 0);
16926 + __set_mm_counter(mm, anon_rss, 0);
16927 cpumask_clear(mm_cpumask(mm));
16928 mm->mm_rb = RB_ROOT;
16929 rb_link = &mm->mm_rb.rb_node;
16930 @@ -312,7 +320,7 @@ static int dup_mmap(struct mm_struct *mm
16932 if (mpnt->vm_flags & VM_DONTCOPY) {
16933 long pages = vma_pages(mpnt);
16934 - mm->total_vm -= pages;
16935 + vx_vmpages_sub(mm, pages);
16936 vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
16939 @@ -454,8 +462,8 @@ static struct mm_struct * mm_init(struct
16940 (current->mm->flags & MMF_INIT_MASK) : default_dump_filter;
16941 mm->core_state = NULL;
16943 - set_mm_counter(mm, file_rss, 0);
16944 - set_mm_counter(mm, anon_rss, 0);
16945 + __set_mm_counter(mm, file_rss, 0);
16946 + __set_mm_counter(mm, anon_rss, 0);
16947 spin_lock_init(&mm->page_table_lock);
16948 mm->free_area_cache = TASK_UNMAPPED_BASE;
16949 mm->cached_hole_size = ~0UL;
16950 @@ -465,6 +473,7 @@ static struct mm_struct * mm_init(struct
16951 if (likely(!mm_alloc_pgd(mm))) {
16953 mmu_notifier_mm_init(mm);
16954 + set_vx_info(&mm->mm_vx_info, p->vx_info);
16958 @@ -498,6 +507,7 @@ void __mmdrop(struct mm_struct *mm)
16960 destroy_context(mm);
16961 mmu_notifier_mm_destroy(mm);
16962 + clr_vx_info(&mm->mm_vx_info);
16965 EXPORT_SYMBOL_GPL(__mmdrop);
16966 @@ -633,6 +643,7 @@ struct mm_struct *dup_mm(struct task_str
16969 memcpy(mm, oldmm, sizeof(*mm));
16970 + mm->mm_vx_info = NULL;
16972 /* Initializing for Swap token stuff */
16973 mm->token_priority = 0;
16974 @@ -671,6 +682,7 @@ fail_nocontext:
16975 * If init_new_context() failed, we cannot use mmput() to free the mm
16976 * because it calls destroy_context()
16978 + clr_vx_info(&mm->mm_vx_info);
16982 @@ -985,6 +997,8 @@ static struct task_struct *copy_process(
16984 struct task_struct *p;
16985 int cgroup_callbacks_done = 0;
16986 + struct vx_info *vxi;
16987 + struct nx_info *nxi;
16989 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
16990 return ERR_PTR(-EINVAL);
16991 @@ -1031,12 +1045,28 @@ static struct task_struct *copy_process(
16992 DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
16993 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
16995 + init_vx_info(&p->vx_info, current_vx_info());
16996 + init_nx_info(&p->nx_info, current_nx_info());
16998 + /* check vserver memory */
16999 + if (p->mm && !(clone_flags & CLONE_VM)) {
17000 + if (vx_vmpages_avail(p->mm, p->mm->total_vm))
17001 + vx_pages_add(p->vx_info, RLIMIT_AS, p->mm->total_vm);
17003 + goto bad_fork_free;
17005 + if (p->mm && vx_flags(VXF_FORK_RSS, 0)) {
17006 + if (!vx_rss_avail(p->mm, get_mm_counter(p->mm, file_rss)))
17007 + goto bad_fork_cleanup_vm;
17010 + if (!vx_nproc_avail(1))
17011 + goto bad_fork_cleanup_vm;
17012 if (atomic_read(&p->real_cred->user->processes) >=
17013 p->signal->rlim[RLIMIT_NPROC].rlim_cur) {
17014 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
17015 p->real_cred->user != INIT_USER)
17016 - goto bad_fork_free;
17017 + goto bad_fork_cleanup_vm;
17020 retval = copy_creds(p, clone_flags);
17021 @@ -1297,6 +1327,18 @@ static struct task_struct *copy_process(
17024 spin_unlock(¤t->sighand->siglock);
17026 + /* p is copy of current */
17027 + vxi = p->vx_info;
17029 + claim_vx_info(vxi, p);
17030 + atomic_inc(&vxi->cvirt.nr_threads);
17031 + atomic_inc(&vxi->cvirt.total_forks);
17034 + nxi = p->nx_info;
17036 + claim_nx_info(nxi, p);
17037 write_unlock_irq(&tasklist_lock);
17038 proc_fork_connector(p);
17039 cgroup_post_fork(p);
17040 @@ -1339,6 +1381,9 @@ bad_fork_cleanup_cgroup:
17041 bad_fork_cleanup_count:
17042 atomic_dec(&p->cred->user->processes);
17044 +bad_fork_cleanup_vm:
17045 + if (p->mm && !(clone_flags & CLONE_VM))
17046 + vx_pages_sub(p->vx_info, RLIMIT_AS, p->mm->total_vm);
17050 diff -NurpP --minimal linux-2.6.33.2/kernel/kthread.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/kthread.c
17051 --- linux-2.6.33.2/kernel/kthread.c 2010-04-06 01:47:46.000000000 +0200
17052 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/kthread.c 2010-04-06 01:59:25.000000000 +0200
17054 #include <linux/file.h>
17055 #include <linux/module.h>
17056 #include <linux/mutex.h>
17057 +#include <linux/vs_pid.h>
17058 #include <trace/events/sched.h>
17060 static DEFINE_SPINLOCK(kthread_create_lock);
17061 diff -NurpP --minimal linux-2.6.33.2/kernel/Makefile linux-2.6.33.2-vs2.3.0.36.30.4/kernel/Makefile
17062 --- linux-2.6.33.2/kernel/Makefile 2010-02-25 11:52:09.000000000 +0100
17063 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/Makefile 2010-02-25 12:02:16.000000000 +0100
17064 @@ -24,6 +24,7 @@ CFLAGS_REMOVE_sched_clock.o = -pg
17065 CFLAGS_REMOVE_perf_event.o = -pg
17069 obj-$(CONFIG_FREEZER) += freezer.o
17070 obj-$(CONFIG_PROFILING) += profile.o
17071 obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
17072 diff -NurpP --minimal linux-2.6.33.2/kernel/nsproxy.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/nsproxy.c
17073 --- linux-2.6.33.2/kernel/nsproxy.c 2009-09-10 15:26:28.000000000 +0200
17074 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/nsproxy.c 2010-02-25 12:02:16.000000000 +0100
17076 #include <linux/mnt_namespace.h>
17077 #include <linux/utsname.h>
17078 #include <linux/pid_namespace.h>
17079 +#include <linux/vserver/global.h>
17080 +#include <linux/vserver/debug.h>
17081 #include <net/net_namespace.h>
17082 #include <linux/ipc_namespace.h>
17084 @@ -31,8 +33,11 @@ static inline struct nsproxy *create_nsp
17085 struct nsproxy *nsproxy;
17087 nsproxy = kmem_cache_alloc(nsproxy_cachep, GFP_KERNEL);
17090 atomic_set(&nsproxy->count, 1);
17091 + atomic_inc(&vs_global_nsproxy);
17093 + vxdprintk(VXD_CBIT(space, 2), "create_nsproxy = %p[1]", nsproxy);
17097 @@ -41,41 +46,52 @@ static inline struct nsproxy *create_nsp
17098 * Return the newly created nsproxy. Do not attach this to the task,
17099 * leave it to the caller to do proper locking and attach it to task.
17101 -static struct nsproxy *create_new_namespaces(unsigned long flags,
17102 - struct task_struct *tsk, struct fs_struct *new_fs)
17103 +static struct nsproxy *unshare_namespaces(unsigned long flags,
17104 + struct nsproxy *orig, struct fs_struct *new_fs)
17106 struct nsproxy *new_nsp;
17109 + vxdprintk(VXD_CBIT(space, 4),
17110 + "unshare_namespaces(0x%08lx,%p,%p)",
17111 + flags, orig, new_fs);
17113 new_nsp = create_nsproxy();
17115 return ERR_PTR(-ENOMEM);
17117 - new_nsp->mnt_ns = copy_mnt_ns(flags, tsk->nsproxy->mnt_ns, new_fs);
17118 + new_nsp->mnt_ns = copy_mnt_ns(flags, orig->mnt_ns, new_fs);
17119 if (IS_ERR(new_nsp->mnt_ns)) {
17120 err = PTR_ERR(new_nsp->mnt_ns);
17124 - new_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns);
17125 + new_nsp->uts_ns = copy_utsname(flags, orig->uts_ns);
17126 if (IS_ERR(new_nsp->uts_ns)) {
17127 err = PTR_ERR(new_nsp->uts_ns);
17131 - new_nsp->ipc_ns = copy_ipcs(flags, tsk->nsproxy->ipc_ns);
17132 + new_nsp->ipc_ns = copy_ipcs(flags, orig->ipc_ns);
17133 if (IS_ERR(new_nsp->ipc_ns)) {
17134 err = PTR_ERR(new_nsp->ipc_ns);
17138 - new_nsp->pid_ns = copy_pid_ns(flags, task_active_pid_ns(tsk));
17139 + new_nsp->pid_ns = copy_pid_ns(flags, orig->pid_ns);
17140 if (IS_ERR(new_nsp->pid_ns)) {
17141 err = PTR_ERR(new_nsp->pid_ns);
17145 - new_nsp->net_ns = copy_net_ns(flags, tsk->nsproxy->net_ns);
17147 + new_nsp->user_ns = copy_user_ns(flags, orig->user_ns);
17148 + if (IS_ERR(new_nsp->user_ns)) {
17149 + err = PTR_ERR(new_nsp->user_ns);
17153 + new_nsp->net_ns = copy_net_ns(flags, orig->net_ns);
17154 if (IS_ERR(new_nsp->net_ns)) {
17155 err = PTR_ERR(new_nsp->net_ns);
17157 @@ -100,6 +116,38 @@ out_ns:
17158 return ERR_PTR(err);
17161 +static struct nsproxy *create_new_namespaces(int flags, struct task_struct *tsk,
17162 + struct fs_struct *new_fs)
17164 + return unshare_namespaces(flags, tsk->nsproxy, new_fs);
17168 + * copies the nsproxy, setting refcount to 1, and grabbing a
17169 + * reference to all contained namespaces.
17171 +struct nsproxy *copy_nsproxy(struct nsproxy *orig)
17173 + struct nsproxy *ns = create_nsproxy();
17176 + memcpy(ns, orig, sizeof(struct nsproxy));
17177 + atomic_set(&ns->count, 1);
17180 + get_mnt_ns(ns->mnt_ns);
17182 + get_uts_ns(ns->uts_ns);
17184 + get_ipc_ns(ns->ipc_ns);
17186 + get_pid_ns(ns->pid_ns);
17188 + get_net(ns->net_ns);
17194 * called from clone. This now handles copy for nsproxy and all
17195 * namespaces therein.
17196 @@ -107,9 +155,12 @@ out_ns:
17197 int copy_namespaces(unsigned long flags, struct task_struct *tsk)
17199 struct nsproxy *old_ns = tsk->nsproxy;
17200 - struct nsproxy *new_ns;
17201 + struct nsproxy *new_ns = NULL;
17204 + vxdprintk(VXD_CBIT(space, 7), "copy_namespaces(0x%08lx,%p[%p])",
17205 + flags, tsk, old_ns);
17210 @@ -119,7 +170,7 @@ int copy_namespaces(unsigned long flags,
17211 CLONE_NEWPID | CLONE_NEWNET)))
17214 - if (!capable(CAP_SYS_ADMIN)) {
17215 + if (!vx_can_unshare(CAP_SYS_ADMIN, flags)) {
17219 @@ -146,6 +197,9 @@ int copy_namespaces(unsigned long flags,
17222 put_nsproxy(old_ns);
17223 + vxdprintk(VXD_CBIT(space, 3),
17224 + "copy_namespaces(0x%08lx,%p[%p]) = %d [%p]",
17225 + flags, tsk, old_ns, err, new_ns);
17229 @@ -159,7 +213,9 @@ void free_nsproxy(struct nsproxy *ns)
17230 put_ipc_ns(ns->ipc_ns);
17232 put_pid_ns(ns->pid_ns);
17233 - put_net(ns->net_ns);
17235 + put_net(ns->net_ns);
17236 + atomic_dec(&vs_global_nsproxy);
17237 kmem_cache_free(nsproxy_cachep, ns);
17240 @@ -172,11 +228,15 @@ int unshare_nsproxy_namespaces(unsigned
17244 + vxdprintk(VXD_CBIT(space, 4),
17245 + "unshare_nsproxy_namespaces(0x%08lx,[%p])",
17246 + unshare_flags, current->nsproxy);
17248 if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
17252 - if (!capable(CAP_SYS_ADMIN))
17253 + if (!vx_can_unshare(CAP_SYS_ADMIN, unshare_flags))
17256 *new_nsp = create_new_namespaces(unshare_flags, current,
17257 diff -NurpP --minimal linux-2.6.33.2/kernel/pid.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/pid.c
17258 --- linux-2.6.33.2/kernel/pid.c 2010-02-25 11:52:09.000000000 +0100
17259 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/pid.c 2010-02-25 12:02:16.000000000 +0100
17261 #include <linux/pid_namespace.h>
17262 #include <linux/init_task.h>
17263 #include <linux/syscalls.h>
17264 +#include <linux/vs_pid.h>
17266 #define pid_hashfn(nr, ns) \
17267 hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift)
17268 @@ -305,7 +306,7 @@ EXPORT_SYMBOL_GPL(find_pid_ns);
17270 struct pid *find_vpid(int nr)
17272 - return find_pid_ns(nr, current->nsproxy->pid_ns);
17273 + return find_pid_ns(vx_rmap_pid(nr), current->nsproxy->pid_ns);
17275 EXPORT_SYMBOL_GPL(find_vpid);
17277 @@ -365,6 +366,9 @@ void transfer_pid(struct task_struct *ol
17278 struct task_struct *pid_task(struct pid *pid, enum pid_type type)
17280 struct task_struct *result = NULL;
17282 + if (type == PIDTYPE_REALPID)
17283 + type = PIDTYPE_PID;
17285 struct hlist_node *first;
17286 first = rcu_dereference(pid->tasks[type].first);
17287 @@ -380,7 +384,7 @@ EXPORT_SYMBOL(pid_task);
17289 struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
17291 - return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
17292 + return pid_task(find_pid_ns(vx_rmap_pid(nr), ns), PIDTYPE_PID);
17295 struct task_struct *find_task_by_vpid(pid_t vnr)
17296 @@ -422,7 +426,7 @@ struct pid *find_get_pid(pid_t nr)
17298 EXPORT_SYMBOL_GPL(find_get_pid);
17300 -pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
17301 +pid_t pid_unmapped_nr_ns(struct pid *pid, struct pid_namespace *ns)
17305 @@ -435,6 +439,11 @@ pid_t pid_nr_ns(struct pid *pid, struct
17309 +pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
17311 + return vx_map_pid(pid_unmapped_nr_ns(pid, ns));
17314 pid_t pid_vnr(struct pid *pid)
17316 return pid_nr_ns(pid, current->nsproxy->pid_ns);
17317 diff -NurpP --minimal linux-2.6.33.2/kernel/pid_namespace.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/pid_namespace.c
17318 --- linux-2.6.33.2/kernel/pid_namespace.c 2009-12-03 20:02:58.000000000 +0100
17319 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/pid_namespace.c 2010-02-25 12:02:16.000000000 +0100
17321 #include <linux/syscalls.h>
17322 #include <linux/err.h>
17323 #include <linux/acct.h>
17324 +#include <linux/vserver/global.h>
17326 #define BITS_PER_PAGE (PAGE_SIZE*8)
17328 @@ -86,6 +87,7 @@ static struct pid_namespace *create_pid_
17331 kref_init(&ns->kref);
17332 + atomic_inc(&vs_global_pid_ns);
17334 ns->parent = get_pid_ns(parent_pid_ns);
17336 @@ -111,6 +113,7 @@ static void destroy_pid_namespace(struct
17338 for (i = 0; i < PIDMAP_ENTRIES; i++)
17339 kfree(ns->pidmap[i].page);
17340 + atomic_dec(&vs_global_pid_ns);
17341 kmem_cache_free(pid_ns_cachep, ns);
17344 diff -NurpP --minimal linux-2.6.33.2/kernel/posix-timers.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/posix-timers.c
17345 --- linux-2.6.33.2/kernel/posix-timers.c 2009-12-03 20:02:58.000000000 +0100
17346 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/posix-timers.c 2010-02-25 12:02:16.000000000 +0100
17348 #include <linux/wait.h>
17349 #include <linux/workqueue.h>
17350 #include <linux/module.h>
17351 +#include <linux/vs_context.h>
17354 * Management arrays for POSIX timers. Timers are kept in slab memory
17355 @@ -363,6 +364,7 @@ int posix_timer_event(struct k_itimer *t
17357 struct task_struct *task;
17358 int shared, ret = -1;
17361 * FIXME: if ->sigq is queued we can race with
17362 * dequeue_signal()->do_schedule_next_timer().
17363 @@ -379,10 +381,18 @@ int posix_timer_event(struct k_itimer *t
17365 task = pid_task(timr->it_pid, PIDTYPE_PID);
17367 + struct vx_info_save vxis;
17368 + struct vx_info *vxi;
17370 + vxi = get_vx_info(task->vx_info);
17371 + enter_vx_info(vxi, &vxis);
17372 shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
17373 ret = send_sigqueue(timr->sigq, task, shared);
17374 + leave_vx_info(&vxis);
17375 + put_vx_info(vxi);
17379 /* If we failed to send the signal the timer stops. */
17382 diff -NurpP --minimal linux-2.6.33.2/kernel/printk.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/printk.c
17383 --- linux-2.6.33.2/kernel/printk.c 2010-02-25 11:52:09.000000000 +0100
17384 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/printk.c 2010-02-25 13:11:15.000000000 +0100
17386 #include <linux/kexec.h>
17387 #include <linux/ratelimit.h>
17388 #include <linux/kmsg_dump.h>
17389 +#include <linux/vs_cvirt.h>
17391 #include <asm/uaccess.h>
17393 @@ -278,18 +279,13 @@ int do_syslog(int type, char __user *buf
17394 unsigned i, j, limit, count;
17400 error = security_syslog(type);
17405 - case 0: /* Close log */
17407 - case 1: /* Open log */
17409 - case 2: /* Read from log */
17410 + if ((type >= 2) && (type <= 4)) {
17412 if (!buf || len < 0)
17414 @@ -300,6 +296,16 @@ int do_syslog(int type, char __user *buf
17419 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
17420 + return vx_do_syslog(type, buf, len);
17423 + case 0: /* Close log */
17425 + case 1: /* Open log */
17427 + case 2: /* Read from log */
17428 error = wait_event_interruptible(log_wait,
17429 (log_start - log_end));
17431 @@ -324,16 +330,6 @@ int do_syslog(int type, char __user *buf
17434 case 3: /* Read last kernel messages */
17436 - if (!buf || len < 0)
17441 - if (!access_ok(VERIFY_WRITE, buf, len)) {
17446 if (count > log_buf_len)
17447 count = log_buf_len;
17448 diff -NurpP --minimal linux-2.6.33.2/kernel/ptrace.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/ptrace.c
17449 --- linux-2.6.33.2/kernel/ptrace.c 2009-12-03 20:02:58.000000000 +0100
17450 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/ptrace.c 2010-02-25 12:02:16.000000000 +0100
17452 #include <linux/pid_namespace.h>
17453 #include <linux/syscalls.h>
17454 #include <linux/uaccess.h>
17455 +#include <linux/vs_context.h>
17459 @@ -151,6 +152,11 @@ int __ptrace_may_access(struct task_stru
17460 dumpable = get_dumpable(task->mm);
17461 if (!dumpable && !capable(CAP_SYS_PTRACE))
17463 + if (!vx_check(task->xid, VS_ADMIN_P|VS_IDENT))
17465 + if (!vx_check(task->xid, VS_IDENT) &&
17466 + !task_vx_flags(task, VXF_STATE_ADMIN, 0))
17469 return security_ptrace_access_check(task, mode);
17471 @@ -621,6 +627,10 @@ SYSCALL_DEFINE4(ptrace, long, request, l
17476 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
17477 + goto out_put_task_struct;
17479 if (request == PTRACE_ATTACH) {
17480 ret = ptrace_attach(child);
17482 diff -NurpP --minimal linux-2.6.33.2/kernel/sched.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sched.c
17483 --- linux-2.6.33.2/kernel/sched.c 2010-04-06 01:47:46.000000000 +0200
17484 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sched.c 2010-04-06 01:59:25.000000000 +0200
17486 #include <linux/debugfs.h>
17487 #include <linux/ctype.h>
17488 #include <linux/ftrace.h>
17489 +#include <linux/vs_sched.h>
17490 +#include <linux/vs_cvirt.h>
17492 #include <asm/tlb.h>
17493 #include <asm/irq_regs.h>
17494 @@ -3009,9 +3011,17 @@ EXPORT_SYMBOL(avenrun);
17496 void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
17498 - loads[0] = (avenrun[0] + offset) << shift;
17499 - loads[1] = (avenrun[1] + offset) << shift;
17500 - loads[2] = (avenrun[2] + offset) << shift;
17501 + if (vx_flags(VXF_VIRT_LOAD, 0)) {
17502 + struct vx_info *vxi = current_vx_info();
17504 + loads[0] = (vxi->cvirt.load[0] + offset) << shift;
17505 + loads[1] = (vxi->cvirt.load[1] + offset) << shift;
17506 + loads[2] = (vxi->cvirt.load[2] + offset) << shift;
17508 + loads[0] = (avenrun[0] + offset) << shift;
17509 + loads[1] = (avenrun[1] + offset) << shift;
17510 + loads[2] = (avenrun[2] + offset) << shift;
17514 static unsigned long
17515 @@ -5067,16 +5077,19 @@ void account_user_time(struct task_struc
17516 cputime_t cputime_scaled)
17518 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
17519 + struct vx_info *vxi = p->vx_info; /* p is _always_ current */
17521 + int nice = (TASK_NICE(p) > 0);
17523 /* Add user time to process. */
17524 p->utime = cputime_add(p->utime, cputime);
17525 p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
17526 + vx_account_user(vxi, cputime, nice);
17527 account_group_user_time(p, cputime);
17529 /* Add user time to cpustat. */
17530 tmp = cputime_to_cputime64(cputime);
17531 - if (TASK_NICE(p) > 0)
17533 cpustat->nice = cputime64_add(cpustat->nice, tmp);
17535 cpustat->user = cputime64_add(cpustat->user, tmp);
17536 @@ -5127,6 +5140,7 @@ void account_system_time(struct task_str
17537 cputime_t cputime, cputime_t cputime_scaled)
17539 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
17540 + struct vx_info *vxi = p->vx_info; /* p is _always_ current */
17543 if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
17544 @@ -5137,6 +5151,7 @@ void account_system_time(struct task_str
17545 /* Add system time to process. */
17546 p->stime = cputime_add(p->stime, cputime);
17547 p->stimescaled = cputime_add(p->stimescaled, cputime_scaled);
17548 + vx_account_system(vxi, cputime, 0 /* do we have idle time? */);
17549 account_group_system_time(p, cputime);
17551 /* Add system time to cpustat. */
17552 @@ -6202,7 +6217,7 @@ SYSCALL_DEFINE1(nice, int, increment)
17555 if (increment < 0 && !can_nice(current, nice))
17557 + return vx_flags(VXF_IGNEG_NICE, 0) ? 0 : -EPERM;
17559 retval = security_task_setnice(current, nice);
17561 diff -NurpP --minimal linux-2.6.33.2/kernel/sched_fair.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sched_fair.c
17562 --- linux-2.6.33.2/kernel/sched_fair.c 2010-02-25 11:52:09.000000000 +0100
17563 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sched_fair.c 2010-03-18 17:25:17.000000000 +0100
17564 @@ -794,6 +794,9 @@ enqueue_entity(struct cfs_rq *cfs_rq, st
17565 check_spread(cfs_rq, se);
17566 if (se != cfs_rq->curr)
17567 __enqueue_entity(cfs_rq, se);
17569 + if (entity_is_task(se))
17570 + vx_activate_task(task_of(se));
17573 static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
17574 @@ -837,6 +840,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
17576 if (se != cfs_rq->curr)
17577 __dequeue_entity(cfs_rq, se);
17578 + if (entity_is_task(se))
17579 + vx_deactivate_task(task_of(se));
17580 account_entity_dequeue(cfs_rq, se);
17581 update_min_vruntime(cfs_rq);
17583 diff -NurpP --minimal linux-2.6.33.2/kernel/signal.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/signal.c
17584 --- linux-2.6.33.2/kernel/signal.c 2010-02-25 11:52:09.000000000 +0100
17585 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/signal.c 2010-03-10 20:32:43.000000000 +0100
17587 #include <linux/freezer.h>
17588 #include <linux/pid_namespace.h>
17589 #include <linux/nsproxy.h>
17590 +#include <linux/vs_context.h>
17591 +#include <linux/vs_pid.h>
17592 #define CREATE_TRACE_POINTS
17593 #include <trace/events/signal.h>
17595 @@ -629,9 +631,18 @@ static int check_kill_permission(int sig
17599 + vxdprintk(VXD_CBIT(misc, 7),
17600 + "check_kill_permission(%d,%p,%p[#%u,%u])",
17601 + sig, info, t, vx_task_xid(t), t->pid);
17603 if (!valid_signal(sig))
17606 +/* FIXME: needed? if so, why?
17607 + if ((info != SEND_SIG_NOINFO) &&
17608 + (is_si_special(info) || !si_fromuser(info)))
17611 if (!si_fromuser(info))
17614 @@ -659,6 +670,20 @@ static int check_kill_permission(int sig
17619 + if (t->pid == 1 && current->xid)
17623 + /* FIXME: we shouldn't return ESRCH ever, to avoid
17624 + loops, maybe ENOENT or EACCES? */
17625 + if (!vx_check(vx_task_xid(t), VS_WATCH_P | VS_IDENT)) {
17626 + vxdprintk(current->xid || VXD_CBIT(misc, 7),
17627 + "signal %d[%p] xid mismatch %p[#%u,%u] xid=#%u",
17628 + sig, info, t, vx_task_xid(t), t->pid, current->xid);
17632 return security_task_kill(t, info, sig, 0);
17635 @@ -1147,7 +1172,7 @@ int kill_pid_info(int sig, struct siginf
17638 p = pid_task(pid, PIDTYPE_PID);
17640 + if (p && vx_check(vx_task_xid(p), VS_IDENT)) {
17641 error = group_send_sig_info(sig, info, p);
17642 if (unlikely(error == -ESRCH))
17644 @@ -1187,7 +1212,7 @@ int kill_pid_info_as_uid(int sig, struct
17647 p = pid_task(pid, PIDTYPE_PID);
17649 + if (!p || !vx_check(vx_task_xid(p), VS_IDENT)) {
17653 @@ -1242,8 +1267,10 @@ static int kill_something_info(int sig,
17654 struct task_struct * p;
17656 for_each_process(p) {
17657 - if (task_pid_vnr(p) > 1 &&
17658 - !same_thread_group(p, current)) {
17659 + if (vx_check(vx_task_xid(p), VS_ADMIN|VS_IDENT) &&
17660 + task_pid_vnr(p) > 1 &&
17661 + !same_thread_group(p, current) &&
17662 + !vx_current_initpid(p->pid)) {
17663 int err = group_send_sig_info(sig, info, p);
17666 @@ -1910,6 +1937,11 @@ relock:
17667 !sig_kernel_only(signr))
17670 + /* virtual init is protected against user signals */
17671 + if ((info->si_code == SI_USER) &&
17672 + vx_current_initpid(current->pid))
17675 if (sig_kernel_stop(signr)) {
17677 * The default action is to stop all threads in
17678 diff -NurpP --minimal linux-2.6.33.2/kernel/softirq.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/softirq.c
17679 --- linux-2.6.33.2/kernel/softirq.c 2010-02-25 11:52:09.000000000 +0100
17680 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/softirq.c 2010-02-25 12:02:16.000000000 +0100
17682 #include <linux/ftrace.h>
17683 #include <linux/smp.h>
17684 #include <linux/tick.h>
17685 +#include <linux/vs_context.h>
17687 #define CREATE_TRACE_POINTS
17688 #include <trace/events/irq.h>
17689 diff -NurpP --minimal linux-2.6.33.2/kernel/sys.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sys.c
17690 --- linux-2.6.33.2/kernel/sys.c 2010-02-25 11:52:09.000000000 +0100
17691 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sys.c 2010-02-25 13:13:03.000000000 +0100
17693 #include <linux/syscalls.h>
17694 #include <linux/kprobes.h>
17695 #include <linux/user_namespace.h>
17696 +#include <linux/vs_pid.h>
17698 #include <asm/uaccess.h>
17699 #include <asm/io.h>
17700 @@ -129,7 +130,10 @@ static int set_one_prio(struct task_stru
17703 if (niceval < task_nice(p) && !can_nice(p, niceval)) {
17705 + if (vx_flags(VXF_IGNEG_NICE, 0))
17711 no_nice = security_task_setnice(p, niceval);
17712 @@ -179,6 +183,8 @@ SYSCALL_DEFINE3(setpriority, int, which,
17714 pgrp = task_pgrp(current);
17715 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
17716 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
17718 error = set_one_prio(p, niceval, error);
17719 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
17721 @@ -242,6 +248,8 @@ SYSCALL_DEFINE2(getpriority, int, which,
17723 pgrp = task_pgrp(current);
17724 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
17725 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
17727 niceval = 20 - task_nice(p);
17728 if (niceval > retval)
17730 @@ -355,6 +363,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
17732 static DEFINE_MUTEX(reboot_mutex);
17734 +long vs_reboot(unsigned int, void __user *);
17737 * Reboot system call: for obvious reasons only root may call it,
17738 * and even root needs to set up some magic numbers in the registers
17739 @@ -387,6 +397,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
17740 if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
17741 cmd = LINUX_REBOOT_CMD_HALT;
17743 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
17744 + return vs_reboot(cmd, arg);
17746 mutex_lock(&reboot_mutex);
17748 case LINUX_REBOOT_CMD_RESTART:
17749 @@ -1136,7 +1149,7 @@ SYSCALL_DEFINE2(sethostname, char __user
17751 char tmp[__NEW_UTS_LEN];
17753 - if (!capable(CAP_SYS_ADMIN))
17754 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
17756 if (len < 0 || len > __NEW_UTS_LEN)
17758 @@ -1185,7 +1198,7 @@ SYSCALL_DEFINE2(setdomainname, char __us
17760 char tmp[__NEW_UTS_LEN];
17762 - if (!capable(CAP_SYS_ADMIN))
17763 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
17765 if (len < 0 || len > __NEW_UTS_LEN)
17767 @@ -1254,7 +1267,7 @@ SYSCALL_DEFINE2(setrlimit, unsigned int,
17769 old_rlim = current->signal->rlim + resource;
17770 if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
17771 - !capable(CAP_SYS_RESOURCE))
17772 + !vx_capable(CAP_SYS_RESOURCE, VXC_SET_RLIMIT))
17774 if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
17776 diff -NurpP --minimal linux-2.6.33.2/kernel/sysctl_binary.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sysctl_binary.c
17777 --- linux-2.6.33.2/kernel/sysctl_binary.c 2010-02-25 11:52:09.000000000 +0100
17778 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sysctl_binary.c 2010-02-25 12:40:06.000000000 +0100
17779 @@ -71,6 +71,7 @@ static const struct bin_table bin_kern_t
17781 { CTL_INT, KERN_PANIC, "panic" },
17782 { CTL_INT, KERN_REALROOTDEV, "real-root-dev" },
17783 + { CTL_STR, KERN_VSHELPER, "vshelper" },
17785 { CTL_STR, KERN_SPARC_REBOOT, "reboot-cmd" },
17786 { CTL_INT, KERN_CTLALTDEL, "ctrl-alt-del" },
17787 diff -NurpP --minimal linux-2.6.33.2/kernel/sysctl.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sysctl.c
17788 --- linux-2.6.33.2/kernel/sysctl.c 2010-02-25 11:52:09.000000000 +0100
17789 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/sysctl.c 2010-02-25 14:43:48.000000000 +0100
17790 @@ -123,6 +123,7 @@ static int ngroups_max = NGROUPS_MAX;
17791 extern char modprobe_path[];
17792 extern int modules_disabled;
17794 +extern char vshelper_path[];
17795 #ifdef CONFIG_CHR_DEV_SG
17796 extern int sg_big_buff;
17798 @@ -553,6 +554,13 @@ static struct ctl_table kern_table[] = {
17799 .proc_handler = proc_dostring,
17803 + .procname = "vshelper",
17804 + .data = &vshelper_path,
17807 + .proc_handler = &proc_dostring,
17809 #ifdef CONFIG_CHR_DEV_SG
17811 .procname = "sg-big-buff",
17812 diff -NurpP --minimal linux-2.6.33.2/kernel/time.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/time.c
17813 --- linux-2.6.33.2/kernel/time.c 2010-02-25 11:52:09.000000000 +0100
17814 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/time.c 2010-02-25 12:02:16.000000000 +0100
17815 @@ -63,6 +63,7 @@ EXPORT_SYMBOL(sys_tz);
17816 SYSCALL_DEFINE1(time, time_t __user *, tloc)
17818 time_t i = get_seconds();
17819 +/* FIXME: do_gettimeofday(&tv) -> vx_gettimeofday(&tv) */
17822 if (put_user(i,tloc))
17823 @@ -93,7 +94,7 @@ SYSCALL_DEFINE1(stime, time_t __user *,
17827 - do_settimeofday(&tv);
17828 + vx_settimeofday(&tv);
17832 @@ -104,7 +105,7 @@ SYSCALL_DEFINE2(gettimeofday, struct tim
17834 if (likely(tv != NULL)) {
17835 struct timeval ktv;
17836 - do_gettimeofday(&ktv);
17837 + vx_gettimeofday(&ktv);
17838 if (copy_to_user(tv, &ktv, sizeof(ktv)))
17841 @@ -179,7 +180,7 @@ int do_sys_settimeofday(struct timespec
17842 /* SMP safe, again the code in arch/foo/time.c should
17843 * globally block out interrupts when it runs.
17845 - return do_settimeofday(tv);
17846 + return vx_settimeofday(tv);
17850 @@ -311,7 +312,7 @@ void getnstimeofday(struct timespec *tv)
17854 - do_gettimeofday(&x);
17855 + vx_gettimeofday(&x);
17856 tv->tv_sec = x.tv_sec;
17857 tv->tv_nsec = x.tv_usec * NSEC_PER_USEC;
17859 diff -NurpP --minimal linux-2.6.33.2/kernel/timer.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/timer.c
17860 --- linux-2.6.33.2/kernel/timer.c 2010-02-25 11:52:09.000000000 +0100
17861 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/timer.c 2010-02-25 12:02:16.000000000 +0100
17863 #include <linux/kallsyms.h>
17864 #include <linux/perf_event.h>
17865 #include <linux/sched.h>
17866 +#include <linux/vs_base.h>
17867 +#include <linux/vs_cvirt.h>
17868 +#include <linux/vs_pid.h>
17869 +#include <linux/vserver/sched.h>
17871 #include <asm/uaccess.h>
17872 #include <asm/unistd.h>
17873 @@ -1252,12 +1256,6 @@ SYSCALL_DEFINE1(alarm, unsigned int, sec
17880 - * The Alpha uses getxpid, getxuid, and getxgid instead. Maybe this
17881 - * should be moved into arch/i386 instead?
17885 * sys_getpid - return the thread group id of the current process
17886 @@ -1286,10 +1284,23 @@ SYSCALL_DEFINE0(getppid)
17888 pid = task_tgid_vnr(current->real_parent);
17890 + return vx_map_pid(pid);
17897 + * The Alpha uses getxpid, getxuid, and getxgid instead.
17900 +asmlinkage long do_getxpid(long *ppid)
17902 + *ppid = sys_getppid();
17903 + return sys_getpid();
17906 +#else /* _alpha_ */
17908 SYSCALL_DEFINE0(getuid)
17910 /* Only we change this so SMP safe */
17911 diff -NurpP --minimal linux-2.6.33.2/kernel/user.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/user.c
17912 --- linux-2.6.33.2/kernel/user.c 2009-12-03 20:02:58.000000000 +0100
17913 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/user.c 2010-02-25 12:02:16.000000000 +0100
17914 @@ -251,10 +251,10 @@ static struct kobj_type uids_ktype = {
17916 * See Documentation/scheduler/sched-design-CFS.txt for ramifications.
17918 -static int uids_user_create(struct user_struct *up)
17919 +static int uids_user_create(struct user_namespace *ns, struct user_struct *up)
17921 struct kobject *kobj = &up->kobj;
17925 memset(kobj, 0, sizeof(struct kobject));
17926 if (up->user_ns != &init_user_ns)
17927 @@ -282,7 +282,7 @@ int __init uids_sysfs_init(void)
17931 - return uids_user_create(&root_user);
17932 + return uids_user_create(NULL, &root_user);
17935 /* delayed work function to remove sysfs directory for a user and free up
17936 @@ -353,7 +353,8 @@ static struct user_struct *uid_hash_find
17939 int uids_sysfs_init(void) { return 0; }
17940 -static inline int uids_user_create(struct user_struct *up) { return 0; }
17941 +static inline int uids_user_create(struct user_namespace *ns,
17942 + struct user_struct *up) { return 0; }
17943 static inline void uids_mutex_lock(void) { }
17944 static inline void uids_mutex_unlock(void) { }
17946 @@ -450,7 +451,7 @@ struct user_struct *alloc_uid(struct use
17948 new->user_ns = get_user_ns(ns);
17950 - if (uids_user_create(new))
17951 + if (uids_user_create(ns, new))
17952 goto out_destoy_sched;
17955 diff -NurpP --minimal linux-2.6.33.2/kernel/user_namespace.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/user_namespace.c
17956 --- linux-2.6.33.2/kernel/user_namespace.c 2009-03-24 14:22:45.000000000 +0100
17957 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/user_namespace.c 2010-02-25 12:02:16.000000000 +0100
17959 #include <linux/slab.h>
17960 #include <linux/user_namespace.h>
17961 #include <linux/cred.h>
17962 +#include <linux/vserver/global.h>
17965 * Create a new user namespace, deriving the creator from the user in the
17966 @@ -30,6 +31,7 @@ int create_user_ns(struct cred *new)
17969 kref_init(&ns->kref);
17970 + atomic_inc(&vs_global_user_ns);
17972 for (n = 0; n < UIDHASH_SZ; ++n)
17973 INIT_HLIST_HEAD(ns->uidhash_table + n);
17974 @@ -78,6 +80,8 @@ void free_user_ns(struct kref *kref)
17975 struct user_namespace *ns =
17976 container_of(kref, struct user_namespace, kref);
17978 + /* FIXME: maybe move into destroyer? */
17979 + atomic_dec(&vs_global_user_ns);
17980 INIT_WORK(&ns->destroyer, free_user_ns_work);
17981 schedule_work(&ns->destroyer);
17983 diff -NurpP --minimal linux-2.6.33.2/kernel/utsname.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/utsname.c
17984 --- linux-2.6.33.2/kernel/utsname.c 2009-09-10 15:26:28.000000000 +0200
17985 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/utsname.c 2010-02-25 12:02:16.000000000 +0100
17986 @@ -14,14 +14,17 @@
17987 #include <linux/utsname.h>
17988 #include <linux/err.h>
17989 #include <linux/slab.h>
17990 +#include <linux/vserver/global.h>
17992 static struct uts_namespace *create_uts_ns(void)
17994 struct uts_namespace *uts_ns;
17996 uts_ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL);
17999 kref_init(&uts_ns->kref);
18000 + atomic_inc(&vs_global_uts_ns);
18005 @@ -71,5 +74,6 @@ void free_uts_ns(struct kref *kref)
18006 struct uts_namespace *ns;
18008 ns = container_of(kref, struct uts_namespace, kref);
18009 + atomic_dec(&vs_global_uts_ns);
18012 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/cacct.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cacct.c
18013 --- linux-2.6.33.2/kernel/vserver/cacct.c 1970-01-01 01:00:00.000000000 +0100
18014 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cacct.c 2010-02-25 12:02:16.000000000 +0100
18017 + * linux/kernel/vserver/cacct.c
18019 + * Virtual Server: Context Accounting
18021 + * Copyright (C) 2006-2007 Herbert Pötzl
18023 + * V0.01 added accounting stats
18027 +#include <linux/types.h>
18028 +#include <linux/vs_context.h>
18029 +#include <linux/vserver/cacct_cmd.h>
18030 +#include <linux/vserver/cacct_int.h>
18032 +#include <asm/errno.h>
18033 +#include <asm/uaccess.h>
18036 +int vc_sock_stat(struct vx_info *vxi, void __user *data)
18038 + struct vcmd_sock_stat_v0 vc_data;
18041 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18044 + field = vc_data.field;
18045 + if ((field < 0) || (field >= VXA_SOCK_SIZE))
18048 + for (j = 0; j < 3; j++) {
18049 + vc_data.count[j] = vx_sock_count(&vxi->cacct, field, j);
18050 + vc_data.total[j] = vx_sock_total(&vxi->cacct, field, j);
18053 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18058 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/cacct_init.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cacct_init.h
18059 --- linux-2.6.33.2/kernel/vserver/cacct_init.h 1970-01-01 01:00:00.000000000 +0100
18060 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cacct_init.h 2010-02-25 12:02:16.000000000 +0100
18064 +static inline void vx_info_init_cacct(struct _vx_cacct *cacct)
18069 + for (i = 0; i < VXA_SOCK_SIZE; i++) {
18070 + for (j = 0; j < 3; j++) {
18071 + atomic_long_set(&cacct->sock[i][j].count, 0);
18072 + atomic_long_set(&cacct->sock[i][j].total, 0);
18075 + for (i = 0; i < 8; i++)
18076 + atomic_set(&cacct->slab[i], 0);
18077 + for (i = 0; i < 5; i++)
18078 + for (j = 0; j < 4; j++)
18079 + atomic_set(&cacct->page[i][j], 0);
18082 +static inline void vx_info_exit_cacct(struct _vx_cacct *cacct)
18087 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/cacct_proc.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cacct_proc.h
18088 --- linux-2.6.33.2/kernel/vserver/cacct_proc.h 1970-01-01 01:00:00.000000000 +0100
18089 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cacct_proc.h 2010-02-25 12:02:16.000000000 +0100
18091 +#ifndef _VX_CACCT_PROC_H
18092 +#define _VX_CACCT_PROC_H
18094 +#include <linux/vserver/cacct_int.h>
18097 +#define VX_SOCKA_TOP \
18098 + "Type\t recv #/bytes\t\t send #/bytes\t\t fail #/bytes\n"
18100 +static inline int vx_info_proc_cacct(struct _vx_cacct *cacct, char *buffer)
18102 + int i, j, length = 0;
18103 + static char *type[VXA_SOCK_SIZE] = {
18104 + "UNSPEC", "UNIX", "INET", "INET6", "PACKET", "OTHER"
18107 + length += sprintf(buffer + length, VX_SOCKA_TOP);
18108 + for (i = 0; i < VXA_SOCK_SIZE; i++) {
18109 + length += sprintf(buffer + length, "%s:", type[i]);
18110 + for (j = 0; j < 3; j++) {
18111 + length += sprintf(buffer + length,
18112 + "\t%10lu/%-10lu",
18113 + vx_sock_count(cacct, i, j),
18114 + vx_sock_total(cacct, i, j));
18116 + buffer[length++] = '\n';
18119 + length += sprintf(buffer + length, "\n");
18120 + length += sprintf(buffer + length,
18121 + "slab:\t %8u %8u %8u %8u\n",
18122 + atomic_read(&cacct->slab[1]),
18123 + atomic_read(&cacct->slab[4]),
18124 + atomic_read(&cacct->slab[0]),
18125 + atomic_read(&cacct->slab[2]));
18127 + length += sprintf(buffer + length, "\n");
18128 + for (i = 0; i < 5; i++) {
18129 + length += sprintf(buffer + length,
18130 + "page[%d]: %8u %8u %8u %8u\t %8u %8u %8u %8u\n", i,
18131 + atomic_read(&cacct->page[i][0]),
18132 + atomic_read(&cacct->page[i][1]),
18133 + atomic_read(&cacct->page[i][2]),
18134 + atomic_read(&cacct->page[i][3]),
18135 + atomic_read(&cacct->page[i][4]),
18136 + atomic_read(&cacct->page[i][5]),
18137 + atomic_read(&cacct->page[i][6]),
18138 + atomic_read(&cacct->page[i][7]));
18143 +#endif /* _VX_CACCT_PROC_H */
18144 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/context.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/context.c
18145 --- linux-2.6.33.2/kernel/vserver/context.c 1970-01-01 01:00:00.000000000 +0100
18146 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/context.c 2010-03-10 20:35:53.000000000 +0100
18149 + * linux/kernel/vserver/context.c
18151 + * Virtual Server: Context Support
18153 + * Copyright (C) 2003-2007 Herbert Pötzl
18155 + * V0.01 context helper
18156 + * V0.02 vx_ctx_kill syscall command
18157 + * V0.03 replaced context_info calls
18158 + * V0.04 redesign of struct (de)alloc
18159 + * V0.05 rlimit basic implementation
18160 + * V0.06 task_xid and info commands
18161 + * V0.07 context flags and caps
18162 + * V0.08 switch to RCU based hash
18163 + * V0.09 revert to non RCU for now
18164 + * V0.10 and back to working RCU hash
18165 + * V0.11 and back to locking again
18166 + * V0.12 referenced context store
18167 + * V0.13 separate per cpu data
18168 + * V0.14 changed vcmds to vxi arg
18169 + * V0.15 added context stat
18170 + * V0.16 have __create claim() the vxi
18171 + * V0.17 removed older and legacy stuff
18175 +#include <linux/slab.h>
18176 +#include <linux/types.h>
18177 +#include <linux/security.h>
18178 +#include <linux/pid_namespace.h>
18180 +#include <linux/vserver/context.h>
18181 +#include <linux/vserver/network.h>
18182 +#include <linux/vserver/debug.h>
18183 +#include <linux/vserver/limit.h>
18184 +#include <linux/vserver/limit_int.h>
18185 +#include <linux/vserver/space.h>
18186 +#include <linux/init_task.h>
18187 +#include <linux/fs_struct.h>
18189 +#include <linux/vs_context.h>
18190 +#include <linux/vs_limit.h>
18191 +#include <linux/vs_pid.h>
18192 +#include <linux/vserver/context_cmd.h>
18194 +#include "cvirt_init.h"
18195 +#include "cacct_init.h"
18196 +#include "limit_init.h"
18197 +#include "sched_init.h"
18200 +atomic_t vx_global_ctotal = ATOMIC_INIT(0);
18201 +atomic_t vx_global_cactive = ATOMIC_INIT(0);
18204 +/* now inactive context structures */
18206 +static struct hlist_head vx_info_inactive = HLIST_HEAD_INIT;
18208 +static spinlock_t vx_info_inactive_lock = SPIN_LOCK_UNLOCKED;
18211 +/* __alloc_vx_info()
18213 + * allocate an initialized vx_info struct
18214 + * doesn't make it visible (hash) */
18216 +static struct vx_info *__alloc_vx_info(xid_t xid)
18218 + struct vx_info *new = NULL;
18221 + vxdprintk(VXD_CBIT(xid, 0), "alloc_vx_info(%d)*", xid);
18223 + /* would this benefit from a slab cache? */
18224 + new = kmalloc(sizeof(struct vx_info), GFP_KERNEL);
18228 + memset(new, 0, sizeof(struct vx_info));
18230 + new->ptr_pc = alloc_percpu(struct _vx_info_pc);
18231 + if (!new->ptr_pc)
18234 + new->vx_id = xid;
18235 + INIT_HLIST_NODE(&new->vx_hlist);
18236 + atomic_set(&new->vx_usecnt, 0);
18237 + atomic_set(&new->vx_tasks, 0);
18238 + new->vx_parent = NULL;
18239 + new->vx_state = 0;
18240 + init_waitqueue_head(&new->vx_wait);
18242 + /* prepare reaper */
18243 + get_task_struct(init_pid_ns.child_reaper);
18244 + new->vx_reaper = init_pid_ns.child_reaper;
18245 + new->vx_badness_bias = 0;
18247 + /* rest of init goes here */
18248 + vx_info_init_limit(&new->limit);
18249 + vx_info_init_sched(&new->sched);
18250 + vx_info_init_cvirt(&new->cvirt);
18251 + vx_info_init_cacct(&new->cacct);
18253 + /* per cpu data structures */
18254 + for_each_possible_cpu(cpu) {
18255 + vx_info_init_sched_pc(
18256 + &vx_per_cpu(new, sched_pc, cpu), cpu);
18257 + vx_info_init_cvirt_pc(
18258 + &vx_per_cpu(new, cvirt_pc, cpu), cpu);
18261 + new->vx_flags = VXF_INIT_SET;
18262 + cap_set_init_eff(new->vx_bcaps);
18263 + new->vx_ccaps = 0;
18264 + new->vx_umask = 0;
18266 + new->reboot_cmd = 0;
18267 + new->exit_code = 0;
18269 + // preconfig fs entries
18270 + for (index = 0; index < VX_SPACES; index++) {
18271 + write_lock(&init_fs.lock);
18273 + write_unlock(&init_fs.lock);
18274 + new->vx_fs[index] = &init_fs;
18277 + vxdprintk(VXD_CBIT(xid, 0),
18278 + "alloc_vx_info(%d) = %p", xid, new);
18279 + vxh_alloc_vx_info(new);
18280 + atomic_inc(&vx_global_ctotal);
18289 +/* __dealloc_vx_info()
18291 + * final disposal of vx_info */
18293 +static void __dealloc_vx_info(struct vx_info *vxi)
18295 +#ifdef CONFIG_VSERVER_WARN
18296 + struct vx_info_save vxis;
18299 + vxdprintk(VXD_CBIT(xid, 0),
18300 + "dealloc_vx_info(%p)", vxi);
18301 + vxh_dealloc_vx_info(vxi);
18303 +#ifdef CONFIG_VSERVER_WARN
18304 + enter_vx_info(vxi, &vxis);
18305 + vx_info_exit_limit(&vxi->limit);
18306 + vx_info_exit_sched(&vxi->sched);
18307 + vx_info_exit_cvirt(&vxi->cvirt);
18308 + vx_info_exit_cacct(&vxi->cacct);
18310 + for_each_possible_cpu(cpu) {
18311 + vx_info_exit_sched_pc(
18312 + &vx_per_cpu(vxi, sched_pc, cpu), cpu);
18313 + vx_info_exit_cvirt_pc(
18314 + &vx_per_cpu(vxi, cvirt_pc, cpu), cpu);
18316 + leave_vx_info(&vxis);
18320 + vxi->vx_state |= VXS_RELEASED;
18323 + free_percpu(vxi->ptr_pc);
18326 + atomic_dec(&vx_global_ctotal);
18329 +static void __shutdown_vx_info(struct vx_info *vxi)
18331 + struct nsproxy *nsproxy;
18332 + struct fs_struct *fs;
18337 + vxi->vx_state |= VXS_SHUTDOWN;
18338 + vs_state_change(vxi, VSC_SHUTDOWN);
18340 + for (index = 0; index < VX_SPACES; index++) {
18341 + nsproxy = xchg(&vxi->vx_nsproxy[index], NULL);
18343 + put_nsproxy(nsproxy);
18345 + fs = xchg(&vxi->vx_fs[index], NULL);
18346 + write_lock(&fs->lock);
18347 + kill = !--fs->users;
18348 + write_unlock(&fs->lock);
18350 + free_fs_struct(fs);
18354 +/* exported stuff */
18356 +void free_vx_info(struct vx_info *vxi)
18358 + unsigned long flags;
18361 + /* check for reference counts first */
18362 + BUG_ON(atomic_read(&vxi->vx_usecnt));
18363 + BUG_ON(atomic_read(&vxi->vx_tasks));
18365 + /* context must not be hashed */
18366 + BUG_ON(vx_info_state(vxi, VXS_HASHED));
18368 + /* context shutdown is mandatory */
18369 + BUG_ON(!vx_info_state(vxi, VXS_SHUTDOWN));
18371 + /* nsproxy and fs check */
18372 + for (index = 0; index < VX_SPACES; index++) {
18373 + BUG_ON(vxi->vx_nsproxy[index]);
18374 + BUG_ON(vxi->vx_fs[index]);
18377 + spin_lock_irqsave(&vx_info_inactive_lock, flags);
18378 + hlist_del(&vxi->vx_hlist);
18379 + spin_unlock_irqrestore(&vx_info_inactive_lock, flags);
18381 + __dealloc_vx_info(vxi);
18385 +/* hash table for vx_info hash */
18387 +#define VX_HASH_SIZE 13
18389 +static struct hlist_head vx_info_hash[VX_HASH_SIZE] =
18390 + { [0 ... VX_HASH_SIZE-1] = HLIST_HEAD_INIT };
18392 +static spinlock_t vx_info_hash_lock = SPIN_LOCK_UNLOCKED;
18395 +static inline unsigned int __hashval(xid_t xid)
18397 + return (xid % VX_HASH_SIZE);
18402 +/* __hash_vx_info()
18404 + * add the vxi to the global hash table
18405 + * requires the hash_lock to be held */
18407 +static inline void __hash_vx_info(struct vx_info *vxi)
18409 + struct hlist_head *head;
18411 + vxd_assert_lock(&vx_info_hash_lock);
18412 + vxdprintk(VXD_CBIT(xid, 4),
18413 + "__hash_vx_info: %p[#%d]", vxi, vxi->vx_id);
18414 + vxh_hash_vx_info(vxi);
18416 + /* context must not be hashed */
18417 + BUG_ON(vx_info_state(vxi, VXS_HASHED));
18419 + vxi->vx_state |= VXS_HASHED;
18420 + head = &vx_info_hash[__hashval(vxi->vx_id)];
18421 + hlist_add_head(&vxi->vx_hlist, head);
18422 + atomic_inc(&vx_global_cactive);
18425 +/* __unhash_vx_info()
18427 + * remove the vxi from the global hash table
18428 + * requires the hash_lock to be held */
18430 +static inline void __unhash_vx_info(struct vx_info *vxi)
18432 + unsigned long flags;
18434 + vxd_assert_lock(&vx_info_hash_lock);
18435 + vxdprintk(VXD_CBIT(xid, 4),
18436 + "__unhash_vx_info: %p[#%d.%d.%d]", vxi, vxi->vx_id,
18437 + atomic_read(&vxi->vx_usecnt), atomic_read(&vxi->vx_tasks));
18438 + vxh_unhash_vx_info(vxi);
18440 + /* context must be hashed */
18441 + BUG_ON(!vx_info_state(vxi, VXS_HASHED));
18442 + /* but without tasks */
18443 + BUG_ON(atomic_read(&vxi->vx_tasks));
18445 + vxi->vx_state &= ~VXS_HASHED;
18446 + hlist_del_init(&vxi->vx_hlist);
18447 + spin_lock_irqsave(&vx_info_inactive_lock, flags);
18448 + hlist_add_head(&vxi->vx_hlist, &vx_info_inactive);
18449 + spin_unlock_irqrestore(&vx_info_inactive_lock, flags);
18450 + atomic_dec(&vx_global_cactive);
18454 +/* __lookup_vx_info()
18456 + * requires the hash_lock to be held
18457 + * doesn't increment the vx_refcnt */
18459 +static inline struct vx_info *__lookup_vx_info(xid_t xid)
18461 + struct hlist_head *head = &vx_info_hash[__hashval(xid)];
18462 + struct hlist_node *pos;
18463 + struct vx_info *vxi;
18465 + vxd_assert_lock(&vx_info_hash_lock);
18466 + hlist_for_each(pos, head) {
18467 + vxi = hlist_entry(pos, struct vx_info, vx_hlist);
18469 + if (vxi->vx_id == xid)
18474 + vxdprintk(VXD_CBIT(xid, 0),
18475 + "__lookup_vx_info(#%u): %p[#%u]",
18476 + xid, vxi, vxi ? vxi->vx_id : 0);
18477 + vxh_lookup_vx_info(vxi, xid);
18482 +/* __create_vx_info()
18484 + * create the requested context
18485 + * get(), claim() and hash it */
18487 +static struct vx_info *__create_vx_info(int id)
18489 + struct vx_info *new, *vxi = NULL;
18491 + vxdprintk(VXD_CBIT(xid, 1), "create_vx_info(%d)*", id);
18493 + if (!(new = __alloc_vx_info(id)))
18494 + return ERR_PTR(-ENOMEM);
18496 + /* required to make dynamic xids unique */
18497 + spin_lock(&vx_info_hash_lock);
18499 + /* static context requested */
18500 + if ((vxi = __lookup_vx_info(id))) {
18501 + vxdprintk(VXD_CBIT(xid, 0),
18502 + "create_vx_info(%d) = %p (already there)", id, vxi);
18503 + if (vx_info_flags(vxi, VXF_STATE_SETUP, 0))
18504 + vxi = ERR_PTR(-EBUSY);
18506 + vxi = ERR_PTR(-EEXIST);
18509 + /* new context */
18510 + vxdprintk(VXD_CBIT(xid, 0),
18511 + "create_vx_info(%d) = %p (new)", id, new);
18512 + claim_vx_info(new, NULL);
18513 + __hash_vx_info(get_vx_info(new));
18514 + vxi = new, new = NULL;
18517 + spin_unlock(&vx_info_hash_lock);
18518 + vxh_create_vx_info(IS_ERR(vxi) ? NULL : vxi, id);
18520 + __dealloc_vx_info(new);
18525 +/* exported stuff */
18528 +void unhash_vx_info(struct vx_info *vxi)
18530 + __shutdown_vx_info(vxi);
18531 + spin_lock(&vx_info_hash_lock);
18532 + __unhash_vx_info(vxi);
18533 + spin_unlock(&vx_info_hash_lock);
18534 + __wakeup_vx_info(vxi);
18538 +/* lookup_vx_info()
18540 + * search for a vx_info and get() it
18541 + * negative id means current */
18543 +struct vx_info *lookup_vx_info(int id)
18545 + struct vx_info *vxi = NULL;
18548 + vxi = get_vx_info(current_vx_info());
18549 + } else if (id > 1) {
18550 + spin_lock(&vx_info_hash_lock);
18551 + vxi = get_vx_info(__lookup_vx_info(id));
18552 + spin_unlock(&vx_info_hash_lock);
18557 +/* xid_is_hashed()
18559 + * verify that xid is still hashed */
18561 +int xid_is_hashed(xid_t xid)
18565 + spin_lock(&vx_info_hash_lock);
18566 + hashed = (__lookup_vx_info(xid) != NULL);
18567 + spin_unlock(&vx_info_hash_lock);
18571 +#ifdef CONFIG_PROC_FS
18575 + * get a subset of hashed xids for proc
18576 + * assumes size is at least one */
18578 +int get_xid_list(int index, unsigned int *xids, int size)
18580 + int hindex, nr_xids = 0;
18582 + /* only show current and children */
18583 + if (!vx_check(0, VS_ADMIN | VS_WATCH)) {
18586 + xids[nr_xids] = vx_current_xid();
18590 + for (hindex = 0; hindex < VX_HASH_SIZE; hindex++) {
18591 + struct hlist_head *head = &vx_info_hash[hindex];
18592 + struct hlist_node *pos;
18594 + spin_lock(&vx_info_hash_lock);
18595 + hlist_for_each(pos, head) {
18596 + struct vx_info *vxi;
18601 + vxi = hlist_entry(pos, struct vx_info, vx_hlist);
18602 + xids[nr_xids] = vxi->vx_id;
18603 + if (++nr_xids >= size) {
18604 + spin_unlock(&vx_info_hash_lock);
18608 + /* keep the lock time short */
18609 + spin_unlock(&vx_info_hash_lock);
18616 +#ifdef CONFIG_VSERVER_DEBUG
18618 +void dump_vx_info_inactive(int level)
18620 + struct hlist_node *entry, *next;
18622 + hlist_for_each_safe(entry, next, &vx_info_inactive) {
18623 + struct vx_info *vxi =
18624 + list_entry(entry, struct vx_info, vx_hlist);
18626 + dump_vx_info(vxi, level);
18633 +int vx_migrate_user(struct task_struct *p, struct vx_info *vxi)
18635 + struct user_struct *new_user, *old_user;
18640 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0))
18643 + new_user = alloc_uid(vxi->vx_id, p->uid);
18647 + old_user = p->user;
18648 + if (new_user != old_user) {
18649 + atomic_inc(&new_user->processes);
18650 + atomic_dec(&old_user->processes);
18651 + p->user = new_user;
18653 + free_uid(old_user);
18659 +void vx_mask_cap_bset(struct vx_info *vxi, struct task_struct *p)
18661 + // p->cap_effective &= vxi->vx_cap_bset;
18662 + p->cap_effective =
18663 + cap_intersect(p->cap_effective, vxi->cap_bset);
18664 + // p->cap_inheritable &= vxi->vx_cap_bset;
18665 + p->cap_inheritable =
18666 + cap_intersect(p->cap_inheritable, vxi->cap_bset);
18667 + // p->cap_permitted &= vxi->vx_cap_bset;
18668 + p->cap_permitted =
18669 + cap_intersect(p->cap_permitted, vxi->cap_bset);
18674 +#include <linux/file.h>
18675 +#include <linux/fdtable.h>
18677 +static int vx_openfd_task(struct task_struct *tsk)
18679 + struct files_struct *files = tsk->files;
18680 + struct fdtable *fdt;
18681 + const unsigned long *bptr;
18682 + int count, total;
18684 + /* no rcu_read_lock() because of spin_lock() */
18685 + spin_lock(&files->file_lock);
18686 + fdt = files_fdtable(files);
18687 + bptr = fdt->open_fds->fds_bits;
18688 + count = fdt->max_fds / (sizeof(unsigned long) * 8);
18689 + for (total = 0; count > 0; count--) {
18691 + total += hweight_long(*bptr);
18694 + spin_unlock(&files->file_lock);
18699 +/* for *space compatibility */
18701 +asmlinkage long sys_unshare(unsigned long);
18704 + * migrate task to new context
18705 + * gets vxi, puts old_vxi on change
18706 + * optionally unshares namespaces (hack)
18709 +int vx_migrate_task(struct task_struct *p, struct vx_info *vxi, int unshare)
18711 + struct vx_info *old_vxi;
18717 + vxdprintk(VXD_CBIT(xid, 5),
18718 + "vx_migrate_task(%p,%p[#%d.%d])", p, vxi,
18719 + vxi->vx_id, atomic_read(&vxi->vx_usecnt));
18721 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0) &&
18722 + !vx_info_flags(vxi, VXF_STATE_SETUP, 0))
18725 + if (vx_info_state(vxi, VXS_SHUTDOWN))
18728 + old_vxi = task_get_vx_info(p);
18729 + if (old_vxi == vxi)
18732 +// if (!(ret = vx_migrate_user(p, vxi))) {
18737 + openfd = vx_openfd_task(p);
18740 + atomic_dec(&old_vxi->cvirt.nr_threads);
18741 + atomic_dec(&old_vxi->cvirt.nr_running);
18742 + __rlim_dec(&old_vxi->limit, RLIMIT_NPROC);
18743 + /* FIXME: what about the struct files here? */
18744 + __rlim_sub(&old_vxi->limit, VLIMIT_OPENFD, openfd);
18745 + /* account for the executable */
18746 + __rlim_dec(&old_vxi->limit, VLIMIT_DENTRY);
18748 + atomic_inc(&vxi->cvirt.nr_threads);
18749 + atomic_inc(&vxi->cvirt.nr_running);
18750 + __rlim_inc(&vxi->limit, RLIMIT_NPROC);
18751 + /* FIXME: what about the struct files here? */
18752 + __rlim_add(&vxi->limit, VLIMIT_OPENFD, openfd);
18753 + /* account for the executable */
18754 + __rlim_inc(&vxi->limit, VLIMIT_DENTRY);
18757 + release_vx_info(old_vxi, p);
18758 + clr_vx_info(&p->vx_info);
18760 + claim_vx_info(vxi, p);
18761 + set_vx_info(&p->vx_info, vxi);
18762 + p->xid = vxi->vx_id;
18764 + vxdprintk(VXD_CBIT(xid, 5),
18765 + "moved task %p into vxi:%p[#%d]",
18766 + p, vxi, vxi->vx_id);
18768 + // vx_mask_cap_bset(vxi, p);
18771 + /* hack for *spaces to provide compatibility */
18773 + struct nsproxy *old_nsp, *new_nsp;
18775 + ret = unshare_nsproxy_namespaces(
18776 + CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER,
18781 + old_nsp = xchg(&p->nsproxy, new_nsp);
18782 + vx_set_space(vxi,
18783 + CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER, 0);
18784 + put_nsproxy(old_nsp);
18788 + put_vx_info(old_vxi);
18792 +int vx_set_reaper(struct vx_info *vxi, struct task_struct *p)
18794 + struct task_struct *old_reaper;
18799 + vxdprintk(VXD_CBIT(xid, 6),
18800 + "vx_set_reaper(%p[#%d],%p[#%d,%d])",
18801 + vxi, vxi->vx_id, p, p->xid, p->pid);
18803 + old_reaper = vxi->vx_reaper;
18804 + if (old_reaper == p)
18807 + /* set new child reaper */
18808 + get_task_struct(p);
18809 + vxi->vx_reaper = p;
18810 + put_task_struct(old_reaper);
18814 +int vx_set_init(struct vx_info *vxi, struct task_struct *p)
18819 + vxdprintk(VXD_CBIT(xid, 6),
18820 + "vx_set_init(%p[#%d],%p[#%d,%d,%d])",
18821 + vxi, vxi->vx_id, p, p->xid, p->pid, p->tgid);
18823 + vxi->vx_flags &= ~VXF_STATE_INIT;
18824 + // vxi->vx_initpid = p->tgid;
18825 + vxi->vx_initpid = p->pid;
18829 +void vx_exit_init(struct vx_info *vxi, struct task_struct *p, int code)
18831 + vxdprintk(VXD_CBIT(xid, 6),
18832 + "vx_exit_init(%p[#%d],%p[#%d,%d,%d])",
18833 + vxi, vxi->vx_id, p, p->xid, p->pid, p->tgid);
18835 + vxi->exit_code = code;
18836 + vxi->vx_initpid = 0;
18840 +void vx_set_persistent(struct vx_info *vxi)
18842 + vxdprintk(VXD_CBIT(xid, 6),
18843 + "vx_set_persistent(%p[#%d])", vxi, vxi->vx_id);
18845 + get_vx_info(vxi);
18846 + claim_vx_info(vxi, NULL);
18849 +void vx_clear_persistent(struct vx_info *vxi)
18851 + vxdprintk(VXD_CBIT(xid, 6),
18852 + "vx_clear_persistent(%p[#%d])", vxi, vxi->vx_id);
18854 + release_vx_info(vxi, NULL);
18855 + put_vx_info(vxi);
18858 +void vx_update_persistent(struct vx_info *vxi)
18860 + if (vx_info_flags(vxi, VXF_PERSISTENT, 0))
18861 + vx_set_persistent(vxi);
18863 + vx_clear_persistent(vxi);
18867 +/* task must be current or locked */
18869 +void exit_vx_info(struct task_struct *p, int code)
18871 + struct vx_info *vxi = p->vx_info;
18874 + atomic_dec(&vxi->cvirt.nr_threads);
18877 + vxi->exit_code = code;
18878 + release_vx_info(vxi, p);
18882 +void exit_vx_info_early(struct task_struct *p, int code)
18884 + struct vx_info *vxi = p->vx_info;
18887 + if (vxi->vx_initpid == p->pid)
18888 + vx_exit_init(vxi, p, code);
18889 + if (vxi->vx_reaper == p)
18890 + vx_set_reaper(vxi, init_pid_ns.child_reaper);
18895 +/* vserver syscall commands below here */
18897 +/* taks xid and vx_info functions */
18899 +#include <asm/uaccess.h>
18902 +int vc_task_xid(uint32_t id)
18907 + struct task_struct *tsk;
18909 + read_lock(&tasklist_lock);
18910 + tsk = find_task_by_real_pid(id);
18911 + xid = (tsk) ? tsk->xid : -ESRCH;
18912 + read_unlock(&tasklist_lock);
18914 + xid = vx_current_xid();
18919 +int vc_vx_info(struct vx_info *vxi, void __user *data)
18921 + struct vcmd_vx_info_v0 vc_data;
18923 + vc_data.xid = vxi->vx_id;
18924 + vc_data.initpid = vxi->vx_initpid;
18926 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18932 +int vc_ctx_stat(struct vx_info *vxi, void __user *data)
18934 + struct vcmd_ctx_stat_v0 vc_data;
18936 + vc_data.usecnt = atomic_read(&vxi->vx_usecnt);
18937 + vc_data.tasks = atomic_read(&vxi->vx_tasks);
18939 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18945 +/* context functions */
18947 +int vc_ctx_create(uint32_t xid, void __user *data)
18949 + struct vcmd_ctx_create vc_data = { .flagword = VXF_INIT_SET };
18950 + struct vx_info *new_vxi;
18953 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
18956 + if ((xid > MAX_S_CONTEXT) || (xid < 2))
18959 + new_vxi = __create_vx_info(xid);
18960 + if (IS_ERR(new_vxi))
18961 + return PTR_ERR(new_vxi);
18963 + /* initial flags */
18964 + new_vxi->vx_flags = vc_data.flagword;
18967 + if (vs_state_change(new_vxi, VSC_STARTUP))
18970 + ret = vx_migrate_task(current, new_vxi, (!data));
18974 + /* return context id on success */
18975 + ret = new_vxi->vx_id;
18977 + /* get a reference for persistent contexts */
18978 + if ((vc_data.flagword & VXF_PERSISTENT))
18979 + vx_set_persistent(new_vxi);
18981 + release_vx_info(new_vxi, NULL);
18982 + put_vx_info(new_vxi);
18987 +int vc_ctx_migrate(struct vx_info *vxi, void __user *data)
18989 + struct vcmd_ctx_migrate vc_data = { .flagword = 0 };
18992 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
18995 + ret = vx_migrate_task(current, vxi, 0);
18998 + if (vc_data.flagword & VXM_SET_INIT)
18999 + ret = vx_set_init(vxi, current);
19002 + if (vc_data.flagword & VXM_SET_REAPER)
19003 + ret = vx_set_reaper(vxi, current);
19008 +int vc_get_cflags(struct vx_info *vxi, void __user *data)
19010 + struct vcmd_ctx_flags_v0 vc_data;
19012 + vc_data.flagword = vxi->vx_flags;
19014 + /* special STATE flag handling */
19015 + vc_data.mask = vs_mask_flags(~0ULL, vxi->vx_flags, VXF_ONE_TIME);
19017 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19022 +int vc_set_cflags(struct vx_info *vxi, void __user *data)
19024 + struct vcmd_ctx_flags_v0 vc_data;
19025 + uint64_t mask, trigger;
19027 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19030 + /* special STATE flag handling */
19031 + mask = vs_mask_mask(vc_data.mask, vxi->vx_flags, VXF_ONE_TIME);
19032 + trigger = (mask & vxi->vx_flags) ^ (mask & vc_data.flagword);
19034 + if (vxi == current_vx_info()) {
19035 + /* if (trigger & VXF_STATE_SETUP)
19036 + vx_mask_cap_bset(vxi, current); */
19037 + if (trigger & VXF_STATE_INIT) {
19040 + ret = vx_set_init(vxi, current);
19043 + ret = vx_set_reaper(vxi, current);
19049 + vxi->vx_flags = vs_mask_flags(vxi->vx_flags,
19050 + vc_data.flagword, mask);
19051 + if (trigger & VXF_PERSISTENT)
19052 + vx_update_persistent(vxi);
19058 +static inline uint64_t caps_from_cap_t(kernel_cap_t c)
19060 + uint64_t v = c.cap[0] | ((uint64_t)c.cap[1] << 32);
19062 + // printk("caps_from_cap_t(%08x:%08x) = %016llx\n", c.cap[1], c.cap[0], v);
19066 +static inline kernel_cap_t cap_t_from_caps(uint64_t v)
19068 + kernel_cap_t c = __cap_empty_set;
19070 + c.cap[0] = v & 0xFFFFFFFF;
19071 + c.cap[1] = (v >> 32) & 0xFFFFFFFF;
19073 + // printk("cap_t_from_caps(%016llx) = %08x:%08x\n", v, c.cap[1], c.cap[0]);
19078 +static int do_get_caps(struct vx_info *vxi, uint64_t *bcaps, uint64_t *ccaps)
19081 + *bcaps = caps_from_cap_t(vxi->vx_bcaps);
19083 + *ccaps = vxi->vx_ccaps;
19088 +int vc_get_ccaps(struct vx_info *vxi, void __user *data)
19090 + struct vcmd_ctx_caps_v1 vc_data;
19093 + ret = do_get_caps(vxi, NULL, &vc_data.ccaps);
19096 + vc_data.cmask = ~0ULL;
19098 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19103 +static int do_set_caps(struct vx_info *vxi,
19104 + uint64_t bcaps, uint64_t bmask, uint64_t ccaps, uint64_t cmask)
19106 + uint64_t bcold = caps_from_cap_t(vxi->vx_bcaps);
19109 + printk("do_set_caps(%16llx, %16llx, %16llx, %16llx)\n",
19110 + bcaps, bmask, ccaps, cmask);
19112 + vxi->vx_bcaps = cap_t_from_caps(
19113 + vs_mask_flags(bcold, bcaps, bmask));
19114 + vxi->vx_ccaps = vs_mask_flags(vxi->vx_ccaps, ccaps, cmask);
19119 +int vc_set_ccaps(struct vx_info *vxi, void __user *data)
19121 + struct vcmd_ctx_caps_v1 vc_data;
19123 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19126 + return do_set_caps(vxi, 0, 0, vc_data.ccaps, vc_data.cmask);
19129 +int vc_get_bcaps(struct vx_info *vxi, void __user *data)
19131 + struct vcmd_bcaps vc_data;
19134 + ret = do_get_caps(vxi, &vc_data.bcaps, NULL);
19137 + vc_data.bmask = ~0ULL;
19139 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19144 +int vc_set_bcaps(struct vx_info *vxi, void __user *data)
19146 + struct vcmd_bcaps vc_data;
19148 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19151 + return do_set_caps(vxi, vc_data.bcaps, vc_data.bmask, 0, 0);
19155 +int vc_get_umask(struct vx_info *vxi, void __user *data)
19157 + struct vcmd_umask vc_data;
19159 + vc_data.umask = vxi->vx_umask;
19160 + vc_data.mask = ~0ULL;
19162 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19167 +int vc_set_umask(struct vx_info *vxi, void __user *data)
19169 + struct vcmd_umask vc_data;
19171 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19174 + vxi->vx_umask = vs_mask_flags(vxi->vx_umask,
19175 + vc_data.umask, vc_data.mask);
19180 +int vc_get_badness(struct vx_info *vxi, void __user *data)
19182 + struct vcmd_badness_v0 vc_data;
19184 + vc_data.bias = vxi->vx_badness_bias;
19186 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19191 +int vc_set_badness(struct vx_info *vxi, void __user *data)
19193 + struct vcmd_badness_v0 vc_data;
19195 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19198 + vxi->vx_badness_bias = vc_data.bias;
19202 +#include <linux/module.h>
19204 +EXPORT_SYMBOL_GPL(free_vx_info);
19206 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/cvirt.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cvirt.c
19207 --- linux-2.6.33.2/kernel/vserver/cvirt.c 1970-01-01 01:00:00.000000000 +0100
19208 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cvirt.c 2010-02-25 12:02:16.000000000 +0100
19211 + * linux/kernel/vserver/cvirt.c
19213 + * Virtual Server: Context Virtualization
19215 + * Copyright (C) 2004-2007 Herbert Pötzl
19217 + * V0.01 broken out from limit.c
19218 + * V0.02 added utsname stuff
19219 + * V0.03 changed vcmds to vxi arg
19223 +#include <linux/types.h>
19224 +#include <linux/utsname.h>
19225 +#include <linux/vs_cvirt.h>
19226 +#include <linux/vserver/switch.h>
19227 +#include <linux/vserver/cvirt_cmd.h>
19229 +#include <asm/uaccess.h>
19232 +void vx_vsi_uptime(struct timespec *uptime, struct timespec *idle)
19234 + struct vx_info *vxi = current_vx_info();
19236 + set_normalized_timespec(uptime,
19237 + uptime->tv_sec - vxi->cvirt.bias_uptime.tv_sec,
19238 + uptime->tv_nsec - vxi->cvirt.bias_uptime.tv_nsec);
19241 + set_normalized_timespec(idle,
19242 + idle->tv_sec - vxi->cvirt.bias_idle.tv_sec,
19243 + idle->tv_nsec - vxi->cvirt.bias_idle.tv_nsec);
19247 +uint64_t vx_idle_jiffies(void)
19249 + return init_task.utime + init_task.stime;
19254 +static inline uint32_t __update_loadavg(uint32_t load,
19255 + int wsize, int delta, int n)
19257 + unsigned long long calc, prev;
19259 + /* just set it to n */
19260 + if (unlikely(delta >= wsize))
19261 + return (n << FSHIFT);
19263 + calc = delta * n;
19265 + prev = (wsize - delta);
19268 + do_div(calc, wsize);
19273 +void vx_update_load(struct vx_info *vxi)
19275 + uint32_t now, last, delta;
19276 + unsigned int nr_running, nr_uninterruptible;
19277 + unsigned int total;
19278 + unsigned long flags;
19280 + spin_lock_irqsave(&vxi->cvirt.load_lock, flags);
19283 + last = vxi->cvirt.load_last;
19284 + delta = now - last;
19286 + if (delta < 5*HZ)
19289 + nr_running = atomic_read(&vxi->cvirt.nr_running);
19290 + nr_uninterruptible = atomic_read(&vxi->cvirt.nr_uninterruptible);
19291 + total = nr_running + nr_uninterruptible;
19293 + vxi->cvirt.load[0] = __update_loadavg(vxi->cvirt.load[0],
19294 + 60*HZ, delta, total);
19295 + vxi->cvirt.load[1] = __update_loadavg(vxi->cvirt.load[1],
19296 + 5*60*HZ, delta, total);
19297 + vxi->cvirt.load[2] = __update_loadavg(vxi->cvirt.load[2],
19298 + 15*60*HZ, delta, total);
19300 + vxi->cvirt.load_last = now;
19302 + atomic_inc(&vxi->cvirt.load_updates);
19303 + spin_unlock_irqrestore(&vxi->cvirt.load_lock, flags);
19308 + * Commands to do_syslog:
19310 + * 0 -- Close the log. Currently a NOP.
19311 + * 1 -- Open the log. Currently a NOP.
19312 + * 2 -- Read from the log.
19313 + * 3 -- Read all messages remaining in the ring buffer.
19314 + * 4 -- Read and clear all messages remaining in the ring buffer
19315 + * 5 -- Clear ring buffer.
19316 + * 6 -- Disable printk's to console
19317 + * 7 -- Enable printk's to console
19318 + * 8 -- Set level of messages printed to console
19319 + * 9 -- Return number of unread characters in the log buffer
19320 + * 10 -- Return size of the log buffer
19322 +int vx_do_syslog(int type, char __user *buf, int len)
19325 + int do_clear = 0;
19326 + struct vx_info *vxi = current_vx_info();
19327 + struct _vx_syslog *log;
19331 + log = &vxi->cvirt.syslog;
19334 + case 0: /* Close log */
19335 + case 1: /* Open log */
19337 + case 2: /* Read from log */
19338 + error = wait_event_interruptible(log->log_wait,
19339 + (log->log_start - log->log_end));
19342 + spin_lock_irq(&log->logbuf_lock);
19343 + spin_unlock_irq(&log->logbuf_lock);
19345 + case 4: /* Read/clear last kernel messages */
19347 + /* fall through */
19348 + case 3: /* Read last kernel messages */
19351 + case 5: /* Clear ring buffer */
19354 + case 6: /* Disable logging to console */
19355 + case 7: /* Enable logging to console */
19356 + case 8: /* Set level of messages printed to console */
19359 + case 9: /* Number of chars in the log buffer */
19361 + case 10: /* Size of the log buffer */
19371 +/* virtual host info names */
19373 +static char *vx_vhi_name(struct vx_info *vxi, int id)
19375 + struct nsproxy *nsproxy;
19376 + struct uts_namespace *uts;
19378 + if (id == VHIN_CONTEXT)
19379 + return vxi->vx_name;
19381 + nsproxy = vxi->vx_nsproxy[0];
19385 + uts = nsproxy->uts_ns;
19390 + case VHIN_SYSNAME:
19391 + return uts->name.sysname;
19392 + case VHIN_NODENAME:
19393 + return uts->name.nodename;
19394 + case VHIN_RELEASE:
19395 + return uts->name.release;
19396 + case VHIN_VERSION:
19397 + return uts->name.version;
19398 + case VHIN_MACHINE:
19399 + return uts->name.machine;
19400 + case VHIN_DOMAINNAME:
19401 + return uts->name.domainname;
19408 +int vc_set_vhi_name(struct vx_info *vxi, void __user *data)
19410 + struct vcmd_vhi_name_v0 vc_data;
19413 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19416 + name = vx_vhi_name(vxi, vc_data.field);
19420 + memcpy(name, vc_data.name, 65);
19424 +int vc_get_vhi_name(struct vx_info *vxi, void __user *data)
19426 + struct vcmd_vhi_name_v0 vc_data;
19429 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19432 + name = vx_vhi_name(vxi, vc_data.field);
19436 + memcpy(vc_data.name, name, 65);
19437 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19443 +int vc_virt_stat(struct vx_info *vxi, void __user *data)
19445 + struct vcmd_virt_stat_v0 vc_data;
19446 + struct _vx_cvirt *cvirt = &vxi->cvirt;
19447 + struct timespec uptime;
19449 + do_posix_clock_monotonic_gettime(&uptime);
19450 + set_normalized_timespec(&uptime,
19451 + uptime.tv_sec - cvirt->bias_uptime.tv_sec,
19452 + uptime.tv_nsec - cvirt->bias_uptime.tv_nsec);
19454 + vc_data.offset = timeval_to_ns(&cvirt->bias_tv);
19455 + vc_data.uptime = timespec_to_ns(&uptime);
19456 + vc_data.nr_threads = atomic_read(&cvirt->nr_threads);
19457 + vc_data.nr_running = atomic_read(&cvirt->nr_running);
19458 + vc_data.nr_uninterruptible = atomic_read(&cvirt->nr_uninterruptible);
19459 + vc_data.nr_onhold = atomic_read(&cvirt->nr_onhold);
19460 + vc_data.nr_forks = atomic_read(&cvirt->total_forks);
19461 + vc_data.load[0] = cvirt->load[0];
19462 + vc_data.load[1] = cvirt->load[1];
19463 + vc_data.load[2] = cvirt->load[2];
19465 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19471 +#ifdef CONFIG_VSERVER_VTIME
19473 +/* virtualized time base */
19475 +void vx_gettimeofday(struct timeval *tv)
19477 + struct vx_info *vxi;
19479 + do_gettimeofday(tv);
19480 + if (!vx_flags(VXF_VIRT_TIME, 0))
19483 + vxi = current_vx_info();
19484 + tv->tv_sec += vxi->cvirt.bias_tv.tv_sec;
19485 + tv->tv_usec += vxi->cvirt.bias_tv.tv_usec;
19487 + if (tv->tv_usec >= USEC_PER_SEC) {
19489 + tv->tv_usec -= USEC_PER_SEC;
19490 + } else if (tv->tv_usec < 0) {
19492 + tv->tv_usec += USEC_PER_SEC;
19496 +int vx_settimeofday(struct timespec *ts)
19498 + struct timeval tv;
19499 + struct vx_info *vxi;
19501 + if (!vx_flags(VXF_VIRT_TIME, 0))
19502 + return do_settimeofday(ts);
19504 + do_gettimeofday(&tv);
19505 + vxi = current_vx_info();
19506 + vxi->cvirt.bias_tv.tv_sec = ts->tv_sec - tv.tv_sec;
19507 + vxi->cvirt.bias_tv.tv_usec =
19508 + (ts->tv_nsec/NSEC_PER_USEC) - tv.tv_usec;
19514 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/cvirt_init.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cvirt_init.h
19515 --- linux-2.6.33.2/kernel/vserver/cvirt_init.h 1970-01-01 01:00:00.000000000 +0100
19516 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cvirt_init.h 2010-02-25 12:02:16.000000000 +0100
19520 +extern uint64_t vx_idle_jiffies(void);
19522 +static inline void vx_info_init_cvirt(struct _vx_cvirt *cvirt)
19524 + uint64_t idle_jiffies = vx_idle_jiffies();
19525 + uint64_t nsuptime;
19527 + do_posix_clock_monotonic_gettime(&cvirt->bias_uptime);
19528 + nsuptime = (unsigned long long)cvirt->bias_uptime.tv_sec
19529 + * NSEC_PER_SEC + cvirt->bias_uptime.tv_nsec;
19530 + cvirt->bias_clock = nsec_to_clock_t(nsuptime);
19531 + cvirt->bias_tv.tv_sec = 0;
19532 + cvirt->bias_tv.tv_usec = 0;
19534 + jiffies_to_timespec(idle_jiffies, &cvirt->bias_idle);
19535 + atomic_set(&cvirt->nr_threads, 0);
19536 + atomic_set(&cvirt->nr_running, 0);
19537 + atomic_set(&cvirt->nr_uninterruptible, 0);
19538 + atomic_set(&cvirt->nr_onhold, 0);
19540 + spin_lock_init(&cvirt->load_lock);
19541 + cvirt->load_last = jiffies;
19542 + atomic_set(&cvirt->load_updates, 0);
19543 + cvirt->load[0] = 0;
19544 + cvirt->load[1] = 0;
19545 + cvirt->load[2] = 0;
19546 + atomic_set(&cvirt->total_forks, 0);
19548 + spin_lock_init(&cvirt->syslog.logbuf_lock);
19549 + init_waitqueue_head(&cvirt->syslog.log_wait);
19550 + cvirt->syslog.log_start = 0;
19551 + cvirt->syslog.log_end = 0;
19552 + cvirt->syslog.con_start = 0;
19553 + cvirt->syslog.logged_chars = 0;
19557 +void vx_info_init_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, int cpu)
19559 + // cvirt_pc->cpustat = { 0 };
19562 +static inline void vx_info_exit_cvirt(struct _vx_cvirt *cvirt)
19566 + vxwprintk_xid((value = atomic_read(&cvirt->nr_threads)),
19567 + "!!! cvirt: %p[nr_threads] = %d on exit.",
19569 + vxwprintk_xid((value = atomic_read(&cvirt->nr_running)),
19570 + "!!! cvirt: %p[nr_running] = %d on exit.",
19572 + vxwprintk_xid((value = atomic_read(&cvirt->nr_uninterruptible)),
19573 + "!!! cvirt: %p[nr_uninterruptible] = %d on exit.",
19575 + vxwprintk_xid((value = atomic_read(&cvirt->nr_onhold)),
19576 + "!!! cvirt: %p[nr_onhold] = %d on exit.",
19582 +void vx_info_exit_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, int cpu)
19587 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/cvirt_proc.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cvirt_proc.h
19588 --- linux-2.6.33.2/kernel/vserver/cvirt_proc.h 1970-01-01 01:00:00.000000000 +0100
19589 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/cvirt_proc.h 2010-02-25 12:02:16.000000000 +0100
19591 +#ifndef _VX_CVIRT_PROC_H
19592 +#define _VX_CVIRT_PROC_H
19594 +#include <linux/nsproxy.h>
19595 +#include <linux/mnt_namespace.h>
19596 +#include <linux/ipc_namespace.h>
19597 +#include <linux/utsname.h>
19598 +#include <linux/ipc.h>
19602 +int vx_info_proc_nsproxy(struct nsproxy *nsproxy, char *buffer)
19604 + struct mnt_namespace *ns;
19605 + struct uts_namespace *uts;
19606 + struct ipc_namespace *ipc;
19607 + struct path path;
19608 + char *pstr, *root;
19614 + length += sprintf(buffer + length,
19615 + "NSProxy:\t%p [%p,%p,%p]\n",
19616 + nsproxy, nsproxy->mnt_ns,
19617 + nsproxy->uts_ns, nsproxy->ipc_ns);
19619 + ns = nsproxy->mnt_ns;
19623 + pstr = kmalloc(PATH_MAX, GFP_KERNEL);
19627 + path.mnt = ns->root;
19628 + path.dentry = ns->root->mnt_root;
19629 + root = d_path(&path, pstr, PATH_MAX - 2);
19630 + length += sprintf(buffer + length,
19631 + "Namespace:\t%p [#%u]\n"
19632 + "RootPath:\t%s\n",
19633 + ns, atomic_read(&ns->count),
19638 + uts = nsproxy->uts_ns;
19642 + length += sprintf(buffer + length,
19643 + "SysName:\t%.*s\n"
19644 + "NodeName:\t%.*s\n"
19645 + "Release:\t%.*s\n"
19646 + "Version:\t%.*s\n"
19647 + "Machine:\t%.*s\n"
19648 + "DomainName:\t%.*s\n",
19649 + __NEW_UTS_LEN, uts->name.sysname,
19650 + __NEW_UTS_LEN, uts->name.nodename,
19651 + __NEW_UTS_LEN, uts->name.release,
19652 + __NEW_UTS_LEN, uts->name.version,
19653 + __NEW_UTS_LEN, uts->name.machine,
19654 + __NEW_UTS_LEN, uts->name.domainname);
19657 + ipc = nsproxy->ipc_ns;
19661 + length += sprintf(buffer + length,
19662 + "SEMS:\t\t%d %d %d %d %d\n"
19663 + "MSG:\t\t%d %d %d\n"
19664 + "SHM:\t\t%lu %lu %d %d\n",
19665 + ipc->sem_ctls[0], ipc->sem_ctls[1],
19666 + ipc->sem_ctls[2], ipc->sem_ctls[3],
19668 + ipc->msg_ctlmax, ipc->msg_ctlmnb, ipc->msg_ctlmni,
19669 + (unsigned long)ipc->shm_ctlmax,
19670 + (unsigned long)ipc->shm_ctlall,
19671 + ipc->shm_ctlmni, ipc->shm_tot);
19678 +#include <linux/sched.h>
19680 +#define LOAD_INT(x) ((x) >> FSHIFT)
19681 +#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1 - 1)) * 100)
19684 +int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer)
19689 + length += sprintf(buffer + length,
19690 + "BiasUptime:\t%lu.%02lu\n",
19691 + (unsigned long)cvirt->bias_uptime.tv_sec,
19692 + (cvirt->bias_uptime.tv_nsec / (NSEC_PER_SEC / 100)));
19694 + a = cvirt->load[0] + (FIXED_1 / 200);
19695 + b = cvirt->load[1] + (FIXED_1 / 200);
19696 + c = cvirt->load[2] + (FIXED_1 / 200);
19697 + length += sprintf(buffer + length,
19698 + "nr_threads:\t%d\n"
19699 + "nr_running:\t%d\n"
19700 + "nr_unintr:\t%d\n"
19701 + "nr_onhold:\t%d\n"
19702 + "load_updates:\t%d\n"
19703 + "loadavg:\t%d.%02d %d.%02d %d.%02d\n"
19704 + "total_forks:\t%d\n",
19705 + atomic_read(&cvirt->nr_threads),
19706 + atomic_read(&cvirt->nr_running),
19707 + atomic_read(&cvirt->nr_uninterruptible),
19708 + atomic_read(&cvirt->nr_onhold),
19709 + atomic_read(&cvirt->load_updates),
19710 + LOAD_INT(a), LOAD_FRAC(a),
19711 + LOAD_INT(b), LOAD_FRAC(b),
19712 + LOAD_INT(c), LOAD_FRAC(c),
19713 + atomic_read(&cvirt->total_forks));
19718 +int vx_info_proc_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc,
19719 + char *buffer, int cpu)
19725 +#endif /* _VX_CVIRT_PROC_H */
19726 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/debug.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/debug.c
19727 --- linux-2.6.33.2/kernel/vserver/debug.c 1970-01-01 01:00:00.000000000 +0100
19728 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/debug.c 2010-02-25 12:02:16.000000000 +0100
19731 + * kernel/vserver/debug.c
19733 + * Copyright (C) 2005-2007 Herbert Pötzl
19735 + * V0.01 vx_info dump support
19739 +#include <linux/module.h>
19741 +#include <linux/vserver/context.h>
19744 +void dump_vx_info(struct vx_info *vxi, int level)
19746 + printk("vx_info %p[#%d, %d.%d, %4x]\n", vxi, vxi->vx_id,
19747 + atomic_read(&vxi->vx_usecnt),
19748 + atomic_read(&vxi->vx_tasks),
19751 + __dump_vx_limit(&vxi->limit);
19752 + __dump_vx_sched(&vxi->sched);
19753 + __dump_vx_cvirt(&vxi->cvirt);
19754 + __dump_vx_cacct(&vxi->cacct);
19760 +EXPORT_SYMBOL_GPL(dump_vx_info);
19762 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/device.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/device.c
19763 --- linux-2.6.33.2/kernel/vserver/device.c 1970-01-01 01:00:00.000000000 +0100
19764 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/device.c 2010-02-25 12:02:16.000000000 +0100
19767 + * linux/kernel/vserver/device.c
19769 + * Linux-VServer: Device Support
19771 + * Copyright (C) 2006 Herbert Pötzl
19772 + * Copyright (C) 2007 Daniel Hokka Zakrisson
19774 + * V0.01 device mapping basics
19775 + * V0.02 added defaults
19779 +#include <linux/slab.h>
19780 +#include <linux/rcupdate.h>
19781 +#include <linux/fs.h>
19782 +#include <linux/namei.h>
19783 +#include <linux/hash.h>
19785 +#include <asm/errno.h>
19786 +#include <asm/uaccess.h>
19787 +#include <linux/vserver/base.h>
19788 +#include <linux/vserver/debug.h>
19789 +#include <linux/vserver/context.h>
19790 +#include <linux/vserver/device.h>
19791 +#include <linux/vserver/device_cmd.h>
19794 +#define DMAP_HASH_BITS 4
19797 +struct vs_mapping {
19799 + struct hlist_node hlist;
19800 + struct list_head list;
19802 +#define dm_hlist u.hlist
19803 +#define dm_list u.list
19806 + struct vx_dmap_target target;
19810 +static struct hlist_head dmap_main_hash[1 << DMAP_HASH_BITS];
19812 +static spinlock_t dmap_main_hash_lock = SPIN_LOCK_UNLOCKED;
19814 +static struct vx_dmap_target dmap_defaults[2] = {
19815 + { .flags = DATTR_OPEN },
19816 + { .flags = DATTR_OPEN },
19820 +struct kmem_cache *dmap_cachep __read_mostly;
19822 +int __init dmap_cache_init(void)
19824 + dmap_cachep = kmem_cache_create("dmap_cache",
19825 + sizeof(struct vs_mapping), 0,
19826 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
19830 +__initcall(dmap_cache_init);
19833 +static inline unsigned int __hashval(dev_t dev, int bits)
19835 + return hash_long((unsigned long)dev, bits);
19839 +/* __hash_mapping()
19840 + * add the mapping to the hash table
19842 +static inline void __hash_mapping(struct vx_info *vxi, struct vs_mapping *vdm)
19844 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19845 + struct hlist_head *head, *hash = dmap_main_hash;
19846 + int device = vdm->device;
19848 + spin_lock(hash_lock);
19849 + vxdprintk(VXD_CBIT(misc, 8), "__hash_mapping: %p[#%d] %08x:%08x",
19850 + vxi, vxi ? vxi->vx_id : 0, device, vdm->target.target);
19852 + head = &hash[__hashval(device, DMAP_HASH_BITS)];
19853 + hlist_add_head(&vdm->dm_hlist, head);
19854 + spin_unlock(hash_lock);
19858 +static inline int __mode_to_default(umode_t mode)
19871 +/* __set_default()
19874 +static inline void __set_default(struct vx_info *vxi, umode_t mode,
19875 + struct vx_dmap_target *vdmt)
19877 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19878 + spin_lock(hash_lock);
19881 + vxi->dmap.targets[__mode_to_default(mode)] = *vdmt;
19883 + dmap_defaults[__mode_to_default(mode)] = *vdmt;
19886 + spin_unlock(hash_lock);
19888 + vxdprintk(VXD_CBIT(misc, 8), "__set_default: %p[#%u] %08x %04x",
19889 + vxi, vxi ? vxi->vx_id : 0, vdmt->target, vdmt->flags);
19893 +/* __remove_default()
19894 + * remove a default
19896 +static inline int __remove_default(struct vx_info *vxi, umode_t mode)
19898 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19899 + spin_lock(hash_lock);
19902 + vxi->dmap.targets[__mode_to_default(mode)].flags = 0;
19903 + else /* remove == reset */
19904 + dmap_defaults[__mode_to_default(mode)].flags = DATTR_OPEN | mode;
19906 + spin_unlock(hash_lock);
19911 +/* __find_mapping()
19912 + * find a mapping in the hash table
19914 + * caller must hold hash_lock
19916 +static inline int __find_mapping(xid_t xid, dev_t device, umode_t mode,
19917 + struct vs_mapping **local, struct vs_mapping **global)
19919 + struct hlist_head *hash = dmap_main_hash;
19920 + struct hlist_head *head = &hash[__hashval(device, DMAP_HASH_BITS)];
19921 + struct hlist_node *pos;
19922 + struct vs_mapping *vdm;
19928 + hlist_for_each(pos, head) {
19929 + vdm = hlist_entry(pos, struct vs_mapping, dm_hlist);
19931 + if ((vdm->device == device) &&
19932 + !((vdm->target.flags ^ mode) & S_IFMT)) {
19933 + if (vdm->xid == xid) {
19936 + } else if (global && vdm->xid == 0)
19941 + if (global && *global)
19948 +/* __lookup_mapping()
19949 + * find a mapping and store the result in target and flags
19951 +static inline int __lookup_mapping(struct vx_info *vxi,
19952 + dev_t device, dev_t *target, int *flags, umode_t mode)
19954 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19955 + struct vs_mapping *vdm, *global;
19956 + struct vx_dmap_target *vdmt;
19958 + xid_t xid = vxi->vx_id;
19961 + spin_lock(hash_lock);
19962 + if (__find_mapping(xid, device, mode, &vdm, &global) > 0) {
19964 + vdmt = &vdm->target;
19968 + index = __mode_to_default(mode);
19969 + if (vxi && vxi->dmap.targets[index].flags) {
19971 + vdmt = &vxi->dmap.targets[index];
19972 + } else if (global) {
19974 + vdmt = &global->target;
19978 + vdmt = &dmap_defaults[index];
19982 + if (target && (vdmt->flags & DATTR_REMAP))
19983 + *target = vdmt->target;
19985 + *target = device;
19987 + *flags = vdmt->flags;
19989 + spin_unlock(hash_lock);
19995 +/* __remove_mapping()
19996 + * remove a mapping from the hash table
19998 +static inline int __remove_mapping(struct vx_info *vxi, dev_t device,
20001 + spinlock_t *hash_lock = &dmap_main_hash_lock;
20002 + struct vs_mapping *vdm = NULL;
20005 + spin_lock(hash_lock);
20007 + ret = __find_mapping((vxi ? vxi->vx_id : 0), device, mode, &vdm,
20009 + vxdprintk(VXD_CBIT(misc, 8), "__remove_mapping: %p[#%d] %08x %04x",
20010 + vxi, vxi ? vxi->vx_id : 0, device, mode);
20013 + hlist_del(&vdm->dm_hlist);
20016 + spin_unlock(hash_lock);
20018 + kmem_cache_free(dmap_cachep, vdm);
20024 +int vs_map_device(struct vx_info *vxi,
20025 + dev_t device, dev_t *target, umode_t mode)
20027 + int ret, flags = DATTR_MASK;
20031 + *target = device;
20034 + ret = __lookup_mapping(vxi, device, target, &flags, mode);
20035 + vxdprintk(VXD_CBIT(misc, 8), "vs_map_device: %08x target: %08x flags: %04x mode: %04x mapped=%d",
20036 + device, target ? *target : 0, flags, mode, ret);
20038 + return (flags & DATTR_MASK);
20043 +static int do_set_mapping(struct vx_info *vxi,
20044 + dev_t device, dev_t target, int flags, umode_t mode)
20047 + struct vs_mapping *new;
20049 + new = kmem_cache_alloc(dmap_cachep, GFP_KERNEL);
20053 + INIT_HLIST_NODE(&new->dm_hlist);
20054 + new->device = device;
20055 + new->target.target = target;
20056 + new->target.flags = flags | mode;
20057 + new->xid = (vxi ? vxi->vx_id : 0);
20059 + vxdprintk(VXD_CBIT(misc, 8), "do_set_mapping: %08x target: %08x flags: %04x", device, target, flags);
20060 + __hash_mapping(vxi, new);
20062 + struct vx_dmap_target new = {
20063 + .target = target,
20064 + .flags = flags | mode,
20066 + __set_default(vxi, mode, &new);
20072 +static int do_unset_mapping(struct vx_info *vxi,
20073 + dev_t device, dev_t target, int flags, umode_t mode)
20075 + int ret = -EINVAL;
20078 + ret = __remove_mapping(vxi, device, mode);
20082 + ret = __remove_default(vxi, mode);
20092 +static inline int __user_device(const char __user *name, dev_t *dev,
20095 + struct nameidata nd;
20102 + ret = user_lpath(name, &nd.path);
20105 + if (nd.path.dentry->d_inode) {
20106 + *dev = nd.path.dentry->d_inode->i_rdev;
20107 + *mode = nd.path.dentry->d_inode->i_mode;
20109 + path_put(&nd.path);
20113 +static inline int __mapping_mode(dev_t device, dev_t target,
20114 + umode_t device_mode, umode_t target_mode, umode_t *mode)
20117 + *mode = device_mode & S_IFMT;
20119 + *mode = target_mode & S_IFMT;
20123 + /* if both given, device and target mode have to match */
20124 + if (device && target &&
20125 + ((device_mode ^ target_mode) & S_IFMT))
20131 +static inline int do_mapping(struct vx_info *vxi, const char __user *device_path,
20132 + const char __user *target_path, int flags, int set)
20134 + dev_t device = ~0, target = ~0;
20135 + umode_t device_mode = 0, target_mode = 0, mode;
20138 + ret = __user_device(device_path, &device, &device_mode);
20141 + ret = __user_device(target_path, &target, &target_mode);
20145 + ret = __mapping_mode(device, target,
20146 + device_mode, target_mode, &mode);
20151 + return do_set_mapping(vxi, device, target,
20154 + return do_unset_mapping(vxi, device, target,
20159 +int vc_set_mapping(struct vx_info *vxi, void __user *data)
20161 + struct vcmd_set_mapping_v0 vc_data;
20163 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20166 + return do_mapping(vxi, vc_data.device, vc_data.target,
20167 + vc_data.flags, 1);
20170 +int vc_unset_mapping(struct vx_info *vxi, void __user *data)
20172 + struct vcmd_set_mapping_v0 vc_data;
20174 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20177 + return do_mapping(vxi, vc_data.device, vc_data.target,
20178 + vc_data.flags, 0);
20182 +#ifdef CONFIG_COMPAT
20184 +int vc_set_mapping_x32(struct vx_info *vxi, void __user *data)
20186 + struct vcmd_set_mapping_v0_x32 vc_data;
20188 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20191 + return do_mapping(vxi, compat_ptr(vc_data.device_ptr),
20192 + compat_ptr(vc_data.target_ptr), vc_data.flags, 1);
20195 +int vc_unset_mapping_x32(struct vx_info *vxi, void __user *data)
20197 + struct vcmd_set_mapping_v0_x32 vc_data;
20199 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20202 + return do_mapping(vxi, compat_ptr(vc_data.device_ptr),
20203 + compat_ptr(vc_data.target_ptr), vc_data.flags, 0);
20206 +#endif /* CONFIG_COMPAT */
20209 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/dlimit.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/dlimit.c
20210 --- linux-2.6.33.2/kernel/vserver/dlimit.c 1970-01-01 01:00:00.000000000 +0100
20211 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/dlimit.c 2010-02-25 12:02:16.000000000 +0100
20214 + * linux/kernel/vserver/dlimit.c
20216 + * Virtual Server: Context Disk Limits
20218 + * Copyright (C) 2004-2009 Herbert Pötzl
20220 + * V0.01 initial version
20221 + * V0.02 compat32 splitup
20222 + * V0.03 extended interface
20226 +#include <linux/statfs.h>
20227 +#include <linux/sched.h>
20228 +#include <linux/namei.h>
20229 +#include <linux/vs_tag.h>
20230 +#include <linux/vs_dlimit.h>
20231 +#include <linux/vserver/dlimit_cmd.h>
20233 +#include <asm/uaccess.h>
20235 +/* __alloc_dl_info()
20237 + * allocate an initialized dl_info struct
20238 + * doesn't make it visible (hash) */
20240 +static struct dl_info *__alloc_dl_info(struct super_block *sb, tag_t tag)
20242 + struct dl_info *new = NULL;
20244 + vxdprintk(VXD_CBIT(dlim, 5),
20245 + "alloc_dl_info(%p,%d)*", sb, tag);
20247 + /* would this benefit from a slab cache? */
20248 + new = kmalloc(sizeof(struct dl_info), GFP_KERNEL);
20252 + memset(new, 0, sizeof(struct dl_info));
20253 + new->dl_tag = tag;
20255 + INIT_RCU_HEAD(&new->dl_rcu);
20256 + INIT_HLIST_NODE(&new->dl_hlist);
20257 + spin_lock_init(&new->dl_lock);
20258 + atomic_set(&new->dl_refcnt, 0);
20259 + atomic_set(&new->dl_usecnt, 0);
20261 + /* rest of init goes here */
20263 + vxdprintk(VXD_CBIT(dlim, 4),
20264 + "alloc_dl_info(%p,%d) = %p", sb, tag, new);
20268 +/* __dealloc_dl_info()
20270 + * final disposal of dl_info */
20272 +static void __dealloc_dl_info(struct dl_info *dli)
20274 + vxdprintk(VXD_CBIT(dlim, 4),
20275 + "dealloc_dl_info(%p)", dli);
20277 + dli->dl_hlist.next = LIST_POISON1;
20278 + dli->dl_tag = -1;
20281 + BUG_ON(atomic_read(&dli->dl_usecnt));
20282 + BUG_ON(atomic_read(&dli->dl_refcnt));
20288 +/* hash table for dl_info hash */
20290 +#define DL_HASH_SIZE 13
20292 +struct hlist_head dl_info_hash[DL_HASH_SIZE];
20294 +static spinlock_t dl_info_hash_lock = SPIN_LOCK_UNLOCKED;
20297 +static inline unsigned int __hashval(struct super_block *sb, tag_t tag)
20299 + return ((tag ^ (unsigned long)sb) % DL_HASH_SIZE);
20304 +/* __hash_dl_info()
20306 + * add the dli to the global hash table
20307 + * requires the hash_lock to be held */
20309 +static inline void __hash_dl_info(struct dl_info *dli)
20311 + struct hlist_head *head;
20313 + vxdprintk(VXD_CBIT(dlim, 6),
20314 + "__hash_dl_info: %p[#%d]", dli, dli->dl_tag);
20315 + get_dl_info(dli);
20316 + head = &dl_info_hash[__hashval(dli->dl_sb, dli->dl_tag)];
20317 + hlist_add_head_rcu(&dli->dl_hlist, head);
20320 +/* __unhash_dl_info()
20322 + * remove the dli from the global hash table
20323 + * requires the hash_lock to be held */
20325 +static inline void __unhash_dl_info(struct dl_info *dli)
20327 + vxdprintk(VXD_CBIT(dlim, 6),
20328 + "__unhash_dl_info: %p[#%d]", dli, dli->dl_tag);
20329 + hlist_del_rcu(&dli->dl_hlist);
20330 + put_dl_info(dli);
20334 +/* __lookup_dl_info()
20336 + * requires the rcu_read_lock()
20337 + * doesn't increment the dl_refcnt */
20339 +static inline struct dl_info *__lookup_dl_info(struct super_block *sb, tag_t tag)
20341 + struct hlist_head *head = &dl_info_hash[__hashval(sb, tag)];
20342 + struct hlist_node *pos;
20343 + struct dl_info *dli;
20345 + hlist_for_each_entry_rcu(dli, pos, head, dl_hlist) {
20347 + if (dli->dl_tag == tag && dli->dl_sb == sb) {
20355 +struct dl_info *locate_dl_info(struct super_block *sb, tag_t tag)
20357 + struct dl_info *dli;
20360 + dli = get_dl_info(__lookup_dl_info(sb, tag));
20361 + vxdprintk(VXD_CBIT(dlim, 7),
20362 + "locate_dl_info(%p,#%d) = %p", sb, tag, dli);
20363 + rcu_read_unlock();
20367 +void rcu_free_dl_info(struct rcu_head *head)
20369 + struct dl_info *dli = container_of(head, struct dl_info, dl_rcu);
20370 + int usecnt, refcnt;
20372 + BUG_ON(!dli || !head);
20374 + usecnt = atomic_read(&dli->dl_usecnt);
20375 + BUG_ON(usecnt < 0);
20377 + refcnt = atomic_read(&dli->dl_refcnt);
20378 + BUG_ON(refcnt < 0);
20380 + vxdprintk(VXD_CBIT(dlim, 3),
20381 + "rcu_free_dl_info(%p)", dli);
20383 + __dealloc_dl_info(dli);
20385 + printk("!!! rcu didn't free\n");
20391 +static int do_addrem_dlimit(uint32_t id, const char __user *name,
20392 + uint32_t flags, int add)
20394 + struct path path;
20397 + ret = user_lpath(name, &path);
20399 + struct super_block *sb;
20400 + struct dl_info *dli;
20403 + if (!path.dentry->d_inode)
20404 + goto out_release;
20405 + if (!(sb = path.dentry->d_inode->i_sb))
20406 + goto out_release;
20409 + dli = __alloc_dl_info(sb, id);
20410 + spin_lock(&dl_info_hash_lock);
20413 + if (__lookup_dl_info(sb, id))
20415 + __hash_dl_info(dli);
20418 + spin_lock(&dl_info_hash_lock);
20419 + dli = __lookup_dl_info(sb, id);
20424 + __unhash_dl_info(dli);
20428 + spin_unlock(&dl_info_hash_lock);
20430 + __dealloc_dl_info(dli);
20437 +int vc_add_dlimit(uint32_t id, void __user *data)
20439 + struct vcmd_ctx_dlimit_base_v0 vc_data;
20441 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20444 + return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 1);
20447 +int vc_rem_dlimit(uint32_t id, void __user *data)
20449 + struct vcmd_ctx_dlimit_base_v0 vc_data;
20451 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20454 + return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 0);
20457 +#ifdef CONFIG_COMPAT
20459 +int vc_add_dlimit_x32(uint32_t id, void __user *data)
20461 + struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
20463 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20466 + return do_addrem_dlimit(id,
20467 + compat_ptr(vc_data.name_ptr), vc_data.flags, 1);
20470 +int vc_rem_dlimit_x32(uint32_t id, void __user *data)
20472 + struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
20474 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20477 + return do_addrem_dlimit(id,
20478 + compat_ptr(vc_data.name_ptr), vc_data.flags, 0);
20481 +#endif /* CONFIG_COMPAT */
20485 +int do_set_dlimit(uint32_t id, const char __user *name,
20486 + uint32_t space_used, uint32_t space_total,
20487 + uint32_t inodes_used, uint32_t inodes_total,
20488 + uint32_t reserved, uint32_t flags)
20490 + struct path path;
20493 + ret = user_lpath(name, &path);
20495 + struct super_block *sb;
20496 + struct dl_info *dli;
20499 + if (!path.dentry->d_inode)
20500 + goto out_release;
20501 + if (!(sb = path.dentry->d_inode->i_sb))
20502 + goto out_release;
20504 + /* sanity checks */
20505 + if ((reserved != CDLIM_KEEP &&
20506 + reserved > 100) ||
20507 + (inodes_used != CDLIM_KEEP &&
20508 + inodes_used > inodes_total) ||
20509 + (space_used != CDLIM_KEEP &&
20510 + space_used > space_total))
20511 + goto out_release;
20514 + dli = locate_dl_info(sb, id);
20516 + goto out_release;
20518 + spin_lock(&dli->dl_lock);
20520 + if (inodes_used != CDLIM_KEEP)
20521 + dli->dl_inodes_used = inodes_used;
20522 + if (inodes_total != CDLIM_KEEP)
20523 + dli->dl_inodes_total = inodes_total;
20524 + if (space_used != CDLIM_KEEP)
20525 + dli->dl_space_used = dlimit_space_32to64(
20526 + space_used, flags, DLIMS_USED);
20528 + if (space_total == CDLIM_INFINITY)
20529 + dli->dl_space_total = DLIM_INFINITY;
20530 + else if (space_total != CDLIM_KEEP)
20531 + dli->dl_space_total = dlimit_space_32to64(
20532 + space_total, flags, DLIMS_TOTAL);
20534 + if (reserved != CDLIM_KEEP)
20535 + dli->dl_nrlmult = (1 << 10) * (100 - reserved) / 100;
20537 + spin_unlock(&dli->dl_lock);
20539 + put_dl_info(dli);
20548 +int vc_set_dlimit(uint32_t id, void __user *data)
20550 + struct vcmd_ctx_dlimit_v0 vc_data;
20552 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20555 + return do_set_dlimit(id, vc_data.name,
20556 + vc_data.space_used, vc_data.space_total,
20557 + vc_data.inodes_used, vc_data.inodes_total,
20558 + vc_data.reserved, vc_data.flags);
20561 +#ifdef CONFIG_COMPAT
20563 +int vc_set_dlimit_x32(uint32_t id, void __user *data)
20565 + struct vcmd_ctx_dlimit_v0_x32 vc_data;
20567 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20570 + return do_set_dlimit(id, compat_ptr(vc_data.name_ptr),
20571 + vc_data.space_used, vc_data.space_total,
20572 + vc_data.inodes_used, vc_data.inodes_total,
20573 + vc_data.reserved, vc_data.flags);
20576 +#endif /* CONFIG_COMPAT */
20580 +int do_get_dlimit(uint32_t id, const char __user *name,
20581 + uint32_t *space_used, uint32_t *space_total,
20582 + uint32_t *inodes_used, uint32_t *inodes_total,
20583 + uint32_t *reserved, uint32_t *flags)
20585 + struct path path;
20588 + ret = user_lpath(name, &path);
20590 + struct super_block *sb;
20591 + struct dl_info *dli;
20594 + if (!path.dentry->d_inode)
20595 + goto out_release;
20596 + if (!(sb = path.dentry->d_inode->i_sb))
20597 + goto out_release;
20600 + dli = locate_dl_info(sb, id);
20602 + goto out_release;
20604 + spin_lock(&dli->dl_lock);
20605 + *inodes_used = dli->dl_inodes_used;
20606 + *inodes_total = dli->dl_inodes_total;
20608 + *space_used = dlimit_space_64to32(
20609 + dli->dl_space_used, flags, DLIMS_USED);
20611 + if (dli->dl_space_total == DLIM_INFINITY)
20612 + *space_total = CDLIM_INFINITY;
20614 + *space_total = dlimit_space_64to32(
20615 + dli->dl_space_total, flags, DLIMS_TOTAL);
20617 + *reserved = 100 - ((dli->dl_nrlmult * 100 + 512) >> 10);
20618 + spin_unlock(&dli->dl_lock);
20620 + put_dl_info(dli);
20631 +int vc_get_dlimit(uint32_t id, void __user *data)
20633 + struct vcmd_ctx_dlimit_v0 vc_data;
20636 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20639 + ret = do_get_dlimit(id, vc_data.name,
20640 + &vc_data.space_used, &vc_data.space_total,
20641 + &vc_data.inodes_used, &vc_data.inodes_total,
20642 + &vc_data.reserved, &vc_data.flags);
20646 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20651 +#ifdef CONFIG_COMPAT
20653 +int vc_get_dlimit_x32(uint32_t id, void __user *data)
20655 + struct vcmd_ctx_dlimit_v0_x32 vc_data;
20658 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20661 + ret = do_get_dlimit(id, compat_ptr(vc_data.name_ptr),
20662 + &vc_data.space_used, &vc_data.space_total,
20663 + &vc_data.inodes_used, &vc_data.inodes_total,
20664 + &vc_data.reserved, &vc_data.flags);
20668 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20673 +#endif /* CONFIG_COMPAT */
20676 +void vx_vsi_statfs(struct super_block *sb, struct kstatfs *buf)
20678 + struct dl_info *dli;
20679 + __u64 blimit, bfree, bavail;
20682 + dli = locate_dl_info(sb, dx_current_tag());
20686 + spin_lock(&dli->dl_lock);
20687 + if (dli->dl_inodes_total == (unsigned long)DLIM_INFINITY)
20690 + /* reduce max inodes available to limit */
20691 + if (buf->f_files > dli->dl_inodes_total)
20692 + buf->f_files = dli->dl_inodes_total;
20694 + ifree = dli->dl_inodes_total - dli->dl_inodes_used;
20695 + /* reduce free inodes to min */
20696 + if (ifree < buf->f_ffree)
20697 + buf->f_ffree = ifree;
20700 + if (dli->dl_space_total == DLIM_INFINITY)
20703 + blimit = dli->dl_space_total >> sb->s_blocksize_bits;
20705 + if (dli->dl_space_total < dli->dl_space_used)
20708 + bfree = (dli->dl_space_total - dli->dl_space_used)
20709 + >> sb->s_blocksize_bits;
20711 + bavail = ((dli->dl_space_total >> 10) * dli->dl_nrlmult);
20712 + if (bavail < dli->dl_space_used)
20715 + bavail = (bavail - dli->dl_space_used)
20716 + >> sb->s_blocksize_bits;
20718 + /* reduce max space available to limit */
20719 + if (buf->f_blocks > blimit)
20720 + buf->f_blocks = blimit;
20722 + /* reduce free space to min */
20723 + if (bfree < buf->f_bfree)
20724 + buf->f_bfree = bfree;
20726 + /* reduce avail space to min */
20727 + if (bavail < buf->f_bavail)
20728 + buf->f_bavail = bavail;
20731 + spin_unlock(&dli->dl_lock);
20732 + put_dl_info(dli);
20737 +#include <linux/module.h>
20739 +EXPORT_SYMBOL_GPL(locate_dl_info);
20740 +EXPORT_SYMBOL_GPL(rcu_free_dl_info);
20742 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/helper.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/helper.c
20743 --- linux-2.6.33.2/kernel/vserver/helper.c 1970-01-01 01:00:00.000000000 +0100
20744 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/helper.c 2010-02-25 12:02:16.000000000 +0100
20747 + * linux/kernel/vserver/helper.c
20749 + * Virtual Context Support
20751 + * Copyright (C) 2004-2007 Herbert Pötzl
20753 + * V0.01 basic helper
20757 +#include <linux/kmod.h>
20758 +#include <linux/reboot.h>
20759 +#include <linux/vs_context.h>
20760 +#include <linux/vs_network.h>
20761 +#include <linux/vserver/signal.h>
20764 +char vshelper_path[255] = "/sbin/vshelper";
20767 +static int do_vshelper(char *name, char *argv[], char *envp[], int sync)
20771 + if ((ret = call_usermodehelper(name, argv, envp, sync))) {
20772 + printk( KERN_WARNING
20773 + "%s: (%s %s) returned %s with %d\n",
20774 + name, argv[1], argv[2],
20775 + sync ? "sync" : "async", ret);
20777 + vxdprintk(VXD_CBIT(switch, 4),
20778 + "%s: (%s %s) returned %s with %d",
20779 + name, argv[1], argv[2], sync ? "sync" : "async", ret);
20784 + * vshelper path is set via /proc/sys
20785 + * invoked by vserver sys_reboot(), with
20786 + * the following arguments
20788 + * argv [0] = vshelper_path;
20789 + * argv [1] = action: "restart", "halt", "poweroff", ...
20790 + * argv [2] = context identifier
20792 + * envp [*] = type-specific parameters
20795 +long vs_reboot_helper(struct vx_info *vxi, int cmd, void __user *arg)
20797 + char id_buf[8], cmd_buf[16];
20798 + char uid_buf[16], pid_buf[16];
20801 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20802 + char *envp[] = {"HOME=/", "TERM=linux",
20803 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
20804 + uid_buf, pid_buf, cmd_buf, 0};
20806 + if (vx_info_state(vxi, VXS_HELPER))
20808 + vxi->vx_state |= VXS_HELPER;
20810 + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
20812 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20813 + snprintf(uid_buf, sizeof(uid_buf)-1, "VS_UID=%d", current_uid());
20814 + snprintf(pid_buf, sizeof(pid_buf)-1, "VS_PID=%d", current->pid);
20817 + case LINUX_REBOOT_CMD_RESTART:
20818 + argv[1] = "restart";
20821 + case LINUX_REBOOT_CMD_HALT:
20822 + argv[1] = "halt";
20825 + case LINUX_REBOOT_CMD_POWER_OFF:
20826 + argv[1] = "poweroff";
20829 + case LINUX_REBOOT_CMD_SW_SUSPEND:
20830 + argv[1] = "swsusp";
20833 + case LINUX_REBOOT_CMD_OOM:
20838 + vxi->vx_state &= ~VXS_HELPER;
20842 + ret = do_vshelper(vshelper_path, argv, envp, 0);
20843 + vxi->vx_state &= ~VXS_HELPER;
20844 + __wakeup_vx_info(vxi);
20845 + return (ret) ? -EPERM : 0;
20849 +long vs_reboot(unsigned int cmd, void __user *arg)
20851 + struct vx_info *vxi = current_vx_info();
20854 + vxdprintk(VXD_CBIT(misc, 5),
20855 + "vs_reboot(%p[#%d],%u)",
20856 + vxi, vxi ? vxi->vx_id : 0, cmd);
20858 + ret = vs_reboot_helper(vxi, cmd, arg);
20862 + vxi->reboot_cmd = cmd;
20863 + if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
20865 + case LINUX_REBOOT_CMD_RESTART:
20866 + case LINUX_REBOOT_CMD_HALT:
20867 + case LINUX_REBOOT_CMD_POWER_OFF:
20868 + vx_info_kill(vxi, 0, SIGKILL);
20869 + vx_info_kill(vxi, 1, SIGKILL);
20877 +long vs_oom_action(unsigned int cmd)
20879 + struct vx_info *vxi = current_vx_info();
20882 + vxdprintk(VXD_CBIT(misc, 5),
20883 + "vs_oom_action(%p[#%d],%u)",
20884 + vxi, vxi ? vxi->vx_id : 0, cmd);
20886 + ret = vs_reboot_helper(vxi, cmd, NULL);
20890 + vxi->reboot_cmd = cmd;
20891 + if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
20892 + vx_info_kill(vxi, 0, SIGKILL);
20893 + vx_info_kill(vxi, 1, SIGKILL);
20899 + * argv [0] = vshelper_path;
20900 + * argv [1] = action: "startup", "shutdown"
20901 + * argv [2] = context identifier
20903 + * envp [*] = type-specific parameters
20906 +long vs_state_change(struct vx_info *vxi, unsigned int cmd)
20908 + char id_buf[8], cmd_buf[16];
20909 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20910 + char *envp[] = {"HOME=/", "TERM=linux",
20911 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
20913 + if (!vx_info_flags(vxi, VXF_SC_HELPER, 0))
20916 + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
20917 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20920 + case VSC_STARTUP:
20921 + argv[1] = "startup";
20923 + case VSC_SHUTDOWN:
20924 + argv[1] = "shutdown";
20930 + return do_vshelper(vshelper_path, argv, envp, 1);
20935 + * argv [0] = vshelper_path;
20936 + * argv [1] = action: "netup", "netdown"
20937 + * argv [2] = context identifier
20939 + * envp [*] = type-specific parameters
20942 +long vs_net_change(struct nx_info *nxi, unsigned int cmd)
20944 + char id_buf[8], cmd_buf[16];
20945 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20946 + char *envp[] = {"HOME=/", "TERM=linux",
20947 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
20949 + if (!nx_info_flags(nxi, NXF_SC_HELPER, 0))
20952 + snprintf(id_buf, sizeof(id_buf)-1, "%d", nxi->nx_id);
20953 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20957 + argv[1] = "netup";
20959 + case VSC_NETDOWN:
20960 + argv[1] = "netdown";
20966 + return do_vshelper(vshelper_path, argv, envp, 1);
20969 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/history.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/history.c
20970 --- linux-2.6.33.2/kernel/vserver/history.c 1970-01-01 01:00:00.000000000 +0100
20971 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/history.c 2010-02-25 12:02:16.000000000 +0100
20974 + * kernel/vserver/history.c
20976 + * Virtual Context History Backtrace
20978 + * Copyright (C) 2004-2007 Herbert Pötzl
20980 + * V0.01 basic structure
20981 + * V0.02 hash/unhash and trace
20982 + * V0.03 preemption fixes
20986 +#include <linux/module.h>
20987 +#include <asm/uaccess.h>
20989 +#include <linux/vserver/context.h>
20990 +#include <linux/vserver/debug.h>
20991 +#include <linux/vserver/debug_cmd.h>
20992 +#include <linux/vserver/history.h>
20995 +#ifdef CONFIG_VSERVER_HISTORY
20996 +#define VXH_SIZE CONFIG_VSERVER_HISTORY_SIZE
20998 +#define VXH_SIZE 64
21001 +struct _vx_history {
21002 + unsigned int counter;
21004 + struct _vx_hist_entry entry[VXH_SIZE + 1];
21008 +DEFINE_PER_CPU(struct _vx_history, vx_history_buffer);
21010 +unsigned volatile int vxh_active = 1;
21012 +static atomic_t sequence = ATOMIC_INIT(0);
21017 + * requires disabled preemption */
21019 +struct _vx_hist_entry *vxh_advance(void *loc)
21021 + unsigned int cpu = smp_processor_id();
21022 + struct _vx_history *hist = &per_cpu(vx_history_buffer, cpu);
21023 + struct _vx_hist_entry *entry;
21024 + unsigned int index;
21026 + index = vxh_active ? (hist->counter++ % VXH_SIZE) : VXH_SIZE;
21027 + entry = &hist->entry[index];
21029 + entry->seq = atomic_inc_return(&sequence);
21030 + entry->loc = loc;
21034 +EXPORT_SYMBOL_GPL(vxh_advance);
21037 +#define VXH_LOC_FMTS "(#%04x,*%d):%p"
21039 +#define VXH_LOC_ARGS(e) (e)->seq, cpu, (e)->loc
21042 +#define VXH_VXI_FMTS "%p[#%d,%d.%d]"
21044 +#define VXH_VXI_ARGS(e) (e)->vxi.ptr, \
21045 + (e)->vxi.ptr ? (e)->vxi.xid : 0, \
21046 + (e)->vxi.ptr ? (e)->vxi.usecnt : 0, \
21047 + (e)->vxi.ptr ? (e)->vxi.tasks : 0
21049 +void vxh_dump_entry(struct _vx_hist_entry *e, unsigned cpu)
21051 + switch (e->type) {
21052 + case VXH_THROW_OOPS:
21053 + printk( VXH_LOC_FMTS " oops \n", VXH_LOC_ARGS(e));
21056 + case VXH_GET_VX_INFO:
21057 + case VXH_PUT_VX_INFO:
21058 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS "\n",
21060 + (e->type == VXH_GET_VX_INFO) ? "get" : "put",
21061 + VXH_VXI_ARGS(e));
21064 + case VXH_INIT_VX_INFO:
21065 + case VXH_SET_VX_INFO:
21066 + case VXH_CLR_VX_INFO:
21067 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS " @%p\n",
21069 + (e->type == VXH_INIT_VX_INFO) ? "init" :
21070 + ((e->type == VXH_SET_VX_INFO) ? "set" : "clr"),
21071 + VXH_VXI_ARGS(e), e->sc.data);
21074 + case VXH_CLAIM_VX_INFO:
21075 + case VXH_RELEASE_VX_INFO:
21076 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS " @%p\n",
21078 + (e->type == VXH_CLAIM_VX_INFO) ? "claim" : "release",
21079 + VXH_VXI_ARGS(e), e->sc.data);
21082 + case VXH_ALLOC_VX_INFO:
21083 + case VXH_DEALLOC_VX_INFO:
21084 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS "\n",
21086 + (e->type == VXH_ALLOC_VX_INFO) ? "alloc" : "dealloc",
21087 + VXH_VXI_ARGS(e));
21090 + case VXH_HASH_VX_INFO:
21091 + case VXH_UNHASH_VX_INFO:
21092 + printk( VXH_LOC_FMTS " __%s_vx_info " VXH_VXI_FMTS "\n",
21094 + (e->type == VXH_HASH_VX_INFO) ? "hash" : "unhash",
21095 + VXH_VXI_ARGS(e));
21098 + case VXH_LOC_VX_INFO:
21099 + case VXH_LOOKUP_VX_INFO:
21100 + case VXH_CREATE_VX_INFO:
21101 + printk( VXH_LOC_FMTS " __%s_vx_info [#%d] -> " VXH_VXI_FMTS "\n",
21103 + (e->type == VXH_CREATE_VX_INFO) ? "create" :
21104 + ((e->type == VXH_LOC_VX_INFO) ? "loc" : "lookup"),
21105 + e->ll.arg, VXH_VXI_ARGS(e));
21110 +static void __vxh_dump_history(void)
21112 + unsigned int i, cpu;
21114 + printk("History:\tSEQ: %8x\tNR_CPUS: %d\n",
21115 + atomic_read(&sequence), NR_CPUS);
21117 + for (i = 0; i < VXH_SIZE; i++) {
21118 + for_each_online_cpu(cpu) {
21119 + struct _vx_history *hist =
21120 + &per_cpu(vx_history_buffer, cpu);
21121 + unsigned int index = (hist->counter - i) % VXH_SIZE;
21122 + struct _vx_hist_entry *entry = &hist->entry[index];
21124 + vxh_dump_entry(entry, cpu);
21129 +void vxh_dump_history(void)
21133 + local_irq_enable();
21135 + local_irq_disable();
21137 + __vxh_dump_history();
21141 +/* vserver syscall commands below here */
21144 +int vc_dump_history(uint32_t id)
21147 + __vxh_dump_history();
21154 +int do_read_history(struct __user _vx_hist_entry *data,
21155 + int cpu, uint32_t *index, uint32_t *count)
21157 + int pos, ret = 0;
21158 + struct _vx_history *hist = &per_cpu(vx_history_buffer, cpu);
21159 + int end = hist->counter;
21160 + int start = end - VXH_SIZE + 2;
21161 + int idx = *index;
21163 + /* special case: get current pos */
21169 + /* have we lost some data? */
21173 + for (pos = 0; (pos < *count) && (idx < end); pos++, idx++) {
21174 + struct _vx_hist_entry *entry =
21175 + &hist->entry[idx % VXH_SIZE];
21177 + /* send entry to userspace */
21178 + ret = copy_to_user(&data[pos], entry, sizeof(*entry));
21182 + /* save new index and count */
21185 + return ret ? ret : (*index < end);
21188 +int vc_read_history(uint32_t id, void __user *data)
21190 + struct vcmd_read_history_v0 vc_data;
21193 + if (id >= NR_CPUS)
21196 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21199 + ret = do_read_history((struct __user _vx_hist_entry *)vc_data.data,
21200 + id, &vc_data.index, &vc_data.count);
21202 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21207 +#ifdef CONFIG_COMPAT
21209 +int vc_read_history_x32(uint32_t id, void __user *data)
21211 + struct vcmd_read_history_v0_x32 vc_data;
21214 + if (id >= NR_CPUS)
21217 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21220 + ret = do_read_history((struct __user _vx_hist_entry *)
21221 + compat_ptr(vc_data.data_ptr),
21222 + id, &vc_data.index, &vc_data.count);
21224 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21229 +#endif /* CONFIG_COMPAT */
21231 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/inet.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/inet.c
21232 --- linux-2.6.33.2/kernel/vserver/inet.c 1970-01-01 01:00:00.000000000 +0100
21233 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/inet.c 2010-02-25 12:02:16.000000000 +0100
21236 +#include <linux/in.h>
21237 +#include <linux/inetdevice.h>
21238 +#include <linux/vs_inet.h>
21239 +#include <linux/vs_inet6.h>
21240 +#include <linux/vserver/debug.h>
21241 +#include <net/route.h>
21242 +#include <net/addrconf.h>
21245 +int nx_v4_addr_conflict(struct nx_info *nxi1, struct nx_info *nxi2)
21249 + if (!nxi1 || !nxi2 || nxi1 == nxi2)
21252 + struct nx_addr_v4 *ptr;
21254 + for (ptr = &nxi1->v4; ptr; ptr = ptr->next) {
21255 + if (v4_nx_addr_in_nx_info(nxi2, ptr, -1)) {
21262 + vxdprintk(VXD_CBIT(net, 2),
21263 + "nx_v4_addr_conflict(%p,%p): %d",
21264 + nxi1, nxi2, ret);
21270 +#ifdef CONFIG_IPV6
21272 +int nx_v6_addr_conflict(struct nx_info *nxi1, struct nx_info *nxi2)
21276 + if (!nxi1 || !nxi2 || nxi1 == nxi2)
21279 + struct nx_addr_v6 *ptr;
21281 + for (ptr = &nxi1->v6; ptr; ptr = ptr->next) {
21282 + if (v6_nx_addr_in_nx_info(nxi2, ptr, -1)) {
21289 + vxdprintk(VXD_CBIT(net, 2),
21290 + "nx_v6_addr_conflict(%p,%p): %d",
21291 + nxi1, nxi2, ret);
21298 +int v4_dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
21300 + struct in_device *in_dev;
21301 + struct in_ifaddr **ifap;
21302 + struct in_ifaddr *ifa;
21307 + in_dev = in_dev_get(dev);
21311 + for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
21312 + ifap = &ifa->ifa_next) {
21313 + if (v4_addr_in_nx_info(nxi, ifa->ifa_local, NXA_MASK_SHOW)) {
21318 + in_dev_put(in_dev);
21324 +#ifdef CONFIG_IPV6
21326 +int v6_dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
21328 + struct inet6_dev *in_dev;
21329 + struct inet6_ifaddr **ifap;
21330 + struct inet6_ifaddr *ifa;
21335 + in_dev = in6_dev_get(dev);
21339 + for (ifap = &in_dev->addr_list; (ifa = *ifap) != NULL;
21340 + ifap = &ifa->if_next) {
21341 + if (v6_addr_in_nx_info(nxi, &ifa->addr, -1)) {
21346 + in6_dev_put(in_dev);
21353 +int dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
21359 + if (nxi->v4.type && v4_dev_in_nx_info(dev, nxi))
21361 +#ifdef CONFIG_IPV6
21363 + if (nxi->v6.type && v6_dev_in_nx_info(dev, nxi))
21368 + vxdprintk(VXD_CBIT(net, 3),
21369 + "dev_in_nx_info(%p,%p[#%d]) = %d",
21370 + dev, nxi, nxi ? nxi->nx_id : 0, ret);
21374 +int ip_v4_find_src(struct net *net, struct nx_info *nxi,
21375 + struct rtable **rp, struct flowi *fl)
21380 + /* FIXME: handle lback only case */
21381 + if (!NX_IPV4(nxi))
21384 + vxdprintk(VXD_CBIT(net, 4),
21385 + "ip_v4_find_src(%p[#%u]) " NIPQUAD_FMT " -> " NIPQUAD_FMT,
21386 + nxi, nxi ? nxi->nx_id : 0,
21387 + NIPQUAD(fl->fl4_src), NIPQUAD(fl->fl4_dst));
21389 + /* single IP is unconditional */
21390 + if (nx_info_flags(nxi, NXF_SINGLE_IP, 0) &&
21391 + (fl->fl4_src == INADDR_ANY))
21392 + fl->fl4_src = nxi->v4.ip[0].s_addr;
21394 + if (fl->fl4_src == INADDR_ANY) {
21395 + struct nx_addr_v4 *ptr;
21396 + __be32 found = 0;
21399 + err = __ip_route_output_key(net, rp, fl);
21401 + found = (*rp)->rt_src;
21403 + vxdprintk(VXD_CBIT(net, 4),
21404 + "ip_v4_find_src(%p[#%u]) rok[%u]: " NIPQUAD_FMT,
21405 + nxi, nxi ? nxi->nx_id : 0, fl->oif, NIPQUAD(found));
21406 + if (v4_addr_in_nx_info(nxi, found, NXA_MASK_BIND))
21410 + for (ptr = &nxi->v4; ptr; ptr = ptr->next) {
21411 + __be32 primary = ptr->ip[0].s_addr;
21412 + __be32 mask = ptr->mask.s_addr;
21413 + __be32 neta = primary & mask;
21415 + vxdprintk(VXD_CBIT(net, 4), "ip_v4_find_src(%p[#%u]) chk: "
21416 + NIPQUAD_FMT "/" NIPQUAD_FMT "/" NIPQUAD_FMT,
21417 + nxi, nxi ? nxi->nx_id : 0, NIPQUAD(primary),
21418 + NIPQUAD(mask), NIPQUAD(neta));
21419 + if ((found & mask) != neta)
21422 + fl->fl4_src = primary;
21423 + err = __ip_route_output_key(net, rp, fl);
21424 + vxdprintk(VXD_CBIT(net, 4),
21425 + "ip_v4_find_src(%p[#%u]) rok[%u]: " NIPQUAD_FMT,
21426 + nxi, nxi ? nxi->nx_id : 0, fl->oif, NIPQUAD(primary));
21428 + found = (*rp)->rt_src;
21430 + if (found == primary)
21434 + /* still no source ip? */
21435 + found = ipv4_is_loopback(fl->fl4_dst)
21436 + ? IPI_LOOPBACK : nxi->v4.ip[0].s_addr;
21438 + /* assign src ip to flow */
21439 + fl->fl4_src = found;
21442 + if (!v4_addr_in_nx_info(nxi, fl->fl4_src, NXA_MASK_BIND))
21446 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0)) {
21447 + if (ipv4_is_loopback(fl->fl4_dst))
21448 + fl->fl4_dst = nxi->v4_lback.s_addr;
21449 + if (ipv4_is_loopback(fl->fl4_src))
21450 + fl->fl4_src = nxi->v4_lback.s_addr;
21451 + } else if (ipv4_is_loopback(fl->fl4_dst) &&
21452 + !nx_info_flags(nxi, NXF_LBACK_ALLOW, 0))
21458 +EXPORT_SYMBOL_GPL(ip_v4_find_src);
21460 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/init.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/init.c
21461 --- linux-2.6.33.2/kernel/vserver/init.c 1970-01-01 01:00:00.000000000 +0100
21462 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/init.c 2010-02-25 12:02:16.000000000 +0100
21465 + * linux/kernel/init.c
21467 + * Virtual Server Init
21469 + * Copyright (C) 2004-2007 Herbert Pötzl
21471 + * V0.01 basic structure
21475 +#include <linux/init.h>
21477 +int vserver_register_sysctl(void);
21478 +void vserver_unregister_sysctl(void);
21481 +static int __init init_vserver(void)
21485 +#ifdef CONFIG_VSERVER_DEBUG
21486 + vserver_register_sysctl();
21492 +static void __exit exit_vserver(void)
21495 +#ifdef CONFIG_VSERVER_DEBUG
21496 + vserver_unregister_sysctl();
21501 +/* FIXME: GFP_ZONETYPES gone
21502 +long vx_slab[GFP_ZONETYPES]; */
21506 +module_init(init_vserver);
21507 +module_exit(exit_vserver);
21509 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/inode.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/inode.c
21510 --- linux-2.6.33.2/kernel/vserver/inode.c 1970-01-01 01:00:00.000000000 +0100
21511 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/inode.c 2010-02-25 12:02:16.000000000 +0100
21514 + * linux/kernel/vserver/inode.c
21516 + * Virtual Server: File System Support
21518 + * Copyright (C) 2004-2007 Herbert Pötzl
21520 + * V0.01 separated from vcontext V0.05
21521 + * V0.02 moved to tag (instead of xid)
21525 +#include <linux/tty.h>
21526 +#include <linux/proc_fs.h>
21527 +#include <linux/devpts_fs.h>
21528 +#include <linux/fs.h>
21529 +#include <linux/file.h>
21530 +#include <linux/mount.h>
21531 +#include <linux/parser.h>
21532 +#include <linux/namei.h>
21533 +#include <linux/vserver/inode.h>
21534 +#include <linux/vserver/inode_cmd.h>
21535 +#include <linux/vs_base.h>
21536 +#include <linux/vs_tag.h>
21538 +#include <asm/uaccess.h>
21541 +static int __vc_get_iattr(struct inode *in, uint32_t *tag, uint32_t *flags, uint32_t *mask)
21543 + struct proc_dir_entry *entry;
21545 + if (!in || !in->i_sb)
21548 + *flags = IATTR_TAG
21549 + | (IS_IMMUTABLE(in) ? IATTR_IMMUTABLE : 0)
21550 + | (IS_IXUNLINK(in) ? IATTR_IXUNLINK : 0)
21551 + | (IS_BARRIER(in) ? IATTR_BARRIER : 0)
21552 + | (IS_COW(in) ? IATTR_COW : 0);
21553 + *mask = IATTR_IXUNLINK | IATTR_IMMUTABLE | IATTR_COW;
21555 + if (S_ISDIR(in->i_mode))
21556 + *mask |= IATTR_BARRIER;
21558 + if (IS_TAGGED(in)) {
21559 + *tag = in->i_tag;
21560 + *mask |= IATTR_TAG;
21563 + switch (in->i_sb->s_magic) {
21564 + case PROC_SUPER_MAGIC:
21565 + entry = PROC_I(in)->pde;
21567 + /* check for specific inodes? */
21569 + *mask |= IATTR_FLAGS;
21571 + *flags |= (entry->vx_flags & IATTR_FLAGS);
21573 + *flags |= (PROC_I(in)->vx_flags & IATTR_FLAGS);
21576 + case DEVPTS_SUPER_MAGIC:
21577 + *tag = in->i_tag;
21578 + *mask |= IATTR_TAG;
21587 +int vc_get_iattr(void __user *data)
21589 + struct path path;
21590 + struct vcmd_ctx_iattr_v1 vc_data = { .tag = -1 };
21593 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21596 + ret = user_lpath(vc_data.name, &path);
21598 + ret = __vc_get_iattr(path.dentry->d_inode,
21599 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21605 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21610 +#ifdef CONFIG_COMPAT
21612 +int vc_get_iattr_x32(void __user *data)
21614 + struct path path;
21615 + struct vcmd_ctx_iattr_v1_x32 vc_data = { .tag = -1 };
21618 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21621 + ret = user_lpath(compat_ptr(vc_data.name_ptr), &path);
21623 + ret = __vc_get_iattr(path.dentry->d_inode,
21624 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21630 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21635 +#endif /* CONFIG_COMPAT */
21638 +int vc_fget_iattr(uint32_t fd, void __user *data)
21640 + struct file *filp;
21641 + struct vcmd_ctx_fiattr_v0 vc_data = { .tag = -1 };
21644 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21648 + if (!filp || !filp->f_dentry || !filp->f_dentry->d_inode)
21651 + ret = __vc_get_iattr(filp->f_dentry->d_inode,
21652 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21656 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21662 +static int __vc_set_iattr(struct dentry *de, uint32_t *tag, uint32_t *flags, uint32_t *mask)
21664 + struct inode *in = de->d_inode;
21665 + int error = 0, is_proc = 0, has_tag = 0;
21666 + struct iattr attr = { 0 };
21668 + if (!in || !in->i_sb)
21671 + is_proc = (in->i_sb->s_magic == PROC_SUPER_MAGIC);
21672 + if ((*mask & IATTR_FLAGS) && !is_proc)
21675 + has_tag = IS_TAGGED(in) ||
21676 + (in->i_sb->s_magic == DEVPTS_SUPER_MAGIC);
21677 + if ((*mask & IATTR_TAG) && !has_tag)
21680 + mutex_lock(&in->i_mutex);
21681 + if (*mask & IATTR_TAG) {
21682 + attr.ia_tag = *tag;
21683 + attr.ia_valid |= ATTR_TAG;
21686 + if (*mask & IATTR_FLAGS) {
21687 + struct proc_dir_entry *entry = PROC_I(in)->pde;
21688 + unsigned int iflags = PROC_I(in)->vx_flags;
21690 + iflags = (iflags & ~(*mask & IATTR_FLAGS))
21691 + | (*flags & IATTR_FLAGS);
21692 + PROC_I(in)->vx_flags = iflags;
21694 + entry->vx_flags = iflags;
21697 + if (*mask & (IATTR_IMMUTABLE | IATTR_IXUNLINK |
21698 + IATTR_BARRIER | IATTR_COW)) {
21699 + int iflags = in->i_flags;
21700 + int vflags = in->i_vflags;
21702 + if (*mask & IATTR_IMMUTABLE) {
21703 + if (*flags & IATTR_IMMUTABLE)
21704 + iflags |= S_IMMUTABLE;
21706 + iflags &= ~S_IMMUTABLE;
21708 + if (*mask & IATTR_IXUNLINK) {
21709 + if (*flags & IATTR_IXUNLINK)
21710 + iflags |= S_IXUNLINK;
21712 + iflags &= ~S_IXUNLINK;
21714 + if (S_ISDIR(in->i_mode) && (*mask & IATTR_BARRIER)) {
21715 + if (*flags & IATTR_BARRIER)
21716 + vflags |= V_BARRIER;
21718 + vflags &= ~V_BARRIER;
21720 + if (S_ISREG(in->i_mode) && (*mask & IATTR_COW)) {
21721 + if (*flags & IATTR_COW)
21724 + vflags &= ~V_COW;
21726 + if (in->i_op && in->i_op->sync_flags) {
21727 + error = in->i_op->sync_flags(in, iflags, vflags);
21733 + if (attr.ia_valid) {
21734 + if (in->i_op && in->i_op->setattr)
21735 + error = in->i_op->setattr(de, &attr);
21737 + error = inode_change_ok(in, &attr);
21739 + error = inode_setattr(in, &attr);
21744 + mutex_unlock(&in->i_mutex);
21748 +int vc_set_iattr(void __user *data)
21750 + struct path path;
21751 + struct vcmd_ctx_iattr_v1 vc_data;
21754 + if (!capable(CAP_LINUX_IMMUTABLE))
21756 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21759 + ret = user_lpath(vc_data.name, &path);
21761 + ret = __vc_set_iattr(path.dentry,
21762 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21766 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21771 +#ifdef CONFIG_COMPAT
21773 +int vc_set_iattr_x32(void __user *data)
21775 + struct path path;
21776 + struct vcmd_ctx_iattr_v1_x32 vc_data;
21779 + if (!capable(CAP_LINUX_IMMUTABLE))
21781 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21784 + ret = user_lpath(compat_ptr(vc_data.name_ptr), &path);
21786 + ret = __vc_set_iattr(path.dentry,
21787 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21791 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21796 +#endif /* CONFIG_COMPAT */
21798 +int vc_fset_iattr(uint32_t fd, void __user *data)
21800 + struct file *filp;
21801 + struct vcmd_ctx_fiattr_v0 vc_data;
21804 + if (!capable(CAP_LINUX_IMMUTABLE))
21806 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21810 + if (!filp || !filp->f_dentry || !filp->f_dentry->d_inode)
21813 + ret = __vc_set_iattr(filp->f_dentry, &vc_data.tag,
21814 + &vc_data.flags, &vc_data.mask);
21818 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21824 +enum { Opt_notagcheck, Opt_tag, Opt_notag, Opt_tagid, Opt_err };
21826 +static match_table_t tokens = {
21827 + {Opt_notagcheck, "notagcheck"},
21828 +#ifdef CONFIG_PROPAGATE
21829 + {Opt_notag, "notag"},
21830 + {Opt_tag, "tag"},
21831 + {Opt_tagid, "tagid=%u"},
21837 +static void __dx_parse_remove(char *string, char *opt)
21839 + char *p = strstr(string, opt);
21843 + while (*q != '\0' && *q != ',')
21852 +int dx_parse_tag(char *string, tag_t *tag, int remove, int *mnt_flags,
21853 + unsigned long *flags)
21856 + substring_t args[MAX_OPT_ARGS];
21857 + int token, option = 0;
21858 + char *s, *p, *opts;
21862 + s = kstrdup(string, GFP_KERNEL | GFP_ATOMIC);
21867 + while ((p = strsep(&opts, ",")) != NULL) {
21868 + token = match_token(p, tokens, args);
21870 + vxdprintk(VXD_CBIT(tag, 7),
21871 + "dx_parse_tag(»%s«): %d:#%d",
21872 + p, token, option);
21875 +#ifdef CONFIG_PROPAGATE
21880 + __dx_parse_remove(s, "tag");
21881 + *mnt_flags |= MNT_TAGID;
21882 + set |= MNT_TAGID;
21886 + __dx_parse_remove(s, "notag");
21887 + *mnt_flags |= MNT_NOTAG;
21888 + set |= MNT_NOTAG;
21891 + if (tag && !match_int(args, &option))
21894 + __dx_parse_remove(s, "tagid");
21895 + *mnt_flags |= MNT_TAGID;
21896 + set |= MNT_TAGID;
21899 + case Opt_notagcheck:
21901 + __dx_parse_remove(s, "notagcheck");
21902 + *flags |= MS_NOTAGCHECK;
21903 + set |= MS_NOTAGCHECK;
21908 + strcpy(string, s);
21913 +#ifdef CONFIG_PROPAGATE
21915 +void __dx_propagate_tag(struct nameidata *nd, struct inode *inode)
21917 + tag_t new_tag = 0;
21918 + struct vfsmount *mnt;
21923 + mnt = nd->path.mnt;
21927 + propagate = (mnt->mnt_flags & MNT_TAGID);
21929 + new_tag = mnt->mnt_tag;
21931 + vxdprintk(VXD_CBIT(tag, 7),
21932 + "dx_propagate_tag(%p[#%lu.%d]): %d,%d",
21933 + inode, inode->i_ino, inode->i_tag,
21934 + new_tag, (propagate) ? 1 : 0);
21937 + inode->i_tag = new_tag;
21940 +#include <linux/module.h>
21942 +EXPORT_SYMBOL_GPL(__dx_propagate_tag);
21944 +#endif /* CONFIG_PROPAGATE */
21946 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/Kconfig
21947 --- linux-2.6.33.2/kernel/vserver/Kconfig 1970-01-01 01:00:00.000000000 +0100
21948 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/Kconfig 2010-02-25 12:02:16.000000000 +0100
21951 +# Linux VServer configuration
21954 +menu "Linux VServer"
21956 +config VSERVER_AUTO_LBACK
21957 + bool "Automatically Assign Loopback IP"
21960 + Automatically assign a guest specific loopback
21961 + IP and add it to the kernel network stack on
21964 +config VSERVER_AUTO_SINGLE
21965 + bool "Automatic Single IP Special Casing"
21966 + depends on EXPERIMENTAL
21969 + This allows network contexts with a single IP to
21970 + automatically remap 0.0.0.0 bindings to that IP,
21971 + avoiding further network checks and improving
21974 + (note: such guests do not allow to change the ip
21975 + on the fly and do not show loopback addresses)
21977 +config VSERVER_COWBL
21978 + bool "Enable COW Immutable Link Breaking"
21981 + This enables the COW (Copy-On-Write) link break code.
21982 + It allows you to treat unified files like normal files
21983 + when writing to them (which will implicitely break the
21984 + link and create a copy of the unified file)
21986 +config VSERVER_VTIME
21987 + bool "Enable Virtualized Guest Time"
21988 + depends on EXPERIMENTAL
21991 + This enables per guest time offsets to allow for
21992 + adjusting the system clock individually per guest.
21993 + this adds some overhead to the time functions and
21994 + therefore should not be enabled without good reason.
21996 +config VSERVER_DEVICE
21997 + bool "Enable Guest Device Mapping"
21998 + depends on EXPERIMENTAL
22001 + This enables generic device remapping.
22003 +config VSERVER_PROC_SECURE
22004 + bool "Enable Proc Security"
22005 + depends on PROC_FS
22008 + This configures ProcFS security to initially hide
22009 + non-process entries for all contexts except the main and
22010 + spectator context (i.e. for all guests), which is a secure
22013 + (note: on 1.2x the entries were visible by default)
22015 +config VSERVER_HARDCPU
22016 + bool "Enable Hard CPU Limits"
22019 + Activate the Hard CPU Limits
22021 + This will compile in code that allows the Token Bucket
22022 + Scheduler to put processes on hold when a context's
22023 + tokens are depleted (provided that its per-context
22024 + sched_hard flag is set).
22026 + Processes belonging to that context will not be able
22027 + to consume CPU resources again until a per-context
22028 + configured minimum of tokens has been reached.
22030 +config VSERVER_IDLETIME
22031 + bool "Avoid idle CPUs by skipping Time"
22032 + depends on VSERVER_HARDCPU
22035 + This option allows the scheduler to artificially
22036 + advance time (per cpu) when otherwise the idle
22037 + task would be scheduled, thus keeping the cpu
22038 + busy and sharing the available resources among
22039 + certain contexts.
22041 +config VSERVER_IDLELIMIT
22042 + bool "Limit the IDLE task"
22043 + depends on VSERVER_HARDCPU
22046 + Limit the idle slices, so the the next context
22047 + will be scheduled as soon as possible.
22049 + This might improve interactivity and latency, but
22050 + will also marginally increase scheduling overhead.
22053 + prompt "Persistent Inode Tagging"
22054 + default TAGGING_ID24
22056 + This adds persistent context information to filesystems
22057 + mounted with the tagxid option. Tagging is a requirement
22058 + for per-context disk limits and per-context quota.
22061 +config TAGGING_NONE
22064 + do not store per-context information in inodes.
22066 +config TAGGING_UID16
22067 + bool "UID16/GID32"
22069 + reduces UID to 16 bit, but leaves GID at 32 bit.
22071 +config TAGGING_GID16
22072 + bool "UID32/GID16"
22074 + reduces GID to 16 bit, but leaves UID at 32 bit.
22076 +config TAGGING_ID24
22077 + bool "UID24/GID24"
22079 + uses the upper 8bit from UID and GID for XID tagging
22080 + which leaves 24bit for UID/GID each, which should be
22081 + more than sufficient for normal use.
22083 +config TAGGING_INTERN
22084 + bool "UID32/GID32"
22086 + this uses otherwise reserved inode fields in the on
22087 + disk representation, which limits the use to a few
22088 + filesystems (currently ext2 and ext3)
22093 + bool "Tag NFSD User Auth and Files"
22096 + Enable this if you do want the in-kernel NFS
22097 + Server to use the tagging specified above.
22098 + (will require patched clients too)
22100 +config VSERVER_PRIVACY
22101 + bool "Honor Privacy Aspects of Guests"
22104 + When enabled, most context checks will disallow
22105 + access to structures assigned to a specific context,
22106 + like ptys or loop devices.
22108 +config VSERVER_CONTEXTS
22109 + int "Maximum number of Contexts (1-65533)" if EMBEDDED
22111 + default "768" if 64BIT
22114 + This setting will optimize certain data structures
22115 + and memory allocations according to the expected
22118 + note: this is not a strict upper limit.
22120 +config VSERVER_WARN
22121 + bool "VServer Warnings"
22124 + This enables various runtime warnings, which will
22125 + notify about potential manipulation attempts or
22126 + resource shortage. It is generally considered to
22127 + be a good idea to have that enabled.
22129 +config VSERVER_DEBUG
22130 + bool "VServer Debugging Code"
22133 + Set this to yes if you want to be able to activate
22134 + debugging output at runtime. It adds a very small
22135 + overhead to all vserver related functions and
22136 + increases the kernel size by about 20k.
22138 +config VSERVER_HISTORY
22139 + bool "VServer History Tracing"
22140 + depends on VSERVER_DEBUG
22143 + Set this to yes if you want to record the history of
22144 + linux-vserver activities, so they can be replayed in
22145 + the event of a kernel panic or oops.
22147 +config VSERVER_HISTORY_SIZE
22148 + int "Per-CPU History Size (32-65536)"
22149 + depends on VSERVER_HISTORY
22153 + This allows you to specify the number of entries in
22154 + the per-CPU history buffer.
22156 +config VSERVER_MONITOR
22157 + bool "VServer Scheduling Monitor"
22158 + depends on VSERVER_DISABLED
22161 + Set this to yes if you want to record the scheduling
22162 + decisions, so that they can be relayed to userspace
22163 + for detailed analysis.
22165 +config VSERVER_MONITOR_SIZE
22166 + int "Per-CPU Monitor Queue Size (32-65536)"
22167 + depends on VSERVER_MONITOR
22171 + This allows you to specify the number of entries in
22172 + the per-CPU scheduling monitor buffer.
22174 +config VSERVER_MONITOR_SYNC
22175 + int "Per-CPU Monitor Sync Interval (0-65536)"
22176 + depends on VSERVER_MONITOR
22180 + This allows you to specify the interval in ticks
22181 + when a time sync entry is inserted.
22189 + select NAMESPACES
22195 +config VSERVER_SECURITY
22197 + depends on SECURITY
22199 + select SECURITY_CAPABILITIES
22201 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/limit.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/limit.c
22202 --- linux-2.6.33.2/kernel/vserver/limit.c 1970-01-01 01:00:00.000000000 +0100
22203 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/limit.c 2010-03-23 19:51:30.000000000 +0100
22206 + * linux/kernel/vserver/limit.c
22208 + * Virtual Server: Context Limits
22210 + * Copyright (C) 2004-2010 Herbert Pötzl
22212 + * V0.01 broken out from vcontext V0.05
22213 + * V0.02 changed vcmds to vxi arg
22214 + * V0.03 added memory cgroup support
22218 +#include <linux/sched.h>
22219 +#include <linux/module.h>
22220 +#include <linux/memcontrol.h>
22221 +#include <linux/res_counter.h>
22222 +#include <linux/vs_limit.h>
22223 +#include <linux/vserver/limit.h>
22224 +#include <linux/vserver/limit_cmd.h>
22226 +#include <asm/uaccess.h>
22229 +const char *vlimit_name[NUM_LIMITS] = {
22230 + [RLIMIT_CPU] = "CPU",
22231 + [RLIMIT_RSS] = "RSS",
22232 + [RLIMIT_NPROC] = "NPROC",
22233 + [RLIMIT_NOFILE] = "NOFILE",
22234 + [RLIMIT_MEMLOCK] = "VML",
22235 + [RLIMIT_AS] = "VM",
22236 + [RLIMIT_LOCKS] = "LOCKS",
22237 + [RLIMIT_SIGPENDING] = "SIGP",
22238 + [RLIMIT_MSGQUEUE] = "MSGQ",
22240 + [VLIMIT_NSOCK] = "NSOCK",
22241 + [VLIMIT_OPENFD] = "OPENFD",
22242 + [VLIMIT_ANON] = "ANON",
22243 + [VLIMIT_SHMEM] = "SHMEM",
22244 + [VLIMIT_DENTRY] = "DENTRY",
22247 +EXPORT_SYMBOL_GPL(vlimit_name);
22249 +#define MASK_ENTRY(x) (1 << (x))
22251 +const struct vcmd_ctx_rlimit_mask_v0 vlimit_mask = {
22254 + , /* softlimit */
22255 + MASK_ENTRY( RLIMIT_RSS ) |
22256 + MASK_ENTRY( VLIMIT_ANON ) |
22259 + MASK_ENTRY( RLIMIT_RSS ) |
22260 + MASK_ENTRY( RLIMIT_NPROC ) |
22261 + MASK_ENTRY( RLIMIT_NOFILE ) |
22262 + MASK_ENTRY( RLIMIT_MEMLOCK ) |
22263 + MASK_ENTRY( RLIMIT_AS ) |
22264 + MASK_ENTRY( RLIMIT_LOCKS ) |
22265 + MASK_ENTRY( RLIMIT_MSGQUEUE ) |
22267 + MASK_ENTRY( VLIMIT_NSOCK ) |
22268 + MASK_ENTRY( VLIMIT_OPENFD ) |
22269 + MASK_ENTRY( VLIMIT_ANON ) |
22270 + MASK_ENTRY( VLIMIT_SHMEM ) |
22271 + MASK_ENTRY( VLIMIT_DENTRY ) |
22274 + /* accounting only */
22275 +uint32_t account_mask =
22276 + MASK_ENTRY( VLIMIT_SEMARY ) |
22277 + MASK_ENTRY( VLIMIT_NSEMS ) |
22278 + MASK_ENTRY( VLIMIT_MAPPED ) |
22282 +static int is_valid_vlimit(int id)
22284 + uint32_t mask = vlimit_mask.minimum |
22285 + vlimit_mask.softlimit | vlimit_mask.maximum;
22286 + return mask & (1 << id);
22289 +static int is_accounted_vlimit(int id)
22291 + if (is_valid_vlimit(id))
22293 + return account_mask & (1 << id);
22297 +static inline uint64_t vc_get_soft(struct vx_info *vxi, int id)
22299 + rlim_t limit = __rlim_soft(&vxi->limit, id);
22300 + return VX_VLIM(limit);
22303 +static inline uint64_t vc_get_hard(struct vx_info *vxi, int id)
22305 + rlim_t limit = __rlim_hard(&vxi->limit, id);
22306 + return VX_VLIM(limit);
22309 +static int do_get_rlimit(struct vx_info *vxi, uint32_t id,
22310 + uint64_t *minimum, uint64_t *softlimit, uint64_t *maximum)
22312 + if (!is_valid_vlimit(id))
22316 + *minimum = CRLIM_UNSET;
22318 + *softlimit = vc_get_soft(vxi, id);
22320 + *maximum = vc_get_hard(vxi, id);
22324 +int vc_get_rlimit(struct vx_info *vxi, void __user *data)
22326 + struct vcmd_ctx_rlimit_v0 vc_data;
22329 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22332 + ret = do_get_rlimit(vxi, vc_data.id,
22333 + &vc_data.minimum, &vc_data.softlimit, &vc_data.maximum);
22337 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22342 +static int do_set_rlimit(struct vx_info *vxi, uint32_t id,
22343 + uint64_t minimum, uint64_t softlimit, uint64_t maximum)
22345 + if (!is_valid_vlimit(id))
22348 + if (maximum != CRLIM_KEEP)
22349 + __rlim_hard(&vxi->limit, id) = VX_RLIM(maximum);
22350 + if (softlimit != CRLIM_KEEP)
22351 + __rlim_soft(&vxi->limit, id) = VX_RLIM(softlimit);
22353 + /* clamp soft limit */
22354 + if (__rlim_soft(&vxi->limit, id) > __rlim_hard(&vxi->limit, id))
22355 + __rlim_soft(&vxi->limit, id) = __rlim_hard(&vxi->limit, id);
22360 +int vc_set_rlimit(struct vx_info *vxi, void __user *data)
22362 + struct vcmd_ctx_rlimit_v0 vc_data;
22364 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22367 + return do_set_rlimit(vxi, vc_data.id,
22368 + vc_data.minimum, vc_data.softlimit, vc_data.maximum);
22371 +#ifdef CONFIG_IA32_EMULATION
22373 +int vc_set_rlimit_x32(struct vx_info *vxi, void __user *data)
22375 + struct vcmd_ctx_rlimit_v0_x32 vc_data;
22377 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22380 + return do_set_rlimit(vxi, vc_data.id,
22381 + vc_data.minimum, vc_data.softlimit, vc_data.maximum);
22384 +int vc_get_rlimit_x32(struct vx_info *vxi, void __user *data)
22386 + struct vcmd_ctx_rlimit_v0_x32 vc_data;
22389 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22392 + ret = do_get_rlimit(vxi, vc_data.id,
22393 + &vc_data.minimum, &vc_data.softlimit, &vc_data.maximum);
22397 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22402 +#endif /* CONFIG_IA32_EMULATION */
22405 +int vc_get_rlimit_mask(uint32_t id, void __user *data)
22407 + if (copy_to_user(data, &vlimit_mask, sizeof(vlimit_mask)))
22413 +static inline void vx_reset_hits(struct _vx_limit *limit)
22417 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22418 + atomic_set(&__rlim_lhit(limit, lim), 0);
22422 +int vc_reset_hits(struct vx_info *vxi, void __user *data)
22424 + vx_reset_hits(&vxi->limit);
22428 +static inline void vx_reset_minmax(struct _vx_limit *limit)
22433 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22434 + value = __rlim_get(limit, lim);
22435 + __rlim_rmax(limit, lim) = value;
22436 + __rlim_rmin(limit, lim) = value;
22440 +int vc_reset_minmax(struct vx_info *vxi, void __user *data)
22442 + vx_reset_minmax(&vxi->limit);
22447 +int vc_rlimit_stat(struct vx_info *vxi, void __user *data)
22449 + struct vcmd_rlimit_stat_v0 vc_data;
22450 + struct _vx_limit *limit = &vxi->limit;
22453 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22457 + if (!is_accounted_vlimit(id))
22460 + vx_limit_fixup(limit, id);
22461 + vc_data.hits = atomic_read(&__rlim_lhit(limit, id));
22462 + vc_data.value = __rlim_get(limit, id);
22463 + vc_data.minimum = __rlim_rmin(limit, id);
22464 + vc_data.maximum = __rlim_rmax(limit, id);
22466 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22472 +void vx_vsi_meminfo(struct sysinfo *val)
22474 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22475 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22476 + u64 res_limit, res_usage;
22481 + res_limit = mem_cgroup_res_read_u64(mcg, RES_LIMIT);
22482 + res_usage = mem_cgroup_res_read_u64(mcg, RES_USAGE);
22484 + if (res_limit != RESOURCE_MAX)
22485 + val->totalram = (res_limit >> PAGE_SHIFT);
22486 + val->freeram = val->totalram - (res_usage >> PAGE_SHIFT);
22487 + val->bufferram = 0;
22488 +#else /* !CONFIG_CGROUP_MEM_RES_CTLR */
22489 + struct vx_info *vxi = current_vx_info();
22490 + unsigned long totalram, freeram;
22493 + /* we blindly accept the max */
22494 + v = __rlim_soft(&vxi->limit, RLIMIT_RSS);
22495 + totalram = (v != RLIM_INFINITY) ? v : val->totalram;
22497 + /* total minus used equals free */
22498 + v = __vx_cres_array_fixup(&vxi->limit, VLA_RSS);
22499 + freeram = (v < totalram) ? totalram - v : 0;
22501 + val->totalram = totalram;
22502 + val->freeram = freeram;
22503 +#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
22504 + val->totalhigh = 0;
22505 + val->freehigh = 0;
22509 +void vx_vsi_swapinfo(struct sysinfo *val)
22511 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22512 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
22513 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22514 + u64 res_limit, res_usage, memsw_limit, memsw_usage;
22515 + s64 swap_limit, swap_usage;
22520 + res_limit = mem_cgroup_res_read_u64(mcg, RES_LIMIT);
22521 + res_usage = mem_cgroup_res_read_u64(mcg, RES_USAGE);
22522 + memsw_limit = mem_cgroup_memsw_read_u64(mcg, RES_LIMIT);
22523 + memsw_usage = mem_cgroup_memsw_read_u64(mcg, RES_USAGE);
22525 + if (res_limit == RESOURCE_MAX)
22528 + swap_limit = memsw_limit - res_limit;
22529 + if (memsw_limit != RESOURCE_MAX)
22530 + val->totalswap = swap_limit >> PAGE_SHIFT;
22532 + swap_usage = memsw_usage - res_usage;
22533 + val->freeswap = (swap_usage < swap_limit) ?
22534 + val->totalswap - (swap_usage >> PAGE_SHIFT) : 0;
22535 +#else /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
22536 + val->totalswap = 0;
22537 + val->freeswap = 0;
22538 +#endif /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
22539 +#else /* !CONFIG_CGROUP_MEM_RES_CTLR */
22540 + struct vx_info *vxi = current_vx_info();
22541 + unsigned long totalswap, freeswap;
22544 + v = __rlim_soft(&vxi->limit, RLIMIT_RSS);
22545 + if (v == RLIM_INFINITY) {
22546 + val->freeswap = val->totalswap;
22550 + /* we blindly accept the max */
22551 + w = __rlim_hard(&vxi->limit, RLIMIT_RSS);
22552 + totalswap = (w != RLIM_INFINITY) ? (w - v) : val->totalswap;
22554 + /* currently 'used' swap */
22555 + w = __vx_cres_array_fixup(&vxi->limit, VLA_RSS);
22556 + w -= (w > v) ? v : w;
22558 + /* total minus used equals free */
22559 + freeswap = (w < totalswap) ? totalswap - w : 0;
22561 + val->totalswap = totalswap;
22562 + val->freeswap = freeswap;
22563 +#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
22567 +long vx_vsi_cached(struct sysinfo *val)
22569 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22570 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22572 + return mem_cgroup_stat_read_cache(mcg);
22579 +unsigned long vx_badness(struct task_struct *task, struct mm_struct *mm)
22581 + struct vx_info *vxi = mm->mm_vx_info;
22582 + unsigned long points;
22588 + points = vxi->vx_badness_bias;
22590 + v = __vx_cres_array_fixup(&vxi->limit, VLA_RSS);
22591 + w = __rlim_soft(&vxi->limit, RLIMIT_RSS);
22592 + points += (v > w) ? (v - w) : 0;
22597 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/limit_init.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/limit_init.h
22598 --- linux-2.6.33.2/kernel/vserver/limit_init.h 1970-01-01 01:00:00.000000000 +0100
22599 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/limit_init.h 2010-02-25 12:02:16.000000000 +0100
22603 +static inline void vx_info_init_limit(struct _vx_limit *limit)
22607 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22608 + __rlim_soft(limit, lim) = RLIM_INFINITY;
22609 + __rlim_hard(limit, lim) = RLIM_INFINITY;
22610 + __rlim_set(limit, lim, 0);
22611 + atomic_set(&__rlim_lhit(limit, lim), 0);
22612 + __rlim_rmin(limit, lim) = 0;
22613 + __rlim_rmax(limit, lim) = 0;
22617 +static inline void vx_info_exit_limit(struct _vx_limit *limit)
22622 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22623 + if ((1 << lim) & VLIM_NOCHECK)
22625 + value = __rlim_get(limit, lim);
22626 + vxwprintk_xid(value,
22627 + "!!! limit: %p[%s,%d] = %ld on exit.",
22628 + limit, vlimit_name[lim], lim, (long)value);
22632 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/limit_proc.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/limit_proc.h
22633 --- linux-2.6.33.2/kernel/vserver/limit_proc.h 1970-01-01 01:00:00.000000000 +0100
22634 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/limit_proc.h 2010-02-25 12:02:16.000000000 +0100
22636 +#ifndef _VX_LIMIT_PROC_H
22637 +#define _VX_LIMIT_PROC_H
22639 +#include <linux/vserver/limit_int.h>
22642 +#define VX_LIMIT_FMT ":\t%8ld\t%8ld/%8ld\t%8lld/%8lld\t%6d\n"
22643 +#define VX_LIMIT_TOP \
22644 + "Limit\t current\t min/max\t\t soft/hard\t\thits\n"
22646 +#define VX_LIMIT_ARG(r) \
22647 + (unsigned long)__rlim_get(limit, r), \
22648 + (unsigned long)__rlim_rmin(limit, r), \
22649 + (unsigned long)__rlim_rmax(limit, r), \
22650 + VX_VLIM(__rlim_soft(limit, r)), \
22651 + VX_VLIM(__rlim_hard(limit, r)), \
22652 + atomic_read(&__rlim_lhit(limit, r))
22654 +static inline int vx_info_proc_limit(struct _vx_limit *limit, char *buffer)
22656 + vx_limit_fixup(limit, -1);
22657 + return sprintf(buffer, VX_LIMIT_TOP
22658 + "PROC" VX_LIMIT_FMT
22659 + "VM" VX_LIMIT_FMT
22660 + "VML" VX_LIMIT_FMT
22661 + "RSS" VX_LIMIT_FMT
22662 + "ANON" VX_LIMIT_FMT
22663 + "RMAP" VX_LIMIT_FMT
22664 + "FILES" VX_LIMIT_FMT
22665 + "OFD" VX_LIMIT_FMT
22666 + "LOCKS" VX_LIMIT_FMT
22667 + "SOCK" VX_LIMIT_FMT
22668 + "MSGQ" VX_LIMIT_FMT
22669 + "SHM" VX_LIMIT_FMT
22670 + "SEMA" VX_LIMIT_FMT
22671 + "SEMS" VX_LIMIT_FMT
22672 + "DENT" VX_LIMIT_FMT,
22673 + VX_LIMIT_ARG(RLIMIT_NPROC),
22674 + VX_LIMIT_ARG(RLIMIT_AS),
22675 + VX_LIMIT_ARG(RLIMIT_MEMLOCK),
22676 + VX_LIMIT_ARG(RLIMIT_RSS),
22677 + VX_LIMIT_ARG(VLIMIT_ANON),
22678 + VX_LIMIT_ARG(VLIMIT_MAPPED),
22679 + VX_LIMIT_ARG(RLIMIT_NOFILE),
22680 + VX_LIMIT_ARG(VLIMIT_OPENFD),
22681 + VX_LIMIT_ARG(RLIMIT_LOCKS),
22682 + VX_LIMIT_ARG(VLIMIT_NSOCK),
22683 + VX_LIMIT_ARG(RLIMIT_MSGQUEUE),
22684 + VX_LIMIT_ARG(VLIMIT_SHMEM),
22685 + VX_LIMIT_ARG(VLIMIT_SEMARY),
22686 + VX_LIMIT_ARG(VLIMIT_NSEMS),
22687 + VX_LIMIT_ARG(VLIMIT_DENTRY));
22690 +#endif /* _VX_LIMIT_PROC_H */
22693 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/Makefile linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/Makefile
22694 --- linux-2.6.33.2/kernel/vserver/Makefile 1970-01-01 01:00:00.000000000 +0100
22695 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/Makefile 2010-02-25 12:02:16.000000000 +0100
22698 +# Makefile for the Linux vserver routines.
22702 +obj-y += vserver.o
22704 +vserver-y := switch.o context.o space.o sched.o network.o inode.o \
22705 + limit.o cvirt.o cacct.o signal.o helper.o init.o \
22708 +vserver-$(CONFIG_INET) += inet.o
22709 +vserver-$(CONFIG_PROC_FS) += proc.o
22710 +vserver-$(CONFIG_VSERVER_DEBUG) += sysctl.o debug.o
22711 +vserver-$(CONFIG_VSERVER_HISTORY) += history.o
22712 +vserver-$(CONFIG_VSERVER_MONITOR) += monitor.o
22713 +vserver-$(CONFIG_VSERVER_DEVICE) += device.o
22715 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/monitor.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/monitor.c
22716 --- linux-2.6.33.2/kernel/vserver/monitor.c 1970-01-01 01:00:00.000000000 +0100
22717 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/monitor.c 2010-02-25 12:02:16.000000000 +0100
22720 + * kernel/vserver/monitor.c
22722 + * Virtual Context Scheduler Monitor
22724 + * Copyright (C) 2006-2007 Herbert Pötzl
22726 + * V0.01 basic design
22730 +#include <linux/module.h>
22731 +#include <linux/jiffies.h>
22732 +#include <asm/uaccess.h>
22733 +#include <asm/atomic.h>
22735 +#include <linux/vserver/monitor.h>
22736 +#include <linux/vserver/debug_cmd.h>
22739 +#ifdef CONFIG_VSERVER_MONITOR
22740 +#define VXM_SIZE CONFIG_VSERVER_MONITOR_SIZE
22742 +#define VXM_SIZE 64
22745 +struct _vx_monitor {
22746 + unsigned int counter;
22748 + struct _vx_mon_entry entry[VXM_SIZE+1];
22752 +DEFINE_PER_CPU(struct _vx_monitor, vx_monitor_buffer);
22754 +unsigned volatile int vxm_active = 1;
22756 +static atomic_t sequence = ATOMIC_INIT(0);
22761 + * requires disabled preemption */
22763 +struct _vx_mon_entry *vxm_advance(int cpu)
22765 + struct _vx_monitor *mon = &per_cpu(vx_monitor_buffer, cpu);
22766 + struct _vx_mon_entry *entry;
22767 + unsigned int index;
22769 + index = vxm_active ? (mon->counter++ % VXM_SIZE) : VXM_SIZE;
22770 + entry = &mon->entry[index];
22772 + entry->ev.seq = atomic_inc_return(&sequence);
22773 + entry->ev.jif = jiffies;
22777 +EXPORT_SYMBOL_GPL(vxm_advance);
22780 +int do_read_monitor(struct __user _vx_mon_entry *data,
22781 + int cpu, uint32_t *index, uint32_t *count)
22783 + int pos, ret = 0;
22784 + struct _vx_monitor *mon = &per_cpu(vx_monitor_buffer, cpu);
22785 + int end = mon->counter;
22786 + int start = end - VXM_SIZE + 2;
22787 + int idx = *index;
22789 + /* special case: get current pos */
22795 + /* have we lost some data? */
22799 + for (pos = 0; (pos < *count) && (idx < end); pos++, idx++) {
22800 + struct _vx_mon_entry *entry =
22801 + &mon->entry[idx % VXM_SIZE];
22803 + /* send entry to userspace */
22804 + ret = copy_to_user(&data[pos], entry, sizeof(*entry));
22808 + /* save new index and count */
22811 + return ret ? ret : (*index < end);
22814 +int vc_read_monitor(uint32_t id, void __user *data)
22816 + struct vcmd_read_monitor_v0 vc_data;
22819 + if (id >= NR_CPUS)
22822 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22825 + ret = do_read_monitor((struct __user _vx_mon_entry *)vc_data.data,
22826 + id, &vc_data.index, &vc_data.count);
22828 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22833 +#ifdef CONFIG_COMPAT
22835 +int vc_read_monitor_x32(uint32_t id, void __user *data)
22837 + struct vcmd_read_monitor_v0_x32 vc_data;
22840 + if (id >= NR_CPUS)
22843 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22846 + ret = do_read_monitor((struct __user _vx_mon_entry *)
22847 + compat_ptr(vc_data.data_ptr),
22848 + id, &vc_data.index, &vc_data.count);
22850 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22855 +#endif /* CONFIG_COMPAT */
22857 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/network.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/network.c
22858 --- linux-2.6.33.2/kernel/vserver/network.c 1970-01-01 01:00:00.000000000 +0100
22859 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/network.c 2010-02-25 12:02:16.000000000 +0100
22862 + * linux/kernel/vserver/network.c
22864 + * Virtual Server: Network Support
22866 + * Copyright (C) 2003-2007 Herbert Pötzl
22868 + * V0.01 broken out from vcontext V0.05
22869 + * V0.02 cleaned up implementation
22870 + * V0.03 added equiv nx commands
22871 + * V0.04 switch to RCU based hash
22872 + * V0.05 and back to locking again
22873 + * V0.06 changed vcmds to nxi arg
22874 + * V0.07 have __create claim() the nxi
22878 +#include <linux/err.h>
22879 +#include <linux/slab.h>
22880 +#include <linux/rcupdate.h>
22882 +#include <linux/vs_network.h>
22883 +#include <linux/vs_pid.h>
22884 +#include <linux/vserver/network_cmd.h>
22887 +atomic_t nx_global_ctotal = ATOMIC_INIT(0);
22888 +atomic_t nx_global_cactive = ATOMIC_INIT(0);
22890 +static struct kmem_cache *nx_addr_v4_cachep = NULL;
22891 +static struct kmem_cache *nx_addr_v6_cachep = NULL;
22894 +static int __init init_network(void)
22896 + nx_addr_v4_cachep = kmem_cache_create("nx_v4_addr_cache",
22897 + sizeof(struct nx_addr_v4), 0,
22898 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
22899 + nx_addr_v6_cachep = kmem_cache_create("nx_v6_addr_cache",
22900 + sizeof(struct nx_addr_v6), 0,
22901 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
22906 +/* __alloc_nx_addr_v4() */
22908 +static inline struct nx_addr_v4 *__alloc_nx_addr_v4(void)
22910 + struct nx_addr_v4 *nxa = kmem_cache_alloc(
22911 + nx_addr_v4_cachep, GFP_KERNEL);
22913 + if (!IS_ERR(nxa))
22914 + memset(nxa, 0, sizeof(*nxa));
22918 +/* __dealloc_nx_addr_v4() */
22920 +static inline void __dealloc_nx_addr_v4(struct nx_addr_v4 *nxa)
22922 + kmem_cache_free(nx_addr_v4_cachep, nxa);
22925 +/* __dealloc_nx_addr_v4_all() */
22927 +static inline void __dealloc_nx_addr_v4_all(struct nx_addr_v4 *nxa)
22930 + struct nx_addr_v4 *next = nxa->next;
22932 + __dealloc_nx_addr_v4(nxa);
22938 +#ifdef CONFIG_IPV6
22940 +/* __alloc_nx_addr_v6() */
22942 +static inline struct nx_addr_v6 *__alloc_nx_addr_v6(void)
22944 + struct nx_addr_v6 *nxa = kmem_cache_alloc(
22945 + nx_addr_v6_cachep, GFP_KERNEL);
22947 + if (!IS_ERR(nxa))
22948 + memset(nxa, 0, sizeof(*nxa));
22952 +/* __dealloc_nx_addr_v6() */
22954 +static inline void __dealloc_nx_addr_v6(struct nx_addr_v6 *nxa)
22956 + kmem_cache_free(nx_addr_v6_cachep, nxa);
22959 +/* __dealloc_nx_addr_v6_all() */
22961 +static inline void __dealloc_nx_addr_v6_all(struct nx_addr_v6 *nxa)
22964 + struct nx_addr_v6 *next = nxa->next;
22966 + __dealloc_nx_addr_v6(nxa);
22971 +#endif /* CONFIG_IPV6 */
22973 +/* __alloc_nx_info()
22975 + * allocate an initialized nx_info struct
22976 + * doesn't make it visible (hash) */
22978 +static struct nx_info *__alloc_nx_info(nid_t nid)
22980 + struct nx_info *new = NULL;
22982 + vxdprintk(VXD_CBIT(nid, 1), "alloc_nx_info(%d)*", nid);
22984 + /* would this benefit from a slab cache? */
22985 + new = kmalloc(sizeof(struct nx_info), GFP_KERNEL);
22989 + memset(new, 0, sizeof(struct nx_info));
22990 + new->nx_id = nid;
22991 + INIT_HLIST_NODE(&new->nx_hlist);
22992 + atomic_set(&new->nx_usecnt, 0);
22993 + atomic_set(&new->nx_tasks, 0);
22994 + new->nx_state = 0;
22996 + new->nx_flags = NXF_INIT_SET;
22998 + /* rest of init goes here */
23000 + new->v4_lback.s_addr = htonl(INADDR_LOOPBACK);
23001 + new->v4_bcast.s_addr = htonl(INADDR_BROADCAST);
23003 + vxdprintk(VXD_CBIT(nid, 0),
23004 + "alloc_nx_info(%d) = %p", nid, new);
23005 + atomic_inc(&nx_global_ctotal);
23009 +/* __dealloc_nx_info()
23011 + * final disposal of nx_info */
23013 +static void __dealloc_nx_info(struct nx_info *nxi)
23015 + vxdprintk(VXD_CBIT(nid, 0),
23016 + "dealloc_nx_info(%p)", nxi);
23018 + nxi->nx_hlist.next = LIST_POISON1;
23021 + BUG_ON(atomic_read(&nxi->nx_usecnt));
23022 + BUG_ON(atomic_read(&nxi->nx_tasks));
23024 + __dealloc_nx_addr_v4_all(nxi->v4.next);
23026 + nxi->nx_state |= NXS_RELEASED;
23028 + atomic_dec(&nx_global_ctotal);
23031 +static void __shutdown_nx_info(struct nx_info *nxi)
23033 + nxi->nx_state |= NXS_SHUTDOWN;
23034 + vs_net_change(nxi, VSC_NETDOWN);
23037 +/* exported stuff */
23039 +void free_nx_info(struct nx_info *nxi)
23041 + /* context shutdown is mandatory */
23042 + BUG_ON(nxi->nx_state != NXS_SHUTDOWN);
23044 + /* context must not be hashed */
23045 + BUG_ON(nxi->nx_state & NXS_HASHED);
23047 + BUG_ON(atomic_read(&nxi->nx_usecnt));
23048 + BUG_ON(atomic_read(&nxi->nx_tasks));
23050 + __dealloc_nx_info(nxi);
23054 +void __nx_set_lback(struct nx_info *nxi)
23056 + int nid = nxi->nx_id;
23057 + __be32 lback = htonl(INADDR_LOOPBACK ^ ((nid & 0xFFFF) << 8));
23059 + nxi->v4_lback.s_addr = lback;
23062 +extern int __nx_inet_add_lback(__be32 addr);
23063 +extern int __nx_inet_del_lback(__be32 addr);
23066 +/* hash table for nx_info hash */
23068 +#define NX_HASH_SIZE 13
23070 +struct hlist_head nx_info_hash[NX_HASH_SIZE];
23072 +static spinlock_t nx_info_hash_lock = SPIN_LOCK_UNLOCKED;
23075 +static inline unsigned int __hashval(nid_t nid)
23077 + return (nid % NX_HASH_SIZE);
23082 +/* __hash_nx_info()
23084 + * add the nxi to the global hash table
23085 + * requires the hash_lock to be held */
23087 +static inline void __hash_nx_info(struct nx_info *nxi)
23089 + struct hlist_head *head;
23091 + vxd_assert_lock(&nx_info_hash_lock);
23092 + vxdprintk(VXD_CBIT(nid, 4),
23093 + "__hash_nx_info: %p[#%d]", nxi, nxi->nx_id);
23095 + /* context must not be hashed */
23096 + BUG_ON(nx_info_state(nxi, NXS_HASHED));
23098 + nxi->nx_state |= NXS_HASHED;
23099 + head = &nx_info_hash[__hashval(nxi->nx_id)];
23100 + hlist_add_head(&nxi->nx_hlist, head);
23101 + atomic_inc(&nx_global_cactive);
23104 +/* __unhash_nx_info()
23106 + * remove the nxi from the global hash table
23107 + * requires the hash_lock to be held */
23109 +static inline void __unhash_nx_info(struct nx_info *nxi)
23111 + vxd_assert_lock(&nx_info_hash_lock);
23112 + vxdprintk(VXD_CBIT(nid, 4),
23113 + "__unhash_nx_info: %p[#%d.%d.%d]", nxi, nxi->nx_id,
23114 + atomic_read(&nxi->nx_usecnt), atomic_read(&nxi->nx_tasks));
23116 + /* context must be hashed */
23117 + BUG_ON(!nx_info_state(nxi, NXS_HASHED));
23118 + /* but without tasks */
23119 + BUG_ON(atomic_read(&nxi->nx_tasks));
23121 + nxi->nx_state &= ~NXS_HASHED;
23122 + hlist_del(&nxi->nx_hlist);
23123 + atomic_dec(&nx_global_cactive);
23127 +/* __lookup_nx_info()
23129 + * requires the hash_lock to be held
23130 + * doesn't increment the nx_refcnt */
23132 +static inline struct nx_info *__lookup_nx_info(nid_t nid)
23134 + struct hlist_head *head = &nx_info_hash[__hashval(nid)];
23135 + struct hlist_node *pos;
23136 + struct nx_info *nxi;
23138 + vxd_assert_lock(&nx_info_hash_lock);
23139 + hlist_for_each(pos, head) {
23140 + nxi = hlist_entry(pos, struct nx_info, nx_hlist);
23142 + if (nxi->nx_id == nid)
23147 + vxdprintk(VXD_CBIT(nid, 0),
23148 + "__lookup_nx_info(#%u): %p[#%u]",
23149 + nid, nxi, nxi ? nxi->nx_id : 0);
23154 +/* __create_nx_info()
23156 + * create the requested context
23157 + * get(), claim() and hash it */
23159 +static struct nx_info *__create_nx_info(int id)
23161 + struct nx_info *new, *nxi = NULL;
23163 + vxdprintk(VXD_CBIT(nid, 1), "create_nx_info(%d)*", id);
23165 + if (!(new = __alloc_nx_info(id)))
23166 + return ERR_PTR(-ENOMEM);
23168 + /* required to make dynamic xids unique */
23169 + spin_lock(&nx_info_hash_lock);
23171 + /* static context requested */
23172 + if ((nxi = __lookup_nx_info(id))) {
23173 + vxdprintk(VXD_CBIT(nid, 0),
23174 + "create_nx_info(%d) = %p (already there)", id, nxi);
23175 + if (nx_info_flags(nxi, NXF_STATE_SETUP, 0))
23176 + nxi = ERR_PTR(-EBUSY);
23178 + nxi = ERR_PTR(-EEXIST);
23181 + /* new context */
23182 + vxdprintk(VXD_CBIT(nid, 0),
23183 + "create_nx_info(%d) = %p (new)", id, new);
23184 + claim_nx_info(new, NULL);
23185 + __nx_set_lback(new);
23186 + __hash_nx_info(get_nx_info(new));
23187 + nxi = new, new = NULL;
23190 + spin_unlock(&nx_info_hash_lock);
23192 + __dealloc_nx_info(new);
23198 +/* exported stuff */
23201 +void unhash_nx_info(struct nx_info *nxi)
23203 + __shutdown_nx_info(nxi);
23204 + spin_lock(&nx_info_hash_lock);
23205 + __unhash_nx_info(nxi);
23206 + spin_unlock(&nx_info_hash_lock);
23209 +/* lookup_nx_info()
23211 + * search for a nx_info and get() it
23212 + * negative id means current */
23214 +struct nx_info *lookup_nx_info(int id)
23216 + struct nx_info *nxi = NULL;
23219 + nxi = get_nx_info(current_nx_info());
23220 + } else if (id > 1) {
23221 + spin_lock(&nx_info_hash_lock);
23222 + nxi = get_nx_info(__lookup_nx_info(id));
23223 + spin_unlock(&nx_info_hash_lock);
23228 +/* nid_is_hashed()
23230 + * verify that nid is still hashed */
23232 +int nid_is_hashed(nid_t nid)
23236 + spin_lock(&nx_info_hash_lock);
23237 + hashed = (__lookup_nx_info(nid) != NULL);
23238 + spin_unlock(&nx_info_hash_lock);
23243 +#ifdef CONFIG_PROC_FS
23247 + * get a subset of hashed nids for proc
23248 + * assumes size is at least one */
23250 +int get_nid_list(int index, unsigned int *nids, int size)
23252 + int hindex, nr_nids = 0;
23254 + /* only show current and children */
23255 + if (!nx_check(0, VS_ADMIN | VS_WATCH)) {
23258 + nids[nr_nids] = nx_current_nid();
23262 + for (hindex = 0; hindex < NX_HASH_SIZE; hindex++) {
23263 + struct hlist_head *head = &nx_info_hash[hindex];
23264 + struct hlist_node *pos;
23266 + spin_lock(&nx_info_hash_lock);
23267 + hlist_for_each(pos, head) {
23268 + struct nx_info *nxi;
23273 + nxi = hlist_entry(pos, struct nx_info, nx_hlist);
23274 + nids[nr_nids] = nxi->nx_id;
23275 + if (++nr_nids >= size) {
23276 + spin_unlock(&nx_info_hash_lock);
23280 + /* keep the lock time short */
23281 + spin_unlock(&nx_info_hash_lock);
23290 + * migrate task to new network
23291 + * gets nxi, puts old_nxi on change
23294 +int nx_migrate_task(struct task_struct *p, struct nx_info *nxi)
23296 + struct nx_info *old_nxi;
23302 + vxdprintk(VXD_CBIT(nid, 5),
23303 + "nx_migrate_task(%p,%p[#%d.%d.%d])",
23304 + p, nxi, nxi->nx_id,
23305 + atomic_read(&nxi->nx_usecnt),
23306 + atomic_read(&nxi->nx_tasks));
23308 + if (nx_info_flags(nxi, NXF_INFO_PRIVATE, 0) &&
23309 + !nx_info_flags(nxi, NXF_STATE_SETUP, 0))
23312 + if (nx_info_state(nxi, NXS_SHUTDOWN))
23315 + /* maybe disallow this completely? */
23316 + old_nxi = task_get_nx_info(p);
23317 + if (old_nxi == nxi)
23322 + clr_nx_info(&p->nx_info);
23323 + claim_nx_info(nxi, p);
23324 + set_nx_info(&p->nx_info, nxi);
23325 + p->nid = nxi->nx_id;
23328 + vxdprintk(VXD_CBIT(nid, 5),
23329 + "moved task %p into nxi:%p[#%d]",
23330 + p, nxi, nxi->nx_id);
23333 + release_nx_info(old_nxi, p);
23336 + put_nx_info(old_nxi);
23341 +void nx_set_persistent(struct nx_info *nxi)
23343 + vxdprintk(VXD_CBIT(nid, 6),
23344 + "nx_set_persistent(%p[#%d])", nxi, nxi->nx_id);
23346 + get_nx_info(nxi);
23347 + claim_nx_info(nxi, NULL);
23350 +void nx_clear_persistent(struct nx_info *nxi)
23352 + vxdprintk(VXD_CBIT(nid, 6),
23353 + "nx_clear_persistent(%p[#%d])", nxi, nxi->nx_id);
23355 + release_nx_info(nxi, NULL);
23356 + put_nx_info(nxi);
23359 +void nx_update_persistent(struct nx_info *nxi)
23361 + if (nx_info_flags(nxi, NXF_PERSISTENT, 0))
23362 + nx_set_persistent(nxi);
23364 + nx_clear_persistent(nxi);
23367 +/* vserver syscall commands below here */
23369 +/* taks nid and nx_info functions */
23371 +#include <asm/uaccess.h>
23374 +int vc_task_nid(uint32_t id)
23379 + struct task_struct *tsk;
23381 + read_lock(&tasklist_lock);
23382 + tsk = find_task_by_real_pid(id);
23383 + nid = (tsk) ? tsk->nid : -ESRCH;
23384 + read_unlock(&tasklist_lock);
23386 + nid = nx_current_nid();
23391 +int vc_nx_info(struct nx_info *nxi, void __user *data)
23393 + struct vcmd_nx_info_v0 vc_data;
23395 + vc_data.nid = nxi->nx_id;
23397 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23403 +/* network functions */
23405 +int vc_net_create(uint32_t nid, void __user *data)
23407 + struct vcmd_net_create vc_data = { .flagword = NXF_INIT_SET };
23408 + struct nx_info *new_nxi;
23411 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23414 + if ((nid > MAX_S_CONTEXT) || (nid < 2))
23417 + new_nxi = __create_nx_info(nid);
23418 + if (IS_ERR(new_nxi))
23419 + return PTR_ERR(new_nxi);
23421 + /* initial flags */
23422 + new_nxi->nx_flags = vc_data.flagword;
23425 + if (vs_net_change(new_nxi, VSC_NETUP))
23428 + ret = nx_migrate_task(current, new_nxi);
23432 + /* return context id on success */
23433 + ret = new_nxi->nx_id;
23435 + /* get a reference for persistent contexts */
23436 + if ((vc_data.flagword & NXF_PERSISTENT))
23437 + nx_set_persistent(new_nxi);
23439 + release_nx_info(new_nxi, NULL);
23440 + put_nx_info(new_nxi);
23445 +int vc_net_migrate(struct nx_info *nxi, void __user *data)
23447 + return nx_migrate_task(current, nxi);
23452 +int do_add_v4_addr(struct nx_info *nxi, __be32 ip, __be32 ip2, __be32 mask,
23453 + uint16_t type, uint16_t flags)
23455 + struct nx_addr_v4 *nxa = &nxi->v4;
23457 + if (NX_IPV4(nxi)) {
23458 + /* locate last entry */
23459 + for (; nxa->next; nxa = nxa->next);
23460 + nxa->next = __alloc_nx_addr_v4();
23464 + return PTR_ERR(nxa);
23467 + if (nxi->v4.next)
23468 + /* remove single ip for ip list */
23469 + nxi->nx_flags &= ~NXF_SINGLE_IP;
23471 + nxa->ip[0].s_addr = ip;
23472 + nxa->ip[1].s_addr = ip2;
23473 + nxa->mask.s_addr = mask;
23474 + nxa->type = type;
23475 + nxa->flags = flags;
23480 +int vc_net_add(struct nx_info *nxi, void __user *data)
23482 + struct vcmd_net_addr_v0 vc_data;
23483 + int index, ret = 0;
23485 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23488 + switch (vc_data.type) {
23489 + case NXA_TYPE_IPV4:
23490 + if ((vc_data.count < 1) || (vc_data.count > 4))
23494 + while (index < vc_data.count) {
23495 + ret = do_add_v4_addr(nxi, vc_data.ip[index].s_addr, 0,
23496 + vc_data.mask[index].s_addr, NXA_TYPE_ADDR, 0);
23504 + case NXA_TYPE_IPV4|NXA_MOD_BCAST:
23505 + nxi->v4_bcast = vc_data.ip[0];
23509 + case NXA_TYPE_IPV4|NXA_MOD_LBACK:
23510 + nxi->v4_lback = vc_data.ip[0];
23521 +int vc_net_remove(struct nx_info *nxi, void __user *data)
23523 + struct vcmd_net_addr_v0 vc_data;
23525 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23528 + switch (vc_data.type) {
23529 + case NXA_TYPE_ANY:
23530 + __dealloc_nx_addr_v4_all(xchg(&nxi->v4.next, NULL));
23531 + memset(&nxi->v4, 0, sizeof(nxi->v4));
23541 +int vc_net_add_ipv4(struct nx_info *nxi, void __user *data)
23543 + struct vcmd_net_addr_ipv4_v1 vc_data;
23545 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23548 + switch (vc_data.type) {
23549 + case NXA_TYPE_ADDR:
23550 + case NXA_TYPE_RANGE:
23551 + case NXA_TYPE_MASK:
23552 + return do_add_v4_addr(nxi, vc_data.ip.s_addr, 0,
23553 + vc_data.mask.s_addr, vc_data.type, vc_data.flags);
23555 + case NXA_TYPE_ADDR | NXA_MOD_BCAST:
23556 + nxi->v4_bcast = vc_data.ip;
23559 + case NXA_TYPE_ADDR | NXA_MOD_LBACK:
23560 + nxi->v4_lback = vc_data.ip;
23569 +int vc_net_remove_ipv4(struct nx_info *nxi, void __user *data)
23571 + struct vcmd_net_addr_ipv4_v1 vc_data;
23573 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23576 + switch (vc_data.type) {
23577 +/* case NXA_TYPE_ADDR:
23580 + case NXA_TYPE_ANY:
23581 + __dealloc_nx_addr_v4_all(xchg(&nxi->v4.next, NULL));
23582 + memset(&nxi->v4, 0, sizeof(nxi->v4));
23592 +#ifdef CONFIG_IPV6
23594 +int do_add_v6_addr(struct nx_info *nxi,
23595 + struct in6_addr *ip, struct in6_addr *mask,
23596 + uint32_t prefix, uint16_t type, uint16_t flags)
23598 + struct nx_addr_v6 *nxa = &nxi->v6;
23600 + if (NX_IPV6(nxi)) {
23601 + /* locate last entry */
23602 + for (; nxa->next; nxa = nxa->next);
23603 + nxa->next = __alloc_nx_addr_v6();
23607 + return PTR_ERR(nxa);
23611 + nxa->mask = *mask;
23612 + nxa->prefix = prefix;
23613 + nxa->type = type;
23614 + nxa->flags = flags;
23619 +int vc_net_add_ipv6(struct nx_info *nxi, void __user *data)
23621 + struct vcmd_net_addr_ipv6_v1 vc_data;
23623 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23626 + switch (vc_data.type) {
23627 + case NXA_TYPE_ADDR:
23628 + case NXA_TYPE_MASK:
23629 + return do_add_v6_addr(nxi, &vc_data.ip, &vc_data.mask,
23630 + vc_data.prefix, vc_data.type, vc_data.flags);
23637 +int vc_net_remove_ipv6(struct nx_info *nxi, void __user *data)
23639 + struct vcmd_net_addr_ipv6_v1 vc_data;
23641 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23644 + switch (vc_data.type) {
23645 + case NXA_TYPE_ANY:
23646 + __dealloc_nx_addr_v6_all(xchg(&nxi->v6.next, NULL));
23647 + memset(&nxi->v6, 0, sizeof(nxi->v6));
23656 +#endif /* CONFIG_IPV6 */
23659 +int vc_get_nflags(struct nx_info *nxi, void __user *data)
23661 + struct vcmd_net_flags_v0 vc_data;
23663 + vc_data.flagword = nxi->nx_flags;
23665 + /* special STATE flag handling */
23666 + vc_data.mask = vs_mask_flags(~0ULL, nxi->nx_flags, NXF_ONE_TIME);
23668 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23673 +int vc_set_nflags(struct nx_info *nxi, void __user *data)
23675 + struct vcmd_net_flags_v0 vc_data;
23676 + uint64_t mask, trigger;
23678 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
23681 + /* special STATE flag handling */
23682 + mask = vs_mask_mask(vc_data.mask, nxi->nx_flags, NXF_ONE_TIME);
23683 + trigger = (mask & nxi->nx_flags) ^ (mask & vc_data.flagword);
23685 + nxi->nx_flags = vs_mask_flags(nxi->nx_flags,
23686 + vc_data.flagword, mask);
23687 + if (trigger & NXF_PERSISTENT)
23688 + nx_update_persistent(nxi);
23693 +int vc_get_ncaps(struct nx_info *nxi, void __user *data)
23695 + struct vcmd_net_caps_v0 vc_data;
23697 + vc_data.ncaps = nxi->nx_ncaps;
23698 + vc_data.cmask = ~0ULL;
23700 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23705 +int vc_set_ncaps(struct nx_info *nxi, void __user *data)
23707 + struct vcmd_net_caps_v0 vc_data;
23709 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
23712 + nxi->nx_ncaps = vs_mask_flags(nxi->nx_ncaps,
23713 + vc_data.ncaps, vc_data.cmask);
23718 +#include <linux/module.h>
23720 +module_init(init_network);
23722 +EXPORT_SYMBOL_GPL(free_nx_info);
23723 +EXPORT_SYMBOL_GPL(unhash_nx_info);
23725 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/proc.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/proc.c
23726 --- linux-2.6.33.2/kernel/vserver/proc.c 1970-01-01 01:00:00.000000000 +0100
23727 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/proc.c 2010-02-25 12:02:16.000000000 +0100
23730 + * linux/kernel/vserver/proc.c
23732 + * Virtual Context Support
23734 + * Copyright (C) 2003-2007 Herbert Pötzl
23736 + * V0.01 basic structure
23737 + * V0.02 adaptation vs1.3.0
23738 + * V0.03 proc permissions
23739 + * V0.04 locking/generic
23740 + * V0.05 next generation procfs
23741 + * V0.06 inode validation
23742 + * V0.07 generic rewrite vid
23743 + * V0.08 remove inode type
23747 +#include <linux/proc_fs.h>
23748 +#include <linux/fs_struct.h>
23749 +#include <linux/mount.h>
23750 +#include <asm/unistd.h>
23752 +#include <linux/vs_context.h>
23753 +#include <linux/vs_network.h>
23754 +#include <linux/vs_cvirt.h>
23756 +#include <linux/in.h>
23757 +#include <linux/inetdevice.h>
23758 +#include <linux/vs_inet.h>
23759 +#include <linux/vs_inet6.h>
23761 +#include <linux/vserver/global.h>
23763 +#include "cvirt_proc.h"
23764 +#include "cacct_proc.h"
23765 +#include "limit_proc.h"
23766 +#include "sched_proc.h"
23767 +#include "vci_config.h"
23770 +static inline char *print_cap_t(char *buffer, kernel_cap_t *c)
23774 + CAP_FOR_EACH_U32(__capi) {
23775 + buffer += sprintf(buffer, "%08x",
23776 + c->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]);
23782 +static struct proc_dir_entry *proc_virtual;
23784 +static struct proc_dir_entry *proc_virtnet;
23787 +/* first the actual feeds */
23790 +static int proc_vci(char *buffer)
23792 + return sprintf(buffer,
23793 + "VCIVersion:\t%04x:%04x\n"
23794 + "VCISyscall:\t%d\n"
23795 + "VCIKernel:\t%08x\n",
23796 + VCI_VERSION >> 16,
23797 + VCI_VERSION & 0xFFFF,
23799 + vci_kernel_config());
23802 +static int proc_virtual_info(char *buffer)
23804 + return proc_vci(buffer);
23807 +static int proc_virtual_status(char *buffer)
23809 + return sprintf(buffer,
23811 + "#CActive:\t%d\n"
23812 + "#NSProxy:\t%d\t%d %d %d %d %d %d\n"
23813 + "#InitTask:\t%d\t%d %d\n",
23814 + atomic_read(&vx_global_ctotal),
23815 + atomic_read(&vx_global_cactive),
23816 + atomic_read(&vs_global_nsproxy),
23817 + atomic_read(&vs_global_fs),
23818 + atomic_read(&vs_global_mnt_ns),
23819 + atomic_read(&vs_global_uts_ns),
23820 + atomic_read(&nr_ipc_ns),
23821 + atomic_read(&vs_global_user_ns),
23822 + atomic_read(&vs_global_pid_ns),
23823 + atomic_read(&init_task.usage),
23824 + atomic_read(&init_task.nsproxy->count),
23825 + init_task.fs->users);
23829 +int proc_vxi_info(struct vx_info *vxi, char *buffer)
23833 + length = sprintf(buffer,
23841 + vxi->vx_badness_bias);
23845 +int proc_vxi_status(struct vx_info *vxi, char *buffer)
23847 + char *orig = buffer;
23849 + buffer += sprintf(buffer,
23852 + "Flags:\t%016llx\n",
23853 + atomic_read(&vxi->vx_usecnt),
23854 + atomic_read(&vxi->vx_tasks),
23855 + (unsigned long long)vxi->vx_flags);
23857 + buffer += sprintf(buffer, "BCaps:\t");
23858 + buffer = print_cap_t(buffer, &vxi->vx_bcaps);
23859 + buffer += sprintf(buffer, "\n");
23861 + buffer += sprintf(buffer,
23862 + "CCaps:\t%016llx\n"
23863 + "Spaces:\t%08lx %08lx\n",
23864 + (unsigned long long)vxi->vx_ccaps,
23865 + vxi->vx_nsmask[0], vxi->vx_nsmask[1]);
23866 + return buffer - orig;
23869 +int proc_vxi_limit(struct vx_info *vxi, char *buffer)
23871 + return vx_info_proc_limit(&vxi->limit, buffer);
23874 +int proc_vxi_sched(struct vx_info *vxi, char *buffer)
23878 + length = vx_info_proc_sched(&vxi->sched, buffer);
23879 + for_each_online_cpu(cpu) {
23880 + length += vx_info_proc_sched_pc(
23881 + &vx_per_cpu(vxi, sched_pc, cpu),
23882 + buffer + length, cpu);
23887 +int proc_vxi_nsproxy0(struct vx_info *vxi, char *buffer)
23889 + return vx_info_proc_nsproxy(vxi->vx_nsproxy[0], buffer);
23892 +int proc_vxi_nsproxy1(struct vx_info *vxi, char *buffer)
23894 + return vx_info_proc_nsproxy(vxi->vx_nsproxy[1], buffer);
23897 +int proc_vxi_cvirt(struct vx_info *vxi, char *buffer)
23901 + vx_update_load(vxi);
23902 + length = vx_info_proc_cvirt(&vxi->cvirt, buffer);
23903 + for_each_online_cpu(cpu) {
23904 + length += vx_info_proc_cvirt_pc(
23905 + &vx_per_cpu(vxi, cvirt_pc, cpu),
23906 + buffer + length, cpu);
23911 +int proc_vxi_cacct(struct vx_info *vxi, char *buffer)
23913 + return vx_info_proc_cacct(&vxi->cacct, buffer);
23917 +static int proc_virtnet_info(char *buffer)
23919 + return proc_vci(buffer);
23922 +static int proc_virtnet_status(char *buffer)
23924 + return sprintf(buffer,
23926 + "#CActive:\t%d\n",
23927 + atomic_read(&nx_global_ctotal),
23928 + atomic_read(&nx_global_cactive));
23931 +int proc_nxi_info(struct nx_info *nxi, char *buffer)
23933 + struct nx_addr_v4 *v4a;
23934 +#ifdef CONFIG_IPV6
23935 + struct nx_addr_v6 *v6a;
23939 + length = sprintf(buffer,
23942 + "Bcast:\t" NIPQUAD_FMT "\n"
23943 + "Lback:\t" NIPQUAD_FMT "\n",
23946 + NIPQUAD(nxi->v4_bcast.s_addr),
23947 + NIPQUAD(nxi->v4_lback.s_addr));
23949 + if (!NX_IPV4(nxi))
23951 + for (i = 0, v4a = &nxi->v4; v4a; i++, v4a = v4a->next)
23952 + length += sprintf(buffer + length, "%d:\t" NXAV4_FMT "\n",
23955 +#ifdef CONFIG_IPV6
23956 + if (!NX_IPV6(nxi))
23958 + for (i = 0, v6a = &nxi->v6; v6a; i++, v6a = v6a->next)
23959 + length += sprintf(buffer + length, "%d:\t" NXAV6_FMT "\n",
23966 +int proc_nxi_status(struct nx_info *nxi, char *buffer)
23970 + length = sprintf(buffer,
23973 + "Flags:\t%016llx\n"
23974 + "NCaps:\t%016llx\n",
23975 + atomic_read(&nxi->nx_usecnt),
23976 + atomic_read(&nxi->nx_tasks),
23977 + (unsigned long long)nxi->nx_flags,
23978 + (unsigned long long)nxi->nx_ncaps);
23984 +/* here the inode helpers */
23990 + struct inode_operations *iop;
23991 + struct file_operations *fop;
23992 + union proc_op op;
23995 +static struct inode *vs_proc_make_inode(struct super_block *sb, struct vs_entry *p)
23997 + struct inode *inode = new_inode(sb);
24002 + inode->i_mode = p->mode;
24004 + inode->i_op = p->iop;
24006 + inode->i_fop = p->fop;
24008 + inode->i_nlink = (p->mode & S_IFDIR) ? 2 : 1;
24009 + inode->i_flags |= S_IMMUTABLE;
24011 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
24013 + inode->i_uid = 0;
24014 + inode->i_gid = 0;
24015 + inode->i_tag = 0;
24020 +static struct dentry *vs_proc_instantiate(struct inode *dir,
24021 + struct dentry *dentry, int id, void *ptr)
24023 + struct vs_entry *p = ptr;
24024 + struct inode *inode = vs_proc_make_inode(dir->i_sb, p);
24025 + struct dentry *error = ERR_PTR(-EINVAL);
24030 + PROC_I(inode)->op = p->op;
24031 + PROC_I(inode)->fd = id;
24032 + d_add(dentry, inode);
24040 +typedef struct dentry *instantiate_t(struct inode *, struct dentry *, int, void *);
24043 + * Fill a directory entry.
24045 + * If possible create the dcache entry and derive our inode number and
24046 + * file type from dcache entry.
24048 + * Since all of the proc inode numbers are dynamically generated, the inode
24049 + * numbers do not exist until the inode is cache. This means creating the
24050 + * the dcache entry in readdir is necessary to keep the inode numbers
24051 + * reported by readdir in sync with the inode numbers reported
24054 +static int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
24055 + char *name, int len, instantiate_t instantiate, int id, void *ptr)
24057 + struct dentry *child, *dir = filp->f_dentry;
24058 + struct inode *inode;
24059 + struct qstr qname;
24061 + unsigned type = DT_UNKNOWN;
24063 + qname.name = name;
24065 + qname.hash = full_name_hash(name, len);
24067 + child = d_lookup(dir, &qname);
24069 + struct dentry *new;
24070 + new = d_alloc(dir, &qname);
24072 + child = instantiate(dir->d_inode, new, id, ptr);
24079 + if (!child || IS_ERR(child) || !child->d_inode)
24080 + goto end_instantiate;
24081 + inode = child->d_inode;
24083 + ino = inode->i_ino;
24084 + type = inode->i_mode >> 12;
24089 + ino = find_inode_number(dir, &qname);
24092 + return filldir(dirent, name, len, filp->f_pos, ino, type);
24097 +/* get and revalidate vx_info/xid */
24100 +struct vx_info *get_proc_vx_info(struct inode *inode)
24102 + return lookup_vx_info(PROC_I(inode)->fd);
24105 +static int proc_xid_revalidate(struct dentry *dentry, struct nameidata *nd)
24107 + struct inode *inode = dentry->d_inode;
24108 + xid_t xid = PROC_I(inode)->fd;
24110 + if (!xid || xid_is_hashed(xid))
24117 +/* get and revalidate nx_info/nid */
24119 +static int proc_nid_revalidate(struct dentry *dentry, struct nameidata *nd)
24121 + struct inode *inode = dentry->d_inode;
24122 + nid_t nid = PROC_I(inode)->fd;
24124 + if (!nid || nid_is_hashed(nid))
24132 +#define PROC_BLOCK_SIZE (PAGE_SIZE - 1024)
24134 +static ssize_t proc_vs_info_read(struct file *file, char __user *buf,
24135 + size_t count, loff_t *ppos)
24137 + struct inode *inode = file->f_dentry->d_inode;
24138 + unsigned long page;
24139 + ssize_t length = 0;
24141 + if (count > PROC_BLOCK_SIZE)
24142 + count = PROC_BLOCK_SIZE;
24144 + /* fade that out as soon as stable */
24145 + WARN_ON(PROC_I(inode)->fd);
24147 + if (!(page = __get_free_page(GFP_KERNEL)))
24150 + BUG_ON(!PROC_I(inode)->op.proc_vs_read);
24151 + length = PROC_I(inode)->op.proc_vs_read((char *)page);
24154 + length = simple_read_from_buffer(buf, count, ppos,
24155 + (char *)page, length);
24161 +static ssize_t proc_vx_info_read(struct file *file, char __user *buf,
24162 + size_t count, loff_t *ppos)
24164 + struct inode *inode = file->f_dentry->d_inode;
24165 + struct vx_info *vxi = NULL;
24166 + xid_t xid = PROC_I(inode)->fd;
24167 + unsigned long page;
24168 + ssize_t length = 0;
24170 + if (count > PROC_BLOCK_SIZE)
24171 + count = PROC_BLOCK_SIZE;
24173 + /* fade that out as soon as stable */
24175 + vxi = lookup_vx_info(xid);
24179 + length = -ENOMEM;
24180 + if (!(page = __get_free_page(GFP_KERNEL)))
24183 + BUG_ON(!PROC_I(inode)->op.proc_vxi_read);
24184 + length = PROC_I(inode)->op.proc_vxi_read(vxi, (char *)page);
24187 + length = simple_read_from_buffer(buf, count, ppos,
24188 + (char *)page, length);
24192 + put_vx_info(vxi);
24197 +static ssize_t proc_nx_info_read(struct file *file, char __user *buf,
24198 + size_t count, loff_t *ppos)
24200 + struct inode *inode = file->f_dentry->d_inode;
24201 + struct nx_info *nxi = NULL;
24202 + nid_t nid = PROC_I(inode)->fd;
24203 + unsigned long page;
24204 + ssize_t length = 0;
24206 + if (count > PROC_BLOCK_SIZE)
24207 + count = PROC_BLOCK_SIZE;
24209 + /* fade that out as soon as stable */
24211 + nxi = lookup_nx_info(nid);
24215 + length = -ENOMEM;
24216 + if (!(page = __get_free_page(GFP_KERNEL)))
24219 + BUG_ON(!PROC_I(inode)->op.proc_nxi_read);
24220 + length = PROC_I(inode)->op.proc_nxi_read(nxi, (char *)page);
24223 + length = simple_read_from_buffer(buf, count, ppos,
24224 + (char *)page, length);
24228 + put_nx_info(nxi);
24235 +/* here comes the lower level */
24238 +#define NOD(NAME, MODE, IOP, FOP, OP) { \
24239 + .len = sizeof(NAME) - 1, \
24240 + .name = (NAME), \
24248 +#define DIR(NAME, MODE, OTYPE) \
24249 + NOD(NAME, (S_IFDIR | (MODE)), \
24250 + &proc_ ## OTYPE ## _inode_operations, \
24251 + &proc_ ## OTYPE ## _file_operations, { } )
24253 +#define INF(NAME, MODE, OTYPE) \
24254 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
24255 + &proc_vs_info_file_operations, \
24256 + { .proc_vs_read = &proc_##OTYPE } )
24258 +#define VINF(NAME, MODE, OTYPE) \
24259 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
24260 + &proc_vx_info_file_operations, \
24261 + { .proc_vxi_read = &proc_##OTYPE } )
24263 +#define NINF(NAME, MODE, OTYPE) \
24264 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
24265 + &proc_nx_info_file_operations, \
24266 + { .proc_nxi_read = &proc_##OTYPE } )
24269 +static struct file_operations proc_vs_info_file_operations = {
24270 + .read = proc_vs_info_read,
24273 +static struct file_operations proc_vx_info_file_operations = {
24274 + .read = proc_vx_info_read,
24277 +static struct dentry_operations proc_xid_dentry_operations = {
24278 + .d_revalidate = proc_xid_revalidate,
24281 +static struct vs_entry vx_base_stuff[] = {
24282 + VINF("info", S_IRUGO, vxi_info),
24283 + VINF("status", S_IRUGO, vxi_status),
24284 + VINF("limit", S_IRUGO, vxi_limit),
24285 + VINF("sched", S_IRUGO, vxi_sched),
24286 + VINF("nsproxy", S_IRUGO, vxi_nsproxy0),
24287 + VINF("nsproxy1",S_IRUGO, vxi_nsproxy1),
24288 + VINF("cvirt", S_IRUGO, vxi_cvirt),
24289 + VINF("cacct", S_IRUGO, vxi_cacct),
24296 +static struct dentry *proc_xid_instantiate(struct inode *dir,
24297 + struct dentry *dentry, int id, void *ptr)
24299 + dentry->d_op = &proc_xid_dentry_operations;
24300 + return vs_proc_instantiate(dir, dentry, id, ptr);
24303 +static struct dentry *proc_xid_lookup(struct inode *dir,
24304 + struct dentry *dentry, struct nameidata *nd)
24306 + struct vs_entry *p = vx_base_stuff;
24307 + struct dentry *error = ERR_PTR(-ENOENT);
24309 + for (; p->name; p++) {
24310 + if (p->len != dentry->d_name.len)
24312 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24318 + error = proc_xid_instantiate(dir, dentry, PROC_I(dir)->fd, p);
24323 +static int proc_xid_readdir(struct file *filp,
24324 + void *dirent, filldir_t filldir)
24326 + struct dentry *dentry = filp->f_dentry;
24327 + struct inode *inode = dentry->d_inode;
24328 + struct vs_entry *p = vx_base_stuff;
24329 + int size = sizeof(vx_base_stuff) / sizeof(struct vs_entry);
24333 + pos = filp->f_pos;
24336 + ino = inode->i_ino;
24337 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24340 + /* fall through */
24342 + ino = parent_ino(dentry);
24343 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24346 + /* fall through */
24349 + if (index >= size)
24351 + for (p += index; p->name; p++) {
24352 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24353 + vs_proc_instantiate, PROC_I(inode)->fd, p))
24359 + filp->f_pos = pos;
24365 +static struct file_operations proc_nx_info_file_operations = {
24366 + .read = proc_nx_info_read,
24369 +static struct dentry_operations proc_nid_dentry_operations = {
24370 + .d_revalidate = proc_nid_revalidate,
24373 +static struct vs_entry nx_base_stuff[] = {
24374 + NINF("info", S_IRUGO, nxi_info),
24375 + NINF("status", S_IRUGO, nxi_status),
24380 +static struct dentry *proc_nid_instantiate(struct inode *dir,
24381 + struct dentry *dentry, int id, void *ptr)
24383 + dentry->d_op = &proc_nid_dentry_operations;
24384 + return vs_proc_instantiate(dir, dentry, id, ptr);
24387 +static struct dentry *proc_nid_lookup(struct inode *dir,
24388 + struct dentry *dentry, struct nameidata *nd)
24390 + struct vs_entry *p = nx_base_stuff;
24391 + struct dentry *error = ERR_PTR(-ENOENT);
24393 + for (; p->name; p++) {
24394 + if (p->len != dentry->d_name.len)
24396 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24402 + error = proc_nid_instantiate(dir, dentry, PROC_I(dir)->fd, p);
24407 +static int proc_nid_readdir(struct file *filp,
24408 + void *dirent, filldir_t filldir)
24410 + struct dentry *dentry = filp->f_dentry;
24411 + struct inode *inode = dentry->d_inode;
24412 + struct vs_entry *p = nx_base_stuff;
24413 + int size = sizeof(nx_base_stuff) / sizeof(struct vs_entry);
24417 + pos = filp->f_pos;
24420 + ino = inode->i_ino;
24421 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24424 + /* fall through */
24426 + ino = parent_ino(dentry);
24427 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24430 + /* fall through */
24433 + if (index >= size)
24435 + for (p += index; p->name; p++) {
24436 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24437 + vs_proc_instantiate, PROC_I(inode)->fd, p))
24443 + filp->f_pos = pos;
24448 +#define MAX_MULBY10 ((~0U - 9) / 10)
24450 +static inline int atovid(const char *str, int len)
24455 + while (len-- > 0) {
24460 + if (vid >= MAX_MULBY10)
24470 +/* now the upper level (virtual) */
24473 +static struct file_operations proc_xid_file_operations = {
24474 + .read = generic_read_dir,
24475 + .readdir = proc_xid_readdir,
24478 +static struct inode_operations proc_xid_inode_operations = {
24479 + .lookup = proc_xid_lookup,
24482 +static struct vs_entry vx_virtual_stuff[] = {
24483 + INF("info", S_IRUGO, virtual_info),
24484 + INF("status", S_IRUGO, virtual_status),
24485 + DIR(NULL, S_IRUGO | S_IXUGO, xid),
24489 +static struct dentry *proc_virtual_lookup(struct inode *dir,
24490 + struct dentry *dentry, struct nameidata *nd)
24492 + struct vs_entry *p = vx_virtual_stuff;
24493 + struct dentry *error = ERR_PTR(-ENOENT);
24496 + for (; p->name; p++) {
24497 + if (p->len != dentry->d_name.len)
24499 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24503 + goto instantiate;
24505 + id = atovid(dentry->d_name.name, dentry->d_name.len);
24506 + if ((id < 0) || !xid_is_hashed(id))
24510 + error = proc_xid_instantiate(dir, dentry, id, p);
24515 +static struct file_operations proc_nid_file_operations = {
24516 + .read = generic_read_dir,
24517 + .readdir = proc_nid_readdir,
24520 +static struct inode_operations proc_nid_inode_operations = {
24521 + .lookup = proc_nid_lookup,
24524 +static struct vs_entry nx_virtnet_stuff[] = {
24525 + INF("info", S_IRUGO, virtnet_info),
24526 + INF("status", S_IRUGO, virtnet_status),
24527 + DIR(NULL, S_IRUGO | S_IXUGO, nid),
24531 +static struct dentry *proc_virtnet_lookup(struct inode *dir,
24532 + struct dentry *dentry, struct nameidata *nd)
24534 + struct vs_entry *p = nx_virtnet_stuff;
24535 + struct dentry *error = ERR_PTR(-ENOENT);
24538 + for (; p->name; p++) {
24539 + if (p->len != dentry->d_name.len)
24541 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24545 + goto instantiate;
24547 + id = atovid(dentry->d_name.name, dentry->d_name.len);
24548 + if ((id < 0) || !nid_is_hashed(id))
24552 + error = proc_nid_instantiate(dir, dentry, id, p);
24558 +#define PROC_MAXVIDS 32
24560 +int proc_virtual_readdir(struct file *filp,
24561 + void *dirent, filldir_t filldir)
24563 + struct dentry *dentry = filp->f_dentry;
24564 + struct inode *inode = dentry->d_inode;
24565 + struct vs_entry *p = vx_virtual_stuff;
24566 + int size = sizeof(vx_virtual_stuff) / sizeof(struct vs_entry);
24568 + unsigned int xid_array[PROC_MAXVIDS];
24569 + char buf[PROC_NUMBUF];
24570 + unsigned int nr_xids, i;
24573 + pos = filp->f_pos;
24576 + ino = inode->i_ino;
24577 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24580 + /* fall through */
24582 + ino = parent_ino(dentry);
24583 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24586 + /* fall through */
24589 + if (index >= size)
24591 + for (p += index; p->name; p++) {
24592 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24593 + vs_proc_instantiate, 0, p))
24598 + index = pos - size;
24599 + p = &vx_virtual_stuff[size - 1];
24600 + nr_xids = get_xid_list(index, xid_array, PROC_MAXVIDS);
24601 + for (i = 0; i < nr_xids; i++) {
24602 + int n, xid = xid_array[i];
24603 + unsigned int j = PROC_NUMBUF;
24607 + buf[--j] = '0' + (n % 10);
24610 + if (proc_fill_cache(filp, dirent, filldir,
24611 + buf + j, PROC_NUMBUF - j,
24612 + vs_proc_instantiate, xid, p))
24618 + filp->f_pos = pos;
24622 +static int proc_virtual_getattr(struct vfsmount *mnt,
24623 + struct dentry *dentry, struct kstat *stat)
24625 + struct inode *inode = dentry->d_inode;
24627 + generic_fillattr(inode, stat);
24628 + stat->nlink = 2 + atomic_read(&vx_global_cactive);
24632 +static struct file_operations proc_virtual_dir_operations = {
24633 + .read = generic_read_dir,
24634 + .readdir = proc_virtual_readdir,
24637 +static struct inode_operations proc_virtual_dir_inode_operations = {
24638 + .getattr = proc_virtual_getattr,
24639 + .lookup = proc_virtual_lookup,
24646 +int proc_virtnet_readdir(struct file *filp,
24647 + void *dirent, filldir_t filldir)
24649 + struct dentry *dentry = filp->f_dentry;
24650 + struct inode *inode = dentry->d_inode;
24651 + struct vs_entry *p = nx_virtnet_stuff;
24652 + int size = sizeof(nx_virtnet_stuff) / sizeof(struct vs_entry);
24654 + unsigned int nid_array[PROC_MAXVIDS];
24655 + char buf[PROC_NUMBUF];
24656 + unsigned int nr_nids, i;
24659 + pos = filp->f_pos;
24662 + ino = inode->i_ino;
24663 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24666 + /* fall through */
24668 + ino = parent_ino(dentry);
24669 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24672 + /* fall through */
24675 + if (index >= size)
24677 + for (p += index; p->name; p++) {
24678 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24679 + vs_proc_instantiate, 0, p))
24684 + index = pos - size;
24685 + p = &nx_virtnet_stuff[size - 1];
24686 + nr_nids = get_nid_list(index, nid_array, PROC_MAXVIDS);
24687 + for (i = 0; i < nr_nids; i++) {
24688 + int n, nid = nid_array[i];
24689 + unsigned int j = PROC_NUMBUF;
24693 + buf[--j] = '0' + (n % 10);
24696 + if (proc_fill_cache(filp, dirent, filldir,
24697 + buf + j, PROC_NUMBUF - j,
24698 + vs_proc_instantiate, nid, p))
24704 + filp->f_pos = pos;
24708 +static int proc_virtnet_getattr(struct vfsmount *mnt,
24709 + struct dentry *dentry, struct kstat *stat)
24711 + struct inode *inode = dentry->d_inode;
24713 + generic_fillattr(inode, stat);
24714 + stat->nlink = 2 + atomic_read(&nx_global_cactive);
24718 +static struct file_operations proc_virtnet_dir_operations = {
24719 + .read = generic_read_dir,
24720 + .readdir = proc_virtnet_readdir,
24723 +static struct inode_operations proc_virtnet_dir_inode_operations = {
24724 + .getattr = proc_virtnet_getattr,
24725 + .lookup = proc_virtnet_lookup,
24730 +void proc_vx_init(void)
24732 + struct proc_dir_entry *ent;
24734 + ent = proc_mkdir("virtual", 0);
24736 + ent->proc_fops = &proc_virtual_dir_operations;
24737 + ent->proc_iops = &proc_virtual_dir_inode_operations;
24739 + proc_virtual = ent;
24741 + ent = proc_mkdir("virtnet", 0);
24743 + ent->proc_fops = &proc_virtnet_dir_operations;
24744 + ent->proc_iops = &proc_virtnet_dir_inode_operations;
24746 + proc_virtnet = ent;
24752 +/* per pid info */
24755 +int proc_pid_vx_info(struct task_struct *p, char *buffer)
24757 + struct vx_info *vxi;
24758 + char *orig = buffer;
24760 + buffer += sprintf(buffer, "XID:\t%d\n", vx_task_xid(p));
24762 + vxi = task_get_vx_info(p);
24766 + buffer += sprintf(buffer, "BCaps:\t");
24767 + buffer = print_cap_t(buffer, &vxi->vx_bcaps);
24768 + buffer += sprintf(buffer, "\n");
24769 + buffer += sprintf(buffer, "CCaps:\t%016llx\n",
24770 + (unsigned long long)vxi->vx_ccaps);
24771 + buffer += sprintf(buffer, "CFlags:\t%016llx\n",
24772 + (unsigned long long)vxi->vx_flags);
24773 + buffer += sprintf(buffer, "CIPid:\t%d\n", vxi->vx_initpid);
24775 + put_vx_info(vxi);
24777 + return buffer - orig;
24781 +int proc_pid_nx_info(struct task_struct *p, char *buffer)
24783 + struct nx_info *nxi;
24784 + struct nx_addr_v4 *v4a;
24785 +#ifdef CONFIG_IPV6
24786 + struct nx_addr_v6 *v6a;
24788 + char *orig = buffer;
24791 + buffer += sprintf(buffer, "NID:\t%d\n", nx_task_nid(p));
24793 + nxi = task_get_nx_info(p);
24797 + buffer += sprintf(buffer, "NCaps:\t%016llx\n",
24798 + (unsigned long long)nxi->nx_ncaps);
24799 + buffer += sprintf(buffer, "NFlags:\t%016llx\n",
24800 + (unsigned long long)nxi->nx_flags);
24802 + buffer += sprintf(buffer,
24803 + "V4Root[bcast]:\t" NIPQUAD_FMT "\n",
24804 + NIPQUAD(nxi->v4_bcast.s_addr));
24805 + buffer += sprintf (buffer,
24806 + "V4Root[lback]:\t" NIPQUAD_FMT "\n",
24807 + NIPQUAD(nxi->v4_lback.s_addr));
24808 + if (!NX_IPV4(nxi))
24810 + for (i = 0, v4a = &nxi->v4; v4a; i++, v4a = v4a->next)
24811 + buffer += sprintf(buffer, "V4Root[%d]:\t" NXAV4_FMT "\n",
24814 +#ifdef CONFIG_IPV6
24815 + if (!NX_IPV6(nxi))
24817 + for (i = 0, v6a = &nxi->v6; v6a; i++, v6a = v6a->next)
24818 + buffer += sprintf(buffer, "V6Root[%d]:\t" NXAV6_FMT "\n",
24822 + put_nx_info(nxi);
24824 + return buffer - orig;
24827 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/sched.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/sched.c
24828 --- linux-2.6.33.2/kernel/vserver/sched.c 1970-01-01 01:00:00.000000000 +0100
24829 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/sched.c 2010-02-25 12:02:16.000000000 +0100
24832 + * linux/kernel/vserver/sched.c
24834 + * Virtual Server: Scheduler Support
24836 + * Copyright (C) 2004-2007 Herbert Pötzl
24838 + * V0.01 adapted Sam Vilains version to 2.6.3
24839 + * V0.02 removed legacy interface
24840 + * V0.03 changed vcmds to vxi arg
24841 + * V0.04 removed older and legacy interfaces
24845 +#include <linux/vs_context.h>
24846 +#include <linux/vs_sched.h>
24847 +#include <linux/vserver/sched_cmd.h>
24849 +#include <asm/uaccess.h>
24852 +#define vxd_check_range(val, min, max) do { \
24853 + vxlprintk((val < min) || (val > max), \
24854 + "check_range(%ld,%ld,%ld)", \
24855 + (long)val, (long)min, (long)max, \
24856 + __FILE__, __LINE__); \
24860 +void vx_update_sched_param(struct _vx_sched *sched,
24861 + struct _vx_sched_pc *sched_pc)
24863 + unsigned int set_mask = sched->update_mask;
24865 + if (set_mask & VXSM_FILL_RATE)
24866 + sched_pc->fill_rate[0] = sched->fill_rate[0];
24867 + if (set_mask & VXSM_INTERVAL)
24868 + sched_pc->interval[0] = sched->interval[0];
24869 + if (set_mask & VXSM_FILL_RATE2)
24870 + sched_pc->fill_rate[1] = sched->fill_rate[1];
24871 + if (set_mask & VXSM_INTERVAL2)
24872 + sched_pc->interval[1] = sched->interval[1];
24873 + if (set_mask & VXSM_TOKENS)
24874 + sched_pc->tokens = sched->tokens;
24875 + if (set_mask & VXSM_TOKENS_MIN)
24876 + sched_pc->tokens_min = sched->tokens_min;
24877 + if (set_mask & VXSM_TOKENS_MAX)
24878 + sched_pc->tokens_max = sched->tokens_max;
24879 + if (set_mask & VXSM_PRIO_BIAS)
24880 + sched_pc->prio_bias = sched->prio_bias;
24882 + if (set_mask & VXSM_IDLE_TIME)
24883 + sched_pc->flags |= VXSF_IDLE_TIME;
24885 + sched_pc->flags &= ~VXSF_IDLE_TIME;
24888 + sched_pc->norm_time = jiffies;
24893 + * recalculate the context's scheduling tokens
24895 + * ret > 0 : number of tokens available
24896 + * ret < 0 : on hold, check delta_min[]
24897 + * -1 only jiffies
24898 + * -2 also idle time
24901 +int vx_tokens_recalc(struct _vx_sched_pc *sched_pc,
24902 + unsigned long *norm_time, unsigned long *idle_time, int delta_min[2])
24906 + int flags = sched_pc->flags;
24908 + /* how much time did pass? */
24909 + delta = *norm_time - sched_pc->norm_time;
24910 + // printk("@ %ld, %ld, %ld\n", *norm_time, sched_pc->norm_time, jiffies);
24911 + vxd_check_range(delta, 0, INT_MAX);
24913 + if (delta >= sched_pc->interval[0]) {
24914 + long tokens, integral;
24916 + /* calc integral token part */
24917 + tokens = delta / sched_pc->interval[0];
24918 + integral = tokens * sched_pc->interval[0];
24919 + tokens *= sched_pc->fill_rate[0];
24920 +#ifdef CONFIG_VSERVER_HARDCPU
24921 + delta_min[0] = delta - integral;
24922 + vxd_check_range(delta_min[0], 0, sched_pc->interval[0]);
24924 + /* advance time */
24925 + sched_pc->norm_time += delta;
24928 + sched_pc->tokens += tokens;
24929 + sched_pc->token_time += tokens;
24931 + delta_min[0] = delta;
24933 +#ifdef CONFIG_VSERVER_IDLETIME
24934 + if (!(flags & VXSF_IDLE_TIME))
24937 + /* how much was the idle skip? */
24938 + delta = *idle_time - sched_pc->idle_time;
24939 + vxd_check_range(delta, 0, INT_MAX);
24941 + if (delta >= sched_pc->interval[1]) {
24942 + long tokens, integral;
24944 + /* calc fair share token part */
24945 + tokens = delta / sched_pc->interval[1];
24946 + integral = tokens * sched_pc->interval[1];
24947 + tokens *= sched_pc->fill_rate[1];
24948 + delta_min[1] = delta - integral;
24949 + vxd_check_range(delta_min[1], 0, sched_pc->interval[1]);
24951 + /* advance idle time */
24952 + sched_pc->idle_time += integral;
24955 + sched_pc->tokens += tokens;
24956 + sched_pc->token_time += tokens;
24958 + delta_min[1] = delta;
24962 + /* clip at maximum */
24963 + if (sched_pc->tokens > sched_pc->tokens_max)
24964 + sched_pc->tokens = sched_pc->tokens_max;
24965 + tokens = sched_pc->tokens;
24967 + if ((flags & VXSF_ONHOLD)) {
24968 + /* can we unhold? */
24969 + if (tokens >= sched_pc->tokens_min) {
24970 + flags &= ~VXSF_ONHOLD;
24971 + sched_pc->hold_ticks +=
24972 + *norm_time - sched_pc->onhold;
24976 + /* put on hold? */
24977 + if (tokens <= 0) {
24978 + flags |= VXSF_ONHOLD;
24979 + sched_pc->onhold = *norm_time;
24983 + sched_pc->flags = flags;
24987 + tokens = sched_pc->tokens_min - tokens;
24988 + sched_pc->flags = flags;
24989 + // BUG_ON(tokens < 0); probably doesn't hold anymore
24991 +#ifdef CONFIG_VSERVER_HARDCPU
24992 + /* next interval? */
24993 + if (!sched_pc->fill_rate[0])
24994 + delta_min[0] = HZ;
24995 + else if (tokens > sched_pc->fill_rate[0])
24996 + delta_min[0] += sched_pc->interval[0] *
24997 + tokens / sched_pc->fill_rate[0];
24999 + delta_min[0] = sched_pc->interval[0] - delta_min[0];
25000 + vxd_check_range(delta_min[0], 0, INT_MAX);
25002 +#ifdef CONFIG_VSERVER_IDLETIME
25003 + if (!(flags & VXSF_IDLE_TIME))
25006 + /* next interval? */
25007 + if (!sched_pc->fill_rate[1])
25008 + delta_min[1] = HZ;
25009 + else if (tokens > sched_pc->fill_rate[1])
25010 + delta_min[1] += sched_pc->interval[1] *
25011 + tokens / sched_pc->fill_rate[1];
25013 + delta_min[1] = sched_pc->interval[1] - delta_min[1];
25014 + vxd_check_range(delta_min[1], 0, INT_MAX);
25019 +#endif /* CONFIG_VSERVER_IDLETIME */
25022 +#endif /* CONFIG_VSERVER_HARDCPU */
25025 +static inline unsigned long msec_to_ticks(unsigned long msec)
25027 + return msecs_to_jiffies(msec);
25030 +static inline unsigned long ticks_to_msec(unsigned long ticks)
25032 + return jiffies_to_msecs(ticks);
25035 +static inline unsigned long ticks_to_usec(unsigned long ticks)
25037 + return jiffies_to_usecs(ticks);
25041 +static int do_set_sched(struct vx_info *vxi, struct vcmd_sched_v5 *data)
25043 + unsigned int set_mask = data->mask;
25044 + unsigned int update_mask;
25047 + /* Sanity check data values */
25048 + if (data->tokens_max <= 0)
25049 + data->tokens_max = HZ;
25050 + if (data->tokens_min < 0)
25051 + data->tokens_min = HZ / 3;
25052 + if (data->tokens_min >= data->tokens_max)
25053 + data->tokens_min = data->tokens_max;
25055 + if (data->prio_bias > MAX_PRIO_BIAS)
25056 + data->prio_bias = MAX_PRIO_BIAS;
25057 + if (data->prio_bias < MIN_PRIO_BIAS)
25058 + data->prio_bias = MIN_PRIO_BIAS;
25060 + spin_lock(&vxi->sched.tokens_lock);
25062 + /* sync up on delayed updates */
25063 + for_each_cpu_mask(cpu, vxi->sched.update)
25064 + vx_update_sched_param(&vxi->sched,
25065 + &vx_per_cpu(vxi, sched_pc, cpu));
25067 + if (set_mask & VXSM_FILL_RATE)
25068 + vxi->sched.fill_rate[0] = data->fill_rate[0];
25069 + if (set_mask & VXSM_FILL_RATE2)
25070 + vxi->sched.fill_rate[1] = data->fill_rate[1];
25071 + if (set_mask & VXSM_INTERVAL)
25072 + vxi->sched.interval[0] = (set_mask & VXSM_MSEC) ?
25073 + msec_to_ticks(data->interval[0]) : data->interval[0];
25074 + if (set_mask & VXSM_INTERVAL2)
25075 + vxi->sched.interval[1] = (set_mask & VXSM_MSEC) ?
25076 + msec_to_ticks(data->interval[1]) : data->interval[1];
25077 + if (set_mask & VXSM_TOKENS)
25078 + vxi->sched.tokens = data->tokens;
25079 + if (set_mask & VXSM_TOKENS_MIN)
25080 + vxi->sched.tokens_min = data->tokens_min;
25081 + if (set_mask & VXSM_TOKENS_MAX)
25082 + vxi->sched.tokens_max = data->tokens_max;
25083 + if (set_mask & VXSM_PRIO_BIAS)
25084 + vxi->sched.prio_bias = data->prio_bias;
25086 + /* Sanity check rate/interval */
25087 + for (i = 0; i < 2; i++) {
25088 + if (data->fill_rate[i] < 0)
25089 + data->fill_rate[i] = 0;
25090 + if (data->interval[i] <= 0)
25091 + data->interval[i] = HZ;
25094 + update_mask = vxi->sched.update_mask & VXSM_SET_MASK;
25095 + update_mask |= (set_mask & (VXSM_SET_MASK | VXSM_IDLE_TIME));
25096 + vxi->sched.update_mask = update_mask;
25100 + if (set_mask & VXSM_CPU_ID) {
25101 + vxi->sched.update = cpumask_of_cpu(data->cpu_id);
25102 + cpus_and(vxi->sched.update, cpu_online_map,
25103 + vxi->sched.update);
25105 + vxi->sched.update = cpu_online_map;
25107 + /* forced reload? */
25108 + if (set_mask & VXSM_FORCE) {
25109 + for_each_cpu_mask(cpu, vxi->sched.update)
25110 + vx_update_sched_param(&vxi->sched,
25111 + &vx_per_cpu(vxi, sched_pc, cpu));
25112 + vxi->sched.update = CPU_MASK_NONE;
25115 + /* on UP we update immediately */
25116 + vx_update_sched_param(&vxi->sched,
25117 + &vx_per_cpu(vxi, sched_pc, 0));
25120 + spin_unlock(&vxi->sched.tokens_lock);
25125 +#define COPY_IDS(C) C(cpu_id); C(bucket_id)
25126 +#define COPY_PRI(C) C(prio_bias)
25127 +#define COPY_TOK(C) C(tokens); C(tokens_min); C(tokens_max)
25128 +#define COPY_FRI(C) C(fill_rate[0]); C(interval[0]); \
25129 + C(fill_rate[1]); C(interval[1]);
25131 +#define COPY_VALUE(name) vc_data.name = data->name
25133 +static int do_set_sched_v4(struct vx_info *vxi, struct vcmd_set_sched_v4 *data)
25135 + struct vcmd_sched_v5 vc_data;
25137 + vc_data.mask = data->set_mask;
25138 + COPY_IDS(COPY_VALUE);
25139 + COPY_PRI(COPY_VALUE);
25140 + COPY_TOK(COPY_VALUE);
25141 + vc_data.fill_rate[0] = vc_data.fill_rate[1] = data->fill_rate;
25142 + vc_data.interval[0] = vc_data.interval[1] = data->interval;
25143 + return do_set_sched(vxi, &vc_data);
25146 +int vc_set_sched_v4(struct vx_info *vxi, void __user *data)
25148 + struct vcmd_set_sched_v4 vc_data;
25150 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25153 + return do_set_sched_v4(vxi, &vc_data);
25156 + /* latest interface is v5 */
25158 +int vc_set_sched(struct vx_info *vxi, void __user *data)
25160 + struct vcmd_sched_v5 vc_data;
25162 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25165 + return do_set_sched(vxi, &vc_data);
25169 +#define COPY_PRI(C) C(prio_bias)
25170 +#define COPY_TOK(C) C(tokens); C(tokens_min); C(tokens_max)
25171 +#define COPY_FRI(C) C(fill_rate[0]); C(interval[0]); \
25172 + C(fill_rate[1]); C(interval[1]);
25174 +#define COPY_VALUE(name) vc_data.name = data->name
25177 +int vc_get_sched(struct vx_info *vxi, void __user *data)
25179 + struct vcmd_sched_v5 vc_data;
25181 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25184 + if (vc_data.mask & VXSM_CPU_ID) {
25185 + int cpu = vc_data.cpu_id;
25186 + struct _vx_sched_pc *data;
25188 + if (!cpu_possible(cpu))
25191 + data = &vx_per_cpu(vxi, sched_pc, cpu);
25192 + COPY_TOK(COPY_VALUE);
25193 + COPY_PRI(COPY_VALUE);
25194 + COPY_FRI(COPY_VALUE);
25196 + if (data->flags & VXSF_IDLE_TIME)
25197 + vc_data.mask |= VXSM_IDLE_TIME;
25199 + struct _vx_sched *data = &vxi->sched;
25201 + COPY_TOK(COPY_VALUE);
25202 + COPY_PRI(COPY_VALUE);
25203 + COPY_FRI(COPY_VALUE);
25206 + if (vc_data.mask & VXSM_MSEC) {
25207 + vc_data.interval[0] = ticks_to_msec(vc_data.interval[0]);
25208 + vc_data.interval[1] = ticks_to_msec(vc_data.interval[1]);
25211 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
25217 +int vc_sched_info(struct vx_info *vxi, void __user *data)
25219 + struct vcmd_sched_info vc_data;
25222 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25225 + cpu = vc_data.cpu_id;
25226 + if (!cpu_possible(cpu))
25230 + struct _vx_sched_pc *sched_pc =
25231 + &vx_per_cpu(vxi, sched_pc, cpu);
25233 + vc_data.user_msec = ticks_to_msec(sched_pc->user_ticks);
25234 + vc_data.sys_msec = ticks_to_msec(sched_pc->sys_ticks);
25235 + vc_data.hold_msec = ticks_to_msec(sched_pc->hold_ticks);
25236 + vc_data.vavavoom = sched_pc->vavavoom;
25238 + vc_data.token_usec = ticks_to_usec(1);
25240 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
25245 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/sched_init.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/sched_init.h
25246 --- linux-2.6.33.2/kernel/vserver/sched_init.h 1970-01-01 01:00:00.000000000 +0100
25247 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/sched_init.h 2010-02-25 12:02:16.000000000 +0100
25250 +static inline void vx_info_init_sched(struct _vx_sched *sched)
25252 + static struct lock_class_key tokens_lock_key;
25254 + /* scheduling; hard code starting values as constants */
25255 + sched->fill_rate[0] = 1;
25256 + sched->interval[0] = 4;
25257 + sched->fill_rate[1] = 1;
25258 + sched->interval[1] = 8;
25259 + sched->tokens = HZ >> 2;
25260 + sched->tokens_min = HZ >> 4;
25261 + sched->tokens_max = HZ >> 1;
25262 + sched->tokens_lock = SPIN_LOCK_UNLOCKED;
25263 + sched->prio_bias = 0;
25265 + lockdep_set_class(&sched->tokens_lock, &tokens_lock_key);
25269 +void vx_info_init_sched_pc(struct _vx_sched_pc *sched_pc, int cpu)
25271 + sched_pc->fill_rate[0] = 1;
25272 + sched_pc->interval[0] = 4;
25273 + sched_pc->fill_rate[1] = 1;
25274 + sched_pc->interval[1] = 8;
25275 + sched_pc->tokens = HZ >> 2;
25276 + sched_pc->tokens_min = HZ >> 4;
25277 + sched_pc->tokens_max = HZ >> 1;
25278 + sched_pc->prio_bias = 0;
25279 + sched_pc->vavavoom = 0;
25280 + sched_pc->token_time = 0;
25281 + sched_pc->idle_time = 0;
25282 + sched_pc->norm_time = jiffies;
25284 + sched_pc->user_ticks = 0;
25285 + sched_pc->sys_ticks = 0;
25286 + sched_pc->hold_ticks = 0;
25289 +static inline void vx_info_exit_sched(struct _vx_sched *sched)
25295 +void vx_info_exit_sched_pc(struct _vx_sched_pc *sched_pc, int cpu)
25299 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/sched_proc.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/sched_proc.h
25300 --- linux-2.6.33.2/kernel/vserver/sched_proc.h 1970-01-01 01:00:00.000000000 +0100
25301 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/sched_proc.h 2010-02-25 12:02:16.000000000 +0100
25303 +#ifndef _VX_SCHED_PROC_H
25304 +#define _VX_SCHED_PROC_H
25308 +int vx_info_proc_sched(struct _vx_sched *sched, char *buffer)
25312 + length += sprintf(buffer,
25313 + "FillRate:\t%8d,%d\n"
25314 + "Interval:\t%8d,%d\n"
25315 + "TokensMin:\t%8d\n"
25316 + "TokensMax:\t%8d\n"
25317 + "PrioBias:\t%8d\n",
25318 + sched->fill_rate[0],
25319 + sched->fill_rate[1],
25320 + sched->interval[0],
25321 + sched->interval[1],
25322 + sched->tokens_min,
25323 + sched->tokens_max,
25324 + sched->prio_bias);
25329 +int vx_info_proc_sched_pc(struct _vx_sched_pc *sched_pc,
25330 + char *buffer, int cpu)
25334 + length += sprintf(buffer + length,
25335 + "cpu %d: %lld %lld %lld %ld %ld", cpu,
25336 + (unsigned long long)sched_pc->user_ticks,
25337 + (unsigned long long)sched_pc->sys_ticks,
25338 + (unsigned long long)sched_pc->hold_ticks,
25339 + sched_pc->token_time,
25340 + sched_pc->idle_time);
25341 + length += sprintf(buffer + length,
25342 + " %c%c %d %d %d %d/%d %d/%d",
25343 + (sched_pc->flags & VXSF_ONHOLD) ? 'H' : 'R',
25344 + (sched_pc->flags & VXSF_IDLE_TIME) ? 'I' : '-',
25345 + sched_pc->tokens,
25346 + sched_pc->tokens_min,
25347 + sched_pc->tokens_max,
25348 + sched_pc->fill_rate[0],
25349 + sched_pc->interval[0],
25350 + sched_pc->fill_rate[1],
25351 + sched_pc->interval[1]);
25352 + length += sprintf(buffer + length,
25354 + sched_pc->prio_bias,
25355 + sched_pc->vavavoom);
25359 +#endif /* _VX_SCHED_PROC_H */
25360 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/signal.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/signal.c
25361 --- linux-2.6.33.2/kernel/vserver/signal.c 1970-01-01 01:00:00.000000000 +0100
25362 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/signal.c 2010-02-25 12:02:16.000000000 +0100
25365 + * linux/kernel/vserver/signal.c
25367 + * Virtual Server: Signal Support
25369 + * Copyright (C) 2003-2007 Herbert Pötzl
25371 + * V0.01 broken out from vcontext V0.05
25372 + * V0.02 changed vcmds to vxi arg
25373 + * V0.03 adjusted siginfo for kill
25377 +#include <asm/uaccess.h>
25379 +#include <linux/vs_context.h>
25380 +#include <linux/vs_pid.h>
25381 +#include <linux/vserver/signal_cmd.h>
25384 +int vx_info_kill(struct vx_info *vxi, int pid, int sig)
25386 + int retval, count = 0;
25387 + struct task_struct *p;
25388 + struct siginfo *sip = SEND_SIG_PRIV;
25391 + vxdprintk(VXD_CBIT(misc, 4),
25392 + "vx_info_kill(%p[#%d],%d,%d)*",
25393 + vxi, vxi->vx_id, pid, sig);
25394 + read_lock(&tasklist_lock);
25398 + for_each_process(p) {
25401 + if (vx_task_xid(p) != vxi->vx_id || p->pid <= 1 ||
25402 + (pid && vxi->vx_initpid == p->pid))
25405 + err = group_send_sig_info(sig, sip, p);
25407 + if (err != -EPERM)
25413 + if (vxi->vx_initpid) {
25414 + pid = vxi->vx_initpid;
25415 + /* for now, only SIGINT to private init ... */
25416 + if (!vx_info_flags(vxi, VXF_STATE_ADMIN, 0) &&
25417 + /* ... as long as there are tasks left */
25418 + (atomic_read(&vxi->vx_tasks) > 1))
25421 + /* fallthrough */
25423 + p = find_task_by_real_pid(pid);
25425 + if (vx_task_xid(p) == vxi->vx_id)
25426 + retval = group_send_sig_info(sig, sip, p);
25430 + read_unlock(&tasklist_lock);
25431 + vxdprintk(VXD_CBIT(misc, 4),
25432 + "vx_info_kill(%p[#%d],%d,%d,%ld) = %d",
25433 + vxi, vxi->vx_id, pid, sig, (long)sip, retval);
25437 +int vc_ctx_kill(struct vx_info *vxi, void __user *data)
25439 + struct vcmd_ctx_kill_v0 vc_data;
25441 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25444 + /* special check to allow guest shutdown */
25445 + if (!vx_info_flags(vxi, VXF_STATE_ADMIN, 0) &&
25446 + /* forbid killall pid=0 when init is present */
25447 + (((vc_data.pid < 1) && vxi->vx_initpid) ||
25448 + (vc_data.pid > 1)))
25451 + return vx_info_kill(vxi, vc_data.pid, vc_data.sig);
25455 +static int __wait_exit(struct vx_info *vxi)
25457 + DECLARE_WAITQUEUE(wait, current);
25460 + add_wait_queue(&vxi->vx_wait, &wait);
25461 + set_current_state(TASK_INTERRUPTIBLE);
25464 + if (vx_info_state(vxi,
25465 + VXS_SHUTDOWN | VXS_HASHED | VXS_HELPER) == VXS_SHUTDOWN)
25467 + if (signal_pending(current)) {
25468 + ret = -ERESTARTSYS;
25475 + set_current_state(TASK_RUNNING);
25476 + remove_wait_queue(&vxi->vx_wait, &wait);
25482 +int vc_wait_exit(struct vx_info *vxi, void __user *data)
25484 + struct vcmd_wait_exit_v0 vc_data;
25487 + ret = __wait_exit(vxi);
25488 + vc_data.reboot_cmd = vxi->reboot_cmd;
25489 + vc_data.exit_code = vxi->exit_code;
25491 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
25496 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/space.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/space.c
25497 --- linux-2.6.33.2/kernel/vserver/space.c 1970-01-01 01:00:00.000000000 +0100
25498 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/space.c 2010-02-25 12:02:16.000000000 +0100
25501 + * linux/kernel/vserver/space.c
25503 + * Virtual Server: Context Space Support
25505 + * Copyright (C) 2003-2007 Herbert Pötzl
25507 + * V0.01 broken out from context.c 0.07
25508 + * V0.02 added task locking for namespace
25509 + * V0.03 broken out vx_enter_namespace
25510 + * V0.04 added *space support and commands
25514 +#include <linux/utsname.h>
25515 +#include <linux/nsproxy.h>
25516 +#include <linux/err.h>
25517 +#include <linux/fs_struct.h>
25518 +#include <asm/uaccess.h>
25520 +#include <linux/vs_context.h>
25521 +#include <linux/vserver/space.h>
25522 +#include <linux/vserver/space_cmd.h>
25524 +atomic_t vs_global_nsproxy = ATOMIC_INIT(0);
25525 +atomic_t vs_global_fs = ATOMIC_INIT(0);
25526 +atomic_t vs_global_mnt_ns = ATOMIC_INIT(0);
25527 +atomic_t vs_global_uts_ns = ATOMIC_INIT(0);
25528 +atomic_t vs_global_user_ns = ATOMIC_INIT(0);
25529 +atomic_t vs_global_pid_ns = ATOMIC_INIT(0);
25532 +/* namespace functions */
25534 +#include <linux/mnt_namespace.h>
25535 +#include <linux/user_namespace.h>
25536 +#include <linux/pid_namespace.h>
25537 +#include <linux/ipc_namespace.h>
25538 +#include <net/net_namespace.h>
25541 +static const struct vcmd_space_mask_v1 space_mask_v0 = {
25542 + .mask = CLONE_FS |
25550 +static const struct vcmd_space_mask_v1 space_mask = {
25551 + .mask = CLONE_FS |
25556 +#ifdef CONFIG_PID_NS
25559 +#ifdef CONFIG_NET_NS
25565 +static const struct vcmd_space_mask_v1 default_space_mask = {
25566 + .mask = CLONE_FS |
25571 +#ifdef CONFIG_PID_NS
25578 + * build a new nsproxy mix
25579 + * assumes that both proxies are 'const'
25580 + * does not touch nsproxy refcounts
25581 + * will hold a reference on the result.
25584 +struct nsproxy *vs_mix_nsproxy(struct nsproxy *old_nsproxy,
25585 + struct nsproxy *new_nsproxy, unsigned long mask)
25587 + struct mnt_namespace *old_ns;
25588 + struct uts_namespace *old_uts;
25589 + struct ipc_namespace *old_ipc;
25590 +#ifdef CONFIG_PID_NS
25591 + struct pid_namespace *old_pid;
25593 +#ifdef CONFIG_NET_NS
25594 + struct net *old_net;
25596 + struct nsproxy *nsproxy;
25598 + nsproxy = copy_nsproxy(old_nsproxy);
25602 + if (mask & CLONE_NEWNS) {
25603 + old_ns = nsproxy->mnt_ns;
25604 + nsproxy->mnt_ns = new_nsproxy->mnt_ns;
25605 + if (nsproxy->mnt_ns)
25606 + get_mnt_ns(nsproxy->mnt_ns);
25610 + if (mask & CLONE_NEWUTS) {
25611 + old_uts = nsproxy->uts_ns;
25612 + nsproxy->uts_ns = new_nsproxy->uts_ns;
25613 + if (nsproxy->uts_ns)
25614 + get_uts_ns(nsproxy->uts_ns);
25618 + if (mask & CLONE_NEWIPC) {
25619 + old_ipc = nsproxy->ipc_ns;
25620 + nsproxy->ipc_ns = new_nsproxy->ipc_ns;
25621 + if (nsproxy->ipc_ns)
25622 + get_ipc_ns(nsproxy->ipc_ns);
25626 +#ifdef CONFIG_PID_NS
25627 + if (mask & CLONE_NEWPID) {
25628 + old_pid = nsproxy->pid_ns;
25629 + nsproxy->pid_ns = new_nsproxy->pid_ns;
25630 + if (nsproxy->pid_ns)
25631 + get_pid_ns(nsproxy->pid_ns);
25635 +#ifdef CONFIG_NET_NS
25636 + if (mask & CLONE_NEWNET) {
25637 + old_net = nsproxy->net_ns;
25638 + nsproxy->net_ns = new_nsproxy->net_ns;
25639 + if (nsproxy->net_ns)
25640 + get_net(nsproxy->net_ns);
25645 + put_mnt_ns(old_ns);
25647 + put_uts_ns(old_uts);
25649 + put_ipc_ns(old_ipc);
25650 +#ifdef CONFIG_PID_NS
25652 + put_pid_ns(old_pid);
25654 +#ifdef CONFIG_NET_NS
25656 + put_net(old_net);
25664 + * merge two nsproxy structs into a new one.
25665 + * will hold a reference on the result.
25669 +struct nsproxy *__vs_merge_nsproxy(struct nsproxy *old,
25670 + struct nsproxy *proxy, unsigned long mask)
25672 + struct nsproxy null_proxy = { .mnt_ns = NULL };
25678 + /* vs_mix_nsproxy returns with reference */
25679 + return vs_mix_nsproxy(old ? old : &null_proxy,
25682 + get_nsproxy(proxy);
25687 +int vx_enter_space(struct vx_info *vxi, unsigned long mask, unsigned index)
25689 + struct nsproxy *proxy, *proxy_cur, *proxy_new;
25690 + struct fs_struct *fs_cur, *fs = NULL;
25691 + int ret, kill = 0;
25693 + vxdprintk(VXD_CBIT(space, 8), "vx_enter_space(%p[#%u],0x%08lx,%d)",
25694 + vxi, vxi->vx_id, mask, index);
25696 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0))
25700 + mask = vxi->vx_nsmask[index];
25702 + if ((mask & vxi->vx_nsmask[index]) != mask)
25705 + if (mask & CLONE_FS) {
25706 + fs = copy_fs_struct(vxi->vx_fs[index]);
25710 + proxy = vxi->vx_nsproxy[index];
25712 + vxdprintk(VXD_CBIT(space, 9),
25713 + "vx_enter_space(%p[#%u],0x%08lx,%d) -> (%p,%p)",
25714 + vxi, vxi->vx_id, mask, index, proxy, fs);
25716 + task_lock(current);
25717 + fs_cur = current->fs;
25719 + if (mask & CLONE_FS) {
25720 + write_lock(&fs_cur->lock);
25721 + current->fs = fs;
25722 + kill = !--fs_cur->users;
25723 + write_unlock(&fs_cur->lock);
25726 + proxy_cur = current->nsproxy;
25727 + get_nsproxy(proxy_cur);
25728 + task_unlock(current);
25731 + free_fs_struct(fs_cur);
25733 + proxy_new = __vs_merge_nsproxy(proxy_cur, proxy, mask);
25734 + if (IS_ERR(proxy_new)) {
25735 + ret = PTR_ERR(proxy_new);
25739 + proxy_new = xchg(¤t->nsproxy, proxy_new);
25743 + put_nsproxy(proxy_new);
25746 + put_nsproxy(proxy_cur);
25751 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index)
25753 + struct nsproxy *proxy_vxi, *proxy_cur, *proxy_new;
25754 + struct fs_struct *fs_vxi, *fs;
25755 + int ret, kill = 0;
25757 + vxdprintk(VXD_CBIT(space, 8), "vx_set_space(%p[#%u],0x%08lx,%d)",
25758 + vxi, vxi->vx_id, mask, index);
25761 + mask = default_space_mask.mask;
25763 + if ((mask & space_mask.mask) != mask)
25766 + proxy_vxi = vxi->vx_nsproxy[index];
25767 + fs_vxi = vxi->vx_fs[index];
25769 + if (mask & CLONE_FS) {
25770 + fs = copy_fs_struct(current->fs);
25775 + task_lock(current);
25777 + if (mask & CLONE_FS) {
25778 + write_lock(&fs_vxi->lock);
25779 + vxi->vx_fs[index] = fs;
25780 + kill = !--fs_vxi->users;
25781 + write_unlock(&fs_vxi->lock);
25784 + proxy_cur = current->nsproxy;
25785 + get_nsproxy(proxy_cur);
25786 + task_unlock(current);
25789 + free_fs_struct(fs_vxi);
25791 + proxy_new = __vs_merge_nsproxy(proxy_vxi, proxy_cur, mask);
25792 + if (IS_ERR(proxy_new)) {
25793 + ret = PTR_ERR(proxy_new);
25797 + proxy_new = xchg(&vxi->vx_nsproxy[index], proxy_new);
25798 + vxi->vx_nsmask[index] |= mask;
25802 + put_nsproxy(proxy_new);
25805 + put_nsproxy(proxy_cur);
25810 +int vc_enter_space_v1(struct vx_info *vxi, void __user *data)
25812 + struct vcmd_space_mask_v1 vc_data = { .mask = 0 };
25814 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25817 + return vx_enter_space(vxi, vc_data.mask, 0);
25820 +int vc_enter_space(struct vx_info *vxi, void __user *data)
25822 + struct vcmd_space_mask_v2 vc_data = { .mask = 0 };
25824 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25827 + if (vc_data.index >= VX_SPACES)
25830 + return vx_enter_space(vxi, vc_data.mask, vc_data.index);
25833 +int vc_set_space_v1(struct vx_info *vxi, void __user *data)
25835 + struct vcmd_space_mask_v1 vc_data = { .mask = 0 };
25837 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25840 + return vx_set_space(vxi, vc_data.mask, 0);
25843 +int vc_set_space(struct vx_info *vxi, void __user *data)
25845 + struct vcmd_space_mask_v2 vc_data = { .mask = 0 };
25847 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25850 + if (vc_data.index >= VX_SPACES)
25853 + return vx_set_space(vxi, vc_data.mask, vc_data.index);
25856 +int vc_get_space_mask(void __user *data, int type)
25858 + const struct vcmd_space_mask_v1 *mask;
25861 + mask = &space_mask_v0;
25862 + else if (type == 1)
25863 + mask = &space_mask;
25865 + mask = &default_space_mask;
25867 + vxdprintk(VXD_CBIT(space, 10),
25868 + "vc_get_space_mask(%d) = %08llx", type, mask->mask);
25870 + if (copy_to_user(data, mask, sizeof(*mask)))
25875 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/switch.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/switch.c
25876 --- linux-2.6.33.2/kernel/vserver/switch.c 1970-01-01 01:00:00.000000000 +0100
25877 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/switch.c 2010-02-25 12:02:16.000000000 +0100
25880 + * linux/kernel/vserver/switch.c
25882 + * Virtual Server: Syscall Switch
25884 + * Copyright (C) 2003-2007 Herbert Pötzl
25886 + * V0.01 syscall switch
25887 + * V0.02 added signal to context
25888 + * V0.03 added rlimit functions
25889 + * V0.04 added iattr, task/xid functions
25890 + * V0.05 added debug/history stuff
25891 + * V0.06 added compat32 layer
25892 + * V0.07 vcmd args and perms
25893 + * V0.08 added status commands
25894 + * V0.09 added tag commands
25895 + * V0.10 added oom bias
25896 + * V0.11 added device commands
25900 +#include <linux/vs_context.h>
25901 +#include <linux/vs_network.h>
25902 +#include <linux/vserver/switch.h>
25904 +#include "vci_config.h"
25908 +int vc_get_version(uint32_t id)
25910 + return VCI_VERSION;
25914 +int vc_get_vci(uint32_t id)
25916 + return vci_kernel_config();
25919 +#include <linux/vserver/context_cmd.h>
25920 +#include <linux/vserver/cvirt_cmd.h>
25921 +#include <linux/vserver/cacct_cmd.h>
25922 +#include <linux/vserver/limit_cmd.h>
25923 +#include <linux/vserver/network_cmd.h>
25924 +#include <linux/vserver/sched_cmd.h>
25925 +#include <linux/vserver/debug_cmd.h>
25926 +#include <linux/vserver/inode_cmd.h>
25927 +#include <linux/vserver/dlimit_cmd.h>
25928 +#include <linux/vserver/signal_cmd.h>
25929 +#include <linux/vserver/space_cmd.h>
25930 +#include <linux/vserver/tag_cmd.h>
25931 +#include <linux/vserver/device_cmd.h>
25933 +#include <linux/vserver/inode.h>
25934 +#include <linux/vserver/dlimit.h>
25937 +#ifdef CONFIG_COMPAT
25938 +#define __COMPAT(name, id, data, compat) \
25939 + (compat) ? name ## _x32(id, data) : name(id, data)
25940 +#define __COMPAT_NO_ID(name, data, compat) \
25941 + (compat) ? name ## _x32(data) : name(data)
25943 +#define __COMPAT(name, id, data, compat) \
25945 +#define __COMPAT_NO_ID(name, data, compat) \
25951 +long do_vcmd(uint32_t cmd, uint32_t id,
25952 + struct vx_info *vxi, struct nx_info *nxi,
25953 + void __user *data, int compat)
25957 + case VCMD_get_version:
25958 + return vc_get_version(id);
25959 + case VCMD_get_vci:
25960 + return vc_get_vci(id);
25962 + case VCMD_task_xid:
25963 + return vc_task_xid(id);
25964 + case VCMD_vx_info:
25965 + return vc_vx_info(vxi, data);
25967 + case VCMD_task_nid:
25968 + return vc_task_nid(id);
25969 + case VCMD_nx_info:
25970 + return vc_nx_info(nxi, data);
25972 + case VCMD_task_tag:
25973 + return vc_task_tag(id);
25975 + case VCMD_set_space_v1:
25976 + return vc_set_space_v1(vxi, data);
25977 + /* this is version 2 */
25978 + case VCMD_set_space:
25979 + return vc_set_space(vxi, data);
25981 + case VCMD_get_space_mask_v0:
25982 + return vc_get_space_mask(data, 0);
25983 + /* this is version 1 */
25984 + case VCMD_get_space_mask:
25985 + return vc_get_space_mask(data, 1);
25987 + case VCMD_get_space_default:
25988 + return vc_get_space_mask(data, -1);
25990 +#ifdef CONFIG_IA32_EMULATION
25991 + case VCMD_get_rlimit:
25992 + return __COMPAT(vc_get_rlimit, vxi, data, compat);
25993 + case VCMD_set_rlimit:
25994 + return __COMPAT(vc_set_rlimit, vxi, data, compat);
25996 + case VCMD_get_rlimit:
25997 + return vc_get_rlimit(vxi, data);
25998 + case VCMD_set_rlimit:
25999 + return vc_set_rlimit(vxi, data);
26001 + case VCMD_get_rlimit_mask:
26002 + return vc_get_rlimit_mask(id, data);
26003 + case VCMD_reset_hits:
26004 + return vc_reset_hits(vxi, data);
26005 + case VCMD_reset_minmax:
26006 + return vc_reset_minmax(vxi, data);
26008 + case VCMD_get_vhi_name:
26009 + return vc_get_vhi_name(vxi, data);
26010 + case VCMD_set_vhi_name:
26011 + return vc_set_vhi_name(vxi, data);
26013 + case VCMD_ctx_stat:
26014 + return vc_ctx_stat(vxi, data);
26015 + case VCMD_virt_stat:
26016 + return vc_virt_stat(vxi, data);
26017 + case VCMD_sock_stat:
26018 + return vc_sock_stat(vxi, data);
26019 + case VCMD_rlimit_stat:
26020 + return vc_rlimit_stat(vxi, data);
26022 + case VCMD_set_cflags:
26023 + return vc_set_cflags(vxi, data);
26024 + case VCMD_get_cflags:
26025 + return vc_get_cflags(vxi, data);
26027 + /* this is version 1 */
26028 + case VCMD_set_ccaps:
26029 + return vc_set_ccaps(vxi, data);
26030 + /* this is version 1 */
26031 + case VCMD_get_ccaps:
26032 + return vc_get_ccaps(vxi, data);
26033 + case VCMD_set_bcaps:
26034 + return vc_set_bcaps(vxi, data);
26035 + case VCMD_get_bcaps:
26036 + return vc_get_bcaps(vxi, data);
26038 + case VCMD_set_badness:
26039 + return vc_set_badness(vxi, data);
26040 + case VCMD_get_badness:
26041 + return vc_get_badness(vxi, data);
26043 + case VCMD_set_nflags:
26044 + return vc_set_nflags(nxi, data);
26045 + case VCMD_get_nflags:
26046 + return vc_get_nflags(nxi, data);
26048 + case VCMD_set_ncaps:
26049 + return vc_set_ncaps(nxi, data);
26050 + case VCMD_get_ncaps:
26051 + return vc_get_ncaps(nxi, data);
26053 + case VCMD_set_sched_v4:
26054 + return vc_set_sched_v4(vxi, data);
26055 + /* this is version 5 */
26056 + case VCMD_set_sched:
26057 + return vc_set_sched(vxi, data);
26058 + case VCMD_get_sched:
26059 + return vc_get_sched(vxi, data);
26060 + case VCMD_sched_info:
26061 + return vc_sched_info(vxi, data);
26063 + case VCMD_add_dlimit:
26064 + return __COMPAT(vc_add_dlimit, id, data, compat);
26065 + case VCMD_rem_dlimit:
26066 + return __COMPAT(vc_rem_dlimit, id, data, compat);
26067 + case VCMD_set_dlimit:
26068 + return __COMPAT(vc_set_dlimit, id, data, compat);
26069 + case VCMD_get_dlimit:
26070 + return __COMPAT(vc_get_dlimit, id, data, compat);
26072 + case VCMD_ctx_kill:
26073 + return vc_ctx_kill(vxi, data);
26075 + case VCMD_wait_exit:
26076 + return vc_wait_exit(vxi, data);
26078 + case VCMD_get_iattr:
26079 + return __COMPAT_NO_ID(vc_get_iattr, data, compat);
26080 + case VCMD_set_iattr:
26081 + return __COMPAT_NO_ID(vc_set_iattr, data, compat);
26083 + case VCMD_fget_iattr:
26084 + return vc_fget_iattr(id, data);
26085 + case VCMD_fset_iattr:
26086 + return vc_fset_iattr(id, data);
26088 + case VCMD_enter_space_v0:
26089 + return vc_enter_space_v1(vxi, NULL);
26090 + case VCMD_enter_space_v1:
26091 + return vc_enter_space_v1(vxi, data);
26092 + /* this is version 2 */
26093 + case VCMD_enter_space:
26094 + return vc_enter_space(vxi, data);
26096 + case VCMD_ctx_create_v0:
26097 + return vc_ctx_create(id, NULL);
26098 + case VCMD_ctx_create:
26099 + return vc_ctx_create(id, data);
26100 + case VCMD_ctx_migrate_v0:
26101 + return vc_ctx_migrate(vxi, NULL);
26102 + case VCMD_ctx_migrate:
26103 + return vc_ctx_migrate(vxi, data);
26105 + case VCMD_net_create_v0:
26106 + return vc_net_create(id, NULL);
26107 + case VCMD_net_create:
26108 + return vc_net_create(id, data);
26109 + case VCMD_net_migrate:
26110 + return vc_net_migrate(nxi, data);
26112 + case VCMD_tag_migrate:
26113 + return vc_tag_migrate(id);
26115 + case VCMD_net_add:
26116 + return vc_net_add(nxi, data);
26117 + case VCMD_net_remove:
26118 + return vc_net_remove(nxi, data);
26120 + case VCMD_net_add_ipv4:
26121 + return vc_net_add_ipv4(nxi, data);
26122 + case VCMD_net_remove_ipv4:
26123 + return vc_net_remove_ipv4(nxi, data);
26124 +#ifdef CONFIG_IPV6
26125 + case VCMD_net_add_ipv6:
26126 + return vc_net_add_ipv6(nxi, data);
26127 + case VCMD_net_remove_ipv6:
26128 + return vc_net_remove_ipv6(nxi, data);
26130 +/* case VCMD_add_match_ipv4:
26131 + return vc_add_match_ipv4(nxi, data);
26132 + case VCMD_get_match_ipv4:
26133 + return vc_get_match_ipv4(nxi, data);
26134 +#ifdef CONFIG_IPV6
26135 + case VCMD_add_match_ipv6:
26136 + return vc_add_match_ipv6(nxi, data);
26137 + case VCMD_get_match_ipv6:
26138 + return vc_get_match_ipv6(nxi, data);
26141 +#ifdef CONFIG_VSERVER_DEVICE
26142 + case VCMD_set_mapping:
26143 + return __COMPAT(vc_set_mapping, vxi, data, compat);
26144 + case VCMD_unset_mapping:
26145 + return __COMPAT(vc_unset_mapping, vxi, data, compat);
26147 +#ifdef CONFIG_VSERVER_HISTORY
26148 + case VCMD_dump_history:
26149 + return vc_dump_history(id);
26150 + case VCMD_read_history:
26151 + return __COMPAT(vc_read_history, id, data, compat);
26153 +#ifdef CONFIG_VSERVER_MONITOR
26154 + case VCMD_read_monitor:
26155 + return __COMPAT(vc_read_monitor, id, data, compat);
26158 + vxwprintk_task(1, "unimplemented VCMD_%02d_%d[%d]",
26159 + VC_CATEGORY(cmd), VC_COMMAND(cmd), VC_VERSION(cmd));
26165 +#define __VCMD(vcmd, _perm, _args, _flags) \
26166 + case VCMD_ ## vcmd: perm = _perm; \
26167 + args = _args; flags = _flags; break
26170 +#define VCA_NONE 0x00
26171 +#define VCA_VXI 0x01
26172 +#define VCA_NXI 0x02
26174 +#define VCF_NONE 0x00
26175 +#define VCF_INFO 0x01
26176 +#define VCF_ADMIN 0x02
26177 +#define VCF_ARES 0x06 /* includes admin */
26178 +#define VCF_SETUP 0x08
26180 +#define VCF_ZIDOK 0x10 /* zero id okay */
26184 +long do_vserver(uint32_t cmd, uint32_t id, void __user *data, int compat)
26187 + int permit = -1, state = 0;
26188 + int perm = -1, args = 0, flags = 0;
26189 + struct vx_info *vxi = NULL;
26190 + struct nx_info *nxi = NULL;
26193 + /* unpriviledged commands */
26194 + __VCMD(get_version, 0, VCA_NONE, 0);
26195 + __VCMD(get_vci, 0, VCA_NONE, 0);
26196 + __VCMD(get_rlimit_mask, 0, VCA_NONE, 0);
26197 + __VCMD(get_space_mask_v0,0, VCA_NONE, 0);
26198 + __VCMD(get_space_mask, 0, VCA_NONE, 0);
26199 + __VCMD(get_space_default,0, VCA_NONE, 0);
26201 + /* info commands */
26202 + __VCMD(task_xid, 2, VCA_NONE, 0);
26203 + __VCMD(reset_hits, 2, VCA_VXI, 0);
26204 + __VCMD(reset_minmax, 2, VCA_VXI, 0);
26205 + __VCMD(vx_info, 3, VCA_VXI, VCF_INFO);
26206 + __VCMD(get_bcaps, 3, VCA_VXI, VCF_INFO);
26207 + __VCMD(get_ccaps, 3, VCA_VXI, VCF_INFO);
26208 + __VCMD(get_cflags, 3, VCA_VXI, VCF_INFO);
26209 + __VCMD(get_badness, 3, VCA_VXI, VCF_INFO);
26210 + __VCMD(get_vhi_name, 3, VCA_VXI, VCF_INFO);
26211 + __VCMD(get_rlimit, 3, VCA_VXI, VCF_INFO);
26213 + __VCMD(ctx_stat, 3, VCA_VXI, VCF_INFO);
26214 + __VCMD(virt_stat, 3, VCA_VXI, VCF_INFO);
26215 + __VCMD(sock_stat, 3, VCA_VXI, VCF_INFO);
26216 + __VCMD(rlimit_stat, 3, VCA_VXI, VCF_INFO);
26218 + __VCMD(task_nid, 2, VCA_NONE, 0);
26219 + __VCMD(nx_info, 3, VCA_NXI, VCF_INFO);
26220 + __VCMD(get_ncaps, 3, VCA_NXI, VCF_INFO);
26221 + __VCMD(get_nflags, 3, VCA_NXI, VCF_INFO);
26223 + __VCMD(task_tag, 2, VCA_NONE, 0);
26225 + __VCMD(get_iattr, 2, VCA_NONE, 0);
26226 + __VCMD(fget_iattr, 2, VCA_NONE, 0);
26227 + __VCMD(get_dlimit, 3, VCA_NONE, VCF_INFO);
26228 + __VCMD(get_sched, 3, VCA_VXI, VCF_INFO);
26229 + __VCMD(sched_info, 3, VCA_VXI, VCF_INFO | VCF_ZIDOK);
26231 + /* lower admin commands */
26232 + __VCMD(wait_exit, 4, VCA_VXI, VCF_INFO);
26233 + __VCMD(ctx_create_v0, 5, VCA_NONE, 0);
26234 + __VCMD(ctx_create, 5, VCA_NONE, 0);
26235 + __VCMD(ctx_migrate_v0, 5, VCA_VXI, VCF_ADMIN);
26236 + __VCMD(ctx_migrate, 5, VCA_VXI, VCF_ADMIN);
26237 + __VCMD(enter_space_v0, 5, VCA_VXI, VCF_ADMIN);
26238 + __VCMD(enter_space_v1, 5, VCA_VXI, VCF_ADMIN);
26239 + __VCMD(enter_space, 5, VCA_VXI, VCF_ADMIN);
26241 + __VCMD(net_create_v0, 5, VCA_NONE, 0);
26242 + __VCMD(net_create, 5, VCA_NONE, 0);
26243 + __VCMD(net_migrate, 5, VCA_NXI, VCF_ADMIN);
26245 + __VCMD(tag_migrate, 5, VCA_NONE, VCF_ADMIN);
26247 + /* higher admin commands */
26248 + __VCMD(ctx_kill, 6, VCA_VXI, VCF_ARES);
26249 + __VCMD(set_space_v1, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26250 + __VCMD(set_space, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26252 + __VCMD(set_ccaps, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26253 + __VCMD(set_bcaps, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26254 + __VCMD(set_cflags, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26255 + __VCMD(set_badness, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26257 + __VCMD(set_vhi_name, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26258 + __VCMD(set_rlimit, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26259 + __VCMD(set_sched, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26260 + __VCMD(set_sched_v4, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26262 + __VCMD(set_ncaps, 7, VCA_NXI, VCF_ARES | VCF_SETUP);
26263 + __VCMD(set_nflags, 7, VCA_NXI, VCF_ARES | VCF_SETUP);
26264 + __VCMD(net_add, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26265 + __VCMD(net_remove, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26266 + __VCMD(net_add_ipv4, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26267 + __VCMD(net_remove_ipv4, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26268 +#ifdef CONFIG_IPV6
26269 + __VCMD(net_add_ipv6, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26270 + __VCMD(net_remove_ipv6, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26272 + __VCMD(set_iattr, 7, VCA_NONE, 0);
26273 + __VCMD(fset_iattr, 7, VCA_NONE, 0);
26274 + __VCMD(set_dlimit, 7, VCA_NONE, VCF_ARES);
26275 + __VCMD(add_dlimit, 8, VCA_NONE, VCF_ARES);
26276 + __VCMD(rem_dlimit, 8, VCA_NONE, VCF_ARES);
26278 +#ifdef CONFIG_VSERVER_DEVICE
26279 + __VCMD(set_mapping, 8, VCA_VXI, VCF_ARES|VCF_ZIDOK);
26280 + __VCMD(unset_mapping, 8, VCA_VXI, VCF_ARES|VCF_ZIDOK);
26282 + /* debug level admin commands */
26283 +#ifdef CONFIG_VSERVER_HISTORY
26284 + __VCMD(dump_history, 9, VCA_NONE, 0);
26285 + __VCMD(read_history, 9, VCA_NONE, 0);
26287 +#ifdef CONFIG_VSERVER_MONITOR
26288 + __VCMD(read_monitor, 9, VCA_NONE, 0);
26295 + vxdprintk(VXD_CBIT(switch, 0),
26296 + "vc: VCMD_%02d_%d[%d], %d,%p [%d,%d,%x,%x]",
26297 + VC_CATEGORY(cmd), VC_COMMAND(cmd),
26298 + VC_VERSION(cmd), id, data, compat,
26299 + perm, args, flags);
26306 + if (!capable(CAP_CONTEXT))
26310 + /* moved here from the individual commands */
26312 + if ((perm > 1) && !capable(CAP_SYS_ADMIN))
26316 + /* vcmd involves resource management */
26318 + if ((flags & VCF_ARES) && !capable(CAP_SYS_RESOURCE))
26322 + /* various legacy exceptions */
26324 + /* will go away when spectator is a cap */
26325 + case VCMD_ctx_migrate_v0:
26326 + case VCMD_ctx_migrate:
26328 + current->xid = 1;
26334 + /* will go away when spectator is a cap */
26335 + case VCMD_net_migrate:
26337 + current->nid = 1;
26344 + /* vcmds are fine by default */
26347 + /* admin type vcmds require admin ... */
26348 + if (flags & VCF_ADMIN)
26349 + permit = vx_check(0, VS_ADMIN) ? 1 : 0;
26351 + /* ... but setup type vcmds override that */
26352 + if (!permit && (flags & VCF_SETUP))
26353 + permit = vx_flags(VXF_STATE_SETUP, 0) ? 2 : 0;
26361 + if (!id && (flags & VCF_ZIDOK))
26365 + if (args & VCA_VXI) {
26366 + vxi = lookup_vx_info(id);
26370 + if ((flags & VCF_ADMIN) &&
26371 + /* special case kill for shutdown */
26372 + (cmd != VCMD_ctx_kill) &&
26373 + /* can context be administrated? */
26374 + !vx_info_flags(vxi, VXF_STATE_ADMIN, 0)) {
26380 + if (args & VCA_NXI) {
26381 + nxi = lookup_nx_info(id);
26385 + if ((flags & VCF_ADMIN) &&
26386 + /* can context be administrated? */
26387 + !nx_info_flags(nxi, NXF_STATE_ADMIN, 0)) {
26394 + ret = do_vcmd(cmd, id, vxi, nxi, data, compat);
26397 + if ((args & VCA_NXI) && nxi)
26398 + put_nx_info(nxi);
26400 + if ((args & VCA_VXI) && vxi)
26401 + put_vx_info(vxi);
26403 + vxdprintk(VXD_CBIT(switch, 1),
26404 + "vc: VCMD_%02d_%d[%d] = %08lx(%ld) [%d,%d]",
26405 + VC_CATEGORY(cmd), VC_COMMAND(cmd),
26406 + VC_VERSION(cmd), ret, ret, state, permit);
26411 +sys_vserver(uint32_t cmd, uint32_t id, void __user *data)
26413 + return do_vserver(cmd, id, data, 0);
26416 +#ifdef CONFIG_COMPAT
26419 +sys32_vserver(uint32_t cmd, uint32_t id, void __user *data)
26421 + return do_vserver(cmd, id, data, 1);
26424 +#endif /* CONFIG_COMPAT */
26425 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/sysctl.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/sysctl.c
26426 --- linux-2.6.33.2/kernel/vserver/sysctl.c 1970-01-01 01:00:00.000000000 +0100
26427 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/sysctl.c 2010-02-25 15:14:16.000000000 +0100
26430 + * kernel/vserver/sysctl.c
26432 + * Virtual Context Support
26434 + * Copyright (C) 2004-2007 Herbert Pötzl
26436 + * V0.01 basic structure
26440 +#include <linux/module.h>
26441 +#include <linux/ctype.h>
26442 +#include <linux/sysctl.h>
26443 +#include <linux/parser.h>
26444 +#include <asm/uaccess.h>
26447 + CTL_DEBUG_ERROR = 0,
26448 + CTL_DEBUG_SWITCH = 1,
26463 +unsigned int vx_debug_switch = 0;
26464 +unsigned int vx_debug_xid = 0;
26465 +unsigned int vx_debug_nid = 0;
26466 +unsigned int vx_debug_tag = 0;
26467 +unsigned int vx_debug_net = 0;
26468 +unsigned int vx_debug_limit = 0;
26469 +unsigned int vx_debug_cres = 0;
26470 +unsigned int vx_debug_dlim = 0;
26471 +unsigned int vx_debug_quota = 0;
26472 +unsigned int vx_debug_cvirt = 0;
26473 +unsigned int vx_debug_space = 0;
26474 +unsigned int vx_debug_misc = 0;
26477 +static struct ctl_table_header *vserver_table_header;
26478 +static ctl_table vserver_root_table[];
26481 +void vserver_register_sysctl(void)
26483 + if (!vserver_table_header) {
26484 + vserver_table_header = register_sysctl_table(vserver_root_table);
26489 +void vserver_unregister_sysctl(void)
26491 + if (vserver_table_header) {
26492 + unregister_sysctl_table(vserver_table_header);
26493 + vserver_table_header = NULL;
26498 +static int proc_dodebug(ctl_table *table, int write,
26499 + void __user *buffer, size_t *lenp, loff_t *ppos)
26501 + char tmpbuf[20], *p, c;
26502 + unsigned int value;
26503 + size_t left, len;
26505 + if ((*ppos && !write) || !*lenp) {
26513 + if (!access_ok(VERIFY_READ, buffer, left))
26515 + p = (char *)buffer;
26516 + while (left && __get_user(c, p) >= 0 && isspace(c))
26521 + if (left > sizeof(tmpbuf) - 1)
26523 + if (copy_from_user(tmpbuf, p, left))
26525 + tmpbuf[left] = '\0';
26527 + for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
26528 + value = 10 * value + (*p - '0');
26529 + if (*p && !isspace(*p))
26531 + while (left && isspace(*p))
26533 + *(unsigned int *)table->data = value;
26535 + if (!access_ok(VERIFY_WRITE, buffer, left))
26537 + len = sprintf(tmpbuf, "%d", *(unsigned int *)table->data);
26540 + if (__copy_to_user(buffer, tmpbuf, len))
26542 + if ((left -= len) > 0) {
26543 + if (put_user('\n', (char *)buffer + len))
26557 +#define CTL_ENTRY(ctl, name) \
26559 + .procname = #name, \
26560 + .data = &vx_ ## name, \
26561 + .maxlen = sizeof(int), \
26563 + .proc_handler = &proc_dodebug, \
26564 + .extra1 = &zero, \
26565 + .extra2 = &zero, \
26568 +static ctl_table vserver_debug_table[] = {
26569 + CTL_ENTRY(CTL_DEBUG_SWITCH, debug_switch),
26570 + CTL_ENTRY(CTL_DEBUG_XID, debug_xid),
26571 + CTL_ENTRY(CTL_DEBUG_NID, debug_nid),
26572 + CTL_ENTRY(CTL_DEBUG_TAG, debug_tag),
26573 + CTL_ENTRY(CTL_DEBUG_NET, debug_net),
26574 + CTL_ENTRY(CTL_DEBUG_LIMIT, debug_limit),
26575 + CTL_ENTRY(CTL_DEBUG_CRES, debug_cres),
26576 + CTL_ENTRY(CTL_DEBUG_DLIM, debug_dlim),
26577 + CTL_ENTRY(CTL_DEBUG_QUOTA, debug_quota),
26578 + CTL_ENTRY(CTL_DEBUG_CVIRT, debug_cvirt),
26579 + CTL_ENTRY(CTL_DEBUG_SPACE, debug_space),
26580 + CTL_ENTRY(CTL_DEBUG_MISC, debug_misc),
26584 +static ctl_table vserver_root_table[] = {
26586 + .procname = "vserver",
26588 + .child = vserver_debug_table
26594 +static match_table_t tokens = {
26595 + { CTL_DEBUG_SWITCH, "switch=%x" },
26596 + { CTL_DEBUG_XID, "xid=%x" },
26597 + { CTL_DEBUG_NID, "nid=%x" },
26598 + { CTL_DEBUG_TAG, "tag=%x" },
26599 + { CTL_DEBUG_NET, "net=%x" },
26600 + { CTL_DEBUG_LIMIT, "limit=%x" },
26601 + { CTL_DEBUG_CRES, "cres=%x" },
26602 + { CTL_DEBUG_DLIM, "dlim=%x" },
26603 + { CTL_DEBUG_QUOTA, "quota=%x" },
26604 + { CTL_DEBUG_CVIRT, "cvirt=%x" },
26605 + { CTL_DEBUG_SPACE, "space=%x" },
26606 + { CTL_DEBUG_MISC, "misc=%x" },
26607 + { CTL_DEBUG_ERROR, NULL }
26610 +#define HANDLE_CASE(id, name, val) \
26611 + case CTL_DEBUG_ ## id: \
26612 + vx_debug_ ## name = val; \
26613 + printk("vs_debug_" #name "=0x%x\n", val); \
26617 +static int __init vs_debug_setup(char *str)
26622 + printk("vs_debug_setup(%s)\n", str);
26623 + while ((p = strsep(&str, ",")) != NULL) {
26624 + substring_t args[MAX_OPT_ARGS];
26625 + unsigned int value;
26630 + token = match_token(p, tokens, args);
26631 + value = (token > 0) ? simple_strtoul(args[0].from, NULL, 0) : 0;
26634 + HANDLE_CASE(SWITCH, switch, value);
26635 + HANDLE_CASE(XID, xid, value);
26636 + HANDLE_CASE(NID, nid, value);
26637 + HANDLE_CASE(TAG, tag, value);
26638 + HANDLE_CASE(NET, net, value);
26639 + HANDLE_CASE(LIMIT, limit, value);
26640 + HANDLE_CASE(CRES, cres, value);
26641 + HANDLE_CASE(DLIM, dlim, value);
26642 + HANDLE_CASE(QUOTA, quota, value);
26643 + HANDLE_CASE(CVIRT, cvirt, value);
26644 + HANDLE_CASE(SPACE, space, value);
26645 + HANDLE_CASE(MISC, misc, value);
26654 +__setup("vsdebug=", vs_debug_setup);
26658 +EXPORT_SYMBOL_GPL(vx_debug_switch);
26659 +EXPORT_SYMBOL_GPL(vx_debug_xid);
26660 +EXPORT_SYMBOL_GPL(vx_debug_nid);
26661 +EXPORT_SYMBOL_GPL(vx_debug_net);
26662 +EXPORT_SYMBOL_GPL(vx_debug_limit);
26663 +EXPORT_SYMBOL_GPL(vx_debug_cres);
26664 +EXPORT_SYMBOL_GPL(vx_debug_dlim);
26665 +EXPORT_SYMBOL_GPL(vx_debug_quota);
26666 +EXPORT_SYMBOL_GPL(vx_debug_cvirt);
26667 +EXPORT_SYMBOL_GPL(vx_debug_space);
26668 +EXPORT_SYMBOL_GPL(vx_debug_misc);
26670 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/tag.c linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/tag.c
26671 --- linux-2.6.33.2/kernel/vserver/tag.c 1970-01-01 01:00:00.000000000 +0100
26672 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/tag.c 2010-02-25 12:02:16.000000000 +0100
26675 + * linux/kernel/vserver/tag.c
26677 + * Virtual Server: Shallow Tag Space
26679 + * Copyright (C) 2007 Herbert Pötzl
26681 + * V0.01 basic implementation
26685 +#include <linux/sched.h>
26686 +#include <linux/vserver/debug.h>
26687 +#include <linux/vs_pid.h>
26688 +#include <linux/vs_tag.h>
26690 +#include <linux/vserver/tag_cmd.h>
26693 +int dx_migrate_task(struct task_struct *p, tag_t tag)
26698 + vxdprintk(VXD_CBIT(tag, 5),
26699 + "dx_migrate_task(%p[#%d],#%d)", p, p->tag, tag);
26705 + vxdprintk(VXD_CBIT(tag, 5),
26706 + "moved task %p into [#%d]", p, tag);
26710 +/* vserver syscall commands below here */
26712 +/* taks xid and vx_info functions */
26715 +int vc_task_tag(uint32_t id)
26720 + struct task_struct *tsk;
26721 + read_lock(&tasklist_lock);
26722 + tsk = find_task_by_real_pid(id);
26723 + tag = (tsk) ? tsk->tag : -ESRCH;
26724 + read_unlock(&tasklist_lock);
26726 + tag = dx_current_tag();
26731 +int vc_tag_migrate(uint32_t tag)
26733 + return dx_migrate_task(current, tag & 0xFFFF);
26737 diff -NurpP --minimal linux-2.6.33.2/kernel/vserver/vci_config.h linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/vci_config.h
26738 --- linux-2.6.33.2/kernel/vserver/vci_config.h 1970-01-01 01:00:00.000000000 +0100
26739 +++ linux-2.6.33.2-vs2.3.0.36.30.4/kernel/vserver/vci_config.h 2010-02-25 12:02:16.000000000 +0100
26742 +/* interface version */
26744 +#define VCI_VERSION 0x00020305
26748 + VCI_KCBIT_NO_DYNAMIC = 0,
26750 + VCI_KCBIT_PROC_SECURE = 4,
26751 + VCI_KCBIT_HARDCPU = 5,
26752 + VCI_KCBIT_IDLELIMIT = 6,
26753 + VCI_KCBIT_IDLETIME = 7,
26755 + VCI_KCBIT_COWBL = 8,
26756 + VCI_KCBIT_FULLCOWBL = 9,
26757 + VCI_KCBIT_SPACES = 10,
26758 + VCI_KCBIT_NETV2 = 11,
26760 + VCI_KCBIT_DEBUG = 16,
26761 + VCI_KCBIT_HISTORY = 20,
26762 + VCI_KCBIT_TAGGED = 24,
26763 + VCI_KCBIT_PPTAG = 28,
26765 + VCI_KCBIT_MORE = 31,
26769 +static inline uint32_t vci_kernel_config(void)
26772 + (1 << VCI_KCBIT_NO_DYNAMIC) |
26774 + /* configured features */
26775 +#ifdef CONFIG_VSERVER_PROC_SECURE
26776 + (1 << VCI_KCBIT_PROC_SECURE) |
26778 +#ifdef CONFIG_VSERVER_HARDCPU
26779 + (1 << VCI_KCBIT_HARDCPU) |
26781 +#ifdef CONFIG_VSERVER_IDLELIMIT
26782 + (1 << VCI_KCBIT_IDLELIMIT) |
26784 +#ifdef CONFIG_VSERVER_IDLETIME
26785 + (1 << VCI_KCBIT_IDLETIME) |
26787 +#ifdef CONFIG_VSERVER_COWBL
26788 + (1 << VCI_KCBIT_COWBL) |
26789 + (1 << VCI_KCBIT_FULLCOWBL) |
26791 + (1 << VCI_KCBIT_SPACES) |
26792 + (1 << VCI_KCBIT_NETV2) |
26794 + /* debug options */
26795 +#ifdef CONFIG_VSERVER_DEBUG
26796 + (1 << VCI_KCBIT_DEBUG) |
26798 +#ifdef CONFIG_VSERVER_HISTORY
26799 + (1 << VCI_KCBIT_HISTORY) |
26802 + /* inode context tagging */
26803 +#if defined(CONFIG_TAGGING_NONE)
26804 + (0 << VCI_KCBIT_TAGGED) |
26805 +#elif defined(CONFIG_TAGGING_UID16)
26806 + (1 << VCI_KCBIT_TAGGED) |
26807 +#elif defined(CONFIG_TAGGING_GID16)
26808 + (2 << VCI_KCBIT_TAGGED) |
26809 +#elif defined(CONFIG_TAGGING_ID24)
26810 + (3 << VCI_KCBIT_TAGGED) |
26811 +#elif defined(CONFIG_TAGGING_INTERN)
26812 + (4 << VCI_KCBIT_TAGGED) |
26813 +#elif defined(CONFIG_TAGGING_RUNTIME)
26814 + (5 << VCI_KCBIT_TAGGED) |
26816 + (7 << VCI_KCBIT_TAGGED) |
26818 + (1 << VCI_KCBIT_PPTAG) |
26822 diff -NurpP --minimal linux-2.6.33.2/mm/filemap_xip.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/filemap_xip.c
26823 --- linux-2.6.33.2/mm/filemap_xip.c 2009-12-03 20:02:58.000000000 +0100
26824 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/filemap_xip.c 2010-02-25 12:02:16.000000000 +0100
26826 #include <linux/sched.h>
26827 #include <linux/seqlock.h>
26828 #include <linux/mutex.h>
26829 +#include <linux/vs_memory.h>
26830 #include <asm/tlbflush.h>
26831 #include <asm/io.h>
26833 diff -NurpP --minimal linux-2.6.33.2/mm/fremap.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/fremap.c
26834 --- linux-2.6.33.2/mm/fremap.c 2009-03-24 14:22:45.000000000 +0100
26835 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/fremap.c 2010-02-25 12:02:16.000000000 +0100
26837 #include <linux/module.h>
26838 #include <linux/syscalls.h>
26839 #include <linux/mmu_notifier.h>
26840 +#include <linux/vs_memory.h>
26842 #include <asm/mmu_context.h>
26843 #include <asm/cacheflush.h>
26844 diff -NurpP --minimal linux-2.6.33.2/mm/hugetlb.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/hugetlb.c
26845 --- linux-2.6.33.2/mm/hugetlb.c 2010-02-25 11:52:09.000000000 +0100
26846 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/hugetlb.c 2010-02-25 12:16:11.000000000 +0100
26849 #include <linux/hugetlb.h>
26850 #include <linux/node.h>
26851 +#include <linux/vs_memory.h>
26852 #include "internal.h"
26854 const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
26855 diff -NurpP --minimal linux-2.6.33.2/mm/memcontrol.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/memcontrol.c
26856 --- linux-2.6.33.2/mm/memcontrol.c 2010-02-25 11:52:09.000000000 +0100
26857 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/memcontrol.c 2010-02-26 10:04:15.000000000 +0100
26858 @@ -555,6 +555,31 @@ struct mem_cgroup *mem_cgroup_from_task(
26859 struct mem_cgroup, css);
26862 +u64 mem_cgroup_res_read_u64(struct mem_cgroup *mem, int member)
26864 + return res_counter_read_u64(&mem->res, member);
26867 +u64 mem_cgroup_memsw_read_u64(struct mem_cgroup *mem, int member)
26869 + return res_counter_read_u64(&mem->memsw, member);
26872 +s64 mem_cgroup_stat_read_cache(struct mem_cgroup *mem)
26874 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_CACHE);
26877 +s64 mem_cgroup_stat_read_anon(struct mem_cgroup *mem)
26879 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_RSS);
26882 +s64 mem_cgroup_stat_read_mapped(struct mem_cgroup *mem)
26884 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_FILE_MAPPED);
26887 static struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
26889 struct mem_cgroup *mem = NULL;
26890 diff -NurpP --minimal linux-2.6.33.2/mm/memory.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/memory.c
26891 --- linux-2.6.33.2/mm/memory.c 2010-02-25 11:52:09.000000000 +0100
26892 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/memory.c 2010-02-25 12:02:16.000000000 +0100
26894 #include <linux/kallsyms.h>
26895 #include <linux/swapops.h>
26896 #include <linux/elf.h>
26897 +// #include <linux/vs_memory.h>
26899 #include <asm/io.h>
26900 #include <asm/pgalloc.h>
26901 @@ -651,6 +652,9 @@ static int copy_pte_range(struct mm_stru
26903 swp_entry_t entry = (swp_entry_t){0};
26905 + if (!vx_rss_avail(dst_mm, ((end - addr)/PAGE_SIZE + 1)))
26909 rss[1] = rss[0] = 0;
26910 dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl);
26911 @@ -2670,6 +2674,8 @@ static int do_anonymous_page(struct mm_s
26912 /* Allocate our own private page. */
26913 pte_unmap(page_table);
26915 + if (!vx_rss_avail(mm, 1))
26917 if (unlikely(anon_vma_prepare(vma)))
26919 page = alloc_zeroed_user_highpage_movable(vma, address);
26920 @@ -2961,6 +2967,7 @@ static inline int handle_pte_fault(struc
26924 + int ret = 0, type = VXPT_UNKNOWN;
26927 if (!pte_present(entry)) {
26928 @@ -2985,9 +2992,12 @@ static inline int handle_pte_fault(struc
26929 if (unlikely(!pte_same(*pte, entry)))
26931 if (flags & FAULT_FLAG_WRITE) {
26932 - if (!pte_write(entry))
26933 - return do_wp_page(mm, vma, address,
26934 + if (!pte_write(entry)) {
26935 + ret = do_wp_page(mm, vma, address,
26936 pte, pmd, ptl, entry);
26937 + type = VXPT_WRITE;
26940 entry = pte_mkdirty(entry);
26942 entry = pte_mkyoung(entry);
26943 @@ -3005,7 +3015,10 @@ static inline int handle_pte_fault(struc
26946 pte_unmap_unlock(pte, ptl);
26950 + vx_page_fault(mm, vma, type, ret);
26955 diff -NurpP --minimal linux-2.6.33.2/mm/mlock.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/mlock.c
26956 --- linux-2.6.33.2/mm/mlock.c 2010-02-25 11:52:09.000000000 +0100
26957 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/mlock.c 2010-02-25 12:02:16.000000000 +0100
26959 #include <linux/rmap.h>
26960 #include <linux/mmzone.h>
26961 #include <linux/hugetlb.h>
26962 +#include <linux/vs_memory.h>
26964 #include "internal.h"
26966 @@ -398,7 +399,7 @@ success:
26967 nr_pages = (end - start) >> PAGE_SHIFT;
26969 nr_pages = -nr_pages;
26970 - mm->locked_vm += nr_pages;
26971 + vx_vmlocked_add(mm, nr_pages);
26974 * vm_flags is protected by the mmap_sem held in write mode.
26975 @@ -471,7 +472,7 @@ static int do_mlock(unsigned long start,
26977 SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
26979 - unsigned long locked;
26980 + unsigned long locked, grow;
26981 unsigned long lock_limit;
26982 int error = -ENOMEM;
26984 @@ -484,8 +485,10 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
26985 len = PAGE_ALIGN(len + (start & ~PAGE_MASK));
26986 start &= PAGE_MASK;
26988 - locked = len >> PAGE_SHIFT;
26989 - locked += current->mm->locked_vm;
26990 + grow = len >> PAGE_SHIFT;
26991 + if (!vx_vmlocked_avail(current->mm, grow))
26993 + locked = current->mm->locked_vm + grow;
26995 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
26996 lock_limit >>= PAGE_SHIFT;
26997 @@ -493,6 +496,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
26998 /* check against resource limits */
26999 if ((locked <= lock_limit) || capable(CAP_IPC_LOCK))
27000 error = do_mlock(start, len, 1);
27002 up_write(¤t->mm->mmap_sem);
27005 @@ -554,6 +558,8 @@ SYSCALL_DEFINE1(mlockall, int, flags)
27006 lock_limit >>= PAGE_SHIFT;
27009 + if (!vx_vmlocked_avail(current->mm, current->mm->total_vm))
27011 if (!(flags & MCL_CURRENT) || (current->mm->total_vm <= lock_limit) ||
27012 capable(CAP_IPC_LOCK))
27013 ret = do_mlockall(flags);
27014 @@ -628,8 +634,10 @@ int account_locked_memory(struct mm_stru
27018 - mm->total_vm += pgsz;
27019 - mm->locked_vm += pgsz;
27020 + // mm->total_vm += pgsz;
27021 + vx_vmpages_add(mm, pgsz);
27022 + // mm->locked_vm += pgsz;
27023 + vx_vmlocked_add(mm, pgsz);
27027 @@ -643,8 +651,10 @@ void refund_locked_memory(struct mm_stru
27029 down_write(&mm->mmap_sem);
27031 - mm->total_vm -= pgsz;
27032 - mm->locked_vm -= pgsz;
27033 + // mm->total_vm -= pgsz;
27034 + vx_vmpages_sub(mm, pgsz);
27035 + // mm->locked_vm -= pgsz;
27036 + vx_vmlocked_sub(mm, pgsz);
27038 up_write(&mm->mmap_sem);
27040 diff -NurpP --minimal linux-2.6.33.2/mm/mmap.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/mmap.c
27041 --- linux-2.6.33.2/mm/mmap.c 2010-02-25 11:52:09.000000000 +0100
27042 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/mmap.c 2010-02-25 12:02:16.000000000 +0100
27043 @@ -1262,7 +1262,8 @@ munmap_back:
27045 perf_event_mmap(vma);
27047 - mm->total_vm += len >> PAGE_SHIFT;
27048 + // mm->total_vm += len >> PAGE_SHIFT;
27049 + vx_vmpages_add(mm, len >> PAGE_SHIFT);
27050 vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
27051 if (vm_flags & VM_LOCKED) {
27053 @@ -1271,7 +1272,8 @@ out:
27054 long nr_pages = mlock_vma_pages_range(vma, addr, addr + len);
27056 return nr_pages; /* vma gone! */
27057 - mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages;
27058 + // mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages;
27059 + vx_vmlocked_add(mm, (len >> PAGE_SHIFT) - nr_pages);
27060 } else if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK))
27061 make_pages_present(addr, addr + len);
27063 @@ -1626,9 +1628,9 @@ static int acct_stack_growth(struct vm_a
27066 /* Ok, everything looks good - let it rip */
27067 - mm->total_vm += grow;
27068 + vx_vmpages_add(mm, grow);
27069 if (vma->vm_flags & VM_LOCKED)
27070 - mm->locked_vm += grow;
27071 + vx_vmlocked_add(mm, grow);
27072 vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow);
27075 @@ -1803,7 +1805,8 @@ static void remove_vma_list(struct mm_st
27077 long nrpages = vma_pages(vma);
27079 - mm->total_vm -= nrpages;
27080 + // mm->total_vm -= nrpages;
27081 + vx_vmpages_sub(mm, nrpages);
27082 vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
27083 vma = remove_vma(vma);
27085 @@ -1995,7 +1998,8 @@ int do_munmap(struct mm_struct *mm, unsi
27086 struct vm_area_struct *tmp = vma;
27087 while (tmp && tmp->vm_start < end) {
27088 if (tmp->vm_flags & VM_LOCKED) {
27089 - mm->locked_vm -= vma_pages(tmp);
27090 + // mm->locked_vm -= vma_pages(tmp);
27091 + vx_vmlocked_sub(mm, vma_pages(tmp));
27092 munlock_vma_pages_all(tmp);
27094 tmp = tmp->vm_next;
27095 @@ -2078,6 +2082,8 @@ unsigned long do_brk(unsigned long addr,
27096 lock_limit >>= PAGE_SHIFT;
27097 if (locked > lock_limit && !capable(CAP_IPC_LOCK))
27099 + if (!vx_vmlocked_avail(mm, len >> PAGE_SHIFT))
27104 @@ -2104,7 +2110,8 @@ unsigned long do_brk(unsigned long addr,
27105 if (mm->map_count > sysctl_max_map_count)
27108 - if (security_vm_enough_memory(len >> PAGE_SHIFT))
27109 + if (security_vm_enough_memory(len >> PAGE_SHIFT) ||
27110 + !vx_vmpages_avail(mm, len >> PAGE_SHIFT))
27113 /* Can we just expand an old private anonymous mapping? */
27114 @@ -2130,10 +2137,13 @@ unsigned long do_brk(unsigned long addr,
27115 vma->vm_page_prot = vm_get_page_prot(flags);
27116 vma_link(mm, vma, prev, rb_link, rb_parent);
27118 - mm->total_vm += len >> PAGE_SHIFT;
27119 + // mm->total_vm += len >> PAGE_SHIFT;
27120 + vx_vmpages_add(mm, len >> PAGE_SHIFT);
27122 if (flags & VM_LOCKED) {
27123 if (!mlock_vma_pages_range(vma, addr, addr + len))
27124 - mm->locked_vm += (len >> PAGE_SHIFT);
27125 + // mm->locked_vm += (len >> PAGE_SHIFT);
27126 + vx_vmlocked_add(mm, len >> PAGE_SHIFT);
27130 @@ -2177,6 +2187,11 @@ void exit_mmap(struct mm_struct *mm)
27131 free_pgtables(tlb, vma, FIRST_USER_ADDRESS, 0);
27132 tlb_finish_mmu(tlb, 0, end);
27134 + set_mm_counter(mm, file_rss, 0);
27135 + set_mm_counter(mm, anon_rss, 0);
27136 + vx_vmpages_sub(mm, mm->total_vm);
27137 + vx_vmlocked_sub(mm, mm->locked_vm);
27140 * Walk the list again, actually closing and freeing it,
27141 * with preemption enabled, without holding any MM locks.
27142 @@ -2216,7 +2231,8 @@ int insert_vm_struct(struct mm_struct *
27143 if (__vma && __vma->vm_start < vma->vm_end)
27145 if ((vma->vm_flags & VM_ACCOUNT) &&
27146 - security_vm_enough_memory_mm(mm, vma_pages(vma)))
27147 + (security_vm_enough_memory_mm(mm, vma_pages(vma)) ||
27148 + !vx_vmpages_avail(mm, vma_pages(vma))))
27150 vma_link(mm, vma, prev, rb_link, rb_parent);
27152 @@ -2292,6 +2308,8 @@ int may_expand_vm(struct mm_struct *mm,
27154 if (cur + npages > lim)
27156 + if (!vx_vmpages_avail(mm, npages))
27161 @@ -2369,7 +2387,7 @@ int install_special_mapping(struct mm_st
27165 - mm->total_vm += len >> PAGE_SHIFT;
27166 + vx_vmpages_add(mm, len >> PAGE_SHIFT);
27168 perf_event_mmap(vma);
27170 diff -NurpP --minimal linux-2.6.33.2/mm/mremap.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/mremap.c
27171 --- linux-2.6.33.2/mm/mremap.c 2010-02-25 11:52:09.000000000 +0100
27172 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/mremap.c 2010-02-25 12:02:16.000000000 +0100
27174 #include <linux/security.h>
27175 #include <linux/syscalls.h>
27176 #include <linux/mmu_notifier.h>
27177 +#include <linux/vs_memory.h>
27179 #include <asm/uaccess.h>
27180 #include <asm/cacheflush.h>
27181 @@ -234,7 +235,7 @@ static unsigned long move_vma(struct vm_
27182 * If this were a serious issue, we'd add a flag to do_munmap().
27184 hiwater_vm = mm->hiwater_vm;
27185 - mm->total_vm += new_len >> PAGE_SHIFT;
27186 + vx_vmpages_add(mm, new_len >> PAGE_SHIFT);
27187 vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
27189 if (do_munmap(mm, old_addr, old_len) < 0) {
27190 @@ -252,7 +253,7 @@ static unsigned long move_vma(struct vm_
27193 if (vm_flags & VM_LOCKED) {
27194 - mm->locked_vm += new_len >> PAGE_SHIFT;
27195 + vx_vmlocked_add(mm, new_len >> PAGE_SHIFT);
27196 if (new_len > old_len)
27197 mlock_vma_pages_range(new_vma, new_addr + old_len,
27198 new_addr + new_len);
27199 @@ -463,10 +464,12 @@ unsigned long do_mremap(unsigned long ad
27200 vma_adjust(vma, vma->vm_start,
27201 addr + new_len, vma->vm_pgoff, NULL);
27203 - mm->total_vm += pages;
27204 + // mm->total_vm += pages;
27205 + vx_vmpages_add(mm, pages);
27206 vm_stat_account(mm, vma->vm_flags, vma->vm_file, pages);
27207 if (vma->vm_flags & VM_LOCKED) {
27208 - mm->locked_vm += pages;
27209 + // mm->locked_vm += pages;
27210 + vx_vmlocked_add(mm, pages);
27211 mlock_vma_pages_range(vma, addr + old_len,
27214 diff -NurpP --minimal linux-2.6.33.2/mm/nommu.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/nommu.c
27215 --- linux-2.6.33.2/mm/nommu.c 2010-02-25 11:52:09.000000000 +0100
27216 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/nommu.c 2010-02-25 12:02:16.000000000 +0100
27217 @@ -1349,7 +1349,7 @@ unsigned long do_mmap_pgoff(struct file
27218 /* okay... we have a mapping; now we have to register it */
27219 result = vma->vm_start;
27221 - current->mm->total_vm += len >> PAGE_SHIFT;
27222 + vx_vmpages_add(current->mm, len >> PAGE_SHIFT);
27225 add_vma_to_mm(current->mm, vma);
27226 @@ -1637,7 +1637,7 @@ void exit_mmap(struct mm_struct *mm)
27230 - mm->total_vm = 0;
27231 + vx_vmpages_sub(mm, mm->total_vm);
27233 while ((vma = mm->mmap)) {
27234 mm->mmap = vma->vm_next;
27235 diff -NurpP --minimal linux-2.6.33.2/mm/oom_kill.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/oom_kill.c
27236 --- linux-2.6.33.2/mm/oom_kill.c 2010-02-25 11:52:09.000000000 +0100
27237 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/oom_kill.c 2010-02-25 12:20:14.000000000 +0100
27239 #include <linux/notifier.h>
27240 #include <linux/memcontrol.h>
27241 #include <linux/security.h>
27242 +#include <linux/reboot.h>
27243 +#include <linux/vs_memory.h>
27244 +#include <linux/vs_context.h>
27246 int sysctl_panic_on_oom;
27247 int sysctl_oom_kill_allocating_task;
27248 @@ -186,9 +189,21 @@ unsigned long badness(struct task_struct
27249 points >>= -(oom_adj);
27253 + * add points for context badness and
27254 + * reduce badness for processes belonging to
27255 + * a different context
27258 + points += vx_badness(p, mm);
27260 + if ((vx_current_xid() > 1) &&
27261 + vx_current_xid() != vx_task_xid(p))
27265 - printk(KERN_DEBUG "OOMkill: task %d (%s) got %lu points\n",
27266 - p->pid, p->comm, points);
27267 + printk(KERN_DEBUG "OOMkill: task %d:#%u (%s) got %d points\n",
27268 + task_pid_nr(p), p->xid, p->comm, points);
27272 @@ -249,6 +264,7 @@ static struct task_struct *select_bad_pr
27273 struct task_struct *p;
27274 struct task_struct *chosen = NULL;
27275 struct timespec uptime;
27276 + unsigned xid = vx_current_xid();
27279 do_posix_clock_monotonic_gettime(&uptime);
27280 @@ -261,11 +277,14 @@ static struct task_struct *select_bad_pr
27284 - /* skip the init task */
27285 - if (is_global_init(p))
27286 + /* skip the init task, global and per guest */
27287 + if (task_is_init(p))
27289 if (mem && !task_in_mem_cgroup(p, mem))
27291 + /* skip other guest and host processes if oom in guest */
27292 + if (xid && vx_task_xid(p) != xid)
27296 * This task already has access to memory reserves and is
27297 @@ -397,9 +416,9 @@ static void __oom_kill_task(struct task_
27301 - printk(KERN_ERR "Killed process %d (%s) "
27302 + printk(KERN_ERR "Killed process %s(%d:#%u) "
27303 "vsz:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
27304 - task_pid_nr(p), p->comm,
27305 + p->comm, task_pid_nr(p), p->xid,
27306 K(p->mm->total_vm),
27307 K(get_mm_counter(p->mm, anon_rss)),
27308 K(get_mm_counter(p->mm, file_rss)));
27309 @@ -452,8 +471,8 @@ static int oom_kill_process(struct task_
27313 - printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n",
27314 - message, task_pid_nr(p), p->comm, points);
27315 + printk(KERN_ERR "%s: kill process %s(%d:#%u) score %li or a child\n",
27316 + message, p->comm, task_pid_nr(p), p->xid, points);
27318 /* Try to kill a child first */
27319 list_for_each_entry(c, &p->children, sibling) {
27320 @@ -554,6 +573,8 @@ void clear_zonelist_oom(struct zonelist
27321 spin_unlock(&zone_scan_lock);
27324 +long vs_oom_action(unsigned int);
27327 * Must be called with tasklist_lock held for read.
27329 @@ -580,7 +601,11 @@ retry:
27331 read_unlock(&tasklist_lock);
27332 dump_header(NULL, gfp_mask, order, NULL);
27333 - panic("Out of memory and no killable processes...\n");
27334 + /* avoid panic for guest OOM */
27335 + if (current->xid)
27336 + vs_oom_action(LINUX_REBOOT_CMD_OOM);
27338 + panic("Out of memory and no killable processes...\n");
27341 if (oom_kill_process(p, gfp_mask, order, points, NULL,
27342 diff -NurpP --minimal linux-2.6.33.2/mm/page_alloc.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/page_alloc.c
27343 --- linux-2.6.33.2/mm/page_alloc.c 2010-02-25 11:52:09.000000000 +0100
27344 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/page_alloc.c 2010-02-25 12:16:45.000000000 +0100
27346 #include <linux/debugobjects.h>
27347 #include <linux/kmemleak.h>
27348 #include <linux/memory.h>
27349 +#include <linux/vs_base.h>
27350 +#include <linux/vs_limit.h>
27351 #include <trace/events/kmem.h>
27353 #include <asm/tlbflush.h>
27354 @@ -2138,6 +2140,9 @@ void si_meminfo(struct sysinfo *val)
27355 val->totalhigh = totalhigh_pages;
27356 val->freehigh = nr_free_highpages();
27357 val->mem_unit = PAGE_SIZE;
27359 + if (vx_flags(VXF_VIRT_MEM, 0))
27360 + vx_vsi_meminfo(val);
27363 EXPORT_SYMBOL(si_meminfo);
27364 @@ -2158,6 +2163,9 @@ void si_meminfo_node(struct sysinfo *val
27367 val->mem_unit = PAGE_SIZE;
27369 + if (vx_flags(VXF_VIRT_MEM, 0))
27370 + vx_vsi_meminfo(val);
27374 diff -NurpP --minimal linux-2.6.33.2/mm/rmap.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/rmap.c
27375 --- linux-2.6.33.2/mm/rmap.c 2010-02-25 11:52:09.000000000 +0100
27376 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/rmap.c 2010-02-25 12:02:16.000000000 +0100
27378 #include <linux/memcontrol.h>
27379 #include <linux/mmu_notifier.h>
27380 #include <linux/migrate.h>
27381 +#include <linux/vs_memory.h>
27383 #include <asm/tlbflush.h>
27385 diff -NurpP --minimal linux-2.6.33.2/mm/shmem.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/shmem.c
27386 --- linux-2.6.33.2/mm/shmem.c 2010-02-25 11:52:09.000000000 +0100
27387 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/shmem.c 2010-02-25 12:02:16.000000000 +0100
27388 @@ -1788,7 +1788,7 @@ static int shmem_statfs(struct dentry *d
27390 struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
27392 - buf->f_type = TMPFS_MAGIC;
27393 + buf->f_type = TMPFS_SUPER_MAGIC;
27394 buf->f_bsize = PAGE_CACHE_SIZE;
27395 buf->f_namelen = NAME_MAX;
27396 spin_lock(&sbinfo->stat_lock);
27397 @@ -2358,7 +2358,7 @@ int shmem_fill_super(struct super_block
27398 sb->s_maxbytes = SHMEM_MAX_BYTES;
27399 sb->s_blocksize = PAGE_CACHE_SIZE;
27400 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
27401 - sb->s_magic = TMPFS_MAGIC;
27402 + sb->s_magic = TMPFS_SUPER_MAGIC;
27403 sb->s_op = &shmem_ops;
27404 sb->s_time_gran = 1;
27405 #ifdef CONFIG_TMPFS_POSIX_ACL
27406 diff -NurpP --minimal linux-2.6.33.2/mm/slab.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/slab.c
27407 --- linux-2.6.33.2/mm/slab.c 2010-04-06 01:47:46.000000000 +0200
27408 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/slab.c 2010-04-06 01:59:25.000000000 +0200
27409 @@ -431,6 +431,8 @@ static void kmem_list3_init(struct kmem_
27410 #define STATS_INC_FREEMISS(x) do { } while (0)
27413 +#include "slab_vs.h"
27418 @@ -3273,6 +3275,7 @@ retry:
27420 obj = slab_get_obj(cachep, slabp, nodeid);
27421 check_slabp(cachep, slabp);
27422 + vx_slab_alloc(cachep, flags);
27423 l3->free_objects--;
27424 /* move slabp to correct slabp list: */
27425 list_del(&slabp->list);
27426 @@ -3349,6 +3352,7 @@ __cache_alloc_node(struct kmem_cache *ca
27427 /* ___cache_alloc_node can fall back to other nodes */
27428 ptr = ____cache_alloc_node(cachep, flags, nodeid);
27430 + vx_slab_alloc(cachep, flags);
27431 local_irq_restore(save_flags);
27432 ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, caller);
27433 kmemleak_alloc_recursive(ptr, obj_size(cachep), 1, cachep->flags,
27434 @@ -3535,6 +3539,7 @@ static inline void __cache_free(struct k
27436 kmemleak_free_recursive(objp, cachep->flags);
27437 objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
27438 + vx_slab_free(cachep);
27440 kmemcheck_slab_free(cachep, objp, obj_size(cachep));
27442 diff -NurpP --minimal linux-2.6.33.2/mm/slab_vs.h linux-2.6.33.2-vs2.3.0.36.30.4/mm/slab_vs.h
27443 --- linux-2.6.33.2/mm/slab_vs.h 1970-01-01 01:00:00.000000000 +0100
27444 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/slab_vs.h 2010-02-25 12:02:16.000000000 +0100
27447 +#include <linux/vserver/context.h>
27449 +#include <linux/vs_context.h>
27452 +void vx_slab_alloc(struct kmem_cache *cachep, gfp_t flags)
27454 + int what = gfp_zone(cachep->gfpflags);
27455 + struct vx_info *vxi = current_vx_info();
27460 + atomic_add(cachep->buffer_size, &vxi->cacct.slab[what]);
27464 +void vx_slab_free(struct kmem_cache *cachep)
27466 + int what = gfp_zone(cachep->gfpflags);
27467 + struct vx_info *vxi = current_vx_info();
27472 + atomic_sub(cachep->buffer_size, &vxi->cacct.slab[what]);
27475 diff -NurpP --minimal linux-2.6.33.2/mm/swapfile.c linux-2.6.33.2-vs2.3.0.36.30.4/mm/swapfile.c
27476 --- linux-2.6.33.2/mm/swapfile.c 2010-02-25 11:52:09.000000000 +0100
27477 +++ linux-2.6.33.2-vs2.3.0.36.30.4/mm/swapfile.c 2010-02-25 12:02:16.000000000 +0100
27479 #include <asm/tlbflush.h>
27480 #include <linux/swapops.h>
27481 #include <linux/page_cgroup.h>
27482 +#include <linux/vs_base.h>
27483 +#include <linux/vs_memory.h>
27485 static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
27487 @@ -1693,6 +1695,16 @@ static int swap_show(struct seq_file *sw
27489 if (si == SEQ_START_TOKEN) {
27490 seq_puts(swap,"Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
27491 + if (vx_flags(VXF_VIRT_MEM, 0)) {
27492 + struct sysinfo si;
27494 + vx_vsi_swapinfo(&si);
27495 + if (si.totalswap < (1 << 10))
27497 + seq_printf(swap, "%s\t\t\t\t\t%s\t%lu\t%lu\t%d\n",
27498 + "hdv0", "partition", si.totalswap >> 10,
27499 + (si.totalswap - si.freeswap) >> 10, -1);
27504 @@ -2071,6 +2083,8 @@ void si_swapinfo(struct sysinfo *val)
27505 val->freeswap = nr_swap_pages + nr_to_be_unused;
27506 val->totalswap = total_swap_pages + nr_to_be_unused;
27507 spin_unlock(&swap_lock);
27508 + if (vx_flags(VXF_VIRT_MEM, 0))
27509 + vx_vsi_swapinfo(val);
27513 diff -NurpP --minimal linux-2.6.33.2/net/core/dev.c linux-2.6.33.2-vs2.3.0.36.30.4/net/core/dev.c
27514 --- linux-2.6.33.2/net/core/dev.c 2010-04-06 01:47:46.000000000 +0200
27515 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/core/dev.c 2010-04-06 01:59:25.000000000 +0200
27516 @@ -128,6 +128,7 @@
27517 #include <linux/in.h>
27518 #include <linux/jhash.h>
27519 #include <linux/random.h>
27520 +#include <linux/vs_inet.h>
27521 #include <trace/events/napi.h>
27523 #include "net-sysfs.h"
27524 @@ -593,7 +594,8 @@ struct net_device *__dev_get_by_name(str
27525 struct hlist_head *head = dev_name_hash(net, name);
27527 hlist_for_each_entry(dev, p, head, name_hlist)
27528 - if (!strncmp(dev->name, name, IFNAMSIZ))
27529 + if (!strncmp(dev->name, name, IFNAMSIZ) &&
27530 + nx_dev_visible(current_nx_info(), dev))
27534 @@ -619,7 +621,8 @@ struct net_device *dev_get_by_name_rcu(s
27535 struct hlist_head *head = dev_name_hash(net, name);
27537 hlist_for_each_entry_rcu(dev, p, head, name_hlist)
27538 - if (!strncmp(dev->name, name, IFNAMSIZ))
27539 + if (!strncmp(dev->name, name, IFNAMSIZ) &&
27540 + nx_dev_visible(current_nx_info(), dev))
27544 @@ -670,7 +673,8 @@ struct net_device *__dev_get_by_index(st
27545 struct hlist_head *head = dev_index_hash(net, ifindex);
27547 hlist_for_each_entry(dev, p, head, index_hlist)
27548 - if (dev->ifindex == ifindex)
27549 + if ((dev->ifindex == ifindex) &&
27550 + nx_dev_visible(current_nx_info(), dev))
27554 @@ -695,7 +699,8 @@ struct net_device *dev_get_by_index_rcu(
27555 struct hlist_head *head = dev_index_hash(net, ifindex);
27557 hlist_for_each_entry_rcu(dev, p, head, index_hlist)
27558 - if (dev->ifindex == ifindex)
27559 + if ((dev->ifindex == ifindex) &&
27560 + nx_dev_visible(current_nx_info(), dev))
27564 @@ -748,10 +753,12 @@ struct net_device *dev_getbyhwaddr(struc
27568 - for_each_netdev(net, dev)
27569 + for_each_netdev(net, dev) {
27570 if (dev->type == type &&
27571 - !memcmp(dev->dev_addr, ha, dev->addr_len))
27572 + !memcmp(dev->dev_addr, ha, dev->addr_len) &&
27573 + nx_dev_visible(current_nx_info(), dev))
27579 @@ -762,9 +769,11 @@ struct net_device *__dev_getfirstbyhwtyp
27580 struct net_device *dev;
27583 - for_each_netdev(net, dev)
27584 - if (dev->type == type)
27585 + for_each_netdev(net, dev) {
27586 + if ((dev->type == type) &&
27587 + nx_dev_visible(current_nx_info(), dev))
27593 @@ -883,6 +892,8 @@ static int __dev_alloc_name(struct net *
27595 if (i < 0 || i >= max_netdevices)
27597 + if (!nx_dev_visible(current_nx_info(), d))
27600 /* avoid cases where sscanf is not exact inverse of printf */
27601 snprintf(buf, IFNAMSIZ, name, i);
27602 @@ -3117,6 +3128,8 @@ static int dev_ifconf(struct net *net, c
27605 for_each_netdev(net, dev) {
27606 + if (!nx_dev_visible(current_nx_info(), dev))
27608 for (i = 0; i < NPROTO; i++) {
27609 if (gifconf_list[i]) {
27611 @@ -3187,6 +3200,9 @@ static void dev_seq_printf_stats(struct
27613 const struct net_device_stats *stats = dev_get_stats(dev);
27615 + if (!nx_dev_visible(current_nx_info(), dev))
27618 seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
27619 "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
27620 dev->name, stats->rx_bytes, stats->rx_packets,
27621 @@ -5530,7 +5546,6 @@ int dev_change_net_namespace(struct net_
27622 if (dev->dev.parent)
27626 /* Ensure the device has been registrered */
27628 if (dev->reg_state != NETREG_REGISTERED)
27629 diff -NurpP --minimal linux-2.6.33.2/net/core/rtnetlink.c linux-2.6.33.2-vs2.3.0.36.30.4/net/core/rtnetlink.c
27630 --- linux-2.6.33.2/net/core/rtnetlink.c 2010-02-25 11:52:10.000000000 +0100
27631 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/core/rtnetlink.c 2010-02-25 13:59:02.000000000 +0100
27632 @@ -695,6 +695,8 @@ static int rtnl_dump_ifinfo(struct sk_bu
27633 hlist_for_each_entry(dev, node, head, index_hlist) {
27636 + if (!nx_dev_visible(skb->sk->sk_nx_info, dev))
27638 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
27639 NETLINK_CB(cb->skb).pid,
27640 cb->nlh->nlmsg_seq, 0,
27641 @@ -1252,6 +1254,9 @@ void rtmsg_ifinfo(int type, struct net_d
27642 struct sk_buff *skb;
27643 int err = -ENOBUFS;
27645 + if (!nx_dev_visible(current_nx_info(), dev))
27648 skb = nlmsg_new(if_nlmsg_size(dev), GFP_KERNEL);
27651 diff -NurpP --minimal linux-2.6.33.2/net/core/sock.c linux-2.6.33.2-vs2.3.0.36.30.4/net/core/sock.c
27652 --- linux-2.6.33.2/net/core/sock.c 2010-04-06 01:47:46.000000000 +0200
27653 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/core/sock.c 2010-04-06 01:59:25.000000000 +0200
27654 @@ -125,6 +125,10 @@
27655 #include <linux/ipsec.h>
27657 #include <linux/filter.h>
27658 +#include <linux/vs_socket.h>
27659 +#include <linux/vs_limit.h>
27660 +#include <linux/vs_context.h>
27661 +#include <linux/vs_network.h>
27664 #include <net/tcp.h>
27665 @@ -1012,6 +1016,8 @@ static struct sock *sk_prot_alloc(struct
27667 sk_tx_queue_clear(sk);
27669 + sock_vx_init(sk);
27670 + sock_nx_init(sk);
27674 @@ -1091,6 +1097,11 @@ static void __sk_free(struct sock *sk)
27675 __func__, atomic_read(&sk->sk_omem_alloc));
27677 put_net(sock_net(sk));
27679 + clr_vx_info(&sk->sk_vx_info);
27681 + clr_nx_info(&sk->sk_nx_info);
27683 sk_prot_free(sk->sk_prot_creator, sk);
27686 @@ -1138,6 +1149,8 @@ struct sock *sk_clone(const struct sock
27689 get_net(sock_net(newsk));
27690 + sock_vx_init(newsk);
27691 + sock_nx_init(newsk);
27692 sk_node_init(&newsk->sk_node);
27693 sock_lock_init(newsk);
27694 bh_lock_sock(newsk);
27695 @@ -1193,6 +1206,12 @@ struct sock *sk_clone(const struct sock
27697 atomic_set(&newsk->sk_refcnt, 2);
27699 + set_vx_info(&newsk->sk_vx_info, sk->sk_vx_info);
27700 + newsk->sk_xid = sk->sk_xid;
27701 + vx_sock_inc(newsk);
27702 + set_nx_info(&newsk->sk_nx_info, sk->sk_nx_info);
27703 + newsk->sk_nid = sk->sk_nid;
27706 * Increment the counter in the same struct proto as the master
27707 * sock (sk_refcnt_debug_inc uses newsk->sk_prot->socks, that
27708 @@ -1922,6 +1941,12 @@ void sock_init_data(struct socket *sock,
27710 sk->sk_stamp = ktime_set(-1L, 0);
27712 + set_vx_info(&sk->sk_vx_info, current_vx_info());
27713 + sk->sk_xid = vx_current_xid();
27715 + set_nx_info(&sk->sk_nx_info, current_nx_info());
27716 + sk->sk_nid = nx_current_nid();
27719 * Before updating sk_refcnt, we must commit prior changes to memory
27720 * (Documentation/RCU/rculist_nulls.txt for details)
27721 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/af_inet.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/af_inet.c
27722 --- linux-2.6.33.2/net/ipv4/af_inet.c 2010-02-25 11:52:10.000000000 +0100
27723 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/af_inet.c 2010-02-25 15:53:12.000000000 +0100
27724 @@ -115,6 +115,7 @@
27725 #ifdef CONFIG_IP_MROUTE
27726 #include <linux/mroute.h>
27728 +#include <linux/vs_limit.h>
27731 /* The inetsw table contains everything that inet_create needs to
27732 @@ -326,9 +327,13 @@ lookup_protocol:
27736 + if ((protocol == IPPROTO_ICMP) &&
27737 + nx_capable(CAP_NET_RAW, NXC_RAW_ICMP))
27740 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
27741 goto out_rcu_unlock;
27744 err = -EAFNOSUPPORT;
27745 if (!inet_netns_ok(net, protocol))
27746 goto out_rcu_unlock;
27747 @@ -448,6 +453,7 @@ int inet_bind(struct socket *sock, struc
27748 struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
27749 struct sock *sk = sock->sk;
27750 struct inet_sock *inet = inet_sk(sk);
27751 + struct nx_v4_sock_addr nsa;
27752 unsigned short snum;
27755 @@ -461,7 +467,11 @@ int inet_bind(struct socket *sock, struc
27756 if (addr_len < sizeof(struct sockaddr_in))
27759 - chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
27760 + err = v4_map_sock_addr(inet, addr, &nsa);
27764 + chk_addr_ret = inet_addr_type(sock_net(sk), nsa.saddr);
27766 /* Not specified by any standard per-se, however it breaks too
27767 * many applications when removed. It is unfortunate since
27768 @@ -473,7 +483,7 @@ int inet_bind(struct socket *sock, struc
27769 err = -EADDRNOTAVAIL;
27770 if (!sysctl_ip_nonlocal_bind &&
27771 !(inet->freebind || inet->transparent) &&
27772 - addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
27773 + nsa.saddr != htonl(INADDR_ANY) &&
27774 chk_addr_ret != RTN_LOCAL &&
27775 chk_addr_ret != RTN_MULTICAST &&
27776 chk_addr_ret != RTN_BROADCAST)
27777 @@ -498,7 +508,7 @@ int inet_bind(struct socket *sock, struc
27778 if (sk->sk_state != TCP_CLOSE || inet->inet_num)
27779 goto out_release_sock;
27781 - inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
27782 + v4_set_sock_addr(inet, &nsa);
27783 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
27784 inet->inet_saddr = 0; /* Use device */
27786 @@ -695,11 +705,13 @@ int inet_getname(struct socket *sock, st
27789 sin->sin_port = inet->inet_dport;
27790 - sin->sin_addr.s_addr = inet->inet_daddr;
27791 + sin->sin_addr.s_addr =
27792 + nx_map_sock_lback(sk->sk_nx_info, inet->inet_daddr);
27794 __be32 addr = inet->inet_rcv_saddr;
27796 addr = inet->inet_saddr;
27797 + addr = nx_map_sock_lback(sk->sk_nx_info, addr);
27798 sin->sin_port = inet->inet_sport;
27799 sin->sin_addr.s_addr = addr;
27801 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/devinet.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/devinet.c
27802 --- linux-2.6.33.2/net/ipv4/devinet.c 2010-02-25 11:52:10.000000000 +0100
27803 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/devinet.c 2010-02-25 14:19:58.000000000 +0100
27804 @@ -416,6 +416,7 @@ struct in_device *inetdev_by_index(struc
27806 EXPORT_SYMBOL(inetdev_by_index);
27809 /* Called only from RTNL semaphored context. No locks. */
27811 struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
27812 @@ -658,6 +659,8 @@ int devinet_ioctl(struct net *net, unsig
27814 in_dev = __in_dev_get_rtnl(dev);
27816 + struct nx_info *nxi = current_nx_info();
27818 if (tryaddrmatch) {
27819 /* Matthias Andree */
27820 /* compare label and address (4.4BSD style) */
27821 @@ -666,6 +669,8 @@ int devinet_ioctl(struct net *net, unsig
27822 This is checked above. */
27823 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
27824 ifap = &ifa->ifa_next) {
27825 + if (!nx_v4_ifa_visible(nxi, ifa))
27827 if (!strcmp(ifr.ifr_name, ifa->ifa_label) &&
27828 sin_orig.sin_addr.s_addr ==
27829 ifa->ifa_address) {
27830 @@ -678,9 +683,12 @@ int devinet_ioctl(struct net *net, unsig
27831 comparing just the label */
27833 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
27834 - ifap = &ifa->ifa_next)
27835 + ifap = &ifa->ifa_next) {
27836 + if (!nx_v4_ifa_visible(nxi, ifa))
27838 if (!strcmp(ifr.ifr_name, ifa->ifa_label))
27844 @@ -832,6 +840,8 @@ static int inet_gifconf(struct net_devic
27847 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
27848 + if (!nx_v4_ifa_visible(current_nx_info(), ifa))
27851 done += sizeof(ifr);
27853 @@ -1180,6 +1190,7 @@ static int inet_dump_ifaddr(struct sk_bu
27854 struct net_device *dev;
27855 struct in_device *in_dev;
27856 struct in_ifaddr *ifa;
27857 + struct sock *sk = skb->sk;
27858 struct hlist_head *head;
27859 struct hlist_node *node;
27861 @@ -1202,6 +1213,8 @@ static int inet_dump_ifaddr(struct sk_bu
27863 for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
27864 ifa = ifa->ifa_next, ip_idx++) {
27865 + if (sk && !nx_v4_ifa_visible(sk->sk_nx_info, ifa))
27867 if (ip_idx < s_ip_idx)
27869 if (inet_fill_ifaddr(skb, ifa,
27870 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/fib_hash.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/fib_hash.c
27871 --- linux-2.6.33.2/net/ipv4/fib_hash.c 2010-02-25 11:52:10.000000000 +0100
27872 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/fib_hash.c 2010-02-25 12:02:16.000000000 +0100
27873 @@ -1016,7 +1016,7 @@ static int fib_seq_show(struct seq_file
27874 prefix = f->fn_key;
27875 mask = FZ_MASK(iter->zone);
27876 flags = fib_flag_trans(fa->fa_type, mask, fi);
27878 + if (fi && nx_dev_visible(current_nx_info(), fi->fib_dev))
27880 "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u%n",
27881 fi->fib_dev ? fi->fib_dev->name : "*", prefix,
27882 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/inet_connection_sock.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/inet_connection_sock.c
27883 --- linux-2.6.33.2/net/ipv4/inet_connection_sock.c 2010-02-25 11:52:10.000000000 +0100
27884 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/inet_connection_sock.c 2010-02-25 12:02:16.000000000 +0100
27885 @@ -49,10 +49,40 @@ void inet_get_local_port_range(int *low,
27887 EXPORT_SYMBOL(inet_get_local_port_range);
27889 +int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
27891 + __be32 sk1_rcv_saddr = inet_rcv_saddr(sk1),
27892 + sk2_rcv_saddr = inet_rcv_saddr(sk2);
27894 + if (inet_v6_ipv6only(sk2))
27897 + if (sk1_rcv_saddr &&
27899 + sk1_rcv_saddr == sk2_rcv_saddr)
27902 + if (sk1_rcv_saddr &&
27903 + !sk2_rcv_saddr &&
27904 + v4_addr_in_nx_info(sk2->sk_nx_info, sk1_rcv_saddr, NXA_MASK_BIND))
27907 + if (sk2_rcv_saddr &&
27908 + !sk1_rcv_saddr &&
27909 + v4_addr_in_nx_info(sk1->sk_nx_info, sk2_rcv_saddr, NXA_MASK_BIND))
27912 + if (!sk1_rcv_saddr &&
27913 + !sk2_rcv_saddr &&
27914 + nx_v4_addr_conflict(sk1->sk_nx_info, sk2->sk_nx_info))
27920 int inet_csk_bind_conflict(const struct sock *sk,
27921 const struct inet_bind_bucket *tb)
27923 - const __be32 sk_rcv_saddr = inet_rcv_saddr(sk);
27925 struct hlist_node *node;
27926 int reuse = sk->sk_reuse;
27927 @@ -72,9 +102,7 @@ int inet_csk_bind_conflict(const struct
27928 sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
27929 if (!reuse || !sk2->sk_reuse ||
27930 sk2->sk_state == TCP_LISTEN) {
27931 - const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
27932 - if (!sk2_rcv_saddr || !sk_rcv_saddr ||
27933 - sk2_rcv_saddr == sk_rcv_saddr)
27934 + if (ipv4_rcv_saddr_equal(sk, sk2))
27938 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/inet_diag.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/inet_diag.c
27939 --- linux-2.6.33.2/net/ipv4/inet_diag.c 2010-02-25 11:52:10.000000000 +0100
27940 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/inet_diag.c 2010-02-25 14:16:01.000000000 +0100
27942 #include <linux/stddef.h>
27944 #include <linux/inet_diag.h>
27945 +#include <linux/vs_network.h>
27946 +#include <linux/vs_inet.h>
27948 static const struct inet_diag_handler **inet_diag_table;
27950 @@ -118,8 +120,10 @@ static int inet_csk_diag_fill(struct soc
27952 r->id.idiag_sport = inet->inet_sport;
27953 r->id.idiag_dport = inet->inet_dport;
27954 - r->id.idiag_src[0] = inet->inet_rcv_saddr;
27955 - r->id.idiag_dst[0] = inet->inet_daddr;
27956 + r->id.idiag_src[0] = nx_map_sock_lback(sk->sk_nx_info,
27957 + inet->inet_rcv_saddr);
27958 + r->id.idiag_dst[0] = nx_map_sock_lback(sk->sk_nx_info,
27959 + inet->inet_daddr);
27961 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
27962 if (r->idiag_family == AF_INET6) {
27963 @@ -204,8 +208,8 @@ static int inet_twsk_diag_fill(struct in
27964 r->id.idiag_cookie[1] = (u32)(((unsigned long)tw >> 31) >> 1);
27965 r->id.idiag_sport = tw->tw_sport;
27966 r->id.idiag_dport = tw->tw_dport;
27967 - r->id.idiag_src[0] = tw->tw_rcv_saddr;
27968 - r->id.idiag_dst[0] = tw->tw_daddr;
27969 + r->id.idiag_src[0] = nx_map_sock_lback(tw->tw_nx_info, tw->tw_rcv_saddr);
27970 + r->id.idiag_dst[0] = nx_map_sock_lback(tw->tw_nx_info, tw->tw_daddr);
27971 r->idiag_state = tw->tw_substate;
27972 r->idiag_timer = 3;
27973 r->idiag_expires = DIV_ROUND_UP(tmo * 1000, HZ);
27974 @@ -262,6 +266,7 @@ static int inet_diag_get_exact(struct sk
27977 if (req->idiag_family == AF_INET) {
27978 + /* TODO: lback */
27979 sk = inet_lookup(&init_net, hashinfo, req->id.idiag_dst[0],
27980 req->id.idiag_dport, req->id.idiag_src[0],
27981 req->id.idiag_sport, req->id.idiag_if);
27982 @@ -504,6 +509,7 @@ static int inet_csk_diag_dump(struct soc
27986 + /* TODO: lback */
27987 entry.saddr = &inet->inet_rcv_saddr;
27988 entry.daddr = &inet->inet_daddr;
27990 @@ -540,6 +546,7 @@ static int inet_twsk_diag_dump(struct in
27994 + /* TODO: lback */
27995 entry.saddr = &tw->tw_rcv_saddr;
27996 entry.daddr = &tw->tw_daddr;
27998 @@ -586,8 +593,8 @@ static int inet_diag_fill_req(struct sk_
28000 r->id.idiag_sport = inet->inet_sport;
28001 r->id.idiag_dport = ireq->rmt_port;
28002 - r->id.idiag_src[0] = ireq->loc_addr;
28003 - r->id.idiag_dst[0] = ireq->rmt_addr;
28004 + r->id.idiag_src[0] = nx_map_sock_lback(sk->sk_nx_info, ireq->loc_addr);
28005 + r->id.idiag_dst[0] = nx_map_sock_lback(sk->sk_nx_info, ireq->rmt_addr);
28006 r->idiag_expires = jiffies_to_msecs(tmo);
28007 r->idiag_rqueue = 0;
28008 r->idiag_wqueue = 0;
28009 @@ -657,6 +664,7 @@ static int inet_diag_dump_reqs(struct sk
28013 + /* TODO: lback */
28015 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
28016 (entry.family == AF_INET6) ?
28017 @@ -727,6 +735,8 @@ static int inet_diag_dump(struct sk_buff
28018 sk_nulls_for_each(sk, node, &ilb->head) {
28019 struct inet_sock *inet = inet_sk(sk);
28021 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28026 @@ -793,6 +803,8 @@ skip_listen_ht:
28027 sk_nulls_for_each(sk, node, &head->chain) {
28028 struct inet_sock *inet = inet_sk(sk);
28030 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28034 if (!(r->idiag_states & (1 << sk->sk_state)))
28035 @@ -817,6 +829,8 @@ next_normal:
28036 inet_twsk_for_each(tw, node,
28039 + if (!nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))
28043 if (r->id.idiag_sport != tw->tw_sport &&
28044 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/inet_hashtables.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/inet_hashtables.c
28045 --- linux-2.6.33.2/net/ipv4/inet_hashtables.c 2010-02-25 11:52:10.000000000 +0100
28046 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/inet_hashtables.c 2010-02-25 12:02:16.000000000 +0100
28049 #include <net/inet_connection_sock.h>
28050 #include <net/inet_hashtables.h>
28051 +#include <net/route.h>
28052 #include <net/ip.h>
28055 @@ -134,6 +135,11 @@ static inline int compute_score(struct s
28056 if (rcv_saddr != daddr)
28060 + /* block non nx_info ips */
28061 + if (!v4_addr_in_nx_info(sk->sk_nx_info,
28062 + daddr, NXA_MASK_BIND))
28065 if (sk->sk_bound_dev_if) {
28066 if (sk->sk_bound_dev_if != dif)
28067 @@ -151,7 +157,6 @@ static inline int compute_score(struct s
28068 * wildcarded during the search since they can never be otherwise.
28072 struct sock *__inet_lookup_listener(struct net *net,
28073 struct inet_hashinfo *hashinfo,
28074 const __be32 daddr, const unsigned short hnum,
28075 @@ -174,6 +179,7 @@ begin:
28081 * if the nulls value we got at the end of this lookup is
28082 * not the expected one, we must restart lookup.
28083 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/netfilter/nf_nat_helper.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/netfilter/nf_nat_helper.c
28084 --- linux-2.6.33.2/net/ipv4/netfilter/nf_nat_helper.c 2010-02-25 11:52:10.000000000 +0100
28085 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/netfilter/nf_nat_helper.c 2010-02-25 12:02:16.000000000 +0100
28087 #include <net/route.h>
28089 #include <linux/netfilter_ipv4.h>
28090 +#include <net/route.h>
28091 #include <net/netfilter/nf_conntrack.h>
28092 #include <net/netfilter/nf_conntrack_helper.h>
28093 #include <net/netfilter/nf_conntrack_ecache.h>
28094 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/netfilter.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/netfilter.c
28095 --- linux-2.6.33.2/net/ipv4/netfilter.c 2010-02-25 11:52:10.000000000 +0100
28096 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/netfilter.c 2010-02-25 12:02:16.000000000 +0100
28098 #include <linux/netfilter_ipv4.h>
28099 #include <linux/ip.h>
28100 #include <linux/skbuff.h>
28101 -#include <net/route.h>
28102 +// #include <net/route.h>
28103 #include <net/xfrm.h>
28104 #include <net/ip.h>
28105 #include <net/netfilter/nf_queue.h>
28106 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/raw.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/raw.c
28107 --- linux-2.6.33.2/net/ipv4/raw.c 2010-02-25 11:52:10.000000000 +0100
28108 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/raw.c 2010-02-25 14:07:52.000000000 +0100
28109 @@ -117,7 +117,7 @@ static struct sock *__raw_v4_lookup(stru
28111 if (net_eq(sock_net(sk), net) && inet->inet_num == num &&
28112 !(inet->inet_daddr && inet->inet_daddr != raddr) &&
28113 - !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
28114 + v4_sock_addr_match(sk->sk_nx_info, inet, laddr) &&
28115 !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
28116 goto found; /* gotcha */
28118 @@ -382,6 +382,12 @@ static int raw_send_hdrinc(struct sock *
28119 icmp_out_count(net, ((struct icmphdr *)
28120 skb_transport_header(skb))->type);
28123 + if (!nx_check(0, VS_ADMIN) && !capable(CAP_NET_RAW) &&
28124 + sk->sk_nx_info &&
28125 + !v4_addr_in_nx_info(sk->sk_nx_info, iph->saddr, NXA_MASK_BIND))
28128 err = NF_HOOK(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
28131 @@ -562,6 +568,13 @@ static int raw_sendmsg(struct kiocb *ioc
28134 security_sk_classify_flow(sk, &fl);
28135 + if (sk->sk_nx_info) {
28136 + err = ip_v4_find_src(sock_net(sk),
28137 + sk->sk_nx_info, &rt, &fl);
28142 err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1);
28145 @@ -634,17 +647,19 @@ static int raw_bind(struct sock *sk, str
28147 struct inet_sock *inet = inet_sk(sk);
28148 struct sockaddr_in *addr = (struct sockaddr_in *) uaddr;
28149 + struct nx_v4_sock_addr nsa = { 0 };
28153 if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in))
28155 - chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
28156 + v4_map_sock_addr(inet, addr, &nsa);
28157 + chk_addr_ret = inet_addr_type(sock_net(sk), nsa.saddr);
28158 ret = -EADDRNOTAVAIL;
28159 - if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL &&
28160 + if (nsa.saddr && chk_addr_ret != RTN_LOCAL &&
28161 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
28163 - inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
28164 + v4_set_sock_addr(inet, &nsa);
28165 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
28166 inet->inet_saddr = 0; /* Use device */
28168 @@ -696,7 +711,8 @@ static int raw_recvmsg(struct kiocb *ioc
28169 /* Copy the address. */
28171 sin->sin_family = AF_INET;
28172 - sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
28173 + sin->sin_addr.s_addr =
28174 + nx_map_sock_lback(sk->sk_nx_info, ip_hdr(skb)->saddr);
28176 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
28178 @@ -874,7 +890,8 @@ static struct sock *raw_get_first(struct
28179 struct hlist_node *node;
28181 sk_for_each(sk, node, &state->h->ht[state->bucket])
28182 - if (sock_net(sk) == seq_file_net(seq))
28183 + if ((sock_net(sk) == seq_file_net(seq)) &&
28184 + nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28188 @@ -890,7 +907,8 @@ static struct sock *raw_get_next(struct
28192 - } while (sk && sock_net(sk) != seq_file_net(seq));
28193 + } while (sk && ((sock_net(sk) != seq_file_net(seq)) ||
28194 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
28196 if (!sk && ++state->bucket < RAW_HTABLE_SIZE) {
28197 sk = sk_head(&state->h->ht[state->bucket]);
28198 @@ -949,7 +967,10 @@ static void raw_sock_seq_show(struct seq
28200 seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
28201 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",
28202 - i, src, srcp, dest, destp, sp->sk_state,
28204 + nx_map_sock_lback(current_nx_info(), src), srcp,
28205 + nx_map_sock_lback(current_nx_info(), dest), destp,
28207 sk_wmem_alloc_get(sp),
28208 sk_rmem_alloc_get(sp),
28209 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
28210 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/tcp.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/tcp.c
28211 --- linux-2.6.33.2/net/ipv4/tcp.c 2010-04-06 01:47:46.000000000 +0200
28212 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/tcp.c 2010-04-06 01:59:25.000000000 +0200
28213 @@ -265,6 +265,7 @@
28214 #include <linux/err.h>
28215 #include <linux/crypto.h>
28216 #include <linux/time.h>
28217 +#include <linux/in.h>
28219 #include <net/icmp.h>
28220 #include <net/tcp.h>
28221 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/tcp_ipv4.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/tcp_ipv4.c
28222 --- linux-2.6.33.2/net/ipv4/tcp_ipv4.c 2010-04-06 01:47:47.000000000 +0200
28223 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/tcp_ipv4.c 2010-04-06 01:59:25.000000000 +0200
28224 @@ -1990,6 +1990,12 @@ static void *listening_get_next(struct s
28225 req = req->dl_next;
28228 + vxdprintk(VXD_CBIT(net, 6),
28229 + "sk,req: %p [#%d] (from %d)", req->sk,
28230 + (req->sk)?req->sk->sk_nid:0, nx_current_nid());
28232 + !nx_check(req->sk->sk_nid, VS_WATCH_P | VS_IDENT))
28234 if (req->rsk_ops->family == st->family) {
28237 @@ -2014,6 +2020,10 @@ get_req:
28240 sk_nulls_for_each_from(sk, node) {
28241 + vxdprintk(VXD_CBIT(net, 6), "sk: %p [#%d] (from %d)",
28242 + sk, sk->sk_nid, nx_current_nid());
28243 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28245 if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) {
28248 @@ -2077,6 +2087,11 @@ static void *established_get_first(struc
28250 spin_lock_bh(lock);
28251 sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
28252 + vxdprintk(VXD_CBIT(net, 6),
28253 + "sk,egf: %p [#%d] (from %d)",
28254 + sk, sk->sk_nid, nx_current_nid());
28255 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28257 if (sk->sk_family != st->family ||
28258 !net_eq(sock_net(sk), net)) {
28260 @@ -2087,6 +2102,11 @@ static void *established_get_first(struc
28261 st->state = TCP_SEQ_STATE_TIME_WAIT;
28262 inet_twsk_for_each(tw, node,
28263 &tcp_hashinfo.ehash[st->bucket].twchain) {
28264 + vxdprintk(VXD_CBIT(net, 6),
28265 + "tw: %p [#%d] (from %d)",
28266 + tw, tw->tw_nid, nx_current_nid());
28267 + if (!nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))
28269 if (tw->tw_family != st->family ||
28270 !net_eq(twsk_net(tw), net)) {
28272 @@ -2115,7 +2135,9 @@ static void *established_get_next(struct
28276 - while (tw && (tw->tw_family != st->family || !net_eq(twsk_net(tw), net))) {
28277 + while (tw && (tw->tw_family != st->family ||
28278 + !net_eq(twsk_net(tw), net) ||
28279 + !nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))) {
28283 @@ -2138,6 +2160,11 @@ get_tw:
28284 sk = sk_nulls_next(sk);
28286 sk_nulls_for_each_from(sk, node) {
28287 + vxdprintk(VXD_CBIT(net, 6),
28288 + "sk,egn: %p [#%d] (from %d)",
28289 + sk, sk->sk_nid, nx_current_nid());
28290 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28292 if (sk->sk_family == st->family && net_eq(sock_net(sk), net))
28295 @@ -2289,9 +2316,9 @@ static void get_openreq4(struct sock *sk
28296 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
28297 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %p%n",
28300 + nx_map_sock_lback(current_nx_info(), ireq->loc_addr),
28301 ntohs(inet_sk(sk)->inet_sport),
28303 + nx_map_sock_lback(current_nx_info(), ireq->rmt_addr),
28304 ntohs(ireq->rmt_port),
28306 0, 0, /* could print option size, but that is af dependent. */
28307 @@ -2343,7 +2370,10 @@ static void get_tcp4_sock(struct sock *s
28309 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
28310 "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
28311 - i, src, srcp, dest, destp, sk->sk_state,
28313 + nx_map_sock_lback(current_nx_info(), src), srcp,
28314 + nx_map_sock_lback(current_nx_info(), dest), destp,
28316 tp->write_seq - tp->snd_una,
28319 @@ -2378,7 +2408,10 @@ static void get_timewait4_sock(struct in
28321 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
28322 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p%n",
28323 - i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
28325 + nx_map_sock_lback(current_nx_info(), src), srcp,
28326 + nx_map_sock_lback(current_nx_info(), dest), destp,
28327 + tw->tw_substate, 0, 0,
28328 3, jiffies_to_clock_t(ttd), 0, 0, 0, 0,
28329 atomic_read(&tw->tw_refcnt), tw, len);
28331 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/tcp_minisocks.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/tcp_minisocks.c
28332 --- linux-2.6.33.2/net/ipv4/tcp_minisocks.c 2010-04-06 01:47:47.000000000 +0200
28333 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/tcp_minisocks.c 2010-04-06 01:59:25.000000000 +0200
28335 #include <linux/module.h>
28336 #include <linux/sysctl.h>
28337 #include <linux/workqueue.h>
28338 +#include <linux/vs_limit.h>
28339 +#include <linux/vs_socket.h>
28340 +#include <linux/vs_context.h>
28341 #include <net/tcp.h>
28342 #include <net/inet_common.h>
28343 #include <net/xfrm.h>
28344 @@ -289,6 +292,11 @@ void tcp_time_wait(struct sock *sk, int
28345 tcptw->tw_ts_recent = tp->rx_opt.ts_recent;
28346 tcptw->tw_ts_recent_stamp = tp->rx_opt.ts_recent_stamp;
28348 + tw->tw_xid = sk->sk_xid;
28349 + tw->tw_vx_info = NULL;
28350 + tw->tw_nid = sk->sk_nid;
28351 + tw->tw_nx_info = NULL;
28353 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
28354 if (tw->tw_family == PF_INET6) {
28355 struct ipv6_pinfo *np = inet6_sk(sk);
28356 diff -NurpP --minimal linux-2.6.33.2/net/ipv4/udp.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/udp.c
28357 --- linux-2.6.33.2/net/ipv4/udp.c 2010-04-06 01:47:47.000000000 +0200
28358 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv4/udp.c 2010-04-06 01:59:25.000000000 +0200
28359 @@ -294,14 +294,7 @@ fail:
28361 EXPORT_SYMBOL(udp_lib_get_port);
28363 -static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
28365 - struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2);
28367 - return (!ipv6_only_sock(sk2) &&
28368 - (!inet1->inet_rcv_saddr || !inet2->inet_rcv_saddr ||
28369 - inet1->inet_rcv_saddr == inet2->inet_rcv_saddr));
28371 +extern int ipv4_rcv_saddr_equal(const struct sock *, const struct sock *);
28373 static unsigned int udp4_portaddr_hash(struct net *net, __be32 saddr,
28375 @@ -336,6 +329,11 @@ static inline int compute_score(struct s
28376 if (inet->inet_rcv_saddr != daddr)
28380 + /* block non nx_info ips */
28381 + if (!v4_addr_in_nx_info(sk->sk_nx_info,
28382 + daddr, NXA_MASK_BIND))
28385 if (inet->inet_daddr) {
28386 if (inet->inet_daddr != saddr)
28387 @@ -439,6 +437,7 @@ exact_match:
28392 /* UDP is nearly always wildcards out the wazoo, it makes no sense to try
28393 * harder than this. -DaveM
28395 @@ -484,6 +483,11 @@ begin:
28396 sk_nulls_for_each_rcu(sk, node, &hslot->head) {
28397 score = compute_score(sk, net, saddr, hnum, sport,
28398 daddr, dport, dif);
28399 + /* FIXME: disabled?
28400 + if (score == 9) {
28404 if (score > badness) {
28407 @@ -497,6 +501,7 @@ begin:
28408 if (get_nulls_value(node) != slot)
28413 if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
28415 @@ -506,6 +511,7 @@ begin:
28423 @@ -548,8 +554,7 @@ static inline struct sock *udp_v4_mcast_
28424 udp_sk(s)->udp_port_hash != hnum ||
28425 (inet->inet_daddr && inet->inet_daddr != rmt_addr) ||
28426 (inet->inet_dport != rmt_port && inet->inet_dport) ||
28427 - (inet->inet_rcv_saddr &&
28428 - inet->inet_rcv_saddr != loc_addr) ||
28429 + !v4_sock_addr_match(sk->sk_nx_info, inet, loc_addr) ||
28430 ipv6_only_sock(s) ||
28431 (s->sk_bound_dev_if && s->sk_bound_dev_if != dif))
28433 @@ -898,8 +903,13 @@ int udp_sendmsg(struct kiocb *iocb, stru
28434 { .sport = inet->inet_sport,
28435 .dport = dport } } };
28436 struct net *net = sock_net(sk);
28437 + struct nx_info *nxi = sk->sk_nx_info;
28439 security_sk_classify_flow(sk, &fl);
28440 + err = ip_v4_find_src(net, nxi, &rt, &fl);
28444 err = ip_route_output_flow(net, &rt, &fl, sk, 1);
28446 if (err == -ENETUNREACH)
28447 @@ -1180,7 +1190,8 @@ try_again:
28449 sin->sin_family = AF_INET;
28450 sin->sin_port = udp_hdr(skb)->source;
28451 - sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
28452 + sin->sin_addr.s_addr = nx_map_sock_lback(
28453 + skb->sk->sk_nx_info, ip_hdr(skb)->saddr);
28454 memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
28456 if (inet->cmsg_flags)
28457 @@ -1867,6 +1878,8 @@ static struct sock *udp_get_first(struct
28458 sk_nulls_for_each(sk, node, &hslot->head) {
28459 if (!net_eq(sock_net(sk), net))
28461 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28463 if (sk->sk_family == state->family)
28466 @@ -1884,7 +1897,9 @@ static struct sock *udp_get_next(struct
28469 sk = sk_nulls_next(sk);
28470 - } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family));
28471 + } while (sk && (!net_eq(sock_net(sk), net) ||
28472 + sk->sk_family != state->family ||
28473 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
28476 if (state->bucket <= state->udp_table->mask)
28477 @@ -1991,7 +2006,10 @@ static void udp4_format_sock(struct sock
28479 seq_printf(f, "%5d: %08X:%04X %08X:%04X"
28480 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n",
28481 - bucket, src, srcp, dest, destp, sp->sk_state,
28483 + nx_map_sock_lback(current_nx_info(), src), srcp,
28484 + nx_map_sock_lback(current_nx_info(), dest), destp,
28486 sk_wmem_alloc_get(sp),
28487 sk_rmem_alloc_get(sp),
28488 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
28489 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/addrconf.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/addrconf.c
28490 --- linux-2.6.33.2/net/ipv6/addrconf.c 2010-02-25 11:52:10.000000000 +0100
28491 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/addrconf.c 2010-02-25 13:40:38.000000000 +0100
28494 #include <linux/proc_fs.h>
28495 #include <linux/seq_file.h>
28496 +#include <linux/vs_network.h>
28497 +#include <linux/vs_inet6.h>
28499 /* Set to 3 to get tracing... */
28500 #define ACONF_DEBUG 2
28501 @@ -1120,7 +1122,7 @@ out:
28503 int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
28504 const struct in6_addr *daddr, unsigned int prefs,
28505 - struct in6_addr *saddr)
28506 + struct in6_addr *saddr, struct nx_info *nxi)
28508 struct ipv6_saddr_score scores[2],
28509 *score = &scores[0], *hiscore = &scores[1];
28510 @@ -1192,6 +1194,8 @@ int ipv6_dev_get_saddr(struct net *net,
28514 + if (!v6_addr_in_nx_info(nxi, &score->ifa->addr, -1))
28518 bitmap_zero(score->scorebits, IPV6_SADDR_RULE_MAX);
28519 @@ -2999,7 +3003,10 @@ static void if6_seq_stop(struct seq_file
28520 static int if6_seq_show(struct seq_file *seq, void *v)
28522 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
28523 - seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
28525 + if (nx_check(0, VS_ADMIN|VS_WATCH) ||
28526 + v6_addr_in_nx_info(current_nx_info(), &ifp->addr, -1))
28527 + seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
28529 ifp->idev->dev->ifindex,
28531 @@ -3494,6 +3501,11 @@ static int in6_dump_addrs(struct inet6_d
28532 struct ifacaddr6 *ifaca;
28534 int ip_idx = *p_ip_idx;
28535 + struct nx_info *nxi = skb->sk ? skb->sk->sk_nx_info : NULL;
28537 + /* disable ipv6 on non v6 guests */
28538 + if (nxi && !nx_info_has_v6(nxi))
28541 read_lock_bh(&idev->lock);
28543 @@ -3503,6 +3515,8 @@ static int in6_dump_addrs(struct inet6_d
28544 ifa = ifa->if_next, ip_idx++) {
28545 if (ip_idx < s_ip_idx)
28547 + if (!v6_addr_in_nx_info(nxi, &ifa->addr, -1))
28549 err = inet6_fill_ifaddr(skb, ifa,
28550 NETLINK_CB(cb->skb).pid,
28551 cb->nlh->nlmsg_seq,
28552 @@ -3518,6 +3532,8 @@ static int in6_dump_addrs(struct inet6_d
28553 ifmca = ifmca->next, ip_idx++) {
28554 if (ip_idx < s_ip_idx)
28556 + if (!v6_addr_in_nx_info(nxi, &ifmca->mca_addr, -1))
28558 err = inet6_fill_ifmcaddr(skb, ifmca,
28559 NETLINK_CB(cb->skb).pid,
28560 cb->nlh->nlmsg_seq,
28561 @@ -3533,6 +3549,8 @@ static int in6_dump_addrs(struct inet6_d
28562 ifaca = ifaca->aca_next, ip_idx++) {
28563 if (ip_idx < s_ip_idx)
28565 + if (!v6_addr_in_nx_info(nxi, &ifaca->aca_addr, -1))
28567 err = inet6_fill_ifacaddr(skb, ifaca,
28568 NETLINK_CB(cb->skb).pid,
28569 cb->nlh->nlmsg_seq,
28570 @@ -3861,6 +3879,11 @@ static int inet6_dump_ifinfo(struct sk_b
28571 struct inet6_dev *idev;
28572 struct hlist_head *head;
28573 struct hlist_node *node;
28574 + struct nx_info *nxi = skb->sk ? skb->sk->sk_nx_info : NULL;
28576 + /* FIXME: maybe disable ipv6 on non v6 guests?
28577 + if (skb->sk && skb->sk->sk_vx_info)
28578 + return skb->len; */
28581 s_idx = cb->args[1];
28582 @@ -3872,6 +3895,8 @@ static int inet6_dump_ifinfo(struct sk_b
28583 hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
28586 + if (!v6_dev_in_nx_info(dev, nxi))
28588 idev = __in6_dev_get(dev);
28591 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/af_inet6.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/af_inet6.c
28592 --- linux-2.6.33.2/net/ipv6/af_inet6.c 2010-02-25 11:52:10.000000000 +0100
28593 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/af_inet6.c 2010-02-25 15:54:53.000000000 +0100
28595 #include <linux/netdevice.h>
28596 #include <linux/icmpv6.h>
28597 #include <linux/netfilter_ipv6.h>
28598 +#include <linux/vs_inet.h>
28599 +#include <linux/vs_inet6.h>
28601 #include <net/ip.h>
28602 #include <net/ipv6.h>
28603 @@ -159,9 +161,12 @@ lookup_protocol:
28607 + if ((protocol == IPPROTO_ICMPV6) &&
28608 + nx_capable(CAP_NET_RAW, NXC_RAW_ICMP))
28610 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
28611 goto out_rcu_unlock;
28614 sock->ops = answer->ops;
28615 answer_prot = answer->prot;
28616 answer_no_check = answer->no_check;
28617 @@ -260,6 +265,7 @@ int inet6_bind(struct socket *sock, stru
28618 struct inet_sock *inet = inet_sk(sk);
28619 struct ipv6_pinfo *np = inet6_sk(sk);
28620 struct net *net = sock_net(sk);
28621 + struct nx_v6_sock_addr nsa;
28623 unsigned short snum;
28625 @@ -271,6 +277,11 @@ int inet6_bind(struct socket *sock, stru
28627 if (addr_len < SIN6_LEN_RFC2133)
28630 + err = v6_map_sock_addr(inet, addr, &nsa);
28634 addr_type = ipv6_addr_type(&addr->sin6_addr);
28635 if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM)
28637 @@ -302,6 +313,7 @@ int inet6_bind(struct socket *sock, stru
28638 /* Reproduce AF_INET checks to make the bindings consitant */
28639 v4addr = addr->sin6_addr.s6_addr32[3];
28640 chk_addr_ret = inet_addr_type(net, v4addr);
28642 if (!sysctl_ip_nonlocal_bind &&
28643 !(inet->freebind || inet->transparent) &&
28644 v4addr != htonl(INADDR_ANY) &&
28645 @@ -311,6 +323,10 @@ int inet6_bind(struct socket *sock, stru
28646 err = -EADDRNOTAVAIL;
28649 + if (!v4_addr_in_nx_info(sk->sk_nx_info, v4addr, NXA_MASK_BIND)) {
28650 + err = -EADDRNOTAVAIL;
28654 if (addr_type != IPV6_ADDR_ANY) {
28655 struct net_device *dev = NULL;
28656 @@ -337,6 +353,11 @@ int inet6_bind(struct socket *sock, stru
28660 + if (!v6_addr_in_nx_info(sk->sk_nx_info, &addr->sin6_addr, -1)) {
28661 + err = -EADDRNOTAVAIL;
28665 /* ipv4 addr of the socket is invalid. Only the
28666 * unspecified and mapped address have a v4 equivalent.
28668 @@ -352,6 +373,9 @@ int inet6_bind(struct socket *sock, stru
28672 + /* what's that for? */
28673 + v6_set_sock_addr(inet, &nsa);
28675 inet->inet_rcv_saddr = v4addr;
28676 inet->inet_saddr = v4addr;
28678 @@ -450,9 +474,11 @@ int inet6_getname(struct socket *sock, s
28680 sin->sin6_port = inet->inet_dport;
28681 ipv6_addr_copy(&sin->sin6_addr, &np->daddr);
28682 + /* FIXME: remap lback? */
28684 sin->sin6_flowinfo = np->flow_label;
28686 + /* FIXME: remap lback? */
28687 if (ipv6_addr_any(&np->rcv_saddr))
28688 ipv6_addr_copy(&sin->sin6_addr, &np->saddr);
28690 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/fib6_rules.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/fib6_rules.c
28691 --- linux-2.6.33.2/net/ipv6/fib6_rules.c 2010-02-25 11:52:10.000000000 +0100
28692 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/fib6_rules.c 2010-02-25 12:02:16.000000000 +0100
28693 @@ -96,7 +96,7 @@ static int fib6_rule_action(struct fib_r
28694 if (ipv6_dev_get_saddr(net,
28695 ip6_dst_idev(&rt->u.dst)->dev,
28696 &flp->fl6_dst, srcprefs,
28700 if (!ipv6_prefix_equal(&saddr, &r->src.addr,
28702 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/inet6_hashtables.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/inet6_hashtables.c
28703 --- linux-2.6.33.2/net/ipv6/inet6_hashtables.c 2010-02-25 11:52:10.000000000 +0100
28704 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/inet6_hashtables.c 2010-02-25 12:02:16.000000000 +0100
28707 #include <linux/module.h>
28708 #include <linux/random.h>
28709 +#include <linux/vs_inet6.h>
28711 #include <net/inet_connection_sock.h>
28712 #include <net/inet_hashtables.h>
28713 @@ -82,7 +83,6 @@ struct sock *__inet6_lookup_established(
28714 unsigned int slot = hash & hashinfo->ehash_mask;
28715 struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
28720 sk_nulls_for_each_rcu(sk, node, &head->chain) {
28721 @@ -94,7 +94,7 @@ begin:
28729 if (get_nulls_value(node) != slot)
28730 @@ -140,6 +140,9 @@ static int inline compute_score(struct s
28731 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
28735 + if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
28738 if (sk->sk_bound_dev_if) {
28739 if (sk->sk_bound_dev_if != dif)
28740 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/ip6_output.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/ip6_output.c
28741 --- linux-2.6.33.2/net/ipv6/ip6_output.c 2010-02-25 11:52:10.000000000 +0100
28742 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/ip6_output.c 2010-02-25 12:02:16.000000000 +0100
28743 @@ -933,7 +933,7 @@ static int ip6_dst_lookup_tail(struct so
28744 err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev,
28746 sk ? inet6_sk(sk)->srcprefs : 0,
28748 + &fl->fl6_src, sk->sk_nx_info);
28750 goto out_err_release;
28752 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/Kconfig linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/Kconfig
28753 --- linux-2.6.33.2/net/ipv6/Kconfig 2010-02-25 11:52:10.000000000 +0100
28754 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/Kconfig 2010-02-25 12:02:16.000000000 +0100
28757 # IPv6 as module will cause a CRASH if you try to unload it
28759 - tristate "The IPv6 protocol"
28761 + bool "The IPv6 protocol"
28764 This is complemental support for the IP version 6.
28765 You will still be able to do traditional IPv4 networking as well.
28766 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/ndisc.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/ndisc.c
28767 --- linux-2.6.33.2/net/ipv6/ndisc.c 2010-02-25 11:52:10.000000000 +0100
28768 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/ndisc.c 2010-02-25 12:02:16.000000000 +0100
28769 @@ -589,7 +589,7 @@ static void ndisc_send_na(struct net_dev
28771 if (ipv6_dev_get_saddr(dev_net(dev), dev, daddr,
28772 inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs,
28774 + &tmpaddr, NULL /* FIXME: ? */ ))
28776 src_addr = &tmpaddr;
28778 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/raw.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/raw.c
28779 --- linux-2.6.33.2/net/ipv6/raw.c 2010-02-25 11:52:11.000000000 +0100
28780 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/raw.c 2010-02-25 12:02:16.000000000 +0100
28782 #include <linux/icmpv6.h>
28783 #include <linux/netfilter.h>
28784 #include <linux/netfilter_ipv6.h>
28785 +#include <linux/vs_inet6.h>
28786 #include <linux/skbuff.h>
28787 #include <asm/uaccess.h>
28788 #include <asm/ioctls.h>
28789 @@ -282,6 +283,13 @@ static int rawv6_bind(struct sock *sk, s
28793 + if (!v6_addr_in_nx_info(sk->sk_nx_info, &addr->sin6_addr, -1)) {
28794 + err = -EADDRNOTAVAIL;
28800 /* ipv4 addr of the socket is invalid. Only the
28801 * unspecified and mapped address have a v4 equivalent.
28803 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/route.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/route.c
28804 --- linux-2.6.33.2/net/ipv6/route.c 2010-04-06 01:47:47.000000000 +0200
28805 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/route.c 2010-04-06 01:59:25.000000000 +0200
28806 @@ -2263,7 +2263,8 @@ static int rt6_fill_node(struct net *net
28807 struct inet6_dev *idev = ip6_dst_idev(&rt->u.dst);
28808 struct in6_addr saddr_buf;
28809 if (ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
28810 - dst, 0, &saddr_buf) == 0)
28811 + dst, 0, &saddr_buf,
28812 + (skb->sk ? skb->sk->sk_nx_info : NULL)) == 0)
28813 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
28816 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/tcp_ipv6.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/tcp_ipv6.c
28817 --- linux-2.6.33.2/net/ipv6/tcp_ipv6.c 2010-04-06 01:47:47.000000000 +0200
28818 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/tcp_ipv6.c 2010-04-06 01:59:25.000000000 +0200
28821 #include <linux/crypto.h>
28822 #include <linux/scatterlist.h>
28823 +#include <linux/vs_inet6.h>
28825 static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb);
28826 static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
28827 @@ -156,8 +157,15 @@ static int tcp_v6_connect(struct sock *s
28828 * connect() to INADDR_ANY means loopback (BSD'ism).
28831 - if(ipv6_addr_any(&usin->sin6_addr))
28832 - usin->sin6_addr.s6_addr[15] = 0x1;
28833 + if(ipv6_addr_any(&usin->sin6_addr)) {
28834 + struct nx_info *nxi = sk->sk_nx_info;
28836 + if (nxi && nx_info_has_v6(nxi))
28837 + /* FIXME: remap lback? */
28838 + usin->sin6_addr = nxi->v6.ip;
28840 + usin->sin6_addr.s6_addr[15] = 0x1;
28843 addr_type = ipv6_addr_type(&usin->sin6_addr);
28845 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/udp.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/udp.c
28846 --- linux-2.6.33.2/net/ipv6/udp.c 2010-04-06 01:47:47.000000000 +0200
28847 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/udp.c 2010-04-06 01:59:25.000000000 +0200
28848 @@ -47,13 +47,14 @@
28850 #include <linux/proc_fs.h>
28851 #include <linux/seq_file.h>
28852 +#include <linux/vs_inet6.h>
28853 #include "udp_impl.h"
28855 int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
28857 const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr;
28858 const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2);
28859 - __be32 sk1_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
28860 + __be32 sk_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
28861 __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
28862 int sk_ipv6only = ipv6_only_sock(sk);
28863 int sk2_ipv6only = inet_v6_ipv6only(sk2);
28864 @@ -61,24 +62,49 @@ int ipv6_rcv_saddr_equal(const struct so
28865 int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
28867 /* if both are mapped, treat as IPv4 */
28868 - if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED)
28869 - return (!sk2_ipv6only &&
28870 - (!sk1_rcv_saddr || !sk2_rcv_saddr ||
28871 - sk1_rcv_saddr == sk2_rcv_saddr));
28872 + if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) {
28873 + if (!sk2_ipv6only &&
28874 + (!sk_rcv_saddr || !sk2_rcv_saddr ||
28875 + sk_rcv_saddr == sk2_rcv_saddr))
28881 if (addr_type2 == IPV6_ADDR_ANY &&
28882 !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
28886 if (addr_type == IPV6_ADDR_ANY &&
28887 !(sk_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
28891 if (sk2_rcv_saddr6 &&
28892 ipv6_addr_equal(sk_rcv_saddr6, sk2_rcv_saddr6))
28899 + if (!sk_rcv_saddr && !sk2_rcv_saddr)
28900 + return nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28901 + if (!sk2_rcv_saddr)
28902 + return v4_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr, -1);
28903 + if (!sk_rcv_saddr)
28904 + return v4_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr, -1);
28907 + if (addr_type2 == IPV6_ADDR_ANY && addr_type == IPV6_ADDR_ANY)
28908 + return nx_v6_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28909 + else if (addr_type2 == IPV6_ADDR_ANY)
28910 + return v6_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr6, -1);
28911 + else if (addr_type == IPV6_ADDR_ANY) {
28912 + if (addr_type2 == IPV6_ADDR_MAPPED)
28913 + return nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28915 + return v6_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr6, -1);
28920 static unsigned int udp6_portaddr_hash(struct net *net,
28921 @@ -133,6 +159,10 @@ static inline int compute_score(struct s
28922 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
28926 + /* block non nx_info ips */
28927 + if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
28930 if (!ipv6_addr_any(&np->daddr)) {
28931 if (!ipv6_addr_equal(&np->daddr, saddr))
28932 diff -NurpP --minimal linux-2.6.33.2/net/ipv6/xfrm6_policy.c linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/xfrm6_policy.c
28933 --- linux-2.6.33.2/net/ipv6/xfrm6_policy.c 2010-04-06 01:47:47.000000000 +0200
28934 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/ipv6/xfrm6_policy.c 2010-04-06 01:59:25.000000000 +0200
28935 @@ -62,7 +62,7 @@ static int xfrm6_get_saddr(struct net *n
28936 dev = ip6_dst_idev(dst)->dev;
28937 ipv6_dev_get_saddr(dev_net(dev), dev,
28938 (struct in6_addr *)&daddr->a6, 0,
28939 - (struct in6_addr *)&saddr->a6);
28940 + (struct in6_addr *)&saddr->a6, NULL);
28944 diff -NurpP --minimal linux-2.6.33.2/net/netlink/af_netlink.c linux-2.6.33.2-vs2.3.0.36.30.4/net/netlink/af_netlink.c
28945 --- linux-2.6.33.2/net/netlink/af_netlink.c 2010-04-06 01:47:47.000000000 +0200
28946 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/netlink/af_netlink.c 2010-04-06 01:59:25.000000000 +0200
28948 #include <linux/types.h>
28949 #include <linux/audit.h>
28950 #include <linux/mutex.h>
28951 +#include <linux/vs_context.h>
28952 +#include <linux/vs_network.h>
28953 +#include <linux/vs_limit.h>
28955 #include <net/net_namespace.h>
28956 #include <net/sock.h>
28957 @@ -1916,6 +1919,8 @@ static struct sock *netlink_seq_socket_i
28958 sk_for_each(s, node, &hash->table[j]) {
28959 if (sock_net(s) != seq_file_net(seq))
28961 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
28965 iter->hash_idx = j;
28966 @@ -1950,7 +1955,8 @@ static void *netlink_seq_next(struct seq
28970 - } while (s && sock_net(s) != seq_file_net(seq));
28971 + } while (s && (sock_net(s) != seq_file_net(seq) ||
28972 + !nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT)));
28976 @@ -1962,7 +1968,8 @@ static void *netlink_seq_next(struct seq
28978 for (; j <= hash->mask; j++) {
28979 s = sk_head(&hash->table[j]);
28980 - while (s && sock_net(s) != seq_file_net(seq))
28981 + while (s && (sock_net(s) != seq_file_net(seq) ||
28982 + !nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT)))
28986 diff -NurpP --minimal linux-2.6.33.2/net/sctp/ipv6.c linux-2.6.33.2-vs2.3.0.36.30.4/net/sctp/ipv6.c
28987 --- linux-2.6.33.2/net/sctp/ipv6.c 2010-02-25 11:52:12.000000000 +0100
28988 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/sctp/ipv6.c 2010-02-25 12:02:16.000000000 +0100
28989 @@ -316,7 +316,8 @@ static void sctp_v6_get_saddr(struct sct
28990 dst ? ip6_dst_idev(dst)->dev : NULL,
28991 &daddr->v6.sin6_addr,
28992 inet6_sk(&sk->inet.sk)->srcprefs,
28993 - &saddr->v6.sin6_addr);
28994 + &saddr->v6.sin6_addr,
28995 + asoc->base.sk->sk_nx_info);
28996 SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: %pI6\n",
28997 &saddr->v6.sin6_addr);
28999 diff -NurpP --minimal linux-2.6.33.2/net/socket.c linux-2.6.33.2-vs2.3.0.36.30.4/net/socket.c
29000 --- linux-2.6.33.2/net/socket.c 2010-02-25 11:52:12.000000000 +0100
29001 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/socket.c 2010-02-25 13:51:25.000000000 +0100
29004 #include <net/sock.h>
29005 #include <linux/netfilter.h>
29006 +#include <linux/vs_base.h>
29007 +#include <linux/vs_socket.h>
29008 +#include <linux/vs_inet.h>
29009 +#include <linux/vs_inet6.h>
29011 #include <linux/if_tun.h>
29012 #include <linux/ipv6_route.h>
29013 @@ -539,7 +543,7 @@ static inline int __sock_sendmsg(struct
29014 struct msghdr *msg, size_t size)
29016 struct sock_iocb *si = kiocb_to_siocb(iocb);
29022 @@ -550,7 +554,22 @@ static inline int __sock_sendmsg(struct
29026 - return sock->ops->sendmsg(iocb, sock, msg, size);
29027 + len = sock->ops->sendmsg(iocb, sock, msg, size);
29030 + vx_sock_send(sock->sk, size);
29032 + vx_sock_fail(sock->sk, size);
29034 + vxdprintk(VXD_CBIT(net, 7),
29035 + "__sock_sendmsg: %p[%p,%p,%p;%d/%d]:%d/%d",
29037 + (sock->sk)?sock->sk->sk_nx_info:0,
29038 + (sock->sk)?sock->sk->sk_vx_info:0,
29039 + (sock->sk)?sock->sk->sk_xid:0,
29040 + (sock->sk)?sock->sk->sk_nid:0,
29041 + (unsigned int)size, len);
29045 int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
29046 @@ -667,6 +686,7 @@ static inline int __sock_recvmsg_nosec(s
29047 struct msghdr *msg, size_t size, int flags)
29049 struct sock_iocb *si = kiocb_to_siocb(iocb);
29054 @@ -674,7 +694,18 @@ static inline int __sock_recvmsg_nosec(s
29058 - return sock->ops->recvmsg(iocb, sock, msg, size, flags);
29059 + len = sock->ops->recvmsg(iocb, sock, msg, size, flags);
29060 + if ((len >= 0) && sock->sk)
29061 + vx_sock_recv(sock->sk, len);
29062 + vxdprintk(VXD_CBIT(net, 7),
29063 + "__sock_recvmsg: %p[%p,%p,%p;%d/%d]:%d/%d",
29065 + (sock->sk)?sock->sk->sk_nx_info:0,
29066 + (sock->sk)?sock->sk->sk_vx_info:0,
29067 + (sock->sk)?sock->sk->sk_xid:0,
29068 + (sock->sk)?sock->sk->sk_nid:0,
29069 + (unsigned int)size, len);
29073 static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock,
29074 @@ -1182,6 +1213,13 @@ static int __sock_create(struct net *net
29075 if (type < 0 || type >= SOCK_MAX)
29078 + if (!nx_check(0, VS_ADMIN)) {
29079 + if (family == PF_INET && !current_nx_info_has_v4())
29080 + return -EAFNOSUPPORT;
29081 + if (family == PF_INET6 && !current_nx_info_has_v6())
29082 + return -EAFNOSUPPORT;
29087 This uglymoron is moved from INET layer to here to avoid
29088 @@ -1314,6 +1352,7 @@ SYSCALL_DEFINE3(socket, int, family, int
29092 + set_bit(SOCK_USER_SOCKET, &sock->flags);
29093 retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
29096 @@ -1355,10 +1394,12 @@ SYSCALL_DEFINE4(socketpair, int, family,
29097 err = sock_create(family, type, protocol, &sock1);
29100 + set_bit(SOCK_USER_SOCKET, &sock1->flags);
29102 err = sock_create(family, type, protocol, &sock2);
29104 goto out_release_1;
29105 + set_bit(SOCK_USER_SOCKET, &sock2->flags);
29107 err = sock1->ops->socketpair(sock1, sock2);
29109 diff -NurpP --minimal linux-2.6.33.2/net/sunrpc/auth.c linux-2.6.33.2-vs2.3.0.36.30.4/net/sunrpc/auth.c
29110 --- linux-2.6.33.2/net/sunrpc/auth.c 2010-02-25 11:52:12.000000000 +0100
29111 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/sunrpc/auth.c 2010-02-25 12:02:16.000000000 +0100
29113 #include <linux/hash.h>
29114 #include <linux/sunrpc/clnt.h>
29115 #include <linux/spinlock.h>
29116 +#include <linux/vs_tag.h>
29119 # define RPCDBG_FACILITY RPCDBG_AUTH
29120 @@ -363,6 +364,7 @@ rpcauth_lookupcred(struct rpc_auth *auth
29121 memset(&acred, 0, sizeof(acred));
29122 acred.uid = cred->fsuid;
29123 acred.gid = cred->fsgid;
29124 + acred.tag = dx_current_tag();
29125 acred.group_info = get_group_info(((struct cred *)cred)->group_info);
29127 ret = auth->au_ops->lookup_cred(auth, &acred, flags);
29128 @@ -403,6 +405,7 @@ rpcauth_bind_root_cred(struct rpc_task *
29129 struct auth_cred acred = {
29132 + .tag = dx_current_tag(),
29134 struct rpc_cred *ret;
29136 diff -NurpP --minimal linux-2.6.33.2/net/sunrpc/auth_unix.c linux-2.6.33.2-vs2.3.0.36.30.4/net/sunrpc/auth_unix.c
29137 --- linux-2.6.33.2/net/sunrpc/auth_unix.c 2008-12-25 00:26:37.000000000 +0100
29138 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/sunrpc/auth_unix.c 2010-02-25 12:02:16.000000000 +0100
29139 @@ -11,12 +11,14 @@
29140 #include <linux/module.h>
29141 #include <linux/sunrpc/clnt.h>
29142 #include <linux/sunrpc/auth.h>
29143 +#include <linux/vs_tag.h>
29145 #define NFS_NGROUPS 16
29148 struct rpc_cred uc_base;
29151 gid_t uc_gids[NFS_NGROUPS];
29153 #define uc_uid uc_base.cr_uid
29154 @@ -78,6 +80,7 @@ unx_create_cred(struct rpc_auth *auth, s
29155 groups = NFS_NGROUPS;
29157 cred->uc_gid = acred->gid;
29158 + cred->uc_tag = acred->tag;
29159 for (i = 0; i < groups; i++)
29160 cred->uc_gids[i] = GROUP_AT(acred->group_info, i);
29161 if (i < NFS_NGROUPS)
29162 @@ -119,7 +122,9 @@ unx_match(struct auth_cred *acred, struc
29166 - if (cred->uc_uid != acred->uid || cred->uc_gid != acred->gid)
29167 + if (cred->uc_uid != acred->uid ||
29168 + cred->uc_gid != acred->gid ||
29169 + cred->uc_tag != acred->tag)
29172 if (acred->group_info != NULL)
29173 @@ -142,7 +147,7 @@ unx_marshal(struct rpc_task *task, __be3
29174 struct rpc_clnt *clnt = task->tk_client;
29175 struct unx_cred *cred = container_of(task->tk_msg.rpc_cred, struct unx_cred, uc_base);
29176 __be32 *base, *hold;
29180 *p++ = htonl(RPC_AUTH_UNIX);
29182 @@ -152,9 +157,12 @@ unx_marshal(struct rpc_task *task, __be3
29183 * Copy the UTS nodename captured when the client was created.
29185 p = xdr_encode_array(p, clnt->cl_nodename, clnt->cl_nodelen);
29186 + tag = task->tk_client->cl_tag;
29188 - *p++ = htonl((u32) cred->uc_uid);
29189 - *p++ = htonl((u32) cred->uc_gid);
29190 + *p++ = htonl((u32) TAGINO_UID(tag,
29191 + cred->uc_uid, cred->uc_tag));
29192 + *p++ = htonl((u32) TAGINO_GID(tag,
29193 + cred->uc_gid, cred->uc_tag));
29195 for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++)
29196 *p++ = htonl((u32) cred->uc_gids[i]);
29197 diff -NurpP --minimal linux-2.6.33.2/net/sunrpc/clnt.c linux-2.6.33.2-vs2.3.0.36.30.4/net/sunrpc/clnt.c
29198 --- linux-2.6.33.2/net/sunrpc/clnt.c 2010-02-25 11:52:12.000000000 +0100
29199 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/sunrpc/clnt.c 2010-02-25 12:02:16.000000000 +0100
29201 #include <linux/utsname.h>
29202 #include <linux/workqueue.h>
29203 #include <linux/in6.h>
29204 +#include <linux/vs_cvirt.h>
29206 #include <linux/sunrpc/clnt.h>
29207 #include <linux/sunrpc/rpc_pipe_fs.h>
29208 @@ -358,6 +359,9 @@ struct rpc_clnt *rpc_create(struct rpc_c
29209 if (!(args->flags & RPC_CLNT_CREATE_QUIET))
29210 clnt->cl_chatty = 1;
29212 + /* TODO: handle RPC_CLNT_CREATE_TAGGED
29213 + if (args->flags & RPC_CLNT_CREATE_TAGGED)
29214 + clnt->cl_tag = 1; */
29217 EXPORT_SYMBOL_GPL(rpc_create);
29218 diff -NurpP --minimal linux-2.6.33.2/net/unix/af_unix.c linux-2.6.33.2-vs2.3.0.36.30.4/net/unix/af_unix.c
29219 --- linux-2.6.33.2/net/unix/af_unix.c 2010-02-25 11:52:12.000000000 +0100
29220 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/unix/af_unix.c 2010-02-25 12:02:16.000000000 +0100
29221 @@ -114,6 +114,8 @@
29222 #include <linux/mount.h>
29223 #include <net/checksum.h>
29224 #include <linux/security.h>
29225 +#include <linux/vs_context.h>
29226 +#include <linux/vs_limit.h>
29228 static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
29229 static DEFINE_SPINLOCK(unix_table_lock);
29230 @@ -258,6 +260,8 @@ static struct sock *__unix_find_socket_b
29231 if (!net_eq(sock_net(s), net))
29234 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
29236 if (u->addr->len == len &&
29237 !memcmp(u->addr->name, sunname, len))
29239 @@ -2115,6 +2119,8 @@ static struct sock *unix_seq_idx(struct
29240 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) {
29241 if (sock_net(s) != seq_file_net(seq))
29243 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
29248 @@ -2139,7 +2145,8 @@ static void *unix_seq_next(struct seq_fi
29249 sk = first_unix_socket(&iter->i);
29251 sk = next_unix_socket(&iter->i, sk);
29252 - while (sk && (sock_net(sk) != seq_file_net(seq)))
29253 + while (sk && (sock_net(sk) != seq_file_net(seq) ||
29254 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)))
29255 sk = next_unix_socket(&iter->i, sk);
29258 diff -NurpP --minimal linux-2.6.33.2/net/x25/af_x25.c linux-2.6.33.2-vs2.3.0.36.30.4/net/x25/af_x25.c
29259 --- linux-2.6.33.2/net/x25/af_x25.c 2010-02-25 11:52:12.000000000 +0100
29260 +++ linux-2.6.33.2-vs2.3.0.36.30.4/net/x25/af_x25.c 2010-02-25 12:02:16.000000000 +0100
29261 @@ -526,7 +526,10 @@ static int x25_create(struct net *net, s
29265 - sock_init_data(sock, sk);
29266 + sk->sk_socket = sock;
29267 + sk->sk_type = sock->type;
29268 + sk->sk_sleep = &sock->wait;
29271 x25_init_timers(sk);
29273 diff -NurpP --minimal linux-2.6.33.2/scripts/checksyscalls.sh linux-2.6.33.2-vs2.3.0.36.30.4/scripts/checksyscalls.sh
29274 --- linux-2.6.33.2/scripts/checksyscalls.sh 2009-09-10 15:26:31.000000000 +0200
29275 +++ linux-2.6.33.2-vs2.3.0.36.30.4/scripts/checksyscalls.sh 2010-02-25 12:02:16.000000000 +0100
29276 @@ -194,7 +194,6 @@ cat << EOF
29277 #define __IGNORE_afs_syscall
29278 #define __IGNORE_getpmsg
29279 #define __IGNORE_putpmsg
29280 -#define __IGNORE_vserver
29284 diff -NurpP --minimal linux-2.6.33.2/security/commoncap.c linux-2.6.33.2-vs2.3.0.36.30.4/security/commoncap.c
29285 --- linux-2.6.33.2/security/commoncap.c 2010-02-25 11:52:12.000000000 +0100
29286 +++ linux-2.6.33.2-vs2.3.0.36.30.4/security/commoncap.c 2010-03-05 15:30:01.000000000 +0100
29288 #include <linux/sched.h>
29289 #include <linux/prctl.h>
29290 #include <linux/securebits.h>
29291 +#include <linux/vs_context.h>
29294 * If a non-root user executes a setuid-root binary in
29295 @@ -52,7 +53,7 @@ static void warn_setuid_and_fcaps_mixed(
29297 int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
29299 - NETLINK_CB(skb).eff_cap = current_cap();
29300 + NETLINK_CB(skb).eff_cap = vx_mbcaps(current_cap());
29304 @@ -62,6 +63,7 @@ int cap_netlink_recv(struct sk_buff *skb
29309 EXPORT_SYMBOL(cap_netlink_recv);
29312 @@ -82,7 +84,22 @@ EXPORT_SYMBOL(cap_netlink_recv);
29313 int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap,
29316 - return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;
29317 + struct vx_info *vxi = tsk->vx_info;
29320 + printk("cap_capable() VXF_STATE_SETUP = %llx, raised = %x, eff = %08x:%08x\n",
29321 + vx_info_flags(vxi, VXF_STATE_SETUP, 0),
29322 + cap_raised(tsk->cap_effective, cap),
29323 + tsk->cap_effective.cap[1], tsk->cap_effective.cap[0]);
29326 + /* special case SETUP */
29327 + if (vx_info_flags(vxi, VXF_STATE_SETUP, 0) &&
29328 + /* FIXME: maybe use cred instead? */
29329 + cap_raised(tsk->cred->cap_effective, cap))
29332 + return vx_cap_raised(vxi, cred->cap_effective, cap) ? 0 : -EPERM;
29336 @@ -570,7 +587,7 @@ int cap_inode_setxattr(struct dentry *de
29338 if (!strncmp(name, XATTR_SECURITY_PREFIX,
29339 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
29340 - !capable(CAP_SYS_ADMIN))
29341 + !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
29345 @@ -596,7 +613,7 @@ int cap_inode_removexattr(struct dentry
29347 if (!strncmp(name, XATTR_SECURITY_PREFIX,
29348 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
29349 - !capable(CAP_SYS_ADMIN))
29350 + !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
29354 @@ -894,7 +911,8 @@ error:
29356 int cap_syslog(int type)
29358 - if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
29359 + if ((type != 3 && type != 10) &&
29360 + !vx_capable(CAP_SYS_ADMIN, VXC_SYSLOG))
29364 @@ -946,3 +964,4 @@ int cap_file_mmap(struct file *file, uns
29369 diff -NurpP --minimal linux-2.6.33.2/security/selinux/av_permissions.h linux-2.6.33.2-vs2.3.0.36.30.4/security/selinux/av_permissions.h
29370 --- linux-2.6.33.2/security/selinux/av_permissions.h 1970-01-01 01:00:00.000000000 +0100
29371 +++ linux-2.6.33.2-vs2.3.0.36.30.4/security/selinux/av_permissions.h 2010-02-27 15:49:05.000000000 +0100
29373 +/* This file is automatically generated. Do not edit. */
29374 +#ifndef _SELINUX_AV_PERMISSIONS_H_
29375 +#define _SELINUX_AV_PERMISSIONS_H_
29377 +#define SECURITY__COMPUTE_AV 0x00000001UL
29378 +#define SECURITY__COMPUTE_CREATE 0x00000002UL
29379 +#define SECURITY__COMPUTE_MEMBER 0x00000004UL
29380 +#define SECURITY__CHECK_CONTEXT 0x00000008UL
29381 +#define SECURITY__LOAD_POLICY 0x00000010UL
29382 +#define SECURITY__COMPUTE_RELABEL 0x00000020UL
29383 +#define SECURITY__COMPUTE_USER 0x00000040UL
29384 +#define SECURITY__SETENFORCE 0x00000080UL
29385 +#define SECURITY__SETBOOL 0x00000100UL
29386 +#define SECURITY__SETSECPARAM 0x00000200UL
29387 +#define SECURITY__SETCHECKREQPROT 0x00000400UL
29388 +#define PROCESS__FORK 0x00000001UL
29389 +#define PROCESS__TRANSITION 0x00000002UL
29390 +#define PROCESS__SIGCHLD 0x00000004UL
29391 +#define PROCESS__SIGKILL 0x00000008UL
29392 +#define PROCESS__SIGSTOP 0x00000010UL
29393 +#define PROCESS__SIGNULL 0x00000020UL
29394 +#define PROCESS__SIGNAL 0x00000040UL
29395 +#define PROCESS__PTRACE 0x00000080UL
29396 +#define PROCESS__GETSCHED 0x00000100UL
29397 +#define PROCESS__SETSCHED 0x00000200UL
29398 +#define PROCESS__GETSESSION 0x00000400UL
29399 +#define PROCESS__GETPGID 0x00000800UL
29400 +#define PROCESS__SETPGID 0x00001000UL
29401 +#define PROCESS__GETCAP 0x00002000UL
29402 +#define PROCESS__SETCAP 0x00004000UL
29403 +#define PROCESS__SHARE 0x00008000UL
29404 +#define PROCESS__GETATTR 0x00010000UL
29405 +#define PROCESS__SETEXEC 0x00020000UL
29406 +#define PROCESS__SETFSCREATE 0x00040000UL
29407 +#define PROCESS__NOATSECURE 0x00080000UL
29408 +#define PROCESS__SIGINH 0x00100000UL
29409 +#define PROCESS__SETRLIMIT 0x00200000UL
29410 +#define PROCESS__RLIMITINH 0x00400000UL
29411 +#define PROCESS__DYNTRANSITION 0x00800000UL
29412 +#define PROCESS__SETCURRENT 0x01000000UL
29413 +#define PROCESS__EXECMEM 0x02000000UL
29414 +#define PROCESS__EXECSTACK 0x04000000UL
29415 +#define PROCESS__EXECHEAP 0x08000000UL
29416 +#define PROCESS__SETKEYCREATE 0x10000000UL
29417 +#define PROCESS__SETSOCKCREATE 0x20000000UL
29418 +#define SYSTEM__IPC_INFO 0x00000001UL
29419 +#define SYSTEM__SYSLOG_READ 0x00000002UL
29420 +#define SYSTEM__SYSLOG_MOD 0x00000004UL
29421 +#define SYSTEM__SYSLOG_CONSOLE 0x00000008UL
29422 +#define SYSTEM__MODULE_REQUEST 0x00000010UL
29423 +#define CAPABILITY__CHOWN 0x00000001UL
29424 +#define CAPABILITY__DAC_OVERRIDE 0x00000002UL
29425 +#define CAPABILITY__DAC_READ_SEARCH 0x00000004UL
29426 +#define CAPABILITY__FOWNER 0x00000008UL
29427 +#define CAPABILITY__FSETID 0x00000010UL
29428 +#define CAPABILITY__KILL 0x00000020UL
29429 +#define CAPABILITY__SETGID 0x00000040UL
29430 +#define CAPABILITY__SETUID 0x00000080UL
29431 +#define CAPABILITY__SETPCAP 0x00000100UL
29432 +#define CAPABILITY__LINUX_IMMUTABLE 0x00000200UL
29433 +#define CAPABILITY__NET_BIND_SERVICE 0x00000400UL
29434 +#define CAPABILITY__NET_BROADCAST 0x00000800UL
29435 +#define CAPABILITY__NET_ADMIN 0x00001000UL
29436 +#define CAPABILITY__NET_RAW 0x00002000UL
29437 +#define CAPABILITY__IPC_LOCK 0x00004000UL
29438 +#define CAPABILITY__IPC_OWNER 0x00008000UL
29439 +#define CAPABILITY__SYS_MODULE 0x00010000UL
29440 +#define CAPABILITY__SYS_RAWIO 0x00020000UL
29441 +#define CAPABILITY__SYS_CHROOT 0x00040000UL
29442 +#define CAPABILITY__SYS_PTRACE 0x00080000UL
29443 +#define CAPABILITY__SYS_PACCT 0x00100000UL
29444 +#define CAPABILITY__SYS_ADMIN 0x00200000UL
29445 +#define CAPABILITY__SYS_BOOT 0x00400000UL
29446 +#define CAPABILITY__SYS_NICE 0x00800000UL
29447 +#define CAPABILITY__SYS_RESOURCE 0x01000000UL
29448 +#define CAPABILITY__SYS_TIME 0x02000000UL
29449 +#define CAPABILITY__SYS_TTY_CONFIG 0x04000000UL
29450 +#define CAPABILITY__MKNOD 0x08000000UL
29451 +#define CAPABILITY__LEASE 0x10000000UL
29452 +#define CAPABILITY__AUDIT_WRITE 0x20000000UL
29453 +#define CAPABILITY__AUDIT_CONTROL 0x40000000UL
29454 +#define CAPABILITY__SETFCAP 0x80000000UL
29455 +#define FILESYSTEM__MOUNT 0x00000001UL
29456 +#define FILESYSTEM__REMOUNT 0x00000002UL
29457 +#define FILESYSTEM__UNMOUNT 0x00000004UL
29458 +#define FILESYSTEM__GETATTR 0x00000008UL
29459 +#define FILESYSTEM__RELABELFROM 0x00000010UL
29460 +#define FILESYSTEM__RELABELTO 0x00000020UL
29461 +#define FILESYSTEM__TRANSITION 0x00000040UL
29462 +#define FILESYSTEM__ASSOCIATE 0x00000080UL
29463 +#define FILESYSTEM__QUOTAMOD 0x00000100UL
29464 +#define FILESYSTEM__QUOTAGET 0x00000200UL
29465 +#define FILE__IOCTL 0x00000001UL
29466 +#define FILE__READ 0x00000002UL
29467 +#define FILE__WRITE 0x00000004UL
29468 +#define FILE__CREATE 0x00000008UL
29469 +#define FILE__GETATTR 0x00000010UL
29470 +#define FILE__SETATTR 0x00000020UL
29471 +#define FILE__LOCK 0x00000040UL
29472 +#define FILE__RELABELFROM 0x00000080UL
29473 +#define FILE__RELABELTO 0x00000100UL
29474 +#define FILE__APPEND 0x00000200UL
29475 +#define FILE__UNLINK 0x00000400UL
29476 +#define FILE__LINK 0x00000800UL
29477 +#define FILE__RENAME 0x00001000UL
29478 +#define FILE__EXECUTE 0x00002000UL
29479 +#define FILE__SWAPON 0x00004000UL
29480 +#define FILE__QUOTAON 0x00008000UL
29481 +#define FILE__MOUNTON 0x00010000UL
29482 +#define FILE__EXECUTE_NO_TRANS 0x00020000UL
29483 +#define FILE__ENTRYPOINT 0x00040000UL
29484 +#define FILE__EXECMOD 0x00080000UL
29485 +#define FILE__OPEN 0x00100000UL
29486 +#define DIR__IOCTL 0x00000001UL
29487 +#define DIR__READ 0x00000002UL
29488 +#define DIR__WRITE 0x00000004UL
29489 +#define DIR__CREATE 0x00000008UL
29490 +#define DIR__GETATTR 0x00000010UL
29491 +#define DIR__SETATTR 0x00000020UL
29492 +#define DIR__LOCK 0x00000040UL
29493 +#define DIR__RELABELFROM 0x00000080UL
29494 +#define DIR__RELABELTO 0x00000100UL
29495 +#define DIR__APPEND 0x00000200UL
29496 +#define DIR__UNLINK 0x00000400UL
29497 +#define DIR__LINK 0x00000800UL
29498 +#define DIR__RENAME 0x00001000UL
29499 +#define DIR__EXECUTE 0x00002000UL
29500 +#define DIR__SWAPON 0x00004000UL
29501 +#define DIR__QUOTAON 0x00008000UL
29502 +#define DIR__MOUNTON 0x00010000UL
29503 +#define DIR__ADD_NAME 0x00020000UL
29504 +#define DIR__REMOVE_NAME 0x00040000UL
29505 +#define DIR__REPARENT 0x00080000UL
29506 +#define DIR__SEARCH 0x00100000UL
29507 +#define DIR__RMDIR 0x00200000UL
29508 +#define DIR__OPEN 0x00400000UL
29509 +#define FD__USE 0x00000001UL
29510 +#define LNK_FILE__IOCTL 0x00000001UL
29511 +#define LNK_FILE__READ 0x00000002UL
29512 +#define LNK_FILE__WRITE 0x00000004UL
29513 +#define LNK_FILE__CREATE 0x00000008UL
29514 +#define LNK_FILE__GETATTR 0x00000010UL
29515 +#define LNK_FILE__SETATTR 0x00000020UL
29516 +#define LNK_FILE__LOCK 0x00000040UL
29517 +#define LNK_FILE__RELABELFROM 0x00000080UL
29518 +#define LNK_FILE__RELABELTO 0x00000100UL
29519 +#define LNK_FILE__APPEND 0x00000200UL
29520 +#define LNK_FILE__UNLINK 0x00000400UL
29521 +#define LNK_FILE__LINK 0x00000800UL
29522 +#define LNK_FILE__RENAME 0x00001000UL
29523 +#define LNK_FILE__EXECUTE 0x00002000UL
29524 +#define LNK_FILE__SWAPON 0x00004000UL
29525 +#define LNK_FILE__QUOTAON 0x00008000UL
29526 +#define LNK_FILE__MOUNTON 0x00010000UL
29527 +#define CHR_FILE__IOCTL 0x00000001UL
29528 +#define CHR_FILE__READ 0x00000002UL
29529 +#define CHR_FILE__WRITE 0x00000004UL
29530 +#define CHR_FILE__CREATE 0x00000008UL
29531 +#define CHR_FILE__GETATTR 0x00000010UL
29532 +#define CHR_FILE__SETATTR 0x00000020UL
29533 +#define CHR_FILE__LOCK 0x00000040UL
29534 +#define CHR_FILE__RELABELFROM 0x00000080UL
29535 +#define CHR_FILE__RELABELTO 0x00000100UL
29536 +#define CHR_FILE__APPEND 0x00000200UL
29537 +#define CHR_FILE__UNLINK 0x00000400UL
29538 +#define CHR_FILE__LINK 0x00000800UL
29539 +#define CHR_FILE__RENAME 0x00001000UL
29540 +#define CHR_FILE__EXECUTE 0x00002000UL
29541 +#define CHR_FILE__SWAPON 0x00004000UL
29542 +#define CHR_FILE__QUOTAON 0x00008000UL
29543 +#define CHR_FILE__MOUNTON 0x00010000UL
29544 +#define CHR_FILE__EXECUTE_NO_TRANS 0x00020000UL
29545 +#define CHR_FILE__ENTRYPOINT 0x00040000UL
29546 +#define CHR_FILE__EXECMOD 0x00080000UL
29547 +#define CHR_FILE__OPEN 0x00100000UL
29548 +#define BLK_FILE__IOCTL 0x00000001UL
29549 +#define BLK_FILE__READ 0x00000002UL
29550 +#define BLK_FILE__WRITE 0x00000004UL
29551 +#define BLK_FILE__CREATE 0x00000008UL
29552 +#define BLK_FILE__GETATTR 0x00000010UL
29553 +#define BLK_FILE__SETATTR 0x00000020UL
29554 +#define BLK_FILE__LOCK 0x00000040UL
29555 +#define BLK_FILE__RELABELFROM 0x00000080UL
29556 +#define BLK_FILE__RELABELTO 0x00000100UL
29557 +#define BLK_FILE__APPEND 0x00000200UL
29558 +#define BLK_FILE__UNLINK 0x00000400UL
29559 +#define BLK_FILE__LINK 0x00000800UL
29560 +#define BLK_FILE__RENAME 0x00001000UL
29561 +#define BLK_FILE__EXECUTE 0x00002000UL
29562 +#define BLK_FILE__SWAPON 0x00004000UL
29563 +#define BLK_FILE__QUOTAON 0x00008000UL
29564 +#define BLK_FILE__MOUNTON 0x00010000UL
29565 +#define BLK_FILE__OPEN 0x00020000UL
29566 +#define SOCK_FILE__IOCTL 0x00000001UL
29567 +#define SOCK_FILE__READ 0x00000002UL
29568 +#define SOCK_FILE__WRITE 0x00000004UL
29569 +#define SOCK_FILE__CREATE 0x00000008UL
29570 +#define SOCK_FILE__GETATTR 0x00000010UL
29571 +#define SOCK_FILE__SETATTR 0x00000020UL
29572 +#define SOCK_FILE__LOCK 0x00000040UL
29573 +#define SOCK_FILE__RELABELFROM 0x00000080UL
29574 +#define SOCK_FILE__RELABELTO 0x00000100UL
29575 +#define SOCK_FILE__APPEND 0x00000200UL
29576 +#define SOCK_FILE__UNLINK 0x00000400UL
29577 +#define SOCK_FILE__LINK 0x00000800UL
29578 +#define SOCK_FILE__RENAME 0x00001000UL
29579 +#define SOCK_FILE__EXECUTE 0x00002000UL
29580 +#define SOCK_FILE__SWAPON 0x00004000UL
29581 +#define SOCK_FILE__QUOTAON 0x00008000UL
29582 +#define SOCK_FILE__MOUNTON 0x00010000UL
29583 +#define SOCK_FILE__OPEN 0x00020000UL
29584 +#define FIFO_FILE__IOCTL 0x00000001UL
29585 +#define FIFO_FILE__READ 0x00000002UL
29586 +#define FIFO_FILE__WRITE 0x00000004UL
29587 +#define FIFO_FILE__CREATE 0x00000008UL
29588 +#define FIFO_FILE__GETATTR 0x00000010UL
29589 +#define FIFO_FILE__SETATTR 0x00000020UL
29590 +#define FIFO_FILE__LOCK 0x00000040UL
29591 +#define FIFO_FILE__RELABELFROM 0x00000080UL
29592 +#define FIFO_FILE__RELABELTO 0x00000100UL
29593 +#define FIFO_FILE__APPEND 0x00000200UL
29594 +#define FIFO_FILE__UNLINK 0x00000400UL
29595 +#define FIFO_FILE__LINK 0x00000800UL
29596 +#define FIFO_FILE__RENAME 0x00001000UL
29597 +#define FIFO_FILE__EXECUTE 0x00002000UL
29598 +#define FIFO_FILE__SWAPON 0x00004000UL
29599 +#define FIFO_FILE__QUOTAON 0x00008000UL
29600 +#define FIFO_FILE__MOUNTON 0x00010000UL
29601 +#define FIFO_FILE__OPEN 0x00020000UL
29602 +#define SOCKET__IOCTL 0x00000001UL
29603 +#define SOCKET__READ 0x00000002UL
29604 +#define SOCKET__WRITE 0x00000004UL
29605 +#define SOCKET__CREATE 0x00000008UL
29606 +#define SOCKET__GETATTR 0x00000010UL
29607 +#define SOCKET__SETATTR 0x00000020UL
29608 +#define SOCKET__LOCK 0x00000040UL
29609 +#define SOCKET__RELABELFROM 0x00000080UL
29610 +#define SOCKET__RELABELTO 0x00000100UL
29611 +#define SOCKET__APPEND 0x00000200UL
29612 +#define SOCKET__BIND 0x00000400UL
29613 +#define SOCKET__CONNECT 0x00000800UL
29614 +#define SOCKET__LISTEN 0x00001000UL
29615 +#define SOCKET__ACCEPT 0x00002000UL
29616 +#define SOCKET__GETOPT 0x00004000UL
29617 +#define SOCKET__SETOPT 0x00008000UL
29618 +#define SOCKET__SHUTDOWN 0x00010000UL
29619 +#define SOCKET__RECVFROM 0x00020000UL
29620 +#define SOCKET__SENDTO 0x00040000UL
29621 +#define SOCKET__RECV_MSG 0x00080000UL
29622 +#define SOCKET__SEND_MSG 0x00100000UL
29623 +#define SOCKET__NAME_BIND 0x00200000UL
29624 +#define TCP_SOCKET__IOCTL 0x00000001UL
29625 +#define TCP_SOCKET__READ 0x00000002UL
29626 +#define TCP_SOCKET__WRITE 0x00000004UL
29627 +#define TCP_SOCKET__CREATE 0x00000008UL
29628 +#define TCP_SOCKET__GETATTR 0x00000010UL
29629 +#define TCP_SOCKET__SETATTR 0x00000020UL
29630 +#define TCP_SOCKET__LOCK 0x00000040UL
29631 +#define TCP_SOCKET__RELABELFROM 0x00000080UL
29632 +#define TCP_SOCKET__RELABELTO 0x00000100UL
29633 +#define TCP_SOCKET__APPEND 0x00000200UL
29634 +#define TCP_SOCKET__BIND 0x00000400UL
29635 +#define TCP_SOCKET__CONNECT 0x00000800UL
29636 +#define TCP_SOCKET__LISTEN 0x00001000UL
29637 +#define TCP_SOCKET__ACCEPT 0x00002000UL
29638 +#define TCP_SOCKET__GETOPT 0x00004000UL
29639 +#define TCP_SOCKET__SETOPT 0x00008000UL
29640 +#define TCP_SOCKET__SHUTDOWN 0x00010000UL
29641 +#define TCP_SOCKET__RECVFROM 0x00020000UL
29642 +#define TCP_SOCKET__SENDTO 0x00040000UL
29643 +#define TCP_SOCKET__RECV_MSG 0x00080000UL
29644 +#define TCP_SOCKET__SEND_MSG 0x00100000UL
29645 +#define TCP_SOCKET__NAME_BIND 0x00200000UL
29646 +#define TCP_SOCKET__CONNECTTO 0x00400000UL
29647 +#define TCP_SOCKET__NEWCONN 0x00800000UL
29648 +#define TCP_SOCKET__ACCEPTFROM 0x01000000UL
29649 +#define TCP_SOCKET__NODE_BIND 0x02000000UL
29650 +#define TCP_SOCKET__NAME_CONNECT 0x04000000UL
29651 +#define UDP_SOCKET__IOCTL 0x00000001UL
29652 +#define UDP_SOCKET__READ 0x00000002UL
29653 +#define UDP_SOCKET__WRITE 0x00000004UL
29654 +#define UDP_SOCKET__CREATE 0x00000008UL
29655 +#define UDP_SOCKET__GETATTR 0x00000010UL
29656 +#define UDP_SOCKET__SETATTR 0x00000020UL
29657 +#define UDP_SOCKET__LOCK 0x00000040UL
29658 +#define UDP_SOCKET__RELABELFROM 0x00000080UL
29659 +#define UDP_SOCKET__RELABELTO 0x00000100UL
29660 +#define UDP_SOCKET__APPEND 0x00000200UL
29661 +#define UDP_SOCKET__BIND 0x00000400UL
29662 +#define UDP_SOCKET__CONNECT 0x00000800UL
29663 +#define UDP_SOCKET__LISTEN 0x00001000UL
29664 +#define UDP_SOCKET__ACCEPT 0x00002000UL
29665 +#define UDP_SOCKET__GETOPT 0x00004000UL
29666 +#define UDP_SOCKET__SETOPT 0x00008000UL
29667 +#define UDP_SOCKET__SHUTDOWN 0x00010000UL
29668 +#define UDP_SOCKET__RECVFROM 0x00020000UL
29669 +#define UDP_SOCKET__SENDTO 0x00040000UL
29670 +#define UDP_SOCKET__RECV_MSG 0x00080000UL
29671 +#define UDP_SOCKET__SEND_MSG 0x00100000UL
29672 +#define UDP_SOCKET__NAME_BIND 0x00200000UL
29673 +#define UDP_SOCKET__NODE_BIND 0x00400000UL
29674 +#define RAWIP_SOCKET__IOCTL 0x00000001UL
29675 +#define RAWIP_SOCKET__READ 0x00000002UL
29676 +#define RAWIP_SOCKET__WRITE 0x00000004UL
29677 +#define RAWIP_SOCKET__CREATE 0x00000008UL
29678 +#define RAWIP_SOCKET__GETATTR 0x00000010UL
29679 +#define RAWIP_SOCKET__SETATTR 0x00000020UL
29680 +#define RAWIP_SOCKET__LOCK 0x00000040UL
29681 +#define RAWIP_SOCKET__RELABELFROM 0x00000080UL
29682 +#define RAWIP_SOCKET__RELABELTO 0x00000100UL
29683 +#define RAWIP_SOCKET__APPEND 0x00000200UL
29684 +#define RAWIP_SOCKET__BIND 0x00000400UL
29685 +#define RAWIP_SOCKET__CONNECT 0x00000800UL
29686 +#define RAWIP_SOCKET__LISTEN 0x00001000UL
29687 +#define RAWIP_SOCKET__ACCEPT 0x00002000UL
29688 +#define RAWIP_SOCKET__GETOPT 0x00004000UL
29689 +#define RAWIP_SOCKET__SETOPT 0x00008000UL
29690 +#define RAWIP_SOCKET__SHUTDOWN 0x00010000UL
29691 +#define RAWIP_SOCKET__RECVFROM 0x00020000UL
29692 +#define RAWIP_SOCKET__SENDTO 0x00040000UL
29693 +#define RAWIP_SOCKET__RECV_MSG 0x00080000UL
29694 +#define RAWIP_SOCKET__SEND_MSG 0x00100000UL
29695 +#define RAWIP_SOCKET__NAME_BIND 0x00200000UL
29696 +#define RAWIP_SOCKET__NODE_BIND 0x00400000UL
29697 +#define NODE__TCP_RECV 0x00000001UL
29698 +#define NODE__TCP_SEND 0x00000002UL
29699 +#define NODE__UDP_RECV 0x00000004UL
29700 +#define NODE__UDP_SEND 0x00000008UL
29701 +#define NODE__RAWIP_RECV 0x00000010UL
29702 +#define NODE__RAWIP_SEND 0x00000020UL
29703 +#define NODE__ENFORCE_DEST 0x00000040UL
29704 +#define NODE__DCCP_RECV 0x00000080UL
29705 +#define NODE__DCCP_SEND 0x00000100UL
29706 +#define NODE__RECVFROM 0x00000200UL
29707 +#define NODE__SENDTO 0x00000400UL
29708 +#define NETIF__TCP_RECV 0x00000001UL
29709 +#define NETIF__TCP_SEND 0x00000002UL
29710 +#define NETIF__UDP_RECV 0x00000004UL
29711 +#define NETIF__UDP_SEND 0x00000008UL
29712 +#define NETIF__RAWIP_RECV 0x00000010UL
29713 +#define NETIF__RAWIP_SEND 0x00000020UL
29714 +#define NETIF__DCCP_RECV 0x00000040UL
29715 +#define NETIF__DCCP_SEND 0x00000080UL
29716 +#define NETIF__INGRESS 0x00000100UL
29717 +#define NETIF__EGRESS 0x00000200UL
29718 +#define NETLINK_SOCKET__IOCTL 0x00000001UL
29719 +#define NETLINK_SOCKET__READ 0x00000002UL
29720 +#define NETLINK_SOCKET__WRITE 0x00000004UL
29721 +#define NETLINK_SOCKET__CREATE 0x00000008UL
29722 +#define NETLINK_SOCKET__GETATTR 0x00000010UL
29723 +#define NETLINK_SOCKET__SETATTR 0x00000020UL
29724 +#define NETLINK_SOCKET__LOCK 0x00000040UL
29725 +#define NETLINK_SOCKET__RELABELFROM 0x00000080UL
29726 +#define NETLINK_SOCKET__RELABELTO 0x00000100UL
29727 +#define NETLINK_SOCKET__APPEND 0x00000200UL
29728 +#define NETLINK_SOCKET__BIND 0x00000400UL
29729 +#define NETLINK_SOCKET__CONNECT 0x00000800UL
29730 +#define NETLINK_SOCKET__LISTEN 0x00001000UL
29731 +#define NETLINK_SOCKET__ACCEPT 0x00002000UL
29732 +#define NETLINK_SOCKET__GETOPT 0x00004000UL
29733 +#define NETLINK_SOCKET__SETOPT 0x00008000UL
29734 +#define NETLINK_SOCKET__SHUTDOWN 0x00010000UL
29735 +#define NETLINK_SOCKET__RECVFROM 0x00020000UL
29736 +#define NETLINK_SOCKET__SENDTO 0x00040000UL
29737 +#define NETLINK_SOCKET__RECV_MSG 0x00080000UL
29738 +#define NETLINK_SOCKET__SEND_MSG 0x00100000UL
29739 +#define NETLINK_SOCKET__NAME_BIND 0x00200000UL
29740 +#define PACKET_SOCKET__IOCTL 0x00000001UL
29741 +#define PACKET_SOCKET__READ 0x00000002UL
29742 +#define PACKET_SOCKET__WRITE 0x00000004UL
29743 +#define PACKET_SOCKET__CREATE 0x00000008UL
29744 +#define PACKET_SOCKET__GETATTR 0x00000010UL
29745 +#define PACKET_SOCKET__SETATTR 0x00000020UL
29746 +#define PACKET_SOCKET__LOCK 0x00000040UL
29747 +#define PACKET_SOCKET__RELABELFROM 0x00000080UL
29748 +#define PACKET_SOCKET__RELABELTO 0x00000100UL
29749 +#define PACKET_SOCKET__APPEND 0x00000200UL
29750 +#define PACKET_SOCKET__BIND 0x00000400UL
29751 +#define PACKET_SOCKET__CONNECT 0x00000800UL
29752 +#define PACKET_SOCKET__LISTEN 0x00001000UL
29753 +#define PACKET_SOCKET__ACCEPT 0x00002000UL
29754 +#define PACKET_SOCKET__GETOPT 0x00004000UL
29755 +#define PACKET_SOCKET__SETOPT 0x00008000UL
29756 +#define PACKET_SOCKET__SHUTDOWN 0x00010000UL
29757 +#define PACKET_SOCKET__RECVFROM 0x00020000UL
29758 +#define PACKET_SOCKET__SENDTO 0x00040000UL
29759 +#define PACKET_SOCKET__RECV_MSG 0x00080000UL
29760 +#define PACKET_SOCKET__SEND_MSG 0x00100000UL
29761 +#define PACKET_SOCKET__NAME_BIND 0x00200000UL
29762 +#define KEY_SOCKET__IOCTL 0x00000001UL
29763 +#define KEY_SOCKET__READ 0x00000002UL
29764 +#define KEY_SOCKET__WRITE 0x00000004UL
29765 +#define KEY_SOCKET__CREATE 0x00000008UL
29766 +#define KEY_SOCKET__GETATTR 0x00000010UL
29767 +#define KEY_SOCKET__SETATTR 0x00000020UL
29768 +#define KEY_SOCKET__LOCK 0x00000040UL
29769 +#define KEY_SOCKET__RELABELFROM 0x00000080UL
29770 +#define KEY_SOCKET__RELABELTO 0x00000100UL
29771 +#define KEY_SOCKET__APPEND 0x00000200UL
29772 +#define KEY_SOCKET__BIND 0x00000400UL
29773 +#define KEY_SOCKET__CONNECT 0x00000800UL
29774 +#define KEY_SOCKET__LISTEN 0x00001000UL
29775 +#define KEY_SOCKET__ACCEPT 0x00002000UL
29776 +#define KEY_SOCKET__GETOPT 0x00004000UL
29777 +#define KEY_SOCKET__SETOPT 0x00008000UL
29778 +#define KEY_SOCKET__SHUTDOWN 0x00010000UL
29779 +#define KEY_SOCKET__RECVFROM 0x00020000UL
29780 +#define KEY_SOCKET__SENDTO 0x00040000UL
29781 +#define KEY_SOCKET__RECV_MSG 0x00080000UL
29782 +#define KEY_SOCKET__SEND_MSG 0x00100000UL
29783 +#define KEY_SOCKET__NAME_BIND 0x00200000UL
29784 +#define UNIX_STREAM_SOCKET__IOCTL 0x00000001UL
29785 +#define UNIX_STREAM_SOCKET__READ 0x00000002UL
29786 +#define UNIX_STREAM_SOCKET__WRITE 0x00000004UL
29787 +#define UNIX_STREAM_SOCKET__CREATE 0x00000008UL
29788 +#define UNIX_STREAM_SOCKET__GETATTR 0x00000010UL
29789 +#define UNIX_STREAM_SOCKET__SETATTR 0x00000020UL
29790 +#define UNIX_STREAM_SOCKET__LOCK 0x00000040UL
29791 +#define UNIX_STREAM_SOCKET__RELABELFROM 0x00000080UL
29792 +#define UNIX_STREAM_SOCKET__RELABELTO 0x00000100UL
29793 +#define UNIX_STREAM_SOCKET__APPEND 0x00000200UL
29794 +#define UNIX_STREAM_SOCKET__BIND 0x00000400UL
29795 +#define UNIX_STREAM_SOCKET__CONNECT 0x00000800UL
29796 +#define UNIX_STREAM_SOCKET__LISTEN 0x00001000UL
29797 +#define UNIX_STREAM_SOCKET__ACCEPT 0x00002000UL
29798 +#define UNIX_STREAM_SOCKET__GETOPT 0x00004000UL
29799 +#define UNIX_STREAM_SOCKET__SETOPT 0x00008000UL
29800 +#define UNIX_STREAM_SOCKET__SHUTDOWN 0x00010000UL
29801 +#define UNIX_STREAM_SOCKET__RECVFROM 0x00020000UL
29802 +#define UNIX_STREAM_SOCKET__SENDTO 0x00040000UL
29803 +#define UNIX_STREAM_SOCKET__RECV_MSG 0x00080000UL
29804 +#define UNIX_STREAM_SOCKET__SEND_MSG 0x00100000UL
29805 +#define UNIX_STREAM_SOCKET__NAME_BIND 0x00200000UL
29806 +#define UNIX_STREAM_SOCKET__CONNECTTO 0x00400000UL
29807 +#define UNIX_STREAM_SOCKET__NEWCONN 0x00800000UL
29808 +#define UNIX_STREAM_SOCKET__ACCEPTFROM 0x01000000UL
29809 +#define UNIX_DGRAM_SOCKET__IOCTL 0x00000001UL
29810 +#define UNIX_DGRAM_SOCKET__READ 0x00000002UL
29811 +#define UNIX_DGRAM_SOCKET__WRITE 0x00000004UL
29812 +#define UNIX_DGRAM_SOCKET__CREATE 0x00000008UL
29813 +#define UNIX_DGRAM_SOCKET__GETATTR 0x00000010UL
29814 +#define UNIX_DGRAM_SOCKET__SETATTR 0x00000020UL
29815 +#define UNIX_DGRAM_SOCKET__LOCK 0x00000040UL
29816 +#define UNIX_DGRAM_SOCKET__RELABELFROM 0x00000080UL
29817 +#define UNIX_DGRAM_SOCKET__RELABELTO 0x00000100UL
29818 +#define UNIX_DGRAM_SOCKET__APPEND 0x00000200UL
29819 +#define UNIX_DGRAM_SOCKET__BIND 0x00000400UL
29820 +#define UNIX_DGRAM_SOCKET__CONNECT 0x00000800UL
29821 +#define UNIX_DGRAM_SOCKET__LISTEN 0x00001000UL
29822 +#define UNIX_DGRAM_SOCKET__ACCEPT 0x00002000UL
29823 +#define UNIX_DGRAM_SOCKET__GETOPT 0x00004000UL
29824 +#define UNIX_DGRAM_SOCKET__SETOPT 0x00008000UL
29825 +#define UNIX_DGRAM_SOCKET__SHUTDOWN 0x00010000UL
29826 +#define UNIX_DGRAM_SOCKET__RECVFROM 0x00020000UL
29827 +#define UNIX_DGRAM_SOCKET__SENDTO 0x00040000UL
29828 +#define UNIX_DGRAM_SOCKET__RECV_MSG 0x00080000UL
29829 +#define UNIX_DGRAM_SOCKET__SEND_MSG 0x00100000UL
29830 +#define UNIX_DGRAM_SOCKET__NAME_BIND 0x00200000UL
29831 +#define SEM__CREATE 0x00000001UL
29832 +#define SEM__DESTROY 0x00000002UL
29833 +#define SEM__GETATTR 0x00000004UL
29834 +#define SEM__SETATTR 0x00000008UL
29835 +#define SEM__READ 0x00000010UL
29836 +#define SEM__WRITE 0x00000020UL
29837 +#define SEM__ASSOCIATE 0x00000040UL
29838 +#define SEM__UNIX_READ 0x00000080UL
29839 +#define SEM__UNIX_WRITE 0x00000100UL
29840 +#define MSG__SEND 0x00000001UL
29841 +#define MSG__RECEIVE 0x00000002UL
29842 +#define MSGQ__CREATE 0x00000001UL
29843 +#define MSGQ__DESTROY 0x00000002UL
29844 +#define MSGQ__GETATTR 0x00000004UL
29845 +#define MSGQ__SETATTR 0x00000008UL
29846 +#define MSGQ__READ 0x00000010UL
29847 +#define MSGQ__WRITE 0x00000020UL
29848 +#define MSGQ__ASSOCIATE 0x00000040UL
29849 +#define MSGQ__UNIX_READ 0x00000080UL
29850 +#define MSGQ__UNIX_WRITE 0x00000100UL
29851 +#define MSGQ__ENQUEUE 0x00000200UL
29852 +#define SHM__CREATE 0x00000001UL
29853 +#define SHM__DESTROY 0x00000002UL
29854 +#define SHM__GETATTR 0x00000004UL
29855 +#define SHM__SETATTR 0x00000008UL
29856 +#define SHM__READ 0x00000010UL
29857 +#define SHM__WRITE 0x00000020UL
29858 +#define SHM__ASSOCIATE 0x00000040UL
29859 +#define SHM__UNIX_READ 0x00000080UL
29860 +#define SHM__UNIX_WRITE 0x00000100UL
29861 +#define SHM__LOCK 0x00000200UL
29862 +#define IPC__CREATE 0x00000001UL
29863 +#define IPC__DESTROY 0x00000002UL
29864 +#define IPC__GETATTR 0x00000004UL
29865 +#define IPC__SETATTR 0x00000008UL
29866 +#define IPC__READ 0x00000010UL
29867 +#define IPC__WRITE 0x00000020UL
29868 +#define IPC__ASSOCIATE 0x00000040UL
29869 +#define IPC__UNIX_READ 0x00000080UL
29870 +#define IPC__UNIX_WRITE 0x00000100UL
29871 +#define NETLINK_ROUTE_SOCKET__IOCTL 0x00000001UL
29872 +#define NETLINK_ROUTE_SOCKET__READ 0x00000002UL
29873 +#define NETLINK_ROUTE_SOCKET__WRITE 0x00000004UL
29874 +#define NETLINK_ROUTE_SOCKET__CREATE 0x00000008UL
29875 +#define NETLINK_ROUTE_SOCKET__GETATTR 0x00000010UL
29876 +#define NETLINK_ROUTE_SOCKET__SETATTR 0x00000020UL
29877 +#define NETLINK_ROUTE_SOCKET__LOCK 0x00000040UL
29878 +#define NETLINK_ROUTE_SOCKET__RELABELFROM 0x00000080UL
29879 +#define NETLINK_ROUTE_SOCKET__RELABELTO 0x00000100UL
29880 +#define NETLINK_ROUTE_SOCKET__APPEND 0x00000200UL
29881 +#define NETLINK_ROUTE_SOCKET__BIND 0x00000400UL
29882 +#define NETLINK_ROUTE_SOCKET__CONNECT 0x00000800UL
29883 +#define NETLINK_ROUTE_SOCKET__LISTEN 0x00001000UL
29884 +#define NETLINK_ROUTE_SOCKET__ACCEPT 0x00002000UL
29885 +#define NETLINK_ROUTE_SOCKET__GETOPT 0x00004000UL
29886 +#define NETLINK_ROUTE_SOCKET__SETOPT 0x00008000UL
29887 +#define NETLINK_ROUTE_SOCKET__SHUTDOWN 0x00010000UL
29888 +#define NETLINK_ROUTE_SOCKET__RECVFROM 0x00020000UL
29889 +#define NETLINK_ROUTE_SOCKET__SENDTO 0x00040000UL
29890 +#define NETLINK_ROUTE_SOCKET__RECV_MSG 0x00080000UL
29891 +#define NETLINK_ROUTE_SOCKET__SEND_MSG 0x00100000UL
29892 +#define NETLINK_ROUTE_SOCKET__NAME_BIND 0x00200000UL
29893 +#define NETLINK_ROUTE_SOCKET__NLMSG_READ 0x00400000UL
29894 +#define NETLINK_ROUTE_SOCKET__NLMSG_WRITE 0x00800000UL
29895 +#define NETLINK_FIREWALL_SOCKET__IOCTL 0x00000001UL
29896 +#define NETLINK_FIREWALL_SOCKET__READ 0x00000002UL
29897 +#define NETLINK_FIREWALL_SOCKET__WRITE 0x00000004UL
29898 +#define NETLINK_FIREWALL_SOCKET__CREATE 0x00000008UL
29899 +#define NETLINK_FIREWALL_SOCKET__GETATTR 0x00000010UL
29900 +#define NETLINK_FIREWALL_SOCKET__SETATTR 0x00000020UL
29901 +#define NETLINK_FIREWALL_SOCKET__LOCK 0x00000040UL
29902 +#define NETLINK_FIREWALL_SOCKET__RELABELFROM 0x00000080UL
29903 +#define NETLINK_FIREWALL_SOCKET__RELABELTO 0x00000100UL
29904 +#define NETLINK_FIREWALL_SOCKET__APPEND 0x00000200UL
29905 +#define NETLINK_FIREWALL_SOCKET__BIND 0x00000400UL
29906 +#define NETLINK_FIREWALL_SOCKET__CONNECT 0x00000800UL
29907 +#define NETLINK_FIREWALL_SOCKET__LISTEN 0x00001000UL
29908 +#define NETLINK_FIREWALL_SOCKET__ACCEPT 0x00002000UL
29909 +#define NETLINK_FIREWALL_SOCKET__GETOPT 0x00004000UL
29910 +#define NETLINK_FIREWALL_SOCKET__SETOPT 0x00008000UL
29911 +#define NETLINK_FIREWALL_SOCKET__SHUTDOWN 0x00010000UL
29912 +#define NETLINK_FIREWALL_SOCKET__RECVFROM 0x00020000UL
29913 +#define NETLINK_FIREWALL_SOCKET__SENDTO 0x00040000UL
29914 +#define NETLINK_FIREWALL_SOCKET__RECV_MSG 0x00080000UL
29915 +#define NETLINK_FIREWALL_SOCKET__SEND_MSG 0x00100000UL
29916 +#define NETLINK_FIREWALL_SOCKET__NAME_BIND 0x00200000UL
29917 +#define NETLINK_FIREWALL_SOCKET__NLMSG_READ 0x00400000UL
29918 +#define NETLINK_FIREWALL_SOCKET__NLMSG_WRITE 0x00800000UL
29919 +#define NETLINK_TCPDIAG_SOCKET__IOCTL 0x00000001UL
29920 +#define NETLINK_TCPDIAG_SOCKET__READ 0x00000002UL
29921 +#define NETLINK_TCPDIAG_SOCKET__WRITE 0x00000004UL
29922 +#define NETLINK_TCPDIAG_SOCKET__CREATE 0x00000008UL
29923 +#define NETLINK_TCPDIAG_SOCKET__GETATTR 0x00000010UL
29924 +#define NETLINK_TCPDIAG_SOCKET__SETATTR 0x00000020UL
29925 +#define NETLINK_TCPDIAG_SOCKET__LOCK 0x00000040UL
29926 +#define NETLINK_TCPDIAG_SOCKET__RELABELFROM 0x00000080UL
29927 +#define NETLINK_TCPDIAG_SOCKET__RELABELTO 0x00000100UL
29928 +#define NETLINK_TCPDIAG_SOCKET__APPEND 0x00000200UL
29929 +#define NETLINK_TCPDIAG_SOCKET__BIND 0x00000400UL
29930 +#define NETLINK_TCPDIAG_SOCKET__CONNECT 0x00000800UL
29931 +#define NETLINK_TCPDIAG_SOCKET__LISTEN 0x00001000UL
29932 +#define NETLINK_TCPDIAG_SOCKET__ACCEPT 0x00002000UL
29933 +#define NETLINK_TCPDIAG_SOCKET__GETOPT 0x00004000UL
29934 +#define NETLINK_TCPDIAG_SOCKET__SETOPT 0x00008000UL
29935 +#define NETLINK_TCPDIAG_SOCKET__SHUTDOWN 0x00010000UL
29936 +#define NETLINK_TCPDIAG_SOCKET__RECVFROM 0x00020000UL
29937 +#define NETLINK_TCPDIAG_SOCKET__SENDTO 0x00040000UL
29938 +#define NETLINK_TCPDIAG_SOCKET__RECV_MSG 0x00080000UL
29939 +#define NETLINK_TCPDIAG_SOCKET__SEND_MSG 0x00100000UL
29940 +#define NETLINK_TCPDIAG_SOCKET__NAME_BIND 0x00200000UL
29941 +#define NETLINK_TCPDIAG_SOCKET__NLMSG_READ 0x00400000UL
29942 +#define NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE 0x00800000UL
29943 +#define NETLINK_NFLOG_SOCKET__IOCTL 0x00000001UL
29944 +#define NETLINK_NFLOG_SOCKET__READ 0x00000002UL
29945 +#define NETLINK_NFLOG_SOCKET__WRITE 0x00000004UL
29946 +#define NETLINK_NFLOG_SOCKET__CREATE 0x00000008UL
29947 +#define NETLINK_NFLOG_SOCKET__GETATTR 0x00000010UL
29948 +#define NETLINK_NFLOG_SOCKET__SETATTR 0x00000020UL
29949 +#define NETLINK_NFLOG_SOCKET__LOCK 0x00000040UL
29950 +#define NETLINK_NFLOG_SOCKET__RELABELFROM 0x00000080UL
29951 +#define NETLINK_NFLOG_SOCKET__RELABELTO 0x00000100UL
29952 +#define NETLINK_NFLOG_SOCKET__APPEND 0x00000200UL
29953 +#define NETLINK_NFLOG_SOCKET__BIND 0x00000400UL
29954 +#define NETLINK_NFLOG_SOCKET__CONNECT 0x00000800UL
29955 +#define NETLINK_NFLOG_SOCKET__LISTEN 0x00001000UL
29956 +#define NETLINK_NFLOG_SOCKET__ACCEPT 0x00002000UL
29957 +#define NETLINK_NFLOG_SOCKET__GETOPT 0x00004000UL
29958 +#define NETLINK_NFLOG_SOCKET__SETOPT 0x00008000UL
29959 +#define NETLINK_NFLOG_SOCKET__SHUTDOWN 0x00010000UL
29960 +#define NETLINK_NFLOG_SOCKET__RECVFROM 0x00020000UL
29961 +#define NETLINK_NFLOG_SOCKET__SENDTO 0x00040000UL
29962 +#define NETLINK_NFLOG_SOCKET__RECV_MSG 0x00080000UL
29963 +#define NETLINK_NFLOG_SOCKET__SEND_MSG 0x00100000UL
29964 +#define NETLINK_NFLOG_SOCKET__NAME_BIND 0x00200000UL
29965 +#define NETLINK_XFRM_SOCKET__IOCTL 0x00000001UL
29966 +#define NETLINK_XFRM_SOCKET__READ 0x00000002UL
29967 +#define NETLINK_XFRM_SOCKET__WRITE 0x00000004UL
29968 +#define NETLINK_XFRM_SOCKET__CREATE 0x00000008UL
29969 +#define NETLINK_XFRM_SOCKET__GETATTR 0x00000010UL
29970 +#define NETLINK_XFRM_SOCKET__SETATTR 0x00000020UL
29971 +#define NETLINK_XFRM_SOCKET__LOCK 0x00000040UL
29972 +#define NETLINK_XFRM_SOCKET__RELABELFROM 0x00000080UL
29973 +#define NETLINK_XFRM_SOCKET__RELABELTO 0x00000100UL
29974 +#define NETLINK_XFRM_SOCKET__APPEND 0x00000200UL
29975 +#define NETLINK_XFRM_SOCKET__BIND 0x00000400UL
29976 +#define NETLINK_XFRM_SOCKET__CONNECT 0x00000800UL
29977 +#define NETLINK_XFRM_SOCKET__LISTEN 0x00001000UL
29978 +#define NETLINK_XFRM_SOCKET__ACCEPT 0x00002000UL
29979 +#define NETLINK_XFRM_SOCKET__GETOPT 0x00004000UL
29980 +#define NETLINK_XFRM_SOCKET__SETOPT 0x00008000UL
29981 +#define NETLINK_XFRM_SOCKET__SHUTDOWN 0x00010000UL
29982 +#define NETLINK_XFRM_SOCKET__RECVFROM 0x00020000UL
29983 +#define NETLINK_XFRM_SOCKET__SENDTO 0x00040000UL
29984 +#define NETLINK_XFRM_SOCKET__RECV_MSG 0x00080000UL
29985 +#define NETLINK_XFRM_SOCKET__SEND_MSG 0x00100000UL
29986 +#define NETLINK_XFRM_SOCKET__NAME_BIND 0x00200000UL
29987 +#define NETLINK_XFRM_SOCKET__NLMSG_READ 0x00400000UL
29988 +#define NETLINK_XFRM_SOCKET__NLMSG_WRITE 0x00800000UL
29989 +#define NETLINK_SELINUX_SOCKET__IOCTL 0x00000001UL
29990 +#define NETLINK_SELINUX_SOCKET__READ 0x00000002UL
29991 +#define NETLINK_SELINUX_SOCKET__WRITE 0x00000004UL
29992 +#define NETLINK_SELINUX_SOCKET__CREATE 0x00000008UL
29993 +#define NETLINK_SELINUX_SOCKET__GETATTR 0x00000010UL
29994 +#define NETLINK_SELINUX_SOCKET__SETATTR 0x00000020UL
29995 +#define NETLINK_SELINUX_SOCKET__LOCK 0x00000040UL
29996 +#define NETLINK_SELINUX_SOCKET__RELABELFROM 0x00000080UL
29997 +#define NETLINK_SELINUX_SOCKET__RELABELTO 0x00000100UL
29998 +#define NETLINK_SELINUX_SOCKET__APPEND 0x00000200UL
29999 +#define NETLINK_SELINUX_SOCKET__BIND 0x00000400UL
30000 +#define NETLINK_SELINUX_SOCKET__CONNECT 0x00000800UL
30001 +#define NETLINK_SELINUX_SOCKET__LISTEN 0x00001000UL
30002 +#define NETLINK_SELINUX_SOCKET__ACCEPT 0x00002000UL
30003 +#define NETLINK_SELINUX_SOCKET__GETOPT 0x00004000UL
30004 +#define NETLINK_SELINUX_SOCKET__SETOPT 0x00008000UL
30005 +#define NETLINK_SELINUX_SOCKET__SHUTDOWN 0x00010000UL
30006 +#define NETLINK_SELINUX_SOCKET__RECVFROM 0x00020000UL
30007 +#define NETLINK_SELINUX_SOCKET__SENDTO 0x00040000UL
30008 +#define NETLINK_SELINUX_SOCKET__RECV_MSG 0x00080000UL
30009 +#define NETLINK_SELINUX_SOCKET__SEND_MSG 0x00100000UL
30010 +#define NETLINK_SELINUX_SOCKET__NAME_BIND 0x00200000UL
30011 +#define NETLINK_AUDIT_SOCKET__IOCTL 0x00000001UL
30012 +#define NETLINK_AUDIT_SOCKET__READ 0x00000002UL
30013 +#define NETLINK_AUDIT_SOCKET__WRITE 0x00000004UL
30014 +#define NETLINK_AUDIT_SOCKET__CREATE 0x00000008UL
30015 +#define NETLINK_AUDIT_SOCKET__GETATTR 0x00000010UL
30016 +#define NETLINK_AUDIT_SOCKET__SETATTR 0x00000020UL
30017 +#define NETLINK_AUDIT_SOCKET__LOCK 0x00000040UL
30018 +#define NETLINK_AUDIT_SOCKET__RELABELFROM 0x00000080UL
30019 +#define NETLINK_AUDIT_SOCKET__RELABELTO 0x00000100UL
30020 +#define NETLINK_AUDIT_SOCKET__APPEND 0x00000200UL
30021 +#define NETLINK_AUDIT_SOCKET__BIND 0x00000400UL
30022 +#define NETLINK_AUDIT_SOCKET__CONNECT 0x00000800UL
30023 +#define NETLINK_AUDIT_SOCKET__LISTEN 0x00001000UL
30024 +#define NETLINK_AUDIT_SOCKET__ACCEPT 0x00002000UL
30025 +#define NETLINK_AUDIT_SOCKET__GETOPT 0x00004000UL
30026 +#define NETLINK_AUDIT_SOCKET__SETOPT 0x00008000UL
30027 +#define NETLINK_AUDIT_SOCKET__SHUTDOWN 0x00010000UL
30028 +#define NETLINK_AUDIT_SOCKET__RECVFROM 0x00020000UL
30029 +#define NETLINK_AUDIT_SOCKET__SENDTO 0x00040000UL
30030 +#define NETLINK_AUDIT_SOCKET__RECV_MSG 0x00080000UL
30031 +#define NETLINK_AUDIT_SOCKET__SEND_MSG 0x00100000UL
30032 +#define NETLINK_AUDIT_SOCKET__NAME_BIND 0x00200000UL
30033 +#define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL
30034 +#define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL
30035 +#define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL
30036 +#define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL
30037 +#define NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT 0x04000000UL
30038 +#define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL
30039 +#define NETLINK_IP6FW_SOCKET__READ 0x00000002UL
30040 +#define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL
30041 +#define NETLINK_IP6FW_SOCKET__CREATE 0x00000008UL
30042 +#define NETLINK_IP6FW_SOCKET__GETATTR 0x00000010UL
30043 +#define NETLINK_IP6FW_SOCKET__SETATTR 0x00000020UL
30044 +#define NETLINK_IP6FW_SOCKET__LOCK 0x00000040UL
30045 +#define NETLINK_IP6FW_SOCKET__RELABELFROM 0x00000080UL
30046 +#define NETLINK_IP6FW_SOCKET__RELABELTO 0x00000100UL
30047 +#define NETLINK_IP6FW_SOCKET__APPEND 0x00000200UL
30048 +#define NETLINK_IP6FW_SOCKET__BIND 0x00000400UL
30049 +#define NETLINK_IP6FW_SOCKET__CONNECT 0x00000800UL
30050 +#define NETLINK_IP6FW_SOCKET__LISTEN 0x00001000UL
30051 +#define NETLINK_IP6FW_SOCKET__ACCEPT 0x00002000UL
30052 +#define NETLINK_IP6FW_SOCKET__GETOPT 0x00004000UL
30053 +#define NETLINK_IP6FW_SOCKET__SETOPT 0x00008000UL
30054 +#define NETLINK_IP6FW_SOCKET__SHUTDOWN 0x00010000UL
30055 +#define NETLINK_IP6FW_SOCKET__RECVFROM 0x00020000UL
30056 +#define NETLINK_IP6FW_SOCKET__SENDTO 0x00040000UL
30057 +#define NETLINK_IP6FW_SOCKET__RECV_MSG 0x00080000UL
30058 +#define NETLINK_IP6FW_SOCKET__SEND_MSG 0x00100000UL
30059 +#define NETLINK_IP6FW_SOCKET__NAME_BIND 0x00200000UL
30060 +#define NETLINK_IP6FW_SOCKET__NLMSG_READ 0x00400000UL
30061 +#define NETLINK_IP6FW_SOCKET__NLMSG_WRITE 0x00800000UL
30062 +#define NETLINK_DNRT_SOCKET__IOCTL 0x00000001UL
30063 +#define NETLINK_DNRT_SOCKET__READ 0x00000002UL
30064 +#define NETLINK_DNRT_SOCKET__WRITE 0x00000004UL
30065 +#define NETLINK_DNRT_SOCKET__CREATE 0x00000008UL
30066 +#define NETLINK_DNRT_SOCKET__GETATTR 0x00000010UL
30067 +#define NETLINK_DNRT_SOCKET__SETATTR 0x00000020UL
30068 +#define NETLINK_DNRT_SOCKET__LOCK 0x00000040UL
30069 +#define NETLINK_DNRT_SOCKET__RELABELFROM 0x00000080UL
30070 +#define NETLINK_DNRT_SOCKET__RELABELTO 0x00000100UL
30071 +#define NETLINK_DNRT_SOCKET__APPEND 0x00000200UL
30072 +#define NETLINK_DNRT_SOCKET__BIND 0x00000400UL
30073 +#define NETLINK_DNRT_SOCKET__CONNECT 0x00000800UL
30074 +#define NETLINK_DNRT_SOCKET__LISTEN 0x00001000UL
30075 +#define NETLINK_DNRT_SOCKET__ACCEPT 0x00002000UL
30076 +#define NETLINK_DNRT_SOCKET__GETOPT 0x00004000UL
30077 +#define NETLINK_DNRT_SOCKET__SETOPT 0x00008000UL
30078 +#define NETLINK_DNRT_SOCKET__SHUTDOWN 0x00010000UL
30079 +#define NETLINK_DNRT_SOCKET__RECVFROM 0x00020000UL
30080 +#define NETLINK_DNRT_SOCKET__SENDTO 0x00040000UL
30081 +#define NETLINK_DNRT_SOCKET__RECV_MSG 0x00080000UL
30082 +#define NETLINK_DNRT_SOCKET__SEND_MSG 0x00100000UL
30083 +#define NETLINK_DNRT_SOCKET__NAME_BIND 0x00200000UL
30084 +#define ASSOCIATION__SENDTO 0x00000001UL
30085 +#define ASSOCIATION__RECVFROM 0x00000002UL
30086 +#define ASSOCIATION__SETCONTEXT 0x00000004UL
30087 +#define ASSOCIATION__POLMATCH 0x00000008UL
30088 +#define NETLINK_KOBJECT_UEVENT_SOCKET__IOCTL 0x00000001UL
30089 +#define NETLINK_KOBJECT_UEVENT_SOCKET__READ 0x00000002UL
30090 +#define NETLINK_KOBJECT_UEVENT_SOCKET__WRITE 0x00000004UL
30091 +#define NETLINK_KOBJECT_UEVENT_SOCKET__CREATE 0x00000008UL
30092 +#define NETLINK_KOBJECT_UEVENT_SOCKET__GETATTR 0x00000010UL
30093 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SETATTR 0x00000020UL
30094 +#define NETLINK_KOBJECT_UEVENT_SOCKET__LOCK 0x00000040UL
30095 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELFROM 0x00000080UL
30096 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELTO 0x00000100UL
30097 +#define NETLINK_KOBJECT_UEVENT_SOCKET__APPEND 0x00000200UL
30098 +#define NETLINK_KOBJECT_UEVENT_SOCKET__BIND 0x00000400UL
30099 +#define NETLINK_KOBJECT_UEVENT_SOCKET__CONNECT 0x00000800UL
30100 +#define NETLINK_KOBJECT_UEVENT_SOCKET__LISTEN 0x00001000UL
30101 +#define NETLINK_KOBJECT_UEVENT_SOCKET__ACCEPT 0x00002000UL
30102 +#define NETLINK_KOBJECT_UEVENT_SOCKET__GETOPT 0x00004000UL
30103 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SETOPT 0x00008000UL
30104 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SHUTDOWN 0x00010000UL
30105 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RECVFROM 0x00020000UL
30106 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SENDTO 0x00040000UL
30107 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RECV_MSG 0x00080000UL
30108 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SEND_MSG 0x00100000UL
30109 +#define NETLINK_KOBJECT_UEVENT_SOCKET__NAME_BIND 0x00200000UL
30110 +#define APPLETALK_SOCKET__IOCTL 0x00000001UL
30111 +#define APPLETALK_SOCKET__READ 0x00000002UL
30112 +#define APPLETALK_SOCKET__WRITE 0x00000004UL
30113 +#define APPLETALK_SOCKET__CREATE 0x00000008UL
30114 +#define APPLETALK_SOCKET__GETATTR 0x00000010UL
30115 +#define APPLETALK_SOCKET__SETATTR 0x00000020UL
30116 +#define APPLETALK_SOCKET__LOCK 0x00000040UL
30117 +#define APPLETALK_SOCKET__RELABELFROM 0x00000080UL
30118 +#define APPLETALK_SOCKET__RELABELTO 0x00000100UL
30119 +#define APPLETALK_SOCKET__APPEND 0x00000200UL
30120 +#define APPLETALK_SOCKET__BIND 0x00000400UL
30121 +#define APPLETALK_SOCKET__CONNECT 0x00000800UL
30122 +#define APPLETALK_SOCKET__LISTEN 0x00001000UL
30123 +#define APPLETALK_SOCKET__ACCEPT 0x00002000UL
30124 +#define APPLETALK_SOCKET__GETOPT 0x00004000UL
30125 +#define APPLETALK_SOCKET__SETOPT 0x00008000UL
30126 +#define APPLETALK_SOCKET__SHUTDOWN 0x00010000UL
30127 +#define APPLETALK_SOCKET__RECVFROM 0x00020000UL
30128 +#define APPLETALK_SOCKET__SENDTO 0x00040000UL
30129 +#define APPLETALK_SOCKET__RECV_MSG 0x00080000UL
30130 +#define APPLETALK_SOCKET__SEND_MSG 0x00100000UL
30131 +#define APPLETALK_SOCKET__NAME_BIND 0x00200000UL
30132 +#define PACKET__SEND 0x00000001UL
30133 +#define PACKET__RECV 0x00000002UL
30134 +#define PACKET__RELABELTO 0x00000004UL
30135 +#define PACKET__FLOW_IN 0x00000008UL
30136 +#define PACKET__FLOW_OUT 0x00000010UL
30137 +#define PACKET__FORWARD_IN 0x00000020UL
30138 +#define PACKET__FORWARD_OUT 0x00000040UL
30139 +#define KEY__VIEW 0x00000001UL
30140 +#define KEY__READ 0x00000002UL
30141 +#define KEY__WRITE 0x00000004UL
30142 +#define KEY__SEARCH 0x00000008UL
30143 +#define KEY__LINK 0x00000010UL
30144 +#define KEY__SETATTR 0x00000020UL
30145 +#define KEY__CREATE 0x00000040UL
30146 +#define DCCP_SOCKET__IOCTL 0x00000001UL
30147 +#define DCCP_SOCKET__READ 0x00000002UL
30148 +#define DCCP_SOCKET__WRITE 0x00000004UL
30149 +#define DCCP_SOCKET__CREATE 0x00000008UL
30150 +#define DCCP_SOCKET__GETATTR 0x00000010UL
30151 +#define DCCP_SOCKET__SETATTR 0x00000020UL
30152 +#define DCCP_SOCKET__LOCK 0x00000040UL
30153 +#define DCCP_SOCKET__RELABELFROM 0x00000080UL
30154 +#define DCCP_SOCKET__RELABELTO 0x00000100UL
30155 +#define DCCP_SOCKET__APPEND 0x00000200UL
30156 +#define DCCP_SOCKET__BIND 0x00000400UL
30157 +#define DCCP_SOCKET__CONNECT 0x00000800UL
30158 +#define DCCP_SOCKET__LISTEN 0x00001000UL
30159 +#define DCCP_SOCKET__ACCEPT 0x00002000UL
30160 +#define DCCP_SOCKET__GETOPT 0x00004000UL
30161 +#define DCCP_SOCKET__SETOPT 0x00008000UL
30162 +#define DCCP_SOCKET__SHUTDOWN 0x00010000UL
30163 +#define DCCP_SOCKET__RECVFROM 0x00020000UL
30164 +#define DCCP_SOCKET__SENDTO 0x00040000UL
30165 +#define DCCP_SOCKET__RECV_MSG 0x00080000UL
30166 +#define DCCP_SOCKET__SEND_MSG 0x00100000UL
30167 +#define DCCP_SOCKET__NAME_BIND 0x00200000UL
30168 +#define DCCP_SOCKET__NODE_BIND 0x00400000UL
30169 +#define DCCP_SOCKET__NAME_CONNECT 0x00800000UL
30170 +#define MEMPROTECT__MMAP_ZERO 0x00000001UL
30171 +#define PEER__RECV 0x00000001UL
30172 +#define CAPABILITY2__MAC_OVERRIDE 0x00000001UL
30173 +#define CAPABILITY2__MAC_ADMIN 0x00000002UL
30174 +#define KERNEL_SERVICE__USE_AS_OVERRIDE 0x00000001UL
30175 +#define KERNEL_SERVICE__CREATE_FILES_AS 0x00000002UL
30176 +#define TUN_SOCKET__IOCTL 0x00000001UL
30177 +#define TUN_SOCKET__READ 0x00000002UL
30178 +#define TUN_SOCKET__WRITE 0x00000004UL
30179 +#define TUN_SOCKET__CREATE 0x00000008UL
30180 +#define TUN_SOCKET__GETATTR 0x00000010UL
30181 +#define TUN_SOCKET__SETATTR 0x00000020UL
30182 +#define TUN_SOCKET__LOCK 0x00000040UL
30183 +#define TUN_SOCKET__RELABELFROM 0x00000080UL
30184 +#define TUN_SOCKET__RELABELTO 0x00000100UL
30185 +#define TUN_SOCKET__APPEND 0x00000200UL
30186 +#define TUN_SOCKET__BIND 0x00000400UL
30187 +#define TUN_SOCKET__CONNECT 0x00000800UL
30188 +#define TUN_SOCKET__LISTEN 0x00001000UL
30189 +#define TUN_SOCKET__ACCEPT 0x00002000UL
30190 +#define TUN_SOCKET__GETOPT 0x00004000UL
30191 +#define TUN_SOCKET__SETOPT 0x00008000UL
30192 +#define TUN_SOCKET__SHUTDOWN 0x00010000UL
30193 +#define TUN_SOCKET__RECVFROM 0x00020000UL
30194 +#define TUN_SOCKET__SENDTO 0x00040000UL
30195 +#define TUN_SOCKET__RECV_MSG 0x00080000UL
30196 +#define TUN_SOCKET__SEND_MSG 0x00100000UL
30197 +#define TUN_SOCKET__NAME_BIND 0x00200000UL
30200 diff -NurpP --minimal linux-2.6.33.2/security/selinux/hooks.c linux-2.6.33.2-vs2.3.0.36.30.4/security/selinux/hooks.c
30201 --- linux-2.6.33.2/security/selinux/hooks.c 2010-02-25 11:52:12.000000000 +0100
30202 +++ linux-2.6.33.2-vs2.3.0.36.30.4/security/selinux/hooks.c 2010-02-25 12:02:16.000000000 +0100
30204 #include <linux/dccp.h>
30205 #include <linux/quota.h>
30206 #include <linux/un.h> /* for Unix socket types */
30207 -#include <net/af_unix.h> /* for Unix socket types */
30208 #include <linux/parser.h>
30209 #include <linux/nfs_mount.h>
30210 #include <net/ipv6.h>
30211 --- linux-2.6.27.45-vs2.3.x-N3/kernel/signal.c 2010-02-01 20:10:59.000000000 +0100
30212 +++ linux-2.6.31.13-vs2.3.x-N3/kernel/signal.c 2010-01-28 00:24:14.000000000 +0100
30213 @@ -1074,7 +1137,7 @@ int kill_pid_info(int sig, struct siginf
30216 p = pid_task(pid, PIDTYPE_PID);
30217 - if (p && vx_check(vx_task_xid(p), VS_ADMIN | VS_IDENT)) {
30218 + if (p && vx_check(vx_task_xid(p), VS_IDENT)) {
30219 error = group_send_sig_info(sig, info, p);
30220 if (unlikely(error == -ESRCH))