[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+b3nvFAgM32SF0Bv46EOO4UFEK3M99pqYzEwmsmLvmhTQ@mail.gmail.com>
Date: Tue, 17 Dec 2019 14:02:40 +0100
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Jia-Ju Bai <baijiaju1990@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Hans Liljestrand <ishkamiel@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Andrea Parri <andrea.parri@...rulasolutions.com>,
Anders Roxell <anders.roxell@...aro.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Reshetova, Elena" <elena.reshetova@...el.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [BUG] kernel: kcov: a possible sleep-in-atomic-context bug in kcov_ioctl()
On Tue, Dec 17, 2019 at 1:56 PM Jia-Ju Bai <baijiaju1990@...il.com> wrote:
>
> The kernel may sleep while holding a spinlock.
> The function call path (from bottom to top) in Linux 4.19 is:
>
> kernel/kcov.c, 237:
> vfree in kcov_put
> kernel/kcov.c, 413:
> kcov_put in kcov_ioctl_locked
> kernel/kcov.c, 427:
> kcov_ioctl_locked in kcov_ioctl
> kernel/kcov.c, 426:
> spin_lock in kcov_ioctl
>
> vfree() can sleep at runtime.
>
> I am not sure how to properly fix this possible bug, so I only report it.
> A possible way is to replace vfree() with kfree(), and replace related
> calls to vmalloc() with kmalloc().
>
> This bug is found by a static analysis tool STCheck written by myself.
Hi Jia-Ju,
Are you sure kcov_ioctl_locked can really release the descriptor? It
happens in the context of ioctl, which means there is an open
reference for the file descriptor. So ioctl should not do vfree I
would assume.
Powered by blists - more mailing lists