[Toybox] [PATCH] sendfile_len: don't check errno unless we set it.

Rob Landley rob at landley.net
Fri Mar 12 00:42:39 PST 2021


On 3/11/21 11:01 AM, enh via Toybox wrote:
> Found by inspection.

Many moons ago I hit a "zero length read that wasn't end of stream" when a
pipeline was interrupted by a signal. I'm pretty sure the kernel guys have fixed
it since, but at the time it was distinguished by EAGAIN and led me down the
path of trying to figure out what SA_RESTART actually meant.

Thus I'd be more comfortable if we set errno to 0 before the call and then
tested <1 && EAGAIN. Old scars. :)

I'm not finding the original, but I am finding one of my follow-up questions:

  http://lkml.iu.edu/hypermail/linux/kernel/0701.2/0777.html

Um, let's see... no, this was a different bug:

  http://lkml.iu.edu/hypermail/linux/kernel/0503.3/1756.html

The bug I hit wasn't involving user mode linux, it was corrupting pipelined
tarballs when you suspended and then resumed the pipeline. It basically threw in
one O_NONBLOCK cycle in there, or something?

(Sigh. It's a pity Google can't "show oldest results first". Or that archive.org
isn't properly searchable...)

Also not it: http://lkml.iu.edu/hypermail/linux/kernel/0104.1/1008.html

Ha, I'd forgotten about
http://lkml.iu.edu/hypermail/linux/kernel/0206.2/0835.html (which got WAY more
feasible when container support started being merged 8 years later)...

I'll stop now.

Rob



More information about the Toybox mailing list