Fix shadow bit for libafl_frida on Linux (#502)
This commit is contained in:
parent
21668b094b
commit
efb5e25411
@ -107,6 +107,7 @@ impl Allocator {
|
|||||||
// max(userspace address) this is usually 0x8_0000_0000_0000 - 1 on x64 linux.
|
// max(userspace address) this is usually 0x8_0000_0000_0000 - 1 on x64 linux.
|
||||||
let mut userspace_max: usize = 0;
|
let mut userspace_max: usize = 0;
|
||||||
|
|
||||||
|
// Enumerate memory ranges that are already occupied.
|
||||||
for prot in [
|
for prot in [
|
||||||
PageProtection::Read,
|
PageProtection::Read,
|
||||||
PageProtection::Write,
|
PageProtection::Write,
|
||||||
@ -117,9 +118,23 @@ impl Allocator {
|
|||||||
let end = start + details.memory_range().size();
|
let end = start + details.memory_range().size();
|
||||||
occupied_ranges.push((start, end));
|
occupied_ranges.push((start, end));
|
||||||
// println!("{:x} {:x}", start, end);
|
// println!("{:x} {:x}", start, end);
|
||||||
|
let base: usize = 2;
|
||||||
|
// On x64, if end > 2**48, then that's in vsyscall or something.
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
if end <= base.pow(48) {
|
||||||
if end > userspace_max {
|
if end > userspace_max {
|
||||||
userspace_max = end;
|
userspace_max = end;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// On x64, if end > 2**52, then range is not in userspace
|
||||||
|
#[cfg(target_arch = "aarch64")]
|
||||||
|
if end <= base.pow(52) {
|
||||||
|
if end > userspace_max {
|
||||||
|
userspace_max = end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
true
|
true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user