RE: [PATCH v2 0/4] Fix some 4-byte vs. 8-byte alignment issues in atomic bit operations
From: David Laight
Date: Tue Nov 26 2019 - 05:13:46 EST
From: Fenghua Yu
> Sent: 25 November 2019 19:43
...
> Change Log:
> v2:
> - Remove patch 1 and 3 in v1 because they are in the tip tree already.
> - Add new patches 2-4 per David Laight's comments:
> https://lore.kernel.org/lkml/e7c75de9191847ed98c573f9ad871518@xxxxxxxxxxxxxxxx/
> Running "grep -r --include '*.[ch]' '_bit([^(]*, *([^)]*\*)' ."
> returns about 200 results. Most of them don't have split lock issues.
Except that any code that has to cast the long[] array argument to any of
the bitops functions is almost certainly broken in some way or other.
At best it is relying on accidental alignment of whatever address it is passing
to avoid alignment faults (for general misaligned accesses).
In other cases attempting to run the code on a BE system will update the
wrong bits - potentially in some other member of the structure.
Now, you might say that 'this code is LE only', but at some point it might
get used on a BE system.
So all of those 200 results need fixing to remove the casts.
Just using the unblocked __bit_xxx() functions doesn't fix
all the problems.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)