Netdev List
 help / color / mirror / Atom feed
From: bai <baijiaju1990@gmail.com>
To: steffen.klassert@secunet.com, herbert@gondor.apana.org.au,
	davem@davemloft.net
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [BUG] net: xfrm: Two possible sleep-in-atomic-context bugs
Date: Fri, 10 Aug 2018 10:02:42 +0800	[thread overview]
Message-ID: <b74ebf58-16c0-4a51-a004-7ce9e6abde7a@gmail.com> (raw)

The code may sleep in interrupt handler.
xfrm_trans_reinject() is an interrupt handler set in tasklet_init().
The function call paths (from bottom to top) in Linux-4.16 are:

[FUNC] schedule_timeout
net/core/sock.c, 2044: schedule_timeout in sock_wait_for_wmem
net/core/sock.c, 2083: sock_wait_for_wmem in sock_alloc_send_pskb
net/core/sock.c, 2102: sock_alloc_send_pskb in sock_alloc_send_skb
net/ipv6/mcast.c, 1989: sock_alloc_send_skb in igmp6_send
net/ipv6/mcast.c, 2391: igmp6_send in igmp6_join_group
net/ipv6/mcast.c, 670: igmp6_join_group in igmp6_group_added
net/ipv6/mcast.c, 914: igmp6_group_added in ipv6_dev_mc_inc
net/ipv6/ndisc.c, 379: ipv6_dev_mc_inc in pndisc_constructor
net/core/neighbour.c, 640: [FUNC_PTR]pndisc_constructor in pneigh_lookup
net/ipv6/ip6_output.c, 483: pneigh_lookup in ip6_forward
./include/net/dst.h, 449: [FUNC_PTR]ip6_forward in dst_input
net/ipv6/ip6_input.c, 71: dst_input in ip6_rcv_finish
net/xfrm/xfrm_input.c, 511: [FUNC_PTR]ip6_rcv_finish in xfrm_trans_reinject

[FUNC] kmalloc(GFP_KERNEL)
net/core/neighbour.c, 630: kmalloc in pneigh_lookup
net/ipv6/ip6_output.c, 483: pneigh_lookup in ip6_forward
./include/net/dst.h, 449: [FUNC_PTR]ip6_forward in dst_input
net/ipv6/ip6_input.c, 71: dst_input in ip6_rcv_finish
net/xfrm/xfrm_input.c, 511: [FUNC_PTR]ip6_rcv_finish in xfrm_trans_reinject

Note that [FUNC_PTR] means a function pointer call is used.

I do not find a good way to fix them, so I only report.
These possible bugs are found by my static analysis tool (DSAC) and 
checked by my code review.


Best wishes,
Jia-Ju Bai

             reply	other threads:[~2018-08-10  2:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10  2:02 bai [this message]
2018-08-10  5:36 ` [BUG] net: xfrm: Two possible sleep-in-atomic-context bugs Steffen Klassert
2018-08-10  7:30   ` Jia-Ju Bai

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=b74ebf58-16c0-4a51-a004-7ce9e6abde7a@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=steffen.klassert@secunet.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