[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAeHK+xNDvauf-SFoBcUfcPA_6fL_FhP-w2mys+Z-heyd0-VEA@mail.gmail.com>
Date: Tue, 5 Jan 2021 20:47:35 +0100
From: Andrey Konovalov <andreyknvl@...gle.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: USB list <linux-usb@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
kasan-dev <kasan-dev@...glegroups.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Shuah Khan <shuah@...nel.org>,
Alexander Potapenko <glider@...gle.com>,
Marco Elver <elver@...gle.com>,
Nazime Hande Harputluoglu <handeharput@...il.com>
Subject: Re: [PATCH v5] kcov, usb: only collect coverage from
__usb_hcd_giveback_urb in softirq
On Mon, Dec 28, 2020 at 3:51 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> On Tue, Nov 24, 2020 at 12:47:25AM +0100, Andrey Konovalov wrote:
> > Currently there's a kcov remote coverage collection section in
> > __usb_hcd_giveback_urb(). Initially that section was added based on the
> > assumption that usb_hcd_giveback_urb() can only be called in interrupt
> > context as indicated by a comment before it. This is what happens when
> > syzkaller is fuzzing the USB stack via the dummy_hcd driver.
> >
> > As it turns out, it's actually valid to call usb_hcd_giveback_urb() in task
> > context, provided that the caller turned off the interrupts; USB/IP does
> > exactly that. This can lead to a nested KCOV remote coverage collection
> > sections both trying to collect coverage in task context. This isn't
> > supported by kcov, and leads to a WARNING.
> >
> > Change __usb_hcd_giveback_urb() to only call kcov_remote_*() callbacks
> > when it's being executed in a softirq. To avoid calling
> > in_serving_softirq() directly in the driver code, add a couple of new kcov
> > wrappers.
> >
> > As the result of this change, the coverage from USB/IP related
> > usb_hcd_giveback_urb() calls won't be collected, but the WARNING is fixed.
> >
> > A potential future improvement would be to support nested remote coverage
> > collection sections, but this patch doesn't address that.
> >
> > Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
> > Acked-by: Marco Elver <elver@...gle.com>
> > ---
> >
> > Changes in v5:
> > - Don't call in_serving_softirq() in USB driver code directly, do that
> > via kcov wrappers.
>
> Does not apply to 5.11-rc1 :(
Hm, I see version 4 in 5.11-rc1. Let me send a fix up.
Powered by blists - more mailing lists