]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD: fix guest stack creation for self-hosting
authorPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 25 Aug 2025 19:48:53 +0000 (21:48 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Mon, 25 Aug 2025 19:48:53 +0000 (21:48 +0200)
See https://bugs.kde.org/show_bug.cgi?id=508638
Not fully resolved, making progress.

coregrind/m_aspacemgr/aspacemgr-linux.c

index bae4f781a82a3c915fb597cd63be04387fa17d61..4e5efaafe50a28e134aa74ff93adc147b32ee044 100644 (file)
@@ -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 ------------------------------------------