From 395c38be75d1757d3eff9241602eec73d658b40c Mon Sep 17 00:00:00 2001 From: Ayush Ranjan Date: Tue, 22 Feb 2022 17:05:47 -0800 Subject: [PATCH] Add ECONNABORTED to the partial result error list. Allow application to receive partial result due to ECONNABORTED. Similar to how ECONNRESET and ETIMEDOUT are handled. Reported-by: syzbot+a0029790ed0bda86356e@syzkaller.appspotmail.com PiperOrigin-RevId: 430328305 --- pkg/sentry/syscalls/linux/error.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/sentry/syscalls/linux/error.go b/pkg/sentry/syscalls/linux/error.go index f4d549a3f..e73e94f32 100644 --- a/pkg/sentry/syscalls/linux/error.go +++ b/pkg/sentry/syscalls/linux/error.go @@ -156,9 +156,12 @@ func handleIOErrorImpl(ctx context.Context, partialResult bool, errOrig, intr er return true, nil case linuxerr.Equals(linuxerr.ECONNRESET, translatedErr): fallthrough + case linuxerr.Equals(linuxerr.ECONNABORTED, translatedErr): + fallthrough case linuxerr.Equals(linuxerr.ETIMEDOUT, translatedErr): - // For TCP sendfile connections, we may have a reset or timeout. But we - // should just return n as the result. + // For TCP sendfile connections, we may have a reset, abort or timeout. But + // we should just return the partial result. The next call will return the + // error without a partial IO operation. return true, nil case linuxerr.Equals(linuxerr.EWOULDBLOCK, translatedErr): // Syscall would block, but completed a partial read/write.