AFLplusplus / AFLplusplus/LibAFL
elf.entry_point() for no-aslr binary
- 主要语言
- Rust
- 星标
- 2.6k
- 派生
- 481
- 平均合并
- 2 天 30 分钟
- 30 天内合并 PR
- 16
描述
## Problem
I'm new to LibAFL and I'm trying to work on a no-aslr binary, it's elf header type is EXEC, not DYN. And here is part of my code
```rust
fn get_elf_entry_point(qemu: Qemu) -> Result {
let mut elf_buffer = Vec::new();
let elf = EasyElf::from_file(qemu.binary_path(), &mut elf_buffer)?;
let load_addr = qemu.load_addr();
eprintln!("[Harness] ELF Load addr: {load_addr:#x}");
let start_pc = elf
.entry_point(qemu.load_addr())
.expect("Target elf's entry_point should not be None!") as u64;
// 使用 println! 确保能看到输出
eprintln!("[Harness] ELF Entry point calculated: {start_pc:#x}");
Ok(start_pc)
```
The problem is qemu.load_addr() will return 0x400000 and elf.entry_point(qemu.load_addr()) will return 0x802500(expected to be 0x402500).
The definition of elf.entry_point() is
```rust
#[must_use]
pub fn entry_point(&self, load_addr: GuestAddr) -> Option {
if self.elf.entry == 0 {
None
} else {
Some(load_addr + self.elf.entry as GuestAddr)
}
}
```
I wonder if this func need to add `if self.if_pic()` check liker other functions (eg. elf.resolve_symbol, elf.get_section) or just I misuse this function.
贡献指南
评估
这个 Issue 还没有评估数据。