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]
Message-ID: <20160201062852.GB29804@X58A-UD3R>
Date:	Mon, 1 Feb 2016 15:28:52 +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, torvalds@...ux-foundation.org
Subject: Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in
 the debug code

On Mon, Feb 01, 2016 at 11:31:12AM +0900, Sergey Senozhatsky wrote:
> On (01/29/16 21:43), Byungchul Park wrote:
> [..]
> > +extern int is_console_lock(raw_spinlock_t *lock);
> > +
> >  static void __spin_lock_debug(raw_spinlock_t *lock)
> >  {
> >  	u64 i;
> > @@ -113,11 +115,19 @@ static void __spin_lock_debug(raw_spinlock_t *lock)
> >  			return;
> >  		__delay(1);
> >  	}
> > -	/* lockup suspected: */
> > -	spin_dump(lock, "lockup suspected");
> > +
> > +	/*
> > +	 * If this function is called from printk(), then we should
> > +	 * not call printk() more. Or it will cause an infinite
> > +	 * recursive cycle!
> > +	 */
> > +	if (likely(!is_console_lock(lock))) {
> > +		/* lockup suspected: */
> > +		spin_dump(lock, "lockup suspected");
> >  #ifdef CONFIG_SMP
> > -	trigger_all_cpu_backtrace();
> > +		trigger_all_cpu_backtrace();
> >  #endif
> > +	}
> 
> /* speaking in a context of printk locks only */
> 
> ... may be for a recoverable "lockup suspected" spin_dump()
> we can switch to deferred printk of the messages, which is a
> bit better than nothing. but for unrecoverable "lockup suspected"
> spin_dump() -- an actual bug (spin lock owner is not going to
> release the lock any more) -- we need something else, I think.
> the bug will neither be reported nor fixed.

Agree.

> 
> 	-ss
> 
> >  	/*
> >  	 * The trylock above was causing a livelock.  Give the lower level arch
> > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> > index 2ce8826..568ab11 100644
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -1981,6 +1981,11 @@ asmlinkage __visible void early_printk(const char *fmt, ...)
> >  }
> >  #endif
> >  
> > +int is_console_lock(raw_spinlock_t *lock)
> > +{
> > +	return lock == &console_sem.lock;
> > +}
> > +
> >  static int __add_preferred_console(char *name, int idx, char *options,
> >  				   char *brl_options)
> >  {
> > -- 
> > 1.9.1
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ