saketupadhyay commited on
Commit
7fcbc11
·
verified ·
1 Parent(s): f767073

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +125 -0
README.md CHANGED
@@ -1,3 +1,128 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ task_categories:
4
+ - tabular-classification
5
+ tags:
6
+ - software
7
+ size_categories:
8
+ - 10K<n<100K
9
  ---
10
+
11
+ # FuzzDistill Dataset Explanation
12
+
13
+ The final Basic Block and Function features are extracted in Semicolon-Separated Values (SSV) format.
14
+
15
+ To load in pandas, use -
16
+ ```python
17
+ import pandas as pd
18
+ data = pd.read_csv("FNFeatures.csv", sep=";")
19
+ ```
20
+ Assuming `FNFeatures.csv` is the target feature file.
21
+
22
+ ## Function Features
23
+
24
+ The generated dataset is list of functions with various characteristics and a label indicating whether each function is
25
+ vulnerable or not. The data is structured into 14 columns, which are described below:
26
+
27
+ 1. **Function ID**: A unique identifier for each function.
28
+ 2. **Function Name**: The name of the function.
29
+ 3. **Instructions**: The number of instructions (e.g.,Intermediate Instructions) in the function.
30
+ 4. **BBs** (Basic Blocks): The number of basic blocks in the function. A basic block is a sequence of instructions that
31
+ are executed together without any control flow changes.
32
+ 5. **In-degree**: The number of incoming edges to the function in the call graph, indicating how many other functions
33
+ call this one.
34
+ 6. **Out-degree**: The number of outgoing edges from the function in the call graph, indicating how many other functions
35
+ are called by this one.
36
+ 7. **Num Loops**: The number of loops (e.g., for, while, do-while) present in the function.
37
+ 8. **Static Allocations**: The number of static memory allocations made by the function.
38
+ 9. **Dynamic Allocations**: The number of dynamic memory allocations made by the function (e.g., using `malloc`,
39
+ `realloc`).
40
+ 10. **MemOps** (Memory Operations): The number of memory-related operations performed by the function (e.g., reads,
41
+ writes).
42
+ 11. **CondBranches** (Conditional Branches): The number of conditional branches (e.g., if-else statements) in the
43
+ function.
44
+ 12. **UnCondBranches** (Unconditional Branches): The number of unconditional branches (e.g., jumps, returns) in the
45
+ function.
46
+ 13. **DirectCalls**: The number of direct function calls made by the function.
47
+ 14. **InDirectCalls** (Indirect Calls): The number of indirect function calls made by the function (e.g., through a
48
+ pointer or a table).
49
+ 15. **VULNERABLE**: A binary label indicating whether the function is vulnerable (1) or not (0).
50
+
51
+ ## Basic Block Features
52
+
53
+ Generated Basic Block dataset a collection of basic blocks (BBs) from functions with various characteristics and a label
54
+ indicating whether each block is vulnerable or not. The data is structured into 13 columns, which are described below:
55
+
56
+ 1. **Block ID**: A unique identifier for each basic block.
57
+ 2. **Block Name**: Name of the block with following structure - `BB_<block #>_<demangled parent function>`
58
+ 3. **Instructions**: The number of instructions (e.g., assembly code operations) in the basic block.
59
+ 4. **In-degree**: The number of incoming edges to the basic block in the control flow graph, indicating how many other
60
+ blocks lead to this one.
61
+ 5. **Out-degree**: The number of outgoing edges from the basic block in the control flow graph, indicating how many
62
+ other blocks are reachable from this one.
63
+ 6. **Static Allocations**: The number of static memory allocations made by the basic block.
64
+ 7. **Dynamic Allocations**: The number of dynamic memory allocations made by the basic block (e.g., using `new`,
65
+ `malloc`).
66
+ 8. **MemOps** (Memory Operations): The number of memory-related operations performed by the basic block (e.g., reads,
67
+ writes).
68
+ 9. **CondBranches** (Conditional Branches): The number of conditional branches (e.g., if-else statements) in the basic
69
+ block.
70
+ 10. **UnCondBranches** (Unconditional Branches): The number of unconditional branches (e.g., jumps, returns) in the
71
+ basic block.
72
+ 11. **DirectCalls**: The number of direct function calls made by the basic block.
73
+ 12. **InDirectCalls** (Indirect Calls): The number of indirect function calls made by the basic block (e.g., through a
74
+ pointer or a table).
75
+ 13. **VULNERABLE**: A binary label indicating whether the basic block is vulnerable (1) or not (0).
76
+
77
+ ---
78
+
79
+ ### A Note on Branches in Basic Blocks
80
+
81
+ Conditional branches (CondBranches) and unconditional branches (UnCondBranches) primarily serve as sanity checks and do
82
+ not significantly impact the categorization of Basic Blocks (it might actually harm the accuracy). Let’s analyze the
83
+ possible values of \( N \) (number of conditional branches) and \( M \) (number of unconditional branches).
84
+
85
+ A basic block can contain at most one conditional branch. A conditional branch is typically used to terminate the block
86
+ and transfer control to another location within the code. If there were multiple conditional branches, they would need
87
+ to be combined into a single decision point using logical operators, which would not increase the count of separate
88
+ conditional branches.
89
+
90
+ $$
91
+ \therefore N \in \{0, 1\}
92
+ $$
93
+
94
+ where \( N \) is either \( 0 \) (no conditional branch) or \( 1 \) (one conditional branch).
95
+
96
+ Similarly, a basic block can have at most one unconditional branch. An unconditional branch is typically used to exit
97
+ the block and jump to another location in the code. If there were multiple unconditional branches, they would be
98
+ redundant, as only one of them would be executed.
99
+
100
+ $$
101
+ \therefore M \in \{0, 1\}
102
+ $$
103
+
104
+ where \( M \) is either \( 0 \) (no unconditional branch) or \( 1 \) (one unconditional branch).
105
+
106
+ If a basic block contains a conditional branch (\( N = 1 \)), it is not possible to have an unconditional branch (\( M =
107
+ 0 \)), as the control flow would be determined solely by the conditional branch. Conversely, if a basic block includes
108
+ an unconditional branch (\( M = 1 \)), it is not feasible to have a conditional branch (\( N = 0 \)), as the
109
+ unconditional branch would override any conditional decision.
110
+
111
+ Logically -
112
+
113
+ $$
114
+ N \times M = 0
115
+ $$
116
+
117
+ $$
118
+ (N = 1) \Rightarrow (M = 0)
119
+ $$
120
+
121
+ $$
122
+ (M = 1) \Rightarrow (N = 0)
123
+ $$
124
+
125
+ That means that only one of \( N \) or \( M \) can have the value of \( 1 \) at any given time.
126
+ If \( N \) is set to \( 1 \), \( M \) must be set to \( 0 \), and vice versa.
127
+
128
+ We can use this relationship to check the functionality of our BB compiler pass and sanity of our training dataset.