[PATCH] libio: Fix deadlock between freopen, fflush (NULL) and fclose (bug 24963)

Florian Weimer fweimer@redhat.com
Thu Feb 12 11:18:17 GMT 2026


* Adhemerval Zanella Netto:

>> diff --git a/sysdeps/pthread/tst-bug24963.c b/sysdeps/pthread/tst-bug24963.c
>> new file mode 100644
>> index 0000000000..3afec8e05d
>> --- /dev/null
>> +++ b/sysdeps/pthread/tst-bug24963.c
>
> Running multiple time, valgrind shows:
>
> ==1938085== Thread 2:
> ==1938085== Conditional jump or move depends on uninitialised value(s)
> ==1938085==    at 0x495312C: _IO_flush_all (genops.c:738)
> ==1938085==    by 0x10A86B: fflush_thread (tst-bug24963.c:32)
> ==1938085==    by 0x495B423: start_thread (pthread_create.c:454)
> ==1938085==    by 0x49D0FAB: thread_start (clone.S:76)
>
> Is this related to https://sourceware.org/bugzilla/show_bug.cgi?id=33785 ?

Yes, this is genops.c:738:

	  if (_IO_fileno (fp) >= 0

So it's the access to the _fileno member.

Thanks,
Florian



More information about the Libc-alpha mailing list