User-allocated stack is inaccessible after thread finishes. It is correct to reuse this memory (maybe allocated via malloc()) for any other purpose. But memcheck reports errors. Short test program is attached. memcheck complains about line with memset(). As Tom Hughes already noted on valgrind-developers list it is not easy to handle, because Valgrind marks stack frames as (in)accessible whenever stack pointer changes. Maybe it is possible to remember original state of memory guessed to be client stack ? On thread exit VG could set original state of this memory back. It is hard for user-allocated stacks with unknown size. But not impossible - VG can store original state gradually - each time stack expands.
Created attachment 15333 [details] test case
Resetting state of whole malloc'ed block that contains this stack isn't a good solution. Proper solution should also handle stacks that are made of part of malloc'ed block or are statically allocated.
Realistically I think the prospects for fixing this are not good, since we don't know how to make our stack-tracking heuristics sophisticated enough.