Zhou Chengming
00cf64fbaa
sysctl: Drop reference added by grab_header in proc_sys_readdir
...
commit 93362fa47fe98b62e4a34ab408c4a418432e7939 upstream.
Fixes CVE-2016-9191, proc_sys_readdir doesn't drop reference
added by grab_header when return from !dir_emit_dots path.
It can cause any path called unregister_sysctl_table will
wait forever.
The calltrace of CVE-2016-9191:
[ 5535.960522] Call Trace:
[ 5535.963265] [<ffffffff817cdaaf>] schedule+0x3f/0xa0
[ 5535.968817] [<ffffffff817d33fb>] schedule_timeout+0x3db/0x6f0
[ 5535.975346] [<ffffffff817cf055>] ? wait_for_completion+0x45/0x130
[ 5535.982256] [<ffffffff817cf0d3>] wait_for_completion+0xc3/0x130
[ 5535.988972] [<ffffffff810d1fd0>] ? wake_up_q+0x80/0x80
[ 5535.994804] [<ffffffff8130de64>] drop_sysctl_table+0xc4/0xe0
[ 5536.001227] [<ffffffff8130de17>] drop_sysctl_table+0x77/0xe0
[ 5536.007648] [<ffffffff8130decd>] unregister_sysctl_table+0x4d/0xa0
[ 5536.014654] [<ffffffff8130deff>] unregister_sysctl_table+0x7f/0xa0
[ 5536.021657] [<ffffffff810f57f5>] unregister_sched_domain_sysctl+0x15/0x40
[ 5536.029344] [<ffffffff810d7704>] partition_sched_domains+0x44/0x450
[ 5536.036447] [<ffffffff817d0761>] ? __mutex_unlock_slowpath+0x111/0x1f0
[ 5536.043844] [<ffffffff81167684>] rebuild_sched_domains_locked+0x64/0xb0
[ 5536.051336] [<ffffffff8116789d>] update_flag+0x11d/0x210
[ 5536.057373] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450
[ 5536.064186] [<ffffffff81167acb>] ? cpuset_css_offline+0x1b/0x60
[ 5536.070899] [<ffffffff810fce3d>] ? trace_hardirqs_on+0xd/0x10
[ 5536.077420] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450
[ 5536.084234] [<ffffffff8115a9f5>] ? css_killed_work_fn+0x25/0x220
[ 5536.091049] [<ffffffff81167ae5>] cpuset_css_offline+0x35/0x60
[ 5536.097571] [<ffffffff8115aa2c>] css_killed_work_fn+0x5c/0x220
[ 5536.104207] [<ffffffff810bc83f>] process_one_work+0x1df/0x710
[ 5536.110736] [<ffffffff810bc7c0>] ? process_one_work+0x160/0x710
[ 5536.117461] [<ffffffff810bce9b>] worker_thread+0x12b/0x4a0
[ 5536.123697] [<ffffffff810bcd70>] ? process_one_work+0x710/0x710
[ 5536.130426] [<ffffffff810c3f7e>] kthread+0xfe/0x120
[ 5536.135991] [<ffffffff817d4baf>] ret_from_fork+0x1f/0x40
[ 5536.142041] [<ffffffff810c3e80>] ? kthread_create_on_node+0x230/0x230
One cgroup maintainer mentioned that "cgroup is trying to offline
a cpuset css, which takes place under cgroup_mutex. The offlining
ends up trying to drain active usages of a sysctl table which apprently
is not happening."
The real reason is that proc_sys_readdir doesn't drop reference added
by grab_header when return from !dir_emit_dots path. So this cpuset
offline path will wait here forever.
See here for details: http://www.openwall.com/lists/oss-security/2016/11/04/13
Fixes: f0c3b5093add ("[readdir] convert procfs")
Reported-by: CAI Qian <caiqian@redhat.com>
Tested-by: Yang Shukui <yangshukui@huawei.com>
Signed-off-by: Zhou Chengming <zhouchengming1@huawei.com>
Acked-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-19 20:18:04 +01:00
..
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-13 17:03:52 +01:00
2016-10-11 15:06:31 -07:00
2016-10-15 12:09:13 -07:00
2016-10-10 23:02:51 -04:00
2017-01-19 20:18:02 +01:00
2016-10-10 20:16:43 -07:00
2016-12-08 14:32:16 +01:00
2017-01-06 10:40:16 +01:00
2016-10-10 20:16:43 -07:00
2016-10-10 23:02:51 -04:00
2017-01-12 11:39:06 +01:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-10 09:54:00 -05:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-27 18:43:43 -07:00
2016-10-06 09:07:44 -04:00
2016-10-18 11:29:35 +02:00
2017-01-06 10:40:14 +01:00
2017-01-12 11:39:35 +01:00
2016-10-10 20:16:43 -07:00
2016-12-06 16:18:45 +01:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-11-30 10:41:26 -08:00
2016-10-12 23:19:18 -04:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-27 17:47:11 +02:00
2016-10-11 15:06:33 -07:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2017-01-09 08:32:25 +01:00
2016-11-01 15:24:43 -04:00
2016-10-10 20:16:43 -07:00
2017-01-09 08:32:22 +01:00
2016-10-30 13:09:42 -04:00
2017-01-19 20:17:59 +01:00
2016-10-10 20:16:43 -07:00
2016-09-27 21:06:21 -04:00
2016-11-16 11:52:19 -05:00
2016-11-29 10:20:24 +01:00
2017-01-19 20:18:04 +01:00
2016-10-10 20:16:43 -07:00
2016-08-15 17:43:31 +02:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2016-10-07 21:48:36 -04:00
2016-10-14 12:18:50 -07:00
2016-10-10 20:16:43 -07:00
2016-09-27 21:06:21 -04:00
2016-10-28 14:48:31 +02:00
2016-10-10 20:16:43 -07:00
2016-10-10 20:16:43 -07:00
2017-01-19 20:18:00 +01:00
2016-10-30 13:09:42 -04:00
2016-10-10 20:16:43 -07:00
2017-01-09 08:32:24 +01:00
2016-07-25 16:51:49 +10:00
2016-09-14 21:28:10 +02:00
2016-08-02 19:35:15 -04:00
2016-07-28 13:29:12 +10:00
2016-09-27 21:06:22 -04:00
2017-01-09 08:32:21 +01:00
2016-10-11 15:06:33 -07:00
2016-08-23 22:58:51 -07:00
2016-09-24 09:27:18 +02:00
2016-09-27 21:20:53 -04:00
2016-11-11 08:12:37 -08:00
2016-10-07 18:46:28 -07:00
2017-01-19 20:18:03 +01:00
2016-10-03 20:38:55 -04:00
2017-01-06 10:40:13 +01:00
2016-09-27 18:47:38 -04:00
2016-08-09 19:58:06 -06:00
2016-10-10 20:16:43 -07:00
2016-10-10 13:04:49 -07:00
2016-09-15 13:29:52 -07:00
2016-10-24 14:20:25 +11:00
2016-10-07 18:46:29 -07:00
2016-08-12 16:47:05 +01:00
2016-10-10 20:16:43 -07:00
2016-10-18 12:21:28 +02:00
2016-08-31 11:44:36 -04:00
2016-09-30 12:46:48 -05:00
2016-08-07 14:41:02 -06:00
2016-10-14 17:23:33 -07:00
2017-01-19 20:18:03 +01:00
2016-10-10 20:16:43 -07:00
2016-10-13 20:28:22 -07:00
2016-10-11 15:06:32 -07:00
2016-09-30 12:46:48 -05:00
2016-09-30 12:46:48 -05:00
2016-10-10 20:16:43 -07:00
2016-10-14 20:00:34 -04:00
2016-10-11 15:06:30 -07:00
2016-10-07 18:46:30 -07:00
2017-01-06 10:40:12 +01:00
2016-10-14 20:41:59 -04:00
2016-07-26 16:19:19 -07:00
2016-10-08 11:06:08 -04:00
2016-11-17 00:00:23 -05:00