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] [day] [month] [year] [list]
Date:	Thu, 8 Oct 2015 15:46:34 +0100
From:	Darren Hart <dvhart@...radead.org>
To:	"Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Torvald Riegel <triegel@...hat.com>,
	Carlos O'Donell <carlos@...hat.com>,
	Ingo Molnar <mingo@...e.hu>, Jakub Jelinek <jakub@...hat.com>,
	linux-man <linux-man@...r.kernel.org>,
	lkml <linux-kernel@...r.kernel.org>,
	Davidlohr Bueso <dave@...olabs.net>,
	Arnd Bergmann <arnd@...db.de>,
	Steven Rostedt <rostedt@...dmis.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Linux API <linux-api@...r.kernel.org>,
	Roland McGrath <roland@...k.frob.com>,
	Anton Blanchard <anton@...ba.org>,
	Eric Dumazet <edumazet@...gle.com>,
	bill o gallmeister <bgallmeister@...il.com>,
	Jan Kiszka <jan.kiszka@...mens.com>,
	Daniel Wagner <wagi@...om.org>, Rich Felker <dalias@...c.org>,
	Andy Lutomirski <luto@...capital.net>,
	bert hubert <bert.hubert@...herlabs.nl>,
	Rusty Russell <rusty@...tcorp.com.au>,
	Heinrich Schuchardt <xypron.glpk@....de>
Subject: Re: Next round: revised futex(2) man page for review

On Wed, Oct 07, 2015 at 10:34:19AM +0100, Michael Kerrisk (man-pages) wrote:
> On 08/19/2015 03:40 PM, Thomas Gleixner wrote:
> > On Wed, 5 Aug 2015, Darren Hart wrote:
> >> On Mon, Jul 27, 2015 at 02:07:15PM +0200, Michael Kerrisk (man-pages) wrote:
> >>> .\" FIXME XXX ===== Start of adapted Hart/Guniguntala text =====
> >>> .\"       The following text is drawn from the Hart/Guniguntala paper
> >>> .\"       (listed in SEE ALSO), but I have reworded some pieces
> >>> .\"       significantly. Please check it.
> >>>
> >>>        The PI futex operations described below  differ  from  the  other
> >>>        futex  operations  in  that  they impose policy on the use of the
> >>>        value of the futex word:
> >>>
> >>>        *  If the lock is not acquired, the futex word's value  shall  be
> >>>           0.
> >>>
> >>>        *  If  the  lock is acquired, the futex word's value shall be the
> >>>           thread ID (TID; see gettid(2)) of the owning thread.
> >>>
> >>>        *  If the lock is owned and there are threads contending for  the
> >>>           lock,  then  the  FUTEX_WAITERS  bit shall be set in the futex
> >>>           word's value; in other words, this value is:
> >>>
> >>>               FUTEX_WAITERS | TID
> >>>
> >>>
> >>>        Note that a PI futex word never just has the value FUTEX_WAITERS,
> >>>        which is a permissible state for non-PI futexes.
> >>
> >> The second clause is inappropriate. I don't know if that was yours or
> >> mine, but non-PI futexes do not have a kernel defined value policy, so
> >> ==FUTEX_WAITERS cannot be a "permissible state" as any value is
> >> permissible for non-PI futexes, and none have a kernel defined state.
> > 
> > Depends. If the regular futex is configured as robust, then we have a
> > kernel defined value policy as well.
> 

Right.

> Okay -- so do we need a change to the text here?

Hrm. We probably need a way to indicate that kernel-defined futex word
value policy only applies to PI and or ROBUST futexes.


> 
> >>> .\" FIXME I'm not quite clear on the meaning of the following sentence.
> >>> .\"       Is this trying to say that while blocked in a
> >>> .\"       FUTEX_WAIT_REQUEUE_PI, it could happen that another
> >>> .\"       task does a FUTEX_WAKE on uaddr that simply causes
> >>> .\"       a normal wake, with the result that the FUTEX_WAIT_REQUEUE_PI
> >>> .\"       does not complete? What happens then to the FUTEX_WAIT_REQUEUE_PI
> >>> .\"       opertion? Does it remain blocked, or does it unblock
> >>> .\"       In which case, what does user space see?
> >>>
> >>>               The
> >>>               waiter   can  be  removed  from  the  wait  on  uaddr  via
> >>>               FUTEX_WAKE without requeueing on uaddr2.
> >>
> >> Userspace should see the task wake and continue executing. This would
> >> effectively be a cancelation operation - which I didn't think was
> >> supported. Thomas?
> > 
> > We probably never intended to support it, but looking at the code it
> > works (did not try it though). It returns to user space with
> > -EWOULDBLOCK. So it basically behaves like any other spurious wakeup.
> 
> Again, I assume no changes are required to the man page(?).

I'd rather not document this as supported or intended behavior.
FUTEX_WAIT_REQUEUE_PI is documented as being paired with and only with
FUTEX_CMP_REQUEUE_PI. Anything else is undefined behavior.

If we want to support a cancelation, it should be deliberate - and we should
probably test it ;-)


-- 
Darren Hart
Intel Open Source Technology Center
--
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