Re: [PATCH/RFC] Futex mmap_sem deadlock

From: Jamie Lokier
Date: Wed Feb 23 2005 - 13:28:20 EST


Olof Johansson wrote:
> On Wed, Feb 23, 2005 at 07:54:06AM -0800, Linus Torvalds wrote:
>
> > > Otherwise, a preempt attempt in get_user would not be seen
> > > until some future preempt_enable was executed.
> >
> > True. I guess we should have a "preempt_check_resched()" there too. That's
> > what "kunmap_atomic()" does too (which is what we rely on in the other
> > case we do this..)
>
> Ok, this is getting complex enough to warrant get_user_inatomic(),
> which means adding it to every arch's uaccess.h.
>
> Below patch does so. Unfortunately I don't have a Viro setup with cross
> compilers for nearly every arch, so I can't make sure it doesn't break
> anything. But since I pasted the same code everywhere it shouldn't.

My turn to say uglee.

Firstly, get_user_inatomic is the wrong name.

"inatomic" in __copy_from_user_inatomic means it's called inside a
non-premptable region (in atomic...).

Your macro get_user_inatomic is _not_ called inside a
non-preemptable region, so it shouldn't be called "inatomic".

(A better name is get_user_no_paging).

Secondly, does this _one_ use (it's not likely to be used elsewhere)
justify copying & pasting the same code into every asm-*/uaccess,
especially when the code is not in any way arch-specific?

I suggest putting it into futex.c, and make it an inline function
which takes "u32 __user *".

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/