Re: [PATCH RFC] m68k: Handle __generic_copy_to_user faults more carefully

Eero Tamminen
2024-04-17T08:26:22Z

Hi,

On 17.4.2024 9.59, Geert Uytterhoeven wrote:
> On Tue, Apr 16, 2024 at 10:36 PM Michael Schmitz <schmitzmic@gmail.com> wrote:
>> I have tested this fault scenario with a transfer beginning
>> at a single byte at the end of a mapped page only, which IMO
>> does violate m68k alignment rules. I cannot remember ever
>> seeing such faults reported from conforming software before.
>
> 68020+ does support unaligned data accesses, so IMHO such transfers
> are valid.

But is that valid also across page boundaries?

I vaguely remember (from 15-20 years ago) there being ARM errata about
some things being undefined when doing unaligned 16/32-bit data access
across page boundary, so maybe it's not so clear cut on m68k either?

> For compatibility with 68000/68008/68010/68012, data is
> recommended to be 2-byte aligned.
> Instructions must always be aligned to 2 bytes, though.

- Eero

PS. Quick googling found following ARM spec comment "a watchpoint might
be undetected if it occurs on the second part of an unaligned access
that crosses a 4K page boundary", but I remember issue being not just
with watchpoints back then.