From dbe58cdbabb0be1cf5d01ba380832d94f2095c36 Mon Sep 17 00:00:00 2001 From: tatref Date: Wed, 6 Oct 2021 00:43:38 +0200 Subject: [PATCH 1/4] MMapPath::Other for /SYSV --- src/process/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/process/mod.rs b/src/process/mod.rs index 39887b12..963b3e19 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -490,6 +490,7 @@ impl MMapPath { MMapPath::TStack(tid) } x if x.starts_with('[') && x.ends_with(']') => MMapPath::Other(x[1..x.len() - 1].to_string()), + x if x.starts_with("/SYSV") => MMapPath::Other(x[0..x.len()].to_string()), x => MMapPath::Path(PathBuf::from(x)), }) } From a3c0ba1d6161fddc19f9c3941dc70725b8602704 Mon Sep 17 00:00:00 2001 From: tatref Date: Thu, 7 Oct 2021 01:37:10 +0200 Subject: [PATCH 2/4] convert /SYSV key to hex --- src/process/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/process/mod.rs b/src/process/mod.rs index 963b3e19..682e3058 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -466,6 +466,8 @@ pub enum MMapPath { Vsyscall, /// An anonymous mapping as obtained via mmap(2). Anonymous, + /// Shared memory segment + Vsys(u32), /// Some other pseudo-path Other(String), } @@ -490,7 +492,7 @@ impl MMapPath { MMapPath::TStack(tid) } x if x.starts_with('[') && x.ends_with(']') => MMapPath::Other(x[1..x.len() - 1].to_string()), - x if x.starts_with("/SYSV") => MMapPath::Other(x[0..x.len()].to_string()), + x if x.starts_with("/SYSV") => MMapPath::Vsys(u32::from_str_radix(&x[5..13], 16).unwrap()), // 32bits as hex. /SYSVaabbccdd (deleted) x => MMapPath::Path(PathBuf::from(x)), }) } From d1c18bd5741c6919095b51c4027d0b013e3780dd Mon Sep 17 00:00:00 2001 From: tatref Date: Thu, 7 Oct 2021 01:41:28 +0200 Subject: [PATCH 3/4] remove unwrap --- src/process/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/process/mod.rs b/src/process/mod.rs index 682e3058..4650fbc3 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -492,7 +492,7 @@ impl MMapPath { MMapPath::TStack(tid) } x if x.starts_with('[') && x.ends_with(']') => MMapPath::Other(x[1..x.len() - 1].to_string()), - x if x.starts_with("/SYSV") => MMapPath::Vsys(u32::from_str_radix(&x[5..13], 16).unwrap()), // 32bits as hex. /SYSVaabbccdd (deleted) + x if x.starts_with("/SYSV") => MMapPath::Vsys(u32::from_str_radix(&x[5..13], 16)?), // 32bits as hex. /SYSVaabbccdd (deleted) x => MMapPath::Path(PathBuf::from(x)), }) } From b68a967bc3fa7b659b4f68563272bdb79f3e104f Mon Sep 17 00:00:00 2001 From: tatref Date: Thu, 7 Oct 2021 02:08:07 +0200 Subject: [PATCH 4/4] s/u32/i32/ --- src/process/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/process/mod.rs b/src/process/mod.rs index 4650fbc3..bf0e21eb 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -467,7 +467,7 @@ pub enum MMapPath { /// An anonymous mapping as obtained via mmap(2). Anonymous, /// Shared memory segment - Vsys(u32), + Vsys(i32), /// Some other pseudo-path Other(String), } @@ -492,7 +492,7 @@ impl MMapPath { MMapPath::TStack(tid) } x if x.starts_with('[') && x.ends_with(']') => MMapPath::Other(x[1..x.len() - 1].to_string()), - x if x.starts_with("/SYSV") => MMapPath::Vsys(u32::from_str_radix(&x[5..13], 16)?), // 32bits as hex. /SYSVaabbccdd (deleted) + x if x.starts_with("/SYSV") => MMapPath::Vsys(i32::from_str_radix(&x[5..13], 16)?), // 32bits as hex. /SYSVaabbccdd (deleted) x => MMapPath::Path(PathBuf::from(x)), }) }