Michal Hocko
2bcf2e92c3
memcg: oom_notify use-after-free fix
Paul Furtado has reported the following GPF:
general protection fault: 0000 [#1] SMP
Modules linked in: ipv6 dm_mod xen_netfront coretemp hwmon x86_pkg_temp_thermal crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel ablk_helper cryptd lrw gf128mul glue_helper aes_x86_64 microcode pcspkr ext4 jbd2 mbcache raid0 xen_blkfront
CPU: 3 PID: 3062 Comm: java Not tainted 3.16.0-rc5 #1
task: ffff8801cfe8f170 ti: ffff8801d2ec4000 task.ti: ffff8801d2ec4000
RIP: e030:mem_cgroup_oom_synchronize+0x140/0x240
RSP: e02b:ffff8801d2ec7d48 EFLAGS: 00010283
RAX: 0000000000000001 RBX: ffff88009d633800 RCX: 000000000000000e
RDX: fffffffffffffffe RSI: ffff88009d630200 RDI: ffff88009d630200
RBP: ffff8801d2ec7da8 R08: 0000000000000012 R09: 00000000fffffffe
R10: 0000000000000000 R11: 0000000000000000 R12: ffff88009d633800
R13: ffff8801d2ec7d48 R14: dead000000100100 R15: ffff88009d633a30
FS: 00007f1748bb4700(0000) GS:ffff8801def80000(0000) knlGS:0000000000000000
CS: e033 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 00007f4110300308 CR3: 00000000c05f7000 CR4: 0000000000002660
Call Trace:
pagefault_out_of_memory+0x18/0x90
mm_fault_error+0xa9/0x1a0
__do_page_fault+0x478/0x4c0
do_page_fault+0x2c/0x40
page_fault+0x28/0x30
Code: 44 00 00 48 89 df e8 40 ca ff ff 48 85 c0 49 89 c4 74 35 4c 8b b0 30 02 00 00 4c 8d b8 30 02 00 00 4d 39 fe 74 1b 0f 1f 44 00 00 <49> 8b 7e 10 be 01 00 00 00 e8 42 d2 04 00 4d 8b 36 4d 39 fe 75
RIP mem_cgroup_oom_synchronize+0x140/0x240
Commit fb2a6fc56b
("mm: memcg: rework and document OOM waiting and
wakeup") has moved mem_cgroup_oom_notify outside of memcg_oom_lock
assuming it is protected by the hierarchical OOM-lock.
Although this is true for the notification part the protection doesn't
cover unregistration of event which can happen in parallel now so
mem_cgroup_oom_notify can see already unlinked and/or freed
mem_cgroup_eventfd_list.
Fix this by using memcg_oom_lock also in mem_cgroup_oom_notify.
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=80881
Fixes: fb2a6fc56b
(mm: memcg: rework and document OOM waiting and wakeup)
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Reported-by: Paul Furtado <paulfurtado91@gmail.com>
Tested-by: Paul Furtado <paulfurtado91@gmail.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: <stable@vger.kernel.org> [3.12+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-07-30 17:16:13 -07:00
..
2014-04-18 14:20:48 +02:00
2014-01-23 16:36:50 -08:00
2013-11-13 12:09:09 +09:00
2014-01-23 16:36:50 -08:00
2014-06-04 16:54:11 -07:00
2011-12-06 09:24:07 +01:00
2014-06-04 16:54:08 -07:00
2014-04-07 16:36:15 -07:00
2013-03-03 22:46:22 -05:00
2012-01-03 22:54:56 -05:00
2013-11-06 12:40:26 +01:00
2014-06-12 10:30:18 -07:00
2014-06-06 16:08:17 -07:00
2014-06-04 16:54:07 -07:00
2014-06-04 16:54:05 -07:00
2012-12-20 08:37:05 -08:00
2014-06-23 16:47:44 -07:00
2014-05-16 13:22:48 -04:00
2014-07-23 15:10:55 -07:00
2014-01-21 16:19:48 -08:00
2011-07-26 16:49:47 -07:00
2014-06-04 16:54:11 -07:00
2012-10-09 16:22:42 +09:00
2014-05-06 17:39:45 -04:00
2014-06-04 16:54:14 -07:00
2012-01-10 16:30:42 -08:00
2010-03-30 22:02:32 +09:00
2014-06-06 16:08:18 -07:00
2014-06-06 16:08:17 -07:00
2014-06-23 16:47:44 -07:00
2014-04-03 16:21:01 -07:00
2011-10-31 09:20:12 -04:00
2014-05-23 09:37:29 -07:00
2014-06-04 16:54:04 -07:00
2014-06-06 16:08:17 -07:00
2014-07-30 17:16:13 -07:00
2014-06-04 16:54:06 -07:00
2014-07-30 17:16:13 -07:00
2014-07-23 15:10:54 -07:00
2014-07-10 11:38:23 -07:00
2014-06-06 16:08:17 -07:00
2014-07-26 14:38:50 -07:00
2014-04-03 16:21:00 -07:00
2014-04-07 16:35:57 -07:00
2014-01-27 21:02:39 -08:00
2014-06-06 16:08:18 -07:00
2014-02-21 08:50:17 +01:00
2014-01-23 16:36:52 -08:00
2013-10-09 14:47:45 +02:00
2014-04-07 16:35:50 -07:00
2014-05-11 17:55:48 +09:00
2014-07-03 09:21:53 -07:00
2014-06-06 16:08:17 -07:00
2014-06-23 16:47:43 -07:00
2014-01-30 16:56:56 -08:00
2014-07-30 17:16:13 -07:00
2014-04-03 16:21:02 -07:00
2014-06-14 19:30:48 -05:00
2013-09-11 15:57:48 -07:00
2014-07-30 17:16:13 -07:00
2013-10-30 14:27:03 -07:00
2010-10-02 10:28:42 +03:00
2012-06-20 14:39:36 -07:00
2014-04-14 16:18:06 -04:00
2013-12-18 19:04:51 -08:00
2014-05-06 17:32:49 -04:00
2011-10-31 09:20:11 -04:00
2014-04-07 16:35:58 -07:00
2014-07-23 15:10:54 -07:00
2014-07-23 15:10:55 -07:00
2014-07-22 18:38:27 -04:00
2014-06-23 16:47:44 -07:00
2014-06-04 16:54:01 -07:00
2014-06-04 16:53:59 -07:00
2014-07-03 09:21:53 -07:00
2014-01-21 16:19:47 -08:00
2014-04-07 16:35:54 -07:00
2014-06-04 16:54:09 -07:00
2014-06-04 16:54:10 -07:00
2014-06-04 16:54:12 -07:00
2014-07-23 15:10:55 -07:00
2014-05-06 14:02:53 -04:00
2014-06-04 16:53:57 -07:00
2014-06-04 16:54:14 -07:00
2014-02-03 13:24:01 -05:00
2014-06-12 10:30:18 -07:00
2014-06-04 16:54:07 -07:00
2014-04-03 16:21:01 -07:00
2014-06-04 16:54:13 -07:00
2014-06-04 16:54:13 -07:00
2014-06-04 16:54:14 -07:00