[master] c2799eb4c varnishtest: Give disable_aslr a normal treatment

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Wed Jun 2 06:30:10 UTC 2021


commit c2799eb4ce38a13d0eee536afa38a2f849e7e83c
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Wed Jun 2 08:27:37 2021 +0200

    varnishtest: Give disable_aslr a normal treatment
    
    Only the special cases get special handling.

diff --git a/bin/varnishtest/vtc_misc.c b/bin/varnishtest/vtc_misc.c
index a46254246..59c226e52 100644
--- a/bin/varnishtest/vtc_misc.c
+++ b/bin/varnishtest/vtc_misc.c
@@ -387,6 +387,20 @@ ipvx_works(const char *target)
 	return (0);
 }
 
+/**********************************************************************/
+
+static int
+addr_no_randomize_works(void)
+{
+	int r = 0;
+
+#ifdef HAVE_SYS_PERSONALITY_H
+	r = personality(0xffffffff);
+	r = personality(r | ADDR_NO_RANDOMIZE);
+#endif
+	return (r >= 0);
+}
+
 /* SECTION: feature feature
  *
  * Test that the required feature(s) for a test are available, and skip
@@ -488,6 +502,7 @@ cmd_feature(CMD_ARGS)
 		FEATURE("ipv6", ipvx_works("[::1]"));
 		FEATURE("pcre_jit", VRE_has_jit);
 		FEATURE("64bit", sizeof(void*) == 8);
+		FEATURE("disable_aslr", addr_no_randomize_works());
 		FEATURE("dns", dns_works());
 		FEATURE("topbuild", iflg);
 		FEATURE("root", !geteuid());
@@ -498,16 +513,7 @@ cmd_feature(CMD_ARGS)
 		FEATURE("sanitizer", sanitizer);
 		FEATURE("SO_RCVTIMEO_WORKS", so_rcvtimeo_works);
 
-		if (!strcmp(feat, "disable_aslr")) {
-			good = 1;
-			skip = neg;
-#ifdef HAVE_SYS_PERSONALITY_H
-			r = personality(0xffffffff);
-			r = personality(r | ADDR_NO_RANDOMIZE);
-			if (r < 0)
-				skip = !neg;
-#endif
-		} else if (!strcmp(feat, "cmd")) {
+		if (!strcmp(feat, "cmd")) {
 			good = 1;
 			skip = neg;
 			av++;


More information about the varnish-commit mailing list