[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+fCnZcd2nJ6XLmJcPfwVJf9wUcHqWjYnafDdV8pmm3HpjY7Wg@mail.gmail.com>
Date: Tue, 21 May 2024 22:46:40 +0200
From: Andrey Konovalov <andreyknvl@...il.com>
To: Dmitry Vyukov <dvyukov@...gle.com>
Cc: andrey.konovalov@...ux.dev, Alan Stern <stern@...land.harvard.edu>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Marco Elver <elver@...gle.com>,
Alexander Potapenko <glider@...gle.com>, kasan-dev@...glegroups.com,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>, Tejun Heo <tj@...nel.org>,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kcov, usb: disable interrupts in kcov_remote_start_usb_softirq
On Tue, May 21, 2024 at 6:35 AM Dmitry Vyukov <dvyukov@...gle.com> wrote:
>
> On Mon, 20 May 2024 at 22:59, <andrey.konovalov@...ux.dev> wrote:
> >
> > From: Andrey Konovalov <andreyknvl@...il.com>
> >
> > After commit 8fea0c8fda30 ("usb: core: hcd: Convert from tasklet to BH
> > workqueue"), usb_giveback_urb_bh() runs in the BH workqueue with
> > interrupts enabled.
> >
> > Thus, the remote coverage collection section in usb_giveback_urb_bh()->
> > __usb_hcd_giveback_urb() might be interrupted, and the interrupt handler
> > might invoke __usb_hcd_giveback_urb() again.
> >
> > This breaks KCOV, as it does not support nested remote coverage collection
> > sections within the same context (neither in task nor in softirq).
> >
> > Update kcov_remote_start/stop_usb_softirq() to disable interrupts for the
> > duration of the coverage collection section to avoid nested sections in
> > the softirq context (in addition to such in the task context, which are
> > already handled).
>
> Besides the issue pointed by the test robot:
>
> Acked-by: Dmitry Vyukov <dvyukov@...gle.com>
>
> Thanks for fixing this.
Thanks for the ack!
> This section of code does not rely on reentrancy, right? E.g. one
> callback won't wait for completion of another callback?
I think all should be good. Before the BH workqueue change, the code
ran with interrupts disabled.
> At some point we started seeing lots of "remote cover enable write
> trace failed (errno 17)" errors while running syzkaller. Can these
> errors be caused by this issue?
This looks like a different issue. I also noticed this when I tried
running a log with a bunch of USB programs via syz-execprog. Not sure
why this happens, but I still see it with this patch applied.
Thanks!
Powered by blists - more mailing lists