Skip to content

Commit 5131c4a

Browse files
authored
[CWS] Fix bug with the listmount snapshotter (#43832)
### What does this PR do? * The link of `/proc/<pid>/ns/mnt` wasn't being read and for this reason, system-probe wasn't obtaining a valid namespace inode number when snapshotting mounts using listmount. This PR fixes the problem. * This was causing `TestMountSnapshotListmount` fail in some cases Co-authored-by: marcio.kovags <marcio.kovags@datadoghq.com>
1 parent 12bfa8a commit 5131c4a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pkg/security/resolvers/mount/mountlister.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,14 @@ func collectUniqueMountNSFDs(procfs string) ([]int, error) {
196196
continue
197197
}
198198
p := filepath.Join(procfs, pid, "ns", "mnt")
199-
ino, err := getInodeNumFromLink(p)
199+
200+
linkTarget, err := os.Readlink(p)
201+
if err != nil {
202+
continue
203+
}
204+
205+
ino, err := getInodeNumFromLink(linkTarget)
206+
200207
if err != nil {
201208
continue
202209
}

0 commit comments

Comments
 (0)