mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Small fixes to trace points
Don't collect `cwd` when task root is not present anymore, e.g. zombie. Limit the size allocated for address in `connect(2)`. Updates #4805 PiperOrigin-RevId: 455208465
This commit is contained in:
committed by
gVisor bot
parent
2df29e11dd
commit
6258291815
@@ -49,12 +49,14 @@ func LoadSeccheckDataLocked(t *Task, mask seccheck.FieldMask, info *pb.ContextDa
|
||||
info.ContainerId = t.tg.leader.ContainerID()
|
||||
}
|
||||
if mask.Contains(seccheck.FieldCtxtCwd) {
|
||||
root := t.FSContext().RootDirectoryVFS2()
|
||||
defer root.DecRef(t)
|
||||
wd := t.FSContext().WorkingDirectoryVFS2()
|
||||
defer wd.DecRef(t)
|
||||
vfsObj := root.Mount().Filesystem().VirtualFilesystem()
|
||||
info.Cwd, _ = vfsObj.PathnameWithDeleted(t, root, wd)
|
||||
if root := t.FSContext().RootDirectoryVFS2(); root.Ok() {
|
||||
defer root.DecRef(t)
|
||||
if wd := t.FSContext().WorkingDirectoryVFS2(); wd.Ok() {
|
||||
defer wd.DecRef(t)
|
||||
vfsObj := root.Mount().Filesystem().VirtualFilesystem()
|
||||
info.Cwd, _ = vfsObj.PathnameWithDeleted(t, root, wd)
|
||||
}
|
||||
}
|
||||
}
|
||||
if mask.Contains(seccheck.FieldCtxtProcessName) {
|
||||
info.ProcessName = t.Name()
|
||||
|
||||
@@ -191,10 +191,7 @@ func PointConnect(t *kernel.Task, fields seccheck.FieldSet, cxtData *pb.ContextD
|
||||
|
||||
addr := info.Args[1].Pointer()
|
||||
addrlen := info.Args[2].Uint()
|
||||
if addr > 0 {
|
||||
p.Address = make([]byte, addrlen)
|
||||
_, _ = t.CopyInBytes(addr, p.Address)
|
||||
}
|
||||
p.Address, _ = CaptureAddress(t, addr, addrlen)
|
||||
|
||||
if fields.Local.Contains(seccheck.FieldSyscallPath) {
|
||||
p.FdPath = getFilePath(t, int32(p.Fd))
|
||||
|
||||
Reference in New Issue
Block a user