lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200925093046.GM29288@alley>
Date:   Fri, 25 Sep 2020 11:30:46 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     qiang.zhang@...driver.com
Cc:     tj@...nel.org, akpm@...ux-foundation.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] kernel/kthread.c: kthread_worker: add work status
 check in timer_fn

On Fri 2020-09-25 13:07:59, qiang.zhang@...driver.com wrote:
> From: Zqiang <qiang.zhang@...driver.com>
> 
> When queue delayed work to worker, at some point after that the timer_fn
> will be call, add work to worker's work_list, at this time, the work may
> be cancel, so add "work->canceling" check current work status.

Great catch!

I was able to understand the problem from the description. Though I
would still try to improve it a bit. I suggest:

<new_text>
Subject: kthread_worker: Prevent queuing delayed work from timer_fn when it is being canceled

There is a small race window when a delayed work is being canceled and
the work still might be queued from the timer_fn:

CPU0					CPU1

kthread_cancel_delayed_work_sync()
  __kthread_cancel_work_sync()
    __kthread_cancel_work()
	work->canceling++;

					kthread_delayed_work_timer_fn()
					  kthread_insert_work();

BUG: kthread_insert_work() should not get called when work->canceling
is set.
</new_text>

> Signed-off-by: Zqiang <qiang.zhang@...driver.com>

With the above subject and commit message:

Reviewed-by: Petr Mladek <pmladek@...e.com>

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ