Bug 27828 - memmove doesn't work with tagged address
Summary: memmove doesn't work with tagged address
Status: RESOLVED OBSOLETE
Alias: None
Product: glibc
Classification: Unclassified
Component: string (show other bugs)
Version: 2.34
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-06 21:02 UTC by H.J. Lu
Modified: 2021-09-17 17:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description H.J. Lu 2021-05-06 21:02:40 UTC
string/memmove.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!  */
      ^^^^^^^^^^^^  This doesn't work with tagged address.
    {
      ...
    }

Processor specific memmove may have the same issue.

sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:

247 L(start_movsb):
248         mov     %RDX_LP, %RCX_LP
249         cmp     %RSI_LP, %RDI_LP
            ^^^^^^^^^^^^^^^^^^^^^^^^ This has the same issue.
250         jb      1f
Comment 1 H.J. Lu 2021-09-17 17:08:40 UTC
Overlapping pointers should have the same tag.