Commit 85eff555 authored by Marcin Spiewak's avatar Marcin Spiewak Committed by Tomasz Zawadzki
Browse files

fuzzer: enable reporting address of leaked memory



This patch turns on reporting of the address of leaked
memory object, when a leak sanitizer is detecting a memory
leak during fuzz tests. This is done by setting
LSAN_OPTIONS vaiable to 'report_objects=1'

Can be used to verify if the leaked object is really
a leak, or during memory leak debugging.
Example output:

  Objects leaked above:
  0x60700000a820 (72 bytes)

  SUMMARY: AddressSanitizer: 72 byte(s) leaked in 1 allocation(s).

If 'report_objects' is not enabled, the address of leaked object
is not provided (only the size is reported)

Change-Id: I0d59ff82096b64ed17fb89e369b439c9f565f500
Signed-off-by: default avatarMarcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/21896


Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarSebastian Brzezinka <sebastian.brzezinka@intel.com>
parent daa0cebd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ function start_llvm_fuzz() {
	local corpus_dir=$rootdir/../corpus/llvm_nvmf_$fuzzer_type
	local nvmf_cfg=/tmp/fuzz_json_$fuzzer_type.conf

	# 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

	port="44$(printf "%02d" $fuzzer_type)"
	mkdir -p $corpus_dir

+4 −0
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@ function start_llvm_fuzz() {
	local vfiouser_io_dir=$fuzzer_dir/domain/2
	local vfiouser_cfg=$fuzzer_dir/fuzz_vfio_json.conf

	# 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

	mkdir -p $fuzzer_dir $vfiouser_dir $vfiouser_io_dir $corpus_dir

	# Adjust paths to allow multiply instance of fuzzer