From: Paul Floyd Date: Mon, 25 Aug 2025 19:48:53 +0000 (+0200) Subject: FreeBSD: fix guest stack creation for self-hosting X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a528bccf165c448ce10ecbf40d1c017373f4c3a6;p=thirdparty%2Fvalgrind.git FreeBSD: fix guest stack creation for self-hosting See https://bugs.kde.org/show_bug.cgi?id=508638 Not fully resolved, making progress. --- diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index bae4f781a..4e5efaafe 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -1726,19 +1726,6 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) // so we can't use these syscalls. Maybe one day when all supported platforms // have them. -#if 0 - // this block implements what is described above - // note this needs - // #include "pub_core_libcproc.h" - SizeT kern_maxssiz; - 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; -#endif - // on amd64 we have oodles of space and just shove the new stack somewhere out of the way // x86 is far more constrained, and we put the new stack just below the stack passed in to V // except that it has stack space and the growth stack guard below it as decribed above @@ -1748,7 +1735,18 @@ 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; + //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 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; + #endif // --- Solaris ------------------------------------------