Commit 53e1dbbd authored by Sebastian Brzezinka's avatar Sebastian Brzezinka Committed by Jim Harris
Browse files

llvm/nvmf: supress false memory leak of `qpair_ctx` and `ctrlr`



This behavior is only reproducible during fuzzing test, probably due
to asynchronous nature of `spdk_nvmf_qpair_disconnect` and
`nvmf_ctrlr_create`. It was verified that there is no real memory leak.

Fixes issue #3285.

Change-Id: I94129bb0cbb63e4d5f7c96ae856d0a398f812f33
Signed-off-by: default avatarSebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22713


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 1b8d54c0
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -25,10 +25,11 @@ function start_llvm_fuzz() {
	local core=$3
	local corpus_dir=$rootdir/../corpus/llvm_nvmf_$fuzzer_type
	local nvmf_cfg=/tmp/fuzz_json_$fuzzer_type.conf
	local suppress_file="/var/tmp/suppress_nvmf_fuzz"

	# set LSAN_OPTIONS to "report_objects=1" to let the LLVM fuzzer report an address of
	# leaked memory object
	local LSAN_OPTIONS=report_objects=1
	local LSAN_OPTIONS=report_objects=1:suppressions="$suppress_file":print_suppressions=0

	port="44$(printf "%02d" $fuzzer_type)"
	mkdir -p $corpus_dir
@@ -36,6 +37,10 @@ function start_llvm_fuzz() {
	trid="trtype:tcp adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode1 traddr:127.0.0.1 trsvcid:$port"
	sed -e "s/\"trsvcid\": \"4420\"/\"trsvcid\": \"$port\"/" $testdir/fuzz_json.conf > $nvmf_cfg

	# Suppress false memory leaks reported by LSan
	echo "leak:spdk_nvmf_qpair_disconnect" > "$suppress_file"
	echo "leak:nvmf_ctrlr_create" >> "$suppress_file"

	$rootdir/test/app/fuzz/llvm_nvme_fuzz/llvm_nvme_fuzz \
		-m $core \
		-s $mem_size \
@@ -46,7 +51,7 @@ function start_llvm_fuzz() {
		-D $corpus_dir \
		-Z $fuzzer_type

	rm -rf $nvmf_cfg
	rm -rf $nvmf_cfg $suppress_file
}

testdir=$(readlink -f $(dirname $0))
@@ -59,7 +64,7 @@ fuzzfile=$rootdir/test/app/fuzz/llvm_nvme_fuzz/llvm_nvme_fuzz.c
fuzz_num=$(($(grep -c "\.fn =" $fuzzfile) - 1))
((fuzz_num != 0))

trap 'cleanup /tmp/llvm_fuzz*; exit 1' SIGINT SIGTERM EXIT
trap 'cleanup /tmp/llvm_fuzz* /var/tmp/suppress_nvmf_fuzz; exit 1' SIGINT SIGTERM EXIT

mem_size=512
if [[ $SPDK_TEST_FUZZER_SHORT -eq 1 ]]; then