public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: <elfutils-devel@sourceware.org>, <ast@fb.com>
Cc: <yhs@fb.com>
Subject: [PATCH elfutils 1/2] [libdwfl] parse inode in /proc/pid/maps correctly
Date: Fri, 25 Jan 2019 21:20:00 -0000	[thread overview]
Message-ID: <20190125212009.2775258-2-yhs@fb.com> (raw)
In-Reply-To: <20190125212009.2775258-1-yhs@fb.com>

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

  reply	other threads:[~2019-01-25 21:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-25 21:20 [PATCH elfutils 0/2] fix two /proc/pid/maps inode parsing issues Yonghong Song
2019-01-25 21:20 ` Yonghong Song [this message]
2019-01-29 20:10   ` [PATCH elfutils 1/2] [libdwfl] parse inode in /proc/pid/maps correctly Mark Wielaard
2019-01-25 21:20 ` [PATCH elfutils 2/2] [tests] parse inode in /proc/pid/maps correctly in run-backtrace-data.sh Yonghong Song
2019-01-29 20:50   ` Mark Wielaard
2019-01-29 21:23     ` Yonghong Song
2019-01-31 21:14       ` Mark Wielaard
2019-01-31 22:26         ` Mark Wielaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190125212009.2775258-2-yhs@fb.com \
    --to=yhs@fb.com \
    --cc=ast@fb.com \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).