From d2743355aea086de1884454ec6d62560bd23730d Mon Sep 17 00:00:00 2001 From: Fabricio Voznika Date: Wed, 25 May 2022 11:58:07 -0700 Subject: [PATCH] Handle negative FDs in syscall points Updates #4805 PiperOrigin-RevId: 450980807 --- pkg/sentry/syscalls/linux/points.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/sentry/syscalls/linux/points.go b/pkg/sentry/syscalls/linux/points.go index f6587b211..3eefbb0d8 100644 --- a/pkg/sentry/syscalls/linux/points.go +++ b/pkg/sentry/syscalls/linux/points.go @@ -35,13 +35,16 @@ func newExitMaybe(info kernel.SyscallInfo) *pb.Exit { } func getFilePath(t *kernel.Task, fd int32) string { + if fd < 0 { + return "" + } fdt := t.FDTable() if fdt == nil { return "[err: no FD table]" } file, _ := fdt.GetVFS2(fd) if file == nil { - return "[err: requires VFS2]" + return "[err: FD not found]" } defer file.DecRef(t)