1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

malloc: Only support zeroing and not arbitrary memset with mtag

The memset api is suboptimal and does not provide much benefit. Memory
tagging only needs a zeroing memset (and only for memory that's sized
and aligned to multiples of the tag granule), so change the internal
api and the target hooks accordingly.  This is to simplify the
implementation of the target hook.

Reviewed-by: DJ Delorie <dj@redhat.com>
This commit is contained in:
Szabolcs Nagy
2021-01-29 17:07:28 +00:00
parent 42bac88a21
commit c076a0bc69
5 changed files with 21 additions and 26 deletions

View File

@ -44,12 +44,12 @@ __libc_mtag_tag_region (void *p, size_t n)
return p;
}
/* Optimized equivalent to __libc_mtag_tag_region followed by memset. */
/* Optimized equivalent to __libc_mtag_tag_region followed by memset to 0. */
static inline void *
__libc_mtag_memset_with_tag (void *p, int c, size_t n)
__libc_mtag_tag_zero_region (void *p, size_t n)
{
__libc_mtag_link_error ();
return memset (p, c, n);
return memset (p, 0, n);
}
/* Convert address P to a pointer that is tagged correctly for that