[Devel] [PATCH] fuse kio: Replenish netaddr_cmp() with unix sockets type

Kirill Tkhai ktkhai at virtuozzo.com
Mon Oct 15 17:42:01 MSK 2018


Yeah, you are sure. It looks like, type is in RAX register and it's PCS_ADDRTYPE_NONE (== 0):

0xffffffffc034a31b <pcs_cs_find_create+363>:    cmp    $0x1,%eax
0xffffffffc034a31e <pcs_cs_find_create+366>:    je     0xffffffffc034a4b2 <pcs_cs_find_create+770>
0xffffffffc034a324 <pcs_cs_find_create+372>:    cmp    $0x2,%eax
0xffffffffc034a327 <pcs_cs_find_create+375>:    jne    0xffffffffc034a4b0 <pcs_cs_find_create+768>
...
0xffffffffc034a4b0 <pcs_cs_find_create+768>:    ud2    

[21519.595102] RAX: 0000000000000000 RBX: ffff8af1d5369680 RCX: 0000000000000000


On 15.10.2018 17:31, Alexey Kuznetsov wrote:
> Hello!
> 
> The thing is that cs_list->cs[]->info always has IP addresses.
> 
> Unix addresses are used only in rpc structs in case cs_list->cs[]->info
> has special CS_FL_LOCAL_SOCK flag.
> 
> AFAIK it is not different in kernel. It looks like the problem is not in this.
> Probably, it was not initialized.
> 
> It is really possible that addr is PCS_ADDRTYPE_NONE in case
> MDS has lost information about CS address. User space has kludge
> eliminating this situation, which was added after kernel was cloned.
> 
> I think we should port commit 601296c30c18eceebd3ca72d2210696370af6ec6
> to kernel.
> 
> 
> 
> 
> On Mon, Oct 15, 2018 at 5:15 PM Kirill Tkhai <ktkhai at virtuozzo.com> wrote:
>>
>> Sadly, but we have no the crash dump
>>
>> On 15.10.2018 16:39, Alexey Kuznetsov wrote:
>>> Hello!
>>>
>>> Do we have crash dump for this bug?
>>>
>>> I was puzzled why we do not hit it in user space
>>> and after some thinking decided it is really impossible
>>> to have unix socket here.
>>>
>>>
>>>
>>> On Fri, Oct 12, 2018 at 11:21 PM Alexey Kuznetsov <kuznet at virtuozzo.com> wrote:
>>>>
>>>> Hello!
>>>>
>>>> Fine. But I cannot figure out why we never hit this problem in user space,
>>>> it does exactly the same thing.
>>>>
>>>> Also, add PCS_ADDRTYPE_RDMA just to be on safe side.
>>>> On Fri, Oct 12, 2018 at 4:58 PM Kirill Tkhai <ktkhai at virtuozzo.com> wrote:
>>>>>
>>>>> We met crash in unix socket comparison:
>>>>>
>>>>> [21519.571700] kernel BUG at fs/fuse/kio/pcs/pcs_cs.c:170!
>>>>> [21519.592534] RIP: 0010:[<ffffffffc080d4b0>]  [<ffffffffc080d4b0>] pcs_cs_find_create+0x300/0x310 [fuse_kio_pcs]
>>>>> [21519.593817] RSP: 0018:ffff8af1f86f3d18  EFLAGS: 00010293
>>>>> [21519.595102] RAX: 0000000000000000 RBX: ffff8af1d5369680 RCX: 0000000000000000
>>>>> [21519.596429] RDX: 0000000000000001 RSI: ffff8af1d5369668 RDI: ffff8af234463820
>>>>> [21519.597763] RBP: ffff8af1f86f3d58 R08: 0000000000000000 R09: 0000000000000000
>>>>> [21519.599115] R10: ffff8af33fc07340 R11: 0000000000000001 R12: ffff8af1d5369668
>>>>> [21519.600467] R13: ffff8af9e8758080 R14: ffff8af1d53696c0 R15: ffff8af234463800
>>>>> [21519.602085] FS:  0000000000000000(0000) GS:ffff8afa1fac0000(0000) knlGS:0000000000000000
>>>>> [21519.603509] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
>>>>> [21519.604918] CR2: 000000c4201db000 CR3: 000000104e744000 CR4: 00000000003607e0
>>>>> [21519.606371] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
>>>>> [21519.607805] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
>>>>> [21519.609604] Call Trace:
>>>>> [21519.611106]  [<ffffffffc0806b50>] cslist_alloc+0x1f0/0x400 [fuse_kio_pcs]
>>>>> [21519.612567]  [<ffffffffc08070ef>] pcs_map_complete+0x38f/0x420 [fuse_kio_pcs]
>>>>> [21519.614001]  [<ffffffffc07fca59>] fuse_complete_map_work+0x79/0xc0 [fuse_kio_pcs]
>>>>> [21519.615388]  [<ffffffff96cb7532>] process_one_work+0x182/0x440
>>>>> [21519.616772]  [<ffffffff96cb86e6>] worker_thread+0x126/0x3c0
>>>>> [21519.618270]  [<ffffffff96cb85c0>] ? manage_workers.isra.24+0x2a0/0x2a0
>>>>> [21519.619703]  [<ffffffff96cbf681>] kthread+0xd1/0xe0
>>>>> [21519.621134]  [<ffffffff96cbf5b0>] ? create_kthread+0x60/0x60
>>>>> [21519.622507]  [<ffffffff97354677>] ret_from_fork_nospec_begin+0x21/0x21
>>>>> [21519.623845]  [<ffffffff96cbf5b0>] ? create_kthread+0x60/0x60
>>>>>
>>>>> Extend netaddr_cmp() with PCS_ADDRTYPE_UNIX to make function
>>>>> not to wonder unknown socket type. Note, unix sockets do not
>>>>> care about address, since all of them are on local machine,
>>>>> there is only port has a sense.
>>>>>
>>>>> https://pmc.acronis.com/browse/VSTOR-16083
>>>>>
>>>>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>>>>> ---
>>>>>  fs/fuse/kio/pcs/pcs_cs.c |    5 ++++-
>>>>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
>>>>> index 56ab3adb36db..3f34c197850f 100644
>>>>> --- a/fs/fuse/kio/pcs/pcs_cs.c
>>>>> +++ b/fs/fuse/kio/pcs/pcs_cs.c
>>>>> @@ -166,6 +166,8 @@ static inline int netaddr_cmp(PCS_NET_ADDR_T const *addr1, PCS_NET_ADDR_T const
>>>>>         case PCS_ADDRTYPE_IP6:
>>>>>                 sz = sizeof(struct in6_addr);
>>>>>                 break;
>>>>> +       case PCS_ADDRTYPE_UNIX:
>>>>> +               return 0;
>>>>>         default:
>>>>>                 BUG();
>>>>>         }
>>>>> @@ -173,7 +175,8 @@ static inline int netaddr_cmp(PCS_NET_ADDR_T const *addr1, PCS_NET_ADDR_T const
>>>>>         return memcmp(addr1->address, addr2->address, sz);
>>>>>  }
>>>>>
>>>>> -int pcs_netaddr_cmp(PCS_NET_ADDR_T const *addr1, PCS_NET_ADDR_T const *addr2)
>>>>> +static int pcs_netaddr_cmp(PCS_NET_ADDR_T const *addr1,
>>>>> +                          PCS_NET_ADDR_T const *addr2)
>>>>>  {
>>>>>         return netaddr_cmp(addr1, addr2, 0);
>>>>>  }
>>>>>



More information about the Devel mailing list