linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] How does syzkaller manage to create Bluetooth connections in a VM which doesn't have a Bluetooth device
@ 2020-09-04 14:19 Coiby Xu
  2020-09-08  7:16 ` Dmitry Vyukov via Linux-kernel-mentees
  0 siblings, 1 reply; 2+ messages in thread
From: Coiby Xu @ 2020-09-04 14:19 UTC (permalink / raw)
  To: syzkaller-bugs; +Cc: linux-kernel-mentees

Hi,

I have been trying to fix this issue [1] found by syzbot. I notice the
extracted syzkaller reproducer could connect to another Bluetooth device
successfully because l2cap_chan_connect successfully returns.

// net/Bluetooth/l2cap_sock.c
static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
			      int alen, int flags)
{
	err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid),
				 &la.l2_bdaddr, la.l2_bdaddr_type);
}

However, if I use syz-prog2c to convert the syzkaller reproducer to a
C reproducer, the C reproducer could never make a socket connect call
successfully. So how does syzkaller manage to create Bluetooth connections
for the sykaller reproducer? I've understood why this issue [1] occurs
but haven't figured out how it occurs, i.e., what is the subtle race
condition. So I want to write a C reproducer to experiment on it.

[1] INFO: trying to register non-static key in l2cap_chan_del: https://syzkaller.appspot.com/bug?id=aca31fd1ef0cbf898bd37115e2c4c66fa37f4a20

--
Best regards,
Coiby
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Linux-kernel-mentees] How does syzkaller manage to create Bluetooth connections in a VM which doesn't have a Bluetooth device
  2020-09-04 14:19 [Linux-kernel-mentees] How does syzkaller manage to create Bluetooth connections in a VM which doesn't have a Bluetooth device Coiby Xu
@ 2020-09-08  7:16 ` Dmitry Vyukov via Linux-kernel-mentees
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Vyukov via Linux-kernel-mentees @ 2020-09-08  7:16 UTC (permalink / raw)
  To: Coiby Xu; +Cc: linux-kernel-mentees, syzkaller-bugs, Andy Nguyen

,On Fri, Sep 4, 2020 at 4:20 PM Coiby Xu <coiby.xu@gmail.com> wrote:
>
> Hi,
>
> I have been trying to fix this issue [1] found by syzbot. I notice the
> extracted syzkaller reproducer could connect to another Bluetooth device
> successfully because l2cap_chan_connect successfully returns.
>
> // net/Bluetooth/l2cap_sock.c
> static int l2cap_sock_connect(struct socket *sock, struct sockaddr *addr,
>                               int alen, int flags)
> {
>         err = l2cap_chan_connect(chan, la.l2_psm, __le16_to_cpu(la.l2_cid),
>                                  &la.l2_bdaddr, la.l2_bdaddr_type);
> }
>
> However, if I use syz-prog2c to convert the syzkaller reproducer to a
> C reproducer, the C reproducer could never make a socket connect call
> successfully. So how does syzkaller manage to create Bluetooth connections
> for the sykaller reproducer? I've understood why this issue [1] occurs
> but haven't figured out how it occurs, i.e., what is the subtle race
> condition. So I want to write a C reproducer to experiment on it.
>
> [1] INFO: trying to register non-static key in l2cap_chan_del: https://syzkaller.appspot.com/bug?id=aca31fd1ef0cbf898bd37115e2c4c66fa37f4a20

Hi Coiby,

syzkaller uses /dev/vhci to create a virtual bluetooth device.
There should be a flag for syz-prog2c to include that code into C
reproducers as well.
However note that syzbot did not provide a C reproducer which means
that the crash was somehow not reproducible with a C reproducer (that
includes vhci initialization code and all other relevant code), so
maybe you are seeing the same effect. It would be useful to figure out
why it's not reproducible with a C repro, maybe it's some bug in
syzkaller that can be fixed.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-08  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 14:19 [Linux-kernel-mentees] How does syzkaller manage to create Bluetooth connections in a VM which doesn't have a Bluetooth device Coiby Xu
2020-09-08  7:16 ` Dmitry Vyukov via Linux-kernel-mentees

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).