]> sourceware.org Git - glibc.git/commit
login: pututxline could fail to overwrite existing entries [BZ #24902]
authorFlorian Weimer <fweimer@redhat.com>
Wed, 28 Aug 2019 09:59:45 +0000 (11:59 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Wed, 28 Aug 2019 09:59:45 +0000 (11:59 +0200)
commit61d3db428176d9d0822e4e680305fe34285edff2
tree22ad4258b0d656bdf5ece29ade65a3e321a9a1b9
parent3a9d025fdd56f595ef9cb142486da4ee1b75281f
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>
ChangeLog
login/Makefile
login/tst-pututxline-lockfail.c [new file with mode: 0644]
login/utmp_file.c
This page took 0.042079 seconds and 5 git commands to generate.