From 4d1f812d12aeca522ea8e21ed7a43127c48405fe Mon Sep 17 00:00:00 2001 From: Jon Doron Date: Tue, 5 Jul 2022 09:26:40 +0300 Subject: [PATCH] Process: Correct AUXV to support 64bit Linux Signed-off-by: Jon Doron --- src/process/mod.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/process/mod.rs b/src/process/mod.rs index 47e4bdd9..754507ff 100644 --- a/src/process/mod.rs +++ b/src/process/mod.rs @@ -67,6 +67,7 @@ use std::ffi::OsStr; use std::ffi::OsString; use std::fs::read_link; use std::io::{self, Read}; +use std::mem; use std::os::unix::ffi::OsStringExt; use std::os::unix::fs::MetadataExt; use std::path::PathBuf; @@ -1103,7 +1104,7 @@ impl Process { /// Get the process's auxiliary vector /// /// (since 2.6.0-test7) - pub fn auxv(&self) -> ProcResult> { + pub fn auxv(&self) -> ProcResult> { use byteorder::{NativeEndian, ReadBytesExt}; let mut file = FileWrapper::open_at(&self.root, &self.fd, "auxv")?; @@ -1119,8 +1120,8 @@ impl Process { let mut file = std::io::Cursor::new(buf); loop { - let key = file.read_u32::()?; - let value = file.read_u32::()?; + let key = file.read_uint::(mem::size_of::())? as u64; + let value = file.read_uint::(mem::size_of::())? as u64; if key == 0 && value == 0 { break; }