* [PATCH net] ipv4: Silence suspicious RCU usage warning
@ 2020-07-29 8:37 Ido Schimmel
2020-07-29 19:13 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Ido Schimmel @ 2020-07-29 8:37 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, alexander.h.duyck, jiri, mlxsw, Ido Schimmel
From: Ido Schimmel <idosch@mellanox.com>
fib_trie_unmerge() is called with RTNL held, but not from an RCU
read-side critical section. This leads to the following warning [1] when
the FIB alias list in a leaf is traversed with
hlist_for_each_entry_rcu().
Since the function is always called with RTNL held and since
modification of the list is protected by RTNL, simply use
hlist_for_each_entry() and silence the warning.
[1]
WARNING: suspicious RCU usage
5.8.0-rc4-custom-01520-gc1f937f3f83b #30 Not tainted
-----------------------------
net/ipv4/fib_trie.c:1867 RCU-list traversed in non-reader section!!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
1 lock held by ip/164:
#0: ffffffff85a27850 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x49a/0xbd0
stack backtrace:
CPU: 0 PID: 164 Comm: ip Not tainted 5.8.0-rc4-custom-01520-gc1f937f3f83b #30
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
Call Trace:
dump_stack+0x100/0x184
lockdep_rcu_suspicious+0x153/0x15d
fib_trie_unmerge+0x608/0xdb0
fib_unmerge+0x44/0x360
fib4_rule_configure+0xc8/0xad0
fib_nl_newrule+0x37a/0x1dd0
rtnetlink_rcv_msg+0x4f7/0xbd0
netlink_rcv_skb+0x17a/0x480
rtnetlink_rcv+0x22/0x30
netlink_unicast+0x5ae/0x890
netlink_sendmsg+0x98a/0xf40
____sys_sendmsg+0x879/0xa00
___sys_sendmsg+0x122/0x190
__sys_sendmsg+0x103/0x1d0
__x64_sys_sendmsg+0x7d/0xb0
do_syscall_64+0x54/0xa0
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7fc80a234e97
Code: Bad RIP value.
RSP: 002b:00007ffef8b66798 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc80a234e97
RDX: 0000000000000000 RSI: 00007ffef8b66800 RDI: 0000000000000003
RBP: 000000005f141b1c R08: 0000000000000001 R09: 0000000000000000
R10: 00007fc80a2a8ac0 R11: 0000000000000246 R12: 0000000000000001
R13: 0000000000000000 R14: 00007ffef8b67008 R15: 0000556fccb10020
Fixes: 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
net/ipv4/fib_trie.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 248f1c1959a6..3c65f71d0e82 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -1864,7 +1864,7 @@ struct fib_table *fib_trie_unmerge(struct fib_table *oldtb)
while ((l = leaf_walk_rcu(&tp, key)) != NULL) {
struct key_vector *local_l = NULL, *local_tp;
- hlist_for_each_entry_rcu(fa, &l->leaf, fa_list) {
+ hlist_for_each_entry(fa, &l->leaf, fa_list) {
struct fib_alias *new_fa;
if (local_tb->tb_id != fa->tb_id)
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] ipv4: Silence suspicious RCU usage warning
2020-07-29 8:37 [PATCH net] ipv4: Silence suspicious RCU usage warning Ido Schimmel
@ 2020-07-29 19:13 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2020-07-29 19:13 UTC (permalink / raw)
To: idosch; +Cc: netdev, kuba, alexander.h.duyck, jiri, mlxsw, idosch
From: Ido Schimmel <idosch@idosch.org>
Date: Wed, 29 Jul 2020 11:37:13 +0300
> From: Ido Schimmel <idosch@mellanox.com>
>
> fib_trie_unmerge() is called with RTNL held, but not from an RCU
> read-side critical section. This leads to the following warning [1] when
> the FIB alias list in a leaf is traversed with
> hlist_for_each_entry_rcu().
>
> Since the function is always called with RTNL held and since
> modification of the list is protected by RTNL, simply use
> hlist_for_each_entry() and silence the warning.
>
> [1]
> WARNING: suspicious RCU usage
> 5.8.0-rc4-custom-01520-gc1f937f3f83b #30 Not tainted
> -----------------------------
> net/ipv4/fib_trie.c:1867 RCU-list traversed in non-reader section!!
...
> Fixes: 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Also applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] ipv4: Silence suspicious RCU usage warning
2020-08-26 16:48 Ido Schimmel
2020-08-26 19:02 ` David Ahern
@ 2020-08-26 22:59 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2020-08-26 22:59 UTC (permalink / raw)
To: idosch; +Cc: netdev, kuba, dsahern, mlxsw, idosch
From: Ido Schimmel <idosch@idosch.org>
Date: Wed, 26 Aug 2020 19:48:10 +0300
> From: Ido Schimmel <idosch@nvidia.com>
>
> fib_info_notify_update() is always called with RTNL held, but not from
> an RCU read-side critical section. This leads to the following warning
> [1] when the FIB table list is traversed with
> hlist_for_each_entry_rcu(), but without a proper lockdep expression.
>
> Since modification of the list is protected by RTNL, silence the warning
> by adding a lockdep expression which verifies RTNL is held.
...
> Fixes: 1bff1a0c9bbd ("ipv4: Add function to send route updates")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] ipv4: Silence suspicious RCU usage warning
2020-08-26 16:48 Ido Schimmel
@ 2020-08-26 19:02 ` David Ahern
2020-08-26 22:59 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Ahern @ 2020-08-26 19:02 UTC (permalink / raw)
To: Ido Schimmel, netdev; +Cc: davem, kuba, mlxsw, Ido Schimmel
On 8/26/20 10:48 AM, Ido Schimmel wrote:
> From: Ido Schimmel <idosch@nvidia.com>
>
> fib_info_notify_update() is always called with RTNL held, but not from
> an RCU read-side critical section. This leads to the following warning
> [1] when the FIB table list is traversed with
> hlist_for_each_entry_rcu(), but without a proper lockdep expression.
>
> Since modification of the list is protected by RTNL, silence the warning
> by adding a lockdep expression which verifies RTNL is held.
>
...
>
> Fixes: 1bff1a0c9bbd ("ipv4: Add function to send route updates")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
> net/ipv4/fib_trie.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Thanks, Ido.
Reviewed-by: David Ahern <dsahern@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net] ipv4: Silence suspicious RCU usage warning
@ 2020-08-26 16:48 Ido Schimmel
2020-08-26 19:02 ` David Ahern
2020-08-26 22:59 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Ido Schimmel @ 2020-08-26 16:48 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, dsahern, mlxsw, Ido Schimmel
From: Ido Schimmel <idosch@nvidia.com>
fib_info_notify_update() is always called with RTNL held, but not from
an RCU read-side critical section. This leads to the following warning
[1] when the FIB table list is traversed with
hlist_for_each_entry_rcu(), but without a proper lockdep expression.
Since modification of the list is protected by RTNL, silence the warning
by adding a lockdep expression which verifies RTNL is held.
[1]
=============================
WARNING: suspicious RCU usage
5.9.0-rc1-custom-14233-g2f26e122d62f #129 Not tainted
-----------------------------
net/ipv4/fib_trie.c:2124 RCU-list traversed in non-reader section!!
other info that might help us debug this:
rcu_scheduler_active = 2, debug_locks = 1
1 lock held by ip/834:
#0: ffffffff85a3b6b0 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x49a/0xbd0
stack backtrace:
CPU: 0 PID: 834 Comm: ip Not tainted 5.9.0-rc1-custom-14233-g2f26e122d62f #129
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-2.fc32 04/01/2014
Call Trace:
dump_stack+0x100/0x184
lockdep_rcu_suspicious+0x143/0x14d
fib_info_notify_update+0x8d1/0xa60
__nexthop_replace_notify+0xd2/0x290
rtm_new_nexthop+0x35e2/0x5946
rtnetlink_rcv_msg+0x4f7/0xbd0
netlink_rcv_skb+0x17a/0x480
rtnetlink_rcv+0x22/0x30
netlink_unicast+0x5ae/0x890
netlink_sendmsg+0x98a/0xf40
____sys_sendmsg+0x879/0xa00
___sys_sendmsg+0x122/0x190
__sys_sendmsg+0x103/0x1d0
__x64_sys_sendmsg+0x7d/0xb0
do_syscall_64+0x32/0x50
entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7fde28c3be57
Code: 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51
c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10
RSP: 002b:00007ffc09330028 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fde28c3be57
RDX: 0000000000000000 RSI: 00007ffc09330090 RDI: 0000000000000003
RBP: 000000005f45f911 R08: 0000000000000001 R09: 00007ffc0933012c
R10: 0000000000000076 R11: 0000000000000246 R12: 0000000000000001
R13: 00007ffc09330290 R14: 00007ffc09330eee R15: 00005610e48ed020
Fixes: 1bff1a0c9bbd ("ipv4: Add function to send route updates")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
net/ipv4/fib_trie.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index c89b46fec153..ffc5332f1390 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -2121,7 +2121,8 @@ void fib_info_notify_update(struct net *net, struct nl_info *info)
struct hlist_head *head = &net->ipv4.fib_table_hash[h];
struct fib_table *tb;
- hlist_for_each_entry_rcu(tb, head, tb_hlist)
+ hlist_for_each_entry_rcu(tb, head, tb_hlist,
+ lockdep_rtnl_is_held())
__fib_info_notify_update(net, tb, info);
}
}
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-08-26 22:59 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-29 8:37 [PATCH net] ipv4: Silence suspicious RCU usage warning Ido Schimmel
2020-07-29 19:13 ` David Miller
2020-08-26 16:48 Ido Schimmel
2020-08-26 19:02 ` David Ahern
2020-08-26 22:59 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).