diff options
author | Florian Weimer <fweimer@redhat.com> | 2019-08-28 11:59:45 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2019-08-28 11:59:45 +0200 |
commit | 61d3db428176d9d0822e4e680305fe34285edff2 (patch) | |
tree | 22ad4258b0d656bdf5ece29ade65a3e321a9a1b9 /ChangeLog | |
parent | 3a9d025fdd56f595ef9cb142486da4ee1b75281f (diff) | |
download | glibc-61d3db428176d9d0822e4e680305fe34285edff2.zip glibc-61d3db428176d9d0822e4e680305fe34285edff2.tar.gz glibc-61d3db428176d9d0822e4e680305fe34285edff2.tar.bz2 |
login: pututxline could fail to overwrite existing entries [BZ #24902]
The internal_getut_r function updates the file_offset variable and
therefore must always update last_entry as well.
Previously, if pututxline could not upgrade the read lock to a
write lock, internal_getut_r would update file_offset only,
without updating last_entry, and a subsequent call would not
overwrite the existing utmpx entry at file_offset, instead
creating a new entry. This has been observed to cause unbounded
file growth in high-load situations.
This commit removes the buffer argument to internal_getut_r and
updates the last_entry variable directly, along with file_offset.
Initially reported and fixed by Ondřej Lysoněk.
Reviewed-by: Gabriel F. T. Gomes <gabrielftg@linux.ibm.com>
Diffstat (limited to 'ChangeLog')
-rw-r--r-- | ChangeLog | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1,3 +1,13 @@ +2019-08-28 Florian Weimer <fweimer@redhat.com> + + [BZ #24902] + * login/Makefile (tests): Add tst-pututxline-lockfail. + (tst-pututxline-lockfail): Link with -lpthread. + * login/utmp_file.c (internal_getut_r): Remove buffer argument. + (__libc_getutid_r): Adjust. + (__libc_pututline): Likewise. Check for file_offset == -1. + * login/tst-pututxline-lockfail.c: New file. + 2019-08-28 Stefan Liebler <stli@linux.ibm.com> * posix/tst-regex.c (do_test): Use tst-regex.input as input file. |