View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0018122||CentOS-7||kernel||public||2021-03-23 23:33||2021-03-23 23:33|
|Summary||0018122: sendfile() to a pipe fails with EFBIG after transferring INT_MAX bytes|
|Description||This a copy of https://bugzilla.redhat.com/show_bug.cgi?id=1930795. That report hasn't received a response and is private without me having the ability to change that, so I've decided to make a public report as well for any folks that may stumble in this bug.|
sendfile() to a pipe fails with EFBIG after the total number of transferred bytes reaches INT_MAX. See steps to reproduce.
I got this issue with my software running on a customer site with RHEL 7.8, but could reproduce it on the CentOS 7 (kernel 3.10.0-1160.15.2.el7).
I couldn't reproduce this on kernels from other distros of similar time frame, so I looked further. And judging by the changelog of CentOS 7 kernel package, a possible culprit is the fix for https://bugzilla.redhat.com/show_bug.cgi?id=1163792. I don't know the patch contents, but it appears to have added `generic_write_checks()` before. But that function checks O_LARGEFILE on the file for large positions, and, surprisingly, pipes do maintain a position in this case, so eventually the check fails with EFBIG.
|Steps To Reproduce||Download the attached Python 2 script and run:|
$ dd if=/dev/zero of=big-file bs=1M count=2048
$ python test-sendfile.py <big-file | cat >/dev/null
|Tags||No tags attached.|