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:	Wed, 6 Jan 2016 17:04:43 +0100
From:	Jiri Bohac <jbohac@...e.cz>
To:	Prarit Bhargava <prarit@...hat.com>
Cc:	linux-kernel@...r.kernel.org, John Stultz <john.stultz@...aro.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...nel.org>,
	Xunlei Pang <pang.xunlei@...aro.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Baolin Wang <baolin.wang@...aro.org>,
	Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH 1/2] kernel, timekeeping, add trylock option to
 ktime_get_with_offset()

On Wed, Jan 06, 2016 at 08:00:33AM -0500, Prarit Bhargava wrote:
> -ktime_t ktime_get_with_offset(enum tk_offsets offs)
> +ktime_t ktime_get_with_offset(enum tk_offsets offs, int trylock)
>  {
>  	struct timekeeper *tk = &tk_core.timekeeper;
>  	unsigned int seq;
>  	ktime_t base, *offset = offsets[offs];
>  	s64 nsecs;
> +	unsigned long flags = 0;
> +
> +	if (unlikely(!timekeeping_initialized))
> +		return ktime_set(0, 0);
>  
>  	WARN_ON(timekeeping_suspended);
>  
> +	if (trylock && !raw_spin_trylock_irqsave(&timekeeper_lock, flags))
> +		return ktime_set(KTIME_MAX, 0);
> +

Are you trying to avoid a deadlock caused by calling printk() with
timekeeper_lock locked?

I believe this is already unsafe, as explained in the commit log
of 6d9bcb62 (timekeeping: use printk_deferred when holding
timekeeping seqlock).

So directly calling ktime_get() from printk would just turn a
rare deadlock into a certain one - perhaps a good thing?


-- 
Jiri Bohac <jbohac@...e.cz>
SUSE Labs, SUSE CZ

--
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