AFLplusplus / AFLplusplus/LibAFL

elf.entry_point() for no-aslr binary

Đang mở
#3,745 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
2.6k
Fork
481
Merge trung bình
2 ngày 30 phút
Pull request đã merge (30 ngày)
16

Mô tả

## 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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.