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, 26 Sep 2016 11:35:03 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     mingo@...nel.org, tglx@...utronix.de, juri.lelli@....com,
        xlpang@...hat.com, bigeasy@...utronix.de,
        linux-kernel@...r.kernel.org, mathieu.desnoyers@...icios.com,
        jdesfossez@...icios.com, bristot@...hat.com,
        Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH -v2 1/9] rtmutex: Deboost before waking up the top
 waiter

On Mon, 26 Sep 2016 17:22:28 +0200
Peter Zijlstra <peterz@...radead.org> wrote:

> > > +	/*
> > > +	 * We should deboost before waking the top waiter task such that
> > > +	 * we don't run two tasks with the 'same' priority. This however
> > > +	 * can lead to prio-inversion if we would get preempted after
> > > +	 * the deboost but before waking our high-prio task, hence the
> > > +	 * preempt_disable before unlock. Pairs with preempt_enable() in
> > > +	 * rt_mutex_postunlock();  
> > 
> > There's a preempt_enable() in rt_mutex_postunlock()? Does
> > wake_futex_pi() know that?
> >   
> 
> Not sure I see your point. rt_mutex_futex_unlock() calls
> rt_mutex_slowunlock() which does the preempt_disable(), we then pass the
> return of that into deboost, which we pass into rt_mutex_postunlock()
> and everything should be balanced.

Can we please add more comments explaining this. Having side effects of
functions disabling preemption, passing a bool saying that it did, and
needing to call another function (somewhat seemingly unrelated) to
re-enable preemption, just seems a bit of a stretch for maintainable
code.

Especially now that the code after the spin_unlock(&hb->lock) is now a
critical section (preemption is disable). There's nothing obvious in
futex.c that says it is.

Just think about looking at this code in another 5 years. Are you going
to remember all this?

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ