This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
[PATCH elfutils 1/2] [libdwfl] parse inode in /proc/pid/maps correctly
- From: Yonghong Song <yhs at fb dot com>
- To: <elfutils-devel at sourceware dot org>, <ast at fb dot com>
- Cc: <yhs at fb dot com>
- Date: Fri, 25 Jan 2019 13:20:08 -0800
- Subject: [PATCH elfutils 1/2] [libdwfl] parse inode in /proc/pid/maps correctly
- References: <20190125212009.2775258-1-yhs@fb.com>
- Smtp-origin-cluster: ftw2c04
- Smtp-origin-hostname: devbig003.ftw2.facebook.com
- Smtp-origin-hostprefix: devbig
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>
---
libdwfl/linux-proc-maps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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)
{
--
2.17.1