From: Mukesh Ojha <quic_mojha@quicinc.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: <linux-kernel@vger.kernel.org>, <tglx@linutronix.de>,
<sboyd@kernel.org>, <rafael@kernel.org>, <keescook@chromium.org>,
Greg KH <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v5] devcoredump : Serialize devcd_del work
Date: Wed, 20 Jul 2022 18:03:59 +0530 [thread overview]
Message-ID: <d95c4715-c194-759b-b698-c548a771f27c@quicinc.com> (raw)
In-Reply-To: <50bb39d7-8207-31e2-0a7d-99c5d2b3c8a8@quicinc.com>
Gentle reminder for review.
-Mukesh
On 7/1/2022 8:23 PM, Mukesh Ojha wrote:
> Thanks @greg.
>
> Hi @johannes,
>
> Could you review this patch?
>
> -Mukesh
>
> On 6/27/2022 6:41 PM, Greg KH wrote:
>> On Fri, May 27, 2022 at 07:33:40PM +0530, Mukesh Ojha wrote:
>>> In following scenario(diagram), when one thread X running
>>> dev_coredumpm()
>>> adds devcd device to the framework which sends uevent notification to
>>> userspace and another thread Y reads this uevent and call to
>>> devcd_data_write() which eventually try to delete the queued timer that
>>> is not initialized/queued yet.
>>>
>>> So, debug object reports some warning and in the meantime, timer is
>>> initialized and queued from X path. and from Y path, it gets
>>> reinitialized
>>> again and timer->entry.pprev=NULL and try_to_grab_pending() stucks.
>>>
>>> To fix this, introduce mutex and a boolean flag to serialize the
>>> behaviour.
>>>
>>> cpu0(X) cpu1(Y)
>>>
>>> dev_coredump() uevent sent to user space
>>> device_add() ======================> user space process Y reads
>>> the
>>> uevents writes to devcd fd
>>> which results into writes to
>>>
>>> devcd_data_write()
>>> mod_delayed_work()
>>> try_to_grab_pending()
>>> del_timer()
>>> debug_assert_init()
>>> INIT_DELAYED_WORK()
>>> schedule_delayed_work()
>>> debug_object_fixup()
>>>
>>> timer_fixup_assert_init()
>>> timer_setup()
>>>
>>> do_init_timer()
>>> /*
>>> Above call
>>> reinitializes
>>> the timer to
>>>
>>> timer->entry.pprev=NULL
>>> and this
>>> will be checked
>>> later in
>>> timer_pending() call.
>>> */
>>> timer_pending()
>>>
>>> !hlist_unhashed_lockless(&timer->entry)
>>> !h->pprev
>>> /*
>>> del_timer() checks
>>> h->pprev and finds
>>> it to be NULL due
>>> to which
>>>
>>> try_to_grab_pending() stucks.
>>> */
>>>
>>> Link:
>>> https://lore.kernel.org/lkml/2e1f81e2-428c-f11f-ce92-eb11048cb271@quicinc.com/
>>>
>>> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
>>> ---
>>
>> I need an ack from the devcoredump maintainer before I can take this...
>>
>> thanks,
>>
>> greg k-h
next prev parent reply other threads:[~2022-07-20 12:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 14:03 Mukesh Ojha
2022-06-27 12:33 ` Mukesh Ojha
2022-06-27 13:11 ` Greg KH
2022-07-01 14:53 ` Mukesh Ojha
2022-07-20 12:33 ` Mukesh Ojha [this message]
2022-08-11 16:13 ` Mukesh Ojha
2022-08-16 20:23 ` Kees Cook
2022-08-24 7:22 ` Mukesh Ojha
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=d95c4715-c194-759b-b698-c548a771f27c@quicinc.com \
--to=quic_mojha@quicinc.com \
--cc=gregkh@linuxfoundation.org \
--cc=johannes@sipsolutions.net \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sboyd@kernel.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®