]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
FreeBSD regtest: fix for scalar sigaltstack
authorPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 14 Apr 2024 13:32:41 +0000 (15:32 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sun, 14 Apr 2024 13:41:00 +0000 (15:41 +0200)
I was lazy and using pointers to the same struct for the new and old
data (which isn't allowed, the new is 'restrict'). The current gets
copied to the old first so under Valgrind it worked. In the kernel
there are separate structs (which get copied in and copied out) and
it doesn't work.

Maybe we should consider changing VG_(do_sys_sigaltstack) to have at
least one local copy in order to behave like the kernel.

memcheck/tests/freebsd/scalar.c

index 978c116278ff2f83f106bb53b00ea9a5ae055979..2cdc2241cf72ceb16815643fe7b9463c0e168a6b 100644 (file)
@@ -244,13 +244,12 @@ int main(void)
               char *ss_sp;
               size_t ss_size;
               int ss_flags;
-      } ss;
-      ss.ss_sp     = NULL;
-      ss.ss_flags  = 0;
-      ss.ss_size   = 0;
-      VALGRIND_MAKE_MEM_NOACCESS(& ss, sizeof(struct our_sigaltstack));
+      } ss = { NULL, 0, 0};
+      struct our_sigaltstack oss;
+      VALGRIND_MAKE_MEM_NOACCESS(&ss, sizeof(struct our_sigaltstack));
+      VALGRIND_MAKE_MEM_NOACCESS(&oss, sizeof(struct our_sigaltstack));
       GO(SYS_sigaltstack, "2s 2m");
-      SY(SYS_sigaltstack, x0+&ss, x0+&ss); SUCC; /* FAIL when run standalone */
+      SY(SYS_sigaltstack, x0+&ss, x0+&oss); FAIL;
    }
 
    /* SYS_ioctl                   54 */