On Fri, Jun 14, 2024 at 09:27:14PM +1000, Michael Ellerman wrote: > commit 2d43cc701b96f910f50915ac4c2a0cae5deb734c upstream. > The 'std' instruction requires a 4-byte aligned displacement because > it is a DS-form instruction, and as the assembler says, 18 is not a > multiple of 4. You learn something new every day :-) > A similar error is seen with GCC 13 and CONFIG_UBSAN_SIGNED_WRAP=y. > > The fix is to change the constraint on the memory operand to put_user(), > from "m" which is a general memory reference to "YZ". > > The "Z" constraint is documented in the GCC manual PowerPC machine > constraints, and specifies a "memory operand accessed with indexed or > indirect addressing". "Y" is not documented in the manual but specifies > a "memory operand for a DS-form instruction". Using both allows the > compiler to generate a DS-form "std" or X-form "stdx" as appropriate. https://gcc.gnu.org/PR115289 It will be documented soon, thanks for the report! > Although the build error is only seen with GCC 13/14, that appears > to just be luck. The constraint has been incorrect since it was first > added. Yes, "m" allows any memory operand, an unaligned one is just fine. Acked-by: Segher Boessenkool <segher@xxxxxxxxxxxxxxxxxxx> Segher