From a005752d88d1f5a5b629071e423e957e7a679ac9 Mon Sep 17 00:00:00 2001 From: Rahat Mahmood Date: Thu, 8 Dec 2022 15:19:16 -0800 Subject: [PATCH] iouringfs: Pet the watchdog during ProcessSubmissions. This loop can take a long time. Since we're blocking on IO outside Task.Block, we need to periodically check for interrupts and update pet the watchdog. Reported-by: syzbot+3fd282d7e4e5c83fc196@syzkaller.appspotmail.com PiperOrigin-RevId: 494009269 --- pkg/sentry/fsimpl/iouringfs/iouringfs.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/sentry/fsimpl/iouringfs/iouringfs.go b/pkg/sentry/fsimpl/iouringfs/iouringfs.go index d771d8fcf..45c3a1c14 100644 --- a/pkg/sentry/fsimpl/iouringfs/iouringfs.go +++ b/pkg/sentry/fsimpl/iouringfs/iouringfs.go @@ -337,6 +337,12 @@ func (fd *FileDescription) ProcessSubmissions(t *kernel.Task, toSubmit uint32, m submitted := uint32(0) for toSubmit > submitted { + // This loop can take a long time to process, so periodically check for + // interrupts. This also pets the watchdog. + if t.Interrupted() { + return -1, linuxerr.EINTR + } + if fetchRB { view, err = fd.ioRingsBuf.view(fd.ioRings.SizeBytes()) if err != nil {