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:	Mon, 14 Mar 2016 11:30:30 +0900
From:	Byungchul Park <byungchul.park@....com>
To:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:	akpm@...ux-foundation.org, mingo@...nel.org,
	linux-kernel@...r.kernel.org, akinobu.mita@...il.com, jack@...e.cz,
	peter@...leysoftware.com, tglx@...utronix.de, peterz@...radead.org,
	rostedt@...dmis.org
Subject: Re: [PATCH v6 2/2] printk: Make printing of spin_dump() deferred to
 avoid a deadlock

On Mon, Mar 14, 2016 at 10:37:52AM +0900, Sergey Senozhatsky wrote:
> On (03/11/16 19:37), Byungchul Park wrote:
> [..]
> > +static void __spin_dump_deferred(raw_spinlock_t *lock, const char *msg)
> > +{
> > +	printk_func_t s;
> > +
> > +	s = this_cpu_read(printk_func);
> > +	this_cpu_write(printk_func, vprintk_deferred);
> > +
> > +	/*
> > +	 * To change printk_func, it must be in preempt disabled and irq
> > +	 * disabled. WARN_ON() should be called after the change because
> > +	 * the default printk_func which may be called from WARN_ON()
> > +	 * is prohibited in this context.
> > +	 */
> > +	WARN_ON(!preempt_count() || !irqs_disabled());
> > +	__spin_dump(lock, msg);
> > +
> > +	this_cpu_write(printk_func, s);
> > +
> > +	printk_pending_output();
> > +}
> >
> > +static void spin_dump(raw_spinlock_t *lock, const char *msg)
> > +{
> > +	if (unlikely(console_sem_spin_is_held()))
> > +		__spin_dump_deferred(lock, msg);
> > +	else
> > +		__spin_dump(lock, msg);
> > +}

Hello, Sergey

> 
> so can it be
> 
> vprintk_emit()
>  __spin_dump_deferred()
>   vprintk_deferred()
>    vprintk_emit()
>     __spin_dump_deferred()
      ^^^
      can be caused by raw_spin_lock(logbug_lock)

>      vprintk_deferred()

Yes, it can happen by raw_spin_lock(logbuf_lock) to print warning or error
message. Are you worrying about an infinite recursion?

1. In the case printing warning, eventually it can fill the buffer without
actual printing using console.

2. In the case printing error, the infinite recursion can be prevented by
debug_locks_off().

Therefore, no problem.

> 
> 
> or am I getting it wrong?

Please let me know if you have any opinion. :-)

Thanks,
Byungchul

> 
> 	-ss

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ