kernel_optimize_test/kernel
Paul Menage 307257cf47 cgroups: fix a race between rmdir and remount
When a cgroup is removed, it's unlinked from its parent's children list,
but not actually freed until the last dentry on it is released (at which
point cgrp->root->number_of_cgroups is decremented).

Currently rebind_subsystems checks for the top cgroup's child list being
empty in order to rebind subsystems into or out of a hierarchy - this can
result in the set of subsystems bound to a hierarchy being
removed-but-not-freed cgroup.

The simplest fix for this is to forbid remounts that change the set of
subsystems on a hierarchy that has removed-but-not-freed cgroups.  This
bug can be reproduced via:

mkdir /mnt/cg
mount -t cgroup -o ns,freezer cgroup /mnt/cg
mkdir /mnt/cg/foo
sleep 1h < /mnt/cg/foo &
rmdir /mnt/cg/foo
mount -t cgroup -o remount,ns,devices,freezer cgroup /mnt/cg
kill $!

Though the above will cause oops in -mm only but not mainline, but the bug
can cause memory leak in mainline (and even oops)

Signed-off-by: Paul Menage <menage@google.com>
Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-12-15 16:27:07 -08:00
..
irq genirq: __irq_set_trigger: change pr_warning to pr_debug 2008-11-13 11:59:48 +01:00
power [PATCH] kill obsolete temporary comment in swsusp_close() 2008-12-04 04:22:54 -05:00
time time: catch xtime_nsec underflows and fix them 2008-12-04 08:43:02 +01:00
trace ftrace: prevent recursion 2008-11-27 10:11:53 +01:00
.gitignore
acct.c
audit_tree.c Fix inotify watch removal/umount races 2008-11-15 12:26:44 -08:00
audit.c [PATCH] fix broken timestamps in AVC generated by kernel threads 2008-12-09 02:27:41 -05:00
audit.h
auditfilter.c Fix inotify watch removal/umount races 2008-11-15 12:26:44 -08:00
auditsc.c [PATCH] fix broken timestamps in AVC generated by kernel threads 2008-12-09 02:27:41 -05:00
backtracetest.c
bounds.c
capability.c
cgroup_debug.c
cgroup_freezer.c freezer_cg: disable writing freezer.state of root cgroup 2008-11-12 17:17:16 -08:00
cgroup.c cgroups: fix a race between rmdir and remount 2008-12-15 16:27:07 -08:00
compat.c
configs.c
cpu.c cpuinit fixes in kernel/* 2008-11-30 10:03:37 -08:00
cpuset.c sched, cpusets: fix warning in kernel/cpuset.c 2008-11-29 20:39:29 +01:00
delayacct.c
dma-coherent.c
dma.c
exec_domain.c
exit.c Move "exit_robust_list" into mm_release() 2008-11-15 10:20:36 -08:00
extable.c
fork.c fix mapping_writably_mapped() 2008-12-10 14:40:45 -08:00
freezer.c
futex_compat.c
futex.c
hrtimer.c hrtimer: clean up unused callback modes 2008-11-12 09:54:40 +01:00
itimer.c
kallsyms.c sprint_symbol(): use less stack 2008-11-19 18:49:58 -08:00
Kconfig.freezer
Kconfig.hz
Kconfig.preempt
kexec.c
kfifo.c
kgdb.c
kmod.c
kprobes.c kernel/kprobes.c: don't pad kretprobe_table_locks[] on uniprocessor builds 2008-11-12 17:17:17 -08:00
ksysfs.c
kthread.c
latencytop.c KSYM_SYMBOL_LEN fixes 2008-12-10 08:01:54 -08:00
lockdep_internals.h
lockdep_proc.c
lockdep.c lockdep: consistent alignement for lockdep info 2008-11-21 08:59:40 +01:00
Makefile Remove -mno-spe flags as they dont belong 2008-11-17 13:24:35 -08:00
marker.c
module.c
mutex-debug.c
mutex-debug.h
mutex.c
mutex.h
notifier.c
ns_cgroup.c
nsproxy.c
panic.c taint: add missing comment 2008-12-01 19:55:24 -08:00
params.c
pid_namespace.c
pid.c
pm_qos_params.c
posix-cpu-timers.c posix-cpu-timers: fix clock_gettime with CLOCK_PROCESS_CPUTIME_ID 2008-11-24 16:41:40 +01:00
posix-timers.c
printk.c
profile.c cpuinit fixes in kernel/* 2008-11-30 10:03:37 -08:00
ptrace.c remove __ARCH_WANT_COMPAT_SYS_PTRACE 2008-11-30 11:00:15 -08:00
rcuclassic.c
rcupdate.c
rcupreempt_trace.c
rcupreempt.c
rcutorture.c
relay.c relayfs: fix infinite loop with splice() 2008-12-10 08:01:52 -08:00
res_counter.c
resource.c reserve_region_with_split: Fix GFP_KERNEL usage under spinlock 2008-11-01 09:53:58 -07:00
rtmutex_common.h
rtmutex-debug.c
rtmutex-debug.h
rtmutex-tester.c
rtmutex.c
rtmutex.h
rwsem.c
sched_clock.c Revert "sched_clock: prevent scd->clock from moving backwards" 2008-12-14 16:23:17 -08:00
sched_cpupri.c
sched_cpupri.h
sched_debug.c sched: fix kernel warning on /proc/sched_debug access 2008-11-16 08:07:15 +01:00
sched_fair.c sched: release buddies on yield 2008-11-11 11:57:22 +01:00
sched_features.h sched: backward looking buddy 2008-11-05 10:30:14 +01:00
sched_idletask.c
sched_rt.c
sched_stats.h sched, signals: fix the racy usage of ->signal in account_group_xxx/run_posix_cpu_timers 2008-11-17 16:49:35 +01:00
sched.c sched: CPU remove deadlock fix 2008-12-09 19:27:03 +01:00
seccomp.c
semaphore.c
signal.c
smp.c generic-ipi: fix the smp_mb() placement 2008-11-06 08:41:56 +01:00
softirq.c irq: call __irq_enter() before calling the tick_idle_check 2008-11-10 22:36:39 +01:00
softlockup.c check_hung_task(): unsigned sysctl_hung_task_warnings cannot be less than 0 2008-12-03 10:11:51 +01:00
spinlock.c
srcu.c
stacktrace.c
stop_machine.c stop_machine: fix race with return value (fixes Bug #11989) 2008-11-16 15:09:52 -08:00
sys_ni.c reintroduce accept4 2008-11-19 18:49:57 -08:00
sys.c
sysctl_check.c
sysctl.c epoll: introduce resource usage limits 2008-12-01 19:55:24 -08:00
taskstats.c
test_kprobes.c
time.c
timeconst.pl
timer.c Add round_jiffies_up and related routines 2008-11-06 08:42:48 +01:00
tracepoint.c
tsacct.c
uid16.c
user_namespace.c
user.c
utsname_sysctl.c
utsname.c
wait.c
workqueue.c cpumask: introduce new API, without changing anything 2008-11-06 09:05:33 +01:00