Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1594694
| From | Cong Wang <xiyou.wangcong@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: net: BUG in unix_notinflight |
| Date | 2017-03-07 23:10 +0100 |
| Message-ID | <tivsR-5xJ-15@gated-at.bofh.it> (permalink) |
| References | <sHPAe-1yq-29@gated-at.bofh.it> <thYng-6U9-23@gated-at.bofh.it> <ti9Vn-6Tr-7@gated-at.bofh.it> <tiji1-5io-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Mar 7, 2017 at 12:37 AM, Dmitry Vyukov <dvyukov@google.com> wrote:
> On Mon, Mar 6, 2017 at 11:34 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
>> The problem here is there is no lock protecting concurrent unix_detach_fds()
>> even though unix_notinflight() is already serialized, if we call
>> unix_notinflight()
>> twice on the same file pointer, we trigger this bug...
>>
>> I don't know what is the right lock here to serialize it.
>
>
> What exactly here needs to be protected?
>
> 1484 static void unix_detach_fds(struct scm_cookie *scm, struct sk_buff *skb)
> 1485 {
> 1486 int i;
> 1487
> 1488 scm->fp = UNIXCB(skb).fp;
> 1489 UNIXCB(skb).fp = NULL;
> 1490
> 1491 for (i = scm->fp->count-1; i >= 0; i--)
> 1492 unix_notinflight(scm->fp->user, scm->fp->fp[i]);
> 1493 }
>
> Whole unix_notinflight happens under global unix_gc_lock.
>
> Is it that 2 threads call unix_detach_fds for the same skb, and then
> call unix_notinflight for the same fd twice?
Not the same skb, but their UNIXCB(skb).fp points to the same place,
therefore we call unix_notinflight() twice on the same fp->user and
fp->fp[i], although we have refcounting but still able to trigger this
warning.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: net: BUG in unix_notinflight Dmitry Vyukov <dvyukov@google.com> - 2017-03-06 11:50 +0100
Re: net: BUG in unix_notinflight Cong Wang <xiyou.wangcong@gmail.com> - 2017-03-07 00:10 +0100
Re: net: BUG in unix_notinflight Dmitry Vyukov <dvyukov@google.com> - 2017-03-07 10:10 +0100
Re: net: BUG in unix_notinflight Cong Wang <xiyou.wangcong@gmail.com> - 2017-03-07 23:10 +0100
Re: net: BUG in unix_notinflight Nikolay Borisov <n.borisov.lkml@gmail.com> - 2017-03-07 23:40 +0100
Re: net: BUG in unix_notinflight Willy Tarreau <w@1wt.eu> - 2017-03-07 23:40 +0100
Re: net: BUG in unix_notinflight Cong Wang <xiyou.wangcong@gmail.com> - 2017-03-10 18:50 +0100
csiph-web