public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Taehee Yoo <ap420073@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>, netdev@vger.kernel.org
Cc: Cong Wang <cong.wang@bytedance.com>,
	syzbot+7d941e89dd48bcf42573@syzkaller.appspotmail.com
Subject: Re: [Patch net] rtnetlink: use rwsem to protect rtnl_af_ops list
Date: Thu, 6 May 2021 21:26:26 +0900	[thread overview]
Message-ID: <d7581cb6-a795-42a3-346a-07ccfa8fc8ce@gmail.com> (raw)
In-Reply-To: <20210505233642.13661-1-xiyou.wangcong@gmail.com>

On 5/6/21 8:36 AM, Cong Wang wrote:
 > From: Cong Wang <cong.wang@bytedance.com>
 >

Hi Cong,
Thank you so much for fixing it!

 > We use RTNL lock and RCU read lock to protect the global
 > list rtnl_af_ops, however, this forces the af_ops readers
 > being in atomic context while iterating this list,
 > particularly af_ops->set_link_af(). This was not a problem
 > until we begin to take mutex lock down the path in
 > __ipv6_dev_mc_dec().
 >
 > Convert RTNL+RCU to rwsemaphore, so that we can block on
 > the reader side while still allowing parallel readers.
 >
 > Reported-and-tested-by: 
syzbot+7d941e89dd48bcf42573@syzkaller.appspotmail.com
 > Fixes: 63ed8de4be81 ("mld: add mc_lock for protecting per-interface 
mld data")
 > Cc: Taehee Yoo <ap420073@gmail.com>
 > Signed-off-by: Cong Wang <cong.wang@bytedance.com>

I have been testing this patch and I found a warning
[ 8410.605309] BUG: sleeping function called from invalid context at 
kernel/locking/rwsem.c:1352
[ 8410.607508] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 
6626, name: ip
[ 8410.609507] INFO: lockdep is turned off.
[ 8410.610644] CPU: 5 PID: 6626 Comm: ip Tainted: G        W 
5.12.0+ #881
[ 8410.614943] Call Trace:
[ 8410.615714]  dump_stack+0xa4/0xe5
[ 8410.616692]  ___might_sleep.cold.126+0x140/0x16e
[ 8410.617958]  down_read+0x7b/0x710
[ 8410.618914]  ? lock_release+0x519/0xc30
[ 8410.620005]  ? down_write_killable+0x3b0/0x3b0
[ 8410.621231]  ? lockdep_hardirqs_on_prepare+0x3e0/0x3e0
[ 8410.622647]  ? entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 8410.624055]  if_nlmsg_size+0x2b2/0x870
[ 8410.625101]  rtnl_calcit.isra.34+0x1db/0x370
[ 8410.626317]  ? if_nlmsg_size+0x870/0x870
[ 8410.627412]  ? lock_release+0x519/0xc30
[ 8410.628497]  ? rtnl_fill_ifinfo+0x3990/0x3990
[ 8410.629716]  rtnetlink_rcv_msg+0x7cf/0x920
[ 8410.630905]  ? rtnetlink_put_metrics+0x450/0x450
[ 8410.632174]  ? lock_release+0x519/0xc30
[ 8410.633271]  ? lock_acquire+0x2a5/0x720
[ 8410.634371]  netlink_rcv_skb+0x121/0x350
[ 8410.635485]  ? rtnetlink_put_metrics+0x450/0x450
[ 8410.636729]  ? slab_post_alloc_hook+0x43/0x430
[ 8410.637993]  ? netlink_ack+0x9d0/0x9d0
[ 8410.639073]  ? _copy_from_iter_full+0x258/0xeb0
[ 8410.640338]  netlink_unicast+0x41c/0x610
[ 8410.641477]  ? netlink_attachskb+0x710/0x710
[ 8410.642624]  ? try_charge+0x2d1/0xfd0
[ 8410.643684]  ? trace_hardirqs_on+0x41/0x120
[ 8410.644859]  netlink_sendmsg+0x6b9/0xb70
[ 8410.645983]  ? netlink_unicast+0x610/0x610
[ 8410.647136]  ? sockfd_lookup_light+0x1c/0x150
[ 8410.648350]  __sys_sendto+0x30b/0x350


  reply	other threads:[~2021-05-06 12:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 23:36 [Patch net] rtnetlink: use rwsem to protect rtnl_af_ops list Cong Wang
2021-05-06 12:26 ` Taehee Yoo [this message]
2021-05-06 21:30   ` Cong Wang
2021-05-07  2:25     ` Taehee Yoo
2021-05-08  8:22     ` Taehee Yoo
2021-05-09 13:14 ` [rtnetlink] aced02f261: BUG:sleeping_function_called_from_invalid_context_at_kernel/locking/rwsem.c kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7581cb6-a795-42a3-346a-07ccfa8fc8ce@gmail.com \
    --to=ap420073@gmail.com \
    --cc=cong.wang@bytedance.com \
    --cc=netdev@vger.kernel.org \
    --cc=syzbot+7d941e89dd48bcf42573@syzkaller.appspotmail.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox