Re: [patch] futex-2.5.42-A2

From: Martin Wirth (Martin.Wirth@dlr.de)
Date: Wed Oct 16 2002 - 02:58:52 EST


(My first reply seems to have been lost, so lets try a second time)

>Um, this test existed for a reason:
>
>> - /* Must be "naturally" aligned, and not on page boundary. */
>> - if ((pos_in_page % __alignof__(int)) != 0
>> - || pos_in_page + sizeof(int) > PAGE_SIZE)
>> + /* Must be "naturally" aligned */
>> + if (pos_in_page % sizeof(int))
>> return -EINVAL;
>
>If you do this, *please* add:
> /* Above check not sufficient if align of int < size. Break link. */
> if (__alignof__(int) < sizeof(int)) {
>
        extern void __error_small_int_align();
>
        __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. The
only sane way to control this is to force the user space compiler
to use __alignof__(int) == sizeof(int) for futex variables.

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.

Martin

-
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/



This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:27 EST