https://sourceware.org/bugzilla/show_bug.cgi?id=26541
Bug ID: 26541
Summary: gold makes incorrect usage of fallocate in fallback
path
Product: binutils
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: gold
Assignee: ccoutant at gmail dot com
Reporter: bugdal at aerifal dot cx
CC: ian at airs dot com
Target Milestone: ---
In gold's output.cc gold_fallocate, after posix_fallocate() fails with a
non-fatal error, it tries fallocate(). However, the code assumes fallocate()
follows the same contract as posix_fallocate(), returning an error number,
rather than behaving as specified in the Linux man page for fallocate and
returning -1 with errno set to indicate the error. This makes EOPNOTSUPP into a
fatal error, since -1 is not equal EINVAL, ENOSYS, or EOPNOTSUPP.
This was likely overlooked because glibc's posix_fallocate (see
https://sourceware.org/bugzilla/show_bug.cgi?id=15661) has an unsafe emulation
in its own fallback path rather than returning EOPNOTSUPP to the caller.
However, it impacts other systems; the problem was reported to me by a musl
user on reiserfs, where fallocate is not implemented.
--
You are receiving this mail because:
You are on the CC list for the bug.