[PATCH v4 3/6] malloc: Basic support for memory tagging in the malloc() family

Florian Weimer fweimer@redhat.com
Mon Dec 21 13:46:46 GMT 2020


* Richard Earnshaw via Libc-alpha:

> +/* Generate a new (random) tag value for PTR, set the tags for the
> +   memory to the new tag and initialize the memory contents to VAL.
> +   In practice this function will only be called with VAL=0, but we
> +   keep this parameter to maintain the same prototype as memset.  */
> +static void *
> +__mtag_tag_new_memset (void *ptr, int val, size_t size)
> +{
> +  return __libc_mtag_memset_with_tag (__libc_mtag_new_tag (ptr), val, size);
> +}

I would like to point out that random choice from all possible tag bits
precludes some memory tagging applications.  Some applications might
want to unconditionally force certain tag bits on a load, to assert that
the pointer refers to a specific kind of memory.  If glibc malloc
randomly assigns tag bits from entire range, this kind of memory type
assertion is no longer eliable.

Thanks,
Florian
-- 
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill



More information about the Libc-alpha mailing list