From: Paul Floyd Date: Wed, 28 Feb 2024 21:00:37 +0000 (+0100) Subject: Comment: explain why v.info location no longer detects stack guard pages on FreeBSD X-Git-Tag: VALGRIND_3_23_0~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1e7eac63534f9b0a7d68383cb45725cb40bee16;p=thirdparty%2Fvalgrind.git Comment: explain why v.info location no longer detects stack guard pages on FreeBSD Workaround: sysctl security.bsd.stack_guard_page=0 --- diff --git a/coregrind/m_addrinfo.c b/coregrind/m_addrinfo.c index 1796eb815..0d4624dbb 100644 --- a/coregrind/m_addrinfo.c +++ b/coregrind/m_addrinfo.c @@ -241,6 +241,19 @@ void VG_(describe_addr) ( DiEpoch ep, Addr a, /*OUT*/AddrInfo* ai ) if (tid != VG_INVALID_THREADID) stackPos = StackPos_guard_page; } + /* + * On FreeBSD the above heuristic fails since version 14.0 + * + * I think that is because of a bug or at least a misfeature + * in the way that the kernel grows mmap'd MAP_STACK memory + * See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277382 + * + * I could add a lot of ugliness like + * "if the address is RW and sysctl security.bsd.stack_guard_page + * times the page size is PROT_NONE then it's a wonky guard page" + * + * Naaah. + */ } if (tid != VG_INVALID_THREADID) {