diff options
author | Yonghong Song <yhs@fb.com> | 2019-01-25 13:20:08 -0800 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2019-01-29 21:07:51 +0100 |
commit | 14ec4824632be7a35afb422f8205773a2bd579d8 (patch) | |
tree | 11c29b77532345cde0da571eb9434188e7f33321 /libdwfl | |
parent | b548f4fe92c43e117cac395a8d23cb9c1fab02af (diff) |
libdwfl: parse inode in /proc/pid/maps correctly
The inode number in /proc/pid/maps is displayed as "unsigned long"
type.
In one of our x64 system, we have inode number exceeding valid "long"
type range, which caused the following test failure:
FAIL: dwfl-bug-fd-leak
FAIL: run-backtrace-dwarf.sh
FAIL: vdsosyms
The offending map entry:
7f269246b000-7f269246c000 rw-p 0002e000 00:50 10224326387095067468 /home/...
This patch changed sscanf inode number type from PRIi64 to PRIu64
and fixed the problem.
Signed-off-by: Yonghong Song <yhs@fb.com>
Diffstat (limited to 'libdwfl')
-rw-r--r-- | libdwfl/ChangeLog | 5 | ||||
-rw-r--r-- | libdwfl/linux-proc-maps.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index de45e7f1..04cadb43 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,8 @@ +2019-01-25 Yonghong Song <yhs@fb.com> + + * linux-proc-maps.c (proc_maps_report): Use PRIu64, not PRIi64, to + read the inode number. + 2019-01-20 Mark Wielaard <mark@klomp.org> * dwfl_segment_report_module.c (dwfl_segment_report_module): Check diff --git a/libdwfl/linux-proc-maps.c b/libdwfl/linux-proc-maps.c index c4438c0f..719cba68 100644 --- a/libdwfl/linux-proc-maps.c +++ b/libdwfl/linux-proc-maps.c @@ -217,7 +217,7 @@ proc_maps_report (Dwfl *dwfl, FILE *f, GElf_Addr sysinfo_ehdr, pid_t pid) uint64_t ino; int nread = -1; if (sscanf (line, "%" PRIx64 "-%" PRIx64 " %*s %" PRIx64 - " %x:%x %" PRIi64 " %n", + " %x:%x %" PRIu64 " %n", &start, &end, &offset, &dmajor, &dminor, &ino, &nread) < 6 || nread <= 0) { |