On Wed, Jun 12, 2019 at 01:30:36PM +0100, Szabolcs Nagy wrote: > On 12/06/2019 12:43, Andrey Konovalov wrote: > > --- /dev/null > > +++ b/tools/testing/selftests/arm64/tags_lib.c > > @@ -0,0 +1,62 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > + > > +#include <stdlib.h> > > +#include <sys/prctl.h> > > + > > +#define TAG_SHIFT (56) > > +#define TAG_MASK (0xffUL << TAG_SHIFT) > > + > > +#define PR_SET_TAGGED_ADDR_CTRL 55 > > +#define PR_GET_TAGGED_ADDR_CTRL 56 > > +#define PR_TAGGED_ADDR_ENABLE (1UL << 0) > > + > > +void *__libc_malloc(size_t size); > > +void __libc_free(void *ptr); > > +void *__libc_realloc(void *ptr, size_t size); > > +void *__libc_calloc(size_t nmemb, size_t size); > > this does not work on at least musl. > > the most robust solution would be to implement > the malloc apis with mmap/munmap/mremap, if that's > too cumbersome then use dlsym RTLD_NEXT (although > that has the slight wart that in glibc it may call > calloc so wrapping calloc that way is tricky). > > in simple linux tests i'd just use static or > stack allocations or mmap. > > if a generic preloadable lib solution is needed > then do it properly with pthread_once to avoid > races etc. Thanks for the feedback Szabolcs. I guess we can go back to the initial simple test that Andrey had and drop the whole LD_PRELOAD hack (I'll just use it for my internal testing). BTW, when you get some time, please review Vincenzo's ABI documentation patches from a user/libc perspective. Once agreed, they should become part of this series. -- Catalin _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx