Skip to content

Commit

Permalink
fix gobin lib version cause oom
Browse files Browse the repository at this point in the history
  • Loading branch information
yoloyyh committed Nov 11, 2024
1 parent a554b19 commit 56825e9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion rasp/librasp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ libc = "0.2.80"
nix = "0.24"
anyhow = "1.0.38"
# elf
goblin = "0.8.0"
goblin = "0.3.4"
byteorder = "1.0"
# lru cache
lru_time_cache = "0.11.8"
Expand Down
4 changes: 2 additions & 2 deletions rasp/librasp/src/golang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ pub fn golang_bin_inspect(bin_file: &PathBuf, elf: &Elf) -> Result<u64> {
let shstrtab = &elf.shdr_strtab;
for section in elf.section_headers.iter() {
let offset = section.sh_name;
if let Some(name) = shstrtab.get_at(offset) {
if name == ".gopclntab" {
if let Some(name) = shstrtab.get(offset) {
if name.unwrap_or_default() == ".gopclntab" {
return Ok(size);
}
}
Expand Down
2 changes: 1 addition & 1 deletion rasp/librasp/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ impl RASPManager {
let runtime_info = &process_info.runtime.clone().unwrap();
let root_dir = format!("/proc/{}/root", process_info.pid);
let pid = process_info.pid;
let nspid = process_info.nspid;
// let nspid = process_info.nspid;
// delete config
// self.delete_config_file(pid, nspid)?;
let attach_result = match runtime_info.name {
Expand Down
8 changes: 4 additions & 4 deletions rasp/librasp/src/parse_elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ fn read_data_at_address(mut file: &File, elf: &Elf, address: u64, size: usize) -

fn find_symbol<'a>(elf: &'a Elf<'a>, symbol_name: &str) -> Option<Sym> {
for sym in &elf.syms {
if let Some(name) = elf.strtab.get_at(sym.st_name) {
if name == symbol_name {
if let Some(name) = elf.strtab.get(sym.st_name) {
if name.unwrap_or_default() == symbol_name {
return Some(sym.clone());
}
}
Expand Down Expand Up @@ -148,8 +148,8 @@ pub fn find_by_section(elf: &Elf, file: &File, mmap: &Mmap) -> Result<String> {

// find .go.buildinfo
if let Some(go_buildinfo_section) = elf.section_headers.iter().find(|section| {
if let Some(sect_name) = elf.shdr_strtab.get_at(section.sh_name) {
sect_name == ".go.buildinfo"
if let Some(sect_name) = elf.shdr_strtab.get(section.sh_name) {
sect_name.unwrap_or_default() == ".go.buildinfo"
} else {
false
}
Expand Down

0 comments on commit 56825e9

Please sign in to comment.