Bug ID: 24902
Summary: Repeating pututxline on EINTR/EAGAIN causes stale utmp
Assignee: unassigned at sourceware dot org
Reporter: fweimer at redhat dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
When the lock upgrade in pututxline fails, file_offset and last_entry may have
become desynchronized, which causes a subsequent call to pututxline to add a
new entry even if the data at the current position could be used.
You are receiving this mail because:
You are on the CC list for the bug.
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.