[PATCH, RFC] fix UP futex code to not generate invalid streqt instruction

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Jul 22 14:22:42 EDT 2011


On Fri, Jul 22, 2011 at 07:12:30PM +0100, Dave Martin wrote:
> Do we have the same potential bug for the __put_user functions in
> arch/arm/include/asm/uaccess.h? Although cases where the two
> relevant arguments could be statically assigned to the same register
> by the compiler will be rare, those macros are used all over the place.

The only time it will happen is if the compiler sees that we're doing
this:

	__put_user(x, x);

In other words, you pass the same argument in for the value and pointer.

That should never happen for two reasons:
1. It will fail the type checking and issue compiler warnings about
   mismatched types.
2. This is silly code.

That goes for the futex case too - it can only happen if you pass in
the same pointer twice (or an alias of it.)  And that's rubbish code.

The only other case it could happen is:

	__put_user(NULL, NULL);

and I mean the constant 'NULL' not some NULL pointer.  Again, this
has to be written explicitly, and writing to address 0 is... very
silly like this.

So, nothing to fix there either.



More information about the linux-arm-kernel mailing list