mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
	Johannes Berg <johannes.berg@intel.com>,
	Hillf Danton <hdanton@sina.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] workqueue: don't skip lockdep wq dependency in cancel_work_sync()
Date: Thu, 28 Jul 2022 06:40:16 -1000	[thread overview]
Message-ID: <YuK78Jiy12BJG/Tp@slm.duckdns.org> (raw)
In-Reply-To: <21b9c1ac-64b7-7f4b-1e62-bf2f021fffcd@I-love.SAKURA.ne.jp>

On Thu, Jul 28, 2022 at 09:23:25PM +0900, Tetsuo Handa wrote:
> Like Hillf Danton mentioned
> 
>   syzbot should have been able to catch cancel_work_sync() in work context
>   by checking lockdep_map in __flush_work() for both flush and cancel.
> 
> in [1], being unable to report an obvious deadlock scenario shown below is
> broken. From locking dependency perspective, sync version of cancel request
> should behave as if flush request, for it waits for completion of work if
> that work has already started execution.
> 
>   ----------
>   #include <linux/module.h>
>   #include <linux/sched.h>
>   static DEFINE_MUTEX(mutex);
>   static void work_fn(struct work_struct *work)
>   {
>     schedule_timeout_uninterruptible(HZ / 5);
>     mutex_lock(&mutex);
>     mutex_unlock(&mutex);
>   }
>   static DECLARE_WORK(work, work_fn);
>   static int __init test_init(void)
>   {
>     schedule_work(&work);
>     schedule_timeout_uninterruptible(HZ / 10);
>     mutex_lock(&mutex);
>     cancel_work_sync(&work);
>     mutex_unlock(&mutex);
>     return -EINVAL;
>   }
>   module_init(test_init);
>   MODULE_LICENSE("GPL");
>   ----------
> 
> Link: https://lkml.kernel.org/r/20220504044800.4966-1-hdanton@sina.com [1]
> Reported-by: Hillf Danton <hdanton@sina.com>
> Fixes: d6e89786bed977f3 ("workqueue: skip lockdep wq dependency in cancel_work_sync()")

Tetsuo, you gotta explain why this is okay w.r.t. the spurious warnings that
the above commit addressed. You can't just state that there are cases which
are missed and then revert it.

Thanks.

-- 
tejun

  reply	other threads:[~2022-07-28 16:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28 12:23 Tetsuo Handa
2022-07-28 16:40 ` Tejun Heo [this message]
2022-07-28 23:18   ` Tetsuo Handa
2022-07-29  1:49     ` Tetsuo Handa
2022-07-29  2:28       ` Tetsuo Handa
2022-07-29  2:49         ` Tetsuo Handa
2022-07-29  2:54           ` [PATCH v2] workqueue: don't skip lockdep work " Tetsuo Handa
2022-07-29  4:30             ` [PATCH v3] " Tetsuo Handa
2022-08-15 21:16               ` Tejun Heo
2023-09-13 14:28               ` Guenter Roeck
2023-09-13 14:41                 ` Johannes Berg
2023-09-13 15:59                   ` Guenter Roeck
2023-09-13 17:25                     ` Florian Fainelli
2023-09-13 17:45                       ` Guenter Roeck
2023-09-13 18:30                       ` Johannes Berg
2023-09-13 18:11                     ` Johannes Berg
2022-07-29  2:38 ` [PATCH] workqueue: don't skip lockdep wq " Lai Jiangshan
2022-07-29  2:49   ` Lai Jiangshan

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=YuK78Jiy12BJG/Tp@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=hdanton@sina.com \
    --cc=jiangshanlai@gmail.com \
    --cc=johannes.berg@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    /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®