diff --git a/README.md b/README.md index 990221d..8830778 100644 --- a/README.md +++ b/README.md @@ -15,11 +15,11 @@ TikNib currently focuses on function-level similarity analysis, which is a fundamental unit of binary analysis. For more details, please check [our -paper](https://0xdkay.me/pub/2020/kim-arxiv2020.pdf). +paper](https://arxiv.org/abs/2011.10749). # Dataset For building the cross-compiling environment and dataset, please check -[here](https://github.com/SoftSec-KAIST/BinKit). +[BinKit](https://github.com/SoftSec-KAIST/BinKit). # Supported features @@ -82,6 +82,34 @@ For building the cross-compiling environment and dataset, please check - data_ret_type # How to use +TikNib has two parts: ground truth building and feature extraction. + +## Scripts Used for Our Evaluation + +To see the scripts used in our evaluation, please check the shell scripts under +[/helper](/helper/). For example, [run_gnu.sh](/helper/run_gnu.sh) builds ground +truth and extracts features for GNU packages. Then, +[run_gnu_roc.sh](/helper/run_gnu_roc.sh) computes the ROC AUC for the results. +You have to run these scripts sequentially as the second one utilizes the cached +results obtained from the first one. +We also added top-k results for the OpenSSL package, which is described in +Sec 5.3 in [our paper](https://arxiv.org/abs/2011.10749). +Please check [run_openssl_roc.sh](/helper/run_openssl_roc.sh) and +[run_openssl_roc_topk.sh](/helper/run_openssl_roc_topk.sh) in the same +directory, of which should also be executed sequentially. + +## Building Ground Truth +TikNib includes scripts for building ground truth for evaluation, as described +in Sec 3.2 in [our paper](https://arxiv.org/abs/2011.10749). After compiling the +datasets using [BinKit](https://github.com/SoftSec-KAIST/BinKit), we build +ground truth as below. + +Given two functions of the same name, we check if they originated from the same +source files and if their line numbers are the same. We also check if both +functions are from the same package and from the binaries of the same name to +confirm their equivalence. Based on these criteria we conducted several steps to +build ground truth and clean the datasets. For more details, please check [our +paper](https://arxiv.org/abs/2011.10749). ### 1. Run IDA Pro to extract preliminary data for each functions. @@ -116,8 +144,48 @@ $ python helper/do_idascript.py \ Additionally, **you can use this script to run any idascript for numerous binaries in parallel.** -### 2. Extract function type information for type features. +### 2. Extract source file names and line numbers to build ground truth. +This extracts source file name and line number by parsing the debugging +information in a given binary. The binary must have been compiled with +the `-g` option. + +```bash +$ python helper/extract_lineno.py \ + --input_list "example/input_list_find.txt" \ + --threshold 1 +``` + +### 3. Filter functions. +This filters functions by checking the source file name and line number. +This removes compiler intrinsic functions and duplicate functions spread +over multiple binaries within the same package. + +```bash +$ python helper/filter_functions.py \ + --input_list "example/input_list_find.txt" \ + --threshold 1 +``` + +### (Optional) 4. Counting the number of functions. +This counts the number of functions and generates a graph of that function +on the same path of `input_list`. This also prints the numbers separated +by `','`. In the below example, a pdf file containing the graph will be +created in `example/input_list_find.pdf` + +```bash +$ python helper/count_functions.py \ + --input_list "example/input_list_find.txt" \ + --threshold 1 +``` + + +## Extracting Features + +### 1. Run IDA Pro to extract preliminary data for each functions. +This is the exact same step as the one described above. + +### 2. Extract function type information for type features. By utilizing `ctags`, this will extract type information. This will add `abstract_args_type` and `abstract_ret_type` into the previously created `.pickle` file. @@ -250,6 +318,7 @@ function in the `find` binary in `findutils`. ```bash $ python helper/test_roc.py \ --input_list "example/input_list_find.txt" \ + --train_funcs_limit 200000 \ --config "config/gnu/config_gnu_normal_all.yml" ``` @@ -293,7 +362,7 @@ We ran all our experiments on a server equipped with four Intel Xeon E7-8867v4 2.40 GHz CPUs (total 144 cores), 896 GB DDR4 RAM, and 4 TB SSD. We setup Ubuntu 16.04 with IDA Pro v6.95 on the server. -Currently, it works on IDA Pro v7.5 and Python 3.8.0 on the system. +Currently, it works on IDA Pro v6.95 and v7.5 with Python 3.8.0 on the system. # Authors This project has been conducted by the below authors at KAIST. diff --git a/config/add_type.sh b/config/add_type_feature.sh similarity index 100% rename from config/add_type.sh rename to config/add_type_feature.sh diff --git a/config/move_type.sh b/config/add_type_suffix.sh similarity index 100% rename from config/move_type.sh rename to config/add_type_suffix.sh diff --git a/config/ase18/config_ase1.yml b/config/ase18/config_ase1.yml new file mode 100644 index 0000000..f9cd38e --- /dev/null +++ b/config/ase18/config_ase1.yml @@ -0,0 +1,107 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - arm_32 + - mips_32 + compiler: + - gcc-5.5.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - arm_32 + - mips_32 + compiler: + - gcc-5.5.0 + others: + - normal diff --git a/config/ase18/config_ase18_3arch_32bit.yml b/config/ase18/config_ase18_3arch_32bit.yml deleted file mode 100644 index 9437592..0000000 --- a/config/ase18/config_ase18_3arch_32bit.yml +++ /dev/null @@ -1,29 +0,0 @@ - arch: - - x86_32 -# - x86_64 - - arm_32 -# - arm_64 - - mips_32 -# - mips_64 -# - mipseb_32 -# - mipseb_64 - compiler: -# - gcc-4.9.4 - - gcc-5.5.0 -# - gcc-6.4.0 -# - gcc-7.3.0 -# - gcc-8.2.0 -# - clang-4.0 -# - clang-5.0 -# - clang-6.0 -# - clang-7.0 -# - clang-obfus-fla -# - clang-obfus-sub -# - clang-obfus-bcf -# - clang-obfus-all - others_list: - - normal -# - noinline -# - pie -# - lto - diff --git a/config/ase18/config_ase18_6arch.yml b/config/ase18/config_ase18_6arch.yml deleted file mode 100644 index 418a395..0000000 --- a/config/ase18/config_ase18_6arch.yml +++ /dev/null @@ -1,29 +0,0 @@ - arch: - - x86_32 - - x86_64 - - arm_32 - - arm_64 - - mips_32 - - mips_64 -# - mipseb_32 -# - mipseb_64 - compiler: - - gcc-4.9.4 - - gcc-5.5.0 -# - gcc-6.4.0 -# - gcc-7.3.0 -# - gcc-8.2.0 -# - clang-4.0 -# - clang-5.0 -# - clang-6.0 -# - clang-7.0 -# - clang-obfus-fla -# - clang-obfus-sub -# - clang-obfus-bcf -# - clang-obfus-all - others_list: - - normal -# - noinline -# - pie -# - lto - diff --git a/config/ase18/config_ase18_all.yml b/config/ase18/config_ase18_all.yml deleted file mode 100644 index 6d21490..0000000 --- a/config/ase18/config_ase18_all.yml +++ /dev/null @@ -1,29 +0,0 @@ - arch: - - x86_32 - - x86_64 - - arm_32 - - arm_64 - - mips_32 - - mips_64 - - mipseb_32 - - mipseb_64 - compiler: - - gcc-4.9.4 - - gcc-5.5.0 - - gcc-6.4.0 - - gcc-7.3.0 - - gcc-8.2.0 - - clang-4.0 - - clang-5.0 - - clang-6.0 - - clang-7.0 -# - clang-obfus-fla -# - clang-obfus-sub -# - clang-obfus-bcf -# - clang-obfus-all - others_list: - - normal -# - noinline -# - pie -# - lto - diff --git a/config/ase18/config_ase18_openssl_32bit.yml b/config/ase18/config_ase18_openssl_32bit.yml deleted file mode 100644 index 8e17b52..0000000 --- a/config/ase18/config_ase18_openssl_32bit.yml +++ /dev/null @@ -1,28 +0,0 @@ - arch: - - x86_32 -# - x86_64 - - arm_32 -# - arm_64 - - mips_32 -# - mips_64 -# - mipseb_32 -# - mipseb_64 - compiler: -# - gcc-4.9.4 - - gcc-5.5.0 -# - gcc-6.4.0 -# - gcc-7.3.0 -# - gcc-8.2.0 -# - clang-4.0 -# - clang-5.0 -# - clang-6.0 -# - clang-7.0 -# - clang-obfus-fla -# - clang-obfus-sub -# - clang-obfus-bcf -# - clang-obfus-all - others_list: - - normal -# - noinline -# - pie -# - lto diff --git a/config/ase18/config_ase2.yml b/config/ase18/config_ase2.yml new file mode 100644 index 0000000..f9cd38e --- /dev/null +++ b/config/ase18/config_ase2.yml @@ -0,0 +1,107 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - arm_32 + - mips_32 + compiler: + - gcc-5.5.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - arm_32 + - mips_32 + compiler: + - gcc-5.5.0 + others: + - normal diff --git a/config/ase18/config_ase3.yml b/config/ase18/config_ase3.yml new file mode 100644 index 0000000..67578f1 --- /dev/null +++ b/config/ase18/config_ase3.yml @@ -0,0 +1,115 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + others: + - normal diff --git a/config/ase18/config_ase4.yml b/config/ase18/config_ase4.yml new file mode 100644 index 0000000..9f5af29 --- /dev/null +++ b/config/ase18/config_ase4.yml @@ -0,0 +1,133 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal diff --git a/config/ase18/config_type_ase1.yml b/config/ase18/config_type_ase1.yml new file mode 100644 index 0000000..ba22972 --- /dev/null +++ b/config/ase18/config_type_ase1.yml @@ -0,0 +1,110 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - arm_32 + - mips_32 + compiler: + - gcc-5.5.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - arm_32 + - mips_32 + compiler: + - gcc-5.5.0 + others: + - normal diff --git a/config/ase18/config_type_ase2.yml b/config/ase18/config_type_ase2.yml new file mode 100644 index 0000000..ba22972 --- /dev/null +++ b/config/ase18/config_type_ase2.yml @@ -0,0 +1,110 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - arm_32 + - mips_32 + compiler: + - gcc-5.5.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - arm_32 + - mips_32 + compiler: + - gcc-5.5.0 + others: + - normal diff --git a/config/ase18/config_type_ase3.yml b/config/ase18/config_type_ase3.yml new file mode 100644 index 0000000..8ce2db0 --- /dev/null +++ b/config/ase18/config_type_ase3.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + others: + - normal diff --git a/config/ase18/config_type_ase4.yml b/config/ase18/config_type_ase4.yml new file mode 100644 index 0000000..fdc5b08 --- /dev/null +++ b/config/ase18/config_type_ase4.yml @@ -0,0 +1,136 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal diff --git a/config/ase18_type/config_ase18_3arch_32bit_type.yml b/config/ase18_type/config_ase18_3arch_32bit_type.yml deleted file mode 100644 index 9437592..0000000 --- a/config/ase18_type/config_ase18_3arch_32bit_type.yml +++ /dev/null @@ -1,29 +0,0 @@ - arch: - - x86_32 -# - x86_64 - - arm_32 -# - arm_64 - - mips_32 -# - mips_64 -# - mipseb_32 -# - mipseb_64 - compiler: -# - gcc-4.9.4 - - gcc-5.5.0 -# - gcc-6.4.0 -# - gcc-7.3.0 -# - gcc-8.2.0 -# - clang-4.0 -# - clang-5.0 -# - clang-6.0 -# - clang-7.0 -# - clang-obfus-fla -# - clang-obfus-sub -# - clang-obfus-bcf -# - clang-obfus-all - others_list: - - normal -# - noinline -# - pie -# - lto - diff --git a/config/ase18_type/config_ase18_6arch_type.yml b/config/ase18_type/config_ase18_6arch_type.yml deleted file mode 100644 index 418a395..0000000 --- a/config/ase18_type/config_ase18_6arch_type.yml +++ /dev/null @@ -1,29 +0,0 @@ - arch: - - x86_32 - - x86_64 - - arm_32 - - arm_64 - - mips_32 - - mips_64 -# - mipseb_32 -# - mipseb_64 - compiler: - - gcc-4.9.4 - - gcc-5.5.0 -# - gcc-6.4.0 -# - gcc-7.3.0 -# - gcc-8.2.0 -# - clang-4.0 -# - clang-5.0 -# - clang-6.0 -# - clang-7.0 -# - clang-obfus-fla -# - clang-obfus-sub -# - clang-obfus-bcf -# - clang-obfus-all - others_list: - - normal -# - noinline -# - pie -# - lto - diff --git a/config/ase18_type/config_ase18_all_type.yml b/config/ase18_type/config_ase18_all_type.yml deleted file mode 100644 index 6d21490..0000000 --- a/config/ase18_type/config_ase18_all_type.yml +++ /dev/null @@ -1,29 +0,0 @@ - arch: - - x86_32 - - x86_64 - - arm_32 - - arm_64 - - mips_32 - - mips_64 - - mipseb_32 - - mipseb_64 - compiler: - - gcc-4.9.4 - - gcc-5.5.0 - - gcc-6.4.0 - - gcc-7.3.0 - - gcc-8.2.0 - - clang-4.0 - - clang-5.0 - - clang-6.0 - - clang-7.0 -# - clang-obfus-fla -# - clang-obfus-sub -# - clang-obfus-bcf -# - clang-obfus-all - others_list: - - normal -# - noinline -# - pie -# - lto - diff --git a/config/ase18_type/config_ase18_openssl_32bit_type.yml b/config/ase18_type/config_ase18_openssl_32bit_type.yml deleted file mode 100644 index 8e17b52..0000000 --- a/config/ase18_type/config_ase18_openssl_32bit_type.yml +++ /dev/null @@ -1,28 +0,0 @@ - arch: - - x86_32 -# - x86_64 - - arm_32 -# - arm_64 - - mips_32 -# - mips_64 -# - mipseb_32 -# - mipseb_64 - compiler: -# - gcc-4.9.4 - - gcc-5.5.0 -# - gcc-6.4.0 -# - gcc-7.3.0 -# - gcc-8.2.0 -# - clang-4.0 -# - clang-5.0 -# - clang-6.0 -# - clang-7.0 -# - clang-obfus-fla -# - clang-obfus-sub -# - clang-obfus-bcf -# - clang-obfus-all - others_list: - - normal -# - noinline -# - pie -# - lto diff --git a/config/config_list_ase18.txt b/config/config_list_ase18.txt new file mode 100644 index 0000000..476cfd0 --- /dev/null +++ b/config/config_list_ase18.txt @@ -0,0 +1,4 @@ +config/ase18/config_ase1.yml +config/ase18/config_ase2.yml +config/ase18/config_ase3.yml +config/ase18/config_ase4.yml diff --git a/config/config_list_ase18_type.txt b/config/config_list_ase18_type.txt new file mode 100644 index 0000000..a1f777b --- /dev/null +++ b/config/config_list_ase18_type.txt @@ -0,0 +1,4 @@ +config/ase18/config_type_ase1.yml +config/ase18/config_type_ase2.yml +config/ase18/config_type_ase3.yml +config/ase18/config_type_ase4.yml diff --git a/config/config_list_gnu.txt b/config/config_list_gnu.txt new file mode 100644 index 0000000..b06fcbe --- /dev/null +++ b/config/config_list_gnu.txt @@ -0,0 +1,32 @@ +config/gnu/config_gnu_normal_all.yml +config/gnu/config_gnu_normal_opti_O0-O3.yml +config/gnu/config_gnu_normal_opti_O2-O3.yml +config/gnu/config_gnu_normal_opti_O0toO3.yml + +config/gnu/config_gnu_normal_comp_gcc.yml +config/gnu/config_gnu_normal_comp_clang.yml +config/gnu/config_gnu_normal_comp_gcc-clang.yml +config/gnu/config_gnu_normal_comp_all.yml + +config/gnu/config_gnu_normal_arch_x86_arm.yml +config/gnu/config_gnu_normal_arch_x86_mips.yml +config/gnu/config_gnu_normal_arch_arm_mips.yml +config/gnu/config_gnu_normal_arch_bits.yml +config/gnu/config_gnu_normal_arch_endian.yml +config/gnu/config_gnu_normal_arch_all.yml + +config/gnu/config_gnu_normal_opti_O0-Os.yml +config/gnu/config_gnu_normal_opti_O1-Os.yml +config/gnu/config_gnu_normal_opti_O3-Os.yml + +config/gnu/config_gnu_normal_others_lto.yml +config/gnu/config_gnu_normal_others_noinline_from_O1.yml +config/gnu/config_gnu_normal_others_pie.yml + +config/gnu/config_gnu_normal_obfus_bcf.yml +config/gnu/config_gnu_normal_obfus_fla.yml +config/gnu/config_gnu_normal_obfus_sub.yml +config/gnu/config_gnu_normal_obfus_all.yml + +config/gnu/config_gnu_normal_hard.yml +config/gnu/config_gnu_normal_obfus_hard.yml diff --git a/config/config_list_gnu_type.txt b/config/config_list_gnu_type.txt new file mode 100644 index 0000000..ea67e36 --- /dev/null +++ b/config/config_list_gnu_type.txt @@ -0,0 +1,32 @@ +config/gnu/config_gnu_normal_all_type.yml +config/gnu/config_gnu_normal_opti_O0-O3_type.yml +config/gnu/config_gnu_normal_opti_O2-O3_type.yml +config/gnu/config_gnu_normal_opti_O0toO3_type.yml + +config/gnu/config_gnu_normal_comp_gcc_type.yml +config/gnu/config_gnu_normal_comp_clang_type.yml +config/gnu/config_gnu_normal_comp_gcc-clang_type.yml +config/gnu/config_gnu_normal_comp_all_type.yml + +config/gnu/config_gnu_normal_arch_x86_arm_type.yml +config/gnu/config_gnu_normal_arch_x86_mips_type.yml +config/gnu/config_gnu_normal_arch_arm_mips_type.yml +config/gnu/config_gnu_normal_arch_bits_type.yml +config/gnu/config_gnu_normal_arch_endian_type.yml +config/gnu/config_gnu_normal_arch_all_type.yml + +config/gnu/config_gnu_normal_opti_O0-Os_type.yml +config/gnu/config_gnu_normal_opti_O1-Os_type.yml +config/gnu/config_gnu_normal_opti_O3-Os_type.yml + +config/gnu/config_gnu_normal_others_lto_type.yml +config/gnu/config_gnu_normal_others_noinline_from_O1_type.yml +config/gnu/config_gnu_normal_others_pie_type.yml + +config/gnu/config_gnu_normal_obfus_bcf_type.yml +config/gnu/config_gnu_normal_obfus_fla_type.yml +config/gnu/config_gnu_normal_obfus_sub_type.yml +config/gnu/config_gnu_normal_obfus_all_type.yml + +config/gnu/config_gnu_normal_hard_type.yml +config/gnu/config_gnu_normal_obfus_hard_type.yml diff --git a/config/config_list_lto.txt b/config/config_list_lto.txt new file mode 100644 index 0000000..e58e368 --- /dev/null +++ b/config/config_list_lto.txt @@ -0,0 +1,12 @@ +config/gnu_lto/config_gnu_normal_others_lto_clang4.yml +config/gnu_lto/config_gnu_normal_others_lto_clang5.yml +config/gnu_lto/config_gnu_normal_others_lto_clang6.yml +config/gnu_lto/config_gnu_normal_others_lto_clang7.yml +config/gnu_lto/config_gnu_normal_others_lto_gcc4.yml +config/gnu_lto/config_gnu_normal_others_lto_gcc5.yml +config/gnu_lto/config_gnu_normal_others_lto_gcc6.yml +config/gnu_lto/config_gnu_normal_others_lto_gcc7.yml +config/gnu_lto/config_gnu_normal_others_lto_gcc8.yml +config/gnu_lto/config_gnu_normal_others_lto_O1.yml +config/gnu_lto/config_gnu_normal_others_lto_O2.yml +config/gnu_lto/config_gnu_normal_others_lto_O3.yml diff --git a/config/config_list_openssl.txt b/config/config_list_openssl.txt new file mode 100644 index 0000000..adf3bb2 --- /dev/null +++ b/config/config_list_openssl.txt @@ -0,0 +1,10 @@ +/home/dongkwan/tiknib/config/openssl/config_openssl_all.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_arm_arm.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_arm_mips.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_arm_x86.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_mips_arm.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_mips_mips.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_mips_x86.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_x86_arm.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_x86_mips.yml +/home/dongkwan/tiknib/config/openssl/config_openssl_x86_x86.yml diff --git a/config/gnu/config_gnu_normal_all.yml b/config/gnu/config_gnu_normal_all.yml index cc99cee..fa87ea4 100644 --- a/config/gnu/config_gnu_normal_all.yml +++ b/config/gnu/config_gnu_normal_all.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_all_type.yml b/config/gnu/config_gnu_normal_all_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_all_type.yml rename to config/gnu/config_gnu_normal_all_type.yml index 544b622..5a776b4 100644 --- a/config/gnu_type/config_gnu_normal_all_type.yml +++ b/config/gnu/config_gnu_normal_all_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_arch_all.yml b/config/gnu/config_gnu_normal_arch_all.yml index a92ee22..195a5dd 100644 --- a/config/gnu/config_gnu_normal_arch_all.yml +++ b/config/gnu/config_gnu_normal_arch_all.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_arch_all_type.yml b/config/gnu/config_gnu_normal_arch_all_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_arch_all_type.yml rename to config/gnu/config_gnu_normal_arch_all_type.yml index 1e618fd..c1bd6de 100644 --- a/config/gnu_type/config_gnu_normal_arch_all_type.yml +++ b/config/gnu/config_gnu_normal_arch_all_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_arch_arm_mips.yml b/config/gnu/config_gnu_normal_arch_arm_mips.yml index 9061656..f3c341e 100644 --- a/config/gnu/config_gnu_normal_arch_arm_mips.yml +++ b/config/gnu/config_gnu_normal_arch_arm_mips.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_arch_arm_mips_type.yml b/config/gnu/config_gnu_normal_arch_arm_mips_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_arch_arm_mips_type.yml rename to config/gnu/config_gnu_normal_arch_arm_mips_type.yml index 6fe3153..5c3a1f1 100644 --- a/config/gnu_type/config_gnu_normal_arch_arm_mips_type.yml +++ b/config/gnu/config_gnu_normal_arch_arm_mips_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_arch_bits.yml b/config/gnu/config_gnu_normal_arch_bits.yml index c55ffb8..d1d9e9f 100644 --- a/config/gnu/config_gnu_normal_arch_bits.yml +++ b/config/gnu/config_gnu_normal_arch_bits.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_arch_bits_type.yml b/config/gnu/config_gnu_normal_arch_bits_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_arch_bits_type.yml rename to config/gnu/config_gnu_normal_arch_bits_type.yml index e9208b4..53819fc 100644 --- a/config/gnu_type/config_gnu_normal_arch_bits_type.yml +++ b/config/gnu/config_gnu_normal_arch_bits_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_arch_endian.yml b/config/gnu/config_gnu_normal_arch_endian.yml index 5993dc8..8efe081 100644 --- a/config/gnu/config_gnu_normal_arch_endian.yml +++ b/config/gnu/config_gnu_normal_arch_endian.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_arch_endian_type.yml b/config/gnu/config_gnu_normal_arch_endian_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_arch_endian_type.yml rename to config/gnu/config_gnu_normal_arch_endian_type.yml index 05b5415..919d106 100644 --- a/config/gnu_type/config_gnu_normal_arch_endian_type.yml +++ b/config/gnu/config_gnu_normal_arch_endian_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_arch_x86_32-mipseb_64.yml b/config/gnu/config_gnu_normal_arch_x86_32-mipseb_64.yml index 499c80c..25e39a9 100644 --- a/config/gnu/config_gnu_normal_arch_x86_32-mipseb_64.yml +++ b/config/gnu/config_gnu_normal_arch_x86_32-mipseb_64.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_arch_x86_32-mipseb_64_type.yml b/config/gnu/config_gnu_normal_arch_x86_32-mipseb_64_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_arch_x86_32-mipseb_64_type.yml rename to config/gnu/config_gnu_normal_arch_x86_32-mipseb_64_type.yml index e4dbf0e..e45c446 100644 --- a/config/gnu_type/config_gnu_normal_arch_x86_32-mipseb_64_type.yml +++ b/config/gnu/config_gnu_normal_arch_x86_32-mipseb_64_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_arch_x86_arm.yml b/config/gnu/config_gnu_normal_arch_x86_arm.yml index 128a855..e6c23d2 100644 --- a/config/gnu/config_gnu_normal_arch_x86_arm.yml +++ b/config/gnu/config_gnu_normal_arch_x86_arm.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_arch_x86_arm_type.yml b/config/gnu/config_gnu_normal_arch_x86_arm_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_arch_x86_arm_type.yml rename to config/gnu/config_gnu_normal_arch_x86_arm_type.yml index cf0dfe9..bfe5ca7 100644 --- a/config/gnu_type/config_gnu_normal_arch_x86_arm_type.yml +++ b/config/gnu/config_gnu_normal_arch_x86_arm_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_arch_x86_mips.yml b/config/gnu/config_gnu_normal_arch_x86_mips.yml index 1f05749..f7875b8 100644 --- a/config/gnu/config_gnu_normal_arch_x86_mips.yml +++ b/config/gnu/config_gnu_normal_arch_x86_mips.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_arch_x86_mips_type.yml b/config/gnu/config_gnu_normal_arch_x86_mips_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_arch_x86_mips_type.yml rename to config/gnu/config_gnu_normal_arch_x86_mips_type.yml index 4591897..50a7875 100644 --- a/config/gnu_type/config_gnu_normal_arch_x86_mips_type.yml +++ b/config/gnu/config_gnu_normal_arch_x86_mips_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_comp_all.yml b/config/gnu/config_gnu_normal_comp_all.yml index 4519e18..cc6afff 100644 --- a/config/gnu/config_gnu_normal_comp_all.yml +++ b/config/gnu/config_gnu_normal_comp_all.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_comp_all_type.yml b/config/gnu/config_gnu_normal_comp_all_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_comp_all_type.yml rename to config/gnu/config_gnu_normal_comp_all_type.yml index 83711dd..19b8e12 100644 --- a/config/gnu_type/config_gnu_normal_comp_all_type.yml +++ b/config/gnu/config_gnu_normal_comp_all_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_comp_clang.yml b/config/gnu/config_gnu_normal_comp_clang.yml index e60bd00..4c79568 100644 --- a/config/gnu/config_gnu_normal_comp_clang.yml +++ b/config/gnu/config_gnu_normal_comp_clang.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_comp_clang4-gcc8.yml b/config/gnu/config_gnu_normal_comp_clang4-gcc8.yml index 0320831..003582d 100644 --- a/config/gnu/config_gnu_normal_comp_clang4-gcc8.yml +++ b/config/gnu/config_gnu_normal_comp_clang4-gcc8.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_comp_clang4-gcc8_type.yml b/config/gnu/config_gnu_normal_comp_clang4-gcc8_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_comp_clang4-gcc8_type.yml rename to config/gnu/config_gnu_normal_comp_clang4-gcc8_type.yml index ef40813..4b1c531 100644 --- a/config/gnu_type/config_gnu_normal_comp_clang4-gcc8_type.yml +++ b/config/gnu/config_gnu_normal_comp_clang4-gcc8_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_comp_clang_type.yml b/config/gnu/config_gnu_normal_comp_clang_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_comp_clang_type.yml rename to config/gnu/config_gnu_normal_comp_clang_type.yml index 33ab33a..8668093 100644 --- a/config/gnu_type/config_gnu_normal_comp_clang_type.yml +++ b/config/gnu/config_gnu_normal_comp_clang_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_comp_gcc-clang.yml b/config/gnu/config_gnu_normal_comp_gcc-clang.yml index 07c1436..6104f07 100644 --- a/config/gnu/config_gnu_normal_comp_gcc-clang.yml +++ b/config/gnu/config_gnu_normal_comp_gcc-clang.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_comp_gcc-clang_type.yml b/config/gnu/config_gnu_normal_comp_gcc-clang_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_comp_gcc-clang_type.yml rename to config/gnu/config_gnu_normal_comp_gcc-clang_type.yml index 453d69a..db64028 100644 --- a/config/gnu_type/config_gnu_normal_comp_gcc-clang_type.yml +++ b/config/gnu/config_gnu_normal_comp_gcc-clang_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_comp_gcc.yml b/config/gnu/config_gnu_normal_comp_gcc.yml index 29be2cb..6162083 100644 --- a/config/gnu/config_gnu_normal_comp_gcc.yml +++ b/config/gnu/config_gnu_normal_comp_gcc.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_comp_gcc4-clang7.yml b/config/gnu/config_gnu_normal_comp_gcc4-clang7.yml index e49c0a4..81cedb3 100644 --- a/config/gnu/config_gnu_normal_comp_gcc4-clang7.yml +++ b/config/gnu/config_gnu_normal_comp_gcc4-clang7.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_comp_gcc4-clang7_type.yml b/config/gnu/config_gnu_normal_comp_gcc4-clang7_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_comp_gcc4-clang7_type.yml rename to config/gnu/config_gnu_normal_comp_gcc4-clang7_type.yml index 8b41f80..149b0eb 100644 --- a/config/gnu_type/config_gnu_normal_comp_gcc4-clang7_type.yml +++ b/config/gnu/config_gnu_normal_comp_gcc4-clang7_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_comp_gcc_type.yml b/config/gnu/config_gnu_normal_comp_gcc_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_comp_gcc_type.yml rename to config/gnu/config_gnu_normal_comp_gcc_type.yml index c8a0bfc..54b5a64 100644 --- a/config/gnu_type/config_gnu_normal_comp_gcc_type.yml +++ b/config/gnu/config_gnu_normal_comp_gcc_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_hard.yml b/config/gnu/config_gnu_normal_hard.yml index bd21461..5b4d3e3 100644 --- a/config/gnu/config_gnu_normal_hard.yml +++ b/config/gnu/config_gnu_normal_hard.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_hard_type.yml b/config/gnu/config_gnu_normal_hard_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_hard_type.yml rename to config/gnu/config_gnu_normal_hard_type.yml index 9acd017..1352ba0 100644 --- a/config/gnu_type/config_gnu_normal_hard_type.yml +++ b/config/gnu/config_gnu_normal_hard_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_obfus_all.yml b/config/gnu/config_gnu_normal_obfus_all.yml index ba5d2ef..605b10a 100644 --- a/config/gnu/config_gnu_normal_obfus_all.yml +++ b/config/gnu/config_gnu_normal_obfus_all.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_obfus_all_type.yml b/config/gnu/config_gnu_normal_obfus_all_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_obfus_all_type.yml rename to config/gnu/config_gnu_normal_obfus_all_type.yml index 845d695..3cbb9fc 100644 --- a/config/gnu_type/config_gnu_normal_obfus_all_type.yml +++ b/config/gnu/config_gnu_normal_obfus_all_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_obfus_bcf.yml b/config/gnu/config_gnu_normal_obfus_bcf.yml index 8291869..cf0479b 100644 --- a/config/gnu/config_gnu_normal_obfus_bcf.yml +++ b/config/gnu/config_gnu_normal_obfus_bcf.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_obfus_bcf_type.yml b/config/gnu/config_gnu_normal_obfus_bcf_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_obfus_bcf_type.yml rename to config/gnu/config_gnu_normal_obfus_bcf_type.yml index 37350b0..af24fd2 100644 --- a/config/gnu_type/config_gnu_normal_obfus_bcf_type.yml +++ b/config/gnu/config_gnu_normal_obfus_bcf_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_obfus_fla.yml b/config/gnu/config_gnu_normal_obfus_fla.yml index 28457fc..71e2209 100644 --- a/config/gnu/config_gnu_normal_obfus_fla.yml +++ b/config/gnu/config_gnu_normal_obfus_fla.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_obfus_fla_type.yml b/config/gnu/config_gnu_normal_obfus_fla_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_obfus_fla_type.yml rename to config/gnu/config_gnu_normal_obfus_fla_type.yml index 93ba477..981f158 100644 --- a/config/gnu_type/config_gnu_normal_obfus_fla_type.yml +++ b/config/gnu/config_gnu_normal_obfus_fla_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_obfus_hard.yml b/config/gnu/config_gnu_normal_obfus_hard.yml index 80d0bbf..2f94572 100644 --- a/config/gnu/config_gnu_normal_obfus_hard.yml +++ b/config/gnu/config_gnu_normal_obfus_hard.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer @@ -95,4 +95,3 @@ dst_options: - clang-obfus-all others: - normal - diff --git a/config/gnu_type/config_gnu_normal_obfus_hard_type.yml b/config/gnu/config_gnu_normal_obfus_hard_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_obfus_hard_type.yml rename to config/gnu/config_gnu_normal_obfus_hard_type.yml index 94b2400..5b4e6f0 100644 --- a/config/gnu_type/config_gnu_normal_obfus_hard_type.yml +++ b/config/gnu/config_gnu_normal_obfus_hard_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_obfus_sub.yml b/config/gnu/config_gnu_normal_obfus_sub.yml index 71275a3..a239943 100644 --- a/config/gnu/config_gnu_normal_obfus_sub.yml +++ b/config/gnu/config_gnu_normal_obfus_sub.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_obfus_sub_type.yml b/config/gnu/config_gnu_normal_obfus_sub_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_obfus_sub_type.yml rename to config/gnu/config_gnu_normal_obfus_sub_type.yml index 5cf8846..38bb12d 100644 --- a/config/gnu_type/config_gnu_normal_obfus_sub_type.yml +++ b/config/gnu/config_gnu_normal_obfus_sub_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_O0-O3.yml b/config/gnu/config_gnu_normal_opti_O0-O3.yml index 0717937..53e78ea 100644 --- a/config/gnu/config_gnu_normal_opti_O0-O3.yml +++ b/config/gnu/config_gnu_normal_opti_O0-O3.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_O0-O3_type.yml b/config/gnu/config_gnu_normal_opti_O0-O3_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_O0-O3_type.yml rename to config/gnu/config_gnu_normal_opti_O0-O3_type.yml index aaf5983..c61098f 100644 --- a/config/gnu_type/config_gnu_normal_opti_O0-O3_type.yml +++ b/config/gnu/config_gnu_normal_opti_O0-O3_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_O0-Os.yml b/config/gnu/config_gnu_normal_opti_O0-Os.yml index ad2d21c..1195a5d 100644 --- a/config/gnu/config_gnu_normal_opti_O0-Os.yml +++ b/config/gnu/config_gnu_normal_opti_O0-Os.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_O0-Os_type.yml b/config/gnu/config_gnu_normal_opti_O0-Os_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_O0-Os_type.yml rename to config/gnu/config_gnu_normal_opti_O0-Os_type.yml index fae7d79..0a272c5 100644 --- a/config/gnu_type/config_gnu_normal_opti_O0-Os_type.yml +++ b/config/gnu/config_gnu_normal_opti_O0-Os_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_O0toO3.yml b/config/gnu/config_gnu_normal_opti_O0toO3.yml index 488c188..9504ac0 100644 --- a/config/gnu/config_gnu_normal_opti_O0toO3.yml +++ b/config/gnu/config_gnu_normal_opti_O0toO3.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_O0toO3_type.yml b/config/gnu/config_gnu_normal_opti_O0toO3_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_O0toO3_type.yml rename to config/gnu/config_gnu_normal_opti_O0toO3_type.yml index 633a816..d1fb655 100644 --- a/config/gnu_type/config_gnu_normal_opti_O0toO3_type.yml +++ b/config/gnu/config_gnu_normal_opti_O0toO3_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_O1-O2.yml b/config/gnu/config_gnu_normal_opti_O1-O2.yml index 08e1d70..dc74eb1 100644 --- a/config/gnu/config_gnu_normal_opti_O1-O2.yml +++ b/config/gnu/config_gnu_normal_opti_O1-O2.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_O1-O2_type.yml b/config/gnu/config_gnu_normal_opti_O1-O2_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_O1-O2_type.yml rename to config/gnu/config_gnu_normal_opti_O1-O2_type.yml index b18850e..b49d0cb 100644 --- a/config/gnu_type/config_gnu_normal_opti_O1-O2_type.yml +++ b/config/gnu/config_gnu_normal_opti_O1-O2_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_O1-Os.yml b/config/gnu/config_gnu_normal_opti_O1-Os.yml index 8c8f57b..9802116 100644 --- a/config/gnu/config_gnu_normal_opti_O1-Os.yml +++ b/config/gnu/config_gnu_normal_opti_O1-Os.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_O1-Os_type.yml b/config/gnu/config_gnu_normal_opti_O1-Os_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_O1-Os_type.yml rename to config/gnu/config_gnu_normal_opti_O1-Os_type.yml index 8bddf6e..c9fc93d 100644 --- a/config/gnu_type/config_gnu_normal_opti_O1-Os_type.yml +++ b/config/gnu/config_gnu_normal_opti_O1-Os_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_O2-O3.yml b/config/gnu/config_gnu_normal_opti_O2-O3.yml index b2f38a5..2414a00 100644 --- a/config/gnu/config_gnu_normal_opti_O2-O3.yml +++ b/config/gnu/config_gnu_normal_opti_O2-O3.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_O2-O3_type.yml b/config/gnu/config_gnu_normal_opti_O2-O3_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_O2-O3_type.yml rename to config/gnu/config_gnu_normal_opti_O2-O3_type.yml index 47d1312..57ae845 100644 --- a/config/gnu_type/config_gnu_normal_opti_O2-O3_type.yml +++ b/config/gnu/config_gnu_normal_opti_O2-O3_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_O2-Os.yml b/config/gnu/config_gnu_normal_opti_O2-Os.yml index 8b04179..33fae93 100644 --- a/config/gnu/config_gnu_normal_opti_O2-Os.yml +++ b/config/gnu/config_gnu_normal_opti_O2-Os.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_O2-Os_type.yml b/config/gnu/config_gnu_normal_opti_O2-Os_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_O2-Os_type.yml rename to config/gnu/config_gnu_normal_opti_O2-Os_type.yml index 02d8a58..455bbdb 100644 --- a/config/gnu_type/config_gnu_normal_opti_O2-Os_type.yml +++ b/config/gnu/config_gnu_normal_opti_O2-Os_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_O3-Os.yml b/config/gnu/config_gnu_normal_opti_O3-Os.yml index f088413..4f6b8cf 100644 --- a/config/gnu/config_gnu_normal_opti_O3-Os.yml +++ b/config/gnu/config_gnu_normal_opti_O3-Os.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_O3-Os_type.yml b/config/gnu/config_gnu_normal_opti_O3-Os_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_O3-Os_type.yml rename to config/gnu/config_gnu_normal_opti_O3-Os_type.yml index 05af23f..507287a 100644 --- a/config/gnu_type/config_gnu_normal_opti_O3-Os_type.yml +++ b/config/gnu/config_gnu_normal_opti_O3-Os_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_opti_all_Os.yml b/config/gnu/config_gnu_normal_opti_all_Os.yml index 898654b..4572c39 100644 --- a/config/gnu/config_gnu_normal_opti_all_Os.yml +++ b/config/gnu/config_gnu_normal_opti_all_Os.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_opti_all_Os_type.yml b/config/gnu/config_gnu_normal_opti_all_Os_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_opti_all_Os_type.yml rename to config/gnu/config_gnu_normal_opti_all_Os_type.yml index 46f57ec..fe102f8 100644 --- a/config/gnu_type/config_gnu_normal_opti_all_Os_type.yml +++ b/config/gnu/config_gnu_normal_opti_all_Os_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_others_lto.yml b/config/gnu/config_gnu_normal_others_lto.yml index 244bdeb..0ae876e 100644 --- a/config/gnu/config_gnu_normal_others_lto.yml +++ b/config/gnu/config_gnu_normal_others_lto.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_others_lto_hard.yml b/config/gnu/config_gnu_normal_others_lto_hard.yml index 524a8f7..8a10953 100644 --- a/config/gnu/config_gnu_normal_others_lto_hard.yml +++ b/config/gnu/config_gnu_normal_others_lto_hard.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_others_lto_hard_type.yml b/config/gnu/config_gnu_normal_others_lto_hard_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_others_lto_hard_type.yml rename to config/gnu/config_gnu_normal_others_lto_hard_type.yml index b290b22..8209037 100644 --- a/config/gnu_type/config_gnu_normal_others_lto_hard_type.yml +++ b/config/gnu/config_gnu_normal_others_lto_hard_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_others_lto_type.yml b/config/gnu/config_gnu_normal_others_lto_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_others_lto_type.yml rename to config/gnu/config_gnu_normal_others_lto_type.yml index 4e050e5..915a302 100644 --- a/config/gnu_type/config_gnu_normal_others_lto_type.yml +++ b/config/gnu/config_gnu_normal_others_lto_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_others_noinline.yml b/config/gnu/config_gnu_normal_others_noinline.yml index f5279fa..fd37f56 100644 --- a/config/gnu/config_gnu_normal_others_noinline.yml +++ b/config/gnu/config_gnu_normal_others_noinline.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_others_noinline_from_O1.yml b/config/gnu/config_gnu_normal_others_noinline_from_O1.yml index 69745b2..ee43bb3 100644 --- a/config/gnu/config_gnu_normal_others_noinline_from_O1.yml +++ b/config/gnu/config_gnu_normal_others_noinline_from_O1.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_others_noinline_from_O1_hard.yml b/config/gnu/config_gnu_normal_others_noinline_from_O1_hard.yml index 6b5f21e..aafb3c3 100644 --- a/config/gnu/config_gnu_normal_others_noinline_from_O1_hard.yml +++ b/config/gnu/config_gnu_normal_others_noinline_from_O1_hard.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_others_noinline_from_O1_hard_type.yml b/config/gnu/config_gnu_normal_others_noinline_from_O1_hard_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_others_noinline_from_O1_hard_type.yml rename to config/gnu/config_gnu_normal_others_noinline_from_O1_hard_type.yml index b9f53d5..8e39184 100644 --- a/config/gnu_type/config_gnu_normal_others_noinline_from_O1_hard_type.yml +++ b/config/gnu/config_gnu_normal_others_noinline_from_O1_hard_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_others_noinline_from_O1_type.yml b/config/gnu/config_gnu_normal_others_noinline_from_O1_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_others_noinline_from_O1_type.yml rename to config/gnu/config_gnu_normal_others_noinline_from_O1_type.yml index 152e7bd..675c046 100644 --- a/config/gnu_type/config_gnu_normal_others_noinline_from_O1_type.yml +++ b/config/gnu/config_gnu_normal_others_noinline_from_O1_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_others_noinline_type.yml b/config/gnu/config_gnu_normal_others_noinline_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_others_noinline_type.yml rename to config/gnu/config_gnu_normal_others_noinline_type.yml index 7027e49..dfb96d6 100644 --- a/config/gnu_type/config_gnu_normal_others_noinline_type.yml +++ b/config/gnu/config_gnu_normal_others_noinline_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_others_pie.yml b/config/gnu/config_gnu_normal_others_pie.yml index d379cbe..730e128 100644 --- a/config/gnu/config_gnu_normal_others_pie.yml +++ b/config/gnu/config_gnu_normal_others_pie.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu/config_gnu_normal_others_pie_hard.yml b/config/gnu/config_gnu_normal_others_pie_hard.yml index 3bd0297..6dd4a04 100644 --- a/config/gnu/config_gnu_normal_others_pie_hard.yml +++ b/config/gnu/config_gnu_normal_others_pie_hard.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_others_pie_hard_type.yml b/config/gnu/config_gnu_normal_others_pie_hard_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_others_pie_hard_type.yml rename to config/gnu/config_gnu_normal_others_pie_hard_type.yml index 9e21552..e6e766f 100644 --- a/config/gnu_type/config_gnu_normal_others_pie_hard_type.yml +++ b/config/gnu/config_gnu_normal_others_pie_hard_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_type/config_gnu_normal_others_pie_type.yml b/config/gnu/config_gnu_normal_others_pie_type.yml similarity index 98% rename from config/gnu_type/config_gnu_normal_others_pie_type.yml rename to config/gnu/config_gnu_normal_others_pie_type.yml index 5f31f7f..f3058d1 100644 --- a/config/gnu_type/config_gnu_normal_others_pie_type.yml +++ b/config/gnu/config_gnu_normal_others_pie_type.yml @@ -53,7 +53,7 @@ features: - inst_num_abs_arith # ctransfer + cond ctransfer - inst_num_abs_ctransfer - - inst_avg_inst + - inst_avg_total - inst_avg_floatinst - inst_avg_logic - inst_avg_dtransfer @@ -64,7 +64,7 @@ features: - inst_avg_cndctransfer - inst_avg_ctransfer - inst_avg_misc - - inst_num_inst + - inst_num_total - inst_num_floatinst - inst_num_logic - inst_num_dtransfer diff --git a/config/gnu_lto/config_gnu_normal_others_lto_clang4.yml b/config/gnu_lto/config_gnu_normal_others_lto_clang4.yml new file mode 100644 index 0000000..4259e7c --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_clang4.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - clang-4.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - clang-4.0 + others: + - lto + diff --git a/config/gnu_lto/config_gnu_normal_others_lto_clang5.yml b/config/gnu_lto/config_gnu_normal_others_lto_clang5.yml new file mode 100644 index 0000000..df8ecaf --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_clang5.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - clang-5.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - clang-5.0 + others: + - lto + diff --git a/config/gnu_lto/config_gnu_normal_others_lto_clang6.yml b/config/gnu_lto/config_gnu_normal_others_lto_clang6.yml new file mode 100644 index 0000000..26303b6 --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_clang6.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - clang-6.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - clang-6.0 + others: + - lto + diff --git a/config/gnu_lto/config_gnu_normal_others_lto_clang7.yml b/config/gnu_lto/config_gnu_normal_others_lto_clang7.yml new file mode 100644 index 0000000..b1df006 --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_clang7.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - clang-7.0 + others: + - lto + diff --git a/config/gnu_lto/config_gnu_normal_others_lto_gcc4.yml b/config/gnu_lto/config_gnu_normal_others_lto_gcc4.yml new file mode 100644 index 0000000..8edd924 --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_gcc4.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + others: + - lto + diff --git a/config/gnu_lto/config_gnu_normal_others_lto_gcc5.yml b/config/gnu_lto/config_gnu_normal_others_lto_gcc5.yml new file mode 100644 index 0000000..4a35e26 --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_gcc5.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-5.5.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-5.5.0 + others: + - lto + diff --git a/config/gnu_lto/config_gnu_normal_others_lto_gcc6.yml b/config/gnu_lto/config_gnu_normal_others_lto_gcc6.yml new file mode 100644 index 0000000..f627557 --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_gcc6.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-6.4.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-6.4.0 + others: + - lto + diff --git a/config/gnu_lto/config_gnu_normal_others_lto_gcc7.yml b/config/gnu_lto/config_gnu_normal_others_lto_gcc7.yml new file mode 100644 index 0000000..d7a539d --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_gcc7.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-7.3.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-7.3.0 + others: + - lto + diff --git a/config/gnu_lto/config_gnu_normal_others_lto_gcc8.yml b/config/gnu_lto/config_gnu_normal_others_lto_gcc8.yml new file mode 100644 index 0000000..4821701 --- /dev/null +++ b/config/gnu_lto/config_gnu_normal_others_lto_gcc8.yml @@ -0,0 +1,118 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-8.2.0 + others: + - normal + +dst_options: + opti: + - O0 + - O1 + - O2 + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-8.2.0 + others: + - lto + diff --git a/config/gnu_noinline/config_gnu_normal_others_noinline_O1.yml b/config/gnu_noinline/config_gnu_normal_others_noinline_O1.yml new file mode 100644 index 0000000..55d14bb --- /dev/null +++ b/config/gnu_noinline/config_gnu_normal_others_noinline_O1.yml @@ -0,0 +1,128 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O1 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O1 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - noinline + diff --git a/config/gnu_noinline/config_gnu_normal_others_noinline_O2.yml b/config/gnu_noinline/config_gnu_normal_others_noinline_O2.yml new file mode 100644 index 0000000..a5f5284 --- /dev/null +++ b/config/gnu_noinline/config_gnu_normal_others_noinline_O2.yml @@ -0,0 +1,128 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - noinline + diff --git a/config/gnu_noinline/config_gnu_normal_others_noinline_O3.yml b/config/gnu_noinline/config_gnu_normal_others_noinline_O3.yml new file mode 100644 index 0000000..ffe9e9b --- /dev/null +++ b/config/gnu_noinline/config_gnu_normal_others_noinline_O3.yml @@ -0,0 +1,128 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: + - arch + - opti + - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O3 + arch: + - x86_32 + - x86_64 + - arm_32 + - arm_64 + - mips_32 + - mips_64 + - mipseb_32 + - mipseb_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - noinline + diff --git a/config/openssl/config_openssl_all.yml b/config/openssl/config_openssl_all.yml new file mode 100644 index 0000000..108ae21 --- /dev/null +++ b/config/openssl/config_openssl_all.yml @@ -0,0 +1,120 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + - arm_64 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + - arm_64 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_all_type.yml b/config/openssl/config_openssl_all_type.yml new file mode 100644 index 0000000..449697c --- /dev/null +++ b/config/openssl/config_openssl_all_type.yml @@ -0,0 +1,123 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + - arm_64 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + - arm_64 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_arm_arm.yml b/config/openssl/config_openssl_arm_arm.yml new file mode 100644 index 0000000..9282fa2 --- /dev/null +++ b/config/openssl/config_openssl_arm_arm.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_arm_arm_type.yml b/config/openssl/config_openssl_arm_arm_type.yml new file mode 100644 index 0000000..62fa6e3 --- /dev/null +++ b/config/openssl/config_openssl_arm_arm_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_arm_mips.yml b/config/openssl/config_openssl_arm_mips.yml new file mode 100644 index 0000000..ea43988 --- /dev/null +++ b/config/openssl/config_openssl_arm_mips.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_arm_mips_type.yml b/config/openssl/config_openssl_arm_mips_type.yml new file mode 100644 index 0000000..286e12c --- /dev/null +++ b/config/openssl/config_openssl_arm_mips_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_arm_x86.yml b/config/openssl/config_openssl_arm_x86.yml new file mode 100644 index 0000000..9248af6 --- /dev/null +++ b/config/openssl/config_openssl_arm_x86.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_arm_x86_type.yml b/config/openssl/config_openssl_arm_x86_type.yml new file mode 100644 index 0000000..e56b4fa --- /dev/null +++ b/config/openssl/config_openssl_arm_x86_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_mips_arm.yml b/config/openssl/config_openssl_mips_arm.yml new file mode 100644 index 0000000..0b30965 --- /dev/null +++ b/config/openssl/config_openssl_mips_arm.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_mips_arm_type.yml b/config/openssl/config_openssl_mips_arm_type.yml new file mode 100644 index 0000000..3da8e80 --- /dev/null +++ b/config/openssl/config_openssl_mips_arm_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_mips_mips.yml b/config/openssl/config_openssl_mips_mips.yml new file mode 100644 index 0000000..db0fd80 --- /dev/null +++ b/config/openssl/config_openssl_mips_mips.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_mips_mips_type.yml b/config/openssl/config_openssl_mips_mips_type.yml new file mode 100644 index 0000000..f894549 --- /dev/null +++ b/config/openssl/config_openssl_mips_mips_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_mips_x86.yml b/config/openssl/config_openssl_mips_x86.yml new file mode 100644 index 0000000..02bca78 --- /dev/null +++ b/config/openssl/config_openssl_mips_x86.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_mips_x86_type.yml b/config/openssl/config_openssl_mips_x86_type.yml new file mode 100644 index 0000000..9083f02 --- /dev/null +++ b/config/openssl/config_openssl_mips_x86_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_x86_arm.yml b/config/openssl/config_openssl_x86_arm.yml new file mode 100644 index 0000000..9a2c69e --- /dev/null +++ b/config/openssl/config_openssl_x86_arm.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_x86_arm_type.yml b/config/openssl/config_openssl_x86_arm_type.yml new file mode 100644 index 0000000..ed7c31a --- /dev/null +++ b/config/openssl/config_openssl_x86_arm_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - arm_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_x86_mips.yml b/config/openssl/config_openssl_x86_mips.yml new file mode 100644 index 0000000..6039e42 --- /dev/null +++ b/config/openssl/config_openssl_x86_mips.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_x86_mips_type.yml b/config/openssl/config_openssl_x86_mips_type.yml new file mode 100644 index 0000000..2d98988 --- /dev/null +++ b/config/openssl/config_openssl_x86_mips_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_x86_x86.yml b/config/openssl/config_openssl_x86_x86.yml new file mode 100644 index 0000000..1d97b64 --- /dev/null +++ b/config/openssl/config_openssl_x86_x86.yml @@ -0,0 +1,116 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl/config_openssl_x86_x86_type.yml b/config/openssl/config_openssl_x86_x86_type.yml new file mode 100644 index 0000000..564c557 --- /dev/null +++ b/config/openssl/config_openssl_x86_x86_type.yml @@ -0,0 +1,119 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: True + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + + +# features +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + compiler: + - gcc-4.9.4 + - gcc-5.5.0 + - gcc-6.4.0 + - gcc-7.3.0 + - gcc-8.2.0 + - clang-4.0 + - clang-5.0 + - clang-6.0 + - clang-7.0 + others: + - normal + diff --git a/config/openssl_topk/config_topk_openssl.yml b/config/openssl_topk/config_topk_openssl.yml new file mode 100644 index 0000000..0f70715 --- /dev/null +++ b/config/openssl_topk/config_topk_openssl.yml @@ -0,0 +1,141 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: False + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + +# Use pre-trained features by gnu dataset +# %s part is architecture pair (e.g., arm_x86, arm_arm) +pre_trained: "/home/dongkwan/tiknib/results/config_openssl_%s/" + +# features +# select from training +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + - arm_64 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-8.2.0 + - clang-4.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + - arm_64 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-8.2.0 + - clang-4.0 + - clang-7.0 + others: + - normal + +target_funcs: + #- tls1_process_heartbeat + - - openssl-OpenSSL_1_0_1f + - libssl.so.elf + - ssl/t1_lib.c + - tls1_process_heartbeat + #- 2555 + #- dtls1_process_heartbeat + - - openssl-OpenSSL_1_0_1f + - libssl.so.elf + - ssl/d1_both.c + - dtls1_process_heartbeat + #- 1456 + +patched_funcs: + #- tls1_process_heartbeat + - - openssl-OpenSSL_1_0_1u + - libssl.so.elf + - ssl/t1_lib.c + - tls1_process_heartbeat + #- 2574 + #- dtls1_process_heartbeat + - - openssl-OpenSSL_1_0_1u + - libssl.so.elf + - ssl/d1_both.c + - dtls1_process_heartbeat + #- 1547 diff --git a/config/openssl_topk/config_topk_openssl_type.yml b/config/openssl_topk/config_topk_openssl_type.yml new file mode 100644 index 0000000..a9bf50e --- /dev/null +++ b/config/openssl_topk/config_topk_openssl_type.yml @@ -0,0 +1,144 @@ +# output directory where the output data will be stored +# if not given, use the config file name as the output directory. +outdir: + +# turn on debug mode or not +debug: False + +# this is a random seed for debugging +seed: "TikNib" + +# if True, perform training to select features, otherwise, just use the given +# features. +do_train: False + +# if you specify options, that option will be fixed when selecting true +# positives and negatives. for example, if you uncomment 'arch', then for a +# source function (arm_32, O1, gcc-4.9.4, normal), the true positive should have +# (arm_32, random opti, random compiler, random others) +fixed_options: +# - arch +# - opti +# - compiler +# - others + +# Use pre-trained features by gnu dataset +# %s part is architecture pair (e.g., arm_x86, arm_arm) +pre_trained: "/home/dongkwan/tiknib/results/config_openssl_%s_type/" + +# features +# select from training +features: + - cfg_size + - cfg_avg_degree + - cfg_num_degree + - cfg_avg_loopintersize + - cfg_avg_loopsize + - cfg_avg_sccsize + - cfg_num_backedges + - cfg_num_loops + - cfg_num_loops_inter + - cfg_num_scc + - cfg_sum_loopintersize + - cfg_sum_loopsize + - cfg_sum_sccsize + - cg_num_callees + - cg_num_callers + - cg_num_imported_callees + - cg_num_incalls + - cg_num_outcalls + - cg_num_imported_calls + - inst_avg_abs_dtransfer + - inst_avg_abs_arith + - inst_avg_abs_ctransfer + # dtransfer + misc + - inst_num_abs_dtransfer + # arith + shift + - inst_num_abs_arith + # ctransfer + cond ctransfer + - inst_num_abs_ctransfer + - inst_avg_total + - inst_avg_floatinst + - inst_avg_logic + - inst_avg_dtransfer + - inst_avg_arith + - inst_avg_cmp + - inst_avg_shift + - inst_avg_bitflag + - inst_avg_cndctransfer + - inst_avg_ctransfer + - inst_avg_misc + - inst_num_total + - inst_num_floatinst + - inst_num_logic + - inst_num_dtransfer + - inst_num_arith + - inst_num_cmp + - inst_num_shift + - inst_num_bitflag + - inst_num_cndctransfer + - inst_num_ctransfer + - inst_num_misc + - data_mul_arg_type + - data_num_args + - data_ret_type + +src_options: + opti: + - O2 + - O3 + arch: + - x86_64 + - arm_64 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-8.2.0 + - clang-4.0 + - clang-7.0 + others: + - normal + +dst_options: + opti: + - O2 + - O3 + arch: + - x86_64 + - arm_64 + - mips_64 + compiler: + - gcc-4.9.4 + - gcc-8.2.0 + - clang-4.0 + - clang-7.0 + others: + - normal + +target_funcs: + #- tls1_process_heartbeat + - - openssl-OpenSSL_1_0_1f + - libssl.so.elf + - ssl/t1_lib.c + - tls1_process_heartbeat + #- 2555 + #- dtls1_process_heartbeat + - - openssl-OpenSSL_1_0_1f + - libssl.so.elf + - ssl/d1_both.c + - dtls1_process_heartbeat + #- 1456 + +patched_funcs: + #- tls1_process_heartbeat + - - openssl-OpenSSL_1_0_1u + - libssl.so.elf + - ssl/t1_lib.c + - tls1_process_heartbeat + #- 2574 + #- dtls1_process_heartbeat + - - openssl-OpenSSL_1_0_1u + - libssl.so.elf + - ssl/d1_both.c + - dtls1_process_heartbeat + #- 1547 diff --git a/example/analyze_roc.py b/example/analyze_roc.py index 44fa314..ad48eb3 100644 --- a/example/analyze_roc.py +++ b/example/analyze_roc.py @@ -90,7 +90,7 @@ continue config_fname = os.path.join("config", "gnu", config_fname + ".yml") with open(config_fname, "r") as f: - config = yaml.load(f) + config = yaml.safe_load(f) config["fname"] = config_fname # setup output directory diff --git a/example/test_all_features.sh b/example/test_all_features.sh index 43abc71..e22e174 100755 --- a/example/test_all_features.sh +++ b/example/test_all_features.sh @@ -36,42 +36,42 @@ declare -a config_list=( "config/gnu/config_gnu_normal_others_noinline.yml" "config/gnu/config_gnu_normal_others_pie_hard.yml" "config/gnu/config_gnu_normal_others_pie.yml" - "config/gnu_type/config_gnu_normal_all_type.yml" - "config/gnu_type/config_gnu_normal_arch_all_type.yml" - "config/gnu_type/config_gnu_normal_arch_arm_mips_type.yml" - "config/gnu_type/config_gnu_normal_arch_bits_type.yml" - "config/gnu_type/config_gnu_normal_arch_endian_type.yml" - "config/gnu_type/config_gnu_normal_arch_x86_32-mipseb_64_type.yml" - "config/gnu_type/config_gnu_normal_arch_x86_arm_type.yml" - "config/gnu_type/config_gnu_normal_arch_x86_mips_type.yml" - "config/gnu_type/config_gnu_normal_comp_all_type.yml" - "config/gnu_type/config_gnu_normal_comp_clang4-gcc8_type.yml" - "config/gnu_type/config_gnu_normal_comp_clang_type.yml" - "config/gnu_type/config_gnu_normal_comp_gcc4-clang7_type.yml" - "config/gnu_type/config_gnu_normal_comp_gcc-clang_type.yml" - "config/gnu_type/config_gnu_normal_comp_gcc_type.yml" - "config/gnu_type/config_gnu_normal_hard_type.yml" - "config/gnu_type/config_gnu_normal_obfus_all_type.yml" - "config/gnu_type/config_gnu_normal_obfus_bcf_type.yml" - "config/gnu_type/config_gnu_normal_obfus_fla_type.yml" - "config/gnu_type/config_gnu_normal_obfus_hard_type.yml" - "config/gnu_type/config_gnu_normal_obfus_sub_type.yml" - "config/gnu_type/config_gnu_normal_opti_all_Os_type.yml" - "config/gnu_type/config_gnu_normal_opti_O0-O3_type.yml" - "config/gnu_type/config_gnu_normal_opti_O0-Os_type.yml" - "config/gnu_type/config_gnu_normal_opti_O0toO3_type.yml" - "config/gnu_type/config_gnu_normal_opti_O1-O2_type.yml" - "config/gnu_type/config_gnu_normal_opti_O1-Os_type.yml" - "config/gnu_type/config_gnu_normal_opti_O2-O3_type.yml" - "config/gnu_type/config_gnu_normal_opti_O2-Os_type.yml" - "config/gnu_type/config_gnu_normal_opti_O3-Os_type.yml" - "config/gnu_type/config_gnu_normal_others_lto_hard_type.yml" - "config/gnu_type/config_gnu_normal_others_lto_type.yml" - "config/gnu_type/config_gnu_normal_others_noinline_from_O1_hard_type.yml" - "config/gnu_type/config_gnu_normal_others_noinline_from_O1_type.yml" - "config/gnu_type/config_gnu_normal_others_noinline_type.yml" - "config/gnu_type/config_gnu_normal_others_pie_hard_type.yml" - "config/gnu_type/config_gnu_normal_others_pie_type.yml" + "config/gnu/config_gnu_normal_all_type.yml" + "config/gnu/config_gnu_normal_arch_all_type.yml" + "config/gnu/config_gnu_normal_arch_arm_mips_type.yml" + "config/gnu/config_gnu_normal_arch_bits_type.yml" + "config/gnu/config_gnu_normal_arch_endian_type.yml" + "config/gnu/config_gnu_normal_arch_x86_32-mipseb_64_type.yml" + "config/gnu/config_gnu_normal_arch_x86_arm_type.yml" + "config/gnu/config_gnu_normal_arch_x86_mips_type.yml" + "config/gnu/config_gnu_normal_comp_all_type.yml" + "config/gnu/config_gnu_normal_comp_clang4-gcc8_type.yml" + "config/gnu/config_gnu_normal_comp_clang_type.yml" + "config/gnu/config_gnu_normal_comp_gcc4-clang7_type.yml" + "config/gnu/config_gnu_normal_comp_gcc-clang_type.yml" + "config/gnu/config_gnu_normal_comp_gcc_type.yml" + "config/gnu/config_gnu_normal_hard_type.yml" + "config/gnu/config_gnu_normal_obfus_all_type.yml" + "config/gnu/config_gnu_normal_obfus_bcf_type.yml" + "config/gnu/config_gnu_normal_obfus_fla_type.yml" + "config/gnu/config_gnu_normal_obfus_hard_type.yml" + "config/gnu/config_gnu_normal_obfus_sub_type.yml" + "config/gnu/config_gnu_normal_opti_all_Os_type.yml" + "config/gnu/config_gnu_normal_opti_O0-O3_type.yml" + "config/gnu/config_gnu_normal_opti_O0-Os_type.yml" + "config/gnu/config_gnu_normal_opti_O0toO3_type.yml" + "config/gnu/config_gnu_normal_opti_O1-O2_type.yml" + "config/gnu/config_gnu_normal_opti_O1-Os_type.yml" + "config/gnu/config_gnu_normal_opti_O2-O3_type.yml" + "config/gnu/config_gnu_normal_opti_O2-Os_type.yml" + "config/gnu/config_gnu_normal_opti_O3-Os_type.yml" + "config/gnu/config_gnu_normal_others_lto_hard_type.yml" + "config/gnu/config_gnu_normal_others_lto_type.yml" + "config/gnu/config_gnu_normal_others_noinline_from_O1_hard_type.yml" + "config/gnu/config_gnu_normal_others_noinline_from_O1_type.yml" + "config/gnu/config_gnu_normal_others_noinline_type.yml" + "config/gnu/config_gnu_normal_others_pie_hard_type.yml" + "config/gnu/config_gnu_normal_others_pie_type.yml" ) for conf in "${config_list[@]}" diff --git a/helper/count_functions.py b/helper/count_functions.py new file mode 100644 index 0000000..43cca04 --- /dev/null +++ b/helper/count_functions.py @@ -0,0 +1,248 @@ +import os +import sys +import time +from optparse import OptionParser + +sys.path.insert(0, os.path.join(sys.path[0], "..")) +from tiknib.utils import do_multiprocess +from tiknib.utils import load_func_data +from tiknib.utils import parse_fname +from tiknib.utils import system + +import logging +import coloredlogs + +logger = logging.getLogger(__name__) +coloredlogs.install(level=logging.INFO) + + +def plot_data(o_fname, num_funcs, num_bbs): + import matplotlib + matplotlib.use('Agg') + import matplotlib.pyplot as plt + import numpy as np + + plt.style.use('seaborn-white') + plt.rcParams['font.size'] = 30 + plt.rcParams['axes.labelsize'] = 30 + plt.rcParams['axes.titlesize'] = 30 + plt.rcParams['xtick.labelsize'] = 20 + plt.rcParams['ytick.labelsize'] = 20 + plt.rcParams['legend.fontsize'] = 20 + plt.rcParams['figure.titlesize'] = 20 + plt.rcParams['errorbar.capsize'] = 5 + + opti_list = sorted(set(map(lambda x: x[0], num_funcs.keys()))) + options = sorted(set(map(lambda x: (x[1], x[2]), num_funcs.keys()))) + pos = np.arange(len(options)) + colors = ['orangered', 'peru', 'yellowgreen', 'c', 'mediumorchid'] + colors = ['#e6b8af', '#fce5cd', '#d9ead3', '#c9daf8', '#d9d2e9'] + colors = ['red', 'g', 'b', 'c', 'k'] + bars = [] + width = 0.15 + alpha = 0.5 + + # Plotting the bars + fig, ax = plt.subplots(figsize=(14,10)) + + for opti_idx, opti in enumerate(opti_list): + bar_data = [] + for option in options: + arch, compiler = option + bar_data.append(num_funcs[(opti, arch, compiler)]) + + bars.append(ax.bar(pos + opti_idx * width, + bar_data, + width, + alpha=alpha, + color=colors[opti_idx], + label=opti)) + + + ax.set_ylabel('Number of Functions') + ax.set_ylim([5 * pow(10, 3), 5 * pow(10, 4)]) + + + ax2 = ax.twinx() + for option_idx, option in enumerate(options): + arch, compiler = option + line_data = [] + for opti_idx, opti in enumerate(opti_list): + rec = bars[opti_idx][option_idx] + h = rec.get_height() + x = rec.get_x() + rec.get_width()/2.0 + line_data.append(num_bbs[(opti, arch, compiler)]) + le = ax2.plot([pos[option_idx] + opti_idx * width \ + for opti_idx in range(len(opti_list))], + line_data, + marker='o', + linestyle='-', + alpha=alpha, + color='black', + label='# of bb') + + ax2.set_ylabel('Number of Basic Blocks') + #ax2.set_ylim([4 * pow(10, 5), 10 * pow(10, 5)]) + #ax2.tick_params('y', colors='r') + + + lines, labels = ax.get_legend_handles_labels() + lines2, labels2 = ax2.get_legend_handles_labels() + + plt.legend(lines + [lines2[0]], labels + [labels2[0]], + frameon=True, + loc="upper right", + fancybox=True, + framealpha=alpha, + borderpad=1, + fontsize=18) + + #plt.xticks(pos + 2.0*width, + plt.xticks(pos + 1.5*width, + list(map(lambda x: + '\n'.join([x[1], + x[0]]), + options))) + + plt.setp(ax.xaxis.get_majorticklabels(), fontsize=20, rotation=0, + horizontalalignment='center') + plt.setp(ax.yaxis.get_majorticklabels(), fontsize=20) + plt.setp(ax2.yaxis.get_majorticklabels(), fontsize=20) + + + + #fig.autofmt_xdate(rotation=30, ha='right') + fig.tight_layout() + + plt.savefig(o_fname + '.pdf', format='pdf') + logging.info("output graph at: %s", o_fname + '.pdf') + + +def count_funcs(bin_path): + # TODO: handle suffix correctly. + #bin_path, func_data_list = load_func_data(bin_path) + bin_path, func_data_list = load_func_data(bin_path, suffix="filtered") + + func_data_list = sorted(func_data_list, key=lambda x: x['name']) + num_funcs = len(func_data_list) + num_bbs = sum(map(lambda x: x['cfg_size'], func_data_list)) + + return bin_path, num_funcs, num_bbs + + +# inevitably use globals since it is fast. +def _init_oracle(oracle): + global g_oracle + g_oracle = oracle + + +if __name__ == "__main__": + op = OptionParser() + op.add_option( + "--input_list", + type="str", + action="store", + dest="input_list", + help="a file containing a list of input binaries", + ) + op.add_option( + "--threshold", + type="int", + action="store", + dest="threshold", + default=1, + help="number of binaries to process in parallel", + ) + op.add_option( + "--chunk_size", + type="int", + action="store", + dest="chunk_size", + default=1, + help="number of binaries to process in each process", + ) + (opts, args) = op.parse_args() + + assert opts.input_list + + with open(opts.input_list, "r") as f: + bins = f.read().splitlines() + + # For debugging + #bins = list(filter(lambda x: "_find" in x, bins)) + + # Fix this function to filter out specific options. + def filter_bins(bin_path): + package, compiler, arch, opti, bin_name = parse_fname(bin_path) + if compiler not in ["clang-7.0", "gcc-8.2.0"]: + return False + return True + bins = list(filter(filter_bins, bins)) + + result = {} + logger.info("Processing %d binaries ...", len(bins)) + t0 = time.time() + numbers = do_multiprocess( + count_funcs, bins, chunk_size=opts.chunk_size, + threshold=opts.threshold + ) + logger.info("done. (%0.3fs)", (time.time() - t0)) + + filtered_num_funcs = {} + filtered_num_bbs = {} + for data in numbers: + bin_path, num_funcs, num_bbs = data + package, compiler, arch, opti, bin_name = parse_fname(bin_path) + if arch.endswith("_64"): + continue + if "eb" in arch: + continue + #compiler = compiler.split("-")[0] + key = (opti, arch, compiler) + if key not in filtered_num_funcs: + filtered_num_funcs[key] = 0 + filtered_num_bbs[key] = 0 + filtered_num_funcs[key] += num_funcs + filtered_num_bbs[key] += num_bbs + + plot_data(opts.input_list, filtered_num_funcs, filtered_num_bbs) + + + # Do not filter to obtain all data + total_num_funcs = {} + total_num_bbs = {} + for data in numbers: + bin_path, num_funcs, num_bbs = data + package, compiler, arch, opti, bin_name = parse_fname(bin_path) + compiler = compiler.split("-")[0] + key = (opti, arch, compiler) + if key not in total_num_funcs: + total_num_funcs[key] = 0 + total_num_bbs[key] = 0 + total_num_funcs[key] += num_funcs + total_num_bbs[key] += num_bbs + keys = set(map(lambda x: (x[1], x[2]), total_num_funcs.keys())) + optis = sorted(set(map(lambda x: x[0], total_num_funcs.keys()))) + keys = sorted(keys, key=lambda x: (x[0], x[1])) + + s = "Options,,,,# of Functions,,,,,# of Basic Blocks,,,\n" + tmp = ["Compiler", "Arch", "Bits"] + tmp.append("") + tmp.extend(optis) # for functions + tmp.append("") + tmp.extend(optis) # for bbs + s += ",".join(tmp) + s += "\n" + for key in keys: + arch, compiler = key + tmp = [compiler.split("-")[0]] + tmp.extend(arch.split("_")) + tmp.append("") + for opti in optis: + tmp.append(f"\"{total_num_funcs[(opti, arch, compiler)]:,}\"") + tmp.append("") + for opti in optis: + tmp.append(f"\"{total_num_bbs[(opti, arch, compiler)]:,}\"") + s += ",".join(tmp) + s += "\n" + print(s) diff --git a/helper/extract_features.py b/helper/extract_features.py index 7d2a734..ab8dbae 100644 --- a/helper/extract_features.py +++ b/helper/extract_features.py @@ -20,15 +20,23 @@ # TODO: add caching information to skip redundant processing. def extract_features(bin_name): global feature_funcs - bin_name, func_data_list = load_func_data(bin_name) + # TODO: handle suffix correctly. + bin_name, func_data_list = load_func_data(bin_name, suffix="filtered") fm = FeatureManager() for func_data in func_data_list: - features = fm.get_all(func_data) + try: + features = fm.get_all(func_data) + except: + import traceback + traceback.print_exc() + print("Error: ", bin_name) + return func_data["feature"] = features - store_func_data(bin_name, func_data_list) + store_func_data(bin_name, func_data_list, suffix="filtered2") if __name__ == "__main__": + import multiprocessing op = OptionParser() op.add_option( "--input_list", @@ -51,7 +59,15 @@ def extract_features(bin_name): action="store", dest="chunk_size", default=1, - help="number of binaries to process in each process", + help="number of binaries to handle in each process", + ) + op.add_option( + "--pool_size", + type="int", + action="store", + dest="pool_size", + default=multiprocessing.cpu_count(), + help="number of processes", ) op.add_option("--debug", action="store_true", dest="debug") (opts, args) = op.parse_args() @@ -65,6 +81,10 @@ def extract_features(bin_name): t0 = time.time() logger.info("Processing %d binaries ...", len(bins)) do_multiprocess( - extract_features, bins, chunk_size=opts.chunk_size, threshold=opts.threshold + extract_features, + bins, + chunk_size=opts.chunk_size, + pool_size=opts.pool_size, + threshold=opts.threshold, ) logger.info("done. (%0.3fs)", (time.time() - t0)) diff --git a/helper/extract_functype.py b/helper/extract_functype.py index cdded86..63966ad 100644 --- a/helper/extract_functype.py +++ b/helper/extract_functype.py @@ -20,8 +20,9 @@ def extract_func_types(args): + # TODO: handle suffix correctly. type_map, bin_name = args - bin_name, func_data_list = load_func_data(bin_name) + bin_name, func_data_list = load_func_data(bin_name, suffix="filtered") for func in func_data_list: ret_type = fetch_type(type_map, func["ret_type"]) arg_types = [] @@ -29,7 +30,7 @@ def extract_func_types(args): arg_types.append(fetch_type(type_map, t)) func["abstract_args_type"] = arg_types func["abstract_ret_type"] = ret_type - store_func_data(bin_name, func_data_list) + store_func_data(bin_name, func_data_list, suffix="filtered") if __name__ == "__main__": diff --git a/helper/extract_lineno.py b/helper/extract_lineno.py new file mode 100644 index 0000000..134a0fb --- /dev/null +++ b/helper/extract_lineno.py @@ -0,0 +1,98 @@ +import os +import sys +import time +from optparse import OptionParser + +sys.path.insert(0, os.path.join(sys.path[0], "..")) +from tiknib.debug.lineno import fetch_lineno +from tiknib.utils import do_multiprocess +from tiknib.utils import load_func_data, store_func_data +from tiknib.utils import parse_source_path + +import logging +import coloredlogs + +logger = logging.getLogger(__name__) +coloredlogs.install(level=logging.INFO) + +def extract_func_lineno(bin_name): + try: + bin_name, func_data_list = load_func_data(bin_name) + except: + print(bin_name) + return bin_name + + func_addrs = dict(map(lambda x: (x["startEA"], x["name"]), func_data_list)) + line_map = fetch_lineno(bin_name, func_addrs) + for func in func_data_list: + func_addr = func["startEA"] + if func_addr not in line_map or not line_map[func_addr][0]: + continue + func["src_path"] = line_map[func_addr][0] + func["src_file"] = parse_source_path(func["src_path"]) + func["src_line"] = line_map[func_addr][1] + store_func_data(bin_name, func_data_list) + return + +if __name__ == "__main__": + op = OptionParser() + op.add_option( + "--input_list", + type="str", + action="store", + dest="input_list", + help="a file containing a list of input binaries", + ) + op.add_option( + "--threshold", + type="int", + action="store", + dest="threshold", + default=1, + help="number of binaries to process in parallel", + ) + op.add_option( + "--chunk_size", + type="int", + action="store", + dest="chunk_size", + default=1, + help="number of binaries to process in each process", + ) + op.add_option("--force", action="store_true", dest="force") + (opts, args) = op.parse_args() + + assert opts.input_list + + with open(opts.input_list, "r") as f: + bins = f.read().splitlines() + + t0 = time.time() + logger.info("Processing %d binaries ...", len(bins)) + failed_bins = do_multiprocess( + extract_func_lineno, bins, chunk_size=opts.chunk_size, threshold=opts.threshold + ) + logger.info("done. (%0.3fs)", (time.time() - t0)) + + failed_bins = list(filter(lambda x: x is not None, failed_bins)) + if failed_bins: + print("{} bins failed.".format(len(failed_bins))) + + with open("failed_bins.txt", "w") as f: + for b in failed_bins: + f.write(b + "\n") + + from tiknib.idascript import IDAScript + idascript = IDAScript( + idapath="/home/dongkwan/.tools/ida-6.95", + idc="tiknib/ida/fetch_funcdata.py", + force=True, + log=True, + ) + idascript.run("failed_bins.txt") + + logger.info("Re-Processing %d binaries ...", len(failed_bins)) + do_multiprocess( + extract_func_lineno, failed_bins, chunk_size=opts.chunk_size, threshold=opts.threshold + ) + logger.info("done. (%0.3fs)", (time.time() - t0)) diff --git a/helper/filter_functions.py b/helper/filter_functions.py new file mode 100644 index 0000000..9dad62a --- /dev/null +++ b/helper/filter_functions.py @@ -0,0 +1,175 @@ +import os +import sys +import time +from optparse import OptionParser + +sys.path.insert(0, os.path.join(sys.path[0], "..")) +from tiknib.utils import do_multiprocess +from tiknib.utils import load_func_data, store_func_data +from tiknib.utils import parse_fname +from tiknib.utils import parse_source_path +from tiknib.utils import system + +import logging +import coloredlogs + +logger = logging.getLogger(__name__) +coloredlogs.install(level=logging.INFO) + + + +g_oracle = None +def filter_funcs(bin_path): + global g_oracle + bin_path, func_data_list = load_func_data(bin_path) + func_data_list = sorted(func_data_list, key=lambda x: x['name']) + num_orig_funcs = len(func_data_list) + pack_name = func_data_list[0]['package'] + + # filter functions by segment name (consider functions in code segment) + funcs = list(filter(lambda x: x['seg_name'] == '.text', func_data_list)) + num_code_funcs = len(funcs) + + funcs = list(filter(lambda x: 'src_path' in x and x['src_path'], funcs)) + num_src_funcs = len(funcs) + + # To identify functions inserted by compilers + #for func in funcs: + # if func['package'] not in func['src_file']: + # print(func['name'], func['src_file'], func['src_line']) + + # filter functions by package name (remove functions inserted by compilers) + funcs = list(filter(lambda x: x['package'] in x['src_path'], funcs)) + num_pack_funcs = len(funcs) + + if num_pack_funcs == 0: + print("No functions: ", pack_name, bin_path, num_orig_funcs) + + funcs = list(filter(lambda x: not x['name'].startswith('sub_'), funcs)) + num_sub_funcs = len(funcs) + + names = set(map(lambda x: x['name'], funcs)) + sources = set(map(lambda x: (x['src_file'], x['src_line']), funcs)) + + if g_oracle: + package, compiler, arch, opti, bin_name = parse_fname(bin_path) + funcs = list(filter( + lambda x: + x['src_file'] in g_oracle[pack_name][bin_name] + and x['src_line'] in g_oracle[pack_name][bin_name][x['src_file']], + funcs)) + # TODO: handle suffix correctly. + store_func_data(bin_path, funcs, suffix="filtered") + num_oracle_funcs = len(funcs) + num_readelf_funcs = 0 +# if g_oracle: +# cmd = "readelf -s {} | grep FUNC | grep -v UND | wc -l".format(bin_path) +# cmd = " objdump --syms -j .text {} | grep \"F .text\" | ".format(bin_path) +# cmd += " cut -d \" \" -f 1 | sort | uniq | wc -l" +# num_readelf_funcs = int(system(cmd)) + num_funcs = (num_orig_funcs, num_code_funcs, num_src_funcs, num_pack_funcs, + num_sub_funcs, num_oracle_funcs, num_readelf_funcs) + return pack_name, bin_path, num_funcs, names, sources + + +# inevitably use globals since it is fast. +def _init_oracle(oracle): + global g_oracle + g_oracle = oracle + + +if __name__ == "__main__": + op = OptionParser() + op.add_option( + "--input_list", + type="str", + action="store", + dest="input_list", + help="a file containing a list of input binaries", + ) + op.add_option( + "--threshold", + type="int", + action="store", + dest="threshold", + default=1, + help="number of binaries to process in parallel", + ) + op.add_option( + "--chunk_size", + type="int", + action="store", + dest="chunk_size", + default=1, + help="number of binaries to process in each process", + ) + op.add_option("--force", action="store_true", dest="force") + (opts, args) = op.parse_args() + + assert opts.input_list + + with open(opts.input_list, "r") as f: + bins = f.read().splitlines() + + pack_bins = {} + for bin_path in bins: + package, compiler, arch, opti, bin_name = parse_fname(bin_path) + if package not in pack_bins: + pack_bins[package] = [] + pack_bins[package].append(bin_path) + + result = {} + logger.info("Processing %d binaries ...", len(bins)) + t0 = time.time() + for package, bin_list in pack_bins.items(): + logger.info("Processing %d binaries in %s ...", len(bin_list), package) + numbers = do_multiprocess( + filter_funcs, bin_list, chunk_size=opts.chunk_size, + threshold=opts.threshold + ) + numbers.sort() + + # build oracle to pick functions uniquely. + oracle = {} + done = {} + for data in numbers: + pack_name, bin_path, num_funcs, names, sources = data + package, compiler, arch, opti, bin_name = parse_fname(bin_path) + if pack_name not in oracle: + oracle[pack_name] = {} + done[pack_name] = set() + if bin_name not in oracle[pack_name]: + oracle[pack_name][bin_name] = {} + # sources = (source file, source line) + new_sources = sources - done[pack_name] + for src_file, src_line in new_sources: + if src_file not in oracle[pack_name][bin_name]: + oracle[pack_name][bin_name][src_file] = set() + oracle[pack_name][bin_name][src_file].add(src_line) + done[pack_name].update(new_sources) + + numbers = do_multiprocess( + filter_funcs, bin_list, chunk_size=opts.chunk_size, + threshold=opts.threshold, initializer=_init_oracle, + initargs=(oracle,), + ) + numbers.sort() + + for data in numbers: + pack_name, bin_path, num_funcs, names, sources = data + #num_orig_funcs, num_code_funcs, num_src_funcs, num_pack_funcs, num_sub_funcs, num_oracle_funcs = num_funcs + if pack_name not in result: + result[pack_name] = [0 for _ in num_funcs] + for idx, n in enumerate(num_funcs): + result[pack_name][idx] += n + logger.info("done. (%0.3fs)", (time.time() - t0)) + + for pack_name, num_funcs in sorted(result.items()): + s = '{}'.format(pack_name) + for num in num_funcs: + s += ',{}'.format(num) + print(s) + s = 'Total' + for num in map(sum, zip(*result.values())): + s += ',{}'.format(num) + print(s) diff --git a/helper/get_roc_graph.py b/helper/get_roc_graph.py new file mode 100644 index 0000000..9532b5f --- /dev/null +++ b/helper/get_roc_graph.py @@ -0,0 +1,214 @@ +import itertools +import os +import glob +import sys +import time +import numpy as np +import yaml +import re + +from optparse import OptionParser +from sklearn.metrics import roc_curve, auc +from collections import defaultdict + +import matplotlib +matplotlib.use('Agg') +import matplotlib.pyplot as plt + +sys.path.insert(0, os.path.join(sys.path[0], "..")) +from tiknib.utils import load_cache + +import pprint as pp +import logging, coloredlogs +rootLogger = logging.getLogger() +rootLogger.setLevel(logging.INFO) + + +def plot_roc_all(outdir, fprs, tprs): + # plot all data by key_name + new_tpr = defaultdict(dict) + new_fpr = defaultdict(dict) + new_std = defaultdict(dict) + new_packages = set() + for key_name in sorted(tprs.keys()): + for package in sorted(tprs[key_name].keys()): + tpr = tprs[key_name][package] + fpr = fprs[key_name][package] + trials = sorted(tpr.keys()) + plot_roc(outdir, '%s_%s_10fold' % (key_name.replace('/','.'), + package), + tpr, fpr, macro=True) + + if not fpr: + continue + + new_packages.add(package) + + # this is for std calculation + all_auc = [] + + # First aggregate all false positive rates + all_fpr = np.unique(np.concatenate([fpr[c] for c in trials])) + + # Then interpolate all ROC curves at this points + mean_tpr = np.zeros_like(all_fpr) + all_auc = [] + for c in trials: + mean_tpr += np.interp(all_fpr, fpr[c], tpr[c]) + all_auc.append(auc(fpr[c], tpr[c])) + + std_auc = np.std(all_auc) + + # Finally average it and compute AUC + mean_tpr /= len(trials) + + new_tpr[key_name][package] = mean_tpr + new_fpr[key_name][package] = all_fpr + new_std[key_name][package] = std_auc + + + for package in new_packages: + tmp_tpr = {} + tmp_fpr = {} + tmp_std = {} + for key_name in new_tpr.keys(): + if package not in new_tpr[key_name]: + continue + + tmp_tpr[key_name] = new_tpr[key_name][package] + tmp_fpr[key_name] = new_fpr[key_name][package] + tmp_std[key_name] = new_std[key_name][package] + + plot_roc(outdir, 'roc_%s' % (package), + tmp_tpr, tmp_fpr, + std=tmp_std, + macro=False) + + +def plot_roc(outdir, out_fname, tpr, fpr, std=None, macro=True): + classes = sorted(tpr.keys()) + if isinstance(classes[0], str): + classes = sorted(classes, key=lambda x: 'type' in x) + roc_auc = {} + + #for style + plt.style.use('seaborn-white') + plt.rcParams['font.size'] = 40 + plt.rcParams['axes.labelsize'] = 40 + plt.rcParams['axes.titlesize'] = 40 + plt.rcParams['xtick.labelsize'] = 40 + plt.rcParams['ytick.labelsize'] = 40 + plt.rcParams['legend.fontsize'] = 30 + plt.rcParams['figure.titlesize'] = 40 + plt.rcParams['errorbar.capsize'] = 5 + #end style + + # Plot all ROC curves + fig = plt.figure(figsize=(14,10)) + + # First aggregate all false positive rates + all_fpr = np.unique(np.concatenate([fpr[c] for c in classes])) + + colors = itertools.cycle(['#ff0000', '#00ff00', '#0000ff', '#ff00ff', + '#00ffff', '#ffff00']) + markers = itertools.cycle(['s',6,'v','h',7,'o','*']) + lw = 2 + + for c, color, marker in zip(classes, colors, markers): + inter_tpr = np.interp(all_fpr, fpr[c], tpr[c]) + markevery = int(len(inter_tpr) * 0.25) + 1 + markevery = 0.1 + if macro: + plt.plot(fpr[c], tpr[c], + marker=marker, markevery=markevery, markersize=14, + color=color, lw=lw, alpha=0.5, + label='{0} (AUC = {1:0.4f})' + ''.format(c, auc(fpr[c], tpr[c]))) + + else: + plt.plot(all_fpr, inter_tpr, + marker=marker, markevery=markevery, markersize=14, + color=color, lw=lw, alpha=0.5, + label='{0} (AUC = {1:0.4f} $\pm$ {2:0.4f})' + ''.format(c, auc(fpr[c], tpr[c]), std[c])) + + plt.plot([0, 1], [0, 1], 'k--', lw=lw) + plt.xlim([-0.03, 1.03]) + plt.ylim([-0.03, 1.03]) + plt.xlabel('False Positive Rate') + plt.ylabel('True Positive Rate') + #plt.title('Receiver Operating Characteristic of Full Dataset', fontsize=20) + plt.legend(frameon=True, loc="lower right", fancybox=True, framealpha=.8, + borderpad=1) + + ax = fig.get_axes()[0] + #plt.setp(ax.xaxis.get_majorticklabels(), fontsize=20) + #plt.setp(ax.yaxis.get_majorticklabels(), fontsize=20) + plt.tight_layout() + os.makedirs(outdir, exist_ok=True) + plt.savefig(os.path.join(outdir, out_fname + '.pdf'), format='pdf') + plt.close(fig) + + +def print_plots(opts): + config_list = opts.config_list + with open(config_list, "r") as f: + config_fnames = f.read().splitlines() + config_fnames = list(filter(lambda x: x, config_fnames)) + + fprs = {} + tprs = {} + for config_fname in config_fnames: + with open(config_fname, "r") as f: + config = yaml.safe_load(f) + config["fname"] = config_fname + + # setup output directory + if "outdir" in config and config["outdir"]: + outdir = config["outdir"] + else: + base_name = os.path.splitext(os.path.basename(config_fname))[0] + outdir = os.path.join("results", base_name) + + # select the latest one + cache_dir = sorted(glob.glob("{}/*".format(outdir)))[-1] + + # TODO: clean up the key name (config_fname to something neat). + config_key = config_fname + config_key = re.search("_([^_]+).yml", config_key).groups()[0] + config_key = config_key.upper() + + # TODO: print out per-package result + package = "all" + fprs[config_key] = {package : {}} + tprs[config_key] = {package : {}} + for idx in range(10): + data = load_cache(fname="data-{}".format(idx), cache_dir=cache_dir) + feature_data, train_data, test_data, test_roc_data = data + fpr, tpr, thresholds = test_roc_data + fprs[config_key][package][idx] = fpr + tprs[config_key][package][idx] = tpr + plot_roc_all(opts.outdir, fprs, tprs) + + +if __name__ == "__main__": + op = OptionParser() + op.add_option( + "--config_list", + action="store", + dest="config_list", + help="give a file containing a list of config files", + ) + op.add_option( + "--outdir", + action="store", + dest="outdir", + help="give a directory for output", + ) + (opts, args) = op.parse_args() + + if not opts.config_list: + op.print_help() + exit(1) + + print_plots(opts) diff --git a/helper/get_roc_table.py b/helper/get_roc_table.py new file mode 100644 index 0000000..f0d8465 --- /dev/null +++ b/helper/get_roc_table.py @@ -0,0 +1,212 @@ +import os +import glob +import sys +import yaml +import re +import numpy as np + +from optparse import OptionParser + +sys.path.insert(0, os.path.join(sys.path[0], "..")) +from tiknib.utils import load_cache + +import pprint as pp +import logging, coloredlogs +rootLogger = logging.getLogger() +rootLogger.setLevel(logging.INFO) + +def calc_tptn_gap(tps, tns): + return np.mean(np.abs(tps - tns), axis=0) + +def load_results(opts): + config_list = opts.config_list + with open(config_list, "r") as f: + config_fnames = f.read().splitlines() + config_fnames = list(filter(lambda x: x, config_fnames)) + + # First joining features that are selected in all 10-fold validation for at + # least one test. + features_union = set() + all_data = {} + for config_idx, config_fname in enumerate(config_fnames): + with open(config_fname, "r") as f: + config = yaml.safe_load(f) + config["fname"] = config_fname + + # setup output directory + if "outdir" in config and config["outdir"]: + outdir = config["outdir"] + else: + base_name = os.path.splitext(os.path.basename(config_fname))[0] + outdir = os.path.join("results", base_name) + + # select the latest one + cache_dir = sorted(glob.glob("{}/*".format(outdir)))[-1] + + # TODO: clean up the key name (config_fname to something neat). + config_key = os.path.basename(config_fname) + config_key = re.search("config_(.+).yml", config_key).groups()[0] + all_data[config_key] = [] + features_inter = set() + for idx in range(10): + data = load_cache(fname="data-{}".format(idx), cache_dir=cache_dir) + all_data[config_key].append(data) + feature_data, train_data, test_data, test_roc_data = data + features, feature_indices = feature_data + feature_names = list(map(lambda x: features[x], feature_indices)) + if not features_inter: + features_inter = set(feature_indices) + else: + features_inter.intersection_update(feature_indices) + features_union.update(features_inter) + + # Create template + total_data = [[] for _ in range(7)] + + # Now fetch real data + for config_idx, config_fname in enumerate(config_fnames): + # TODO: clean up the key name (config_fname to something neat). + config_key = os.path.basename(config_fname) + config_key = re.search("config_(.+).yml", config_key).groups()[0] + + rocs = [] + aps = [] + train_times = [] + test_times = [] + num_train_pairs = [] + num_test_pairs = [] + num_features = [] + features_inter = set() + tptn_gaps = [] + # TODO: print out per-package result + for idx in range(10): + data = all_data[config_key][idx] + feature_data, train_data, test_data, test_roc_data = data + features, feature_indices = feature_data + fpr, tpr, thresholds = test_roc_data + if not features_inter: + features_inter = set(feature_indices) + else: + features_inter.intersection_update(feature_indices) + + train_func_keys, train_tps, train_tns = train_data[:3] + train_roc, train_ap, train_time = train_data[4:7] + test_func_keys, test_tps, test_tns = test_data[:3] + test_roc, test_ap, test_time = test_data[4:7] + + rocs.append(test_roc) + aps.append(test_ap) + train_times.append(train_time) + test_times.append(test_time) + num_train_pairs.append(len(train_tps) + len(train_tns)) + num_test_pairs.append(len(test_tps) + len(test_tns)) + num_features.append(len(feature_indices)) + + tptn_gap = calc_tptn_gap(test_tps, test_tns) + tptn_gaps.append(tptn_gap) + + # first rows + total_data[0].append([ + np.mean(num_train_pairs), + np.mean(num_test_pairs) + ]) + + # second rows + total_data[1].append([ + np.mean(train_times), + np.mean(test_times) + ]) + + # third rows + tmp = {} + for idx in features_union: + if idx in features_inter: + tmp[features[idx]] = [tptn_gap[idx], True] + else: + tmp[features[idx]] = [tptn_gap[idx], False] + total_data[2].append(tmp) + + # fourth row + total_data[3].append(np.mean(num_features)) + + # fifth rows + total_data[4].append([ + np.mean(tptn_gap), + np.mean(tptn_gap[list(features_inter)]) + ]) + + # sixth rows + total_data[5].append([ + np.mean(rocs), + np.std(rocs) + ]) + + # seventh rows + total_data[6].append([ + np.mean(aps), + np.std(aps) + ]) + + return config_fnames, total_data, features, features_union + + +def get_results(opts): + config_fnames, total_data, features, features_union = load_results(opts) + + # first rows + print(','.join(map(lambda x: + '%.2f' % (x[0] / 1000000.0) + if x[0] > 100000 + else '%.2fF' % (x[0] / 10000), total_data[0]))) + print(','.join(map(lambda x: + '%.2f' % (x[1] / 1000000.0) + if x[1] > 100000 + else '%.2fF' % (x[1] / 10000), total_data[0]))) + + # second rows + print(','.join(map(lambda x: '%.1f' % (x[0]), total_data[1]))) + print(','.join(map(lambda x: '%.1f' % (x[1]), total_data[1]))) + + # third rows + for idx in features_union: + feature = features[idx] + s = [feature] + for data in total_data[2]: + # intersection + if data[feature][1]: + s.append('%.2f-' % (data[feature][0])) + else: + s.append('%.2f' % (data[feature][0])) + print(','.join(s)) + + # fourth row + print(','.join(map(lambda x: '%.1f' % (x), total_data[3]))) + + # fifth rows + print(','.join(map(lambda x: '%.2f' % (x[0]), total_data[4]))) + print(','.join(map(lambda x: '%.2f' % (x[1]), total_data[4]))) + + # sixth rows + print(','.join(map(lambda x: '%.2f' % (x[0]), total_data[5]))) + print(','.join(map(lambda x: '%.2f' % (x[1]), total_data[5]))) + + # seventh rows + print(','.join(map(lambda x: '%.2f' % (x[0]), total_data[6]))) + print(','.join(map(lambda x: '%.2f' % (x[1]), total_data[6]))) + + +if __name__ == "__main__": + op = OptionParser() + op.add_option( + "--config_list", + action="store", + dest="config_list", + help="give a file containing a list of config files", + ) + (opts, args) = op.parse_args() + + if not opts.config_list: + op.print_help() + exit(1) + + get_results(opts) diff --git a/helper/get_topk_result.py b/helper/get_topk_result.py new file mode 100644 index 0000000..9de1c95 --- /dev/null +++ b/helper/get_topk_result.py @@ -0,0 +1,402 @@ +import time +import random +import itertools + +# import gc +import os +import sys +import datetime +import numpy as np +import yaml +import pickle + +from operator import itemgetter +from optparse import OptionParser +from sklearn.model_selection import KFold +from sklearn.metrics import roc_curve, auc, average_precision_score + +sys.path.insert(0, os.path.join(sys.path[0], "..")) +from tiknib.utils import do_multiprocess, parse_fname +from tiknib.utils import load_func_data +from tiknib.utils import flatten +from tiknib.utils import store_cache +from tiknib.utils import load_cache +from get_roc_graph import plot_roc_all + +import logging +import coloredlogs + +logger = logging.getLogger(__name__) +coloredlogs.install(level=logging.INFO) +coloredlogs.install(level=logging.DEBUG) +np.seterr(divide="ignore", invalid="ignore") + + +def debughere(): + import ipdb; ipdb.set_trace(sys._getframe().f_back) + + +def get_package(func_key): + return func_key[0] + + +def get_binary(func_key): + return func_key[1] + + +def get_func(func_key): + return (func_key[2], func_key[3]) + + +def get_opti(option_key): + return option_key[0] + + +def get_arch(option_key): + return option_key[1] + + +def get_arch_nobits(option_key): + return option_key[1].split("_")[0] + + +def get_bits(option_key): + return option_key[1].split("_")[1] + + +def get_compiler(option_key): + return option_key[2] + + +def get_others(option_key): + return option_key[3] + + +def parse_other_options(bin_path): + other_options = ["lto", "pie", "noinline"] + for opt in other_options: + if opt in bin_path: + return opt + return "normal" + + +def get_optionidx_map(options): + return {opt: idx for idx, opt in enumerate(sorted(options))} + + +def is_valid(dictionary, s): + return s in dictionary and dictionary[s] + + +def load_options(config): + options = ["opti", "arch", "compiler", "others"] + src_options = [] + dst_options = [] + fixed_options = [] + for idx, opt in enumerate(options): + src_options.append(config["src_options"][opt]) + dst_options.append(config["dst_options"][opt]) + if is_valid(config, "fixed_options") and opt in config["fixed_options"]: + fixed_options.append(idx) + src_options = set(itertools.product(*src_options)) + dst_options = set(itertools.product(*dst_options)) + options = sorted(src_options.union(dst_options)) + optionidx_map = get_optionidx_map(options) + + dst_options_filtered = {} + # Filtering dst options + for src_option in src_options: + + def _check_option(opt): + if opt == src_option: + return False + for idx in fixed_options: + if opt[idx] != src_option[idx]: + return False + return True + + candidates = list(filter(_check_option, dst_options)) + + # arch needs more filtering ... + # - 32 vs 64 bits + # - little vs big endian + # need to have same archs without bits + # TODO: move this file name checking into config option. + if "arch_bits" in config["fname"]: + + def _check_arch_without_bits(opt): + return get_arch_nobits(opt) == get_arch_nobits(src_option) + + candidates = list(filter(_check_arch_without_bits, candidates)) + # need to have same bits + elif "arch_endian" in config["fname"]: + + def _check_bits(opt): + return get_bits(opt) == get_bits(src_option) + + candidates = list(filter(_check_bits, candidates)) + candidates = list(set([optionidx_map[opt] for opt in candidates])) + dst_options_filtered[optionidx_map[src_option]] = candidates + + logger.info("total %d options.", len(options)) + logger.info("%d src options.", len(src_options)) + logger.info("%d dst options.", len(dst_options)) + logger.info("%d filtered dst options.", len(dst_options_filtered)) + return options, dst_options_filtered + + +def pre_k(ranks, k): + count = 0 + for r in ranks: + if r <= k: + count += 1 + return count / len(ranks) + + + +def analyze_top_k_results(config, all_data): + for target_key in all_data: + logger.info("Analyzing %s", target_key) + all_ranks=[] + all_funcs=[] + for target_option in all_data[target_key]: + result_arch, result, scores = all_data[target_key][target_option] + ranks, func_counts, other_ranks = result_arch + ranks = list(ranks.values()) + func_counts = list(func_counts.values()) + logger.info("Top-K %s(%s)", target_key, target_option) + logger.info("Avg Rank: %0.4f", np.mean(ranks)) + logger.info("Std Rank: %0.4f", np.std(ranks)) + logger.info("Prec Top 1: %0.4f", pre_k(ranks,1)) + logger.info("Prec Top 10: %0.4f", pre_k(ranks,10)) + logger.info("Prec Top 100: %0.4f", pre_k(ranks,100)) + logger.info("Avg Counts: %0.4f", np.mean(func_counts)) + all_ranks.extend(ranks) + all_funcs.extend(func_counts) + logger.info("Top-K %s", target_key) + logger.info("Avg Rank: %0.4f", np.mean(all_ranks)) + logger.info("Std Rank: %0.4f", np.std(all_ranks)) + logger.info("Prec Top 1: %0.4f", pre_k(all_ranks,1)) + logger.info("Prec Top 10: %0.4f", pre_k(all_ranks,10)) + logger.info("Prec Top 100: %0.4f", pre_k(all_ranks,100)) + logger.info("Avg Counts: %0.4f", np.mean(all_funcs)) + logger.info("============= normal feature set=============") + for target_key in all_data: + logger.info("Analyzing %s", target_key) + all_ranks=[] + all_funcs=[] + for target_option in all_data[target_key]: + result_arch, result, scores = all_data[target_key][target_option] + ranks, func_counts, other_ranks = result + ranks = list(ranks.values()) + func_counts = list(func_counts.values()) + logger.info("Top-K %s(%s)", target_key, target_option) + logger.info("Avg Rank: %0.4f", np.mean(ranks)) + logger.info("Std Rank: %0.4f", np.std(ranks)) + logger.info("Prec Top 1: %0.4f", pre_k(ranks,1)) + logger.info("Prec Top 10: %0.4f", pre_k(ranks,10)) + logger.info("Prec Top 100: %0.4f", pre_k(ranks,100)) + logger.info("Avg Counts: %0.4f", np.mean(func_counts)) + all_ranks.extend(ranks) + all_funcs.extend(func_counts) + logger.info("Top-K %s", target_key) + logger.info("Avg Rank: %0.4f", np.mean(all_ranks)) + logger.info("Std Rank: %0.4f", np.std(all_ranks)) + logger.info("Prec Top 1: %0.4f", pre_k(all_ranks,1)) + logger.info("Prec Top 10: %0.4f", pre_k(all_ranks,10)) + logger.info("Prec Top 100: %0.4f", pre_k(all_ranks,100)) + logger.info("Avg Counts: %0.4f", np.mean(all_funcs)) + +def check_opt(ops, option): + if type(ops) is not list: + ops = [ops] + for op in ops: + pass + +def analyze_opt(data, op1, op2, arch=True): + global interested_func_keys + all_ranks=[] + all_funcs=[] + all_other={} + max_ranks=[] + if type(op1) is not list: + op1 = [op1] + if type(op2) is not list: + op2 = [op2] + for target_option in data: + if any([o not in str(target_option) for o in op1]): + continue + result_arch, result, scores = data[target_option] + if arch: + ranks, funcs, other_ranks = result_arch + else: + ranks, funcs, other_ranks = result + for src_option in ranks: + tmp_ranks = [] + if any([o not in str(src_option) for o in op2]): + continue + all_ranks.append(ranks[src_option]) + all_funcs.append(funcs[src_option]) + tmp_ranks.append(ranks[src_option]) + for f in other_ranks[src_option]: + if f in all_other: + all_other[f].append(other_ranks[src_option][f]) + else: + all_other[f] = [other_ranks[src_option][f]] + tmp_ranks.append(other_ranks[src_option][f]) + max_ranks.append(min(tmp_ranks)) + result=[] + #result.append('%s to %s'%(op1[0],op2[0])) + result.append(op1[0]) + result.append(op2[0]) + result.append(str(len(all_ranks))) + result.append(np.mean(all_funcs)) + result.append(np.mean(all_ranks)) + result.append(pre_k(all_ranks, 1)) + for f in interested_func_keys: + result.append(np.mean(all_other[f])) + result.append(np.mean(max_ranks)) + result.append(pre_k(max_ranks, 1)) + + ''' + print("%0.3f"% np.mean(all_ranks)) + print("%0.3f"% np.std(all_ranks)) + print("%0.3f"% np.mean(all_funcs)) + print("%0.3f"% pre_k(all_ranks,1)) + #print("%0.3f"% pre_k(all_ranks,10)) + #print("%0.3f"% pre_k(all_ranks,100)) + for f in interested_func_keys: + print(f[3]) + print("%0.3f"% np.mean(all_other[f])) + #print("%0.3f"% pre_k(all_other[f],1)) + #print("%0.3f"% pre_k(all_other[f],10)) + #print("%0.3f"% pre_k(all_other[f],100)) + print("MAX") + print("%0.3f"% np.mean(max_ranks)) + print("%0.3f"% np.std(max_ranks)) + print("%0.3f"% pre_k(max_ranks,1)) + print("%0.3f"% pre_k(max_ranks,10)) + print("%0.3f"% pre_k(max_ranks,100)) + ''' + return result + + + +def analyze(opts): + global interested_func_keys + config_fname = opts.config + with open(config_fname, "r") as f: + config = yaml.safe_load(f) + config["fname"] = config_fname + + #file_handler = logging.FileHandler(os.path.join(outdir, "log.txt")) + #logger.addHandler(file_handler) + logger.info("config file name: %s", config["fname"]) + + options, dst_options = load_options(config) + features = sorted(config["features"]) + target_funcs = config["target_funcs"] + patched_funcs = config["patched_funcs"] + target_func_keys = [] + patched_func_keys = [] + for target_func in target_funcs: + package, bin_name, src_file, src_line = target_func + func_key = (package, bin_name, src_file, src_line) + logger.info("Target function: %s", func_key) + target_func_keys.append(func_key) + for patched_func in patched_funcs: + package, bin_name, src_file, src_line = patched_func + func_key = (package, bin_name, src_file, src_line) + logger.info("Patched function: %s", func_key) + patched_func_keys.append(func_key) + + is_all = False + if "top-k_all" in opts.pickle: + is_all = True + else: + funcname = os.path.basename(opts.pickle)[6:-7] + with open(opts.pickle, 'rb') as f: + if is_all: + all_data = pickle.load(f) + else: + all_data = {} + all_data[funcname] = pickle.load(f) + analyze_top_k_results(config, all_data) + + #analyze_opt(all_data[funcname], 'normal', 'normal') + #analyze_opt(all_data[funcname], ['clang-4','x86_64','O1'], ['gcc-4','x86_64','O1']) + + interested_func_keys = [k for k in target_func_keys if k[3] != funcname] + interested_func_keys += patched_func_keys + + tests = [('norm', 'norm'), + ('arm','arm'), + ('arm','mips'), + ('arm','x86'), + ('mips','mips'), + ('mips','arm'), + ('mips','x86'), + ('x86','x86'), + ('x86','arm'), + ('x86','mips'), + ('O2','O3'), + ('O3','O2'), + ('gcc','clang'), + ('gcc-4','gcc-8'), + ('gcc-8','gcc-4'), + ('clang-4','clang-7'), + ('clang-7','clang-4') + ] + + all_res = [] + all_res.append(['X','Y', '# of test', '# of Func', 'Rank', 'Pre@1', 'Rank (dtls)', 'Rank (tls-patched)', + 'Rank (dtls-patched)', 'Rank', 'Pre@1']) + idx = 0 + for test in tests: + A, B = test + res = analyze_opt(all_data[funcname], A, B) + #res2 = analyze_opt(all_data[funcname], A, B, False) + all_res.append(res) + + + delim = ',' + for j in range(len(all_res[0])): + for i in range(len(all_res)): + if type(all_res[i][j]) is str: + print(all_res[i][j], end=delim) + else: + print("%0.2f"% all_res[i][j], end=delim) + print('') + + + +if __name__ == "__main__": + op = OptionParser() + op.add_option( + "--config", + action="store", + dest="config", + help="give config file (ex) config/config_default.yml", + ) + op.add_option( + "--pickle", + type="str", + action="store", + dest="pickle", + help="a file containing pickled result" + ) + op.add_option( + "--train_funcs_limit", + type="int", + action="store", + dest="train_funcs_limit", + default=200000, + help="a number to limit the number of functions in training", + ) + (opts, args) = op.parse_args() + + if not opts.config: + op.print_help() + exit(1) + + analyze(opts) diff --git a/helper/run_ase.sh b/helper/run_ase.sh new file mode 100755 index 0000000..9c89557 --- /dev/null +++ b/helper/run_ase.sh @@ -0,0 +1,67 @@ +#!/bin/bash +set -x + +declare -a input_list=( + # This one is for processing all functions. + "/home/dongkwan/binkit-dataset/ase_debug.txt" + # Then, for experiment and counting, we utilize them separately. +# "/home/dongkwan/binkit-dataset/ase1_debug.txt" +# "/home/dongkwan/binkit-dataset/ase2_debug.txt" +# "/home/dongkwan/binkit-dataset/ase3_debug.txt" +# "/home/dongkwan/binkit-dataset/ase4_debug.txt" +) + +source_list="/home/dongkwan/binkit-dataset/ase_source_list.txt" +ctags_dir="/home/dongkwan/binkit-dataset/ase_ctags_data" + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/do_idascript.py \ + --idapath "/home/dongkwan/.tools/ida-6.95" \ + --idc "/home/dongkwan/tiknib/tiknib/ida/fetch_funcdata_v6.95.py" \ + --input_list "${f}" \ + --log +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/extract_lineno.py \ + --input_list "${f}" \ + --threshold 1 +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/filter_functions.py \ + --input_list "${f}" \ + --threshold 1 +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/count_functions.py \ + --input_list "${f}" \ + --threshold 1 +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/extract_functype.py \ + --source_list "${source_list}" \ + --input_list "${f}" \ + --ctags_dir "${ctags_dir}" \ + --threshold 1 +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/extract_features.py \ + --input_list "${f}" \ + --threshold 1 +done diff --git a/helper/run_ase_roc.sh b/helper/run_ase_roc.sh new file mode 100755 index 0000000..db2bbaf --- /dev/null +++ b/helper/run_ase_roc.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -x + +# You can run below commands in parallel. +echo "Testing Presemantic features ..." +python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/ase1_debug.txt" \ + --train_funcs_limit 200000 \ + --config "config/ase18/config_ase1.yml" +python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/ase2_debug.txt" \ + --train_funcs_limit 200000 \ + --config "config/ase18/config_ase2.yml" +python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/ase3_debug.txt" \ + --train_funcs_limit 200000 \ + --config "config/ase18/config_ase3.yml" +python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/ase4_debug.txt" \ + --train_funcs_limit 200000 \ + --config "config/ase18/config_ase4.yml" + +echo "Testing Type features ..." +python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/ase1_debug.txt" \ + --train_funcs_limit 200000 \ + --config "config/ase18/config_type_ase1.yml" +python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/ase2_debug.txt" \ + --train_funcs_limit 200000 \ + --config "config/ase18/config_type_ase2.yml" +python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/ase3_debug.txt" \ + --train_funcs_limit 200000 \ + --config "config/ase18/config_type_ase3.yml" +python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/ase4_debug.txt" \ + --train_funcs_limit 200000 \ + --config "config/ase18/config_type_ase4.yml" diff --git a/helper/run_extra_roc.sh b/helper/run_extra_roc.sh new file mode 100755 index 0000000..7940e32 --- /dev/null +++ b/helper/run_extra_roc.sh @@ -0,0 +1,36 @@ +#!/bin/bash +set -x + +declare -a input_list=( + "config/gnu_lto/config_gnu_normal_others_lto_clang4.yml" + "config/gnu_lto/config_gnu_normal_others_lto_clang5.yml" + "config/gnu_lto/config_gnu_normal_others_lto_clang6.yml" + "config/gnu_lto/config_gnu_normal_others_lto_clang7.yml" + "config/gnu_lto/config_gnu_normal_others_lto_gcc4.yml" + "config/gnu_lto/config_gnu_normal_others_lto_gcc5.yml" + "config/gnu_lto/config_gnu_normal_others_lto_gcc6.yml" + "config/gnu_lto/config_gnu_normal_others_lto_gcc7.yml" + "config/gnu_lto/config_gnu_normal_others_lto_gcc8.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_lto.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + +declare -a input_list=( + "config/gnu_noinline/config_gnu_normal_others_noinline_O1.yml" + "config/gnu_noinline/config_gnu_normal_others_noinline_O2.yml" + "config/gnu_noinline/config_gnu_normal_others_noinline_O3.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_noinline.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done diff --git a/helper/run_gnu.sh b/helper/run_gnu.sh new file mode 100755 index 0000000..0d3d231 --- /dev/null +++ b/helper/run_gnu.sh @@ -0,0 +1,67 @@ +#!/bin/bash +set -x + +declare -a input_list=( + "/home/dongkwan/binkit-dataset/gnu_debug.txt" + "/home/dongkwan/binkit-dataset/gnu_debug_sizeopt.txt" + "/home/dongkwan/binkit-dataset/gnu_debug_pie.txt" + "/home/dongkwan/binkit-dataset/gnu_debug_noinline.txt" + "/home/dongkwan/binkit-dataset/gnu_debug_lto.txt" + "/home/dongkwan/binkit-dataset/gnu_debug_obfus.txt" +) +source_list="/home/dongkwan/binkit-dataset/gnu_source_list.txt" +ctags_dir="/home/dongkwan/binkit-dataset/gnu_ctags_data" + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/do_idascript.py \ + --idapath "/home/dongkwan/.tools/ida-6.95" \ + --idc "/home/dongkwan/tiknib/tiknib/ida/fetch_funcdata.py" \ + --input_list "${f}" \ + --log +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/extract_lineno.py \ + --input_list "${f}" \ + --threshold 1 +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/filter_functions.py \ + --input_list "${f}" \ + --threshold 1 +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/count_functions.py \ + --input_list "${f}" \ + --threshold 1 +done + +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/extract_functype.py \ + --source_list "${source_list}" \ + --input_list "${f}" \ + --ctags_dir "${ctags_dir}" \ + --threshold 1 +done + +# needs to adjust 'pool_size' for the obfuscation dataset because it takes too +# much memory. +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/extract_features.py \ + --input_list "${f}" \ + --threshold 1 +done diff --git a/helper/run_gnu_roc.sh b/helper/run_gnu_roc.sh new file mode 100755 index 0000000..041b53b --- /dev/null +++ b/helper/run_gnu_roc.sh @@ -0,0 +1,102 @@ +#!/bin/bash +set -x + +declare -a input_list=( + "config/gnu/config_gnu_normal_all.yml" + + "config/gnu/config_gnu_normal_opti_O0-O3.yml" + "config/gnu/config_gnu_normal_opti_O2-O3.yml" + "config/gnu/config_gnu_normal_opti_O0toO3.yml" + + "config/gnu/config_gnu_normal_comp_gcc.yml" + "config/gnu/config_gnu_normal_comp_clang.yml" + "config/gnu/config_gnu_normal_comp_gcc-clang.yml" + "config/gnu/config_gnu_normal_comp_all.yml" + + "config/gnu/config_gnu_normal_arch_x86_arm.yml" + "config/gnu/config_gnu_normal_arch_x86_mips.yml" + "config/gnu/config_gnu_normal_arch_arm_mips.yml" + "config/gnu/config_gnu_normal_arch_bits.yml" + "config/gnu/config_gnu_normal_arch_endian.yml" + "config/gnu/config_gnu_normal_arch_all.yml" + + "config/gnu/config_gnu_normal_hard.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/gnu_debug.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + + + +declare -a input_list=( + "config/gnu/config_gnu_normal_opti_O0-Os.yml" + "config/gnu/config_gnu_normal_opti_O1-Os.yml" + "config/gnu/config_gnu_normal_opti_O3-Os.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_size.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + +declare -a input_list=( + "config/gnu/config_gnu_normal_others_lto.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_lto.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + + +declare -a input_list=( + "config/gnu/config_gnu_normal_others_noinline_from_O1.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_noinline.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + +declare -a input_list=( + "config/gnu/config_gnu_normal_others_pie.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_pie.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + +declare -a input_list=( + "config/gnu/config_gnu_normal_obfus_bcf.yml" + "config/gnu/config_gnu_normal_obfus_fla.yml" + "config/gnu/config_gnu_normal_obfus_sub.yml" + "config/gnu/config_gnu_normal_obfus_all.yml" + + "config/gnu/config_gnu_normal_obfus_hard.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_obfus.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done diff --git a/helper/run_gnu_roc_type.sh b/helper/run_gnu_roc_type.sh new file mode 100755 index 0000000..aef6aa0 --- /dev/null +++ b/helper/run_gnu_roc_type.sh @@ -0,0 +1,102 @@ +#!/bin/bash +set -x + +declare -a input_list=( + "config/gnu/config_gnu_normal_all_type.yml" + + "config/gnu/config_gnu_normal_opti_O0-O3_type.yml" + "config/gnu/config_gnu_normal_opti_O2-O3_type.yml" + "config/gnu/config_gnu_normal_opti_O0toO3_type.yml" + + "config/gnu/config_gnu_normal_comp_gcc_type.yml" + "config/gnu/config_gnu_normal_comp_clang_type.yml" + "config/gnu/config_gnu_normal_comp_gcc-clang_type.yml" + "config/gnu/config_gnu_normal_comp_all_type.yml" + + "config/gnu/config_gnu_normal_arch_x86_arm_type.yml" + "config/gnu/config_gnu_normal_arch_x86_mips_type.yml" + "config/gnu/config_gnu_normal_arch_arm_mips_type.yml" + "config/gnu/config_gnu_normal_arch_bits_type.yml" + "config/gnu/config_gnu_normal_arch_endian_type.yml" + "config/gnu/config_gnu_normal_arch_all_type.yml" + + "config/gnu/config_gnu_normal_hard_type.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/gnu_debug.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + + + +declare -a input_list=( + "config/gnu/config_gnu_normal_opti_O0-Os_type.yml" + "config/gnu/config_gnu_normal_opti_O1-Os_type.yml" + "config/gnu/config_gnu_normal_opti_O3-Os_type.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_size.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + +declare -a input_list=( + "config/gnu/config_gnu_normal_others_lto_type.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_lto.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + + +declare -a input_list=( + "config/gnu/config_gnu_normal_others_noinline_from_O1_type.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_noinline.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + +declare -a input_list=( + "config/gnu/config_gnu_normal_others_pie_type.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_pie.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done + +declare -a input_list=( + "config/gnu/config_gnu_normal_obfus_bcf_type.yml" + "config/gnu/config_gnu_normal_obfus_fla_type.yml" + "config/gnu/config_gnu_normal_obfus_sub_type.yml" + "config/gnu/config_gnu_normal_obfus_all_type.yml" + + "config/gnu/config_gnu_normal_obfus_hard_type.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/test_obfus.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done diff --git a/helper/run_openssl_roc.sh b/helper/run_openssl_roc.sh new file mode 100755 index 0000000..fa23d7a --- /dev/null +++ b/helper/run_openssl_roc.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -x + +declare -a input_list=( + "config/openssl/config_openssl_all.yml" + "config/openssl/config_openssl_arm_mips.yml" + "config/openssl/config_openssl_arm_x86.yml" + "config/openssl/config_openssl_mips_arm.yml" + "config/openssl/config_openssl_mips_x86.yml" + "config/openssl/config_openssl_x86_arm.yml" + "config/openssl/config_openssl_x86_mips.yml" +) +for f in "${input_list[@]}" +do + # this is feature selecting for openssl, so we use gnu normal dataset + echo "Processing ${f} ..." + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/gnu_debug.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done diff --git a/helper/run_openssl_roc_topk.sh b/helper/run_openssl_roc_topk.sh new file mode 100755 index 0000000..b58ab1b --- /dev/null +++ b/helper/run_openssl_roc_topk.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -x + +declare -a input_list=( + "config/openssl_topk/config_topk_openssl.yml" +) +for f in "${input_list[@]}" +do + # this is feature selecting for openssl, so we use gnu normal dataset + echo "Processing ${f} ..." + python helper/test_topk.py \ + --input_list "/home/dongkwan/binkit-dataset/ase4_debug_openssl.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" + + # We specified the name of the pickle file that has the cached results of the + # test_topk.py + python helper/get_topk_result.py \ + --config "${f}" \ + --pickle "./results/config_topk_openssl/2021-07-19 15:56:43.763949/top-k_tls1_process_heartbeat.pickle" +done + diff --git a/helper/run_openssl_roc_topk_type.sh b/helper/run_openssl_roc_topk_type.sh new file mode 100755 index 0000000..d2c7c36 --- /dev/null +++ b/helper/run_openssl_roc_topk_type.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -x + +declare -a input_list=( + "config/openssl_topk/config_topk_openssl_type.yml" +) +for f in "${input_list[@]}" +do + # this is feature selecting for openssl, so we use gnu normal dataset + echo "Processing ${f} ..." + python helper/test_topk.py \ + --input_list "/home/dongkwan/binkit-dataset/ase4_debug_openssl.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" + + # We specified the name of the pickle file that has the cached results of the + # test_topk.py + python helper/get_topk_result.py \ + --config "${f}" \ + --pickle "./results/config_topk_openssl_type/2021-07-19 17:10:06.097997/top-k_tls1_process_heartbeat.pickle" +done diff --git a/helper/run_openssl_roc_type.sh b/helper/run_openssl_roc_type.sh new file mode 100755 index 0000000..ae347dd --- /dev/null +++ b/helper/run_openssl_roc_type.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -x + +declare -a input_list=( + "config/openssl/config_openssl_all_type.yml" + "config/openssl/config_openssl_arm_mips_type.yml" + "config/openssl/config_openssl_arm_x86_type.yml" + "config/openssl/config_openssl_mips_arm_type.yml" + "config/openssl/config_openssl_mips_x86_type.yml" + "config/openssl/config_openssl_x86_arm_type.yml" + "config/openssl/config_openssl_x86_mips_type.yml" +) +for f in "${input_list[@]}" +do + echo "Processing ${f} ..." + # this is feature selecting for openssl, so we use gnu normal dataset + python helper/test_roc.py \ + --input_list "/home/dongkwan/binkit-dataset/gnu_debug.txt" \ + --train_funcs_limit 200000 \ + --config "${f}" +done diff --git a/helper/test_roc.py b/helper/test_roc.py index 4b5c0c2..0751749 100644 --- a/helper/test_roc.py +++ b/helper/test_roc.py @@ -19,6 +19,7 @@ from tiknib.utils import load_func_data from tiknib.utils import flatten from tiknib.utils import store_cache +from get_roc_graph import plot_roc_all import logging import coloredlogs @@ -38,7 +39,8 @@ def get_binary(func_key): def get_func(func_key): - return func_key[2] + #return (func_key[2]) # use name + return (func_key[2], func_key[3]) # use source file, source line def get_opti(option_key): @@ -141,7 +143,8 @@ def calc_metric_helper(func_key): while True: func_tn_key = random.choice(g_func_keys) # Since difference binaries may have an equal function, pick a - # function having a different name for precise comparison + # function having a different source file name and line number for + # precise comparison if get_func(func_tn_key) != get_func(func_key): if dst_opt in g_funcs[func_tn_key]: tn_func = g_funcs[func_tn_key][dst_opt] @@ -234,6 +237,23 @@ def calc_results(tps, tns, feature_indices): return calc_roc(X, y), calc_ap(X, y) +# this function returns (fpr, tpr, tresholds) +def get_roc_curve(tps, tns, feature_indices): + feature_indices = np.array(feature_indices) + num_data = len(tps) + num_features = len(feature_indices) + X = np.concatenate( + [ + relative_distance(tps, feature_indices), + relative_distance(tns, feature_indices), + ] + ) + y = np.concatenate( + [np.ones(num_data, dtype=np.bool), np.zeros(num_data, dtype=np.bool)] + ) + return roc_curve(y, X, pos_label=1) + + # preprocess possible target options for src option def load_options(config): options = ["opti", "arch", "compiler", "others"] @@ -292,14 +312,19 @@ def _check_bits(opt): return options, dst_options_filtered -def group_binaries(input_list): +def group_binaries(input_list, options): with open(input_list, "r") as f: bin_paths = f.read().splitlines() bins = {} packages = set() + check_options = set(options) for bin_path in bin_paths: package, compiler, arch, opti, bin_name = parse_fname(bin_path) others = parse_other_options(bin_path) + option_key = (opti, arch, compiler, others) + # Filter unnecessary binaries to speed up testing. + if option_key not in check_options: + continue key = (package, bin_name) if key not in bins: bins[key] = [] @@ -309,45 +334,55 @@ def group_binaries(input_list): "%d packages, %d unique binaries, total %d binaries", len(packages), len(bins), - len(bin_paths), + sum(map(len, bins.values())) ) return bins, packages def load_func_features_helper(bin_paths): + # TODO: handle suffix correctly. # returns {function_key: {option_idx: np.array(feature_values)}} global g_options, g_features func_features = {} num_features = len(g_features) optionidx_map = get_optionidx_map(g_options) + # This counts compiler-generated duplicates (.isra, .part, .cold) + duplicate_cnt = 0 for bin_path in bin_paths: package, compiler, arch, opti, bin_name = parse_fname(bin_path) others = parse_other_options(bin_path) - _, func_data_list = load_func_data(bin_path) + _, func_data_list = load_func_data(bin_path, suffix="filtered2") for func_data in func_data_list: # Use only .text functions for testing + # These are already filtered in filter_functions.py if func_data["seg_name"] != ".text": continue if func_data["name"].startswith("sub_"): continue - func_key = (package, bin_name, func_data["name"]) + #func_key = (package, bin_name, func_data["name"]) + func_key = (package, bin_name, func_data["src_file"], func_data["src_line"]) option_key = (opti, arch, compiler, others) if option_key not in optionidx_map: continue option_idx = optionidx_map[option_key] if func_key not in func_features: func_features[func_key] = {} + # in the below condition by using option_key instead of option_idx, + # we can filter duplicate functions and only leave the last one. + # TODO: move this filtering to filter_functions.py if option_key not in func_features[func_key]: func_features[func_key][option_idx] = np.zeros( num_features, dtype=np.float64 ) + else: + duplicate_cnt += 1 for feature_idx, feature in enumerate(g_features): if feature not in func_data["feature"]: continue val = func_data["feature"][feature] func_features[func_key][option_idx][feature_idx] = val - return func_features + return func_features, duplicate_cnt # inevitably use globals since it is fast. @@ -358,7 +393,7 @@ def _init_load(options, features): def load_func_features(input_list, options, features): - grouped_bins, packages = group_binaries(input_list) + grouped_bins, packages = group_binaries(input_list, options) func_features_list = do_multiprocess( load_func_features_helper, grouped_bins.values(), @@ -368,15 +403,20 @@ def load_func_features(input_list, options, features): initargs=(options, features), ) funcs = {} - for func_features in func_features_list: + duplicate_cnt = 0 + for func_features, dup_cnt in func_features_list: funcs.update(func_features) + duplicate_cnt += dup_cnt + num_funcs = sum([len(x) for x in funcs.values()]) + logger.info("%d functions loaded.", num_funcs) + logger.info("%d compiler-generated duplicates.", duplicate_cnt) return funcs def do_test(opts): config_fname = opts.config with open(config_fname, "r") as f: - config = yaml.load(f) + config = yaml.safe_load(f) config["fname"] = config_fname # setup output directory @@ -400,15 +440,14 @@ def do_test(opts): t0 = time.time() logger.info("Feature loading ...") funcs = load_func_features(opts.input_list, options, features) + num_funcs = sum([len(x) for x in funcs.values()]) logger.info( - "%d functions (%d unique).", sum([len(x) for x in funcs.values()]), len(funcs) + "%d functions (%d unique).", num_funcs, len(funcs) ) logger.info("Feature loading done. (%0.3fs)", time.time() - t0) num_folds = 10 kf = KFold(n_splits=num_folds) - # We revised the code and now NUM_TRAIN_LIMIT is not used. - # NUM_TRAIN_LIMIT = 2000000 assert len(funcs) > num_folds # =============================================== @@ -423,19 +462,35 @@ def do_test(opts): data_all = [] for trial_idx, (train_func_keys, test_func_keys) in enumerate(kf.split(func_keys)): logger.info("[+] TRIAL %d/%d ================", trial_idx + 1, num_folds) - # We revised the code and now NUM_TRAIN_LIMIT is not used. - # # If there exist too many functions it takes too much time. - # # Therefore, we take 10% of train set. - # if len(train_keys) > NUM_TRAIN_LIMIT: - # train_keys = random.sample(train_keys, NUM_TRAIN_LIMIT) - train_func_keys = [func_keys[i] for i in train_func_keys] + #train_funcs = {key: funcs[key] for key in train_func_keys} + # If there exist too many functions it takes too much time. + # Therefore, we take 10% of train set. + num_train_funcs = 0 + train_funcs = {} + remove_keys = [] + for idx, key in enumerate(train_func_keys): + train_funcs[key] = funcs[key] + num_train_funcs += len(funcs[key]) + if num_train_funcs > opts.train_funcs_limit: + logging.info( + "Training functions over limit: %d", + opts.train_funcs_limit, + ) + break + if idx+1 < len(train_func_keys): + train_func_keys = train_func_keys[:idx+1] + train_funcs = {key: funcs[key] for key in train_func_keys} test_func_keys = [func_keys[i] for i in test_func_keys] test_funcs = {key: funcs[key] for key in test_func_keys} + num_train_funcs = sum([len(x) for x in train_funcs.values()]) + num_test_funcs = sum([len(x) for x in test_funcs.values()]) logging.info( - "Train: %d unique funcs, Test: %d unique funcs", + "Train: %d funcs (%d unique), Test: %d funcs (%d unique)", + num_train_funcs, len(train_func_keys), + num_test_funcs, len(test_func_keys), ) @@ -484,32 +539,24 @@ def do_test(opts): ) logger.info("testing done. (%0.3fs)", test_time) + fpr, tpr, thresholds = get_roc_curve(test_tps, test_tns, selected_feature_indices) + # analyze features that fits our analysis metric data = [ - train_func_keys, - train_tps, - train_tns, - train_opts, - train_roc, - train_ap, - train_time, - test_func_keys, - test_tps, - test_tns, - test_opts, - test_roc, - test_ap, - test_time, - features, - selected_feature_indices, + (features, selected_feature_indices), + (train_func_keys, train_tps, train_tns, train_opts, train_roc, + train_ap, train_time), + (test_func_keys, test_tps, test_tns, test_opts, test_roc, test_ap, + test_time), + (fpr, tpr, thresholds), ] store_cache(data, fname="data-{}".format(trial_idx), cache_dir=outdir) data_all.append(data) - analyze_results(data_all) + analyze_results(config, data_all) -def analyze_results(data_all): +def analyze_results(config, data_all): rocs = [] aps = [] train_times = [] @@ -521,19 +568,19 @@ def analyze_results(data_all): features_union = set() tptn_gaps = [] for data in data_all: - feature_indices = data[15] + feature_data, train_data, test_data, test_roc_data = data + features, feature_indices = feature_data + fpr, tpr, thresholds = test_roc_data if not features_inter: features_inter = set(feature_indices) else: features_inter.intersection_update(feature_indices) features_union.update(feature_indices) - for data in data_all: - train_func_keys, train_tps, train_tns = data[:3] - train_roc, train_ap, train_time = data[4:7] - test_func_keys, test_tps, test_tns = data[7:10] - test_roc, test_ap, test_time = data[11:14] - features, feature_indices = data[14:16] + train_func_keys, train_tps, train_tns = train_data[:3] + train_roc, train_ap, train_time = train_data[4:7] + test_func_keys, test_tps, test_tns = test_data[:3] + test_roc, test_ap, test_time = test_data[4:7] rocs.append(test_roc) aps.append(test_ap) @@ -563,7 +610,7 @@ def analyze_results(data_all): logger.info("Avg. AP: %0.4f", np.mean(aps)) logger.info("Std. of AP: %0.4f", np.std(aps)) logger.info("Avg. Train time: %0.4f", np.mean(train_times)) - logger.info("AVg. Test time: %0.4f", np.mean(test_times)) + logger.info("Avg. Test time: %0.4f", np.mean(test_times)) logger.info("Avg. # of Train Pairs: %d", np.mean(num_train_pairs)) logger.info("Avg. # of Test Pairs: %d", np.mean(num_test_pairs)) @@ -576,12 +623,6 @@ def analyze_results(data_all): dest="config", help="give config file (ex) config/config_default.yml", ) - op.add_option( - "--type", - action="store_true", - dest="type", - help="test type features after loading features", - ) op.add_option( "--input_list", type="str", @@ -589,6 +630,14 @@ def analyze_results(data_all): dest="input_list", help="a file containing a list of input binaries", ) + op.add_option( + "--train_funcs_limit", + type="int", + action="store", + dest="train_funcs_limit", + default=200000, + help="a number to limit the number of functions in training", + ) (opts, args) = op.parse_args() if not opts.config: diff --git a/helper/test_topk.py b/helper/test_topk.py new file mode 100644 index 0000000..d0cc932 --- /dev/null +++ b/helper/test_topk.py @@ -0,0 +1,601 @@ +import time +import random +import itertools + +# import gc +import os +import sys +import glob +import datetime +import numpy as np +import yaml +import pickle + +from operator import itemgetter +from optparse import OptionParser +from sklearn.model_selection import KFold +from sklearn.metrics import roc_curve, auc, average_precision_score + +sys.path.insert(0, os.path.join(sys.path[0], "..")) +from tiknib.utils import do_multiprocess, parse_fname +from tiknib.utils import load_func_data +from tiknib.utils import flatten +from tiknib.utils import store_cache, load_cache +from get_roc_graph import plot_roc_all + +import logging +import coloredlogs + +logger = logging.getLogger(__name__) +coloredlogs.install(level=logging.INFO) +coloredlogs.install(level=logging.DEBUG) +np.seterr(divide="ignore", invalid="ignore") + +TRIALS=10 + +def debughere(): + import ipdb; ipdb.set_trace(sys._getframe().f_back) + + +def get_package(func_key): + return func_key[0] + + +def get_binary(func_key): + return func_key[1] + + +def get_func(func_key): + return (func_key[2], func_key[3]) + + +def get_opti(option_key): + return option_key[0] + + +def get_arch(option_key): + return option_key[1] + + +def get_arch_nobits(option_key): + return option_key[1].split("_")[0] + + +def get_bits(option_key): + return option_key[1].split("_")[1] + + +def get_compiler(option_key): + return option_key[2] + + +def get_others(option_key): + return option_key[3] + + +def parse_other_options(bin_path): + other_options = ["lto", "pie", "noinline"] + for opt in other_options: + if opt in bin_path: + return opt + return "normal" + + +def get_optionidx_map(options): + return {opt: idx for idx, opt in enumerate(sorted(options))} + + +def is_valid(dictionary, s): + return s in dictionary and dictionary[s] + + +def calc_ap(X, y): + return average_precision_score(y, X) + + +def calc_roc(X, y): + fpr, tpr, tresholds = roc_curve(y, X, pos_label=1) + return auc(fpr, tpr) + + +def calc_tptn_gap(tps, tns): + return np.mean(np.abs(tps - tns), axis=0) + + +def relative_difference(a, b): + max_val = np.maximum(np.absolute(a), np.absolute(b)) + d = np.absolute(a - b) / max_val + d[np.isnan(d)] = 0 # 0 / 0 = nan -> 0 + d[np.isinf(d)] = 1 # x / 0 = inf -> 1 (when x != 0) + return d + + +def relative_distance(X, feature_indices): + return 1 - (np.sum(X[feature_indices])) / len(feature_indices) + + +def calc_metric_helper(func_key): + global g_funcs, g_func_keys, g_options, g_target_key, g_option_idx, g_feature_indices + func_data = g_funcs[func_key] + results_arch = [] + results = [] + optionidx_map = get_optionidx_map(g_options) + #for src_opt, src_func in func_data.items(): + for option in g_options: + src_option = option + src_option_idx = optionidx_map[option] + if src_option_idx not in func_data: + results.append(0.0) + results_arch.append(0.0) + continue + if src_option_idx == g_option_idx: + results.append(0.0) + results_arch.append(0.0) + continue + + src_func = func_data[src_option_idx] + + + dst_option_idx = g_option_idx + dst_option = g_options[dst_option_idx] + dst_func = g_funcs[g_target_key][dst_option_idx] + + assert not np.isnan(src_func).any() + assert not np.isnan(dst_func).any() + #results.append(1-np.average(relative_difference(src_func, dst_func))) + rdiff = relative_difference(src_func, dst_func) + #get pre trained feature indices + archs = [get_arch_nobits(dst_option), get_arch_nobits(src_option)] + archs = "_".join(archs) + rdists = [] + feature_indices = g_feature_indices[archs] + rdist = relative_distance(rdiff, feature_indices) + results_arch.append(rdist) + feature_indices = g_feature_indices['all'] + rdist = relative_distance(rdiff, feature_indices) + results.append(rdist) + return func_key, results_arch, results + + +# inevitably use globals since it is fast. +def _init_calc(funcs, options, target_key, option_idx, feature_indices): + global g_funcs, g_func_keys, g_options, g_target_key, g_option_idx, g_feature_indices + g_funcs = funcs + g_func_keys = sorted(funcs.keys()) + g_options = options + g_target_key = target_key + g_option_idx = option_idx + g_feature_indices = feature_indices + + +def calc_metric(funcs, options, target_key, option_idx, feature_indices): + # now select for features. this find local optimum value using hill + # climbing. + metric_results = do_multiprocess( + calc_metric_helper, + funcs.keys(), + chunk_size=1, + threshold=1, + initializer=_init_calc, + initargs=(funcs, options, target_key, option_idx, feature_indices), + ) + func_keys, results_arch, results = zip(*metric_results) + scores_arch = {} + scores = {} + for idx, func_key in enumerate(func_keys): + scores_arch[func_key] = results_arch[idx] + scores[func_key] = results[idx] + return scores_arch, scores + + + +# preprocess possible target options for src option +def load_options(config): + options = ["opti", "arch", "compiler", "others"] + src_options = [] + dst_options = [] + fixed_options = [] + for idx, opt in enumerate(options): + src_options.append(config["src_options"][opt]) + dst_options.append(config["dst_options"][opt]) + if is_valid(config, "fixed_options") and opt in config["fixed_options"]: + fixed_options.append(idx) + src_options = set(itertools.product(*src_options)) + dst_options = set(itertools.product(*dst_options)) + options = sorted(src_options.union(dst_options)) + optionidx_map = get_optionidx_map(options) + + dst_options_filtered = {} + # Filtering dst options + for src_option in src_options: + + def _check_option(opt): + if opt == src_option: + return False + for idx in fixed_options: + if opt[idx] != src_option[idx]: + return False + return True + + candidates = list(filter(_check_option, dst_options)) + + # arch needs more filtering ... + # - 32 vs 64 bits + # - little vs big endian + # need to have same archs without bits + # TODO: move this file name checking into config option. + if "arch_bits" in config["fname"]: + + def _check_arch_without_bits(opt): + return get_arch_nobits(opt) == get_arch_nobits(src_option) + + candidates = list(filter(_check_arch_without_bits, candidates)) + # need to have same bits + elif "arch_endian" in config["fname"]: + + def _check_bits(opt): + return get_bits(opt) == get_bits(src_option) + + candidates = list(filter(_check_bits, candidates)) + candidates = list(set([optionidx_map[opt] for opt in candidates])) + dst_options_filtered[optionidx_map[src_option]] = candidates + + logger.info("total %d options.", len(options)) + logger.info("%d src options.", len(src_options)) + logger.info("%d dst options.", len(dst_options)) + logger.info("%d filtered dst options.", len(dst_options_filtered)) + return options, dst_options_filtered + + +def group_binaries(input_list): + with open(input_list, "r") as f: + bin_paths = f.read().splitlines() + bins = {} + packages = set() + for bin_path in bin_paths: + package, compiler, arch, opti, bin_name = parse_fname(bin_path) + others = parse_other_options(bin_path) + key = (package, bin_name) + if key not in bins: + bins[key] = [] + bins[key].append(bin_path) + packages.add(package) + logger.info( + "%d packages, %d unique binaries, total %d binaries", + len(packages), + len(bins), + len(bin_paths), + ) + return bins, packages + + +def load_func_features_helper(bin_paths): + # TODO: handle suffix correctly. + # returns {function_key: {option_idx: np.array(feature_values)}} + global g_options, g_features + func_features = {} + num_features = len(g_features) + optionidx_map = get_optionidx_map(g_options) + for bin_path in bin_paths: + package, compiler, arch, opti, bin_name = parse_fname(bin_path) + others = parse_other_options(bin_path) + option_key = (opti, arch, compiler, others) + if option_key not in optionidx_map: + continue + _, func_data_list = load_func_data(bin_path, suffix="filtered2") + for func_data in func_data_list: + # Use only .text functions for testing + # These are already filtered in filter_functions.py + if func_data["seg_name"] != ".text": + continue + if func_data["name"].startswith("sub_"): + continue + #func_key = (package, bin_name, func_data["name"]) + func_key = (package, bin_name, func_data["src_file"], + func_data["src_line"]) + func_key = (package, bin_name, func_data["src_file"], + func_data["name"]) + option_idx = optionidx_map[option_key] + if func_key not in func_features: + func_features[func_key] = {} + if option_key not in func_features[func_key]: + func_features[func_key][option_idx] = np.zeros( + num_features, dtype=np.float64 + ) + for feature_idx, feature in enumerate(g_features): + if feature not in func_data["feature"]: + continue + val = func_data["feature"][feature] + func_features[func_key][option_idx][feature_idx] = val + + return func_features + + +# inevitably use globals since it is fast. +def _init_load(options, features): + global g_options, g_features + g_options = options + g_features = features + + +def load_func_features(input_list, options, features): + grouped_bins, packages = group_binaries(input_list) + func_features_list = do_multiprocess( + load_func_features_helper, + grouped_bins.values(), + chunk_size=1, + threshold=1, + initializer=_init_load, + initargs=(options, features), + ) + funcs = {} + for func_features in func_features_list: + funcs.update(func_features) + return funcs + +def load_trained_features(features, pre_trained): + feature_indices = {} + logging.info("Loading pre-trained features") + base_path = pre_trained + archs = ['arm','mips','x86'] + arch_pairs = ['%s_%s'%(a,b) for a in archs for b in archs] + arch_pairs.append('all') + + for arch in arch_pairs: + outdir = base_path % arch + logger.info(outdir) + cache_dir = sorted(glob.glob("{}/*".format(outdir)))[-1] + roc_max = 0 + for idx in range(10): + data = load_cache(fname="data-{}".format(idx), cache_dir=cache_dir) + feature_data, train_data, test_data, test_roc_data = data + train_func_keys, train_tps, train_tns, train_opts, train_roc, train_ap, train_time = train_data + + if train_roc > roc_max: + roc_max = train_roc + data_features = feature_data[0] + selected = feature_data[1] + indices = [] + for f in selected: + feature = data_features[f] + indices.append(features.index(feature)) + feature_indices[arch] = indices + #feature_indices['all']=[5] + + logger.info(feature_indices) + + return feature_indices + +def _init_rank(func_keys, scores, options, target_key, interested_keys): + global g_func_keys, g_scores, g_options, g_target_key, g_interested_keys + g_func_keys = func_keys + g_scores = scores + g_options = options + g_target_key = target_key + g_interested_keys = interested_keys + + +def get_rank_helper(src_option): + global g_func_keys, g_scores, g_options, g_target_key, g_interested_keys + optionidx_map = get_optionidx_map(g_options) + + src_option_idx = optionidx_map[src_option] + rank = 0 + funcs = 0 + other_ranks = {} + target_found = True + sorted_keys = sorted(g_func_keys, key=lambda k: g_scores[k][src_option_idx], reverse=True) + sorted_keys = list(filter(lambda k: g_scores[k][src_option_idx]!=0.0, sorted_keys)) + try: + rank = sorted_keys.index(g_target_key)+1 + except ValueError: + return None, None, None, None + funcs=len(sorted_keys) + #logger.info("Rank at %d", rank) + for i_func_key in g_interested_keys: + if i_func_key == g_target_key: + continue + try: + i_rank = sorted_keys.index(i_func_key)+1 + other_ranks[i_func_key] = i_rank + except ValueError: + continue + return src_option, rank, funcs, other_ranks + + +def get_rank(func_keys, scores, options, target_key, interested_keys, target_option): + src_options = [ op for op in options if op != target_option] + metric_results = do_multiprocess( + get_rank_helper, + src_options, + chunk_size=1, + threshold=1, + initializer=_init_rank, + initargs=(func_keys, scores, options, target_key, interested_keys), + ) + src_option, total_rank, total_funcs, total_other_ranks = zip(*metric_results) + ranks = {} + func_counts = {} + other_ranks = {} + for idx, option in enumerate(src_option): + if option == None: + continue + ranks[option] = total_rank[idx] + func_counts[option] = total_funcs[idx] + other_ranks[option] = total_other_ranks[idx] + return [ranks, func_counts, other_ranks] + + +def do_top_k(opts): + config_fname = opts.config + with open(config_fname, "r") as f: + config = yaml.safe_load(f) + config["fname"] = config_fname + + # setup output directory + if "outdir" in config and config["outdir"]: + outdir = config["outdir"] + else: + base_name = os.path.splitext(os.path.basename(config_fname))[0] + outdir = os.path.join("results", base_name) + date = datetime.datetime.now() + outdir = os.path.join(outdir, str(date)) + os.makedirs(outdir, exist_ok=True) + file_handler = logging.FileHandler(os.path.join(outdir, "log.txt")) + logger.addHandler(file_handler) + logger.info("config file name: %s", config["fname"]) + logger.info("output directory: %s", outdir) + + options, dst_options = load_options(config) + features = sorted(config["features"]) + logger.info("%d features", len(features)) + feature_indices = load_trained_features(features, config["pre_trained"]) + + t0 = time.time() + logger.info("Feature loading ...") + target_funcs = config["target_funcs"] + patched_funcs = config["patched_funcs"] + target_func_keys = [] + patched_func_keys = [] + for target_func in target_funcs: + package, bin_name, src_file, src_line = target_func + func_key = (package, bin_name, src_file, src_line) + logger.info("Target function: %s", func_key) + target_func_keys.append(func_key) + for patched_func in patched_funcs: + package, bin_name, src_file, src_line = patched_func + func_key = (package, bin_name, src_file, src_line) + logger.info("Patched function: %s", func_key) + patched_func_keys.append(func_key) + interested_func_keys = target_func_keys + patched_func_keys + funcs = load_func_features(opts.input_list, options, features) + num_funcs = sum([len(x) for x in funcs.values()]) + logger.info( + "%d functions (%d unique).", num_funcs, len(funcs) + ) + logger.info("Feature loading done. (%0.3fs)", time.time() - t0) + + # ================= + # start + # ================= + optionidx_map = get_optionidx_map(options) + + func_keys = sorted(funcs.keys()) + t1 = time.time() + all_data={} + for target_key in target_func_keys: + if target_key not in func_keys: + logger.info("Target %s not found", target_key) + continue + logger.info("Testing %s", target_key) + all_data[target_key] = {} + for target_option in options: + logger.info("Testing %s", target_option) + target_option_idx = optionidx_map[target_option] + if target_option_idx not in funcs[target_key]: + continue + t2 = time.time() + scores_arch, scores = calc_metric(funcs, options, target_key, target_option_idx, feature_indices) + logger.info("Calc %s, %s done. (%0.3fs)", target_key, target_option, time.time() - t2) + t3 = time.time() + result_arch = get_rank(func_keys, scores_arch, options, target_key, interested_func_keys, target_option) + result = get_rank(func_keys, scores, options, target_key, interested_func_keys, target_option) + all_data[target_key][target_option] = [result_arch, result, scores] + #debughere() + logger.info("Rank %s, %s done. (%0.3fs)", target_key, target_option, time.time() - t3) + ranks, func_counts, other_ranks = result_arch + ranks2, func_counts2, other_ranks2 = result + for src_option in options: + if src_option in ranks: + logger.info("%s: Rank %.3f over %.3f", src_option, ranks[src_option], func_counts[src_option]) + logger.info("%s: Rank %.3f over %.3f", src_option, ranks2[src_option], func_counts2[src_option]) + #all_data[target_key][target_option] = [ranks, func_counts, other_ranks] + #store_cache(all_data[target_key], fname="top-k_%s"%str(target_key[3]), cache_dir=outdir) + store_cache(all_data[target_key], fname="top-k_%s"%str(target_key[3]), cache_dir=outdir) + store_cache(all_data, fname="top-k_all", cache_dir=outdir) + analyze_top_k_results(config, all_data) + + +def pre_k(ranks, k): + count = 0 + for r in ranks: + if r <= k: + count += 1 + return count / len(ranks) + + + +def log_res(ranks): + ranks = list(ranks.values()) + func_counts = list(func_counts.values()) + logger.info("Top-K %s(%s)", target_key, target_option) + logger.info("Avg Rank: %0.4f", np.mean(ranks)) + logger.info("Std Rank: %0.4f", np.std(ranks)) + logger.info("Prec Top 1: %0.4f", pre_k(ranks,1)) + logger.info("Prec Top 10: %0.4f", pre_k(ranks,10)) + logger.info("Prec Top 100: %0.4f", pre_k(ranks,100)) + logger.info("Avg Counts: %0.4f", np.mean(func_counts)) + + +def analyze_top_k_results(config, all_data): + for target_key in all_data: + logger.info("Analyzing %s", target_key) + all_ranks=[] + all_funcs=[] + for target_option in all_data[target_key]: + result_arch, result, scores = all_data[target_key][target_option] + ranks, func_counts, other_ranks = result_arch + ranks = list(ranks.values()) + func_counts = list(func_counts.values()) + logger.info("Top-K %s(%s)", target_key, target_option) + logger.info("Avg Rank: %0.4f", np.mean(ranks)) + logger.info("Std Rank: %0.4f", np.std(ranks)) + logger.info("Prec Top 1: %0.4f", pre_k(ranks,1)) + logger.info("Prec Top 10: %0.4f", pre_k(ranks,10)) + logger.info("Prec Top 100: %0.4f", pre_k(ranks,100)) + logger.info("Avg Counts: %0.4f", np.mean(func_counts)) + all_ranks.extend(ranks) + all_funcs.extend(func_counts) + logger.info("Top-K %s", target_key) + logger.info("Avg Rank: %0.4f", np.mean(all_ranks)) + logger.info("Std Rank: %0.4f", np.std(all_ranks)) + logger.info("Prec Top 1: %0.4f", pre_k(all_ranks,1)) + logger.info("Prec Top 10: %0.4f", pre_k(all_ranks,10)) + logger.info("Prec Top 100: %0.4f", pre_k(all_ranks,100)) + logger.info("Avg Counts: %0.4f", np.mean(all_funcs)) + + + + + + +if __name__ == "__main__": + op = OptionParser() + op.add_option( + "--config", + action="store", + dest="config", + help="give config file (ex) config/config_default.yml", + ) + op.add_option( + "--input_list", + type="str", + action="store", + dest="input_list", + help="a file containing a list of input binaries", + ) + op.add_option( + "--train_funcs_limit", + type="int", + action="store", + dest="train_funcs_limit", + default=200000, + help="a number to limit the number of functions in training", + ) + (opts, args) = op.parse_args() + + if not opts.config: + op.print_help() + exit(1) + + do_top_k(opts) diff --git a/requirements.txt b/requirements.txt index 14887ba..15ddc06 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,9 @@ -numpy==1.19.4 +matplotlib==3.4.2 capstone==4.0.0 -coloredlogs==6.0 -networkx==2.5 +numpy==1.19.4 python_ctags3==1.5.0 -PyYAML==5.3.1 -scikit_learn==0.23.2 +networkx==2.5 +coloredlogs==6.0 +pyelftools==0.27 +PyYAML==5.4.1 +scikit_learn==0.24.2 diff --git a/tiknib/debug/functype.py b/tiknib/debug/functype.py index b88fe89..6d53f92 100644 --- a/tiknib/debug/functype.py +++ b/tiknib/debug/functype.py @@ -3,7 +3,7 @@ import ctags from ctags import CTags, TagEntry -from tiknib.utils import system, do_multiprocess +from tiknib.utils import system import logging @@ -159,7 +159,10 @@ def update_type_map(type_map, ctags_fname): status = tag.first(entry) while status: name = entry["name"].decode() - kind = entry["kind"].decode() + try: + kind = entry["kind"].decode() + except: + import pdb; pdb.set_trace() typeref = (entry[b"typeref"] or b"").decode() pattern = entry["pattern"].decode() @@ -254,17 +257,18 @@ def create_ctags(source_list, ctags_dir): with open(source_list, "r") as f: lines = f.read().splitlines() + # TODO: extract only dependent source files with "gcc -M" for dir_name in lines: basename = os.path.basename(dir_name.strip()) if os.path.exists(os.path.join(ctags_dir, basename + ".tags")): continue - cmd = 'ctags -f "{0}/{1}.tags" --fields=afmikKlnsStz -R "{2}"' + cmd = 'ctags -f "{0}/{1}.tags" --languages=c,c++ --c-kinds=+p --c++-kinds=+p --fields=afmikKlnsStz --extra=+q -R "{2}"' cmd = cmd.format(ctags_dir, basename, dir_name) system(cmd) if not os.path.exists(os.path.join(ctags_dir, "include.tags")): - cmd = 'ctags -f "{0}/include.tags" --fields=afmikKlnsStz -R "{1}"' + cmd = 'ctags -f "{0}/include.tags" --languages=c,c++ --c-kinds=+p --c++-kinds=+p --fields=afmikKlnsStz --extra=+q -R "{1}"' cmd = cmd.format(ctags_dir, "/usr/include/") system(cmd) diff --git a/tiknib/debug/lineno.py b/tiknib/debug/lineno.py new file mode 100644 index 0000000..d0d7273 --- /dev/null +++ b/tiknib/debug/lineno.py @@ -0,0 +1,55 @@ +import os +import re +import pickle + +from elftools.elf.elffile import ELFFile + + +# Slightly modified below code: +# https://github.com/eliben/pyelftools/blob/master/examples/dwarf_decode_address.py +def decode_file_line(dwarfinfo, func_addrs): + # Go over all the line programs in the DWARF information. + ret = {} + for CU in dwarfinfo.iter_CUs(): + # Look at line programs to find the file/line for the address + lineprog = dwarfinfo.line_program_for_CU(CU) + for entry in lineprog.get_entries(): + if entry.state is None: + continue + if entry.state.end_sequence: + continue + # We check if an address is in the given set of function addresses. + cur_state = entry.state + if cur_state.address not in func_addrs: + continue + + file_name = b"" + try: + file_name = lineprog["file_entry"][cur_state.file - 1].name + # To obtain full path + dir_name = CU.get_top_DIE().attributes["DW_AT_comp_dir"].value + path_name = CU.get_top_DIE().attributes["DW_AT_name"].value + file_name = os.path.join(dir_name, path_name) + except: + pass + + if isinstance(file_name, bytes): + file_name = file_name.decode() + + line = cur_state.line + ret[cur_state.address] = (file_name, line) + + return ret + + +def fetch_lineno(bin_name, func_addrs): + addr_to_line = {} + with open(bin_name, "rb") as f: + elffile = ELFFile(f) + if not elffile.has_dwarf_info(): + print("No Dwarf Found in ", bin_name) + else: + dwarf = elffile.get_dwarf_info() + addr_to_line = decode_file_line(dwarf, func_addrs) + + return addr_to_line diff --git a/tiknib/feature/data.py b/tiknib/feature/data.py index e9602f6..d1e4cd3 100644 --- a/tiknib/feature/data.py +++ b/tiknib/feature/data.py @@ -52,5 +52,5 @@ def make_abstract_number(s): if len(PRIMES) < len(s) - 1: PRIME_MAX *= 100 PRIMES = gen_primes(PRIME_MAX) - return make_number(s) + return make_abstract_number(s) return PRIMES[len(s) - 1].item(0) diff --git a/tiknib/ida/fetch_funcdata_v7.5.py b/tiknib/ida/fetch_funcdata_v7.5.py index 8432df0..aee5437 100644 --- a/tiknib/ida/fetch_funcdata_v7.5.py +++ b/tiknib/ida/fetch_funcdata_v7.5.py @@ -179,7 +179,10 @@ def main(): imported_callees = [] if func_name in callee_map: imported_callees = list( - filter(lambda x: get_segm_name(x[1]) != get_segm_name(addr), callee_map[func_name]) + filter( + lambda x: get_segm_name(x[1]) != get_segm_name(addr), + callee_map[func_name], + ) ) # Get type information from IDA diff --git a/tiknib/idascript.py b/tiknib/idascript.py index 0911910..a4574ef 100644 --- a/tiknib/idascript.py +++ b/tiknib/idascript.py @@ -99,10 +99,10 @@ def run_helper(self, input_fname): # >= IDA Pro v7.4 use "idat" instead of "idal" if not os.path.exists(ida): - ida = ida.replace('idal', 'idat') + ida = ida.replace("idal", "idat") # Setup command line arguments - path = [ida, "-A", "-S{}".format(idc_args)] + path = [ida, "-A", '-S"{}"'.format(idc_args)] if self.log or self.stdout: fd, tmp_fname = tempfile.mkstemp() os.close(fd) diff --git a/tiknib/utils.py b/tiknib/utils.py index 1e500c2..b05f0da 100644 --- a/tiknib/utils.py +++ b/tiknib/utils.py @@ -44,6 +44,15 @@ def parse_fname(bin_path): return matches +def parse_source_path(src_path): + matches = re.search(RESTR, src_path) + if not matches: + return "" + src_file = matches.groups()[-1] + src_file = src_file[src_file.index('/')+1:] + return os.path.relpath(src_file) + + # statistics mean function cannot handle the empty list def mean(l): return stat_mean(l or [0]) @@ -304,15 +313,15 @@ def init_idc(): # Belows are functions for processing function data -def load_func_data(bin_name): - data_name = bin_name + ".pickle" +def load_func_data(bin_name, suffix=""): + data_name = bin_name + suffix + ".pickle" with open(data_name, "rb") as f: func_data_list = pickle.load(f) return bin_name, func_data_list -def store_func_data(bin_name, func_data_list): - data_name = bin_name + ".pickle" +def store_func_data(bin_name, func_data_list, suffix=""): + data_name = bin_name + suffix + ".pickle" with open(data_name, "wb") as f: pickle.dump(func_data_list, f)