1 diff -NurpP --minimal linux-2.6.33.1/arch/alpha/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/alpha/Kconfig
2 --- linux-2.6.33.1/arch/alpha/Kconfig 2010-02-25 11:51:18.000000000 +0100
3 +++ linux-2.6.33.1-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.1/arch/alpha/kernel/entry.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/alpha/kernel/entry.S
14 --- linux-2.6.33.1/arch/alpha/kernel/entry.S 2009-06-11 17:11:46.000000000 +0200
15 +++ linux-2.6.33.1-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.1/arch/alpha/kernel/osf_sys.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/alpha/kernel/osf_sys.c
49 --- linux-2.6.33.1/arch/alpha/kernel/osf_sys.c 2010-02-25 11:51:19.000000000 +0100
50 +++ linux-2.6.33.1-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.1/arch/alpha/kernel/ptrace.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/alpha/kernel/ptrace.c
61 --- linux-2.6.33.1/arch/alpha/kernel/ptrace.c 2009-09-10 15:25:14.000000000 +0200
62 +++ linux-2.6.33.1-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.1/arch/alpha/kernel/systbls.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/alpha/kernel/systbls.S
72 --- linux-2.6.33.1/arch/alpha/kernel/systbls.S 2010-02-25 11:51:19.000000000 +0100
73 +++ linux-2.6.33.1-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.1/arch/alpha/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/alpha/kernel/traps.c
84 --- linux-2.6.33.1/arch/alpha/kernel/traps.c 2009-06-11 17:11:46.000000000 +0200
85 +++ linux-2.6.33.1-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.1/arch/alpha/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/alpha/mm/fault.c
97 --- linux-2.6.33.1/arch/alpha/mm/fault.c 2009-09-10 15:25:14.000000000 +0200
98 +++ linux-2.6.33.1-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.1/arch/arm/include/asm/tlb.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/arm/include/asm/tlb.h
111 --- linux-2.6.33.1/arch/arm/include/asm/tlb.h 2009-09-10 15:25:15.000000000 +0200
112 +++ linux-2.6.33.1-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.1/arch/arm/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/arm/Kconfig
122 --- linux-2.6.33.1/arch/arm/Kconfig 2010-02-25 11:51:19.000000000 +0100
123 +++ linux-2.6.33.1-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.1/arch/arm/kernel/calls.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/arm/kernel/calls.S
134 --- linux-2.6.33.1/arch/arm/kernel/calls.S 2010-02-25 11:51:20.000000000 +0100
135 +++ linux-2.6.33.1-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.1/arch/arm/kernel/process.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/arm/kernel/process.c
146 --- linux-2.6.33.1/arch/arm/kernel/process.c 2010-02-25 11:51:20.000000000 +0100
147 +++ linux-2.6.33.1-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.1/arch/arm/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/arm/kernel/traps.c
159 --- linux-2.6.33.1/arch/arm/kernel/traps.c 2009-12-03 20:01:50.000000000 +0100
160 +++ linux-2.6.33.1-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.1/arch/avr32/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/avr32/mm/fault.c
173 --- linux-2.6.33.1/arch/avr32/mm/fault.c 2009-09-10 15:25:20.000000000 +0200
174 +++ linux-2.6.33.1-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.1/arch/cris/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/cris/Kconfig
186 --- linux-2.6.33.1/arch/cris/Kconfig 2009-06-11 17:11:56.000000000 +0200
187 +++ linux-2.6.33.1-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.1/arch/cris/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/cris/mm/fault.c
198 --- linux-2.6.33.1/arch/cris/mm/fault.c 2010-02-25 11:51:26.000000000 +0100
199 +++ linux-2.6.33.1-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.1/arch/frv/kernel/kernel_thread.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/frv/kernel/kernel_thread.S
211 --- linux-2.6.33.1/arch/frv/kernel/kernel_thread.S 2008-12-25 00:26:37.000000000 +0100
212 +++ linux-2.6.33.1-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.1/arch/frv/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/frv/mm/fault.c
223 --- linux-2.6.33.1/arch/frv/mm/fault.c 2009-09-10 15:25:22.000000000 +0200
224 +++ linux-2.6.33.1-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.1/arch/h8300/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/h8300/Kconfig
236 --- linux-2.6.33.1/arch/h8300/Kconfig 2010-02-25 11:51:26.000000000 +0100
237 +++ linux-2.6.33.1-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.1/arch/ia64/ia32/ia32_entry.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/ia32/ia32_entry.S
248 --- linux-2.6.33.1/arch/ia64/ia32/ia32_entry.S 2010-02-25 11:51:26.000000000 +0100
249 +++ linux-2.6.33.1-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.1/arch/ia64/include/asm/tlb.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/include/asm/tlb.h
260 --- linux-2.6.33.1/arch/ia64/include/asm/tlb.h 2010-02-25 11:51:26.000000000 +0100
261 +++ linux-2.6.33.1-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.1/arch/ia64/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/Kconfig
271 --- linux-2.6.33.1/arch/ia64/Kconfig 2010-02-25 11:51:26.000000000 +0100
272 +++ linux-2.6.33.1-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.1/arch/ia64/kernel/entry.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/kernel/entry.S
283 --- linux-2.6.33.1/arch/ia64/kernel/entry.S 2010-02-25 11:51:26.000000000 +0100
284 +++ linux-2.6.33.1-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.1/arch/ia64/kernel/perfmon.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/kernel/perfmon.c
295 --- linux-2.6.33.1/arch/ia64/kernel/perfmon.c 2010-02-25 11:51:26.000000000 +0100
296 +++ linux-2.6.33.1-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.1/arch/ia64/kernel/process.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/kernel/process.c
315 --- linux-2.6.33.1/arch/ia64/kernel/process.c 2009-12-03 20:01:56.000000000 +0100
316 +++ linux-2.6.33.1-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.1/arch/ia64/kernel/ptrace.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/kernel/ptrace.c
329 --- linux-2.6.33.1/arch/ia64/kernel/ptrace.c 2009-09-10 15:25:22.000000000 +0200
330 +++ linux-2.6.33.1-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.1/arch/ia64/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/kernel/traps.c
340 --- linux-2.6.33.1/arch/ia64/kernel/traps.c 2008-12-25 00:26:37.000000000 +0100
341 +++ linux-2.6.33.1-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.1/arch/ia64/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/ia64/mm/fault.c
367 --- linux-2.6.33.1/arch/ia64/mm/fault.c 2009-09-10 15:25:23.000000000 +0200
368 +++ linux-2.6.33.1-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.1/arch/m32r/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/m32r/kernel/traps.c
388 --- linux-2.6.33.1/arch/m32r/kernel/traps.c 2009-12-03 20:01:57.000000000 +0100
389 +++ linux-2.6.33.1-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.1/arch/m32r/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/m32r/mm/fault.c
403 --- linux-2.6.33.1/arch/m32r/mm/fault.c 2009-09-10 15:25:23.000000000 +0200
404 +++ linux-2.6.33.1-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.1/arch/m68k/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/m68k/Kconfig
416 --- linux-2.6.33.1/arch/m68k/Kconfig 2009-12-03 20:01:57.000000000 +0100
417 +++ linux-2.6.33.1-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.1/arch/m68k/kernel/ptrace.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/m68k/kernel/ptrace.c
428 --- linux-2.6.33.1/arch/m68k/kernel/ptrace.c 2010-02-25 11:51:27.000000000 +0100
429 +++ linux-2.6.33.1-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.1/arch/m68k/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/m68k/kernel/traps.c
448 --- linux-2.6.33.1/arch/m68k/kernel/traps.c 2009-09-10 15:25:23.000000000 +0200
449 +++ linux-2.6.33.1-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.1/arch/m68k/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/m68k/mm/fault.c
462 --- linux-2.6.33.1/arch/m68k/mm/fault.c 2009-09-10 15:25:23.000000000 +0200
463 +++ linux-2.6.33.1-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.1/arch/m68knommu/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/m68knommu/Kconfig
475 --- linux-2.6.33.1/arch/m68knommu/Kconfig 2010-02-25 11:51:27.000000000 +0100
476 +++ linux-2.6.33.1-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.1/arch/m68knommu/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/m68knommu/kernel/traps.c
487 --- linux-2.6.33.1/arch/m68knommu/kernel/traps.c 2009-09-10 15:25:23.000000000 +0200
488 +++ linux-2.6.33.1-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.1/arch/microblaze/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/microblaze/mm/fault.c
502 --- linux-2.6.33.1/arch/microblaze/mm/fault.c 2009-09-10 15:25:24.000000000 +0200
503 +++ linux-2.6.33.1-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.1/arch/mips/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/mips/Kconfig
515 --- linux-2.6.33.1/arch/mips/Kconfig 2010-02-25 11:51:27.000000000 +0100
516 +++ linux-2.6.33.1-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.1/arch/mips/kernel/ptrace.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/mips/kernel/ptrace.c
527 --- linux-2.6.33.1/arch/mips/kernel/ptrace.c 2008-12-25 00:26:37.000000000 +0100
528 +++ linux-2.6.33.1-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.1/arch/mips/kernel/scall32-o32.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/mips/kernel/scall32-o32.S
548 --- linux-2.6.33.1/arch/mips/kernel/scall32-o32.S 2010-02-25 11:51:28.000000000 +0100
549 +++ linux-2.6.33.1-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.1/arch/mips/kernel/scall64-64.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/mips/kernel/scall64-64.S
560 --- linux-2.6.33.1/arch/mips/kernel/scall64-64.S 2010-02-25 11:51:28.000000000 +0100
561 +++ linux-2.6.33.1-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.1/arch/mips/kernel/scall64-n32.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/mips/kernel/scall64-n32.S
572 --- linux-2.6.33.1/arch/mips/kernel/scall64-n32.S 2010-02-25 11:51:28.000000000 +0100
573 +++ linux-2.6.33.1-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.1/arch/mips/kernel/scall64-o32.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/mips/kernel/scall64-o32.S
584 --- linux-2.6.33.1/arch/mips/kernel/scall64-o32.S 2010-02-25 11:51:28.000000000 +0100
585 +++ linux-2.6.33.1-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.1/arch/mips/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/mips/kernel/traps.c
596 --- linux-2.6.33.1/arch/mips/kernel/traps.c 2010-02-25 11:51:28.000000000 +0100
597 +++ linux-2.6.33.1-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.1/arch/mn10300/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/mn10300/mm/fault.c
613 --- linux-2.6.33.1/arch/mn10300/mm/fault.c 2009-09-10 15:25:39.000000000 +0200
614 +++ linux-2.6.33.1-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.1/arch/parisc/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/parisc/Kconfig
626 --- linux-2.6.33.1/arch/parisc/Kconfig 2010-02-25 11:51:29.000000000 +0100
627 +++ linux-2.6.33.1-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.1/arch/parisc/kernel/syscall_table.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/parisc/kernel/syscall_table.S
638 --- linux-2.6.33.1/arch/parisc/kernel/syscall_table.S 2010-02-25 11:51:29.000000000 +0100
639 +++ linux-2.6.33.1-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.1/arch/parisc/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/parisc/kernel/traps.c
650 --- linux-2.6.33.1/arch/parisc/kernel/traps.c 2009-09-10 15:25:40.000000000 +0200
651 +++ linux-2.6.33.1-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.1/arch/parisc/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/parisc/mm/fault.c
676 --- linux-2.6.33.1/arch/parisc/mm/fault.c 2009-09-10 15:25:40.000000000 +0200
677 +++ linux-2.6.33.1-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.1/arch/powerpc/include/asm/unistd.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/powerpc/include/asm/unistd.h
701 --- linux-2.6.33.1/arch/powerpc/include/asm/unistd.h 2009-12-03 20:02:01.000000000 +0100
702 +++ linux-2.6.33.1-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.1/arch/powerpc/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/powerpc/Kconfig
713 --- linux-2.6.33.1/arch/powerpc/Kconfig 2010-02-25 11:51:29.000000000 +0100
714 +++ linux-2.6.33.1-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.1/arch/powerpc/kernel/irq.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/powerpc/kernel/irq.c
725 --- linux-2.6.33.1/arch/powerpc/kernel/irq.c 2010-02-25 11:51:31.000000000 +0100
726 +++ linux-2.6.33.1-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.1/arch/powerpc/kernel/process.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/powerpc/kernel/process.c
736 --- linux-2.6.33.1/arch/powerpc/kernel/process.c 2010-02-25 11:51:31.000000000 +0100
737 +++ linux-2.6.33.1-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.1/arch/powerpc/kernel/traps.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/powerpc/kernel/traps.c
751 --- linux-2.6.33.1/arch/powerpc/kernel/traps.c 2010-02-25 11:51:31.000000000 +0100
752 +++ linux-2.6.33.1-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.1/arch/powerpc/kernel/vdso.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/powerpc/kernel/vdso.c
766 --- linux-2.6.33.1/arch/powerpc/kernel/vdso.c 2010-02-25 11:51:31.000000000 +0100
767 +++ linux-2.6.33.1-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.1/arch/powerpc/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/powerpc/mm/fault.c
777 --- linux-2.6.33.1/arch/powerpc/mm/fault.c 2010-02-25 11:51:31.000000000 +0100
778 +++ linux-2.6.33.1-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.1/arch/s390/include/asm/tlb.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/s390/include/asm/tlb.h
790 --- linux-2.6.33.1/arch/s390/include/asm/tlb.h 2009-09-10 15:25:43.000000000 +0200
791 +++ linux-2.6.33.1-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.1/arch/s390/include/asm/unistd.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/s390/include/asm/unistd.h
802 --- linux-2.6.33.1/arch/s390/include/asm/unistd.h 2010-02-25 11:51:32.000000000 +0100
803 +++ linux-2.6.33.1-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.1/arch/s390/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/s390/Kconfig
814 --- linux-2.6.33.1/arch/s390/Kconfig 2010-02-25 11:51:32.000000000 +0100
815 +++ linux-2.6.33.1-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.1/arch/s390/kernel/ptrace.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/s390/kernel/ptrace.c
826 --- linux-2.6.33.1/arch/s390/kernel/ptrace.c 2010-02-25 11:51:32.000000000 +0100
827 +++ linux-2.6.33.1-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.1/arch/s390/kernel/syscalls.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/s390/kernel/syscalls.S
837 --- linux-2.6.33.1/arch/s390/kernel/syscalls.S 2009-12-03 20:02:03.000000000 +0100
838 +++ linux-2.6.33.1-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.1/arch/sh/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/sh/Kconfig
849 --- linux-2.6.33.1/arch/sh/Kconfig 2010-02-25 11:51:32.000000000 +0100
850 +++ linux-2.6.33.1-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.1/arch/sh/kernel/irq.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/sh/kernel/irq.c
861 --- linux-2.6.33.1/arch/sh/kernel/irq.c 2010-02-25 11:51:33.000000000 +0100
862 +++ linux-2.6.33.1-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.1/arch/sh/kernel/vsyscall/vsyscall.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/sh/kernel/vsyscall/vsyscall.c
872 --- linux-2.6.33.1/arch/sh/kernel/vsyscall/vsyscall.c 2009-03-24 14:18:42.000000000 +0100
873 +++ linux-2.6.33.1-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.1/arch/sh/mm/fault_32.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/sh/mm/fault_32.c
883 --- linux-2.6.33.1/arch/sh/mm/fault_32.c 2009-12-03 20:02:14.000000000 +0100
884 +++ linux-2.6.33.1-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.1/arch/sh/mm/tlbflush_64.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/sh/mm/tlbflush_64.c
896 --- linux-2.6.33.1/arch/sh/mm/tlbflush_64.c 2009-12-03 20:02:14.000000000 +0100
897 +++ linux-2.6.33.1-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.1/arch/sparc/include/asm/tlb_64.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/sparc/include/asm/tlb_64.h
909 --- linux-2.6.33.1/arch/sparc/include/asm/tlb_64.h 2009-09-10 15:25:45.000000000 +0200
910 +++ linux-2.6.33.1-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.1/arch/sparc/include/asm/unistd.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/sparc/include/asm/unistd.h
920 --- linux-2.6.33.1/arch/sparc/include/asm/unistd.h 2010-02-25 11:51:34.000000000 +0100
921 +++ linux-2.6.33.1-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.1/arch/sparc/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/sparc/Kconfig
932 --- linux-2.6.33.1/arch/sparc/Kconfig 2010-02-25 11:51:33.000000000 +0100
933 +++ linux-2.6.33.1-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.1/arch/sparc/kernel/systbls_32.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/sparc/kernel/systbls_32.S
944 --- linux-2.6.33.1/arch/sparc/kernel/systbls_32.S 2010-02-25 11:51:34.000000000 +0100
945 +++ linux-2.6.33.1-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.1/arch/sparc/kernel/systbls_64.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/sparc/kernel/systbls_64.S
956 --- linux-2.6.33.1/arch/sparc/kernel/systbls_64.S 2010-02-25 11:51:34.000000000 +0100
957 +++ linux-2.6.33.1-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.1/arch/um/include/asm/tlb.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/um/include/asm/tlb.h
977 --- linux-2.6.33.1/arch/um/include/asm/tlb.h 2009-09-10 15:25:46.000000000 +0200
978 +++ linux-2.6.33.1-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.1/arch/um/include/shared/kern_constants.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/um/include/shared/kern_constants.h
988 --- linux-2.6.33.1/arch/um/include/shared/kern_constants.h 1970-01-01 01:00:00.000000000 +0100
989 +++ linux-2.6.33.1-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.1/arch/um/include/shared/user_constants.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/um/include/shared/user_constants.h
993 --- linux-2.6.33.1/arch/um/include/shared/user_constants.h 1970-01-01 01:00:00.000000000 +0100
994 +++ linux-2.6.33.1-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.1/arch/um/Kconfig.rest linux-2.6.33.1-vs2.3.0.36.30.4/arch/um/Kconfig.rest
1037 --- linux-2.6.33.1/arch/um/Kconfig.rest 2009-06-11 17:12:19.000000000 +0200
1038 +++ linux-2.6.33.1-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.1/arch/um/kernel/config.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/um/kernel/config.c
1049 --- linux-2.6.33.1/arch/um/kernel/config.c 1970-01-01 01:00:00.000000000 +0100
1050 +++ linux-2.6.33.1-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.1/arch/um/kernel/config.tmp linux-2.6.33.1-vs2.3.0.36.30.4/arch/um/kernel/config.tmp
1470 --- linux-2.6.33.1/arch/um/kernel/config.tmp 1970-01-01 01:00:00.000000000 +0100
1471 +++ linux-2.6.33.1-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.1/arch/um/kernel/vmlinux.lds linux-2.6.33.1-vs2.3.0.36.30.4/arch/um/kernel/vmlinux.lds
1864 --- linux-2.6.33.1/arch/um/kernel/vmlinux.lds 1970-01-01 01:00:00.000000000 +0100
1865 +++ linux-2.6.33.1-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.1/arch/x86/ia32/ia32entry.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/x86/ia32/ia32entry.S
2415 --- linux-2.6.33.1/arch/x86/ia32/ia32entry.S 2010-02-25 11:51:34.000000000 +0100
2416 +++ linux-2.6.33.1-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.1/arch/x86/include/asm/unistd_64.h linux-2.6.33.1-vs2.3.0.36.30.4/arch/x86/include/asm/unistd_64.h
2427 --- linux-2.6.33.1/arch/x86/include/asm/unistd_64.h 2010-02-25 11:51:34.000000000 +0100
2428 +++ linux-2.6.33.1-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.1/arch/x86/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/arch/x86/Kconfig
2439 --- linux-2.6.33.1/arch/x86/Kconfig 2010-02-25 11:51:34.000000000 +0100
2440 +++ linux-2.6.33.1-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.1/arch/x86/kernel/syscall_table_32.S linux-2.6.33.1-vs2.3.0.36.30.4/arch/x86/kernel/syscall_table_32.S
2451 --- linux-2.6.33.1/arch/x86/kernel/syscall_table_32.S 2010-02-25 11:51:35.000000000 +0100
2452 +++ linux-2.6.33.1-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.1/arch/xtensa/mm/fault.c linux-2.6.33.1-vs2.3.0.36.30.4/arch/xtensa/mm/fault.c
2463 --- linux-2.6.33.1/arch/xtensa/mm/fault.c 2009-09-10 15:25:48.000000000 +0200
2464 +++ linux-2.6.33.1-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.1/Documentation/vserver/debug.txt linux-2.6.33.1-vs2.3.0.36.30.4/Documentation/vserver/debug.txt
2476 --- linux-2.6.33.1/Documentation/vserver/debug.txt 1970-01-01 01:00:00.000000000 +0100
2477 +++ linux-2.6.33.1-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.1/drivers/block/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/drivers/block/Kconfig
2634 --- linux-2.6.33.1/drivers/block/Kconfig 2010-02-25 11:51:36.000000000 +0100
2635 +++ linux-2.6.33.1-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.1/drivers/block/loop.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/block/loop.c
2651 --- linux-2.6.33.1/drivers/block/loop.c 2009-12-03 20:02:19.000000000 +0100
2652 +++ linux-2.6.33.1-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.1/drivers/block/Makefile linux-2.6.33.1-vs2.3.0.36.30.4/drivers/block/Makefile
2707 --- linux-2.6.33.1/drivers/block/Makefile 2010-02-25 11:51:36.000000000 +0100
2708 +++ linux-2.6.33.1-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.1/drivers/block/vroot.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/block/vroot.c
2718 --- linux-2.6.33.1/drivers/block/vroot.c 1970-01-01 01:00:00.000000000 +0100
2719 +++ linux-2.6.33.1-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.1/drivers/char/sysrq.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/char/sysrq.c
3003 --- linux-2.6.33.1/drivers/char/sysrq.c 2010-02-25 11:51:37.000000000 +0100
3004 +++ linux-2.6.33.1-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.1/drivers/char/tty_io.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/char/tty_io.c
3057 --- linux-2.6.33.1/drivers/char/tty_io.c 2010-02-25 11:51:37.000000000 +0100
3058 +++ linux-2.6.33.1-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.1/drivers/gpu/drm/radeon/r100_reg_safe.h linux-2.6.33.1-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r100_reg_safe.h
3086 --- linux-2.6.33.1/drivers/gpu/drm/radeon/r100_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3087 +++ linux-2.6.33.1-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.1/drivers/gpu/drm/radeon/r200_reg_safe.h linux-2.6.33.1-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r200_reg_safe.h
3118 --- linux-2.6.33.1/drivers/gpu/drm/radeon/r200_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3119 +++ linux-2.6.33.1-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.1/drivers/gpu/drm/radeon/r300_reg_safe.h linux-2.6.33.1-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r300_reg_safe.h
3150 --- linux-2.6.33.1/drivers/gpu/drm/radeon/r300_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3151 +++ linux-2.6.33.1-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.1/drivers/gpu/drm/radeon/r420_reg_safe.h linux-2.6.33.1-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/r420_reg_safe.h
3196 --- linux-2.6.33.1/drivers/gpu/drm/radeon/r420_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3197 +++ linux-2.6.33.1-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.1/drivers/gpu/drm/radeon/rn50_reg_safe.h linux-2.6.33.1-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rn50_reg_safe.h
3242 --- linux-2.6.33.1/drivers/gpu/drm/radeon/rn50_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3243 +++ linux-2.6.33.1-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.1/drivers/gpu/drm/radeon/rs600_reg_safe.h linux-2.6.33.1-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rs600_reg_safe.h
3274 --- linux-2.6.33.1/drivers/gpu/drm/radeon/rs600_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3275 +++ linux-2.6.33.1-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.1/drivers/gpu/drm/radeon/rv515_reg_safe.h linux-2.6.33.1-vs2.3.0.36.30.4/drivers/gpu/drm/radeon/rv515_reg_safe.h
3335 --- linux-2.6.33.1/drivers/gpu/drm/radeon/rv515_reg_safe.h 1970-01-01 01:00:00.000000000 +0100
3336 +++ linux-2.6.33.1-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.1/drivers/infiniband/core/addr.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/infiniband/core/addr.c
3396 --- linux-2.6.33.1/drivers/infiniband/core/addr.c 2010-02-25 11:51:39.000000000 +0100
3397 +++ linux-2.6.33.1-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.1/drivers/infiniband/hw/ipath/ipath_user_pages.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/infiniband/hw/ipath/ipath_user_pages.c
3408 --- linux-2.6.33.1/drivers/infiniband/hw/ipath/ipath_user_pages.c 2009-12-03 20:02:23.000000000 +0100
3409 +++ linux-2.6.33.1-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.1/drivers/md/dm.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/md/dm.c
3456 --- linux-2.6.33.1/drivers/md/dm.c 2010-03-18 16:25:14.000000000 +0100
3457 +++ linux-2.6.33.1-vs2.3.0.36.30.4/drivers/md/dm.c 2010-03-18 16:54:28.000000000 +0100
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.1/drivers/md/dm.h linux-2.6.33.1-vs2.3.0.36.30.4/drivers/md/dm.h
3532 --- linux-2.6.33.1/drivers/md/dm.h 2010-02-25 11:51:41.000000000 +0100
3533 +++ linux-2.6.33.1-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.1/drivers/md/dm-ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/md/dm-ioctl.c
3544 --- linux-2.6.33.1/drivers/md/dm-ioctl.c 2010-03-18 16:25:14.000000000 +0100
3545 +++ linux-2.6.33.1-vs2.3.0.36.30.4/drivers/md/dm-ioctl.c 2010-03-18 16:54:28.000000000 +0100
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.1/drivers/net/tun.c linux-2.6.33.1-vs2.3.0.36.30.4/drivers/net/tun.c
3628 --- linux-2.6.33.1/drivers/net/tun.c 2010-02-25 11:51:53.000000000 +0100
3629 +++ linux-2.6.33.1-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.1/fs/attr.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/attr.c
3700 --- linux-2.6.33.1/fs/attr.c 2009-12-03 20:02:51.000000000 +0100
3701 +++ linux-2.6.33.1-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.1/fs/binfmt_aout.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/binfmt_aout.c
3743 --- linux-2.6.33.1/fs/binfmt_aout.c 2010-02-25 11:52:04.000000000 +0100
3744 +++ linux-2.6.33.1-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.1/fs/binfmt_elf.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/binfmt_elf.c
3754 --- linux-2.6.33.1/fs/binfmt_elf.c 2010-02-25 11:52:04.000000000 +0100
3755 +++ linux-2.6.33.1-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.1/fs/binfmt_flat.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/binfmt_flat.c
3765 --- linux-2.6.33.1/fs/binfmt_flat.c 2010-02-25 11:52:04.000000000 +0100
3766 +++ linux-2.6.33.1-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.1/fs/binfmt_som.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/binfmt_som.c
3776 --- linux-2.6.33.1/fs/binfmt_som.c 2010-02-25 11:52:04.000000000 +0100
3777 +++ linux-2.6.33.1-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.1/fs/block_dev.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/block_dev.c
3787 --- linux-2.6.33.1/fs/block_dev.c 2010-02-25 11:52:04.000000000 +0100
3788 +++ linux-2.6.33.1-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.1/fs/btrfs/ctree.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/btrfs/ctree.h
3827 --- linux-2.6.33.1/fs/btrfs/ctree.h 2010-02-25 11:52:04.000000000 +0100
3828 +++ linux-2.6.33.1-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.1/fs/btrfs/disk-io.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/btrfs/disk-io.c
3882 --- linux-2.6.33.1/fs/btrfs/disk-io.c 2010-02-25 11:52:04.000000000 +0100
3883 +++ linux-2.6.33.1-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.1/fs/btrfs/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/btrfs/inode.c
3895 --- linux-2.6.33.1/fs/btrfs/inode.c 2010-02-25 11:52:04.000000000 +0100
3896 +++ linux-2.6.33.1-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.1/fs/btrfs/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/btrfs/ioctl.c
3974 --- linux-2.6.33.1/fs/btrfs/ioctl.c 2010-02-25 11:52:04.000000000 +0100
3975 +++ linux-2.6.33.1-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.1/fs/btrfs/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/btrfs/super.c
4158 --- linux-2.6.33.1/fs/btrfs/super.c 2010-02-25 11:52:04.000000000 +0100
4159 +++ linux-2.6.33.1-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.1/fs/char_dev.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/char_dev.c
4216 --- linux-2.6.33.1/fs/char_dev.c 2009-12-03 20:02:51.000000000 +0100
4217 +++ linux-2.6.33.1-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.1/fs/dcache.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/dcache.c
4251 --- linux-2.6.33.1/fs/dcache.c 2010-02-25 11:52:05.000000000 +0100
4252 +++ linux-2.6.33.1-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.1/fs/devpts/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/devpts/inode.c
4305 --- linux-2.6.33.1/fs/devpts/inode.c 2010-02-25 11:52:05.000000000 +0100
4306 +++ linux-2.6.33.1-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.1/fs/exec.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/exec.c
4390 --- linux-2.6.33.1/fs/exec.c 2010-02-25 11:52:05.000000000 +0100
4391 +++ linux-2.6.33.1-vs2.3.0.36.30.4/fs/exec.c 2010-02-25 12:02:16.000000000 +0100
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.1/fs/ext2/balloc.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext2/balloc.c
4413 --- linux-2.6.33.1/fs/ext2/balloc.c 2009-06-11 17:13:03.000000000 +0200
4414 +++ linux-2.6.33.1-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.1/fs/ext2/ext2.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext2/ext2.h
4424 --- linux-2.6.33.1/fs/ext2/ext2.h 2010-02-25 11:52:05.000000000 +0100
4425 +++ linux-2.6.33.1-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.1/fs/ext2/file.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext2/file.c
4435 --- linux-2.6.33.1/fs/ext2/file.c 2010-02-25 11:52:05.000000000 +0100
4436 +++ linux-2.6.33.1-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.1/fs/ext2/ialloc.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext2/ialloc.c
4444 --- linux-2.6.33.1/fs/ext2/ialloc.c 2009-06-11 17:13:03.000000000 +0200
4445 +++ linux-2.6.33.1-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.1/fs/ext2/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext2/inode.c
4463 --- linux-2.6.33.1/fs/ext2/inode.c 2010-02-25 11:52:05.000000000 +0100
4464 +++ linux-2.6.33.1-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.1/fs/ext2/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext2/ioctl.c
4614 --- linux-2.6.33.1/fs/ext2/ioctl.c 2009-09-10 15:26:21.000000000 +0200
4615 +++ linux-2.6.33.1-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.1/fs/ext2/namei.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext2/namei.c
4666 --- linux-2.6.33.1/fs/ext2/namei.c 2009-12-03 20:02:51.000000000 +0100
4667 +++ linux-2.6.33.1-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.1/fs/ext2/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext2/super.c
4693 --- linux-2.6.33.1/fs/ext2/super.c 2010-02-25 11:52:05.000000000 +0100
4694 +++ linux-2.6.33.1-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.1/fs/ext3/file.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext3/file.c
4761 --- linux-2.6.33.1/fs/ext3/file.c 2009-12-03 20:02:51.000000000 +0100
4762 +++ linux-2.6.33.1-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.1/fs/ext3/ialloc.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext3/ialloc.c
4771 --- linux-2.6.33.1/fs/ext3/ialloc.c 2009-09-10 15:26:21.000000000 +0200
4772 +++ linux-2.6.33.1-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.1/fs/ext3/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext3/inode.c
4790 --- linux-2.6.33.1/fs/ext3/inode.c 2010-02-25 11:52:05.000000000 +0100
4791 +++ linux-2.6.33.1-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.1/fs/ext3/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext3/ioctl.c
4976 --- linux-2.6.33.1/fs/ext3/ioctl.c 2009-06-11 17:13:03.000000000 +0200
4977 +++ linux-2.6.33.1-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.1/fs/ext3/namei.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext3/namei.c
5054 --- linux-2.6.33.1/fs/ext3/namei.c 2010-02-25 11:52:05.000000000 +0100
5055 +++ linux-2.6.33.1-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.1/fs/ext3/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext3/super.c
5081 --- linux-2.6.33.1/fs/ext3/super.c 2010-02-25 11:52:05.000000000 +0100
5082 +++ linux-2.6.33.1-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.1/fs/ext4/ext4.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext4/ext4.h
5149 --- linux-2.6.33.1/fs/ext4/ext4.h 2010-02-25 11:52:05.000000000 +0100
5150 +++ linux-2.6.33.1-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.1/fs/ext4/file.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext4/file.c
5199 --- linux-2.6.33.1/fs/ext4/file.c 2009-12-03 20:02:51.000000000 +0100
5200 +++ linux-2.6.33.1-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.1/fs/ext4/ialloc.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext4/ialloc.c
5209 --- linux-2.6.33.1/fs/ext4/ialloc.c 2009-12-03 20:02:51.000000000 +0100
5210 +++ linux-2.6.33.1-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.1/fs/ext4/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext4/inode.c
5228 --- linux-2.6.33.1/fs/ext4/inode.c 2010-02-25 11:52:05.000000000 +0100
5229 +++ linux-2.6.33.1-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.1/fs/ext4/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext4/ioctl.c
5413 --- linux-2.6.33.1/fs/ext4/ioctl.c 2010-02-25 11:52:05.000000000 +0100
5414 +++ linux-2.6.33.1-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.1/fs/ext4/namei.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext4/namei.c
5479 --- linux-2.6.33.1/fs/ext4/namei.c 2010-02-25 11:52:05.000000000 +0100
5480 +++ linux-2.6.33.1-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.1/fs/ext4/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ext4/super.c
5506 --- linux-2.6.33.1/fs/ext4/super.c 2010-02-25 11:52:05.000000000 +0100
5507 +++ linux-2.6.33.1-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.1/fs/fcntl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/fcntl.c
5573 --- linux-2.6.33.1/fs/fcntl.c 2010-02-25 11:52:05.000000000 +0100
5574 +++ linux-2.6.33.1-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.1/fs/file.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/file.c
5602 --- linux-2.6.33.1/fs/file.c 2009-12-03 20:02:51.000000000 +0100
5603 +++ linux-2.6.33.1-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.1/fs/file_table.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/file_table.c
5630 --- linux-2.6.33.1/fs/file_table.c 2010-03-18 16:25:15.000000000 +0100
5631 +++ linux-2.6.33.1-vs2.3.0.36.30.4/fs/file_table.c 2010-03-18 16:54:29.000000000 +0100
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.1/fs/fs_struct.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/fs_struct.c
5669 --- linux-2.6.33.1/fs/fs_struct.c 2009-06-11 17:13:04.000000000 +0200
5670 +++ linux-2.6.33.1-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.1/fs/gfs2/file.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/gfs2/file.c
5696 --- linux-2.6.33.1/fs/gfs2/file.c 2010-02-25 11:52:05.000000000 +0100
5697 +++ linux-2.6.33.1-vs2.3.0.36.30.4/fs/gfs2/file.c 2010-02-25 12:02:16.000000000 +0100
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.1/fs/gfs2/inode.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/gfs2/inode.h
5819 --- linux-2.6.33.1/fs/gfs2/inode.h 2009-09-10 15:26:22.000000000 +0200
5820 +++ linux-2.6.33.1-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.1/fs/gfs2/ops_inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/gfs2/ops_inode.c
5830 --- linux-2.6.33.1/fs/gfs2/ops_inode.c 2010-02-25 11:52:05.000000000 +0100
5831 +++ linux-2.6.33.1-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.1/fs/hfsplus/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/hfsplus/ioctl.c
5849 --- linux-2.6.33.1/fs/hfsplus/ioctl.c 2008-12-25 00:26:37.000000000 +0100
5850 +++ linux-2.6.33.1-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.1/fs/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/inode.c
5860 --- linux-2.6.33.1/fs/inode.c 2010-02-25 11:52:05.000000000 +0100
5861 +++ linux-2.6.33.1-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.1/fs/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ioctl.c
5902 --- linux-2.6.33.1/fs/ioctl.c 2009-12-03 20:02:52.000000000 +0100
5903 +++ linux-2.6.33.1-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.1/fs/ioprio.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ioprio.c
5915 --- linux-2.6.33.1/fs/ioprio.c 2009-03-24 14:22:26.000000000 +0100
5916 +++ linux-2.6.33.1-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.1/fs/jfs/acl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/acl.c
5944 --- linux-2.6.33.1/fs/jfs/acl.c 2009-12-03 20:02:52.000000000 +0100
5945 +++ linux-2.6.33.1-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.1/fs/jfs/file.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/file.c
5957 --- linux-2.6.33.1/fs/jfs/file.c 2009-12-03 20:02:52.000000000 +0100
5958 +++ linux-2.6.33.1-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.1/fs/jfs/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/ioctl.c
5968 --- linux-2.6.33.1/fs/jfs/ioctl.c 2008-12-25 00:26:37.000000000 +0100
5969 +++ linux-2.6.33.1-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.1/fs/jfs/jfs_dinode.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/jfs_dinode.h
6028 --- linux-2.6.33.1/fs/jfs/jfs_dinode.h 2008-12-25 00:26:37.000000000 +0100
6029 +++ linux-2.6.33.1-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.1/fs/jfs/jfs_filsys.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/jfs_filsys.h
6047 --- linux-2.6.33.1/fs/jfs/jfs_filsys.h 2008-12-25 00:26:37.000000000 +0100
6048 +++ linux-2.6.33.1-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.1/fs/jfs/jfs_imap.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/jfs_imap.c
6058 --- linux-2.6.33.1/fs/jfs/jfs_imap.c 2009-09-10 15:26:22.000000000 +0200
6059 +++ linux-2.6.33.1-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.1/fs/jfs/jfs_inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/jfs_inode.c
6120 --- linux-2.6.33.1/fs/jfs/jfs_inode.c 2009-06-11 17:13:05.000000000 +0200
6121 +++ linux-2.6.33.1-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.1/fs/jfs/jfs_inode.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/jfs_inode.h
6204 --- linux-2.6.33.1/fs/jfs/jfs_inode.h 2009-06-11 17:13:05.000000000 +0200
6205 +++ linux-2.6.33.1-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.1/fs/jfs/namei.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/namei.c
6215 --- linux-2.6.33.1/fs/jfs/namei.c 2009-12-03 20:02:52.000000000 +0100
6216 +++ linux-2.6.33.1-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.1/fs/jfs/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/jfs/super.c
6242 --- linux-2.6.33.1/fs/jfs/super.c 2010-02-25 11:52:05.000000000 +0100
6243 +++ linux-2.6.33.1-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.1/fs/libfs.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/libfs.c
6310 --- linux-2.6.33.1/fs/libfs.c 2010-02-25 11:52:05.000000000 +0100
6311 +++ linux-2.6.33.1-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.1/fs/locks.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/locks.c
6359 --- linux-2.6.33.1/fs/locks.c 2009-12-03 20:02:52.000000000 +0100
6360 +++ linux-2.6.33.1-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.1/fs/namei.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/namei.c
6547 --- linux-2.6.33.1/fs/namei.c 2010-02-25 11:52:05.000000000 +0100
6548 +++ linux-2.6.33.1-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.1/fs/namespace.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/namespace.c
7025 --- linux-2.6.33.1/fs/namespace.c 2010-02-25 11:52:05.000000000 +0100
7026 +++ linux-2.6.33.1-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.1/fs/nfs/client.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfs/client.c
7317 --- linux-2.6.33.1/fs/nfs/client.c 2010-02-25 11:52:05.000000000 +0100
7318 +++ linux-2.6.33.1-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.1/fs/nfs/dir.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfs/dir.c
7341 --- linux-2.6.33.1/fs/nfs/dir.c 2010-02-25 11:52:05.000000000 +0100
7342 +++ linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfs/dir.c 2010-02-25 12:02:16.000000000 +0100
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.1/fs/nfs/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfs/inode.c
7360 --- linux-2.6.33.1/fs/nfs/inode.c 2010-02-25 11:52:05.000000000 +0100
7361 +++ linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfs/inode.c 2010-02-25 12:02:16.000000000 +0100
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.1/fs/nfs/nfs3xdr.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfs/nfs3xdr.c
7514 --- linux-2.6.33.1/fs/nfs/nfs3xdr.c 2009-12-03 20:02:52.000000000 +0100
7515 +++ linux-2.6.33.1-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.1/fs/nfs/nfsroot.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfs/nfsroot.c
7606 --- linux-2.6.33.1/fs/nfs/nfsroot.c 2009-09-10 15:26:23.000000000 +0200
7607 +++ linux-2.6.33.1-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.1/fs/nfs/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfs/super.c
7655 --- linux-2.6.33.1/fs/nfs/super.c 2010-02-25 11:52:05.000000000 +0100
7656 +++ linux-2.6.33.1-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.1/fs/nfsd/auth.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfsd/auth.c
7674 --- linux-2.6.33.1/fs/nfsd/auth.c 2010-02-25 11:52:05.000000000 +0100
7675 +++ linux-2.6.33.1-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.1/fs/nfsd/nfs3xdr.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfsd/nfs3xdr.c
7695 --- linux-2.6.33.1/fs/nfsd/nfs3xdr.c 2010-02-25 11:52:05.000000000 +0100
7696 +++ linux-2.6.33.1-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.1/fs/nfsd/nfs4xdr.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfsd/nfs4xdr.c
7748 --- linux-2.6.33.1/fs/nfsd/nfs4xdr.c 2010-02-25 11:52:05.000000000 +0100
7749 +++ linux-2.6.33.1-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.1/fs/nfsd/nfsxdr.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/nfsd/nfsxdr.c
7780 --- linux-2.6.33.1/fs/nfsd/nfsxdr.c 2010-02-25 11:52:05.000000000 +0100
7781 +++ linux-2.6.33.1-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.1/fs/ocfs2/dlm/dlmfs.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/dlm/dlmfs.c
7831 --- linux-2.6.33.1/fs/ocfs2/dlm/dlmfs.c 2009-12-03 20:02:53.000000000 +0100
7832 +++ linux-2.6.33.1-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.1/fs/ocfs2/dlmglue.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/dlmglue.c
7858 --- linux-2.6.33.1/fs/ocfs2/dlmglue.c 2010-02-25 11:52:06.000000000 +0100
7859 +++ linux-2.6.33.1-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.1/fs/ocfs2/dlmglue.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/dlmglue.h
7877 --- linux-2.6.33.1/fs/ocfs2/dlmglue.h 2009-12-03 20:02:53.000000000 +0100
7878 +++ linux-2.6.33.1-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.1/fs/ocfs2/file.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/file.c
7890 --- linux-2.6.33.1/fs/ocfs2/file.c 2010-02-25 11:52:06.000000000 +0100
7891 +++ linux-2.6.33.1-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.1/fs/ocfs2/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/inode.c
7910 --- linux-2.6.33.1/fs/ocfs2/inode.c 2010-02-25 11:52:06.000000000 +0100
7911 +++ linux-2.6.33.1-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.1/fs/ocfs2/inode.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/inode.h
8009 --- linux-2.6.33.1/fs/ocfs2/inode.h 2009-12-03 20:02:53.000000000 +0100
8010 +++ linux-2.6.33.1-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.1/fs/ocfs2/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/ioctl.c
8020 --- linux-2.6.33.1/fs/ocfs2/ioctl.c 2010-02-25 11:52:06.000000000 +0100
8021 +++ linux-2.6.33.1-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.1/fs/ocfs2/namei.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/namei.c
8086 --- linux-2.6.33.1/fs/ocfs2/namei.c 2010-02-25 11:52:06.000000000 +0100
8087 +++ linux-2.6.33.1-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.1/fs/ocfs2/ocfs2_fs.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/ocfs2_fs.h
8119 --- linux-2.6.33.1/fs/ocfs2/ocfs2_fs.h 2010-02-25 11:52:06.000000000 +0100
8120 +++ linux-2.6.33.1-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.1/fs/ocfs2/ocfs2.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/ocfs2.h
8157 --- linux-2.6.33.1/fs/ocfs2/ocfs2.h 2010-02-25 11:52:06.000000000 +0100
8158 +++ linux-2.6.33.1-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.1/fs/ocfs2/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/ocfs2/super.c
8168 --- linux-2.6.33.1/fs/ocfs2/super.c 2010-02-25 11:52:06.000000000 +0100
8169 +++ linux-2.6.33.1-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.1/fs/open.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/open.c
8234 --- linux-2.6.33.1/fs/open.c 2010-02-25 11:52:06.000000000 +0100
8235 +++ linux-2.6.33.1-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.1/fs/proc/array.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/array.c
8337 --- linux-2.6.33.1/fs/proc/array.c 2010-02-25 11:52:06.000000000 +0100
8338 +++ linux-2.6.33.1-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.1/fs/proc/base.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/base.c
8453 --- linux-2.6.33.1/fs/proc/base.c 2010-02-25 11:52:06.000000000 +0100
8454 +++ linux-2.6.33.1-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.1/fs/proc/generic.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/generic.c
8597 --- linux-2.6.33.1/fs/proc/generic.c 2010-02-25 11:52:06.000000000 +0100
8598 +++ linux-2.6.33.1-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.1/fs/proc/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/inode.c
8661 --- linux-2.6.33.1/fs/proc/inode.c 2010-02-25 11:52:06.000000000 +0100
8662 +++ linux-2.6.33.1-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.1/fs/proc/internal.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/internal.h
8673 --- linux-2.6.33.1/fs/proc/internal.h 2010-02-25 11:52:06.000000000 +0100
8674 +++ linux-2.6.33.1-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.1/fs/proc/loadavg.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/loadavg.c
8712 --- linux-2.6.33.1/fs/proc/loadavg.c 2009-09-10 15:26:23.000000000 +0200
8713 +++ linux-2.6.33.1-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.1/fs/proc/meminfo.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/meminfo.c
8744 --- linux-2.6.33.1/fs/proc/meminfo.c 2009-12-03 20:02:53.000000000 +0100
8745 +++ linux-2.6.33.1-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.1/fs/proc/root.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/root.c
8757 --- linux-2.6.33.1/fs/proc/root.c 2009-06-11 17:13:07.000000000 +0200
8758 +++ linux-2.6.33.1-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.1/fs/proc/uptime.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/proc/uptime.c
8791 --- linux-2.6.33.1/fs/proc/uptime.c 2009-12-03 20:02:53.000000000 +0100
8792 +++ linux-2.6.33.1-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.1/fs/quota/quota.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/quota/quota.c
8823 --- linux-2.6.33.1/fs/quota/quota.c 2010-02-25 11:52:06.000000000 +0100
8824 +++ linux-2.6.33.1-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.1/fs/reiserfs/file.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/reiserfs/file.c
8931 --- linux-2.6.33.1/fs/reiserfs/file.c 2010-02-25 11:52:06.000000000 +0100
8932 +++ linux-2.6.33.1-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.1/fs/reiserfs/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/reiserfs/inode.c
8940 --- linux-2.6.33.1/fs/reiserfs/inode.c 2010-02-25 11:52:06.000000000 +0100
8941 +++ linux-2.6.33.1-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.1/fs/reiserfs/ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/reiserfs/ioctl.c
9111 --- linux-2.6.33.1/fs/reiserfs/ioctl.c 2010-02-25 11:52:06.000000000 +0100
9112 +++ linux-2.6.33.1-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.1/fs/reiserfs/namei.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/reiserfs/namei.c
9181 --- linux-2.6.33.1/fs/reiserfs/namei.c 2010-02-25 11:52:06.000000000 +0100
9182 +++ linux-2.6.33.1-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.1/fs/reiserfs/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/reiserfs/super.c
9216 --- linux-2.6.33.1/fs/reiserfs/super.c 2010-02-25 11:52:06.000000000 +0100
9217 +++ linux-2.6.33.1-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.1/fs/reiserfs/xattr.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/reiserfs/xattr.c
9260 --- linux-2.6.33.1/fs/reiserfs/xattr.c 2010-02-25 11:52:06.000000000 +0100
9261 +++ linux-2.6.33.1-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.1/fs/stat.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/stat.c
9271 --- linux-2.6.33.1/fs/stat.c 2010-02-25 11:52:06.000000000 +0100
9272 +++ linux-2.6.33.1-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.1/fs/super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/super.c
9282 --- linux-2.6.33.1/fs/super.c 2010-02-25 11:52:06.000000000 +0100
9283 +++ linux-2.6.33.1-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.1/fs/sysfs/mount.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/sysfs/mount.c
9334 --- linux-2.6.33.1/fs/sysfs/mount.c 2009-06-11 17:13:08.000000000 +0200
9335 +++ linux-2.6.33.1-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.1/fs/utimes.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/utimes.c
9346 --- linux-2.6.33.1/fs/utimes.c 2009-03-24 14:22:37.000000000 +0100
9347 +++ linux-2.6.33.1-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.1/fs/xattr.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xattr.c
9358 --- linux-2.6.33.1/fs/xattr.c 2010-02-25 11:52:06.000000000 +0100
9359 +++ linux-2.6.33.1-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.1/fs/xfs/linux-2.6/xfs_ioctl.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_ioctl.c
9378 --- linux-2.6.33.1/fs/xfs/linux-2.6/xfs_ioctl.c 2010-02-25 11:52:06.000000000 +0100
9379 +++ linux-2.6.33.1-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.1/fs/xfs/linux-2.6/xfs_ioctl.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_ioctl.h
9448 --- linux-2.6.33.1/fs/xfs/linux-2.6/xfs_ioctl.h 2009-03-24 14:22:37.000000000 +0100
9449 +++ linux-2.6.33.1-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.1/fs/xfs/linux-2.6/xfs_iops.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_iops.c
9464 --- linux-2.6.33.1/fs/xfs/linux-2.6/xfs_iops.c 2010-02-25 11:52:06.000000000 +0100
9465 +++ linux-2.6.33.1-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.1/fs/xfs/linux-2.6/xfs_linux.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_linux.h
9542 --- linux-2.6.33.1/fs/xfs/linux-2.6/xfs_linux.h 2010-02-25 11:52:06.000000000 +0100
9543 +++ linux-2.6.33.1-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.1/fs/xfs/linux-2.6/xfs_super.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/linux-2.6/xfs_super.c
9553 --- linux-2.6.33.1/fs/xfs/linux-2.6/xfs_super.c 2010-02-25 11:52:06.000000000 +0100
9554 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_dinode.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_dinode.h
9628 --- linux-2.6.33.1/fs/xfs/xfs_dinode.h 2009-06-11 17:13:09.000000000 +0200
9629 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_fs.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_fs.h
9671 --- linux-2.6.33.1/fs/xfs/xfs_fs.h 2009-12-03 20:02:53.000000000 +0100
9672 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_ialloc.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_ialloc.c
9694 --- linux-2.6.33.1/fs/xfs/xfs_ialloc.c 2010-02-25 11:52:06.000000000 +0100
9695 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_inode.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_inode.c
9705 --- linux-2.6.33.1/fs/xfs/xfs_inode.c 2010-02-25 11:52:06.000000000 +0100
9706 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_inode.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_inode.h
9882 --- linux-2.6.33.1/fs/xfs/xfs_inode.h 2010-02-25 11:52:06.000000000 +0100
9883 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_itable.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_itable.c
9905 --- linux-2.6.33.1/fs/xfs/xfs_itable.c 2009-12-03 20:02:54.000000000 +0100
9906 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_log_recover.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_log_recover.c
9916 --- linux-2.6.33.1/fs/xfs/xfs_log_recover.c 2010-02-25 11:52:06.000000000 +0100
9917 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_mount.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_mount.h
9929 --- linux-2.6.33.1/fs/xfs/xfs_mount.h 2010-02-25 11:52:06.000000000 +0100
9930 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_vnodeops.c linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_vnodeops.c
9940 --- linux-2.6.33.1/fs/xfs/xfs_vnodeops.c 2010-02-25 11:52:06.000000000 +0100
9941 +++ linux-2.6.33.1-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.1/fs/xfs/xfs_vnodeops.h linux-2.6.33.1-vs2.3.0.36.30.4/fs/xfs/xfs_vnodeops.h
10082 --- linux-2.6.33.1/fs/xfs/xfs_vnodeops.h 2010-02-25 11:52:06.000000000 +0100
10083 +++ linux-2.6.33.1-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.1/include/asm-generic/tlb.h linux-2.6.33.1-vs2.3.0.36.30.4/include/asm-generic/tlb.h
10093 --- linux-2.6.33.1/include/asm-generic/tlb.h 2009-09-10 15:26:24.000000000 +0200
10094 +++ linux-2.6.33.1-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.1/include/linux/capability.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/capability.h
10104 --- linux-2.6.33.1/include/linux/capability.h 2010-02-25 11:52:07.000000000 +0100
10105 +++ linux-2.6.33.1-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.1/include/linux/devpts_fs.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/devpts_fs.h
10130 --- linux-2.6.33.1/include/linux/devpts_fs.h 2008-12-25 00:26:37.000000000 +0100
10131 +++ linux-2.6.33.1-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.1/include/linux/ext2_fs.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/ext2_fs.h
10139 --- linux-2.6.33.1/include/linux/ext2_fs.h 2010-02-25 11:52:07.000000000 +0100
10140 +++ linux-2.6.33.1-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.1/include/linux/ext3_fs.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/ext3_fs.h
10181 --- linux-2.6.33.1/include/linux/ext3_fs.h 2010-02-25 11:52:07.000000000 +0100
10182 +++ linux-2.6.33.1-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.1/include/linux/fs.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/fs.h
10235 --- linux-2.6.33.1/include/linux/fs.h 2010-03-18 16:25:15.000000000 +0100
10236 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/fs.h 2010-03-18 16:54:29.000000000 +0100
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.1/include/linux/gfs2_ondisk.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/gfs2_ondisk.h
10416 --- linux-2.6.33.1/include/linux/gfs2_ondisk.h 2010-02-25 11:52:07.000000000 +0100
10417 +++ linux-2.6.33.1-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.1/include/linux/if_tun.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/if_tun.h
10439 --- linux-2.6.33.1/include/linux/if_tun.h 2009-12-03 20:02:55.000000000 +0100
10440 +++ linux-2.6.33.1-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.1/include/linux/init_task.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/init_task.h
10450 --- linux-2.6.33.1/include/linux/init_task.h 2010-02-25 11:52:07.000000000 +0100
10451 +++ linux-2.6.33.1-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.1/include/linux/ipc.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/ipc.h
10464 --- linux-2.6.33.1/include/linux/ipc.h 2009-12-03 20:02:55.000000000 +0100
10465 +++ linux-2.6.33.1-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.1/include/linux/Kbuild linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/Kbuild
10475 --- linux-2.6.33.1/include/linux/Kbuild 2010-02-25 11:52:07.000000000 +0100
10476 +++ linux-2.6.33.1-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.1/include/linux/loop.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/loop.h
10487 --- linux-2.6.33.1/include/linux/loop.h 2009-09-10 15:26:25.000000000 +0200
10488 +++ linux-2.6.33.1-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.1/include/linux/magic.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/magic.h
10498 --- linux-2.6.33.1/include/linux/magic.h 2009-12-03 20:02:55.000000000 +0100
10499 +++ linux-2.6.33.1-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.1/include/linux/major.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/major.h
10518 --- linux-2.6.33.1/include/linux/major.h 2009-09-10 15:26:25.000000000 +0200
10519 +++ linux-2.6.33.1-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.1/include/linux/memcontrol.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/memcontrol.h
10529 --- linux-2.6.33.1/include/linux/memcontrol.h 2010-02-25 11:52:07.000000000 +0100
10530 +++ linux-2.6.33.1-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.1/include/linux/mm_types.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/mm_types.h
10546 --- linux-2.6.33.1/include/linux/mm_types.h 2010-02-25 11:52:07.000000000 +0100
10547 +++ linux-2.6.33.1-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.1/include/linux/mount.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/mount.h
10557 --- linux-2.6.33.1/include/linux/mount.h 2009-09-10 15:26:25.000000000 +0200
10558 +++ linux-2.6.33.1-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.1/include/linux/net.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/net.h
10578 --- linux-2.6.33.1/include/linux/net.h 2010-02-25 11:52:07.000000000 +0100
10579 +++ linux-2.6.33.1-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.1/include/linux/nfs_mount.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/nfs_mount.h
10589 --- linux-2.6.33.1/include/linux/nfs_mount.h 2009-03-24 14:22:43.000000000 +0100
10590 +++ linux-2.6.33.1-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.1/include/linux/nsproxy.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/nsproxy.h
10602 --- linux-2.6.33.1/include/linux/nsproxy.h 2009-06-11 17:13:17.000000000 +0200
10603 +++ linux-2.6.33.1-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.1/include/linux/pid.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/pid.h
10653 --- linux-2.6.33.1/include/linux/pid.h 2009-03-24 14:22:43.000000000 +0100
10654 +++ linux-2.6.33.1-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.1/include/linux/proc_fs.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/proc_fs.h
10674 --- linux-2.6.33.1/include/linux/proc_fs.h 2009-12-03 20:02:56.000000000 +0100
10675 +++ linux-2.6.33.1-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.1/include/linux/quotaops.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/quotaops.h
10712 --- linux-2.6.33.1/include/linux/quotaops.h 2009-12-03 20:02:56.000000000 +0100
10713 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/quotaops.h 2010-02-25 12:02:16.000000000 +0100
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 @@ -154,10 +155,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 @@ -174,10 +179,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 @@ -194,22 +203,30 @@ 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);
10773 static inline int vfs_dq_alloc_inode(struct inode *inode)
10775 + if (dl_alloc_inode(inode))
10777 if (sb_any_quota_active(inode->i_sb)) {
10778 vfs_dq_init(inode);
10779 - if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
10780 + if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) {
10781 + dl_free_inode(inode);
10787 @@ -217,9 +234,13 @@ static inline int vfs_dq_alloc_inode(str
10789 static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
10791 + if (dl_claim_space(inode, nr))
10793 if (sb_any_quota_active(inode->i_sb)) {
10794 - if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA)
10795 + if (inode->i_sb->dq_op->claim_space(inode, nr) == NO_QUOTA) {
10796 + dl_release_space(inode, nr);
10800 inode_add_bytes(inode, nr);
10802 @@ -235,8 +256,9 @@ void vfs_dq_release_reservation_space(st
10804 if (sb_any_quota_active(inode->i_sb))
10805 inode->i_sb->dq_op->release_rsv(inode, nr);
10807 inode_sub_rsv_space(inode, nr);
10808 + dl_release_space(inode, nr);
10811 static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
10812 @@ -243,6 +265,7 @@ static inline void vfs_dq_free_space_nod
10813 inode->i_sb->dq_op->free_space(inode, nr);
10815 inode_sub_bytes(inode, nr);
10816 + dl_free_space(inode, nr);
10819 static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
10820 @@ -255,6 +278,7 @@ static inline void vfs_dq_free_inode(str
10822 if (sb_any_quota_active(inode->i_sb))
10823 inode->i_sb->dq_op->free_inode(inode, 1);
10824 + dl_free_inode(inode);
10827 /* Cannot be called inside a transaction */
10828 @@ -358,6 +382,8 @@ static inline int vfs_dq_transfer(struct
10830 static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
10832 + if (dl_alloc_space(inode, nr))
10834 inode_add_bytes(inode, nr);
10837 @@ -371,6 +397,8 @@ static inline int vfs_dq_prealloc_space(
10839 static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
10841 + if (dl_alloc_space(inode, nr))
10843 inode_add_bytes(inode, nr);
10846 @@ -384,22 +412,28 @@ static inline int vfs_dq_alloc_space(str
10848 static inline int vfs_dq_reserve_space(struct inode *inode, qsize_t nr)
10850 + if (dl_reserve_space(inode, nr))
10855 static inline int vfs_dq_claim_space(struct inode *inode, qsize_t nr)
10857 + if (dl_claim_space(inode, nr))
10859 return vfs_dq_alloc_space(inode, nr);
10863 int vfs_dq_release_reservation_space(struct inode *inode, qsize_t nr)
10865 + dl_release_space(inode, nr);
10869 static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
10871 + dl_free_space(inode, nr);
10872 inode_sub_bytes(inode, nr);
10875 diff -NurpP --minimal linux-2.6.33.1/include/linux/reboot.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/reboot.h
10876 --- linux-2.6.33.1/include/linux/reboot.h 2008-12-25 00:26:37.000000000 +0100
10877 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/reboot.h 2010-02-25 12:02:16.000000000 +0100
10879 #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
10880 #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
10881 #define LINUX_REBOOT_CMD_KEXEC 0x45584543
10882 +#define LINUX_REBOOT_CMD_OOM 0xDEADBEEF
10886 diff -NurpP --minimal linux-2.6.33.1/include/linux/reiserfs_fs.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/reiserfs_fs.h
10887 --- linux-2.6.33.1/include/linux/reiserfs_fs.h 2010-02-25 11:52:07.000000000 +0100
10888 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/reiserfs_fs.h 2010-02-25 12:02:16.000000000 +0100
10889 @@ -977,6 +977,11 @@ struct stat_data_v1 {
10890 #define REISERFS_COMPR_FL FS_COMPR_FL
10891 #define REISERFS_NOTAIL_FL FS_NOTAIL_FL
10893 +/* unfortunately reiserfs sdattr is only 16 bit */
10894 +#define REISERFS_IXUNLINK_FL (FS_IXUNLINK_FL >> 16)
10895 +#define REISERFS_BARRIER_FL (FS_BARRIER_FL >> 16)
10896 +#define REISERFS_COW_FL (FS_COW_FL >> 16)
10898 /* persistent flags that file inherits from the parent directory */
10899 #define REISERFS_INHERIT_MASK ( REISERFS_IMMUTABLE_FL | \
10900 REISERFS_SYNC_FL | \
10901 @@ -986,6 +991,9 @@ struct stat_data_v1 {
10902 REISERFS_COMPR_FL | \
10903 REISERFS_NOTAIL_FL )
10905 +#define REISERFS_FL_USER_VISIBLE 0x80FF
10906 +#define REISERFS_FL_USER_MODIFIABLE 0x80FF
10908 /* Stat Data on disk (reiserfs version of UFS disk inode minus the
10911 @@ -2071,6 +2079,7 @@ static inline void reiserfs_update_sd(st
10912 void sd_attrs_to_i_attrs(__u16 sd_attrs, struct inode *inode);
10913 void i_attrs_to_sd_attrs(struct inode *inode, __u16 * sd_attrs);
10914 int reiserfs_setattr(struct dentry *dentry, struct iattr *attr);
10915 +int reiserfs_sync_flags(struct inode *inode, int, int);
10918 void set_de_name_and_namelen(struct reiserfs_dir_entry *de);
10919 diff -NurpP --minimal linux-2.6.33.1/include/linux/reiserfs_fs_sb.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/reiserfs_fs_sb.h
10920 --- linux-2.6.33.1/include/linux/reiserfs_fs_sb.h 2010-02-25 11:52:07.000000000 +0100
10921 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/reiserfs_fs_sb.h 2010-02-25 12:02:16.000000000 +0100
10922 @@ -476,6 +476,7 @@ enum reiserfs_mount_options {
10923 REISERFS_EXPOSE_PRIVROOT,
10924 REISERFS_BARRIER_NONE,
10925 REISERFS_BARRIER_FLUSH,
10928 /* Actions on error */
10929 REISERFS_ERROR_PANIC,
10930 diff -NurpP --minimal linux-2.6.33.1/include/linux/sched.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sched.h
10931 --- linux-2.6.33.1/include/linux/sched.h 2010-03-18 16:25:15.000000000 +0100
10932 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sched.h 2010-03-18 17:24:08.000000000 +0100
10933 @@ -401,25 +401,28 @@ static inline void arch_pick_mmap_layout
10934 * The mm counters are not protected by its page_table_lock,
10935 * so must be incremented atomically.
10937 -#define set_mm_counter(mm, member, value) atomic_long_set(&(mm)->_##member, value)
10938 -#define get_mm_counter(mm, member) ((unsigned long)atomic_long_read(&(mm)->_##member))
10939 -#define add_mm_counter(mm, member, value) atomic_long_add(value, &(mm)->_##member)
10940 -#define inc_mm_counter(mm, member) atomic_long_inc(&(mm)->_##member)
10941 -#define dec_mm_counter(mm, member) atomic_long_dec(&(mm)->_##member)
10942 +#define __set_mm_counter(mm, member, value) \
10943 + atomic_long_set(&(mm)->_##member, value)
10944 +#define get_mm_counter(mm, member) \
10945 + ((unsigned long)atomic_long_read(&(mm)->_##member))
10947 #else /* !USE_SPLIT_PTLOCKS */
10949 * The mm counters are protected by its page_table_lock,
10950 * so can be incremented directly.
10952 -#define set_mm_counter(mm, member, value) (mm)->_##member = (value)
10953 +#define __set_mm_counter(mm, member, value) (mm)->_##member = (value)
10954 #define get_mm_counter(mm, member) ((mm)->_##member)
10955 -#define add_mm_counter(mm, member, value) (mm)->_##member += (value)
10956 -#define inc_mm_counter(mm, member) (mm)->_##member++
10957 -#define dec_mm_counter(mm, member) (mm)->_##member--
10959 #endif /* !USE_SPLIT_PTLOCKS */
10961 +#define set_mm_counter(mm, member, value) \
10962 + vx_ ## member ## pages_sub((mm), (get_mm_counter(mm, member) - value))
10963 +#define add_mm_counter(mm, member, value) \
10964 + vx_ ## member ## pages_add((mm), (value))
10965 +#define inc_mm_counter(mm, member) vx_ ## member ## pages_inc((mm))
10966 +#define dec_mm_counter(mm, member) vx_ ## member ## pages_dec((mm))
10968 #define get_mm_rss(mm) \
10969 (get_mm_counter(mm, file_rss) + get_mm_counter(mm, anon_rss))
10970 #define update_hiwater_rss(mm) do { \
10971 @@ -1415,6 +1418,14 @@ struct task_struct {
10975 +/* vserver context data */
10976 + struct vx_info *vx_info;
10977 + struct nx_info *nx_info;
10983 /* Thread group tracking */
10984 u32 parent_exec_id;
10986 @@ -1648,6 +1659,11 @@ struct pid_namespace;
10987 pid_t __task_pid_nr_ns(struct task_struct *task, enum pid_type type,
10988 struct pid_namespace *ns);
10990 +#include <linux/vserver/base.h>
10991 +#include <linux/vserver/context.h>
10992 +#include <linux/vserver/debug.h>
10993 +#include <linux/vserver/pid.h>
10995 static inline pid_t task_pid_nr(struct task_struct *tsk)
10998 @@ -1661,7 +1677,8 @@ static inline pid_t task_pid_nr_ns(struc
11000 static inline pid_t task_pid_vnr(struct task_struct *tsk)
11002 - return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
11003 + // return __task_pid_nr_ns(tsk, PIDTYPE_PID, NULL);
11004 + return vx_map_pid(__task_pid_nr_ns(tsk, PIDTYPE_PID, NULL));
11008 @@ -1674,7 +1691,7 @@ pid_t task_tgid_nr_ns(struct task_struct
11010 static inline pid_t task_tgid_vnr(struct task_struct *tsk)
11012 - return pid_vnr(task_tgid(tsk));
11013 + return vx_map_tgid(pid_vnr(task_tgid(tsk)));
11017 diff -NurpP --minimal linux-2.6.33.1/include/linux/shmem_fs.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/shmem_fs.h
11018 --- linux-2.6.33.1/include/linux/shmem_fs.h 2010-02-25 11:52:08.000000000 +0100
11019 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/shmem_fs.h 2010-02-25 12:02:16.000000000 +0100
11022 #define SHMEM_NR_DIRECT 16
11024 +#define TMPFS_SUPER_MAGIC 0x01021994
11027 struct shmem_inode_info {
11029 unsigned long flags;
11030 diff -NurpP --minimal linux-2.6.33.1/include/linux/stat.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/stat.h
11031 --- linux-2.6.33.1/include/linux/stat.h 2008-12-25 00:26:37.000000000 +0100
11032 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/stat.h 2010-02-25 12:02:16.000000000 +0100
11033 @@ -66,6 +66,7 @@ struct kstat {
11034 unsigned int nlink;
11040 struct timespec atime;
11041 diff -NurpP --minimal linux-2.6.33.1/include/linux/sunrpc/auth.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sunrpc/auth.h
11042 --- linux-2.6.33.1/include/linux/sunrpc/auth.h 2009-12-03 20:02:56.000000000 +0100
11043 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sunrpc/auth.h 2010-02-25 12:02:16.000000000 +0100
11049 struct group_info *group_info;
11050 unsigned char machine_cred : 1;
11052 diff -NurpP --minimal linux-2.6.33.1/include/linux/sunrpc/clnt.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sunrpc/clnt.h
11053 --- linux-2.6.33.1/include/linux/sunrpc/clnt.h 2009-12-03 20:02:56.000000000 +0100
11054 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sunrpc/clnt.h 2010-02-25 12:02:16.000000000 +0100
11055 @@ -49,7 +49,8 @@ struct rpc_clnt {
11056 unsigned int cl_softrtry : 1,/* soft timeouts */
11057 cl_discrtry : 1,/* disconnect before retry */
11058 cl_autobind : 1,/* use getport() */
11059 - cl_chatty : 1;/* be verbose */
11060 + cl_chatty : 1,/* be verbose */
11061 + cl_tag : 1;/* context tagging */
11063 struct rpc_rtt * cl_rtt; /* RTO estimator data */
11064 const struct rpc_timeout *cl_timeout; /* Timeout strategy */
11065 diff -NurpP --minimal linux-2.6.33.1/include/linux/syscalls.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/syscalls.h
11066 --- linux-2.6.33.1/include/linux/syscalls.h 2010-03-18 16:25:15.000000000 +0100
11067 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/syscalls.h 2010-03-18 16:54:29.000000000 +0100
11068 @@ -498,6 +498,8 @@ asmlinkage long sys_symlink(const char _
11069 asmlinkage long sys_unlink(const char __user *pathname);
11070 asmlinkage long sys_rename(const char __user *oldname,
11071 const char __user *newname);
11072 +asmlinkage long sys_copyfile(const char __user *from, const char __user *to,
11074 asmlinkage long sys_chmod(const char __user *filename, mode_t mode);
11075 asmlinkage long sys_fchmod(unsigned int fd, mode_t mode);
11077 diff -NurpP --minimal linux-2.6.33.1/include/linux/sysctl.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sysctl.h
11078 --- linux-2.6.33.1/include/linux/sysctl.h 2010-02-25 11:52:08.000000000 +0100
11079 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sysctl.h 2010-02-25 12:02:16.000000000 +0100
11080 @@ -60,6 +60,7 @@ enum
11081 CTL_ABI=9, /* Binary emulation */
11082 CTL_CPU=10, /* CPU stuff (speed scaling, etc) */
11083 CTL_ARLAN=254, /* arlan wireless driver */
11084 + CTL_VSERVER=4242, /* Linux-VServer debug */
11085 CTL_S390DBF=5677, /* s390 debug */
11086 CTL_SUNRPC=7249, /* sunrpc debug */
11087 CTL_PM=9899, /* frv power management */
11088 @@ -94,6 +95,7 @@ enum
11090 KERN_PANIC=15, /* int: panic timeout */
11091 KERN_REALROOTDEV=16, /* real root device to mount after initrd */
11092 + KERN_VSHELPER=17, /* string: path to vshelper policy agent */
11094 KERN_SPARC_REBOOT=21, /* reboot command on Sparc */
11095 KERN_CTLALTDEL=22, /* int: allow ctl-alt-del to reboot */
11096 diff -NurpP --minimal linux-2.6.33.1/include/linux/sysfs.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sysfs.h
11097 --- linux-2.6.33.1/include/linux/sysfs.h 2010-02-25 11:52:08.000000000 +0100
11098 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/sysfs.h 2010-02-25 12:02:16.000000000 +0100
11100 #include <linux/list.h>
11101 #include <asm/atomic.h>
11103 +#define SYSFS_SUPER_MAGIC 0x62656572
11108 diff -NurpP --minimal linux-2.6.33.1/include/linux/time.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/time.h
11109 --- linux-2.6.33.1/include/linux/time.h 2010-02-25 11:52:08.000000000 +0100
11110 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/time.h 2010-02-25 12:02:16.000000000 +0100
11111 @@ -238,6 +238,9 @@ static __always_inline void timespec_add
11112 a->tv_sec += __iter_div_u64_rem(a->tv_nsec + ns, NSEC_PER_SEC, &ns);
11116 +#include <linux/vs_time.h>
11118 #endif /* __KERNEL__ */
11120 #define NFDBITS __NFDBITS
11121 diff -NurpP --minimal linux-2.6.33.1/include/linux/types.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/types.h
11122 --- linux-2.6.33.1/include/linux/types.h 2009-09-10 15:26:26.000000000 +0200
11123 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/types.h 2010-02-25 12:02:16.000000000 +0100
11124 @@ -37,6 +37,9 @@ typedef __kernel_uid32_t uid_t;
11125 typedef __kernel_gid32_t gid_t;
11126 typedef __kernel_uid16_t uid16_t;
11127 typedef __kernel_gid16_t gid16_t;
11128 +typedef unsigned int xid_t;
11129 +typedef unsigned int nid_t;
11130 +typedef unsigned int tag_t;
11132 typedef unsigned long uintptr_t;
11134 diff -NurpP --minimal linux-2.6.33.1/include/linux/vroot.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vroot.h
11135 --- linux-2.6.33.1/include/linux/vroot.h 1970-01-01 01:00:00.000000000 +0100
11136 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vroot.h 2010-02-25 12:02:16.000000000 +0100
11140 + * include/linux/vroot.h
11142 + * written by Herbert Pötzl, 9/11/2002
11143 + * ported to 2.6 by Herbert Pötzl, 30/12/2004
11145 + * Copyright (C) 2002-2007 by Herbert Pötzl.
11146 + * Redistribution of this file is permitted under the
11147 + * GNU General Public License.
11150 +#ifndef _LINUX_VROOT_H
11151 +#define _LINUX_VROOT_H
11156 +/* Possible states of device */
11162 +struct vroot_device {
11166 + struct semaphore vr_ctl_mutex;
11167 + struct block_device *vr_device;
11172 +typedef struct block_device *(vroot_grb_func)(struct block_device *);
11174 +extern int register_vroot_grb(vroot_grb_func *);
11175 +extern int unregister_vroot_grb(vroot_grb_func *);
11177 +#endif /* __KERNEL__ */
11179 +#define MAX_VROOT_DEFAULT 8
11182 + * IOCTL commands --- we will commandeer 0x56 ('V')
11185 +#define VROOT_SET_DEV 0x5600
11186 +#define VROOT_CLR_DEV 0x5601
11188 +#endif /* _LINUX_VROOT_H */
11189 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_base.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_base.h
11190 --- linux-2.6.33.1/include/linux/vs_base.h 1970-01-01 01:00:00.000000000 +0100
11191 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_base.h 2010-02-25 12:02:16.000000000 +0100
11193 +#ifndef _VS_BASE_H
11194 +#define _VS_BASE_H
11196 +#include "vserver/base.h"
11197 +#include "vserver/check.h"
11198 +#include "vserver/debug.h"
11201 +#warning duplicate inclusion
11203 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_context.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_context.h
11204 --- linux-2.6.33.1/include/linux/vs_context.h 1970-01-01 01:00:00.000000000 +0100
11205 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_context.h 2010-02-25 12:02:16.000000000 +0100
11207 +#ifndef _VS_CONTEXT_H
11208 +#define _VS_CONTEXT_H
11210 +#include "vserver/base.h"
11211 +#include "vserver/check.h"
11212 +#include "vserver/context.h"
11213 +#include "vserver/history.h"
11214 +#include "vserver/debug.h"
11216 +#include <linux/sched.h>
11219 +#define get_vx_info(i) __get_vx_info(i, __FILE__, __LINE__, __HERE__)
11221 +static inline struct vx_info *__get_vx_info(struct vx_info *vxi,
11222 + const char *_file, int _line, void *_here)
11227 + vxlprintk(VXD_CBIT(xid, 2), "get_vx_info(%p[#%d.%d])",
11228 + vxi, vxi ? vxi->vx_id : 0,
11229 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11231 + __vxh_get_vx_info(vxi, _here);
11233 + atomic_inc(&vxi->vx_usecnt);
11238 +extern void free_vx_info(struct vx_info *);
11240 +#define put_vx_info(i) __put_vx_info(i, __FILE__, __LINE__, __HERE__)
11242 +static inline void __put_vx_info(struct vx_info *vxi,
11243 + const char *_file, int _line, void *_here)
11248 + vxlprintk(VXD_CBIT(xid, 2), "put_vx_info(%p[#%d.%d])",
11249 + vxi, vxi ? vxi->vx_id : 0,
11250 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11252 + __vxh_put_vx_info(vxi, _here);
11254 + if (atomic_dec_and_test(&vxi->vx_usecnt))
11255 + free_vx_info(vxi);
11259 +#define init_vx_info(p, i) \
11260 + __init_vx_info(p, i, __FILE__, __LINE__, __HERE__)
11262 +static inline void __init_vx_info(struct vx_info **vxp, struct vx_info *vxi,
11263 + const char *_file, int _line, void *_here)
11266 + vxlprintk(VXD_CBIT(xid, 3),
11267 + "init_vx_info(%p[#%d.%d])",
11268 + vxi, vxi ? vxi->vx_id : 0,
11269 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11271 + __vxh_init_vx_info(vxi, vxp, _here);
11273 + atomic_inc(&vxi->vx_usecnt);
11279 +#define set_vx_info(p, i) \
11280 + __set_vx_info(p, i, __FILE__, __LINE__, __HERE__)
11282 +static inline void __set_vx_info(struct vx_info **vxp, struct vx_info *vxi,
11283 + const char *_file, int _line, void *_here)
11285 + struct vx_info *vxo;
11290 + vxlprintk(VXD_CBIT(xid, 3), "set_vx_info(%p[#%d.%d])",
11291 + vxi, vxi ? vxi->vx_id : 0,
11292 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11294 + __vxh_set_vx_info(vxi, vxp, _here);
11296 + atomic_inc(&vxi->vx_usecnt);
11297 + vxo = xchg(vxp, vxi);
11302 +#define clr_vx_info(p) __clr_vx_info(p, __FILE__, __LINE__, __HERE__)
11304 +static inline void __clr_vx_info(struct vx_info **vxp,
11305 + const char *_file, int _line, void *_here)
11307 + struct vx_info *vxo;
11309 + vxo = xchg(vxp, NULL);
11313 + vxlprintk(VXD_CBIT(xid, 3), "clr_vx_info(%p[#%d.%d])",
11314 + vxo, vxo ? vxo->vx_id : 0,
11315 + vxo ? atomic_read(&vxo->vx_usecnt) : 0,
11317 + __vxh_clr_vx_info(vxo, vxp, _here);
11319 + if (atomic_dec_and_test(&vxo->vx_usecnt))
11320 + free_vx_info(vxo);
11324 +#define claim_vx_info(v, p) \
11325 + __claim_vx_info(v, p, __FILE__, __LINE__, __HERE__)
11327 +static inline void __claim_vx_info(struct vx_info *vxi,
11328 + struct task_struct *task,
11329 + const char *_file, int _line, void *_here)
11331 + vxlprintk(VXD_CBIT(xid, 3), "claim_vx_info(%p[#%d.%d.%d]) %p",
11332 + vxi, vxi ? vxi->vx_id : 0,
11333 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11334 + vxi ? atomic_read(&vxi->vx_tasks) : 0,
11335 + task, _file, _line);
11336 + __vxh_claim_vx_info(vxi, task, _here);
11338 + atomic_inc(&vxi->vx_tasks);
11342 +extern void unhash_vx_info(struct vx_info *);
11344 +#define release_vx_info(v, p) \
11345 + __release_vx_info(v, p, __FILE__, __LINE__, __HERE__)
11347 +static inline void __release_vx_info(struct vx_info *vxi,
11348 + struct task_struct *task,
11349 + const char *_file, int _line, void *_here)
11351 + vxlprintk(VXD_CBIT(xid, 3), "release_vx_info(%p[#%d.%d.%d]) %p",
11352 + vxi, vxi ? vxi->vx_id : 0,
11353 + vxi ? atomic_read(&vxi->vx_usecnt) : 0,
11354 + vxi ? atomic_read(&vxi->vx_tasks) : 0,
11355 + task, _file, _line);
11356 + __vxh_release_vx_info(vxi, task, _here);
11360 + if (atomic_dec_and_test(&vxi->vx_tasks))
11361 + unhash_vx_info(vxi);
11365 +#define task_get_vx_info(p) \
11366 + __task_get_vx_info(p, __FILE__, __LINE__, __HERE__)
11368 +static inline struct vx_info *__task_get_vx_info(struct task_struct *p,
11369 + const char *_file, int _line, void *_here)
11371 + struct vx_info *vxi;
11374 + vxlprintk(VXD_CBIT(xid, 5), "task_get_vx_info(%p)",
11375 + p, _file, _line);
11376 + vxi = __get_vx_info(p->vx_info, _file, _line, _here);
11382 +static inline void __wakeup_vx_info(struct vx_info *vxi)
11384 + if (waitqueue_active(&vxi->vx_wait))
11385 + wake_up_interruptible(&vxi->vx_wait);
11389 +#define enter_vx_info(v, s) __enter_vx_info(v, s, __FILE__, __LINE__)
11391 +static inline void __enter_vx_info(struct vx_info *vxi,
11392 + struct vx_info_save *vxis, const char *_file, int _line)
11394 + vxlprintk(VXD_CBIT(xid, 5), "enter_vx_info(%p[#%d],%p) %p[#%d,%p]",
11395 + vxi, vxi ? vxi->vx_id : 0, vxis, current,
11396 + current->xid, current->vx_info, _file, _line);
11397 + vxis->vxi = xchg(¤t->vx_info, vxi);
11398 + vxis->xid = current->xid;
11399 + current->xid = vxi ? vxi->vx_id : 0;
11402 +#define leave_vx_info(s) __leave_vx_info(s, __FILE__, __LINE__)
11404 +static inline void __leave_vx_info(struct vx_info_save *vxis,
11405 + const char *_file, int _line)
11407 + vxlprintk(VXD_CBIT(xid, 5), "leave_vx_info(%p[#%d,%p]) %p[#%d,%p]",
11408 + vxis, vxis->xid, vxis->vxi, current,
11409 + current->xid, current->vx_info, _file, _line);
11410 + (void)xchg(¤t->vx_info, vxis->vxi);
11411 + current->xid = vxis->xid;
11415 +static inline void __enter_vx_admin(struct vx_info_save *vxis)
11417 + vxis->vxi = xchg(¤t->vx_info, NULL);
11418 + vxis->xid = xchg(¤t->xid, (xid_t)0);
11421 +static inline void __leave_vx_admin(struct vx_info_save *vxis)
11423 + (void)xchg(¤t->xid, vxis->xid);
11424 + (void)xchg(¤t->vx_info, vxis->vxi);
11427 +#define task_is_init(p) \
11428 + __task_is_init(p, __FILE__, __LINE__, __HERE__)
11430 +static inline int __task_is_init(struct task_struct *p,
11431 + const char *_file, int _line, void *_here)
11433 + int is_init = is_global_init(p);
11437 + is_init = p->vx_info->vx_initpid == p->pid;
11442 +extern void exit_vx_info(struct task_struct *, int);
11443 +extern void exit_vx_info_early(struct task_struct *, int);
11447 +#warning duplicate inclusion
11449 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_cowbl.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_cowbl.h
11450 --- linux-2.6.33.1/include/linux/vs_cowbl.h 1970-01-01 01:00:00.000000000 +0100
11451 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_cowbl.h 2010-02-25 12:02:16.000000000 +0100
11453 +#ifndef _VS_COWBL_H
11454 +#define _VS_COWBL_H
11456 +#include <linux/fs.h>
11457 +#include <linux/dcache.h>
11458 +#include <linux/namei.h>
11460 +extern struct dentry *cow_break_link(const char *pathname);
11462 +static inline int cow_check_and_break(struct path *path)
11464 + struct inode *inode = path->dentry->d_inode;
11467 + /* do we need this check? */
11468 + if (IS_RDONLY(inode))
11471 + if (IS_COW(inode)) {
11472 + if (IS_COW_LINK(inode)) {
11473 + struct dentry *new_dentry, *old_dentry = path->dentry;
11476 + buf = kmalloc(PATH_MAX, GFP_KERNEL);
11480 + pp = d_path(path, buf, PATH_MAX);
11481 + new_dentry = cow_break_link(pp);
11483 + if (!IS_ERR(new_dentry)) {
11484 + path->dentry = new_dentry;
11485 + dput(old_dentry);
11487 + error = PTR_ERR(new_dentry);
11489 + inode->i_flags &= ~(S_IXUNLINK | S_IMMUTABLE);
11490 + inode->i_ctime = CURRENT_TIME;
11491 + mark_inode_dirty(inode);
11498 +#warning duplicate inclusion
11500 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_cvirt.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_cvirt.h
11501 --- linux-2.6.33.1/include/linux/vs_cvirt.h 1970-01-01 01:00:00.000000000 +0100
11502 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_cvirt.h 2010-02-25 12:02:16.000000000 +0100
11504 +#ifndef _VS_CVIRT_H
11505 +#define _VS_CVIRT_H
11507 +#include "vserver/cvirt.h"
11508 +#include "vserver/context.h"
11509 +#include "vserver/base.h"
11510 +#include "vserver/check.h"
11511 +#include "vserver/debug.h"
11514 +static inline void vx_activate_task(struct task_struct *p)
11516 + struct vx_info *vxi;
11518 + if ((vxi = p->vx_info)) {
11519 + vx_update_load(vxi);
11520 + atomic_inc(&vxi->cvirt.nr_running);
11524 +static inline void vx_deactivate_task(struct task_struct *p)
11526 + struct vx_info *vxi;
11528 + if ((vxi = p->vx_info)) {
11529 + vx_update_load(vxi);
11530 + atomic_dec(&vxi->cvirt.nr_running);
11534 +static inline void vx_uninterruptible_inc(struct task_struct *p)
11536 + struct vx_info *vxi;
11538 + if ((vxi = p->vx_info))
11539 + atomic_inc(&vxi->cvirt.nr_uninterruptible);
11542 +static inline void vx_uninterruptible_dec(struct task_struct *p)
11544 + struct vx_info *vxi;
11546 + if ((vxi = p->vx_info))
11547 + atomic_dec(&vxi->cvirt.nr_uninterruptible);
11552 +#warning duplicate inclusion
11554 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_device.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_device.h
11555 --- linux-2.6.33.1/include/linux/vs_device.h 1970-01-01 01:00:00.000000000 +0100
11556 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_device.h 2010-02-25 12:02:16.000000000 +0100
11558 +#ifndef _VS_DEVICE_H
11559 +#define _VS_DEVICE_H
11561 +#include "vserver/base.h"
11562 +#include "vserver/device.h"
11563 +#include "vserver/debug.h"
11566 +#ifdef CONFIG_VSERVER_DEVICE
11568 +int vs_map_device(struct vx_info *, dev_t, dev_t *, umode_t);
11570 +#define vs_device_perm(v, d, m, p) \
11571 + ((vs_map_device(current_vx_info(), d, NULL, m) & (p)) == (p))
11576 +int vs_map_device(struct vx_info *vxi,
11577 + dev_t device, dev_t *target, umode_t mode)
11580 + *target = device;
11584 +#define vs_device_perm(v, d, m, p) ((p) == (p))
11589 +#define vs_map_chrdev(d, t, p) \
11590 + ((vs_map_device(current_vx_info(), d, t, S_IFCHR) & (p)) == (p))
11591 +#define vs_map_blkdev(d, t, p) \
11592 + ((vs_map_device(current_vx_info(), d, t, S_IFBLK) & (p)) == (p))
11594 +#define vs_chrdev_perm(d, p) \
11595 + vs_device_perm(current_vx_info(), d, S_IFCHR, p)
11596 +#define vs_blkdev_perm(d, p) \
11597 + vs_device_perm(current_vx_info(), d, S_IFBLK, p)
11601 +#warning duplicate inclusion
11603 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_dlimit.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_dlimit.h
11604 --- linux-2.6.33.1/include/linux/vs_dlimit.h 1970-01-01 01:00:00.000000000 +0100
11605 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_dlimit.h 2010-03-21 06:38:55.000000000 +0100
11607 +#ifndef _VS_DLIMIT_H
11608 +#define _VS_DLIMIT_H
11610 +#include <linux/fs.h>
11612 +#include "vserver/dlimit.h"
11613 +#include "vserver/base.h"
11614 +#include "vserver/debug.h"
11617 +#define get_dl_info(i) __get_dl_info(i, __FILE__, __LINE__)
11619 +static inline struct dl_info *__get_dl_info(struct dl_info *dli,
11620 + const char *_file, int _line)
11624 + vxlprintk(VXD_CBIT(dlim, 4), "get_dl_info(%p[#%d.%d])",
11625 + dli, dli ? dli->dl_tag : 0,
11626 + dli ? atomic_read(&dli->dl_usecnt) : 0,
11628 + atomic_inc(&dli->dl_usecnt);
11633 +#define free_dl_info(i) \
11634 + call_rcu(&(i)->dl_rcu, rcu_free_dl_info)
11636 +#define put_dl_info(i) __put_dl_info(i, __FILE__, __LINE__)
11638 +static inline void __put_dl_info(struct dl_info *dli,
11639 + const char *_file, int _line)
11643 + vxlprintk(VXD_CBIT(dlim, 4), "put_dl_info(%p[#%d.%d])",
11644 + dli, dli ? dli->dl_tag : 0,
11645 + dli ? atomic_read(&dli->dl_usecnt) : 0,
11647 + if (atomic_dec_and_test(&dli->dl_usecnt))
11648 + free_dl_info(dli);
11652 +#define __dlimit_char(d) ((d) ? '*' : ' ')
11654 +static inline int __dl_alloc_space(struct super_block *sb,
11655 + tag_t tag, dlsize_t nr, const char *file, int line)
11657 + struct dl_info *dli = NULL;
11662 + dli = locate_dl_info(sb, tag);
11666 + spin_lock(&dli->dl_lock);
11667 + ret = (dli->dl_space_used + nr > dli->dl_space_total);
11669 + dli->dl_space_used += nr;
11670 + spin_unlock(&dli->dl_lock);
11671 + put_dl_info(dli);
11673 + vxlprintk(VXD_CBIT(dlim, 1),
11674 + "ALLOC (%p,#%d)%c %lld bytes (%d)",
11675 + sb, tag, __dlimit_char(dli), (long long)nr,
11676 + ret, file, line);
11680 +static inline void __dl_free_space(struct super_block *sb,
11681 + tag_t tag, dlsize_t nr, const char *_file, int _line)
11683 + struct dl_info *dli = NULL;
11687 + dli = locate_dl_info(sb, tag);
11691 + spin_lock(&dli->dl_lock);
11692 + if (dli->dl_space_used > nr)
11693 + dli->dl_space_used -= nr;
11695 + dli->dl_space_used = 0;
11696 + spin_unlock(&dli->dl_lock);
11697 + put_dl_info(dli);
11699 + vxlprintk(VXD_CBIT(dlim, 1),
11700 + "FREE (%p,#%d)%c %lld bytes",
11701 + sb, tag, __dlimit_char(dli), (long long)nr,
11705 +static inline int __dl_alloc_inode(struct super_block *sb,
11706 + tag_t tag, const char *_file, int _line)
11708 + struct dl_info *dli;
11711 + dli = locate_dl_info(sb, tag);
11715 + spin_lock(&dli->dl_lock);
11716 + dli->dl_inodes_used++;
11717 + ret = (dli->dl_inodes_used > dli->dl_inodes_total);
11718 + spin_unlock(&dli->dl_lock);
11719 + put_dl_info(dli);
11721 + vxlprintk(VXD_CBIT(dlim, 0),
11722 + "ALLOC (%p,#%d)%c inode (%d)",
11723 + sb, tag, __dlimit_char(dli), ret, _file, _line);
11727 +static inline void __dl_free_inode(struct super_block *sb,
11728 + tag_t tag, const char *_file, int _line)
11730 + struct dl_info *dli;
11732 + dli = locate_dl_info(sb, tag);
11736 + spin_lock(&dli->dl_lock);
11737 + if (dli->dl_inodes_used > 1)
11738 + dli->dl_inodes_used--;
11740 + dli->dl_inodes_used = 0;
11741 + spin_unlock(&dli->dl_lock);
11742 + put_dl_info(dli);
11744 + vxlprintk(VXD_CBIT(dlim, 0),
11745 + "FREE (%p,#%d)%c inode",
11746 + sb, tag, __dlimit_char(dli), _file, _line);
11749 +static inline void __dl_adjust_block(struct super_block *sb, tag_t tag,
11750 + unsigned long long *free_blocks, unsigned long long *root_blocks,
11751 + const char *_file, int _line)
11753 + struct dl_info *dli;
11754 + uint64_t broot, bfree;
11756 + dli = locate_dl_info(sb, tag);
11760 + spin_lock(&dli->dl_lock);
11761 + broot = (dli->dl_space_total -
11762 + (dli->dl_space_total >> 10) * dli->dl_nrlmult)
11763 + >> sb->s_blocksize_bits;
11764 + bfree = (dli->dl_space_total - dli->dl_space_used)
11765 + >> sb->s_blocksize_bits;
11766 + spin_unlock(&dli->dl_lock);
11768 + vxlprintk(VXD_CBIT(dlim, 2),
11769 + "ADJUST: %lld,%lld on %lld,%lld [mult=%d]",
11770 + (long long)bfree, (long long)broot,
11771 + *free_blocks, *root_blocks, dli->dl_nrlmult,
11773 + if (free_blocks) {
11774 + if (*free_blocks > bfree)
11775 + *free_blocks = bfree;
11777 + if (root_blocks) {
11778 + if (*root_blocks > broot)
11779 + *root_blocks = broot;
11781 + put_dl_info(dli);
11784 +#define dl_prealloc_space(in, bytes) \
11785 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11786 + __FILE__, __LINE__ )
11788 +#define dl_alloc_space(in, bytes) \
11789 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11790 + __FILE__, __LINE__ )
11792 +#define dl_reserve_space(in, bytes) \
11793 + __dl_alloc_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11794 + __FILE__, __LINE__ )
11796 +#define dl_claim_space(in, bytes) (0)
11798 +#define dl_release_space(in, bytes) \
11799 + __dl_free_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11800 + __FILE__, __LINE__ )
11802 +#define dl_free_space(in, bytes) \
11803 + __dl_free_space((in)->i_sb, (in)->i_tag, (dlsize_t)(bytes), \
11804 + __FILE__, __LINE__ )
11808 +#define dl_alloc_inode(in) \
11809 + __dl_alloc_inode((in)->i_sb, (in)->i_tag, __FILE__, __LINE__ )
11811 +#define dl_free_inode(in) \
11812 + __dl_free_inode((in)->i_sb, (in)->i_tag, __FILE__, __LINE__ )
11815 +#define dl_adjust_block(sb, tag, fb, rb) \
11816 + __dl_adjust_block(sb, tag, fb, rb, __FILE__, __LINE__ )
11820 +#warning duplicate inclusion
11822 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/base.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/base.h
11823 --- linux-2.6.33.1/include/linux/vserver/base.h 1970-01-01 01:00:00.000000000 +0100
11824 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/base.h 2010-02-25 12:02:16.000000000 +0100
11826 +#ifndef _VX_BASE_H
11827 +#define _VX_BASE_H
11830 +/* context state changes */
11842 +#define vx_task_xid(t) ((t)->xid)
11844 +#define vx_current_xid() vx_task_xid(current)
11846 +#define current_vx_info() (current->vx_info)
11849 +#define nx_task_nid(t) ((t)->nid)
11851 +#define nx_current_nid() nx_task_nid(current)
11853 +#define current_nx_info() (current->nx_info)
11856 +/* generic flag merging */
11858 +#define vs_check_flags(v, m, f) (((v) & (m)) ^ (f))
11860 +#define vs_mask_flags(v, f, m) (((v) & ~(m)) | ((f) & (m)))
11862 +#define vs_mask_mask(v, f, m) (((v) & ~(m)) | ((v) & (f) & (m)))
11864 +#define vs_check_bit(v, n) ((v) & (1LL << (n)))
11867 +/* context flags */
11869 +#define __vx_flags(v) ((v) ? (v)->vx_flags : 0)
11871 +#define vx_current_flags() __vx_flags(current_vx_info())
11873 +#define vx_info_flags(v, m, f) \
11874 + vs_check_flags(__vx_flags(v), m, f)
11876 +#define task_vx_flags(t, m, f) \
11877 + ((t) && vx_info_flags((t)->vx_info, m, f))
11879 +#define vx_flags(m, f) vx_info_flags(current_vx_info(), m, f)
11882 +/* context caps */
11884 +#define __vx_ccaps(v) ((v) ? (v)->vx_ccaps : 0)
11886 +#define vx_current_ccaps() __vx_ccaps(current_vx_info())
11888 +#define vx_info_ccaps(v, c) (__vx_ccaps(v) & (c))
11890 +#define vx_ccaps(c) vx_info_ccaps(current_vx_info(), (c))
11894 +/* network flags */
11896 +#define __nx_flags(n) ((n) ? (n)->nx_flags : 0)
11898 +#define nx_current_flags() __nx_flags(current_nx_info())
11900 +#define nx_info_flags(n, m, f) \
11901 + vs_check_flags(__nx_flags(n), m, f)
11903 +#define task_nx_flags(t, m, f) \
11904 + ((t) && nx_info_flags((t)->nx_info, m, f))
11906 +#define nx_flags(m, f) nx_info_flags(current_nx_info(), m, f)
11909 +/* network caps */
11911 +#define __nx_ncaps(n) ((n) ? (n)->nx_ncaps : 0)
11913 +#define nx_current_ncaps() __nx_ncaps(current_nx_info())
11915 +#define nx_info_ncaps(n, c) (__nx_ncaps(n) & (c))
11917 +#define nx_ncaps(c) nx_info_ncaps(current_nx_info(), c)
11920 +/* context mask capabilities */
11922 +#define __vx_mcaps(v) ((v) ? (v)->vx_ccaps >> 32UL : ~0 )
11924 +#define vx_info_mcaps(v, c) (__vx_mcaps(v) & (c))
11926 +#define vx_mcaps(c) vx_info_mcaps(current_vx_info(), c)
11929 +/* context bcap mask */
11931 +#define __vx_bcaps(v) ((v)->vx_bcaps)
11933 +#define vx_current_bcaps() __vx_bcaps(current_vx_info())
11936 +/* mask given bcaps */
11938 +#define vx_info_mbcaps(v, c) ((v) ? cap_intersect(__vx_bcaps(v), c) : c)
11940 +#define vx_mbcaps(c) vx_info_mbcaps(current_vx_info(), c)
11943 +/* masked cap_bset */
11945 +#define vx_info_cap_bset(v) vx_info_mbcaps(v, current->cap_bset)
11947 +#define vx_current_cap_bset() vx_info_cap_bset(current_vx_info())
11950 +#define vx_info_mbcap(v, b) \
11951 + (!vx_info_flags(v, VXF_STATE_SETUP, 0) ? \
11952 + vx_info_bcaps(v, b) : (b))
11954 +#define task_vx_mbcap(t, b) \
11955 + vx_info_mbcap((t)->vx_info, (t)->b)
11957 +#define vx_mbcap(b) task_vx_mbcap(current, b)
11960 +#define vx_cap_raised(v, c, f) cap_raised(vx_info_mbcaps(v, c), f)
11962 +#define vx_capable(b, c) (capable(b) || \
11963 + (cap_raised(current_cap(), b) && vx_ccaps(c)))
11965 +#define nx_capable(b, c) (capable(b) || \
11966 + (cap_raised(current_cap(), b) && nx_ncaps(c)))
11968 +#define vx_task_initpid(t, n) \
11969 + ((t)->vx_info && \
11970 + ((t)->vx_info->vx_initpid == (n)))
11972 +#define vx_current_initpid(n) vx_task_initpid(current, n)
11975 +/* context unshare mask */
11977 +#define __vx_umask(v) ((v)->vx_umask)
11979 +#define vx_current_umask() __vx_umask(current_vx_info())
11981 +#define vx_can_unshare(b, f) (capable(b) || \
11982 + (cap_raised(current_cap(), b) && \
11983 + !((f) & ~vx_current_umask())))
11986 +#define __vx_state(v) ((v) ? ((v)->vx_state) : 0)
11988 +#define vx_info_state(v, m) (__vx_state(v) & (m))
11991 +#define __nx_state(n) ((n) ? ((n)->nx_state) : 0)
11993 +#define nx_info_state(n, m) (__nx_state(n) & (m))
11996 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/cacct_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cacct_cmd.h
11997 --- linux-2.6.33.1/include/linux/vserver/cacct_cmd.h 1970-01-01 01:00:00.000000000 +0100
11998 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cacct_cmd.h 2010-02-25 12:02:16.000000000 +0100
12000 +#ifndef _VX_CACCT_CMD_H
12001 +#define _VX_CACCT_CMD_H
12004 +/* virtual host info name commands */
12006 +#define VCMD_sock_stat VC_CMD(VSTAT, 5, 0)
12008 +struct vcmd_sock_stat_v0 {
12010 + uint32_t count[3];
12011 + uint64_t total[3];
12017 +#include <linux/compiler.h>
12019 +extern int vc_sock_stat(struct vx_info *, void __user *);
12021 +#endif /* __KERNEL__ */
12022 +#endif /* _VX_CACCT_CMD_H */
12023 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/cacct_def.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cacct_def.h
12024 --- linux-2.6.33.1/include/linux/vserver/cacct_def.h 1970-01-01 01:00:00.000000000 +0100
12025 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cacct_def.h 2010-02-25 12:02:16.000000000 +0100
12027 +#ifndef _VX_CACCT_DEF_H
12028 +#define _VX_CACCT_DEF_H
12030 +#include <asm/atomic.h>
12031 +#include <linux/vserver/cacct.h>
12034 +struct _vx_sock_acc {
12035 + atomic_long_t count;
12036 + atomic_long_t total;
12039 +/* context sub struct */
12041 +struct _vx_cacct {
12042 + struct _vx_sock_acc sock[VXA_SOCK_SIZE][3];
12043 + atomic_t slab[8];
12044 + atomic_t page[6][8];
12047 +#ifdef CONFIG_VSERVER_DEBUG
12049 +static inline void __dump_vx_cacct(struct _vx_cacct *cacct)
12053 + printk("\t_vx_cacct:");
12054 + for (i = 0; i < 6; i++) {
12055 + struct _vx_sock_acc *ptr = cacct->sock[i];
12057 + printk("\t [%d] =", i);
12058 + for (j = 0; j < 3; j++) {
12059 + printk(" [%d] = %8lu, %8lu", j,
12060 + atomic_long_read(&ptr[j].count),
12061 + atomic_long_read(&ptr[j].total));
12069 +#endif /* _VX_CACCT_DEF_H */
12070 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/cacct.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cacct.h
12071 --- linux-2.6.33.1/include/linux/vserver/cacct.h 1970-01-01 01:00:00.000000000 +0100
12072 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cacct.h 2010-02-25 12:02:16.000000000 +0100
12074 +#ifndef _VX_CACCT_H
12075 +#define _VX_CACCT_H
12078 +enum sock_acc_field {
12079 + VXA_SOCK_UNSPEC = 0,
12085 + VXA_SOCK_SIZE /* array size */
12088 +#endif /* _VX_CACCT_H */
12089 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/cacct_int.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cacct_int.h
12090 --- linux-2.6.33.1/include/linux/vserver/cacct_int.h 1970-01-01 01:00:00.000000000 +0100
12091 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cacct_int.h 2010-02-25 12:02:16.000000000 +0100
12093 +#ifndef _VX_CACCT_INT_H
12094 +#define _VX_CACCT_INT_H
12100 +unsigned long vx_sock_count(struct _vx_cacct *cacct, int type, int pos)
12102 + return atomic_long_read(&cacct->sock[type][pos].count);
12107 +unsigned long vx_sock_total(struct _vx_cacct *cacct, int type, int pos)
12109 + return atomic_long_read(&cacct->sock[type][pos].total);
12112 +#endif /* __KERNEL__ */
12113 +#endif /* _VX_CACCT_INT_H */
12114 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/check.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/check.h
12115 --- linux-2.6.33.1/include/linux/vserver/check.h 1970-01-01 01:00:00.000000000 +0100
12116 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/check.h 2010-02-25 12:02:16.000000000 +0100
12118 +#ifndef _VS_CHECK_H
12119 +#define _VS_CHECK_H
12122 +#define MAX_S_CONTEXT 65535 /* Arbitrary limit */
12124 +#ifdef CONFIG_VSERVER_DYNAMIC_IDS
12125 +#define MIN_D_CONTEXT 49152 /* dynamic contexts start here */
12127 +#define MIN_D_CONTEXT 65536
12130 +/* check conditions */
12132 +#define VS_ADMIN 0x0001
12133 +#define VS_WATCH 0x0002
12134 +#define VS_HIDE 0x0004
12135 +#define VS_HOSTID 0x0008
12137 +#define VS_IDENT 0x0010
12138 +#define VS_EQUIV 0x0020
12139 +#define VS_PARENT 0x0040
12140 +#define VS_CHILD 0x0080
12142 +#define VS_ARG_MASK 0x00F0
12144 +#define VS_DYNAMIC 0x0100
12145 +#define VS_STATIC 0x0200
12147 +#define VS_ATR_MASK 0x0F00
12149 +#ifdef CONFIG_VSERVER_PRIVACY
12150 +#define VS_ADMIN_P (0)
12151 +#define VS_WATCH_P (0)
12153 +#define VS_ADMIN_P VS_ADMIN
12154 +#define VS_WATCH_P VS_WATCH
12157 +#define VS_HARDIRQ 0x1000
12158 +#define VS_SOFTIRQ 0x2000
12159 +#define VS_IRQ 0x4000
12161 +#define VS_IRQ_MASK 0xF000
12163 +#include <linux/hardirq.h>
12166 + * check current context for ADMIN/WATCH and
12167 + * optionally against supplied argument
12169 +static inline int __vs_check(int cid, int id, unsigned int mode)
12171 + if (mode & VS_ARG_MASK) {
12172 + if ((mode & VS_IDENT) && (id == cid))
12175 + if (mode & VS_ATR_MASK) {
12176 + if ((mode & VS_DYNAMIC) &&
12177 + (id >= MIN_D_CONTEXT) &&
12178 + (id <= MAX_S_CONTEXT))
12180 + if ((mode & VS_STATIC) &&
12181 + (id > 1) && (id < MIN_D_CONTEXT))
12184 + if (mode & VS_IRQ_MASK) {
12185 + if ((mode & VS_IRQ) && unlikely(in_interrupt()))
12187 + if ((mode & VS_HARDIRQ) && unlikely(in_irq()))
12189 + if ((mode & VS_SOFTIRQ) && unlikely(in_softirq()))
12192 + return (((mode & VS_ADMIN) && (cid == 0)) ||
12193 + ((mode & VS_WATCH) && (cid == 1)) ||
12194 + ((mode & VS_HOSTID) && (id == 0)));
12197 +#define vx_check(c, m) __vs_check(vx_current_xid(), c, (m) | VS_IRQ)
12199 +#define vx_weak_check(c, m) ((m) ? vx_check(c, m) : 1)
12202 +#define nx_check(c, m) __vs_check(nx_current_nid(), c, m)
12204 +#define nx_weak_check(c, m) ((m) ? nx_check(c, m) : 1)
12207 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/context_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/context_cmd.h
12208 --- linux-2.6.33.1/include/linux/vserver/context_cmd.h 1970-01-01 01:00:00.000000000 +0100
12209 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/context_cmd.h 2010-02-25 12:02:16.000000000 +0100
12211 +#ifndef _VX_CONTEXT_CMD_H
12212 +#define _VX_CONTEXT_CMD_H
12215 +/* vinfo commands */
12217 +#define VCMD_task_xid VC_CMD(VINFO, 1, 0)
12220 +extern int vc_task_xid(uint32_t);
12222 +#endif /* __KERNEL__ */
12224 +#define VCMD_vx_info VC_CMD(VINFO, 5, 0)
12226 +struct vcmd_vx_info_v0 {
12228 + uint32_t initpid;
12229 + /* more to come */
12233 +extern int vc_vx_info(struct vx_info *, void __user *);
12235 +#endif /* __KERNEL__ */
12237 +#define VCMD_ctx_stat VC_CMD(VSTAT, 0, 0)
12239 +struct vcmd_ctx_stat_v0 {
12242 + /* more to come */
12246 +extern int vc_ctx_stat(struct vx_info *, void __user *);
12248 +#endif /* __KERNEL__ */
12250 +/* context commands */
12252 +#define VCMD_ctx_create_v0 VC_CMD(VPROC, 1, 0)
12253 +#define VCMD_ctx_create VC_CMD(VPROC, 1, 1)
12255 +struct vcmd_ctx_create {
12256 + uint64_t flagword;
12259 +#define VCMD_ctx_migrate_v0 VC_CMD(PROCMIG, 1, 0)
12260 +#define VCMD_ctx_migrate VC_CMD(PROCMIG, 1, 1)
12262 +struct vcmd_ctx_migrate {
12263 + uint64_t flagword;
12267 +extern int vc_ctx_create(uint32_t, void __user *);
12268 +extern int vc_ctx_migrate(struct vx_info *, void __user *);
12270 +#endif /* __KERNEL__ */
12273 +/* flag commands */
12275 +#define VCMD_get_cflags VC_CMD(FLAGS, 1, 0)
12276 +#define VCMD_set_cflags VC_CMD(FLAGS, 2, 0)
12278 +struct vcmd_ctx_flags_v0 {
12279 + uint64_t flagword;
12284 +extern int vc_get_cflags(struct vx_info *, void __user *);
12285 +extern int vc_set_cflags(struct vx_info *, void __user *);
12287 +#endif /* __KERNEL__ */
12290 +/* context caps commands */
12292 +#define VCMD_get_ccaps VC_CMD(FLAGS, 3, 1)
12293 +#define VCMD_set_ccaps VC_CMD(FLAGS, 4, 1)
12295 +struct vcmd_ctx_caps_v1 {
12301 +extern int vc_get_ccaps(struct vx_info *, void __user *);
12302 +extern int vc_set_ccaps(struct vx_info *, void __user *);
12304 +#endif /* __KERNEL__ */
12307 +/* bcaps commands */
12309 +#define VCMD_get_bcaps VC_CMD(FLAGS, 9, 0)
12310 +#define VCMD_set_bcaps VC_CMD(FLAGS, 10, 0)
12312 +struct vcmd_bcaps {
12318 +extern int vc_get_bcaps(struct vx_info *, void __user *);
12319 +extern int vc_set_bcaps(struct vx_info *, void __user *);
12321 +#endif /* __KERNEL__ */
12324 +/* umask commands */
12326 +#define VCMD_get_umask VC_CMD(FLAGS, 13, 0)
12327 +#define VCMD_set_umask VC_CMD(FLAGS, 14, 0)
12329 +struct vcmd_umask {
12335 +extern int vc_get_umask(struct vx_info *, void __user *);
12336 +extern int vc_set_umask(struct vx_info *, void __user *);
12338 +#endif /* __KERNEL__ */
12343 +#define VCMD_get_badness VC_CMD(MEMCTRL, 5, 0)
12344 +#define VCMD_set_badness VC_CMD(MEMCTRL, 6, 0)
12346 +struct vcmd_badness_v0 {
12351 +extern int vc_get_badness(struct vx_info *, void __user *);
12352 +extern int vc_set_badness(struct vx_info *, void __user *);
12354 +#endif /* __KERNEL__ */
12355 +#endif /* _VX_CONTEXT_CMD_H */
12356 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/context.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/context.h
12357 --- linux-2.6.33.1/include/linux/vserver/context.h 1970-01-01 01:00:00.000000000 +0100
12358 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/context.h 2010-03-05 19:53:00.000000000 +0100
12360 +#ifndef _VX_CONTEXT_H
12361 +#define _VX_CONTEXT_H
12363 +#include <linux/types.h>
12364 +#include <linux/capability.h>
12367 +/* context flags */
12369 +#define VXF_INFO_SCHED 0x00000002
12370 +#define VXF_INFO_NPROC 0x00000004
12371 +#define VXF_INFO_PRIVATE 0x00000008
12373 +#define VXF_INFO_INIT 0x00000010
12374 +#define VXF_INFO_HIDE 0x00000020
12375 +#define VXF_INFO_ULIMIT 0x00000040
12376 +#define VXF_INFO_NSPACE 0x00000080
12378 +#define VXF_SCHED_HARD 0x00000100
12379 +#define VXF_SCHED_PRIO 0x00000200
12380 +#define VXF_SCHED_PAUSE 0x00000400
12382 +#define VXF_VIRT_MEM 0x00010000
12383 +#define VXF_VIRT_UPTIME 0x00020000
12384 +#define VXF_VIRT_CPU 0x00040000
12385 +#define VXF_VIRT_LOAD 0x00080000
12386 +#define VXF_VIRT_TIME 0x00100000
12388 +#define VXF_HIDE_MOUNT 0x01000000
12389 +/* was VXF_HIDE_NETIF 0x02000000 */
12390 +#define VXF_HIDE_VINFO 0x04000000
12392 +#define VXF_STATE_SETUP (1ULL << 32)
12393 +#define VXF_STATE_INIT (1ULL << 33)
12394 +#define VXF_STATE_ADMIN (1ULL << 34)
12396 +#define VXF_SC_HELPER (1ULL << 36)
12397 +#define VXF_REBOOT_KILL (1ULL << 37)
12398 +#define VXF_PERSISTENT (1ULL << 38)
12400 +#define VXF_FORK_RSS (1ULL << 48)
12401 +#define VXF_PROLIFIC (1ULL << 49)
12403 +#define VXF_IGNEG_NICE (1ULL << 52)
12405 +#define VXF_ONE_TIME (0x0007ULL << 32)
12407 +#define VXF_INIT_SET (VXF_STATE_SETUP | VXF_STATE_INIT | VXF_STATE_ADMIN)
12410 +/* context migration */
12412 +#define VXM_SET_INIT 0x00000001
12413 +#define VXM_SET_REAPER 0x00000002
12415 +/* context caps */
12417 +#define VXC_CAP_MASK 0x00000000
12419 +#define VXC_SET_UTSNAME 0x00000001
12420 +#define VXC_SET_RLIMIT 0x00000002
12421 +#define VXC_FS_SECURITY 0x00000004
12422 +#define VXC_FS_TRUSTED 0x00000008
12423 +#define VXC_TIOCSTI 0x00000010
12425 +/* was VXC_RAW_ICMP 0x00000100 */
12426 +#define VXC_SYSLOG 0x00001000
12427 +#define VXC_OOM_ADJUST 0x00002000
12428 +#define VXC_AUDIT_CONTROL 0x00004000
12430 +#define VXC_SECURE_MOUNT 0x00010000
12431 +#define VXC_SECURE_REMOUNT 0x00020000
12432 +#define VXC_BINARY_MOUNT 0x00040000
12434 +#define VXC_QUOTA_CTL 0x00100000
12435 +#define VXC_ADMIN_MAPPER 0x00200000
12436 +#define VXC_ADMIN_CLOOP 0x00400000
12438 +#define VXC_KTHREAD 0x01000000
12439 +#define VXC_NAMESPACE 0x02000000
12444 +#include <linux/list.h>
12445 +#include <linux/spinlock.h>
12446 +#include <linux/rcupdate.h>
12448 +#include "limit_def.h"
12449 +#include "sched_def.h"
12450 +#include "cvirt_def.h"
12451 +#include "cacct_def.h"
12452 +#include "device_def.h"
12454 +#define VX_SPACES 2
12456 +struct _vx_info_pc {
12457 + struct _vx_sched_pc sched_pc;
12458 + struct _vx_cvirt_pc cvirt_pc;
12462 + struct hlist_node vx_hlist; /* linked list of contexts */
12463 + xid_t vx_id; /* context id */
12464 + atomic_t vx_usecnt; /* usage count */
12465 + atomic_t vx_tasks; /* tasks count */
12466 + struct vx_info *vx_parent; /* parent context */
12467 + int vx_state; /* context state */
12469 + unsigned long vx_nsmask[VX_SPACES]; /* assignment mask */
12470 + struct nsproxy *vx_nsproxy[VX_SPACES]; /* private namespaces */
12471 + struct fs_struct *vx_fs[VX_SPACES]; /* private namespace fs */
12473 + uint64_t vx_flags; /* context flags */
12474 + uint64_t vx_ccaps; /* context caps (vserver) */
12475 + kernel_cap_t vx_bcaps; /* bounding caps (system) */
12476 + unsigned long vx_umask; /* unshare mask (guest) */
12478 + struct task_struct *vx_reaper; /* guest reaper process */
12479 + pid_t vx_initpid; /* PID of guest init */
12480 + int64_t vx_badness_bias; /* OOM points bias */
12482 + struct _vx_limit limit; /* vserver limits */
12483 + struct _vx_sched sched; /* vserver scheduler */
12484 + struct _vx_cvirt cvirt; /* virtual/bias stuff */
12485 + struct _vx_cacct cacct; /* context accounting */
12487 + struct _vx_device dmap; /* default device map targets */
12489 +#ifndef CONFIG_SMP
12490 + struct _vx_info_pc info_pc; /* per cpu data */
12492 + struct _vx_info_pc *ptr_pc; /* per cpu array */
12495 + wait_queue_head_t vx_wait; /* context exit waitqueue */
12496 + int reboot_cmd; /* last sys_reboot() cmd */
12497 + int exit_code; /* last process exit code */
12499 + char vx_name[65]; /* vserver name */
12502 +#ifndef CONFIG_SMP
12503 +#define vx_ptr_pc(vxi) (&(vxi)->info_pc)
12504 +#define vx_per_cpu(vxi, v, id) vx_ptr_pc(vxi)->v
12506 +#define vx_ptr_pc(vxi) ((vxi)->ptr_pc)
12507 +#define vx_per_cpu(vxi, v, id) per_cpu_ptr(vx_ptr_pc(vxi), id)->v
12510 +#define vx_cpu(vxi, v) vx_per_cpu(vxi, v, smp_processor_id())
12513 +struct vx_info_save {
12514 + struct vx_info *vxi;
12519 +/* status flags */
12521 +#define VXS_HASHED 0x0001
12522 +#define VXS_PAUSED 0x0010
12523 +#define VXS_SHUTDOWN 0x0100
12524 +#define VXS_HELPER 0x1000
12525 +#define VXS_RELEASED 0x8000
12528 +extern void claim_vx_info(struct vx_info *, struct task_struct *);
12529 +extern void release_vx_info(struct vx_info *, struct task_struct *);
12531 +extern struct vx_info *lookup_vx_info(int);
12532 +extern struct vx_info *lookup_or_create_vx_info(int);
12534 +extern int get_xid_list(int, unsigned int *, int);
12535 +extern int xid_is_hashed(xid_t);
12537 +extern int vx_migrate_task(struct task_struct *, struct vx_info *, int);
12539 +extern long vs_state_change(struct vx_info *, unsigned int);
12542 +#endif /* __KERNEL__ */
12543 +#endif /* _VX_CONTEXT_H */
12544 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/cvirt_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cvirt_cmd.h
12545 --- linux-2.6.33.1/include/linux/vserver/cvirt_cmd.h 1970-01-01 01:00:00.000000000 +0100
12546 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cvirt_cmd.h 2010-02-25 12:02:16.000000000 +0100
12548 +#ifndef _VX_CVIRT_CMD_H
12549 +#define _VX_CVIRT_CMD_H
12552 +/* virtual host info name commands */
12554 +#define VCMD_set_vhi_name VC_CMD(VHOST, 1, 0)
12555 +#define VCMD_get_vhi_name VC_CMD(VHOST, 2, 0)
12557 +struct vcmd_vhi_name_v0 {
12563 +enum vhi_name_field {
12564 + VHIN_CONTEXT = 0,
12576 +#include <linux/compiler.h>
12578 +extern int vc_set_vhi_name(struct vx_info *, void __user *);
12579 +extern int vc_get_vhi_name(struct vx_info *, void __user *);
12581 +#endif /* __KERNEL__ */
12583 +#define VCMD_virt_stat VC_CMD(VSTAT, 3, 0)
12585 +struct vcmd_virt_stat_v0 {
12588 + uint32_t nr_threads;
12589 + uint32_t nr_running;
12590 + uint32_t nr_uninterruptible;
12591 + uint32_t nr_onhold;
12592 + uint32_t nr_forks;
12593 + uint32_t load[3];
12597 +extern int vc_virt_stat(struct vx_info *, void __user *);
12599 +#endif /* __KERNEL__ */
12600 +#endif /* _VX_CVIRT_CMD_H */
12601 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/cvirt_def.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cvirt_def.h
12602 --- linux-2.6.33.1/include/linux/vserver/cvirt_def.h 1970-01-01 01:00:00.000000000 +0100
12603 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cvirt_def.h 2010-02-25 12:02:16.000000000 +0100
12605 +#ifndef _VX_CVIRT_DEF_H
12606 +#define _VX_CVIRT_DEF_H
12608 +#include <linux/jiffies.h>
12609 +#include <linux/spinlock.h>
12610 +#include <linux/wait.h>
12611 +#include <linux/time.h>
12612 +#include <asm/atomic.h>
12615 +struct _vx_usage_stat {
12619 + uint64_t softirq;
12625 +struct _vx_syslog {
12626 + wait_queue_head_t log_wait;
12627 + spinlock_t logbuf_lock; /* lock for the log buffer */
12629 + unsigned long log_start; /* next char to be read by syslog() */
12630 + unsigned long con_start; /* next char to be sent to consoles */
12631 + unsigned long log_end; /* most-recently-written-char + 1 */
12632 + unsigned long logged_chars; /* #chars since last read+clear operation */
12634 + char log_buf[1024];
12638 +/* context sub struct */
12640 +struct _vx_cvirt {
12641 + atomic_t nr_threads; /* number of current threads */
12642 + atomic_t nr_running; /* number of running threads */
12643 + atomic_t nr_uninterruptible; /* number of uninterruptible threads */
12645 + atomic_t nr_onhold; /* processes on hold */
12646 + uint32_t onhold_last; /* jiffies when put on hold */
12648 + struct timeval bias_tv; /* time offset to the host */
12649 + struct timespec bias_idle;
12650 + struct timespec bias_uptime; /* context creation point */
12651 + uint64_t bias_clock; /* offset in clock_t */
12653 + spinlock_t load_lock; /* lock for the load averages */
12654 + atomic_t load_updates; /* nr of load updates done so far */
12655 + uint32_t load_last; /* last time load was calculated */
12656 + uint32_t load[3]; /* load averages 1,5,15 */
12658 + atomic_t total_forks; /* number of forks so far */
12660 + struct _vx_syslog syslog;
12663 +struct _vx_cvirt_pc {
12664 + struct _vx_usage_stat cpustat;
12668 +#ifdef CONFIG_VSERVER_DEBUG
12670 +static inline void __dump_vx_cvirt(struct _vx_cvirt *cvirt)
12672 + printk("\t_vx_cvirt:\n");
12673 + printk("\t threads: %4d, %4d, %4d, %4d\n",
12674 + atomic_read(&cvirt->nr_threads),
12675 + atomic_read(&cvirt->nr_running),
12676 + atomic_read(&cvirt->nr_uninterruptible),
12677 + atomic_read(&cvirt->nr_onhold));
12678 + /* add rest here */
12679 + printk("\t total_forks = %d\n", atomic_read(&cvirt->total_forks));
12684 +#endif /* _VX_CVIRT_DEF_H */
12685 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/cvirt.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cvirt.h
12686 --- linux-2.6.33.1/include/linux/vserver/cvirt.h 1970-01-01 01:00:00.000000000 +0100
12687 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/cvirt.h 2010-02-25 12:02:16.000000000 +0100
12689 +#ifndef _VX_CVIRT_H
12690 +#define _VX_CVIRT_H
12697 +void vx_vsi_uptime(struct timespec *, struct timespec *);
12702 +void vx_update_load(struct vx_info *);
12705 +int vx_do_syslog(int, char __user *, int);
12707 +#endif /* __KERNEL__ */
12708 +#endif /* _VX_CVIRT_H */
12709 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/debug_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/debug_cmd.h
12710 --- linux-2.6.33.1/include/linux/vserver/debug_cmd.h 1970-01-01 01:00:00.000000000 +0100
12711 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/debug_cmd.h 2010-02-25 12:02:16.000000000 +0100
12713 +#ifndef _VX_DEBUG_CMD_H
12714 +#define _VX_DEBUG_CMD_H
12717 +/* debug commands */
12719 +#define VCMD_dump_history VC_CMD(DEBUG, 1, 0)
12721 +#define VCMD_read_history VC_CMD(DEBUG, 5, 0)
12722 +#define VCMD_read_monitor VC_CMD(DEBUG, 6, 0)
12724 +struct vcmd_read_history_v0 {
12727 + char __user *data;
12730 +struct vcmd_read_monitor_v0 {
12733 + char __user *data;
12739 +#ifdef CONFIG_COMPAT
12741 +#include <asm/compat.h>
12743 +struct vcmd_read_history_v0_x32 {
12746 + compat_uptr_t data_ptr;
12749 +struct vcmd_read_monitor_v0_x32 {
12752 + compat_uptr_t data_ptr;
12755 +#endif /* CONFIG_COMPAT */
12757 +extern int vc_dump_history(uint32_t);
12759 +extern int vc_read_history(uint32_t, void __user *);
12760 +extern int vc_read_monitor(uint32_t, void __user *);
12762 +#ifdef CONFIG_COMPAT
12764 +extern int vc_read_history_x32(uint32_t, void __user *);
12765 +extern int vc_read_monitor_x32(uint32_t, void __user *);
12767 +#endif /* CONFIG_COMPAT */
12769 +#endif /* __KERNEL__ */
12770 +#endif /* _VX_DEBUG_CMD_H */
12771 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/debug.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/debug.h
12772 --- linux-2.6.33.1/include/linux/vserver/debug.h 1970-01-01 01:00:00.000000000 +0100
12773 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/debug.h 2010-02-25 12:02:16.000000000 +0100
12775 +#ifndef _VX_DEBUG_H
12776 +#define _VX_DEBUG_H
12779 +#define VXD_CBIT(n, m) (vx_debug_ ## n & (1 << (m)))
12780 +#define VXD_CMIN(n, m) (vx_debug_ ## n > (m))
12781 +#define VXD_MASK(n, m) (vx_debug_ ## n & (m))
12783 +#define VXD_DEV(d) (d), (d)->bd_inode->i_ino, \
12784 + imajor((d)->bd_inode), iminor((d)->bd_inode)
12785 +#define VXF_DEV "%p[%lu,%d:%d]"
12788 +#define vxd_path(p) \
12789 + ({ static char _buffer[PATH_MAX]; \
12790 + d_path(p, _buffer, sizeof(_buffer)); })
12792 +#define vxd_cond_path(n) \
12793 + ((n) ? vxd_path(&(n)->path) : "<null>" )
12796 +#ifdef CONFIG_VSERVER_DEBUG
12798 +extern unsigned int vx_debug_switch;
12799 +extern unsigned int vx_debug_xid;
12800 +extern unsigned int vx_debug_nid;
12801 +extern unsigned int vx_debug_tag;
12802 +extern unsigned int vx_debug_net;
12803 +extern unsigned int vx_debug_limit;
12804 +extern unsigned int vx_debug_cres;
12805 +extern unsigned int vx_debug_dlim;
12806 +extern unsigned int vx_debug_quota;
12807 +extern unsigned int vx_debug_cvirt;
12808 +extern unsigned int vx_debug_space;
12809 +extern unsigned int vx_debug_misc;
12812 +#define VX_LOGLEVEL "vxD: "
12813 +#define VX_PROC_FMT "%p: "
12814 +#define VX_PROCESS current
12816 +#define vxdprintk(c, f, x...) \
12819 + printk(VX_LOGLEVEL VX_PROC_FMT f "\n", \
12820 + VX_PROCESS , ##x); \
12823 +#define vxlprintk(c, f, x...) \
12826 + printk(VX_LOGLEVEL f " @%s:%d\n", x); \
12829 +#define vxfprintk(c, f, x...) \
12832 + printk(VX_LOGLEVEL f " %s@%s:%d\n", x); \
12838 +void dump_vx_info(struct vx_info *, int);
12839 +void dump_vx_info_inactive(int);
12841 +#else /* CONFIG_VSERVER_DEBUG */
12843 +#define vx_debug_switch 0
12844 +#define vx_debug_xid 0
12845 +#define vx_debug_nid 0
12846 +#define vx_debug_tag 0
12847 +#define vx_debug_net 0
12848 +#define vx_debug_limit 0
12849 +#define vx_debug_cres 0
12850 +#define vx_debug_dlim 0
12851 +#define vx_debug_cvirt 0
12853 +#define vxdprintk(x...) do { } while (0)
12854 +#define vxlprintk(x...) do { } while (0)
12855 +#define vxfprintk(x...) do { } while (0)
12857 +#endif /* CONFIG_VSERVER_DEBUG */
12860 +#ifdef CONFIG_VSERVER_WARN
12862 +#define VX_WARNLEVEL KERN_WARNING "vxW: "
12863 +#define VX_WARN_TASK "[»%s«,%u:#%u|%u|%u] "
12864 +#define VX_WARN_XID "[xid #%u] "
12865 +#define VX_WARN_NID "[nid #%u] "
12866 +#define VX_WARN_TAG "[tag #%u] "
12868 +#define vxwprintk(c, f, x...) \
12871 + printk(VX_WARNLEVEL f "\n", ##x); \
12874 +#else /* CONFIG_VSERVER_WARN */
12876 +#define vxwprintk(x...) do { } while (0)
12878 +#endif /* CONFIG_VSERVER_WARN */
12880 +#define vxwprintk_task(c, f, x...) \
12881 + vxwprintk(c, VX_WARN_TASK f, \
12882 + current->comm, current->pid, \
12883 + current->xid, current->nid, current->tag, ##x)
12884 +#define vxwprintk_xid(c, f, x...) \
12885 + vxwprintk(c, VX_WARN_XID f, current->xid, x)
12886 +#define vxwprintk_nid(c, f, x...) \
12887 + vxwprintk(c, VX_WARN_NID f, current->nid, x)
12888 +#define vxwprintk_tag(c, f, x...) \
12889 + vxwprintk(c, VX_WARN_TAG f, current->tag, x)
12891 +#ifdef CONFIG_VSERVER_DEBUG
12892 +#define vxd_assert_lock(l) assert_spin_locked(l)
12893 +#define vxd_assert(c, f, x...) vxlprintk(!(c), \
12894 + "assertion [" f "] failed.", ##x, __FILE__, __LINE__)
12896 +#define vxd_assert_lock(l) do { } while (0)
12897 +#define vxd_assert(c, f, x...) do { } while (0)
12901 +#endif /* _VX_DEBUG_H */
12902 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/device_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/device_cmd.h
12903 --- linux-2.6.33.1/include/linux/vserver/device_cmd.h 1970-01-01 01:00:00.000000000 +0100
12904 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/device_cmd.h 2010-02-25 12:02:16.000000000 +0100
12906 +#ifndef _VX_DEVICE_CMD_H
12907 +#define _VX_DEVICE_CMD_H
12910 +/* device vserver commands */
12912 +#define VCMD_set_mapping VC_CMD(DEVICE, 1, 0)
12913 +#define VCMD_unset_mapping VC_CMD(DEVICE, 2, 0)
12915 +struct vcmd_set_mapping_v0 {
12916 + const char __user *device;
12917 + const char __user *target;
12924 +#ifdef CONFIG_COMPAT
12926 +#include <asm/compat.h>
12928 +struct vcmd_set_mapping_v0_x32 {
12929 + compat_uptr_t device_ptr;
12930 + compat_uptr_t target_ptr;
12934 +#endif /* CONFIG_COMPAT */
12936 +#include <linux/compiler.h>
12938 +extern int vc_set_mapping(struct vx_info *, void __user *);
12939 +extern int vc_unset_mapping(struct vx_info *, void __user *);
12941 +#ifdef CONFIG_COMPAT
12943 +extern int vc_set_mapping_x32(struct vx_info *, void __user *);
12944 +extern int vc_unset_mapping_x32(struct vx_info *, void __user *);
12946 +#endif /* CONFIG_COMPAT */
12948 +#endif /* __KERNEL__ */
12949 +#endif /* _VX_DEVICE_CMD_H */
12950 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/device_def.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/device_def.h
12951 --- linux-2.6.33.1/include/linux/vserver/device_def.h 1970-01-01 01:00:00.000000000 +0100
12952 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/device_def.h 2010-02-25 12:02:16.000000000 +0100
12954 +#ifndef _VX_DEVICE_DEF_H
12955 +#define _VX_DEVICE_DEF_H
12957 +#include <linux/types.h>
12959 +struct vx_dmap_target {
12964 +struct _vx_device {
12965 +#ifdef CONFIG_VSERVER_DEVICE
12966 + struct vx_dmap_target targets[2];
12970 +#endif /* _VX_DEVICE_DEF_H */
12971 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/device.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/device.h
12972 --- linux-2.6.33.1/include/linux/vserver/device.h 1970-01-01 01:00:00.000000000 +0100
12973 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/device.h 2010-02-25 12:02:16.000000000 +0100
12975 +#ifndef _VX_DEVICE_H
12976 +#define _VX_DEVICE_H
12979 +#define DATTR_CREATE 0x00000001
12980 +#define DATTR_OPEN 0x00000002
12982 +#define DATTR_REMAP 0x00000010
12984 +#define DATTR_MASK 0x00000013
12987 +#else /* _VX_DEVICE_H */
12988 +#warning duplicate inclusion
12989 +#endif /* _VX_DEVICE_H */
12990 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/dlimit_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/dlimit_cmd.h
12991 --- linux-2.6.33.1/include/linux/vserver/dlimit_cmd.h 1970-01-01 01:00:00.000000000 +0100
12992 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/dlimit_cmd.h 2010-02-25 12:02:16.000000000 +0100
12994 +#ifndef _VX_DLIMIT_CMD_H
12995 +#define _VX_DLIMIT_CMD_H
12998 +/* dlimit vserver commands */
13000 +#define VCMD_add_dlimit VC_CMD(DLIMIT, 1, 0)
13001 +#define VCMD_rem_dlimit VC_CMD(DLIMIT, 2, 0)
13003 +#define VCMD_set_dlimit VC_CMD(DLIMIT, 5, 0)
13004 +#define VCMD_get_dlimit VC_CMD(DLIMIT, 6, 0)
13006 +struct vcmd_ctx_dlimit_base_v0 {
13007 + const char __user *name;
13011 +struct vcmd_ctx_dlimit_v0 {
13012 + const char __user *name;
13013 + uint32_t space_used; /* used space in kbytes */
13014 + uint32_t space_total; /* maximum space in kbytes */
13015 + uint32_t inodes_used; /* used inodes */
13016 + uint32_t inodes_total; /* maximum inodes */
13017 + uint32_t reserved; /* reserved for root in % */
13021 +#define CDLIM_UNSET ((uint32_t)0UL)
13022 +#define CDLIM_INFINITY ((uint32_t)~0UL)
13023 +#define CDLIM_KEEP ((uint32_t)~1UL)
13025 +#define DLIME_UNIT 0
13026 +#define DLIME_KILO 1
13027 +#define DLIME_MEGA 2
13028 +#define DLIME_GIGA 3
13030 +#define DLIMF_SHIFT 0x10
13032 +#define DLIMS_USED 0
13033 +#define DLIMS_TOTAL 2
13036 +uint64_t dlimit_space_32to64(uint32_t val, uint32_t flags, int shift)
13038 + int exp = (flags & DLIMF_SHIFT) ?
13039 + (flags >> shift) & DLIME_GIGA : DLIME_KILO;
13040 + return ((uint64_t)val) << (10 * exp);
13044 +uint32_t dlimit_space_64to32(uint64_t val, uint32_t *flags, int shift)
13048 + if (*flags & DLIMF_SHIFT) {
13049 + while (val > (1LL << 32) && (exp < 3)) {
13053 + *flags &= ~(DLIME_GIGA << shift);
13054 + *flags |= exp << shift;
13062 +#ifdef CONFIG_COMPAT
13064 +#include <asm/compat.h>
13066 +struct vcmd_ctx_dlimit_base_v0_x32 {
13067 + compat_uptr_t name_ptr;
13071 +struct vcmd_ctx_dlimit_v0_x32 {
13072 + compat_uptr_t name_ptr;
13073 + uint32_t space_used; /* used space in kbytes */
13074 + uint32_t space_total; /* maximum space in kbytes */
13075 + uint32_t inodes_used; /* used inodes */
13076 + uint32_t inodes_total; /* maximum inodes */
13077 + uint32_t reserved; /* reserved for root in % */
13081 +#endif /* CONFIG_COMPAT */
13083 +#include <linux/compiler.h>
13085 +extern int vc_add_dlimit(uint32_t, void __user *);
13086 +extern int vc_rem_dlimit(uint32_t, void __user *);
13088 +extern int vc_set_dlimit(uint32_t, void __user *);
13089 +extern int vc_get_dlimit(uint32_t, void __user *);
13091 +#ifdef CONFIG_COMPAT
13093 +extern int vc_add_dlimit_x32(uint32_t, void __user *);
13094 +extern int vc_rem_dlimit_x32(uint32_t, void __user *);
13096 +extern int vc_set_dlimit_x32(uint32_t, void __user *);
13097 +extern int vc_get_dlimit_x32(uint32_t, void __user *);
13099 +#endif /* CONFIG_COMPAT */
13101 +#endif /* __KERNEL__ */
13102 +#endif /* _VX_DLIMIT_CMD_H */
13103 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/dlimit.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/dlimit.h
13104 --- linux-2.6.33.1/include/linux/vserver/dlimit.h 1970-01-01 01:00:00.000000000 +0100
13105 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/dlimit.h 2010-02-25 12:02:16.000000000 +0100
13107 +#ifndef _VX_DLIMIT_H
13108 +#define _VX_DLIMIT_H
13110 +#include "switch.h"
13115 +/* keep in sync with CDLIM_INFINITY */
13117 +#define DLIM_INFINITY (~0ULL)
13119 +#include <linux/spinlock.h>
13120 +#include <linux/rcupdate.h>
13122 +struct super_block;
13125 + struct hlist_node dl_hlist; /* linked list of contexts */
13126 + struct rcu_head dl_rcu; /* the rcu head */
13127 + tag_t dl_tag; /* context tag */
13128 + atomic_t dl_usecnt; /* usage count */
13129 + atomic_t dl_refcnt; /* reference count */
13131 + struct super_block *dl_sb; /* associated superblock */
13133 + spinlock_t dl_lock; /* protect the values */
13135 + unsigned long long dl_space_used; /* used space in bytes */
13136 + unsigned long long dl_space_total; /* maximum space in bytes */
13137 + unsigned long dl_inodes_used; /* used inodes */
13138 + unsigned long dl_inodes_total; /* maximum inodes */
13140 + unsigned int dl_nrlmult; /* non root limit mult */
13145 +extern void rcu_free_dl_info(struct rcu_head *);
13146 +extern void unhash_dl_info(struct dl_info *);
13148 +extern struct dl_info *locate_dl_info(struct super_block *, tag_t);
13153 +extern void vx_vsi_statfs(struct super_block *, struct kstatfs *);
13155 +typedef uint64_t dlsize_t;
13157 +#endif /* __KERNEL__ */
13158 +#else /* _VX_DLIMIT_H */
13159 +#warning duplicate inclusion
13160 +#endif /* _VX_DLIMIT_H */
13161 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/global.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/global.h
13162 --- linux-2.6.33.1/include/linux/vserver/global.h 1970-01-01 01:00:00.000000000 +0100
13163 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/global.h 2010-02-25 12:02:16.000000000 +0100
13165 +#ifndef _VX_GLOBAL_H
13166 +#define _VX_GLOBAL_H
13169 +extern atomic_t vx_global_ctotal;
13170 +extern atomic_t vx_global_cactive;
13172 +extern atomic_t nx_global_ctotal;
13173 +extern atomic_t nx_global_cactive;
13175 +extern atomic_t vs_global_nsproxy;
13176 +extern atomic_t vs_global_fs;
13177 +extern atomic_t vs_global_mnt_ns;
13178 +extern atomic_t vs_global_uts_ns;
13179 +extern atomic_t vs_global_user_ns;
13180 +extern atomic_t vs_global_pid_ns;
13183 +#endif /* _VX_GLOBAL_H */
13184 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/history.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/history.h
13185 --- linux-2.6.33.1/include/linux/vserver/history.h 1970-01-01 01:00:00.000000000 +0100
13186 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/history.h 2010-02-25 12:02:16.000000000 +0100
13188 +#ifndef _VX_HISTORY_H
13189 +#define _VX_HISTORY_H
13194 + VXH_THROW_OOPS = 1,
13198 + VXH_INIT_VX_INFO,
13201 + VXH_CLAIM_VX_INFO,
13202 + VXH_RELEASE_VX_INFO,
13203 + VXH_ALLOC_VX_INFO,
13204 + VXH_DEALLOC_VX_INFO,
13205 + VXH_HASH_VX_INFO,
13206 + VXH_UNHASH_VX_INFO,
13208 + VXH_LOOKUP_VX_INFO,
13209 + VXH_CREATE_VX_INFO,
13212 +struct _vxhe_vxi {
13213 + struct vx_info *ptr;
13219 +struct _vxhe_set_clr {
13223 +struct _vxhe_loc_lookup {
13227 +struct _vx_hist_entry {
13229 + unsigned short seq;
13230 + unsigned short type;
13231 + struct _vxhe_vxi vxi;
13233 + struct _vxhe_set_clr sc;
13234 + struct _vxhe_loc_lookup ll;
13238 +#ifdef CONFIG_VSERVER_HISTORY
13240 +extern unsigned volatile int vxh_active;
13242 +struct _vx_hist_entry *vxh_advance(void *loc);
13246 +void __vxh_copy_vxi(struct _vx_hist_entry *entry, struct vx_info *vxi)
13248 + entry->vxi.ptr = vxi;
13250 + entry->vxi.usecnt = atomic_read(&vxi->vx_usecnt);
13251 + entry->vxi.tasks = atomic_read(&vxi->vx_tasks);
13252 + entry->vxi.xid = vxi->vx_id;
13257 +#define __HERE__ current_text_addr()
13259 +#define __VXH_BODY(__type, __data, __here) \
13260 + struct _vx_hist_entry *entry; \
13262 + preempt_disable(); \
13263 + entry = vxh_advance(__here); \
13265 + entry->type = __type; \
13266 + preempt_enable();
13269 + /* pass vxi only */
13271 +#define __VXH_SMPL \
13272 + __vxh_copy_vxi(entry, vxi)
13275 +void __vxh_smpl(struct vx_info *vxi, int __type, void *__here)
13277 + __VXH_BODY(__type, __VXH_SMPL, __here)
13280 + /* pass vxi and data (void *) */
13282 +#define __VXH_DATA \
13283 + __vxh_copy_vxi(entry, vxi); \
13284 + entry->sc.data = data
13287 +void __vxh_data(struct vx_info *vxi, void *data,
13288 + int __type, void *__here)
13290 + __VXH_BODY(__type, __VXH_DATA, __here)
13293 + /* pass vxi and arg (long) */
13295 +#define __VXH_LONG \
13296 + __vxh_copy_vxi(entry, vxi); \
13297 + entry->ll.arg = arg
13300 +void __vxh_long(struct vx_info *vxi, long arg,
13301 + int __type, void *__here)
13303 + __VXH_BODY(__type, __VXH_LONG, __here)
13308 +void __vxh_throw_oops(void *__here)
13310 + __VXH_BODY(VXH_THROW_OOPS, {}, __here);
13311 + /* prevent further acquisition */
13316 +#define vxh_throw_oops() __vxh_throw_oops(__HERE__);
13318 +#define __vxh_get_vx_info(v, h) __vxh_smpl(v, VXH_GET_VX_INFO, h);
13319 +#define __vxh_put_vx_info(v, h) __vxh_smpl(v, VXH_PUT_VX_INFO, h);
13321 +#define __vxh_init_vx_info(v, d, h) \
13322 + __vxh_data(v, d, VXH_INIT_VX_INFO, h);
13323 +#define __vxh_set_vx_info(v, d, h) \
13324 + __vxh_data(v, d, VXH_SET_VX_INFO, h);
13325 +#define __vxh_clr_vx_info(v, d, h) \
13326 + __vxh_data(v, d, VXH_CLR_VX_INFO, h);
13328 +#define __vxh_claim_vx_info(v, d, h) \
13329 + __vxh_data(v, d, VXH_CLAIM_VX_INFO, h);
13330 +#define __vxh_release_vx_info(v, d, h) \
13331 + __vxh_data(v, d, VXH_RELEASE_VX_INFO, h);
13333 +#define vxh_alloc_vx_info(v) \
13334 + __vxh_smpl(v, VXH_ALLOC_VX_INFO, __HERE__);
13335 +#define vxh_dealloc_vx_info(v) \
13336 + __vxh_smpl(v, VXH_DEALLOC_VX_INFO, __HERE__);
13338 +#define vxh_hash_vx_info(v) \
13339 + __vxh_smpl(v, VXH_HASH_VX_INFO, __HERE__);
13340 +#define vxh_unhash_vx_info(v) \
13341 + __vxh_smpl(v, VXH_UNHASH_VX_INFO, __HERE__);
13343 +#define vxh_loc_vx_info(v, l) \
13344 + __vxh_long(v, l, VXH_LOC_VX_INFO, __HERE__);
13345 +#define vxh_lookup_vx_info(v, l) \
13346 + __vxh_long(v, l, VXH_LOOKUP_VX_INFO, __HERE__);
13347 +#define vxh_create_vx_info(v, l) \
13348 + __vxh_long(v, l, VXH_CREATE_VX_INFO, __HERE__);
13350 +extern void vxh_dump_history(void);
13353 +#else /* CONFIG_VSERVER_HISTORY */
13355 +#define __HERE__ 0
13357 +#define vxh_throw_oops() do { } while (0)
13359 +#define __vxh_get_vx_info(v, h) do { } while (0)
13360 +#define __vxh_put_vx_info(v, h) do { } while (0)
13362 +#define __vxh_init_vx_info(v, d, h) do { } while (0)
13363 +#define __vxh_set_vx_info(v, d, h) do { } while (0)
13364 +#define __vxh_clr_vx_info(v, d, h) do { } while (0)
13366 +#define __vxh_claim_vx_info(v, d, h) do { } while (0)
13367 +#define __vxh_release_vx_info(v, d, h) do { } while (0)
13369 +#define vxh_alloc_vx_info(v) do { } while (0)
13370 +#define vxh_dealloc_vx_info(v) do { } while (0)
13372 +#define vxh_hash_vx_info(v) do { } while (0)
13373 +#define vxh_unhash_vx_info(v) do { } while (0)
13375 +#define vxh_loc_vx_info(v, l) do { } while (0)
13376 +#define vxh_lookup_vx_info(v, l) do { } while (0)
13377 +#define vxh_create_vx_info(v, l) do { } while (0)
13379 +#define vxh_dump_history() do { } while (0)
13382 +#endif /* CONFIG_VSERVER_HISTORY */
13384 +#endif /* _VX_HISTORY_H */
13385 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/inode_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/inode_cmd.h
13386 --- linux-2.6.33.1/include/linux/vserver/inode_cmd.h 1970-01-01 01:00:00.000000000 +0100
13387 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/inode_cmd.h 2010-02-25 12:02:16.000000000 +0100
13389 +#ifndef _VX_INODE_CMD_H
13390 +#define _VX_INODE_CMD_H
13393 +/* inode vserver commands */
13395 +#define VCMD_get_iattr VC_CMD(INODE, 1, 1)
13396 +#define VCMD_set_iattr VC_CMD(INODE, 2, 1)
13398 +#define VCMD_fget_iattr VC_CMD(INODE, 3, 0)
13399 +#define VCMD_fset_iattr VC_CMD(INODE, 4, 0)
13401 +struct vcmd_ctx_iattr_v1 {
13402 + const char __user *name;
13408 +struct vcmd_ctx_fiattr_v0 {
13418 +#ifdef CONFIG_COMPAT
13420 +#include <asm/compat.h>
13422 +struct vcmd_ctx_iattr_v1_x32 {
13423 + compat_uptr_t name_ptr;
13429 +#endif /* CONFIG_COMPAT */
13431 +#include <linux/compiler.h>
13433 +extern int vc_get_iattr(void __user *);
13434 +extern int vc_set_iattr(void __user *);
13436 +extern int vc_fget_iattr(uint32_t, void __user *);
13437 +extern int vc_fset_iattr(uint32_t, void __user *);
13439 +#ifdef CONFIG_COMPAT
13441 +extern int vc_get_iattr_x32(void __user *);
13442 +extern int vc_set_iattr_x32(void __user *);
13444 +#endif /* CONFIG_COMPAT */
13446 +#endif /* __KERNEL__ */
13447 +#endif /* _VX_INODE_CMD_H */
13448 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/inode.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/inode.h
13449 --- linux-2.6.33.1/include/linux/vserver/inode.h 1970-01-01 01:00:00.000000000 +0100
13450 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/inode.h 2010-02-25 12:02:16.000000000 +0100
13452 +#ifndef _VX_INODE_H
13453 +#define _VX_INODE_H
13456 +#define IATTR_TAG 0x01000000
13458 +#define IATTR_ADMIN 0x00000001
13459 +#define IATTR_WATCH 0x00000002
13460 +#define IATTR_HIDE 0x00000004
13461 +#define IATTR_FLAGS 0x00000007
13463 +#define IATTR_BARRIER 0x00010000
13464 +#define IATTR_IXUNLINK 0x00020000
13465 +#define IATTR_IMMUTABLE 0x00040000
13466 +#define IATTR_COW 0x00080000
13471 +#ifdef CONFIG_VSERVER_PROC_SECURE
13472 +#define IATTR_PROC_DEFAULT ( IATTR_ADMIN | IATTR_HIDE )
13473 +#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
13475 +#define IATTR_PROC_DEFAULT ( IATTR_ADMIN )
13476 +#define IATTR_PROC_SYMLINK ( IATTR_ADMIN )
13479 +#define vx_hide_check(c, m) (((m) & IATTR_HIDE) ? vx_check(c, m) : 1)
13481 +#endif /* __KERNEL__ */
13483 +/* inode ioctls */
13485 +#define FIOC_GETXFLG _IOR('x', 5, long)
13486 +#define FIOC_SETXFLG _IOW('x', 6, long)
13488 +#else /* _VX_INODE_H */
13489 +#warning duplicate inclusion
13490 +#endif /* _VX_INODE_H */
13491 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/Kbuild linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/Kbuild
13492 --- linux-2.6.33.1/include/linux/vserver/Kbuild 1970-01-01 01:00:00.000000000 +0100
13493 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/Kbuild 2010-02-25 12:02:16.000000000 +0100
13496 +unifdef-y += context_cmd.h network_cmd.h space_cmd.h \
13497 + cacct_cmd.h cvirt_cmd.h limit_cmd.h dlimit_cmd.h \
13498 + inode_cmd.h tag_cmd.h sched_cmd.h signal_cmd.h \
13499 + debug_cmd.h device_cmd.h
13501 +unifdef-y += switch.h network.h monitor.h inode.h device.h
13503 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/limit_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/limit_cmd.h
13504 --- linux-2.6.33.1/include/linux/vserver/limit_cmd.h 1970-01-01 01:00:00.000000000 +0100
13505 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/limit_cmd.h 2010-02-25 12:02:16.000000000 +0100
13507 +#ifndef _VX_LIMIT_CMD_H
13508 +#define _VX_LIMIT_CMD_H
13511 +/* rlimit vserver commands */
13513 +#define VCMD_get_rlimit VC_CMD(RLIMIT, 1, 0)
13514 +#define VCMD_set_rlimit VC_CMD(RLIMIT, 2, 0)
13515 +#define VCMD_get_rlimit_mask VC_CMD(RLIMIT, 3, 0)
13516 +#define VCMD_reset_hits VC_CMD(RLIMIT, 7, 0)
13517 +#define VCMD_reset_minmax VC_CMD(RLIMIT, 9, 0)
13519 +struct vcmd_ctx_rlimit_v0 {
13521 + uint64_t minimum;
13522 + uint64_t softlimit;
13523 + uint64_t maximum;
13526 +struct vcmd_ctx_rlimit_mask_v0 {
13527 + uint32_t minimum;
13528 + uint32_t softlimit;
13529 + uint32_t maximum;
13532 +#define VCMD_rlimit_stat VC_CMD(VSTAT, 1, 0)
13534 +struct vcmd_rlimit_stat_v0 {
13538 + uint64_t minimum;
13539 + uint64_t maximum;
13542 +#define CRLIM_UNSET (0ULL)
13543 +#define CRLIM_INFINITY (~0ULL)
13544 +#define CRLIM_KEEP (~1ULL)
13548 +#ifdef CONFIG_IA32_EMULATION
13550 +struct vcmd_ctx_rlimit_v0_x32 {
13552 + uint64_t minimum;
13553 + uint64_t softlimit;
13554 + uint64_t maximum;
13555 +} __attribute__ ((packed));
13557 +#endif /* CONFIG_IA32_EMULATION */
13559 +#include <linux/compiler.h>
13561 +extern int vc_get_rlimit_mask(uint32_t, void __user *);
13562 +extern int vc_get_rlimit(struct vx_info *, void __user *);
13563 +extern int vc_set_rlimit(struct vx_info *, void __user *);
13564 +extern int vc_reset_hits(struct vx_info *, void __user *);
13565 +extern int vc_reset_minmax(struct vx_info *, void __user *);
13567 +extern int vc_rlimit_stat(struct vx_info *, void __user *);
13569 +#ifdef CONFIG_IA32_EMULATION
13571 +extern int vc_get_rlimit_x32(struct vx_info *, void __user *);
13572 +extern int vc_set_rlimit_x32(struct vx_info *, void __user *);
13574 +#endif /* CONFIG_IA32_EMULATION */
13576 +#endif /* __KERNEL__ */
13577 +#endif /* _VX_LIMIT_CMD_H */
13578 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/limit_def.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/limit_def.h
13579 --- linux-2.6.33.1/include/linux/vserver/limit_def.h 1970-01-01 01:00:00.000000000 +0100
13580 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/limit_def.h 2010-02-25 12:02:16.000000000 +0100
13582 +#ifndef _VX_LIMIT_DEF_H
13583 +#define _VX_LIMIT_DEF_H
13585 +#include <asm/atomic.h>
13586 +#include <asm/resource.h>
13588 +#include "limit.h"
13591 +struct _vx_res_limit {
13592 + rlim_t soft; /* Context soft limit */
13593 + rlim_t hard; /* Context hard limit */
13595 + rlim_atomic_t rcur; /* Current value */
13596 + rlim_t rmin; /* Context minimum */
13597 + rlim_t rmax; /* Context maximum */
13599 + atomic_t lhit; /* Limit hits */
13602 +/* context sub struct */
13604 +struct _vx_limit {
13605 + struct _vx_res_limit res[NUM_LIMITS];
13608 +#ifdef CONFIG_VSERVER_DEBUG
13610 +static inline void __dump_vx_limit(struct _vx_limit *limit)
13614 + printk("\t_vx_limit:");
13615 + for (i = 0; i < NUM_LIMITS; i++) {
13616 + printk("\t [%2d] = %8lu %8lu/%8lu, %8ld/%8ld, %8d\n",
13617 + i, (unsigned long)__rlim_get(limit, i),
13618 + (unsigned long)__rlim_rmin(limit, i),
13619 + (unsigned long)__rlim_rmax(limit, i),
13620 + (long)__rlim_soft(limit, i),
13621 + (long)__rlim_hard(limit, i),
13622 + atomic_read(&__rlim_lhit(limit, i)));
13628 +#endif /* _VX_LIMIT_DEF_H */
13629 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/limit.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/limit.h
13630 --- linux-2.6.33.1/include/linux/vserver/limit.h 1970-01-01 01:00:00.000000000 +0100
13631 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/limit.h 2010-02-25 12:02:16.000000000 +0100
13633 +#ifndef _VX_LIMIT_H
13634 +#define _VX_LIMIT_H
13636 +#define VLIMIT_NSOCK 16
13637 +#define VLIMIT_OPENFD 17
13638 +#define VLIMIT_ANON 18
13639 +#define VLIMIT_SHMEM 19
13640 +#define VLIMIT_SEMARY 20
13641 +#define VLIMIT_NSEMS 21
13642 +#define VLIMIT_DENTRY 22
13643 +#define VLIMIT_MAPPED 23
13648 +#define VLIM_NOCHECK ((1L << VLIMIT_DENTRY) | (1L << RLIMIT_RSS))
13650 +/* keep in sync with CRLIM_INFINITY */
13652 +#define VLIM_INFINITY (~0ULL)
13654 +#include <asm/atomic.h>
13655 +#include <asm/resource.h>
13657 +#ifndef RLIM_INFINITY
13658 +#warning RLIM_INFINITY is undefined
13661 +#define __rlim_val(l, r, v) ((l)->res[r].v)
13663 +#define __rlim_soft(l, r) __rlim_val(l, r, soft)
13664 +#define __rlim_hard(l, r) __rlim_val(l, r, hard)
13666 +#define __rlim_rcur(l, r) __rlim_val(l, r, rcur)
13667 +#define __rlim_rmin(l, r) __rlim_val(l, r, rmin)
13668 +#define __rlim_rmax(l, r) __rlim_val(l, r, rmax)
13670 +#define __rlim_lhit(l, r) __rlim_val(l, r, lhit)
13671 +#define __rlim_hit(l, r) atomic_inc(&__rlim_lhit(l, r))
13673 +typedef atomic_long_t rlim_atomic_t;
13674 +typedef unsigned long rlim_t;
13676 +#define __rlim_get(l, r) atomic_long_read(&__rlim_rcur(l, r))
13677 +#define __rlim_set(l, r, v) atomic_long_set(&__rlim_rcur(l, r), v)
13678 +#define __rlim_inc(l, r) atomic_long_inc(&__rlim_rcur(l, r))
13679 +#define __rlim_dec(l, r) atomic_long_dec(&__rlim_rcur(l, r))
13680 +#define __rlim_add(l, r, v) atomic_long_add(v, &__rlim_rcur(l, r))
13681 +#define __rlim_sub(l, r, v) atomic_long_sub(v, &__rlim_rcur(l, r))
13684 +#if (RLIM_INFINITY == VLIM_INFINITY)
13685 +#define VX_VLIM(r) ((long long)(long)(r))
13686 +#define VX_RLIM(v) ((rlim_t)(v))
13688 +#define VX_VLIM(r) (((r) == RLIM_INFINITY) \
13689 + ? VLIM_INFINITY : (long long)(r))
13690 +#define VX_RLIM(v) (((v) == VLIM_INFINITY) \
13691 + ? RLIM_INFINITY : (rlim_t)(v))
13696 +void vx_vsi_meminfo(struct sysinfo *);
13697 +void vx_vsi_swapinfo(struct sysinfo *);
13698 +long vx_vsi_cached(struct sysinfo *);
13700 +#define NUM_LIMITS 24
13702 +#endif /* __KERNEL__ */
13703 +#endif /* _VX_LIMIT_H */
13704 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/limit_int.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/limit_int.h
13705 --- linux-2.6.33.1/include/linux/vserver/limit_int.h 1970-01-01 01:00:00.000000000 +0100
13706 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/limit_int.h 2010-02-25 12:02:16.000000000 +0100
13708 +#ifndef _VX_LIMIT_INT_H
13709 +#define _VX_LIMIT_INT_H
13711 +#include "context.h"
13715 +#define VXD_RCRES_COND(r) VXD_CBIT(cres, r)
13716 +#define VXD_RLIMIT_COND(r) VXD_CBIT(limit, r)
13718 +extern const char *vlimit_name[NUM_LIMITS];
13720 +static inline void __vx_acc_cres(struct vx_info *vxi,
13721 + int res, int dir, void *_data, char *_file, int _line)
13723 + if (VXD_RCRES_COND(res))
13724 + vxlprintk(1, "vx_acc_cres[%5d,%s,%2d]: %5ld%s (%p)",
13725 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13726 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13727 + (dir > 0) ? "++" : "--", _data, _file, _line);
13732 + __rlim_inc(&vxi->limit, res);
13734 + __rlim_dec(&vxi->limit, res);
13737 +static inline void __vx_add_cres(struct vx_info *vxi,
13738 + int res, int amount, void *_data, char *_file, int _line)
13740 + if (VXD_RCRES_COND(res))
13741 + vxlprintk(1, "vx_add_cres[%5d,%s,%2d]: %5ld += %5d (%p)",
13742 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13743 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13744 + amount, _data, _file, _line);
13749 + __rlim_add(&vxi->limit, res, amount);
13753 +int __vx_cres_adjust_max(struct _vx_limit *limit, int res, rlim_t value)
13755 + int cond = (value > __rlim_rmax(limit, res));
13758 + __rlim_rmax(limit, res) = value;
13763 +int __vx_cres_adjust_min(struct _vx_limit *limit, int res, rlim_t value)
13765 + int cond = (value < __rlim_rmin(limit, res));
13768 + __rlim_rmin(limit, res) = value;
13773 +void __vx_cres_fixup(struct _vx_limit *limit, int res, rlim_t value)
13775 + if (!__vx_cres_adjust_max(limit, res, value))
13776 + __vx_cres_adjust_min(limit, res, value);
13781 + +1 ... no limit hit
13782 + -1 ... over soft limit
13783 + 0 ... over hard limit */
13785 +static inline int __vx_cres_avail(struct vx_info *vxi,
13786 + int res, int num, char *_file, int _line)
13788 + struct _vx_limit *limit;
13791 + if (VXD_RLIMIT_COND(res))
13792 + vxlprintk(1, "vx_cres_avail[%5d,%s,%2d]: %5ld/%5ld > %5ld + %5d",
13793 + (vxi ? vxi->vx_id : -1), vlimit_name[res], res,
13794 + (vxi ? (long)__rlim_soft(&vxi->limit, res) : -1),
13795 + (vxi ? (long)__rlim_hard(&vxi->limit, res) : -1),
13796 + (vxi ? (long)__rlim_get(&vxi->limit, res) : 0),
13797 + num, _file, _line);
13801 + limit = &vxi->limit;
13802 + value = __rlim_get(limit, res);
13804 + if (!__vx_cres_adjust_max(limit, res, value))
13805 + __vx_cres_adjust_min(limit, res, value);
13810 + if (__rlim_soft(limit, res) == RLIM_INFINITY)
13812 + if (value + num <= __rlim_soft(limit, res))
13815 + if (__rlim_hard(limit, res) == RLIM_INFINITY)
13817 + if (value + num <= __rlim_hard(limit, res))
13820 + __rlim_hit(limit, res);
13825 +static const int VLA_RSS[] = { RLIMIT_RSS, VLIMIT_ANON, VLIMIT_MAPPED, 0 };
13828 +rlim_t __vx_cres_array_sum(struct _vx_limit *limit, const int *array)
13830 + rlim_t value, sum = 0;
13833 + while ((res = *array++)) {
13834 + value = __rlim_get(limit, res);
13835 + __vx_cres_fixup(limit, res, value);
13842 +rlim_t __vx_cres_array_fixup(struct _vx_limit *limit, const int *array)
13844 + rlim_t value = __vx_cres_array_sum(limit, array + 1);
13845 + int res = *array;
13847 + if (value == __rlim_get(limit, res))
13850 + __rlim_set(limit, res, value);
13851 + /* now adjust min/max */
13852 + if (!__vx_cres_adjust_max(limit, res, value))
13853 + __vx_cres_adjust_min(limit, res, value);
13858 +static inline int __vx_cres_array_avail(struct vx_info *vxi,
13859 + const int *array, int num, char *_file, int _line)
13861 + struct _vx_limit *limit;
13862 + rlim_t value = 0;
13870 + limit = &vxi->limit;
13872 + value = __vx_cres_array_sum(limit, array + 1);
13874 + __rlim_set(limit, res, value);
13875 + __vx_cres_fixup(limit, res, value);
13877 + return __vx_cres_avail(vxi, res, num, _file, _line);
13881 +static inline void vx_limit_fixup(struct _vx_limit *limit, int id)
13886 + /* complex resources first */
13887 + if ((id < 0) || (id == RLIMIT_RSS))
13888 + __vx_cres_array_fixup(limit, VLA_RSS);
13890 + for (res = 0; res < NUM_LIMITS; res++) {
13891 + if ((id > 0) && (res != id))
13894 + value = __rlim_get(limit, res);
13895 + __vx_cres_fixup(limit, res, value);
13897 + /* not supposed to happen, maybe warn? */
13898 + if (__rlim_rmax(limit, res) > __rlim_hard(limit, res))
13899 + __rlim_rmax(limit, res) = __rlim_hard(limit, res);
13904 +#endif /* __KERNEL__ */
13905 +#endif /* _VX_LIMIT_INT_H */
13906 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/monitor.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/monitor.h
13907 --- linux-2.6.33.1/include/linux/vserver/monitor.h 1970-01-01 01:00:00.000000000 +0100
13908 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/monitor.h 2010-02-25 12:02:16.000000000 +0100
13910 +#ifndef _VX_MONITOR_H
13911 +#define _VX_MONITOR_H
13913 +#include <linux/types.h>
13920 + VXM_UPDATE = 0x20,
13924 + VXM_RQINFO_1 = 0x24,
13927 + VXM_ACTIVATE = 0x40,
13934 + VXM_MIGRATE = 0x48,
13937 + /* all other bits are flags */
13938 + VXM_SCHED = 0x80,
13941 +struct _vxm_update_1 {
13942 + uint32_t tokens_max;
13943 + uint32_t fill_rate;
13944 + uint32_t interval;
13947 +struct _vxm_update_2 {
13948 + uint32_t tokens_min;
13949 + uint32_t fill_rate;
13950 + uint32_t interval;
13953 +struct _vxm_rqinfo_1 {
13954 + uint16_t running;
13958 + uint32_t idle_tokens;
13961 +struct _vxm_rqinfo_2 {
13962 + uint32_t norm_time;
13963 + uint32_t idle_time;
13964 + uint32_t idle_skip;
13967 +struct _vxm_sched {
13969 + uint32_t norm_time;
13970 + uint32_t idle_time;
13973 +struct _vxm_task {
13978 +struct _vxm_event {
13987 + struct _vxm_task tsk;
13991 +struct _vx_mon_entry {
13995 + struct _vxm_event ev;
13996 + struct _vxm_sched sd;
13997 + struct _vxm_update_1 u1;
13998 + struct _vxm_update_2 u2;
13999 + struct _vxm_rqinfo_1 q1;
14000 + struct _vxm_rqinfo_2 q2;
14005 +#endif /* _VX_MONITOR_H */
14006 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/network_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/network_cmd.h
14007 --- linux-2.6.33.1/include/linux/vserver/network_cmd.h 1970-01-01 01:00:00.000000000 +0100
14008 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/network_cmd.h 2010-02-25 12:02:16.000000000 +0100
14010 +#ifndef _VX_NETWORK_CMD_H
14011 +#define _VX_NETWORK_CMD_H
14014 +/* vinfo commands */
14016 +#define VCMD_task_nid VC_CMD(VINFO, 2, 0)
14019 +extern int vc_task_nid(uint32_t);
14021 +#endif /* __KERNEL__ */
14023 +#define VCMD_nx_info VC_CMD(VINFO, 6, 0)
14025 +struct vcmd_nx_info_v0 {
14027 + /* more to come */
14031 +extern int vc_nx_info(struct nx_info *, void __user *);
14033 +#endif /* __KERNEL__ */
14035 +#include <linux/in.h>
14036 +#include <linux/in6.h>
14038 +#define VCMD_net_create_v0 VC_CMD(VNET, 1, 0)
14039 +#define VCMD_net_create VC_CMD(VNET, 1, 1)
14041 +struct vcmd_net_create {
14042 + uint64_t flagword;
14045 +#define VCMD_net_migrate VC_CMD(NETMIG, 1, 0)
14047 +#define VCMD_net_add VC_CMD(NETALT, 1, 0)
14048 +#define VCMD_net_remove VC_CMD(NETALT, 2, 0)
14050 +struct vcmd_net_addr_v0 {
14053 + struct in_addr ip[4];
14054 + struct in_addr mask[4];
14057 +#define VCMD_net_add_ipv4 VC_CMD(NETALT, 1, 1)
14058 +#define VCMD_net_remove_ipv4 VC_CMD(NETALT, 2, 1)
14060 +struct vcmd_net_addr_ipv4_v1 {
14063 + struct in_addr ip;
14064 + struct in_addr mask;
14067 +#define VCMD_net_add_ipv6 VC_CMD(NETALT, 3, 1)
14068 +#define VCMD_net_remove_ipv6 VC_CMD(NETALT, 4, 1)
14070 +struct vcmd_net_addr_ipv6_v1 {
14074 + struct in6_addr ip;
14075 + struct in6_addr mask;
14078 +#define VCMD_add_match_ipv4 VC_CMD(NETALT, 5, 0)
14079 +#define VCMD_get_match_ipv4 VC_CMD(NETALT, 6, 0)
14081 +struct vcmd_match_ipv4_v0 {
14086 + struct in_addr ip;
14087 + struct in_addr ip2;
14088 + struct in_addr mask;
14091 +#define VCMD_add_match_ipv6 VC_CMD(NETALT, 7, 0)
14092 +#define VCMD_get_match_ipv6 VC_CMD(NETALT, 8, 0)
14094 +struct vcmd_match_ipv6_v0 {
14099 + struct in6_addr ip;
14100 + struct in6_addr ip2;
14101 + struct in6_addr mask;
14106 +extern int vc_net_create(uint32_t, void __user *);
14107 +extern int vc_net_migrate(struct nx_info *, void __user *);
14109 +extern int vc_net_add(struct nx_info *, void __user *);
14110 +extern int vc_net_remove(struct nx_info *, void __user *);
14112 +extern int vc_net_add_ipv4(struct nx_info *, void __user *);
14113 +extern int vc_net_remove_ipv4(struct nx_info *, void __user *);
14115 +extern int vc_net_add_ipv6(struct nx_info *, void __user *);
14116 +extern int vc_net_remove_ipv6(struct nx_info *, void __user *);
14118 +extern int vc_add_match_ipv4(struct nx_info *, void __user *);
14119 +extern int vc_get_match_ipv4(struct nx_info *, void __user *);
14121 +extern int vc_add_match_ipv6(struct nx_info *, void __user *);
14122 +extern int vc_get_match_ipv6(struct nx_info *, void __user *);
14124 +#endif /* __KERNEL__ */
14127 +/* flag commands */
14129 +#define VCMD_get_nflags VC_CMD(FLAGS, 5, 0)
14130 +#define VCMD_set_nflags VC_CMD(FLAGS, 6, 0)
14132 +struct vcmd_net_flags_v0 {
14133 + uint64_t flagword;
14138 +extern int vc_get_nflags(struct nx_info *, void __user *);
14139 +extern int vc_set_nflags(struct nx_info *, void __user *);
14141 +#endif /* __KERNEL__ */
14144 +/* network caps commands */
14146 +#define VCMD_get_ncaps VC_CMD(FLAGS, 7, 0)
14147 +#define VCMD_set_ncaps VC_CMD(FLAGS, 8, 0)
14149 +struct vcmd_net_caps_v0 {
14155 +extern int vc_get_ncaps(struct nx_info *, void __user *);
14156 +extern int vc_set_ncaps(struct nx_info *, void __user *);
14158 +#endif /* __KERNEL__ */
14159 +#endif /* _VX_CONTEXT_CMD_H */
14160 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/network.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/network.h
14161 --- linux-2.6.33.1/include/linux/vserver/network.h 1970-01-01 01:00:00.000000000 +0100
14162 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/network.h 2010-02-25 12:02:16.000000000 +0100
14164 +#ifndef _VX_NETWORK_H
14165 +#define _VX_NETWORK_H
14167 +#include <linux/types.h>
14170 +#define MAX_N_CONTEXT 65535 /* Arbitrary limit */
14173 +/* network flags */
14175 +#define NXF_INFO_PRIVATE 0x00000008
14177 +#define NXF_SINGLE_IP 0x00000100
14178 +#define NXF_LBACK_REMAP 0x00000200
14179 +#define NXF_LBACK_ALLOW 0x00000400
14181 +#define NXF_HIDE_NETIF 0x02000000
14182 +#define NXF_HIDE_LBACK 0x04000000
14184 +#define NXF_STATE_SETUP (1ULL << 32)
14185 +#define NXF_STATE_ADMIN (1ULL << 34)
14187 +#define NXF_SC_HELPER (1ULL << 36)
14188 +#define NXF_PERSISTENT (1ULL << 38)
14190 +#define NXF_ONE_TIME (0x0005ULL << 32)
14193 +#define NXF_INIT_SET (__nxf_init_set())
14195 +static inline uint64_t __nxf_init_set(void) {
14196 + return NXF_STATE_ADMIN
14197 +#ifdef CONFIG_VSERVER_AUTO_LBACK
14198 + | NXF_LBACK_REMAP
14201 +#ifdef CONFIG_VSERVER_AUTO_SINGLE
14204 + | NXF_HIDE_NETIF;
14208 +/* network caps */
14210 +#define NXC_TUN_CREATE 0x00000001
14212 +#define NXC_RAW_ICMP 0x00000100
14215 +/* address types */
14217 +#define NXA_TYPE_IPV4 0x0001
14218 +#define NXA_TYPE_IPV6 0x0002
14220 +#define NXA_TYPE_NONE 0x0000
14221 +#define NXA_TYPE_ANY 0x00FF
14223 +#define NXA_TYPE_ADDR 0x0010
14224 +#define NXA_TYPE_MASK 0x0020
14225 +#define NXA_TYPE_RANGE 0x0040
14227 +#define NXA_MASK_ALL (NXA_TYPE_ADDR | NXA_TYPE_MASK | NXA_TYPE_RANGE)
14229 +#define NXA_MOD_BCAST 0x0100
14230 +#define NXA_MOD_LBACK 0x0200
14232 +#define NXA_LOOPBACK 0x1000
14234 +#define NXA_MASK_BIND (NXA_MASK_ALL | NXA_MOD_BCAST | NXA_MOD_LBACK)
14235 +#define NXA_MASK_SHOW (NXA_MASK_ALL | NXA_LOOPBACK)
14239 +#include <linux/list.h>
14240 +#include <linux/spinlock.h>
14241 +#include <linux/rcupdate.h>
14242 +#include <linux/in.h>
14243 +#include <linux/in6.h>
14244 +#include <asm/atomic.h>
14246 +struct nx_addr_v4 {
14247 + struct nx_addr_v4 *next;
14248 + struct in_addr ip[2];
14249 + struct in_addr mask;
14254 +struct nx_addr_v6 {
14255 + struct nx_addr_v6 *next;
14256 + struct in6_addr ip;
14257 + struct in6_addr mask;
14264 + struct hlist_node nx_hlist; /* linked list of nxinfos */
14265 + nid_t nx_id; /* vnet id */
14266 + atomic_t nx_usecnt; /* usage count */
14267 + atomic_t nx_tasks; /* tasks count */
14268 + int nx_state; /* context state */
14270 + uint64_t nx_flags; /* network flag word */
14271 + uint64_t nx_ncaps; /* network capabilities */
14273 + struct in_addr v4_lback; /* Loopback address */
14274 + struct in_addr v4_bcast; /* Broadcast address */
14275 + struct nx_addr_v4 v4; /* First/Single ipv4 address */
14276 +#ifdef CONFIG_IPV6
14277 + struct nx_addr_v6 v6; /* First/Single ipv6 address */
14279 + char nx_name[65]; /* network context name */
14283 +/* status flags */
14285 +#define NXS_HASHED 0x0001
14286 +#define NXS_SHUTDOWN 0x0100
14287 +#define NXS_RELEASED 0x8000
14289 +extern struct nx_info *lookup_nx_info(int);
14291 +extern int get_nid_list(int, unsigned int *, int);
14292 +extern int nid_is_hashed(nid_t);
14294 +extern int nx_migrate_task(struct task_struct *, struct nx_info *);
14296 +extern long vs_net_change(struct nx_info *, unsigned int);
14301 +#define NX_IPV4(n) ((n)->v4.type != NXA_TYPE_NONE)
14302 +#ifdef CONFIG_IPV6
14303 +#define NX_IPV6(n) ((n)->v6.type != NXA_TYPE_NONE)
14305 +#define NX_IPV6(n) (0)
14308 +#endif /* __KERNEL__ */
14309 +#endif /* _VX_NETWORK_H */
14310 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/percpu.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/percpu.h
14311 --- linux-2.6.33.1/include/linux/vserver/percpu.h 1970-01-01 01:00:00.000000000 +0100
14312 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/percpu.h 2010-02-25 12:02:16.000000000 +0100
14314 +#ifndef _VX_PERCPU_H
14315 +#define _VX_PERCPU_H
14317 +#include "cvirt_def.h"
14318 +#include "sched_def.h"
14320 +struct _vx_percpu {
14321 + struct _vx_cvirt_pc cvirt;
14322 + struct _vx_sched_pc sched;
14325 +#define PERCPU_PERCTX (sizeof(struct _vx_percpu))
14327 +#endif /* _VX_PERCPU_H */
14328 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/pid.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/pid.h
14329 --- linux-2.6.33.1/include/linux/vserver/pid.h 1970-01-01 01:00:00.000000000 +0100
14330 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/pid.h 2010-02-25 12:02:16.000000000 +0100
14332 +#ifndef _VSERVER_PID_H
14333 +#define _VSERVER_PID_H
14335 +/* pid faking stuff */
14337 +#define vx_info_map_pid(v, p) \
14338 + __vx_info_map_pid((v), (p), __func__, __FILE__, __LINE__)
14339 +#define vx_info_map_tgid(v,p) vx_info_map_pid(v,p)
14340 +#define vx_map_pid(p) vx_info_map_pid(current_vx_info(), p)
14341 +#define vx_map_tgid(p) vx_map_pid(p)
14343 +static inline int __vx_info_map_pid(struct vx_info *vxi, int pid,
14344 + const char *func, const char *file, int line)
14346 + if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
14347 + vxfprintk(VXD_CBIT(cvirt, 2),
14348 + "vx_map_tgid: %p/%llx: %d -> %d",
14349 + vxi, (long long)vxi->vx_flags, pid,
14350 + (pid && pid == vxi->vx_initpid) ? 1 : pid,
14351 + func, file, line);
14354 + if (pid == vxi->vx_initpid)
14360 +#define vx_info_rmap_pid(v, p) \
14361 + __vx_info_rmap_pid((v), (p), __func__, __FILE__, __LINE__)
14362 +#define vx_rmap_pid(p) vx_info_rmap_pid(current_vx_info(), p)
14363 +#define vx_rmap_tgid(p) vx_rmap_pid(p)
14365 +static inline int __vx_info_rmap_pid(struct vx_info *vxi, int pid,
14366 + const char *func, const char *file, int line)
14368 + if (vx_info_flags(vxi, VXF_INFO_INIT, 0)) {
14369 + vxfprintk(VXD_CBIT(cvirt, 2),
14370 + "vx_rmap_tgid: %p/%llx: %d -> %d",
14371 + vxi, (long long)vxi->vx_flags, pid,
14372 + (pid == 1) ? vxi->vx_initpid : pid,
14373 + func, file, line);
14374 + if ((pid == 1) && vxi->vx_initpid)
14375 + return vxi->vx_initpid;
14376 + if (pid == vxi->vx_initpid)
14383 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/sched_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/sched_cmd.h
14384 --- linux-2.6.33.1/include/linux/vserver/sched_cmd.h 1970-01-01 01:00:00.000000000 +0100
14385 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/sched_cmd.h 2010-02-25 12:02:16.000000000 +0100
14387 +#ifndef _VX_SCHED_CMD_H
14388 +#define _VX_SCHED_CMD_H
14391 +/* sched vserver commands */
14393 +#define VCMD_set_sched_v2 VC_CMD(SCHED, 1, 2)
14394 +#define VCMD_set_sched_v3 VC_CMD(SCHED, 1, 3)
14395 +#define VCMD_set_sched_v4 VC_CMD(SCHED, 1, 4)
14397 +struct vcmd_set_sched_v2 {
14398 + int32_t fill_rate;
14399 + int32_t interval;
14401 + int32_t tokens_min;
14402 + int32_t tokens_max;
14403 + uint64_t cpu_mask;
14406 +struct vcmd_set_sched_v3 {
14407 + uint32_t set_mask;
14408 + int32_t fill_rate;
14409 + int32_t interval;
14411 + int32_t tokens_min;
14412 + int32_t tokens_max;
14413 + int32_t priority_bias;
14416 +struct vcmd_set_sched_v4 {
14417 + uint32_t set_mask;
14418 + int32_t fill_rate;
14419 + int32_t interval;
14421 + int32_t tokens_min;
14422 + int32_t tokens_max;
14423 + int32_t prio_bias;
14425 + int32_t bucket_id;
14428 +#define VCMD_set_sched VC_CMD(SCHED, 1, 5)
14429 +#define VCMD_get_sched VC_CMD(SCHED, 2, 5)
14431 +struct vcmd_sched_v5 {
14434 + int32_t bucket_id;
14435 + int32_t fill_rate[2];
14436 + int32_t interval[2];
14438 + int32_t tokens_min;
14439 + int32_t tokens_max;
14440 + int32_t prio_bias;
14443 +#define VXSM_FILL_RATE 0x0001
14444 +#define VXSM_INTERVAL 0x0002
14445 +#define VXSM_FILL_RATE2 0x0004
14446 +#define VXSM_INTERVAL2 0x0008
14447 +#define VXSM_TOKENS 0x0010
14448 +#define VXSM_TOKENS_MIN 0x0020
14449 +#define VXSM_TOKENS_MAX 0x0040
14450 +#define VXSM_PRIO_BIAS 0x0100
14452 +#define VXSM_IDLE_TIME 0x0200
14453 +#define VXSM_FORCE 0x0400
14455 +#define VXSM_V3_MASK 0x0173
14456 +#define VXSM_SET_MASK 0x01FF
14458 +#define VXSM_CPU_ID 0x1000
14459 +#define VXSM_BUCKET_ID 0x2000
14461 +#define VXSM_MSEC 0x4000
14463 +#define SCHED_KEEP (-2) /* only for v2 */
14467 +#include <linux/compiler.h>
14469 +extern int vc_set_sched_v2(struct vx_info *, void __user *);
14470 +extern int vc_set_sched_v3(struct vx_info *, void __user *);
14471 +extern int vc_set_sched_v4(struct vx_info *, void __user *);
14472 +extern int vc_set_sched(struct vx_info *, void __user *);
14473 +extern int vc_get_sched(struct vx_info *, void __user *);
14475 +#endif /* __KERNEL__ */
14477 +#define VCMD_sched_info VC_CMD(SCHED, 3, 0)
14479 +struct vcmd_sched_info {
14481 + int32_t bucket_id;
14482 + uint64_t user_msec;
14483 + uint64_t sys_msec;
14484 + uint64_t hold_msec;
14485 + uint32_t token_usec;
14486 + int32_t vavavoom;
14491 +extern int vc_sched_info(struct vx_info *, void __user *);
14493 +#endif /* __KERNEL__ */
14494 +#endif /* _VX_SCHED_CMD_H */
14495 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/sched_def.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/sched_def.h
14496 --- linux-2.6.33.1/include/linux/vserver/sched_def.h 1970-01-01 01:00:00.000000000 +0100
14497 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/sched_def.h 2010-02-25 12:02:16.000000000 +0100
14499 +#ifndef _VX_SCHED_DEF_H
14500 +#define _VX_SCHED_DEF_H
14502 +#include <linux/spinlock.h>
14503 +#include <linux/jiffies.h>
14504 +#include <linux/cpumask.h>
14505 +#include <asm/atomic.h>
14506 +#include <asm/param.h>
14509 +/* context sub struct */
14511 +struct _vx_sched {
14512 + spinlock_t tokens_lock; /* lock for token bucket */
14514 + int tokens; /* number of CPU tokens */
14515 + int fill_rate[2]; /* Fill rate: add X tokens... */
14516 + int interval[2]; /* Divisor: per Y jiffies */
14517 + int tokens_min; /* Limit: minimum for unhold */
14518 + int tokens_max; /* Limit: no more than N tokens */
14520 + int prio_bias; /* bias offset for priority */
14522 + unsigned update_mask; /* which features should be updated */
14523 + cpumask_t update; /* CPUs which should update */
14526 +struct _vx_sched_pc {
14527 + int tokens; /* number of CPU tokens */
14528 + int flags; /* bucket flags */
14530 + int fill_rate[2]; /* Fill rate: add X tokens... */
14531 + int interval[2]; /* Divisor: per Y jiffies */
14532 + int tokens_min; /* Limit: minimum for unhold */
14533 + int tokens_max; /* Limit: no more than N tokens */
14535 + int prio_bias; /* bias offset for priority */
14536 + int vavavoom; /* last calculated vavavoom */
14538 + unsigned long norm_time; /* last time accounted */
14539 + unsigned long idle_time; /* non linear time for fair sched */
14540 + unsigned long token_time; /* token time for accounting */
14541 + unsigned long onhold; /* jiffies when put on hold */
14543 + uint64_t user_ticks; /* token tick events */
14544 + uint64_t sys_ticks; /* token tick events */
14545 + uint64_t hold_ticks; /* token ticks paused */
14549 +#define VXSF_ONHOLD 0x0001
14550 +#define VXSF_IDLE_TIME 0x0100
14552 +#ifdef CONFIG_VSERVER_DEBUG
14554 +static inline void __dump_vx_sched(struct _vx_sched *sched)
14556 + printk("\t_vx_sched:\n");
14557 + printk("\t tokens: %4d/%4d, %4d/%4d, %4d, %4d\n",
14558 + sched->fill_rate[0], sched->interval[0],
14559 + sched->fill_rate[1], sched->interval[1],
14560 + sched->tokens_min, sched->tokens_max);
14561 + printk("\t priority = %4d\n", sched->prio_bias);
14566 +#endif /* _VX_SCHED_DEF_H */
14567 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/sched.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/sched.h
14568 --- linux-2.6.33.1/include/linux/vserver/sched.h 1970-01-01 01:00:00.000000000 +0100
14569 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/sched.h 2010-02-25 12:02:16.000000000 +0100
14571 +#ifndef _VX_SCHED_H
14572 +#define _VX_SCHED_H
14579 +void vx_vsi_uptime(struct timespec *, struct timespec *);
14584 +void vx_update_load(struct vx_info *);
14587 +int vx_tokens_recalc(struct _vx_sched_pc *,
14588 + unsigned long *, unsigned long *, int [2]);
14590 +void vx_update_sched_param(struct _vx_sched *sched,
14591 + struct _vx_sched_pc *sched_pc);
14593 +#endif /* __KERNEL__ */
14594 +#else /* _VX_SCHED_H */
14595 +#warning duplicate inclusion
14596 +#endif /* _VX_SCHED_H */
14597 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/signal_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/signal_cmd.h
14598 --- linux-2.6.33.1/include/linux/vserver/signal_cmd.h 1970-01-01 01:00:00.000000000 +0100
14599 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/signal_cmd.h 2010-02-25 12:02:16.000000000 +0100
14601 +#ifndef _VX_SIGNAL_CMD_H
14602 +#define _VX_SIGNAL_CMD_H
14605 +/* signalling vserver commands */
14607 +#define VCMD_ctx_kill VC_CMD(PROCTRL, 1, 0)
14608 +#define VCMD_wait_exit VC_CMD(EVENT, 99, 0)
14610 +struct vcmd_ctx_kill_v0 {
14615 +struct vcmd_wait_exit_v0 {
14616 + int32_t reboot_cmd;
14617 + int32_t exit_code;
14622 +extern int vc_ctx_kill(struct vx_info *, void __user *);
14623 +extern int vc_wait_exit(struct vx_info *, void __user *);
14625 +#endif /* __KERNEL__ */
14627 +/* process alteration commands */
14629 +#define VCMD_get_pflags VC_CMD(PROCALT, 5, 0)
14630 +#define VCMD_set_pflags VC_CMD(PROCALT, 6, 0)
14632 +struct vcmd_pflags_v0 {
14633 + uint32_t flagword;
14639 +extern int vc_get_pflags(uint32_t pid, void __user *);
14640 +extern int vc_set_pflags(uint32_t pid, void __user *);
14642 +#endif /* __KERNEL__ */
14643 +#endif /* _VX_SIGNAL_CMD_H */
14644 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/signal.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/signal.h
14645 --- linux-2.6.33.1/include/linux/vserver/signal.h 1970-01-01 01:00:00.000000000 +0100
14646 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/signal.h 2010-02-25 12:02:16.000000000 +0100
14648 +#ifndef _VX_SIGNAL_H
14649 +#define _VX_SIGNAL_H
14656 +int vx_info_kill(struct vx_info *, int, int);
14658 +#endif /* __KERNEL__ */
14659 +#else /* _VX_SIGNAL_H */
14660 +#warning duplicate inclusion
14661 +#endif /* _VX_SIGNAL_H */
14662 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/space_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/space_cmd.h
14663 --- linux-2.6.33.1/include/linux/vserver/space_cmd.h 1970-01-01 01:00:00.000000000 +0100
14664 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/space_cmd.h 2010-02-25 12:02:16.000000000 +0100
14666 +#ifndef _VX_SPACE_CMD_H
14667 +#define _VX_SPACE_CMD_H
14670 +#define VCMD_enter_space_v0 VC_CMD(PROCALT, 1, 0)
14671 +#define VCMD_enter_space_v1 VC_CMD(PROCALT, 1, 1)
14672 +#define VCMD_enter_space VC_CMD(PROCALT, 1, 2)
14674 +#define VCMD_set_space_v0 VC_CMD(PROCALT, 3, 0)
14675 +#define VCMD_set_space_v1 VC_CMD(PROCALT, 3, 1)
14676 +#define VCMD_set_space VC_CMD(PROCALT, 3, 2)
14678 +#define VCMD_get_space_mask_v0 VC_CMD(PROCALT, 4, 0)
14680 +#define VCMD_get_space_mask VC_CMD(VSPACE, 0, 1)
14681 +#define VCMD_get_space_default VC_CMD(VSPACE, 1, 0)
14684 +struct vcmd_space_mask_v1 {
14688 +struct vcmd_space_mask_v2 {
14696 +extern int vc_enter_space_v1(struct vx_info *, void __user *);
14697 +extern int vc_set_space_v1(struct vx_info *, void __user *);
14698 +extern int vc_enter_space(struct vx_info *, void __user *);
14699 +extern int vc_set_space(struct vx_info *, void __user *);
14700 +extern int vc_get_space_mask(void __user *, int);
14702 +#endif /* __KERNEL__ */
14703 +#endif /* _VX_SPACE_CMD_H */
14704 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/space.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/space.h
14705 --- linux-2.6.33.1/include/linux/vserver/space.h 1970-01-01 01:00:00.000000000 +0100
14706 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/space.h 2010-02-25 12:02:16.000000000 +0100
14708 +#ifndef _VX_SPACE_H
14709 +#define _VX_SPACE_H
14711 +#include <linux/types.h>
14715 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index);
14717 +#else /* _VX_SPACE_H */
14718 +#warning duplicate inclusion
14719 +#endif /* _VX_SPACE_H */
14720 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/switch.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/switch.h
14721 --- linux-2.6.33.1/include/linux/vserver/switch.h 1970-01-01 01:00:00.000000000 +0100
14722 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/switch.h 2010-02-25 12:02:16.000000000 +0100
14724 +#ifndef _VX_SWITCH_H
14725 +#define _VX_SWITCH_H
14727 +#include <linux/types.h>
14730 +#define VC_CATEGORY(c) (((c) >> 24) & 0x3F)
14731 +#define VC_COMMAND(c) (((c) >> 16) & 0xFF)
14732 +#define VC_VERSION(c) ((c) & 0xFFF)
14734 +#define VC_CMD(c, i, v) ((((VC_CAT_ ## c) & 0x3F) << 24) \
14735 + | (((i) & 0xFF) << 16) | ((v) & 0xFFF))
14739 + Syscall Matrix V2.8
14741 + |VERSION|CREATE |MODIFY |MIGRATE|CONTROL|EXPERIM| |SPECIAL|SPECIAL|
14742 + |STATS |DESTROY|ALTER |CHANGE |LIMIT |TEST | | | |
14743 + |INFO |SETUP | |MOVE | | | | | |
14744 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14745 + SYSTEM |VERSION|VSETUP |VHOST | | | | |DEVICE | |
14746 + HOST | 00| 01| 02| 03| 04| 05| | 06| 07|
14747 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14748 + CPU | |VPROC |PROCALT|PROCMIG|PROCTRL| | |SCHED. | |
14749 + PROCESS| 08| 09| 10| 11| 12| 13| | 14| 15|
14750 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14751 + MEMORY | | | | |MEMCTRL| | |SWAP | |
14752 + | 16| 17| 18| 19| 20| 21| | 22| 23|
14753 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14754 + NETWORK| |VNET |NETALT |NETMIG |NETCTL | | |SERIAL | |
14755 + | 24| 25| 26| 27| 28| 29| | 30| 31|
14756 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14757 + DISK | | | |TAGMIG |DLIMIT | | |INODE | |
14758 + VFS | 32| 33| 34| 35| 36| 37| | 38| 39|
14759 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14760 + OTHER |VSTAT | | | | | | |VINFO | |
14761 + | 40| 41| 42| 43| 44| 45| | 46| 47|
14762 + =======+=======+=======+=======+=======+=======+=======+ +=======+=======+
14763 + SPECIAL|EVENT | | | |FLAGS | | |VSPACE | |
14764 + | 48| 49| 50| 51| 52| 53| | 54| 55|
14765 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14766 + SPECIAL|DEBUG | | | |RLIMIT |SYSCALL| | |COMPAT |
14767 + | 56| 57| 58| 59| 60|TEST 61| | 62| 63|
14768 + -------+-------+-------+-------+-------+-------+-------+ +-------+-------+
14772 +#define VC_CAT_VERSION 0
14774 +#define VC_CAT_VSETUP 1
14775 +#define VC_CAT_VHOST 2
14777 +#define VC_CAT_DEVICE 6
14779 +#define VC_CAT_VPROC 9
14780 +#define VC_CAT_PROCALT 10
14781 +#define VC_CAT_PROCMIG 11
14782 +#define VC_CAT_PROCTRL 12
14784 +#define VC_CAT_SCHED 14
14785 +#define VC_CAT_MEMCTRL 20
14787 +#define VC_CAT_VNET 25
14788 +#define VC_CAT_NETALT 26
14789 +#define VC_CAT_NETMIG 27
14790 +#define VC_CAT_NETCTRL 28
14792 +#define VC_CAT_TAGMIG 35
14793 +#define VC_CAT_DLIMIT 36
14794 +#define VC_CAT_INODE 38
14796 +#define VC_CAT_VSTAT 40
14797 +#define VC_CAT_VINFO 46
14798 +#define VC_CAT_EVENT 48
14800 +#define VC_CAT_FLAGS 52
14801 +#define VC_CAT_VSPACE 54
14802 +#define VC_CAT_DEBUG 56
14803 +#define VC_CAT_RLIMIT 60
14805 +#define VC_CAT_SYSTEST 61
14806 +#define VC_CAT_COMPAT 63
14808 +/* query version */
14810 +#define VCMD_get_version VC_CMD(VERSION, 0, 0)
14811 +#define VCMD_get_vci VC_CMD(VERSION, 1, 0)
14816 +#include <linux/errno.h>
14818 +#endif /* __KERNEL__ */
14820 +#endif /* _VX_SWITCH_H */
14822 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/tag_cmd.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/tag_cmd.h
14823 --- linux-2.6.33.1/include/linux/vserver/tag_cmd.h 1970-01-01 01:00:00.000000000 +0100
14824 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/tag_cmd.h 2010-02-25 12:02:16.000000000 +0100
14826 +#ifndef _VX_TAG_CMD_H
14827 +#define _VX_TAG_CMD_H
14830 +/* vinfo commands */
14832 +#define VCMD_task_tag VC_CMD(VINFO, 3, 0)
14835 +extern int vc_task_tag(uint32_t);
14837 +#endif /* __KERNEL__ */
14839 +/* context commands */
14841 +#define VCMD_tag_migrate VC_CMD(TAGMIG, 1, 0)
14844 +extern int vc_tag_migrate(uint32_t);
14846 +#endif /* __KERNEL__ */
14847 +#endif /* _VX_TAG_CMD_H */
14848 diff -NurpP --minimal linux-2.6.33.1/include/linux/vserver/tag.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/tag.h
14849 --- linux-2.6.33.1/include/linux/vserver/tag.h 1970-01-01 01:00:00.000000000 +0100
14850 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vserver/tag.h 2010-02-25 12:02:16.000000000 +0100
14855 +#include <linux/types.h>
14858 +#define DX_TAG(in) (IS_TAGGED(in))
14861 +#ifdef CONFIG_TAG_NFSD
14862 +#define DX_TAG_NFSD 1
14864 +#define DX_TAG_NFSD 0
14868 +#ifdef CONFIG_TAGGING_NONE
14870 +#define MAX_UID 0xFFFFFFFF
14871 +#define MAX_GID 0xFFFFFFFF
14873 +#define INOTAG_TAG(cond, uid, gid, tag) (0)
14875 +#define TAGINO_UID(cond, uid, tag) (uid)
14876 +#define TAGINO_GID(cond, gid, tag) (gid)
14881 +#ifdef CONFIG_TAGGING_GID16
14883 +#define MAX_UID 0xFFFFFFFF
14884 +#define MAX_GID 0x0000FFFF
14886 +#define INOTAG_TAG(cond, uid, gid, tag) \
14887 + ((cond) ? (((gid) >> 16) & 0xFFFF) : 0)
14889 +#define TAGINO_UID(cond, uid, tag) (uid)
14890 +#define TAGINO_GID(cond, gid, tag) \
14891 + ((cond) ? (((gid) & 0xFFFF) | ((tag) << 16)) : (gid))
14896 +#ifdef CONFIG_TAGGING_ID24
14898 +#define MAX_UID 0x00FFFFFF
14899 +#define MAX_GID 0x00FFFFFF
14901 +#define INOTAG_TAG(cond, uid, gid, tag) \
14902 + ((cond) ? ((((uid) >> 16) & 0xFF00) | (((gid) >> 24) & 0xFF)) : 0)
14904 +#define TAGINO_UID(cond, uid, tag) \
14905 + ((cond) ? (((uid) & 0xFFFFFF) | (((tag) & 0xFF00) << 16)) : (uid))
14906 +#define TAGINO_GID(cond, gid, tag) \
14907 + ((cond) ? (((gid) & 0xFFFFFF) | (((tag) & 0x00FF) << 24)) : (gid))
14912 +#ifdef CONFIG_TAGGING_UID16
14914 +#define MAX_UID 0x0000FFFF
14915 +#define MAX_GID 0xFFFFFFFF
14917 +#define INOTAG_TAG(cond, uid, gid, tag) \
14918 + ((cond) ? (((uid) >> 16) & 0xFFFF) : 0)
14920 +#define TAGINO_UID(cond, uid, tag) \
14921 + ((cond) ? (((uid) & 0xFFFF) | ((tag) << 16)) : (uid))
14922 +#define TAGINO_GID(cond, gid, tag) (gid)
14927 +#ifdef CONFIG_TAGGING_INTERN
14929 +#define MAX_UID 0xFFFFFFFF
14930 +#define MAX_GID 0xFFFFFFFF
14932 +#define INOTAG_TAG(cond, uid, gid, tag) \
14933 + ((cond) ? (tag) : 0)
14935 +#define TAGINO_UID(cond, uid, tag) (uid)
14936 +#define TAGINO_GID(cond, gid, tag) (gid)
14941 +#ifndef CONFIG_TAGGING_NONE
14942 +#define dx_current_fstag(sb) \
14943 + ((sb)->s_flags & MS_TAGGED ? dx_current_tag() : 0)
14945 +#define dx_current_fstag(sb) (0)
14948 +#ifndef CONFIG_TAGGING_INTERN
14949 +#define TAGINO_TAG(cond, tag) (0)
14951 +#define TAGINO_TAG(cond, tag) ((cond) ? (tag) : 0)
14954 +#define INOTAG_UID(cond, uid, gid) \
14955 + ((cond) ? ((uid) & MAX_UID) : (uid))
14956 +#define INOTAG_GID(cond, uid, gid) \
14957 + ((cond) ? ((gid) & MAX_GID) : (gid))
14960 +static inline uid_t dx_map_uid(uid_t uid)
14962 + if ((uid > MAX_UID) && (uid != -1))
14964 + return (uid & MAX_UID);
14967 +static inline gid_t dx_map_gid(gid_t gid)
14969 + if ((gid > MAX_GID) && (gid != -1))
14971 + return (gid & MAX_GID);
14979 +#define dx_notagcheck(sb) ((sb) && ((sb)->s_flags & MS_NOTAGCHECK))
14981 +int dx_parse_tag(char *string, tag_t *tag, int remove, int *mnt_flags,
14982 + unsigned long *flags);
14984 +#ifdef CONFIG_PROPAGATE
14986 +void __dx_propagate_tag(struct nameidata *nd, struct inode *inode);
14988 +#define dx_propagate_tag(n, i) __dx_propagate_tag(n, i)
14991 +#define dx_propagate_tag(n, i) do { } while (0)
14994 +#endif /* _DX_TAG_H */
14995 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_inet6.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_inet6.h
14996 --- linux-2.6.33.1/include/linux/vs_inet6.h 1970-01-01 01:00:00.000000000 +0100
14997 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_inet6.h 2010-02-25 14:47:08.000000000 +0100
14999 +#ifndef _VS_INET6_H
15000 +#define _VS_INET6_H
15002 +#include "vserver/base.h"
15003 +#include "vserver/network.h"
15004 +#include "vserver/debug.h"
15006 +#include <net/ipv6.h>
15008 +#define NXAV6(a) &(a)->ip, &(a)->mask, (a)->prefix, (a)->type
15009 +#define NXAV6_FMT "[%pI6/%pI6/%d:%04x]"
15012 +#ifdef CONFIG_IPV6
15015 +int v6_addr_match(struct nx_addr_v6 *nxa,
15016 + const struct in6_addr *addr, uint16_t mask)
15020 + switch (nxa->type & mask) {
15021 + case NXA_TYPE_MASK:
15022 + ret = ipv6_masked_addr_cmp(&nxa->ip, &nxa->mask, addr);
15024 + case NXA_TYPE_ADDR:
15025 + ret = ipv6_addr_equal(&nxa->ip, addr);
15027 + case NXA_TYPE_ANY:
15031 + vxdprintk(VXD_CBIT(net, 0),
15032 + "v6_addr_match(%p" NXAV6_FMT ",%pI6,%04x) = %d",
15033 + nxa, NXAV6(nxa), addr, mask, ret);
15038 +int v6_addr_in_nx_info(struct nx_info *nxi,
15039 + const struct in6_addr *addr, uint16_t mask)
15041 + struct nx_addr_v6 *nxa;
15046 + for (nxa = &nxi->v6; nxa; nxa = nxa->next)
15047 + if (v6_addr_match(nxa, addr, mask))
15051 + vxdprintk(VXD_CBIT(net, 0),
15052 + "v6_addr_in_nx_info(%p[#%u],%pI6,%04x) = %d",
15053 + nxi, nxi ? nxi->nx_id : 0, addr, mask, ret);
15058 +int v6_nx_addr_match(struct nx_addr_v6 *nxa, struct nx_addr_v6 *addr, uint16_t mask)
15060 + /* FIXME: needs full range checks */
15061 + return v6_addr_match(nxa, &addr->ip, mask);
15065 +int v6_nx_addr_in_nx_info(struct nx_info *nxi, struct nx_addr_v6 *nxa, uint16_t mask)
15067 + struct nx_addr_v6 *ptr;
15069 + for (ptr = &nxi->v6; ptr; ptr = ptr->next)
15070 + if (v6_nx_addr_match(ptr, nxa, mask))
15077 + * Check if a given address matches for a socket
15079 + * nxi: the socket's nx_info if any
15080 + * addr: to be verified address
15083 +int v6_sock_addr_match (
15084 + struct nx_info *nxi,
15085 + struct inet_sock *inet,
15086 + struct in6_addr *addr)
15088 + struct sock *sk = &inet->sk;
15089 + struct in6_addr *saddr = inet6_rcv_saddr(sk);
15091 + if (!ipv6_addr_any(addr) &&
15092 + ipv6_addr_equal(saddr, addr))
15094 + if (ipv6_addr_any(saddr))
15095 + return v6_addr_in_nx_info(nxi, addr, -1);
15100 + * check if address is covered by socket
15102 + * sk: the socket to check against
15103 + * addr: the address in question (must be != 0)
15107 +int __v6_addr_match_socket(const struct sock *sk, struct nx_addr_v6 *nxa)
15109 + struct nx_info *nxi = sk->sk_nx_info;
15110 + struct in6_addr *saddr = inet6_rcv_saddr(sk);
15112 + vxdprintk(VXD_CBIT(net, 5),
15113 + "__v6_addr_in_socket(%p," NXAV6_FMT ") %p:%pI6 %p;%lx",
15114 + sk, NXAV6(nxa), nxi, saddr, sk->sk_socket,
15115 + (sk->sk_socket?sk->sk_socket->flags:0));
15117 + if (!ipv6_addr_any(saddr)) { /* direct address match */
15118 + return v6_addr_match(nxa, saddr, -1);
15119 + } else if (nxi) { /* match against nx_info */
15120 + return v6_nx_addr_in_nx_info(nxi, nxa, -1);
15121 + } else { /* unrestricted any socket */
15127 +/* inet related checks and helpers */
15131 +struct net_device;
15135 +#include <linux/netdevice.h>
15136 +#include <linux/inetdevice.h>
15137 +#include <net/inet_timewait_sock.h>
15140 +int dev_in_nx_info(struct net_device *, struct nx_info *);
15141 +int v6_dev_in_nx_info(struct net_device *, struct nx_info *);
15142 +int nx_v6_addr_conflict(struct nx_info *, struct nx_info *);
15147 +int v6_ifa_in_nx_info(struct inet6_ifaddr *ifa, struct nx_info *nxi)
15153 + return v6_addr_in_nx_info(nxi, &ifa->addr, -1);
15157 +int nx_v6_ifa_visible(struct nx_info *nxi, struct inet6_ifaddr *ifa)
15159 + vxdprintk(VXD_CBIT(net, 1), "nx_v6_ifa_visible(%p[#%u],%p) %d",
15160 + nxi, nxi ? nxi->nx_id : 0, ifa,
15161 + nxi ? v6_ifa_in_nx_info(ifa, nxi) : 0);
15163 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15165 + if (v6_ifa_in_nx_info(ifa, nxi))
15171 +struct nx_v6_sock_addr {
15172 + struct in6_addr saddr; /* Address used for validation */
15173 + struct in6_addr baddr; /* Address used for socket bind */
15177 +int v6_map_sock_addr(struct inet_sock *inet, struct sockaddr_in6 *addr,
15178 + struct nx_v6_sock_addr *nsa)
15180 + // struct sock *sk = &inet->sk;
15181 + // struct nx_info *nxi = sk->sk_nx_info;
15182 + struct in6_addr saddr = addr->sin6_addr;
15183 + struct in6_addr baddr = saddr;
15185 + nsa->saddr = saddr;
15186 + nsa->baddr = baddr;
15191 +void v6_set_sock_addr(struct inet_sock *inet, struct nx_v6_sock_addr *nsa)
15193 + // struct sock *sk = &inet->sk;
15194 + // struct in6_addr *saddr = inet6_rcv_saddr(sk);
15196 + // *saddr = nsa->baddr;
15197 + // inet->inet_saddr = nsa->baddr;
15201 +int nx_info_has_v6(struct nx_info *nxi)
15205 + if (NX_IPV6(nxi))
15210 +#else /* CONFIG_IPV6 */
15213 +int nx_v6_dev_visible(struct nx_info *n, struct net_device *d)
15220 +int nx_v6_addr_conflict(struct nx_info *n, uint32_t a, const struct sock *s)
15226 +int v6_ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
15232 +int nx_info_has_v6(struct nx_info *nxi)
15237 +#endif /* CONFIG_IPV6 */
15239 +#define current_nx_info_has_v6() \
15240 + nx_info_has_v6(current_nx_info())
15243 +#warning duplicate inclusion
15245 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_inet.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_inet.h
15246 --- linux-2.6.33.1/include/linux/vs_inet.h 1970-01-01 01:00:00.000000000 +0100
15247 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_inet.h 2010-02-25 14:45:44.000000000 +0100
15249 +#ifndef _VS_INET_H
15250 +#define _VS_INET_H
15252 +#include "vserver/base.h"
15253 +#include "vserver/network.h"
15254 +#include "vserver/debug.h"
15256 +#define IPI_LOOPBACK htonl(INADDR_LOOPBACK)
15258 +#define NXAV4(a) NIPQUAD((a)->ip[0]), NIPQUAD((a)->ip[1]), \
15259 + NIPQUAD((a)->mask), (a)->type
15260 +#define NXAV4_FMT "[" NIPQUAD_FMT "-" NIPQUAD_FMT "/" NIPQUAD_FMT ":%04x]"
15264 +int v4_addr_match(struct nx_addr_v4 *nxa, __be32 addr, uint16_t tmask)
15266 + __be32 ip = nxa->ip[0].s_addr;
15267 + __be32 mask = nxa->mask.s_addr;
15268 + __be32 bcast = ip | ~mask;
15271 + switch (nxa->type & tmask) {
15272 + case NXA_TYPE_MASK:
15273 + ret = (ip == (addr & mask));
15275 + case NXA_TYPE_ADDR:
15279 + /* fall through to broadcast */
15280 + case NXA_MOD_BCAST:
15281 + ret = ((tmask & NXA_MOD_BCAST) && (addr == bcast));
15283 + case NXA_TYPE_RANGE:
15284 + ret = ((nxa->ip[0].s_addr <= addr) &&
15285 + (nxa->ip[1].s_addr > addr));
15287 + case NXA_TYPE_ANY:
15292 + vxdprintk(VXD_CBIT(net, 0),
15293 + "v4_addr_match(%p" NXAV4_FMT "," NIPQUAD_FMT ",%04x) = %d",
15294 + nxa, NXAV4(nxa), NIPQUAD(addr), tmask, ret);
15299 +int v4_addr_in_nx_info(struct nx_info *nxi, __be32 addr, uint16_t tmask)
15301 + struct nx_addr_v4 *nxa;
15308 + /* allow 127.0.0.1 when remapping lback */
15309 + if ((tmask & NXA_LOOPBACK) &&
15310 + (addr == IPI_LOOPBACK) &&
15311 + nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15314 + /* check for lback address */
15315 + if ((tmask & NXA_MOD_LBACK) &&
15316 + (nxi->v4_lback.s_addr == addr))
15319 + /* check for broadcast address */
15320 + if ((tmask & NXA_MOD_BCAST) &&
15321 + (nxi->v4_bcast.s_addr == addr))
15324 + /* check for v4 addresses */
15325 + for (nxa = &nxi->v4; nxa; nxa = nxa->next)
15326 + if (v4_addr_match(nxa, addr, tmask))
15330 + vxdprintk(VXD_CBIT(net, 0),
15331 + "v4_addr_in_nx_info(%p[#%u]," NIPQUAD_FMT ",%04x) = %d",
15332 + nxi, nxi ? nxi->nx_id : 0, NIPQUAD(addr), tmask, ret);
15337 +int v4_nx_addr_match(struct nx_addr_v4 *nxa, struct nx_addr_v4 *addr, uint16_t mask)
15339 + /* FIXME: needs full range checks */
15340 + return v4_addr_match(nxa, addr->ip[0].s_addr, mask);
15344 +int v4_nx_addr_in_nx_info(struct nx_info *nxi, struct nx_addr_v4 *nxa, uint16_t mask)
15346 + struct nx_addr_v4 *ptr;
15348 + for (ptr = &nxi->v4; ptr; ptr = ptr->next)
15349 + if (v4_nx_addr_match(ptr, nxa, mask))
15354 +#include <net/inet_sock.h>
15357 + * Check if a given address matches for a socket
15359 + * nxi: the socket's nx_info if any
15360 + * addr: to be verified address
15363 +int v4_sock_addr_match (
15364 + struct nx_info *nxi,
15365 + struct inet_sock *inet,
15368 + __be32 saddr = inet->inet_rcv_saddr;
15369 + __be32 bcast = nxi ? nxi->v4_bcast.s_addr : INADDR_BROADCAST;
15371 + if (addr && (saddr == addr || bcast == addr))
15374 + return v4_addr_in_nx_info(nxi, addr, NXA_MASK_BIND);
15379 +/* inet related checks and helpers */
15383 +struct net_device;
15386 +#ifdef CONFIG_INET
15388 +#include <linux/netdevice.h>
15389 +#include <linux/inetdevice.h>
15390 +#include <net/inet_sock.h>
15391 +#include <net/inet_timewait_sock.h>
15394 +int dev_in_nx_info(struct net_device *, struct nx_info *);
15395 +int v4_dev_in_nx_info(struct net_device *, struct nx_info *);
15396 +int nx_v4_addr_conflict(struct nx_info *, struct nx_info *);
15400 + * check if address is covered by socket
15402 + * sk: the socket to check against
15403 + * addr: the address in question (must be != 0)
15407 +int __v4_addr_match_socket(const struct sock *sk, struct nx_addr_v4 *nxa)
15409 + struct nx_info *nxi = sk->sk_nx_info;
15410 + __be32 saddr = inet_rcv_saddr(sk);
15412 + vxdprintk(VXD_CBIT(net, 5),
15413 + "__v4_addr_in_socket(%p," NXAV4_FMT ") %p:" NIPQUAD_FMT " %p;%lx",
15414 + sk, NXAV4(nxa), nxi, NIPQUAD(saddr), sk->sk_socket,
15415 + (sk->sk_socket?sk->sk_socket->flags:0));
15417 + if (saddr) { /* direct address match */
15418 + return v4_addr_match(nxa, saddr, -1);
15419 + } else if (nxi) { /* match against nx_info */
15420 + return v4_nx_addr_in_nx_info(nxi, nxa, -1);
15421 + } else { /* unrestricted any socket */
15429 +int nx_dev_visible(struct nx_info *nxi, struct net_device *dev)
15431 + vxdprintk(VXD_CBIT(net, 1), "nx_dev_visible(%p[#%u],%p »%s«) %d",
15432 + nxi, nxi ? nxi->nx_id : 0, dev, dev->name,
15433 + nxi ? dev_in_nx_info(dev, nxi) : 0);
15435 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15437 + if (dev_in_nx_info(dev, nxi))
15444 +int v4_ifa_in_nx_info(struct in_ifaddr *ifa, struct nx_info *nxi)
15450 + return v4_addr_in_nx_info(nxi, ifa->ifa_local, NXA_MASK_SHOW);
15454 +int nx_v4_ifa_visible(struct nx_info *nxi, struct in_ifaddr *ifa)
15456 + vxdprintk(VXD_CBIT(net, 1), "nx_v4_ifa_visible(%p[#%u],%p) %d",
15457 + nxi, nxi ? nxi->nx_id : 0, ifa,
15458 + nxi ? v4_ifa_in_nx_info(ifa, nxi) : 0);
15460 + if (!nx_info_flags(nxi, NXF_HIDE_NETIF, 0))
15462 + if (v4_ifa_in_nx_info(ifa, nxi))
15468 +struct nx_v4_sock_addr {
15469 + __be32 saddr; /* Address used for validation */
15470 + __be32 baddr; /* Address used for socket bind */
15474 +int v4_map_sock_addr(struct inet_sock *inet, struct sockaddr_in *addr,
15475 + struct nx_v4_sock_addr *nsa)
15477 + struct sock *sk = &inet->sk;
15478 + struct nx_info *nxi = sk->sk_nx_info;
15479 + __be32 saddr = addr->sin_addr.s_addr;
15480 + __be32 baddr = saddr;
15482 + vxdprintk(VXD_CBIT(net, 3),
15483 + "inet_bind(%p)* %p,%p;%lx " NIPQUAD_FMT,
15484 + sk, sk->sk_nx_info, sk->sk_socket,
15485 + (sk->sk_socket ? sk->sk_socket->flags : 0),
15489 + if (saddr == INADDR_ANY) {
15490 + if (nx_info_flags(nxi, NXF_SINGLE_IP, 0))
15491 + baddr = nxi->v4.ip[0].s_addr;
15492 + } else if (saddr == IPI_LOOPBACK) {
15493 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15494 + baddr = nxi->v4_lback.s_addr;
15495 + } else { /* normal address bind */
15496 + if (!v4_addr_in_nx_info(nxi, saddr, NXA_MASK_BIND))
15497 + return -EADDRNOTAVAIL;
15501 + vxdprintk(VXD_CBIT(net, 3),
15502 + "inet_bind(%p) " NIPQUAD_FMT ", " NIPQUAD_FMT,
15503 + sk, NIPQUAD(saddr), NIPQUAD(baddr));
15505 + nsa->saddr = saddr;
15506 + nsa->baddr = baddr;
15511 +void v4_set_sock_addr(struct inet_sock *inet, struct nx_v4_sock_addr *nsa)
15513 + inet->inet_saddr = nsa->baddr;
15514 + inet->inet_rcv_saddr = nsa->baddr;
15519 + * helper to simplify inet_lookup_listener
15521 + * nxi: the socket's nx_info if any
15522 + * addr: to be verified address
15523 + * saddr: socket address
15525 +static inline int v4_inet_addr_match (
15526 + struct nx_info *nxi,
15530 + if (addr && (saddr == addr))
15533 + return nxi ? v4_addr_in_nx_info(nxi, addr, NXA_MASK_BIND) : 1;
15537 +static inline __be32 nx_map_sock_lback(struct nx_info *nxi, __be32 addr)
15539 + if (nx_info_flags(nxi, NXF_HIDE_LBACK, 0) &&
15540 + (addr == nxi->v4_lback.s_addr))
15541 + return IPI_LOOPBACK;
15546 +int nx_info_has_v4(struct nx_info *nxi)
15550 + if (NX_IPV4(nxi))
15552 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0))
15557 +#else /* CONFIG_INET */
15560 +int nx_dev_visible(struct nx_info *n, struct net_device *d)
15566 +int nx_v4_addr_conflict(struct nx_info *n, uint32_t a, const struct sock *s)
15572 +int v4_ifa_in_nx_info(struct in_ifaddr *a, struct nx_info *n)
15578 +int nx_info_has_v4(struct nx_info *nxi)
15583 +#endif /* CONFIG_INET */
15585 +#define current_nx_info_has_v4() \
15586 + nx_info_has_v4(current_nx_info())
15589 +// #warning duplicate inclusion
15591 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_limit.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_limit.h
15592 --- linux-2.6.33.1/include/linux/vs_limit.h 1970-01-01 01:00:00.000000000 +0100
15593 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_limit.h 2010-02-25 12:02:16.000000000 +0100
15595 +#ifndef _VS_LIMIT_H
15596 +#define _VS_LIMIT_H
15598 +#include "vserver/limit.h"
15599 +#include "vserver/base.h"
15600 +#include "vserver/context.h"
15601 +#include "vserver/debug.h"
15602 +#include "vserver/context.h"
15603 +#include "vserver/limit_int.h"
15606 +#define vx_acc_cres(v, d, p, r) \
15607 + __vx_acc_cres(v, r, d, p, __FILE__, __LINE__)
15609 +#define vx_acc_cres_cond(x, d, p, r) \
15610 + __vx_acc_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \
15611 + r, d, p, __FILE__, __LINE__)
15614 +#define vx_add_cres(v, a, p, r) \
15615 + __vx_add_cres(v, r, a, p, __FILE__, __LINE__)
15616 +#define vx_sub_cres(v, a, p, r) vx_add_cres(v, -(a), p, r)
15618 +#define vx_add_cres_cond(x, a, p, r) \
15619 + __vx_add_cres(((x) == vx_current_xid()) ? current_vx_info() : 0, \
15620 + r, a, p, __FILE__, __LINE__)
15621 +#define vx_sub_cres_cond(x, a, p, r) vx_add_cres_cond(x, -(a), p, r)
15624 +/* process and file limits */
15626 +#define vx_nproc_inc(p) \
15627 + vx_acc_cres((p)->vx_info, 1, p, RLIMIT_NPROC)
15629 +#define vx_nproc_dec(p) \
15630 + vx_acc_cres((p)->vx_info,-1, p, RLIMIT_NPROC)
15632 +#define vx_files_inc(f) \
15633 + vx_acc_cres_cond((f)->f_xid, 1, f, RLIMIT_NOFILE)
15635 +#define vx_files_dec(f) \
15636 + vx_acc_cres_cond((f)->f_xid,-1, f, RLIMIT_NOFILE)
15638 +#define vx_locks_inc(l) \
15639 + vx_acc_cres_cond((l)->fl_xid, 1, l, RLIMIT_LOCKS)
15641 +#define vx_locks_dec(l) \
15642 + vx_acc_cres_cond((l)->fl_xid,-1, l, RLIMIT_LOCKS)
15644 +#define vx_openfd_inc(f) \
15645 + vx_acc_cres(current_vx_info(), 1, (void *)(long)(f), VLIMIT_OPENFD)
15647 +#define vx_openfd_dec(f) \
15648 + vx_acc_cres(current_vx_info(),-1, (void *)(long)(f), VLIMIT_OPENFD)
15651 +#define vx_cres_avail(v, n, r) \
15652 + __vx_cres_avail(v, r, n, __FILE__, __LINE__)
15655 +#define vx_nproc_avail(n) \
15656 + vx_cres_avail(current_vx_info(), n, RLIMIT_NPROC)
15658 +#define vx_files_avail(n) \
15659 + vx_cres_avail(current_vx_info(), n, RLIMIT_NOFILE)
15661 +#define vx_locks_avail(n) \
15662 + vx_cres_avail(current_vx_info(), n, RLIMIT_LOCKS)
15664 +#define vx_openfd_avail(n) \
15665 + vx_cres_avail(current_vx_info(), n, VLIMIT_OPENFD)
15668 +/* dentry limits */
15670 +#define vx_dentry_inc(d) do { \
15671 + if (atomic_read(&d->d_count) == 1) \
15672 + vx_acc_cres(current_vx_info(), 1, d, VLIMIT_DENTRY); \
15675 +#define vx_dentry_dec(d) do { \
15676 + if (atomic_read(&d->d_count) == 0) \
15677 + vx_acc_cres(current_vx_info(),-1, d, VLIMIT_DENTRY); \
15680 +#define vx_dentry_avail(n) \
15681 + vx_cres_avail(current_vx_info(), n, VLIMIT_DENTRY)
15684 +/* socket limits */
15686 +#define vx_sock_inc(s) \
15687 + vx_acc_cres((s)->sk_vx_info, 1, s, VLIMIT_NSOCK)
15689 +#define vx_sock_dec(s) \
15690 + vx_acc_cres((s)->sk_vx_info,-1, s, VLIMIT_NSOCK)
15692 +#define vx_sock_avail(n) \
15693 + vx_cres_avail(current_vx_info(), n, VLIMIT_NSOCK)
15696 +/* ipc resource limits */
15698 +#define vx_ipcmsg_add(v, u, a) \
15699 + vx_add_cres(v, a, u, RLIMIT_MSGQUEUE)
15701 +#define vx_ipcmsg_sub(v, u, a) \
15702 + vx_sub_cres(v, a, u, RLIMIT_MSGQUEUE)
15704 +#define vx_ipcmsg_avail(v, a) \
15705 + vx_cres_avail(v, a, RLIMIT_MSGQUEUE)
15708 +#define vx_ipcshm_add(v, k, a) \
15709 + vx_add_cres(v, a, (void *)(long)(k), VLIMIT_SHMEM)
15711 +#define vx_ipcshm_sub(v, k, a) \
15712 + vx_sub_cres(v, a, (void *)(long)(k), VLIMIT_SHMEM)
15714 +#define vx_ipcshm_avail(v, a) \
15715 + vx_cres_avail(v, a, VLIMIT_SHMEM)
15718 +#define vx_semary_inc(a) \
15719 + vx_acc_cres(current_vx_info(), 1, a, VLIMIT_SEMARY)
15721 +#define vx_semary_dec(a) \
15722 + vx_acc_cres(current_vx_info(), -1, a, VLIMIT_SEMARY)
15725 +#define vx_nsems_add(a,n) \
15726 + vx_add_cres(current_vx_info(), n, a, VLIMIT_NSEMS)
15728 +#define vx_nsems_sub(a,n) \
15729 + vx_sub_cres(current_vx_info(), n, a, VLIMIT_NSEMS)
15733 +#warning duplicate inclusion
15735 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_memory.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_memory.h
15736 --- linux-2.6.33.1/include/linux/vs_memory.h 1970-01-01 01:00:00.000000000 +0100
15737 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_memory.h 2010-02-25 12:02:16.000000000 +0100
15739 +#ifndef _VS_MEMORY_H
15740 +#define _VS_MEMORY_H
15742 +#include "vserver/limit.h"
15743 +#include "vserver/base.h"
15744 +#include "vserver/context.h"
15745 +#include "vserver/debug.h"
15746 +#include "vserver/context.h"
15747 +#include "vserver/limit_int.h"
15750 +#define __acc_add_long(a, v) (*(v) += (a))
15751 +#define __acc_inc_long(v) (++*(v))
15752 +#define __acc_dec_long(v) (--*(v))
15754 +#if NR_CPUS >= CONFIG_SPLIT_PTLOCK_CPUS
15755 +#define __acc_add_atomic(a, v) atomic_long_add(a, v)
15756 +#define __acc_inc_atomic(v) atomic_long_inc(v)
15757 +#define __acc_dec_atomic(v) atomic_long_dec(v)
15758 +#else /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
15759 +#define __acc_add_atomic(a, v) __acc_add_long(a, v)
15760 +#define __acc_inc_atomic(v) __acc_inc_long(v)
15761 +#define __acc_dec_atomic(v) __acc_dec_long(v)
15762 +#endif /* NR_CPUS < CONFIG_SPLIT_PTLOCK_CPUS */
15765 +#define vx_acc_page(m, d, v, r) do { \
15767 + __acc_inc_long(&(m)->v); \
15769 + __acc_dec_long(&(m)->v); \
15770 + __vx_acc_cres(m->mm_vx_info, r, d, m, __FILE__, __LINE__); \
15773 +#define vx_acc_page_atomic(m, d, v, r) do { \
15775 + __acc_inc_atomic(&(m)->v); \
15777 + __acc_dec_atomic(&(m)->v); \
15778 + __vx_acc_cres(m->mm_vx_info, r, d, m, __FILE__, __LINE__); \
15782 +#define vx_acc_pages(m, p, v, r) do { \
15783 + unsigned long __p = (p); \
15784 + __acc_add_long(__p, &(m)->v); \
15785 + __vx_add_cres(m->mm_vx_info, r, __p, m, __FILE__, __LINE__); \
15788 +#define vx_acc_pages_atomic(m, p, v, r) do { \
15789 + unsigned long __p = (p); \
15790 + __acc_add_atomic(__p, &(m)->v); \
15791 + __vx_add_cres(m->mm_vx_info, r, __p, m, __FILE__, __LINE__); \
15796 +#define vx_acc_vmpage(m, d) \
15797 + vx_acc_page(m, d, total_vm, RLIMIT_AS)
15798 +#define vx_acc_vmlpage(m, d) \
15799 + vx_acc_page(m, d, locked_vm, RLIMIT_MEMLOCK)
15800 +#define vx_acc_file_rsspage(m, d) \
15801 + vx_acc_page_atomic(m, d, _file_rss, VLIMIT_MAPPED)
15802 +#define vx_acc_anon_rsspage(m, d) \
15803 + vx_acc_page_atomic(m, d, _anon_rss, VLIMIT_ANON)
15805 +#define vx_acc_vmpages(m, p) \
15806 + vx_acc_pages(m, p, total_vm, RLIMIT_AS)
15807 +#define vx_acc_vmlpages(m, p) \
15808 + vx_acc_pages(m, p, locked_vm, RLIMIT_MEMLOCK)
15809 +#define vx_acc_file_rsspages(m, p) \
15810 + vx_acc_pages_atomic(m, p, _file_rss, VLIMIT_MAPPED)
15811 +#define vx_acc_anon_rsspages(m, p) \
15812 + vx_acc_pages_atomic(m, p, _anon_rss, VLIMIT_ANON)
15814 +#define vx_pages_add(s, r, p) __vx_add_cres(s, r, p, 0, __FILE__, __LINE__)
15815 +#define vx_pages_sub(s, r, p) vx_pages_add(s, r, -(p))
15817 +#define vx_vmpages_inc(m) vx_acc_vmpage(m, 1)
15818 +#define vx_vmpages_dec(m) vx_acc_vmpage(m, -1)
15819 +#define vx_vmpages_add(m, p) vx_acc_vmpages(m, p)
15820 +#define vx_vmpages_sub(m, p) vx_acc_vmpages(m, -(p))
15822 +#define vx_vmlocked_inc(m) vx_acc_vmlpage(m, 1)
15823 +#define vx_vmlocked_dec(m) vx_acc_vmlpage(m, -1)
15824 +#define vx_vmlocked_add(m, p) vx_acc_vmlpages(m, p)
15825 +#define vx_vmlocked_sub(m, p) vx_acc_vmlpages(m, -(p))
15827 +#define vx_file_rsspages_inc(m) vx_acc_file_rsspage(m, 1)
15828 +#define vx_file_rsspages_dec(m) vx_acc_file_rsspage(m, -1)
15829 +#define vx_file_rsspages_add(m, p) vx_acc_file_rsspages(m, p)
15830 +#define vx_file_rsspages_sub(m, p) vx_acc_file_rsspages(m, -(p))
15832 +#define vx_anon_rsspages_inc(m) vx_acc_anon_rsspage(m, 1)
15833 +#define vx_anon_rsspages_dec(m) vx_acc_anon_rsspage(m, -1)
15834 +#define vx_anon_rsspages_add(m, p) vx_acc_anon_rsspages(m, p)
15835 +#define vx_anon_rsspages_sub(m, p) vx_acc_anon_rsspages(m, -(p))
15838 +#define vx_pages_avail(m, p, r) \
15839 + __vx_cres_avail((m)->mm_vx_info, r, p, __FILE__, __LINE__)
15841 +#define vx_vmpages_avail(m, p) vx_pages_avail(m, p, RLIMIT_AS)
15842 +#define vx_vmlocked_avail(m, p) vx_pages_avail(m, p, RLIMIT_MEMLOCK)
15843 +#define vx_anon_avail(m, p) vx_pages_avail(m, p, VLIMIT_ANON)
15844 +#define vx_mapped_avail(m, p) vx_pages_avail(m, p, VLIMIT_MAPPED)
15846 +#define vx_rss_avail(m, p) \
15847 + __vx_cres_array_avail((m)->mm_vx_info, VLA_RSS, p, __FILE__, __LINE__)
15851 + VXPT_UNKNOWN = 0,
15860 +#define vx_page_fault(mm, vma, type, ret)
15864 +void __vx_page_fault(struct mm_struct *mm,
15865 + struct vm_area_struct *vma, int type, int ret)
15867 + struct vx_info *vxi = mm->mm_vx_info;
15870 + static char *page_type[6] =
15871 + { "UNKNOWN", "ANON", "NONE", "FILE", "SWAP", "WRITE" };
15872 + static char *page_what[4] =
15873 + { "FAULT_OOM", "FAULT_SIGBUS", "FAULT_MINOR", "FAULT_MAJOR" };
15879 + what = (ret & 0x3);
15881 +/* printk("[%d] page[%d][%d] %2x %s %s\n", vxi->vx_id,
15882 + type, what, ret, page_type[type], page_what[what]);
15884 + if (ret & VM_FAULT_WRITE)
15886 + atomic_inc(&vxi->cacct.page[type][what]);
15889 +#define vx_page_fault(mm, vma, type, ret) __vx_page_fault(mm, vma, type, ret)
15893 +extern unsigned long vx_badness(struct task_struct *task, struct mm_struct *mm);
15896 +#warning duplicate inclusion
15898 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_network.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_network.h
15899 --- linux-2.6.33.1/include/linux/vs_network.h 1970-01-01 01:00:00.000000000 +0100
15900 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_network.h 2010-02-25 12:02:16.000000000 +0100
15902 +#ifndef _NX_VS_NETWORK_H
15903 +#define _NX_VS_NETWORK_H
15905 +#include "vserver/context.h"
15906 +#include "vserver/network.h"
15907 +#include "vserver/base.h"
15908 +#include "vserver/check.h"
15909 +#include "vserver/debug.h"
15911 +#include <linux/sched.h>
15914 +#define get_nx_info(i) __get_nx_info(i, __FILE__, __LINE__)
15916 +static inline struct nx_info *__get_nx_info(struct nx_info *nxi,
15917 + const char *_file, int _line)
15922 + vxlprintk(VXD_CBIT(nid, 2), "get_nx_info(%p[#%d.%d])",
15923 + nxi, nxi ? nxi->nx_id : 0,
15924 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15927 + atomic_inc(&nxi->nx_usecnt);
15932 +extern void free_nx_info(struct nx_info *);
15934 +#define put_nx_info(i) __put_nx_info(i, __FILE__, __LINE__)
15936 +static inline void __put_nx_info(struct nx_info *nxi, const char *_file, int _line)
15941 + vxlprintk(VXD_CBIT(nid, 2), "put_nx_info(%p[#%d.%d])",
15942 + nxi, nxi ? nxi->nx_id : 0,
15943 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15946 + if (atomic_dec_and_test(&nxi->nx_usecnt))
15947 + free_nx_info(nxi);
15951 +#define init_nx_info(p, i) __init_nx_info(p, i, __FILE__, __LINE__)
15953 +static inline void __init_nx_info(struct nx_info **nxp, struct nx_info *nxi,
15954 + const char *_file, int _line)
15957 + vxlprintk(VXD_CBIT(nid, 3),
15958 + "init_nx_info(%p[#%d.%d])",
15959 + nxi, nxi ? nxi->nx_id : 0,
15960 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15963 + atomic_inc(&nxi->nx_usecnt);
15969 +#define set_nx_info(p, i) __set_nx_info(p, i, __FILE__, __LINE__)
15971 +static inline void __set_nx_info(struct nx_info **nxp, struct nx_info *nxi,
15972 + const char *_file, int _line)
15974 + struct nx_info *nxo;
15979 + vxlprintk(VXD_CBIT(nid, 3), "set_nx_info(%p[#%d.%d])",
15980 + nxi, nxi ? nxi->nx_id : 0,
15981 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
15984 + atomic_inc(&nxi->nx_usecnt);
15985 + nxo = xchg(nxp, nxi);
15989 +#define clr_nx_info(p) __clr_nx_info(p, __FILE__, __LINE__)
15991 +static inline void __clr_nx_info(struct nx_info **nxp,
15992 + const char *_file, int _line)
15994 + struct nx_info *nxo;
15996 + nxo = xchg(nxp, NULL);
16000 + vxlprintk(VXD_CBIT(nid, 3), "clr_nx_info(%p[#%d.%d])",
16001 + nxo, nxo ? nxo->nx_id : 0,
16002 + nxo ? atomic_read(&nxo->nx_usecnt) : 0,
16005 + if (atomic_dec_and_test(&nxo->nx_usecnt))
16006 + free_nx_info(nxo);
16010 +#define claim_nx_info(v, p) __claim_nx_info(v, p, __FILE__, __LINE__)
16012 +static inline void __claim_nx_info(struct nx_info *nxi,
16013 + struct task_struct *task, const char *_file, int _line)
16015 + vxlprintk(VXD_CBIT(nid, 3), "claim_nx_info(%p[#%d.%d.%d]) %p",
16016 + nxi, nxi ? nxi->nx_id : 0,
16017 + nxi?atomic_read(&nxi->nx_usecnt):0,
16018 + nxi?atomic_read(&nxi->nx_tasks):0,
16019 + task, _file, _line);
16021 + atomic_inc(&nxi->nx_tasks);
16025 +extern void unhash_nx_info(struct nx_info *);
16027 +#define release_nx_info(v, p) __release_nx_info(v, p, __FILE__, __LINE__)
16029 +static inline void __release_nx_info(struct nx_info *nxi,
16030 + struct task_struct *task, const char *_file, int _line)
16032 + vxlprintk(VXD_CBIT(nid, 3), "release_nx_info(%p[#%d.%d.%d]) %p",
16033 + nxi, nxi ? nxi->nx_id : 0,
16034 + nxi ? atomic_read(&nxi->nx_usecnt) : 0,
16035 + nxi ? atomic_read(&nxi->nx_tasks) : 0,
16036 + task, _file, _line);
16040 + if (atomic_dec_and_test(&nxi->nx_tasks))
16041 + unhash_nx_info(nxi);
16045 +#define task_get_nx_info(i) __task_get_nx_info(i, __FILE__, __LINE__)
16047 +static __inline__ struct nx_info *__task_get_nx_info(struct task_struct *p,
16048 + const char *_file, int _line)
16050 + struct nx_info *nxi;
16053 + vxlprintk(VXD_CBIT(nid, 5), "task_get_nx_info(%p)",
16054 + p, _file, _line);
16055 + nxi = __get_nx_info(p->nx_info, _file, _line);
16061 +static inline void exit_nx_info(struct task_struct *p)
16064 + release_nx_info(p->nx_info, p);
16069 +#warning duplicate inclusion
16071 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_pid.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_pid.h
16072 --- linux-2.6.33.1/include/linux/vs_pid.h 1970-01-01 01:00:00.000000000 +0100
16073 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_pid.h 2010-02-25 12:02:16.000000000 +0100
16078 +#include "vserver/base.h"
16079 +#include "vserver/check.h"
16080 +#include "vserver/context.h"
16081 +#include "vserver/debug.h"
16082 +#include "vserver/pid.h"
16083 +#include <linux/pid_namespace.h>
16086 +#define VXF_FAKE_INIT (VXF_INFO_INIT | VXF_STATE_INIT)
16089 +int vx_proc_task_visible(struct task_struct *task)
16091 + if ((task->pid == 1) &&
16092 + !vx_flags(VXF_FAKE_INIT, VXF_FAKE_INIT))
16093 + /* show a blend through init */
16095 + if (vx_check(vx_task_xid(task), VS_WATCH | VS_IDENT))
16102 +#define find_task_by_real_pid(pid) find_task_by_pid_ns(pid, &init_pid_ns)
16107 +struct task_struct *vx_find_proc_task_by_pid(int pid)
16109 + struct task_struct *task = find_task_by_real_pid(pid);
16111 + if (task && !vx_proc_task_visible(task)) {
16112 + vxdprintk(VXD_CBIT(misc, 6),
16113 + "dropping task (find) %p[#%u,%u] for %p[#%u,%u]",
16114 + task, task->xid, task->pid,
16115 + current, current->xid, current->pid);
16124 +struct task_struct *vx_get_proc_task(struct inode *inode, struct pid *pid)
16126 + struct task_struct *task = get_pid_task(pid, PIDTYPE_PID);
16128 + if (task && !vx_proc_task_visible(task)) {
16129 + vxdprintk(VXD_CBIT(misc, 6),
16130 + "dropping task (get) %p[#%u,%u] for %p[#%u,%u]",
16131 + task, task->xid, task->pid,
16132 + current, current->xid, current->pid);
16133 + put_task_struct(task);
16142 +struct task_struct *vx_child_reaper(struct task_struct *p)
16144 + struct vx_info *vxi = p->vx_info;
16145 + struct task_struct *reaper = child_reaper(p);
16150 + BUG_ON(!p->vx_info->vx_reaper);
16152 + /* child reaper for the guest reaper */
16153 + if (vxi->vx_reaper == p)
16156 + reaper = vxi->vx_reaper;
16158 + vxdprintk(VXD_CBIT(xid, 7),
16159 + "vx_child_reaper(%p[#%u,%u]) = %p[#%u,%u]",
16160 + p, p->xid, p->pid, reaper, reaper->xid, reaper->pid);
16168 +#warning duplicate inclusion
16170 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_sched.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_sched.h
16171 --- linux-2.6.33.1/include/linux/vs_sched.h 1970-01-01 01:00:00.000000000 +0100
16172 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_sched.h 2010-02-25 12:02:16.000000000 +0100
16174 +#ifndef _VS_SCHED_H
16175 +#define _VS_SCHED_H
16177 +#include "vserver/base.h"
16178 +#include "vserver/context.h"
16179 +#include "vserver/sched.h"
16182 +#define VAVAVOOM_RATIO 50
16184 +#define MAX_PRIO_BIAS 20
16185 +#define MIN_PRIO_BIAS -20
16188 +#ifdef CONFIG_VSERVER_HARDCPU
16191 + * effective_prio - return the priority that is based on the static
16192 + * priority but is modified by bonuses/penalties.
16194 + * We scale the actual sleep average [0 .... MAX_SLEEP_AVG]
16195 + * into a -4 ... 0 ... +4 bonus/penalty range.
16197 + * Additionally, we scale another amount based on the number of
16198 + * CPU tokens currently held by the context, if the process is
16199 + * part of a context (and the appropriate SCHED flag is set).
16200 + * This ranges from -5 ... 0 ... +15, quadratically.
16202 + * So, the total bonus is -9 .. 0 .. +19
16203 + * We use ~50% of the full 0...39 priority range so that:
16205 + * 1) nice +19 interactive tasks do not preempt nice 0 CPU hogs.
16206 + * 2) nice -20 CPU hogs do not get preempted by nice 0 tasks.
16207 + * unless that context is far exceeding its CPU allocation.
16209 + * Both properties are important to certain workloads.
16212 +int vx_effective_vavavoom(struct _vx_sched_pc *sched_pc, int max_prio)
16214 + int vavavoom, max;
16216 + /* lots of tokens = lots of vavavoom
16217 + * no tokens = no vavavoom */
16218 + if ((vavavoom = sched_pc->tokens) >= 0) {
16219 + max = sched_pc->tokens_max;
16220 + vavavoom = max - vavavoom;
16222 + vavavoom = max_prio * VAVAVOOM_RATIO / 100
16223 + * (vavavoom*vavavoom - (max >> 2)) / max;
16231 +int vx_adjust_prio(struct task_struct *p, int prio, int max_user)
16233 + struct vx_info *vxi = p->vx_info;
16234 + struct _vx_sched_pc *sched_pc;
16239 + sched_pc = &vx_cpu(vxi, sched_pc);
16240 + if (vx_info_flags(vxi, VXF_SCHED_PRIO, 0)) {
16241 + int vavavoom = vx_effective_vavavoom(sched_pc, max_user);
16243 + sched_pc->vavavoom = vavavoom;
16244 + prio += vavavoom;
16246 + prio += sched_pc->prio_bias;
16250 +#else /* !CONFIG_VSERVER_HARDCPU */
16253 +int vx_adjust_prio(struct task_struct *p, int prio, int max_user)
16255 + struct vx_info *vxi = p->vx_info;
16258 + prio += vx_cpu(vxi, sched_pc).prio_bias;
16262 +#endif /* CONFIG_VSERVER_HARDCPU */
16265 +static inline void vx_account_user(struct vx_info *vxi,
16266 + cputime_t cputime, int nice)
16270 + vx_cpu(vxi, sched_pc).user_ticks += cputime;
16273 +static inline void vx_account_system(struct vx_info *vxi,
16274 + cputime_t cputime, int idle)
16278 + vx_cpu(vxi, sched_pc).sys_ticks += cputime;
16282 +#warning duplicate inclusion
16284 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_socket.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_socket.h
16285 --- linux-2.6.33.1/include/linux/vs_socket.h 1970-01-01 01:00:00.000000000 +0100
16286 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_socket.h 2010-02-25 12:02:16.000000000 +0100
16288 +#ifndef _VS_SOCKET_H
16289 +#define _VS_SOCKET_H
16291 +#include "vserver/debug.h"
16292 +#include "vserver/base.h"
16293 +#include "vserver/cacct.h"
16294 +#include "vserver/context.h"
16295 +#include "vserver/tag.h"
16298 +/* socket accounting */
16300 +#include <linux/socket.h>
16302 +static inline int vx_sock_type(int family)
16304 + switch (family) {
16306 + return VXA_SOCK_UNSPEC;
16308 + return VXA_SOCK_UNIX;
16310 + return VXA_SOCK_INET;
16312 + return VXA_SOCK_INET6;
16314 + return VXA_SOCK_PACKET;
16316 + return VXA_SOCK_OTHER;
16320 +#define vx_acc_sock(v, f, p, s) \
16321 + __vx_acc_sock(v, f, p, s, __FILE__, __LINE__)
16323 +static inline void __vx_acc_sock(struct vx_info *vxi,
16324 + int family, int pos, int size, char *file, int line)
16327 + int type = vx_sock_type(family);
16329 + atomic_long_inc(&vxi->cacct.sock[type][pos].count);
16330 + atomic_long_add(size, &vxi->cacct.sock[type][pos].total);
16334 +#define vx_sock_recv(sk, s) \
16335 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 0, s)
16336 +#define vx_sock_send(sk, s) \
16337 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 1, s)
16338 +#define vx_sock_fail(sk, s) \
16339 + vx_acc_sock((sk)->sk_vx_info, (sk)->sk_family, 2, s)
16342 +#define sock_vx_init(s) do { \
16343 + (s)->sk_xid = 0; \
16344 + (s)->sk_vx_info = NULL; \
16347 +#define sock_nx_init(s) do { \
16348 + (s)->sk_nid = 0; \
16349 + (s)->sk_nx_info = NULL; \
16353 +#warning duplicate inclusion
16355 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_tag.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_tag.h
16356 --- linux-2.6.33.1/include/linux/vs_tag.h 1970-01-01 01:00:00.000000000 +0100
16357 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_tag.h 2010-02-25 12:02:16.000000000 +0100
16362 +#include <linux/vserver/tag.h>
16364 +/* check conditions */
16366 +#define DX_ADMIN 0x0001
16367 +#define DX_WATCH 0x0002
16368 +#define DX_HOSTID 0x0008
16370 +#define DX_IDENT 0x0010
16372 +#define DX_ARG_MASK 0x0010
16375 +#define dx_task_tag(t) ((t)->tag)
16377 +#define dx_current_tag() dx_task_tag(current)
16379 +#define dx_check(c, m) __dx_check(dx_current_tag(), c, m)
16381 +#define dx_weak_check(c, m) ((m) ? dx_check(c, m) : 1)
16385 + * check current context for ADMIN/WATCH and
16386 + * optionally against supplied argument
16388 +static inline int __dx_check(tag_t cid, tag_t id, unsigned int mode)
16390 + if (mode & DX_ARG_MASK) {
16391 + if ((mode & DX_IDENT) && (id == cid))
16394 + return (((mode & DX_ADMIN) && (cid == 0)) ||
16395 + ((mode & DX_WATCH) && (cid == 1)) ||
16396 + ((mode & DX_HOSTID) && (id == 0)));
16400 +int dx_permission(const struct inode *inode, int mask);
16404 +#warning duplicate inclusion
16406 diff -NurpP --minimal linux-2.6.33.1/include/linux/vs_time.h linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_time.h
16407 --- linux-2.6.33.1/include/linux/vs_time.h 1970-01-01 01:00:00.000000000 +0100
16408 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/linux/vs_time.h 2010-02-25 12:02:16.000000000 +0100
16410 +#ifndef _VS_TIME_H
16411 +#define _VS_TIME_H
16414 +/* time faking stuff */
16416 +#ifdef CONFIG_VSERVER_VTIME
16418 +extern void vx_gettimeofday(struct timeval *tv);
16419 +extern int vx_settimeofday(struct timespec *ts);
16422 +#define vx_gettimeofday(t) do_gettimeofday(t)
16423 +#define vx_settimeofday(t) do_settimeofday(t)
16427 +#warning duplicate inclusion
16429 diff -NurpP --minimal linux-2.6.33.1/include/net/addrconf.h linux-2.6.33.1-vs2.3.0.36.30.4/include/net/addrconf.h
16430 --- linux-2.6.33.1/include/net/addrconf.h 2009-12-03 20:02:57.000000000 +0100
16431 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/net/addrconf.h 2010-02-25 12:02:16.000000000 +0100
16432 @@ -84,7 +84,8 @@ extern int ipv6_dev_get_saddr(struct n
16433 struct net_device *dev,
16434 const struct in6_addr *daddr,
16435 unsigned int srcprefs,
16436 - struct in6_addr *saddr);
16437 + struct in6_addr *saddr,
16438 + struct nx_info *nxi);
16439 extern int ipv6_get_lladdr(struct net_device *dev,
16440 struct in6_addr *addr,
16441 unsigned char banned_flags);
16442 diff -NurpP --minimal linux-2.6.33.1/include/net/af_unix.h linux-2.6.33.1-vs2.3.0.36.30.4/include/net/af_unix.h
16443 --- linux-2.6.33.1/include/net/af_unix.h 2008-12-25 00:26:37.000000000 +0100
16444 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/net/af_unix.h 2010-02-25 12:02:16.000000000 +0100
16446 #include <linux/socket.h>
16447 #include <linux/un.h>
16448 #include <linux/mutex.h>
16449 +#include <linux/vs_base.h>
16450 #include <net/sock.h>
16452 extern void unix_inflight(struct file *fp);
16453 diff -NurpP --minimal linux-2.6.33.1/include/net/inet_timewait_sock.h linux-2.6.33.1-vs2.3.0.36.30.4/include/net/inet_timewait_sock.h
16454 --- linux-2.6.33.1/include/net/inet_timewait_sock.h 2010-02-25 11:52:08.000000000 +0100
16455 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/net/inet_timewait_sock.h 2010-02-25 12:02:16.000000000 +0100
16456 @@ -117,6 +117,10 @@ struct inet_timewait_sock {
16457 #define tw_hash __tw_common.skc_hash
16458 #define tw_prot __tw_common.skc_prot
16459 #define tw_net __tw_common.skc_net
16460 +#define tw_xid __tw_common.skc_xid
16461 +#define tw_vx_info __tw_common.skc_vx_info
16462 +#define tw_nid __tw_common.skc_nid
16463 +#define tw_nx_info __tw_common.skc_nx_info
16465 volatile unsigned char tw_substate;
16466 /* 3 bits hole, try to pack */
16467 diff -NurpP --minimal linux-2.6.33.1/include/net/route.h linux-2.6.33.1-vs2.3.0.36.30.4/include/net/route.h
16468 --- linux-2.6.33.1/include/net/route.h 2010-02-25 11:52:08.000000000 +0100
16469 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/net/route.h 2010-02-25 12:02:16.000000000 +0100
16470 @@ -132,6 +132,9 @@ static inline void ip_rt_put(struct rtab
16471 dst_release(&rt->u.dst);
16474 +#include <linux/vs_base.h>
16475 +#include <linux/vs_inet.h>
16477 #define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
16479 extern const __u8 ip_tos2prio[16];
16480 @@ -141,6 +144,9 @@ static inline char rt_tos2priority(u8 to
16481 return ip_tos2prio[IPTOS_TOS(tos)>>1];
16484 +extern int ip_v4_find_src(struct net *net, struct nx_info *,
16485 + struct rtable **, struct flowi *);
16487 static inline int ip_route_connect(struct rtable **rp, __be32 dst,
16488 __be32 src, u32 tos, int oif, u8 protocol,
16489 __be16 sport, __be16 dport, struct sock *sk,
16490 @@ -158,11 +164,24 @@ static inline int ip_route_connect(struc
16493 struct net *net = sock_net(sk);
16494 + struct nx_info *nx_info = current_nx_info();
16496 if (inet_sk(sk)->transparent)
16497 fl.flags |= FLOWI_FLAG_ANYSRC;
16499 - if (!dst || !src) {
16501 + nx_info = sk->sk_nx_info;
16503 + vxdprintk(VXD_CBIT(net, 4),
16504 + "ip_route_connect(%p) %p,%p;%lx",
16505 + sk, nx_info, sk->sk_socket,
16506 + (sk->sk_socket?sk->sk_socket->flags:0));
16508 + err = ip_v4_find_src(net, nx_info, rp, &fl);
16512 + if (!fl.fl4_dst || !fl.fl4_src) {
16513 err = __ip_route_output_key(net, rp, &fl);
16516 diff -NurpP --minimal linux-2.6.33.1/include/net/sock.h linux-2.6.33.1-vs2.3.0.36.30.4/include/net/sock.h
16517 --- linux-2.6.33.1/include/net/sock.h 2010-02-25 11:52:08.000000000 +0100
16518 +++ linux-2.6.33.1-vs2.3.0.36.30.4/include/net/sock.h 2010-02-25 12:02:16.000000000 +0100
16519 @@ -149,6 +149,10 @@ struct sock_common {
16520 #ifdef CONFIG_NET_NS
16521 struct net *skc_net;
16524 + struct vx_info *skc_vx_info;
16526 + struct nx_info *skc_nx_info;
16530 @@ -236,6 +240,10 @@ struct sock {
16531 #define sk_bind_node __sk_common.skc_bind_node
16532 #define sk_prot __sk_common.skc_prot
16533 #define sk_net __sk_common.skc_net
16534 +#define sk_xid __sk_common.skc_xid
16535 +#define sk_vx_info __sk_common.skc_vx_info
16536 +#define sk_nid __sk_common.skc_nid
16537 +#define sk_nx_info __sk_common.skc_nx_info
16538 kmemcheck_bitfield_begin(flags);
16539 unsigned int sk_shutdown : 2,
16541 diff -NurpP --minimal linux-2.6.33.1/init/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/init/Kconfig
16542 --- linux-2.6.33.1/init/Kconfig 2010-02-25 11:52:09.000000000 +0100
16543 +++ linux-2.6.33.1-vs2.3.0.36.30.4/init/Kconfig 2010-02-25 16:27:44.000000000 +0100
16544 @@ -496,8 +496,22 @@ config CGROUP_SCHED
16548 +config CFS_HARD_LIMITS
16549 + bool "Hard Limits for CFS Group Scheduler"
16550 + depends on EXPERIMENTAL
16551 + depends on FAIR_GROUP_SCHED && CGROUP_SCHED
16554 + This option enables hard limiting of CPU time obtained by
16555 + a fair task group. Use this if you want to throttle a group of tasks
16556 + based on its CPU usage. For more details refer to
16557 + Documentation/scheduler/sched-cfs-hard-limits.txt
16562 boolean "Control Group support"
16565 This option adds support for grouping sets of processes together, for
16566 use with process control subsystems such as Cpusets, CFS, memory
16567 @@ -525,6 +539,7 @@ config CGROUP_DEBUG
16569 bool "Namespace cgroup subsystem"
16573 Provides a simple namespace cgroup subsystem to
16574 provide hierarchical naming of sets of namespaces,
16575 diff -NurpP --minimal linux-2.6.33.1/init/main.c linux-2.6.33.1-vs2.3.0.36.30.4/init/main.c
16576 --- linux-2.6.33.1/init/main.c 2010-02-25 11:52:09.000000000 +0100
16577 +++ linux-2.6.33.1-vs2.3.0.36.30.4/init/main.c 2010-02-25 12:02:16.000000000 +0100
16579 #include <linux/sfi.h>
16580 #include <linux/shmem_fs.h>
16581 #include <trace/boot.h>
16582 +#include <linux/vserver/percpu.h>
16584 #include <asm/io.h>
16585 #include <asm/bugs.h>
16586 diff -NurpP --minimal linux-2.6.33.1/ipc/mqueue.c linux-2.6.33.1-vs2.3.0.36.30.4/ipc/mqueue.c
16587 --- linux-2.6.33.1/ipc/mqueue.c 2010-02-25 11:52:09.000000000 +0100
16588 +++ linux-2.6.33.1-vs2.3.0.36.30.4/ipc/mqueue.c 2010-02-25 12:21:21.000000000 +0100
16590 #include <linux/nsproxy.h>
16591 #include <linux/pid.h>
16592 #include <linux/ipc_namespace.h>
16593 +#include <linux/vs_context.h>
16594 +#include <linux/vs_limit.h>
16596 #include <net/sock.h>
16598 @@ -65,6 +67,7 @@ struct mqueue_inode_info {
16599 struct sigevent notify;
16600 struct pid* notify_owner;
16601 struct user_struct *user; /* user who created, for accounting */
16602 + struct vx_info *vxi;
16603 struct sock *notify_sock;
16604 struct sk_buff *notify_cookie;
16606 @@ -124,6 +127,7 @@ static struct inode *mqueue_get_inode(st
16607 if (S_ISREG(mode)) {
16608 struct mqueue_inode_info *info;
16609 struct task_struct *p = current;
16610 + struct vx_info *vxi = p->vx_info;
16611 unsigned long mq_bytes, mq_msg_tblsz;
16613 inode->i_fop = &mqueue_file_operations;
16614 @@ -138,6 +142,7 @@ static struct inode *mqueue_get_inode(st
16615 info->notify_owner = NULL;
16617 info->user = NULL; /* set when all is ok */
16618 + info->vxi = NULL;
16619 memset(&info->attr, 0, sizeof(info->attr));
16620 info->attr.mq_maxmsg = ipc_ns->mq_msg_max;
16621 info->attr.mq_msgsize = ipc_ns->mq_msgsize_max;
16622 @@ -152,22 +157,26 @@ static struct inode *mqueue_get_inode(st
16623 spin_lock(&mq_lock);
16624 if (u->mq_bytes + mq_bytes < u->mq_bytes ||
16625 u->mq_bytes + mq_bytes >
16626 - p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur) {
16627 + p->signal->rlim[RLIMIT_MSGQUEUE].rlim_cur ||
16628 + !vx_ipcmsg_avail(vxi, mq_bytes)) {
16629 spin_unlock(&mq_lock);
16632 u->mq_bytes += mq_bytes;
16633 + vx_ipcmsg_add(vxi, u, mq_bytes);
16634 spin_unlock(&mq_lock);
16636 info->messages = kmalloc(mq_msg_tblsz, GFP_KERNEL);
16637 if (!info->messages) {
16638 spin_lock(&mq_lock);
16639 u->mq_bytes -= mq_bytes;
16640 + vx_ipcmsg_sub(vxi, u, mq_bytes);
16641 spin_unlock(&mq_lock);
16645 info->user = get_uid(u);
16646 + info->vxi = get_vx_info(vxi);
16647 } else if (S_ISDIR(mode)) {
16649 /* Some things misbehave if size == 0 on a directory */
16650 @@ -268,8 +277,11 @@ static void mqueue_delete_inode(struct i
16651 (info->attr.mq_maxmsg * info->attr.mq_msgsize));
16654 + struct vx_info *vxi = info->vxi;
16656 spin_lock(&mq_lock);
16657 user->mq_bytes -= mq_bytes;
16658 + vx_ipcmsg_sub(vxi, user, mq_bytes);
16660 * get_ns_from_inode() ensures that the
16661 * (ipc_ns = sb->s_fs_info) is either a valid ipc_ns
16662 @@ -279,6 +291,7 @@ static void mqueue_delete_inode(struct i
16664 ipc_ns->mq_queues_count--;
16665 spin_unlock(&mq_lock);
16666 + put_vx_info(vxi);
16670 diff -NurpP --minimal linux-2.6.33.1/ipc/msg.c linux-2.6.33.1-vs2.3.0.36.30.4/ipc/msg.c
16671 --- linux-2.6.33.1/ipc/msg.c 2010-02-25 11:52:09.000000000 +0100
16672 +++ linux-2.6.33.1-vs2.3.0.36.30.4/ipc/msg.c 2010-02-25 12:02:16.000000000 +0100
16674 #include <linux/rwsem.h>
16675 #include <linux/nsproxy.h>
16676 #include <linux/ipc_namespace.h>
16677 +#include <linux/vs_base.h>
16679 #include <asm/current.h>
16680 #include <asm/uaccess.h>
16681 @@ -191,6 +192,7 @@ static int newque(struct ipc_namespace *
16683 msq->q_perm.mode = msgflg & S_IRWXUGO;
16684 msq->q_perm.key = key;
16685 + msq->q_perm.xid = vx_current_xid();
16687 msq->q_perm.security = NULL;
16688 retval = security_msg_queue_alloc(msq);
16689 diff -NurpP --minimal linux-2.6.33.1/ipc/namespace.c linux-2.6.33.1-vs2.3.0.36.30.4/ipc/namespace.c
16690 --- linux-2.6.33.1/ipc/namespace.c 2009-09-10 15:26:27.000000000 +0200
16691 +++ linux-2.6.33.1-vs2.3.0.36.30.4/ipc/namespace.c 2010-02-25 12:02:16.000000000 +0100
16693 #include <linux/slab.h>
16694 #include <linux/fs.h>
16695 #include <linux/mount.h>
16696 +#include <linux/vs_base.h>
16697 +#include <linux/vserver/global.h>
16701 diff -NurpP --minimal linux-2.6.33.1/ipc/sem.c linux-2.6.33.1-vs2.3.0.36.30.4/ipc/sem.c
16702 --- linux-2.6.33.1/ipc/sem.c 2010-02-25 11:52:09.000000000 +0100
16703 +++ linux-2.6.33.1-vs2.3.0.36.30.4/ipc/sem.c 2010-02-25 12:02:16.000000000 +0100
16705 #include <linux/rwsem.h>
16706 #include <linux/nsproxy.h>
16707 #include <linux/ipc_namespace.h>
16708 +#include <linux/vs_base.h>
16709 +#include <linux/vs_limit.h>
16711 #include <asm/uaccess.h>
16713 @@ -257,6 +259,7 @@ static int newary(struct ipc_namespace *
16715 sma->sem_perm.mode = (semflg & S_IRWXUGO);
16716 sma->sem_perm.key = key;
16717 + sma->sem_perm.xid = vx_current_xid();
16719 sma->sem_perm.security = NULL;
16720 retval = security_sem_alloc(sma);
16721 @@ -272,6 +275,9 @@ static int newary(struct ipc_namespace *
16724 ns->used_sems += nsems;
16725 + /* FIXME: obsoleted? */
16726 + vx_semary_inc(sma);
16727 + vx_nsems_add(sma, nsems);
16729 sma->sem_base = (struct sem *) &sma[1];
16731 @@ -595,6 +601,9 @@ static void freeary(struct ipc_namespace
16734 ns->used_sems -= sma->sem_nsems;
16735 + /* FIXME: obsoleted? */
16736 + vx_nsems_sub(sma, sma->sem_nsems);
16737 + vx_semary_dec(sma);
16738 security_sem_free(sma);
16739 ipc_rcu_putref(sma);
16741 diff -NurpP --minimal linux-2.6.33.1/ipc/shm.c linux-2.6.33.1-vs2.3.0.36.30.4/ipc/shm.c
16742 --- linux-2.6.33.1/ipc/shm.c 2010-02-25 11:52:09.000000000 +0100
16743 +++ linux-2.6.33.1-vs2.3.0.36.30.4/ipc/shm.c 2010-02-25 12:23:04.000000000 +0100
16745 #include <linux/nsproxy.h>
16746 #include <linux/mount.h>
16747 #include <linux/ipc_namespace.h>
16748 +#include <linux/vs_context.h>
16749 +#include <linux/vs_limit.h>
16751 #include <asm/uaccess.h>
16753 @@ -169,7 +171,12 @@ static void shm_open(struct vm_area_stru
16755 static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
16757 - ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
16758 + struct vx_info *vxi = lookup_vx_info(shp->shm_perm.xid);
16759 + int numpages = (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT;
16761 + vx_ipcshm_sub(vxi, shp, numpages);
16762 + ns->shm_tot -= numpages;
16766 if (!is_file_hugepages(shp->shm_file))
16767 @@ -179,6 +186,7 @@ static void shm_destroy(struct ipc_names
16769 fput (shp->shm_file);
16770 security_shm_free(shp);
16771 + put_vx_info(vxi);
16772 ipc_rcu_putref(shp);
16775 @@ -352,11 +360,15 @@ static int newseg(struct ipc_namespace *
16776 if (ns->shm_tot + numpages > ns->shm_ctlall)
16779 + if (!vx_ipcshm_avail(current_vx_info(), numpages))
16782 shp = ipc_rcu_alloc(sizeof(*shp));
16786 shp->shm_perm.key = key;
16787 + shp->shm_perm.xid = vx_current_xid();
16788 shp->shm_perm.mode = (shmflg & S_IRWXUGO);
16789 shp->mlock_user = NULL;
16791 @@ -410,6 +422,7 @@ static int newseg(struct ipc_namespace *
16792 ns->shm_tot += numpages;
16793 error = shp->shm_perm.id;
16795 + vx_ipcshm_add(current_vx_info(), key, numpages);
16799 diff -NurpP --minimal linux-2.6.33.1/kernel/capability.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/capability.c
16800 --- linux-2.6.33.1/kernel/capability.c 2010-02-25 11:52:09.000000000 +0100
16801 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/capability.c 2010-02-25 12:02:16.000000000 +0100
16803 #include <linux/security.h>
16804 #include <linux/syscalls.h>
16805 #include <linux/pid_namespace.h>
16806 +#include <linux/vs_context.h>
16807 #include <asm/uaccess.h>
16808 #include "cred-internals.h"
16810 @@ -120,6 +121,7 @@ static int cap_validate_magic(cap_user_h
16816 * The only thing that can change the capabilities of the current
16817 * process is the current process. As such, we can't be in this code
16818 @@ -290,6 +292,8 @@ error:
16822 +#include <linux/vserver/base.h>
16825 * capable - Determine if the current task has a superior capability in effect
16826 * @cap: The capability to be tested for
16827 @@ -302,6 +306,9 @@ error:
16829 int capable(int cap)
16831 + /* here for now so we don't require task locking */
16832 + if (vs_check_bit(VXC_CAP_MASK, cap) && !vx_mcaps(1L << cap))
16834 if (unlikely(!cap_valid(cap))) {
16835 printk(KERN_CRIT "capable() called with invalid cap=%u\n", cap);
16837 diff -NurpP --minimal linux-2.6.33.1/kernel/compat.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/compat.c
16838 --- linux-2.6.33.1/kernel/compat.c 2009-09-10 15:26:27.000000000 +0200
16839 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/compat.c 2010-02-25 12:02:16.000000000 +0100
16840 @@ -902,7 +902,7 @@ asmlinkage long compat_sys_time(compat_t
16844 - do_gettimeofday(&tv);
16845 + vx_gettimeofday(&tv);
16849 @@ -927,7 +927,7 @@ asmlinkage long compat_sys_stime(compat_
16853 - do_settimeofday(&tv);
16854 + vx_settimeofday(&tv);
16858 diff -NurpP --minimal linux-2.6.33.1/kernel/exit.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/exit.c
16859 --- linux-2.6.33.1/kernel/exit.c 2010-02-25 11:52:09.000000000 +0100
16860 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/exit.c 2010-02-25 12:02:16.000000000 +0100
16862 #include <linux/fs_struct.h>
16863 #include <linux/init_task.h>
16864 #include <linux/perf_event.h>
16865 +#include <linux/vs_limit.h>
16866 +#include <linux/vs_context.h>
16867 +#include <linux/vs_network.h>
16868 +#include <linux/vs_pid.h>
16869 #include <trace/events/sched.h>
16870 #include <linux/hw_breakpoint.h>
16872 @@ -489,9 +493,11 @@ static void close_files(struct files_str
16873 filp_close(file, files);
16876 + vx_openfd_dec(i);
16884 @@ -1019,11 +1025,16 @@ NORET_TYPE void do_exit(long code)
16886 validate_creds_for_do_exit(tsk);
16888 + /* needs to stay after exit_notify() */
16889 + exit_vx_info(tsk, code);
16890 + exit_nx_info(tsk);
16894 /* causes final put_task_struct in finish_task_switch(). */
16895 tsk->state = TASK_DEAD;
16897 + printk("bad task: %p [%lx]\n", current, current->state);
16899 /* Avoid "noreturn function does return". */
16901 diff -NurpP --minimal linux-2.6.33.1/kernel/fork.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/fork.c
16902 --- linux-2.6.33.1/kernel/fork.c 2010-02-25 11:52:09.000000000 +0100
16903 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/fork.c 2010-02-25 12:23:31.000000000 +0100
16905 #include <linux/perf_event.h>
16906 #include <linux/posix-timers.h>
16907 #include <linux/user-return-notifier.h>
16908 +#include <linux/vs_context.h>
16909 +#include <linux/vs_network.h>
16910 +#include <linux/vs_limit.h>
16911 +#include <linux/vs_memory.h>
16913 #include <asm/pgtable.h>
16914 #include <asm/pgalloc.h>
16915 @@ -152,6 +156,8 @@ void free_task(struct task_struct *tsk)
16916 account_kernel_stack(tsk->stack, -1);
16917 free_thread_info(tsk->stack);
16918 rt_mutex_debug_task_free(tsk);
16919 + clr_vx_info(&tsk->vx_info);
16920 + clr_nx_info(&tsk->nx_info);
16921 ftrace_graph_exit_task(tsk);
16922 free_task_struct(tsk);
16924 @@ -298,6 +304,8 @@ static int dup_mmap(struct mm_struct *mm
16925 mm->free_area_cache = oldmm->mmap_base;
16926 mm->cached_hole_size = ~0UL;
16928 + __set_mm_counter(mm, file_rss, 0);
16929 + __set_mm_counter(mm, anon_rss, 0);
16930 cpumask_clear(mm_cpumask(mm));
16931 mm->mm_rb = RB_ROOT;
16932 rb_link = &mm->mm_rb.rb_node;
16933 @@ -312,7 +320,7 @@ static int dup_mmap(struct mm_struct *mm
16935 if (mpnt->vm_flags & VM_DONTCOPY) {
16936 long pages = vma_pages(mpnt);
16937 - mm->total_vm -= pages;
16938 + vx_vmpages_sub(mm, pages);
16939 vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
16942 @@ -454,8 +462,8 @@ static struct mm_struct * mm_init(struct
16943 (current->mm->flags & MMF_INIT_MASK) : default_dump_filter;
16944 mm->core_state = NULL;
16946 - set_mm_counter(mm, file_rss, 0);
16947 - set_mm_counter(mm, anon_rss, 0);
16948 + __set_mm_counter(mm, file_rss, 0);
16949 + __set_mm_counter(mm, anon_rss, 0);
16950 spin_lock_init(&mm->page_table_lock);
16951 mm->free_area_cache = TASK_UNMAPPED_BASE;
16952 mm->cached_hole_size = ~0UL;
16953 @@ -465,6 +473,7 @@ static struct mm_struct * mm_init(struct
16954 if (likely(!mm_alloc_pgd(mm))) {
16956 mmu_notifier_mm_init(mm);
16957 + set_vx_info(&mm->mm_vx_info, p->vx_info);
16961 @@ -498,6 +507,7 @@ void __mmdrop(struct mm_struct *mm)
16963 destroy_context(mm);
16964 mmu_notifier_mm_destroy(mm);
16965 + clr_vx_info(&mm->mm_vx_info);
16968 EXPORT_SYMBOL_GPL(__mmdrop);
16969 @@ -633,6 +643,7 @@ struct mm_struct *dup_mm(struct task_str
16972 memcpy(mm, oldmm, sizeof(*mm));
16973 + mm->mm_vx_info = NULL;
16975 /* Initializing for Swap token stuff */
16976 mm->token_priority = 0;
16977 @@ -671,6 +682,7 @@ fail_nocontext:
16978 * If init_new_context() failed, we cannot use mmput() to free the mm
16979 * because it calls destroy_context()
16981 + clr_vx_info(&mm->mm_vx_info);
16985 @@ -985,6 +997,8 @@ static struct task_struct *copy_process(
16987 struct task_struct *p;
16988 int cgroup_callbacks_done = 0;
16989 + struct vx_info *vxi;
16990 + struct nx_info *nxi;
16992 if ((clone_flags & (CLONE_NEWNS|CLONE_FS)) == (CLONE_NEWNS|CLONE_FS))
16993 return ERR_PTR(-EINVAL);
16994 @@ -1031,12 +1045,28 @@ static struct task_struct *copy_process(
16995 DEBUG_LOCKS_WARN_ON(!p->hardirqs_enabled);
16996 DEBUG_LOCKS_WARN_ON(!p->softirqs_enabled);
16998 + init_vx_info(&p->vx_info, current_vx_info());
16999 + init_nx_info(&p->nx_info, current_nx_info());
17001 + /* check vserver memory */
17002 + if (p->mm && !(clone_flags & CLONE_VM)) {
17003 + if (vx_vmpages_avail(p->mm, p->mm->total_vm))
17004 + vx_pages_add(p->vx_info, RLIMIT_AS, p->mm->total_vm);
17006 + goto bad_fork_free;
17008 + if (p->mm && vx_flags(VXF_FORK_RSS, 0)) {
17009 + if (!vx_rss_avail(p->mm, get_mm_counter(p->mm, file_rss)))
17010 + goto bad_fork_cleanup_vm;
17013 + if (!vx_nproc_avail(1))
17014 + goto bad_fork_cleanup_vm;
17015 if (atomic_read(&p->real_cred->user->processes) >=
17016 p->signal->rlim[RLIMIT_NPROC].rlim_cur) {
17017 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
17018 p->real_cred->user != INIT_USER)
17019 - goto bad_fork_free;
17020 + goto bad_fork_cleanup_vm;
17023 retval = copy_creds(p, clone_flags);
17024 @@ -1297,6 +1327,18 @@ static struct task_struct *copy_process(
17027 spin_unlock(¤t->sighand->siglock);
17029 + /* p is copy of current */
17030 + vxi = p->vx_info;
17032 + claim_vx_info(vxi, p);
17033 + atomic_inc(&vxi->cvirt.nr_threads);
17034 + atomic_inc(&vxi->cvirt.total_forks);
17037 + nxi = p->nx_info;
17039 + claim_nx_info(nxi, p);
17040 write_unlock_irq(&tasklist_lock);
17041 proc_fork_connector(p);
17042 cgroup_post_fork(p);
17043 @@ -1339,6 +1381,9 @@ bad_fork_cleanup_cgroup:
17044 bad_fork_cleanup_count:
17045 atomic_dec(&p->cred->user->processes);
17047 +bad_fork_cleanup_vm:
17048 + if (p->mm && !(clone_flags & CLONE_VM))
17049 + vx_pages_sub(p->vx_info, RLIMIT_AS, p->mm->total_vm);
17053 diff -NurpP --minimal linux-2.6.33.1/kernel/kthread.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/kthread.c
17054 --- linux-2.6.33.1/kernel/kthread.c 2010-02-25 11:52:09.000000000 +0100
17055 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/kthread.c 2010-02-25 12:02:16.000000000 +0100
17057 #include <linux/file.h>
17058 #include <linux/module.h>
17059 #include <linux/mutex.h>
17060 +#include <linux/vs_pid.h>
17061 #include <trace/events/sched.h>
17063 static DEFINE_SPINLOCK(kthread_create_lock);
17064 diff -NurpP --minimal linux-2.6.33.1/kernel/Makefile linux-2.6.33.1-vs2.3.0.36.30.4/kernel/Makefile
17065 --- linux-2.6.33.1/kernel/Makefile 2010-02-25 11:52:09.000000000 +0100
17066 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/Makefile 2010-02-25 12:02:16.000000000 +0100
17067 @@ -24,6 +24,7 @@ CFLAGS_REMOVE_sched_clock.o = -pg
17068 CFLAGS_REMOVE_perf_event.o = -pg
17072 obj-$(CONFIG_FREEZER) += freezer.o
17073 obj-$(CONFIG_PROFILING) += profile.o
17074 obj-$(CONFIG_SYSCTL_SYSCALL_CHECK) += sysctl_check.o
17075 diff -NurpP --minimal linux-2.6.33.1/kernel/nsproxy.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/nsproxy.c
17076 --- linux-2.6.33.1/kernel/nsproxy.c 2009-09-10 15:26:28.000000000 +0200
17077 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/nsproxy.c 2010-02-25 12:02:16.000000000 +0100
17079 #include <linux/mnt_namespace.h>
17080 #include <linux/utsname.h>
17081 #include <linux/pid_namespace.h>
17082 +#include <linux/vserver/global.h>
17083 +#include <linux/vserver/debug.h>
17084 #include <net/net_namespace.h>
17085 #include <linux/ipc_namespace.h>
17087 @@ -31,8 +33,11 @@ static inline struct nsproxy *create_nsp
17088 struct nsproxy *nsproxy;
17090 nsproxy = kmem_cache_alloc(nsproxy_cachep, GFP_KERNEL);
17093 atomic_set(&nsproxy->count, 1);
17094 + atomic_inc(&vs_global_nsproxy);
17096 + vxdprintk(VXD_CBIT(space, 2), "create_nsproxy = %p[1]", nsproxy);
17100 @@ -41,41 +46,52 @@ static inline struct nsproxy *create_nsp
17101 * Return the newly created nsproxy. Do not attach this to the task,
17102 * leave it to the caller to do proper locking and attach it to task.
17104 -static struct nsproxy *create_new_namespaces(unsigned long flags,
17105 - struct task_struct *tsk, struct fs_struct *new_fs)
17106 +static struct nsproxy *unshare_namespaces(unsigned long flags,
17107 + struct nsproxy *orig, struct fs_struct *new_fs)
17109 struct nsproxy *new_nsp;
17112 + vxdprintk(VXD_CBIT(space, 4),
17113 + "unshare_namespaces(0x%08lx,%p,%p)",
17114 + flags, orig, new_fs);
17116 new_nsp = create_nsproxy();
17118 return ERR_PTR(-ENOMEM);
17120 - new_nsp->mnt_ns = copy_mnt_ns(flags, tsk->nsproxy->mnt_ns, new_fs);
17121 + new_nsp->mnt_ns = copy_mnt_ns(flags, orig->mnt_ns, new_fs);
17122 if (IS_ERR(new_nsp->mnt_ns)) {
17123 err = PTR_ERR(new_nsp->mnt_ns);
17127 - new_nsp->uts_ns = copy_utsname(flags, tsk->nsproxy->uts_ns);
17128 + new_nsp->uts_ns = copy_utsname(flags, orig->uts_ns);
17129 if (IS_ERR(new_nsp->uts_ns)) {
17130 err = PTR_ERR(new_nsp->uts_ns);
17134 - new_nsp->ipc_ns = copy_ipcs(flags, tsk->nsproxy->ipc_ns);
17135 + new_nsp->ipc_ns = copy_ipcs(flags, orig->ipc_ns);
17136 if (IS_ERR(new_nsp->ipc_ns)) {
17137 err = PTR_ERR(new_nsp->ipc_ns);
17141 - new_nsp->pid_ns = copy_pid_ns(flags, task_active_pid_ns(tsk));
17142 + new_nsp->pid_ns = copy_pid_ns(flags, orig->pid_ns);
17143 if (IS_ERR(new_nsp->pid_ns)) {
17144 err = PTR_ERR(new_nsp->pid_ns);
17148 - new_nsp->net_ns = copy_net_ns(flags, tsk->nsproxy->net_ns);
17150 + new_nsp->user_ns = copy_user_ns(flags, orig->user_ns);
17151 + if (IS_ERR(new_nsp->user_ns)) {
17152 + err = PTR_ERR(new_nsp->user_ns);
17156 + new_nsp->net_ns = copy_net_ns(flags, orig->net_ns);
17157 if (IS_ERR(new_nsp->net_ns)) {
17158 err = PTR_ERR(new_nsp->net_ns);
17160 @@ -100,6 +116,38 @@ out_ns:
17161 return ERR_PTR(err);
17164 +static struct nsproxy *create_new_namespaces(int flags, struct task_struct *tsk,
17165 + struct fs_struct *new_fs)
17167 + return unshare_namespaces(flags, tsk->nsproxy, new_fs);
17171 + * copies the nsproxy, setting refcount to 1, and grabbing a
17172 + * reference to all contained namespaces.
17174 +struct nsproxy *copy_nsproxy(struct nsproxy *orig)
17176 + struct nsproxy *ns = create_nsproxy();
17179 + memcpy(ns, orig, sizeof(struct nsproxy));
17180 + atomic_set(&ns->count, 1);
17183 + get_mnt_ns(ns->mnt_ns);
17185 + get_uts_ns(ns->uts_ns);
17187 + get_ipc_ns(ns->ipc_ns);
17189 + get_pid_ns(ns->pid_ns);
17191 + get_net(ns->net_ns);
17197 * called from clone. This now handles copy for nsproxy and all
17198 * namespaces therein.
17199 @@ -107,9 +155,12 @@ out_ns:
17200 int copy_namespaces(unsigned long flags, struct task_struct *tsk)
17202 struct nsproxy *old_ns = tsk->nsproxy;
17203 - struct nsproxy *new_ns;
17204 + struct nsproxy *new_ns = NULL;
17207 + vxdprintk(VXD_CBIT(space, 7), "copy_namespaces(0x%08lx,%p[%p])",
17208 + flags, tsk, old_ns);
17213 @@ -119,7 +170,7 @@ int copy_namespaces(unsigned long flags,
17214 CLONE_NEWPID | CLONE_NEWNET)))
17217 - if (!capable(CAP_SYS_ADMIN)) {
17218 + if (!vx_can_unshare(CAP_SYS_ADMIN, flags)) {
17222 @@ -146,6 +197,9 @@ int copy_namespaces(unsigned long flags,
17225 put_nsproxy(old_ns);
17226 + vxdprintk(VXD_CBIT(space, 3),
17227 + "copy_namespaces(0x%08lx,%p[%p]) = %d [%p]",
17228 + flags, tsk, old_ns, err, new_ns);
17232 @@ -159,7 +213,9 @@ void free_nsproxy(struct nsproxy *ns)
17233 put_ipc_ns(ns->ipc_ns);
17235 put_pid_ns(ns->pid_ns);
17236 - put_net(ns->net_ns);
17238 + put_net(ns->net_ns);
17239 + atomic_dec(&vs_global_nsproxy);
17240 kmem_cache_free(nsproxy_cachep, ns);
17243 @@ -172,11 +228,15 @@ int unshare_nsproxy_namespaces(unsigned
17247 + vxdprintk(VXD_CBIT(space, 4),
17248 + "unshare_nsproxy_namespaces(0x%08lx,[%p])",
17249 + unshare_flags, current->nsproxy);
17251 if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
17255 - if (!capable(CAP_SYS_ADMIN))
17256 + if (!vx_can_unshare(CAP_SYS_ADMIN, unshare_flags))
17259 *new_nsp = create_new_namespaces(unshare_flags, current,
17260 diff -NurpP --minimal linux-2.6.33.1/kernel/pid.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/pid.c
17261 --- linux-2.6.33.1/kernel/pid.c 2010-02-25 11:52:09.000000000 +0100
17262 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/pid.c 2010-02-25 12:02:16.000000000 +0100
17264 #include <linux/pid_namespace.h>
17265 #include <linux/init_task.h>
17266 #include <linux/syscalls.h>
17267 +#include <linux/vs_pid.h>
17269 #define pid_hashfn(nr, ns) \
17270 hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift)
17271 @@ -305,7 +306,7 @@ EXPORT_SYMBOL_GPL(find_pid_ns);
17273 struct pid *find_vpid(int nr)
17275 - return find_pid_ns(nr, current->nsproxy->pid_ns);
17276 + return find_pid_ns(vx_rmap_pid(nr), current->nsproxy->pid_ns);
17278 EXPORT_SYMBOL_GPL(find_vpid);
17280 @@ -365,6 +366,9 @@ void transfer_pid(struct task_struct *ol
17281 struct task_struct *pid_task(struct pid *pid, enum pid_type type)
17283 struct task_struct *result = NULL;
17285 + if (type == PIDTYPE_REALPID)
17286 + type = PIDTYPE_PID;
17288 struct hlist_node *first;
17289 first = rcu_dereference(pid->tasks[type].first);
17290 @@ -380,7 +384,7 @@ EXPORT_SYMBOL(pid_task);
17292 struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
17294 - return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
17295 + return pid_task(find_pid_ns(vx_rmap_pid(nr), ns), PIDTYPE_PID);
17298 struct task_struct *find_task_by_vpid(pid_t vnr)
17299 @@ -422,7 +426,7 @@ struct pid *find_get_pid(pid_t nr)
17301 EXPORT_SYMBOL_GPL(find_get_pid);
17303 -pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
17304 +pid_t pid_unmapped_nr_ns(struct pid *pid, struct pid_namespace *ns)
17308 @@ -435,6 +439,11 @@ pid_t pid_nr_ns(struct pid *pid, struct
17312 +pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
17314 + return vx_map_pid(pid_unmapped_nr_ns(pid, ns));
17317 pid_t pid_vnr(struct pid *pid)
17319 return pid_nr_ns(pid, current->nsproxy->pid_ns);
17320 diff -NurpP --minimal linux-2.6.33.1/kernel/pid_namespace.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/pid_namespace.c
17321 --- linux-2.6.33.1/kernel/pid_namespace.c 2009-12-03 20:02:58.000000000 +0100
17322 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/pid_namespace.c 2010-02-25 12:02:16.000000000 +0100
17324 #include <linux/syscalls.h>
17325 #include <linux/err.h>
17326 #include <linux/acct.h>
17327 +#include <linux/vserver/global.h>
17329 #define BITS_PER_PAGE (PAGE_SIZE*8)
17331 @@ -86,6 +87,7 @@ static struct pid_namespace *create_pid_
17334 kref_init(&ns->kref);
17335 + atomic_inc(&vs_global_pid_ns);
17337 ns->parent = get_pid_ns(parent_pid_ns);
17339 @@ -111,6 +113,7 @@ static void destroy_pid_namespace(struct
17341 for (i = 0; i < PIDMAP_ENTRIES; i++)
17342 kfree(ns->pidmap[i].page);
17343 + atomic_dec(&vs_global_pid_ns);
17344 kmem_cache_free(pid_ns_cachep, ns);
17347 diff -NurpP --minimal linux-2.6.33.1/kernel/posix-timers.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/posix-timers.c
17348 --- linux-2.6.33.1/kernel/posix-timers.c 2009-12-03 20:02:58.000000000 +0100
17349 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/posix-timers.c 2010-02-25 12:02:16.000000000 +0100
17351 #include <linux/wait.h>
17352 #include <linux/workqueue.h>
17353 #include <linux/module.h>
17354 +#include <linux/vs_context.h>
17357 * Management arrays for POSIX timers. Timers are kept in slab memory
17358 @@ -363,6 +364,7 @@ int posix_timer_event(struct k_itimer *t
17360 struct task_struct *task;
17361 int shared, ret = -1;
17364 * FIXME: if ->sigq is queued we can race with
17365 * dequeue_signal()->do_schedule_next_timer().
17366 @@ -379,10 +381,18 @@ int posix_timer_event(struct k_itimer *t
17368 task = pid_task(timr->it_pid, PIDTYPE_PID);
17370 + struct vx_info_save vxis;
17371 + struct vx_info *vxi;
17373 + vxi = get_vx_info(task->vx_info);
17374 + enter_vx_info(vxi, &vxis);
17375 shared = !(timr->it_sigev_notify & SIGEV_THREAD_ID);
17376 ret = send_sigqueue(timr->sigq, task, shared);
17377 + leave_vx_info(&vxis);
17378 + put_vx_info(vxi);
17382 /* If we failed to send the signal the timer stops. */
17385 diff -NurpP --minimal linux-2.6.33.1/kernel/printk.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/printk.c
17386 --- linux-2.6.33.1/kernel/printk.c 2010-02-25 11:52:09.000000000 +0100
17387 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/printk.c 2010-02-25 13:11:15.000000000 +0100
17389 #include <linux/kexec.h>
17390 #include <linux/ratelimit.h>
17391 #include <linux/kmsg_dump.h>
17392 +#include <linux/vs_cvirt.h>
17394 #include <asm/uaccess.h>
17396 @@ -278,18 +279,13 @@ int do_syslog(int type, char __user *buf
17397 unsigned i, j, limit, count;
17403 error = security_syslog(type);
17408 - case 0: /* Close log */
17410 - case 1: /* Open log */
17412 - case 2: /* Read from log */
17413 + if ((type >= 2) && (type <= 4)) {
17415 if (!buf || len < 0)
17417 @@ -300,6 +296,16 @@ int do_syslog(int type, char __user *buf
17422 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
17423 + return vx_do_syslog(type, buf, len);
17426 + case 0: /* Close log */
17428 + case 1: /* Open log */
17430 + case 2: /* Read from log */
17431 error = wait_event_interruptible(log_wait,
17432 (log_start - log_end));
17434 @@ -324,16 +330,6 @@ int do_syslog(int type, char __user *buf
17437 case 3: /* Read last kernel messages */
17439 - if (!buf || len < 0)
17444 - if (!access_ok(VERIFY_WRITE, buf, len)) {
17449 if (count > log_buf_len)
17450 count = log_buf_len;
17451 diff -NurpP --minimal linux-2.6.33.1/kernel/ptrace.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/ptrace.c
17452 --- linux-2.6.33.1/kernel/ptrace.c 2009-12-03 20:02:58.000000000 +0100
17453 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/ptrace.c 2010-02-25 12:02:16.000000000 +0100
17455 #include <linux/pid_namespace.h>
17456 #include <linux/syscalls.h>
17457 #include <linux/uaccess.h>
17458 +#include <linux/vs_context.h>
17462 @@ -151,6 +152,11 @@ int __ptrace_may_access(struct task_stru
17463 dumpable = get_dumpable(task->mm);
17464 if (!dumpable && !capable(CAP_SYS_PTRACE))
17466 + if (!vx_check(task->xid, VS_ADMIN_P|VS_IDENT))
17468 + if (!vx_check(task->xid, VS_IDENT) &&
17469 + !task_vx_flags(task, VXF_STATE_ADMIN, 0))
17472 return security_ptrace_access_check(task, mode);
17474 @@ -621,6 +627,10 @@ SYSCALL_DEFINE4(ptrace, long, request, l
17479 + if (!vx_check(vx_task_xid(child), VS_WATCH_P | VS_IDENT))
17480 + goto out_put_task_struct;
17482 if (request == PTRACE_ATTACH) {
17483 ret = ptrace_attach(child);
17485 diff -NurpP --minimal linux-2.6.33.1/kernel/sched.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sched.c
17486 --- linux-2.6.33.1/kernel/sched.c 2010-03-18 16:25:15.000000000 +0100
17487 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sched.c 2010-03-18 17:24:11.000000000 +0100
17489 #include <linux/debugfs.h>
17490 #include <linux/ctype.h>
17491 #include <linux/ftrace.h>
17492 +#include <linux/vs_sched.h>
17493 +#include <linux/vs_cvirt.h>
17495 #include <asm/tlb.h>
17496 #include <asm/irq_regs.h>
17497 @@ -3009,9 +3011,17 @@ EXPORT_SYMBOL(avenrun);
17499 void get_avenrun(unsigned long *loads, unsigned long offset, int shift)
17501 - loads[0] = (avenrun[0] + offset) << shift;
17502 - loads[1] = (avenrun[1] + offset) << shift;
17503 - loads[2] = (avenrun[2] + offset) << shift;
17504 + if (vx_flags(VXF_VIRT_LOAD, 0)) {
17505 + struct vx_info *vxi = current_vx_info();
17507 + loads[0] = (vxi->cvirt.load[0] + offset) << shift;
17508 + loads[1] = (vxi->cvirt.load[1] + offset) << shift;
17509 + loads[2] = (vxi->cvirt.load[2] + offset) << shift;
17511 + loads[0] = (avenrun[0] + offset) << shift;
17512 + loads[1] = (avenrun[1] + offset) << shift;
17513 + loads[2] = (avenrun[2] + offset) << shift;
17517 static unsigned long
17518 @@ -5057,16 +5067,19 @@ void account_user_time(struct task_struc
17519 cputime_t cputime_scaled)
17521 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
17522 + struct vx_info *vxi = p->vx_info; /* p is _always_ current */
17524 + int nice = (TASK_NICE(p) > 0);
17526 /* Add user time to process. */
17527 p->utime = cputime_add(p->utime, cputime);
17528 p->utimescaled = cputime_add(p->utimescaled, cputime_scaled);
17529 + vx_account_user(vxi, cputime, nice);
17530 account_group_user_time(p, cputime);
17532 /* Add user time to cpustat. */
17533 tmp = cputime_to_cputime64(cputime);
17534 - if (TASK_NICE(p) > 0)
17536 cpustat->nice = cputime64_add(cpustat->nice, tmp);
17538 cpustat->user = cputime64_add(cpustat->user, tmp);
17539 @@ -5117,6 +5130,7 @@ void account_system_time(struct task_str
17540 cputime_t cputime, cputime_t cputime_scaled)
17542 struct cpu_usage_stat *cpustat = &kstat_this_cpu.cpustat;
17543 + struct vx_info *vxi = p->vx_info; /* p is _always_ current */
17546 if ((p->flags & PF_VCPU) && (irq_count() - hardirq_offset == 0)) {
17547 @@ -5127,6 +5141,7 @@ void account_system_time(struct task_str
17548 /* Add system time to process. */
17549 p->stime = cputime_add(p->stime, cputime);
17550 p->stimescaled = cputime_add(p->stimescaled, cputime_scaled);
17551 + vx_account_system(vxi, cputime, 0 /* do we have idle time? */);
17552 account_group_system_time(p, cputime);
17554 /* Add system time to cpustat. */
17555 @@ -6192,7 +6207,7 @@ SYSCALL_DEFINE1(nice, int, increment)
17558 if (increment < 0 && !can_nice(current, nice))
17560 + return vx_flags(VXF_IGNEG_NICE, 0) ? 0 : -EPERM;
17562 retval = security_task_setnice(current, nice);
17564 diff -NurpP --minimal linux-2.6.33.1/kernel/sched_fair.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sched_fair.c
17565 --- linux-2.6.33.1/kernel/sched_fair.c 2010-02-25 11:52:09.000000000 +0100
17566 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sched_fair.c 2010-03-18 17:25:17.000000000 +0100
17567 @@ -794,6 +794,9 @@ enqueue_entity(struct cfs_rq *cfs_rq, st
17568 check_spread(cfs_rq, se);
17569 if (se != cfs_rq->curr)
17570 __enqueue_entity(cfs_rq, se);
17572 + if (entity_is_task(se))
17573 + vx_activate_task(task_of(se));
17576 static void __clear_buddies(struct cfs_rq *cfs_rq, struct sched_entity *se)
17577 @@ -837,6 +840,8 @@ dequeue_entity(struct cfs_rq *cfs_rq, st
17579 if (se != cfs_rq->curr)
17580 __dequeue_entity(cfs_rq, se);
17581 + if (entity_is_task(se))
17582 + vx_deactivate_task(task_of(se));
17583 account_entity_dequeue(cfs_rq, se);
17584 update_min_vruntime(cfs_rq);
17586 diff -NurpP --minimal linux-2.6.33.1/kernel/signal.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/signal.c
17587 --- linux-2.6.33.1/kernel/signal.c 2010-02-25 11:52:09.000000000 +0100
17588 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/signal.c 2010-03-10 20:32:43.000000000 +0100
17590 #include <linux/freezer.h>
17591 #include <linux/pid_namespace.h>
17592 #include <linux/nsproxy.h>
17593 +#include <linux/vs_context.h>
17594 +#include <linux/vs_pid.h>
17595 #define CREATE_TRACE_POINTS
17596 #include <trace/events/signal.h>
17598 @@ -629,9 +631,18 @@ static int check_kill_permission(int sig
17602 + vxdprintk(VXD_CBIT(misc, 7),
17603 + "check_kill_permission(%d,%p,%p[#%u,%u])",
17604 + sig, info, t, vx_task_xid(t), t->pid);
17606 if (!valid_signal(sig))
17609 +/* FIXME: needed? if so, why?
17610 + if ((info != SEND_SIG_NOINFO) &&
17611 + (is_si_special(info) || !si_fromuser(info)))
17614 if (!si_fromuser(info))
17617 @@ -659,6 +670,20 @@ static int check_kill_permission(int sig
17622 + if (t->pid == 1 && current->xid)
17626 + /* FIXME: we shouldn't return ESRCH ever, to avoid
17627 + loops, maybe ENOENT or EACCES? */
17628 + if (!vx_check(vx_task_xid(t), VS_WATCH_P | VS_IDENT)) {
17629 + vxdprintk(current->xid || VXD_CBIT(misc, 7),
17630 + "signal %d[%p] xid mismatch %p[#%u,%u] xid=#%u",
17631 + sig, info, t, vx_task_xid(t), t->pid, current->xid);
17635 return security_task_kill(t, info, sig, 0);
17638 @@ -1147,7 +1172,7 @@ int kill_pid_info(int sig, struct siginf
17641 p = pid_task(pid, PIDTYPE_PID);
17643 + if (p && vx_check(vx_task_xid(p), VS_IDENT)) {
17644 error = group_send_sig_info(sig, info, p);
17645 if (unlikely(error == -ESRCH))
17647 @@ -1187,7 +1212,7 @@ int kill_pid_info_as_uid(int sig, struct
17650 p = pid_task(pid, PIDTYPE_PID);
17652 + if (!p || !vx_check(vx_task_xid(p), VS_IDENT)) {
17656 @@ -1242,8 +1267,10 @@ static int kill_something_info(int sig,
17657 struct task_struct * p;
17659 for_each_process(p) {
17660 - if (task_pid_vnr(p) > 1 &&
17661 - !same_thread_group(p, current)) {
17662 + if (vx_check(vx_task_xid(p), VS_ADMIN|VS_IDENT) &&
17663 + task_pid_vnr(p) > 1 &&
17664 + !same_thread_group(p, current) &&
17665 + !vx_current_initpid(p->pid)) {
17666 int err = group_send_sig_info(sig, info, p);
17669 @@ -1910,6 +1937,11 @@ relock:
17670 !sig_kernel_only(signr))
17673 + /* virtual init is protected against user signals */
17674 + if ((info->si_code == SI_USER) &&
17675 + vx_current_initpid(current->pid))
17678 if (sig_kernel_stop(signr)) {
17680 * The default action is to stop all threads in
17681 diff -NurpP --minimal linux-2.6.33.1/kernel/softirq.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/softirq.c
17682 --- linux-2.6.33.1/kernel/softirq.c 2010-02-25 11:52:09.000000000 +0100
17683 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/softirq.c 2010-02-25 12:02:16.000000000 +0100
17685 #include <linux/ftrace.h>
17686 #include <linux/smp.h>
17687 #include <linux/tick.h>
17688 +#include <linux/vs_context.h>
17690 #define CREATE_TRACE_POINTS
17691 #include <trace/events/irq.h>
17692 diff -NurpP --minimal linux-2.6.33.1/kernel/sys.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sys.c
17693 --- linux-2.6.33.1/kernel/sys.c 2010-02-25 11:52:09.000000000 +0100
17694 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sys.c 2010-02-25 13:13:03.000000000 +0100
17696 #include <linux/syscalls.h>
17697 #include <linux/kprobes.h>
17698 #include <linux/user_namespace.h>
17699 +#include <linux/vs_pid.h>
17701 #include <asm/uaccess.h>
17702 #include <asm/io.h>
17703 @@ -129,7 +130,10 @@ static int set_one_prio(struct task_stru
17706 if (niceval < task_nice(p) && !can_nice(p, niceval)) {
17708 + if (vx_flags(VXF_IGNEG_NICE, 0))
17714 no_nice = security_task_setnice(p, niceval);
17715 @@ -179,6 +183,8 @@ SYSCALL_DEFINE3(setpriority, int, which,
17717 pgrp = task_pgrp(current);
17718 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
17719 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
17721 error = set_one_prio(p, niceval, error);
17722 } while_each_pid_thread(pgrp, PIDTYPE_PGID, p);
17724 @@ -242,6 +248,8 @@ SYSCALL_DEFINE2(getpriority, int, which,
17726 pgrp = task_pgrp(current);
17727 do_each_pid_thread(pgrp, PIDTYPE_PGID, p) {
17728 + if (!vx_check(p->xid, VS_ADMIN_P | VS_IDENT))
17730 niceval = 20 - task_nice(p);
17731 if (niceval > retval)
17733 @@ -355,6 +363,8 @@ EXPORT_SYMBOL_GPL(kernel_power_off);
17735 static DEFINE_MUTEX(reboot_mutex);
17737 +long vs_reboot(unsigned int, void __user *);
17740 * Reboot system call: for obvious reasons only root may call it,
17741 * and even root needs to set up some magic numbers in the registers
17742 @@ -387,6 +397,9 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
17743 if ((cmd == LINUX_REBOOT_CMD_POWER_OFF) && !pm_power_off)
17744 cmd = LINUX_REBOOT_CMD_HALT;
17746 + if (!vx_check(0, VS_ADMIN|VS_WATCH))
17747 + return vs_reboot(cmd, arg);
17749 mutex_lock(&reboot_mutex);
17751 case LINUX_REBOOT_CMD_RESTART:
17752 @@ -1136,7 +1149,7 @@ SYSCALL_DEFINE2(sethostname, char __user
17754 char tmp[__NEW_UTS_LEN];
17756 - if (!capable(CAP_SYS_ADMIN))
17757 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
17759 if (len < 0 || len > __NEW_UTS_LEN)
17761 @@ -1185,7 +1198,7 @@ SYSCALL_DEFINE2(setdomainname, char __us
17763 char tmp[__NEW_UTS_LEN];
17765 - if (!capable(CAP_SYS_ADMIN))
17766 + if (!vx_capable(CAP_SYS_ADMIN, VXC_SET_UTSNAME))
17768 if (len < 0 || len > __NEW_UTS_LEN)
17770 @@ -1254,7 +1267,7 @@ SYSCALL_DEFINE2(setrlimit, unsigned int,
17772 old_rlim = current->signal->rlim + resource;
17773 if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
17774 - !capable(CAP_SYS_RESOURCE))
17775 + !vx_capable(CAP_SYS_RESOURCE, VXC_SET_RLIMIT))
17777 if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
17779 diff -NurpP --minimal linux-2.6.33.1/kernel/sysctl_binary.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sysctl_binary.c
17780 --- linux-2.6.33.1/kernel/sysctl_binary.c 2010-02-25 11:52:09.000000000 +0100
17781 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sysctl_binary.c 2010-02-25 12:40:06.000000000 +0100
17782 @@ -71,6 +71,7 @@ static const struct bin_table bin_kern_t
17784 { CTL_INT, KERN_PANIC, "panic" },
17785 { CTL_INT, KERN_REALROOTDEV, "real-root-dev" },
17786 + { CTL_STR, KERN_VSHELPER, "vshelper" },
17788 { CTL_STR, KERN_SPARC_REBOOT, "reboot-cmd" },
17789 { CTL_INT, KERN_CTLALTDEL, "ctrl-alt-del" },
17790 diff -NurpP --minimal linux-2.6.33.1/kernel/sysctl.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sysctl.c
17791 --- linux-2.6.33.1/kernel/sysctl.c 2010-02-25 11:52:09.000000000 +0100
17792 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/sysctl.c 2010-02-25 14:43:48.000000000 +0100
17793 @@ -123,6 +123,7 @@ static int ngroups_max = NGROUPS_MAX;
17794 extern char modprobe_path[];
17795 extern int modules_disabled;
17797 +extern char vshelper_path[];
17798 #ifdef CONFIG_CHR_DEV_SG
17799 extern int sg_big_buff;
17801 @@ -553,6 +554,13 @@ static struct ctl_table kern_table[] = {
17802 .proc_handler = proc_dostring,
17806 + .procname = "vshelper",
17807 + .data = &vshelper_path,
17810 + .proc_handler = &proc_dostring,
17812 #ifdef CONFIG_CHR_DEV_SG
17814 .procname = "sg-big-buff",
17815 diff -NurpP --minimal linux-2.6.33.1/kernel/time.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/time.c
17816 --- linux-2.6.33.1/kernel/time.c 2010-02-25 11:52:09.000000000 +0100
17817 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/time.c 2010-02-25 12:02:16.000000000 +0100
17818 @@ -63,6 +63,7 @@ EXPORT_SYMBOL(sys_tz);
17819 SYSCALL_DEFINE1(time, time_t __user *, tloc)
17821 time_t i = get_seconds();
17822 +/* FIXME: do_gettimeofday(&tv) -> vx_gettimeofday(&tv) */
17825 if (put_user(i,tloc))
17826 @@ -93,7 +94,7 @@ SYSCALL_DEFINE1(stime, time_t __user *,
17830 - do_settimeofday(&tv);
17831 + vx_settimeofday(&tv);
17835 @@ -104,7 +105,7 @@ SYSCALL_DEFINE2(gettimeofday, struct tim
17837 if (likely(tv != NULL)) {
17838 struct timeval ktv;
17839 - do_gettimeofday(&ktv);
17840 + vx_gettimeofday(&ktv);
17841 if (copy_to_user(tv, &ktv, sizeof(ktv)))
17844 @@ -179,7 +180,7 @@ int do_sys_settimeofday(struct timespec
17845 /* SMP safe, again the code in arch/foo/time.c should
17846 * globally block out interrupts when it runs.
17848 - return do_settimeofday(tv);
17849 + return vx_settimeofday(tv);
17853 @@ -311,7 +312,7 @@ void getnstimeofday(struct timespec *tv)
17857 - do_gettimeofday(&x);
17858 + vx_gettimeofday(&x);
17859 tv->tv_sec = x.tv_sec;
17860 tv->tv_nsec = x.tv_usec * NSEC_PER_USEC;
17862 diff -NurpP --minimal linux-2.6.33.1/kernel/timer.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/timer.c
17863 --- linux-2.6.33.1/kernel/timer.c 2010-02-25 11:52:09.000000000 +0100
17864 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/timer.c 2010-02-25 12:02:16.000000000 +0100
17866 #include <linux/kallsyms.h>
17867 #include <linux/perf_event.h>
17868 #include <linux/sched.h>
17869 +#include <linux/vs_base.h>
17870 +#include <linux/vs_cvirt.h>
17871 +#include <linux/vs_pid.h>
17872 +#include <linux/vserver/sched.h>
17874 #include <asm/uaccess.h>
17875 #include <asm/unistd.h>
17876 @@ -1252,12 +1256,6 @@ SYSCALL_DEFINE1(alarm, unsigned int, sec
17883 - * The Alpha uses getxpid, getxuid, and getxgid instead. Maybe this
17884 - * should be moved into arch/i386 instead?
17888 * sys_getpid - return the thread group id of the current process
17889 @@ -1286,10 +1284,23 @@ SYSCALL_DEFINE0(getppid)
17891 pid = task_tgid_vnr(current->real_parent);
17893 + return vx_map_pid(pid);
17900 + * The Alpha uses getxpid, getxuid, and getxgid instead.
17903 +asmlinkage long do_getxpid(long *ppid)
17905 + *ppid = sys_getppid();
17906 + return sys_getpid();
17909 +#else /* _alpha_ */
17911 SYSCALL_DEFINE0(getuid)
17913 /* Only we change this so SMP safe */
17914 diff -NurpP --minimal linux-2.6.33.1/kernel/user.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/user.c
17915 --- linux-2.6.33.1/kernel/user.c 2009-12-03 20:02:58.000000000 +0100
17916 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/user.c 2010-02-25 12:02:16.000000000 +0100
17917 @@ -251,10 +251,10 @@ static struct kobj_type uids_ktype = {
17919 * See Documentation/scheduler/sched-design-CFS.txt for ramifications.
17921 -static int uids_user_create(struct user_struct *up)
17922 +static int uids_user_create(struct user_namespace *ns, struct user_struct *up)
17924 struct kobject *kobj = &up->kobj;
17928 memset(kobj, 0, sizeof(struct kobject));
17929 if (up->user_ns != &init_user_ns)
17930 @@ -282,7 +282,7 @@ int __init uids_sysfs_init(void)
17934 - return uids_user_create(&root_user);
17935 + return uids_user_create(NULL, &root_user);
17938 /* delayed work function to remove sysfs directory for a user and free up
17939 @@ -353,7 +353,8 @@ static struct user_struct *uid_hash_find
17942 int uids_sysfs_init(void) { return 0; }
17943 -static inline int uids_user_create(struct user_struct *up) { return 0; }
17944 +static inline int uids_user_create(struct user_namespace *ns,
17945 + struct user_struct *up) { return 0; }
17946 static inline void uids_mutex_lock(void) { }
17947 static inline void uids_mutex_unlock(void) { }
17949 @@ -450,7 +451,7 @@ struct user_struct *alloc_uid(struct use
17951 new->user_ns = get_user_ns(ns);
17953 - if (uids_user_create(new))
17954 + if (uids_user_create(ns, new))
17955 goto out_destoy_sched;
17958 diff -NurpP --minimal linux-2.6.33.1/kernel/user_namespace.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/user_namespace.c
17959 --- linux-2.6.33.1/kernel/user_namespace.c 2009-03-24 14:22:45.000000000 +0100
17960 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/user_namespace.c 2010-02-25 12:02:16.000000000 +0100
17962 #include <linux/slab.h>
17963 #include <linux/user_namespace.h>
17964 #include <linux/cred.h>
17965 +#include <linux/vserver/global.h>
17968 * Create a new user namespace, deriving the creator from the user in the
17969 @@ -30,6 +31,7 @@ int create_user_ns(struct cred *new)
17972 kref_init(&ns->kref);
17973 + atomic_inc(&vs_global_user_ns);
17975 for (n = 0; n < UIDHASH_SZ; ++n)
17976 INIT_HLIST_HEAD(ns->uidhash_table + n);
17977 @@ -78,6 +80,8 @@ void free_user_ns(struct kref *kref)
17978 struct user_namespace *ns =
17979 container_of(kref, struct user_namespace, kref);
17981 + /* FIXME: maybe move into destroyer? */
17982 + atomic_dec(&vs_global_user_ns);
17983 INIT_WORK(&ns->destroyer, free_user_ns_work);
17984 schedule_work(&ns->destroyer);
17986 diff -NurpP --minimal linux-2.6.33.1/kernel/utsname.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/utsname.c
17987 --- linux-2.6.33.1/kernel/utsname.c 2009-09-10 15:26:28.000000000 +0200
17988 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/utsname.c 2010-02-25 12:02:16.000000000 +0100
17989 @@ -14,14 +14,17 @@
17990 #include <linux/utsname.h>
17991 #include <linux/err.h>
17992 #include <linux/slab.h>
17993 +#include <linux/vserver/global.h>
17995 static struct uts_namespace *create_uts_ns(void)
17997 struct uts_namespace *uts_ns;
17999 uts_ns = kmalloc(sizeof(struct uts_namespace), GFP_KERNEL);
18002 kref_init(&uts_ns->kref);
18003 + atomic_inc(&vs_global_uts_ns);
18008 @@ -71,5 +74,6 @@ void free_uts_ns(struct kref *kref)
18009 struct uts_namespace *ns;
18011 ns = container_of(kref, struct uts_namespace, kref);
18012 + atomic_dec(&vs_global_uts_ns);
18015 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/cacct.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cacct.c
18016 --- linux-2.6.33.1/kernel/vserver/cacct.c 1970-01-01 01:00:00.000000000 +0100
18017 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cacct.c 2010-02-25 12:02:16.000000000 +0100
18020 + * linux/kernel/vserver/cacct.c
18022 + * Virtual Server: Context Accounting
18024 + * Copyright (C) 2006-2007 Herbert Pötzl
18026 + * V0.01 added accounting stats
18030 +#include <linux/types.h>
18031 +#include <linux/vs_context.h>
18032 +#include <linux/vserver/cacct_cmd.h>
18033 +#include <linux/vserver/cacct_int.h>
18035 +#include <asm/errno.h>
18036 +#include <asm/uaccess.h>
18039 +int vc_sock_stat(struct vx_info *vxi, void __user *data)
18041 + struct vcmd_sock_stat_v0 vc_data;
18044 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
18047 + field = vc_data.field;
18048 + if ((field < 0) || (field >= VXA_SOCK_SIZE))
18051 + for (j = 0; j < 3; j++) {
18052 + vc_data.count[j] = vx_sock_count(&vxi->cacct, field, j);
18053 + vc_data.total[j] = vx_sock_total(&vxi->cacct, field, j);
18056 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18061 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/cacct_init.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cacct_init.h
18062 --- linux-2.6.33.1/kernel/vserver/cacct_init.h 1970-01-01 01:00:00.000000000 +0100
18063 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cacct_init.h 2010-02-25 12:02:16.000000000 +0100
18067 +static inline void vx_info_init_cacct(struct _vx_cacct *cacct)
18072 + for (i = 0; i < VXA_SOCK_SIZE; i++) {
18073 + for (j = 0; j < 3; j++) {
18074 + atomic_long_set(&cacct->sock[i][j].count, 0);
18075 + atomic_long_set(&cacct->sock[i][j].total, 0);
18078 + for (i = 0; i < 8; i++)
18079 + atomic_set(&cacct->slab[i], 0);
18080 + for (i = 0; i < 5; i++)
18081 + for (j = 0; j < 4; j++)
18082 + atomic_set(&cacct->page[i][j], 0);
18085 +static inline void vx_info_exit_cacct(struct _vx_cacct *cacct)
18090 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/cacct_proc.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cacct_proc.h
18091 --- linux-2.6.33.1/kernel/vserver/cacct_proc.h 1970-01-01 01:00:00.000000000 +0100
18092 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cacct_proc.h 2010-02-25 12:02:16.000000000 +0100
18094 +#ifndef _VX_CACCT_PROC_H
18095 +#define _VX_CACCT_PROC_H
18097 +#include <linux/vserver/cacct_int.h>
18100 +#define VX_SOCKA_TOP \
18101 + "Type\t recv #/bytes\t\t send #/bytes\t\t fail #/bytes\n"
18103 +static inline int vx_info_proc_cacct(struct _vx_cacct *cacct, char *buffer)
18105 + int i, j, length = 0;
18106 + static char *type[VXA_SOCK_SIZE] = {
18107 + "UNSPEC", "UNIX", "INET", "INET6", "PACKET", "OTHER"
18110 + length += sprintf(buffer + length, VX_SOCKA_TOP);
18111 + for (i = 0; i < VXA_SOCK_SIZE; i++) {
18112 + length += sprintf(buffer + length, "%s:", type[i]);
18113 + for (j = 0; j < 3; j++) {
18114 + length += sprintf(buffer + length,
18115 + "\t%10lu/%-10lu",
18116 + vx_sock_count(cacct, i, j),
18117 + vx_sock_total(cacct, i, j));
18119 + buffer[length++] = '\n';
18122 + length += sprintf(buffer + length, "\n");
18123 + length += sprintf(buffer + length,
18124 + "slab:\t %8u %8u %8u %8u\n",
18125 + atomic_read(&cacct->slab[1]),
18126 + atomic_read(&cacct->slab[4]),
18127 + atomic_read(&cacct->slab[0]),
18128 + atomic_read(&cacct->slab[2]));
18130 + length += sprintf(buffer + length, "\n");
18131 + for (i = 0; i < 5; i++) {
18132 + length += sprintf(buffer + length,
18133 + "page[%d]: %8u %8u %8u %8u\t %8u %8u %8u %8u\n", i,
18134 + atomic_read(&cacct->page[i][0]),
18135 + atomic_read(&cacct->page[i][1]),
18136 + atomic_read(&cacct->page[i][2]),
18137 + atomic_read(&cacct->page[i][3]),
18138 + atomic_read(&cacct->page[i][4]),
18139 + atomic_read(&cacct->page[i][5]),
18140 + atomic_read(&cacct->page[i][6]),
18141 + atomic_read(&cacct->page[i][7]));
18146 +#endif /* _VX_CACCT_PROC_H */
18147 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/context.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/context.c
18148 --- linux-2.6.33.1/kernel/vserver/context.c 1970-01-01 01:00:00.000000000 +0100
18149 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/context.c 2010-03-10 20:35:53.000000000 +0100
18152 + * linux/kernel/vserver/context.c
18154 + * Virtual Server: Context Support
18156 + * Copyright (C) 2003-2007 Herbert Pötzl
18158 + * V0.01 context helper
18159 + * V0.02 vx_ctx_kill syscall command
18160 + * V0.03 replaced context_info calls
18161 + * V0.04 redesign of struct (de)alloc
18162 + * V0.05 rlimit basic implementation
18163 + * V0.06 task_xid and info commands
18164 + * V0.07 context flags and caps
18165 + * V0.08 switch to RCU based hash
18166 + * V0.09 revert to non RCU for now
18167 + * V0.10 and back to working RCU hash
18168 + * V0.11 and back to locking again
18169 + * V0.12 referenced context store
18170 + * V0.13 separate per cpu data
18171 + * V0.14 changed vcmds to vxi arg
18172 + * V0.15 added context stat
18173 + * V0.16 have __create claim() the vxi
18174 + * V0.17 removed older and legacy stuff
18178 +#include <linux/slab.h>
18179 +#include <linux/types.h>
18180 +#include <linux/security.h>
18181 +#include <linux/pid_namespace.h>
18183 +#include <linux/vserver/context.h>
18184 +#include <linux/vserver/network.h>
18185 +#include <linux/vserver/debug.h>
18186 +#include <linux/vserver/limit.h>
18187 +#include <linux/vserver/limit_int.h>
18188 +#include <linux/vserver/space.h>
18189 +#include <linux/init_task.h>
18190 +#include <linux/fs_struct.h>
18192 +#include <linux/vs_context.h>
18193 +#include <linux/vs_limit.h>
18194 +#include <linux/vs_pid.h>
18195 +#include <linux/vserver/context_cmd.h>
18197 +#include "cvirt_init.h"
18198 +#include "cacct_init.h"
18199 +#include "limit_init.h"
18200 +#include "sched_init.h"
18203 +atomic_t vx_global_ctotal = ATOMIC_INIT(0);
18204 +atomic_t vx_global_cactive = ATOMIC_INIT(0);
18207 +/* now inactive context structures */
18209 +static struct hlist_head vx_info_inactive = HLIST_HEAD_INIT;
18211 +static spinlock_t vx_info_inactive_lock = SPIN_LOCK_UNLOCKED;
18214 +/* __alloc_vx_info()
18216 + * allocate an initialized vx_info struct
18217 + * doesn't make it visible (hash) */
18219 +static struct vx_info *__alloc_vx_info(xid_t xid)
18221 + struct vx_info *new = NULL;
18224 + vxdprintk(VXD_CBIT(xid, 0), "alloc_vx_info(%d)*", xid);
18226 + /* would this benefit from a slab cache? */
18227 + new = kmalloc(sizeof(struct vx_info), GFP_KERNEL);
18231 + memset(new, 0, sizeof(struct vx_info));
18233 + new->ptr_pc = alloc_percpu(struct _vx_info_pc);
18234 + if (!new->ptr_pc)
18237 + new->vx_id = xid;
18238 + INIT_HLIST_NODE(&new->vx_hlist);
18239 + atomic_set(&new->vx_usecnt, 0);
18240 + atomic_set(&new->vx_tasks, 0);
18241 + new->vx_parent = NULL;
18242 + new->vx_state = 0;
18243 + init_waitqueue_head(&new->vx_wait);
18245 + /* prepare reaper */
18246 + get_task_struct(init_pid_ns.child_reaper);
18247 + new->vx_reaper = init_pid_ns.child_reaper;
18248 + new->vx_badness_bias = 0;
18250 + /* rest of init goes here */
18251 + vx_info_init_limit(&new->limit);
18252 + vx_info_init_sched(&new->sched);
18253 + vx_info_init_cvirt(&new->cvirt);
18254 + vx_info_init_cacct(&new->cacct);
18256 + /* per cpu data structures */
18257 + for_each_possible_cpu(cpu) {
18258 + vx_info_init_sched_pc(
18259 + &vx_per_cpu(new, sched_pc, cpu), cpu);
18260 + vx_info_init_cvirt_pc(
18261 + &vx_per_cpu(new, cvirt_pc, cpu), cpu);
18264 + new->vx_flags = VXF_INIT_SET;
18265 + cap_set_init_eff(new->vx_bcaps);
18266 + new->vx_ccaps = 0;
18267 + new->vx_umask = 0;
18269 + new->reboot_cmd = 0;
18270 + new->exit_code = 0;
18272 + // preconfig fs entries
18273 + for (index = 0; index < VX_SPACES; index++) {
18274 + write_lock(&init_fs.lock);
18276 + write_unlock(&init_fs.lock);
18277 + new->vx_fs[index] = &init_fs;
18280 + vxdprintk(VXD_CBIT(xid, 0),
18281 + "alloc_vx_info(%d) = %p", xid, new);
18282 + vxh_alloc_vx_info(new);
18283 + atomic_inc(&vx_global_ctotal);
18292 +/* __dealloc_vx_info()
18294 + * final disposal of vx_info */
18296 +static void __dealloc_vx_info(struct vx_info *vxi)
18298 +#ifdef CONFIG_VSERVER_WARN
18299 + struct vx_info_save vxis;
18302 + vxdprintk(VXD_CBIT(xid, 0),
18303 + "dealloc_vx_info(%p)", vxi);
18304 + vxh_dealloc_vx_info(vxi);
18306 +#ifdef CONFIG_VSERVER_WARN
18307 + enter_vx_info(vxi, &vxis);
18308 + vx_info_exit_limit(&vxi->limit);
18309 + vx_info_exit_sched(&vxi->sched);
18310 + vx_info_exit_cvirt(&vxi->cvirt);
18311 + vx_info_exit_cacct(&vxi->cacct);
18313 + for_each_possible_cpu(cpu) {
18314 + vx_info_exit_sched_pc(
18315 + &vx_per_cpu(vxi, sched_pc, cpu), cpu);
18316 + vx_info_exit_cvirt_pc(
18317 + &vx_per_cpu(vxi, cvirt_pc, cpu), cpu);
18319 + leave_vx_info(&vxis);
18323 + vxi->vx_state |= VXS_RELEASED;
18326 + free_percpu(vxi->ptr_pc);
18329 + atomic_dec(&vx_global_ctotal);
18332 +static void __shutdown_vx_info(struct vx_info *vxi)
18334 + struct nsproxy *nsproxy;
18335 + struct fs_struct *fs;
18340 + vxi->vx_state |= VXS_SHUTDOWN;
18341 + vs_state_change(vxi, VSC_SHUTDOWN);
18343 + for (index = 0; index < VX_SPACES; index++) {
18344 + nsproxy = xchg(&vxi->vx_nsproxy[index], NULL);
18346 + put_nsproxy(nsproxy);
18348 + fs = xchg(&vxi->vx_fs[index], NULL);
18349 + write_lock(&fs->lock);
18350 + kill = !--fs->users;
18351 + write_unlock(&fs->lock);
18353 + free_fs_struct(fs);
18357 +/* exported stuff */
18359 +void free_vx_info(struct vx_info *vxi)
18361 + unsigned long flags;
18364 + /* check for reference counts first */
18365 + BUG_ON(atomic_read(&vxi->vx_usecnt));
18366 + BUG_ON(atomic_read(&vxi->vx_tasks));
18368 + /* context must not be hashed */
18369 + BUG_ON(vx_info_state(vxi, VXS_HASHED));
18371 + /* context shutdown is mandatory */
18372 + BUG_ON(!vx_info_state(vxi, VXS_SHUTDOWN));
18374 + /* nsproxy and fs check */
18375 + for (index = 0; index < VX_SPACES; index++) {
18376 + BUG_ON(vxi->vx_nsproxy[index]);
18377 + BUG_ON(vxi->vx_fs[index]);
18380 + spin_lock_irqsave(&vx_info_inactive_lock, flags);
18381 + hlist_del(&vxi->vx_hlist);
18382 + spin_unlock_irqrestore(&vx_info_inactive_lock, flags);
18384 + __dealloc_vx_info(vxi);
18388 +/* hash table for vx_info hash */
18390 +#define VX_HASH_SIZE 13
18392 +static struct hlist_head vx_info_hash[VX_HASH_SIZE] =
18393 + { [0 ... VX_HASH_SIZE-1] = HLIST_HEAD_INIT };
18395 +static spinlock_t vx_info_hash_lock = SPIN_LOCK_UNLOCKED;
18398 +static inline unsigned int __hashval(xid_t xid)
18400 + return (xid % VX_HASH_SIZE);
18405 +/* __hash_vx_info()
18407 + * add the vxi to the global hash table
18408 + * requires the hash_lock to be held */
18410 +static inline void __hash_vx_info(struct vx_info *vxi)
18412 + struct hlist_head *head;
18414 + vxd_assert_lock(&vx_info_hash_lock);
18415 + vxdprintk(VXD_CBIT(xid, 4),
18416 + "__hash_vx_info: %p[#%d]", vxi, vxi->vx_id);
18417 + vxh_hash_vx_info(vxi);
18419 + /* context must not be hashed */
18420 + BUG_ON(vx_info_state(vxi, VXS_HASHED));
18422 + vxi->vx_state |= VXS_HASHED;
18423 + head = &vx_info_hash[__hashval(vxi->vx_id)];
18424 + hlist_add_head(&vxi->vx_hlist, head);
18425 + atomic_inc(&vx_global_cactive);
18428 +/* __unhash_vx_info()
18430 + * remove the vxi from the global hash table
18431 + * requires the hash_lock to be held */
18433 +static inline void __unhash_vx_info(struct vx_info *vxi)
18435 + unsigned long flags;
18437 + vxd_assert_lock(&vx_info_hash_lock);
18438 + vxdprintk(VXD_CBIT(xid, 4),
18439 + "__unhash_vx_info: %p[#%d.%d.%d]", vxi, vxi->vx_id,
18440 + atomic_read(&vxi->vx_usecnt), atomic_read(&vxi->vx_tasks));
18441 + vxh_unhash_vx_info(vxi);
18443 + /* context must be hashed */
18444 + BUG_ON(!vx_info_state(vxi, VXS_HASHED));
18445 + /* but without tasks */
18446 + BUG_ON(atomic_read(&vxi->vx_tasks));
18448 + vxi->vx_state &= ~VXS_HASHED;
18449 + hlist_del_init(&vxi->vx_hlist);
18450 + spin_lock_irqsave(&vx_info_inactive_lock, flags);
18451 + hlist_add_head(&vxi->vx_hlist, &vx_info_inactive);
18452 + spin_unlock_irqrestore(&vx_info_inactive_lock, flags);
18453 + atomic_dec(&vx_global_cactive);
18457 +/* __lookup_vx_info()
18459 + * requires the hash_lock to be held
18460 + * doesn't increment the vx_refcnt */
18462 +static inline struct vx_info *__lookup_vx_info(xid_t xid)
18464 + struct hlist_head *head = &vx_info_hash[__hashval(xid)];
18465 + struct hlist_node *pos;
18466 + struct vx_info *vxi;
18468 + vxd_assert_lock(&vx_info_hash_lock);
18469 + hlist_for_each(pos, head) {
18470 + vxi = hlist_entry(pos, struct vx_info, vx_hlist);
18472 + if (vxi->vx_id == xid)
18477 + vxdprintk(VXD_CBIT(xid, 0),
18478 + "__lookup_vx_info(#%u): %p[#%u]",
18479 + xid, vxi, vxi ? vxi->vx_id : 0);
18480 + vxh_lookup_vx_info(vxi, xid);
18485 +/* __create_vx_info()
18487 + * create the requested context
18488 + * get(), claim() and hash it */
18490 +static struct vx_info *__create_vx_info(int id)
18492 + struct vx_info *new, *vxi = NULL;
18494 + vxdprintk(VXD_CBIT(xid, 1), "create_vx_info(%d)*", id);
18496 + if (!(new = __alloc_vx_info(id)))
18497 + return ERR_PTR(-ENOMEM);
18499 + /* required to make dynamic xids unique */
18500 + spin_lock(&vx_info_hash_lock);
18502 + /* static context requested */
18503 + if ((vxi = __lookup_vx_info(id))) {
18504 + vxdprintk(VXD_CBIT(xid, 0),
18505 + "create_vx_info(%d) = %p (already there)", id, vxi);
18506 + if (vx_info_flags(vxi, VXF_STATE_SETUP, 0))
18507 + vxi = ERR_PTR(-EBUSY);
18509 + vxi = ERR_PTR(-EEXIST);
18512 + /* new context */
18513 + vxdprintk(VXD_CBIT(xid, 0),
18514 + "create_vx_info(%d) = %p (new)", id, new);
18515 + claim_vx_info(new, NULL);
18516 + __hash_vx_info(get_vx_info(new));
18517 + vxi = new, new = NULL;
18520 + spin_unlock(&vx_info_hash_lock);
18521 + vxh_create_vx_info(IS_ERR(vxi) ? NULL : vxi, id);
18523 + __dealloc_vx_info(new);
18528 +/* exported stuff */
18531 +void unhash_vx_info(struct vx_info *vxi)
18533 + __shutdown_vx_info(vxi);
18534 + spin_lock(&vx_info_hash_lock);
18535 + __unhash_vx_info(vxi);
18536 + spin_unlock(&vx_info_hash_lock);
18537 + __wakeup_vx_info(vxi);
18541 +/* lookup_vx_info()
18543 + * search for a vx_info and get() it
18544 + * negative id means current */
18546 +struct vx_info *lookup_vx_info(int id)
18548 + struct vx_info *vxi = NULL;
18551 + vxi = get_vx_info(current_vx_info());
18552 + } else if (id > 1) {
18553 + spin_lock(&vx_info_hash_lock);
18554 + vxi = get_vx_info(__lookup_vx_info(id));
18555 + spin_unlock(&vx_info_hash_lock);
18560 +/* xid_is_hashed()
18562 + * verify that xid is still hashed */
18564 +int xid_is_hashed(xid_t xid)
18568 + spin_lock(&vx_info_hash_lock);
18569 + hashed = (__lookup_vx_info(xid) != NULL);
18570 + spin_unlock(&vx_info_hash_lock);
18574 +#ifdef CONFIG_PROC_FS
18578 + * get a subset of hashed xids for proc
18579 + * assumes size is at least one */
18581 +int get_xid_list(int index, unsigned int *xids, int size)
18583 + int hindex, nr_xids = 0;
18585 + /* only show current and children */
18586 + if (!vx_check(0, VS_ADMIN | VS_WATCH)) {
18589 + xids[nr_xids] = vx_current_xid();
18593 + for (hindex = 0; hindex < VX_HASH_SIZE; hindex++) {
18594 + struct hlist_head *head = &vx_info_hash[hindex];
18595 + struct hlist_node *pos;
18597 + spin_lock(&vx_info_hash_lock);
18598 + hlist_for_each(pos, head) {
18599 + struct vx_info *vxi;
18604 + vxi = hlist_entry(pos, struct vx_info, vx_hlist);
18605 + xids[nr_xids] = vxi->vx_id;
18606 + if (++nr_xids >= size) {
18607 + spin_unlock(&vx_info_hash_lock);
18611 + /* keep the lock time short */
18612 + spin_unlock(&vx_info_hash_lock);
18619 +#ifdef CONFIG_VSERVER_DEBUG
18621 +void dump_vx_info_inactive(int level)
18623 + struct hlist_node *entry, *next;
18625 + hlist_for_each_safe(entry, next, &vx_info_inactive) {
18626 + struct vx_info *vxi =
18627 + list_entry(entry, struct vx_info, vx_hlist);
18629 + dump_vx_info(vxi, level);
18636 +int vx_migrate_user(struct task_struct *p, struct vx_info *vxi)
18638 + struct user_struct *new_user, *old_user;
18643 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0))
18646 + new_user = alloc_uid(vxi->vx_id, p->uid);
18650 + old_user = p->user;
18651 + if (new_user != old_user) {
18652 + atomic_inc(&new_user->processes);
18653 + atomic_dec(&old_user->processes);
18654 + p->user = new_user;
18656 + free_uid(old_user);
18662 +void vx_mask_cap_bset(struct vx_info *vxi, struct task_struct *p)
18664 + // p->cap_effective &= vxi->vx_cap_bset;
18665 + p->cap_effective =
18666 + cap_intersect(p->cap_effective, vxi->cap_bset);
18667 + // p->cap_inheritable &= vxi->vx_cap_bset;
18668 + p->cap_inheritable =
18669 + cap_intersect(p->cap_inheritable, vxi->cap_bset);
18670 + // p->cap_permitted &= vxi->vx_cap_bset;
18671 + p->cap_permitted =
18672 + cap_intersect(p->cap_permitted, vxi->cap_bset);
18677 +#include <linux/file.h>
18678 +#include <linux/fdtable.h>
18680 +static int vx_openfd_task(struct task_struct *tsk)
18682 + struct files_struct *files = tsk->files;
18683 + struct fdtable *fdt;
18684 + const unsigned long *bptr;
18685 + int count, total;
18687 + /* no rcu_read_lock() because of spin_lock() */
18688 + spin_lock(&files->file_lock);
18689 + fdt = files_fdtable(files);
18690 + bptr = fdt->open_fds->fds_bits;
18691 + count = fdt->max_fds / (sizeof(unsigned long) * 8);
18692 + for (total = 0; count > 0; count--) {
18694 + total += hweight_long(*bptr);
18697 + spin_unlock(&files->file_lock);
18702 +/* for *space compatibility */
18704 +asmlinkage long sys_unshare(unsigned long);
18707 + * migrate task to new context
18708 + * gets vxi, puts old_vxi on change
18709 + * optionally unshares namespaces (hack)
18712 +int vx_migrate_task(struct task_struct *p, struct vx_info *vxi, int unshare)
18714 + struct vx_info *old_vxi;
18720 + vxdprintk(VXD_CBIT(xid, 5),
18721 + "vx_migrate_task(%p,%p[#%d.%d])", p, vxi,
18722 + vxi->vx_id, atomic_read(&vxi->vx_usecnt));
18724 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0) &&
18725 + !vx_info_flags(vxi, VXF_STATE_SETUP, 0))
18728 + if (vx_info_state(vxi, VXS_SHUTDOWN))
18731 + old_vxi = task_get_vx_info(p);
18732 + if (old_vxi == vxi)
18735 +// if (!(ret = vx_migrate_user(p, vxi))) {
18740 + openfd = vx_openfd_task(p);
18743 + atomic_dec(&old_vxi->cvirt.nr_threads);
18744 + atomic_dec(&old_vxi->cvirt.nr_running);
18745 + __rlim_dec(&old_vxi->limit, RLIMIT_NPROC);
18746 + /* FIXME: what about the struct files here? */
18747 + __rlim_sub(&old_vxi->limit, VLIMIT_OPENFD, openfd);
18748 + /* account for the executable */
18749 + __rlim_dec(&old_vxi->limit, VLIMIT_DENTRY);
18751 + atomic_inc(&vxi->cvirt.nr_threads);
18752 + atomic_inc(&vxi->cvirt.nr_running);
18753 + __rlim_inc(&vxi->limit, RLIMIT_NPROC);
18754 + /* FIXME: what about the struct files here? */
18755 + __rlim_add(&vxi->limit, VLIMIT_OPENFD, openfd);
18756 + /* account for the executable */
18757 + __rlim_inc(&vxi->limit, VLIMIT_DENTRY);
18760 + release_vx_info(old_vxi, p);
18761 + clr_vx_info(&p->vx_info);
18763 + claim_vx_info(vxi, p);
18764 + set_vx_info(&p->vx_info, vxi);
18765 + p->xid = vxi->vx_id;
18767 + vxdprintk(VXD_CBIT(xid, 5),
18768 + "moved task %p into vxi:%p[#%d]",
18769 + p, vxi, vxi->vx_id);
18771 + // vx_mask_cap_bset(vxi, p);
18774 + /* hack for *spaces to provide compatibility */
18776 + struct nsproxy *old_nsp, *new_nsp;
18778 + ret = unshare_nsproxy_namespaces(
18779 + CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER,
18784 + old_nsp = xchg(&p->nsproxy, new_nsp);
18785 + vx_set_space(vxi,
18786 + CLONE_NEWUTS | CLONE_NEWIPC | CLONE_NEWUSER, 0);
18787 + put_nsproxy(old_nsp);
18791 + put_vx_info(old_vxi);
18795 +int vx_set_reaper(struct vx_info *vxi, struct task_struct *p)
18797 + struct task_struct *old_reaper;
18802 + vxdprintk(VXD_CBIT(xid, 6),
18803 + "vx_set_reaper(%p[#%d],%p[#%d,%d])",
18804 + vxi, vxi->vx_id, p, p->xid, p->pid);
18806 + old_reaper = vxi->vx_reaper;
18807 + if (old_reaper == p)
18810 + /* set new child reaper */
18811 + get_task_struct(p);
18812 + vxi->vx_reaper = p;
18813 + put_task_struct(old_reaper);
18817 +int vx_set_init(struct vx_info *vxi, struct task_struct *p)
18822 + vxdprintk(VXD_CBIT(xid, 6),
18823 + "vx_set_init(%p[#%d],%p[#%d,%d,%d])",
18824 + vxi, vxi->vx_id, p, p->xid, p->pid, p->tgid);
18826 + vxi->vx_flags &= ~VXF_STATE_INIT;
18827 + // vxi->vx_initpid = p->tgid;
18828 + vxi->vx_initpid = p->pid;
18832 +void vx_exit_init(struct vx_info *vxi, struct task_struct *p, int code)
18834 + vxdprintk(VXD_CBIT(xid, 6),
18835 + "vx_exit_init(%p[#%d],%p[#%d,%d,%d])",
18836 + vxi, vxi->vx_id, p, p->xid, p->pid, p->tgid);
18838 + vxi->exit_code = code;
18839 + vxi->vx_initpid = 0;
18843 +void vx_set_persistent(struct vx_info *vxi)
18845 + vxdprintk(VXD_CBIT(xid, 6),
18846 + "vx_set_persistent(%p[#%d])", vxi, vxi->vx_id);
18848 + get_vx_info(vxi);
18849 + claim_vx_info(vxi, NULL);
18852 +void vx_clear_persistent(struct vx_info *vxi)
18854 + vxdprintk(VXD_CBIT(xid, 6),
18855 + "vx_clear_persistent(%p[#%d])", vxi, vxi->vx_id);
18857 + release_vx_info(vxi, NULL);
18858 + put_vx_info(vxi);
18861 +void vx_update_persistent(struct vx_info *vxi)
18863 + if (vx_info_flags(vxi, VXF_PERSISTENT, 0))
18864 + vx_set_persistent(vxi);
18866 + vx_clear_persistent(vxi);
18870 +/* task must be current or locked */
18872 +void exit_vx_info(struct task_struct *p, int code)
18874 + struct vx_info *vxi = p->vx_info;
18877 + atomic_dec(&vxi->cvirt.nr_threads);
18880 + vxi->exit_code = code;
18881 + release_vx_info(vxi, p);
18885 +void exit_vx_info_early(struct task_struct *p, int code)
18887 + struct vx_info *vxi = p->vx_info;
18890 + if (vxi->vx_initpid == p->pid)
18891 + vx_exit_init(vxi, p, code);
18892 + if (vxi->vx_reaper == p)
18893 + vx_set_reaper(vxi, init_pid_ns.child_reaper);
18898 +/* vserver syscall commands below here */
18900 +/* taks xid and vx_info functions */
18902 +#include <asm/uaccess.h>
18905 +int vc_task_xid(uint32_t id)
18910 + struct task_struct *tsk;
18912 + read_lock(&tasklist_lock);
18913 + tsk = find_task_by_real_pid(id);
18914 + xid = (tsk) ? tsk->xid : -ESRCH;
18915 + read_unlock(&tasklist_lock);
18917 + xid = vx_current_xid();
18922 +int vc_vx_info(struct vx_info *vxi, void __user *data)
18924 + struct vcmd_vx_info_v0 vc_data;
18926 + vc_data.xid = vxi->vx_id;
18927 + vc_data.initpid = vxi->vx_initpid;
18929 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18935 +int vc_ctx_stat(struct vx_info *vxi, void __user *data)
18937 + struct vcmd_ctx_stat_v0 vc_data;
18939 + vc_data.usecnt = atomic_read(&vxi->vx_usecnt);
18940 + vc_data.tasks = atomic_read(&vxi->vx_tasks);
18942 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
18948 +/* context functions */
18950 +int vc_ctx_create(uint32_t xid, void __user *data)
18952 + struct vcmd_ctx_create vc_data = { .flagword = VXF_INIT_SET };
18953 + struct vx_info *new_vxi;
18956 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
18959 + if ((xid > MAX_S_CONTEXT) || (xid < 2))
18962 + new_vxi = __create_vx_info(xid);
18963 + if (IS_ERR(new_vxi))
18964 + return PTR_ERR(new_vxi);
18966 + /* initial flags */
18967 + new_vxi->vx_flags = vc_data.flagword;
18970 + if (vs_state_change(new_vxi, VSC_STARTUP))
18973 + ret = vx_migrate_task(current, new_vxi, (!data));
18977 + /* return context id on success */
18978 + ret = new_vxi->vx_id;
18980 + /* get a reference for persistent contexts */
18981 + if ((vc_data.flagword & VXF_PERSISTENT))
18982 + vx_set_persistent(new_vxi);
18984 + release_vx_info(new_vxi, NULL);
18985 + put_vx_info(new_vxi);
18990 +int vc_ctx_migrate(struct vx_info *vxi, void __user *data)
18992 + struct vcmd_ctx_migrate vc_data = { .flagword = 0 };
18995 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
18998 + ret = vx_migrate_task(current, vxi, 0);
19001 + if (vc_data.flagword & VXM_SET_INIT)
19002 + ret = vx_set_init(vxi, current);
19005 + if (vc_data.flagword & VXM_SET_REAPER)
19006 + ret = vx_set_reaper(vxi, current);
19011 +int vc_get_cflags(struct vx_info *vxi, void __user *data)
19013 + struct vcmd_ctx_flags_v0 vc_data;
19015 + vc_data.flagword = vxi->vx_flags;
19017 + /* special STATE flag handling */
19018 + vc_data.mask = vs_mask_flags(~0ULL, vxi->vx_flags, VXF_ONE_TIME);
19020 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19025 +int vc_set_cflags(struct vx_info *vxi, void __user *data)
19027 + struct vcmd_ctx_flags_v0 vc_data;
19028 + uint64_t mask, trigger;
19030 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19033 + /* special STATE flag handling */
19034 + mask = vs_mask_mask(vc_data.mask, vxi->vx_flags, VXF_ONE_TIME);
19035 + trigger = (mask & vxi->vx_flags) ^ (mask & vc_data.flagword);
19037 + if (vxi == current_vx_info()) {
19038 + /* if (trigger & VXF_STATE_SETUP)
19039 + vx_mask_cap_bset(vxi, current); */
19040 + if (trigger & VXF_STATE_INIT) {
19043 + ret = vx_set_init(vxi, current);
19046 + ret = vx_set_reaper(vxi, current);
19052 + vxi->vx_flags = vs_mask_flags(vxi->vx_flags,
19053 + vc_data.flagword, mask);
19054 + if (trigger & VXF_PERSISTENT)
19055 + vx_update_persistent(vxi);
19061 +static inline uint64_t caps_from_cap_t(kernel_cap_t c)
19063 + uint64_t v = c.cap[0] | ((uint64_t)c.cap[1] << 32);
19065 + // printk("caps_from_cap_t(%08x:%08x) = %016llx\n", c.cap[1], c.cap[0], v);
19069 +static inline kernel_cap_t cap_t_from_caps(uint64_t v)
19071 + kernel_cap_t c = __cap_empty_set;
19073 + c.cap[0] = v & 0xFFFFFFFF;
19074 + c.cap[1] = (v >> 32) & 0xFFFFFFFF;
19076 + // printk("cap_t_from_caps(%016llx) = %08x:%08x\n", v, c.cap[1], c.cap[0]);
19081 +static int do_get_caps(struct vx_info *vxi, uint64_t *bcaps, uint64_t *ccaps)
19084 + *bcaps = caps_from_cap_t(vxi->vx_bcaps);
19086 + *ccaps = vxi->vx_ccaps;
19091 +int vc_get_ccaps(struct vx_info *vxi, void __user *data)
19093 + struct vcmd_ctx_caps_v1 vc_data;
19096 + ret = do_get_caps(vxi, NULL, &vc_data.ccaps);
19099 + vc_data.cmask = ~0ULL;
19101 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19106 +static int do_set_caps(struct vx_info *vxi,
19107 + uint64_t bcaps, uint64_t bmask, uint64_t ccaps, uint64_t cmask)
19109 + uint64_t bcold = caps_from_cap_t(vxi->vx_bcaps);
19112 + printk("do_set_caps(%16llx, %16llx, %16llx, %16llx)\n",
19113 + bcaps, bmask, ccaps, cmask);
19115 + vxi->vx_bcaps = cap_t_from_caps(
19116 + vs_mask_flags(bcold, bcaps, bmask));
19117 + vxi->vx_ccaps = vs_mask_flags(vxi->vx_ccaps, ccaps, cmask);
19122 +int vc_set_ccaps(struct vx_info *vxi, void __user *data)
19124 + struct vcmd_ctx_caps_v1 vc_data;
19126 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19129 + return do_set_caps(vxi, 0, 0, vc_data.ccaps, vc_data.cmask);
19132 +int vc_get_bcaps(struct vx_info *vxi, void __user *data)
19134 + struct vcmd_bcaps vc_data;
19137 + ret = do_get_caps(vxi, &vc_data.bcaps, NULL);
19140 + vc_data.bmask = ~0ULL;
19142 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19147 +int vc_set_bcaps(struct vx_info *vxi, void __user *data)
19149 + struct vcmd_bcaps vc_data;
19151 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19154 + return do_set_caps(vxi, vc_data.bcaps, vc_data.bmask, 0, 0);
19158 +int vc_get_umask(struct vx_info *vxi, void __user *data)
19160 + struct vcmd_umask vc_data;
19162 + vc_data.umask = vxi->vx_umask;
19163 + vc_data.mask = ~0ULL;
19165 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19170 +int vc_set_umask(struct vx_info *vxi, void __user *data)
19172 + struct vcmd_umask vc_data;
19174 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19177 + vxi->vx_umask = vs_mask_flags(vxi->vx_umask,
19178 + vc_data.umask, vc_data.mask);
19183 +int vc_get_badness(struct vx_info *vxi, void __user *data)
19185 + struct vcmd_badness_v0 vc_data;
19187 + vc_data.bias = vxi->vx_badness_bias;
19189 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19194 +int vc_set_badness(struct vx_info *vxi, void __user *data)
19196 + struct vcmd_badness_v0 vc_data;
19198 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19201 + vxi->vx_badness_bias = vc_data.bias;
19205 +#include <linux/module.h>
19207 +EXPORT_SYMBOL_GPL(free_vx_info);
19209 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/cvirt.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cvirt.c
19210 --- linux-2.6.33.1/kernel/vserver/cvirt.c 1970-01-01 01:00:00.000000000 +0100
19211 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cvirt.c 2010-02-25 12:02:16.000000000 +0100
19214 + * linux/kernel/vserver/cvirt.c
19216 + * Virtual Server: Context Virtualization
19218 + * Copyright (C) 2004-2007 Herbert Pötzl
19220 + * V0.01 broken out from limit.c
19221 + * V0.02 added utsname stuff
19222 + * V0.03 changed vcmds to vxi arg
19226 +#include <linux/types.h>
19227 +#include <linux/utsname.h>
19228 +#include <linux/vs_cvirt.h>
19229 +#include <linux/vserver/switch.h>
19230 +#include <linux/vserver/cvirt_cmd.h>
19232 +#include <asm/uaccess.h>
19235 +void vx_vsi_uptime(struct timespec *uptime, struct timespec *idle)
19237 + struct vx_info *vxi = current_vx_info();
19239 + set_normalized_timespec(uptime,
19240 + uptime->tv_sec - vxi->cvirt.bias_uptime.tv_sec,
19241 + uptime->tv_nsec - vxi->cvirt.bias_uptime.tv_nsec);
19244 + set_normalized_timespec(idle,
19245 + idle->tv_sec - vxi->cvirt.bias_idle.tv_sec,
19246 + idle->tv_nsec - vxi->cvirt.bias_idle.tv_nsec);
19250 +uint64_t vx_idle_jiffies(void)
19252 + return init_task.utime + init_task.stime;
19257 +static inline uint32_t __update_loadavg(uint32_t load,
19258 + int wsize, int delta, int n)
19260 + unsigned long long calc, prev;
19262 + /* just set it to n */
19263 + if (unlikely(delta >= wsize))
19264 + return (n << FSHIFT);
19266 + calc = delta * n;
19268 + prev = (wsize - delta);
19271 + do_div(calc, wsize);
19276 +void vx_update_load(struct vx_info *vxi)
19278 + uint32_t now, last, delta;
19279 + unsigned int nr_running, nr_uninterruptible;
19280 + unsigned int total;
19281 + unsigned long flags;
19283 + spin_lock_irqsave(&vxi->cvirt.load_lock, flags);
19286 + last = vxi->cvirt.load_last;
19287 + delta = now - last;
19289 + if (delta < 5*HZ)
19292 + nr_running = atomic_read(&vxi->cvirt.nr_running);
19293 + nr_uninterruptible = atomic_read(&vxi->cvirt.nr_uninterruptible);
19294 + total = nr_running + nr_uninterruptible;
19296 + vxi->cvirt.load[0] = __update_loadavg(vxi->cvirt.load[0],
19297 + 60*HZ, delta, total);
19298 + vxi->cvirt.load[1] = __update_loadavg(vxi->cvirt.load[1],
19299 + 5*60*HZ, delta, total);
19300 + vxi->cvirt.load[2] = __update_loadavg(vxi->cvirt.load[2],
19301 + 15*60*HZ, delta, total);
19303 + vxi->cvirt.load_last = now;
19305 + atomic_inc(&vxi->cvirt.load_updates);
19306 + spin_unlock_irqrestore(&vxi->cvirt.load_lock, flags);
19311 + * Commands to do_syslog:
19313 + * 0 -- Close the log. Currently a NOP.
19314 + * 1 -- Open the log. Currently a NOP.
19315 + * 2 -- Read from the log.
19316 + * 3 -- Read all messages remaining in the ring buffer.
19317 + * 4 -- Read and clear all messages remaining in the ring buffer
19318 + * 5 -- Clear ring buffer.
19319 + * 6 -- Disable printk's to console
19320 + * 7 -- Enable printk's to console
19321 + * 8 -- Set level of messages printed to console
19322 + * 9 -- Return number of unread characters in the log buffer
19323 + * 10 -- Return size of the log buffer
19325 +int vx_do_syslog(int type, char __user *buf, int len)
19328 + int do_clear = 0;
19329 + struct vx_info *vxi = current_vx_info();
19330 + struct _vx_syslog *log;
19334 + log = &vxi->cvirt.syslog;
19337 + case 0: /* Close log */
19338 + case 1: /* Open log */
19340 + case 2: /* Read from log */
19341 + error = wait_event_interruptible(log->log_wait,
19342 + (log->log_start - log->log_end));
19345 + spin_lock_irq(&log->logbuf_lock);
19346 + spin_unlock_irq(&log->logbuf_lock);
19348 + case 4: /* Read/clear last kernel messages */
19350 + /* fall through */
19351 + case 3: /* Read last kernel messages */
19354 + case 5: /* Clear ring buffer */
19357 + case 6: /* Disable logging to console */
19358 + case 7: /* Enable logging to console */
19359 + case 8: /* Set level of messages printed to console */
19362 + case 9: /* Number of chars in the log buffer */
19364 + case 10: /* Size of the log buffer */
19374 +/* virtual host info names */
19376 +static char *vx_vhi_name(struct vx_info *vxi, int id)
19378 + struct nsproxy *nsproxy;
19379 + struct uts_namespace *uts;
19381 + if (id == VHIN_CONTEXT)
19382 + return vxi->vx_name;
19384 + nsproxy = vxi->vx_nsproxy[0];
19388 + uts = nsproxy->uts_ns;
19393 + case VHIN_SYSNAME:
19394 + return uts->name.sysname;
19395 + case VHIN_NODENAME:
19396 + return uts->name.nodename;
19397 + case VHIN_RELEASE:
19398 + return uts->name.release;
19399 + case VHIN_VERSION:
19400 + return uts->name.version;
19401 + case VHIN_MACHINE:
19402 + return uts->name.machine;
19403 + case VHIN_DOMAINNAME:
19404 + return uts->name.domainname;
19411 +int vc_set_vhi_name(struct vx_info *vxi, void __user *data)
19413 + struct vcmd_vhi_name_v0 vc_data;
19416 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19419 + name = vx_vhi_name(vxi, vc_data.field);
19423 + memcpy(name, vc_data.name, 65);
19427 +int vc_get_vhi_name(struct vx_info *vxi, void __user *data)
19429 + struct vcmd_vhi_name_v0 vc_data;
19432 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
19435 + name = vx_vhi_name(vxi, vc_data.field);
19439 + memcpy(vc_data.name, name, 65);
19440 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19446 +int vc_virt_stat(struct vx_info *vxi, void __user *data)
19448 + struct vcmd_virt_stat_v0 vc_data;
19449 + struct _vx_cvirt *cvirt = &vxi->cvirt;
19450 + struct timespec uptime;
19452 + do_posix_clock_monotonic_gettime(&uptime);
19453 + set_normalized_timespec(&uptime,
19454 + uptime.tv_sec - cvirt->bias_uptime.tv_sec,
19455 + uptime.tv_nsec - cvirt->bias_uptime.tv_nsec);
19457 + vc_data.offset = timeval_to_ns(&cvirt->bias_tv);
19458 + vc_data.uptime = timespec_to_ns(&uptime);
19459 + vc_data.nr_threads = atomic_read(&cvirt->nr_threads);
19460 + vc_data.nr_running = atomic_read(&cvirt->nr_running);
19461 + vc_data.nr_uninterruptible = atomic_read(&cvirt->nr_uninterruptible);
19462 + vc_data.nr_onhold = atomic_read(&cvirt->nr_onhold);
19463 + vc_data.nr_forks = atomic_read(&cvirt->total_forks);
19464 + vc_data.load[0] = cvirt->load[0];
19465 + vc_data.load[1] = cvirt->load[1];
19466 + vc_data.load[2] = cvirt->load[2];
19468 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
19474 +#ifdef CONFIG_VSERVER_VTIME
19476 +/* virtualized time base */
19478 +void vx_gettimeofday(struct timeval *tv)
19480 + struct vx_info *vxi;
19482 + do_gettimeofday(tv);
19483 + if (!vx_flags(VXF_VIRT_TIME, 0))
19486 + vxi = current_vx_info();
19487 + tv->tv_sec += vxi->cvirt.bias_tv.tv_sec;
19488 + tv->tv_usec += vxi->cvirt.bias_tv.tv_usec;
19490 + if (tv->tv_usec >= USEC_PER_SEC) {
19492 + tv->tv_usec -= USEC_PER_SEC;
19493 + } else if (tv->tv_usec < 0) {
19495 + tv->tv_usec += USEC_PER_SEC;
19499 +int vx_settimeofday(struct timespec *ts)
19501 + struct timeval tv;
19502 + struct vx_info *vxi;
19504 + if (!vx_flags(VXF_VIRT_TIME, 0))
19505 + return do_settimeofday(ts);
19507 + do_gettimeofday(&tv);
19508 + vxi = current_vx_info();
19509 + vxi->cvirt.bias_tv.tv_sec = ts->tv_sec - tv.tv_sec;
19510 + vxi->cvirt.bias_tv.tv_usec =
19511 + (ts->tv_nsec/NSEC_PER_USEC) - tv.tv_usec;
19517 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/cvirt_init.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cvirt_init.h
19518 --- linux-2.6.33.1/kernel/vserver/cvirt_init.h 1970-01-01 01:00:00.000000000 +0100
19519 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cvirt_init.h 2010-02-25 12:02:16.000000000 +0100
19523 +extern uint64_t vx_idle_jiffies(void);
19525 +static inline void vx_info_init_cvirt(struct _vx_cvirt *cvirt)
19527 + uint64_t idle_jiffies = vx_idle_jiffies();
19528 + uint64_t nsuptime;
19530 + do_posix_clock_monotonic_gettime(&cvirt->bias_uptime);
19531 + nsuptime = (unsigned long long)cvirt->bias_uptime.tv_sec
19532 + * NSEC_PER_SEC + cvirt->bias_uptime.tv_nsec;
19533 + cvirt->bias_clock = nsec_to_clock_t(nsuptime);
19534 + cvirt->bias_tv.tv_sec = 0;
19535 + cvirt->bias_tv.tv_usec = 0;
19537 + jiffies_to_timespec(idle_jiffies, &cvirt->bias_idle);
19538 + atomic_set(&cvirt->nr_threads, 0);
19539 + atomic_set(&cvirt->nr_running, 0);
19540 + atomic_set(&cvirt->nr_uninterruptible, 0);
19541 + atomic_set(&cvirt->nr_onhold, 0);
19543 + spin_lock_init(&cvirt->load_lock);
19544 + cvirt->load_last = jiffies;
19545 + atomic_set(&cvirt->load_updates, 0);
19546 + cvirt->load[0] = 0;
19547 + cvirt->load[1] = 0;
19548 + cvirt->load[2] = 0;
19549 + atomic_set(&cvirt->total_forks, 0);
19551 + spin_lock_init(&cvirt->syslog.logbuf_lock);
19552 + init_waitqueue_head(&cvirt->syslog.log_wait);
19553 + cvirt->syslog.log_start = 0;
19554 + cvirt->syslog.log_end = 0;
19555 + cvirt->syslog.con_start = 0;
19556 + cvirt->syslog.logged_chars = 0;
19560 +void vx_info_init_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, int cpu)
19562 + // cvirt_pc->cpustat = { 0 };
19565 +static inline void vx_info_exit_cvirt(struct _vx_cvirt *cvirt)
19569 + vxwprintk_xid((value = atomic_read(&cvirt->nr_threads)),
19570 + "!!! cvirt: %p[nr_threads] = %d on exit.",
19572 + vxwprintk_xid((value = atomic_read(&cvirt->nr_running)),
19573 + "!!! cvirt: %p[nr_running] = %d on exit.",
19575 + vxwprintk_xid((value = atomic_read(&cvirt->nr_uninterruptible)),
19576 + "!!! cvirt: %p[nr_uninterruptible] = %d on exit.",
19578 + vxwprintk_xid((value = atomic_read(&cvirt->nr_onhold)),
19579 + "!!! cvirt: %p[nr_onhold] = %d on exit.",
19585 +void vx_info_exit_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc, int cpu)
19590 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/cvirt_proc.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cvirt_proc.h
19591 --- linux-2.6.33.1/kernel/vserver/cvirt_proc.h 1970-01-01 01:00:00.000000000 +0100
19592 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/cvirt_proc.h 2010-02-25 12:02:16.000000000 +0100
19594 +#ifndef _VX_CVIRT_PROC_H
19595 +#define _VX_CVIRT_PROC_H
19597 +#include <linux/nsproxy.h>
19598 +#include <linux/mnt_namespace.h>
19599 +#include <linux/ipc_namespace.h>
19600 +#include <linux/utsname.h>
19601 +#include <linux/ipc.h>
19605 +int vx_info_proc_nsproxy(struct nsproxy *nsproxy, char *buffer)
19607 + struct mnt_namespace *ns;
19608 + struct uts_namespace *uts;
19609 + struct ipc_namespace *ipc;
19610 + struct path path;
19611 + char *pstr, *root;
19617 + length += sprintf(buffer + length,
19618 + "NSProxy:\t%p [%p,%p,%p]\n",
19619 + nsproxy, nsproxy->mnt_ns,
19620 + nsproxy->uts_ns, nsproxy->ipc_ns);
19622 + ns = nsproxy->mnt_ns;
19626 + pstr = kmalloc(PATH_MAX, GFP_KERNEL);
19630 + path.mnt = ns->root;
19631 + path.dentry = ns->root->mnt_root;
19632 + root = d_path(&path, pstr, PATH_MAX - 2);
19633 + length += sprintf(buffer + length,
19634 + "Namespace:\t%p [#%u]\n"
19635 + "RootPath:\t%s\n",
19636 + ns, atomic_read(&ns->count),
19641 + uts = nsproxy->uts_ns;
19645 + length += sprintf(buffer + length,
19646 + "SysName:\t%.*s\n"
19647 + "NodeName:\t%.*s\n"
19648 + "Release:\t%.*s\n"
19649 + "Version:\t%.*s\n"
19650 + "Machine:\t%.*s\n"
19651 + "DomainName:\t%.*s\n",
19652 + __NEW_UTS_LEN, uts->name.sysname,
19653 + __NEW_UTS_LEN, uts->name.nodename,
19654 + __NEW_UTS_LEN, uts->name.release,
19655 + __NEW_UTS_LEN, uts->name.version,
19656 + __NEW_UTS_LEN, uts->name.machine,
19657 + __NEW_UTS_LEN, uts->name.domainname);
19660 + ipc = nsproxy->ipc_ns;
19664 + length += sprintf(buffer + length,
19665 + "SEMS:\t\t%d %d %d %d %d\n"
19666 + "MSG:\t\t%d %d %d\n"
19667 + "SHM:\t\t%lu %lu %d %d\n",
19668 + ipc->sem_ctls[0], ipc->sem_ctls[1],
19669 + ipc->sem_ctls[2], ipc->sem_ctls[3],
19671 + ipc->msg_ctlmax, ipc->msg_ctlmnb, ipc->msg_ctlmni,
19672 + (unsigned long)ipc->shm_ctlmax,
19673 + (unsigned long)ipc->shm_ctlall,
19674 + ipc->shm_ctlmni, ipc->shm_tot);
19681 +#include <linux/sched.h>
19683 +#define LOAD_INT(x) ((x) >> FSHIFT)
19684 +#define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1 - 1)) * 100)
19687 +int vx_info_proc_cvirt(struct _vx_cvirt *cvirt, char *buffer)
19692 + length += sprintf(buffer + length,
19693 + "BiasUptime:\t%lu.%02lu\n",
19694 + (unsigned long)cvirt->bias_uptime.tv_sec,
19695 + (cvirt->bias_uptime.tv_nsec / (NSEC_PER_SEC / 100)));
19697 + a = cvirt->load[0] + (FIXED_1 / 200);
19698 + b = cvirt->load[1] + (FIXED_1 / 200);
19699 + c = cvirt->load[2] + (FIXED_1 / 200);
19700 + length += sprintf(buffer + length,
19701 + "nr_threads:\t%d\n"
19702 + "nr_running:\t%d\n"
19703 + "nr_unintr:\t%d\n"
19704 + "nr_onhold:\t%d\n"
19705 + "load_updates:\t%d\n"
19706 + "loadavg:\t%d.%02d %d.%02d %d.%02d\n"
19707 + "total_forks:\t%d\n",
19708 + atomic_read(&cvirt->nr_threads),
19709 + atomic_read(&cvirt->nr_running),
19710 + atomic_read(&cvirt->nr_uninterruptible),
19711 + atomic_read(&cvirt->nr_onhold),
19712 + atomic_read(&cvirt->load_updates),
19713 + LOAD_INT(a), LOAD_FRAC(a),
19714 + LOAD_INT(b), LOAD_FRAC(b),
19715 + LOAD_INT(c), LOAD_FRAC(c),
19716 + atomic_read(&cvirt->total_forks));
19721 +int vx_info_proc_cvirt_pc(struct _vx_cvirt_pc *cvirt_pc,
19722 + char *buffer, int cpu)
19728 +#endif /* _VX_CVIRT_PROC_H */
19729 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/debug.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/debug.c
19730 --- linux-2.6.33.1/kernel/vserver/debug.c 1970-01-01 01:00:00.000000000 +0100
19731 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/debug.c 2010-02-25 12:02:16.000000000 +0100
19734 + * kernel/vserver/debug.c
19736 + * Copyright (C) 2005-2007 Herbert Pötzl
19738 + * V0.01 vx_info dump support
19742 +#include <linux/module.h>
19744 +#include <linux/vserver/context.h>
19747 +void dump_vx_info(struct vx_info *vxi, int level)
19749 + printk("vx_info %p[#%d, %d.%d, %4x]\n", vxi, vxi->vx_id,
19750 + atomic_read(&vxi->vx_usecnt),
19751 + atomic_read(&vxi->vx_tasks),
19754 + __dump_vx_limit(&vxi->limit);
19755 + __dump_vx_sched(&vxi->sched);
19756 + __dump_vx_cvirt(&vxi->cvirt);
19757 + __dump_vx_cacct(&vxi->cacct);
19763 +EXPORT_SYMBOL_GPL(dump_vx_info);
19765 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/device.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/device.c
19766 --- linux-2.6.33.1/kernel/vserver/device.c 1970-01-01 01:00:00.000000000 +0100
19767 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/device.c 2010-02-25 12:02:16.000000000 +0100
19770 + * linux/kernel/vserver/device.c
19772 + * Linux-VServer: Device Support
19774 + * Copyright (C) 2006 Herbert Pötzl
19775 + * Copyright (C) 2007 Daniel Hokka Zakrisson
19777 + * V0.01 device mapping basics
19778 + * V0.02 added defaults
19782 +#include <linux/slab.h>
19783 +#include <linux/rcupdate.h>
19784 +#include <linux/fs.h>
19785 +#include <linux/namei.h>
19786 +#include <linux/hash.h>
19788 +#include <asm/errno.h>
19789 +#include <asm/uaccess.h>
19790 +#include <linux/vserver/base.h>
19791 +#include <linux/vserver/debug.h>
19792 +#include <linux/vserver/context.h>
19793 +#include <linux/vserver/device.h>
19794 +#include <linux/vserver/device_cmd.h>
19797 +#define DMAP_HASH_BITS 4
19800 +struct vs_mapping {
19802 + struct hlist_node hlist;
19803 + struct list_head list;
19805 +#define dm_hlist u.hlist
19806 +#define dm_list u.list
19809 + struct vx_dmap_target target;
19813 +static struct hlist_head dmap_main_hash[1 << DMAP_HASH_BITS];
19815 +static spinlock_t dmap_main_hash_lock = SPIN_LOCK_UNLOCKED;
19817 +static struct vx_dmap_target dmap_defaults[2] = {
19818 + { .flags = DATTR_OPEN },
19819 + { .flags = DATTR_OPEN },
19823 +struct kmem_cache *dmap_cachep __read_mostly;
19825 +int __init dmap_cache_init(void)
19827 + dmap_cachep = kmem_cache_create("dmap_cache",
19828 + sizeof(struct vs_mapping), 0,
19829 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
19833 +__initcall(dmap_cache_init);
19836 +static inline unsigned int __hashval(dev_t dev, int bits)
19838 + return hash_long((unsigned long)dev, bits);
19842 +/* __hash_mapping()
19843 + * add the mapping to the hash table
19845 +static inline void __hash_mapping(struct vx_info *vxi, struct vs_mapping *vdm)
19847 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19848 + struct hlist_head *head, *hash = dmap_main_hash;
19849 + int device = vdm->device;
19851 + spin_lock(hash_lock);
19852 + vxdprintk(VXD_CBIT(misc, 8), "__hash_mapping: %p[#%d] %08x:%08x",
19853 + vxi, vxi ? vxi->vx_id : 0, device, vdm->target.target);
19855 + head = &hash[__hashval(device, DMAP_HASH_BITS)];
19856 + hlist_add_head(&vdm->dm_hlist, head);
19857 + spin_unlock(hash_lock);
19861 +static inline int __mode_to_default(umode_t mode)
19874 +/* __set_default()
19877 +static inline void __set_default(struct vx_info *vxi, umode_t mode,
19878 + struct vx_dmap_target *vdmt)
19880 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19881 + spin_lock(hash_lock);
19884 + vxi->dmap.targets[__mode_to_default(mode)] = *vdmt;
19886 + dmap_defaults[__mode_to_default(mode)] = *vdmt;
19889 + spin_unlock(hash_lock);
19891 + vxdprintk(VXD_CBIT(misc, 8), "__set_default: %p[#%u] %08x %04x",
19892 + vxi, vxi ? vxi->vx_id : 0, vdmt->target, vdmt->flags);
19896 +/* __remove_default()
19897 + * remove a default
19899 +static inline int __remove_default(struct vx_info *vxi, umode_t mode)
19901 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19902 + spin_lock(hash_lock);
19905 + vxi->dmap.targets[__mode_to_default(mode)].flags = 0;
19906 + else /* remove == reset */
19907 + dmap_defaults[__mode_to_default(mode)].flags = DATTR_OPEN | mode;
19909 + spin_unlock(hash_lock);
19914 +/* __find_mapping()
19915 + * find a mapping in the hash table
19917 + * caller must hold hash_lock
19919 +static inline int __find_mapping(xid_t xid, dev_t device, umode_t mode,
19920 + struct vs_mapping **local, struct vs_mapping **global)
19922 + struct hlist_head *hash = dmap_main_hash;
19923 + struct hlist_head *head = &hash[__hashval(device, DMAP_HASH_BITS)];
19924 + struct hlist_node *pos;
19925 + struct vs_mapping *vdm;
19931 + hlist_for_each(pos, head) {
19932 + vdm = hlist_entry(pos, struct vs_mapping, dm_hlist);
19934 + if ((vdm->device == device) &&
19935 + !((vdm->target.flags ^ mode) & S_IFMT)) {
19936 + if (vdm->xid == xid) {
19939 + } else if (global && vdm->xid == 0)
19944 + if (global && *global)
19951 +/* __lookup_mapping()
19952 + * find a mapping and store the result in target and flags
19954 +static inline int __lookup_mapping(struct vx_info *vxi,
19955 + dev_t device, dev_t *target, int *flags, umode_t mode)
19957 + spinlock_t *hash_lock = &dmap_main_hash_lock;
19958 + struct vs_mapping *vdm, *global;
19959 + struct vx_dmap_target *vdmt;
19961 + xid_t xid = vxi->vx_id;
19964 + spin_lock(hash_lock);
19965 + if (__find_mapping(xid, device, mode, &vdm, &global) > 0) {
19967 + vdmt = &vdm->target;
19971 + index = __mode_to_default(mode);
19972 + if (vxi && vxi->dmap.targets[index].flags) {
19974 + vdmt = &vxi->dmap.targets[index];
19975 + } else if (global) {
19977 + vdmt = &global->target;
19981 + vdmt = &dmap_defaults[index];
19985 + if (target && (vdmt->flags & DATTR_REMAP))
19986 + *target = vdmt->target;
19988 + *target = device;
19990 + *flags = vdmt->flags;
19992 + spin_unlock(hash_lock);
19998 +/* __remove_mapping()
19999 + * remove a mapping from the hash table
20001 +static inline int __remove_mapping(struct vx_info *vxi, dev_t device,
20004 + spinlock_t *hash_lock = &dmap_main_hash_lock;
20005 + struct vs_mapping *vdm = NULL;
20008 + spin_lock(hash_lock);
20010 + ret = __find_mapping((vxi ? vxi->vx_id : 0), device, mode, &vdm,
20012 + vxdprintk(VXD_CBIT(misc, 8), "__remove_mapping: %p[#%d] %08x %04x",
20013 + vxi, vxi ? vxi->vx_id : 0, device, mode);
20016 + hlist_del(&vdm->dm_hlist);
20019 + spin_unlock(hash_lock);
20021 + kmem_cache_free(dmap_cachep, vdm);
20027 +int vs_map_device(struct vx_info *vxi,
20028 + dev_t device, dev_t *target, umode_t mode)
20030 + int ret, flags = DATTR_MASK;
20034 + *target = device;
20037 + ret = __lookup_mapping(vxi, device, target, &flags, mode);
20038 + vxdprintk(VXD_CBIT(misc, 8), "vs_map_device: %08x target: %08x flags: %04x mode: %04x mapped=%d",
20039 + device, target ? *target : 0, flags, mode, ret);
20041 + return (flags & DATTR_MASK);
20046 +static int do_set_mapping(struct vx_info *vxi,
20047 + dev_t device, dev_t target, int flags, umode_t mode)
20050 + struct vs_mapping *new;
20052 + new = kmem_cache_alloc(dmap_cachep, GFP_KERNEL);
20056 + INIT_HLIST_NODE(&new->dm_hlist);
20057 + new->device = device;
20058 + new->target.target = target;
20059 + new->target.flags = flags | mode;
20060 + new->xid = (vxi ? vxi->vx_id : 0);
20062 + vxdprintk(VXD_CBIT(misc, 8), "do_set_mapping: %08x target: %08x flags: %04x", device, target, flags);
20063 + __hash_mapping(vxi, new);
20065 + struct vx_dmap_target new = {
20066 + .target = target,
20067 + .flags = flags | mode,
20069 + __set_default(vxi, mode, &new);
20075 +static int do_unset_mapping(struct vx_info *vxi,
20076 + dev_t device, dev_t target, int flags, umode_t mode)
20078 + int ret = -EINVAL;
20081 + ret = __remove_mapping(vxi, device, mode);
20085 + ret = __remove_default(vxi, mode);
20095 +static inline int __user_device(const char __user *name, dev_t *dev,
20098 + struct nameidata nd;
20105 + ret = user_lpath(name, &nd.path);
20108 + if (nd.path.dentry->d_inode) {
20109 + *dev = nd.path.dentry->d_inode->i_rdev;
20110 + *mode = nd.path.dentry->d_inode->i_mode;
20112 + path_put(&nd.path);
20116 +static inline int __mapping_mode(dev_t device, dev_t target,
20117 + umode_t device_mode, umode_t target_mode, umode_t *mode)
20120 + *mode = device_mode & S_IFMT;
20122 + *mode = target_mode & S_IFMT;
20126 + /* if both given, device and target mode have to match */
20127 + if (device && target &&
20128 + ((device_mode ^ target_mode) & S_IFMT))
20134 +static inline int do_mapping(struct vx_info *vxi, const char __user *device_path,
20135 + const char __user *target_path, int flags, int set)
20137 + dev_t device = ~0, target = ~0;
20138 + umode_t device_mode = 0, target_mode = 0, mode;
20141 + ret = __user_device(device_path, &device, &device_mode);
20144 + ret = __user_device(target_path, &target, &target_mode);
20148 + ret = __mapping_mode(device, target,
20149 + device_mode, target_mode, &mode);
20154 + return do_set_mapping(vxi, device, target,
20157 + return do_unset_mapping(vxi, device, target,
20162 +int vc_set_mapping(struct vx_info *vxi, void __user *data)
20164 + struct vcmd_set_mapping_v0 vc_data;
20166 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20169 + return do_mapping(vxi, vc_data.device, vc_data.target,
20170 + vc_data.flags, 1);
20173 +int vc_unset_mapping(struct vx_info *vxi, void __user *data)
20175 + struct vcmd_set_mapping_v0 vc_data;
20177 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20180 + return do_mapping(vxi, vc_data.device, vc_data.target,
20181 + vc_data.flags, 0);
20185 +#ifdef CONFIG_COMPAT
20187 +int vc_set_mapping_x32(struct vx_info *vxi, void __user *data)
20189 + struct vcmd_set_mapping_v0_x32 vc_data;
20191 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20194 + return do_mapping(vxi, compat_ptr(vc_data.device_ptr),
20195 + compat_ptr(vc_data.target_ptr), vc_data.flags, 1);
20198 +int vc_unset_mapping_x32(struct vx_info *vxi, void __user *data)
20200 + struct vcmd_set_mapping_v0_x32 vc_data;
20202 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20205 + return do_mapping(vxi, compat_ptr(vc_data.device_ptr),
20206 + compat_ptr(vc_data.target_ptr), vc_data.flags, 0);
20209 +#endif /* CONFIG_COMPAT */
20212 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/dlimit.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/dlimit.c
20213 --- linux-2.6.33.1/kernel/vserver/dlimit.c 1970-01-01 01:00:00.000000000 +0100
20214 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/dlimit.c 2010-02-25 12:02:16.000000000 +0100
20217 + * linux/kernel/vserver/dlimit.c
20219 + * Virtual Server: Context Disk Limits
20221 + * Copyright (C) 2004-2009 Herbert Pötzl
20223 + * V0.01 initial version
20224 + * V0.02 compat32 splitup
20225 + * V0.03 extended interface
20229 +#include <linux/statfs.h>
20230 +#include <linux/sched.h>
20231 +#include <linux/namei.h>
20232 +#include <linux/vs_tag.h>
20233 +#include <linux/vs_dlimit.h>
20234 +#include <linux/vserver/dlimit_cmd.h>
20236 +#include <asm/uaccess.h>
20238 +/* __alloc_dl_info()
20240 + * allocate an initialized dl_info struct
20241 + * doesn't make it visible (hash) */
20243 +static struct dl_info *__alloc_dl_info(struct super_block *sb, tag_t tag)
20245 + struct dl_info *new = NULL;
20247 + vxdprintk(VXD_CBIT(dlim, 5),
20248 + "alloc_dl_info(%p,%d)*", sb, tag);
20250 + /* would this benefit from a slab cache? */
20251 + new = kmalloc(sizeof(struct dl_info), GFP_KERNEL);
20255 + memset(new, 0, sizeof(struct dl_info));
20256 + new->dl_tag = tag;
20258 + INIT_RCU_HEAD(&new->dl_rcu);
20259 + INIT_HLIST_NODE(&new->dl_hlist);
20260 + spin_lock_init(&new->dl_lock);
20261 + atomic_set(&new->dl_refcnt, 0);
20262 + atomic_set(&new->dl_usecnt, 0);
20264 + /* rest of init goes here */
20266 + vxdprintk(VXD_CBIT(dlim, 4),
20267 + "alloc_dl_info(%p,%d) = %p", sb, tag, new);
20271 +/* __dealloc_dl_info()
20273 + * final disposal of dl_info */
20275 +static void __dealloc_dl_info(struct dl_info *dli)
20277 + vxdprintk(VXD_CBIT(dlim, 4),
20278 + "dealloc_dl_info(%p)", dli);
20280 + dli->dl_hlist.next = LIST_POISON1;
20281 + dli->dl_tag = -1;
20284 + BUG_ON(atomic_read(&dli->dl_usecnt));
20285 + BUG_ON(atomic_read(&dli->dl_refcnt));
20291 +/* hash table for dl_info hash */
20293 +#define DL_HASH_SIZE 13
20295 +struct hlist_head dl_info_hash[DL_HASH_SIZE];
20297 +static spinlock_t dl_info_hash_lock = SPIN_LOCK_UNLOCKED;
20300 +static inline unsigned int __hashval(struct super_block *sb, tag_t tag)
20302 + return ((tag ^ (unsigned long)sb) % DL_HASH_SIZE);
20307 +/* __hash_dl_info()
20309 + * add the dli to the global hash table
20310 + * requires the hash_lock to be held */
20312 +static inline void __hash_dl_info(struct dl_info *dli)
20314 + struct hlist_head *head;
20316 + vxdprintk(VXD_CBIT(dlim, 6),
20317 + "__hash_dl_info: %p[#%d]", dli, dli->dl_tag);
20318 + get_dl_info(dli);
20319 + head = &dl_info_hash[__hashval(dli->dl_sb, dli->dl_tag)];
20320 + hlist_add_head_rcu(&dli->dl_hlist, head);
20323 +/* __unhash_dl_info()
20325 + * remove the dli from the global hash table
20326 + * requires the hash_lock to be held */
20328 +static inline void __unhash_dl_info(struct dl_info *dli)
20330 + vxdprintk(VXD_CBIT(dlim, 6),
20331 + "__unhash_dl_info: %p[#%d]", dli, dli->dl_tag);
20332 + hlist_del_rcu(&dli->dl_hlist);
20333 + put_dl_info(dli);
20337 +/* __lookup_dl_info()
20339 + * requires the rcu_read_lock()
20340 + * doesn't increment the dl_refcnt */
20342 +static inline struct dl_info *__lookup_dl_info(struct super_block *sb, tag_t tag)
20344 + struct hlist_head *head = &dl_info_hash[__hashval(sb, tag)];
20345 + struct hlist_node *pos;
20346 + struct dl_info *dli;
20348 + hlist_for_each_entry_rcu(dli, pos, head, dl_hlist) {
20350 + if (dli->dl_tag == tag && dli->dl_sb == sb) {
20358 +struct dl_info *locate_dl_info(struct super_block *sb, tag_t tag)
20360 + struct dl_info *dli;
20363 + dli = get_dl_info(__lookup_dl_info(sb, tag));
20364 + vxdprintk(VXD_CBIT(dlim, 7),
20365 + "locate_dl_info(%p,#%d) = %p", sb, tag, dli);
20366 + rcu_read_unlock();
20370 +void rcu_free_dl_info(struct rcu_head *head)
20372 + struct dl_info *dli = container_of(head, struct dl_info, dl_rcu);
20373 + int usecnt, refcnt;
20375 + BUG_ON(!dli || !head);
20377 + usecnt = atomic_read(&dli->dl_usecnt);
20378 + BUG_ON(usecnt < 0);
20380 + refcnt = atomic_read(&dli->dl_refcnt);
20381 + BUG_ON(refcnt < 0);
20383 + vxdprintk(VXD_CBIT(dlim, 3),
20384 + "rcu_free_dl_info(%p)", dli);
20386 + __dealloc_dl_info(dli);
20388 + printk("!!! rcu didn't free\n");
20394 +static int do_addrem_dlimit(uint32_t id, const char __user *name,
20395 + uint32_t flags, int add)
20397 + struct path path;
20400 + ret = user_lpath(name, &path);
20402 + struct super_block *sb;
20403 + struct dl_info *dli;
20406 + if (!path.dentry->d_inode)
20407 + goto out_release;
20408 + if (!(sb = path.dentry->d_inode->i_sb))
20409 + goto out_release;
20412 + dli = __alloc_dl_info(sb, id);
20413 + spin_lock(&dl_info_hash_lock);
20416 + if (__lookup_dl_info(sb, id))
20418 + __hash_dl_info(dli);
20421 + spin_lock(&dl_info_hash_lock);
20422 + dli = __lookup_dl_info(sb, id);
20427 + __unhash_dl_info(dli);
20431 + spin_unlock(&dl_info_hash_lock);
20433 + __dealloc_dl_info(dli);
20440 +int vc_add_dlimit(uint32_t id, void __user *data)
20442 + struct vcmd_ctx_dlimit_base_v0 vc_data;
20444 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20447 + return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 1);
20450 +int vc_rem_dlimit(uint32_t id, void __user *data)
20452 + struct vcmd_ctx_dlimit_base_v0 vc_data;
20454 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20457 + return do_addrem_dlimit(id, vc_data.name, vc_data.flags, 0);
20460 +#ifdef CONFIG_COMPAT
20462 +int vc_add_dlimit_x32(uint32_t id, void __user *data)
20464 + struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
20466 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20469 + return do_addrem_dlimit(id,
20470 + compat_ptr(vc_data.name_ptr), vc_data.flags, 1);
20473 +int vc_rem_dlimit_x32(uint32_t id, void __user *data)
20475 + struct vcmd_ctx_dlimit_base_v0_x32 vc_data;
20477 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20480 + return do_addrem_dlimit(id,
20481 + compat_ptr(vc_data.name_ptr), vc_data.flags, 0);
20484 +#endif /* CONFIG_COMPAT */
20488 +int do_set_dlimit(uint32_t id, const char __user *name,
20489 + uint32_t space_used, uint32_t space_total,
20490 + uint32_t inodes_used, uint32_t inodes_total,
20491 + uint32_t reserved, uint32_t flags)
20493 + struct path path;
20496 + ret = user_lpath(name, &path);
20498 + struct super_block *sb;
20499 + struct dl_info *dli;
20502 + if (!path.dentry->d_inode)
20503 + goto out_release;
20504 + if (!(sb = path.dentry->d_inode->i_sb))
20505 + goto out_release;
20507 + /* sanity checks */
20508 + if ((reserved != CDLIM_KEEP &&
20509 + reserved > 100) ||
20510 + (inodes_used != CDLIM_KEEP &&
20511 + inodes_used > inodes_total) ||
20512 + (space_used != CDLIM_KEEP &&
20513 + space_used > space_total))
20514 + goto out_release;
20517 + dli = locate_dl_info(sb, id);
20519 + goto out_release;
20521 + spin_lock(&dli->dl_lock);
20523 + if (inodes_used != CDLIM_KEEP)
20524 + dli->dl_inodes_used = inodes_used;
20525 + if (inodes_total != CDLIM_KEEP)
20526 + dli->dl_inodes_total = inodes_total;
20527 + if (space_used != CDLIM_KEEP)
20528 + dli->dl_space_used = dlimit_space_32to64(
20529 + space_used, flags, DLIMS_USED);
20531 + if (space_total == CDLIM_INFINITY)
20532 + dli->dl_space_total = DLIM_INFINITY;
20533 + else if (space_total != CDLIM_KEEP)
20534 + dli->dl_space_total = dlimit_space_32to64(
20535 + space_total, flags, DLIMS_TOTAL);
20537 + if (reserved != CDLIM_KEEP)
20538 + dli->dl_nrlmult = (1 << 10) * (100 - reserved) / 100;
20540 + spin_unlock(&dli->dl_lock);
20542 + put_dl_info(dli);
20551 +int vc_set_dlimit(uint32_t id, void __user *data)
20553 + struct vcmd_ctx_dlimit_v0 vc_data;
20555 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20558 + return do_set_dlimit(id, vc_data.name,
20559 + vc_data.space_used, vc_data.space_total,
20560 + vc_data.inodes_used, vc_data.inodes_total,
20561 + vc_data.reserved, vc_data.flags);
20564 +#ifdef CONFIG_COMPAT
20566 +int vc_set_dlimit_x32(uint32_t id, void __user *data)
20568 + struct vcmd_ctx_dlimit_v0_x32 vc_data;
20570 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20573 + return do_set_dlimit(id, compat_ptr(vc_data.name_ptr),
20574 + vc_data.space_used, vc_data.space_total,
20575 + vc_data.inodes_used, vc_data.inodes_total,
20576 + vc_data.reserved, vc_data.flags);
20579 +#endif /* CONFIG_COMPAT */
20583 +int do_get_dlimit(uint32_t id, const char __user *name,
20584 + uint32_t *space_used, uint32_t *space_total,
20585 + uint32_t *inodes_used, uint32_t *inodes_total,
20586 + uint32_t *reserved, uint32_t *flags)
20588 + struct path path;
20591 + ret = user_lpath(name, &path);
20593 + struct super_block *sb;
20594 + struct dl_info *dli;
20597 + if (!path.dentry->d_inode)
20598 + goto out_release;
20599 + if (!(sb = path.dentry->d_inode->i_sb))
20600 + goto out_release;
20603 + dli = locate_dl_info(sb, id);
20605 + goto out_release;
20607 + spin_lock(&dli->dl_lock);
20608 + *inodes_used = dli->dl_inodes_used;
20609 + *inodes_total = dli->dl_inodes_total;
20611 + *space_used = dlimit_space_64to32(
20612 + dli->dl_space_used, flags, DLIMS_USED);
20614 + if (dli->dl_space_total == DLIM_INFINITY)
20615 + *space_total = CDLIM_INFINITY;
20617 + *space_total = dlimit_space_64to32(
20618 + dli->dl_space_total, flags, DLIMS_TOTAL);
20620 + *reserved = 100 - ((dli->dl_nrlmult * 100 + 512) >> 10);
20621 + spin_unlock(&dli->dl_lock);
20623 + put_dl_info(dli);
20634 +int vc_get_dlimit(uint32_t id, void __user *data)
20636 + struct vcmd_ctx_dlimit_v0 vc_data;
20639 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20642 + ret = do_get_dlimit(id, vc_data.name,
20643 + &vc_data.space_used, &vc_data.space_total,
20644 + &vc_data.inodes_used, &vc_data.inodes_total,
20645 + &vc_data.reserved, &vc_data.flags);
20649 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20654 +#ifdef CONFIG_COMPAT
20656 +int vc_get_dlimit_x32(uint32_t id, void __user *data)
20658 + struct vcmd_ctx_dlimit_v0_x32 vc_data;
20661 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
20664 + ret = do_get_dlimit(id, compat_ptr(vc_data.name_ptr),
20665 + &vc_data.space_used, &vc_data.space_total,
20666 + &vc_data.inodes_used, &vc_data.inodes_total,
20667 + &vc_data.reserved, &vc_data.flags);
20671 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
20676 +#endif /* CONFIG_COMPAT */
20679 +void vx_vsi_statfs(struct super_block *sb, struct kstatfs *buf)
20681 + struct dl_info *dli;
20682 + __u64 blimit, bfree, bavail;
20685 + dli = locate_dl_info(sb, dx_current_tag());
20689 + spin_lock(&dli->dl_lock);
20690 + if (dli->dl_inodes_total == (unsigned long)DLIM_INFINITY)
20693 + /* reduce max inodes available to limit */
20694 + if (buf->f_files > dli->dl_inodes_total)
20695 + buf->f_files = dli->dl_inodes_total;
20697 + ifree = dli->dl_inodes_total - dli->dl_inodes_used;
20698 + /* reduce free inodes to min */
20699 + if (ifree < buf->f_ffree)
20700 + buf->f_ffree = ifree;
20703 + if (dli->dl_space_total == DLIM_INFINITY)
20706 + blimit = dli->dl_space_total >> sb->s_blocksize_bits;
20708 + if (dli->dl_space_total < dli->dl_space_used)
20711 + bfree = (dli->dl_space_total - dli->dl_space_used)
20712 + >> sb->s_blocksize_bits;
20714 + bavail = ((dli->dl_space_total >> 10) * dli->dl_nrlmult);
20715 + if (bavail < dli->dl_space_used)
20718 + bavail = (bavail - dli->dl_space_used)
20719 + >> sb->s_blocksize_bits;
20721 + /* reduce max space available to limit */
20722 + if (buf->f_blocks > blimit)
20723 + buf->f_blocks = blimit;
20725 + /* reduce free space to min */
20726 + if (bfree < buf->f_bfree)
20727 + buf->f_bfree = bfree;
20729 + /* reduce avail space to min */
20730 + if (bavail < buf->f_bavail)
20731 + buf->f_bavail = bavail;
20734 + spin_unlock(&dli->dl_lock);
20735 + put_dl_info(dli);
20740 +#include <linux/module.h>
20742 +EXPORT_SYMBOL_GPL(locate_dl_info);
20743 +EXPORT_SYMBOL_GPL(rcu_free_dl_info);
20745 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/helper.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/helper.c
20746 --- linux-2.6.33.1/kernel/vserver/helper.c 1970-01-01 01:00:00.000000000 +0100
20747 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/helper.c 2010-02-25 12:02:16.000000000 +0100
20750 + * linux/kernel/vserver/helper.c
20752 + * Virtual Context Support
20754 + * Copyright (C) 2004-2007 Herbert Pötzl
20756 + * V0.01 basic helper
20760 +#include <linux/kmod.h>
20761 +#include <linux/reboot.h>
20762 +#include <linux/vs_context.h>
20763 +#include <linux/vs_network.h>
20764 +#include <linux/vserver/signal.h>
20767 +char vshelper_path[255] = "/sbin/vshelper";
20770 +static int do_vshelper(char *name, char *argv[], char *envp[], int sync)
20774 + if ((ret = call_usermodehelper(name, argv, envp, sync))) {
20775 + printk( KERN_WARNING
20776 + "%s: (%s %s) returned %s with %d\n",
20777 + name, argv[1], argv[2],
20778 + sync ? "sync" : "async", ret);
20780 + vxdprintk(VXD_CBIT(switch, 4),
20781 + "%s: (%s %s) returned %s with %d",
20782 + name, argv[1], argv[2], sync ? "sync" : "async", ret);
20787 + * vshelper path is set via /proc/sys
20788 + * invoked by vserver sys_reboot(), with
20789 + * the following arguments
20791 + * argv [0] = vshelper_path;
20792 + * argv [1] = action: "restart", "halt", "poweroff", ...
20793 + * argv [2] = context identifier
20795 + * envp [*] = type-specific parameters
20798 +long vs_reboot_helper(struct vx_info *vxi, int cmd, void __user *arg)
20800 + char id_buf[8], cmd_buf[16];
20801 + char uid_buf[16], pid_buf[16];
20804 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20805 + char *envp[] = {"HOME=/", "TERM=linux",
20806 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
20807 + uid_buf, pid_buf, cmd_buf, 0};
20809 + if (vx_info_state(vxi, VXS_HELPER))
20811 + vxi->vx_state |= VXS_HELPER;
20813 + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
20815 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20816 + snprintf(uid_buf, sizeof(uid_buf)-1, "VS_UID=%d", current_uid());
20817 + snprintf(pid_buf, sizeof(pid_buf)-1, "VS_PID=%d", current->pid);
20820 + case LINUX_REBOOT_CMD_RESTART:
20821 + argv[1] = "restart";
20824 + case LINUX_REBOOT_CMD_HALT:
20825 + argv[1] = "halt";
20828 + case LINUX_REBOOT_CMD_POWER_OFF:
20829 + argv[1] = "poweroff";
20832 + case LINUX_REBOOT_CMD_SW_SUSPEND:
20833 + argv[1] = "swsusp";
20836 + case LINUX_REBOOT_CMD_OOM:
20841 + vxi->vx_state &= ~VXS_HELPER;
20845 + ret = do_vshelper(vshelper_path, argv, envp, 0);
20846 + vxi->vx_state &= ~VXS_HELPER;
20847 + __wakeup_vx_info(vxi);
20848 + return (ret) ? -EPERM : 0;
20852 +long vs_reboot(unsigned int cmd, void __user *arg)
20854 + struct vx_info *vxi = current_vx_info();
20857 + vxdprintk(VXD_CBIT(misc, 5),
20858 + "vs_reboot(%p[#%d],%u)",
20859 + vxi, vxi ? vxi->vx_id : 0, cmd);
20861 + ret = vs_reboot_helper(vxi, cmd, arg);
20865 + vxi->reboot_cmd = cmd;
20866 + if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
20868 + case LINUX_REBOOT_CMD_RESTART:
20869 + case LINUX_REBOOT_CMD_HALT:
20870 + case LINUX_REBOOT_CMD_POWER_OFF:
20871 + vx_info_kill(vxi, 0, SIGKILL);
20872 + vx_info_kill(vxi, 1, SIGKILL);
20880 +long vs_oom_action(unsigned int cmd)
20882 + struct vx_info *vxi = current_vx_info();
20885 + vxdprintk(VXD_CBIT(misc, 5),
20886 + "vs_oom_action(%p[#%d],%u)",
20887 + vxi, vxi ? vxi->vx_id : 0, cmd);
20889 + ret = vs_reboot_helper(vxi, cmd, NULL);
20893 + vxi->reboot_cmd = cmd;
20894 + if (vx_info_flags(vxi, VXF_REBOOT_KILL, 0)) {
20895 + vx_info_kill(vxi, 0, SIGKILL);
20896 + vx_info_kill(vxi, 1, SIGKILL);
20902 + * argv [0] = vshelper_path;
20903 + * argv [1] = action: "startup", "shutdown"
20904 + * argv [2] = context identifier
20906 + * envp [*] = type-specific parameters
20909 +long vs_state_change(struct vx_info *vxi, unsigned int cmd)
20911 + char id_buf[8], cmd_buf[16];
20912 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20913 + char *envp[] = {"HOME=/", "TERM=linux",
20914 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
20916 + if (!vx_info_flags(vxi, VXF_SC_HELPER, 0))
20919 + snprintf(id_buf, sizeof(id_buf)-1, "%d", vxi->vx_id);
20920 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20923 + case VSC_STARTUP:
20924 + argv[1] = "startup";
20926 + case VSC_SHUTDOWN:
20927 + argv[1] = "shutdown";
20933 + return do_vshelper(vshelper_path, argv, envp, 1);
20938 + * argv [0] = vshelper_path;
20939 + * argv [1] = action: "netup", "netdown"
20940 + * argv [2] = context identifier
20942 + * envp [*] = type-specific parameters
20945 +long vs_net_change(struct nx_info *nxi, unsigned int cmd)
20947 + char id_buf[8], cmd_buf[16];
20948 + char *argv[] = {vshelper_path, NULL, id_buf, 0};
20949 + char *envp[] = {"HOME=/", "TERM=linux",
20950 + "PATH=/sbin:/usr/sbin:/bin:/usr/bin", cmd_buf, 0};
20952 + if (!nx_info_flags(nxi, NXF_SC_HELPER, 0))
20955 + snprintf(id_buf, sizeof(id_buf)-1, "%d", nxi->nx_id);
20956 + snprintf(cmd_buf, sizeof(cmd_buf)-1, "VS_CMD=%08x", cmd);
20960 + argv[1] = "netup";
20962 + case VSC_NETDOWN:
20963 + argv[1] = "netdown";
20969 + return do_vshelper(vshelper_path, argv, envp, 1);
20972 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/history.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/history.c
20973 --- linux-2.6.33.1/kernel/vserver/history.c 1970-01-01 01:00:00.000000000 +0100
20974 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/history.c 2010-02-25 12:02:16.000000000 +0100
20977 + * kernel/vserver/history.c
20979 + * Virtual Context History Backtrace
20981 + * Copyright (C) 2004-2007 Herbert Pötzl
20983 + * V0.01 basic structure
20984 + * V0.02 hash/unhash and trace
20985 + * V0.03 preemption fixes
20989 +#include <linux/module.h>
20990 +#include <asm/uaccess.h>
20992 +#include <linux/vserver/context.h>
20993 +#include <linux/vserver/debug.h>
20994 +#include <linux/vserver/debug_cmd.h>
20995 +#include <linux/vserver/history.h>
20998 +#ifdef CONFIG_VSERVER_HISTORY
20999 +#define VXH_SIZE CONFIG_VSERVER_HISTORY_SIZE
21001 +#define VXH_SIZE 64
21004 +struct _vx_history {
21005 + unsigned int counter;
21007 + struct _vx_hist_entry entry[VXH_SIZE + 1];
21011 +DEFINE_PER_CPU(struct _vx_history, vx_history_buffer);
21013 +unsigned volatile int vxh_active = 1;
21015 +static atomic_t sequence = ATOMIC_INIT(0);
21020 + * requires disabled preemption */
21022 +struct _vx_hist_entry *vxh_advance(void *loc)
21024 + unsigned int cpu = smp_processor_id();
21025 + struct _vx_history *hist = &per_cpu(vx_history_buffer, cpu);
21026 + struct _vx_hist_entry *entry;
21027 + unsigned int index;
21029 + index = vxh_active ? (hist->counter++ % VXH_SIZE) : VXH_SIZE;
21030 + entry = &hist->entry[index];
21032 + entry->seq = atomic_inc_return(&sequence);
21033 + entry->loc = loc;
21037 +EXPORT_SYMBOL_GPL(vxh_advance);
21040 +#define VXH_LOC_FMTS "(#%04x,*%d):%p"
21042 +#define VXH_LOC_ARGS(e) (e)->seq, cpu, (e)->loc
21045 +#define VXH_VXI_FMTS "%p[#%d,%d.%d]"
21047 +#define VXH_VXI_ARGS(e) (e)->vxi.ptr, \
21048 + (e)->vxi.ptr ? (e)->vxi.xid : 0, \
21049 + (e)->vxi.ptr ? (e)->vxi.usecnt : 0, \
21050 + (e)->vxi.ptr ? (e)->vxi.tasks : 0
21052 +void vxh_dump_entry(struct _vx_hist_entry *e, unsigned cpu)
21054 + switch (e->type) {
21055 + case VXH_THROW_OOPS:
21056 + printk( VXH_LOC_FMTS " oops \n", VXH_LOC_ARGS(e));
21059 + case VXH_GET_VX_INFO:
21060 + case VXH_PUT_VX_INFO:
21061 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS "\n",
21063 + (e->type == VXH_GET_VX_INFO) ? "get" : "put",
21064 + VXH_VXI_ARGS(e));
21067 + case VXH_INIT_VX_INFO:
21068 + case VXH_SET_VX_INFO:
21069 + case VXH_CLR_VX_INFO:
21070 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS " @%p\n",
21072 + (e->type == VXH_INIT_VX_INFO) ? "init" :
21073 + ((e->type == VXH_SET_VX_INFO) ? "set" : "clr"),
21074 + VXH_VXI_ARGS(e), e->sc.data);
21077 + case VXH_CLAIM_VX_INFO:
21078 + case VXH_RELEASE_VX_INFO:
21079 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS " @%p\n",
21081 + (e->type == VXH_CLAIM_VX_INFO) ? "claim" : "release",
21082 + VXH_VXI_ARGS(e), e->sc.data);
21085 + case VXH_ALLOC_VX_INFO:
21086 + case VXH_DEALLOC_VX_INFO:
21087 + printk( VXH_LOC_FMTS " %s_vx_info " VXH_VXI_FMTS "\n",
21089 + (e->type == VXH_ALLOC_VX_INFO) ? "alloc" : "dealloc",
21090 + VXH_VXI_ARGS(e));
21093 + case VXH_HASH_VX_INFO:
21094 + case VXH_UNHASH_VX_INFO:
21095 + printk( VXH_LOC_FMTS " __%s_vx_info " VXH_VXI_FMTS "\n",
21097 + (e->type == VXH_HASH_VX_INFO) ? "hash" : "unhash",
21098 + VXH_VXI_ARGS(e));
21101 + case VXH_LOC_VX_INFO:
21102 + case VXH_LOOKUP_VX_INFO:
21103 + case VXH_CREATE_VX_INFO:
21104 + printk( VXH_LOC_FMTS " __%s_vx_info [#%d] -> " VXH_VXI_FMTS "\n",
21106 + (e->type == VXH_CREATE_VX_INFO) ? "create" :
21107 + ((e->type == VXH_LOC_VX_INFO) ? "loc" : "lookup"),
21108 + e->ll.arg, VXH_VXI_ARGS(e));
21113 +static void __vxh_dump_history(void)
21115 + unsigned int i, cpu;
21117 + printk("History:\tSEQ: %8x\tNR_CPUS: %d\n",
21118 + atomic_read(&sequence), NR_CPUS);
21120 + for (i = 0; i < VXH_SIZE; i++) {
21121 + for_each_online_cpu(cpu) {
21122 + struct _vx_history *hist =
21123 + &per_cpu(vx_history_buffer, cpu);
21124 + unsigned int index = (hist->counter - i) % VXH_SIZE;
21125 + struct _vx_hist_entry *entry = &hist->entry[index];
21127 + vxh_dump_entry(entry, cpu);
21132 +void vxh_dump_history(void)
21136 + local_irq_enable();
21138 + local_irq_disable();
21140 + __vxh_dump_history();
21144 +/* vserver syscall commands below here */
21147 +int vc_dump_history(uint32_t id)
21150 + __vxh_dump_history();
21157 +int do_read_history(struct __user _vx_hist_entry *data,
21158 + int cpu, uint32_t *index, uint32_t *count)
21160 + int pos, ret = 0;
21161 + struct _vx_history *hist = &per_cpu(vx_history_buffer, cpu);
21162 + int end = hist->counter;
21163 + int start = end - VXH_SIZE + 2;
21164 + int idx = *index;
21166 + /* special case: get current pos */
21172 + /* have we lost some data? */
21176 + for (pos = 0; (pos < *count) && (idx < end); pos++, idx++) {
21177 + struct _vx_hist_entry *entry =
21178 + &hist->entry[idx % VXH_SIZE];
21180 + /* send entry to userspace */
21181 + ret = copy_to_user(&data[pos], entry, sizeof(*entry));
21185 + /* save new index and count */
21188 + return ret ? ret : (*index < end);
21191 +int vc_read_history(uint32_t id, void __user *data)
21193 + struct vcmd_read_history_v0 vc_data;
21196 + if (id >= NR_CPUS)
21199 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21202 + ret = do_read_history((struct __user _vx_hist_entry *)vc_data.data,
21203 + id, &vc_data.index, &vc_data.count);
21205 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21210 +#ifdef CONFIG_COMPAT
21212 +int vc_read_history_x32(uint32_t id, void __user *data)
21214 + struct vcmd_read_history_v0_x32 vc_data;
21217 + if (id >= NR_CPUS)
21220 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21223 + ret = do_read_history((struct __user _vx_hist_entry *)
21224 + compat_ptr(vc_data.data_ptr),
21225 + id, &vc_data.index, &vc_data.count);
21227 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21232 +#endif /* CONFIG_COMPAT */
21234 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/inet.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/inet.c
21235 --- linux-2.6.33.1/kernel/vserver/inet.c 1970-01-01 01:00:00.000000000 +0100
21236 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/inet.c 2010-02-25 12:02:16.000000000 +0100
21239 +#include <linux/in.h>
21240 +#include <linux/inetdevice.h>
21241 +#include <linux/vs_inet.h>
21242 +#include <linux/vs_inet6.h>
21243 +#include <linux/vserver/debug.h>
21244 +#include <net/route.h>
21245 +#include <net/addrconf.h>
21248 +int nx_v4_addr_conflict(struct nx_info *nxi1, struct nx_info *nxi2)
21252 + if (!nxi1 || !nxi2 || nxi1 == nxi2)
21255 + struct nx_addr_v4 *ptr;
21257 + for (ptr = &nxi1->v4; ptr; ptr = ptr->next) {
21258 + if (v4_nx_addr_in_nx_info(nxi2, ptr, -1)) {
21265 + vxdprintk(VXD_CBIT(net, 2),
21266 + "nx_v4_addr_conflict(%p,%p): %d",
21267 + nxi1, nxi2, ret);
21273 +#ifdef CONFIG_IPV6
21275 +int nx_v6_addr_conflict(struct nx_info *nxi1, struct nx_info *nxi2)
21279 + if (!nxi1 || !nxi2 || nxi1 == nxi2)
21282 + struct nx_addr_v6 *ptr;
21284 + for (ptr = &nxi1->v6; ptr; ptr = ptr->next) {
21285 + if (v6_nx_addr_in_nx_info(nxi2, ptr, -1)) {
21292 + vxdprintk(VXD_CBIT(net, 2),
21293 + "nx_v6_addr_conflict(%p,%p): %d",
21294 + nxi1, nxi2, ret);
21301 +int v4_dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
21303 + struct in_device *in_dev;
21304 + struct in_ifaddr **ifap;
21305 + struct in_ifaddr *ifa;
21310 + in_dev = in_dev_get(dev);
21314 + for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
21315 + ifap = &ifa->ifa_next) {
21316 + if (v4_addr_in_nx_info(nxi, ifa->ifa_local, NXA_MASK_SHOW)) {
21321 + in_dev_put(in_dev);
21327 +#ifdef CONFIG_IPV6
21329 +int v6_dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
21331 + struct inet6_dev *in_dev;
21332 + struct inet6_ifaddr **ifap;
21333 + struct inet6_ifaddr *ifa;
21338 + in_dev = in6_dev_get(dev);
21342 + for (ifap = &in_dev->addr_list; (ifa = *ifap) != NULL;
21343 + ifap = &ifa->if_next) {
21344 + if (v6_addr_in_nx_info(nxi, &ifa->addr, -1)) {
21349 + in6_dev_put(in_dev);
21356 +int dev_in_nx_info(struct net_device *dev, struct nx_info *nxi)
21362 + if (nxi->v4.type && v4_dev_in_nx_info(dev, nxi))
21364 +#ifdef CONFIG_IPV6
21366 + if (nxi->v6.type && v6_dev_in_nx_info(dev, nxi))
21371 + vxdprintk(VXD_CBIT(net, 3),
21372 + "dev_in_nx_info(%p,%p[#%d]) = %d",
21373 + dev, nxi, nxi ? nxi->nx_id : 0, ret);
21377 +int ip_v4_find_src(struct net *net, struct nx_info *nxi,
21378 + struct rtable **rp, struct flowi *fl)
21383 + /* FIXME: handle lback only case */
21384 + if (!NX_IPV4(nxi))
21387 + vxdprintk(VXD_CBIT(net, 4),
21388 + "ip_v4_find_src(%p[#%u]) " NIPQUAD_FMT " -> " NIPQUAD_FMT,
21389 + nxi, nxi ? nxi->nx_id : 0,
21390 + NIPQUAD(fl->fl4_src), NIPQUAD(fl->fl4_dst));
21392 + /* single IP is unconditional */
21393 + if (nx_info_flags(nxi, NXF_SINGLE_IP, 0) &&
21394 + (fl->fl4_src == INADDR_ANY))
21395 + fl->fl4_src = nxi->v4.ip[0].s_addr;
21397 + if (fl->fl4_src == INADDR_ANY) {
21398 + struct nx_addr_v4 *ptr;
21399 + __be32 found = 0;
21402 + err = __ip_route_output_key(net, rp, fl);
21404 + found = (*rp)->rt_src;
21406 + vxdprintk(VXD_CBIT(net, 4),
21407 + "ip_v4_find_src(%p[#%u]) rok[%u]: " NIPQUAD_FMT,
21408 + nxi, nxi ? nxi->nx_id : 0, fl->oif, NIPQUAD(found));
21409 + if (v4_addr_in_nx_info(nxi, found, NXA_MASK_BIND))
21413 + for (ptr = &nxi->v4; ptr; ptr = ptr->next) {
21414 + __be32 primary = ptr->ip[0].s_addr;
21415 + __be32 mask = ptr->mask.s_addr;
21416 + __be32 neta = primary & mask;
21418 + vxdprintk(VXD_CBIT(net, 4), "ip_v4_find_src(%p[#%u]) chk: "
21419 + NIPQUAD_FMT "/" NIPQUAD_FMT "/" NIPQUAD_FMT,
21420 + nxi, nxi ? nxi->nx_id : 0, NIPQUAD(primary),
21421 + NIPQUAD(mask), NIPQUAD(neta));
21422 + if ((found & mask) != neta)
21425 + fl->fl4_src = primary;
21426 + err = __ip_route_output_key(net, rp, fl);
21427 + vxdprintk(VXD_CBIT(net, 4),
21428 + "ip_v4_find_src(%p[#%u]) rok[%u]: " NIPQUAD_FMT,
21429 + nxi, nxi ? nxi->nx_id : 0, fl->oif, NIPQUAD(primary));
21431 + found = (*rp)->rt_src;
21433 + if (found == primary)
21437 + /* still no source ip? */
21438 + found = ipv4_is_loopback(fl->fl4_dst)
21439 + ? IPI_LOOPBACK : nxi->v4.ip[0].s_addr;
21441 + /* assign src ip to flow */
21442 + fl->fl4_src = found;
21445 + if (!v4_addr_in_nx_info(nxi, fl->fl4_src, NXA_MASK_BIND))
21449 + if (nx_info_flags(nxi, NXF_LBACK_REMAP, 0)) {
21450 + if (ipv4_is_loopback(fl->fl4_dst))
21451 + fl->fl4_dst = nxi->v4_lback.s_addr;
21452 + if (ipv4_is_loopback(fl->fl4_src))
21453 + fl->fl4_src = nxi->v4_lback.s_addr;
21454 + } else if (ipv4_is_loopback(fl->fl4_dst) &&
21455 + !nx_info_flags(nxi, NXF_LBACK_ALLOW, 0))
21461 +EXPORT_SYMBOL_GPL(ip_v4_find_src);
21463 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/init.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/init.c
21464 --- linux-2.6.33.1/kernel/vserver/init.c 1970-01-01 01:00:00.000000000 +0100
21465 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/init.c 2010-02-25 12:02:16.000000000 +0100
21468 + * linux/kernel/init.c
21470 + * Virtual Server Init
21472 + * Copyright (C) 2004-2007 Herbert Pötzl
21474 + * V0.01 basic structure
21478 +#include <linux/init.h>
21480 +int vserver_register_sysctl(void);
21481 +void vserver_unregister_sysctl(void);
21484 +static int __init init_vserver(void)
21488 +#ifdef CONFIG_VSERVER_DEBUG
21489 + vserver_register_sysctl();
21495 +static void __exit exit_vserver(void)
21498 +#ifdef CONFIG_VSERVER_DEBUG
21499 + vserver_unregister_sysctl();
21504 +/* FIXME: GFP_ZONETYPES gone
21505 +long vx_slab[GFP_ZONETYPES]; */
21509 +module_init(init_vserver);
21510 +module_exit(exit_vserver);
21512 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/inode.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/inode.c
21513 --- linux-2.6.33.1/kernel/vserver/inode.c 1970-01-01 01:00:00.000000000 +0100
21514 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/inode.c 2010-02-25 12:02:16.000000000 +0100
21517 + * linux/kernel/vserver/inode.c
21519 + * Virtual Server: File System Support
21521 + * Copyright (C) 2004-2007 Herbert Pötzl
21523 + * V0.01 separated from vcontext V0.05
21524 + * V0.02 moved to tag (instead of xid)
21528 +#include <linux/tty.h>
21529 +#include <linux/proc_fs.h>
21530 +#include <linux/devpts_fs.h>
21531 +#include <linux/fs.h>
21532 +#include <linux/file.h>
21533 +#include <linux/mount.h>
21534 +#include <linux/parser.h>
21535 +#include <linux/namei.h>
21536 +#include <linux/vserver/inode.h>
21537 +#include <linux/vserver/inode_cmd.h>
21538 +#include <linux/vs_base.h>
21539 +#include <linux/vs_tag.h>
21541 +#include <asm/uaccess.h>
21544 +static int __vc_get_iattr(struct inode *in, uint32_t *tag, uint32_t *flags, uint32_t *mask)
21546 + struct proc_dir_entry *entry;
21548 + if (!in || !in->i_sb)
21551 + *flags = IATTR_TAG
21552 + | (IS_IMMUTABLE(in) ? IATTR_IMMUTABLE : 0)
21553 + | (IS_IXUNLINK(in) ? IATTR_IXUNLINK : 0)
21554 + | (IS_BARRIER(in) ? IATTR_BARRIER : 0)
21555 + | (IS_COW(in) ? IATTR_COW : 0);
21556 + *mask = IATTR_IXUNLINK | IATTR_IMMUTABLE | IATTR_COW;
21558 + if (S_ISDIR(in->i_mode))
21559 + *mask |= IATTR_BARRIER;
21561 + if (IS_TAGGED(in)) {
21562 + *tag = in->i_tag;
21563 + *mask |= IATTR_TAG;
21566 + switch (in->i_sb->s_magic) {
21567 + case PROC_SUPER_MAGIC:
21568 + entry = PROC_I(in)->pde;
21570 + /* check for specific inodes? */
21572 + *mask |= IATTR_FLAGS;
21574 + *flags |= (entry->vx_flags & IATTR_FLAGS);
21576 + *flags |= (PROC_I(in)->vx_flags & IATTR_FLAGS);
21579 + case DEVPTS_SUPER_MAGIC:
21580 + *tag = in->i_tag;
21581 + *mask |= IATTR_TAG;
21590 +int vc_get_iattr(void __user *data)
21592 + struct path path;
21593 + struct vcmd_ctx_iattr_v1 vc_data = { .tag = -1 };
21596 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21599 + ret = user_lpath(vc_data.name, &path);
21601 + ret = __vc_get_iattr(path.dentry->d_inode,
21602 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21608 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21613 +#ifdef CONFIG_COMPAT
21615 +int vc_get_iattr_x32(void __user *data)
21617 + struct path path;
21618 + struct vcmd_ctx_iattr_v1_x32 vc_data = { .tag = -1 };
21621 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21624 + ret = user_lpath(compat_ptr(vc_data.name_ptr), &path);
21626 + ret = __vc_get_iattr(path.dentry->d_inode,
21627 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21633 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21638 +#endif /* CONFIG_COMPAT */
21641 +int vc_fget_iattr(uint32_t fd, void __user *data)
21643 + struct file *filp;
21644 + struct vcmd_ctx_fiattr_v0 vc_data = { .tag = -1 };
21647 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21651 + if (!filp || !filp->f_dentry || !filp->f_dentry->d_inode)
21654 + ret = __vc_get_iattr(filp->f_dentry->d_inode,
21655 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21659 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21665 +static int __vc_set_iattr(struct dentry *de, uint32_t *tag, uint32_t *flags, uint32_t *mask)
21667 + struct inode *in = de->d_inode;
21668 + int error = 0, is_proc = 0, has_tag = 0;
21669 + struct iattr attr = { 0 };
21671 + if (!in || !in->i_sb)
21674 + is_proc = (in->i_sb->s_magic == PROC_SUPER_MAGIC);
21675 + if ((*mask & IATTR_FLAGS) && !is_proc)
21678 + has_tag = IS_TAGGED(in) ||
21679 + (in->i_sb->s_magic == DEVPTS_SUPER_MAGIC);
21680 + if ((*mask & IATTR_TAG) && !has_tag)
21683 + mutex_lock(&in->i_mutex);
21684 + if (*mask & IATTR_TAG) {
21685 + attr.ia_tag = *tag;
21686 + attr.ia_valid |= ATTR_TAG;
21689 + if (*mask & IATTR_FLAGS) {
21690 + struct proc_dir_entry *entry = PROC_I(in)->pde;
21691 + unsigned int iflags = PROC_I(in)->vx_flags;
21693 + iflags = (iflags & ~(*mask & IATTR_FLAGS))
21694 + | (*flags & IATTR_FLAGS);
21695 + PROC_I(in)->vx_flags = iflags;
21697 + entry->vx_flags = iflags;
21700 + if (*mask & (IATTR_IMMUTABLE | IATTR_IXUNLINK |
21701 + IATTR_BARRIER | IATTR_COW)) {
21702 + int iflags = in->i_flags;
21703 + int vflags = in->i_vflags;
21705 + if (*mask & IATTR_IMMUTABLE) {
21706 + if (*flags & IATTR_IMMUTABLE)
21707 + iflags |= S_IMMUTABLE;
21709 + iflags &= ~S_IMMUTABLE;
21711 + if (*mask & IATTR_IXUNLINK) {
21712 + if (*flags & IATTR_IXUNLINK)
21713 + iflags |= S_IXUNLINK;
21715 + iflags &= ~S_IXUNLINK;
21717 + if (S_ISDIR(in->i_mode) && (*mask & IATTR_BARRIER)) {
21718 + if (*flags & IATTR_BARRIER)
21719 + vflags |= V_BARRIER;
21721 + vflags &= ~V_BARRIER;
21723 + if (S_ISREG(in->i_mode) && (*mask & IATTR_COW)) {
21724 + if (*flags & IATTR_COW)
21727 + vflags &= ~V_COW;
21729 + if (in->i_op && in->i_op->sync_flags) {
21730 + error = in->i_op->sync_flags(in, iflags, vflags);
21736 + if (attr.ia_valid) {
21737 + if (in->i_op && in->i_op->setattr)
21738 + error = in->i_op->setattr(de, &attr);
21740 + error = inode_change_ok(in, &attr);
21742 + error = inode_setattr(in, &attr);
21747 + mutex_unlock(&in->i_mutex);
21751 +int vc_set_iattr(void __user *data)
21753 + struct path path;
21754 + struct vcmd_ctx_iattr_v1 vc_data;
21757 + if (!capable(CAP_LINUX_IMMUTABLE))
21759 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21762 + ret = user_lpath(vc_data.name, &path);
21764 + ret = __vc_set_iattr(path.dentry,
21765 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21769 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21774 +#ifdef CONFIG_COMPAT
21776 +int vc_set_iattr_x32(void __user *data)
21778 + struct path path;
21779 + struct vcmd_ctx_iattr_v1_x32 vc_data;
21782 + if (!capable(CAP_LINUX_IMMUTABLE))
21784 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21787 + ret = user_lpath(compat_ptr(vc_data.name_ptr), &path);
21789 + ret = __vc_set_iattr(path.dentry,
21790 + &vc_data.tag, &vc_data.flags, &vc_data.mask);
21794 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21799 +#endif /* CONFIG_COMPAT */
21801 +int vc_fset_iattr(uint32_t fd, void __user *data)
21803 + struct file *filp;
21804 + struct vcmd_ctx_fiattr_v0 vc_data;
21807 + if (!capable(CAP_LINUX_IMMUTABLE))
21809 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
21813 + if (!filp || !filp->f_dentry || !filp->f_dentry->d_inode)
21816 + ret = __vc_set_iattr(filp->f_dentry, &vc_data.tag,
21817 + &vc_data.flags, &vc_data.mask);
21821 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
21827 +enum { Opt_notagcheck, Opt_tag, Opt_notag, Opt_tagid, Opt_err };
21829 +static match_table_t tokens = {
21830 + {Opt_notagcheck, "notagcheck"},
21831 +#ifdef CONFIG_PROPAGATE
21832 + {Opt_notag, "notag"},
21833 + {Opt_tag, "tag"},
21834 + {Opt_tagid, "tagid=%u"},
21840 +static void __dx_parse_remove(char *string, char *opt)
21842 + char *p = strstr(string, opt);
21846 + while (*q != '\0' && *q != ',')
21855 +int dx_parse_tag(char *string, tag_t *tag, int remove, int *mnt_flags,
21856 + unsigned long *flags)
21859 + substring_t args[MAX_OPT_ARGS];
21860 + int token, option = 0;
21861 + char *s, *p, *opts;
21865 + s = kstrdup(string, GFP_KERNEL | GFP_ATOMIC);
21870 + while ((p = strsep(&opts, ",")) != NULL) {
21871 + token = match_token(p, tokens, args);
21873 + vxdprintk(VXD_CBIT(tag, 7),
21874 + "dx_parse_tag(»%s«): %d:#%d",
21875 + p, token, option);
21878 +#ifdef CONFIG_PROPAGATE
21883 + __dx_parse_remove(s, "tag");
21884 + *mnt_flags |= MNT_TAGID;
21885 + set |= MNT_TAGID;
21889 + __dx_parse_remove(s, "notag");
21890 + *mnt_flags |= MNT_NOTAG;
21891 + set |= MNT_NOTAG;
21894 + if (tag && !match_int(args, &option))
21897 + __dx_parse_remove(s, "tagid");
21898 + *mnt_flags |= MNT_TAGID;
21899 + set |= MNT_TAGID;
21902 + case Opt_notagcheck:
21904 + __dx_parse_remove(s, "notagcheck");
21905 + *flags |= MS_NOTAGCHECK;
21906 + set |= MS_NOTAGCHECK;
21911 + strcpy(string, s);
21916 +#ifdef CONFIG_PROPAGATE
21918 +void __dx_propagate_tag(struct nameidata *nd, struct inode *inode)
21920 + tag_t new_tag = 0;
21921 + struct vfsmount *mnt;
21926 + mnt = nd->path.mnt;
21930 + propagate = (mnt->mnt_flags & MNT_TAGID);
21932 + new_tag = mnt->mnt_tag;
21934 + vxdprintk(VXD_CBIT(tag, 7),
21935 + "dx_propagate_tag(%p[#%lu.%d]): %d,%d",
21936 + inode, inode->i_ino, inode->i_tag,
21937 + new_tag, (propagate) ? 1 : 0);
21940 + inode->i_tag = new_tag;
21943 +#include <linux/module.h>
21945 +EXPORT_SYMBOL_GPL(__dx_propagate_tag);
21947 +#endif /* CONFIG_PROPAGATE */
21949 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/Kconfig
21950 --- linux-2.6.33.1/kernel/vserver/Kconfig 1970-01-01 01:00:00.000000000 +0100
21951 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/Kconfig 2010-02-25 12:02:16.000000000 +0100
21954 +# Linux VServer configuration
21957 +menu "Linux VServer"
21959 +config VSERVER_AUTO_LBACK
21960 + bool "Automatically Assign Loopback IP"
21963 + Automatically assign a guest specific loopback
21964 + IP and add it to the kernel network stack on
21967 +config VSERVER_AUTO_SINGLE
21968 + bool "Automatic Single IP Special Casing"
21969 + depends on EXPERIMENTAL
21972 + This allows network contexts with a single IP to
21973 + automatically remap 0.0.0.0 bindings to that IP,
21974 + avoiding further network checks and improving
21977 + (note: such guests do not allow to change the ip
21978 + on the fly and do not show loopback addresses)
21980 +config VSERVER_COWBL
21981 + bool "Enable COW Immutable Link Breaking"
21984 + This enables the COW (Copy-On-Write) link break code.
21985 + It allows you to treat unified files like normal files
21986 + when writing to them (which will implicitely break the
21987 + link and create a copy of the unified file)
21989 +config VSERVER_VTIME
21990 + bool "Enable Virtualized Guest Time"
21991 + depends on EXPERIMENTAL
21994 + This enables per guest time offsets to allow for
21995 + adjusting the system clock individually per guest.
21996 + this adds some overhead to the time functions and
21997 + therefore should not be enabled without good reason.
21999 +config VSERVER_DEVICE
22000 + bool "Enable Guest Device Mapping"
22001 + depends on EXPERIMENTAL
22004 + This enables generic device remapping.
22006 +config VSERVER_PROC_SECURE
22007 + bool "Enable Proc Security"
22008 + depends on PROC_FS
22011 + This configures ProcFS security to initially hide
22012 + non-process entries for all contexts except the main and
22013 + spectator context (i.e. for all guests), which is a secure
22016 + (note: on 1.2x the entries were visible by default)
22018 +config VSERVER_HARDCPU
22019 + bool "Enable Hard CPU Limits"
22022 + Activate the Hard CPU Limits
22024 + This will compile in code that allows the Token Bucket
22025 + Scheduler to put processes on hold when a context's
22026 + tokens are depleted (provided that its per-context
22027 + sched_hard flag is set).
22029 + Processes belonging to that context will not be able
22030 + to consume CPU resources again until a per-context
22031 + configured minimum of tokens has been reached.
22033 +config VSERVER_IDLETIME
22034 + bool "Avoid idle CPUs by skipping Time"
22035 + depends on VSERVER_HARDCPU
22038 + This option allows the scheduler to artificially
22039 + advance time (per cpu) when otherwise the idle
22040 + task would be scheduled, thus keeping the cpu
22041 + busy and sharing the available resources among
22042 + certain contexts.
22044 +config VSERVER_IDLELIMIT
22045 + bool "Limit the IDLE task"
22046 + depends on VSERVER_HARDCPU
22049 + Limit the idle slices, so the the next context
22050 + will be scheduled as soon as possible.
22052 + This might improve interactivity and latency, but
22053 + will also marginally increase scheduling overhead.
22056 + prompt "Persistent Inode Tagging"
22057 + default TAGGING_ID24
22059 + This adds persistent context information to filesystems
22060 + mounted with the tagxid option. Tagging is a requirement
22061 + for per-context disk limits and per-context quota.
22064 +config TAGGING_NONE
22067 + do not store per-context information in inodes.
22069 +config TAGGING_UID16
22070 + bool "UID16/GID32"
22072 + reduces UID to 16 bit, but leaves GID at 32 bit.
22074 +config TAGGING_GID16
22075 + bool "UID32/GID16"
22077 + reduces GID to 16 bit, but leaves UID at 32 bit.
22079 +config TAGGING_ID24
22080 + bool "UID24/GID24"
22082 + uses the upper 8bit from UID and GID for XID tagging
22083 + which leaves 24bit for UID/GID each, which should be
22084 + more than sufficient for normal use.
22086 +config TAGGING_INTERN
22087 + bool "UID32/GID32"
22089 + this uses otherwise reserved inode fields in the on
22090 + disk representation, which limits the use to a few
22091 + filesystems (currently ext2 and ext3)
22096 + bool "Tag NFSD User Auth and Files"
22099 + Enable this if you do want the in-kernel NFS
22100 + Server to use the tagging specified above.
22101 + (will require patched clients too)
22103 +config VSERVER_PRIVACY
22104 + bool "Honor Privacy Aspects of Guests"
22107 + When enabled, most context checks will disallow
22108 + access to structures assigned to a specific context,
22109 + like ptys or loop devices.
22111 +config VSERVER_CONTEXTS
22112 + int "Maximum number of Contexts (1-65533)" if EMBEDDED
22114 + default "768" if 64BIT
22117 + This setting will optimize certain data structures
22118 + and memory allocations according to the expected
22121 + note: this is not a strict upper limit.
22123 +config VSERVER_WARN
22124 + bool "VServer Warnings"
22127 + This enables various runtime warnings, which will
22128 + notify about potential manipulation attempts or
22129 + resource shortage. It is generally considered to
22130 + be a good idea to have that enabled.
22132 +config VSERVER_DEBUG
22133 + bool "VServer Debugging Code"
22136 + Set this to yes if you want to be able to activate
22137 + debugging output at runtime. It adds a very small
22138 + overhead to all vserver related functions and
22139 + increases the kernel size by about 20k.
22141 +config VSERVER_HISTORY
22142 + bool "VServer History Tracing"
22143 + depends on VSERVER_DEBUG
22146 + Set this to yes if you want to record the history of
22147 + linux-vserver activities, so they can be replayed in
22148 + the event of a kernel panic or oops.
22150 +config VSERVER_HISTORY_SIZE
22151 + int "Per-CPU History Size (32-65536)"
22152 + depends on VSERVER_HISTORY
22156 + This allows you to specify the number of entries in
22157 + the per-CPU history buffer.
22159 +config VSERVER_MONITOR
22160 + bool "VServer Scheduling Monitor"
22161 + depends on VSERVER_DISABLED
22164 + Set this to yes if you want to record the scheduling
22165 + decisions, so that they can be relayed to userspace
22166 + for detailed analysis.
22168 +config VSERVER_MONITOR_SIZE
22169 + int "Per-CPU Monitor Queue Size (32-65536)"
22170 + depends on VSERVER_MONITOR
22174 + This allows you to specify the number of entries in
22175 + the per-CPU scheduling monitor buffer.
22177 +config VSERVER_MONITOR_SYNC
22178 + int "Per-CPU Monitor Sync Interval (0-65536)"
22179 + depends on VSERVER_MONITOR
22183 + This allows you to specify the interval in ticks
22184 + when a time sync entry is inserted.
22192 + select NAMESPACES
22198 +config VSERVER_SECURITY
22200 + depends on SECURITY
22202 + select SECURITY_CAPABILITIES
22204 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/limit.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/limit.c
22205 --- linux-2.6.33.1/kernel/vserver/limit.c 1970-01-01 01:00:00.000000000 +0100
22206 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/limit.c 2010-03-23 19:51:30.000000000 +0100
22209 + * linux/kernel/vserver/limit.c
22211 + * Virtual Server: Context Limits
22213 + * Copyright (C) 2004-2010 Herbert Pötzl
22215 + * V0.01 broken out from vcontext V0.05
22216 + * V0.02 changed vcmds to vxi arg
22217 + * V0.03 added memory cgroup support
22221 +#include <linux/sched.h>
22222 +#include <linux/module.h>
22223 +#include <linux/memcontrol.h>
22224 +#include <linux/res_counter.h>
22225 +#include <linux/vs_limit.h>
22226 +#include <linux/vserver/limit.h>
22227 +#include <linux/vserver/limit_cmd.h>
22229 +#include <asm/uaccess.h>
22232 +const char *vlimit_name[NUM_LIMITS] = {
22233 + [RLIMIT_CPU] = "CPU",
22234 + [RLIMIT_RSS] = "RSS",
22235 + [RLIMIT_NPROC] = "NPROC",
22236 + [RLIMIT_NOFILE] = "NOFILE",
22237 + [RLIMIT_MEMLOCK] = "VML",
22238 + [RLIMIT_AS] = "VM",
22239 + [RLIMIT_LOCKS] = "LOCKS",
22240 + [RLIMIT_SIGPENDING] = "SIGP",
22241 + [RLIMIT_MSGQUEUE] = "MSGQ",
22243 + [VLIMIT_NSOCK] = "NSOCK",
22244 + [VLIMIT_OPENFD] = "OPENFD",
22245 + [VLIMIT_ANON] = "ANON",
22246 + [VLIMIT_SHMEM] = "SHMEM",
22247 + [VLIMIT_DENTRY] = "DENTRY",
22250 +EXPORT_SYMBOL_GPL(vlimit_name);
22252 +#define MASK_ENTRY(x) (1 << (x))
22254 +const struct vcmd_ctx_rlimit_mask_v0 vlimit_mask = {
22257 + , /* softlimit */
22258 + MASK_ENTRY( RLIMIT_RSS ) |
22259 + MASK_ENTRY( VLIMIT_ANON ) |
22262 + MASK_ENTRY( RLIMIT_RSS ) |
22263 + MASK_ENTRY( RLIMIT_NPROC ) |
22264 + MASK_ENTRY( RLIMIT_NOFILE ) |
22265 + MASK_ENTRY( RLIMIT_MEMLOCK ) |
22266 + MASK_ENTRY( RLIMIT_AS ) |
22267 + MASK_ENTRY( RLIMIT_LOCKS ) |
22268 + MASK_ENTRY( RLIMIT_MSGQUEUE ) |
22270 + MASK_ENTRY( VLIMIT_NSOCK ) |
22271 + MASK_ENTRY( VLIMIT_OPENFD ) |
22272 + MASK_ENTRY( VLIMIT_ANON ) |
22273 + MASK_ENTRY( VLIMIT_SHMEM ) |
22274 + MASK_ENTRY( VLIMIT_DENTRY ) |
22277 + /* accounting only */
22278 +uint32_t account_mask =
22279 + MASK_ENTRY( VLIMIT_SEMARY ) |
22280 + MASK_ENTRY( VLIMIT_NSEMS ) |
22281 + MASK_ENTRY( VLIMIT_MAPPED ) |
22285 +static int is_valid_vlimit(int id)
22287 + uint32_t mask = vlimit_mask.minimum |
22288 + vlimit_mask.softlimit | vlimit_mask.maximum;
22289 + return mask & (1 << id);
22292 +static int is_accounted_vlimit(int id)
22294 + if (is_valid_vlimit(id))
22296 + return account_mask & (1 << id);
22300 +static inline uint64_t vc_get_soft(struct vx_info *vxi, int id)
22302 + rlim_t limit = __rlim_soft(&vxi->limit, id);
22303 + return VX_VLIM(limit);
22306 +static inline uint64_t vc_get_hard(struct vx_info *vxi, int id)
22308 + rlim_t limit = __rlim_hard(&vxi->limit, id);
22309 + return VX_VLIM(limit);
22312 +static int do_get_rlimit(struct vx_info *vxi, uint32_t id,
22313 + uint64_t *minimum, uint64_t *softlimit, uint64_t *maximum)
22315 + if (!is_valid_vlimit(id))
22319 + *minimum = CRLIM_UNSET;
22321 + *softlimit = vc_get_soft(vxi, id);
22323 + *maximum = vc_get_hard(vxi, id);
22327 +int vc_get_rlimit(struct vx_info *vxi, void __user *data)
22329 + struct vcmd_ctx_rlimit_v0 vc_data;
22332 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22335 + ret = do_get_rlimit(vxi, vc_data.id,
22336 + &vc_data.minimum, &vc_data.softlimit, &vc_data.maximum);
22340 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22345 +static int do_set_rlimit(struct vx_info *vxi, uint32_t id,
22346 + uint64_t minimum, uint64_t softlimit, uint64_t maximum)
22348 + if (!is_valid_vlimit(id))
22351 + if (maximum != CRLIM_KEEP)
22352 + __rlim_hard(&vxi->limit, id) = VX_RLIM(maximum);
22353 + if (softlimit != CRLIM_KEEP)
22354 + __rlim_soft(&vxi->limit, id) = VX_RLIM(softlimit);
22356 + /* clamp soft limit */
22357 + if (__rlim_soft(&vxi->limit, id) > __rlim_hard(&vxi->limit, id))
22358 + __rlim_soft(&vxi->limit, id) = __rlim_hard(&vxi->limit, id);
22363 +int vc_set_rlimit(struct vx_info *vxi, void __user *data)
22365 + struct vcmd_ctx_rlimit_v0 vc_data;
22367 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22370 + return do_set_rlimit(vxi, vc_data.id,
22371 + vc_data.minimum, vc_data.softlimit, vc_data.maximum);
22374 +#ifdef CONFIG_IA32_EMULATION
22376 +int vc_set_rlimit_x32(struct vx_info *vxi, void __user *data)
22378 + struct vcmd_ctx_rlimit_v0_x32 vc_data;
22380 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22383 + return do_set_rlimit(vxi, vc_data.id,
22384 + vc_data.minimum, vc_data.softlimit, vc_data.maximum);
22387 +int vc_get_rlimit_x32(struct vx_info *vxi, void __user *data)
22389 + struct vcmd_ctx_rlimit_v0_x32 vc_data;
22392 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22395 + ret = do_get_rlimit(vxi, vc_data.id,
22396 + &vc_data.minimum, &vc_data.softlimit, &vc_data.maximum);
22400 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22405 +#endif /* CONFIG_IA32_EMULATION */
22408 +int vc_get_rlimit_mask(uint32_t id, void __user *data)
22410 + if (copy_to_user(data, &vlimit_mask, sizeof(vlimit_mask)))
22416 +static inline void vx_reset_hits(struct _vx_limit *limit)
22420 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22421 + atomic_set(&__rlim_lhit(limit, lim), 0);
22425 +int vc_reset_hits(struct vx_info *vxi, void __user *data)
22427 + vx_reset_hits(&vxi->limit);
22431 +static inline void vx_reset_minmax(struct _vx_limit *limit)
22436 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22437 + value = __rlim_get(limit, lim);
22438 + __rlim_rmax(limit, lim) = value;
22439 + __rlim_rmin(limit, lim) = value;
22443 +int vc_reset_minmax(struct vx_info *vxi, void __user *data)
22445 + vx_reset_minmax(&vxi->limit);
22450 +int vc_rlimit_stat(struct vx_info *vxi, void __user *data)
22452 + struct vcmd_rlimit_stat_v0 vc_data;
22453 + struct _vx_limit *limit = &vxi->limit;
22456 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22460 + if (!is_accounted_vlimit(id))
22463 + vx_limit_fixup(limit, id);
22464 + vc_data.hits = atomic_read(&__rlim_lhit(limit, id));
22465 + vc_data.value = __rlim_get(limit, id);
22466 + vc_data.minimum = __rlim_rmin(limit, id);
22467 + vc_data.maximum = __rlim_rmax(limit, id);
22469 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22475 +void vx_vsi_meminfo(struct sysinfo *val)
22477 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22478 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22479 + u64 res_limit, res_usage;
22484 + res_limit = mem_cgroup_res_read_u64(mcg, RES_LIMIT);
22485 + res_usage = mem_cgroup_res_read_u64(mcg, RES_USAGE);
22487 + if (res_limit != RESOURCE_MAX)
22488 + val->totalram = (res_limit >> PAGE_SHIFT);
22489 + val->freeram = val->totalram - (res_usage >> PAGE_SHIFT);
22490 + val->bufferram = 0;
22491 +#else /* !CONFIG_CGROUP_MEM_RES_CTLR */
22492 + struct vx_info *vxi = current_vx_info();
22493 + unsigned long totalram, freeram;
22496 + /* we blindly accept the max */
22497 + v = __rlim_soft(&vxi->limit, RLIMIT_RSS);
22498 + totalram = (v != RLIM_INFINITY) ? v : val->totalram;
22500 + /* total minus used equals free */
22501 + v = __vx_cres_array_fixup(&vxi->limit, VLA_RSS);
22502 + freeram = (v < totalram) ? totalram - v : 0;
22504 + val->totalram = totalram;
22505 + val->freeram = freeram;
22506 +#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
22507 + val->totalhigh = 0;
22508 + val->freehigh = 0;
22512 +void vx_vsi_swapinfo(struct sysinfo *val)
22514 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22515 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
22516 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22517 + u64 res_limit, res_usage, memsw_limit, memsw_usage;
22518 + s64 swap_limit, swap_usage;
22523 + res_limit = mem_cgroup_res_read_u64(mcg, RES_LIMIT);
22524 + res_usage = mem_cgroup_res_read_u64(mcg, RES_USAGE);
22525 + memsw_limit = mem_cgroup_memsw_read_u64(mcg, RES_LIMIT);
22526 + memsw_usage = mem_cgroup_memsw_read_u64(mcg, RES_USAGE);
22528 + if (res_limit == RESOURCE_MAX)
22531 + swap_limit = memsw_limit - res_limit;
22532 + if (memsw_limit != RESOURCE_MAX)
22533 + val->totalswap = swap_limit >> PAGE_SHIFT;
22535 + swap_usage = memsw_usage - res_usage;
22536 + val->freeswap = (swap_usage < swap_limit) ?
22537 + val->totalswap - (swap_usage >> PAGE_SHIFT) : 0;
22538 +#else /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
22539 + val->totalswap = 0;
22540 + val->freeswap = 0;
22541 +#endif /* !CONFIG_CGROUP_MEM_RES_CTLR_SWAP */
22542 +#else /* !CONFIG_CGROUP_MEM_RES_CTLR */
22543 + struct vx_info *vxi = current_vx_info();
22544 + unsigned long totalswap, freeswap;
22547 + v = __rlim_soft(&vxi->limit, RLIMIT_RSS);
22548 + if (v == RLIM_INFINITY) {
22549 + val->freeswap = val->totalswap;
22553 + /* we blindly accept the max */
22554 + w = __rlim_hard(&vxi->limit, RLIMIT_RSS);
22555 + totalswap = (w != RLIM_INFINITY) ? (w - v) : val->totalswap;
22557 + /* currently 'used' swap */
22558 + w = __vx_cres_array_fixup(&vxi->limit, VLA_RSS);
22559 + w -= (w > v) ? v : w;
22561 + /* total minus used equals free */
22562 + freeswap = (w < totalswap) ? totalswap - w : 0;
22564 + val->totalswap = totalswap;
22565 + val->freeswap = freeswap;
22566 +#endif /* CONFIG_CGROUP_MEM_RES_CTLR */
22570 +long vx_vsi_cached(struct sysinfo *val)
22572 +#ifdef CONFIG_CGROUP_MEM_RES_CTLR
22573 + struct mem_cgroup *mcg = mem_cgroup_from_task(current);
22575 + return mem_cgroup_stat_read_cache(mcg);
22582 +unsigned long vx_badness(struct task_struct *task, struct mm_struct *mm)
22584 + struct vx_info *vxi = mm->mm_vx_info;
22585 + unsigned long points;
22591 + points = vxi->vx_badness_bias;
22593 + v = __vx_cres_array_fixup(&vxi->limit, VLA_RSS);
22594 + w = __rlim_soft(&vxi->limit, RLIMIT_RSS);
22595 + points += (v > w) ? (v - w) : 0;
22600 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/limit_init.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/limit_init.h
22601 --- linux-2.6.33.1/kernel/vserver/limit_init.h 1970-01-01 01:00:00.000000000 +0100
22602 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/limit_init.h 2010-02-25 12:02:16.000000000 +0100
22606 +static inline void vx_info_init_limit(struct _vx_limit *limit)
22610 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22611 + __rlim_soft(limit, lim) = RLIM_INFINITY;
22612 + __rlim_hard(limit, lim) = RLIM_INFINITY;
22613 + __rlim_set(limit, lim, 0);
22614 + atomic_set(&__rlim_lhit(limit, lim), 0);
22615 + __rlim_rmin(limit, lim) = 0;
22616 + __rlim_rmax(limit, lim) = 0;
22620 +static inline void vx_info_exit_limit(struct _vx_limit *limit)
22625 + for (lim = 0; lim < NUM_LIMITS; lim++) {
22626 + if ((1 << lim) & VLIM_NOCHECK)
22628 + value = __rlim_get(limit, lim);
22629 + vxwprintk_xid(value,
22630 + "!!! limit: %p[%s,%d] = %ld on exit.",
22631 + limit, vlimit_name[lim], lim, (long)value);
22635 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/limit_proc.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/limit_proc.h
22636 --- linux-2.6.33.1/kernel/vserver/limit_proc.h 1970-01-01 01:00:00.000000000 +0100
22637 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/limit_proc.h 2010-02-25 12:02:16.000000000 +0100
22639 +#ifndef _VX_LIMIT_PROC_H
22640 +#define _VX_LIMIT_PROC_H
22642 +#include <linux/vserver/limit_int.h>
22645 +#define VX_LIMIT_FMT ":\t%8ld\t%8ld/%8ld\t%8lld/%8lld\t%6d\n"
22646 +#define VX_LIMIT_TOP \
22647 + "Limit\t current\t min/max\t\t soft/hard\t\thits\n"
22649 +#define VX_LIMIT_ARG(r) \
22650 + (unsigned long)__rlim_get(limit, r), \
22651 + (unsigned long)__rlim_rmin(limit, r), \
22652 + (unsigned long)__rlim_rmax(limit, r), \
22653 + VX_VLIM(__rlim_soft(limit, r)), \
22654 + VX_VLIM(__rlim_hard(limit, r)), \
22655 + atomic_read(&__rlim_lhit(limit, r))
22657 +static inline int vx_info_proc_limit(struct _vx_limit *limit, char *buffer)
22659 + vx_limit_fixup(limit, -1);
22660 + return sprintf(buffer, VX_LIMIT_TOP
22661 + "PROC" VX_LIMIT_FMT
22662 + "VM" VX_LIMIT_FMT
22663 + "VML" VX_LIMIT_FMT
22664 + "RSS" VX_LIMIT_FMT
22665 + "ANON" VX_LIMIT_FMT
22666 + "RMAP" VX_LIMIT_FMT
22667 + "FILES" VX_LIMIT_FMT
22668 + "OFD" VX_LIMIT_FMT
22669 + "LOCKS" VX_LIMIT_FMT
22670 + "SOCK" VX_LIMIT_FMT
22671 + "MSGQ" VX_LIMIT_FMT
22672 + "SHM" VX_LIMIT_FMT
22673 + "SEMA" VX_LIMIT_FMT
22674 + "SEMS" VX_LIMIT_FMT
22675 + "DENT" VX_LIMIT_FMT,
22676 + VX_LIMIT_ARG(RLIMIT_NPROC),
22677 + VX_LIMIT_ARG(RLIMIT_AS),
22678 + VX_LIMIT_ARG(RLIMIT_MEMLOCK),
22679 + VX_LIMIT_ARG(RLIMIT_RSS),
22680 + VX_LIMIT_ARG(VLIMIT_ANON),
22681 + VX_LIMIT_ARG(VLIMIT_MAPPED),
22682 + VX_LIMIT_ARG(RLIMIT_NOFILE),
22683 + VX_LIMIT_ARG(VLIMIT_OPENFD),
22684 + VX_LIMIT_ARG(RLIMIT_LOCKS),
22685 + VX_LIMIT_ARG(VLIMIT_NSOCK),
22686 + VX_LIMIT_ARG(RLIMIT_MSGQUEUE),
22687 + VX_LIMIT_ARG(VLIMIT_SHMEM),
22688 + VX_LIMIT_ARG(VLIMIT_SEMARY),
22689 + VX_LIMIT_ARG(VLIMIT_NSEMS),
22690 + VX_LIMIT_ARG(VLIMIT_DENTRY));
22693 +#endif /* _VX_LIMIT_PROC_H */
22696 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/Makefile linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/Makefile
22697 --- linux-2.6.33.1/kernel/vserver/Makefile 1970-01-01 01:00:00.000000000 +0100
22698 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/Makefile 2010-02-25 12:02:16.000000000 +0100
22701 +# Makefile for the Linux vserver routines.
22705 +obj-y += vserver.o
22707 +vserver-y := switch.o context.o space.o sched.o network.o inode.o \
22708 + limit.o cvirt.o cacct.o signal.o helper.o init.o \
22711 +vserver-$(CONFIG_INET) += inet.o
22712 +vserver-$(CONFIG_PROC_FS) += proc.o
22713 +vserver-$(CONFIG_VSERVER_DEBUG) += sysctl.o debug.o
22714 +vserver-$(CONFIG_VSERVER_HISTORY) += history.o
22715 +vserver-$(CONFIG_VSERVER_MONITOR) += monitor.o
22716 +vserver-$(CONFIG_VSERVER_DEVICE) += device.o
22718 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/monitor.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/monitor.c
22719 --- linux-2.6.33.1/kernel/vserver/monitor.c 1970-01-01 01:00:00.000000000 +0100
22720 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/monitor.c 2010-02-25 12:02:16.000000000 +0100
22723 + * kernel/vserver/monitor.c
22725 + * Virtual Context Scheduler Monitor
22727 + * Copyright (C) 2006-2007 Herbert Pötzl
22729 + * V0.01 basic design
22733 +#include <linux/module.h>
22734 +#include <linux/jiffies.h>
22735 +#include <asm/uaccess.h>
22736 +#include <asm/atomic.h>
22738 +#include <linux/vserver/monitor.h>
22739 +#include <linux/vserver/debug_cmd.h>
22742 +#ifdef CONFIG_VSERVER_MONITOR
22743 +#define VXM_SIZE CONFIG_VSERVER_MONITOR_SIZE
22745 +#define VXM_SIZE 64
22748 +struct _vx_monitor {
22749 + unsigned int counter;
22751 + struct _vx_mon_entry entry[VXM_SIZE+1];
22755 +DEFINE_PER_CPU(struct _vx_monitor, vx_monitor_buffer);
22757 +unsigned volatile int vxm_active = 1;
22759 +static atomic_t sequence = ATOMIC_INIT(0);
22764 + * requires disabled preemption */
22766 +struct _vx_mon_entry *vxm_advance(int cpu)
22768 + struct _vx_monitor *mon = &per_cpu(vx_monitor_buffer, cpu);
22769 + struct _vx_mon_entry *entry;
22770 + unsigned int index;
22772 + index = vxm_active ? (mon->counter++ % VXM_SIZE) : VXM_SIZE;
22773 + entry = &mon->entry[index];
22775 + entry->ev.seq = atomic_inc_return(&sequence);
22776 + entry->ev.jif = jiffies;
22780 +EXPORT_SYMBOL_GPL(vxm_advance);
22783 +int do_read_monitor(struct __user _vx_mon_entry *data,
22784 + int cpu, uint32_t *index, uint32_t *count)
22786 + int pos, ret = 0;
22787 + struct _vx_monitor *mon = &per_cpu(vx_monitor_buffer, cpu);
22788 + int end = mon->counter;
22789 + int start = end - VXM_SIZE + 2;
22790 + int idx = *index;
22792 + /* special case: get current pos */
22798 + /* have we lost some data? */
22802 + for (pos = 0; (pos < *count) && (idx < end); pos++, idx++) {
22803 + struct _vx_mon_entry *entry =
22804 + &mon->entry[idx % VXM_SIZE];
22806 + /* send entry to userspace */
22807 + ret = copy_to_user(&data[pos], entry, sizeof(*entry));
22811 + /* save new index and count */
22814 + return ret ? ret : (*index < end);
22817 +int vc_read_monitor(uint32_t id, void __user *data)
22819 + struct vcmd_read_monitor_v0 vc_data;
22822 + if (id >= NR_CPUS)
22825 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22828 + ret = do_read_monitor((struct __user _vx_mon_entry *)vc_data.data,
22829 + id, &vc_data.index, &vc_data.count);
22831 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22836 +#ifdef CONFIG_COMPAT
22838 +int vc_read_monitor_x32(uint32_t id, void __user *data)
22840 + struct vcmd_read_monitor_v0_x32 vc_data;
22843 + if (id >= NR_CPUS)
22846 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
22849 + ret = do_read_monitor((struct __user _vx_mon_entry *)
22850 + compat_ptr(vc_data.data_ptr),
22851 + id, &vc_data.index, &vc_data.count);
22853 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
22858 +#endif /* CONFIG_COMPAT */
22860 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/network.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/network.c
22861 --- linux-2.6.33.1/kernel/vserver/network.c 1970-01-01 01:00:00.000000000 +0100
22862 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/network.c 2010-02-25 12:02:16.000000000 +0100
22865 + * linux/kernel/vserver/network.c
22867 + * Virtual Server: Network Support
22869 + * Copyright (C) 2003-2007 Herbert Pötzl
22871 + * V0.01 broken out from vcontext V0.05
22872 + * V0.02 cleaned up implementation
22873 + * V0.03 added equiv nx commands
22874 + * V0.04 switch to RCU based hash
22875 + * V0.05 and back to locking again
22876 + * V0.06 changed vcmds to nxi arg
22877 + * V0.07 have __create claim() the nxi
22881 +#include <linux/err.h>
22882 +#include <linux/slab.h>
22883 +#include <linux/rcupdate.h>
22885 +#include <linux/vs_network.h>
22886 +#include <linux/vs_pid.h>
22887 +#include <linux/vserver/network_cmd.h>
22890 +atomic_t nx_global_ctotal = ATOMIC_INIT(0);
22891 +atomic_t nx_global_cactive = ATOMIC_INIT(0);
22893 +static struct kmem_cache *nx_addr_v4_cachep = NULL;
22894 +static struct kmem_cache *nx_addr_v6_cachep = NULL;
22897 +static int __init init_network(void)
22899 + nx_addr_v4_cachep = kmem_cache_create("nx_v4_addr_cache",
22900 + sizeof(struct nx_addr_v4), 0,
22901 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
22902 + nx_addr_v6_cachep = kmem_cache_create("nx_v6_addr_cache",
22903 + sizeof(struct nx_addr_v6), 0,
22904 + SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
22909 +/* __alloc_nx_addr_v4() */
22911 +static inline struct nx_addr_v4 *__alloc_nx_addr_v4(void)
22913 + struct nx_addr_v4 *nxa = kmem_cache_alloc(
22914 + nx_addr_v4_cachep, GFP_KERNEL);
22916 + if (!IS_ERR(nxa))
22917 + memset(nxa, 0, sizeof(*nxa));
22921 +/* __dealloc_nx_addr_v4() */
22923 +static inline void __dealloc_nx_addr_v4(struct nx_addr_v4 *nxa)
22925 + kmem_cache_free(nx_addr_v4_cachep, nxa);
22928 +/* __dealloc_nx_addr_v4_all() */
22930 +static inline void __dealloc_nx_addr_v4_all(struct nx_addr_v4 *nxa)
22933 + struct nx_addr_v4 *next = nxa->next;
22935 + __dealloc_nx_addr_v4(nxa);
22941 +#ifdef CONFIG_IPV6
22943 +/* __alloc_nx_addr_v6() */
22945 +static inline struct nx_addr_v6 *__alloc_nx_addr_v6(void)
22947 + struct nx_addr_v6 *nxa = kmem_cache_alloc(
22948 + nx_addr_v6_cachep, GFP_KERNEL);
22950 + if (!IS_ERR(nxa))
22951 + memset(nxa, 0, sizeof(*nxa));
22955 +/* __dealloc_nx_addr_v6() */
22957 +static inline void __dealloc_nx_addr_v6(struct nx_addr_v6 *nxa)
22959 + kmem_cache_free(nx_addr_v6_cachep, nxa);
22962 +/* __dealloc_nx_addr_v6_all() */
22964 +static inline void __dealloc_nx_addr_v6_all(struct nx_addr_v6 *nxa)
22967 + struct nx_addr_v6 *next = nxa->next;
22969 + __dealloc_nx_addr_v6(nxa);
22974 +#endif /* CONFIG_IPV6 */
22976 +/* __alloc_nx_info()
22978 + * allocate an initialized nx_info struct
22979 + * doesn't make it visible (hash) */
22981 +static struct nx_info *__alloc_nx_info(nid_t nid)
22983 + struct nx_info *new = NULL;
22985 + vxdprintk(VXD_CBIT(nid, 1), "alloc_nx_info(%d)*", nid);
22987 + /* would this benefit from a slab cache? */
22988 + new = kmalloc(sizeof(struct nx_info), GFP_KERNEL);
22992 + memset(new, 0, sizeof(struct nx_info));
22993 + new->nx_id = nid;
22994 + INIT_HLIST_NODE(&new->nx_hlist);
22995 + atomic_set(&new->nx_usecnt, 0);
22996 + atomic_set(&new->nx_tasks, 0);
22997 + new->nx_state = 0;
22999 + new->nx_flags = NXF_INIT_SET;
23001 + /* rest of init goes here */
23003 + new->v4_lback.s_addr = htonl(INADDR_LOOPBACK);
23004 + new->v4_bcast.s_addr = htonl(INADDR_BROADCAST);
23006 + vxdprintk(VXD_CBIT(nid, 0),
23007 + "alloc_nx_info(%d) = %p", nid, new);
23008 + atomic_inc(&nx_global_ctotal);
23012 +/* __dealloc_nx_info()
23014 + * final disposal of nx_info */
23016 +static void __dealloc_nx_info(struct nx_info *nxi)
23018 + vxdprintk(VXD_CBIT(nid, 0),
23019 + "dealloc_nx_info(%p)", nxi);
23021 + nxi->nx_hlist.next = LIST_POISON1;
23024 + BUG_ON(atomic_read(&nxi->nx_usecnt));
23025 + BUG_ON(atomic_read(&nxi->nx_tasks));
23027 + __dealloc_nx_addr_v4_all(nxi->v4.next);
23029 + nxi->nx_state |= NXS_RELEASED;
23031 + atomic_dec(&nx_global_ctotal);
23034 +static void __shutdown_nx_info(struct nx_info *nxi)
23036 + nxi->nx_state |= NXS_SHUTDOWN;
23037 + vs_net_change(nxi, VSC_NETDOWN);
23040 +/* exported stuff */
23042 +void free_nx_info(struct nx_info *nxi)
23044 + /* context shutdown is mandatory */
23045 + BUG_ON(nxi->nx_state != NXS_SHUTDOWN);
23047 + /* context must not be hashed */
23048 + BUG_ON(nxi->nx_state & NXS_HASHED);
23050 + BUG_ON(atomic_read(&nxi->nx_usecnt));
23051 + BUG_ON(atomic_read(&nxi->nx_tasks));
23053 + __dealloc_nx_info(nxi);
23057 +void __nx_set_lback(struct nx_info *nxi)
23059 + int nid = nxi->nx_id;
23060 + __be32 lback = htonl(INADDR_LOOPBACK ^ ((nid & 0xFFFF) << 8));
23062 + nxi->v4_lback.s_addr = lback;
23065 +extern int __nx_inet_add_lback(__be32 addr);
23066 +extern int __nx_inet_del_lback(__be32 addr);
23069 +/* hash table for nx_info hash */
23071 +#define NX_HASH_SIZE 13
23073 +struct hlist_head nx_info_hash[NX_HASH_SIZE];
23075 +static spinlock_t nx_info_hash_lock = SPIN_LOCK_UNLOCKED;
23078 +static inline unsigned int __hashval(nid_t nid)
23080 + return (nid % NX_HASH_SIZE);
23085 +/* __hash_nx_info()
23087 + * add the nxi to the global hash table
23088 + * requires the hash_lock to be held */
23090 +static inline void __hash_nx_info(struct nx_info *nxi)
23092 + struct hlist_head *head;
23094 + vxd_assert_lock(&nx_info_hash_lock);
23095 + vxdprintk(VXD_CBIT(nid, 4),
23096 + "__hash_nx_info: %p[#%d]", nxi, nxi->nx_id);
23098 + /* context must not be hashed */
23099 + BUG_ON(nx_info_state(nxi, NXS_HASHED));
23101 + nxi->nx_state |= NXS_HASHED;
23102 + head = &nx_info_hash[__hashval(nxi->nx_id)];
23103 + hlist_add_head(&nxi->nx_hlist, head);
23104 + atomic_inc(&nx_global_cactive);
23107 +/* __unhash_nx_info()
23109 + * remove the nxi from the global hash table
23110 + * requires the hash_lock to be held */
23112 +static inline void __unhash_nx_info(struct nx_info *nxi)
23114 + vxd_assert_lock(&nx_info_hash_lock);
23115 + vxdprintk(VXD_CBIT(nid, 4),
23116 + "__unhash_nx_info: %p[#%d.%d.%d]", nxi, nxi->nx_id,
23117 + atomic_read(&nxi->nx_usecnt), atomic_read(&nxi->nx_tasks));
23119 + /* context must be hashed */
23120 + BUG_ON(!nx_info_state(nxi, NXS_HASHED));
23121 + /* but without tasks */
23122 + BUG_ON(atomic_read(&nxi->nx_tasks));
23124 + nxi->nx_state &= ~NXS_HASHED;
23125 + hlist_del(&nxi->nx_hlist);
23126 + atomic_dec(&nx_global_cactive);
23130 +/* __lookup_nx_info()
23132 + * requires the hash_lock to be held
23133 + * doesn't increment the nx_refcnt */
23135 +static inline struct nx_info *__lookup_nx_info(nid_t nid)
23137 + struct hlist_head *head = &nx_info_hash[__hashval(nid)];
23138 + struct hlist_node *pos;
23139 + struct nx_info *nxi;
23141 + vxd_assert_lock(&nx_info_hash_lock);
23142 + hlist_for_each(pos, head) {
23143 + nxi = hlist_entry(pos, struct nx_info, nx_hlist);
23145 + if (nxi->nx_id == nid)
23150 + vxdprintk(VXD_CBIT(nid, 0),
23151 + "__lookup_nx_info(#%u): %p[#%u]",
23152 + nid, nxi, nxi ? nxi->nx_id : 0);
23157 +/* __create_nx_info()
23159 + * create the requested context
23160 + * get(), claim() and hash it */
23162 +static struct nx_info *__create_nx_info(int id)
23164 + struct nx_info *new, *nxi = NULL;
23166 + vxdprintk(VXD_CBIT(nid, 1), "create_nx_info(%d)*", id);
23168 + if (!(new = __alloc_nx_info(id)))
23169 + return ERR_PTR(-ENOMEM);
23171 + /* required to make dynamic xids unique */
23172 + spin_lock(&nx_info_hash_lock);
23174 + /* static context requested */
23175 + if ((nxi = __lookup_nx_info(id))) {
23176 + vxdprintk(VXD_CBIT(nid, 0),
23177 + "create_nx_info(%d) = %p (already there)", id, nxi);
23178 + if (nx_info_flags(nxi, NXF_STATE_SETUP, 0))
23179 + nxi = ERR_PTR(-EBUSY);
23181 + nxi = ERR_PTR(-EEXIST);
23184 + /* new context */
23185 + vxdprintk(VXD_CBIT(nid, 0),
23186 + "create_nx_info(%d) = %p (new)", id, new);
23187 + claim_nx_info(new, NULL);
23188 + __nx_set_lback(new);
23189 + __hash_nx_info(get_nx_info(new));
23190 + nxi = new, new = NULL;
23193 + spin_unlock(&nx_info_hash_lock);
23195 + __dealloc_nx_info(new);
23201 +/* exported stuff */
23204 +void unhash_nx_info(struct nx_info *nxi)
23206 + __shutdown_nx_info(nxi);
23207 + spin_lock(&nx_info_hash_lock);
23208 + __unhash_nx_info(nxi);
23209 + spin_unlock(&nx_info_hash_lock);
23212 +/* lookup_nx_info()
23214 + * search for a nx_info and get() it
23215 + * negative id means current */
23217 +struct nx_info *lookup_nx_info(int id)
23219 + struct nx_info *nxi = NULL;
23222 + nxi = get_nx_info(current_nx_info());
23223 + } else if (id > 1) {
23224 + spin_lock(&nx_info_hash_lock);
23225 + nxi = get_nx_info(__lookup_nx_info(id));
23226 + spin_unlock(&nx_info_hash_lock);
23231 +/* nid_is_hashed()
23233 + * verify that nid is still hashed */
23235 +int nid_is_hashed(nid_t nid)
23239 + spin_lock(&nx_info_hash_lock);
23240 + hashed = (__lookup_nx_info(nid) != NULL);
23241 + spin_unlock(&nx_info_hash_lock);
23246 +#ifdef CONFIG_PROC_FS
23250 + * get a subset of hashed nids for proc
23251 + * assumes size is at least one */
23253 +int get_nid_list(int index, unsigned int *nids, int size)
23255 + int hindex, nr_nids = 0;
23257 + /* only show current and children */
23258 + if (!nx_check(0, VS_ADMIN | VS_WATCH)) {
23261 + nids[nr_nids] = nx_current_nid();
23265 + for (hindex = 0; hindex < NX_HASH_SIZE; hindex++) {
23266 + struct hlist_head *head = &nx_info_hash[hindex];
23267 + struct hlist_node *pos;
23269 + spin_lock(&nx_info_hash_lock);
23270 + hlist_for_each(pos, head) {
23271 + struct nx_info *nxi;
23276 + nxi = hlist_entry(pos, struct nx_info, nx_hlist);
23277 + nids[nr_nids] = nxi->nx_id;
23278 + if (++nr_nids >= size) {
23279 + spin_unlock(&nx_info_hash_lock);
23283 + /* keep the lock time short */
23284 + spin_unlock(&nx_info_hash_lock);
23293 + * migrate task to new network
23294 + * gets nxi, puts old_nxi on change
23297 +int nx_migrate_task(struct task_struct *p, struct nx_info *nxi)
23299 + struct nx_info *old_nxi;
23305 + vxdprintk(VXD_CBIT(nid, 5),
23306 + "nx_migrate_task(%p,%p[#%d.%d.%d])",
23307 + p, nxi, nxi->nx_id,
23308 + atomic_read(&nxi->nx_usecnt),
23309 + atomic_read(&nxi->nx_tasks));
23311 + if (nx_info_flags(nxi, NXF_INFO_PRIVATE, 0) &&
23312 + !nx_info_flags(nxi, NXF_STATE_SETUP, 0))
23315 + if (nx_info_state(nxi, NXS_SHUTDOWN))
23318 + /* maybe disallow this completely? */
23319 + old_nxi = task_get_nx_info(p);
23320 + if (old_nxi == nxi)
23325 + clr_nx_info(&p->nx_info);
23326 + claim_nx_info(nxi, p);
23327 + set_nx_info(&p->nx_info, nxi);
23328 + p->nid = nxi->nx_id;
23331 + vxdprintk(VXD_CBIT(nid, 5),
23332 + "moved task %p into nxi:%p[#%d]",
23333 + p, nxi, nxi->nx_id);
23336 + release_nx_info(old_nxi, p);
23339 + put_nx_info(old_nxi);
23344 +void nx_set_persistent(struct nx_info *nxi)
23346 + vxdprintk(VXD_CBIT(nid, 6),
23347 + "nx_set_persistent(%p[#%d])", nxi, nxi->nx_id);
23349 + get_nx_info(nxi);
23350 + claim_nx_info(nxi, NULL);
23353 +void nx_clear_persistent(struct nx_info *nxi)
23355 + vxdprintk(VXD_CBIT(nid, 6),
23356 + "nx_clear_persistent(%p[#%d])", nxi, nxi->nx_id);
23358 + release_nx_info(nxi, NULL);
23359 + put_nx_info(nxi);
23362 +void nx_update_persistent(struct nx_info *nxi)
23364 + if (nx_info_flags(nxi, NXF_PERSISTENT, 0))
23365 + nx_set_persistent(nxi);
23367 + nx_clear_persistent(nxi);
23370 +/* vserver syscall commands below here */
23372 +/* taks nid and nx_info functions */
23374 +#include <asm/uaccess.h>
23377 +int vc_task_nid(uint32_t id)
23382 + struct task_struct *tsk;
23384 + read_lock(&tasklist_lock);
23385 + tsk = find_task_by_real_pid(id);
23386 + nid = (tsk) ? tsk->nid : -ESRCH;
23387 + read_unlock(&tasklist_lock);
23389 + nid = nx_current_nid();
23394 +int vc_nx_info(struct nx_info *nxi, void __user *data)
23396 + struct vcmd_nx_info_v0 vc_data;
23398 + vc_data.nid = nxi->nx_id;
23400 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23406 +/* network functions */
23408 +int vc_net_create(uint32_t nid, void __user *data)
23410 + struct vcmd_net_create vc_data = { .flagword = NXF_INIT_SET };
23411 + struct nx_info *new_nxi;
23414 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23417 + if ((nid > MAX_S_CONTEXT) || (nid < 2))
23420 + new_nxi = __create_nx_info(nid);
23421 + if (IS_ERR(new_nxi))
23422 + return PTR_ERR(new_nxi);
23424 + /* initial flags */
23425 + new_nxi->nx_flags = vc_data.flagword;
23428 + if (vs_net_change(new_nxi, VSC_NETUP))
23431 + ret = nx_migrate_task(current, new_nxi);
23435 + /* return context id on success */
23436 + ret = new_nxi->nx_id;
23438 + /* get a reference for persistent contexts */
23439 + if ((vc_data.flagword & NXF_PERSISTENT))
23440 + nx_set_persistent(new_nxi);
23442 + release_nx_info(new_nxi, NULL);
23443 + put_nx_info(new_nxi);
23448 +int vc_net_migrate(struct nx_info *nxi, void __user *data)
23450 + return nx_migrate_task(current, nxi);
23455 +int do_add_v4_addr(struct nx_info *nxi, __be32 ip, __be32 ip2, __be32 mask,
23456 + uint16_t type, uint16_t flags)
23458 + struct nx_addr_v4 *nxa = &nxi->v4;
23460 + if (NX_IPV4(nxi)) {
23461 + /* locate last entry */
23462 + for (; nxa->next; nxa = nxa->next);
23463 + nxa->next = __alloc_nx_addr_v4();
23467 + return PTR_ERR(nxa);
23470 + if (nxi->v4.next)
23471 + /* remove single ip for ip list */
23472 + nxi->nx_flags &= ~NXF_SINGLE_IP;
23474 + nxa->ip[0].s_addr = ip;
23475 + nxa->ip[1].s_addr = ip2;
23476 + nxa->mask.s_addr = mask;
23477 + nxa->type = type;
23478 + nxa->flags = flags;
23483 +int vc_net_add(struct nx_info *nxi, void __user *data)
23485 + struct vcmd_net_addr_v0 vc_data;
23486 + int index, ret = 0;
23488 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23491 + switch (vc_data.type) {
23492 + case NXA_TYPE_IPV4:
23493 + if ((vc_data.count < 1) || (vc_data.count > 4))
23497 + while (index < vc_data.count) {
23498 + ret = do_add_v4_addr(nxi, vc_data.ip[index].s_addr, 0,
23499 + vc_data.mask[index].s_addr, NXA_TYPE_ADDR, 0);
23507 + case NXA_TYPE_IPV4|NXA_MOD_BCAST:
23508 + nxi->v4_bcast = vc_data.ip[0];
23512 + case NXA_TYPE_IPV4|NXA_MOD_LBACK:
23513 + nxi->v4_lback = vc_data.ip[0];
23524 +int vc_net_remove(struct nx_info *nxi, void __user *data)
23526 + struct vcmd_net_addr_v0 vc_data;
23528 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23531 + switch (vc_data.type) {
23532 + case NXA_TYPE_ANY:
23533 + __dealloc_nx_addr_v4_all(xchg(&nxi->v4.next, NULL));
23534 + memset(&nxi->v4, 0, sizeof(nxi->v4));
23544 +int vc_net_add_ipv4(struct nx_info *nxi, void __user *data)
23546 + struct vcmd_net_addr_ipv4_v1 vc_data;
23548 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23551 + switch (vc_data.type) {
23552 + case NXA_TYPE_ADDR:
23553 + case NXA_TYPE_RANGE:
23554 + case NXA_TYPE_MASK:
23555 + return do_add_v4_addr(nxi, vc_data.ip.s_addr, 0,
23556 + vc_data.mask.s_addr, vc_data.type, vc_data.flags);
23558 + case NXA_TYPE_ADDR | NXA_MOD_BCAST:
23559 + nxi->v4_bcast = vc_data.ip;
23562 + case NXA_TYPE_ADDR | NXA_MOD_LBACK:
23563 + nxi->v4_lback = vc_data.ip;
23572 +int vc_net_remove_ipv4(struct nx_info *nxi, void __user *data)
23574 + struct vcmd_net_addr_ipv4_v1 vc_data;
23576 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23579 + switch (vc_data.type) {
23580 +/* case NXA_TYPE_ADDR:
23583 + case NXA_TYPE_ANY:
23584 + __dealloc_nx_addr_v4_all(xchg(&nxi->v4.next, NULL));
23585 + memset(&nxi->v4, 0, sizeof(nxi->v4));
23595 +#ifdef CONFIG_IPV6
23597 +int do_add_v6_addr(struct nx_info *nxi,
23598 + struct in6_addr *ip, struct in6_addr *mask,
23599 + uint32_t prefix, uint16_t type, uint16_t flags)
23601 + struct nx_addr_v6 *nxa = &nxi->v6;
23603 + if (NX_IPV6(nxi)) {
23604 + /* locate last entry */
23605 + for (; nxa->next; nxa = nxa->next);
23606 + nxa->next = __alloc_nx_addr_v6();
23610 + return PTR_ERR(nxa);
23614 + nxa->mask = *mask;
23615 + nxa->prefix = prefix;
23616 + nxa->type = type;
23617 + nxa->flags = flags;
23622 +int vc_net_add_ipv6(struct nx_info *nxi, void __user *data)
23624 + struct vcmd_net_addr_ipv6_v1 vc_data;
23626 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23629 + switch (vc_data.type) {
23630 + case NXA_TYPE_ADDR:
23631 + case NXA_TYPE_MASK:
23632 + return do_add_v6_addr(nxi, &vc_data.ip, &vc_data.mask,
23633 + vc_data.prefix, vc_data.type, vc_data.flags);
23640 +int vc_net_remove_ipv6(struct nx_info *nxi, void __user *data)
23642 + struct vcmd_net_addr_ipv6_v1 vc_data;
23644 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
23647 + switch (vc_data.type) {
23648 + case NXA_TYPE_ANY:
23649 + __dealloc_nx_addr_v6_all(xchg(&nxi->v6.next, NULL));
23650 + memset(&nxi->v6, 0, sizeof(nxi->v6));
23659 +#endif /* CONFIG_IPV6 */
23662 +int vc_get_nflags(struct nx_info *nxi, void __user *data)
23664 + struct vcmd_net_flags_v0 vc_data;
23666 + vc_data.flagword = nxi->nx_flags;
23668 + /* special STATE flag handling */
23669 + vc_data.mask = vs_mask_flags(~0ULL, nxi->nx_flags, NXF_ONE_TIME);
23671 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23676 +int vc_set_nflags(struct nx_info *nxi, void __user *data)
23678 + struct vcmd_net_flags_v0 vc_data;
23679 + uint64_t mask, trigger;
23681 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
23684 + /* special STATE flag handling */
23685 + mask = vs_mask_mask(vc_data.mask, nxi->nx_flags, NXF_ONE_TIME);
23686 + trigger = (mask & nxi->nx_flags) ^ (mask & vc_data.flagword);
23688 + nxi->nx_flags = vs_mask_flags(nxi->nx_flags,
23689 + vc_data.flagword, mask);
23690 + if (trigger & NXF_PERSISTENT)
23691 + nx_update_persistent(nxi);
23696 +int vc_get_ncaps(struct nx_info *nxi, void __user *data)
23698 + struct vcmd_net_caps_v0 vc_data;
23700 + vc_data.ncaps = nxi->nx_ncaps;
23701 + vc_data.cmask = ~0ULL;
23703 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
23708 +int vc_set_ncaps(struct nx_info *nxi, void __user *data)
23710 + struct vcmd_net_caps_v0 vc_data;
23712 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
23715 + nxi->nx_ncaps = vs_mask_flags(nxi->nx_ncaps,
23716 + vc_data.ncaps, vc_data.cmask);
23721 +#include <linux/module.h>
23723 +module_init(init_network);
23725 +EXPORT_SYMBOL_GPL(free_nx_info);
23726 +EXPORT_SYMBOL_GPL(unhash_nx_info);
23728 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/proc.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/proc.c
23729 --- linux-2.6.33.1/kernel/vserver/proc.c 1970-01-01 01:00:00.000000000 +0100
23730 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/proc.c 2010-02-25 12:02:16.000000000 +0100
23733 + * linux/kernel/vserver/proc.c
23735 + * Virtual Context Support
23737 + * Copyright (C) 2003-2007 Herbert Pötzl
23739 + * V0.01 basic structure
23740 + * V0.02 adaptation vs1.3.0
23741 + * V0.03 proc permissions
23742 + * V0.04 locking/generic
23743 + * V0.05 next generation procfs
23744 + * V0.06 inode validation
23745 + * V0.07 generic rewrite vid
23746 + * V0.08 remove inode type
23750 +#include <linux/proc_fs.h>
23751 +#include <linux/fs_struct.h>
23752 +#include <linux/mount.h>
23753 +#include <asm/unistd.h>
23755 +#include <linux/vs_context.h>
23756 +#include <linux/vs_network.h>
23757 +#include <linux/vs_cvirt.h>
23759 +#include <linux/in.h>
23760 +#include <linux/inetdevice.h>
23761 +#include <linux/vs_inet.h>
23762 +#include <linux/vs_inet6.h>
23764 +#include <linux/vserver/global.h>
23766 +#include "cvirt_proc.h"
23767 +#include "cacct_proc.h"
23768 +#include "limit_proc.h"
23769 +#include "sched_proc.h"
23770 +#include "vci_config.h"
23773 +static inline char *print_cap_t(char *buffer, kernel_cap_t *c)
23777 + CAP_FOR_EACH_U32(__capi) {
23778 + buffer += sprintf(buffer, "%08x",
23779 + c->cap[(_KERNEL_CAPABILITY_U32S-1) - __capi]);
23785 +static struct proc_dir_entry *proc_virtual;
23787 +static struct proc_dir_entry *proc_virtnet;
23790 +/* first the actual feeds */
23793 +static int proc_vci(char *buffer)
23795 + return sprintf(buffer,
23796 + "VCIVersion:\t%04x:%04x\n"
23797 + "VCISyscall:\t%d\n"
23798 + "VCIKernel:\t%08x\n",
23799 + VCI_VERSION >> 16,
23800 + VCI_VERSION & 0xFFFF,
23802 + vci_kernel_config());
23805 +static int proc_virtual_info(char *buffer)
23807 + return proc_vci(buffer);
23810 +static int proc_virtual_status(char *buffer)
23812 + return sprintf(buffer,
23814 + "#CActive:\t%d\n"
23815 + "#NSProxy:\t%d\t%d %d %d %d %d %d\n"
23816 + "#InitTask:\t%d\t%d %d\n",
23817 + atomic_read(&vx_global_ctotal),
23818 + atomic_read(&vx_global_cactive),
23819 + atomic_read(&vs_global_nsproxy),
23820 + atomic_read(&vs_global_fs),
23821 + atomic_read(&vs_global_mnt_ns),
23822 + atomic_read(&vs_global_uts_ns),
23823 + atomic_read(&nr_ipc_ns),
23824 + atomic_read(&vs_global_user_ns),
23825 + atomic_read(&vs_global_pid_ns),
23826 + atomic_read(&init_task.usage),
23827 + atomic_read(&init_task.nsproxy->count),
23828 + init_task.fs->users);
23832 +int proc_vxi_info(struct vx_info *vxi, char *buffer)
23836 + length = sprintf(buffer,
23844 + vxi->vx_badness_bias);
23848 +int proc_vxi_status(struct vx_info *vxi, char *buffer)
23850 + char *orig = buffer;
23852 + buffer += sprintf(buffer,
23855 + "Flags:\t%016llx\n",
23856 + atomic_read(&vxi->vx_usecnt),
23857 + atomic_read(&vxi->vx_tasks),
23858 + (unsigned long long)vxi->vx_flags);
23860 + buffer += sprintf(buffer, "BCaps:\t");
23861 + buffer = print_cap_t(buffer, &vxi->vx_bcaps);
23862 + buffer += sprintf(buffer, "\n");
23864 + buffer += sprintf(buffer,
23865 + "CCaps:\t%016llx\n"
23866 + "Spaces:\t%08lx %08lx\n",
23867 + (unsigned long long)vxi->vx_ccaps,
23868 + vxi->vx_nsmask[0], vxi->vx_nsmask[1]);
23869 + return buffer - orig;
23872 +int proc_vxi_limit(struct vx_info *vxi, char *buffer)
23874 + return vx_info_proc_limit(&vxi->limit, buffer);
23877 +int proc_vxi_sched(struct vx_info *vxi, char *buffer)
23881 + length = vx_info_proc_sched(&vxi->sched, buffer);
23882 + for_each_online_cpu(cpu) {
23883 + length += vx_info_proc_sched_pc(
23884 + &vx_per_cpu(vxi, sched_pc, cpu),
23885 + buffer + length, cpu);
23890 +int proc_vxi_nsproxy0(struct vx_info *vxi, char *buffer)
23892 + return vx_info_proc_nsproxy(vxi->vx_nsproxy[0], buffer);
23895 +int proc_vxi_nsproxy1(struct vx_info *vxi, char *buffer)
23897 + return vx_info_proc_nsproxy(vxi->vx_nsproxy[1], buffer);
23900 +int proc_vxi_cvirt(struct vx_info *vxi, char *buffer)
23904 + vx_update_load(vxi);
23905 + length = vx_info_proc_cvirt(&vxi->cvirt, buffer);
23906 + for_each_online_cpu(cpu) {
23907 + length += vx_info_proc_cvirt_pc(
23908 + &vx_per_cpu(vxi, cvirt_pc, cpu),
23909 + buffer + length, cpu);
23914 +int proc_vxi_cacct(struct vx_info *vxi, char *buffer)
23916 + return vx_info_proc_cacct(&vxi->cacct, buffer);
23920 +static int proc_virtnet_info(char *buffer)
23922 + return proc_vci(buffer);
23925 +static int proc_virtnet_status(char *buffer)
23927 + return sprintf(buffer,
23929 + "#CActive:\t%d\n",
23930 + atomic_read(&nx_global_ctotal),
23931 + atomic_read(&nx_global_cactive));
23934 +int proc_nxi_info(struct nx_info *nxi, char *buffer)
23936 + struct nx_addr_v4 *v4a;
23937 +#ifdef CONFIG_IPV6
23938 + struct nx_addr_v6 *v6a;
23942 + length = sprintf(buffer,
23945 + "Bcast:\t" NIPQUAD_FMT "\n"
23946 + "Lback:\t" NIPQUAD_FMT "\n",
23949 + NIPQUAD(nxi->v4_bcast.s_addr),
23950 + NIPQUAD(nxi->v4_lback.s_addr));
23952 + if (!NX_IPV4(nxi))
23954 + for (i = 0, v4a = &nxi->v4; v4a; i++, v4a = v4a->next)
23955 + length += sprintf(buffer + length, "%d:\t" NXAV4_FMT "\n",
23958 +#ifdef CONFIG_IPV6
23959 + if (!NX_IPV6(nxi))
23961 + for (i = 0, v6a = &nxi->v6; v6a; i++, v6a = v6a->next)
23962 + length += sprintf(buffer + length, "%d:\t" NXAV6_FMT "\n",
23969 +int proc_nxi_status(struct nx_info *nxi, char *buffer)
23973 + length = sprintf(buffer,
23976 + "Flags:\t%016llx\n"
23977 + "NCaps:\t%016llx\n",
23978 + atomic_read(&nxi->nx_usecnt),
23979 + atomic_read(&nxi->nx_tasks),
23980 + (unsigned long long)nxi->nx_flags,
23981 + (unsigned long long)nxi->nx_ncaps);
23987 +/* here the inode helpers */
23993 + struct inode_operations *iop;
23994 + struct file_operations *fop;
23995 + union proc_op op;
23998 +static struct inode *vs_proc_make_inode(struct super_block *sb, struct vs_entry *p)
24000 + struct inode *inode = new_inode(sb);
24005 + inode->i_mode = p->mode;
24007 + inode->i_op = p->iop;
24009 + inode->i_fop = p->fop;
24011 + inode->i_nlink = (p->mode & S_IFDIR) ? 2 : 1;
24012 + inode->i_flags |= S_IMMUTABLE;
24014 + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
24016 + inode->i_uid = 0;
24017 + inode->i_gid = 0;
24018 + inode->i_tag = 0;
24023 +static struct dentry *vs_proc_instantiate(struct inode *dir,
24024 + struct dentry *dentry, int id, void *ptr)
24026 + struct vs_entry *p = ptr;
24027 + struct inode *inode = vs_proc_make_inode(dir->i_sb, p);
24028 + struct dentry *error = ERR_PTR(-EINVAL);
24033 + PROC_I(inode)->op = p->op;
24034 + PROC_I(inode)->fd = id;
24035 + d_add(dentry, inode);
24043 +typedef struct dentry *instantiate_t(struct inode *, struct dentry *, int, void *);
24046 + * Fill a directory entry.
24048 + * If possible create the dcache entry and derive our inode number and
24049 + * file type from dcache entry.
24051 + * Since all of the proc inode numbers are dynamically generated, the inode
24052 + * numbers do not exist until the inode is cache. This means creating the
24053 + * the dcache entry in readdir is necessary to keep the inode numbers
24054 + * reported by readdir in sync with the inode numbers reported
24057 +static int proc_fill_cache(struct file *filp, void *dirent, filldir_t filldir,
24058 + char *name, int len, instantiate_t instantiate, int id, void *ptr)
24060 + struct dentry *child, *dir = filp->f_dentry;
24061 + struct inode *inode;
24062 + struct qstr qname;
24064 + unsigned type = DT_UNKNOWN;
24066 + qname.name = name;
24068 + qname.hash = full_name_hash(name, len);
24070 + child = d_lookup(dir, &qname);
24072 + struct dentry *new;
24073 + new = d_alloc(dir, &qname);
24075 + child = instantiate(dir->d_inode, new, id, ptr);
24082 + if (!child || IS_ERR(child) || !child->d_inode)
24083 + goto end_instantiate;
24084 + inode = child->d_inode;
24086 + ino = inode->i_ino;
24087 + type = inode->i_mode >> 12;
24092 + ino = find_inode_number(dir, &qname);
24095 + return filldir(dirent, name, len, filp->f_pos, ino, type);
24100 +/* get and revalidate vx_info/xid */
24103 +struct vx_info *get_proc_vx_info(struct inode *inode)
24105 + return lookup_vx_info(PROC_I(inode)->fd);
24108 +static int proc_xid_revalidate(struct dentry *dentry, struct nameidata *nd)
24110 + struct inode *inode = dentry->d_inode;
24111 + xid_t xid = PROC_I(inode)->fd;
24113 + if (!xid || xid_is_hashed(xid))
24120 +/* get and revalidate nx_info/nid */
24122 +static int proc_nid_revalidate(struct dentry *dentry, struct nameidata *nd)
24124 + struct inode *inode = dentry->d_inode;
24125 + nid_t nid = PROC_I(inode)->fd;
24127 + if (!nid || nid_is_hashed(nid))
24135 +#define PROC_BLOCK_SIZE (PAGE_SIZE - 1024)
24137 +static ssize_t proc_vs_info_read(struct file *file, char __user *buf,
24138 + size_t count, loff_t *ppos)
24140 + struct inode *inode = file->f_dentry->d_inode;
24141 + unsigned long page;
24142 + ssize_t length = 0;
24144 + if (count > PROC_BLOCK_SIZE)
24145 + count = PROC_BLOCK_SIZE;
24147 + /* fade that out as soon as stable */
24148 + WARN_ON(PROC_I(inode)->fd);
24150 + if (!(page = __get_free_page(GFP_KERNEL)))
24153 + BUG_ON(!PROC_I(inode)->op.proc_vs_read);
24154 + length = PROC_I(inode)->op.proc_vs_read((char *)page);
24157 + length = simple_read_from_buffer(buf, count, ppos,
24158 + (char *)page, length);
24164 +static ssize_t proc_vx_info_read(struct file *file, char __user *buf,
24165 + size_t count, loff_t *ppos)
24167 + struct inode *inode = file->f_dentry->d_inode;
24168 + struct vx_info *vxi = NULL;
24169 + xid_t xid = PROC_I(inode)->fd;
24170 + unsigned long page;
24171 + ssize_t length = 0;
24173 + if (count > PROC_BLOCK_SIZE)
24174 + count = PROC_BLOCK_SIZE;
24176 + /* fade that out as soon as stable */
24178 + vxi = lookup_vx_info(xid);
24182 + length = -ENOMEM;
24183 + if (!(page = __get_free_page(GFP_KERNEL)))
24186 + BUG_ON(!PROC_I(inode)->op.proc_vxi_read);
24187 + length = PROC_I(inode)->op.proc_vxi_read(vxi, (char *)page);
24190 + length = simple_read_from_buffer(buf, count, ppos,
24191 + (char *)page, length);
24195 + put_vx_info(vxi);
24200 +static ssize_t proc_nx_info_read(struct file *file, char __user *buf,
24201 + size_t count, loff_t *ppos)
24203 + struct inode *inode = file->f_dentry->d_inode;
24204 + struct nx_info *nxi = NULL;
24205 + nid_t nid = PROC_I(inode)->fd;
24206 + unsigned long page;
24207 + ssize_t length = 0;
24209 + if (count > PROC_BLOCK_SIZE)
24210 + count = PROC_BLOCK_SIZE;
24212 + /* fade that out as soon as stable */
24214 + nxi = lookup_nx_info(nid);
24218 + length = -ENOMEM;
24219 + if (!(page = __get_free_page(GFP_KERNEL)))
24222 + BUG_ON(!PROC_I(inode)->op.proc_nxi_read);
24223 + length = PROC_I(inode)->op.proc_nxi_read(nxi, (char *)page);
24226 + length = simple_read_from_buffer(buf, count, ppos,
24227 + (char *)page, length);
24231 + put_nx_info(nxi);
24238 +/* here comes the lower level */
24241 +#define NOD(NAME, MODE, IOP, FOP, OP) { \
24242 + .len = sizeof(NAME) - 1, \
24243 + .name = (NAME), \
24251 +#define DIR(NAME, MODE, OTYPE) \
24252 + NOD(NAME, (S_IFDIR | (MODE)), \
24253 + &proc_ ## OTYPE ## _inode_operations, \
24254 + &proc_ ## OTYPE ## _file_operations, { } )
24256 +#define INF(NAME, MODE, OTYPE) \
24257 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
24258 + &proc_vs_info_file_operations, \
24259 + { .proc_vs_read = &proc_##OTYPE } )
24261 +#define VINF(NAME, MODE, OTYPE) \
24262 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
24263 + &proc_vx_info_file_operations, \
24264 + { .proc_vxi_read = &proc_##OTYPE } )
24266 +#define NINF(NAME, MODE, OTYPE) \
24267 + NOD(NAME, (S_IFREG | (MODE)), NULL, \
24268 + &proc_nx_info_file_operations, \
24269 + { .proc_nxi_read = &proc_##OTYPE } )
24272 +static struct file_operations proc_vs_info_file_operations = {
24273 + .read = proc_vs_info_read,
24276 +static struct file_operations proc_vx_info_file_operations = {
24277 + .read = proc_vx_info_read,
24280 +static struct dentry_operations proc_xid_dentry_operations = {
24281 + .d_revalidate = proc_xid_revalidate,
24284 +static struct vs_entry vx_base_stuff[] = {
24285 + VINF("info", S_IRUGO, vxi_info),
24286 + VINF("status", S_IRUGO, vxi_status),
24287 + VINF("limit", S_IRUGO, vxi_limit),
24288 + VINF("sched", S_IRUGO, vxi_sched),
24289 + VINF("nsproxy", S_IRUGO, vxi_nsproxy0),
24290 + VINF("nsproxy1",S_IRUGO, vxi_nsproxy1),
24291 + VINF("cvirt", S_IRUGO, vxi_cvirt),
24292 + VINF("cacct", S_IRUGO, vxi_cacct),
24299 +static struct dentry *proc_xid_instantiate(struct inode *dir,
24300 + struct dentry *dentry, int id, void *ptr)
24302 + dentry->d_op = &proc_xid_dentry_operations;
24303 + return vs_proc_instantiate(dir, dentry, id, ptr);
24306 +static struct dentry *proc_xid_lookup(struct inode *dir,
24307 + struct dentry *dentry, struct nameidata *nd)
24309 + struct vs_entry *p = vx_base_stuff;
24310 + struct dentry *error = ERR_PTR(-ENOENT);
24312 + for (; p->name; p++) {
24313 + if (p->len != dentry->d_name.len)
24315 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24321 + error = proc_xid_instantiate(dir, dentry, PROC_I(dir)->fd, p);
24326 +static int proc_xid_readdir(struct file *filp,
24327 + void *dirent, filldir_t filldir)
24329 + struct dentry *dentry = filp->f_dentry;
24330 + struct inode *inode = dentry->d_inode;
24331 + struct vs_entry *p = vx_base_stuff;
24332 + int size = sizeof(vx_base_stuff) / sizeof(struct vs_entry);
24336 + pos = filp->f_pos;
24339 + ino = inode->i_ino;
24340 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24343 + /* fall through */
24345 + ino = parent_ino(dentry);
24346 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24349 + /* fall through */
24352 + if (index >= size)
24354 + for (p += index; p->name; p++) {
24355 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24356 + vs_proc_instantiate, PROC_I(inode)->fd, p))
24362 + filp->f_pos = pos;
24368 +static struct file_operations proc_nx_info_file_operations = {
24369 + .read = proc_nx_info_read,
24372 +static struct dentry_operations proc_nid_dentry_operations = {
24373 + .d_revalidate = proc_nid_revalidate,
24376 +static struct vs_entry nx_base_stuff[] = {
24377 + NINF("info", S_IRUGO, nxi_info),
24378 + NINF("status", S_IRUGO, nxi_status),
24383 +static struct dentry *proc_nid_instantiate(struct inode *dir,
24384 + struct dentry *dentry, int id, void *ptr)
24386 + dentry->d_op = &proc_nid_dentry_operations;
24387 + return vs_proc_instantiate(dir, dentry, id, ptr);
24390 +static struct dentry *proc_nid_lookup(struct inode *dir,
24391 + struct dentry *dentry, struct nameidata *nd)
24393 + struct vs_entry *p = nx_base_stuff;
24394 + struct dentry *error = ERR_PTR(-ENOENT);
24396 + for (; p->name; p++) {
24397 + if (p->len != dentry->d_name.len)
24399 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24405 + error = proc_nid_instantiate(dir, dentry, PROC_I(dir)->fd, p);
24410 +static int proc_nid_readdir(struct file *filp,
24411 + void *dirent, filldir_t filldir)
24413 + struct dentry *dentry = filp->f_dentry;
24414 + struct inode *inode = dentry->d_inode;
24415 + struct vs_entry *p = nx_base_stuff;
24416 + int size = sizeof(nx_base_stuff) / sizeof(struct vs_entry);
24420 + pos = filp->f_pos;
24423 + ino = inode->i_ino;
24424 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24427 + /* fall through */
24429 + ino = parent_ino(dentry);
24430 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24433 + /* fall through */
24436 + if (index >= size)
24438 + for (p += index; p->name; p++) {
24439 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24440 + vs_proc_instantiate, PROC_I(inode)->fd, p))
24446 + filp->f_pos = pos;
24451 +#define MAX_MULBY10 ((~0U - 9) / 10)
24453 +static inline int atovid(const char *str, int len)
24458 + while (len-- > 0) {
24463 + if (vid >= MAX_MULBY10)
24473 +/* now the upper level (virtual) */
24476 +static struct file_operations proc_xid_file_operations = {
24477 + .read = generic_read_dir,
24478 + .readdir = proc_xid_readdir,
24481 +static struct inode_operations proc_xid_inode_operations = {
24482 + .lookup = proc_xid_lookup,
24485 +static struct vs_entry vx_virtual_stuff[] = {
24486 + INF("info", S_IRUGO, virtual_info),
24487 + INF("status", S_IRUGO, virtual_status),
24488 + DIR(NULL, S_IRUGO | S_IXUGO, xid),
24492 +static struct dentry *proc_virtual_lookup(struct inode *dir,
24493 + struct dentry *dentry, struct nameidata *nd)
24495 + struct vs_entry *p = vx_virtual_stuff;
24496 + struct dentry *error = ERR_PTR(-ENOENT);
24499 + for (; p->name; p++) {
24500 + if (p->len != dentry->d_name.len)
24502 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24506 + goto instantiate;
24508 + id = atovid(dentry->d_name.name, dentry->d_name.len);
24509 + if ((id < 0) || !xid_is_hashed(id))
24513 + error = proc_xid_instantiate(dir, dentry, id, p);
24518 +static struct file_operations proc_nid_file_operations = {
24519 + .read = generic_read_dir,
24520 + .readdir = proc_nid_readdir,
24523 +static struct inode_operations proc_nid_inode_operations = {
24524 + .lookup = proc_nid_lookup,
24527 +static struct vs_entry nx_virtnet_stuff[] = {
24528 + INF("info", S_IRUGO, virtnet_info),
24529 + INF("status", S_IRUGO, virtnet_status),
24530 + DIR(NULL, S_IRUGO | S_IXUGO, nid),
24534 +static struct dentry *proc_virtnet_lookup(struct inode *dir,
24535 + struct dentry *dentry, struct nameidata *nd)
24537 + struct vs_entry *p = nx_virtnet_stuff;
24538 + struct dentry *error = ERR_PTR(-ENOENT);
24541 + for (; p->name; p++) {
24542 + if (p->len != dentry->d_name.len)
24544 + if (!memcmp(dentry->d_name.name, p->name, p->len))
24548 + goto instantiate;
24550 + id = atovid(dentry->d_name.name, dentry->d_name.len);
24551 + if ((id < 0) || !nid_is_hashed(id))
24555 + error = proc_nid_instantiate(dir, dentry, id, p);
24561 +#define PROC_MAXVIDS 32
24563 +int proc_virtual_readdir(struct file *filp,
24564 + void *dirent, filldir_t filldir)
24566 + struct dentry *dentry = filp->f_dentry;
24567 + struct inode *inode = dentry->d_inode;
24568 + struct vs_entry *p = vx_virtual_stuff;
24569 + int size = sizeof(vx_virtual_stuff) / sizeof(struct vs_entry);
24571 + unsigned int xid_array[PROC_MAXVIDS];
24572 + char buf[PROC_NUMBUF];
24573 + unsigned int nr_xids, i;
24576 + pos = filp->f_pos;
24579 + ino = inode->i_ino;
24580 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24583 + /* fall through */
24585 + ino = parent_ino(dentry);
24586 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24589 + /* fall through */
24592 + if (index >= size)
24594 + for (p += index; p->name; p++) {
24595 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24596 + vs_proc_instantiate, 0, p))
24601 + index = pos - size;
24602 + p = &vx_virtual_stuff[size - 1];
24603 + nr_xids = get_xid_list(index, xid_array, PROC_MAXVIDS);
24604 + for (i = 0; i < nr_xids; i++) {
24605 + int n, xid = xid_array[i];
24606 + unsigned int j = PROC_NUMBUF;
24610 + buf[--j] = '0' + (n % 10);
24613 + if (proc_fill_cache(filp, dirent, filldir,
24614 + buf + j, PROC_NUMBUF - j,
24615 + vs_proc_instantiate, xid, p))
24621 + filp->f_pos = pos;
24625 +static int proc_virtual_getattr(struct vfsmount *mnt,
24626 + struct dentry *dentry, struct kstat *stat)
24628 + struct inode *inode = dentry->d_inode;
24630 + generic_fillattr(inode, stat);
24631 + stat->nlink = 2 + atomic_read(&vx_global_cactive);
24635 +static struct file_operations proc_virtual_dir_operations = {
24636 + .read = generic_read_dir,
24637 + .readdir = proc_virtual_readdir,
24640 +static struct inode_operations proc_virtual_dir_inode_operations = {
24641 + .getattr = proc_virtual_getattr,
24642 + .lookup = proc_virtual_lookup,
24649 +int proc_virtnet_readdir(struct file *filp,
24650 + void *dirent, filldir_t filldir)
24652 + struct dentry *dentry = filp->f_dentry;
24653 + struct inode *inode = dentry->d_inode;
24654 + struct vs_entry *p = nx_virtnet_stuff;
24655 + int size = sizeof(nx_virtnet_stuff) / sizeof(struct vs_entry);
24657 + unsigned int nid_array[PROC_MAXVIDS];
24658 + char buf[PROC_NUMBUF];
24659 + unsigned int nr_nids, i;
24662 + pos = filp->f_pos;
24665 + ino = inode->i_ino;
24666 + if (filldir(dirent, ".", 1, pos, ino, DT_DIR) < 0)
24669 + /* fall through */
24671 + ino = parent_ino(dentry);
24672 + if (filldir(dirent, "..", 2, pos, ino, DT_DIR) < 0)
24675 + /* fall through */
24678 + if (index >= size)
24680 + for (p += index; p->name; p++) {
24681 + if (proc_fill_cache(filp, dirent, filldir, p->name, p->len,
24682 + vs_proc_instantiate, 0, p))
24687 + index = pos - size;
24688 + p = &nx_virtnet_stuff[size - 1];
24689 + nr_nids = get_nid_list(index, nid_array, PROC_MAXVIDS);
24690 + for (i = 0; i < nr_nids; i++) {
24691 + int n, nid = nid_array[i];
24692 + unsigned int j = PROC_NUMBUF;
24696 + buf[--j] = '0' + (n % 10);
24699 + if (proc_fill_cache(filp, dirent, filldir,
24700 + buf + j, PROC_NUMBUF - j,
24701 + vs_proc_instantiate, nid, p))
24707 + filp->f_pos = pos;
24711 +static int proc_virtnet_getattr(struct vfsmount *mnt,
24712 + struct dentry *dentry, struct kstat *stat)
24714 + struct inode *inode = dentry->d_inode;
24716 + generic_fillattr(inode, stat);
24717 + stat->nlink = 2 + atomic_read(&nx_global_cactive);
24721 +static struct file_operations proc_virtnet_dir_operations = {
24722 + .read = generic_read_dir,
24723 + .readdir = proc_virtnet_readdir,
24726 +static struct inode_operations proc_virtnet_dir_inode_operations = {
24727 + .getattr = proc_virtnet_getattr,
24728 + .lookup = proc_virtnet_lookup,
24733 +void proc_vx_init(void)
24735 + struct proc_dir_entry *ent;
24737 + ent = proc_mkdir("virtual", 0);
24739 + ent->proc_fops = &proc_virtual_dir_operations;
24740 + ent->proc_iops = &proc_virtual_dir_inode_operations;
24742 + proc_virtual = ent;
24744 + ent = proc_mkdir("virtnet", 0);
24746 + ent->proc_fops = &proc_virtnet_dir_operations;
24747 + ent->proc_iops = &proc_virtnet_dir_inode_operations;
24749 + proc_virtnet = ent;
24755 +/* per pid info */
24758 +int proc_pid_vx_info(struct task_struct *p, char *buffer)
24760 + struct vx_info *vxi;
24761 + char *orig = buffer;
24763 + buffer += sprintf(buffer, "XID:\t%d\n", vx_task_xid(p));
24765 + vxi = task_get_vx_info(p);
24769 + buffer += sprintf(buffer, "BCaps:\t");
24770 + buffer = print_cap_t(buffer, &vxi->vx_bcaps);
24771 + buffer += sprintf(buffer, "\n");
24772 + buffer += sprintf(buffer, "CCaps:\t%016llx\n",
24773 + (unsigned long long)vxi->vx_ccaps);
24774 + buffer += sprintf(buffer, "CFlags:\t%016llx\n",
24775 + (unsigned long long)vxi->vx_flags);
24776 + buffer += sprintf(buffer, "CIPid:\t%d\n", vxi->vx_initpid);
24778 + put_vx_info(vxi);
24780 + return buffer - orig;
24784 +int proc_pid_nx_info(struct task_struct *p, char *buffer)
24786 + struct nx_info *nxi;
24787 + struct nx_addr_v4 *v4a;
24788 +#ifdef CONFIG_IPV6
24789 + struct nx_addr_v6 *v6a;
24791 + char *orig = buffer;
24794 + buffer += sprintf(buffer, "NID:\t%d\n", nx_task_nid(p));
24796 + nxi = task_get_nx_info(p);
24800 + buffer += sprintf(buffer, "NCaps:\t%016llx\n",
24801 + (unsigned long long)nxi->nx_ncaps);
24802 + buffer += sprintf(buffer, "NFlags:\t%016llx\n",
24803 + (unsigned long long)nxi->nx_flags);
24805 + buffer += sprintf(buffer,
24806 + "V4Root[bcast]:\t" NIPQUAD_FMT "\n",
24807 + NIPQUAD(nxi->v4_bcast.s_addr));
24808 + buffer += sprintf (buffer,
24809 + "V4Root[lback]:\t" NIPQUAD_FMT "\n",
24810 + NIPQUAD(nxi->v4_lback.s_addr));
24811 + if (!NX_IPV4(nxi))
24813 + for (i = 0, v4a = &nxi->v4; v4a; i++, v4a = v4a->next)
24814 + buffer += sprintf(buffer, "V4Root[%d]:\t" NXAV4_FMT "\n",
24817 +#ifdef CONFIG_IPV6
24818 + if (!NX_IPV6(nxi))
24820 + for (i = 0, v6a = &nxi->v6; v6a; i++, v6a = v6a->next)
24821 + buffer += sprintf(buffer, "V6Root[%d]:\t" NXAV6_FMT "\n",
24825 + put_nx_info(nxi);
24827 + return buffer - orig;
24830 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/sched.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/sched.c
24831 --- linux-2.6.33.1/kernel/vserver/sched.c 1970-01-01 01:00:00.000000000 +0100
24832 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/sched.c 2010-02-25 12:02:16.000000000 +0100
24835 + * linux/kernel/vserver/sched.c
24837 + * Virtual Server: Scheduler Support
24839 + * Copyright (C) 2004-2007 Herbert Pötzl
24841 + * V0.01 adapted Sam Vilains version to 2.6.3
24842 + * V0.02 removed legacy interface
24843 + * V0.03 changed vcmds to vxi arg
24844 + * V0.04 removed older and legacy interfaces
24848 +#include <linux/vs_context.h>
24849 +#include <linux/vs_sched.h>
24850 +#include <linux/vserver/sched_cmd.h>
24852 +#include <asm/uaccess.h>
24855 +#define vxd_check_range(val, min, max) do { \
24856 + vxlprintk((val < min) || (val > max), \
24857 + "check_range(%ld,%ld,%ld)", \
24858 + (long)val, (long)min, (long)max, \
24859 + __FILE__, __LINE__); \
24863 +void vx_update_sched_param(struct _vx_sched *sched,
24864 + struct _vx_sched_pc *sched_pc)
24866 + unsigned int set_mask = sched->update_mask;
24868 + if (set_mask & VXSM_FILL_RATE)
24869 + sched_pc->fill_rate[0] = sched->fill_rate[0];
24870 + if (set_mask & VXSM_INTERVAL)
24871 + sched_pc->interval[0] = sched->interval[0];
24872 + if (set_mask & VXSM_FILL_RATE2)
24873 + sched_pc->fill_rate[1] = sched->fill_rate[1];
24874 + if (set_mask & VXSM_INTERVAL2)
24875 + sched_pc->interval[1] = sched->interval[1];
24876 + if (set_mask & VXSM_TOKENS)
24877 + sched_pc->tokens = sched->tokens;
24878 + if (set_mask & VXSM_TOKENS_MIN)
24879 + sched_pc->tokens_min = sched->tokens_min;
24880 + if (set_mask & VXSM_TOKENS_MAX)
24881 + sched_pc->tokens_max = sched->tokens_max;
24882 + if (set_mask & VXSM_PRIO_BIAS)
24883 + sched_pc->prio_bias = sched->prio_bias;
24885 + if (set_mask & VXSM_IDLE_TIME)
24886 + sched_pc->flags |= VXSF_IDLE_TIME;
24888 + sched_pc->flags &= ~VXSF_IDLE_TIME;
24891 + sched_pc->norm_time = jiffies;
24896 + * recalculate the context's scheduling tokens
24898 + * ret > 0 : number of tokens available
24899 + * ret < 0 : on hold, check delta_min[]
24900 + * -1 only jiffies
24901 + * -2 also idle time
24904 +int vx_tokens_recalc(struct _vx_sched_pc *sched_pc,
24905 + unsigned long *norm_time, unsigned long *idle_time, int delta_min[2])
24909 + int flags = sched_pc->flags;
24911 + /* how much time did pass? */
24912 + delta = *norm_time - sched_pc->norm_time;
24913 + // printk("@ %ld, %ld, %ld\n", *norm_time, sched_pc->norm_time, jiffies);
24914 + vxd_check_range(delta, 0, INT_MAX);
24916 + if (delta >= sched_pc->interval[0]) {
24917 + long tokens, integral;
24919 + /* calc integral token part */
24920 + tokens = delta / sched_pc->interval[0];
24921 + integral = tokens * sched_pc->interval[0];
24922 + tokens *= sched_pc->fill_rate[0];
24923 +#ifdef CONFIG_VSERVER_HARDCPU
24924 + delta_min[0] = delta - integral;
24925 + vxd_check_range(delta_min[0], 0, sched_pc->interval[0]);
24927 + /* advance time */
24928 + sched_pc->norm_time += delta;
24931 + sched_pc->tokens += tokens;
24932 + sched_pc->token_time += tokens;
24934 + delta_min[0] = delta;
24936 +#ifdef CONFIG_VSERVER_IDLETIME
24937 + if (!(flags & VXSF_IDLE_TIME))
24940 + /* how much was the idle skip? */
24941 + delta = *idle_time - sched_pc->idle_time;
24942 + vxd_check_range(delta, 0, INT_MAX);
24944 + if (delta >= sched_pc->interval[1]) {
24945 + long tokens, integral;
24947 + /* calc fair share token part */
24948 + tokens = delta / sched_pc->interval[1];
24949 + integral = tokens * sched_pc->interval[1];
24950 + tokens *= sched_pc->fill_rate[1];
24951 + delta_min[1] = delta - integral;
24952 + vxd_check_range(delta_min[1], 0, sched_pc->interval[1]);
24954 + /* advance idle time */
24955 + sched_pc->idle_time += integral;
24958 + sched_pc->tokens += tokens;
24959 + sched_pc->token_time += tokens;
24961 + delta_min[1] = delta;
24965 + /* clip at maximum */
24966 + if (sched_pc->tokens > sched_pc->tokens_max)
24967 + sched_pc->tokens = sched_pc->tokens_max;
24968 + tokens = sched_pc->tokens;
24970 + if ((flags & VXSF_ONHOLD)) {
24971 + /* can we unhold? */
24972 + if (tokens >= sched_pc->tokens_min) {
24973 + flags &= ~VXSF_ONHOLD;
24974 + sched_pc->hold_ticks +=
24975 + *norm_time - sched_pc->onhold;
24979 + /* put on hold? */
24980 + if (tokens <= 0) {
24981 + flags |= VXSF_ONHOLD;
24982 + sched_pc->onhold = *norm_time;
24986 + sched_pc->flags = flags;
24990 + tokens = sched_pc->tokens_min - tokens;
24991 + sched_pc->flags = flags;
24992 + // BUG_ON(tokens < 0); probably doesn't hold anymore
24994 +#ifdef CONFIG_VSERVER_HARDCPU
24995 + /* next interval? */
24996 + if (!sched_pc->fill_rate[0])
24997 + delta_min[0] = HZ;
24998 + else if (tokens > sched_pc->fill_rate[0])
24999 + delta_min[0] += sched_pc->interval[0] *
25000 + tokens / sched_pc->fill_rate[0];
25002 + delta_min[0] = sched_pc->interval[0] - delta_min[0];
25003 + vxd_check_range(delta_min[0], 0, INT_MAX);
25005 +#ifdef CONFIG_VSERVER_IDLETIME
25006 + if (!(flags & VXSF_IDLE_TIME))
25009 + /* next interval? */
25010 + if (!sched_pc->fill_rate[1])
25011 + delta_min[1] = HZ;
25012 + else if (tokens > sched_pc->fill_rate[1])
25013 + delta_min[1] += sched_pc->interval[1] *
25014 + tokens / sched_pc->fill_rate[1];
25016 + delta_min[1] = sched_pc->interval[1] - delta_min[1];
25017 + vxd_check_range(delta_min[1], 0, INT_MAX);
25022 +#endif /* CONFIG_VSERVER_IDLETIME */
25025 +#endif /* CONFIG_VSERVER_HARDCPU */
25028 +static inline unsigned long msec_to_ticks(unsigned long msec)
25030 + return msecs_to_jiffies(msec);
25033 +static inline unsigned long ticks_to_msec(unsigned long ticks)
25035 + return jiffies_to_msecs(ticks);
25038 +static inline unsigned long ticks_to_usec(unsigned long ticks)
25040 + return jiffies_to_usecs(ticks);
25044 +static int do_set_sched(struct vx_info *vxi, struct vcmd_sched_v5 *data)
25046 + unsigned int set_mask = data->mask;
25047 + unsigned int update_mask;
25050 + /* Sanity check data values */
25051 + if (data->tokens_max <= 0)
25052 + data->tokens_max = HZ;
25053 + if (data->tokens_min < 0)
25054 + data->tokens_min = HZ / 3;
25055 + if (data->tokens_min >= data->tokens_max)
25056 + data->tokens_min = data->tokens_max;
25058 + if (data->prio_bias > MAX_PRIO_BIAS)
25059 + data->prio_bias = MAX_PRIO_BIAS;
25060 + if (data->prio_bias < MIN_PRIO_BIAS)
25061 + data->prio_bias = MIN_PRIO_BIAS;
25063 + spin_lock(&vxi->sched.tokens_lock);
25065 + /* sync up on delayed updates */
25066 + for_each_cpu_mask(cpu, vxi->sched.update)
25067 + vx_update_sched_param(&vxi->sched,
25068 + &vx_per_cpu(vxi, sched_pc, cpu));
25070 + if (set_mask & VXSM_FILL_RATE)
25071 + vxi->sched.fill_rate[0] = data->fill_rate[0];
25072 + if (set_mask & VXSM_FILL_RATE2)
25073 + vxi->sched.fill_rate[1] = data->fill_rate[1];
25074 + if (set_mask & VXSM_INTERVAL)
25075 + vxi->sched.interval[0] = (set_mask & VXSM_MSEC) ?
25076 + msec_to_ticks(data->interval[0]) : data->interval[0];
25077 + if (set_mask & VXSM_INTERVAL2)
25078 + vxi->sched.interval[1] = (set_mask & VXSM_MSEC) ?
25079 + msec_to_ticks(data->interval[1]) : data->interval[1];
25080 + if (set_mask & VXSM_TOKENS)
25081 + vxi->sched.tokens = data->tokens;
25082 + if (set_mask & VXSM_TOKENS_MIN)
25083 + vxi->sched.tokens_min = data->tokens_min;
25084 + if (set_mask & VXSM_TOKENS_MAX)
25085 + vxi->sched.tokens_max = data->tokens_max;
25086 + if (set_mask & VXSM_PRIO_BIAS)
25087 + vxi->sched.prio_bias = data->prio_bias;
25089 + /* Sanity check rate/interval */
25090 + for (i = 0; i < 2; i++) {
25091 + if (data->fill_rate[i] < 0)
25092 + data->fill_rate[i] = 0;
25093 + if (data->interval[i] <= 0)
25094 + data->interval[i] = HZ;
25097 + update_mask = vxi->sched.update_mask & VXSM_SET_MASK;
25098 + update_mask |= (set_mask & (VXSM_SET_MASK | VXSM_IDLE_TIME));
25099 + vxi->sched.update_mask = update_mask;
25103 + if (set_mask & VXSM_CPU_ID) {
25104 + vxi->sched.update = cpumask_of_cpu(data->cpu_id);
25105 + cpus_and(vxi->sched.update, cpu_online_map,
25106 + vxi->sched.update);
25108 + vxi->sched.update = cpu_online_map;
25110 + /* forced reload? */
25111 + if (set_mask & VXSM_FORCE) {
25112 + for_each_cpu_mask(cpu, vxi->sched.update)
25113 + vx_update_sched_param(&vxi->sched,
25114 + &vx_per_cpu(vxi, sched_pc, cpu));
25115 + vxi->sched.update = CPU_MASK_NONE;
25118 + /* on UP we update immediately */
25119 + vx_update_sched_param(&vxi->sched,
25120 + &vx_per_cpu(vxi, sched_pc, 0));
25123 + spin_unlock(&vxi->sched.tokens_lock);
25128 +#define COPY_IDS(C) C(cpu_id); C(bucket_id)
25129 +#define COPY_PRI(C) C(prio_bias)
25130 +#define COPY_TOK(C) C(tokens); C(tokens_min); C(tokens_max)
25131 +#define COPY_FRI(C) C(fill_rate[0]); C(interval[0]); \
25132 + C(fill_rate[1]); C(interval[1]);
25134 +#define COPY_VALUE(name) vc_data.name = data->name
25136 +static int do_set_sched_v4(struct vx_info *vxi, struct vcmd_set_sched_v4 *data)
25138 + struct vcmd_sched_v5 vc_data;
25140 + vc_data.mask = data->set_mask;
25141 + COPY_IDS(COPY_VALUE);
25142 + COPY_PRI(COPY_VALUE);
25143 + COPY_TOK(COPY_VALUE);
25144 + vc_data.fill_rate[0] = vc_data.fill_rate[1] = data->fill_rate;
25145 + vc_data.interval[0] = vc_data.interval[1] = data->interval;
25146 + return do_set_sched(vxi, &vc_data);
25149 +int vc_set_sched_v4(struct vx_info *vxi, void __user *data)
25151 + struct vcmd_set_sched_v4 vc_data;
25153 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25156 + return do_set_sched_v4(vxi, &vc_data);
25159 + /* latest interface is v5 */
25161 +int vc_set_sched(struct vx_info *vxi, void __user *data)
25163 + struct vcmd_sched_v5 vc_data;
25165 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25168 + return do_set_sched(vxi, &vc_data);
25172 +#define COPY_PRI(C) C(prio_bias)
25173 +#define COPY_TOK(C) C(tokens); C(tokens_min); C(tokens_max)
25174 +#define COPY_FRI(C) C(fill_rate[0]); C(interval[0]); \
25175 + C(fill_rate[1]); C(interval[1]);
25177 +#define COPY_VALUE(name) vc_data.name = data->name
25180 +int vc_get_sched(struct vx_info *vxi, void __user *data)
25182 + struct vcmd_sched_v5 vc_data;
25184 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25187 + if (vc_data.mask & VXSM_CPU_ID) {
25188 + int cpu = vc_data.cpu_id;
25189 + struct _vx_sched_pc *data;
25191 + if (!cpu_possible(cpu))
25194 + data = &vx_per_cpu(vxi, sched_pc, cpu);
25195 + COPY_TOK(COPY_VALUE);
25196 + COPY_PRI(COPY_VALUE);
25197 + COPY_FRI(COPY_VALUE);
25199 + if (data->flags & VXSF_IDLE_TIME)
25200 + vc_data.mask |= VXSM_IDLE_TIME;
25202 + struct _vx_sched *data = &vxi->sched;
25204 + COPY_TOK(COPY_VALUE);
25205 + COPY_PRI(COPY_VALUE);
25206 + COPY_FRI(COPY_VALUE);
25209 + if (vc_data.mask & VXSM_MSEC) {
25210 + vc_data.interval[0] = ticks_to_msec(vc_data.interval[0]);
25211 + vc_data.interval[1] = ticks_to_msec(vc_data.interval[1]);
25214 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
25220 +int vc_sched_info(struct vx_info *vxi, void __user *data)
25222 + struct vcmd_sched_info vc_data;
25225 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25228 + cpu = vc_data.cpu_id;
25229 + if (!cpu_possible(cpu))
25233 + struct _vx_sched_pc *sched_pc =
25234 + &vx_per_cpu(vxi, sched_pc, cpu);
25236 + vc_data.user_msec = ticks_to_msec(sched_pc->user_ticks);
25237 + vc_data.sys_msec = ticks_to_msec(sched_pc->sys_ticks);
25238 + vc_data.hold_msec = ticks_to_msec(sched_pc->hold_ticks);
25239 + vc_data.vavavoom = sched_pc->vavavoom;
25241 + vc_data.token_usec = ticks_to_usec(1);
25243 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
25248 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/sched_init.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/sched_init.h
25249 --- linux-2.6.33.1/kernel/vserver/sched_init.h 1970-01-01 01:00:00.000000000 +0100
25250 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/sched_init.h 2010-02-25 12:02:16.000000000 +0100
25253 +static inline void vx_info_init_sched(struct _vx_sched *sched)
25255 + static struct lock_class_key tokens_lock_key;
25257 + /* scheduling; hard code starting values as constants */
25258 + sched->fill_rate[0] = 1;
25259 + sched->interval[0] = 4;
25260 + sched->fill_rate[1] = 1;
25261 + sched->interval[1] = 8;
25262 + sched->tokens = HZ >> 2;
25263 + sched->tokens_min = HZ >> 4;
25264 + sched->tokens_max = HZ >> 1;
25265 + sched->tokens_lock = SPIN_LOCK_UNLOCKED;
25266 + sched->prio_bias = 0;
25268 + lockdep_set_class(&sched->tokens_lock, &tokens_lock_key);
25272 +void vx_info_init_sched_pc(struct _vx_sched_pc *sched_pc, int cpu)
25274 + sched_pc->fill_rate[0] = 1;
25275 + sched_pc->interval[0] = 4;
25276 + sched_pc->fill_rate[1] = 1;
25277 + sched_pc->interval[1] = 8;
25278 + sched_pc->tokens = HZ >> 2;
25279 + sched_pc->tokens_min = HZ >> 4;
25280 + sched_pc->tokens_max = HZ >> 1;
25281 + sched_pc->prio_bias = 0;
25282 + sched_pc->vavavoom = 0;
25283 + sched_pc->token_time = 0;
25284 + sched_pc->idle_time = 0;
25285 + sched_pc->norm_time = jiffies;
25287 + sched_pc->user_ticks = 0;
25288 + sched_pc->sys_ticks = 0;
25289 + sched_pc->hold_ticks = 0;
25292 +static inline void vx_info_exit_sched(struct _vx_sched *sched)
25298 +void vx_info_exit_sched_pc(struct _vx_sched_pc *sched_pc, int cpu)
25302 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/sched_proc.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/sched_proc.h
25303 --- linux-2.6.33.1/kernel/vserver/sched_proc.h 1970-01-01 01:00:00.000000000 +0100
25304 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/sched_proc.h 2010-02-25 12:02:16.000000000 +0100
25306 +#ifndef _VX_SCHED_PROC_H
25307 +#define _VX_SCHED_PROC_H
25311 +int vx_info_proc_sched(struct _vx_sched *sched, char *buffer)
25315 + length += sprintf(buffer,
25316 + "FillRate:\t%8d,%d\n"
25317 + "Interval:\t%8d,%d\n"
25318 + "TokensMin:\t%8d\n"
25319 + "TokensMax:\t%8d\n"
25320 + "PrioBias:\t%8d\n",
25321 + sched->fill_rate[0],
25322 + sched->fill_rate[1],
25323 + sched->interval[0],
25324 + sched->interval[1],
25325 + sched->tokens_min,
25326 + sched->tokens_max,
25327 + sched->prio_bias);
25332 +int vx_info_proc_sched_pc(struct _vx_sched_pc *sched_pc,
25333 + char *buffer, int cpu)
25337 + length += sprintf(buffer + length,
25338 + "cpu %d: %lld %lld %lld %ld %ld", cpu,
25339 + (unsigned long long)sched_pc->user_ticks,
25340 + (unsigned long long)sched_pc->sys_ticks,
25341 + (unsigned long long)sched_pc->hold_ticks,
25342 + sched_pc->token_time,
25343 + sched_pc->idle_time);
25344 + length += sprintf(buffer + length,
25345 + " %c%c %d %d %d %d/%d %d/%d",
25346 + (sched_pc->flags & VXSF_ONHOLD) ? 'H' : 'R',
25347 + (sched_pc->flags & VXSF_IDLE_TIME) ? 'I' : '-',
25348 + sched_pc->tokens,
25349 + sched_pc->tokens_min,
25350 + sched_pc->tokens_max,
25351 + sched_pc->fill_rate[0],
25352 + sched_pc->interval[0],
25353 + sched_pc->fill_rate[1],
25354 + sched_pc->interval[1]);
25355 + length += sprintf(buffer + length,
25357 + sched_pc->prio_bias,
25358 + sched_pc->vavavoom);
25362 +#endif /* _VX_SCHED_PROC_H */
25363 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/signal.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/signal.c
25364 --- linux-2.6.33.1/kernel/vserver/signal.c 1970-01-01 01:00:00.000000000 +0100
25365 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/signal.c 2010-02-25 12:02:16.000000000 +0100
25368 + * linux/kernel/vserver/signal.c
25370 + * Virtual Server: Signal Support
25372 + * Copyright (C) 2003-2007 Herbert Pötzl
25374 + * V0.01 broken out from vcontext V0.05
25375 + * V0.02 changed vcmds to vxi arg
25376 + * V0.03 adjusted siginfo for kill
25380 +#include <asm/uaccess.h>
25382 +#include <linux/vs_context.h>
25383 +#include <linux/vs_pid.h>
25384 +#include <linux/vserver/signal_cmd.h>
25387 +int vx_info_kill(struct vx_info *vxi, int pid, int sig)
25389 + int retval, count = 0;
25390 + struct task_struct *p;
25391 + struct siginfo *sip = SEND_SIG_PRIV;
25394 + vxdprintk(VXD_CBIT(misc, 4),
25395 + "vx_info_kill(%p[#%d],%d,%d)*",
25396 + vxi, vxi->vx_id, pid, sig);
25397 + read_lock(&tasklist_lock);
25401 + for_each_process(p) {
25404 + if (vx_task_xid(p) != vxi->vx_id || p->pid <= 1 ||
25405 + (pid && vxi->vx_initpid == p->pid))
25408 + err = group_send_sig_info(sig, sip, p);
25410 + if (err != -EPERM)
25416 + if (vxi->vx_initpid) {
25417 + pid = vxi->vx_initpid;
25418 + /* for now, only SIGINT to private init ... */
25419 + if (!vx_info_flags(vxi, VXF_STATE_ADMIN, 0) &&
25420 + /* ... as long as there are tasks left */
25421 + (atomic_read(&vxi->vx_tasks) > 1))
25424 + /* fallthrough */
25426 + p = find_task_by_real_pid(pid);
25428 + if (vx_task_xid(p) == vxi->vx_id)
25429 + retval = group_send_sig_info(sig, sip, p);
25433 + read_unlock(&tasklist_lock);
25434 + vxdprintk(VXD_CBIT(misc, 4),
25435 + "vx_info_kill(%p[#%d],%d,%d,%ld) = %d",
25436 + vxi, vxi->vx_id, pid, sig, (long)sip, retval);
25440 +int vc_ctx_kill(struct vx_info *vxi, void __user *data)
25442 + struct vcmd_ctx_kill_v0 vc_data;
25444 + if (copy_from_user(&vc_data, data, sizeof(vc_data)))
25447 + /* special check to allow guest shutdown */
25448 + if (!vx_info_flags(vxi, VXF_STATE_ADMIN, 0) &&
25449 + /* forbid killall pid=0 when init is present */
25450 + (((vc_data.pid < 1) && vxi->vx_initpid) ||
25451 + (vc_data.pid > 1)))
25454 + return vx_info_kill(vxi, vc_data.pid, vc_data.sig);
25458 +static int __wait_exit(struct vx_info *vxi)
25460 + DECLARE_WAITQUEUE(wait, current);
25463 + add_wait_queue(&vxi->vx_wait, &wait);
25464 + set_current_state(TASK_INTERRUPTIBLE);
25467 + if (vx_info_state(vxi,
25468 + VXS_SHUTDOWN | VXS_HASHED | VXS_HELPER) == VXS_SHUTDOWN)
25470 + if (signal_pending(current)) {
25471 + ret = -ERESTARTSYS;
25478 + set_current_state(TASK_RUNNING);
25479 + remove_wait_queue(&vxi->vx_wait, &wait);
25485 +int vc_wait_exit(struct vx_info *vxi, void __user *data)
25487 + struct vcmd_wait_exit_v0 vc_data;
25490 + ret = __wait_exit(vxi);
25491 + vc_data.reboot_cmd = vxi->reboot_cmd;
25492 + vc_data.exit_code = vxi->exit_code;
25494 + if (copy_to_user(data, &vc_data, sizeof(vc_data)))
25499 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/space.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/space.c
25500 --- linux-2.6.33.1/kernel/vserver/space.c 1970-01-01 01:00:00.000000000 +0100
25501 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/space.c 2010-02-25 12:02:16.000000000 +0100
25504 + * linux/kernel/vserver/space.c
25506 + * Virtual Server: Context Space Support
25508 + * Copyright (C) 2003-2007 Herbert Pötzl
25510 + * V0.01 broken out from context.c 0.07
25511 + * V0.02 added task locking for namespace
25512 + * V0.03 broken out vx_enter_namespace
25513 + * V0.04 added *space support and commands
25517 +#include <linux/utsname.h>
25518 +#include <linux/nsproxy.h>
25519 +#include <linux/err.h>
25520 +#include <linux/fs_struct.h>
25521 +#include <asm/uaccess.h>
25523 +#include <linux/vs_context.h>
25524 +#include <linux/vserver/space.h>
25525 +#include <linux/vserver/space_cmd.h>
25527 +atomic_t vs_global_nsproxy = ATOMIC_INIT(0);
25528 +atomic_t vs_global_fs = ATOMIC_INIT(0);
25529 +atomic_t vs_global_mnt_ns = ATOMIC_INIT(0);
25530 +atomic_t vs_global_uts_ns = ATOMIC_INIT(0);
25531 +atomic_t vs_global_user_ns = ATOMIC_INIT(0);
25532 +atomic_t vs_global_pid_ns = ATOMIC_INIT(0);
25535 +/* namespace functions */
25537 +#include <linux/mnt_namespace.h>
25538 +#include <linux/user_namespace.h>
25539 +#include <linux/pid_namespace.h>
25540 +#include <linux/ipc_namespace.h>
25541 +#include <net/net_namespace.h>
25544 +static const struct vcmd_space_mask_v1 space_mask_v0 = {
25545 + .mask = CLONE_FS |
25553 +static const struct vcmd_space_mask_v1 space_mask = {
25554 + .mask = CLONE_FS |
25559 +#ifdef CONFIG_PID_NS
25562 +#ifdef CONFIG_NET_NS
25568 +static const struct vcmd_space_mask_v1 default_space_mask = {
25569 + .mask = CLONE_FS |
25574 +#ifdef CONFIG_PID_NS
25581 + * build a new nsproxy mix
25582 + * assumes that both proxies are 'const'
25583 + * does not touch nsproxy refcounts
25584 + * will hold a reference on the result.
25587 +struct nsproxy *vs_mix_nsproxy(struct nsproxy *old_nsproxy,
25588 + struct nsproxy *new_nsproxy, unsigned long mask)
25590 + struct mnt_namespace *old_ns;
25591 + struct uts_namespace *old_uts;
25592 + struct ipc_namespace *old_ipc;
25593 +#ifdef CONFIG_PID_NS
25594 + struct pid_namespace *old_pid;
25596 +#ifdef CONFIG_NET_NS
25597 + struct net *old_net;
25599 + struct nsproxy *nsproxy;
25601 + nsproxy = copy_nsproxy(old_nsproxy);
25605 + if (mask & CLONE_NEWNS) {
25606 + old_ns = nsproxy->mnt_ns;
25607 + nsproxy->mnt_ns = new_nsproxy->mnt_ns;
25608 + if (nsproxy->mnt_ns)
25609 + get_mnt_ns(nsproxy->mnt_ns);
25613 + if (mask & CLONE_NEWUTS) {
25614 + old_uts = nsproxy->uts_ns;
25615 + nsproxy->uts_ns = new_nsproxy->uts_ns;
25616 + if (nsproxy->uts_ns)
25617 + get_uts_ns(nsproxy->uts_ns);
25621 + if (mask & CLONE_NEWIPC) {
25622 + old_ipc = nsproxy->ipc_ns;
25623 + nsproxy->ipc_ns = new_nsproxy->ipc_ns;
25624 + if (nsproxy->ipc_ns)
25625 + get_ipc_ns(nsproxy->ipc_ns);
25629 +#ifdef CONFIG_PID_NS
25630 + if (mask & CLONE_NEWPID) {
25631 + old_pid = nsproxy->pid_ns;
25632 + nsproxy->pid_ns = new_nsproxy->pid_ns;
25633 + if (nsproxy->pid_ns)
25634 + get_pid_ns(nsproxy->pid_ns);
25638 +#ifdef CONFIG_NET_NS
25639 + if (mask & CLONE_NEWNET) {
25640 + old_net = nsproxy->net_ns;
25641 + nsproxy->net_ns = new_nsproxy->net_ns;
25642 + if (nsproxy->net_ns)
25643 + get_net(nsproxy->net_ns);
25648 + put_mnt_ns(old_ns);
25650 + put_uts_ns(old_uts);
25652 + put_ipc_ns(old_ipc);
25653 +#ifdef CONFIG_PID_NS
25655 + put_pid_ns(old_pid);
25657 +#ifdef CONFIG_NET_NS
25659 + put_net(old_net);
25667 + * merge two nsproxy structs into a new one.
25668 + * will hold a reference on the result.
25672 +struct nsproxy *__vs_merge_nsproxy(struct nsproxy *old,
25673 + struct nsproxy *proxy, unsigned long mask)
25675 + struct nsproxy null_proxy = { .mnt_ns = NULL };
25681 + /* vs_mix_nsproxy returns with reference */
25682 + return vs_mix_nsproxy(old ? old : &null_proxy,
25685 + get_nsproxy(proxy);
25690 +int vx_enter_space(struct vx_info *vxi, unsigned long mask, unsigned index)
25692 + struct nsproxy *proxy, *proxy_cur, *proxy_new;
25693 + struct fs_struct *fs_cur, *fs = NULL;
25694 + int ret, kill = 0;
25696 + vxdprintk(VXD_CBIT(space, 8), "vx_enter_space(%p[#%u],0x%08lx,%d)",
25697 + vxi, vxi->vx_id, mask, index);
25699 + if (vx_info_flags(vxi, VXF_INFO_PRIVATE, 0))
25703 + mask = vxi->vx_nsmask[index];
25705 + if ((mask & vxi->vx_nsmask[index]) != mask)
25708 + if (mask & CLONE_FS) {
25709 + fs = copy_fs_struct(vxi->vx_fs[index]);
25713 + proxy = vxi->vx_nsproxy[index];
25715 + vxdprintk(VXD_CBIT(space, 9),
25716 + "vx_enter_space(%p[#%u],0x%08lx,%d) -> (%p,%p)",
25717 + vxi, vxi->vx_id, mask, index, proxy, fs);
25719 + task_lock(current);
25720 + fs_cur = current->fs;
25722 + if (mask & CLONE_FS) {
25723 + write_lock(&fs_cur->lock);
25724 + current->fs = fs;
25725 + kill = !--fs_cur->users;
25726 + write_unlock(&fs_cur->lock);
25729 + proxy_cur = current->nsproxy;
25730 + get_nsproxy(proxy_cur);
25731 + task_unlock(current);
25734 + free_fs_struct(fs_cur);
25736 + proxy_new = __vs_merge_nsproxy(proxy_cur, proxy, mask);
25737 + if (IS_ERR(proxy_new)) {
25738 + ret = PTR_ERR(proxy_new);
25742 + proxy_new = xchg(¤t->nsproxy, proxy_new);
25746 + put_nsproxy(proxy_new);
25749 + put_nsproxy(proxy_cur);
25754 +int vx_set_space(struct vx_info *vxi, unsigned long mask, unsigned index)
25756 + struct nsproxy *proxy_vxi, *proxy_cur, *proxy_new;
25757 + struct fs_struct *fs_vxi, *fs;
25758 + int ret, kill = 0;
25760 + vxdprintk(VXD_CBIT(space, 8), "vx_set_space(%p[#%u],0x%08lx,%d)",
25761 + vxi, vxi->vx_id, mask, index);
25764 + mask = default_space_mask.mask;
25766 + if ((mask & space_mask.mask) != mask)
25769 + proxy_vxi = vxi->vx_nsproxy[index];
25770 + fs_vxi = vxi->vx_fs[index];
25772 + if (mask & CLONE_FS) {
25773 + fs = copy_fs_struct(current->fs);
25778 + task_lock(current);
25780 + if (mask & CLONE_FS) {
25781 + write_lock(&fs_vxi->lock);
25782 + vxi->vx_fs[index] = fs;
25783 + kill = !--fs_vxi->users;
25784 + write_unlock(&fs_vxi->lock);
25787 + proxy_cur = current->nsproxy;
25788 + get_nsproxy(proxy_cur);
25789 + task_unlock(current);
25792 + free_fs_struct(fs_vxi);
25794 + proxy_new = __vs_merge_nsproxy(proxy_vxi, proxy_cur, mask);
25795 + if (IS_ERR(proxy_new)) {
25796 + ret = PTR_ERR(proxy_new);
25800 + proxy_new = xchg(&vxi->vx_nsproxy[index], proxy_new);
25801 + vxi->vx_nsmask[index] |= mask;
25805 + put_nsproxy(proxy_new);
25808 + put_nsproxy(proxy_cur);
25813 +int vc_enter_space_v1(struct vx_info *vxi, void __user *data)
25815 + struct vcmd_space_mask_v1 vc_data = { .mask = 0 };
25817 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25820 + return vx_enter_space(vxi, vc_data.mask, 0);
25823 +int vc_enter_space(struct vx_info *vxi, void __user *data)
25825 + struct vcmd_space_mask_v2 vc_data = { .mask = 0 };
25827 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25830 + if (vc_data.index >= VX_SPACES)
25833 + return vx_enter_space(vxi, vc_data.mask, vc_data.index);
25836 +int vc_set_space_v1(struct vx_info *vxi, void __user *data)
25838 + struct vcmd_space_mask_v1 vc_data = { .mask = 0 };
25840 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25843 + return vx_set_space(vxi, vc_data.mask, 0);
25846 +int vc_set_space(struct vx_info *vxi, void __user *data)
25848 + struct vcmd_space_mask_v2 vc_data = { .mask = 0 };
25850 + if (data && copy_from_user(&vc_data, data, sizeof(vc_data)))
25853 + if (vc_data.index >= VX_SPACES)
25856 + return vx_set_space(vxi, vc_data.mask, vc_data.index);
25859 +int vc_get_space_mask(void __user *data, int type)
25861 + const struct vcmd_space_mask_v1 *mask;
25864 + mask = &space_mask_v0;
25865 + else if (type == 1)
25866 + mask = &space_mask;
25868 + mask = &default_space_mask;
25870 + vxdprintk(VXD_CBIT(space, 10),
25871 + "vc_get_space_mask(%d) = %08llx", type, mask->mask);
25873 + if (copy_to_user(data, mask, sizeof(*mask)))
25878 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/switch.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/switch.c
25879 --- linux-2.6.33.1/kernel/vserver/switch.c 1970-01-01 01:00:00.000000000 +0100
25880 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/switch.c 2010-02-25 12:02:16.000000000 +0100
25883 + * linux/kernel/vserver/switch.c
25885 + * Virtual Server: Syscall Switch
25887 + * Copyright (C) 2003-2007 Herbert Pötzl
25889 + * V0.01 syscall switch
25890 + * V0.02 added signal to context
25891 + * V0.03 added rlimit functions
25892 + * V0.04 added iattr, task/xid functions
25893 + * V0.05 added debug/history stuff
25894 + * V0.06 added compat32 layer
25895 + * V0.07 vcmd args and perms
25896 + * V0.08 added status commands
25897 + * V0.09 added tag commands
25898 + * V0.10 added oom bias
25899 + * V0.11 added device commands
25903 +#include <linux/vs_context.h>
25904 +#include <linux/vs_network.h>
25905 +#include <linux/vserver/switch.h>
25907 +#include "vci_config.h"
25911 +int vc_get_version(uint32_t id)
25913 + return VCI_VERSION;
25917 +int vc_get_vci(uint32_t id)
25919 + return vci_kernel_config();
25922 +#include <linux/vserver/context_cmd.h>
25923 +#include <linux/vserver/cvirt_cmd.h>
25924 +#include <linux/vserver/cacct_cmd.h>
25925 +#include <linux/vserver/limit_cmd.h>
25926 +#include <linux/vserver/network_cmd.h>
25927 +#include <linux/vserver/sched_cmd.h>
25928 +#include <linux/vserver/debug_cmd.h>
25929 +#include <linux/vserver/inode_cmd.h>
25930 +#include <linux/vserver/dlimit_cmd.h>
25931 +#include <linux/vserver/signal_cmd.h>
25932 +#include <linux/vserver/space_cmd.h>
25933 +#include <linux/vserver/tag_cmd.h>
25934 +#include <linux/vserver/device_cmd.h>
25936 +#include <linux/vserver/inode.h>
25937 +#include <linux/vserver/dlimit.h>
25940 +#ifdef CONFIG_COMPAT
25941 +#define __COMPAT(name, id, data, compat) \
25942 + (compat) ? name ## _x32(id, data) : name(id, data)
25943 +#define __COMPAT_NO_ID(name, data, compat) \
25944 + (compat) ? name ## _x32(data) : name(data)
25946 +#define __COMPAT(name, id, data, compat) \
25948 +#define __COMPAT_NO_ID(name, data, compat) \
25954 +long do_vcmd(uint32_t cmd, uint32_t id,
25955 + struct vx_info *vxi, struct nx_info *nxi,
25956 + void __user *data, int compat)
25960 + case VCMD_get_version:
25961 + return vc_get_version(id);
25962 + case VCMD_get_vci:
25963 + return vc_get_vci(id);
25965 + case VCMD_task_xid:
25966 + return vc_task_xid(id);
25967 + case VCMD_vx_info:
25968 + return vc_vx_info(vxi, data);
25970 + case VCMD_task_nid:
25971 + return vc_task_nid(id);
25972 + case VCMD_nx_info:
25973 + return vc_nx_info(nxi, data);
25975 + case VCMD_task_tag:
25976 + return vc_task_tag(id);
25978 + case VCMD_set_space_v1:
25979 + return vc_set_space_v1(vxi, data);
25980 + /* this is version 2 */
25981 + case VCMD_set_space:
25982 + return vc_set_space(vxi, data);
25984 + case VCMD_get_space_mask_v0:
25985 + return vc_get_space_mask(data, 0);
25986 + /* this is version 1 */
25987 + case VCMD_get_space_mask:
25988 + return vc_get_space_mask(data, 1);
25990 + case VCMD_get_space_default:
25991 + return vc_get_space_mask(data, -1);
25993 +#ifdef CONFIG_IA32_EMULATION
25994 + case VCMD_get_rlimit:
25995 + return __COMPAT(vc_get_rlimit, vxi, data, compat);
25996 + case VCMD_set_rlimit:
25997 + return __COMPAT(vc_set_rlimit, vxi, data, compat);
25999 + case VCMD_get_rlimit:
26000 + return vc_get_rlimit(vxi, data);
26001 + case VCMD_set_rlimit:
26002 + return vc_set_rlimit(vxi, data);
26004 + case VCMD_get_rlimit_mask:
26005 + return vc_get_rlimit_mask(id, data);
26006 + case VCMD_reset_hits:
26007 + return vc_reset_hits(vxi, data);
26008 + case VCMD_reset_minmax:
26009 + return vc_reset_minmax(vxi, data);
26011 + case VCMD_get_vhi_name:
26012 + return vc_get_vhi_name(vxi, data);
26013 + case VCMD_set_vhi_name:
26014 + return vc_set_vhi_name(vxi, data);
26016 + case VCMD_ctx_stat:
26017 + return vc_ctx_stat(vxi, data);
26018 + case VCMD_virt_stat:
26019 + return vc_virt_stat(vxi, data);
26020 + case VCMD_sock_stat:
26021 + return vc_sock_stat(vxi, data);
26022 + case VCMD_rlimit_stat:
26023 + return vc_rlimit_stat(vxi, data);
26025 + case VCMD_set_cflags:
26026 + return vc_set_cflags(vxi, data);
26027 + case VCMD_get_cflags:
26028 + return vc_get_cflags(vxi, data);
26030 + /* this is version 1 */
26031 + case VCMD_set_ccaps:
26032 + return vc_set_ccaps(vxi, data);
26033 + /* this is version 1 */
26034 + case VCMD_get_ccaps:
26035 + return vc_get_ccaps(vxi, data);
26036 + case VCMD_set_bcaps:
26037 + return vc_set_bcaps(vxi, data);
26038 + case VCMD_get_bcaps:
26039 + return vc_get_bcaps(vxi, data);
26041 + case VCMD_set_badness:
26042 + return vc_set_badness(vxi, data);
26043 + case VCMD_get_badness:
26044 + return vc_get_badness(vxi, data);
26046 + case VCMD_set_nflags:
26047 + return vc_set_nflags(nxi, data);
26048 + case VCMD_get_nflags:
26049 + return vc_get_nflags(nxi, data);
26051 + case VCMD_set_ncaps:
26052 + return vc_set_ncaps(nxi, data);
26053 + case VCMD_get_ncaps:
26054 + return vc_get_ncaps(nxi, data);
26056 + case VCMD_set_sched_v4:
26057 + return vc_set_sched_v4(vxi, data);
26058 + /* this is version 5 */
26059 + case VCMD_set_sched:
26060 + return vc_set_sched(vxi, data);
26061 + case VCMD_get_sched:
26062 + return vc_get_sched(vxi, data);
26063 + case VCMD_sched_info:
26064 + return vc_sched_info(vxi, data);
26066 + case VCMD_add_dlimit:
26067 + return __COMPAT(vc_add_dlimit, id, data, compat);
26068 + case VCMD_rem_dlimit:
26069 + return __COMPAT(vc_rem_dlimit, id, data, compat);
26070 + case VCMD_set_dlimit:
26071 + return __COMPAT(vc_set_dlimit, id, data, compat);
26072 + case VCMD_get_dlimit:
26073 + return __COMPAT(vc_get_dlimit, id, data, compat);
26075 + case VCMD_ctx_kill:
26076 + return vc_ctx_kill(vxi, data);
26078 + case VCMD_wait_exit:
26079 + return vc_wait_exit(vxi, data);
26081 + case VCMD_get_iattr:
26082 + return __COMPAT_NO_ID(vc_get_iattr, data, compat);
26083 + case VCMD_set_iattr:
26084 + return __COMPAT_NO_ID(vc_set_iattr, data, compat);
26086 + case VCMD_fget_iattr:
26087 + return vc_fget_iattr(id, data);
26088 + case VCMD_fset_iattr:
26089 + return vc_fset_iattr(id, data);
26091 + case VCMD_enter_space_v0:
26092 + return vc_enter_space_v1(vxi, NULL);
26093 + case VCMD_enter_space_v1:
26094 + return vc_enter_space_v1(vxi, data);
26095 + /* this is version 2 */
26096 + case VCMD_enter_space:
26097 + return vc_enter_space(vxi, data);
26099 + case VCMD_ctx_create_v0:
26100 + return vc_ctx_create(id, NULL);
26101 + case VCMD_ctx_create:
26102 + return vc_ctx_create(id, data);
26103 + case VCMD_ctx_migrate_v0:
26104 + return vc_ctx_migrate(vxi, NULL);
26105 + case VCMD_ctx_migrate:
26106 + return vc_ctx_migrate(vxi, data);
26108 + case VCMD_net_create_v0:
26109 + return vc_net_create(id, NULL);
26110 + case VCMD_net_create:
26111 + return vc_net_create(id, data);
26112 + case VCMD_net_migrate:
26113 + return vc_net_migrate(nxi, data);
26115 + case VCMD_tag_migrate:
26116 + return vc_tag_migrate(id);
26118 + case VCMD_net_add:
26119 + return vc_net_add(nxi, data);
26120 + case VCMD_net_remove:
26121 + return vc_net_remove(nxi, data);
26123 + case VCMD_net_add_ipv4:
26124 + return vc_net_add_ipv4(nxi, data);
26125 + case VCMD_net_remove_ipv4:
26126 + return vc_net_remove_ipv4(nxi, data);
26127 +#ifdef CONFIG_IPV6
26128 + case VCMD_net_add_ipv6:
26129 + return vc_net_add_ipv6(nxi, data);
26130 + case VCMD_net_remove_ipv6:
26131 + return vc_net_remove_ipv6(nxi, data);
26133 +/* case VCMD_add_match_ipv4:
26134 + return vc_add_match_ipv4(nxi, data);
26135 + case VCMD_get_match_ipv4:
26136 + return vc_get_match_ipv4(nxi, data);
26137 +#ifdef CONFIG_IPV6
26138 + case VCMD_add_match_ipv6:
26139 + return vc_add_match_ipv6(nxi, data);
26140 + case VCMD_get_match_ipv6:
26141 + return vc_get_match_ipv6(nxi, data);
26144 +#ifdef CONFIG_VSERVER_DEVICE
26145 + case VCMD_set_mapping:
26146 + return __COMPAT(vc_set_mapping, vxi, data, compat);
26147 + case VCMD_unset_mapping:
26148 + return __COMPAT(vc_unset_mapping, vxi, data, compat);
26150 +#ifdef CONFIG_VSERVER_HISTORY
26151 + case VCMD_dump_history:
26152 + return vc_dump_history(id);
26153 + case VCMD_read_history:
26154 + return __COMPAT(vc_read_history, id, data, compat);
26156 +#ifdef CONFIG_VSERVER_MONITOR
26157 + case VCMD_read_monitor:
26158 + return __COMPAT(vc_read_monitor, id, data, compat);
26161 + vxwprintk_task(1, "unimplemented VCMD_%02d_%d[%d]",
26162 + VC_CATEGORY(cmd), VC_COMMAND(cmd), VC_VERSION(cmd));
26168 +#define __VCMD(vcmd, _perm, _args, _flags) \
26169 + case VCMD_ ## vcmd: perm = _perm; \
26170 + args = _args; flags = _flags; break
26173 +#define VCA_NONE 0x00
26174 +#define VCA_VXI 0x01
26175 +#define VCA_NXI 0x02
26177 +#define VCF_NONE 0x00
26178 +#define VCF_INFO 0x01
26179 +#define VCF_ADMIN 0x02
26180 +#define VCF_ARES 0x06 /* includes admin */
26181 +#define VCF_SETUP 0x08
26183 +#define VCF_ZIDOK 0x10 /* zero id okay */
26187 +long do_vserver(uint32_t cmd, uint32_t id, void __user *data, int compat)
26190 + int permit = -1, state = 0;
26191 + int perm = -1, args = 0, flags = 0;
26192 + struct vx_info *vxi = NULL;
26193 + struct nx_info *nxi = NULL;
26196 + /* unpriviledged commands */
26197 + __VCMD(get_version, 0, VCA_NONE, 0);
26198 + __VCMD(get_vci, 0, VCA_NONE, 0);
26199 + __VCMD(get_rlimit_mask, 0, VCA_NONE, 0);
26200 + __VCMD(get_space_mask_v0,0, VCA_NONE, 0);
26201 + __VCMD(get_space_mask, 0, VCA_NONE, 0);
26202 + __VCMD(get_space_default,0, VCA_NONE, 0);
26204 + /* info commands */
26205 + __VCMD(task_xid, 2, VCA_NONE, 0);
26206 + __VCMD(reset_hits, 2, VCA_VXI, 0);
26207 + __VCMD(reset_minmax, 2, VCA_VXI, 0);
26208 + __VCMD(vx_info, 3, VCA_VXI, VCF_INFO);
26209 + __VCMD(get_bcaps, 3, VCA_VXI, VCF_INFO);
26210 + __VCMD(get_ccaps, 3, VCA_VXI, VCF_INFO);
26211 + __VCMD(get_cflags, 3, VCA_VXI, VCF_INFO);
26212 + __VCMD(get_badness, 3, VCA_VXI, VCF_INFO);
26213 + __VCMD(get_vhi_name, 3, VCA_VXI, VCF_INFO);
26214 + __VCMD(get_rlimit, 3, VCA_VXI, VCF_INFO);
26216 + __VCMD(ctx_stat, 3, VCA_VXI, VCF_INFO);
26217 + __VCMD(virt_stat, 3, VCA_VXI, VCF_INFO);
26218 + __VCMD(sock_stat, 3, VCA_VXI, VCF_INFO);
26219 + __VCMD(rlimit_stat, 3, VCA_VXI, VCF_INFO);
26221 + __VCMD(task_nid, 2, VCA_NONE, 0);
26222 + __VCMD(nx_info, 3, VCA_NXI, VCF_INFO);
26223 + __VCMD(get_ncaps, 3, VCA_NXI, VCF_INFO);
26224 + __VCMD(get_nflags, 3, VCA_NXI, VCF_INFO);
26226 + __VCMD(task_tag, 2, VCA_NONE, 0);
26228 + __VCMD(get_iattr, 2, VCA_NONE, 0);
26229 + __VCMD(fget_iattr, 2, VCA_NONE, 0);
26230 + __VCMD(get_dlimit, 3, VCA_NONE, VCF_INFO);
26231 + __VCMD(get_sched, 3, VCA_VXI, VCF_INFO);
26232 + __VCMD(sched_info, 3, VCA_VXI, VCF_INFO | VCF_ZIDOK);
26234 + /* lower admin commands */
26235 + __VCMD(wait_exit, 4, VCA_VXI, VCF_INFO);
26236 + __VCMD(ctx_create_v0, 5, VCA_NONE, 0);
26237 + __VCMD(ctx_create, 5, VCA_NONE, 0);
26238 + __VCMD(ctx_migrate_v0, 5, VCA_VXI, VCF_ADMIN);
26239 + __VCMD(ctx_migrate, 5, VCA_VXI, VCF_ADMIN);
26240 + __VCMD(enter_space_v0, 5, VCA_VXI, VCF_ADMIN);
26241 + __VCMD(enter_space_v1, 5, VCA_VXI, VCF_ADMIN);
26242 + __VCMD(enter_space, 5, VCA_VXI, VCF_ADMIN);
26244 + __VCMD(net_create_v0, 5, VCA_NONE, 0);
26245 + __VCMD(net_create, 5, VCA_NONE, 0);
26246 + __VCMD(net_migrate, 5, VCA_NXI, VCF_ADMIN);
26248 + __VCMD(tag_migrate, 5, VCA_NONE, VCF_ADMIN);
26250 + /* higher admin commands */
26251 + __VCMD(ctx_kill, 6, VCA_VXI, VCF_ARES);
26252 + __VCMD(set_space_v1, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26253 + __VCMD(set_space, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26255 + __VCMD(set_ccaps, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26256 + __VCMD(set_bcaps, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26257 + __VCMD(set_cflags, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26258 + __VCMD(set_badness, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26260 + __VCMD(set_vhi_name, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26261 + __VCMD(set_rlimit, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26262 + __VCMD(set_sched, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26263 + __VCMD(set_sched_v4, 7, VCA_VXI, VCF_ARES | VCF_SETUP);
26265 + __VCMD(set_ncaps, 7, VCA_NXI, VCF_ARES | VCF_SETUP);
26266 + __VCMD(set_nflags, 7, VCA_NXI, VCF_ARES | VCF_SETUP);
26267 + __VCMD(net_add, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26268 + __VCMD(net_remove, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26269 + __VCMD(net_add_ipv4, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26270 + __VCMD(net_remove_ipv4, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26271 +#ifdef CONFIG_IPV6
26272 + __VCMD(net_add_ipv6, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26273 + __VCMD(net_remove_ipv6, 8, VCA_NXI, VCF_ARES | VCF_SETUP);
26275 + __VCMD(set_iattr, 7, VCA_NONE, 0);
26276 + __VCMD(fset_iattr, 7, VCA_NONE, 0);
26277 + __VCMD(set_dlimit, 7, VCA_NONE, VCF_ARES);
26278 + __VCMD(add_dlimit, 8, VCA_NONE, VCF_ARES);
26279 + __VCMD(rem_dlimit, 8, VCA_NONE, VCF_ARES);
26281 +#ifdef CONFIG_VSERVER_DEVICE
26282 + __VCMD(set_mapping, 8, VCA_VXI, VCF_ARES|VCF_ZIDOK);
26283 + __VCMD(unset_mapping, 8, VCA_VXI, VCF_ARES|VCF_ZIDOK);
26285 + /* debug level admin commands */
26286 +#ifdef CONFIG_VSERVER_HISTORY
26287 + __VCMD(dump_history, 9, VCA_NONE, 0);
26288 + __VCMD(read_history, 9, VCA_NONE, 0);
26290 +#ifdef CONFIG_VSERVER_MONITOR
26291 + __VCMD(read_monitor, 9, VCA_NONE, 0);
26298 + vxdprintk(VXD_CBIT(switch, 0),
26299 + "vc: VCMD_%02d_%d[%d], %d,%p [%d,%d,%x,%x]",
26300 + VC_CATEGORY(cmd), VC_COMMAND(cmd),
26301 + VC_VERSION(cmd), id, data, compat,
26302 + perm, args, flags);
26309 + if (!capable(CAP_CONTEXT))
26313 + /* moved here from the individual commands */
26315 + if ((perm > 1) && !capable(CAP_SYS_ADMIN))
26319 + /* vcmd involves resource management */
26321 + if ((flags & VCF_ARES) && !capable(CAP_SYS_RESOURCE))
26325 + /* various legacy exceptions */
26327 + /* will go away when spectator is a cap */
26328 + case VCMD_ctx_migrate_v0:
26329 + case VCMD_ctx_migrate:
26331 + current->xid = 1;
26337 + /* will go away when spectator is a cap */
26338 + case VCMD_net_migrate:
26340 + current->nid = 1;
26347 + /* vcmds are fine by default */
26350 + /* admin type vcmds require admin ... */
26351 + if (flags & VCF_ADMIN)
26352 + permit = vx_check(0, VS_ADMIN) ? 1 : 0;
26354 + /* ... but setup type vcmds override that */
26355 + if (!permit && (flags & VCF_SETUP))
26356 + permit = vx_flags(VXF_STATE_SETUP, 0) ? 2 : 0;
26364 + if (!id && (flags & VCF_ZIDOK))
26368 + if (args & VCA_VXI) {
26369 + vxi = lookup_vx_info(id);
26373 + if ((flags & VCF_ADMIN) &&
26374 + /* special case kill for shutdown */
26375 + (cmd != VCMD_ctx_kill) &&
26376 + /* can context be administrated? */
26377 + !vx_info_flags(vxi, VXF_STATE_ADMIN, 0)) {
26383 + if (args & VCA_NXI) {
26384 + nxi = lookup_nx_info(id);
26388 + if ((flags & VCF_ADMIN) &&
26389 + /* can context be administrated? */
26390 + !nx_info_flags(nxi, NXF_STATE_ADMIN, 0)) {
26397 + ret = do_vcmd(cmd, id, vxi, nxi, data, compat);
26400 + if ((args & VCA_NXI) && nxi)
26401 + put_nx_info(nxi);
26403 + if ((args & VCA_VXI) && vxi)
26404 + put_vx_info(vxi);
26406 + vxdprintk(VXD_CBIT(switch, 1),
26407 + "vc: VCMD_%02d_%d[%d] = %08lx(%ld) [%d,%d]",
26408 + VC_CATEGORY(cmd), VC_COMMAND(cmd),
26409 + VC_VERSION(cmd), ret, ret, state, permit);
26414 +sys_vserver(uint32_t cmd, uint32_t id, void __user *data)
26416 + return do_vserver(cmd, id, data, 0);
26419 +#ifdef CONFIG_COMPAT
26422 +sys32_vserver(uint32_t cmd, uint32_t id, void __user *data)
26424 + return do_vserver(cmd, id, data, 1);
26427 +#endif /* CONFIG_COMPAT */
26428 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/sysctl.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/sysctl.c
26429 --- linux-2.6.33.1/kernel/vserver/sysctl.c 1970-01-01 01:00:00.000000000 +0100
26430 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/sysctl.c 2010-02-25 15:14:16.000000000 +0100
26433 + * kernel/vserver/sysctl.c
26435 + * Virtual Context Support
26437 + * Copyright (C) 2004-2007 Herbert Pötzl
26439 + * V0.01 basic structure
26443 +#include <linux/module.h>
26444 +#include <linux/ctype.h>
26445 +#include <linux/sysctl.h>
26446 +#include <linux/parser.h>
26447 +#include <asm/uaccess.h>
26450 + CTL_DEBUG_ERROR = 0,
26451 + CTL_DEBUG_SWITCH = 1,
26466 +unsigned int vx_debug_switch = 0;
26467 +unsigned int vx_debug_xid = 0;
26468 +unsigned int vx_debug_nid = 0;
26469 +unsigned int vx_debug_tag = 0;
26470 +unsigned int vx_debug_net = 0;
26471 +unsigned int vx_debug_limit = 0;
26472 +unsigned int vx_debug_cres = 0;
26473 +unsigned int vx_debug_dlim = 0;
26474 +unsigned int vx_debug_quota = 0;
26475 +unsigned int vx_debug_cvirt = 0;
26476 +unsigned int vx_debug_space = 0;
26477 +unsigned int vx_debug_misc = 0;
26480 +static struct ctl_table_header *vserver_table_header;
26481 +static ctl_table vserver_root_table[];
26484 +void vserver_register_sysctl(void)
26486 + if (!vserver_table_header) {
26487 + vserver_table_header = register_sysctl_table(vserver_root_table);
26492 +void vserver_unregister_sysctl(void)
26494 + if (vserver_table_header) {
26495 + unregister_sysctl_table(vserver_table_header);
26496 + vserver_table_header = NULL;
26501 +static int proc_dodebug(ctl_table *table, int write,
26502 + void __user *buffer, size_t *lenp, loff_t *ppos)
26504 + char tmpbuf[20], *p, c;
26505 + unsigned int value;
26506 + size_t left, len;
26508 + if ((*ppos && !write) || !*lenp) {
26516 + if (!access_ok(VERIFY_READ, buffer, left))
26518 + p = (char *)buffer;
26519 + while (left && __get_user(c, p) >= 0 && isspace(c))
26524 + if (left > sizeof(tmpbuf) - 1)
26526 + if (copy_from_user(tmpbuf, p, left))
26528 + tmpbuf[left] = '\0';
26530 + for (p = tmpbuf, value = 0; '0' <= *p && *p <= '9'; p++, left--)
26531 + value = 10 * value + (*p - '0');
26532 + if (*p && !isspace(*p))
26534 + while (left && isspace(*p))
26536 + *(unsigned int *)table->data = value;
26538 + if (!access_ok(VERIFY_WRITE, buffer, left))
26540 + len = sprintf(tmpbuf, "%d", *(unsigned int *)table->data);
26543 + if (__copy_to_user(buffer, tmpbuf, len))
26545 + if ((left -= len) > 0) {
26546 + if (put_user('\n', (char *)buffer + len))
26560 +#define CTL_ENTRY(ctl, name) \
26562 + .procname = #name, \
26563 + .data = &vx_ ## name, \
26564 + .maxlen = sizeof(int), \
26566 + .proc_handler = &proc_dodebug, \
26567 + .extra1 = &zero, \
26568 + .extra2 = &zero, \
26571 +static ctl_table vserver_debug_table[] = {
26572 + CTL_ENTRY(CTL_DEBUG_SWITCH, debug_switch),
26573 + CTL_ENTRY(CTL_DEBUG_XID, debug_xid),
26574 + CTL_ENTRY(CTL_DEBUG_NID, debug_nid),
26575 + CTL_ENTRY(CTL_DEBUG_TAG, debug_tag),
26576 + CTL_ENTRY(CTL_DEBUG_NET, debug_net),
26577 + CTL_ENTRY(CTL_DEBUG_LIMIT, debug_limit),
26578 + CTL_ENTRY(CTL_DEBUG_CRES, debug_cres),
26579 + CTL_ENTRY(CTL_DEBUG_DLIM, debug_dlim),
26580 + CTL_ENTRY(CTL_DEBUG_QUOTA, debug_quota),
26581 + CTL_ENTRY(CTL_DEBUG_CVIRT, debug_cvirt),
26582 + CTL_ENTRY(CTL_DEBUG_SPACE, debug_space),
26583 + CTL_ENTRY(CTL_DEBUG_MISC, debug_misc),
26587 +static ctl_table vserver_root_table[] = {
26589 + .procname = "vserver",
26591 + .child = vserver_debug_table
26597 +static match_table_t tokens = {
26598 + { CTL_DEBUG_SWITCH, "switch=%x" },
26599 + { CTL_DEBUG_XID, "xid=%x" },
26600 + { CTL_DEBUG_NID, "nid=%x" },
26601 + { CTL_DEBUG_TAG, "tag=%x" },
26602 + { CTL_DEBUG_NET, "net=%x" },
26603 + { CTL_DEBUG_LIMIT, "limit=%x" },
26604 + { CTL_DEBUG_CRES, "cres=%x" },
26605 + { CTL_DEBUG_DLIM, "dlim=%x" },
26606 + { CTL_DEBUG_QUOTA, "quota=%x" },
26607 + { CTL_DEBUG_CVIRT, "cvirt=%x" },
26608 + { CTL_DEBUG_SPACE, "space=%x" },
26609 + { CTL_DEBUG_MISC, "misc=%x" },
26610 + { CTL_DEBUG_ERROR, NULL }
26613 +#define HANDLE_CASE(id, name, val) \
26614 + case CTL_DEBUG_ ## id: \
26615 + vx_debug_ ## name = val; \
26616 + printk("vs_debug_" #name "=0x%x\n", val); \
26620 +static int __init vs_debug_setup(char *str)
26625 + printk("vs_debug_setup(%s)\n", str);
26626 + while ((p = strsep(&str, ",")) != NULL) {
26627 + substring_t args[MAX_OPT_ARGS];
26628 + unsigned int value;
26633 + token = match_token(p, tokens, args);
26634 + value = (token > 0) ? simple_strtoul(args[0].from, NULL, 0) : 0;
26637 + HANDLE_CASE(SWITCH, switch, value);
26638 + HANDLE_CASE(XID, xid, value);
26639 + HANDLE_CASE(NID, nid, value);
26640 + HANDLE_CASE(TAG, tag, value);
26641 + HANDLE_CASE(NET, net, value);
26642 + HANDLE_CASE(LIMIT, limit, value);
26643 + HANDLE_CASE(CRES, cres, value);
26644 + HANDLE_CASE(DLIM, dlim, value);
26645 + HANDLE_CASE(QUOTA, quota, value);
26646 + HANDLE_CASE(CVIRT, cvirt, value);
26647 + HANDLE_CASE(SPACE, space, value);
26648 + HANDLE_CASE(MISC, misc, value);
26657 +__setup("vsdebug=", vs_debug_setup);
26661 +EXPORT_SYMBOL_GPL(vx_debug_switch);
26662 +EXPORT_SYMBOL_GPL(vx_debug_xid);
26663 +EXPORT_SYMBOL_GPL(vx_debug_nid);
26664 +EXPORT_SYMBOL_GPL(vx_debug_net);
26665 +EXPORT_SYMBOL_GPL(vx_debug_limit);
26666 +EXPORT_SYMBOL_GPL(vx_debug_cres);
26667 +EXPORT_SYMBOL_GPL(vx_debug_dlim);
26668 +EXPORT_SYMBOL_GPL(vx_debug_quota);
26669 +EXPORT_SYMBOL_GPL(vx_debug_cvirt);
26670 +EXPORT_SYMBOL_GPL(vx_debug_space);
26671 +EXPORT_SYMBOL_GPL(vx_debug_misc);
26673 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/tag.c linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/tag.c
26674 --- linux-2.6.33.1/kernel/vserver/tag.c 1970-01-01 01:00:00.000000000 +0100
26675 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/tag.c 2010-02-25 12:02:16.000000000 +0100
26678 + * linux/kernel/vserver/tag.c
26680 + * Virtual Server: Shallow Tag Space
26682 + * Copyright (C) 2007 Herbert Pötzl
26684 + * V0.01 basic implementation
26688 +#include <linux/sched.h>
26689 +#include <linux/vserver/debug.h>
26690 +#include <linux/vs_pid.h>
26691 +#include <linux/vs_tag.h>
26693 +#include <linux/vserver/tag_cmd.h>
26696 +int dx_migrate_task(struct task_struct *p, tag_t tag)
26701 + vxdprintk(VXD_CBIT(tag, 5),
26702 + "dx_migrate_task(%p[#%d],#%d)", p, p->tag, tag);
26708 + vxdprintk(VXD_CBIT(tag, 5),
26709 + "moved task %p into [#%d]", p, tag);
26713 +/* vserver syscall commands below here */
26715 +/* taks xid and vx_info functions */
26718 +int vc_task_tag(uint32_t id)
26723 + struct task_struct *tsk;
26724 + read_lock(&tasklist_lock);
26725 + tsk = find_task_by_real_pid(id);
26726 + tag = (tsk) ? tsk->tag : -ESRCH;
26727 + read_unlock(&tasklist_lock);
26729 + tag = dx_current_tag();
26734 +int vc_tag_migrate(uint32_t tag)
26736 + return dx_migrate_task(current, tag & 0xFFFF);
26740 diff -NurpP --minimal linux-2.6.33.1/kernel/vserver/vci_config.h linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/vci_config.h
26741 --- linux-2.6.33.1/kernel/vserver/vci_config.h 1970-01-01 01:00:00.000000000 +0100
26742 +++ linux-2.6.33.1-vs2.3.0.36.30.4/kernel/vserver/vci_config.h 2010-02-25 12:02:16.000000000 +0100
26745 +/* interface version */
26747 +#define VCI_VERSION 0x00020305
26751 + VCI_KCBIT_NO_DYNAMIC = 0,
26753 + VCI_KCBIT_PROC_SECURE = 4,
26754 + VCI_KCBIT_HARDCPU = 5,
26755 + VCI_KCBIT_IDLELIMIT = 6,
26756 + VCI_KCBIT_IDLETIME = 7,
26758 + VCI_KCBIT_COWBL = 8,
26759 + VCI_KCBIT_FULLCOWBL = 9,
26760 + VCI_KCBIT_SPACES = 10,
26761 + VCI_KCBIT_NETV2 = 11,
26763 + VCI_KCBIT_DEBUG = 16,
26764 + VCI_KCBIT_HISTORY = 20,
26765 + VCI_KCBIT_TAGGED = 24,
26766 + VCI_KCBIT_PPTAG = 28,
26768 + VCI_KCBIT_MORE = 31,
26772 +static inline uint32_t vci_kernel_config(void)
26775 + (1 << VCI_KCBIT_NO_DYNAMIC) |
26777 + /* configured features */
26778 +#ifdef CONFIG_VSERVER_PROC_SECURE
26779 + (1 << VCI_KCBIT_PROC_SECURE) |
26781 +#ifdef CONFIG_VSERVER_HARDCPU
26782 + (1 << VCI_KCBIT_HARDCPU) |
26784 +#ifdef CONFIG_VSERVER_IDLELIMIT
26785 + (1 << VCI_KCBIT_IDLELIMIT) |
26787 +#ifdef CONFIG_VSERVER_IDLETIME
26788 + (1 << VCI_KCBIT_IDLETIME) |
26790 +#ifdef CONFIG_VSERVER_COWBL
26791 + (1 << VCI_KCBIT_COWBL) |
26792 + (1 << VCI_KCBIT_FULLCOWBL) |
26794 + (1 << VCI_KCBIT_SPACES) |
26795 + (1 << VCI_KCBIT_NETV2) |
26797 + /* debug options */
26798 +#ifdef CONFIG_VSERVER_DEBUG
26799 + (1 << VCI_KCBIT_DEBUG) |
26801 +#ifdef CONFIG_VSERVER_HISTORY
26802 + (1 << VCI_KCBIT_HISTORY) |
26805 + /* inode context tagging */
26806 +#if defined(CONFIG_TAGGING_NONE)
26807 + (0 << VCI_KCBIT_TAGGED) |
26808 +#elif defined(CONFIG_TAGGING_UID16)
26809 + (1 << VCI_KCBIT_TAGGED) |
26810 +#elif defined(CONFIG_TAGGING_GID16)
26811 + (2 << VCI_KCBIT_TAGGED) |
26812 +#elif defined(CONFIG_TAGGING_ID24)
26813 + (3 << VCI_KCBIT_TAGGED) |
26814 +#elif defined(CONFIG_TAGGING_INTERN)
26815 + (4 << VCI_KCBIT_TAGGED) |
26816 +#elif defined(CONFIG_TAGGING_RUNTIME)
26817 + (5 << VCI_KCBIT_TAGGED) |
26819 + (7 << VCI_KCBIT_TAGGED) |
26821 + (1 << VCI_KCBIT_PPTAG) |
26825 diff -NurpP --minimal linux-2.6.33.1/mm/filemap_xip.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/filemap_xip.c
26826 --- linux-2.6.33.1/mm/filemap_xip.c 2009-12-03 20:02:58.000000000 +0100
26827 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/filemap_xip.c 2010-02-25 12:02:16.000000000 +0100
26829 #include <linux/sched.h>
26830 #include <linux/seqlock.h>
26831 #include <linux/mutex.h>
26832 +#include <linux/vs_memory.h>
26833 #include <asm/tlbflush.h>
26834 #include <asm/io.h>
26836 diff -NurpP --minimal linux-2.6.33.1/mm/fremap.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/fremap.c
26837 --- linux-2.6.33.1/mm/fremap.c 2009-03-24 14:22:45.000000000 +0100
26838 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/fremap.c 2010-02-25 12:02:16.000000000 +0100
26840 #include <linux/module.h>
26841 #include <linux/syscalls.h>
26842 #include <linux/mmu_notifier.h>
26843 +#include <linux/vs_memory.h>
26845 #include <asm/mmu_context.h>
26846 #include <asm/cacheflush.h>
26847 diff -NurpP --minimal linux-2.6.33.1/mm/hugetlb.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/hugetlb.c
26848 --- linux-2.6.33.1/mm/hugetlb.c 2010-02-25 11:52:09.000000000 +0100
26849 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/hugetlb.c 2010-02-25 12:16:11.000000000 +0100
26852 #include <linux/hugetlb.h>
26853 #include <linux/node.h>
26854 +#include <linux/vs_memory.h>
26855 #include "internal.h"
26857 const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
26858 diff -NurpP --minimal linux-2.6.33.1/mm/memcontrol.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/memcontrol.c
26859 --- linux-2.6.33.1/mm/memcontrol.c 2010-02-25 11:52:09.000000000 +0100
26860 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/memcontrol.c 2010-02-26 10:04:15.000000000 +0100
26861 @@ -555,6 +555,31 @@ struct mem_cgroup *mem_cgroup_from_task(
26862 struct mem_cgroup, css);
26865 +u64 mem_cgroup_res_read_u64(struct mem_cgroup *mem, int member)
26867 + return res_counter_read_u64(&mem->res, member);
26870 +u64 mem_cgroup_memsw_read_u64(struct mem_cgroup *mem, int member)
26872 + return res_counter_read_u64(&mem->memsw, member);
26875 +s64 mem_cgroup_stat_read_cache(struct mem_cgroup *mem)
26877 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_CACHE);
26880 +s64 mem_cgroup_stat_read_anon(struct mem_cgroup *mem)
26882 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_RSS);
26885 +s64 mem_cgroup_stat_read_mapped(struct mem_cgroup *mem)
26887 + return mem_cgroup_read_stat(&mem->stat, MEM_CGROUP_STAT_FILE_MAPPED);
26890 static struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
26892 struct mem_cgroup *mem = NULL;
26893 diff -NurpP --minimal linux-2.6.33.1/mm/memory.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/memory.c
26894 --- linux-2.6.33.1/mm/memory.c 2010-02-25 11:52:09.000000000 +0100
26895 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/memory.c 2010-02-25 12:02:16.000000000 +0100
26897 #include <linux/kallsyms.h>
26898 #include <linux/swapops.h>
26899 #include <linux/elf.h>
26900 +// #include <linux/vs_memory.h>
26902 #include <asm/io.h>
26903 #include <asm/pgalloc.h>
26904 @@ -651,6 +652,9 @@ static int copy_pte_range(struct mm_stru
26906 swp_entry_t entry = (swp_entry_t){0};
26908 + if (!vx_rss_avail(dst_mm, ((end - addr)/PAGE_SIZE + 1)))
26912 rss[1] = rss[0] = 0;
26913 dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl);
26914 @@ -2670,6 +2674,8 @@ static int do_anonymous_page(struct mm_s
26915 /* Allocate our own private page. */
26916 pte_unmap(page_table);
26918 + if (!vx_rss_avail(mm, 1))
26920 if (unlikely(anon_vma_prepare(vma)))
26922 page = alloc_zeroed_user_highpage_movable(vma, address);
26923 @@ -2961,6 +2967,7 @@ static inline int handle_pte_fault(struc
26927 + int ret = 0, type = VXPT_UNKNOWN;
26930 if (!pte_present(entry)) {
26931 @@ -2985,9 +2992,12 @@ static inline int handle_pte_fault(struc
26932 if (unlikely(!pte_same(*pte, entry)))
26934 if (flags & FAULT_FLAG_WRITE) {
26935 - if (!pte_write(entry))
26936 - return do_wp_page(mm, vma, address,
26937 + if (!pte_write(entry)) {
26938 + ret = do_wp_page(mm, vma, address,
26939 pte, pmd, ptl, entry);
26940 + type = VXPT_WRITE;
26943 entry = pte_mkdirty(entry);
26945 entry = pte_mkyoung(entry);
26946 @@ -3005,7 +3015,10 @@ static inline int handle_pte_fault(struc
26949 pte_unmap_unlock(pte, ptl);
26953 + vx_page_fault(mm, vma, type, ret);
26958 diff -NurpP --minimal linux-2.6.33.1/mm/mlock.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/mlock.c
26959 --- linux-2.6.33.1/mm/mlock.c 2010-02-25 11:52:09.000000000 +0100
26960 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/mlock.c 2010-02-25 12:02:16.000000000 +0100
26962 #include <linux/rmap.h>
26963 #include <linux/mmzone.h>
26964 #include <linux/hugetlb.h>
26965 +#include <linux/vs_memory.h>
26967 #include "internal.h"
26969 @@ -398,7 +399,7 @@ success:
26970 nr_pages = (end - start) >> PAGE_SHIFT;
26972 nr_pages = -nr_pages;
26973 - mm->locked_vm += nr_pages;
26974 + vx_vmlocked_add(mm, nr_pages);
26977 * vm_flags is protected by the mmap_sem held in write mode.
26978 @@ -471,7 +472,7 @@ static int do_mlock(unsigned long start,
26980 SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
26982 - unsigned long locked;
26983 + unsigned long locked, grow;
26984 unsigned long lock_limit;
26985 int error = -ENOMEM;
26987 @@ -484,8 +485,10 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
26988 len = PAGE_ALIGN(len + (start & ~PAGE_MASK));
26989 start &= PAGE_MASK;
26991 - locked = len >> PAGE_SHIFT;
26992 - locked += current->mm->locked_vm;
26993 + grow = len >> PAGE_SHIFT;
26994 + if (!vx_vmlocked_avail(current->mm, grow))
26996 + locked = current->mm->locked_vm + grow;
26998 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
26999 lock_limit >>= PAGE_SHIFT;
27000 @@ -493,6 +496,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, st
27001 /* check against resource limits */
27002 if ((locked <= lock_limit) || capable(CAP_IPC_LOCK))
27003 error = do_mlock(start, len, 1);
27005 up_write(¤t->mm->mmap_sem);
27008 @@ -554,6 +558,8 @@ SYSCALL_DEFINE1(mlockall, int, flags)
27009 lock_limit >>= PAGE_SHIFT;
27012 + if (!vx_vmlocked_avail(current->mm, current->mm->total_vm))
27014 if (!(flags & MCL_CURRENT) || (current->mm->total_vm <= lock_limit) ||
27015 capable(CAP_IPC_LOCK))
27016 ret = do_mlockall(flags);
27017 @@ -628,8 +634,10 @@ int account_locked_memory(struct mm_stru
27021 - mm->total_vm += pgsz;
27022 - mm->locked_vm += pgsz;
27023 + // mm->total_vm += pgsz;
27024 + vx_vmpages_add(mm, pgsz);
27025 + // mm->locked_vm += pgsz;
27026 + vx_vmlocked_add(mm, pgsz);
27030 @@ -643,8 +651,10 @@ void refund_locked_memory(struct mm_stru
27032 down_write(&mm->mmap_sem);
27034 - mm->total_vm -= pgsz;
27035 - mm->locked_vm -= pgsz;
27036 + // mm->total_vm -= pgsz;
27037 + vx_vmpages_sub(mm, pgsz);
27038 + // mm->locked_vm -= pgsz;
27039 + vx_vmlocked_sub(mm, pgsz);
27041 up_write(&mm->mmap_sem);
27043 diff -NurpP --minimal linux-2.6.33.1/mm/mmap.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/mmap.c
27044 --- linux-2.6.33.1/mm/mmap.c 2010-02-25 11:52:09.000000000 +0100
27045 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/mmap.c 2010-02-25 12:02:16.000000000 +0100
27046 @@ -1262,7 +1262,8 @@ munmap_back:
27048 perf_event_mmap(vma);
27050 - mm->total_vm += len >> PAGE_SHIFT;
27051 + // mm->total_vm += len >> PAGE_SHIFT;
27052 + vx_vmpages_add(mm, len >> PAGE_SHIFT);
27053 vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
27054 if (vm_flags & VM_LOCKED) {
27056 @@ -1271,7 +1272,8 @@ out:
27057 long nr_pages = mlock_vma_pages_range(vma, addr, addr + len);
27059 return nr_pages; /* vma gone! */
27060 - mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages;
27061 + // mm->locked_vm += (len >> PAGE_SHIFT) - nr_pages;
27062 + vx_vmlocked_add(mm, (len >> PAGE_SHIFT) - nr_pages);
27063 } else if ((flags & MAP_POPULATE) && !(flags & MAP_NONBLOCK))
27064 make_pages_present(addr, addr + len);
27066 @@ -1626,9 +1628,9 @@ static int acct_stack_growth(struct vm_a
27069 /* Ok, everything looks good - let it rip */
27070 - mm->total_vm += grow;
27071 + vx_vmpages_add(mm, grow);
27072 if (vma->vm_flags & VM_LOCKED)
27073 - mm->locked_vm += grow;
27074 + vx_vmlocked_add(mm, grow);
27075 vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow);
27078 @@ -1803,7 +1805,8 @@ static void remove_vma_list(struct mm_st
27080 long nrpages = vma_pages(vma);
27082 - mm->total_vm -= nrpages;
27083 + // mm->total_vm -= nrpages;
27084 + vx_vmpages_sub(mm, nrpages);
27085 vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
27086 vma = remove_vma(vma);
27088 @@ -1995,7 +1998,8 @@ int do_munmap(struct mm_struct *mm, unsi
27089 struct vm_area_struct *tmp = vma;
27090 while (tmp && tmp->vm_start < end) {
27091 if (tmp->vm_flags & VM_LOCKED) {
27092 - mm->locked_vm -= vma_pages(tmp);
27093 + // mm->locked_vm -= vma_pages(tmp);
27094 + vx_vmlocked_sub(mm, vma_pages(tmp));
27095 munlock_vma_pages_all(tmp);
27097 tmp = tmp->vm_next;
27098 @@ -2078,6 +2082,8 @@ unsigned long do_brk(unsigned long addr,
27099 lock_limit >>= PAGE_SHIFT;
27100 if (locked > lock_limit && !capable(CAP_IPC_LOCK))
27102 + if (!vx_vmlocked_avail(mm, len >> PAGE_SHIFT))
27107 @@ -2104,7 +2110,8 @@ unsigned long do_brk(unsigned long addr,
27108 if (mm->map_count > sysctl_max_map_count)
27111 - if (security_vm_enough_memory(len >> PAGE_SHIFT))
27112 + if (security_vm_enough_memory(len >> PAGE_SHIFT) ||
27113 + !vx_vmpages_avail(mm, len >> PAGE_SHIFT))
27116 /* Can we just expand an old private anonymous mapping? */
27117 @@ -2130,10 +2137,13 @@ unsigned long do_brk(unsigned long addr,
27118 vma->vm_page_prot = vm_get_page_prot(flags);
27119 vma_link(mm, vma, prev, rb_link, rb_parent);
27121 - mm->total_vm += len >> PAGE_SHIFT;
27122 + // mm->total_vm += len >> PAGE_SHIFT;
27123 + vx_vmpages_add(mm, len >> PAGE_SHIFT);
27125 if (flags & VM_LOCKED) {
27126 if (!mlock_vma_pages_range(vma, addr, addr + len))
27127 - mm->locked_vm += (len >> PAGE_SHIFT);
27128 + // mm->locked_vm += (len >> PAGE_SHIFT);
27129 + vx_vmlocked_add(mm, len >> PAGE_SHIFT);
27133 @@ -2177,6 +2187,11 @@ void exit_mmap(struct mm_struct *mm)
27134 free_pgtables(tlb, vma, FIRST_USER_ADDRESS, 0);
27135 tlb_finish_mmu(tlb, 0, end);
27137 + set_mm_counter(mm, file_rss, 0);
27138 + set_mm_counter(mm, anon_rss, 0);
27139 + vx_vmpages_sub(mm, mm->total_vm);
27140 + vx_vmlocked_sub(mm, mm->locked_vm);
27143 * Walk the list again, actually closing and freeing it,
27144 * with preemption enabled, without holding any MM locks.
27145 @@ -2216,7 +2231,8 @@ int insert_vm_struct(struct mm_struct *
27146 if (__vma && __vma->vm_start < vma->vm_end)
27148 if ((vma->vm_flags & VM_ACCOUNT) &&
27149 - security_vm_enough_memory_mm(mm, vma_pages(vma)))
27150 + (security_vm_enough_memory_mm(mm, vma_pages(vma)) ||
27151 + !vx_vmpages_avail(mm, vma_pages(vma))))
27153 vma_link(mm, vma, prev, rb_link, rb_parent);
27155 @@ -2292,6 +2308,8 @@ int may_expand_vm(struct mm_struct *mm,
27157 if (cur + npages > lim)
27159 + if (!vx_vmpages_avail(mm, npages))
27164 @@ -2369,7 +2387,7 @@ int install_special_mapping(struct mm_st
27168 - mm->total_vm += len >> PAGE_SHIFT;
27169 + vx_vmpages_add(mm, len >> PAGE_SHIFT);
27171 perf_event_mmap(vma);
27173 diff -NurpP --minimal linux-2.6.33.1/mm/mremap.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/mremap.c
27174 --- linux-2.6.33.1/mm/mremap.c 2010-02-25 11:52:09.000000000 +0100
27175 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/mremap.c 2010-02-25 12:02:16.000000000 +0100
27177 #include <linux/security.h>
27178 #include <linux/syscalls.h>
27179 #include <linux/mmu_notifier.h>
27180 +#include <linux/vs_memory.h>
27182 #include <asm/uaccess.h>
27183 #include <asm/cacheflush.h>
27184 @@ -234,7 +235,7 @@ static unsigned long move_vma(struct vm_
27185 * If this were a serious issue, we'd add a flag to do_munmap().
27187 hiwater_vm = mm->hiwater_vm;
27188 - mm->total_vm += new_len >> PAGE_SHIFT;
27189 + vx_vmpages_add(mm, new_len >> PAGE_SHIFT);
27190 vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
27192 if (do_munmap(mm, old_addr, old_len) < 0) {
27193 @@ -252,7 +253,7 @@ static unsigned long move_vma(struct vm_
27196 if (vm_flags & VM_LOCKED) {
27197 - mm->locked_vm += new_len >> PAGE_SHIFT;
27198 + vx_vmlocked_add(mm, new_len >> PAGE_SHIFT);
27199 if (new_len > old_len)
27200 mlock_vma_pages_range(new_vma, new_addr + old_len,
27201 new_addr + new_len);
27202 @@ -463,10 +464,12 @@ unsigned long do_mremap(unsigned long ad
27203 vma_adjust(vma, vma->vm_start,
27204 addr + new_len, vma->vm_pgoff, NULL);
27206 - mm->total_vm += pages;
27207 + // mm->total_vm += pages;
27208 + vx_vmpages_add(mm, pages);
27209 vm_stat_account(mm, vma->vm_flags, vma->vm_file, pages);
27210 if (vma->vm_flags & VM_LOCKED) {
27211 - mm->locked_vm += pages;
27212 + // mm->locked_vm += pages;
27213 + vx_vmlocked_add(mm, pages);
27214 mlock_vma_pages_range(vma, addr + old_len,
27217 diff -NurpP --minimal linux-2.6.33.1/mm/nommu.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/nommu.c
27218 --- linux-2.6.33.1/mm/nommu.c 2010-02-25 11:52:09.000000000 +0100
27219 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/nommu.c 2010-02-25 12:02:16.000000000 +0100
27220 @@ -1349,7 +1349,7 @@ unsigned long do_mmap_pgoff(struct file
27221 /* okay... we have a mapping; now we have to register it */
27222 result = vma->vm_start;
27224 - current->mm->total_vm += len >> PAGE_SHIFT;
27225 + vx_vmpages_add(current->mm, len >> PAGE_SHIFT);
27228 add_vma_to_mm(current->mm, vma);
27229 @@ -1637,7 +1637,7 @@ void exit_mmap(struct mm_struct *mm)
27233 - mm->total_vm = 0;
27234 + vx_vmpages_sub(mm, mm->total_vm);
27236 while ((vma = mm->mmap)) {
27237 mm->mmap = vma->vm_next;
27238 diff -NurpP --minimal linux-2.6.33.1/mm/oom_kill.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/oom_kill.c
27239 --- linux-2.6.33.1/mm/oom_kill.c 2010-02-25 11:52:09.000000000 +0100
27240 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/oom_kill.c 2010-02-25 12:20:14.000000000 +0100
27242 #include <linux/notifier.h>
27243 #include <linux/memcontrol.h>
27244 #include <linux/security.h>
27245 +#include <linux/reboot.h>
27246 +#include <linux/vs_memory.h>
27247 +#include <linux/vs_context.h>
27249 int sysctl_panic_on_oom;
27250 int sysctl_oom_kill_allocating_task;
27251 @@ -186,9 +189,21 @@ unsigned long badness(struct task_struct
27252 points >>= -(oom_adj);
27256 + * add points for context badness and
27257 + * reduce badness for processes belonging to
27258 + * a different context
27261 + points += vx_badness(p, mm);
27263 + if ((vx_current_xid() > 1) &&
27264 + vx_current_xid() != vx_task_xid(p))
27268 - printk(KERN_DEBUG "OOMkill: task %d (%s) got %lu points\n",
27269 - p->pid, p->comm, points);
27270 + printk(KERN_DEBUG "OOMkill: task %d:#%u (%s) got %d points\n",
27271 + task_pid_nr(p), p->xid, p->comm, points);
27275 @@ -249,6 +264,7 @@ static struct task_struct *select_bad_pr
27276 struct task_struct *p;
27277 struct task_struct *chosen = NULL;
27278 struct timespec uptime;
27279 + unsigned xid = vx_current_xid();
27282 do_posix_clock_monotonic_gettime(&uptime);
27283 @@ -261,11 +277,14 @@ static struct task_struct *select_bad_pr
27287 - /* skip the init task */
27288 - if (is_global_init(p))
27289 + /* skip the init task, global and per guest */
27290 + if (task_is_init(p))
27292 if (mem && !task_in_mem_cgroup(p, mem))
27294 + /* skip other guest and host processes if oom in guest */
27295 + if (xid && vx_task_xid(p) != xid)
27299 * This task already has access to memory reserves and is
27300 @@ -397,9 +416,9 @@ static void __oom_kill_task(struct task_
27304 - printk(KERN_ERR "Killed process %d (%s) "
27305 + printk(KERN_ERR "Killed process %s(%d:#%u) "
27306 "vsz:%lukB, anon-rss:%lukB, file-rss:%lukB\n",
27307 - task_pid_nr(p), p->comm,
27308 + p->comm, task_pid_nr(p), p->xid,
27309 K(p->mm->total_vm),
27310 K(get_mm_counter(p->mm, anon_rss)),
27311 K(get_mm_counter(p->mm, file_rss)));
27312 @@ -452,8 +471,8 @@ static int oom_kill_process(struct task_
27316 - printk(KERN_ERR "%s: kill process %d (%s) score %li or a child\n",
27317 - message, task_pid_nr(p), p->comm, points);
27318 + printk(KERN_ERR "%s: kill process %s(%d:#%u) score %li or a child\n",
27319 + message, p->comm, task_pid_nr(p), p->xid, points);
27321 /* Try to kill a child first */
27322 list_for_each_entry(c, &p->children, sibling) {
27323 @@ -554,6 +573,8 @@ void clear_zonelist_oom(struct zonelist
27324 spin_unlock(&zone_scan_lock);
27327 +long vs_oom_action(unsigned int);
27330 * Must be called with tasklist_lock held for read.
27332 @@ -580,7 +601,11 @@ retry:
27334 read_unlock(&tasklist_lock);
27335 dump_header(NULL, gfp_mask, order, NULL);
27336 - panic("Out of memory and no killable processes...\n");
27337 + /* avoid panic for guest OOM */
27338 + if (current->xid)
27339 + vs_oom_action(LINUX_REBOOT_CMD_OOM);
27341 + panic("Out of memory and no killable processes...\n");
27344 if (oom_kill_process(p, gfp_mask, order, points, NULL,
27345 diff -NurpP --minimal linux-2.6.33.1/mm/page_alloc.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/page_alloc.c
27346 --- linux-2.6.33.1/mm/page_alloc.c 2010-02-25 11:52:09.000000000 +0100
27347 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/page_alloc.c 2010-02-25 12:16:45.000000000 +0100
27349 #include <linux/debugobjects.h>
27350 #include <linux/kmemleak.h>
27351 #include <linux/memory.h>
27352 +#include <linux/vs_base.h>
27353 +#include <linux/vs_limit.h>
27354 #include <trace/events/kmem.h>
27356 #include <asm/tlbflush.h>
27357 @@ -2138,6 +2140,9 @@ void si_meminfo(struct sysinfo *val)
27358 val->totalhigh = totalhigh_pages;
27359 val->freehigh = nr_free_highpages();
27360 val->mem_unit = PAGE_SIZE;
27362 + if (vx_flags(VXF_VIRT_MEM, 0))
27363 + vx_vsi_meminfo(val);
27366 EXPORT_SYMBOL(si_meminfo);
27367 @@ -2158,6 +2163,9 @@ void si_meminfo_node(struct sysinfo *val
27370 val->mem_unit = PAGE_SIZE;
27372 + if (vx_flags(VXF_VIRT_MEM, 0))
27373 + vx_vsi_meminfo(val);
27377 diff -NurpP --minimal linux-2.6.33.1/mm/rmap.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/rmap.c
27378 --- linux-2.6.33.1/mm/rmap.c 2010-02-25 11:52:09.000000000 +0100
27379 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/rmap.c 2010-02-25 12:02:16.000000000 +0100
27381 #include <linux/memcontrol.h>
27382 #include <linux/mmu_notifier.h>
27383 #include <linux/migrate.h>
27384 +#include <linux/vs_memory.h>
27386 #include <asm/tlbflush.h>
27388 diff -NurpP --minimal linux-2.6.33.1/mm/shmem.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/shmem.c
27389 --- linux-2.6.33.1/mm/shmem.c 2010-02-25 11:52:09.000000000 +0100
27390 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/shmem.c 2010-02-25 12:02:16.000000000 +0100
27391 @@ -1788,7 +1788,7 @@ static int shmem_statfs(struct dentry *d
27393 struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb);
27395 - buf->f_type = TMPFS_MAGIC;
27396 + buf->f_type = TMPFS_SUPER_MAGIC;
27397 buf->f_bsize = PAGE_CACHE_SIZE;
27398 buf->f_namelen = NAME_MAX;
27399 spin_lock(&sbinfo->stat_lock);
27400 @@ -2358,7 +2358,7 @@ int shmem_fill_super(struct super_block
27401 sb->s_maxbytes = SHMEM_MAX_BYTES;
27402 sb->s_blocksize = PAGE_CACHE_SIZE;
27403 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
27404 - sb->s_magic = TMPFS_MAGIC;
27405 + sb->s_magic = TMPFS_SUPER_MAGIC;
27406 sb->s_op = &shmem_ops;
27407 sb->s_time_gran = 1;
27408 #ifdef CONFIG_TMPFS_POSIX_ACL
27409 diff -NurpP --minimal linux-2.6.33.1/mm/slab.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/slab.c
27410 --- linux-2.6.33.1/mm/slab.c 2010-03-18 16:25:15.000000000 +0100
27411 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/slab.c 2010-03-18 16:54:29.000000000 +0100
27412 @@ -431,6 +431,8 @@ static void kmem_list3_init(struct kmem_
27413 #define STATS_INC_FREEMISS(x) do { } while (0)
27416 +#include "slab_vs.h"
27421 @@ -3273,6 +3275,7 @@ retry:
27423 obj = slab_get_obj(cachep, slabp, nodeid);
27424 check_slabp(cachep, slabp);
27425 + vx_slab_alloc(cachep, flags);
27426 l3->free_objects--;
27427 /* move slabp to correct slabp list: */
27428 list_del(&slabp->list);
27429 @@ -3349,6 +3352,7 @@ __cache_alloc_node(struct kmem_cache *ca
27430 /* ___cache_alloc_node can fall back to other nodes */
27431 ptr = ____cache_alloc_node(cachep, flags, nodeid);
27433 + vx_slab_alloc(cachep, flags);
27434 local_irq_restore(save_flags);
27435 ptr = cache_alloc_debugcheck_after(cachep, flags, ptr, caller);
27436 kmemleak_alloc_recursive(ptr, obj_size(cachep), 1, cachep->flags,
27437 @@ -3535,6 +3539,7 @@ static inline void __cache_free(struct k
27439 kmemleak_free_recursive(objp, cachep->flags);
27440 objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
27441 + vx_slab_free(cachep);
27443 kmemcheck_slab_free(cachep, objp, obj_size(cachep));
27445 diff -NurpP --minimal linux-2.6.33.1/mm/slab_vs.h linux-2.6.33.1-vs2.3.0.36.30.4/mm/slab_vs.h
27446 --- linux-2.6.33.1/mm/slab_vs.h 1970-01-01 01:00:00.000000000 +0100
27447 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/slab_vs.h 2010-02-25 12:02:16.000000000 +0100
27450 +#include <linux/vserver/context.h>
27452 +#include <linux/vs_context.h>
27455 +void vx_slab_alloc(struct kmem_cache *cachep, gfp_t flags)
27457 + int what = gfp_zone(cachep->gfpflags);
27458 + struct vx_info *vxi = current_vx_info();
27463 + atomic_add(cachep->buffer_size, &vxi->cacct.slab[what]);
27467 +void vx_slab_free(struct kmem_cache *cachep)
27469 + int what = gfp_zone(cachep->gfpflags);
27470 + struct vx_info *vxi = current_vx_info();
27475 + atomic_sub(cachep->buffer_size, &vxi->cacct.slab[what]);
27478 diff -NurpP --minimal linux-2.6.33.1/mm/swapfile.c linux-2.6.33.1-vs2.3.0.36.30.4/mm/swapfile.c
27479 --- linux-2.6.33.1/mm/swapfile.c 2010-02-25 11:52:09.000000000 +0100
27480 +++ linux-2.6.33.1-vs2.3.0.36.30.4/mm/swapfile.c 2010-02-25 12:02:16.000000000 +0100
27482 #include <asm/tlbflush.h>
27483 #include <linux/swapops.h>
27484 #include <linux/page_cgroup.h>
27485 +#include <linux/vs_base.h>
27486 +#include <linux/vs_memory.h>
27488 static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
27490 @@ -1693,6 +1695,16 @@ static int swap_show(struct seq_file *sw
27492 if (si == SEQ_START_TOKEN) {
27493 seq_puts(swap,"Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n");
27494 + if (vx_flags(VXF_VIRT_MEM, 0)) {
27495 + struct sysinfo si;
27497 + vx_vsi_swapinfo(&si);
27498 + if (si.totalswap < (1 << 10))
27500 + seq_printf(swap, "%s\t\t\t\t\t%s\t%lu\t%lu\t%d\n",
27501 + "hdv0", "partition", si.totalswap >> 10,
27502 + (si.totalswap - si.freeswap) >> 10, -1);
27507 @@ -2071,6 +2083,8 @@ void si_swapinfo(struct sysinfo *val)
27508 val->freeswap = nr_swap_pages + nr_to_be_unused;
27509 val->totalswap = total_swap_pages + nr_to_be_unused;
27510 spin_unlock(&swap_lock);
27511 + if (vx_flags(VXF_VIRT_MEM, 0))
27512 + vx_vsi_swapinfo(val);
27516 diff -NurpP --minimal linux-2.6.33.1/net/core/dev.c linux-2.6.33.1-vs2.3.0.36.30.4/net/core/dev.c
27517 --- linux-2.6.33.1/net/core/dev.c 2010-02-25 11:52:10.000000000 +0100
27518 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/core/dev.c 2010-02-25 14:02:39.000000000 +0100
27519 @@ -128,6 +128,7 @@
27520 #include <linux/in.h>
27521 #include <linux/jhash.h>
27522 #include <linux/random.h>
27523 +#include <linux/vs_inet.h>
27524 #include <trace/events/napi.h>
27526 #include "net-sysfs.h"
27527 @@ -593,7 +594,8 @@ struct net_device *__dev_get_by_name(str
27528 struct hlist_head *head = dev_name_hash(net, name);
27530 hlist_for_each_entry(dev, p, head, name_hlist)
27531 - if (!strncmp(dev->name, name, IFNAMSIZ))
27532 + if (!strncmp(dev->name, name, IFNAMSIZ) &&
27533 + nx_dev_visible(current_nx_info(), dev))
27537 @@ -619,7 +621,8 @@ struct net_device *dev_get_by_name_rcu(s
27538 struct hlist_head *head = dev_name_hash(net, name);
27540 hlist_for_each_entry_rcu(dev, p, head, name_hlist)
27541 - if (!strncmp(dev->name, name, IFNAMSIZ))
27542 + if (!strncmp(dev->name, name, IFNAMSIZ) &&
27543 + nx_dev_visible(current_nx_info(), dev))
27547 @@ -670,7 +673,8 @@ struct net_device *__dev_get_by_index(st
27548 struct hlist_head *head = dev_index_hash(net, ifindex);
27550 hlist_for_each_entry(dev, p, head, index_hlist)
27551 - if (dev->ifindex == ifindex)
27552 + if ((dev->ifindex == ifindex) &&
27553 + nx_dev_visible(current_nx_info(), dev))
27557 @@ -695,7 +699,8 @@ struct net_device *dev_get_by_index_rcu(
27558 struct hlist_head *head = dev_index_hash(net, ifindex);
27560 hlist_for_each_entry_rcu(dev, p, head, index_hlist)
27561 - if (dev->ifindex == ifindex)
27562 + if ((dev->ifindex == ifindex) &&
27563 + nx_dev_visible(current_nx_info(), dev))
27567 @@ -748,10 +753,12 @@ struct net_device *dev_getbyhwaddr(struc
27571 - for_each_netdev(net, dev)
27572 + for_each_netdev(net, dev) {
27573 if (dev->type == type &&
27574 - !memcmp(dev->dev_addr, ha, dev->addr_len))
27575 + !memcmp(dev->dev_addr, ha, dev->addr_len) &&
27576 + nx_dev_visible(current_nx_info(), dev))
27582 @@ -762,9 +769,11 @@ struct net_device *__dev_getfirstbyhwtyp
27583 struct net_device *dev;
27586 - for_each_netdev(net, dev)
27587 - if (dev->type == type)
27588 + for_each_netdev(net, dev) {
27589 + if ((dev->type == type) &&
27590 + nx_dev_visible(current_nx_info(), dev))
27596 @@ -883,6 +892,8 @@ static int __dev_alloc_name(struct net *
27598 if (i < 0 || i >= max_netdevices)
27600 + if (!nx_dev_visible(current_nx_info(), d))
27603 /* avoid cases where sscanf is not exact inverse of printf */
27604 snprintf(buf, IFNAMSIZ, name, i);
27605 @@ -3115,6 +3126,8 @@ static int dev_ifconf(struct net *net, c
27608 for_each_netdev(net, dev) {
27609 + if (!nx_dev_visible(current_nx_info(), dev))
27611 for (i = 0; i < NPROTO; i++) {
27612 if (gifconf_list[i]) {
27614 @@ -3185,6 +3198,9 @@ static void dev_seq_printf_stats(struct
27616 const struct net_device_stats *stats = dev_get_stats(dev);
27618 + if (!nx_dev_visible(current_nx_info(), dev))
27621 seq_printf(seq, "%6s:%8lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu "
27622 "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n",
27623 dev->name, stats->rx_bytes, stats->rx_packets,
27624 @@ -5528,7 +5544,6 @@ int dev_change_net_namespace(struct net_
27625 if (dev->dev.parent)
27629 /* Ensure the device has been registrered */
27631 if (dev->reg_state != NETREG_REGISTERED)
27632 diff -NurpP --minimal linux-2.6.33.1/net/core/rtnetlink.c linux-2.6.33.1-vs2.3.0.36.30.4/net/core/rtnetlink.c
27633 --- linux-2.6.33.1/net/core/rtnetlink.c 2010-02-25 11:52:10.000000000 +0100
27634 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/core/rtnetlink.c 2010-02-25 13:59:02.000000000 +0100
27635 @@ -695,6 +695,8 @@ static int rtnl_dump_ifinfo(struct sk_bu
27636 hlist_for_each_entry(dev, node, head, index_hlist) {
27639 + if (!nx_dev_visible(skb->sk->sk_nx_info, dev))
27641 if (rtnl_fill_ifinfo(skb, dev, RTM_NEWLINK,
27642 NETLINK_CB(cb->skb).pid,
27643 cb->nlh->nlmsg_seq, 0,
27644 @@ -1252,6 +1254,9 @@ void rtmsg_ifinfo(int type, struct net_d
27645 struct sk_buff *skb;
27646 int err = -ENOBUFS;
27648 + if (!nx_dev_visible(current_nx_info(), dev))
27651 skb = nlmsg_new(if_nlmsg_size(dev), GFP_KERNEL);
27654 diff -NurpP --minimal linux-2.6.33.1/net/core/sock.c linux-2.6.33.1-vs2.3.0.36.30.4/net/core/sock.c
27655 --- linux-2.6.33.1/net/core/sock.c 2010-02-25 11:52:10.000000000 +0100
27656 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/core/sock.c 2010-02-25 12:02:16.000000000 +0100
27657 @@ -125,6 +125,10 @@
27658 #include <linux/ipsec.h>
27660 #include <linux/filter.h>
27661 +#include <linux/vs_socket.h>
27662 +#include <linux/vs_limit.h>
27663 +#include <linux/vs_context.h>
27664 +#include <linux/vs_network.h>
27667 #include <net/tcp.h>
27668 @@ -1008,6 +1012,8 @@ static struct sock *sk_prot_alloc(struct
27670 sk_tx_queue_clear(sk);
27672 + sock_vx_init(sk);
27673 + sock_nx_init(sk);
27677 @@ -1087,6 +1093,11 @@ static void __sk_free(struct sock *sk)
27678 __func__, atomic_read(&sk->sk_omem_alloc));
27680 put_net(sock_net(sk));
27682 + clr_vx_info(&sk->sk_vx_info);
27684 + clr_nx_info(&sk->sk_nx_info);
27686 sk_prot_free(sk->sk_prot_creator, sk);
27689 @@ -1134,6 +1145,8 @@ struct sock *sk_clone(const struct sock
27692 get_net(sock_net(newsk));
27693 + sock_vx_init(newsk);
27694 + sock_nx_init(newsk);
27695 sk_node_init(&newsk->sk_node);
27696 sock_lock_init(newsk);
27697 bh_lock_sock(newsk);
27698 @@ -1188,6 +1201,12 @@ struct sock *sk_clone(const struct sock
27700 atomic_set(&newsk->sk_refcnt, 2);
27702 + set_vx_info(&newsk->sk_vx_info, sk->sk_vx_info);
27703 + newsk->sk_xid = sk->sk_xid;
27704 + vx_sock_inc(newsk);
27705 + set_nx_info(&newsk->sk_nx_info, sk->sk_nx_info);
27706 + newsk->sk_nid = sk->sk_nid;
27709 * Increment the counter in the same struct proto as the master
27710 * sock (sk_refcnt_debug_inc uses newsk->sk_prot->socks, that
27711 @@ -1910,6 +1929,12 @@ void sock_init_data(struct socket *sock,
27713 sk->sk_stamp = ktime_set(-1L, 0);
27715 + set_vx_info(&sk->sk_vx_info, current_vx_info());
27716 + sk->sk_xid = vx_current_xid();
27718 + set_nx_info(&sk->sk_nx_info, current_nx_info());
27719 + sk->sk_nid = nx_current_nid();
27722 * Before updating sk_refcnt, we must commit prior changes to memory
27723 * (Documentation/RCU/rculist_nulls.txt for details)
27724 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/af_inet.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/af_inet.c
27725 --- linux-2.6.33.1/net/ipv4/af_inet.c 2010-02-25 11:52:10.000000000 +0100
27726 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/af_inet.c 2010-02-25 15:53:12.000000000 +0100
27727 @@ -115,6 +115,7 @@
27728 #ifdef CONFIG_IP_MROUTE
27729 #include <linux/mroute.h>
27731 +#include <linux/vs_limit.h>
27734 /* The inetsw table contains everything that inet_create needs to
27735 @@ -326,9 +327,13 @@ lookup_protocol:
27739 + if ((protocol == IPPROTO_ICMP) &&
27740 + nx_capable(CAP_NET_RAW, NXC_RAW_ICMP))
27743 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
27744 goto out_rcu_unlock;
27747 err = -EAFNOSUPPORT;
27748 if (!inet_netns_ok(net, protocol))
27749 goto out_rcu_unlock;
27750 @@ -448,6 +453,7 @@ int inet_bind(struct socket *sock, struc
27751 struct sockaddr_in *addr = (struct sockaddr_in *)uaddr;
27752 struct sock *sk = sock->sk;
27753 struct inet_sock *inet = inet_sk(sk);
27754 + struct nx_v4_sock_addr nsa;
27755 unsigned short snum;
27758 @@ -461,7 +467,11 @@ int inet_bind(struct socket *sock, struc
27759 if (addr_len < sizeof(struct sockaddr_in))
27762 - chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
27763 + err = v4_map_sock_addr(inet, addr, &nsa);
27767 + chk_addr_ret = inet_addr_type(sock_net(sk), nsa.saddr);
27769 /* Not specified by any standard per-se, however it breaks too
27770 * many applications when removed. It is unfortunate since
27771 @@ -473,7 +483,7 @@ int inet_bind(struct socket *sock, struc
27772 err = -EADDRNOTAVAIL;
27773 if (!sysctl_ip_nonlocal_bind &&
27774 !(inet->freebind || inet->transparent) &&
27775 - addr->sin_addr.s_addr != htonl(INADDR_ANY) &&
27776 + nsa.saddr != htonl(INADDR_ANY) &&
27777 chk_addr_ret != RTN_LOCAL &&
27778 chk_addr_ret != RTN_MULTICAST &&
27779 chk_addr_ret != RTN_BROADCAST)
27780 @@ -498,7 +508,7 @@ int inet_bind(struct socket *sock, struc
27781 if (sk->sk_state != TCP_CLOSE || inet->inet_num)
27782 goto out_release_sock;
27784 - inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
27785 + v4_set_sock_addr(inet, &nsa);
27786 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
27787 inet->inet_saddr = 0; /* Use device */
27789 @@ -695,11 +705,13 @@ int inet_getname(struct socket *sock, st
27792 sin->sin_port = inet->inet_dport;
27793 - sin->sin_addr.s_addr = inet->inet_daddr;
27794 + sin->sin_addr.s_addr =
27795 + nx_map_sock_lback(sk->sk_nx_info, inet->inet_daddr);
27797 __be32 addr = inet->inet_rcv_saddr;
27799 addr = inet->inet_saddr;
27800 + addr = nx_map_sock_lback(sk->sk_nx_info, addr);
27801 sin->sin_port = inet->inet_sport;
27802 sin->sin_addr.s_addr = addr;
27804 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/devinet.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/devinet.c
27805 --- linux-2.6.33.1/net/ipv4/devinet.c 2010-02-25 11:52:10.000000000 +0100
27806 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/devinet.c 2010-02-25 14:19:58.000000000 +0100
27807 @@ -416,6 +416,7 @@ struct in_device *inetdev_by_index(struc
27809 EXPORT_SYMBOL(inetdev_by_index);
27812 /* Called only from RTNL semaphored context. No locks. */
27814 struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix,
27815 @@ -658,6 +659,8 @@ int devinet_ioctl(struct net *net, unsig
27817 in_dev = __in_dev_get_rtnl(dev);
27819 + struct nx_info *nxi = current_nx_info();
27821 if (tryaddrmatch) {
27822 /* Matthias Andree */
27823 /* compare label and address (4.4BSD style) */
27824 @@ -666,6 +669,8 @@ int devinet_ioctl(struct net *net, unsig
27825 This is checked above. */
27826 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
27827 ifap = &ifa->ifa_next) {
27828 + if (!nx_v4_ifa_visible(nxi, ifa))
27830 if (!strcmp(ifr.ifr_name, ifa->ifa_label) &&
27831 sin_orig.sin_addr.s_addr ==
27832 ifa->ifa_address) {
27833 @@ -678,9 +683,12 @@ int devinet_ioctl(struct net *net, unsig
27834 comparing just the label */
27836 for (ifap = &in_dev->ifa_list; (ifa = *ifap) != NULL;
27837 - ifap = &ifa->ifa_next)
27838 + ifap = &ifa->ifa_next) {
27839 + if (!nx_v4_ifa_visible(nxi, ifa))
27841 if (!strcmp(ifr.ifr_name, ifa->ifa_label))
27847 @@ -832,6 +840,8 @@ static int inet_gifconf(struct net_devic
27850 for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) {
27851 + if (!nx_v4_ifa_visible(current_nx_info(), ifa))
27854 done += sizeof(ifr);
27856 @@ -1180,6 +1190,7 @@ static int inet_dump_ifaddr(struct sk_bu
27857 struct net_device *dev;
27858 struct in_device *in_dev;
27859 struct in_ifaddr *ifa;
27860 + struct sock *sk = skb->sk;
27861 struct hlist_head *head;
27862 struct hlist_node *node;
27864 @@ -1202,6 +1213,8 @@ static int inet_dump_ifaddr(struct sk_bu
27866 for (ifa = in_dev->ifa_list, ip_idx = 0; ifa;
27867 ifa = ifa->ifa_next, ip_idx++) {
27868 + if (sk && !nx_v4_ifa_visible(sk->sk_nx_info, ifa))
27870 if (ip_idx < s_ip_idx)
27872 if (inet_fill_ifaddr(skb, ifa,
27873 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/fib_hash.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/fib_hash.c
27874 --- linux-2.6.33.1/net/ipv4/fib_hash.c 2010-02-25 11:52:10.000000000 +0100
27875 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/fib_hash.c 2010-02-25 12:02:16.000000000 +0100
27876 @@ -1016,7 +1016,7 @@ static int fib_seq_show(struct seq_file
27877 prefix = f->fn_key;
27878 mask = FZ_MASK(iter->zone);
27879 flags = fib_flag_trans(fa->fa_type, mask, fi);
27881 + if (fi && nx_dev_visible(current_nx_info(), fi->fib_dev))
27883 "%s\t%08X\t%08X\t%04X\t%d\t%u\t%d\t%08X\t%d\t%u\t%u%n",
27884 fi->fib_dev ? fi->fib_dev->name : "*", prefix,
27885 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/inet_connection_sock.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/inet_connection_sock.c
27886 --- linux-2.6.33.1/net/ipv4/inet_connection_sock.c 2010-02-25 11:52:10.000000000 +0100
27887 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/inet_connection_sock.c 2010-02-25 12:02:16.000000000 +0100
27888 @@ -49,10 +49,40 @@ void inet_get_local_port_range(int *low,
27890 EXPORT_SYMBOL(inet_get_local_port_range);
27892 +int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
27894 + __be32 sk1_rcv_saddr = inet_rcv_saddr(sk1),
27895 + sk2_rcv_saddr = inet_rcv_saddr(sk2);
27897 + if (inet_v6_ipv6only(sk2))
27900 + if (sk1_rcv_saddr &&
27902 + sk1_rcv_saddr == sk2_rcv_saddr)
27905 + if (sk1_rcv_saddr &&
27906 + !sk2_rcv_saddr &&
27907 + v4_addr_in_nx_info(sk2->sk_nx_info, sk1_rcv_saddr, NXA_MASK_BIND))
27910 + if (sk2_rcv_saddr &&
27911 + !sk1_rcv_saddr &&
27912 + v4_addr_in_nx_info(sk1->sk_nx_info, sk2_rcv_saddr, NXA_MASK_BIND))
27915 + if (!sk1_rcv_saddr &&
27916 + !sk2_rcv_saddr &&
27917 + nx_v4_addr_conflict(sk1->sk_nx_info, sk2->sk_nx_info))
27923 int inet_csk_bind_conflict(const struct sock *sk,
27924 const struct inet_bind_bucket *tb)
27926 - const __be32 sk_rcv_saddr = inet_rcv_saddr(sk);
27928 struct hlist_node *node;
27929 int reuse = sk->sk_reuse;
27930 @@ -72,9 +102,7 @@ int inet_csk_bind_conflict(const struct
27931 sk->sk_bound_dev_if == sk2->sk_bound_dev_if)) {
27932 if (!reuse || !sk2->sk_reuse ||
27933 sk2->sk_state == TCP_LISTEN) {
27934 - const __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
27935 - if (!sk2_rcv_saddr || !sk_rcv_saddr ||
27936 - sk2_rcv_saddr == sk_rcv_saddr)
27937 + if (ipv4_rcv_saddr_equal(sk, sk2))
27941 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/inet_diag.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/inet_diag.c
27942 --- linux-2.6.33.1/net/ipv4/inet_diag.c 2010-02-25 11:52:10.000000000 +0100
27943 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/inet_diag.c 2010-02-25 14:16:01.000000000 +0100
27945 #include <linux/stddef.h>
27947 #include <linux/inet_diag.h>
27948 +#include <linux/vs_network.h>
27949 +#include <linux/vs_inet.h>
27951 static const struct inet_diag_handler **inet_diag_table;
27953 @@ -118,8 +120,10 @@ static int inet_csk_diag_fill(struct soc
27955 r->id.idiag_sport = inet->inet_sport;
27956 r->id.idiag_dport = inet->inet_dport;
27957 - r->id.idiag_src[0] = inet->inet_rcv_saddr;
27958 - r->id.idiag_dst[0] = inet->inet_daddr;
27959 + r->id.idiag_src[0] = nx_map_sock_lback(sk->sk_nx_info,
27960 + inet->inet_rcv_saddr);
27961 + r->id.idiag_dst[0] = nx_map_sock_lback(sk->sk_nx_info,
27962 + inet->inet_daddr);
27964 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
27965 if (r->idiag_family == AF_INET6) {
27966 @@ -204,8 +208,8 @@ static int inet_twsk_diag_fill(struct in
27967 r->id.idiag_cookie[1] = (u32)(((unsigned long)tw >> 31) >> 1);
27968 r->id.idiag_sport = tw->tw_sport;
27969 r->id.idiag_dport = tw->tw_dport;
27970 - r->id.idiag_src[0] = tw->tw_rcv_saddr;
27971 - r->id.idiag_dst[0] = tw->tw_daddr;
27972 + r->id.idiag_src[0] = nx_map_sock_lback(tw->tw_nx_info, tw->tw_rcv_saddr);
27973 + r->id.idiag_dst[0] = nx_map_sock_lback(tw->tw_nx_info, tw->tw_daddr);
27974 r->idiag_state = tw->tw_substate;
27975 r->idiag_timer = 3;
27976 r->idiag_expires = DIV_ROUND_UP(tmo * 1000, HZ);
27977 @@ -262,6 +266,7 @@ static int inet_diag_get_exact(struct sk
27980 if (req->idiag_family == AF_INET) {
27981 + /* TODO: lback */
27982 sk = inet_lookup(&init_net, hashinfo, req->id.idiag_dst[0],
27983 req->id.idiag_dport, req->id.idiag_src[0],
27984 req->id.idiag_sport, req->id.idiag_if);
27985 @@ -504,6 +509,7 @@ static int inet_csk_diag_dump(struct soc
27989 + /* TODO: lback */
27990 entry.saddr = &inet->inet_rcv_saddr;
27991 entry.daddr = &inet->inet_daddr;
27993 @@ -540,6 +546,7 @@ static int inet_twsk_diag_dump(struct in
27997 + /* TODO: lback */
27998 entry.saddr = &tw->tw_rcv_saddr;
27999 entry.daddr = &tw->tw_daddr;
28001 @@ -586,8 +593,8 @@ static int inet_diag_fill_req(struct sk_
28003 r->id.idiag_sport = inet->inet_sport;
28004 r->id.idiag_dport = ireq->rmt_port;
28005 - r->id.idiag_src[0] = ireq->loc_addr;
28006 - r->id.idiag_dst[0] = ireq->rmt_addr;
28007 + r->id.idiag_src[0] = nx_map_sock_lback(sk->sk_nx_info, ireq->loc_addr);
28008 + r->id.idiag_dst[0] = nx_map_sock_lback(sk->sk_nx_info, ireq->rmt_addr);
28009 r->idiag_expires = jiffies_to_msecs(tmo);
28010 r->idiag_rqueue = 0;
28011 r->idiag_wqueue = 0;
28012 @@ -657,6 +664,7 @@ static int inet_diag_dump_reqs(struct sk
28016 + /* TODO: lback */
28018 #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
28019 (entry.family == AF_INET6) ?
28020 @@ -727,6 +735,8 @@ static int inet_diag_dump(struct sk_buff
28021 sk_nulls_for_each(sk, node, &ilb->head) {
28022 struct inet_sock *inet = inet_sk(sk);
28024 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28029 @@ -793,6 +803,8 @@ skip_listen_ht:
28030 sk_nulls_for_each(sk, node, &head->chain) {
28031 struct inet_sock *inet = inet_sk(sk);
28033 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28037 if (!(r->idiag_states & (1 << sk->sk_state)))
28038 @@ -817,6 +829,8 @@ next_normal:
28039 inet_twsk_for_each(tw, node,
28042 + if (!nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))
28046 if (r->id.idiag_sport != tw->tw_sport &&
28047 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/inet_hashtables.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/inet_hashtables.c
28048 --- linux-2.6.33.1/net/ipv4/inet_hashtables.c 2010-02-25 11:52:10.000000000 +0100
28049 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/inet_hashtables.c 2010-02-25 12:02:16.000000000 +0100
28052 #include <net/inet_connection_sock.h>
28053 #include <net/inet_hashtables.h>
28054 +#include <net/route.h>
28055 #include <net/ip.h>
28058 @@ -134,6 +135,11 @@ static inline int compute_score(struct s
28059 if (rcv_saddr != daddr)
28063 + /* block non nx_info ips */
28064 + if (!v4_addr_in_nx_info(sk->sk_nx_info,
28065 + daddr, NXA_MASK_BIND))
28068 if (sk->sk_bound_dev_if) {
28069 if (sk->sk_bound_dev_if != dif)
28070 @@ -151,7 +157,6 @@ static inline int compute_score(struct s
28071 * wildcarded during the search since they can never be otherwise.
28075 struct sock *__inet_lookup_listener(struct net *net,
28076 struct inet_hashinfo *hashinfo,
28077 const __be32 daddr, const unsigned short hnum,
28078 @@ -174,6 +179,7 @@ begin:
28084 * if the nulls value we got at the end of this lookup is
28085 * not the expected one, we must restart lookup.
28086 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/netfilter/nf_nat_helper.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/netfilter/nf_nat_helper.c
28087 --- linux-2.6.33.1/net/ipv4/netfilter/nf_nat_helper.c 2010-02-25 11:52:10.000000000 +0100
28088 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/netfilter/nf_nat_helper.c 2010-02-25 12:02:16.000000000 +0100
28090 #include <net/route.h>
28092 #include <linux/netfilter_ipv4.h>
28093 +#include <net/route.h>
28094 #include <net/netfilter/nf_conntrack.h>
28095 #include <net/netfilter/nf_conntrack_helper.h>
28096 #include <net/netfilter/nf_conntrack_ecache.h>
28097 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/netfilter.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/netfilter.c
28098 --- linux-2.6.33.1/net/ipv4/netfilter.c 2010-02-25 11:52:10.000000000 +0100
28099 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/netfilter.c 2010-02-25 12:02:16.000000000 +0100
28101 #include <linux/netfilter_ipv4.h>
28102 #include <linux/ip.h>
28103 #include <linux/skbuff.h>
28104 -#include <net/route.h>
28105 +// #include <net/route.h>
28106 #include <net/xfrm.h>
28107 #include <net/ip.h>
28108 #include <net/netfilter/nf_queue.h>
28109 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/raw.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/raw.c
28110 --- linux-2.6.33.1/net/ipv4/raw.c 2010-02-25 11:52:10.000000000 +0100
28111 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/raw.c 2010-02-25 14:07:52.000000000 +0100
28112 @@ -117,7 +117,7 @@ static struct sock *__raw_v4_lookup(stru
28114 if (net_eq(sock_net(sk), net) && inet->inet_num == num &&
28115 !(inet->inet_daddr && inet->inet_daddr != raddr) &&
28116 - !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) &&
28117 + v4_sock_addr_match(sk->sk_nx_info, inet, laddr) &&
28118 !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
28119 goto found; /* gotcha */
28121 @@ -382,6 +382,12 @@ static int raw_send_hdrinc(struct sock *
28122 icmp_out_count(net, ((struct icmphdr *)
28123 skb_transport_header(skb))->type);
28126 + if (!nx_check(0, VS_ADMIN) && !capable(CAP_NET_RAW) &&
28127 + sk->sk_nx_info &&
28128 + !v4_addr_in_nx_info(sk->sk_nx_info, iph->saddr, NXA_MASK_BIND))
28131 err = NF_HOOK(PF_INET, NF_INET_LOCAL_OUT, skb, NULL, rt->u.dst.dev,
28134 @@ -562,6 +568,13 @@ static int raw_sendmsg(struct kiocb *ioc
28137 security_sk_classify_flow(sk, &fl);
28138 + if (sk->sk_nx_info) {
28139 + err = ip_v4_find_src(sock_net(sk),
28140 + sk->sk_nx_info, &rt, &fl);
28145 err = ip_route_output_flow(sock_net(sk), &rt, &fl, sk, 1);
28148 @@ -634,17 +647,19 @@ static int raw_bind(struct sock *sk, str
28150 struct inet_sock *inet = inet_sk(sk);
28151 struct sockaddr_in *addr = (struct sockaddr_in *) uaddr;
28152 + struct nx_v4_sock_addr nsa = { 0 };
28156 if (sk->sk_state != TCP_CLOSE || addr_len < sizeof(struct sockaddr_in))
28158 - chk_addr_ret = inet_addr_type(sock_net(sk), addr->sin_addr.s_addr);
28159 + v4_map_sock_addr(inet, addr, &nsa);
28160 + chk_addr_ret = inet_addr_type(sock_net(sk), nsa.saddr);
28161 ret = -EADDRNOTAVAIL;
28162 - if (addr->sin_addr.s_addr && chk_addr_ret != RTN_LOCAL &&
28163 + if (nsa.saddr && chk_addr_ret != RTN_LOCAL &&
28164 chk_addr_ret != RTN_MULTICAST && chk_addr_ret != RTN_BROADCAST)
28166 - inet->inet_rcv_saddr = inet->inet_saddr = addr->sin_addr.s_addr;
28167 + v4_set_sock_addr(inet, &nsa);
28168 if (chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST)
28169 inet->inet_saddr = 0; /* Use device */
28171 @@ -696,7 +711,8 @@ static int raw_recvmsg(struct kiocb *ioc
28172 /* Copy the address. */
28174 sin->sin_family = AF_INET;
28175 - sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
28176 + sin->sin_addr.s_addr =
28177 + nx_map_sock_lback(sk->sk_nx_info, ip_hdr(skb)->saddr);
28179 memset(&sin->sin_zero, 0, sizeof(sin->sin_zero));
28181 @@ -874,7 +890,8 @@ static struct sock *raw_get_first(struct
28182 struct hlist_node *node;
28184 sk_for_each(sk, node, &state->h->ht[state->bucket])
28185 - if (sock_net(sk) == seq_file_net(seq))
28186 + if ((sock_net(sk) == seq_file_net(seq)) &&
28187 + nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28191 @@ -890,7 +907,8 @@ static struct sock *raw_get_next(struct
28195 - } while (sk && sock_net(sk) != seq_file_net(seq));
28196 + } while (sk && ((sock_net(sk) != seq_file_net(seq)) ||
28197 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
28199 if (!sk && ++state->bucket < RAW_HTABLE_SIZE) {
28200 sk = sk_head(&state->h->ht[state->bucket]);
28201 @@ -949,7 +967,10 @@ static void raw_sock_seq_show(struct seq
28203 seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
28204 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d\n",
28205 - i, src, srcp, dest, destp, sp->sk_state,
28207 + nx_map_sock_lback(current_nx_info(), src), srcp,
28208 + nx_map_sock_lback(current_nx_info(), dest), destp,
28210 sk_wmem_alloc_get(sp),
28211 sk_rmem_alloc_get(sp),
28212 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
28213 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/tcp.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/tcp.c
28214 --- linux-2.6.33.1/net/ipv4/tcp.c 2010-02-25 11:52:10.000000000 +0100
28215 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/tcp.c 2010-02-25 14:03:32.000000000 +0100
28216 @@ -265,6 +265,7 @@
28217 #include <linux/err.h>
28218 #include <linux/crypto.h>
28219 #include <linux/time.h>
28220 +#include <linux/in.h>
28222 #include <net/icmp.h>
28223 #include <net/tcp.h>
28224 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/tcp_ipv4.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/tcp_ipv4.c
28225 --- linux-2.6.33.1/net/ipv4/tcp_ipv4.c 2010-02-25 11:52:10.000000000 +0100
28226 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/tcp_ipv4.c 2010-02-25 14:08:55.000000000 +0100
28227 @@ -1988,6 +1988,12 @@ static void *listening_get_next(struct s
28228 req = req->dl_next;
28231 + vxdprintk(VXD_CBIT(net, 6),
28232 + "sk,req: %p [#%d] (from %d)", req->sk,
28233 + (req->sk)?req->sk->sk_nid:0, nx_current_nid());
28235 + !nx_check(req->sk->sk_nid, VS_WATCH_P | VS_IDENT))
28237 if (req->rsk_ops->family == st->family) {
28240 @@ -2012,6 +2018,10 @@ get_req:
28243 sk_nulls_for_each_from(sk, node) {
28244 + vxdprintk(VXD_CBIT(net, 6), "sk: %p [#%d] (from %d)",
28245 + sk, sk->sk_nid, nx_current_nid());
28246 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28248 if (sk->sk_family == st->family && net_eq(sock_net(sk), net)) {
28251 @@ -2075,6 +2085,11 @@ static void *established_get_first(struc
28253 spin_lock_bh(lock);
28254 sk_nulls_for_each(sk, node, &tcp_hashinfo.ehash[st->bucket].chain) {
28255 + vxdprintk(VXD_CBIT(net, 6),
28256 + "sk,egf: %p [#%d] (from %d)",
28257 + sk, sk->sk_nid, nx_current_nid());
28258 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28260 if (sk->sk_family != st->family ||
28261 !net_eq(sock_net(sk), net)) {
28263 @@ -2085,6 +2100,11 @@ static void *established_get_first(struc
28264 st->state = TCP_SEQ_STATE_TIME_WAIT;
28265 inet_twsk_for_each(tw, node,
28266 &tcp_hashinfo.ehash[st->bucket].twchain) {
28267 + vxdprintk(VXD_CBIT(net, 6),
28268 + "tw: %p [#%d] (from %d)",
28269 + tw, tw->tw_nid, nx_current_nid());
28270 + if (!nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))
28272 if (tw->tw_family != st->family ||
28273 !net_eq(twsk_net(tw), net)) {
28275 @@ -2113,7 +2133,9 @@ static void *established_get_next(struct
28279 - while (tw && (tw->tw_family != st->family || !net_eq(twsk_net(tw), net))) {
28280 + while (tw && (tw->tw_family != st->family ||
28281 + !net_eq(twsk_net(tw), net) ||
28282 + !nx_check(tw->tw_nid, VS_WATCH_P | VS_IDENT))) {
28286 @@ -2136,6 +2158,11 @@ get_tw:
28287 sk = sk_nulls_next(sk);
28289 sk_nulls_for_each_from(sk, node) {
28290 + vxdprintk(VXD_CBIT(net, 6),
28291 + "sk,egn: %p [#%d] (from %d)",
28292 + sk, sk->sk_nid, nx_current_nid());
28293 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28295 if (sk->sk_family == st->family && net_eq(sock_net(sk), net))
28298 @@ -2287,9 +2314,9 @@ static void get_openreq4(struct sock *sk
28299 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
28300 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %p%n",
28303 + nx_map_sock_lback(current_nx_info(), ireq->loc_addr),
28304 ntohs(inet_sk(sk)->inet_sport),
28306 + nx_map_sock_lback(current_nx_info(), ireq->rmt_addr),
28307 ntohs(ireq->rmt_port),
28309 0, 0, /* could print option size, but that is af dependent. */
28310 @@ -2341,7 +2368,10 @@ static void get_tcp4_sock(struct sock *s
28312 seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
28313 "%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
28314 - i, src, srcp, dest, destp, sk->sk_state,
28316 + nx_map_sock_lback(current_nx_info(), src), srcp,
28317 + nx_map_sock_lback(current_nx_info(), dest), destp,
28319 tp->write_seq - tp->snd_una,
28322 @@ -2376,7 +2406,10 @@ static void get_timewait4_sock(struct in
28324 seq_printf(f, "%4d: %08X:%04X %08X:%04X"
28325 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %p%n",
28326 - i, src, srcp, dest, destp, tw->tw_substate, 0, 0,
28328 + nx_map_sock_lback(current_nx_info(), src), srcp,
28329 + nx_map_sock_lback(current_nx_info(), dest), destp,
28330 + tw->tw_substate, 0, 0,
28331 3, jiffies_to_clock_t(ttd), 0, 0, 0, 0,
28332 atomic_read(&tw->tw_refcnt), tw, len);
28334 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/tcp_minisocks.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/tcp_minisocks.c
28335 --- linux-2.6.33.1/net/ipv4/tcp_minisocks.c 2010-02-25 11:52:10.000000000 +0100
28336 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/tcp_minisocks.c 2010-02-25 14:03:06.000000000 +0100
28338 #include <linux/module.h>
28339 #include <linux/sysctl.h>
28340 #include <linux/workqueue.h>
28341 +#include <linux/vs_limit.h>
28342 +#include <linux/vs_socket.h>
28343 +#include <linux/vs_context.h>
28344 #include <net/tcp.h>
28345 #include <net/inet_common.h>
28346 #include <net/xfrm.h>
28347 @@ -289,6 +292,11 @@ void tcp_time_wait(struct sock *sk, int
28348 tcptw->tw_ts_recent = tp->rx_opt.ts_recent;
28349 tcptw->tw_ts_recent_stamp = tp->rx_opt.ts_recent_stamp;
28351 + tw->tw_xid = sk->sk_xid;
28352 + tw->tw_vx_info = NULL;
28353 + tw->tw_nid = sk->sk_nid;
28354 + tw->tw_nx_info = NULL;
28356 #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
28357 if (tw->tw_family == PF_INET6) {
28358 struct ipv6_pinfo *np = inet6_sk(sk);
28359 diff -NurpP --minimal linux-2.6.33.1/net/ipv4/udp.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/udp.c
28360 --- linux-2.6.33.1/net/ipv4/udp.c 2010-02-25 11:52:10.000000000 +0100
28361 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv4/udp.c 2010-02-25 14:18:12.000000000 +0100
28362 @@ -294,14 +294,7 @@ fail:
28364 EXPORT_SYMBOL(udp_lib_get_port);
28366 -static int ipv4_rcv_saddr_equal(const struct sock *sk1, const struct sock *sk2)
28368 - struct inet_sock *inet1 = inet_sk(sk1), *inet2 = inet_sk(sk2);
28370 - return (!ipv6_only_sock(sk2) &&
28371 - (!inet1->inet_rcv_saddr || !inet2->inet_rcv_saddr ||
28372 - inet1->inet_rcv_saddr == inet2->inet_rcv_saddr));
28374 +extern int ipv4_rcv_saddr_equal(const struct sock *, const struct sock *);
28376 static unsigned int udp4_portaddr_hash(struct net *net, __be32 saddr,
28378 @@ -336,6 +329,11 @@ static inline int compute_score(struct s
28379 if (inet->inet_rcv_saddr != daddr)
28383 + /* block non nx_info ips */
28384 + if (!v4_addr_in_nx_info(sk->sk_nx_info,
28385 + daddr, NXA_MASK_BIND))
28388 if (inet->inet_daddr) {
28389 if (inet->inet_daddr != saddr)
28390 @@ -439,6 +437,7 @@ exact_match:
28395 /* UDP is nearly always wildcards out the wazoo, it makes no sense to try
28396 * harder than this. -DaveM
28398 @@ -484,6 +483,11 @@ begin:
28399 sk_nulls_for_each_rcu(sk, node, &hslot->head) {
28400 score = compute_score(sk, net, saddr, hnum, sport,
28401 daddr, dport, dif);
28402 + /* FIXME: disabled?
28403 + if (score == 9) {
28407 if (score > badness) {
28410 @@ -497,6 +501,7 @@ begin:
28411 if (get_nulls_value(node) != slot)
28416 if (unlikely(!atomic_inc_not_zero(&result->sk_refcnt)))
28418 @@ -506,6 +511,7 @@ begin:
28426 @@ -548,8 +554,7 @@ static inline struct sock *udp_v4_mcast_
28427 udp_sk(s)->udp_port_hash != hnum ||
28428 (inet->inet_daddr && inet->inet_daddr != rmt_addr) ||
28429 (inet->inet_dport != rmt_port && inet->inet_dport) ||
28430 - (inet->inet_rcv_saddr &&
28431 - inet->inet_rcv_saddr != loc_addr) ||
28432 + !v4_sock_addr_match(sk->sk_nx_info, inet, loc_addr) ||
28433 ipv6_only_sock(s) ||
28434 (s->sk_bound_dev_if && s->sk_bound_dev_if != dif))
28436 @@ -898,8 +903,13 @@ int udp_sendmsg(struct kiocb *iocb, stru
28437 { .sport = inet->inet_sport,
28438 .dport = dport } } };
28439 struct net *net = sock_net(sk);
28440 + struct nx_info *nxi = sk->sk_nx_info;
28442 security_sk_classify_flow(sk, &fl);
28443 + err = ip_v4_find_src(net, nxi, &rt, &fl);
28447 err = ip_route_output_flow(net, &rt, &fl, sk, 1);
28449 if (err == -ENETUNREACH)
28450 @@ -1180,7 +1190,8 @@ try_again:
28452 sin->sin_family = AF_INET;
28453 sin->sin_port = udp_hdr(skb)->source;
28454 - sin->sin_addr.s_addr = ip_hdr(skb)->saddr;
28455 + sin->sin_addr.s_addr = nx_map_sock_lback(
28456 + skb->sk->sk_nx_info, ip_hdr(skb)->saddr);
28457 memset(sin->sin_zero, 0, sizeof(sin->sin_zero));
28459 if (inet->cmsg_flags)
28460 @@ -1865,6 +1876,8 @@ static struct sock *udp_get_first(struct
28461 sk_nulls_for_each(sk, node, &hslot->head) {
28462 if (!net_eq(sock_net(sk), net))
28464 + if (!nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT))
28466 if (sk->sk_family == state->family)
28469 @@ -1882,7 +1895,9 @@ static struct sock *udp_get_next(struct
28472 sk = sk_nulls_next(sk);
28473 - } while (sk && (!net_eq(sock_net(sk), net) || sk->sk_family != state->family));
28474 + } while (sk && (!net_eq(sock_net(sk), net) ||
28475 + sk->sk_family != state->family ||
28476 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)));
28479 if (state->bucket <= state->udp_table->mask)
28480 @@ -1989,7 +2004,10 @@ static void udp4_format_sock(struct sock
28482 seq_printf(f, "%5d: %08X:%04X %08X:%04X"
28483 " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %d%n",
28484 - bucket, src, srcp, dest, destp, sp->sk_state,
28486 + nx_map_sock_lback(current_nx_info(), src), srcp,
28487 + nx_map_sock_lback(current_nx_info(), dest), destp,
28489 sk_wmem_alloc_get(sp),
28490 sk_rmem_alloc_get(sp),
28491 0, 0L, 0, sock_i_uid(sp), 0, sock_i_ino(sp),
28492 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/addrconf.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/addrconf.c
28493 --- linux-2.6.33.1/net/ipv6/addrconf.c 2010-02-25 11:52:10.000000000 +0100
28494 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/addrconf.c 2010-02-25 13:40:38.000000000 +0100
28497 #include <linux/proc_fs.h>
28498 #include <linux/seq_file.h>
28499 +#include <linux/vs_network.h>
28500 +#include <linux/vs_inet6.h>
28502 /* Set to 3 to get tracing... */
28503 #define ACONF_DEBUG 2
28504 @@ -1120,7 +1122,7 @@ out:
28506 int ipv6_dev_get_saddr(struct net *net, struct net_device *dst_dev,
28507 const struct in6_addr *daddr, unsigned int prefs,
28508 - struct in6_addr *saddr)
28509 + struct in6_addr *saddr, struct nx_info *nxi)
28511 struct ipv6_saddr_score scores[2],
28512 *score = &scores[0], *hiscore = &scores[1];
28513 @@ -1192,6 +1194,8 @@ int ipv6_dev_get_saddr(struct net *net,
28517 + if (!v6_addr_in_nx_info(nxi, &score->ifa->addr, -1))
28521 bitmap_zero(score->scorebits, IPV6_SADDR_RULE_MAX);
28522 @@ -2999,7 +3003,10 @@ static void if6_seq_stop(struct seq_file
28523 static int if6_seq_show(struct seq_file *seq, void *v)
28525 struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v;
28526 - seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
28528 + if (nx_check(0, VS_ADMIN|VS_WATCH) ||
28529 + v6_addr_in_nx_info(current_nx_info(), &ifp->addr, -1))
28530 + seq_printf(seq, "%pi6 %02x %02x %02x %02x %8s\n",
28532 ifp->idev->dev->ifindex,
28534 @@ -3494,6 +3501,11 @@ static int in6_dump_addrs(struct inet6_d
28535 struct ifacaddr6 *ifaca;
28537 int ip_idx = *p_ip_idx;
28538 + struct nx_info *nxi = skb->sk ? skb->sk->sk_nx_info : NULL;
28540 + /* disable ipv6 on non v6 guests */
28541 + if (nxi && !nx_info_has_v6(nxi))
28544 read_lock_bh(&idev->lock);
28546 @@ -3503,6 +3515,8 @@ static int in6_dump_addrs(struct inet6_d
28547 ifa = ifa->if_next, ip_idx++) {
28548 if (ip_idx < s_ip_idx)
28550 + if (!v6_addr_in_nx_info(nxi, &ifa->addr, -1))
28552 err = inet6_fill_ifaddr(skb, ifa,
28553 NETLINK_CB(cb->skb).pid,
28554 cb->nlh->nlmsg_seq,
28555 @@ -3518,6 +3532,8 @@ static int in6_dump_addrs(struct inet6_d
28556 ifmca = ifmca->next, ip_idx++) {
28557 if (ip_idx < s_ip_idx)
28559 + if (!v6_addr_in_nx_info(nxi, &ifmca->mca_addr, -1))
28561 err = inet6_fill_ifmcaddr(skb, ifmca,
28562 NETLINK_CB(cb->skb).pid,
28563 cb->nlh->nlmsg_seq,
28564 @@ -3533,6 +3549,8 @@ static int in6_dump_addrs(struct inet6_d
28565 ifaca = ifaca->aca_next, ip_idx++) {
28566 if (ip_idx < s_ip_idx)
28568 + if (!v6_addr_in_nx_info(nxi, &ifaca->aca_addr, -1))
28570 err = inet6_fill_ifacaddr(skb, ifaca,
28571 NETLINK_CB(cb->skb).pid,
28572 cb->nlh->nlmsg_seq,
28573 @@ -3861,6 +3879,11 @@ static int inet6_dump_ifinfo(struct sk_b
28574 struct inet6_dev *idev;
28575 struct hlist_head *head;
28576 struct hlist_node *node;
28577 + struct nx_info *nxi = skb->sk ? skb->sk->sk_nx_info : NULL;
28579 + /* FIXME: maybe disable ipv6 on non v6 guests?
28580 + if (skb->sk && skb->sk->sk_vx_info)
28581 + return skb->len; */
28584 s_idx = cb->args[1];
28585 @@ -3872,6 +3895,8 @@ static int inet6_dump_ifinfo(struct sk_b
28586 hlist_for_each_entry_rcu(dev, node, head, index_hlist) {
28589 + if (!v6_dev_in_nx_info(dev, nxi))
28591 idev = __in6_dev_get(dev);
28594 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/af_inet6.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/af_inet6.c
28595 --- linux-2.6.33.1/net/ipv6/af_inet6.c 2010-02-25 11:52:10.000000000 +0100
28596 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/af_inet6.c 2010-02-25 15:54:53.000000000 +0100
28598 #include <linux/netdevice.h>
28599 #include <linux/icmpv6.h>
28600 #include <linux/netfilter_ipv6.h>
28601 +#include <linux/vs_inet.h>
28602 +#include <linux/vs_inet6.h>
28604 #include <net/ip.h>
28605 #include <net/ipv6.h>
28606 @@ -159,9 +161,12 @@ lookup_protocol:
28610 + if ((protocol == IPPROTO_ICMPV6) &&
28611 + nx_capable(CAP_NET_RAW, NXC_RAW_ICMP))
28613 if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW))
28614 goto out_rcu_unlock;
28617 sock->ops = answer->ops;
28618 answer_prot = answer->prot;
28619 answer_no_check = answer->no_check;
28620 @@ -260,6 +265,7 @@ int inet6_bind(struct socket *sock, stru
28621 struct inet_sock *inet = inet_sk(sk);
28622 struct ipv6_pinfo *np = inet6_sk(sk);
28623 struct net *net = sock_net(sk);
28624 + struct nx_v6_sock_addr nsa;
28626 unsigned short snum;
28628 @@ -271,6 +277,11 @@ int inet6_bind(struct socket *sock, stru
28630 if (addr_len < SIN6_LEN_RFC2133)
28633 + err = v6_map_sock_addr(inet, addr, &nsa);
28637 addr_type = ipv6_addr_type(&addr->sin6_addr);
28638 if ((addr_type & IPV6_ADDR_MULTICAST) && sock->type == SOCK_STREAM)
28640 @@ -302,6 +313,7 @@ int inet6_bind(struct socket *sock, stru
28641 /* Reproduce AF_INET checks to make the bindings consitant */
28642 v4addr = addr->sin6_addr.s6_addr32[3];
28643 chk_addr_ret = inet_addr_type(net, v4addr);
28645 if (!sysctl_ip_nonlocal_bind &&
28646 !(inet->freebind || inet->transparent) &&
28647 v4addr != htonl(INADDR_ANY) &&
28648 @@ -311,6 +323,10 @@ int inet6_bind(struct socket *sock, stru
28649 err = -EADDRNOTAVAIL;
28652 + if (!v4_addr_in_nx_info(sk->sk_nx_info, v4addr, NXA_MASK_BIND)) {
28653 + err = -EADDRNOTAVAIL;
28657 if (addr_type != IPV6_ADDR_ANY) {
28658 struct net_device *dev = NULL;
28659 @@ -337,6 +353,11 @@ int inet6_bind(struct socket *sock, stru
28663 + if (!v6_addr_in_nx_info(sk->sk_nx_info, &addr->sin6_addr, -1)) {
28664 + err = -EADDRNOTAVAIL;
28668 /* ipv4 addr of the socket is invalid. Only the
28669 * unspecified and mapped address have a v4 equivalent.
28671 @@ -352,6 +373,9 @@ int inet6_bind(struct socket *sock, stru
28675 + /* what's that for? */
28676 + v6_set_sock_addr(inet, &nsa);
28678 inet->inet_rcv_saddr = v4addr;
28679 inet->inet_saddr = v4addr;
28681 @@ -450,9 +474,11 @@ int inet6_getname(struct socket *sock, s
28683 sin->sin6_port = inet->inet_dport;
28684 ipv6_addr_copy(&sin->sin6_addr, &np->daddr);
28685 + /* FIXME: remap lback? */
28687 sin->sin6_flowinfo = np->flow_label;
28689 + /* FIXME: remap lback? */
28690 if (ipv6_addr_any(&np->rcv_saddr))
28691 ipv6_addr_copy(&sin->sin6_addr, &np->saddr);
28693 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/fib6_rules.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/fib6_rules.c
28694 --- linux-2.6.33.1/net/ipv6/fib6_rules.c 2010-02-25 11:52:10.000000000 +0100
28695 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/fib6_rules.c 2010-02-25 12:02:16.000000000 +0100
28696 @@ -96,7 +96,7 @@ static int fib6_rule_action(struct fib_r
28697 if (ipv6_dev_get_saddr(net,
28698 ip6_dst_idev(&rt->u.dst)->dev,
28699 &flp->fl6_dst, srcprefs,
28703 if (!ipv6_prefix_equal(&saddr, &r->src.addr,
28705 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/inet6_hashtables.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/inet6_hashtables.c
28706 --- linux-2.6.33.1/net/ipv6/inet6_hashtables.c 2010-02-25 11:52:10.000000000 +0100
28707 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/inet6_hashtables.c 2010-02-25 12:02:16.000000000 +0100
28710 #include <linux/module.h>
28711 #include <linux/random.h>
28712 +#include <linux/vs_inet6.h>
28714 #include <net/inet_connection_sock.h>
28715 #include <net/inet_hashtables.h>
28716 @@ -82,7 +83,6 @@ struct sock *__inet6_lookup_established(
28717 unsigned int slot = hash & hashinfo->ehash_mask;
28718 struct inet_ehash_bucket *head = &hashinfo->ehash[slot];
28723 sk_nulls_for_each_rcu(sk, node, &head->chain) {
28724 @@ -94,7 +94,7 @@ begin:
28732 if (get_nulls_value(node) != slot)
28733 @@ -140,6 +140,9 @@ static int inline compute_score(struct s
28734 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
28738 + if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
28741 if (sk->sk_bound_dev_if) {
28742 if (sk->sk_bound_dev_if != dif)
28743 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/ip6_output.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/ip6_output.c
28744 --- linux-2.6.33.1/net/ipv6/ip6_output.c 2010-02-25 11:52:10.000000000 +0100
28745 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/ip6_output.c 2010-02-25 12:02:16.000000000 +0100
28746 @@ -933,7 +933,7 @@ static int ip6_dst_lookup_tail(struct so
28747 err = ipv6_dev_get_saddr(net, ip6_dst_idev(*dst)->dev,
28749 sk ? inet6_sk(sk)->srcprefs : 0,
28751 + &fl->fl6_src, sk->sk_nx_info);
28753 goto out_err_release;
28755 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/Kconfig linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/Kconfig
28756 --- linux-2.6.33.1/net/ipv6/Kconfig 2010-02-25 11:52:10.000000000 +0100
28757 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/Kconfig 2010-02-25 12:02:16.000000000 +0100
28760 # IPv6 as module will cause a CRASH if you try to unload it
28762 - tristate "The IPv6 protocol"
28764 + bool "The IPv6 protocol"
28767 This is complemental support for the IP version 6.
28768 You will still be able to do traditional IPv4 networking as well.
28769 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/ndisc.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/ndisc.c
28770 --- linux-2.6.33.1/net/ipv6/ndisc.c 2010-02-25 11:52:10.000000000 +0100
28771 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/ndisc.c 2010-02-25 12:02:16.000000000 +0100
28772 @@ -589,7 +589,7 @@ static void ndisc_send_na(struct net_dev
28774 if (ipv6_dev_get_saddr(dev_net(dev), dev, daddr,
28775 inet6_sk(dev_net(dev)->ipv6.ndisc_sk)->srcprefs,
28777 + &tmpaddr, NULL /* FIXME: ? */ ))
28779 src_addr = &tmpaddr;
28781 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/raw.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/raw.c
28782 --- linux-2.6.33.1/net/ipv6/raw.c 2010-02-25 11:52:11.000000000 +0100
28783 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/raw.c 2010-02-25 12:02:16.000000000 +0100
28785 #include <linux/icmpv6.h>
28786 #include <linux/netfilter.h>
28787 #include <linux/netfilter_ipv6.h>
28788 +#include <linux/vs_inet6.h>
28789 #include <linux/skbuff.h>
28790 #include <asm/uaccess.h>
28791 #include <asm/ioctls.h>
28792 @@ -282,6 +283,13 @@ static int rawv6_bind(struct sock *sk, s
28796 + if (!v6_addr_in_nx_info(sk->sk_nx_info, &addr->sin6_addr, -1)) {
28797 + err = -EADDRNOTAVAIL;
28803 /* ipv4 addr of the socket is invalid. Only the
28804 * unspecified and mapped address have a v4 equivalent.
28806 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/route.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/route.c
28807 --- linux-2.6.33.1/net/ipv6/route.c 2010-02-25 11:52:11.000000000 +0100
28808 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/route.c 2010-02-25 12:02:16.000000000 +0100
28809 @@ -2258,7 +2258,8 @@ static int rt6_fill_node(struct net *net
28810 struct inet6_dev *idev = ip6_dst_idev(&rt->u.dst);
28811 struct in6_addr saddr_buf;
28812 if (ipv6_dev_get_saddr(net, idev ? idev->dev : NULL,
28813 - dst, 0, &saddr_buf) == 0)
28814 + dst, 0, &saddr_buf,
28815 + (skb->sk ? skb->sk->sk_nx_info : NULL)) == 0)
28816 NLA_PUT(skb, RTA_PREFSRC, 16, &saddr_buf);
28819 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/tcp_ipv6.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/tcp_ipv6.c
28820 --- linux-2.6.33.1/net/ipv6/tcp_ipv6.c 2010-02-25 11:52:11.000000000 +0100
28821 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/tcp_ipv6.c 2010-02-25 12:02:16.000000000 +0100
28824 #include <linux/crypto.h>
28825 #include <linux/scatterlist.h>
28826 +#include <linux/vs_inet6.h>
28828 static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb);
28829 static void tcp_v6_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
28830 @@ -156,8 +157,15 @@ static int tcp_v6_connect(struct sock *s
28831 * connect() to INADDR_ANY means loopback (BSD'ism).
28834 - if(ipv6_addr_any(&usin->sin6_addr))
28835 - usin->sin6_addr.s6_addr[15] = 0x1;
28836 + if(ipv6_addr_any(&usin->sin6_addr)) {
28837 + struct nx_info *nxi = sk->sk_nx_info;
28839 + if (nxi && nx_info_has_v6(nxi))
28840 + /* FIXME: remap lback? */
28841 + usin->sin6_addr = nxi->v6.ip;
28843 + usin->sin6_addr.s6_addr[15] = 0x1;
28846 addr_type = ipv6_addr_type(&usin->sin6_addr);
28848 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/udp.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/udp.c
28849 --- linux-2.6.33.1/net/ipv6/udp.c 2010-02-25 11:52:11.000000000 +0100
28850 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/udp.c 2010-02-25 15:58:22.000000000 +0100
28851 @@ -47,13 +47,14 @@
28853 #include <linux/proc_fs.h>
28854 #include <linux/seq_file.h>
28855 +#include <linux/vs_inet6.h>
28856 #include "udp_impl.h"
28858 int ipv6_rcv_saddr_equal(const struct sock *sk, const struct sock *sk2)
28860 const struct in6_addr *sk_rcv_saddr6 = &inet6_sk(sk)->rcv_saddr;
28861 const struct in6_addr *sk2_rcv_saddr6 = inet6_rcv_saddr(sk2);
28862 - __be32 sk1_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
28863 + __be32 sk_rcv_saddr = inet_sk(sk)->inet_rcv_saddr;
28864 __be32 sk2_rcv_saddr = inet_rcv_saddr(sk2);
28865 int sk_ipv6only = ipv6_only_sock(sk);
28866 int sk2_ipv6only = inet_v6_ipv6only(sk2);
28867 @@ -61,24 +62,49 @@ int ipv6_rcv_saddr_equal(const struct so
28868 int addr_type2 = sk2_rcv_saddr6 ? ipv6_addr_type(sk2_rcv_saddr6) : IPV6_ADDR_MAPPED;
28870 /* if both are mapped, treat as IPv4 */
28871 - if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED)
28872 - return (!sk2_ipv6only &&
28873 - (!sk1_rcv_saddr || !sk2_rcv_saddr ||
28874 - sk1_rcv_saddr == sk2_rcv_saddr));
28875 + if (addr_type == IPV6_ADDR_MAPPED && addr_type2 == IPV6_ADDR_MAPPED) {
28876 + if (!sk2_ipv6only &&
28877 + (!sk_rcv_saddr || !sk2_rcv_saddr ||
28878 + sk_rcv_saddr == sk2_rcv_saddr))
28884 if (addr_type2 == IPV6_ADDR_ANY &&
28885 !(sk2_ipv6only && addr_type == IPV6_ADDR_MAPPED))
28889 if (addr_type == IPV6_ADDR_ANY &&
28890 !(sk_ipv6only && addr_type2 == IPV6_ADDR_MAPPED))
28894 if (sk2_rcv_saddr6 &&
28895 ipv6_addr_equal(sk_rcv_saddr6, sk2_rcv_saddr6))
28902 + if (!sk_rcv_saddr && !sk2_rcv_saddr)
28903 + return nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28904 + if (!sk2_rcv_saddr)
28905 + return v4_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr, -1);
28906 + if (!sk_rcv_saddr)
28907 + return v4_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr, -1);
28910 + if (addr_type2 == IPV6_ADDR_ANY && addr_type == IPV6_ADDR_ANY)
28911 + return nx_v6_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28912 + else if (addr_type2 == IPV6_ADDR_ANY)
28913 + return v6_addr_in_nx_info(sk2->sk_nx_info, sk_rcv_saddr6, -1);
28914 + else if (addr_type == IPV6_ADDR_ANY) {
28915 + if (addr_type2 == IPV6_ADDR_MAPPED)
28916 + return nx_v4_addr_conflict(sk->sk_nx_info, sk2->sk_nx_info);
28918 + return v6_addr_in_nx_info(sk->sk_nx_info, sk2_rcv_saddr6, -1);
28923 static unsigned int udp6_portaddr_hash(struct net *net,
28924 @@ -133,6 +159,10 @@ static inline int compute_score(struct s
28925 if (!ipv6_addr_equal(&np->rcv_saddr, daddr))
28929 + /* block non nx_info ips */
28930 + if (!v6_addr_in_nx_info(sk->sk_nx_info, daddr, -1))
28933 if (!ipv6_addr_any(&np->daddr)) {
28934 if (!ipv6_addr_equal(&np->daddr, saddr))
28935 diff -NurpP --minimal linux-2.6.33.1/net/ipv6/xfrm6_policy.c linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/xfrm6_policy.c
28936 --- linux-2.6.33.1/net/ipv6/xfrm6_policy.c 2010-02-25 11:52:11.000000000 +0100
28937 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/ipv6/xfrm6_policy.c 2010-02-25 12:02:16.000000000 +0100
28938 @@ -62,7 +62,7 @@ static int xfrm6_get_saddr(struct net *n
28939 dev = ip6_dst_idev(dst)->dev;
28940 ipv6_dev_get_saddr(dev_net(dev), dev,
28941 (struct in6_addr *)&daddr->a6, 0,
28942 - (struct in6_addr *)&saddr->a6);
28943 + (struct in6_addr *)&saddr->a6, NULL);
28947 diff -NurpP --minimal linux-2.6.33.1/net/netlink/af_netlink.c linux-2.6.33.1-vs2.3.0.36.30.4/net/netlink/af_netlink.c
28948 --- linux-2.6.33.1/net/netlink/af_netlink.c 2010-02-25 11:52:11.000000000 +0100
28949 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/netlink/af_netlink.c 2010-02-25 12:02:16.000000000 +0100
28951 #include <linux/types.h>
28952 #include <linux/audit.h>
28953 #include <linux/mutex.h>
28954 +#include <linux/vs_context.h>
28955 +#include <linux/vs_network.h>
28956 +#include <linux/vs_limit.h>
28958 #include <net/net_namespace.h>
28959 #include <net/sock.h>
28960 @@ -1905,6 +1908,8 @@ static struct sock *netlink_seq_socket_i
28961 sk_for_each(s, node, &hash->table[j]) {
28962 if (sock_net(s) != seq_file_net(seq))
28964 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
28968 iter->hash_idx = j;
28969 @@ -1939,7 +1944,8 @@ static void *netlink_seq_next(struct seq
28973 - } while (s && sock_net(s) != seq_file_net(seq));
28974 + } while (s && (sock_net(s) != seq_file_net(seq) ||
28975 + !nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT)));
28979 @@ -1951,7 +1957,8 @@ static void *netlink_seq_next(struct seq
28981 for (; j <= hash->mask; j++) {
28982 s = sk_head(&hash->table[j]);
28983 - while (s && sock_net(s) != seq_file_net(seq))
28984 + while (s && (sock_net(s) != seq_file_net(seq) ||
28985 + !nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT)))
28989 diff -NurpP --minimal linux-2.6.33.1/net/sctp/ipv6.c linux-2.6.33.1-vs2.3.0.36.30.4/net/sctp/ipv6.c
28990 --- linux-2.6.33.1/net/sctp/ipv6.c 2010-02-25 11:52:12.000000000 +0100
28991 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/sctp/ipv6.c 2010-02-25 12:02:16.000000000 +0100
28992 @@ -316,7 +316,8 @@ static void sctp_v6_get_saddr(struct sct
28993 dst ? ip6_dst_idev(dst)->dev : NULL,
28994 &daddr->v6.sin6_addr,
28995 inet6_sk(&sk->inet.sk)->srcprefs,
28996 - &saddr->v6.sin6_addr);
28997 + &saddr->v6.sin6_addr,
28998 + asoc->base.sk->sk_nx_info);
28999 SCTP_DEBUG_PRINTK("saddr from ipv6_get_saddr: %pI6\n",
29000 &saddr->v6.sin6_addr);
29002 diff -NurpP --minimal linux-2.6.33.1/net/socket.c linux-2.6.33.1-vs2.3.0.36.30.4/net/socket.c
29003 --- linux-2.6.33.1/net/socket.c 2010-02-25 11:52:12.000000000 +0100
29004 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/socket.c 2010-02-25 13:51:25.000000000 +0100
29007 #include <net/sock.h>
29008 #include <linux/netfilter.h>
29009 +#include <linux/vs_base.h>
29010 +#include <linux/vs_socket.h>
29011 +#include <linux/vs_inet.h>
29012 +#include <linux/vs_inet6.h>
29014 #include <linux/if_tun.h>
29015 #include <linux/ipv6_route.h>
29016 @@ -539,7 +543,7 @@ static inline int __sock_sendmsg(struct
29017 struct msghdr *msg, size_t size)
29019 struct sock_iocb *si = kiocb_to_siocb(iocb);
29025 @@ -550,7 +554,22 @@ static inline int __sock_sendmsg(struct
29029 - return sock->ops->sendmsg(iocb, sock, msg, size);
29030 + len = sock->ops->sendmsg(iocb, sock, msg, size);
29033 + vx_sock_send(sock->sk, size);
29035 + vx_sock_fail(sock->sk, size);
29037 + vxdprintk(VXD_CBIT(net, 7),
29038 + "__sock_sendmsg: %p[%p,%p,%p;%d/%d]:%d/%d",
29040 + (sock->sk)?sock->sk->sk_nx_info:0,
29041 + (sock->sk)?sock->sk->sk_vx_info:0,
29042 + (sock->sk)?sock->sk->sk_xid:0,
29043 + (sock->sk)?sock->sk->sk_nid:0,
29044 + (unsigned int)size, len);
29048 int sock_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
29049 @@ -667,6 +686,7 @@ static inline int __sock_recvmsg_nosec(s
29050 struct msghdr *msg, size_t size, int flags)
29052 struct sock_iocb *si = kiocb_to_siocb(iocb);
29057 @@ -674,7 +694,18 @@ static inline int __sock_recvmsg_nosec(s
29061 - return sock->ops->recvmsg(iocb, sock, msg, size, flags);
29062 + len = sock->ops->recvmsg(iocb, sock, msg, size, flags);
29063 + if ((len >= 0) && sock->sk)
29064 + vx_sock_recv(sock->sk, len);
29065 + vxdprintk(VXD_CBIT(net, 7),
29066 + "__sock_recvmsg: %p[%p,%p,%p;%d/%d]:%d/%d",
29068 + (sock->sk)?sock->sk->sk_nx_info:0,
29069 + (sock->sk)?sock->sk->sk_vx_info:0,
29070 + (sock->sk)?sock->sk->sk_xid:0,
29071 + (sock->sk)?sock->sk->sk_nid:0,
29072 + (unsigned int)size, len);
29076 static inline int __sock_recvmsg(struct kiocb *iocb, struct socket *sock,
29077 @@ -1182,6 +1213,13 @@ static int __sock_create(struct net *net
29078 if (type < 0 || type >= SOCK_MAX)
29081 + if (!nx_check(0, VS_ADMIN)) {
29082 + if (family == PF_INET && !current_nx_info_has_v4())
29083 + return -EAFNOSUPPORT;
29084 + if (family == PF_INET6 && !current_nx_info_has_v6())
29085 + return -EAFNOSUPPORT;
29090 This uglymoron is moved from INET layer to here to avoid
29091 @@ -1314,6 +1352,7 @@ SYSCALL_DEFINE3(socket, int, family, int
29095 + set_bit(SOCK_USER_SOCKET, &sock->flags);
29096 retval = sock_map_fd(sock, flags & (O_CLOEXEC | O_NONBLOCK));
29099 @@ -1355,10 +1394,12 @@ SYSCALL_DEFINE4(socketpair, int, family,
29100 err = sock_create(family, type, protocol, &sock1);
29103 + set_bit(SOCK_USER_SOCKET, &sock1->flags);
29105 err = sock_create(family, type, protocol, &sock2);
29107 goto out_release_1;
29108 + set_bit(SOCK_USER_SOCKET, &sock2->flags);
29110 err = sock1->ops->socketpair(sock1, sock2);
29112 diff -NurpP --minimal linux-2.6.33.1/net/sunrpc/auth.c linux-2.6.33.1-vs2.3.0.36.30.4/net/sunrpc/auth.c
29113 --- linux-2.6.33.1/net/sunrpc/auth.c 2010-02-25 11:52:12.000000000 +0100
29114 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/sunrpc/auth.c 2010-02-25 12:02:16.000000000 +0100
29116 #include <linux/hash.h>
29117 #include <linux/sunrpc/clnt.h>
29118 #include <linux/spinlock.h>
29119 +#include <linux/vs_tag.h>
29122 # define RPCDBG_FACILITY RPCDBG_AUTH
29123 @@ -363,6 +364,7 @@ rpcauth_lookupcred(struct rpc_auth *auth
29124 memset(&acred, 0, sizeof(acred));
29125 acred.uid = cred->fsuid;
29126 acred.gid = cred->fsgid;
29127 + acred.tag = dx_current_tag();
29128 acred.group_info = get_group_info(((struct cred *)cred)->group_info);
29130 ret = auth->au_ops->lookup_cred(auth, &acred, flags);
29131 @@ -403,6 +405,7 @@ rpcauth_bind_root_cred(struct rpc_task *
29132 struct auth_cred acred = {
29135 + .tag = dx_current_tag(),
29137 struct rpc_cred *ret;
29139 diff -NurpP --minimal linux-2.6.33.1/net/sunrpc/auth_unix.c linux-2.6.33.1-vs2.3.0.36.30.4/net/sunrpc/auth_unix.c
29140 --- linux-2.6.33.1/net/sunrpc/auth_unix.c 2008-12-25 00:26:37.000000000 +0100
29141 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/sunrpc/auth_unix.c 2010-02-25 12:02:16.000000000 +0100
29142 @@ -11,12 +11,14 @@
29143 #include <linux/module.h>
29144 #include <linux/sunrpc/clnt.h>
29145 #include <linux/sunrpc/auth.h>
29146 +#include <linux/vs_tag.h>
29148 #define NFS_NGROUPS 16
29151 struct rpc_cred uc_base;
29154 gid_t uc_gids[NFS_NGROUPS];
29156 #define uc_uid uc_base.cr_uid
29157 @@ -78,6 +80,7 @@ unx_create_cred(struct rpc_auth *auth, s
29158 groups = NFS_NGROUPS;
29160 cred->uc_gid = acred->gid;
29161 + cred->uc_tag = acred->tag;
29162 for (i = 0; i < groups; i++)
29163 cred->uc_gids[i] = GROUP_AT(acred->group_info, i);
29164 if (i < NFS_NGROUPS)
29165 @@ -119,7 +122,9 @@ unx_match(struct auth_cred *acred, struc
29169 - if (cred->uc_uid != acred->uid || cred->uc_gid != acred->gid)
29170 + if (cred->uc_uid != acred->uid ||
29171 + cred->uc_gid != acred->gid ||
29172 + cred->uc_tag != acred->tag)
29175 if (acred->group_info != NULL)
29176 @@ -142,7 +147,7 @@ unx_marshal(struct rpc_task *task, __be3
29177 struct rpc_clnt *clnt = task->tk_client;
29178 struct unx_cred *cred = container_of(task->tk_msg.rpc_cred, struct unx_cred, uc_base);
29179 __be32 *base, *hold;
29183 *p++ = htonl(RPC_AUTH_UNIX);
29185 @@ -152,9 +157,12 @@ unx_marshal(struct rpc_task *task, __be3
29186 * Copy the UTS nodename captured when the client was created.
29188 p = xdr_encode_array(p, clnt->cl_nodename, clnt->cl_nodelen);
29189 + tag = task->tk_client->cl_tag;
29191 - *p++ = htonl((u32) cred->uc_uid);
29192 - *p++ = htonl((u32) cred->uc_gid);
29193 + *p++ = htonl((u32) TAGINO_UID(tag,
29194 + cred->uc_uid, cred->uc_tag));
29195 + *p++ = htonl((u32) TAGINO_GID(tag,
29196 + cred->uc_gid, cred->uc_tag));
29198 for (i = 0; i < 16 && cred->uc_gids[i] != (gid_t) NOGROUP; i++)
29199 *p++ = htonl((u32) cred->uc_gids[i]);
29200 diff -NurpP --minimal linux-2.6.33.1/net/sunrpc/clnt.c linux-2.6.33.1-vs2.3.0.36.30.4/net/sunrpc/clnt.c
29201 --- linux-2.6.33.1/net/sunrpc/clnt.c 2010-02-25 11:52:12.000000000 +0100
29202 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/sunrpc/clnt.c 2010-02-25 12:02:16.000000000 +0100
29204 #include <linux/utsname.h>
29205 #include <linux/workqueue.h>
29206 #include <linux/in6.h>
29207 +#include <linux/vs_cvirt.h>
29209 #include <linux/sunrpc/clnt.h>
29210 #include <linux/sunrpc/rpc_pipe_fs.h>
29211 @@ -358,6 +359,9 @@ struct rpc_clnt *rpc_create(struct rpc_c
29212 if (!(args->flags & RPC_CLNT_CREATE_QUIET))
29213 clnt->cl_chatty = 1;
29215 + /* TODO: handle RPC_CLNT_CREATE_TAGGED
29216 + if (args->flags & RPC_CLNT_CREATE_TAGGED)
29217 + clnt->cl_tag = 1; */
29220 EXPORT_SYMBOL_GPL(rpc_create);
29221 diff -NurpP --minimal linux-2.6.33.1/net/unix/af_unix.c linux-2.6.33.1-vs2.3.0.36.30.4/net/unix/af_unix.c
29222 --- linux-2.6.33.1/net/unix/af_unix.c 2010-02-25 11:52:12.000000000 +0100
29223 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/unix/af_unix.c 2010-02-25 12:02:16.000000000 +0100
29224 @@ -114,6 +114,8 @@
29225 #include <linux/mount.h>
29226 #include <net/checksum.h>
29227 #include <linux/security.h>
29228 +#include <linux/vs_context.h>
29229 +#include <linux/vs_limit.h>
29231 static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
29232 static DEFINE_SPINLOCK(unix_table_lock);
29233 @@ -258,6 +260,8 @@ static struct sock *__unix_find_socket_b
29234 if (!net_eq(sock_net(s), net))
29237 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
29239 if (u->addr->len == len &&
29240 !memcmp(u->addr->name, sunname, len))
29242 @@ -2115,6 +2119,8 @@ static struct sock *unix_seq_idx(struct
29243 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) {
29244 if (sock_net(s) != seq_file_net(seq))
29246 + if (!nx_check(s->sk_nid, VS_WATCH_P | VS_IDENT))
29251 @@ -2139,7 +2145,8 @@ static void *unix_seq_next(struct seq_fi
29252 sk = first_unix_socket(&iter->i);
29254 sk = next_unix_socket(&iter->i, sk);
29255 - while (sk && (sock_net(sk) != seq_file_net(seq)))
29256 + while (sk && (sock_net(sk) != seq_file_net(seq) ||
29257 + !nx_check(sk->sk_nid, VS_WATCH_P | VS_IDENT)))
29258 sk = next_unix_socket(&iter->i, sk);
29261 diff -NurpP --minimal linux-2.6.33.1/net/x25/af_x25.c linux-2.6.33.1-vs2.3.0.36.30.4/net/x25/af_x25.c
29262 --- linux-2.6.33.1/net/x25/af_x25.c 2010-02-25 11:52:12.000000000 +0100
29263 +++ linux-2.6.33.1-vs2.3.0.36.30.4/net/x25/af_x25.c 2010-02-25 12:02:16.000000000 +0100
29264 @@ -526,7 +526,10 @@ static int x25_create(struct net *net, s
29268 - sock_init_data(sock, sk);
29269 + sk->sk_socket = sock;
29270 + sk->sk_type = sock->type;
29271 + sk->sk_sleep = &sock->wait;
29274 x25_init_timers(sk);
29276 diff -NurpP --minimal linux-2.6.33.1/scripts/checksyscalls.sh linux-2.6.33.1-vs2.3.0.36.30.4/scripts/checksyscalls.sh
29277 --- linux-2.6.33.1/scripts/checksyscalls.sh 2009-09-10 15:26:31.000000000 +0200
29278 +++ linux-2.6.33.1-vs2.3.0.36.30.4/scripts/checksyscalls.sh 2010-02-25 12:02:16.000000000 +0100
29279 @@ -194,7 +194,6 @@ cat << EOF
29280 #define __IGNORE_afs_syscall
29281 #define __IGNORE_getpmsg
29282 #define __IGNORE_putpmsg
29283 -#define __IGNORE_vserver
29287 diff -NurpP --minimal linux-2.6.33.1/security/commoncap.c linux-2.6.33.1-vs2.3.0.36.30.4/security/commoncap.c
29288 --- linux-2.6.33.1/security/commoncap.c 2010-02-25 11:52:12.000000000 +0100
29289 +++ linux-2.6.33.1-vs2.3.0.36.30.4/security/commoncap.c 2010-03-05 15:30:01.000000000 +0100
29291 #include <linux/sched.h>
29292 #include <linux/prctl.h>
29293 #include <linux/securebits.h>
29294 +#include <linux/vs_context.h>
29297 * If a non-root user executes a setuid-root binary in
29298 @@ -52,7 +53,7 @@ static void warn_setuid_and_fcaps_mixed(
29300 int cap_netlink_send(struct sock *sk, struct sk_buff *skb)
29302 - NETLINK_CB(skb).eff_cap = current_cap();
29303 + NETLINK_CB(skb).eff_cap = vx_mbcaps(current_cap());
29307 @@ -62,6 +63,7 @@ int cap_netlink_recv(struct sk_buff *skb
29312 EXPORT_SYMBOL(cap_netlink_recv);
29315 @@ -82,7 +84,22 @@ EXPORT_SYMBOL(cap_netlink_recv);
29316 int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap,
29319 - return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;
29320 + struct vx_info *vxi = tsk->vx_info;
29323 + printk("cap_capable() VXF_STATE_SETUP = %llx, raised = %x, eff = %08x:%08x\n",
29324 + vx_info_flags(vxi, VXF_STATE_SETUP, 0),
29325 + cap_raised(tsk->cap_effective, cap),
29326 + tsk->cap_effective.cap[1], tsk->cap_effective.cap[0]);
29329 + /* special case SETUP */
29330 + if (vx_info_flags(vxi, VXF_STATE_SETUP, 0) &&
29331 + /* FIXME: maybe use cred instead? */
29332 + cap_raised(tsk->cred->cap_effective, cap))
29335 + return vx_cap_raised(vxi, cred->cap_effective, cap) ? 0 : -EPERM;
29339 @@ -570,7 +587,7 @@ int cap_inode_setxattr(struct dentry *de
29341 if (!strncmp(name, XATTR_SECURITY_PREFIX,
29342 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
29343 - !capable(CAP_SYS_ADMIN))
29344 + !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
29348 @@ -596,7 +613,7 @@ int cap_inode_removexattr(struct dentry
29350 if (!strncmp(name, XATTR_SECURITY_PREFIX,
29351 sizeof(XATTR_SECURITY_PREFIX) - 1) &&
29352 - !capable(CAP_SYS_ADMIN))
29353 + !vx_capable(CAP_SYS_ADMIN, VXC_FS_SECURITY))
29357 @@ -894,7 +911,8 @@ error:
29359 int cap_syslog(int type)
29361 - if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
29362 + if ((type != 3 && type != 10) &&
29363 + !vx_capable(CAP_SYS_ADMIN, VXC_SYSLOG))
29367 @@ -946,3 +964,4 @@ int cap_file_mmap(struct file *file, uns
29372 diff -NurpP --minimal linux-2.6.33.1/security/selinux/av_permissions.h linux-2.6.33.1-vs2.3.0.36.30.4/security/selinux/av_permissions.h
29373 --- linux-2.6.33.1/security/selinux/av_permissions.h 1970-01-01 01:00:00.000000000 +0100
29374 +++ linux-2.6.33.1-vs2.3.0.36.30.4/security/selinux/av_permissions.h 2010-02-27 15:49:05.000000000 +0100
29376 +/* This file is automatically generated. Do not edit. */
29377 +#ifndef _SELINUX_AV_PERMISSIONS_H_
29378 +#define _SELINUX_AV_PERMISSIONS_H_
29380 +#define SECURITY__COMPUTE_AV 0x00000001UL
29381 +#define SECURITY__COMPUTE_CREATE 0x00000002UL
29382 +#define SECURITY__COMPUTE_MEMBER 0x00000004UL
29383 +#define SECURITY__CHECK_CONTEXT 0x00000008UL
29384 +#define SECURITY__LOAD_POLICY 0x00000010UL
29385 +#define SECURITY__COMPUTE_RELABEL 0x00000020UL
29386 +#define SECURITY__COMPUTE_USER 0x00000040UL
29387 +#define SECURITY__SETENFORCE 0x00000080UL
29388 +#define SECURITY__SETBOOL 0x00000100UL
29389 +#define SECURITY__SETSECPARAM 0x00000200UL
29390 +#define SECURITY__SETCHECKREQPROT 0x00000400UL
29391 +#define PROCESS__FORK 0x00000001UL
29392 +#define PROCESS__TRANSITION 0x00000002UL
29393 +#define PROCESS__SIGCHLD 0x00000004UL
29394 +#define PROCESS__SIGKILL 0x00000008UL
29395 +#define PROCESS__SIGSTOP 0x00000010UL
29396 +#define PROCESS__SIGNULL 0x00000020UL
29397 +#define PROCESS__SIGNAL 0x00000040UL
29398 +#define PROCESS__PTRACE 0x00000080UL
29399 +#define PROCESS__GETSCHED 0x00000100UL
29400 +#define PROCESS__SETSCHED 0x00000200UL
29401 +#define PROCESS__GETSESSION 0x00000400UL
29402 +#define PROCESS__GETPGID 0x00000800UL
29403 +#define PROCESS__SETPGID 0x00001000UL
29404 +#define PROCESS__GETCAP 0x00002000UL
29405 +#define PROCESS__SETCAP 0x00004000UL
29406 +#define PROCESS__SHARE 0x00008000UL
29407 +#define PROCESS__GETATTR 0x00010000UL
29408 +#define PROCESS__SETEXEC 0x00020000UL
29409 +#define PROCESS__SETFSCREATE 0x00040000UL
29410 +#define PROCESS__NOATSECURE 0x00080000UL
29411 +#define PROCESS__SIGINH 0x00100000UL
29412 +#define PROCESS__SETRLIMIT 0x00200000UL
29413 +#define PROCESS__RLIMITINH 0x00400000UL
29414 +#define PROCESS__DYNTRANSITION 0x00800000UL
29415 +#define PROCESS__SETCURRENT 0x01000000UL
29416 +#define PROCESS__EXECMEM 0x02000000UL
29417 +#define PROCESS__EXECSTACK 0x04000000UL
29418 +#define PROCESS__EXECHEAP 0x08000000UL
29419 +#define PROCESS__SETKEYCREATE 0x10000000UL
29420 +#define PROCESS__SETSOCKCREATE 0x20000000UL
29421 +#define SYSTEM__IPC_INFO 0x00000001UL
29422 +#define SYSTEM__SYSLOG_READ 0x00000002UL
29423 +#define SYSTEM__SYSLOG_MOD 0x00000004UL
29424 +#define SYSTEM__SYSLOG_CONSOLE 0x00000008UL
29425 +#define SYSTEM__MODULE_REQUEST 0x00000010UL
29426 +#define CAPABILITY__CHOWN 0x00000001UL
29427 +#define CAPABILITY__DAC_OVERRIDE 0x00000002UL
29428 +#define CAPABILITY__DAC_READ_SEARCH 0x00000004UL
29429 +#define CAPABILITY__FOWNER 0x00000008UL
29430 +#define CAPABILITY__FSETID 0x00000010UL
29431 +#define CAPABILITY__KILL 0x00000020UL
29432 +#define CAPABILITY__SETGID 0x00000040UL
29433 +#define CAPABILITY__SETUID 0x00000080UL
29434 +#define CAPABILITY__SETPCAP 0x00000100UL
29435 +#define CAPABILITY__LINUX_IMMUTABLE 0x00000200UL
29436 +#define CAPABILITY__NET_BIND_SERVICE 0x00000400UL
29437 +#define CAPABILITY__NET_BROADCAST 0x00000800UL
29438 +#define CAPABILITY__NET_ADMIN 0x00001000UL
29439 +#define CAPABILITY__NET_RAW 0x00002000UL
29440 +#define CAPABILITY__IPC_LOCK 0x00004000UL
29441 +#define CAPABILITY__IPC_OWNER 0x00008000UL
29442 +#define CAPABILITY__SYS_MODULE 0x00010000UL
29443 +#define CAPABILITY__SYS_RAWIO 0x00020000UL
29444 +#define CAPABILITY__SYS_CHROOT 0x00040000UL
29445 +#define CAPABILITY__SYS_PTRACE 0x00080000UL
29446 +#define CAPABILITY__SYS_PACCT 0x00100000UL
29447 +#define CAPABILITY__SYS_ADMIN 0x00200000UL
29448 +#define CAPABILITY__SYS_BOOT 0x00400000UL
29449 +#define CAPABILITY__SYS_NICE 0x00800000UL
29450 +#define CAPABILITY__SYS_RESOURCE 0x01000000UL
29451 +#define CAPABILITY__SYS_TIME 0x02000000UL
29452 +#define CAPABILITY__SYS_TTY_CONFIG 0x04000000UL
29453 +#define CAPABILITY__MKNOD 0x08000000UL
29454 +#define CAPABILITY__LEASE 0x10000000UL
29455 +#define CAPABILITY__AUDIT_WRITE 0x20000000UL
29456 +#define CAPABILITY__AUDIT_CONTROL 0x40000000UL
29457 +#define CAPABILITY__SETFCAP 0x80000000UL
29458 +#define FILESYSTEM__MOUNT 0x00000001UL
29459 +#define FILESYSTEM__REMOUNT 0x00000002UL
29460 +#define FILESYSTEM__UNMOUNT 0x00000004UL
29461 +#define FILESYSTEM__GETATTR 0x00000008UL
29462 +#define FILESYSTEM__RELABELFROM 0x00000010UL
29463 +#define FILESYSTEM__RELABELTO 0x00000020UL
29464 +#define FILESYSTEM__TRANSITION 0x00000040UL
29465 +#define FILESYSTEM__ASSOCIATE 0x00000080UL
29466 +#define FILESYSTEM__QUOTAMOD 0x00000100UL
29467 +#define FILESYSTEM__QUOTAGET 0x00000200UL
29468 +#define FILE__IOCTL 0x00000001UL
29469 +#define FILE__READ 0x00000002UL
29470 +#define FILE__WRITE 0x00000004UL
29471 +#define FILE__CREATE 0x00000008UL
29472 +#define FILE__GETATTR 0x00000010UL
29473 +#define FILE__SETATTR 0x00000020UL
29474 +#define FILE__LOCK 0x00000040UL
29475 +#define FILE__RELABELFROM 0x00000080UL
29476 +#define FILE__RELABELTO 0x00000100UL
29477 +#define FILE__APPEND 0x00000200UL
29478 +#define FILE__UNLINK 0x00000400UL
29479 +#define FILE__LINK 0x00000800UL
29480 +#define FILE__RENAME 0x00001000UL
29481 +#define FILE__EXECUTE 0x00002000UL
29482 +#define FILE__SWAPON 0x00004000UL
29483 +#define FILE__QUOTAON 0x00008000UL
29484 +#define FILE__MOUNTON 0x00010000UL
29485 +#define FILE__EXECUTE_NO_TRANS 0x00020000UL
29486 +#define FILE__ENTRYPOINT 0x00040000UL
29487 +#define FILE__EXECMOD 0x00080000UL
29488 +#define FILE__OPEN 0x00100000UL
29489 +#define DIR__IOCTL 0x00000001UL
29490 +#define DIR__READ 0x00000002UL
29491 +#define DIR__WRITE 0x00000004UL
29492 +#define DIR__CREATE 0x00000008UL
29493 +#define DIR__GETATTR 0x00000010UL
29494 +#define DIR__SETATTR 0x00000020UL
29495 +#define DIR__LOCK 0x00000040UL
29496 +#define DIR__RELABELFROM 0x00000080UL
29497 +#define DIR__RELABELTO 0x00000100UL
29498 +#define DIR__APPEND 0x00000200UL
29499 +#define DIR__UNLINK 0x00000400UL
29500 +#define DIR__LINK 0x00000800UL
29501 +#define DIR__RENAME 0x00001000UL
29502 +#define DIR__EXECUTE 0x00002000UL
29503 +#define DIR__SWAPON 0x00004000UL
29504 +#define DIR__QUOTAON 0x00008000UL
29505 +#define DIR__MOUNTON 0x00010000UL
29506 +#define DIR__ADD_NAME 0x00020000UL
29507 +#define DIR__REMOVE_NAME 0x00040000UL
29508 +#define DIR__REPARENT 0x00080000UL
29509 +#define DIR__SEARCH 0x00100000UL
29510 +#define DIR__RMDIR 0x00200000UL
29511 +#define DIR__OPEN 0x00400000UL
29512 +#define FD__USE 0x00000001UL
29513 +#define LNK_FILE__IOCTL 0x00000001UL
29514 +#define LNK_FILE__READ 0x00000002UL
29515 +#define LNK_FILE__WRITE 0x00000004UL
29516 +#define LNK_FILE__CREATE 0x00000008UL
29517 +#define LNK_FILE__GETATTR 0x00000010UL
29518 +#define LNK_FILE__SETATTR 0x00000020UL
29519 +#define LNK_FILE__LOCK 0x00000040UL
29520 +#define LNK_FILE__RELABELFROM 0x00000080UL
29521 +#define LNK_FILE__RELABELTO 0x00000100UL
29522 +#define LNK_FILE__APPEND 0x00000200UL
29523 +#define LNK_FILE__UNLINK 0x00000400UL
29524 +#define LNK_FILE__LINK 0x00000800UL
29525 +#define LNK_FILE__RENAME 0x00001000UL
29526 +#define LNK_FILE__EXECUTE 0x00002000UL
29527 +#define LNK_FILE__SWAPON 0x00004000UL
29528 +#define LNK_FILE__QUOTAON 0x00008000UL
29529 +#define LNK_FILE__MOUNTON 0x00010000UL
29530 +#define CHR_FILE__IOCTL 0x00000001UL
29531 +#define CHR_FILE__READ 0x00000002UL
29532 +#define CHR_FILE__WRITE 0x00000004UL
29533 +#define CHR_FILE__CREATE 0x00000008UL
29534 +#define CHR_FILE__GETATTR 0x00000010UL
29535 +#define CHR_FILE__SETATTR 0x00000020UL
29536 +#define CHR_FILE__LOCK 0x00000040UL
29537 +#define CHR_FILE__RELABELFROM 0x00000080UL
29538 +#define CHR_FILE__RELABELTO 0x00000100UL
29539 +#define CHR_FILE__APPEND 0x00000200UL
29540 +#define CHR_FILE__UNLINK 0x00000400UL
29541 +#define CHR_FILE__LINK 0x00000800UL
29542 +#define CHR_FILE__RENAME 0x00001000UL
29543 +#define CHR_FILE__EXECUTE 0x00002000UL
29544 +#define CHR_FILE__SWAPON 0x00004000UL
29545 +#define CHR_FILE__QUOTAON 0x00008000UL
29546 +#define CHR_FILE__MOUNTON 0x00010000UL
29547 +#define CHR_FILE__EXECUTE_NO_TRANS 0x00020000UL
29548 +#define CHR_FILE__ENTRYPOINT 0x00040000UL
29549 +#define CHR_FILE__EXECMOD 0x00080000UL
29550 +#define CHR_FILE__OPEN 0x00100000UL
29551 +#define BLK_FILE__IOCTL 0x00000001UL
29552 +#define BLK_FILE__READ 0x00000002UL
29553 +#define BLK_FILE__WRITE 0x00000004UL
29554 +#define BLK_FILE__CREATE 0x00000008UL
29555 +#define BLK_FILE__GETATTR 0x00000010UL
29556 +#define BLK_FILE__SETATTR 0x00000020UL
29557 +#define BLK_FILE__LOCK 0x00000040UL
29558 +#define BLK_FILE__RELABELFROM 0x00000080UL
29559 +#define BLK_FILE__RELABELTO 0x00000100UL
29560 +#define BLK_FILE__APPEND 0x00000200UL
29561 +#define BLK_FILE__UNLINK 0x00000400UL
29562 +#define BLK_FILE__LINK 0x00000800UL
29563 +#define BLK_FILE__RENAME 0x00001000UL
29564 +#define BLK_FILE__EXECUTE 0x00002000UL
29565 +#define BLK_FILE__SWAPON 0x00004000UL
29566 +#define BLK_FILE__QUOTAON 0x00008000UL
29567 +#define BLK_FILE__MOUNTON 0x00010000UL
29568 +#define BLK_FILE__OPEN 0x00020000UL
29569 +#define SOCK_FILE__IOCTL 0x00000001UL
29570 +#define SOCK_FILE__READ 0x00000002UL
29571 +#define SOCK_FILE__WRITE 0x00000004UL
29572 +#define SOCK_FILE__CREATE 0x00000008UL
29573 +#define SOCK_FILE__GETATTR 0x00000010UL
29574 +#define SOCK_FILE__SETATTR 0x00000020UL
29575 +#define SOCK_FILE__LOCK 0x00000040UL
29576 +#define SOCK_FILE__RELABELFROM 0x00000080UL
29577 +#define SOCK_FILE__RELABELTO 0x00000100UL
29578 +#define SOCK_FILE__APPEND 0x00000200UL
29579 +#define SOCK_FILE__UNLINK 0x00000400UL
29580 +#define SOCK_FILE__LINK 0x00000800UL
29581 +#define SOCK_FILE__RENAME 0x00001000UL
29582 +#define SOCK_FILE__EXECUTE 0x00002000UL
29583 +#define SOCK_FILE__SWAPON 0x00004000UL
29584 +#define SOCK_FILE__QUOTAON 0x00008000UL
29585 +#define SOCK_FILE__MOUNTON 0x00010000UL
29586 +#define SOCK_FILE__OPEN 0x00020000UL
29587 +#define FIFO_FILE__IOCTL 0x00000001UL
29588 +#define FIFO_FILE__READ 0x00000002UL
29589 +#define FIFO_FILE__WRITE 0x00000004UL
29590 +#define FIFO_FILE__CREATE 0x00000008UL
29591 +#define FIFO_FILE__GETATTR 0x00000010UL
29592 +#define FIFO_FILE__SETATTR 0x00000020UL
29593 +#define FIFO_FILE__LOCK 0x00000040UL
29594 +#define FIFO_FILE__RELABELFROM 0x00000080UL
29595 +#define FIFO_FILE__RELABELTO 0x00000100UL
29596 +#define FIFO_FILE__APPEND 0x00000200UL
29597 +#define FIFO_FILE__UNLINK 0x00000400UL
29598 +#define FIFO_FILE__LINK 0x00000800UL
29599 +#define FIFO_FILE__RENAME 0x00001000UL
29600 +#define FIFO_FILE__EXECUTE 0x00002000UL
29601 +#define FIFO_FILE__SWAPON 0x00004000UL
29602 +#define FIFO_FILE__QUOTAON 0x00008000UL
29603 +#define FIFO_FILE__MOUNTON 0x00010000UL
29604 +#define FIFO_FILE__OPEN 0x00020000UL
29605 +#define SOCKET__IOCTL 0x00000001UL
29606 +#define SOCKET__READ 0x00000002UL
29607 +#define SOCKET__WRITE 0x00000004UL
29608 +#define SOCKET__CREATE 0x00000008UL
29609 +#define SOCKET__GETATTR 0x00000010UL
29610 +#define SOCKET__SETATTR 0x00000020UL
29611 +#define SOCKET__LOCK 0x00000040UL
29612 +#define SOCKET__RELABELFROM 0x00000080UL
29613 +#define SOCKET__RELABELTO 0x00000100UL
29614 +#define SOCKET__APPEND 0x00000200UL
29615 +#define SOCKET__BIND 0x00000400UL
29616 +#define SOCKET__CONNECT 0x00000800UL
29617 +#define SOCKET__LISTEN 0x00001000UL
29618 +#define SOCKET__ACCEPT 0x00002000UL
29619 +#define SOCKET__GETOPT 0x00004000UL
29620 +#define SOCKET__SETOPT 0x00008000UL
29621 +#define SOCKET__SHUTDOWN 0x00010000UL
29622 +#define SOCKET__RECVFROM 0x00020000UL
29623 +#define SOCKET__SENDTO 0x00040000UL
29624 +#define SOCKET__RECV_MSG 0x00080000UL
29625 +#define SOCKET__SEND_MSG 0x00100000UL
29626 +#define SOCKET__NAME_BIND 0x00200000UL
29627 +#define TCP_SOCKET__IOCTL 0x00000001UL
29628 +#define TCP_SOCKET__READ 0x00000002UL
29629 +#define TCP_SOCKET__WRITE 0x00000004UL
29630 +#define TCP_SOCKET__CREATE 0x00000008UL
29631 +#define TCP_SOCKET__GETATTR 0x00000010UL
29632 +#define TCP_SOCKET__SETATTR 0x00000020UL
29633 +#define TCP_SOCKET__LOCK 0x00000040UL
29634 +#define TCP_SOCKET__RELABELFROM 0x00000080UL
29635 +#define TCP_SOCKET__RELABELTO 0x00000100UL
29636 +#define TCP_SOCKET__APPEND 0x00000200UL
29637 +#define TCP_SOCKET__BIND 0x00000400UL
29638 +#define TCP_SOCKET__CONNECT 0x00000800UL
29639 +#define TCP_SOCKET__LISTEN 0x00001000UL
29640 +#define TCP_SOCKET__ACCEPT 0x00002000UL
29641 +#define TCP_SOCKET__GETOPT 0x00004000UL
29642 +#define TCP_SOCKET__SETOPT 0x00008000UL
29643 +#define TCP_SOCKET__SHUTDOWN 0x00010000UL
29644 +#define TCP_SOCKET__RECVFROM 0x00020000UL
29645 +#define TCP_SOCKET__SENDTO 0x00040000UL
29646 +#define TCP_SOCKET__RECV_MSG 0x00080000UL
29647 +#define TCP_SOCKET__SEND_MSG 0x00100000UL
29648 +#define TCP_SOCKET__NAME_BIND 0x00200000UL
29649 +#define TCP_SOCKET__CONNECTTO 0x00400000UL
29650 +#define TCP_SOCKET__NEWCONN 0x00800000UL
29651 +#define TCP_SOCKET__ACCEPTFROM 0x01000000UL
29652 +#define TCP_SOCKET__NODE_BIND 0x02000000UL
29653 +#define TCP_SOCKET__NAME_CONNECT 0x04000000UL
29654 +#define UDP_SOCKET__IOCTL 0x00000001UL
29655 +#define UDP_SOCKET__READ 0x00000002UL
29656 +#define UDP_SOCKET__WRITE 0x00000004UL
29657 +#define UDP_SOCKET__CREATE 0x00000008UL
29658 +#define UDP_SOCKET__GETATTR 0x00000010UL
29659 +#define UDP_SOCKET__SETATTR 0x00000020UL
29660 +#define UDP_SOCKET__LOCK 0x00000040UL
29661 +#define UDP_SOCKET__RELABELFROM 0x00000080UL
29662 +#define UDP_SOCKET__RELABELTO 0x00000100UL
29663 +#define UDP_SOCKET__APPEND 0x00000200UL
29664 +#define UDP_SOCKET__BIND 0x00000400UL
29665 +#define UDP_SOCKET__CONNECT 0x00000800UL
29666 +#define UDP_SOCKET__LISTEN 0x00001000UL
29667 +#define UDP_SOCKET__ACCEPT 0x00002000UL
29668 +#define UDP_SOCKET__GETOPT 0x00004000UL
29669 +#define UDP_SOCKET__SETOPT 0x00008000UL
29670 +#define UDP_SOCKET__SHUTDOWN 0x00010000UL
29671 +#define UDP_SOCKET__RECVFROM 0x00020000UL
29672 +#define UDP_SOCKET__SENDTO 0x00040000UL
29673 +#define UDP_SOCKET__RECV_MSG 0x00080000UL
29674 +#define UDP_SOCKET__SEND_MSG 0x00100000UL
29675 +#define UDP_SOCKET__NAME_BIND 0x00200000UL
29676 +#define UDP_SOCKET__NODE_BIND 0x00400000UL
29677 +#define RAWIP_SOCKET__IOCTL 0x00000001UL
29678 +#define RAWIP_SOCKET__READ 0x00000002UL
29679 +#define RAWIP_SOCKET__WRITE 0x00000004UL
29680 +#define RAWIP_SOCKET__CREATE 0x00000008UL
29681 +#define RAWIP_SOCKET__GETATTR 0x00000010UL
29682 +#define RAWIP_SOCKET__SETATTR 0x00000020UL
29683 +#define RAWIP_SOCKET__LOCK 0x00000040UL
29684 +#define RAWIP_SOCKET__RELABELFROM 0x00000080UL
29685 +#define RAWIP_SOCKET__RELABELTO 0x00000100UL
29686 +#define RAWIP_SOCKET__APPEND 0x00000200UL
29687 +#define RAWIP_SOCKET__BIND 0x00000400UL
29688 +#define RAWIP_SOCKET__CONNECT 0x00000800UL
29689 +#define RAWIP_SOCKET__LISTEN 0x00001000UL
29690 +#define RAWIP_SOCKET__ACCEPT 0x00002000UL
29691 +#define RAWIP_SOCKET__GETOPT 0x00004000UL
29692 +#define RAWIP_SOCKET__SETOPT 0x00008000UL
29693 +#define RAWIP_SOCKET__SHUTDOWN 0x00010000UL
29694 +#define RAWIP_SOCKET__RECVFROM 0x00020000UL
29695 +#define RAWIP_SOCKET__SENDTO 0x00040000UL
29696 +#define RAWIP_SOCKET__RECV_MSG 0x00080000UL
29697 +#define RAWIP_SOCKET__SEND_MSG 0x00100000UL
29698 +#define RAWIP_SOCKET__NAME_BIND 0x00200000UL
29699 +#define RAWIP_SOCKET__NODE_BIND 0x00400000UL
29700 +#define NODE__TCP_RECV 0x00000001UL
29701 +#define NODE__TCP_SEND 0x00000002UL
29702 +#define NODE__UDP_RECV 0x00000004UL
29703 +#define NODE__UDP_SEND 0x00000008UL
29704 +#define NODE__RAWIP_RECV 0x00000010UL
29705 +#define NODE__RAWIP_SEND 0x00000020UL
29706 +#define NODE__ENFORCE_DEST 0x00000040UL
29707 +#define NODE__DCCP_RECV 0x00000080UL
29708 +#define NODE__DCCP_SEND 0x00000100UL
29709 +#define NODE__RECVFROM 0x00000200UL
29710 +#define NODE__SENDTO 0x00000400UL
29711 +#define NETIF__TCP_RECV 0x00000001UL
29712 +#define NETIF__TCP_SEND 0x00000002UL
29713 +#define NETIF__UDP_RECV 0x00000004UL
29714 +#define NETIF__UDP_SEND 0x00000008UL
29715 +#define NETIF__RAWIP_RECV 0x00000010UL
29716 +#define NETIF__RAWIP_SEND 0x00000020UL
29717 +#define NETIF__DCCP_RECV 0x00000040UL
29718 +#define NETIF__DCCP_SEND 0x00000080UL
29719 +#define NETIF__INGRESS 0x00000100UL
29720 +#define NETIF__EGRESS 0x00000200UL
29721 +#define NETLINK_SOCKET__IOCTL 0x00000001UL
29722 +#define NETLINK_SOCKET__READ 0x00000002UL
29723 +#define NETLINK_SOCKET__WRITE 0x00000004UL
29724 +#define NETLINK_SOCKET__CREATE 0x00000008UL
29725 +#define NETLINK_SOCKET__GETATTR 0x00000010UL
29726 +#define NETLINK_SOCKET__SETATTR 0x00000020UL
29727 +#define NETLINK_SOCKET__LOCK 0x00000040UL
29728 +#define NETLINK_SOCKET__RELABELFROM 0x00000080UL
29729 +#define NETLINK_SOCKET__RELABELTO 0x00000100UL
29730 +#define NETLINK_SOCKET__APPEND 0x00000200UL
29731 +#define NETLINK_SOCKET__BIND 0x00000400UL
29732 +#define NETLINK_SOCKET__CONNECT 0x00000800UL
29733 +#define NETLINK_SOCKET__LISTEN 0x00001000UL
29734 +#define NETLINK_SOCKET__ACCEPT 0x00002000UL
29735 +#define NETLINK_SOCKET__GETOPT 0x00004000UL
29736 +#define NETLINK_SOCKET__SETOPT 0x00008000UL
29737 +#define NETLINK_SOCKET__SHUTDOWN 0x00010000UL
29738 +#define NETLINK_SOCKET__RECVFROM 0x00020000UL
29739 +#define NETLINK_SOCKET__SENDTO 0x00040000UL
29740 +#define NETLINK_SOCKET__RECV_MSG 0x00080000UL
29741 +#define NETLINK_SOCKET__SEND_MSG 0x00100000UL
29742 +#define NETLINK_SOCKET__NAME_BIND 0x00200000UL
29743 +#define PACKET_SOCKET__IOCTL 0x00000001UL
29744 +#define PACKET_SOCKET__READ 0x00000002UL
29745 +#define PACKET_SOCKET__WRITE 0x00000004UL
29746 +#define PACKET_SOCKET__CREATE 0x00000008UL
29747 +#define PACKET_SOCKET__GETATTR 0x00000010UL
29748 +#define PACKET_SOCKET__SETATTR 0x00000020UL
29749 +#define PACKET_SOCKET__LOCK 0x00000040UL
29750 +#define PACKET_SOCKET__RELABELFROM 0x00000080UL
29751 +#define PACKET_SOCKET__RELABELTO 0x00000100UL
29752 +#define PACKET_SOCKET__APPEND 0x00000200UL
29753 +#define PACKET_SOCKET__BIND 0x00000400UL
29754 +#define PACKET_SOCKET__CONNECT 0x00000800UL
29755 +#define PACKET_SOCKET__LISTEN 0x00001000UL
29756 +#define PACKET_SOCKET__ACCEPT 0x00002000UL
29757 +#define PACKET_SOCKET__GETOPT 0x00004000UL
29758 +#define PACKET_SOCKET__SETOPT 0x00008000UL
29759 +#define PACKET_SOCKET__SHUTDOWN 0x00010000UL
29760 +#define PACKET_SOCKET__RECVFROM 0x00020000UL
29761 +#define PACKET_SOCKET__SENDTO 0x00040000UL
29762 +#define PACKET_SOCKET__RECV_MSG 0x00080000UL
29763 +#define PACKET_SOCKET__SEND_MSG 0x00100000UL
29764 +#define PACKET_SOCKET__NAME_BIND 0x00200000UL
29765 +#define KEY_SOCKET__IOCTL 0x00000001UL
29766 +#define KEY_SOCKET__READ 0x00000002UL
29767 +#define KEY_SOCKET__WRITE 0x00000004UL
29768 +#define KEY_SOCKET__CREATE 0x00000008UL
29769 +#define KEY_SOCKET__GETATTR 0x00000010UL
29770 +#define KEY_SOCKET__SETATTR 0x00000020UL
29771 +#define KEY_SOCKET__LOCK 0x00000040UL
29772 +#define KEY_SOCKET__RELABELFROM 0x00000080UL
29773 +#define KEY_SOCKET__RELABELTO 0x00000100UL
29774 +#define KEY_SOCKET__APPEND 0x00000200UL
29775 +#define KEY_SOCKET__BIND 0x00000400UL
29776 +#define KEY_SOCKET__CONNECT 0x00000800UL
29777 +#define KEY_SOCKET__LISTEN 0x00001000UL
29778 +#define KEY_SOCKET__ACCEPT 0x00002000UL
29779 +#define KEY_SOCKET__GETOPT 0x00004000UL
29780 +#define KEY_SOCKET__SETOPT 0x00008000UL
29781 +#define KEY_SOCKET__SHUTDOWN 0x00010000UL
29782 +#define KEY_SOCKET__RECVFROM 0x00020000UL
29783 +#define KEY_SOCKET__SENDTO 0x00040000UL
29784 +#define KEY_SOCKET__RECV_MSG 0x00080000UL
29785 +#define KEY_SOCKET__SEND_MSG 0x00100000UL
29786 +#define KEY_SOCKET__NAME_BIND 0x00200000UL
29787 +#define UNIX_STREAM_SOCKET__IOCTL 0x00000001UL
29788 +#define UNIX_STREAM_SOCKET__READ 0x00000002UL
29789 +#define UNIX_STREAM_SOCKET__WRITE 0x00000004UL
29790 +#define UNIX_STREAM_SOCKET__CREATE 0x00000008UL
29791 +#define UNIX_STREAM_SOCKET__GETATTR 0x00000010UL
29792 +#define UNIX_STREAM_SOCKET__SETATTR 0x00000020UL
29793 +#define UNIX_STREAM_SOCKET__LOCK 0x00000040UL
29794 +#define UNIX_STREAM_SOCKET__RELABELFROM 0x00000080UL
29795 +#define UNIX_STREAM_SOCKET__RELABELTO 0x00000100UL
29796 +#define UNIX_STREAM_SOCKET__APPEND 0x00000200UL
29797 +#define UNIX_STREAM_SOCKET__BIND 0x00000400UL
29798 +#define UNIX_STREAM_SOCKET__CONNECT 0x00000800UL
29799 +#define UNIX_STREAM_SOCKET__LISTEN 0x00001000UL
29800 +#define UNIX_STREAM_SOCKET__ACCEPT 0x00002000UL
29801 +#define UNIX_STREAM_SOCKET__GETOPT 0x00004000UL
29802 +#define UNIX_STREAM_SOCKET__SETOPT 0x00008000UL
29803 +#define UNIX_STREAM_SOCKET__SHUTDOWN 0x00010000UL
29804 +#define UNIX_STREAM_SOCKET__RECVFROM 0x00020000UL
29805 +#define UNIX_STREAM_SOCKET__SENDTO 0x00040000UL
29806 +#define UNIX_STREAM_SOCKET__RECV_MSG 0x00080000UL
29807 +#define UNIX_STREAM_SOCKET__SEND_MSG 0x00100000UL
29808 +#define UNIX_STREAM_SOCKET__NAME_BIND 0x00200000UL
29809 +#define UNIX_STREAM_SOCKET__CONNECTTO 0x00400000UL
29810 +#define UNIX_STREAM_SOCKET__NEWCONN 0x00800000UL
29811 +#define UNIX_STREAM_SOCKET__ACCEPTFROM 0x01000000UL
29812 +#define UNIX_DGRAM_SOCKET__IOCTL 0x00000001UL
29813 +#define UNIX_DGRAM_SOCKET__READ 0x00000002UL
29814 +#define UNIX_DGRAM_SOCKET__WRITE 0x00000004UL
29815 +#define UNIX_DGRAM_SOCKET__CREATE 0x00000008UL
29816 +#define UNIX_DGRAM_SOCKET__GETATTR 0x00000010UL
29817 +#define UNIX_DGRAM_SOCKET__SETATTR 0x00000020UL
29818 +#define UNIX_DGRAM_SOCKET__LOCK 0x00000040UL
29819 +#define UNIX_DGRAM_SOCKET__RELABELFROM 0x00000080UL
29820 +#define UNIX_DGRAM_SOCKET__RELABELTO 0x00000100UL
29821 +#define UNIX_DGRAM_SOCKET__APPEND 0x00000200UL
29822 +#define UNIX_DGRAM_SOCKET__BIND 0x00000400UL
29823 +#define UNIX_DGRAM_SOCKET__CONNECT 0x00000800UL
29824 +#define UNIX_DGRAM_SOCKET__LISTEN 0x00001000UL
29825 +#define UNIX_DGRAM_SOCKET__ACCEPT 0x00002000UL
29826 +#define UNIX_DGRAM_SOCKET__GETOPT 0x00004000UL
29827 +#define UNIX_DGRAM_SOCKET__SETOPT 0x00008000UL
29828 +#define UNIX_DGRAM_SOCKET__SHUTDOWN 0x00010000UL
29829 +#define UNIX_DGRAM_SOCKET__RECVFROM 0x00020000UL
29830 +#define UNIX_DGRAM_SOCKET__SENDTO 0x00040000UL
29831 +#define UNIX_DGRAM_SOCKET__RECV_MSG 0x00080000UL
29832 +#define UNIX_DGRAM_SOCKET__SEND_MSG 0x00100000UL
29833 +#define UNIX_DGRAM_SOCKET__NAME_BIND 0x00200000UL
29834 +#define SEM__CREATE 0x00000001UL
29835 +#define SEM__DESTROY 0x00000002UL
29836 +#define SEM__GETATTR 0x00000004UL
29837 +#define SEM__SETATTR 0x00000008UL
29838 +#define SEM__READ 0x00000010UL
29839 +#define SEM__WRITE 0x00000020UL
29840 +#define SEM__ASSOCIATE 0x00000040UL
29841 +#define SEM__UNIX_READ 0x00000080UL
29842 +#define SEM__UNIX_WRITE 0x00000100UL
29843 +#define MSG__SEND 0x00000001UL
29844 +#define MSG__RECEIVE 0x00000002UL
29845 +#define MSGQ__CREATE 0x00000001UL
29846 +#define MSGQ__DESTROY 0x00000002UL
29847 +#define MSGQ__GETATTR 0x00000004UL
29848 +#define MSGQ__SETATTR 0x00000008UL
29849 +#define MSGQ__READ 0x00000010UL
29850 +#define MSGQ__WRITE 0x00000020UL
29851 +#define MSGQ__ASSOCIATE 0x00000040UL
29852 +#define MSGQ__UNIX_READ 0x00000080UL
29853 +#define MSGQ__UNIX_WRITE 0x00000100UL
29854 +#define MSGQ__ENQUEUE 0x00000200UL
29855 +#define SHM__CREATE 0x00000001UL
29856 +#define SHM__DESTROY 0x00000002UL
29857 +#define SHM__GETATTR 0x00000004UL
29858 +#define SHM__SETATTR 0x00000008UL
29859 +#define SHM__READ 0x00000010UL
29860 +#define SHM__WRITE 0x00000020UL
29861 +#define SHM__ASSOCIATE 0x00000040UL
29862 +#define SHM__UNIX_READ 0x00000080UL
29863 +#define SHM__UNIX_WRITE 0x00000100UL
29864 +#define SHM__LOCK 0x00000200UL
29865 +#define IPC__CREATE 0x00000001UL
29866 +#define IPC__DESTROY 0x00000002UL
29867 +#define IPC__GETATTR 0x00000004UL
29868 +#define IPC__SETATTR 0x00000008UL
29869 +#define IPC__READ 0x00000010UL
29870 +#define IPC__WRITE 0x00000020UL
29871 +#define IPC__ASSOCIATE 0x00000040UL
29872 +#define IPC__UNIX_READ 0x00000080UL
29873 +#define IPC__UNIX_WRITE 0x00000100UL
29874 +#define NETLINK_ROUTE_SOCKET__IOCTL 0x00000001UL
29875 +#define NETLINK_ROUTE_SOCKET__READ 0x00000002UL
29876 +#define NETLINK_ROUTE_SOCKET__WRITE 0x00000004UL
29877 +#define NETLINK_ROUTE_SOCKET__CREATE 0x00000008UL
29878 +#define NETLINK_ROUTE_SOCKET__GETATTR 0x00000010UL
29879 +#define NETLINK_ROUTE_SOCKET__SETATTR 0x00000020UL
29880 +#define NETLINK_ROUTE_SOCKET__LOCK 0x00000040UL
29881 +#define NETLINK_ROUTE_SOCKET__RELABELFROM 0x00000080UL
29882 +#define NETLINK_ROUTE_SOCKET__RELABELTO 0x00000100UL
29883 +#define NETLINK_ROUTE_SOCKET__APPEND 0x00000200UL
29884 +#define NETLINK_ROUTE_SOCKET__BIND 0x00000400UL
29885 +#define NETLINK_ROUTE_SOCKET__CONNECT 0x00000800UL
29886 +#define NETLINK_ROUTE_SOCKET__LISTEN 0x00001000UL
29887 +#define NETLINK_ROUTE_SOCKET__ACCEPT 0x00002000UL
29888 +#define NETLINK_ROUTE_SOCKET__GETOPT 0x00004000UL
29889 +#define NETLINK_ROUTE_SOCKET__SETOPT 0x00008000UL
29890 +#define NETLINK_ROUTE_SOCKET__SHUTDOWN 0x00010000UL
29891 +#define NETLINK_ROUTE_SOCKET__RECVFROM 0x00020000UL
29892 +#define NETLINK_ROUTE_SOCKET__SENDTO 0x00040000UL
29893 +#define NETLINK_ROUTE_SOCKET__RECV_MSG 0x00080000UL
29894 +#define NETLINK_ROUTE_SOCKET__SEND_MSG 0x00100000UL
29895 +#define NETLINK_ROUTE_SOCKET__NAME_BIND 0x00200000UL
29896 +#define NETLINK_ROUTE_SOCKET__NLMSG_READ 0x00400000UL
29897 +#define NETLINK_ROUTE_SOCKET__NLMSG_WRITE 0x00800000UL
29898 +#define NETLINK_FIREWALL_SOCKET__IOCTL 0x00000001UL
29899 +#define NETLINK_FIREWALL_SOCKET__READ 0x00000002UL
29900 +#define NETLINK_FIREWALL_SOCKET__WRITE 0x00000004UL
29901 +#define NETLINK_FIREWALL_SOCKET__CREATE 0x00000008UL
29902 +#define NETLINK_FIREWALL_SOCKET__GETATTR 0x00000010UL
29903 +#define NETLINK_FIREWALL_SOCKET__SETATTR 0x00000020UL
29904 +#define NETLINK_FIREWALL_SOCKET__LOCK 0x00000040UL
29905 +#define NETLINK_FIREWALL_SOCKET__RELABELFROM 0x00000080UL
29906 +#define NETLINK_FIREWALL_SOCKET__RELABELTO 0x00000100UL
29907 +#define NETLINK_FIREWALL_SOCKET__APPEND 0x00000200UL
29908 +#define NETLINK_FIREWALL_SOCKET__BIND 0x00000400UL
29909 +#define NETLINK_FIREWALL_SOCKET__CONNECT 0x00000800UL
29910 +#define NETLINK_FIREWALL_SOCKET__LISTEN 0x00001000UL
29911 +#define NETLINK_FIREWALL_SOCKET__ACCEPT 0x00002000UL
29912 +#define NETLINK_FIREWALL_SOCKET__GETOPT 0x00004000UL
29913 +#define NETLINK_FIREWALL_SOCKET__SETOPT 0x00008000UL
29914 +#define NETLINK_FIREWALL_SOCKET__SHUTDOWN 0x00010000UL
29915 +#define NETLINK_FIREWALL_SOCKET__RECVFROM 0x00020000UL
29916 +#define NETLINK_FIREWALL_SOCKET__SENDTO 0x00040000UL
29917 +#define NETLINK_FIREWALL_SOCKET__RECV_MSG 0x00080000UL
29918 +#define NETLINK_FIREWALL_SOCKET__SEND_MSG 0x00100000UL
29919 +#define NETLINK_FIREWALL_SOCKET__NAME_BIND 0x00200000UL
29920 +#define NETLINK_FIREWALL_SOCKET__NLMSG_READ 0x00400000UL
29921 +#define NETLINK_FIREWALL_SOCKET__NLMSG_WRITE 0x00800000UL
29922 +#define NETLINK_TCPDIAG_SOCKET__IOCTL 0x00000001UL
29923 +#define NETLINK_TCPDIAG_SOCKET__READ 0x00000002UL
29924 +#define NETLINK_TCPDIAG_SOCKET__WRITE 0x00000004UL
29925 +#define NETLINK_TCPDIAG_SOCKET__CREATE 0x00000008UL
29926 +#define NETLINK_TCPDIAG_SOCKET__GETATTR 0x00000010UL
29927 +#define NETLINK_TCPDIAG_SOCKET__SETATTR 0x00000020UL
29928 +#define NETLINK_TCPDIAG_SOCKET__LOCK 0x00000040UL
29929 +#define NETLINK_TCPDIAG_SOCKET__RELABELFROM 0x00000080UL
29930 +#define NETLINK_TCPDIAG_SOCKET__RELABELTO 0x00000100UL
29931 +#define NETLINK_TCPDIAG_SOCKET__APPEND 0x00000200UL
29932 +#define NETLINK_TCPDIAG_SOCKET__BIND 0x00000400UL
29933 +#define NETLINK_TCPDIAG_SOCKET__CONNECT 0x00000800UL
29934 +#define NETLINK_TCPDIAG_SOCKET__LISTEN 0x00001000UL
29935 +#define NETLINK_TCPDIAG_SOCKET__ACCEPT 0x00002000UL
29936 +#define NETLINK_TCPDIAG_SOCKET__GETOPT 0x00004000UL
29937 +#define NETLINK_TCPDIAG_SOCKET__SETOPT 0x00008000UL
29938 +#define NETLINK_TCPDIAG_SOCKET__SHUTDOWN 0x00010000UL
29939 +#define NETLINK_TCPDIAG_SOCKET__RECVFROM 0x00020000UL
29940 +#define NETLINK_TCPDIAG_SOCKET__SENDTO 0x00040000UL
29941 +#define NETLINK_TCPDIAG_SOCKET__RECV_MSG 0x00080000UL
29942 +#define NETLINK_TCPDIAG_SOCKET__SEND_MSG 0x00100000UL
29943 +#define NETLINK_TCPDIAG_SOCKET__NAME_BIND 0x00200000UL
29944 +#define NETLINK_TCPDIAG_SOCKET__NLMSG_READ 0x00400000UL
29945 +#define NETLINK_TCPDIAG_SOCKET__NLMSG_WRITE 0x00800000UL
29946 +#define NETLINK_NFLOG_SOCKET__IOCTL 0x00000001UL
29947 +#define NETLINK_NFLOG_SOCKET__READ 0x00000002UL
29948 +#define NETLINK_NFLOG_SOCKET__WRITE 0x00000004UL
29949 +#define NETLINK_NFLOG_SOCKET__CREATE 0x00000008UL
29950 +#define NETLINK_NFLOG_SOCKET__GETATTR 0x00000010UL
29951 +#define NETLINK_NFLOG_SOCKET__SETATTR 0x00000020UL
29952 +#define NETLINK_NFLOG_SOCKET__LOCK 0x00000040UL
29953 +#define NETLINK_NFLOG_SOCKET__RELABELFROM 0x00000080UL
29954 +#define NETLINK_NFLOG_SOCKET__RELABELTO 0x00000100UL
29955 +#define NETLINK_NFLOG_SOCKET__APPEND 0x00000200UL
29956 +#define NETLINK_NFLOG_SOCKET__BIND 0x00000400UL
29957 +#define NETLINK_NFLOG_SOCKET__CONNECT 0x00000800UL
29958 +#define NETLINK_NFLOG_SOCKET__LISTEN 0x00001000UL
29959 +#define NETLINK_NFLOG_SOCKET__ACCEPT 0x00002000UL
29960 +#define NETLINK_NFLOG_SOCKET__GETOPT 0x00004000UL
29961 +#define NETLINK_NFLOG_SOCKET__SETOPT 0x00008000UL
29962 +#define NETLINK_NFLOG_SOCKET__SHUTDOWN 0x00010000UL
29963 +#define NETLINK_NFLOG_SOCKET__RECVFROM 0x00020000UL
29964 +#define NETLINK_NFLOG_SOCKET__SENDTO 0x00040000UL
29965 +#define NETLINK_NFLOG_SOCKET__RECV_MSG 0x00080000UL
29966 +#define NETLINK_NFLOG_SOCKET__SEND_MSG 0x00100000UL
29967 +#define NETLINK_NFLOG_SOCKET__NAME_BIND 0x00200000UL
29968 +#define NETLINK_XFRM_SOCKET__IOCTL 0x00000001UL
29969 +#define NETLINK_XFRM_SOCKET__READ 0x00000002UL
29970 +#define NETLINK_XFRM_SOCKET__WRITE 0x00000004UL
29971 +#define NETLINK_XFRM_SOCKET__CREATE 0x00000008UL
29972 +#define NETLINK_XFRM_SOCKET__GETATTR 0x00000010UL
29973 +#define NETLINK_XFRM_SOCKET__SETATTR 0x00000020UL
29974 +#define NETLINK_XFRM_SOCKET__LOCK 0x00000040UL
29975 +#define NETLINK_XFRM_SOCKET__RELABELFROM 0x00000080UL
29976 +#define NETLINK_XFRM_SOCKET__RELABELTO 0x00000100UL
29977 +#define NETLINK_XFRM_SOCKET__APPEND 0x00000200UL
29978 +#define NETLINK_XFRM_SOCKET__BIND 0x00000400UL
29979 +#define NETLINK_XFRM_SOCKET__CONNECT 0x00000800UL
29980 +#define NETLINK_XFRM_SOCKET__LISTEN 0x00001000UL
29981 +#define NETLINK_XFRM_SOCKET__ACCEPT 0x00002000UL
29982 +#define NETLINK_XFRM_SOCKET__GETOPT 0x00004000UL
29983 +#define NETLINK_XFRM_SOCKET__SETOPT 0x00008000UL
29984 +#define NETLINK_XFRM_SOCKET__SHUTDOWN 0x00010000UL
29985 +#define NETLINK_XFRM_SOCKET__RECVFROM 0x00020000UL
29986 +#define NETLINK_XFRM_SOCKET__SENDTO 0x00040000UL
29987 +#define NETLINK_XFRM_SOCKET__RECV_MSG 0x00080000UL
29988 +#define NETLINK_XFRM_SOCKET__SEND_MSG 0x00100000UL
29989 +#define NETLINK_XFRM_SOCKET__NAME_BIND 0x00200000UL
29990 +#define NETLINK_XFRM_SOCKET__NLMSG_READ 0x00400000UL
29991 +#define NETLINK_XFRM_SOCKET__NLMSG_WRITE 0x00800000UL
29992 +#define NETLINK_SELINUX_SOCKET__IOCTL 0x00000001UL
29993 +#define NETLINK_SELINUX_SOCKET__READ 0x00000002UL
29994 +#define NETLINK_SELINUX_SOCKET__WRITE 0x00000004UL
29995 +#define NETLINK_SELINUX_SOCKET__CREATE 0x00000008UL
29996 +#define NETLINK_SELINUX_SOCKET__GETATTR 0x00000010UL
29997 +#define NETLINK_SELINUX_SOCKET__SETATTR 0x00000020UL
29998 +#define NETLINK_SELINUX_SOCKET__LOCK 0x00000040UL
29999 +#define NETLINK_SELINUX_SOCKET__RELABELFROM 0x00000080UL
30000 +#define NETLINK_SELINUX_SOCKET__RELABELTO 0x00000100UL
30001 +#define NETLINK_SELINUX_SOCKET__APPEND 0x00000200UL
30002 +#define NETLINK_SELINUX_SOCKET__BIND 0x00000400UL
30003 +#define NETLINK_SELINUX_SOCKET__CONNECT 0x00000800UL
30004 +#define NETLINK_SELINUX_SOCKET__LISTEN 0x00001000UL
30005 +#define NETLINK_SELINUX_SOCKET__ACCEPT 0x00002000UL
30006 +#define NETLINK_SELINUX_SOCKET__GETOPT 0x00004000UL
30007 +#define NETLINK_SELINUX_SOCKET__SETOPT 0x00008000UL
30008 +#define NETLINK_SELINUX_SOCKET__SHUTDOWN 0x00010000UL
30009 +#define NETLINK_SELINUX_SOCKET__RECVFROM 0x00020000UL
30010 +#define NETLINK_SELINUX_SOCKET__SENDTO 0x00040000UL
30011 +#define NETLINK_SELINUX_SOCKET__RECV_MSG 0x00080000UL
30012 +#define NETLINK_SELINUX_SOCKET__SEND_MSG 0x00100000UL
30013 +#define NETLINK_SELINUX_SOCKET__NAME_BIND 0x00200000UL
30014 +#define NETLINK_AUDIT_SOCKET__IOCTL 0x00000001UL
30015 +#define NETLINK_AUDIT_SOCKET__READ 0x00000002UL
30016 +#define NETLINK_AUDIT_SOCKET__WRITE 0x00000004UL
30017 +#define NETLINK_AUDIT_SOCKET__CREATE 0x00000008UL
30018 +#define NETLINK_AUDIT_SOCKET__GETATTR 0x00000010UL
30019 +#define NETLINK_AUDIT_SOCKET__SETATTR 0x00000020UL
30020 +#define NETLINK_AUDIT_SOCKET__LOCK 0x00000040UL
30021 +#define NETLINK_AUDIT_SOCKET__RELABELFROM 0x00000080UL
30022 +#define NETLINK_AUDIT_SOCKET__RELABELTO 0x00000100UL
30023 +#define NETLINK_AUDIT_SOCKET__APPEND 0x00000200UL
30024 +#define NETLINK_AUDIT_SOCKET__BIND 0x00000400UL
30025 +#define NETLINK_AUDIT_SOCKET__CONNECT 0x00000800UL
30026 +#define NETLINK_AUDIT_SOCKET__LISTEN 0x00001000UL
30027 +#define NETLINK_AUDIT_SOCKET__ACCEPT 0x00002000UL
30028 +#define NETLINK_AUDIT_SOCKET__GETOPT 0x00004000UL
30029 +#define NETLINK_AUDIT_SOCKET__SETOPT 0x00008000UL
30030 +#define NETLINK_AUDIT_SOCKET__SHUTDOWN 0x00010000UL
30031 +#define NETLINK_AUDIT_SOCKET__RECVFROM 0x00020000UL
30032 +#define NETLINK_AUDIT_SOCKET__SENDTO 0x00040000UL
30033 +#define NETLINK_AUDIT_SOCKET__RECV_MSG 0x00080000UL
30034 +#define NETLINK_AUDIT_SOCKET__SEND_MSG 0x00100000UL
30035 +#define NETLINK_AUDIT_SOCKET__NAME_BIND 0x00200000UL
30036 +#define NETLINK_AUDIT_SOCKET__NLMSG_READ 0x00400000UL
30037 +#define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL
30038 +#define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL
30039 +#define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL
30040 +#define NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT 0x04000000UL
30041 +#define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL
30042 +#define NETLINK_IP6FW_SOCKET__READ 0x00000002UL
30043 +#define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL
30044 +#define NETLINK_IP6FW_SOCKET__CREATE 0x00000008UL
30045 +#define NETLINK_IP6FW_SOCKET__GETATTR 0x00000010UL
30046 +#define NETLINK_IP6FW_SOCKET__SETATTR 0x00000020UL
30047 +#define NETLINK_IP6FW_SOCKET__LOCK 0x00000040UL
30048 +#define NETLINK_IP6FW_SOCKET__RELABELFROM 0x00000080UL
30049 +#define NETLINK_IP6FW_SOCKET__RELABELTO 0x00000100UL
30050 +#define NETLINK_IP6FW_SOCKET__APPEND 0x00000200UL
30051 +#define NETLINK_IP6FW_SOCKET__BIND 0x00000400UL
30052 +#define NETLINK_IP6FW_SOCKET__CONNECT 0x00000800UL
30053 +#define NETLINK_IP6FW_SOCKET__LISTEN 0x00001000UL
30054 +#define NETLINK_IP6FW_SOCKET__ACCEPT 0x00002000UL
30055 +#define NETLINK_IP6FW_SOCKET__GETOPT 0x00004000UL
30056 +#define NETLINK_IP6FW_SOCKET__SETOPT 0x00008000UL
30057 +#define NETLINK_IP6FW_SOCKET__SHUTDOWN 0x00010000UL
30058 +#define NETLINK_IP6FW_SOCKET__RECVFROM 0x00020000UL
30059 +#define NETLINK_IP6FW_SOCKET__SENDTO 0x00040000UL
30060 +#define NETLINK_IP6FW_SOCKET__RECV_MSG 0x00080000UL
30061 +#define NETLINK_IP6FW_SOCKET__SEND_MSG 0x00100000UL
30062 +#define NETLINK_IP6FW_SOCKET__NAME_BIND 0x00200000UL
30063 +#define NETLINK_IP6FW_SOCKET__NLMSG_READ 0x00400000UL
30064 +#define NETLINK_IP6FW_SOCKET__NLMSG_WRITE 0x00800000UL
30065 +#define NETLINK_DNRT_SOCKET__IOCTL 0x00000001UL
30066 +#define NETLINK_DNRT_SOCKET__READ 0x00000002UL
30067 +#define NETLINK_DNRT_SOCKET__WRITE 0x00000004UL
30068 +#define NETLINK_DNRT_SOCKET__CREATE 0x00000008UL
30069 +#define NETLINK_DNRT_SOCKET__GETATTR 0x00000010UL
30070 +#define NETLINK_DNRT_SOCKET__SETATTR 0x00000020UL
30071 +#define NETLINK_DNRT_SOCKET__LOCK 0x00000040UL
30072 +#define NETLINK_DNRT_SOCKET__RELABELFROM 0x00000080UL
30073 +#define NETLINK_DNRT_SOCKET__RELABELTO 0x00000100UL
30074 +#define NETLINK_DNRT_SOCKET__APPEND 0x00000200UL
30075 +#define NETLINK_DNRT_SOCKET__BIND 0x00000400UL
30076 +#define NETLINK_DNRT_SOCKET__CONNECT 0x00000800UL
30077 +#define NETLINK_DNRT_SOCKET__LISTEN 0x00001000UL
30078 +#define NETLINK_DNRT_SOCKET__ACCEPT 0x00002000UL
30079 +#define NETLINK_DNRT_SOCKET__GETOPT 0x00004000UL
30080 +#define NETLINK_DNRT_SOCKET__SETOPT 0x00008000UL
30081 +#define NETLINK_DNRT_SOCKET__SHUTDOWN 0x00010000UL
30082 +#define NETLINK_DNRT_SOCKET__RECVFROM 0x00020000UL
30083 +#define NETLINK_DNRT_SOCKET__SENDTO 0x00040000UL
30084 +#define NETLINK_DNRT_SOCKET__RECV_MSG 0x00080000UL
30085 +#define NETLINK_DNRT_SOCKET__SEND_MSG 0x00100000UL
30086 +#define NETLINK_DNRT_SOCKET__NAME_BIND 0x00200000UL
30087 +#define ASSOCIATION__SENDTO 0x00000001UL
30088 +#define ASSOCIATION__RECVFROM 0x00000002UL
30089 +#define ASSOCIATION__SETCONTEXT 0x00000004UL
30090 +#define ASSOCIATION__POLMATCH 0x00000008UL
30091 +#define NETLINK_KOBJECT_UEVENT_SOCKET__IOCTL 0x00000001UL
30092 +#define NETLINK_KOBJECT_UEVENT_SOCKET__READ 0x00000002UL
30093 +#define NETLINK_KOBJECT_UEVENT_SOCKET__WRITE 0x00000004UL
30094 +#define NETLINK_KOBJECT_UEVENT_SOCKET__CREATE 0x00000008UL
30095 +#define NETLINK_KOBJECT_UEVENT_SOCKET__GETATTR 0x00000010UL
30096 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SETATTR 0x00000020UL
30097 +#define NETLINK_KOBJECT_UEVENT_SOCKET__LOCK 0x00000040UL
30098 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELFROM 0x00000080UL
30099 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RELABELTO 0x00000100UL
30100 +#define NETLINK_KOBJECT_UEVENT_SOCKET__APPEND 0x00000200UL
30101 +#define NETLINK_KOBJECT_UEVENT_SOCKET__BIND 0x00000400UL
30102 +#define NETLINK_KOBJECT_UEVENT_SOCKET__CONNECT 0x00000800UL
30103 +#define NETLINK_KOBJECT_UEVENT_SOCKET__LISTEN 0x00001000UL
30104 +#define NETLINK_KOBJECT_UEVENT_SOCKET__ACCEPT 0x00002000UL
30105 +#define NETLINK_KOBJECT_UEVENT_SOCKET__GETOPT 0x00004000UL
30106 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SETOPT 0x00008000UL
30107 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SHUTDOWN 0x00010000UL
30108 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RECVFROM 0x00020000UL
30109 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SENDTO 0x00040000UL
30110 +#define NETLINK_KOBJECT_UEVENT_SOCKET__RECV_MSG 0x00080000UL
30111 +#define NETLINK_KOBJECT_UEVENT_SOCKET__SEND_MSG 0x00100000UL
30112 +#define NETLINK_KOBJECT_UEVENT_SOCKET__NAME_BIND 0x00200000UL
30113 +#define APPLETALK_SOCKET__IOCTL 0x00000001UL
30114 +#define APPLETALK_SOCKET__READ 0x00000002UL
30115 +#define APPLETALK_SOCKET__WRITE 0x00000004UL
30116 +#define APPLETALK_SOCKET__CREATE 0x00000008UL
30117 +#define APPLETALK_SOCKET__GETATTR 0x00000010UL
30118 +#define APPLETALK_SOCKET__SETATTR 0x00000020UL
30119 +#define APPLETALK_SOCKET__LOCK 0x00000040UL
30120 +#define APPLETALK_SOCKET__RELABELFROM 0x00000080UL
30121 +#define APPLETALK_SOCKET__RELABELTO 0x00000100UL
30122 +#define APPLETALK_SOCKET__APPEND 0x00000200UL
30123 +#define APPLETALK_SOCKET__BIND 0x00000400UL
30124 +#define APPLETALK_SOCKET__CONNECT 0x00000800UL
30125 +#define APPLETALK_SOCKET__LISTEN 0x00001000UL
30126 +#define APPLETALK_SOCKET__ACCEPT 0x00002000UL
30127 +#define APPLETALK_SOCKET__GETOPT 0x00004000UL
30128 +#define APPLETALK_SOCKET__SETOPT 0x00008000UL
30129 +#define APPLETALK_SOCKET__SHUTDOWN 0x00010000UL
30130 +#define APPLETALK_SOCKET__RECVFROM 0x00020000UL
30131 +#define APPLETALK_SOCKET__SENDTO 0x00040000UL
30132 +#define APPLETALK_SOCKET__RECV_MSG 0x00080000UL
30133 +#define APPLETALK_SOCKET__SEND_MSG 0x00100000UL
30134 +#define APPLETALK_SOCKET__NAME_BIND 0x00200000UL
30135 +#define PACKET__SEND 0x00000001UL
30136 +#define PACKET__RECV 0x00000002UL
30137 +#define PACKET__RELABELTO 0x00000004UL
30138 +#define PACKET__FLOW_IN 0x00000008UL
30139 +#define PACKET__FLOW_OUT 0x00000010UL
30140 +#define PACKET__FORWARD_IN 0x00000020UL
30141 +#define PACKET__FORWARD_OUT 0x00000040UL
30142 +#define KEY__VIEW 0x00000001UL
30143 +#define KEY__READ 0x00000002UL
30144 +#define KEY__WRITE 0x00000004UL
30145 +#define KEY__SEARCH 0x00000008UL
30146 +#define KEY__LINK 0x00000010UL
30147 +#define KEY__SETATTR 0x00000020UL
30148 +#define KEY__CREATE 0x00000040UL
30149 +#define DCCP_SOCKET__IOCTL 0x00000001UL
30150 +#define DCCP_SOCKET__READ 0x00000002UL
30151 +#define DCCP_SOCKET__WRITE 0x00000004UL
30152 +#define DCCP_SOCKET__CREATE 0x00000008UL
30153 +#define DCCP_SOCKET__GETATTR 0x00000010UL
30154 +#define DCCP_SOCKET__SETATTR 0x00000020UL
30155 +#define DCCP_SOCKET__LOCK 0x00000040UL
30156 +#define DCCP_SOCKET__RELABELFROM 0x00000080UL
30157 +#define DCCP_SOCKET__RELABELTO 0x00000100UL
30158 +#define DCCP_SOCKET__APPEND 0x00000200UL
30159 +#define DCCP_SOCKET__BIND 0x00000400UL
30160 +#define DCCP_SOCKET__CONNECT 0x00000800UL
30161 +#define DCCP_SOCKET__LISTEN 0x00001000UL
30162 +#define DCCP_SOCKET__ACCEPT 0x00002000UL
30163 +#define DCCP_SOCKET__GETOPT 0x00004000UL
30164 +#define DCCP_SOCKET__SETOPT 0x00008000UL
30165 +#define DCCP_SOCKET__SHUTDOWN 0x00010000UL
30166 +#define DCCP_SOCKET__RECVFROM 0x00020000UL
30167 +#define DCCP_SOCKET__SENDTO 0x00040000UL
30168 +#define DCCP_SOCKET__RECV_MSG 0x00080000UL
30169 +#define DCCP_SOCKET__SEND_MSG 0x00100000UL
30170 +#define DCCP_SOCKET__NAME_BIND 0x00200000UL
30171 +#define DCCP_SOCKET__NODE_BIND 0x00400000UL
30172 +#define DCCP_SOCKET__NAME_CONNECT 0x00800000UL
30173 +#define MEMPROTECT__MMAP_ZERO 0x00000001UL
30174 +#define PEER__RECV 0x00000001UL
30175 +#define CAPABILITY2__MAC_OVERRIDE 0x00000001UL
30176 +#define CAPABILITY2__MAC_ADMIN 0x00000002UL
30177 +#define KERNEL_SERVICE__USE_AS_OVERRIDE 0x00000001UL
30178 +#define KERNEL_SERVICE__CREATE_FILES_AS 0x00000002UL
30179 +#define TUN_SOCKET__IOCTL 0x00000001UL
30180 +#define TUN_SOCKET__READ 0x00000002UL
30181 +#define TUN_SOCKET__WRITE 0x00000004UL
30182 +#define TUN_SOCKET__CREATE 0x00000008UL
30183 +#define TUN_SOCKET__GETATTR 0x00000010UL
30184 +#define TUN_SOCKET__SETATTR 0x00000020UL
30185 +#define TUN_SOCKET__LOCK 0x00000040UL
30186 +#define TUN_SOCKET__RELABELFROM 0x00000080UL
30187 +#define TUN_SOCKET__RELABELTO 0x00000100UL
30188 +#define TUN_SOCKET__APPEND 0x00000200UL
30189 +#define TUN_SOCKET__BIND 0x00000400UL
30190 +#define TUN_SOCKET__CONNECT 0x00000800UL
30191 +#define TUN_SOCKET__LISTEN 0x00001000UL
30192 +#define TUN_SOCKET__ACCEPT 0x00002000UL
30193 +#define TUN_SOCKET__GETOPT 0x00004000UL
30194 +#define TUN_SOCKET__SETOPT 0x00008000UL
30195 +#define TUN_SOCKET__SHUTDOWN 0x00010000UL
30196 +#define TUN_SOCKET__RECVFROM 0x00020000UL
30197 +#define TUN_SOCKET__SENDTO 0x00040000UL
30198 +#define TUN_SOCKET__RECV_MSG 0x00080000UL
30199 +#define TUN_SOCKET__SEND_MSG 0x00100000UL
30200 +#define TUN_SOCKET__NAME_BIND 0x00200000UL
30203 diff -NurpP --minimal linux-2.6.33.1/security/selinux/hooks.c linux-2.6.33.1-vs2.3.0.36.30.4/security/selinux/hooks.c
30204 --- linux-2.6.33.1/security/selinux/hooks.c 2010-02-25 11:52:12.000000000 +0100
30205 +++ linux-2.6.33.1-vs2.3.0.36.30.4/security/selinux/hooks.c 2010-02-25 12:02:16.000000000 +0100
30207 #include <linux/dccp.h>
30208 #include <linux/quota.h>
30209 #include <linux/un.h> /* for Unix socket types */
30210 -#include <net/af_unix.h> /* for Unix socket types */
30211 #include <linux/parser.h>
30212 #include <linux/nfs_mount.h>
30213 #include <net/ipv6.h>