But why is this check needed? We do not do similar checks in kern_umtx.c.
IMO MD casueword/fuword/suword interfaces must handle this case, e.g. returning EFAULT if unaligned userspace address is not acceptable (or silently do whatever is needed).
Ok, I see. So according to your suggestion, amd64 fuword should fall back to a lock-prefixed instruction if it detects that the operand is unaligned.
I note though that the futex documentation explicitly states that EINVAL is returned if the object is not 4 byte-aligned, so I suspect that this change is still preferable for compatibility reasons.
I do not think so. As far as kernel does not melt under unaligned access, it should be fine. The fact that fuword/suword are not atomic on perfectly unaligned addresses only breaks userspace that is already broken by requesting umtx op on such address.
For other arches, where unaligned access might need some assistance, it is fine to either return an error or to emulate it. pcb_onfault is the most obvious approach. But fuword(9) family must tolerate arbitrary representable addresses, by any means. There should be no need in pre-checks to safely use them.