]> sourceware.org Git - valgrind.git/commitdiff
Auxv user stack for FreeBSD, part 2
authorPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 18 Oct 2022 20:11:32 +0000 (22:11 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Tue, 18 Oct 2022 20:11:32 +0000 (22:11 +0200)
Try to set the stack limit.

coregrind/m_initimg/initimg-freebsd.c
coregrind/m_main.c
coregrind/m_syswrap/syswrap-freebsd.c
coregrind/pub_core_aspacemgr.h
none/tests/freebsd/auxv.c

index 920ed92911222817fbe279f981dbfbc15808f53e..43b88948afc27c6323fada490a4276afa0de3699 100644 (file)
@@ -718,7 +718,7 @@ Addr setup_client_stack( void*  init_sp,
          auxv->u.a_val = VG_(get_usrstack)();
          break;
       case AT_USRSTACKLIM:
-         auxv->a_type = AT_IGNORE;
+         auxv->u.a_val = VG_(get_usrstacklim)();
          break;
 #endif
 
index 200da407fba09a685f172ec0e28ab5ed030b43e6..327a130a80595530a1c53257d69041921d20c1bb 100644 (file)
@@ -3903,12 +3903,18 @@ UWord voucher_mach_msg_set ( UWord arg1 )
 
 #endif
 
-
+#if defined(VGO_freebsd)
 Word VG_(get_usrstack)(void)
 {
    return VG_PGROUNDDN(the_iicii.clstack_end) + VKI_PAGE_SIZE;
 }
 
+Word VG_(get_usrstacklim)(void)
+{
+   return the_iifii.clstack_max_size;
+}
+#endif
+
 
 
 /*--------------------------------------------------------------------*/
index 518eaf087146ceaf75825d93c795fb339bae79fe..0fad6aa8443c374c9d58298d0e971e893a6941b5 100644 (file)
@@ -2022,7 +2022,7 @@ PRE(sys___sysctl)
    /*
     * Special handling cases
     *
-    * 1. kern.userstack
+    * 1. kern.usrstack
     *    This sysctl returns the address of the bottom of the user stack
     *    (that is the highest user stack address, since the stack grows
     *    downwards). Without any special handling this would return the
@@ -2034,7 +2034,7 @@ PRE(sys___sysctl)
     */
    if (SARG2 >= 2 && ML_(safe_to_deref)(name, 2*sizeof(int))) {
       if (name[0] == 1 && name[1] == 33) {
-         // kern.userstack
+         // kern.usrstack
          sysctl_kern_usrstack((SizeT*)ARG3, (SizeT*)ARG4);
          SET_STATUS_Success(0);
       }
index aac2a0a321dc6ef77482463e52ca46a21b17a2c3..1a73ac1a342e4fcfe0bea62d7f97125e9ce37a61 100644 (file)
@@ -384,9 +384,11 @@ extern Bool VG_(am_search_for_new_segment)(Addr *start, SizeT *size,
                                            UInt *prot);
 #endif
 
+#if defined(VGO_freebsd)
 /* For kern.usrstack syscall on FreeBSD */
 extern Word VG_(get_usrstack)(void);
-
+extern Word VG_(get_usrstacklim)(void);
+#endif
 
 #endif   // __PUB_CORE_ASPACEMGR_H
 
index 9033c3427e39c834bebc3fc8e241e9e614157de3..778280b39a5b4f36bf31a3ed8d05b1c7cecc5e1c 100644 (file)
@@ -38,7 +38,7 @@ Elf_AuxStr aux_map[AT_COUNT] = {
         {"AT_HWCAP", 25},
         {"AT_HWCAP2", 26},
 // FreeBSD 12 and 11
-//        {"AT_COUNT", 27},
+//      {"AT_COUNT", 27},
 #if (FREEBSD_VERS >= FREEBSD_13_0)
         {"AT_BSDFLAGS", 27},
         {"AT_ARGC", 28},
@@ -46,13 +46,17 @@ Elf_AuxStr aux_map[AT_COUNT] = {
         {"AT_ENVC", 30},
         {"AT_ENVV", 31},
         {"AT_PS_STRINGS", 32},
-//        {"AT_COUNT", 33},
+//      {"AT_COUNT", 33},
 #endif
 #if (FREEBSD_VERS >= FREEBSD_13_1)
         {"AT_FXRNG", 33},
         {"AT_KPRELOAD", 34},
-
-//        {"AT_COUNT", 35},
+//      {"AT_COUNT", 35},
+#endif
+#if (FREEBSD_VERS >= FREEBSD_14)
+        {"AT_USRSTACKBASE", 35},
+        {"AT_USRSTACKLIM", 36),
+//      {"AT_COUNT", 37},
 #endif
 };
 
This page took 2.110287 seconds and 5 git commands to generate.