Commit 9d04d0ef authored by Jim Harris's avatar Jim Harris
Browse files

env_dpdk: pick base-virtaddr that ASAN won't override

ASAN has some memory address regions that it will not
allow applications to use for mappings (including mmap).
So when specifying --base-virtaddr to DPDK for
shared/mutli-process mappings, pick an address that
ASAN will allow the application to map.

Ref: https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm



We will still disable ASLR while using the test stub for now.
Maybe we can eliminate this too in the future, but for now just
modify the autotest_common.sh comment since we've figured out
how to keep ASAN from messing with the mmap hint.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ie24fd35bd22aa3ceab6271e8936775b157e5c330
Reviewed-on: https://review.gerrithub.io/416420


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
parent f3001308
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -280,8 +280,13 @@ spdk_build_eal_cmdline(const struct spdk_env_opts *opts)
			return -1;
		}

		/* set the base virtual address */
		args = spdk_push_arg(args, &argcount, _sprintf_alloc("--base-virtaddr=0x1000000000"));
		/* Set the base virtual address - it must be an address that is not in the
		 * ASAN shadow region, otherwise ASAN-enabled builds will ignore the
		 * mmap hint.
		 *
		 * Ref: https://github.com/google/sanitizers/wiki/AddressSanitizerAlgorithm
		 */
		args = spdk_push_arg(args, &argcount, _sprintf_alloc("--base-virtaddr=0x200000000000"));
		if (args == NULL) {
			return -1;
		}
+2 −3
Original line number Diff line number Diff line
@@ -367,9 +367,8 @@ function rbd_cleanup() {

function start_stub() {
	# Disable ASLR for multi-process testing.  SPDK does support using DPDK multi-process,
	# but ASAN instrumentation will result in mmap hints in our specified virt address
	# region getting ignored.   We will reenable it again after multi-process testing
	# is complete in kill_stub()
	# but ASLR can still be unreliable in some cases.
	# We will reenable it again after multi-process testing is complete in kill_stub()
	echo 0 > /proc/sys/kernel/randomize_va_space
	$rootdir/test/app/stub/stub $1 &
	stubpid=$!