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:	Tue, 04 Jun 2013 08:16:29 -0400
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	LKML <linux-kernel@...r.kernel.org>,
	"Paul E. McKenney" <paulmck@...ibm.com>,
	Dave Jones <davej@...hat.com>, Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH v2][RFC] tracing/context-tracking: Add
 preempt_schedule_context() for tracing

On Tue, 2013-06-04 at 14:09 +0200, Frederic Weisbecker wrote:
>  
> > +/**
> > + * preempt_schedule_context - preempt_schedule called by tracing
> > + *
> > + * The tracing infrastructure uses preempt_enable_notrace to prevent
> > + * recursion and tracing preempt enabling caused by the tracing
> > + * infrastructure itself. But as tracing can happen in areas coming
> > + * from userspace or just about to enter userspace, a preempt enable
> > + * can occur before user_exit() is called. This will cause the scheduler
> > + * to be called when the system is still in usermode.
> > + *
> > + * To prevent this, the preempt_enable_notrace will use this function
> > + * instead of preempt_schedule() to exit user context if needed before
> > + * calling the scheduler.
> > + */
> > +void __sched notrace preempt_schedule_context(void)
> > +{
> > +	struct thread_info *ti = current_thread_info();
> > +	enum ctx_state prev_ctx;
> > +
> > +	if (likely(ti->preempt_count || irqs_disabled()))
> > +		return;
> 
> or:
>         if (!preemptible())
>                 return;

Sure, but this is a cut and paste from preempt_schedule(). If I make
that change here, I would want to make that there too.

Peter, should I use !preemptible() or keep it like preempt_schedule()
and make a clean up change for 3.11?

> 
> > +
> > +	/*
> > +	 * Need to disable preemption in case user_exit() is traced
> > +	 * and the tracer calls preempt_enable_notrace() causing
> > +	 * an infinite recursion.
> > +	 */
> > +	preempt_disable_notrace();
> > +	prev_ctx = exception_enter();
> > +	preempt_enable_no_resched_notrace();
> > +
> > +	preempt_schedule();
> > +
> > +	preempt_disable_notrace();
> > +	exception_exit(prev_ctx);
> > +	preempt_enable_notrace();
> > +}
> > +EXPORT_SYMBOL(preempt_schedule_context);
> 
> That's quite a tricky change but I can't think of anything better.

Yeah, I had a few other solutions that were even worse than this one.
Then I finally decided this was the best of the worse.

> 
> Acked-by: Frederic Weisbecker <fweisbec@...il.com>

Thanks,

-- Steve

> 
> 
> >  /**
> >   * user_exit - Inform the context tracking that the CPU is
> > -- 
> > 1.7.3.4
> > 
> > 
> > 


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