mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] Make futex waiters take an mm or inode reference
@ 2003-09-08 18:20 Jamie Lokier
  2003-09-08 18:34 ` Jamie Lokier
  0 siblings, 1 reply; 5+ messages in thread
From: Jamie Lokier @ 2003-09-08 18:20 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Rusty Russell, Hugh Dickins, Ulrich Drepper, Andrew Morton,
	Stephen Hemminger, Linux Kernel

Rusty Russell wrote:
> But why not solve the problem by just holding an mm reference, too?

Rusty also wrote:
> Why not make the code a *whole* lot more readable (and only marginally
> slower, if at all) by doing it in two passes: pull them off onto a
> (on-stack) list in one pass, then requeue them all in another.

This patch makes each futex waiter hold a reference to the mm or inode
that a futex is keyed on.

This is very important, because otherwise a malicious or erroneous
program can use FUTEX_FD to create futexes on mms or inodes which are
recycled, and steal wakeups from other, unrelated programs.

It isn't entirely trivial, because we can't call mmdrop() or iput()
while holding the spinlock, I think.  (Does someone know to the
contrary?)  Rusty, you will be glad to see that I have reimplemented
futex_requeue() exactly as you suggest: in two passes.

Ulrich will be glad to hear tst-cond2 runs just fine :)

Linus, please apply unless there are objections.

Thanks,
-- Jamie

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-09-09  4:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-08 18:20 [PATCH] Make futex waiters take an mm or inode reference Jamie Lokier
2003-09-08 18:34 ` Jamie Lokier
2003-09-08 18:52   ` Linus Torvalds
2003-09-08 20:00     ` Jamie Lokier
2003-09-09  4:02     ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome