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: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie24fd35bd22aa3ceab6271e8936775b157e5c330
Reviewed-on: https://review.gerrithub.io/416420
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This commit is contained in:
Jim Harris 2018-06-21 01:15:17 -07:00
parent f300130872
commit 9d04d0efd5
2 changed files with 9 additions and 5 deletions

View File

@ -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;
}

View File

@ -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=$!