Skip to content

Commit

Permalink
pkg/ldd: filter dependencies without a filesystem path
Browse files Browse the repository at this point in the history
In some cases the interpreter returns dependencies without
a filesystem path, e.g.:

linux-vdso.so.1 => (0x00007ffe4972d000)

Those dependencies should be skipt.

Signed-off-by: Florian Gläßer <florian.glaesser@code-intelligence.com>
  • Loading branch information
florianGla committed Feb 24, 2023
1 parent 66770cb commit cd7f8b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/ldd/ldd_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ func parseinterp(input string) ([]string, error) {
if f[0] == f[2] {
continue
}
// If the third part is a memory address
// instead of a file system path,
// the entry should be skipped. For example:
// linux-vdso.so.1 => (0x00007ffe4972d000),
if f[1] == "=>" && string(f[2][0]) == "(" {
continue
}
names = append(names, f[2])
}
return names, nil
Expand Down
5 changes: 5 additions & 0 deletions pkg/ldd/ldd_unix_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ var (
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2`,
output: []string{"/usr/lib/libc.so.6", "/usr/lib64/ld-linux-x86-64.so.2"},
},
{
name: "entry with memory address",
input: `linux-vdso.so.1 => (0x00007ffe4972d000)`,
output: []string{},
},
}
)

Expand Down

0 comments on commit cd7f8b0

Please sign in to comment.