From 5fd63c007641ccd49f2729f3ea341467de34b7d2 Mon Sep 17 00:00:00 2001 From: Dongjia Zhang Date: Fri, 24 Jun 2022 00:54:50 +0900 Subject: [PATCH] Fix QAsan (#677) * fix * more --- libafl_qemu/build_linux.rs | 12 ++++++++---- libafl_qemu/libqasan/libqasan.c | 17 ++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/libafl_qemu/build_linux.rs b/libafl_qemu/build_linux.rs index 9f1f40dcb3..407815a121 100644 --- a/libafl_qemu/build_linux.rs +++ b/libafl_qemu/build_linux.rs @@ -254,23 +254,27 @@ pub fn build() { } */ drop( - Command::new("make") + assert!(Command::new("make") .current_dir(&out_dir_path) .env("CC", &cross_cc) .env("OUT_DIR", &target_dir) .arg("-C") .arg(&qasan_dir) .arg("clean") - .status(), + .status() + .expect("make failed") + .success()) ); drop( - Command::new("make") + assert!(Command::new("make") .current_dir(&out_dir_path) .env("CC", &cross_cc) .env("OUT_DIR", &target_dir) .arg("-C") .arg(&qasan_dir) - .status(), + .status() + .expect("make failed") + .success()) ); cc::Build::new() diff --git a/libafl_qemu/libqasan/libqasan.c b/libafl_qemu/libqasan/libqasan.c index 12b07d41b5..2701dad529 100644 --- a/libafl_qemu/libqasan/libqasan.c +++ b/libafl_qemu/libqasan/libqasan.c @@ -43,17 +43,16 @@ void __libqasan_print_maps(void) { int i; char *line = NULL; for (i = 0; i < len; i++) { - if (!line) line = { &buf[i]; + if (!line) line = &buf[i]; + if (buf[i] == '\n') { + buf[i] = 0; + QASAN_LOG("%s\n", line); + line = NULL; + } } - if (buf[i] == '\n') { - buf[i] = 0; - QASAN_LOG("%s\n", line); - line = NULL; - } -} -if (line) { QASAN_LOG("%s\n", line); } -QASAN_LOG("\n"); + if (line) { QASAN_LOG("%s\n", line); } + QASAN_LOG("\n"); } int __libqasan_is_initialized = 0;