[PATCH] nptl: Add smoke test for pthread_getcpuclockid failure

Siddhesh Poyarekar siddhesh@sourceware.org
Fri Nov 22 11:39:53 GMT 2024


On 2024-11-22 02:42, Florian Weimer wrote:
>> +int
>> +do_test (void)
>> +{
>> +  pthread_t t = xpthread_create (NULL, thr, NULL);
>> +  xpthread_join (t);
>> +
>> +  clockid_t c;
>> +  TEST_COMPARE (pthread_getcpuclockid (t, &c), ESRCH);
> 
> This test is invalid because the lifetime of t has ended.  This
> use-after-free bug becomes visible if you run the test with
> GLIBC_TUNABLES=glibc.pthread.stack_cache_size=0.

Eek, of course, sorry I should have seen that :/

I can't see a way to intercept points within the lifetime of the thread 
id where tid is <=0, but I'll send an update if I do.

Thanks,
Sid


More information about the Libc-alpha mailing list