Re: [patch] futex-2.5.42-A2

Ingo Molnar (mingo@elte.hu)
Wed, 16 Oct 2002 10:23:15 +0200 (CEST)


On Wed, 16 Oct 2002, Martin Wirth wrote:

> > if (__alignof__(int) < sizeof(int)) {
> >
> extern void __error_small_int_align();

> I suggested to tighten the above test, because if __alignof__(int) <
> sizeof(int) the test leads to sporadic user space errors if the futex
> variable accidentally crosses a page boundary. [...]

i think you misunderstood Rusty's suggestion - what he suggests is to fail
the kernel compile with a linker error if alignof(int) < sizeof(int). This
is a pure compile-time thing, it does not relate to the alignment of the
futex variable in any way.

> Anyway, the test dates back to times when the futex code did atomic
> operations on the user space variable. But this is gone. The present
> code only touches users space by get_user which does its on checks. So
> from the point of keeping the kernel in a sane state we could drop the
> test completely.

actually, i think it's still important to do the alignment check to
enforce userspace to use sane alignment. We dont want one futex variable
out of 1000 potential futex to be misaligned, missed and blamed on the
kernel.

Ingo

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