Mailing List Archive

[master] fa69f349e ... and as I expected, that hack breaks on all sorts of other systems, so #ifdef __FreeBSD__, which is OK, since the intent is just to get VTEST code coverage.
commit fa69f349ef7e423573e0b60d2d9447108526daf8
Author: Poul-Henning Kamp <phk@FreeBSD.org>
Date: Wed May 4 07:22:50 2022 +0000

... and as I expected, that hack breaks on all sorts of other systems,
so #ifdef __FreeBSD__, which is OK, since the intent is just to get
VTEST code coverage.

diff --git a/bin/varnishd/storage/mgt_storage_persistent.c b/bin/varnishd/storage/mgt_storage_persistent.c
index 22c58ab19..fdd4419c8 100644
--- a/bin/varnishd/storage/mgt_storage_persistent.c
+++ b/bin/varnishd/storage/mgt_storage_persistent.c
@@ -144,7 +144,6 @@ smp_mgt_init(struct stevedore *parent, int ac, char * const *av)
struct smp_sign sgn;
void *target;
int i, mmap_flags;
- uintptr_t up;

ASSERT_MGT();

@@ -213,6 +212,7 @@ smp_mgt_init(struct stevedore *parent, int ac, char * const *av)
mmap_flags |= MAP_EXCL;
#endif
} else {
+#ifdef __FreeBSD__
/*
* I guess the people who came up with ASLR never learned
* that virtual memory can have benficial uses, because they
@@ -222,11 +222,13 @@ smp_mgt_init(struct stevedore *parent, int ac, char * const *av)
* can get away with just hacking something up: 16M below
* the break seems to work on FreeBSD.
*/
+ uintptr_t up;
up = (uintptr_t)sbrk(0);
up -= 1ULL<<24;
up -= sc->mediasize;
up &= ~(getpagesize() - 1ULL);
target = (void *)up;
+#endif

#ifdef MAP_ALIGNED_SUPER
mmap_flags |= MAP_ALIGNED_SUPER;
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit