From: Paul Floyd Date: Tue, 26 Aug 2025 06:42:56 +0000 (+0200) Subject: FreeBSD 64bit: client stack changes X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8afbe743fadde2126848656f48a8236232c93f3b;p=thirdparty%2Fvalgrind.git FreeBSD 64bit: client stack changes Just use system max stack size, but with a lower limit of 64Mb Add some -d -d traces --- diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index 4e5efaafe..785d75c70 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -1735,17 +1735,29 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) suggested_clstack_end = aspacem_maxAddr - 64*1024*1024UL + VKI_PAGE_SIZE; #else - //suggested_clstack_end = aspacem_maxAddr; - // this block implements what is described above - // note this needs - // #include "pub_core_libcproc.h" + SizeT kern_maxssiz; - SizeT kern_sgrowsiz; + //SizeT kern_sgrowsiz; SizeT sysctl_size = sizeof(SizeT); VG_(sysctlbyname)("kern.maxssiz", &kern_maxssiz, &sysctl_size, NULL, 0); - VG_(sysctlbyname)("kern.sgrowsiz", &kern_sgrowsiz, &sysctl_size, NULL, 0); - //VG_(printf)("maxssiz %lx\n", kern_maxssiz); - suggested_clstack_end = aspacem_maxAddr - (kern_maxssiz - kern_sgrowsiz) + VKI_PAGE_SIZE; + if (kern_maxssiz < 64*1024*1024UL) { + kern_maxssiz = 64*1024*1024UL; + VG_(debugLog)(2, "aspacem", + " max stack size (maxssiz) set to lower limit, 64Mb\n"); + } + //VG_(sysctlbyname)("kern.sgrowsiz", &kern_sgrowsiz, &sysctl_size, NULL, 0); + // initially this was aspacem_maxAddr - (kern_maxssiz - kern_sgrowsiz) + VKI_PAGE_SIZE + // but we're not using / respecting the stack grow size (yet) + suggested_clstack_end = aspacem_maxAddr - (kern_maxssiz) + VKI_PAGE_SIZE; + VG_(debugLog)(2, "aspacem", + " max stack size (maxssiz) = 0x%lx\n", + kern_maxssiz); + //VG_(debugLog)(2, "aspacem", + // " stack grow size (sgrowsiz) = 0x%lx\n", + // kern_sgrowsiz); + VG_(debugLog)(2, "aspacem", + " suggested client stack end (aspacem_maxAddr - (kern_maxssiz) + VKI_PAGE_SIZE) = 0x%lx\n", + suggested_clstack_end); #endif