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: <20140930134928.GF4241@worktop.programming.kicks-ass.net>
Date:	Tue, 30 Sep 2014 15:49:28 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Oleg Nesterov <oleg@...hat.com>
Cc:	mingo@...nel.org, torvalds@...ux-foundation.org,
	tglx@...utronix.de, ilya.dryomov@...tank.com,
	umgwanakikbuti@...il.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 10/11] sched: Debug nested sleeps

On Tue, Sep 30, 2014 at 12:13:44AM +0200, Oleg Nesterov wrote:
> On 09/24, Peter Zijlstra wrote:
> >
> > +#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
> > +
> > +#define __set_task_state(tsk, state_value)			\
> > +	do {							\
> > +		(tsk)->task_state_change = _THIS_IP_;		\
> > +		(tsk)->state = (state_value);			\
> > +	} while (0)
> 
> ...
> 
> > @@ -7143,6 +7143,19 @@ void __might_sleep(const char *file, int
> >  {
> >  	static unsigned long prev_jiffy;	/* ratelimiting */
> >
> > +	/*
> > +	 * Blocking primitives will set (and therefore destroy) current->state,
> > +	 * since we will exit with TASK_RUNNING make sure we enter with it,
> > +	 * otherwise we will destroy state.
> > +	 */
> > +	if (WARN(current->state != TASK_RUNNING,
> > +			"do not call blocking ops when !TASK_RUNNING; "
> > +			"state=%lx set at [<%p>] %pS\n",
> > +			current->state,
> > +			(void *)current->task_state_change,
> > +			(void *)current->task_state_change))
> > +		__set_current_state(TASK_RUNNING);
> 
> Question: now that we have ->task_state_change, perhaps it makes sense
> to redefine fixup_sleep()
> 
> 	#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
> 	#define fixup_sleep()	(current->task_state_change = 0)
> 	#else
> 	#define fixup_sleep()	do { } while (0)
> 	#endif
> 
> and make the WARN() above depend on task_state_change != 0 ?
> 
> This is minor, but this way CONFIG_DEBUG_ATOMIC_SLEEP will not imply
> a subtle behavioural change.

You mean the __set_current_state() that's extra? I would actually argue
to keep that since it makes the 'problem' much worse.
--
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