Ido Schimmel
3ebaf6da07
net: sched: Do not assume RTNL is held in tunnel key action helpers
The cited commit removed RTNL from tc_setup_flow_action(), but the
function calls two tunnel key action helpers that use rtnl_dereference()
to fetch the action's parameters. This leads to "suspicious RCU usage"
warnings [1][2].
Change the helpers to use rcu_dereference_protected() while requiring
the action's lock to be held. This is safe because the two helpers are
only called from tc_setup_flow_action() which acquires the lock.
[1]
[ 156.950855] =============================
[ 156.955463] WARNING: suspicious RCU usage
[ 156.960085] 5.6.0-rc5-custom-47426-gdfe43878d573 #2409 Not tainted
[ 156.967116] -----------------------------
[ 156.971728] include/net/tc_act/tc_tunnel_key.h:31 suspicious rcu_dereference_protected() usage!
[ 156.981583]
[ 156.981583] other info that might help us debug this:
[ 156.981583]
[ 156.990675]
[ 156.990675] rcu_scheduler_active = 2, debug_locks = 1
[ 156.998205] 1 lock held by tc/877:
[ 157.002187] #0: ffff8881cbf7bea0 (&(&p->tcfa_lock)->rlock){+...}, at: tc_setup_flow_action+0xbe/0x4f78
[ 157.012866]
[ 157.012866] stack backtrace:
[ 157.017886] CPU: 2 PID: 877 Comm: tc Not tainted 5.6.0-rc5-custom-47426-gdfe43878d573 #2409
[ 157.027253] Hardware name: Mellanox Technologies Ltd. MSN2100-CB2FO/SA001017, BIOS 5.6.5 06/07/2016
[ 157.037389] Call Trace:
[ 157.040170] dump_stack+0xfd/0x178
[ 157.044034] lockdep_rcu_suspicious+0x14a/0x153
[ 157.049157] tc_setup_flow_action+0x89f/0x4f78
[ 157.054227] fl_hw_replace_filter+0x375/0x640
[ 157.064348] fl_change+0x28ec/0x4f6b
[ 157.088843] tc_new_tfilter+0x15e2/0x2260
[ 157.176801] rtnetlink_rcv_msg+0x8d6/0xb60
[ 157.190915] netlink_rcv_skb+0x177/0x460
[ 157.208884] rtnetlink_rcv+0x21/0x30
[ 157.212925] netlink_unicast+0x5d0/0x7f0
[ 157.227728] netlink_sendmsg+0x981/0xe90
[ 157.245416] ____sys_sendmsg+0x76d/0x8f0
[ 157.255348] ___sys_sendmsg+0x10f/0x190
[ 157.320308] __sys_sendmsg+0x115/0x1f0
[ 157.342553] __x64_sys_sendmsg+0x7d/0xc0
[ 157.346987] do_syscall_64+0xc1/0x600
[ 157.351142] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[2]
[ 157.432346] =============================
[ 157.436937] WARNING: suspicious RCU usage
[ 157.441537] 5.6.0-rc5-custom-47426-gdfe43878d573 #2409 Not tainted
[ 157.448559] -----------------------------
[ 157.453204] include/net/tc_act/tc_tunnel_key.h:43 suspicious rcu_dereference_protected() usage!
[ 157.463042]
[ 157.463042] other info that might help us debug this:
[ 157.463042]
[ 157.472112]
[ 157.472112] rcu_scheduler_active = 2, debug_locks = 1
[ 157.479529] 1 lock held by tc/877:
[ 157.483442] #0: ffff8881cbf7bea0 (&(&p->tcfa_lock)->rlock){+...}, at: tc_setup_flow_action+0xbe/0x4f78
[ 157.494119]
[ 157.494119] stack backtrace:
[ 157.499114] CPU: 2 PID: 877 Comm: tc Not tainted 5.6.0-rc5-custom-47426-gdfe43878d573 #2409
[ 157.508485] Hardware name: Mellanox Technologies Ltd. MSN2100-CB2FO/SA001017, BIOS 5.6.5 06/07/2016
[ 157.518628] Call Trace:
[ 157.521416] dump_stack+0xfd/0x178
[ 157.525293] lockdep_rcu_suspicious+0x14a/0x153
[ 157.530425] tc_setup_flow_action+0x993/0x4f78
[ 157.535505] fl_hw_replace_filter+0x375/0x640
[ 157.545650] fl_change+0x28ec/0x4f6b
[ 157.570204] tc_new_tfilter+0x15e2/0x2260
[ 157.658199] rtnetlink_rcv_msg+0x8d6/0xb60
[ 157.672315] netlink_rcv_skb+0x177/0x460
[ 157.690278] rtnetlink_rcv+0x21/0x30
[ 157.694320] netlink_unicast+0x5d0/0x7f0
[ 157.709129] netlink_sendmsg+0x981/0xe90
[ 157.726813] ____sys_sendmsg+0x76d/0x8f0
[ 157.736725] ___sys_sendmsg+0x10f/0x190
[ 157.801721] __sys_sendmsg+0x115/0x1f0
[ 157.823967] __x64_sys_sendmsg+0x7d/0xc0
[ 157.828403] do_syscall_64+0xc1/0x600
[ 157.832558] entry_SYSCALL_64_after_hwframe+0x49/0xbe
Fixes: b15e7a6e8d ("net: sched: don't take rtnl lock during flow_action setup")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Reviewed-by: Vlad Buslov <vladbu@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-19 20:25:52 -07:00
..
2019-05-30 11:29:21 -07:00
2020-01-15 22:28:51 +01:00
2019-05-30 11:29:22 -07:00
2018-09-26 09:56:07 -07:00
2020-03-15 15:27:49 +01:00
2020-03-12 12:08:09 -07:00
2020-02-27 12:06:20 -08:00
2019-06-05 17:37:07 +02:00
2020-02-29 21:52:19 -08:00
2020-03-19 20:25:52 -07:00
2020-03-08 21:07:48 -07:00
2019-12-16 16:09:44 -08:00
2019-05-30 11:26:41 -07:00
2019-05-30 11:26:32 -07:00
2020-02-28 12:12:53 -08:00
2019-12-11 15:01:23 -08:00
2019-11-06 16:14:48 -08:00
2019-01-23 11:18:00 -08:00
2019-06-19 17:09:55 +02:00
2020-02-24 13:31:42 -08:00
2019-05-24 17:37:53 +02:00
2019-05-21 11:28:40 +02:00
2019-07-04 12:30:48 -07:00
2020-02-28 12:08:37 -08:00
2020-02-27 18:50:19 -08:00
2019-10-30 17:34:35 -07:00
2019-05-21 11:28:45 +02:00
2019-06-19 17:09:55 +02:00
2020-02-24 13:56:57 +01:00
2020-02-29 14:39:08 +01:00
2019-05-30 11:26:32 -07:00
2019-05-21 11:28:45 +02:00
2019-05-30 11:26:32 -07:00
2019-04-19 14:07:40 -07:00
2019-05-30 11:29:52 -07:00
2019-05-30 11:29:52 -07:00
2020-02-25 11:05:54 -08:00
2020-02-29 21:52:20 -08:00
2019-05-21 11:52:39 +02:00
2019-05-21 11:52:39 +02:00
2020-02-25 11:05:54 -08:00
2020-03-03 18:57:49 -08:00
2019-12-16 16:09:44 -08:00
2018-03-05 12:52:45 -05:00
2019-12-24 22:28:54 -08:00
2019-12-24 22:28:55 -08:00
2018-05-20 18:31:42 -04:00
2019-12-09 09:59:07 +01:00
2019-06-19 17:09:55 +02:00
2018-05-28 22:59:54 -04:00
2019-12-24 22:37:30 -08:00
2020-03-03 13:28:48 -08:00
2020-02-17 21:33:28 -08:00
2020-03-17 21:12:39 -07:00
2019-02-27 12:50:17 -08:00
2019-11-08 09:11:49 +01:00
2019-10-23 20:13:22 -07:00
2019-12-09 10:36:44 -08:00
2019-11-05 18:20:55 -08:00
2019-10-06 15:44:47 +02:00
2019-03-22 12:09:31 -07:00
2018-12-10 15:53:04 -08:00
2019-07-01 10:58:23 -07:00
2019-10-25 16:24:32 -07:00
2020-02-13 14:19:00 -08:00
2019-02-22 12:56:24 -08:00
2019-05-30 11:26:41 -07:00
2019-08-28 14:43:03 -07:00
2019-04-22 21:50:53 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-07-03 13:51:54 -07:00
2020-03-09 22:34:58 +01:00
2018-10-17 17:45:07 -07:00
2019-08-08 15:55:10 -07:00
2019-12-13 21:40:49 -08:00
2020-03-02 11:16:28 -08:00
2019-09-27 12:05:02 +02:00
2019-02-08 21:50:15 -08:00
2020-02-19 11:20:59 -08:00
2020-03-02 11:16:28 -08:00
2020-02-29 21:52:20 -08:00
2019-06-18 20:48:45 -04:00
2020-03-02 11:16:28 -08:00
2019-12-09 10:36:44 -08:00
2019-11-02 13:54:56 -07:00
2019-12-07 11:55:11 -08:00
2019-06-19 11:37:47 -04:00
2019-12-04 12:27:13 -08:00
2020-02-24 13:31:42 -08:00
2020-02-05 14:28:09 +01:00
2018-03-27 09:51:23 +02:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2018-07-11 23:10:19 -07:00
2019-10-08 13:23:05 -07:00
2018-09-13 09:04:58 -07:00
2020-02-29 21:52:20 -08:00
2020-02-24 14:07:01 +01:00
2019-05-30 11:26:41 -07:00
2020-03-16 01:42:31 -07:00
2020-03-02 11:16:27 -08:00
2020-02-29 21:52:20 -08:00
2020-02-28 12:08:37 -08:00
2019-06-05 17:36:38 +02:00
2020-01-30 10:55:54 +01:00
2019-12-09 10:36:44 -08:00
2020-02-29 21:52:20 -08:00
2020-02-29 21:52:20 -08:00
2018-05-28 22:59:54 -04:00
2020-01-17 13:25:24 +01:00
2018-08-01 09:52:30 -07:00
2019-05-21 11:28:45 +02:00
2019-12-12 17:07:05 -08:00
2019-11-12 08:18:03 -08:00
2019-04-11 13:59:49 -07:00
2020-02-29 21:52:20 -08:00
2020-02-20 10:09:25 -08:00
2020-03-04 13:25:55 -08:00
2019-05-30 11:26:32 -07:00
2020-03-14 21:03:46 -07:00
2020-03-17 21:16:34 -07:00
2019-05-30 11:26:32 -07:00
2019-09-16 09:18:03 +02:00
2019-05-30 11:26:32 -07:00
2020-03-14 21:03:46 -07:00
2018-08-28 11:11:47 +02:00
2019-10-09 21:34:31 -07:00
2018-05-16 07:23:35 +02:00
2020-02-24 13:31:42 -08:00
2018-03-13 18:37:02 +02:00
2018-11-06 15:00:45 -08:00
2019-04-22 21:47:25 -07:00
2020-03-12 11:19:24 -07:00
2018-07-21 10:43:12 -05:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2018-04-11 10:33:46 -04:00
2019-11-15 12:28:28 -08:00
2019-10-05 16:29:00 -07:00
2020-02-29 21:52:19 -08:00
2020-02-21 15:22:45 -08:00
2018-03-01 21:21:36 -05:00
2019-06-19 17:09:55 +02:00
2019-05-30 11:26:32 -07:00
2019-05-30 11:26:32 -07:00
2020-03-09 22:34:58 +01:00
2019-05-30 11:26:32 -07:00
2018-05-08 00:02:41 -04:00
2019-10-04 14:07:07 -07:00
2019-12-19 17:46:51 -08:00
2018-07-07 10:58:49 +09:00
2019-03-29 10:53:45 -07:00
2020-03-09 22:34:58 +01:00
2018-02-16 15:57:42 -05:00
2019-11-14 18:12:17 -08:00
2019-10-24 14:53:49 -07:00
2018-01-24 19:13:45 -05:00
2019-06-05 17:30:29 +02:00
2019-12-09 10:28:43 -08:00
2019-11-16 12:39:10 -08:00
2019-12-20 16:00:09 -08:00
2019-06-19 11:23:13 -04:00
2019-12-09 09:59:07 +01:00