lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 27 Feb 2020 16:11:02 +0000
From:   Stefan Hajnoczi <stefanha@...hat.com>
To:     Stefano Garzarella <sgarzare@...hat.com>
Cc:     davem@...emloft.net, Dexuan Cui <decui@...rosoft.com>,
        Hillf Danton <hdanton@...a.com>,
        virtualization@...ts.linux-foundation.org,
        "K. Y. Srinivasan" <kys@...rosoft.com>, kvm@...r.kernel.org,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        syzbot+731710996d79d0d58fbc@...kaller.appspotmail.com,
        netdev@...r.kernel.org, Sasha Levin <sashal@...nel.org>,
        Sunil Muthuswamy <sunilmut@...rosoft.com>,
        linux-kernel@...r.kernel.org, linux-hyperv@...r.kernel.org,
        Jakub Kicinski <kuba@...nel.org>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        Jorgen Hansen <jhansen@...are.com>
Subject: Re: [PATCH net] vsock: fix potential deadlock in transport->release()

On Wed, Feb 26, 2020 at 11:58:18AM +0100, Stefano Garzarella wrote:
> Some transports (hyperv, virtio) acquire the sock lock during the
> .release() callback.
> 
> In the vsock_stream_connect() we call vsock_assign_transport(); if
> the socket was previously assigned to another transport, the
> vsk->transport->release() is called, but the sock lock is already
> held in the vsock_stream_connect(), causing a deadlock reported by
> syzbot:
> 
>     INFO: task syz-executor280:9768 blocked for more than 143 seconds.
>       Not tainted 5.6.0-rc1-syzkaller #0
>     "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
>     syz-executor280 D27912  9768   9766 0x00000000
>     Call Trace:
>      context_switch kernel/sched/core.c:3386 [inline]
>      __schedule+0x934/0x1f90 kernel/sched/core.c:4082
>      schedule+0xdc/0x2b0 kernel/sched/core.c:4156
>      __lock_sock+0x165/0x290 net/core/sock.c:2413
>      lock_sock_nested+0xfe/0x120 net/core/sock.c:2938
>      virtio_transport_release+0xc4/0xd60 net/vmw_vsock/virtio_transport_common.c:832
>      vsock_assign_transport+0xf3/0x3b0 net/vmw_vsock/af_vsock.c:454
>      vsock_stream_connect+0x2b3/0xc70 net/vmw_vsock/af_vsock.c:1288
>      __sys_connect_file+0x161/0x1c0 net/socket.c:1857
>      __sys_connect+0x174/0x1b0 net/socket.c:1874
>      __do_sys_connect net/socket.c:1885 [inline]
>      __se_sys_connect net/socket.c:1882 [inline]
>      __x64_sys_connect+0x73/0xb0 net/socket.c:1882
>      do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
>      entry_SYSCALL_64_after_hwframe+0x49/0xbe
> 
> To avoid this issue, this patch remove the lock acquiring in the
> .release() callback of hyperv and virtio transports, and it holds
> the lock when we call vsk->transport->release() in the vsock core.
> 
> Reported-by: syzbot+731710996d79d0d58fbc@...kaller.appspotmail.com
> Fixes: 408624af4c89 ("vsock: use local transport when it is loaded")
> Signed-off-by: Stefano Garzarella <sgarzare@...hat.com>
> ---
>  net/vmw_vsock/af_vsock.c                | 20 ++++++++++++--------
>  net/vmw_vsock/hyperv_transport.c        |  3 ---
>  net/vmw_vsock/virtio_transport_common.c |  2 --
>  3 files changed, 12 insertions(+), 13 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@...hat.com>

Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ