Vasily Averin
d7d62156f4
netfilter: x_tables: gpf inside xt_find_revision()
commit 8e24edddad upstream.
nested target/match_revfn() calls work with xt[NFPROTO_UNSPEC] lists
without taking xt[NFPROTO_UNSPEC].mutex. This can race with module unload
and cause host to crash:
general protection fault: 0000 [#1]
Modules linked in: ... [last unloaded: xt_cluster]
CPU: 0 PID: 542455 Comm: iptables
RIP: 0010:[<ffffffff8ffbd518>] [<ffffffff8ffbd518>] strcmp+0x18/0x40
RDX: 0000000000000003 RSI: ffff9a5a5d9abe10 RDI: dead000000000111
R13: ffff9a5a5d9abe10 R14: ffff9a5a5d9abd8c R15: dead000000000100
(VvS: %R15 -- &xt_match, %RDI -- &xt_match.name,
xt_cluster unregister match in xt[NFPROTO_UNSPEC].match list)
Call Trace:
[<ffffffff902ccf44>] match_revfn+0x54/0xc0
[<ffffffff902ccf9f>] match_revfn+0xaf/0xc0
[<ffffffff902cd01e>] xt_find_revision+0x6e/0xf0
[<ffffffffc05a5be0>] do_ipt_get_ctl+0x100/0x420 [ip_tables]
[<ffffffff902cc6bf>] nf_getsockopt+0x4f/0x70
[<ffffffff902dd99e>] ip_getsockopt+0xde/0x100
[<ffffffff903039b5>] raw_getsockopt+0x25/0x50
[<ffffffff9026c5da>] sock_common_getsockopt+0x1a/0x20
[<ffffffff9026b89d>] SyS_getsockopt+0x7d/0xf0
[<ffffffff903cbf92>] system_call_fastpath+0x25/0x2a
Fixes: 656caff20e ("netfilter 04/09: x_tables: fix match/target revision lookup")
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Reviewed-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-17 16:10:13 +01:00
..
2021-01-12 19:49:05 +01:00
2020-10-29 09:05:45 +01:00
2021-02-23 13:59:16 +01:00
2019-09-21 07:14:16 +02:00
2020-07-09 09:35:57 +02:00
2020-10-14 09:48:14 +02:00
2020-06-03 08:16:46 +02:00
2018-08-24 13:12:41 +02:00
2019-01-13 10:03:48 +01:00
2021-01-23 15:38:18 +01:00
2018-10-20 09:51:32 +02:00
2020-09-12 11:47:33 +02:00
2020-03-20 09:07:46 +01:00
2019-08-25 10:51:22 +02:00
2019-02-20 10:18:34 +01:00
2021-02-03 23:19:51 +01:00
2020-04-02 17:20:35 +02:00
2019-02-20 10:18:34 +01:00
2020-06-20 10:24:15 +02:00
2020-09-12 11:47:33 +02:00
2019-05-04 08:49:06 +02:00
2021-03-17 16:10:13 +01:00
2020-02-28 15:42:51 +01:00
2020-02-28 15:42:56 +01:00
2018-11-27 16:09:39 +01:00
2019-04-05 22:29:14 +02:00
2021-01-12 19:49:05 +01:00
2021-02-23 13:59:16 +01:00