From: Paul Floyd Date: Sun, 14 Apr 2024 13:32:41 +0000 (+0200) Subject: FreeBSD regtest: fix for scalar sigaltstack X-Git-Tag: VALGRIND_3_23_0~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8ab5a1e423b9a601fc2c763e062c4ae2523dd9f;p=thirdparty%2Fvalgrind.git FreeBSD regtest: fix for scalar sigaltstack 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. --- diff --git a/memcheck/tests/freebsd/scalar.c b/memcheck/tests/freebsd/scalar.c index 978c11627..2cdc2241c 100644 --- a/memcheck/tests/freebsd/scalar.c +++ b/memcheck/tests/freebsd/scalar.c @@ -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 */