On Tue, Jun 11, 2019 at 7:50 PM Catalin Marinas <catalin.marinas@xxxxxxx> wrote: > > On Tue, Jun 11, 2019 at 07:18:04PM +0200, Andrey Konovalov wrote: > > On Tue, Jun 11, 2019 at 5:01 PM Catalin Marinas <catalin.marinas@xxxxxxx> wrote: > > > static void *tag_ptr(void *ptr) > > > { > > > static int tagged_addr_err = 1; > > > unsigned long tag = 0; > > > > > > if (tagged_addr_err == 1) > > > tagged_addr_err = prctl(PR_SET_TAGGED_ADDR_CTRL, > > > PR_TAGGED_ADDR_ENABLE, 0, 0, 0); > > > > I think this requires atomics. malloc() can be called from multiple threads. > > It's slightly racy but I assume in a real libc it can be initialised > earlier than the hook calls while still in single-threaded mode (I had > a quick attempt with __attribute__((constructor)) but didn't get far). > > Even with the race, under normal circumstances calling the prctl() twice > is not a problem. I think the risk here is that someone disables the ABI > via sysctl and the ABI is enabled for some of the threads only. OK, I'll keep the code racy, but add a comment pointing it out. Thanks! > > -- > Catalin _______________________________________________ amd-gfx mailing list amd-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/amd-gfx