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] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 21 Aug 2008 22:03:43 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Dmitry Adamushko <dmitry.adamushko@...il.com>
Cc:	Vegard Nossum <vegard.nossum@...il.com>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	"Rafael J. Wysocki" <rjw@...k.pl>,
	Max Krasnyanskiy <maxk@...lcomm.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: latest -git: hibernate: possible circular locking dependency detected

On 08/21, Dmitry Adamushko wrote:
> 
> however, I think there are 2 problems with handle_poweroff()
> [ kernel/power/poweroff.c ]
> 
> (1) it doesn't ensure that the 'cpu' it gets via
> first_cpu(cpu_online_map) can't disappear (race with cpu_down()) on
> the way to schedule_work_on()
> 
> [ I pressume, neither generic sysrq nor console layer takes care of
> it. They shoudn't of course ]
> 
> (2) run_workqueue() [ which in the end calls do_poweroff() ] takes the
> "cwq->lock" (which is lock-2 in our terminology)
> 
> well, actually it release it before calling "work->fun()" but is the
> 'lockdep' annotation right here? Peter?
> 
> (I admit, I never looked at lockdep and do make assumptions on its syntax here).
> 
> The lock-1 will be taken as a result of
> 
> then, do_poweroff() -> kernel_power_off() -> disable_nonboot_cpus()
> 
> which calls cpu_maps_update_begin() and takes "cpu_add_remove_lock"
> 
> and this looks dangerous. Due to the same reason as was before with
> the use of get_online_cpus() by workqueue handlers before
> CPU_POST_DEAD introduction
> (http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3da1c84c00c7e5fa8348336bd8c342f9128b0f14)
> 
> I guess, it may deadlock as the lock-1 has been already taken before
> calling cleanup_workqueue_thread() -> flush_cpu_workqueue() and
> completion of the former chain depends in turn on being able to
> acquire the very same lock.

I apologize in advance if I missed something else in your message,
but I think you are very right. Please look at

	http://marc.info/?t=121580236300019

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ