<feed xmlns='http://www.w3.org/2005/Atom'>
<title>glibc/libio/genops.c, branch vdso</title>
<subtitle>Fork of glibc for development</subtitle>
<id>https://git.zx2c4.com/glibc/atom/libio/genops.c?h=vdso</id>
<link rel='self' href='https://git.zx2c4.com/glibc/atom/libio/genops.c?h=vdso'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/'/>
<updated>2024-09-04T13:29:35Z</updated>
<entry>
<title>libio: Attempt wide backup free only for non-legacy code</title>
<updated>2024-09-04T13:29:35Z</updated>
<author>
<name>Siddhesh Poyarekar</name>
<email>siddhesh@sourceware.org</email>
</author>
<published>2024-09-03T18:58:33Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=ae4d44b1d501421ad9a3af95279b8f4d1546f1ce'/>
<id>urn:sha1:ae4d44b1d501421ad9a3af95279b8f4d1546f1ce</id>
<content type='text'>
_wide_data and _mode are not available in legacy code, so do not attempt
to free the wide backup buffer in legacy code.

Resolves: BZ #32137 and BZ #27821

Signed-off-by: Siddhesh Poyarekar &lt;siddhesh@sourceware.org&gt;
Reviewed-by: Florian Weimer &lt;fweimer@redhat.com&gt;
</content>
</entry>
<entry>
<title>ungetc: Fix backup buffer leak on program exit [BZ #27821]</title>
<updated>2024-08-15T17:56:13Z</updated>
<author>
<name>Siddhesh Poyarekar</name>
<email>siddhesh@sourceware.org</email>
</author>
<published>2024-08-14T01:08:49Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=3e1d8d1d1dca24ae90df2ea826a8916896fc7e77'/>
<id>urn:sha1:3e1d8d1d1dca24ae90df2ea826a8916896fc7e77</id>
<content type='text'>
If a file descriptor is left unclosed and is cleaned up by _IO_cleanup
on exit, its backup buffer remains unfreed, registering as a leak in
valgrind.  This is not strictly an issue since (1) the program should
ideally be closing the stream once it's not in use and (2) the program
is about to exit anyway, so keeping the backup buffer around a wee bit
longer isn't a real problem.  Free it anyway to keep valgrind happy
when the streams in question are the standard ones, i.e. stdout, stdin
or stderr.

Also, the _IO_have_backup macro checks for _IO_save_base,
which is a roundabout way to check for a backup buffer instead of
directly looking for _IO_backup_base.  The roundabout check breaks when
the main get area has not been used and user pushes a char into the
backup buffer with ungetc.  Fix this to use the _IO_backup_base
directly.

Signed-off-by: Siddhesh Poyarekar &lt;siddhesh@sourceware.org&gt;
Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</content>
</entry>
<entry>
<title>ungetc: Fix uninitialized read when putting into unused streams [BZ #27821]</title>
<updated>2024-08-15T17:55:07Z</updated>
<author>
<name>Siddhesh Poyarekar</name>
<email>siddhesh@sourceware.org</email>
</author>
<published>2024-08-14T01:00:06Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=cdf0f88f97b0aaceb894cc02b21159d148d7065c'/>
<id>urn:sha1:cdf0f88f97b0aaceb894cc02b21159d148d7065c</id>
<content type='text'>
When ungetc is called on an unused stream, the backup buffer is
allocated without the main get area being present.  This results in
every subsequent ungetc (as the stream remains in the backup area)
checking uninitialized memory in the backup buffer when trying to put a
character back into the stream.

Avoid comparing the input character with buffer contents when in backup
to avoid this uninitialized read.  The uninitialized read is harmless in
this context since the location is promptly overwritten with the input
character, thus fulfilling ungetc functionality.

Also adjust wording in the manual to drop the paragraph that says glibc
cannot do multiple ungetc back to back since with this change, ungetc
can actually do this.

Signed-off-by: Siddhesh Poyarekar &lt;siddhesh@sourceware.org&gt;
Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</content>
</entry>
<entry>
<title>libio: handle opening a file when all files are closed (bug 31963)</title>
<updated>2024-07-09T08:12:36Z</updated>
<author>
<name>Andreas Schwab</name>
<email>schwab@suse.de</email>
</author>
<published>2024-07-08T13:52:35Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=2213b37b705843908355a89648017f4e597b2bbb'/>
<id>urn:sha1:2213b37b705843908355a89648017f4e597b2bbb</id>
<content type='text'>
_IO_list_all becomes NULL when all files (including standard files) are
closed.
</content>
</entry>
<entry>
<title>Use a doubly-linked list for _IO_list_all (bug 27777)</title>
<updated>2024-05-17T21:13:25Z</updated>
<author>
<name>Alexandre Ferrieux</name>
<email>alexandre.ferrieux@orange.com</email>
</author>
<published>2024-05-16T12:54:30Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=2a99e2398d9d717c034e915f7846a49e623f5450'/>
<id>urn:sha1:2a99e2398d9d717c034e915f7846a49e623f5450</id>
<content type='text'>
This patch fixes BZ #27777 "fclose does a linear search, takes ages when
many FILE* are opened".  Simply put, the master list of opened (FILE*),
namely _IO_list_all, is a singly-linked list.  As a consequence, the
removal of a single element is in O(N), which cripples the performance
of fclose().  The patch switches to a doubly-linked list, yielding O(1)
removal.  The one padding field in struct _IO_FILE, __pad5, is renamed
to _prevchain for a doubly-linked list.  Since fields in struct _IO_FILE
after the _lock field are internal to glibc and opaque to applications.
We can change them as long as the size of struct _IO_FILE is unchanged,
which is checked as the part of glibc ABI with sizes of _IO_2_1_stdin_,
_IO_2_1_stdout_ and _IO_2_1_stderr_.

NB: When _IO_vtable_offset (fp) == 0, copy relocation will cover the
whole struct _IO_FILE.  Otherwise, only fields up to the _lock field
will be copied to applications at run-time.  It is used to check if
the _prevchain field can be safely accessed.

After opening 2 million (FILE*), the fclose() of 100 of them takes quite
a few seconds without the patch, and under 2 seconds with it on a loaded
machine.

No test is added since there are no functional changes.

Co-Authored-By: H.J. Lu &lt;hjl.tools@gmail.com&gt;
Signed-off-by: Alexandre Ferrieux &lt;alexandre.ferrieux@orange.com&gt;
Signed-off-by: H.J. Lu &lt;hjl.tools@gmail.com&gt;
Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</content>
</entry>
<entry>
<title>Update copyright dates with scripts/update-copyrights</title>
<updated>2024-01-01T18:53:40Z</updated>
<author>
<name>Paul Eggert</name>
<email>eggert@cs.ucla.edu</email>
</author>
<published>2024-01-01T18:12:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=dff8da6b3e89b986bb7f6b1ec18cf65d5972e307'/>
<id>urn:sha1:dff8da6b3e89b986bb7f6b1ec18cf65d5972e307</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Always do locking when accessing streams (bug 15142, bug 14697)</title>
<updated>2023-07-03T07:55:43Z</updated>
<author>
<name>Andreas Schwab</name>
<email>schwab@suse.de</email>
</author>
<published>2018-01-30T09:16:00Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=af130d27099651e0d27b2cf2cfb44dafd6fe8a26'/>
<id>urn:sha1:af130d27099651e0d27b2cf2cfb44dafd6fe8a26</id>
<content type='text'>
Now that abort no longer calls fflush there is no reason to avoid locking
the stdio streams anywhere.  This fixes a conformance issue and potential
heap corruption during exit.
</content>
</entry>
<entry>
<title>Move libc_freeres_ptrs and libc_subfreeres to hidden/weak functions</title>
<updated>2023-03-27T16:57:55Z</updated>
<author>
<name>Adhemerval Zanella Netto</name>
<email>adhemerval.zanella@linaro.org</email>
</author>
<published>2022-12-27T21:11:42Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=88677348b4de73874ca7d5a47451f42880f65f07'/>
<id>urn:sha1:88677348b4de73874ca7d5a47451f42880f65f07</id>
<content type='text'>
They are both used by __libc_freeres to free all library malloc
allocated resources to help tooling like mtrace or valgrind with
memory leak tracking.

The current scheme uses assembly markers and linker script entries
to consolidate the free routine function pointers in the RELRO segment
and to be freed buffers in BSS.

This patch changes it to use specific free functions for
libc_freeres_ptrs buffers and call the function pointer array directly
with call_function_static_weak.

It allows the removal of both the internal macros and the linker
script sections.

Checked on x86_64-linux-gnu, i686-linux-gnu, and aarch64-linux-gnu.
Reviewed-by: Carlos O'Donell &lt;carlos@redhat.com&gt;
</content>
</entry>
<entry>
<title>Update copyright dates with scripts/update-copyrights</title>
<updated>2023-01-06T21:14:39Z</updated>
<author>
<name>Joseph Myers</name>
<email>joseph@codesourcery.com</email>
</author>
<published>2023-01-06T21:08:04Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=6d7e8eda9b85b08f207a6dc6f187e94e4817270f'/>
<id>urn:sha1:6d7e8eda9b85b08f207a6dc6f187e94e4817270f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>stdlib: Move _IO_cleanup to call_function_static_weak</title>
<updated>2022-12-12T12:53:23Z</updated>
<author>
<name>Adhemerval Zanella</name>
<email>adhemerval.zanella@linaro.org</email>
</author>
<published>2022-11-13T18:49:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/glibc/commit/?id=5dcd2d0ad02ff12c76355ef4f40947c1857ac482'/>
<id>urn:sha1:5dcd2d0ad02ff12c76355ef4f40947c1857ac482</id>
<content type='text'>
Reviewed-by: Florian Weimer &lt;fweimer@redhat.com&gt;
</content>
</entry>
</feed>
