Skip to content

Commit

Permalink
fix(lazy-pages-fuzzer): remove host address check (#4202)
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteNacked authored Aug 28, 2024
1 parent c52c277 commit cdd5b12
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions scripts/check-lazy-pages-fuzzer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ main() {
if echo $OUTPUT | grep -q 'SIG: Unprotect WASM memory at address' && \
! echo $OUTPUT | grep -iq "ERROR"
then
echo -e "\nSuccess"
echo "Success"
exit 0
else
cat $OUTPUT_FILE
echo -e "\nFailure"
echo "Failure"
print_seed
exit 1
fi
}

print_seed() {
echo -e "\n Seed start: \""
echo "Seed start: \""
xxd -p $FUZZER_INPUT_FILE | tr --delete '\n'
echo -e "\n\" seed end."
echo "\" seed end."
}

main
13 changes: 7 additions & 6 deletions utils/lazy-pages-fuzzer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ use wasmi_backend::WasmiRunner;
mod wasmi_backend;

const INITIAL_PAGES: u32 = 10;
const WASM_PAGE_SIZE: usize = 0x10_000;
const PROGRAM_GAS: i64 = 1_000_000;
const OS_PAGE_SIZE: usize = 4096;
const MODULE_ENV: &str = "env";
Expand Down Expand Up @@ -88,13 +87,15 @@ impl RunResult {
.into_iter()
.zip(wasmi_res.pages.into_iter())
{
let lower_bytes_page_mask = ((INITIAL_PAGES as usize) * WASM_PAGE_SIZE) - 1;
assert_eq!(
lower_bytes_page_mask & wasmer_addr,
lower_bytes_page_mask & wasmi_addr
wasmer_page_info, wasmi_page_info,
"wasmer page mem 0x{wasmer_addr:X?} wasmi page mem 0x{wasmi_addr:X?}",
);
assert_eq!(
wasmer_page_mem, wasmi_page_mem,
"wasmer page mem 0x{wasmer_addr:X?} wasmi page mem 0x{wasmi_addr:X?} \
with content: 0x{wasmer_page_mem:X?} 0x{wasmi_page_mem:X?}",
);
assert_eq!(wasmer_page_info, wasmi_page_info);
assert_eq!(wasmer_page_mem, wasmi_page_mem);
}

assert_eq!(wasmer_res.globals, wasmi_res.globals);
Expand Down

0 comments on commit cdd5b12

Please sign in to comment.