mbox

[0/7] RFC Memory tagging support

Message ID DB8PR08MB5036AA1C87DAF7E37DB778ED839C0@DB8PR08MB5036.eurprd08.prod.outlook.com
Headers

Message

Wilco Dijkstra June 15, 2020, 6:35 p.m. UTC
  Hi,

> memmove in C has
> 
> rettype
> inhibit_loop_to_libcall
> MEMMOVE (a1const void *a1, a2const void *a2, size_t len)
> {
>   unsigned long int dstp = (long int) dest;
>   unsigned long int srcp = (long int) src;
>
>   /* This test makes the forward copying code be used whenever possible.
>      Reduces the working set.  */
>   if (dstp - srcp >= len) /* *Unsigned* compare!  */
>
> How does it work?

It's not a problem. If the move does not overlap, the tags may be different, and
you do a forward or backward copy depending on the tags (which doesn't matter
when there is no overlap!). If the move overlaps and the tags are the same, things
work as expected. If the tags are not the same, MTE will trigger an exception.

Cheers,
Wilco