Handle negative FDs in syscall points

Updates #4805

PiperOrigin-RevId: 450980807
This commit is contained in:
Fabricio Voznika
2022-05-25 12:00:50 -07:00
committed by gVisor bot
parent 657b52920d
commit d2743355ae
+4 -1
View File
@@ -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)