mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: Al Viro <viro@ZenIV.linux.org.uk>
Cc: akpm@linux-foundation.org, dvyukov@google.com,
	Greg KH <gregkh@linuxfoundation.org>,
	tchibo@google.com, aryabinin@virtuozzo.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [BUG] kernel: kcov: a possible sleep-in-atomic-context bug in kcov_ioctl()
Date: Thu, 21 Jun 2018 11:50:54 +0800	[thread overview]
Message-ID: <3dc2431d-e474-a3b6-c6c9-9f7079a9cb9b@gmail.com> (raw)
In-Reply-To: <20180621034335.GT30522@ZenIV.linux.org.uk>



On 2018/6/21 11:43, Al Viro wrote:
> On Thu, Jun 21, 2018 at 11:20:59AM +0800, Jia-Ju Bai wrote:
>> The kernel may sleep with holding a spinlock.
>> The function call path (from bottom to top) in Linux-4.16.7 is:
>>
>> [FUNC] vfree --> can sleep
>> kernel/kcov.c, 237: vfree in kcov_put
>> kernel/kcov.c, 396: kcov_put in kcov_ioctl_locked
>> kernel/kcov.c, 410: kcov_ioctl_locked in kcov_ioctl
>> kernel/kcov.c, 409: spin_lock in kcov_ioctl
>>
>> This bug is found by my static analysis tool (DSAC-2) and checked by my
>> code review.
>>
>> I do not know how to correctly fix this bug, so I just report them.
> Assuming it's a bug in the first place, that is.  Note that
> 	* we never modify task->kcov for task != current
> 	* task->kcov contributes to refcount
> 	* opened file contributes to refcount
> 	* that kcov_put() of yours happens from ->ioctl() and removes
> current->kcov reference; it *can't* be the last reference - the one
> held by struct file used to call ->ioctl() is also there.
>
> IOW, it's a false positive.

Okay, thanks for your reply and explanation.
I agree that my report is false.


Best wishes,
Jia-Ju Bai

  reply	other threads:[~2018-06-21  3:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21  3:20 Jia-Ju Bai
2018-06-21  3:43 ` Al Viro
2018-06-21  3:50   ` Jia-Ju Bai [this message]
2019-12-17 12:56 Jia-Ju Bai
2019-12-17 13:02 ` Dmitry Vyukov
2019-12-17 13:11   ` Jia-Ju Bai
2019-12-17 13:13     ` Dmitry Vyukov
2019-12-17 13:17       ` Jia-Ju Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3dc2431d-e474-a3b6-c6c9-9f7079a9cb9b@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aryabinin@virtuozzo.com \
    --cc=dvyukov@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tchibo@google.com \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome