diff --git a/rap/rust-toolchain.toml b/rap/rust-toolchain.toml index 896b098..ef309bf 100644 --- a/rap/rust-toolchain.toml +++ b/rap/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] # The default version of the rustc compiler -channel = "nightly-2024-10-12" +channel = "nightly-2024-10-12-x86_64-unknown-linux-gnu" components = ["rustc-dev", "rust-src", "llvm-tools-preview"] diff --git a/rap/rust-toolchain.toml.bak b/rap/rust-toolchain.toml.bak new file mode 100644 index 0000000..ef309bf --- /dev/null +++ b/rap/rust-toolchain.toml.bak @@ -0,0 +1,4 @@ +[toolchain] +# The default version of the rustc compiler +channel = "nightly-2024-10-12-x86_64-unknown-linux-gnu" +components = ["rustc-dev", "rust-src", "llvm-tools-preview"] diff --git a/tests/CI_leak/batch.sh b/tests/CI_leak/batch.sh new file mode 100755 index 0000000..73dee7f --- /dev/null +++ b/tests/CI_leak/batch.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#该脚本在目录下为每个Cargo项目执行相同的命令直到报错 + +if [ $# -eq 0 ]; then + #脚本无参数时执行cargo clean + #Example: batch.sh + cmd="cargo clean" +else + #脚本有参数时按照给定参数执行cargo命令 + #Example: batch.sh -uaf + cmd="cargo rap $@" +fi + +# 查找并编译当前目录下的所有 Rust 项目 +find . -type f -name "Cargo.toml" | while read -r cargo_file; do + # 获取 Cargo.toml 文件所在的目录 + project_dir=$(dirname "$cargo_file") + + echo "Processing project in: $project_dir" + + # 切换到项目目录 + pushd "$project_dir" > /dev/null + + $cmd + if [ $? -ne 0 ]; then + # 如果命令失败,打印错误信息并退出循环 + echo "Error: '$cmd' failed in $project_dir" + popd > /dev/null + exit 1 + fi + + # 返回原始目录 + popd > /dev/null +done + diff --git a/tests/leak_min/Cargo.toml b/tests/CI_leak/leak_min/Cargo.toml similarity index 100% rename from tests/leak_min/Cargo.toml rename to tests/CI_leak/leak_min/Cargo.toml diff --git a/tests/leak_min/src/main.rs b/tests/CI_leak/leak_min/src/main.rs similarity index 100% rename from tests/leak_min/src/main.rs rename to tests/CI_leak/leak_min/src/main.rs diff --git a/tests/leak_proxy/Cargo.toml b/tests/CI_leak/leak_proxy/Cargo.toml similarity index 100% rename from tests/leak_proxy/Cargo.toml rename to tests/CI_leak/leak_proxy/Cargo.toml diff --git a/tests/leak_proxy/src/main.rs b/tests/CI_leak/leak_proxy/src/main.rs similarity index 100% rename from tests/leak_proxy/src/main.rs rename to tests/CI_leak/leak_proxy/src/main.rs diff --git a/tests/CI_uaf/batch.sh b/tests/CI_uaf/batch.sh new file mode 100755 index 0000000..73dee7f --- /dev/null +++ b/tests/CI_uaf/batch.sh @@ -0,0 +1,35 @@ +#!/bin/bash +#该脚本在目录下为每个Cargo项目执行相同的命令直到报错 + +if [ $# -eq 0 ]; then + #脚本无参数时执行cargo clean + #Example: batch.sh + cmd="cargo clean" +else + #脚本有参数时按照给定参数执行cargo命令 + #Example: batch.sh -uaf + cmd="cargo rap $@" +fi + +# 查找并编译当前目录下的所有 Rust 项目 +find . -type f -name "Cargo.toml" | while read -r cargo_file; do + # 获取 Cargo.toml 文件所在的目录 + project_dir=$(dirname "$cargo_file") + + echo "Processing project in: $project_dir" + + # 切换到项目目录 + pushd "$project_dir" > /dev/null + + $cmd + if [ $? -ne 0 ]; then + # 如果命令失败,打印错误信息并退出循环 + echo "Error: '$cmd' failed in $project_dir" + popd > /dev/null + exit 1 + fi + + # 返回原始目录 + popd > /dev/null +done + diff --git a/tests/dangling_min/Cargo.toml b/tests/CI_uaf/dangling_min/Cargo.toml similarity index 100% rename from tests/dangling_min/Cargo.toml rename to tests/CI_uaf/dangling_min/Cargo.toml diff --git a/tests/dangling_min/src/main.rs b/tests/CI_uaf/dangling_min/src/main.rs similarity index 83% rename from tests/dangling_min/src/main.rs rename to tests/CI_uaf/dangling_min/src/main.rs index 9438419..5e56270 100644 --- a/tests/dangling_min/src/main.rs +++ b/tests/CI_uaf/dangling_min/src/main.rs @@ -13,7 +13,7 @@ fn create_vec() -> *mut Vec { fn main() { let p = create_vec(); - let v = unsafe {&mut *p}; - v.push(4); - println!("{:?}", v); + // let v = unsafe {&mut *p}; + // v.push(4); + // println!("{:?}", v); } diff --git a/tests/df_min/Cargo.toml b/tests/CI_uaf/df_min/Cargo.toml similarity index 100% rename from tests/df_min/Cargo.toml rename to tests/CI_uaf/df_min/Cargo.toml diff --git a/tests/df_min/src/main.rs b/tests/CI_uaf/df_min/src/main.rs similarity index 100% rename from tests/df_min/src/main.rs rename to tests/CI_uaf/df_min/src/main.rs diff --git a/tests/uaf_assume_init_drop/Cargo.toml b/tests/CI_uaf/uaf_drop/Cargo.toml similarity index 100% rename from tests/uaf_assume_init_drop/Cargo.toml rename to tests/CI_uaf/uaf_drop/Cargo.toml diff --git a/tests/uaf_drop/src/main.rs b/tests/CI_uaf/uaf_drop/src/main.rs similarity index 100% rename from tests/uaf_drop/src/main.rs rename to tests/CI_uaf/uaf_drop/src/main.rs diff --git a/tests/uaf_drop2/Cargo.toml b/tests/CI_uaf/uaf_drop2/Cargo.toml similarity index 100% rename from tests/uaf_drop2/Cargo.toml rename to tests/CI_uaf/uaf_drop2/Cargo.toml diff --git a/tests/uaf_drop2/src/main.rs b/tests/CI_uaf/uaf_drop2/src/main.rs similarity index 100% rename from tests/uaf_drop2/src/main.rs rename to tests/CI_uaf/uaf_drop2/src/main.rs diff --git a/tests/uaf_drop/Cargo.toml b/tests/CI_uaf/uaf_drop_in_palce/Cargo.toml similarity index 100% rename from tests/uaf_drop/Cargo.toml rename to tests/CI_uaf/uaf_drop_in_palce/Cargo.toml diff --git a/tests/uaf_drop_in_palce/src/main.rs b/tests/CI_uaf/uaf_drop_in_palce/src/main.rs similarity index 100% rename from tests/uaf_drop_in_palce/src/main.rs rename to tests/CI_uaf/uaf_drop_in_palce/src/main.rs diff --git a/tests/uaf_drop_in_palce/Cargo.toml b/tests/CI_uaf/uaf_lifetime/Cargo.toml similarity index 100% rename from tests/uaf_drop_in_palce/Cargo.toml rename to tests/CI_uaf/uaf_lifetime/Cargo.toml diff --git a/tests/uaf_lifetime/src/main.rs b/tests/CI_uaf/uaf_lifetime/src/main.rs similarity index 100% rename from tests/uaf_lifetime/src/main.rs rename to tests/CI_uaf/uaf_lifetime/src/main.rs diff --git a/tests/uaf_small/Cargo.toml b/tests/CI_uaf/uaf_small/Cargo.toml similarity index 100% rename from tests/uaf_small/Cargo.toml rename to tests/CI_uaf/uaf_small/Cargo.toml diff --git a/tests/uaf_small/src/main.rs b/tests/CI_uaf/uaf_small/src/main.rs similarity index 100% rename from tests/uaf_small/src/main.rs rename to tests/CI_uaf/uaf_small/src/main.rs diff --git a/tests/alias_mop/Cargo.toml b/tests/todo/alias_mop/Cargo.toml similarity index 100% rename from tests/alias_mop/Cargo.toml rename to tests/todo/alias_mop/Cargo.toml diff --git a/tests/alias_mop/src/main.rs b/tests/todo/alias_mop/src/main.rs similarity index 100% rename from tests/alias_mop/src/main.rs rename to tests/todo/alias_mop/src/main.rs diff --git a/tests/alias_mop_field/Cargo.toml b/tests/todo/alias_mop_field/Cargo.toml similarity index 100% rename from tests/alias_mop_field/Cargo.toml rename to tests/todo/alias_mop_field/Cargo.toml diff --git a/tests/alias_mop_field/src/main.rs b/tests/todo/alias_mop_field/src/main.rs similarity index 100% rename from tests/alias_mop_field/src/main.rs rename to tests/todo/alias_mop_field/src/main.rs diff --git a/tests/asterinas/read_none/Cargo.toml b/tests/todo/asterinas/read_none/Cargo.toml similarity index 100% rename from tests/asterinas/read_none/Cargo.toml rename to tests/todo/asterinas/read_none/Cargo.toml diff --git a/tests/asterinas/read_none/src/main.rs b/tests/todo/asterinas/read_none/src/main.rs similarity index 100% rename from tests/asterinas/read_none/src/main.rs rename to tests/todo/asterinas/read_none/src/main.rs diff --git a/tests/asterinas/rwlock/Cargo.toml b/tests/todo/asterinas/rwlock/Cargo.toml similarity index 100% rename from tests/asterinas/rwlock/Cargo.toml rename to tests/todo/asterinas/rwlock/Cargo.toml diff --git a/tests/asterinas/rwlock/src/main.rs b/tests/todo/asterinas/rwlock/src/main.rs similarity index 100% rename from tests/asterinas/rwlock/src/main.rs rename to tests/todo/asterinas/rwlock/src/main.rs diff --git a/tests/bounds_len/Cargo.toml b/tests/todo/bounds_len/Cargo.toml similarity index 100% rename from tests/bounds_len/Cargo.toml rename to tests/todo/bounds_len/Cargo.toml diff --git a/tests/bounds_len/src/lib.rs b/tests/todo/bounds_len/src/lib.rs similarity index 100% rename from tests/bounds_len/src/lib.rs rename to tests/todo/bounds_len/src/lib.rs diff --git a/tests/bounds_loop_push/Cargo.toml b/tests/todo/bounds_loop_push/Cargo.toml similarity index 100% rename from tests/bounds_loop_push/Cargo.toml rename to tests/todo/bounds_loop_push/Cargo.toml diff --git a/tests/bounds_loop_push/src/lib.rs b/tests/todo/bounds_loop_push/src/lib.rs similarity index 100% rename from tests/bounds_loop_push/src/lib.rs rename to tests/todo/bounds_loop_push/src/lib.rs diff --git a/tests/deadlock_safedrop/Cargo.toml b/tests/todo/deadlock_safedrop/Cargo.toml similarity index 100% rename from tests/deadlock_safedrop/Cargo.toml rename to tests/todo/deadlock_safedrop/Cargo.toml diff --git a/tests/deadlock_safedrop/src/main.rs b/tests/todo/deadlock_safedrop/src/main.rs similarity index 100% rename from tests/deadlock_safedrop/src/main.rs rename to tests/todo/deadlock_safedrop/src/main.rs diff --git a/tests/hash_key_cloning/Cargo.toml b/tests/todo/hash_key_cloning/Cargo.toml similarity index 100% rename from tests/hash_key_cloning/Cargo.toml rename to tests/todo/hash_key_cloning/Cargo.toml diff --git a/tests/hash_key_cloning/src/lib.rs b/tests/todo/hash_key_cloning/src/lib.rs similarity index 100% rename from tests/hash_key_cloning/src/lib.rs rename to tests/todo/hash_key_cloning/src/lib.rs diff --git a/tests/senryx_tests/slice_from_raw_parts/Cargo.toml b/tests/todo/senryx_tests/slice_from_raw_parts/Cargo.toml similarity index 100% rename from tests/senryx_tests/slice_from_raw_parts/Cargo.toml rename to tests/todo/senryx_tests/slice_from_raw_parts/Cargo.toml diff --git a/tests/senryx_tests/slice_from_raw_parts/src/cfg.png b/tests/todo/senryx_tests/slice_from_raw_parts/src/cfg.png similarity index 100% rename from tests/senryx_tests/slice_from_raw_parts/src/cfg.png rename to tests/todo/senryx_tests/slice_from_raw_parts/src/cfg.png diff --git a/tests/senryx_tests/slice_from_raw_parts/src/main.rs b/tests/todo/senryx_tests/slice_from_raw_parts/src/main.rs similarity index 100% rename from tests/senryx_tests/slice_from_raw_parts/src/main.rs rename to tests/todo/senryx_tests/slice_from_raw_parts/src/main.rs diff --git a/tests/senryx_tests/slice_from_raw_parts/src/output.dot b/tests/todo/senryx_tests/slice_from_raw_parts/src/output.dot similarity index 100% rename from tests/senryx_tests/slice_from_raw_parts/src/output.dot rename to tests/todo/senryx_tests/slice_from_raw_parts/src/output.dot diff --git a/tests/uaf_lifetime/Cargo.toml b/tests/todo/uaf_assume_init_drop/Cargo.toml similarity index 100% rename from tests/uaf_lifetime/Cargo.toml rename to tests/todo/uaf_assume_init_drop/Cargo.toml diff --git a/tests/uaf_assume_init_drop/src/main.rs b/tests/todo/uaf_assume_init_drop/src/main.rs similarity index 100% rename from tests/uaf_assume_init_drop/src/main.rs rename to tests/todo/uaf_assume_init_drop/src/main.rs diff --git a/tests/uaf_module/Cargo.toml b/tests/todo/uaf_module/Cargo.toml similarity index 100% rename from tests/uaf_module/Cargo.toml rename to tests/todo/uaf_module/Cargo.toml diff --git a/tests/uaf_module/src/main.rs b/tests/todo/uaf_module/src/main.rs similarity index 100% rename from tests/uaf_module/src/main.rs rename to tests/todo/uaf_module/src/main.rs diff --git a/tests/uaf_module/src/module_a.rs b/tests/todo/uaf_module/src/module_a.rs similarity index 100% rename from tests/uaf_module/src/module_a.rs rename to tests/todo/uaf_module/src/module_a.rs diff --git a/tests/uaf_queue/Cargo.toml b/tests/todo/uaf_queue/Cargo.toml similarity index 100% rename from tests/uaf_queue/Cargo.toml rename to tests/todo/uaf_queue/Cargo.toml diff --git a/tests/uaf_queue/src/main.rs b/tests/todo/uaf_queue/src/main.rs similarity index 100% rename from tests/uaf_queue/src/main.rs rename to tests/todo/uaf_queue/src/main.rs diff --git a/tests/uaf_realloc/Cargo.toml b/tests/todo/uaf_realloc/Cargo.toml similarity index 100% rename from tests/uaf_realloc/Cargo.toml rename to tests/todo/uaf_realloc/Cargo.toml diff --git a/tests/uaf_realloc/src/main.rs b/tests/todo/uaf_realloc/src/main.rs similarity index 100% rename from tests/uaf_realloc/src/main.rs rename to tests/todo/uaf_realloc/src/main.rs