From c32913b7357c98230ac844dab8ec25c0bbb61cea Mon Sep 17 00:00:00 2001 From: mbuhl Date: Thu, 2 Sep 2021 15:28:41 +0000 Subject: [PATCH] Enable vfork syscall test. Disable SIGSTOP test as it is masked until exec/exit with vfork. OK bluhm@ --- regress/lib/libc/sys/Makefile | 8 +++++++- regress/lib/libc/sys/README | 2 +- regress/lib/libc/sys/macros.h | 3 ++- regress/lib/libc/sys/t_fork.c | 7 ++++--- regress/lib/libc/sys/t_vfork.c | 31 +++++++++++++++++++++++++++++++ 5 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 regress/lib/libc/sys/t_vfork.c diff --git a/regress/lib/libc/sys/Makefile b/regress/lib/libc/sys/Makefile index acb5c898966..0bc8822c2ab 100644 --- a/regress/lib/libc/sys/Makefile +++ b/regress/lib/libc/sys/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.11 2021/09/02 12:40:44 mbuhl Exp $ +# $OpenBSD: Makefile,v 1.12 2021/09/02 15:28:41 mbuhl Exp $ # Copyright (c) 2019 Moritz Buhl # Copyright (c) 2019 Alexander Bluhm @@ -66,6 +66,7 @@ PROGS += t_stat PROGS += t_syscall PROGS += t_truncate PROGS += t_umask t_unlink +PROGS += t_vfork PROGS += t_wait_noproc PROGS += t_wait_noproc_wnohang PROGS += t_write @@ -78,6 +79,11 @@ REGRESS_EXPECTED_FAILURES += run-t_pipe2-2 REGRESS_EXPECTED_FAILURES += run-t_stat-5 REGRESS_EXPECTED_FAILURES += run-t_unlink-2 +run-t_vfork-2: + # SIGSTOP with vfork is masked before exec(3)/exit(3) + # see NetBSD: kern_sig.c,v 1.345 + @echo DISABLED + . for p in ${PROGS} SRCS_$p = $p.c atf-c.c . endfor diff --git a/regress/lib/libc/sys/README b/regress/lib/libc/sys/README index 5606fcaa153..b0092c4e0b6 100644 --- a/regress/lib/libc/sys/README +++ b/regress/lib/libc/sys/README @@ -28,6 +28,7 @@ t_revoke - remove basic tests, revoke only on ttys supported t_select - remove sigset_t struct as it is int on OpenBSD t_setrlimit - remove unsupported resource parameters and lwp t_syscall - add __syscall prototype +t_vfork - SIGSTOP is masked before exec(3)/exit(3) t_wait_noproc - waitid and wait6 are not implemented t_wait_noproc_wnohang - waitid and wait6 are not implemented @@ -38,7 +39,6 @@ t_msgrcv - msgrcv(id, &r, 3 - 1, 0x41, 004000) != -1 t_pipe2 - closefrom(4) == -1, remove F_GETNOSIGPIPE and nosigpipe test t_stat - invalid GID with doas t_unlink - wrong errno according to POSIX -t_vfork - !(((status) & 0177) == 0) evaluated to false, SIGSTOP wrong Excluded tests: t_clock_nanosleep - not available diff --git a/regress/lib/libc/sys/macros.h b/regress/lib/libc/sys/macros.h index 56f9ff1a1a6..ee7d77c31de 100644 --- a/regress/lib/libc/sys/macros.h +++ b/regress/lib/libc/sys/macros.h @@ -1,4 +1,4 @@ -/* $OpenBSD: macros.h,v 1.3 2021/09/02 12:40:44 mbuhl Exp $ */ +/* $OpenBSD: macros.h,v 1.4 2021/09/02 15:28:41 mbuhl Exp $ */ /* Public domain - Moritz Buhl */ #include @@ -56,6 +56,7 @@ sysctlbyname(char* s, void *oldp, size_t *oldlenp, void *newp, size_t newlen) #define kinfo_proc2 kinfo_proc #define KERN_PROC2 KERN_PROC #define reallocarr(pp, n, s) ((*pp = reallocarray(*pp, n, s)), *pp == NULL) +#define LSSTOP SSTOP /* t_mlock.c */ #define MAP_WIRED __MAP_NOREPLACE diff --git a/regress/lib/libc/sys/t_fork.c b/regress/lib/libc/sys/t_fork.c index 76d66ce9d4d..04157efc5dc 100644 --- a/regress/lib/libc/sys/t_fork.c +++ b/regress/lib/libc/sys/t_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: t_fork.c,v 1.1 2021/09/02 12:40:44 mbuhl Exp $ */ +/* $OpenBSD: t_fork.c,v 1.2 2021/09/02 15:28:41 mbuhl Exp $ */ /* $NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $ */ /*- @@ -34,6 +34,9 @@ __COPYRIGHT("@(#) Copyright (c) 2018, 2019\ __RCSID("$NetBSD: t_fork.c,v 1.4 2019/04/06 15:41:54 kamil Exp $"); #include +#ifdef __OpenBSD__ +#include +#endif #include #include #include @@ -118,10 +121,8 @@ await_stopped_child(pid_t process) continue; if (p[i].p_ppid != process) continue; -#ifndef __OpenBSD__ if (p[i].p_stat != LSSTOP) continue; -#endif child = p[i].p_pid; break; } diff --git a/regress/lib/libc/sys/t_vfork.c b/regress/lib/libc/sys/t_vfork.c new file mode 100644 index 00000000000..a7c6f82e8a0 --- /dev/null +++ b/regress/lib/libc/sys/t_vfork.c @@ -0,0 +1,31 @@ +/* $OpenBSD: t_vfork.c,v 1.1 2021/09/02 15:28:41 mbuhl Exp $ */ +/* $NetBSD: t_vfork.c,v 1.1 2018/05/18 06:39:58 kamil Exp $ */ + +/*- + * Copyright (c) 2018 The NetBSD Foundation, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#define VFORK +#include "t_fork.c" -- 2.20.1