* [Linux-kernel-mentees] [PATCH] netfilter: ipt_CLUSTERIP: Pass lockdep expression to RCU lists
@ 2020-02-19 10:16 ` Amol Grover
0 siblings, 0 replies; 4+ messages in thread
From: Amol Grover @ 2020-02-19 10:16 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
David S . Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI,
Jakub Kicinski
Cc: Paul E . McKenney, netdev, linux-kernel, Madhuparna Bhowmik,
coreteam, netfilter-devel, Joel Fernandes, linux-kernel-mentees
cn->configs is traversed using list_for_each_entry_rcu
outside an RCU read-side critical section but under the protection
of cn->lock.
Hence, add corresponding lockdep expression to silence false-positive
warnings, and harden RCU lists.
Signed-off-by: Amol Grover <frextrite@gmail.com>
---
net/ipv4/netfilter/ipt_CLUSTERIP.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 6bdb1ab8af61..df856ff835b7 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -139,7 +139,8 @@ __clusterip_config_find(struct net *net, __be32 clusterip)
struct clusterip_config *c;
struct clusterip_net *cn = clusterip_pernet(net);
- list_for_each_entry_rcu(c, &cn->configs, list) {
+ list_for_each_entry_rcu(c, &cn->configs, list,
+ lockdep_is_held(&cn->lock)) {
if (c->clusterip == clusterip)
return c;
}
@@ -194,7 +195,8 @@ clusterip_netdev_event(struct notifier_block *this, unsigned long event,
struct clusterip_config *c;
spin_lock_bh(&cn->lock);
- list_for_each_entry_rcu(c, &cn->configs, list) {
+ list_for_each_entry_rcu(c, &cn->configs, list,
+ lockdep_is_held(&cn->lock)) {
switch (event) {
case NETDEV_REGISTER:
if (!strcmp(dev->name, c->ifname)) {
--
2.24.1
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] netfilter: ipt_CLUSTERIP: Pass lockdep expression to RCU lists
@ 2020-02-19 10:16 ` Amol Grover
0 siblings, 0 replies; 4+ messages in thread
From: Amol Grover @ 2020-02-19 10:16 UTC (permalink / raw)
To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
David S . Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI,
Jakub Kicinski
Cc: linux-kernel, linux-kernel-mentees, Joel Fernandes,
Madhuparna Bhowmik, Paul E . McKenney, netfilter-devel, coreteam,
netdev, Amol Grover
cn->configs is traversed using list_for_each_entry_rcu
outside an RCU read-side critical section but under the protection
of cn->lock.
Hence, add corresponding lockdep expression to silence false-positive
warnings, and harden RCU lists.
Signed-off-by: Amol Grover <frextrite@gmail.com>
---
net/ipv4/netfilter/ipt_CLUSTERIP.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 6bdb1ab8af61..df856ff835b7 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -139,7 +139,8 @@ __clusterip_config_find(struct net *net, __be32 clusterip)
struct clusterip_config *c;
struct clusterip_net *cn = clusterip_pernet(net);
- list_for_each_entry_rcu(c, &cn->configs, list) {
+ list_for_each_entry_rcu(c, &cn->configs, list,
+ lockdep_is_held(&cn->lock)) {
if (c->clusterip == clusterip)
return c;
}
@@ -194,7 +195,8 @@ clusterip_netdev_event(struct notifier_block *this, unsigned long event,
struct clusterip_config *c;
spin_lock_bh(&cn->lock);
- list_for_each_entry_rcu(c, &cn->configs, list) {
+ list_for_each_entry_rcu(c, &cn->configs, list,
+ lockdep_is_held(&cn->lock)) {
switch (event) {
case NETDEV_REGISTER:
if (!strcmp(dev->name, c->ifname)) {
--
2.24.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Linux-kernel-mentees] [PATCH] netfilter: ipt_CLUSTERIP: Pass lockdep expression to RCU lists
2020-02-19 10:16 ` Amol Grover
@ 2020-03-02 12:37 ` Pablo Neira Ayuso
-1 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2020-03-02 12:37 UTC (permalink / raw)
To: Amol Grover
Cc: Paul E . McKenney, Hideaki YOSHIFUJI, netdev, Florian Westphal,
linux-kernel, Jozsef Kadlecsik, Madhuparna Bhowmik, coreteam,
netfilter-devel, Jakub Kicinski, Joel Fernandes, Alexey Kuznetsov,
linux-kernel-mentees, David S . Miller
On Wed, Feb 19, 2020 at 03:46:27PM +0530, Amol Grover wrote:
> cn->configs is traversed using list_for_each_entry_rcu
> outside an RCU read-side critical section but under the protection
> of cn->lock.
>
> Hence, add corresponding lockdep expression to silence false-positive
> warnings, and harden RCU lists.
>
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
> net/ipv4/netfilter/ipt_CLUSTERIP.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
> index 6bdb1ab8af61..df856ff835b7 100644
> --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
> +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
> @@ -139,7 +139,8 @@ __clusterip_config_find(struct net *net, __be32 clusterip)
> struct clusterip_config *c;
> struct clusterip_net *cn = clusterip_pernet(net);
>
> - list_for_each_entry_rcu(c, &cn->configs, list) {
> + list_for_each_entry_rcu(c, &cn->configs, list,
> + lockdep_is_held(&cn->lock)) {
bh is disabled before calling __clusterip_config_find(), then
rcu_read_lock_any_held() evaluates true.
Are you sure this really results in a WARN_ON splat?
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netfilter: ipt_CLUSTERIP: Pass lockdep expression to RCU lists
@ 2020-03-02 12:37 ` Pablo Neira Ayuso
0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2020-03-02 12:37 UTC (permalink / raw)
To: Amol Grover
Cc: Jozsef Kadlecsik, Florian Westphal, David S . Miller,
Alexey Kuznetsov, Hideaki YOSHIFUJI, Jakub Kicinski, linux-kernel,
linux-kernel-mentees, Joel Fernandes, Madhuparna Bhowmik,
Paul E . McKenney, netfilter-devel, coreteam, netdev
On Wed, Feb 19, 2020 at 03:46:27PM +0530, Amol Grover wrote:
> cn->configs is traversed using list_for_each_entry_rcu
> outside an RCU read-side critical section but under the protection
> of cn->lock.
>
> Hence, add corresponding lockdep expression to silence false-positive
> warnings, and harden RCU lists.
>
> Signed-off-by: Amol Grover <frextrite@gmail.com>
> ---
> net/ipv4/netfilter/ipt_CLUSTERIP.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
> index 6bdb1ab8af61..df856ff835b7 100644
> --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
> +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
> @@ -139,7 +139,8 @@ __clusterip_config_find(struct net *net, __be32 clusterip)
> struct clusterip_config *c;
> struct clusterip_net *cn = clusterip_pernet(net);
>
> - list_for_each_entry_rcu(c, &cn->configs, list) {
> + list_for_each_entry_rcu(c, &cn->configs, list,
> + lockdep_is_held(&cn->lock)) {
bh is disabled before calling __clusterip_config_find(), then
rcu_read_lock_any_held() evaluates true.
Are you sure this really results in a WARN_ON splat?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-02 12:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-19 10:16 [Linux-kernel-mentees] [PATCH] netfilter: ipt_CLUSTERIP: Pass lockdep expression to RCU lists Amol Grover
2020-02-19 10:16 ` Amol Grover
2020-03-02 12:37 ` [Linux-kernel-mentees] " Pablo Neira Ayuso
2020-03-02 12:37 ` Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.