Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding shell script for oss-fuzz support. #5

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions oss-fuzz/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash -eu
export CLANG_PATH=/usr/local/bin
export ASAN_SYMBOLIZER_PATH=/usr/local/bin/llvm-symbolizer
export PACKAGES_PATH="$SRC/hbfa-fl/HBFA:$SRC/edk2"
antoniogi marked this conversation as resolved.
Show resolved Hide resolved
export EDK_TOOLS_PATH="$SRC/edk2/BaseTools"
export CONF_PATH="$SRC/edk2/Conf"
export PYTHON_COMMAND=/usr/local/bin/python
el-tipton marked this conversation as resolved.
Show resolved Hide resolved
export WORKSPACE=$WORK

build_fuzzer() {
fuzzer=$1
inf=$2
seed=${3:-""}

if [ ! -z $seed ]; then
zip -j $OUT/${fuzzer}_seed_corpus.zip ${seed}/*
fi

python $SRC/hbfa-fl/HBFA/UefiHostTestTools/RunLibFuzzer.py -c manual -a X64 \
-m $inf \
-o $WORK

cp $WORK/Build/UefiHostFuzzTestCasePkg/DEBUG_LIBFUZZER/X64/$fuzzer $OUT
}

cd $SRC/edk2
make -C BaseTools
source edksetup.sh
cd ..
python $SRC/hbfa-fl/HBFA/UefiHostTestTools/HBFAEnvSetup.py

cp $SRC/hbfa-fl/HBFA/UefiHostFuzzTestPkg/Conf/build_rule.txt $SRC/edk2/Conf/build_rule.txt
cp $SRC/hbfa-fl/HBFA/UefiHostFuzzTestPkg/Conf/tools_def.txt $SRC/edk2/Conf/tools_def.txt
cp $SRC/*.options $OUT

build_fuzzer "TestBmpSupportLib" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/MdeModulePkg/Library/BaseBmpSupportLib/TestBmpSupportLib.inf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/Seed/BMP/Raw"

build_fuzzer "TestTpm2CommandLib" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/SecurityPkg/Library/Tpm2CommandLib/TestTpm2CommandLib.inf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/Seed/TPM/Raw"

build_fuzzer "TestPartition" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/MdeModulePkg/Universal/Disk/PartitionDxe/TestPartition.inf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/Seed/UDF/Raw/Partition"

build_fuzzer "TestUdf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/MdeModulePkg/Universal/Disk/UdfDxe/TestUdf.inf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/Seed/UDF/Raw/FileSystem"

build_fuzzer "TestPeiUsb" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/MdeModulePkg/Bus/Usb/UsbBusPei/TestPeiUsb.inf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/Seed/UDF/Raw/FileSystem"

build_fuzzer "TestFmpAuthenticationLibPkcs7" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/SecurityPkg/Library/FmpAuthenticationLibPkcs7/TestFmpAuthenticationLibPkcs7.inf"

build_fuzzer "TestFmpAuthenticationLibRsa2048Sha256" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/SecurityPkg/Library/FmpAuthenticationLibRsa2048Sha256/TestFmpAuthenticationLibRsa2048Sha256.inf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/Seed/Capsule"

build_fuzzer "TestCapsulePei" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/MdeModulePkg/Universal/CapsulePei/Common/TestCapsulePei.inf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/Seed/Capsule"

build_fuzzer "TestFileName" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/MdeModulePkg/Universal/Disk/UdfDxe/TestFileName.inf" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/Seed/UDF/Raw/FileName"

build_fuzzer "TestVirtio10Blk" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/OvmfPkg/Virtio10BlkDxe/TestVirtio10Blk.inf"

build_fuzzer "TestVirtioBlk" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/OvmfPkg/VirtioBlkDxe/TestVirtioBlk.inf"

build_fuzzer "TestVirtioPciDevice" \
"$SRC/hbfa-fl/HBFA/UefiHostFuzzTestCasePkg/TestCase/OvmfPkg/VirtioPciDeviceDxe/TestVirtioPciDevice.inf"