[master] 4b89323 Add a "disable_aslr" feature and use it for troublesome r00962

Poul-Henning Kamp phk at FreeBSD.org
Sat Nov 26 00:58:05 CET 2016


commit 4b89323c79bb054fa5cd4aa4ab2823523f04a0de
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri Nov 25 23:56:17 2016 +0000

    Add a "disable_aslr" feature and use it for troublesome r00962
    
    There is now similar logic in varnishd, but by then it may be
    too late already, but that still improves chances for the users.

diff --git a/bin/varnishtest/tests/r00962.vtc b/bin/varnishtest/tests/r00962.vtc
index 4d0ec7e..bff9498 100644
--- a/bin/varnishtest/tests/r00962.vtc
+++ b/bin/varnishtest/tests/r00962.vtc
@@ -1,5 +1,7 @@
 varnishtest "Test address remapping"
 
+feature disable_aslr
+
 # VM-remapping is too random on OSX
 feature	!OSX
 # Same on some hardened Linux
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index 7c24d99..7d2219e 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -50,6 +50,10 @@
 #include "vre.h"
 #include "vtim.h"
 
+#ifdef HAVE_SYS_PERSONALITY_H
+#  include <sys/personality.h>
+#endif
+
 #define		MAX_TOKENS		200
 
 volatile sig_atomic_t	vtc_error;	/* Error encountered */
@@ -612,7 +616,17 @@ cmd_feature(CMD_ARGS)
 		FEATURE("user_vcache", getpwnam("vcache") != NULL);
 		FEATURE("group_varnish", getgrnam("varnish") != NULL);
 
-		if (!strcmp(*av, "cmd")) {
+		if (!strcmp(*av, "disable_aslr")) {
+			good = 1;
+#ifdef HAVE_SYS_PERSONALITY_H
+			r = personality(0xffffffff);
+			r = personality(r | ADDR_NO_RANDOMIZE);
+			if (r < 0) {
+				good = 0;
+				vtc_stop = 1;
+			}
+#endif
+		} else if (!strcmp(*av, "cmd")) {
 			av++;
 			if (*av == NULL) {
 				vtc_log(vl, 0, "Missing the command-line");



More information about the varnish-commit mailing list