README.md
1# Fuzzers for liblp
2## Table of contents
3+ [liblp_builder_fuzzer](#Builder)
4+ [liblp_super_layout_builder_fuzzer](#SuperBuilder)
5+ [liblp_apis_fuzzer](#APIs)
6
7# <a name="Builder"></a> Fuzzer for LiblpBuilder
8
9LiblpBuilder supports the following parameters:
101. kAttributeTypes (parameter name: "attribute")
112. blockDevSize (parameter name: "blockdev_size")
123. metadataMaxSize (parameter name: "metadata_max_size")
134. metadataSlotCount (parameter name: "metadata_slot_count")
145. partitionName (parameter name: "partition_name")
156. superBlockDeviceName (parameter name: "block_device_name")
167. blockDeviceInfoSize (parameter name: "block_device_info_size")
178. alignment (parameter name: "alignment")
189. alignmentOffset (parameter name: "alignment_offset")
1910. logicalBlockSize (parameter name: "logical_block_size")
2011. maxMetadataSize (parameter name: "max_metadata_size")
2112. deviceIndex (parameter name: "device_index")
2213. start (parameter name: "start")
2314. end (parameter name: "end")
2415. addedGroupName (parameter name: "group_name")
2516. partitionGroupName (parameter name: "partition_name")
2617. numSectors (parameter name: "num_sectors")
2718. physicalSector (parameter name: "physical_sector")
2819. resizedPartitionSize (parameter name: "requested_size")
29
30| Parameter| Valid Values| Configured Value|
31|------------- |-------------| ----- |
32|`kAttributeTypes`| 1.`LP_PARTITION_ATTR_NONE`,<br/> 2.`LP_PARTITION_ATTR_READONLY`,<br/> 3.`LP_PARTITION_ATTR_SLOT_SUFFIXED`,<br/> 4.`LP_PARTITION_ATTR_UPDATED`,<br/> 5.`LP_PARTITION_ATTR_DISABLED`|Value obtained from FuzzedDataProvider|
33|`blockDevSize`| Integer value from `0` to `100000`|Value obtained from FuzzedDataProvider|
34|`metadataMaxSize`| Integer value from `0` to `10000` |Value obtained from FuzzedDataProvider|
35|`metadataSlotCount`| Integer value from `0` to `2` |Value obtained from FuzzedDataProvider|
36|`partitionName`| String |Value obtained from FuzzedDataProvider|
37|`superBlockDeviceName`| String |Value obtained from FuzzedDataProvider|
38|`blockDeviceInfoSize`| Integer |Value obtained from FuzzedDataProvider|
39|`alignment`| Integer |Value obtained from FuzzedDataProvider|
40|`alignmentOffset`| Integer |Value obtained from FuzzedDataProvider|
41|`logicalBlockSize`| Integer |Value obtained from FuzzedDataProvider|
42|`maxMetadataSize`| Integer value from `0` to `10000` |Value obtained from FuzzedDataProvider|
43|`deviceIndex`| Integer |Value obtained from FuzzedDataProvider|
44|`start`| Integer |Value obtained from FuzzedDataProvider|
45|`end`| Integer |Value obtained from FuzzedDataProvider|
46|`partitionGroupName`| String |Value obtained from FuzzedDataProvider|
47|`numSectors`| Integer value from `1` to `1000000` |Value obtained from FuzzedDataProvider|
48|`physicalSector`| Integer value from `1` to `1000000` |Value obtained from FuzzedDataProvider|
49|`resizedPartitionSize`| Integer value from `0` to `10000` |Value obtained from FuzzedDataProvider|
50
51#### Steps to run
521. Build the fuzzer
53```
54 $ mm -j$(nproc) liblp_builder_fuzzer
55```
562. Run on device
57```
58 $ adb sync data
59 $ adb shell /data/fuzz/arm64/liblp_builder_fuzzer/liblp_builder_fuzzer
60```
61
62# <a name="SuperBuilder"></a> Fuzzer for LiblpSuperLayoutBuilder
63
64SuperLayoutBuilder supports the following parameters:
651. kAttributeTypes (parameter name: "attribute")
662. blockDevSize (parameter name: "blockdev_size")
673. metadataMaxSize (parameter name: "metadata_max_size")
684. partitionName (parameter name: "partition_name")
695. data (parameter name: "data")
706. imageName (parameter name: "image_name")
71
72| Parameter| Valid Values| Configured Value|
73|------------- |-------------| ----- |
74|`kAttributeTypes`| 1.`LP_PARTITION_ATTR_NONE`,<br/> 2.`LP_PARTITION_ATTR_READONLY`,<br/> 3.`LP_PARTITION_ATTR_SLOT_SUFFIXED`,<br/> 4.`LP_PARTITION_ATTR_UPDATED`,<br/> 5.`LP_PARTITION_ATTR_DISABLED`|Value obtained from FuzzedDataProvider|
75|`blockDevSize`| Integer value from `0` to `100000`|Value obtained from FuzzedDataProvider|
76|`metadataMaxSize`| Integer value from `0` to `10000` |Value obtained from FuzzedDataProvider|
77|`partitionName`| String |Value obtained from FuzzedDataProvider|
78|`data`| String |Value obtained from FuzzedDataProvider|
79|`imageName`| String |Value obtained from FuzzedDataProvider|
80
81#### Steps to run
821. Build the fuzzer
83```
84 $ mm -j$(nproc) liblp_super_layout_builder_fuzzer
85```
862. Run on device
87```
88 $ adb sync data
89 $ adb shell /data/fuzz/arm64/liblp_super_layout_builder_fuzzer/liblp_super_layout_builder_fuzzer
90```
91
92# <a name="APIs"></a> Fuzzer for LiblpApis
93
94LiblpAPIs supports the following parameters:
951. blockDeviceInfoSize (parameter name: "block_device_info_size")
962. alignment (parameter name: "alignment")
973. alignmentOffset (parameter name: "alignment_offset")
984. logicalBlockSize (parameter name: "logical_block_size")
995. blockDevSize (parameter name: "blockdev_size")
1006. metadataMaxSize (parameter name: "metadata_max_size")
1017. blockDeviceInfoName (parameter name: "block_device_info_name")
1028. numSectors (parameter name: "num_sectors")
1039. physicalSector (parameter name: "physical_sector")
10410. sparsify (parameter name: "sparsify")
10511. buffer (parameter name: "data")
106
107| Parameter| Valid Values| Configured Value|
108|------------- |-------------| ----- |
109|`blockDeviceInfoSize`| Integer |Value obtained from FuzzedDataProvider|
110|`alignment`| Integer |Value obtained from FuzzedDataProvider|
111|`alignmentOffset`| Integer |Value obtained from FuzzedDataProvider|
112|`logicalBlockSize`| Integer |Value obtained from FuzzedDataProvider|
113|`blockDevSize`| Integer value in multiples of `LP_SECTOR_SIZE`|Value obtained from FuzzedDataProvider|
114|`metadataMaxSize`| Integer value from `0` to `10000` |Value obtained from FuzzedDataProvider|
115|`blockDeviceInfoName`| String |Value obtained from FuzzedDataProvider|
116|`numSectors`| Integer value from `1` to `1000000` |Value obtained from FuzzedDataProvider|
117|`physicalSector`| Integer value from `1` to `1000000` |Value obtained from FuzzedDataProvider|
118|`alignment`| Bool |Value obtained from FuzzedDataProvider|
119|`alignment`| Vector |Value obtained from FuzzedDataProvider|
120
121#### Steps to run
1221. Build the fuzzer
123```
124 $ mm -j$(nproc) liblp_apis_fuzzer
125```
1262. Run on device
127```
128 $ adb sync data
129 $ adb shell /data/fuzz/arm64/liblp_apis_fuzzer/liblp_apis_fuzzer
130```
131