CVS commit: src/sys/arch/amd64/amd64
Module Name:src Committed By: maxv Date: Tue May 5 06:32:43 UTC 2020 Modified Files: src/sys/arch/amd64/amd64: locore.S Log Message: Fix KASAN, init_xen_early must be called after kasan_early_init. To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 src/sys/arch/amd64/amd64/locore.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.207 src/sys/arch/amd64/amd64/locore.S:1.208 --- src/sys/arch/amd64/amd64/locore.S:1.207 Sat May 2 19:01:08 2020 +++ src/sys/arch/amd64/amd64/locore.S Tue May 5 06:32:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.207 2020/05/02 19:01:08 christos Exp $ */ +/* $NetBSD: locore.S,v 1.208 2020/05/05 06:32:43 maxv Exp $ */ /* * Copyright-o-rama! @@ -991,14 +991,15 @@ longmode_hi: #endif /* XENPV */ pushq %rdi -#if defined(XEN) && !defined(XENPV) - call _C_LABEL(init_xen_early) -#endif call _C_LABEL(init_bootspace) #ifdef KASAN movq _C_LABEL(lwp0uarea)(%rip),%rdi call _C_LABEL(kasan_early_init) #endif + /* <-- DO NOT INSERT C CALLS BEFORE THIS POINT --> */ +#if defined(XEN) && !defined(XENPV) + call _C_LABEL(init_xen_early) +#endif call _C_LABEL(init_slotspace) popq %rdi call _C_LABEL(init_x86_64)
CVS commit: src/lib/libc
Module Name:src Committed By: skrll Date: Tue May 5 06:20:55 UTC 2020 Modified Files: src/lib/libc/arch/hppa/gen: __setjmp14.S _setjmp.S swapcontext.S src/lib/libc/arch/hppa/string: bcmp.S bzero.S ffs.S strlcpy.S src/lib/libc/arch/hppa/sys: __clone.S __sigtramp2.S __vfork14.S brk.S cerror.S fork.S getcontext.S pipe.S sbrk.S src/lib/libc/compat/arch/hppa/sys: compat_Ovfork.S Log Message: Add a space before any non-nullified instruction. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/lib/libc/arch/hppa/gen/__setjmp14.S cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/hppa/gen/_setjmp.S cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/hppa/gen/swapcontext.S cvs rdiff -u -r1.2 -r1.3 src/lib/libc/arch/hppa/string/bcmp.S cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/hppa/string/bzero.S cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/hppa/string/ffs.S \ src/lib/libc/arch/hppa/string/strlcpy.S cvs rdiff -u -r1.6 -r1.7 src/lib/libc/arch/hppa/sys/__clone.S \ src/lib/libc/arch/hppa/sys/sbrk.S cvs rdiff -u -r1.5 -r1.6 src/lib/libc/arch/hppa/sys/__sigtramp2.S \ src/lib/libc/arch/hppa/sys/cerror.S \ src/lib/libc/arch/hppa/sys/getcontext.S cvs rdiff -u -r1.7 -r1.8 src/lib/libc/arch/hppa/sys/__vfork14.S \ src/lib/libc/arch/hppa/sys/brk.S cvs rdiff -u -r1.4 -r1.5 src/lib/libc/arch/hppa/sys/fork.S cvs rdiff -u -r1.3 -r1.4 src/lib/libc/arch/hppa/sys/pipe.S cvs rdiff -u -r1.2 -r1.3 src/lib/libc/compat/arch/hppa/sys/compat_Ovfork.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/hppa/gen/__setjmp14.S diff -u src/lib/libc/arch/hppa/gen/__setjmp14.S:1.8 src/lib/libc/arch/hppa/gen/__setjmp14.S:1.9 --- src/lib/libc/arch/hppa/gen/__setjmp14.S:1.8 Mon May 4 06:42:11 2020 +++ src/lib/libc/arch/hppa/gen/__setjmp14.S Tue May 5 06:20:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: __setjmp14.S,v 1.8 2020/05/04 06:42:11 skrll Exp $ */ +/* $NetBSD: __setjmp14.S,v 1.9 2020/05/05 06:20:55 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: __setjmp14.S,v 1.8 2020/05/04 06:42:11 skrll Exp $") + RCSID("$NetBSD: __setjmp14.S,v 1.9 2020/05/05 06:20:55 skrll Exp $") #endif /* LIBC_SCCS and not lint */ /* @@ -101,7 +101,7 @@ ENTRY(__setjmp14,0) /* Get signal stack info. */ ldo 4(%r3), %arg1 ; set up oss bl __sigaltstack14, %rp - copy %r0, %arg0 ; set up ss + copy %r0, %arg0 ; set up ss /* Recover our jmp_buf and extract SS_ONSTACK */ ldw HPPA_FRAME_ARG(0)(%r3), %arg0 @@ -114,14 +114,14 @@ ENTRY(__setjmp14,0) ldo 40(%arg0), %arg2 ; oset = &sc.sc_mask copy %r0, %arg1 ; set = NULL bl __sigprocmask14, %rp - copy %r0, %arg0 ; action = 0 + copy %r0, %arg0 ; action = 0 /* Return 0. */ ldo HPPA_FRAME_SIZE(%r3),%sp ldwm -HPPA_FRAME_SIZE(%sp),%r3 ldw HPPA_FRAME_CRP(%sp), %rp bv %r0(%rp) - copy %r0, %ret0 + copy %r0, %ret0 EXIT(__setjmp14) .end Index: src/lib/libc/arch/hppa/gen/_setjmp.S diff -u src/lib/libc/arch/hppa/gen/_setjmp.S:1.5 src/lib/libc/arch/hppa/gen/_setjmp.S:1.6 --- src/lib/libc/arch/hppa/gen/_setjmp.S:1.5 Mon May 4 06:42:11 2020 +++ src/lib/libc/arch/hppa/gen/_setjmp.S Tue May 5 06:20:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: _setjmp.S,v 1.5 2020/05/04 06:42:11 skrll Exp $ */ +/* $NetBSD: _setjmp.S,v 1.6 2020/05/05 06:20:55 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -33,7 +33,7 @@ #include #if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: _setjmp.S,v 1.5 2020/05/04 06:42:11 skrll Exp $") + RCSID("$NetBSD: _setjmp.S,v 1.6 2020/05/05 06:20:55 skrll Exp $") #endif /* LIBC_SCCS and not lint */ /* @@ -82,7 +82,7 @@ ENTRY(_setjmp,0) /* Return 0. */ bv %r0(%rp) - copy %r0, %ret0 + copy %r0, %ret0 EXIT(_setjmp) ENTRY(_longjmp,0) @@ -114,12 +114,12 @@ ENTRY(_longjmp,0) ldw 8(%arg0), %sp ldw 24(%arg0), %rp bv %r0(%rp) - nop + nop botch: bl longjmperror, %rp - nop + nop bl abort, %rp - nop + nop EXIT(_longjmp) .end Index: src/lib/libc/arch/hppa/gen/swapcontext.S diff -u src/lib/libc/arch/hppa/gen/swapcontext.S:1.6 src/lib/libc/arch/hppa/gen/swapcontext.S:1.7 --- src/lib/libc/arch/hppa/gen/swapcontext.S:1.6 Wed Feb 19 13:01:51 2014 +++ src/lib/libc/arch/hppa/gen/swapcontext.S Tue May 5 06:20:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: swapcontext.S,v 1.6 2014/02/19 13:01:51 skrll Exp $ */ +/* $NetBSD: swapcontext.S,v 1.7 2020/05/05 06:20:55 skrll Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #if defined(SYSLIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: swapcontext.S,v 1.6 2014/02/19 13:01:51 skrll Exp $") + RCSID("$NetBSD: swapcontext.S,v 1.7 2020/05/05 06:20:55 skrll Exp $") #endif /* SYSLIBC_SCCS && !lint */ LEAF_ENTRY(swapcontext) @@ -52,7 +52,7 @@ LEAF_ENTRY(swapcontext) stw %r
CVS commit: src/lib/libc/compat/arch/hppa/sys
Module Name:src Committed By: skrll Date: Tue May 5 06:11:06 UTC 2020 Modified Files: src/lib/libc/compat/arch/hppa/sys: compat_sigpending.S compat_sigprocmask.S compat_sigreturn.S compat_sigsuspend.S Log Message: Use the delay slot To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/lib/libc/compat/arch/hppa/sys/compat_sigpending.S \ src/lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S \ src/lib/libc/compat/arch/hppa/sys/compat_sigreturn.S \ src/lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/compat/arch/hppa/sys/compat_sigpending.S diff -u src/lib/libc/compat/arch/hppa/sys/compat_sigpending.S:1.3 src/lib/libc/compat/arch/hppa/sys/compat_sigpending.S:1.4 --- src/lib/libc/compat/arch/hppa/sys/compat_sigpending.S:1.3 Sun May 3 15:27:06 2020 +++ src/lib/libc/compat/arch/hppa/sys/compat_sigpending.S Tue May 5 06:11:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_sigpending.S,v 1.3 2020/05/03 15:27:06 skrll Exp $ */ +/* $NetBSD: compat_sigpending.S,v 1.4 2020/05/05 06:11:06 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -42,6 +42,6 @@ ENTRY(sigpending, 0) * AFAICT, since the hppa port came after __sigpending14, * we shouldn't have to supply the compatability sigpending. */ - ldi EINVAL, %t1 - b,n __cerror + b __cerror + ldi EINVAL, %t1 EXIT(sigpending) Index: src/lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S diff -u src/lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S:1.3 src/lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S:1.4 --- src/lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S:1.3 Sun May 3 08:36:09 2020 +++ src/lib/libc/compat/arch/hppa/sys/compat_sigprocmask.S Tue May 5 06:11:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_sigprocmask.S,v 1.3 2020/05/03 08:36:09 skrll Exp $ */ +/* $NetBSD: compat_sigprocmask.S,v 1.4 2020/05/05 06:11:06 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -42,6 +42,6 @@ ENTRY(sigprocmask, 0) * AFAICT, since the hppa port came after __sigprocmask14, * we shouldn't have to supply the compatability sigprocmask. */ - ldi EINVAL, %t1 - b,n __cerror + b __cerror + ldi EINVAL, %t1 EXIT(sigprocmask) Index: src/lib/libc/compat/arch/hppa/sys/compat_sigreturn.S diff -u src/lib/libc/compat/arch/hppa/sys/compat_sigreturn.S:1.3 src/lib/libc/compat/arch/hppa/sys/compat_sigreturn.S:1.4 --- src/lib/libc/compat/arch/hppa/sys/compat_sigreturn.S:1.3 Sun May 3 15:27:06 2020 +++ src/lib/libc/compat/arch/hppa/sys/compat_sigreturn.S Tue May 5 06:11:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_sigreturn.S,v 1.3 2020/05/03 15:27:06 skrll Exp $ */ +/* $NetBSD: compat_sigreturn.S,v 1.4 2020/05/05 06:11:06 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -42,6 +42,6 @@ ENTRY(sigreturn, 0) * AFAICT, since the hppa port came after __sigreturn14, * we shouldn't have to supply the compatability sigreturn. */ - ldi EINVAL, %t1 - b,n __cerror + b __cerror + ldi EINVAL, %t1 EXIT(sigreturn) Index: src/lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S diff -u src/lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S:1.3 src/lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S:1.4 --- src/lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S:1.3 Sun May 3 08:36:09 2020 +++ src/lib/libc/compat/arch/hppa/sys/compat_sigsuspend.S Tue May 5 06:11:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_sigsuspend.S,v 1.3 2020/05/03 08:36:09 skrll Exp $ */ +/* $NetBSD: compat_sigsuspend.S,v 1.4 2020/05/05 06:11:06 skrll Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -42,6 +42,6 @@ ENTRY(sigsuspend, 0) * AFAICT, since the hppa port came after __sigsuspend14, * we shouldn't have to supply the compatability sigsuspend. */ - ldi EINVAL, %t1 - b,n __cerror + b __cerror + ldi EINVAL, %t1 EXIT(sigsuspend)
CVS commit: src/lib/libc/arch/hppa
Module Name:src Committed By: skrll Date: Tue May 5 06:06:17 UTC 2020 Modified Files: src/lib/libc/arch/hppa: SYS.h Log Message: Remove unnecesary #define/#undef _LOCORE To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/lib/libc/arch/hppa/SYS.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/arch/hppa/SYS.h diff -u src/lib/libc/arch/hppa/SYS.h:1.9 src/lib/libc/arch/hppa/SYS.h:1.10 --- src/lib/libc/arch/hppa/SYS.h:1.9 Thu Mar 6 19:02:58 2014 +++ src/lib/libc/arch/hppa/SYS.h Tue May 5 06:06:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: SYS.h,v 1.9 2014/03/06 19:02:58 skrll Exp $ */ +/* $NetBSD: SYS.h,v 1.10 2020/05/05 06:06:16 skrll Exp $ */ /* $OpenBSD: SYS.h,v 1.9 2001/09/20 20:52:09 millert Exp $ */ @@ -30,8 +30,6 @@ #include #include #include -#undef _LOCORE -#define _LOCORE #include #define SYSENTRY(x) LEAF_ENTRY(x)
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 02:06:08 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_misc_wait.h Log Message: Move misc tests out of t_ptrace_wait.c to t_ptrace_misc_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_misc_wait.h cvs rdiff -u -r1.190 -r1.191 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.190 src/tests/lib/libc/sys/t_ptrace_wait.c:1.191 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.190 Tue May 5 01:24:29 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 02:06:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.190 2020/05/05 01:24:29 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.191 2020/05/05 02:06:08 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.190 2020/05/05 01:24:29 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.191 2020/05/05 02:06:08 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -103,94 +103,6 @@ static int debug = 0; /// -static void -user_va0_disable(int operation) -{ - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - const int sigval = SIGSTOP; - int rv; - - struct ptrace_siginfo info; - - if (get_user_va0_disable() == 0) - atf_tc_skip("vm.user_va0_disable is set to 0"); - - memset(&info, 0, sizeof(info)); - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - /* NOTREACHED */ - FORKEE_ASSERTX(0 && "This shall not be reached"); - __unreachable(); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for " - "child\n"); - SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, - sizeof(info)) != -1); - - DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid); - DPRINTF("Signal properties: si_signo=%#x si_code=%#x " - "si_errno=%#x\n", - info.psi_siginfo.si_signo, info.psi_siginfo.si_code, - info.psi_siginfo.si_errno); - - ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP); - - DPRINTF("Before resuming the child process in PC=0x0 " - "and without signal to be sent\n"); - errno = 0; - rv = ptrace(operation, child, (void *)0, 0); - ATF_REQUIRE_EQ(errno, EINVAL); - ATF_REQUIRE_EQ(rv, -1); - - SYSCALL_REQUIRE(ptrace(PT_KILL, child, NULL, 0) != -1); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - validate_status_signaled(status, SIGKILL, 0); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); -} - -#define USER_VA0_DISABLE(test, operation)\ -ATF_TC(test);\ -ATF_TC_HEAD(test, tc) \ -{ \ - atf_tc_set_md_var(tc, "descr", \ - "Verify behavior of " #operation " with PC set to 0x0"); \ -} \ - \ -ATF_TC_BODY(test, tc) \ -{ \ - \ - user_va0_disable(operation); \ -} - -USER_VA0_DISABLE(user_va0_disable_pt_continue, PT_CONTINUE) -USER_VA0_DISABLE(user_va0_disable_pt_syscall, PT_SYSCALL) -USER_VA0_DISABLE(user_va0_disable_pt_detach, PT_DETACH) - -/// - #include "t_ptrace_register_wait.h" #include "t_ptrace_syscall_wait.h" #include "t_ptrace_step_wait.h" @@ -206,6 +118,7 @@ USER_VA0_DISABLE(user_va0_disable_pt_det #include "t_ptrace_threads_wait.h" #include "t_ptrace_siginfo_wait.h" #include "t_ptrace_core_wait.h" +#include "t_ptrace_misc_wait.h" /// @@ -236,10 +149,6 @@ ATF_TP_ADD_TCS(tp) setvbuf(stderr, NULL, _IONBF, 0); #ifdef ENABLE_TESTS - ATF_TP_ADD_TC(tp, user_va0_disable_pt_continue); - ATF_TP_ADD_TC(tp, user_va0_disable_pt_syscall); - ATF_TP_ADD_TC(tp, user_va0_disable_pt_detach); - ATF_TP_ADD_TCS_PTRACE_WAIT_REGISTER();
CVS commit: src/share/misc
Module Name:src Committed By: ginsbach Date: Tue May 5 01:28:17 UTC 2020 Modified Files: src/share/misc: acronyms.comp Log Message: Add OWASP To generate a diff of this commit: cvs rdiff -u -r1.302 -r1.303 src/share/misc/acronyms.comp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/misc/acronyms.comp diff -u src/share/misc/acronyms.comp:1.302 src/share/misc/acronyms.comp:1.303 --- src/share/misc/acronyms.comp:1.302 Wed Apr 29 22:17:38 2020 +++ src/share/misc/acronyms.comp Tue May 5 01:28:17 2020 @@ -1,4 +1,4 @@ -$NetBSD: acronyms.comp,v 1.302 2020/04/29 22:17:38 rtr Exp $ +$NetBSD: acronyms.comp,v 1.303 2020/05/05 01:28:17 ginsbach Exp $ 3WHS three-way handshake 8VSB 8-state vestigial side band modulation AA anti-aliasing @@ -1117,6 +1117,7 @@ OTP one time password OTP open telecom platform OU organizational unit OUI organizationally unique identifier +OWASP Open Web Application Security Project OWL Web Ontology Language P2P PCI to PCI P2P peer to peer
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 01:24:29 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_core_wait.h Log Message: Move core tests out of t_ptrace_wait.c to t_ptrace_core_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_core_wait.h cvs rdiff -u -r1.189 -r1.190 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.189 src/tests/lib/libc/sys/t_ptrace_wait.c:1.190 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.189 Tue May 5 00:57:34 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 01:24:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.189 2020/05/05 00:57:34 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.190 2020/05/05 01:24:29 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.189 2020/05/05 00:57:34 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.190 2020/05/05 01:24:29 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -191,199 +191,6 @@ USER_VA0_DISABLE(user_va0_disable_pt_det /// -/* - * Parse the core file and find the requested note. If the reading or parsing - * fails, the test is failed. If the note is found, it is read onto buf, up to - * buf_len. The actual length of the note is returned (which can be greater - * than buf_len, indicating that it has been truncated). If the note is not - * found, -1 is returned. - * - * If the note_name ends in '*', then we find the first note that matches - * the note_name prefix up to the '*' character, e.g.: - * - * NetBSD-CORE@* - * - * finds the first note whose name prefix matches "NetBSD-CORE@". - */ -static ssize_t core_find_note(const char *core_path, -const char *note_name, uint64_t note_type, void *buf, size_t buf_len) -{ - int core_fd; - Elf *core_elf; - size_t core_numhdr, i; - ssize_t ret = -1; - size_t name_len = strlen(note_name); - bool prefix_match = false; - - if (note_name[name_len - 1] == '*') { - prefix_match = true; - name_len--; - } else { - /* note: we assume note name will be null-terminated */ - name_len++; - } - - SYSCALL_REQUIRE((core_fd = open(core_path, O_RDONLY)) != -1); - SYSCALL_REQUIRE(elf_version(EV_CURRENT) != EV_NONE); - SYSCALL_REQUIRE((core_elf = elf_begin(core_fd, ELF_C_READ, NULL))); - - SYSCALL_REQUIRE(elf_getphnum(core_elf, &core_numhdr) != 0); - for (i = 0; i < core_numhdr && ret == -1; i++) { - GElf_Phdr core_hdr; - size_t offset; - SYSCALL_REQUIRE(gelf_getphdr(core_elf, i, &core_hdr)); - if (core_hdr.p_type != PT_NOTE) - continue; - - for (offset = core_hdr.p_offset; - offset < core_hdr.p_offset + core_hdr.p_filesz;) { - Elf64_Nhdr note_hdr; - char name_buf[64]; - - switch (gelf_getclass(core_elf)) { - case ELFCLASS64: -SYSCALL_REQUIRE(pread(core_fd, ¬e_hdr, -sizeof(note_hdr), offset) -== sizeof(note_hdr)); -offset += sizeof(note_hdr); -break; - case ELFCLASS32: -{ -Elf32_Nhdr tmp_hdr; -SYSCALL_REQUIRE(pread(core_fd, &tmp_hdr, -sizeof(tmp_hdr), offset) -== sizeof(tmp_hdr)); -offset += sizeof(tmp_hdr); -note_hdr.n_namesz = tmp_hdr.n_namesz; -note_hdr.n_descsz = tmp_hdr.n_descsz; -note_hdr.n_type = tmp_hdr.n_type; -} -break; - } - - /* indicates end of notes */ - if (note_hdr.n_namesz == 0 || note_hdr.n_descsz == 0) -break; - if (((prefix_match && - note_hdr.n_namesz > name_len) || - (!prefix_match && - note_hdr.n_namesz == name_len)) && - note_hdr.n_namesz <= sizeof(name_buf)) { -SYSCALL_REQUIRE(pread(core_fd, name_buf, -note_hdr.n_namesz, offset) -== (ssize_t)(size_t)note_hdr.n_namesz); - -if (!strncmp(note_name, name_buf, name_len) && -note_hdr.n_type == note_type) - ret = note_hdr.n_descsz; - } - - offset += note_hdr.n_namesz; - /* fix to alignment */ - offset = roundup(offset, core_hdr.p_align); - - /* if name & type matched above */ - if (ret != -1) { -ssize_t read_len = MIN(buf_len, -note_hdr.n_descsz); -SYSCALL_REQUIRE(pread(core_fd, buf, -read_len, offset) == read_len); -break; - } - - offset += note_hdr.n_descsz; - /* fix to alignment */ - offset = roundup(offset, core_hdr.p_align); - } - } - - elf_end(core_elf); - close(core_fd); - - return ret; -} - -ATF_TC(core_dump_procinfo); -ATF_TC_HEAD(core_dump_procinfo, tc) -{ - atf_tc_set_md_var(tc, "descr", - "Trigger a core dump a
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 00:57:34 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_siginfo_wait.h Log Message: Move siginfo tests out of t_ptrace_wait.c to t_ptrace_siginfo_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_siginfo_wait.h cvs rdiff -u -r1.188 -r1.189 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.188 src/tests/lib/libc/sys/t_ptrace_wait.c:1.189 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.188 Tue May 5 00:50:39 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 00:57:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.188 2020/05/05 00:50:39 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.189 2020/05/05 00:57:34 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.188 2020/05/05 00:50:39 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.189 2020/05/05 00:57:34 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -104,132 +104,6 @@ static int debug = 0; /// static void -ptrace_siginfo(bool faked, void (*sah)(int a, siginfo_t *b, void *c), int *signal_caught) -{ - const int exitval = 5; - const int sigval = SIGINT; - const int sigfaked = SIGTRAP; - const int sicodefaked = TRAP_BRKPT; - pid_t child, wpid; - struct sigaction sa; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - struct ptrace_siginfo info; - memset(&info, 0, sizeof(info)); - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - sa.sa_sigaction = sah; - sa.sa_flags = SA_SIGINFO; - sigemptyset(&sa.sa_mask); - - FORKEE_ASSERT(sigaction(faked ? sigfaked : sigval, &sa, NULL) - != -1); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - FORKEE_ASSERT_EQ(*signal_caught, 1); - - DPRINTF("Before exiting of the child process\n"); - _exit(exitval); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); - SYSCALL_REQUIRE( - ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); - - DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid); - DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", - info.psi_siginfo.si_signo, info.psi_siginfo.si_code, - info.psi_siginfo.si_errno); - - if (faked) { - DPRINTF("Before setting new faked signal to signo=%d " - "si_code=%d\n", sigfaked, sicodefaked); - info.psi_siginfo.si_signo = sigfaked; - info.psi_siginfo.si_code = sicodefaked; - } - - DPRINTF("Before calling ptrace(2) with PT_SET_SIGINFO for child\n"); - SYSCALL_REQUIRE( - ptrace(PT_SET_SIGINFO, child, &info, sizeof(info)) != -1); - - if (faked) { - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for " - "child\n"); - SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, - sizeof(info)) != -1); - - DPRINTF("Before checking siginfo_t\n"); - ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigfaked); - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, sicodefaked); - } - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, - faked ? sigfaked : sigval) != -1); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_exited(status, exitval); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); -} - -#define PTRACE_SIGINFO(test, faked) \ -ATF_TC(test);\ -ATF_TC_HEAD(test, tc) \ -{ \ - atf_tc_set_md_var(tc, "descr", \ - "Verify basic PT_GET_SIGINFO and PT_SET_SIGINFO calls" \ - "with%s setting signal to new value", faked ? "" : "out"); \ -} \ - \ -static int test##_caught = 0; \ - \ -static void\ -test##_sighandler(int sig, siginfo_t *info, void *ctx) \ -{ \ - if (faked) { \ - FORKEE_ASSE
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 00:50:39 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c t_ptrace_wait.h Added Files: src/tests/lib/libc/sys: t_ptrace_threads_wait.h Log Message: Move threads tests out of t_ptrace_wait.c to t_ptrace_threads_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_threads_wait.h cvs rdiff -u -r1.187 -r1.188 src/tests/lib/libc/sys/t_ptrace_wait.c cvs rdiff -u -r1.27 -r1.28 src/tests/lib/libc/sys/t_ptrace_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.187 src/tests/lib/libc/sys/t_ptrace_wait.c:1.188 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.187 Tue May 5 00:33:37 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 00:50:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.187 2020/05/05 00:33:37 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.188 2020/05/05 00:50:39 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.187 2020/05/05 00:33:37 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.188 2020/05/05 00:50:39 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -229,631 +229,6 @@ PTRACE_SIGINFO(siginfo_set_faked, true) /// -#define TRACE_THREADS_NUM 100 - -static volatile int done; -pthread_mutex_t trace_threads_mtx = PTHREAD_MUTEX_INITIALIZER; - -static void * -trace_threads_cb(void *arg __unused) -{ - - pthread_mutex_lock(&trace_threads_mtx); - done++; - pthread_mutex_unlock(&trace_threads_mtx); - - while (done < TRACE_THREADS_NUM) - sched_yield(); - - return NULL; -} - -static void -trace_threads(bool trace_create, bool trace_exit, bool masked) -{ - const int sigval = SIGSTOP; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - ptrace_state_t state; - const int slen = sizeof(state); - ptrace_event_t event; - const int elen = sizeof(event); - struct ptrace_siginfo info; - - sigset_t intmask; - - pthread_t t[TRACE_THREADS_NUM]; - int rv; - size_t n; - lwpid_t lid; - - /* Track created and exited threads */ - struct lwp_event_count traced_lwps[__arraycount(t)] = {{0, 0}}; - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - if (masked) { - sigemptyset(&intmask); - sigaddset(&intmask, SIGTRAP); - sigprocmask(SIG_BLOCK, &intmask, NULL); - } - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - for (n = 0; n < __arraycount(t); n++) { - rv = pthread_create(&t[n], NULL, trace_threads_cb, - NULL); - FORKEE_ASSERT(rv == 0); - } - - for (n = 0; n < __arraycount(t); n++) { - rv = pthread_join(t[n], NULL); - FORKEE_ASSERT(rv == 0); - } - - /* - * There is race between _exit() and pthread_join() detaching - * a thread. For simplicity kill the process after detecting - * LWP events. - */ - while (true) - continue; - - FORKEE_ASSERT(0 && "Not reached"); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); - SYSCALL_REQUIRE( - ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); - - DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid); - DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", - info.psi_siginfo.si_signo, info.psi_siginfo.si_code, - info.psi_siginfo.si_errno); - - ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP); - - DPRINTF("Set LWP event mask for the child %d\n", child); - memset(&event, 0, sizeof(event)); - if (trace_create) - event.pe_set_event |= PTRACE_LWP_CREATE; - if (trace_exit) - event.pe_set_event |= PTRACE_LWP_EXIT; - SYSCALL_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); - - for (n = 0; n < (trace_create ? __arraycount(t) : 0); n++) { - DPRINTF("Before calling %s() for the child - expected stopped " - "SIGTRAP\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child,
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 00:33:37 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_topology_wait.h Log Message: Move topology tests out of t_ptrace_wait.c to t_ptrace_topology_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_topology_wait.h cvs rdiff -u -r1.186 -r1.187 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.186 src/tests/lib/libc/sys/t_ptrace_wait.c:1.187 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.186 Tue May 5 00:23:12 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 00:33:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.186 2020/05/05 00:23:12 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.187 2020/05/05 00:33:37 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.186 2020/05/05 00:23:12 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.187 2020/05/05 00:33:37 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -103,683 +103,6 @@ static int debug = 0; /// -ATF_TC(traceme_pid1_parent); -ATF_TC_HEAD(traceme_pid1_parent, tc) -{ - atf_tc_set_md_var(tc, "descr", - "Verify that PT_TRACE_ME is not allowed when our parent is PID1"); -} - -ATF_TC_BODY(traceme_pid1_parent, tc) -{ - struct msg_fds parent_child; - int exitval_child1 = 1, exitval_child2 = 2; - pid_t child1, child2, wpid; - uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - - SYSCALL_REQUIRE(msg_open(&parent_child) == 0); - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child1 = fork()) != -1); - if (child1 == 0) { - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child2 = fork()) != -1); - if (child2 != 0) { - DPRINTF("Parent process PID=%d, child2's PID=%d\n", - getpid(), child2); - _exit(exitval_child1); - } - CHILD_FROM_PARENT("exit child1", parent_child, msg); - - DPRINTF("Assert that our parent is PID1 (initproc)\n"); - FORKEE_ASSERT_EQ(getppid(), 1); - - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) == -1); - SYSCALL_REQUIRE_ERRNO(errno, EPERM); - - CHILD_TO_PARENT("child2 exiting", parent_child, msg); - - _exit(exitval_child2); - } - DPRINTF("Parent process PID=%d, child1's PID=%d\n", getpid(), child1); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS( - wpid = TWAIT_GENERIC(child1, &status, WEXITED), child1); - - validate_status_exited(status, exitval_child1); - - DPRINTF("Notify that child1 is dead\n"); - PARENT_TO_CHILD("exit child1", parent_child, msg); - - DPRINTF("Wait for exiting of child2\n"); - PARENT_FROM_CHILD("child2 exiting", parent_child, msg); -} - -/// - -#if defined(TWAIT_HAVE_PID) -static void -tracer_sees_terminaton_before_the_parent_raw(bool notimeout, bool unrelated, - bool stopped) -{ - /* - * notimeout - disable timeout in await zombie function - * unrelated - attach from unrelated tracer reparented to initproc - * stopped - attach to a stopped process - */ - - struct msg_fds parent_tracee, parent_tracer; - const int exitval_tracee = 5; - const int exitval_tracer = 10; - pid_t tracee, tracer, wpid; - uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */ -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - - /* - * Only a subset of options are supported. - */ - ATF_REQUIRE((!notimeout && !unrelated && !stopped) || - (!notimeout && unrelated && !stopped) || - (notimeout && !unrelated && !stopped) || - (!notimeout && unrelated && stopped)); - - DPRINTF("Spawn tracee\n"); - SYSCALL_REQUIRE(msg_open(&parent_tracee) == 0); - tracee = atf_utils_fork(); - if (tracee == 0) { - if (stopped) { - DPRINTF("Stop self PID %d\n", getpid()); - raise(SIGSTOP); - } - - // Wait for parent to let us exit - CHILD_FROM_PARENT("exit tracee", parent_tracee, msg); - _exit(exitval_tracee); - } - - DPRINTF("Spawn debugger\n"); - SYSCALL_REQUIRE(msg_open(&parent_tracer) == 0); - tracer = atf_utils_fork(); - if (tracer == 0) { - if(unrelated) { - /* Fork again and drop parent to reattach to PID 1 */ - tracer = atf_utils_fork(); - if (tracer != 0) -_exit(exitval_tracer); - } - - if
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 00:23:13 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_exec_wait.h Log Message: Move exec() tests out of t_ptrace_wait.c to t_ptrace_exec_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_exec_wait.h cvs rdiff -u -r1.185 -r1.186 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.185 src/tests/lib/libc/sys/t_ptrace_wait.c:1.186 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.185 Tue May 5 00:15:45 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 00:23:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.185 2020/05/05 00:15:45 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.186 2020/05/05 00:23:12 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.185 2020/05/05 00:15:45 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.186 2020/05/05 00:23:12 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -162,153 +162,6 @@ ATF_TC_BODY(traceme_pid1_parent, tc) /// -static void -traceme_vfork_exec(bool masked, bool ignored) -{ - const int sigval = SIGTRAP; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - struct sigaction sa; - struct ptrace_siginfo info; - sigset_t intmask; - struct kinfo_proc2 kp; - size_t len = sizeof(kp); - - int name[6]; - const size_t namelen = __arraycount(name); - ki_sigset_t kp_sigmask; - ki_sigset_t kp_sigignore; - - memset(&info, 0, sizeof(info)); - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = vfork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - if (masked) { - sigemptyset(&intmask); - sigaddset(&intmask, sigval); - sigprocmask(SIG_BLOCK, &intmask, NULL); - } - - if (ignored) { - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = SIG_IGN; - sigemptyset(&sa.sa_mask); - FORKEE_ASSERT(sigaction(sigval, &sa, NULL) != -1); - } - - DPRINTF("Before calling execve(2) from child\n"); - execlp("/bin/echo", "/bin/echo", NULL); - - /* NOTREACHED */ - FORKEE_ASSERTX(0 && "Not reached"); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - name[0] = CTL_KERN, - name[1] = KERN_PROC2, - name[2] = KERN_PROC_PID; - name[3] = getpid(); - name[4] = sizeof(kp); - name[5] = 1; - - ATF_REQUIRE_EQ(sysctl(name, namelen, &kp, &len, NULL, 0), 0); - - if (masked) - kp_sigmask = kp.p_sigmask; - - if (ignored) - kp_sigignore = kp.p_sigignore; - - name[3] = getpid(); - - ATF_REQUIRE_EQ(sysctl(name, namelen, &kp, &len, NULL, 0), 0); - - if (masked) { - DPRINTF("kp_sigmask=" - "%#02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02" PRIx32"\n", - kp_sigmask.__bits[0], kp_sigmask.__bits[1], - kp_sigmask.__bits[2], kp_sigmask.__bits[3]); - - DPRINTF("kp.p_sigmask=" - "%#02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02" PRIx32"\n", - kp.p_sigmask.__bits[0], kp.p_sigmask.__bits[1], - kp.p_sigmask.__bits[2], kp.p_sigmask.__bits[3]); - - ATF_REQUIRE(!memcmp(&kp_sigmask, &kp.p_sigmask, - sizeof(kp_sigmask))); - } - - if (ignored) { - DPRINTF("kp_sigignore=" - "%#02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02" PRIx32"\n", - kp_sigignore.__bits[0], kp_sigignore.__bits[1], - kp_sigignore.__bits[2], kp_sigignore.__bits[3]); - - DPRINTF("kp.p_sigignore=" - "%#02" PRIx32 "%02" PRIx32 "%02" PRIx32 "%02" PRIx32"\n", - kp.p_sigignore.__bits[0], kp.p_sigignore.__bits[1], - kp.p_sigignore.__bits[2], kp.p_sigignore.__bits[3]); - - ATF_REQUIRE(!memcmp(&kp_sigignore, &kp.p_sigignore, - sizeof(kp_sigignore))); - } - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); - SYSCALL_REQUIRE( - ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); - - DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid); - DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", - info.psi_siginfo.si_signo, info.psi_siginfo.si_code, - info.psi_siginfo.si_errno); - - ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_EXEC); - - DPRINTF("Before
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 00:15:45 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_lwp_wait.h Log Message: Move LWP tests out of t_ptrace_wait.c to t_ptrace_lwp_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_lwp_wait.h cvs rdiff -u -r1.184 -r1.185 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.184 src/tests/lib/libc/sys/t_ptrace_wait.c:1.185 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.184 Tue May 5 00:03:49 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 00:15:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.184 2020/05/05 00:03:49 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.185 2020/05/05 00:15:45 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.184 2020/05/05 00:03:49 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.185 2020/05/05 00:15:45 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -927,618 +927,6 @@ TRACEE_SEES_ITS_ORIGINAL_PARENT( /// -static int lwpinfo_thread_sigmask[] = {SIGXCPU, SIGPIPE, SIGALRM, SIGURG}; - -static pthread_mutex_t lwpinfo_thread_mtx = PTHREAD_MUTEX_INITIALIZER; -static pthread_cond_t lwpinfo_thread_cnd = PTHREAD_COND_INITIALIZER; -static volatile size_t lwpinfo_thread_done; - -static void * -lwpinfo_thread(void *arg) -{ - sigset_t s; - volatile void **tcb; - - tcb = (volatile void **)arg; - - *tcb = _lwp_getprivate(); - DPRINTF("Storing tcb[] = %p from thread %d\n", *tcb, _lwp_self()); - - pthread_setname_np(pthread_self(), "thread %d", - (void *)(intptr_t)_lwp_self()); - - sigemptyset(&s); - pthread_mutex_lock(&lwpinfo_thread_mtx); - sigaddset(&s, lwpinfo_thread_sigmask[lwpinfo_thread_done]); - lwpinfo_thread_done++; - pthread_sigmask(SIG_BLOCK, &s, NULL); - pthread_cond_signal(&lwpinfo_thread_cnd); - pthread_mutex_unlock(&lwpinfo_thread_mtx); - - return infinite_thread(NULL); -} - -static void -traceme_lwpinfo(const size_t threads, const char *iter) -{ - const int sigval = SIGSTOP; - const int sigval2 = SIGINT; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - struct ptrace_lwpinfo lwp = {0, 0}; - struct ptrace_lwpstatus lwpstatus = {0}; - struct ptrace_siginfo info; - void *private; - char *name; - char namebuf[PL_LNAMELEN]; - volatile void *tcb[4]; - bool found; - sigset_t s; - - /* Maximum number of supported threads in this test */ - pthread_t t[__arraycount(tcb) - 1]; - size_t n, m; - int rv; - size_t bytes_read; - - struct ptrace_io_desc io; - sigset_t sigmask; - - ATF_REQUIRE(__arraycount(t) >= threads); - memset(tcb, 0, sizeof(tcb)); - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - tcb[0] = _lwp_getprivate(); - DPRINTF("Storing tcb[0] = %p\n", tcb[0]); - - pthread_setname_np(pthread_self(), "thread %d", - (void *)(intptr_t)_lwp_self()); - - sigemptyset(&s); - sigaddset(&s, lwpinfo_thread_sigmask[lwpinfo_thread_done]); - pthread_sigmask(SIG_BLOCK, &s, NULL); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - for (n = 0; n < threads; n++) { - rv = pthread_create(&t[n], NULL, lwpinfo_thread, - &tcb[n + 1]); - FORKEE_ASSERT(rv == 0); - } - - pthread_mutex_lock(&lwpinfo_thread_mtx); - while (lwpinfo_thread_done < threads) { - pthread_cond_wait(&lwpinfo_thread_cnd, - &lwpinfo_thread_mtx); - } - pthread_mutex_unlock(&lwpinfo_thread_mtx); - - DPRINTF("Before raising %s from child\n", strsignal(sigval2)); - FORKEE_ASSERT(raise(sigval2) == 0); - - /* NOTREACHED */ - FORKEE_ASSERTX(0 && "Not reached"); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child"); - SYSCALL_REQUIRE( - ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); - - DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid); - DPRINTF("Signal properties: si_signo=%#x si_code=%#x si_errno=%#x\n", - info.psi_siginfo.si_signo, info.psi_siginfo.si_code, - info.psi_siginfo.si_errno); - -
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 00:03:49 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Log Message: Remove the duplicate ATF_TP_ADD_TC() entries Event mask tests are already defined in ATF_TP_ADD_TCS_PTRACE_WAIT_EVENTMASK(). To generate a diff of this commit: cvs rdiff -u -r1.183 -r1.184 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.183 src/tests/lib/libc/sys/t_ptrace_wait.c:1.184 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.183 Tue May 5 00:01:14 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 00:03:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.183 2020/05/05 00:01:14 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.184 2020/05/05 00:03:49 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.183 2020/05/05 00:01:14 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.184 2020/05/05 00:03:49 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -3172,14 +3172,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC_HAVE_PID(tp, tracee_sees_its_original_parent_procfs_status); - ATF_TP_ADD_TC(tp, eventmask_preserved_empty); - ATF_TP_ADD_TC(tp, eventmask_preserved_fork); - ATF_TP_ADD_TC(tp, eventmask_preserved_vfork); - ATF_TP_ADD_TC(tp, eventmask_preserved_vfork_done); - ATF_TP_ADD_TC(tp, eventmask_preserved_lwp_create); - ATF_TP_ADD_TC(tp, eventmask_preserved_lwp_exit); - ATF_TP_ADD_TC(tp, eventmask_preserved_posix_spawn); - ATF_TP_ADD_TC(tp, traceme_lwpinfo0); ATF_TP_ADD_TC(tp, traceme_lwpinfo1); ATF_TP_ADD_TC(tp, traceme_lwpinfo2);
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Tue May 5 00:01:15 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_eventmask_wait.h Log Message: Move eventmask tests out of t_ptrace_wait.c to t_ptrace_eventmask_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_eventmask_wait.h cvs rdiff -u -r1.182 -r1.183 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.182 src/tests/lib/libc/sys/t_ptrace_wait.c:1.183 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.182 Mon May 4 23:53:20 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue May 5 00:01:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.182 2020/05/04 23:53:20 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.183 2020/05/05 00:01:14 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.182 2020/05/04 23:53:20 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.183 2020/05/05 00:01:14 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -927,83 +927,6 @@ TRACEE_SEES_ITS_ORIGINAL_PARENT( /// -static void -eventmask_preserved(int event) -{ - const int exitval = 5; - const int sigval = SIGSTOP; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - ptrace_event_t set_event, get_event; - const int len = sizeof(ptrace_event_t); - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - DPRINTF("Before exiting of the child process\n"); - _exit(exitval); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - set_event.pe_set_event = event; - SYSCALL_REQUIRE( - ptrace(PT_SET_EVENT_MASK, child, &set_event, len) != -1); - SYSCALL_REQUIRE( - ptrace(PT_GET_EVENT_MASK, child, &get_event, len) != -1); - DPRINTF("set_event=%#x get_event=%#x\n", set_event.pe_set_event, - get_event.pe_set_event); - ATF_REQUIRE(memcmp(&set_event, &get_event, len) == 0); - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_exited(status, exitval); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); -} - -#define EVENTMASK_PRESERVED(test, event)\ -ATF_TC(test);\ -ATF_TC_HEAD(test, tc) \ -{ \ - atf_tc_set_md_var(tc, "descr", \ - "Verify that eventmask " #event " is preserved"); \ -} \ - \ -ATF_TC_BODY(test, tc) \ -{ \ - \ - eventmask_preserved(event); \ -} - -EVENTMASK_PRESERVED(eventmask_preserved_empty, 0) -EVENTMASK_PRESERVED(eventmask_preserved_fork, PTRACE_FORK) -EVENTMASK_PRESERVED(eventmask_preserved_vfork, PTRACE_VFORK) -EVENTMASK_PRESERVED(eventmask_preserved_vfork_done, PTRACE_VFORK_DONE) -EVENTMASK_PRESERVED(eventmask_preserved_lwp_create, PTRACE_LWP_CREATE) -EVENTMASK_PRESERVED(eventmask_preserved_lwp_exit, PTRACE_LWP_EXIT) -EVENTMASK_PRESERVED(eventmask_preserved_posix_spawn, PTRACE_POSIX_SPAWN) - -/// - static int lwpinfo_thread_sigmask[] = {SIGXCPU, SIGPIPE, SIGALRM, SIGURG}; static pthread_mutex_t lwpinfo_thread_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -3193,6 +3116,7 @@ THREAD_CONCURRENT_TEST(thread_concurrent #include "t_ptrace_clone_wait.h" #include "t_ptrace_fork_wait.h" #include "t_ptrace_signal_wait.h" +#include "t_ptrace_eventmask_wait.h" /// @@ -3362,6 +3286,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TCS_PTRACE_WAIT_CLONE(); ATF_TP_ADD_TCS_PTRACE_WAIT_FORK(); ATF_TP_ADD_TCS_PTRACE_WAIT_SIGNAL(); + ATF_TP_ADD_TCS_PTRACE_WAIT_EVENTMASK(); ATF_TP_ADD_TCS_PTRACE_WAIT_AMD64(); ATF_TP_ADD_TCS_PTRACE_
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon May 4 23:53:20 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Log Message: Remove the duplicate ATF_TP_ADD_TC() entries Byte transfer tests are already defined in ATF_TP_ADD_TCS_PTRACE_WAIT_BYTETRANSFER(). To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.181 src/tests/lib/libc/sys/t_ptrace_wait.c:1.182 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.181 Mon May 4 23:49:31 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon May 4 23:53:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.181 2020/05/04 23:49:31 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.182 2020/05/04 23:53:20 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.181 2020/05/04 23:49:31 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.182 2020/05/04 23:53:20 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -3256,80 +3256,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, eventmask_preserved_lwp_exit); ATF_TP_ADD_TC(tp, eventmask_preserved_posix_spawn); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_d_8); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_d_16); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_d_32); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_d_64); - - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_i_8); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_i_16); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_i_32); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_i_64); - - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_d_8); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_d_16); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_d_32); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_d_64); - - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_i_8); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_i_16); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_i_32); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_i_64); - - ATF_TP_ADD_TC(tp, bytes_transfer_read_d); - ATF_TP_ADD_TC(tp, bytes_transfer_read_i); - ATF_TP_ADD_TC(tp, bytes_transfer_write_d); - ATF_TP_ADD_TC(tp, bytes_transfer_write_i); - - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_d_8_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_d_16_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_d_32_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_d_64_text); - - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_i_8_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_i_16_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_i_32_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_i_64_text); - - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_d_8_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_d_16_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_d_32_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_d_64_text); - - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_i_8_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_i_16_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_i_32_text); - ATF_TP_ADD_TC(tp, bytes_transfer_piod_write_i_64_text); - - ATF_TP_ADD_TC(tp, bytes_transfer_read_d_text); - ATF_TP_ADD_TC(tp, bytes_transfer_read_i_text); - ATF_TP_ADD_TC(tp, bytes_transfer_write_d_text); - ATF_TP_ADD_TC(tp, bytes_transfer_write_i_text); - - ATF_TP_ADD_TC(tp, bytes_transfer_piod_read_auxv); - - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_pt_read_i); - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_pt_read_d); - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_pt_write_i); - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_pt_write_d); - - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_piod_read_i); - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_piod_read_d); - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_piod_write_i); - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_piod_write_d); - - ATF_TP_ADD_TC(tp, bytes_transfer_alignment_piod_read_auxv); - - ATF_TP_ADD_TC(tp, bytes_transfer_eof_pt_read_i); - ATF_TP_ADD_TC(tp, bytes_transfer_eof_pt_read_d); - ATF_TP_ADD_TC(tp, bytes_transfer_eof_pt_write_i); - ATF_TP_ADD_TC(tp, bytes_transfer_eof_pt_write_d); - - ATF_TP_ADD_TC(tp, bytes_transfer_eof_piod_read_i); - ATF_TP_ADD_TC(tp, bytes_transfer_eof_piod_read_d); - ATF_TP_ADD_TC(tp, bytes_transfer_eof_piod_write_i); - ATF_TP_ADD_TC(tp, bytes_transfer_eof_piod_write_d); - ATF_TP_ADD_TC(tp, traceme_lwpinfo0); ATF_TP_ADD_TC(tp, traceme_lwpinfo1); ATF_TP_ADD_TC(tp, traceme_lwpinfo2);
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon May 4 22:24:31 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_clone_wait.h Log Message: Bump (c) year To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_ptrace_clone_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_clone_wait.h diff -u src/tests/lib/libc/sys/t_ptrace_clone_wait.h:1.1 src/tests/lib/libc/sys/t_ptrace_clone_wait.h:1.2 --- src/tests/lib/libc/sys/t_ptrace_clone_wait.h:1.1 Mon May 4 22:15:23 2020 +++ src/tests/lib/libc/sys/t_ptrace_clone_wait.h Mon May 4 22:24:31 2020 @@ -1,7 +1,7 @@ -/* $NetBSD: t_ptrace_clone_wait.h,v 1.1 2020/05/04 22:15:23 kamil Exp $ */ +/* $NetBSD: t_ptrace_clone_wait.h,v 1.2 2020/05/04 22:24:31 kamil Exp $ */ /*- - * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. + * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon May 4 22:15:23 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_clone_wait.h Log Message: Move clone() tests out of t_ptrace_wait.c to t_ptrace_clone_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_clone_wait.h cvs rdiff -u -r1.178 -r1.179 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.178 src/tests/lib/libc/sys/t_ptrace_wait.c:1.179 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.178 Mon May 4 22:05:28 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon May 4 22:15:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.178 2020/05/04 22:05:28 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.179 2020/05/04 22:15:23 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.178 2020/05/04 22:05:28 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.179 2020/05/04 22:15:23 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -6159,742 +6159,6 @@ ATF_TC_BODY(resume, tc) /// static void -clone_body(int flags, bool trackfork, bool trackvfork, -bool trackvforkdone) -{ - const int exitval = 5; - const int exitval2 = 15; - const int sigval = SIGSTOP; - pid_t child, child2 = 0, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - ptrace_state_t state; - const int slen = sizeof(state); - ptrace_event_t event; - const int elen = sizeof(event); - - const size_t stack_size = 1024 * 1024; - void *stack, *stack_base; - - stack = malloc(stack_size); - ATF_REQUIRE(stack != NULL); - -#ifdef __MACHINE_STACK_GROWS_UP - stack_base = stack; -#else - stack_base = (char *)stack + stack_size; -#endif - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - SYSCALL_REQUIRE((child2 = __clone(clone_func, stack_base, - flags|SIGCHLD, (void *)(intptr_t)exitval2)) != -1); - - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), - child2); - - // XXX WALLSIG? - FORKEE_REQUIRE_SUCCESS - (wpid = TWAIT_GENERIC(child2, &status, WALLSIG), child2); - - forkee_status_exited(status, exitval2); - - DPRINTF("Before exiting of the child process\n"); - _exit(exitval); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Set 0%s%s%s in EVENT_MASK for the child %d\n", - trackfork ? "|PTRACE_FORK" : "", - trackvfork ? "|PTRACE_VFORK" : "", - trackvforkdone ? "|PTRACE_VFORK_DONE" : "", child); - event.pe_set_event = 0; - if (trackfork) - event.pe_set_event |= PTRACE_FORK; - if (trackvfork) - event.pe_set_event |= PTRACE_VFORK; - if (trackvforkdone) - event.pe_set_event |= PTRACE_VFORK_DONE; - SYSCALL_REQUIRE(ptrace(PT_SET_EVENT_MASK, child, &event, elen) != -1); - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); - -#if defined(TWAIT_HAVE_PID) - if ((trackfork && !(flags & CLONE_VFORK)) || - (trackvfork && (flags & CLONE_VFORK))) { - DPRINTF("Before calling %s() for the child %d\n", TWAIT_FNAME, - child); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), - child); - - validate_status_stopped(status, SIGTRAP); - - SYSCALL_REQUIRE( - ptrace(PT_GET_PROCESS_STATE, child, &state, slen) != -1); - if (trackfork && !(flags & CLONE_VFORK)) { - ATF_REQUIRE_EQ(state.pe_report_event & PTRACE_FORK, - PTRACE_FORK); - } - if (trackvfork && (flags & CLONE_VFORK)) { - ATF_REQUIRE_EQ(state.pe_report_event & PTRACE_VFORK, - PTRACE_VFORK); - } - - child2 = state.pe_other_pid; - DPRINTF("Reported ptrace event with forkee %d\n", child2); - - DPRINTF("Before calling %s() for the forkee %d of the child " - "%d\n", TWAIT_FNAME, child2, child); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child2, &status, 0), - child2); - - validate_status_stopped(status, SIGTRAP); - - SYSCALL_REQUIRE( - ptrace(PT_GET_PROCESS_STATE, ch
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon May 4 22:05:29 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_bytetransfer_wait.h Log Message: Move byte transfer tests out of t_ptrace_wait.c to t_ptrace_bytetransfer_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_bytetransfer_wait.h cvs rdiff -u -r1.177 -r1.178 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.177 src/tests/lib/libc/sys/t_ptrace_wait.c:1.178 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.177 Mon May 4 21:55:12 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon May 4 22:05:28 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.177 2020/05/04 21:55:12 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.178 2020/05/04 22:05:28 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.177 2020/05/04 21:55:12 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.178 2020/05/04 22:05:28 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -4194,826 +4194,6 @@ TRACEME_VFORK_FORK_TEST(traceme_vfork_vf /// -enum bytes_transfer_type { - BYTES_TRANSFER_DATA, - BYTES_TRANSFER_DATAIO, - BYTES_TRANSFER_TEXT, - BYTES_TRANSFER_TEXTIO, - BYTES_TRANSFER_AUXV -}; - -static int __used -bytes_transfer_dummy(int a, int b, int c, int d) -{ - int e, f, g, h; - - a *= 4; - b += 3; - c -= 2; - d /= 1; - - e = strtol("10", NULL, 10); - f = strtol("20", NULL, 10); - g = strtol("30", NULL, 10); - h = strtol("40", NULL, 10); - - return (a + b * c - d) + (e * f - g / h); -} - -static void -bytes_transfer(int operation, size_t size, enum bytes_transfer_type type) -{ - const int exitval = 5; - const int sigval = SIGSTOP; - pid_t child, wpid; - bool skip = false; - - int lookup_me = 0; - uint8_t lookup_me8 = 0; - uint16_t lookup_me16 = 0; - uint32_t lookup_me32 = 0; - uint64_t lookup_me64 = 0; - - int magic = 0x13579246; - uint8_t magic8 = 0xab; - uint16_t magic16 = 0x1234; - uint32_t magic32 = 0x98765432; - uint64_t magic64 = 0xabcdef0123456789; - - struct ptrace_io_desc io; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - /* 513 is just enough, for the purposes of ATF it's good enough */ - AuxInfo ai[513], *aip; - - ATF_REQUIRE(size < sizeof(ai)); - - /* Prepare variables for .TEXT transfers */ - switch (type) { - case BYTES_TRANSFER_TEXT: - memcpy(&magic, bytes_transfer_dummy, sizeof(magic)); - break; - case BYTES_TRANSFER_TEXTIO: - switch (size) { - case 8: - memcpy(&magic8, bytes_transfer_dummy, sizeof(magic8)); - break; - case 16: - memcpy(&magic16, bytes_transfer_dummy, sizeof(magic16)); - break; - case 32: - memcpy(&magic32, bytes_transfer_dummy, sizeof(magic32)); - break; - case 64: - memcpy(&magic64, bytes_transfer_dummy, sizeof(magic64)); - break; - } - break; - default: - break; - } - - /* Prepare variables for PIOD and AUXV transfers */ - switch (type) { - case BYTES_TRANSFER_TEXTIO: - case BYTES_TRANSFER_DATAIO: - io.piod_op = operation; - switch (size) { - case 8: - io.piod_offs = (type == BYTES_TRANSFER_TEXTIO) ? - (void *)bytes_transfer_dummy : - &lookup_me8; - io.piod_addr = &lookup_me8; - io.piod_len = sizeof(lookup_me8); - break; - case 16: - io.piod_offs = (type == BYTES_TRANSFER_TEXTIO) ? - (void *)bytes_transfer_dummy : - &lookup_me16; - io.piod_addr = &lookup_me16; - io.piod_len = sizeof(lookup_me16); - break; - case 32: - io.piod_offs = (type == BYTES_TRANSFER_TEXTIO) ? - (void *)bytes_transfer_dummy : - &lookup_me32; - io.piod_addr = &lookup_me32; - io.piod_len = sizeof(lookup_me32); - break; - case 64: - io.piod_offs = (type == BYTES_TRANSFER_TEXTIO) ? - (void *)bytes_transfer_dummy : - &lookup_me64; - io.piod_addr = &lookup_me64; - io.piod_len = sizeof(lookup_me64); - break; - default: - break; - } - break; - case BYTES_TRANSFER_AUXV: - io.piod_op = operation; - io.piod_offs = 0; - io.piod_addr = ai; - io.piod_len = size; - break; - default: - break; - } - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - switch (type) { - case BYTES_TRANSFER_DATA: - switch (operation) { - case PT_READ_D:
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon May 4 21:55:12 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_kill_wait.h Log Message: Move kill()-like tests out of t_ptrace_wait.c to t_ptrace_kill_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_kill_wait.h cvs rdiff -u -r1.176 -r1.177 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.176 src/tests/lib/libc/sys/t_ptrace_wait.c:1.177 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.176 Mon May 4 21:33:20 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon May 4 21:55:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.176 2020/05/04 21:33:20 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.177 2020/05/04 21:55:12 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.176 2020/05/04 21:33:20 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.177 2020/05/04 21:55:12 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -5014,75 +5014,6 @@ BYTES_TRANSFER_EOF(bytes_transfer_eof_pi /// -static void -ptrace_kill(const char *type) -{ - const int sigval = SIGSTOP; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - /* NOTREACHED */ - FORKEE_ASSERTX(0 && - "Child should be terminated by a signal from its parent"); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Before killing the child process with %s\n", type); - if (strcmp(type, "ptrace(PT_KILL)") == 0) { - SYSCALL_REQUIRE(ptrace(PT_KILL, child, (void*)1, 0) != -1); - } else if (strcmp(type, "kill(SIGKILL)") == 0) { - kill(child, SIGKILL); - } else if (strcmp(type, "killpg(SIGKILL)") == 0) { - setpgid(child, 0); - killpg(getpgid(child), SIGKILL); - } - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_signaled(status, SIGKILL, 0); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_FAILURE(ECHILD, wpid = TWAIT_GENERIC(child, &status, 0)); -} - -#define PTRACE_KILL(test, type) \ -ATF_TC(test);\ -ATF_TC_HEAD(test, tc) \ -{ \ -atf_tc_set_md_var(tc, "descr", \ -"Verify killing the child with " type); \ -} \ - \ -ATF_TC_BODY(test, tc) \ -{ \ - \ -ptrace_kill(type); \ -} - -// PT_CONTINUE with SIGKILL is covered by traceme_sendsignal_simple1 -PTRACE_KILL(kill1, "ptrace(PT_KILL)") -PTRACE_KILL(kill2, "kill(SIGKILL)") -PTRACE_KILL(kill3, "killpg(SIGKILL)") - -/// - static int lwpinfo_thread_sigmask[] = {SIGXCPU, SIGPIPE, SIGALRM, SIGURG}; static pthread_mutex_t lwpinfo_thread_mtx = PTHREAD_MUTEX_INITIALIZER; @@ -8458,6 +8389,7 @@ THREAD_CONCURRENT_TEST(thread_concurrent #include "t_ptrace_register_wait.h" #include "t_ptrace_syscall_wait.h" #include "t_ptrace_step_wait.h" +#include "t_ptrace_kill_wait.h" /// @@ -8865,10 +8797,6 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, bytes_transfer_eof_piod_write_i); ATF_TP_ADD_TC(tp, bytes_transfer_eof_piod_write_d); - ATF_TP_ADD_TC(tp, kill1); - ATF_TP_ADD_TC(tp, kill2); - ATF_TP_ADD_TC(tp, kill3); - ATF_TP_ADD_TC(tp, traceme_lwpinfo0); ATF_TP_ADD_TC(tp, traceme_lwpinfo1); ATF_TP_ADD_TC(tp, traceme_lwpinfo2); @@ -9055,6 +8983,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TCS_PTRACE_WAIT_REGISTER(); ATF_TP_ADD_TCS_PTRACE_WAIT_SYSCALL(); ATF_TP_ADD_TCS_PTRACE_WAIT_STEP(); + ATF_TP_ADD_TCS_PTRACE_WAIT_KILL(); ATF_TP_ADD_TCS_PTRACE_WAIT_AMD64(); ATF_TP_ADD_TCS_PTRACE_WAIT_I386(); Added files: Index: src/tests/lib/libc/sys/t_ptrace_kill_wait.h diff -u /dev/null src/tests/lib/libc/sys/t_ptrace_kill_wait.h:1.1 --- /dev/null Mon May
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon May 4 21:33:20 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_step_wait.h Log Message: Move PT_STEP tests out of t_ptrace_wait.c to t_ptrace_step_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_step_wait.h cvs rdiff -u -r1.175 -r1.176 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.175 src/tests/lib/libc/sys/t_ptrace_wait.c:1.176 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.175 Mon May 4 21:21:30 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon May 4 21:33:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.175 2020/05/04 21:21:30 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.176 2020/05/04 21:33:20 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.175 2020/05/04 21:21:30 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.176 2020/05/04 21:33:20 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -5014,226 +5014,6 @@ BYTES_TRANSFER_EOF(bytes_transfer_eof_pi /// -#if defined(PT_STEP) -static void -ptrace_step(int N, int setstep, bool masked, bool ignored) -{ - const int exitval = 5; - const int sigval = SIGSTOP; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - int happy; - struct sigaction sa; - struct ptrace_siginfo info; - sigset_t intmask; - struct kinfo_proc2 kp; - size_t len = sizeof(kp); - - int name[6]; - const size_t namelen = __arraycount(name); - ki_sigset_t kp_sigmask; - ki_sigset_t kp_sigignore; - -#if defined(__arm__) - /* PT_STEP not supported on arm 32-bit */ - atf_tc_expect_fail("PR kern/52119"); -#endif - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - if (masked) { - sigemptyset(&intmask); - sigaddset(&intmask, SIGTRAP); - sigprocmask(SIG_BLOCK, &intmask, NULL); - } - - if (ignored) { - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = SIG_IGN; - sigemptyset(&sa.sa_mask); - FORKEE_ASSERT(sigaction(SIGTRAP, &sa, NULL) != -1); - } - - happy = check_happy(999); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - FORKEE_ASSERT_EQ(happy, check_happy(999)); - - DPRINTF("Before exiting of the child process\n"); - _exit(exitval); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); - SYSCALL_REQUIRE( - ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); - - DPRINTF("Before checking siginfo_t\n"); - ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP); - - name[0] = CTL_KERN, - name[1] = KERN_PROC2, - name[2] = KERN_PROC_PID; - name[3] = child; - name[4] = sizeof(kp); - name[5] = 1; - - FORKEE_ASSERT_EQ(sysctl(name, namelen, &kp, &len, NULL, 0), 0); - - if (masked) - kp_sigmask = kp.p_sigmask; - - if (ignored) - kp_sigignore = kp.p_sigignore; - - while (N --> 0) { - if (setstep) { - DPRINTF("Before resuming the child process where it " - "left off and without signal to be sent (use " - "PT_SETSTEP and PT_CONTINUE)\n"); - SYSCALL_REQUIRE(ptrace(PT_SETSTEP, child, 0, 0) != -1); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) - != -1); - } else { - DPRINTF("Before resuming the child process where it " - "left off and without signal to be sent (use " - "PT_STEP)\n"); - SYSCALL_REQUIRE(ptrace(PT_STEP, child, (void *)1, 0) - != -1); - } - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), - child); - - validate_status_stopped(status, SIGTRAP); - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); - SYSCALL_REQUIRE( - ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); - - DPRINTF("Before checking siginfo_t\n"); - ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_TRACE); - - if (setstep) { - SYSCALL_REQUIRE(ptrace(PT_CLEARSTEP,
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon May 4 21:21:30 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_syscall_wait.h Log Message: Move syscall tests out of t_ptrace_wait.c to t_ptrace_syscall_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_syscall_wait.h cvs rdiff -u -r1.174 -r1.175 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.174 src/tests/lib/libc/sys/t_ptrace_wait.c:1.175 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.174 Mon May 4 20:55:48 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon May 4 21:21:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.174 2020/05/04 20:55:48 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.175 2020/05/04 21:21:30 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.174 2020/05/04 20:55:48 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.175 2020/05/04 21:21:30 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -7267,245 +7267,6 @@ ATF_TC_BODY(resume, tc) /// -static int test_syscall_caught; - -static void -syscall_sighand(int arg) -{ - - DPRINTF("Caught a signal %d in process %d\n", arg, getpid()); - - FORKEE_ASSERT_EQ(arg, SIGINFO); - - ++test_syscall_caught; - - FORKEE_ASSERT_EQ(test_syscall_caught, 1); -} - -static void -syscall_body(const char *op) -{ - const int exitval = 5; - const int sigval = SIGSTOP; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - struct ptrace_siginfo info; - - memset(&info, 0, sizeof(info)); - -#if defined(TWAIT_HAVE_STATUS) - if (strstr(op, "signal") != NULL) { - atf_tc_expect_fail("XXX: behavior under investigation"); - } -#endif - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - signal(SIGINFO, syscall_sighand); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - syscall(SYS_getpid); - - if (strstr(op, "signal") != NULL) { - FORKEE_ASSERT_EQ(test_syscall_caught, 1); - } - - DPRINTF("Before exiting of the child process\n"); - _exit(exitval); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_SYSCALL, child, (void *)1, 0) != -1); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, SIGTRAP); - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n"); - SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info, sizeof(info)) != -1); - - DPRINTF("Before checking siginfo_t and lwpid\n"); - ATF_REQUIRE(info.psi_lwpid > 0); - ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP); - ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCE); - - if (strstr(op, "killed") != NULL) { - SYSCALL_REQUIRE(ptrace(PT_KILL, child, NULL, 0) != -1); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS( - wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_signaled(status, SIGKILL, 0); - } else { - if (strstr(op, "signal") != NULL) { - DPRINTF("Before resuming the child %d and sending a " - "signal SIGINFO\n", child); - SYSCALL_REQUIRE( - ptrace(PT_CONTINUE, child, (void *)1, SIGINFO) - != -1); - } else if (strstr(op, "detach") != NULL) { - DPRINTF("Before detaching the child %d\n", child); - SYSCALL_REQUIRE( - ptrace(PT_DETACH, child, (void *)1, 0) != -1); - } else { - DPRINTF("Before resuming the child process where it " - "left off and without signal to be sent\n"); - SYSCALL_REQUIRE( - ptrace(PT_SYSCALL, child, (void *)1, 0) != -1); - - DPRINTF("Before calling %s() for the child\n", - TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS( - wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, SIGTRAP); - - DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO " - "for child\n"); - SYSCA
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: kamil Date: Mon May 4 20:55:48 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.c Added Files: src/tests/lib/libc/sys: t_ptrace_register_wait.h Log Message: Move register tests out of t_ptrace_wait.c to t_ptrace_register_wait.h The same tests are now included with the preprocessor in t_ptrace_wait.c. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_register_wait.h cvs rdiff -u -r1.173 -r1.174 src/tests/lib/libc/sys/t_ptrace_wait.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.c diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.173 src/tests/lib/libc/sys/t_ptrace_wait.c:1.174 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.173 Fri Apr 24 12:17:45 2020 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Mon May 4 20:55:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.173 2020/04/24 12:17:45 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.174 2020/05/04 20:55:48 kamil Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.173 2020/04/24 12:17:45 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.174 2020/05/04 20:55:48 kamil Exp $"); #define __LEGACY_PT_LWPINFO @@ -5014,172 +5014,6 @@ BYTES_TRANSFER_EOF(bytes_transfer_eof_pi /// -#if defined(HAVE_GPREGS) || defined(HAVE_FPREGS) -static void -access_regs(const char *regset, const char *aux) -{ - const int exitval = 5; - const int sigval = SIGSTOP; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif -#if defined(HAVE_GPREGS) - struct reg gpr; - register_t rgstr; -#endif -#if defined(HAVE_FPREGS) - struct fpreg fpr; -#endif - -#if !defined(HAVE_GPREGS) - if (strcmp(regset, "regs") == 0) - atf_tc_fail("Impossible test scenario!"); -#endif - -#if !defined(HAVE_FPREGS) - if (strcmp(regset, "fpregs") == 0) - atf_tc_fail("Impossible test scenario!"); -#endif - - DPRINTF("Before forking process PID=%d\n", getpid()); - SYSCALL_REQUIRE((child = fork()) != -1); - if (child == 0) { - DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid()); - FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - DPRINTF("Before exiting of the child process\n"); - _exit(exitval); - } - DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child); - - DPRINTF("Before calling %s() for the child\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, &status, 0), child); - - validate_status_stopped(status, sigval); - -#if defined(HAVE_GPREGS) - if (strcmp(regset, "regs") == 0) { - DPRINTF("Call GETREGS for the child process\n"); - SYSCALL_REQUIRE(ptrace(PT_GETREGS, child, &gpr, 0) != -1); - - if (strcmp(aux, "none") == 0) { - DPRINTF("Retrieved registers\n"); - } else if (strcmp(aux, "pc") == 0) { - rgstr = PTRACE_REG_PC(&gpr); - DPRINTF("Retrieved %" PRIxREGISTER "\n", rgstr); - } else if (strstr(aux, "set_pc") != NULL) { - rgstr = PTRACE_REG_PC(&gpr); - DPRINTF("Retrieved PC %" PRIxREGISTER "\n", rgstr); - if (strstr(aux, "0x1") != NULL) { -rgstr |= 0x1; - } else if (strstr(aux, "0x3") != NULL) { -rgstr |= 0x3; - } else if (strstr(aux, "0x7") != NULL) { -rgstr |= 0x7; - } - DPRINTF("Set PC %" PRIxREGISTER "\n", rgstr); - PTRACE_REG_SET_PC(&gpr, rgstr); - if (strcmp(aux, "set_pc") != 0) { -/* This call can fail with EINVAL or similar. */ -ptrace(PT_SETREGS, child, &gpr, 0); - } - } else if (strcmp(aux, "sp") == 0) { - rgstr = PTRACE_REG_SP(&gpr); - DPRINTF("Retrieved %" PRIxREGISTER "\n", rgstr); - } else if (strcmp(aux, "intrv") == 0) { - rgstr = PTRACE_REG_INTRV(&gpr); - DPRINTF("Retrieved %" PRIxREGISTER "\n", rgstr); - } else if (strcmp(aux, "setregs") == 0) { - DPRINTF("Call SETREGS for the child process\n"); - SYSCALL_REQUIRE( - ptrace(PT_SETREGS, child, &gpr, 0) != -1); - } - } -#endif - -#if defined(HAVE_FPREGS) - if (strcmp(regset, "fpregs") == 0) { - DPRINTF("Call GETFPREGS for the child process\n"); - SYSCALL_REQUIRE(ptrace(PT_GETFPREGS, child, &fpr, 0) != -1); - - if (strcmp(aux, "getfpregs") == 0) { - DPRINTF("Retrieved FP registers\n"); - } else if (strcmp(aux, "setfpregs") == 0) { - DPRINTF("Call SETFPREGS for the child\n"); - SYSCALL_REQUIRE( - ptrace(PT_SETFPREGS, child, &fpr, 0) != -1); - } - } -#endif - - DPRINTF("Before resuming the child process where it left off and " - "without signal to be sent\n"); - SYSCALL_REQUIRE(ptrace(PT_CONTINUE, child, (void *)1, 0) != -1); - - if (strstr(aux, "unaligned") != NULL) { - DPRINTF("Before resuming the child p
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jdolecek Date: Mon May 4 20:06:38 UTC 2020 Modified Files: src/sys/dev/acpi: acpi_ec.c acpi_quirks.c wss_acpi.c Log Message: constify To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/dev/acpi/acpi_ec.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/acpi/acpi_quirks.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/acpi/wss_acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/acpi/acpi_ec.c diff -u src/sys/dev/acpi/acpi_ec.c:1.82 src/sys/dev/acpi/acpi_ec.c:1.83 --- src/sys/dev/acpi/acpi_ec.c:1.82 Tue Apr 28 10:04:32 2020 +++ src/sys/dev/acpi/acpi_ec.c Mon May 4 20:06:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_ec.c,v 1.82 2020/04/28 10:04:32 jmcneill Exp $ */ +/* $NetBSD: acpi_ec.c,v 1.83 2020/05/04 20:06:38 jdolecek Exp $ */ /*- * Copyright (c) 2007 Joerg Sonnenberger . @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.82 2020/04/28 10:04:32 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.83 2020/05/04 20:06:38 jdolecek Exp $"); #include #include @@ -101,7 +101,7 @@ ACPI_MODULE_NAME("acpi_ec") #define EC_STATUS_SCI 0x20 #define EC_STATUS_SMI 0x40 -static const char *ec_hid[] = { +static const char * const ec_hid[] = { "PNP0C09", NULL, }; Index: src/sys/dev/acpi/acpi_quirks.c diff -u src/sys/dev/acpi/acpi_quirks.c:1.20 src/sys/dev/acpi/acpi_quirks.c:1.21 --- src/sys/dev/acpi/acpi_quirks.c:1.20 Mon Nov 14 02:44:59 2011 +++ src/sys/dev/acpi/acpi_quirks.c Mon May 4 20:06:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_quirks.c,v 1.20 2011/11/14 02:44:59 jmcneill Exp $ */ +/* $NetBSD: acpi_quirks.c,v 1.21 2020/05/04 20:06:38 jdolecek Exp $ */ /*- * Copyright (c) 2011 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_quirks.c,v 1.20 2011/11/14 02:44:59 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_quirks.c,v 1.21 2020/05/04 20:06:38 jdolecek Exp $"); #include "opt_acpi.h" @@ -84,7 +84,7 @@ ACPI_MODULE_NAME ("acpi_quirks") static int acpi_quirks_revcmp(uint32_t, uint32_t, int); -static struct acpi_quirk acpi_quirks[] = { +static const struct acpi_quirk acpi_quirks[] = { { ACPI_SIG_FADT, "ASUS ", 0x30303031, AQ_LTE, "CUV4X-D ", ACPI_QUIRK_BROKEN }, @@ -152,7 +152,7 @@ int acpi_find_quirks(void) { ACPI_TABLE_HEADER fadt, dsdt, xsdt, *hdr; - struct acpi_quirk *aq; + const struct acpi_quirk *aq; ACPI_STATUS rv; size_t i, len; Index: src/sys/dev/acpi/wss_acpi.c diff -u src/sys/dev/acpi/wss_acpi.c:1.32 src/sys/dev/acpi/wss_acpi.c:1.33 --- src/sys/dev/acpi/wss_acpi.c:1.32 Wed May 8 13:40:17 2019 +++ src/sys/dev/acpi/wss_acpi.c Mon May 4 20:06:38 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: wss_acpi.c,v 1.32 2019/05/08 13:40:17 isaki Exp $ */ +/* $NetBSD: wss_acpi.c,v 1.33 2020/05/04 20:06:38 jdolecek Exp $ */ /* * Copyright (c) 2002 Jared D. McNeill @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wss_acpi.c,v 1.32 2019/05/08 13:40:17 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wss_acpi.c,v 1.33 2020/05/04 20:06:38 jdolecek Exp $"); #include #include @@ -59,7 +59,7 @@ struct wss_acpi_hint { int offset_ad1848; /* offset from start of DAC region */ }; -static struct wss_acpi_hint wss_acpi_hints[] = { +static const struct wss_acpi_hint wss_acpi_hints[] = { { "NMX2210", 1, 2, WSS_CODEC }, { "CSC", 0, 1, 0 }, /* Dell Latitude CPi */ { "CSC0100", 0, 1, 0 }, /* CS4610 with CS4236 codec */ @@ -114,7 +114,7 @@ wss_acpi_attach(device_t parent, device_ struct acpi_drq *playdrq, *recdrq; struct audio_attach_args arg; ACPI_STATUS rv; - struct wss_acpi_hint *wah; + const struct wss_acpi_hint *wah; sc->sc_ad1848.sc_ad1848.sc_dev = self; wah = &wss_acpi_hints[
CVS commit: src/sys/arch/arm/include/arm32
Module Name:src Committed By: joerg Date: Mon May 4 18:36:24 UTC 2020 Modified Files: src/sys/arch/arm/include/arm32: pte.h Log Message: Prevent double definition of pt_entry_t from machine/param.h To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/include/arm32/pte.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/include/arm32/pte.h diff -u src/sys/arch/arm/include/arm32/pte.h:1.22 src/sys/arch/arm/include/arm32/pte.h:1.23 --- src/sys/arch/arm/include/arm32/pte.h:1.22 Sun Feb 2 09:19:48 2020 +++ src/sys/arch/arm/include/arm32/pte.h Mon May 4 18:36:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.22 2020/02/02 09:19:48 skrll Exp $ */ +/* $NetBSD: pte.h,v 1.23 2020/05/04 18:36:24 joerg Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -89,7 +89,11 @@ #ifndef _LOCORE typedef uint32_t pd_entry_t; /* L1 table entry */ -typedef uint32_t pt_entry_t; /* L2 table entry */ +#ifndef __BSD_PTENTRY_T__ +#define __BSD_PTENTRY_T__ +typedef uint32_t pt_entry_t; +#define PRIxPTE PRIx32 +#endif #endif /* _LOCORE */ #define L1_SS_SIZE 0x0100 /* 16M */
CVS commit: src/sys
Module Name:src Committed By: riastradh Date: Mon May 4 18:23:37 UTC 2020 Modified Files: src/sys/kern: kern_condvar.c subr_time.c src/sys/sys: timevar.h Log Message: New timedwaitclock_setup. C99 initializers would have been nice, but part of the struct is explicit parameters and part of the struct is implicit state, and -Wmissing-field-initializers can't discriminate between them (although for some reason it doesn't always fire!). Instead, just do: struct timedwaitclock T; timedwaitclock_setup(&T, timeout, clockid, flags, epsilon); while (...) { error = timedwaitclock_begin(&T, &timo); if (error) ... error = waitwhatever(timo); timedwaitclock_end(&T); ... } To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/kern/kern_condvar.c cvs rdiff -u -r1.22 -r1.23 src/sys/kern/subr_time.c cvs rdiff -u -r1.42 -r1.43 src/sys/sys/timevar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_condvar.c diff -u src/sys/kern/kern_condvar.c:1.50 src/sys/kern/kern_condvar.c:1.51 --- src/sys/kern/kern_condvar.c:1.50 Sun May 3 17:36:33 2020 +++ src/sys/kern/kern_condvar.c Mon May 4 18:23:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_condvar.c,v 1.50 2020/05/03 17:36:33 thorpej Exp $ */ +/* $NetBSD: kern_condvar.c,v 1.51 2020/05/04 18:23:37 riastradh Exp $ */ /*- * Copyright (c) 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.50 2020/05/03 17:36:33 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.51 2020/05/04 18:23:37 riastradh Exp $"); #include #include @@ -261,12 +261,7 @@ int cv_timedwaitclock(kcondvar_t *cv, kmutex_t *mtx, struct timespec *timeout, clockid_t clockid, int flags, const struct bintime *epsilon) { - struct timedwaitclock T = { - .timeout = timeout, - .clockid = clockid, - .flags = flags, - .epsilon = epsilon, - }; + struct timedwaitclock T; int timo; int error; @@ -275,6 +270,7 @@ cv_timedwaitclock(kcondvar_t *cv, kmutex return 0; } + timedwaitclock_setup(&T, timeout, clockid, flags, epsilon); error = timedwaitclock_begin(&T, &timo); if (error) return error; @@ -301,18 +297,14 @@ int cv_timedwaitclock_sig(kcondvar_t *cv, kmutex_t *mtx, struct timespec *timeout, clockid_t clockid, int flags, const struct bintime *epsilon) { - struct timedwaitclock T = { - .timeout = timeout, - .clockid = clockid, - .flags = flags, - .epsilon = epsilon, - }; + struct timedwaitclock T; int timo; int error; if (timeout == NULL) return cv_wait_sig(cv, mtx); + timedwaitclock_setup(&T, timeout, clockid, flags, epsilon); error = timedwaitclock_begin(&T, &timo); if (error) return error; Index: src/sys/kern/subr_time.c diff -u src/sys/kern/subr_time.c:1.22 src/sys/kern/subr_time.c:1.23 --- src/sys/kern/subr_time.c:1.22 Sun May 3 17:36:33 2020 +++ src/sys/kern/subr_time.c Mon May 4 18:23:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_time.c,v 1.22 2020/05/03 17:36:33 thorpej Exp $ */ +/* $NetBSD: subr_time.c,v 1.23 2020/05/04 18:23:37 riastradh Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.22 2020/05/03 17:36:33 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_time.c,v 1.23 2020/05/04 18:23:37 riastradh Exp $"); #include #include @@ -355,6 +355,38 @@ ts2timo(clockid_t clock_id, int flags, s return 0; } +/* + * timedwaitclock_setup(T, timeout, clockid, flags, epsilon) + * + * Initialize state for a timedwaitclock, to be used subsequently + * with timedwaitclock_begin/end, possibly many times in a row. + * + * No cleanup action required at the end; the caller-allocated + * (typically stack-allocated) timedwaitclock just holds + * parameters and a little state for timedwaitclock_begin/end. + */ +void +timedwaitclock_setup(struct timedwaitclock *T, struct timespec *timeout, +clockid_t clockid, int flags, const struct bintime *epsilon) +{ + + memset(T, 0, sizeof(*T)); + T->timeout = timeout; + T->clockid = clockid; + T->flags = flags; + T->epsilon = epsilon; + T->starttime = (struct timespec){0,0}; +} + +/* + * timedwaitclock_begin(T, timo) + * + * Decide how many ticks to wait for the timedwaitclock T and + * store it in *timo. Keep state for timedwaitclock_end. May + * fail with EINVAL if the specified timeout is invalid, or if the + * specified clock fails. Fails with ETIMEDOUT if there is no + * time left to wait. + */ int timedwaitclock_begin(struct timedwaitclock *T, int *timo) { @@ -406,6 +438,14 @@ timedwaitclock_begin(struct timedwaitclo return 0; } +/* + * timedwaitclock_end(T) + * + * If the timedwaitclock T was relative, update the caller's + *
CVS commit: src/usr.sbin/sysinst/arch/evbarm
Module Name:src Committed By: joerg Date: Mon May 4 18:19:34 UTC 2020 Modified Files: src/usr.sbin/sysinst/arch/evbarm: md.h Log Message: boardype should not be common. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/arch/evbarm/md.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/sysinst/arch/evbarm/md.h diff -u src/usr.sbin/sysinst/arch/evbarm/md.h:1.5 src/usr.sbin/sysinst/arch/evbarm/md.h:1.6 --- src/usr.sbin/sysinst/arch/evbarm/md.h:1.5 Mon Jan 20 21:26:35 2020 +++ src/usr.sbin/sysinst/arch/evbarm/md.h Mon May 4 18:19:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: md.h,v 1.5 2020/01/20 21:26:35 martin Exp $ */ +/* $NetBSD: md.h,v 1.6 2020/05/04 18:19:34 joerg Exp $ */ /* * Copyright 1997 Piermont Information Systems Inc. @@ -96,7 +96,7 @@ #define BOARD_TYPE_NORMAL 0 /* assume u-boot */ #define BOARD_TYPE_RPI 1 /* RPi firmware booted us */ #define BOARD_TYPE_ACPI 2 /* generic SBSA machine */ -int boardtype; +extern int boardtype; /* * Size limit for the initial GPT part, in bytes. This allows us to
CVS commit: src/doc
Module Name:src Committed By: jdolecek Date: Mon May 4 16:21:23 UTC 2020 Modified Files: src/doc: CHANGES Log Message: note feature-sg and jumbo frames for xennet(4)/xvif(4), MSI for XenPV To generate a diff of this commit: cvs rdiff -u -r1.2684 -r1.2685 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2684 src/doc/CHANGES:1.2685 --- src/doc/CHANGES:1.2684 Mon May 4 06:55:12 2020 +++ src/doc/CHANGES Mon May 4 16:21:23 2020 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2684 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2685 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -189,3 +189,6 @@ Changes from NetBSD 9.0 to NetBSD 10.0: xen: Added support for Xen PVH. [bouyer 20200502] hp300: Add bitmap access ops support for EVRX framebuffer on HP9000/425e. [tsutsui 20200504] + xennet(4): add support for feature-sg & jumbo frames [jdolecek 20200430] + xvif(4): add support for feature-sg & jumbo frames [jdolecek 20200503] + xen: Support MSI for XenPV [jdolecek 20200504]
CVS commit: src/sys/arch
Module Name:src Committed By: jdolecek Date: Mon May 4 15:55:57 UTC 2020 Modified Files: src/sys/arch/amd64/include: types.h src/sys/arch/i386/include: types.h src/sys/arch/x86/pci: msipic.c msipic.h pci_machdep.c src/sys/arch/xen/include: evtchn.h src/sys/arch/xen/x86: pintr.c xen_intr.c src/sys/arch/xen/xen: evtchn.c Log Message: add support for using MSI for XenPV Dom0 use PHYSDEVOP_map_pirq to get the pirq/gsi for MSI/MSI-X, switch also INTx to use it instead of PHYSDEVOP_alloc_irq_vector MSI confirmed working with single-vector MSI for wm(4), ahcisata(4), bge(4) XXX added some provision for MSI-X, but it doesn't actually work (no interrupts delivered), needs some further investigation; disable MSI-X for XENPV via flag in x86/pci/pci_machdep.c To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/include/types.h cvs rdiff -u -r1.90 -r1.91 src/sys/arch/i386/include/types.h cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/pci/msipic.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/msipic.h cvs rdiff -u -r1.86 -r1.87 src/sys/arch/x86/pci/pci_machdep.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/xen/include/evtchn.h cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/x86/pintr.c cvs rdiff -u -r1.24 -r1.25 src/sys/arch/xen/x86/xen_intr.c cvs rdiff -u -r1.91 -r1.92 src/sys/arch/xen/xen/evtchn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/include/types.h diff -u src/sys/arch/amd64/include/types.h:1.67 src/sys/arch/amd64/include/types.h:1.68 --- src/sys/arch/amd64/include/types.h:1.67 Sat Apr 25 15:26:16 2020 +++ src/sys/arch/amd64/include/types.h Mon May 4 15:55:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.67 2020/04/25 15:26:16 bouyer Exp $ */ +/* $NetBSD: types.h,v 1.68 2020/05/04 15:55:56 jdolecek Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -100,6 +100,9 @@ typedef unsigned char __cpu_simple_lock #define __HAVE_MM_MD_DIRECT_MAPPED_IO #define __HAVE_MM_MD_DIRECT_MAPPED_PHYS #define __HAVE_UCAS_FULL +#if !defined(NO_PCI_MSI_MSIX) +#define __HAVE_PCI_MSI_MSIX +#endif #ifdef _KERNEL_OPT #define __HAVE_RAS @@ -116,9 +119,6 @@ typedef unsigned char __cpu_simple_lock #define __HAVE_DIRECT_MAP 1 #endif #define __HAVE_CPU_UAREA_ROUTINES 1 -#if !defined(NO_PCI_MSI_MSIX) -#define __HAVE_PCI_MSI_MSIX -#endif #endif #endif Index: src/sys/arch/i386/include/types.h diff -u src/sys/arch/i386/include/types.h:1.90 src/sys/arch/i386/include/types.h:1.91 --- src/sys/arch/i386/include/types.h:1.90 Mon Sep 23 23:06:26 2019 +++ src/sys/arch/i386/include/types.h Mon May 4 15:55:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: types.h,v 1.90 2019/09/23 23:06:26 kamil Exp $ */ +/* $NetBSD: types.h,v 1.91 2020/05/04 15:55:56 jdolecek Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -133,13 +133,9 @@ typedef __register_t register_t; #define __HAVE_TLS_VARIANT_II #define __HAVE_COMMON___TLS_GET_ADDR #define __HAVE_UCAS_FULL - -#if defined(_KERNEL) -#define __HAVE_RAS - -#if !defined(XEN) && !defined(NO_PCI_MSI_MSIX) +#if !defined(NO_PCI_MSI_MSIX) #define __HAVE_PCI_MSI_MSIX #endif -#endif +#define __HAVE_RAS #endif /* _I386_MACHTYPES_H_ */ Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.22 src/sys/arch/x86/pci/msipic.c:1.23 --- src/sys/arch/x86/pci/msipic.c:1.22 Mon May 4 09:34:37 2020 +++ src/sys/arch/x86/pci/msipic.c Mon May 4 15:55:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.22 2020/05/04 09:34:37 jdolecek Exp $ */ +/* $NetBSD: msipic.c,v 1.23 2020/05/04 15:55:56 jdolecek Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.22 2020/05/04 09:34:37 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.23 2020/05/04 15:55:56 jdolecek Exp $"); #include "opt_intrdebug.h" @@ -70,12 +70,9 @@ __KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1 * is managed by below "dev_seqs". */ struct msipic { - int mp_bus; - int mp_dev; - int mp_fun; + struct msipic_pci_info mp_i; int mp_devid; /* The device id for the MSI/MSI-X device. */ - int mp_veccnt; /* The number of MSI/MSI-X vectors. */ char mp_pic_name[MSIPICNAMEBUF]; /* The MSI/MSI-X device's name. */ @@ -256,7 +253,7 @@ msipic_construct_common_msi_pic(const st pic->pic_msipic = msipic; msipic->mp_pic = pic; pci_decompose_tag(pa->pa_pc, pa->pa_tag, - &msipic->mp_bus, &msipic->mp_dev, &msipic->mp_fun); + &msipic->mp_i.mp_bus, &msipic->mp_i.mp_dev, &msipic->mp_i.mp_fun); memcpy(&msipic->mp_pa, pa, sizeof(msipic->mp_pa)); msipic->mp_devid = devid; /* @@ -311,6 +308,17 @@ msipic_get_devid(struct pic *pic) return pic->pic_msipic->mp_devid; } +/* + * Return the PCI bus/dev/func info for the device. + */ +const struct msipic_pci_info * +msipic_
CVS commit: src/share/man/man9
Module Name:src Committed By: wiz Date: Mon May 4 15:13:46 UTC 2020 Modified Files: src/share/man/man9: rnd.9 Log Message: Improve markup. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/share/man/man9/rnd.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/rnd.9 diff -u src/share/man/man9/rnd.9:1.28 src/share/man/man9/rnd.9:1.29 --- src/share/man/man9/rnd.9:1.28 Thu Apr 30 03:28:18 2020 +++ src/share/man/man9/rnd.9 Mon May 4 15:13:45 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: rnd.9,v 1.28 2020/04/30 03:28:18 riastradh Exp $ +.\" $NetBSD: rnd.9,v 1.29 2020/05/04 15:13:45 wiz Exp $ .\" .\" Copyright (c) 1997 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -275,7 +275,7 @@ but may be used in a callback as set wit .Fn rndsource_setcb . .It Fn rnd_add_uint32 "rnd_source" "datum" Equivalent to -.Li "rnd_add_data(" Ns Fa rnd_source Ns Li ", &" Ns datum Ns Li ", 4, 0)" . +.Li rnd_add_data Ns ( Ns Fa rnd_source , Li & Ns Fa datum , Li 4 , 0 ) . .Pp .Fn rnd_add_uint32 .Em must not
CVS commit: src/share/man/man4
Module Name:src Committed By: wiz Date: Mon May 4 15:10:41 UTC 2020 Modified Files: src/share/man/man4: rnd.4 Log Message: Break line after macro arguments end. Use \- for minus. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/share/man/man4/rnd.4 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man4/rnd.4 diff -u src/share/man/man4/rnd.4:1.33 src/share/man/man4/rnd.4:1.34 --- src/share/man/man4/rnd.4:1.33 Fri May 1 19:56:08 2020 +++ src/share/man/man4/rnd.4 Mon May 4 15:10:40 2020 @@ -1,4 +1,4 @@ -.\" $NetBSD: rnd.4,v 1.33 2020/05/01 19:56:08 riastradh Exp $ +.\" $NetBSD: rnd.4,v 1.34 2020/05/04 15:10:40 wiz Exp $ .\" .\" Copyright (c) 2014-2020 The NetBSD Foundation, Inc. .\" All rights reserved. @@ -463,14 +463,15 @@ pool at the next consolidation, such as .It Dv kern.entropy.epoch Pq Vt unsigned int Number of times system has reached full entropy, or entropy has been consolidated with -.Dv kern.entropy.consolidate , as an unsigned 32-bit integer. +.Dv kern.entropy.consolidate , +as an unsigned 32-bit integer. Consulted inside the kernel by subsystems such as .Xr cprng 9 to decide whether to reseed. -Initially set to 2^32 - 1 -.Pq i.e., Li "(unsigned)-1" +Initially set to 2^32 \- 1 +.Pq i.e., Li "(unsigned)\-1" meaning the system has never reached full entropy and the entropy has -never been consolidated; never again set to 2^32 - 1. +never been consolidated; never again set to 2^32 \- 1. Never zero, so applications can initialize a cache of the epoch to zero to ensure they reseed the next time they check whether it is different from the stored epoch.
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: thorpej Date: Mon May 4 15:09:34 UTC 2020 Modified Files: src/tests/lib/libc/sys: t_futex_ops.c Log Message: Add a test case for PR kern/55230. It is currently marked as expect-fail. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_futex_ops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_futex_ops.c diff -u src/tests/lib/libc/sys/t_futex_ops.c:1.3 src/tests/lib/libc/sys/t_futex_ops.c:1.4 --- src/tests/lib/libc/sys/t_futex_ops.c:1.3 Thu Apr 30 04:18:07 2020 +++ src/tests/lib/libc/sys/t_futex_ops.c Mon May 4 15:09:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: t_futex_ops.c,v 1.3 2020/04/30 04:18:07 thorpej Exp $ */ +/* $NetBSD: t_futex_ops.c,v 1.4 2020/05/04 15:09:34 thorpej Exp $ */ /*- * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ #include __COPYRIGHT("@(#) Copyright (c) 2019, 2020\ The NetBSD Foundation, inc. All rights reserved."); -__RCSID("$NetBSD: t_futex_ops.c,v 1.3 2020/04/30 04:18:07 thorpej Exp $"); +__RCSID("$NetBSD: t_futex_ops.c,v 1.4 2020/05/04 15:09:34 thorpej Exp $"); #include #include @@ -42,6 +42,7 @@ __RCSID("$NetBSD: t_futex_ops.c,v 1.3 20 #include #include #include +#include #include #include @@ -1334,6 +1335,152 @@ ATF_TC_CLEANUP(futex_wait_evil_unmapped_ /*/ +static int pri_min; +static int pri_max; + +static void +lowpri_simple_test_waiter_lwp(void *arg) +{ + struct lwp_data *d = arg; + struct sched_param sp; + int policy; + + d->threadid = _lwp_self(); + + ATF_REQUIRE(_sched_getparam(getpid(), d->threadid, &policy, &sp) == 0); + policy = SCHED_RR; + sp.sched_priority = pri_min; + ATF_REQUIRE(_sched_setparam(getpid(), d->threadid, policy, &sp) == 0); + + simple_test_waiter_lwp(arg); +} + +static void +highpri_simple_test_waiter_lwp(void *arg) +{ + struct lwp_data *d = arg; + struct sched_param sp; + int policy; + + d->threadid = _lwp_self(); + + ATF_REQUIRE(_sched_getparam(getpid(), d->threadid, &policy, &sp) == 0); + policy = SCHED_RR; + sp.sched_priority = pri_max; + ATF_REQUIRE(_sched_setparam(getpid(), d->threadid, policy, &sp) == 0); + + simple_test_waiter_lwp(arg); +} + +static void +do_test_wake_highest_pri(void) +{ + lwpid_t waiter; + int tries; + long pri; + + ATF_REQUIRE((pri = sysconf(_SC_SCHED_PRI_MIN)) != -1); + pri_min = (int)pri; + ATF_REQUIRE((pri = sysconf(_SC_SCHED_PRI_MAX)) != -1); + pri_max = (int)pri; + + futex_word = 0; + membar_sync(); + + setup_lwp_context(&lwp_data[0], lowpri_simple_test_waiter_lwp); + lwp_data[0].op_flags = FUTEX_PRIVATE_FLAG; + lwp_data[0].futex_error = -1; + lwp_data[0].futex_ptr = &futex_word; + lwp_data[0].block_val = 0; + lwp_data[0].bitset = 0; + lwp_data[0].wait_op = FUTEX_WAIT; + ATF_REQUIRE(_lwp_create(&lwp_data[0].context, 0, +&lwp_data[0].lwpid) == 0); + + for (tries = 0; tries < 5; tries++) { + membar_sync(); + if (nlwps_running == 1) + break; + sleep(1); + } + membar_sync(); + ATF_REQUIRE_EQ_MSG(nlwps_running, 1, "lowpri waiter failed to start"); + + /* Ensure it's blocked. */ + ATF_REQUIRE(lwp_data[0].futex_error == -1); + + setup_lwp_context(&lwp_data[1], highpri_simple_test_waiter_lwp); + lwp_data[1].op_flags = FUTEX_PRIVATE_FLAG; + lwp_data[1].futex_error = -1; + lwp_data[1].futex_ptr = &futex_word; + lwp_data[1].block_val = 0; + lwp_data[1].bitset = 0; + lwp_data[1].wait_op = FUTEX_WAIT; + ATF_REQUIRE(_lwp_create(&lwp_data[0].context, 0, +&lwp_data[0].lwpid) == 0); + + for (tries = 0; tries < 5; tries++) { + membar_sync(); + if (nlwps_running == 2) + break; + sleep(1); + } + membar_sync(); + ATF_REQUIRE_EQ_MSG(nlwps_running, 2, "highpri waiter failed to start"); + + /* Ensure it's blocked. */ + ATF_REQUIRE(lwp_data[1].futex_error == -1); + + /* Wake the first LWP. We should get the highpri thread. */ + ATF_REQUIRE(__futex(&futex_word, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, + 1, NULL, NULL, 0, 0) == 1); + sleep(1); + for (tries = 0; tries < 5; tries++) { + membar_sync(); + if (nlwps_running == 1) + break; + sleep(1); + } + membar_sync(); + ATF_REQUIRE(nlwps_running == 1); + ATF_REQUIRE(_lwp_wait(0, &waiter) == 0); + ATF_REQUIRE(waiter == lwp_data[1].threadid); + + /* Wake the second LWP. We should get the lowpri thread. */ + ATF_REQUIRE(__futex(&futex_word, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, + 1, NULL, NULL, 0, 0) == 1); + sleep(1); + for (tries = 0; tries < 5; tries++) { + membar_sync(); + if (nlwps_running == 0) + break; + sleep(1); + } + membar_sync(); + ATF_REQUIRE(nlwps_running == 0); + ATF_REQUIRE(_lwp_wait(0, &waiter) == 0); + ATF_REQUIRE(waiter == lwp_data[0].threadid); +} + +ATF_TC_WITH_CLEANUP(futex_wake_highest_pri); +ATF_TC_HEAD(futex_wake_highest_pri, tc) +{ + atf_tc_set_md_var(tc, "descr", + "tests that futex WAKE wakes the highest priori
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Mon May 4 14:04:11 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.1 Log Message: Tickets #885 - #887 To generate a diff of this commit: cvs rdiff -u -r1.1.2.51 -r1.1.2.52 src/doc/CHANGES-9.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.1 diff -u src/doc/CHANGES-9.1:1.1.2.51 src/doc/CHANGES-9.1:1.1.2.52 --- src/doc/CHANGES-9.1:1.1.2.51 Sat May 2 16:31:44 2020 +++ src/doc/CHANGES-9.1 Mon May 4 14:04:11 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.1,v 1.1.2.51 2020/05/02 16:31:44 martin Exp $ +# $NetBSD: CHANGES-9.1,v 1.1.2.52 2020/05/04 14:04:11 martin Exp $ A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1 release: @@ -2425,3 +2425,22 @@ sys/arch/aarch64/aarch64/sig_machdep.c aarch64: fix sigaltstack(2) [tnn, ticket #884] +sys/dev/scsipi/scsiconf.c 1.287 + + Do not attempt to read opcodes and their timeouts at attach time for + old (pre SCSI-3) devices. + [jdc, ticket #885] + +sys/dev/sun/disksubr.c1.17 + + sparc: prevent a panic a sparc when trying to read a disklabel from + an empty CD drive. + [jdc, ticket #886] + +crypto/external/bsd/netpgp/lib/verify/Makefile 1.13 +crypto/external/bsd/netpgp/lib/verify/verify.map 1.1 + + Add a linker map to hide all the symbols the this library accidentally + exported. This fixes pkg_add. + [christos, ticket #887] +
CVS commit: [netbsd-9] src/crypto/external/bsd/netpgp/lib/verify
Module Name:src Committed By: martin Date: Mon May 4 14:03:12 UTC 2020 Modified Files: src/crypto/external/bsd/netpgp/lib/verify [netbsd-9]: Makefile Added Files: src/crypto/external/bsd/netpgp/lib/verify [netbsd-9]: verify.map Log Message: Pull up following revision(s) (requested by christos in ticket #887): crypto/external/bsd/netpgp/lib/verify/Makefile: revision 1.13 crypto/external/bsd/netpgp/lib/verify/verify.map: revision 1.1 Add a linker map to hide all the symbols the this library accidentally exported. In particular the following symbols: DSA_SIG_free DSA_SIG_new DSA_do_sign DSA_do_verify DSA_free DSA_new DSA_size RSA_check_key RSA_free RSA_generate_key RSA_new RSA_private_decrypt RSA_private_encrypt RSA_public_decrypt RSA_public_encrypt conflict with libcrypto and break pkg_add which links against both libraries. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.10.2.1 \ src/crypto/external/bsd/netpgp/lib/verify/Makefile cvs rdiff -u -r0 -r1.1.2.2 \ src/crypto/external/bsd/netpgp/lib/verify/verify.map Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/crypto/external/bsd/netpgp/lib/verify/Makefile diff -u src/crypto/external/bsd/netpgp/lib/verify/Makefile:1.10 src/crypto/external/bsd/netpgp/lib/verify/Makefile:1.10.2.1 --- src/crypto/external/bsd/netpgp/lib/verify/Makefile:1.10 Mon Feb 4 04:05:15 2019 +++ src/crypto/external/bsd/netpgp/lib/verify/Makefile Mon May 4 14:03:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.10 2019/02/04 04:05:15 mrg Exp $ +# $NetBSD: Makefile,v 1.10.2.1 2020/05/04 14:03:12 martin Exp $ LIB=netpgpverify SRCS+=b64.c @@ -30,5 +30,7 @@ INCSDIR=/usr/include/netpgp .if defined(HAVE_GCC) && ${HAVE_GCC} == 7 && ${ACTIVE_CC} == "gcc" COPTS+= -Wno-error=implicit-fallthrough .endif +LDFLAGS+=-Wl,--version-script=${.CURDIR}/verify.map + .include Added files: Index: src/crypto/external/bsd/netpgp/lib/verify/verify.map diff -u /dev/null src/crypto/external/bsd/netpgp/lib/verify/verify.map:1.1.2.2 --- /dev/null Mon May 4 14:03:12 2020 +++ src/crypto/external/bsd/netpgp/lib/verify/verify.map Mon May 4 14:03:12 2020 @@ -0,0 +1,17 @@ +NETPGPVERIFY_5_0 { +global: + pgpv_new; + pgpv_new_cursor; + pgpv_read_pubring; + pgpv_read_ssh_pubkeys; + pgpv_verify; + pgpv_get_verified; + pgpv_dump; + pgpv_get_entry; + pgpv_get_cursor_num; + pgpv_get_cursor_str; + pgpv_get_cursor_element; + pgpv_close; + pgpv_cursor_close; +local: *; +};
CVS commit: src/sys/kern
Module Name:src Committed By: riastradh Date: Mon May 4 13:58:48 UTC 2020 Modified Files: src/sys/kern: uipc_sem.c Log Message: Release the collision if we find one. Candidate fix for: panic: lock error: Mutex: mutex_vector_enter,542: locking against myself: lock 0x8f611abd37e0 cpu 8 lwp 0x8f60a3c6a040 cpu8: Begin traceback... vpanic() at netbsd:vpanic+0x178 snprintf() at netbsd:snprintf lockdebug_abort() at netbsd:lockdebug_abort+0xe6 mutex_vector_enter() at netbsd:mutex_vector_enter+0x3c1 ksem_close_fop() at netbsd:ksem_close_fop+0x17 closef() at netbsd:closef+0x69 fd_free() at netbsd:fd_free+0x101 exit1() at netbsd:exit1+0x118 sys_exit() at netbsd:sys_exit+0x3d syscall() at netbsd:syscall+0x299 Would be nice to have an automatic test for this. Since semids are only 24 bits, we only need to create a few thousand of them to have a high probability of collision. Maybe we should bump default semmax while here... To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/kern/uipc_sem.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/uipc_sem.c diff -u src/sys/kern/uipc_sem.c:1.58 src/sys/kern/uipc_sem.c:1.59 --- src/sys/kern/uipc_sem.c:1.58 Tue Dec 17 18:16:05 2019 +++ src/sys/kern/uipc_sem.c Mon May 4 13:58:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_sem.c,v 1.58 2019/12/17 18:16:05 ad Exp $ */ +/* $NetBSD: uipc_sem.c,v 1.59 2020/05/04 13:58:48 riastradh Exp $ */ /*- * Copyright (c) 2011, 2019 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.58 2019/12/17 18:16:05 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.59 2020/05/04 13:58:48 riastradh Exp $"); #include #include @@ -110,6 +110,7 @@ static kauth_listener_t ksem_listener; static int ksem_sysinit(void); static int ksem_sysfini(bool); static int ksem_modcmd(modcmd_t, void *); +static void ksem_release(ksem_t *, int); static int ksem_close_fop(file_t *); static int ksem_stat_fop(file_t *, struct stat *); static int ksem_read_fop(file_t *, off_t *, struct uio *, @@ -365,6 +366,7 @@ ksem_lookup_pshared(intptr_t id) static void ksem_alloc_pshared_id(ksem_t *ksem) { + ksem_t *ksem0; uint32_t try; KASSERT(ksem->ks_pshared_proc != NULL); @@ -374,10 +376,11 @@ ksem_alloc_pshared_id(ksem_t *ksem) try = (cprng_fast32() & ~KSEM_MARKER_MASK) | KSEM_PSHARED_MARKER; - if (ksem_lookup_pshared_locked(try) == NULL) { + if ((ksem0 = ksem_lookup_pshared_locked(try)) == NULL) { /* Got it! */ break; } + ksem_release(ksem0, -1); } ksem->ks_pshared_id = try; u_long bucket = KSEM_PSHARED_HASH(ksem->ks_pshared_id);
CVS commit: [netbsd-9] src/sys/dev/sun
Module Name:src Committed By: martin Date: Mon May 4 13:58:17 UTC 2020 Modified Files: src/sys/dev/sun [netbsd-9]: disksubr.c Log Message: Pull up following revision(s) (requested by jdc in ticket #886): sys/dev/sun/disksubr.c: revision 1.17 If the sector size is 0, return early in readdisklabel(). Prevents a panic trying to use a 0-sized buffer, which can happen if we run (e.g.) `scsictl /dev/cd0c identify` with no medium in the CD drive. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/dev/sun/disksubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/sun/disksubr.c diff -u src/sys/dev/sun/disksubr.c:1.16 src/sys/dev/sun/disksubr.c:1.16.4.1 --- src/sys/dev/sun/disksubr.c:1.16 Wed Apr 3 22:10:52 2019 +++ src/sys/dev/sun/disksubr.c Mon May 4 13:58:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: disksubr.c,v 1.16 2019/04/03 22:10:52 christos Exp $ */ +/* $NetBSD: disksubr.c,v 1.16.4.1 2020/05/04 13:58:17 martin Exp $ */ /* * Copyright (c) 1982, 1986, 1988 Regents of the University of California. @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.16 2019/04/03 22:10:52 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.16.4.1 2020/05/04 13:58:17 martin Exp $"); #include #include @@ -104,6 +104,8 @@ readdisklabel(dev_t dev, void (*strat)(s lp->d_partitions[RAW_PART].p_size = 0x1fff; lp->d_partitions[RAW_PART].p_offset = 0; } + if (lp->d_secsize == 0) + return ("sector size 0"); /* obtain buffer to probe drive with */ bp = geteblk((int)lp->d_secsize);
CVS commit: [netbsd-9] src/sys/dev/scsipi
Module Name:src Committed By: martin Date: Mon May 4 13:50:07 UTC 2020 Modified Files: src/sys/dev/scsipi [netbsd-9]: scsiconf.c Log Message: Pull up following revision(s) (requested by jdc in ticket #885): sys/dev/scsipi/scsiconf.c: revision 1.287 Don't attempt to read opcodes and their timeouts at attach time for old devices. The MAINTENANCE IN command was introduced with SCSI-3 and sending it to older peripherals can cause timeouts or them not to respond to further requests. To generate a diff of this commit: cvs rdiff -u -r1.284 -r1.284.4.1 src/sys/dev/scsipi/scsiconf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/scsipi/scsiconf.c diff -u src/sys/dev/scsipi/scsiconf.c:1.284 src/sys/dev/scsipi/scsiconf.c:1.284.4.1 --- src/sys/dev/scsipi/scsiconf.c:1.284 Thu Mar 28 10:44:29 2019 +++ src/sys/dev/scsipi/scsiconf.c Mon May 4 13:50:07 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: scsiconf.c,v 1.284 2019/03/28 10:44:29 kardel Exp $ */ +/* $NetBSD: scsiconf.c,v 1.284.4.1 2020/05/04 13:50:07 martin Exp $ */ /*- * Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.284 2019/03/28 10:44:29 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.284.4.1 2020/05/04 13:50:07 martin Exp $"); #include #include @@ -1022,10 +1022,14 @@ scsi_probe_device(struct scsibus_softc * scsipi_insert_periph(chan, periph); /* - * determine supported opcodes and - * timeouts if available + * Determine supported opcodes and timeouts if available. + * Only do this on peripherals reporting SCSI version 3 + * or greater - this command isn't in the SCSI-2 spec. and + * it causes either timeouts or peripherals disappearing + * when sent to some SCSI-1 or SCSI-2 peripherals. */ - scsipi_get_opcodeinfo(periph); + if (periph->periph_version >= 3) + scsipi_get_opcodeinfo(periph); /* * XXX Can't assign periph_dev here, because we'll
CVS commit: src/sys/arch/evbmips/conf
Module Name:src Committed By: simonb Date: Mon May 4 12:15:43 UTC 2020 Modified Files: src/sys/arch/evbmips/conf: ALCHEMY MALTA Log Message: Enable PTYFS. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/arch/evbmips/conf/ALCHEMY cvs rdiff -u -r1.100 -r1.101 src/sys/arch/evbmips/conf/MALTA Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/evbmips/conf/ALCHEMY diff -u src/sys/arch/evbmips/conf/ALCHEMY:1.68 src/sys/arch/evbmips/conf/ALCHEMY:1.69 --- src/sys/arch/evbmips/conf/ALCHEMY:1.68 Sun Jan 19 01:25:05 2020 +++ src/sys/arch/evbmips/conf/ALCHEMY Mon May 4 12:15:43 2020 @@ -1,11 +1,11 @@ -# $NetBSD: ALCHEMY,v 1.68 2020/01/19 01:25:05 thorpej Exp $ +# $NetBSD: ALCHEMY,v 1.69 2020/05/04 12:15:43 simonb Exp $ # # Kernel config for the Alchemy Semiconductor (AMD) PB1000, PB1500, # DBAu1000 and DBAu1500 evaluation boards. include "arch/evbmips/conf/std.alchemy" -#ident "ALCHEMY-$Revision: 1.68 $" +#ident "ALCHEMY-$Revision: 1.69 $" maxusers 32 @@ -68,7 +68,7 @@ file-system FDESC # user file descripto #file-system UNION # union file system #file-system MSDOSFS # MS-DOS FAT filesystem(s). #file-system CODA # Coda File System; also needs vcoda (below) -#file-system PTYFS # /dev/pts/N support +file-system PTYFS # /dev/pts/N support # File system options #options NFSSERVER # Sun NFS-compatible filesystem server Index: src/sys/arch/evbmips/conf/MALTA diff -u src/sys/arch/evbmips/conf/MALTA:1.100 src/sys/arch/evbmips/conf/MALTA:1.101 --- src/sys/arch/evbmips/conf/MALTA:1.100 Sat Jan 25 18:38:35 2020 +++ src/sys/arch/evbmips/conf/MALTA Mon May 4 12:15:43 2020 @@ -1,10 +1,10 @@ -# $NetBSD: MALTA,v 1.100 2020/01/25 18:38:35 thorpej Exp $ +# $NetBSD: MALTA,v 1.101 2020/05/04 12:15:43 simonb Exp $ include "arch/evbmips/conf/std.malta" #options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "MALTA-$Revision: 1.100 $" +#ident "MALTA-$Revision: 1.101 $" maxusers 32 @@ -64,7 +64,7 @@ file-system TMPFS # Efficient memory fi #file-system UNION # union file system #file-system MSDOSFS # MS-DOS FAT filesystem(s). #file-system CODA # Coda File System; also needs vcoda (below) -#file-system PTYFS # /dev/pts/N support +file-system PTYFS # /dev/pts/N support # File system options #options NFSSERVER # Sun NFS-compatible filesystem server
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: jdolecek Date: Mon May 4 10:03:45 UTC 2020 Modified Files: src/sys/arch/xen/xen: if_xennet_xenbus.c Log Message: fix delet-o To generate a diff of this commit: cvs rdiff -u -r1.122 -r1.123 src/sys/arch/xen/xen/if_xennet_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/if_xennet_xenbus.c diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.122 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.123 --- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.122 Mon May 4 08:22:45 2020 +++ src/sys/arch/xen/xen/if_xennet_xenbus.c Mon May 4 10:03:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_xennet_xenbus.c,v 1.122 2020/05/04 08:22:45 jdolecek Exp $ */ +/* $NetBSD: if_xennet_xenbus.c,v 1.123 2020/05/04 10:03:45 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.122 2020/05/04 08:22:45 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.123 2020/05/04 10:03:45 jdolecek Exp $"); #include "opt_xen.h" #include "opt_nfs_boot.h" @@ -382,7 +382,7 @@ xennet_xenbus_attach(device_t parent, de | IFCAP_CSUM_UDPv6_Rx | IFCAP_CSUM_TCPv6_Rx; #define XN_M_CSUM_SUPPORTED \ - (M_CSUM_TCPv4 | M_CSUM_UDPv4 | | M_CSUM_TCPv6 | M_CSUM_UDPv6) + (M_CSUM_TCPv4 | M_CSUM_UDPv4 | M_CSUM_TCPv6 | M_CSUM_UDPv6) if (sc->sc_features & FEATURE_IPV6CSUM) { /*
CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: jdolecek Date: Mon May 4 09:34:37 UTC 2020 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: constify the pic templates To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/arch/x86/pci/msipic.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.21 src/sys/arch/x86/pci/msipic.c:1.22 --- src/sys/arch/x86/pci/msipic.c:1.21 Sat Apr 25 15:26:18 2020 +++ src/sys/arch/x86/pci/msipic.c Mon May 4 09:34:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.21 2020/04/25 15:26:18 bouyer Exp $ */ +/* $NetBSD: msipic.c,v 1.22 2020/05/04 09:34:37 jdolecek Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.21 2020/04/25 15:26:18 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.22 2020/05/04 09:34:37 jdolecek Exp $"); #include "opt_intrdebug.h" @@ -114,7 +114,7 @@ static void msipic_release_common_msi_de static struct pic *msipic_find_msi_pic_locked(int); static struct pic *msipic_construct_common_msi_pic(const struct pci_attach_args *, - struct pic *); + const struct pic *); static void msipic_destruct_common_msi_pic(struct pic *); static void msi_set_msictl_enablebit(struct pic *, int, int); @@ -231,7 +231,7 @@ msipic_find_msi_pic(int devid) */ static struct pic * msipic_construct_common_msi_pic(const struct pci_attach_args *pa, -struct pic *pic_tmpl) +const struct pic *pic_tmpl) { struct pic *pic; struct msipic *msipic; @@ -427,7 +427,7 @@ msi_delroute(struct pic *pic, struct cpu * Template for MSI pic. * .pic_msipic is set later in construct_msi_pic(). */ -static struct pic msi_pic_tmpl = { +static const struct pic msi_pic_tmpl = { .pic_type = PIC_MSI, .pic_vecbase = 0, .pic_apicid = 0, @@ -605,7 +605,7 @@ msix_delroute(struct pic *pic, struct cp * Template for MSI-X pic. * .pic_msipic is set later in construct_msix_pic(). */ -static struct pic msix_pic_tmpl = { +static const struct pic msix_pic_tmpl = { .pic_type = PIC_MSIX, .pic_vecbase = 0, .pic_apicid = 0,
CVS commit: src/sys/arch/xen/xen
Module Name:src Committed By: jdolecek Date: Mon May 4 08:22:45 UTC 2020 Modified Files: src/sys/arch/xen/xen: if_xennet_xenbus.c xennet_checksum.c xennetback_xenbus.c Log Message: remove IPv4 csum offloading for xennet(4) - it's not complete, and even if it was, it doesn't work with Linux Dom0 as it expects the IPv4 csum present To generate a diff of this commit: cvs rdiff -u -r1.121 -r1.122 src/sys/arch/xen/xen/if_xennet_xenbus.c cvs rdiff -u -r1.13 -r1.14 src/sys/arch/xen/xen/xennet_checksum.c cvs rdiff -u -r1.103 -r1.104 src/sys/arch/xen/xen/xennetback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/xen/xen/if_xennet_xenbus.c diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.121 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.122 --- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.121 Fri May 1 19:53:17 2020 +++ src/sys/arch/xen/xen/if_xennet_xenbus.c Mon May 4 08:22:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_xennet_xenbus.c,v 1.121 2020/05/01 19:53:17 jdolecek Exp $ */ +/* $NetBSD: if_xennet_xenbus.c,v 1.122 2020/05/04 08:22:45 jdolecek Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -81,7 +81,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.121 2020/05/01 19:53:17 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.122 2020/05/04 08:22:45 jdolecek Exp $"); #include "opt_xen.h" #include "opt_nfs_boot.h" @@ -377,15 +377,13 @@ xennet_xenbus_attach(device_t parent, de ifp->if_extflags = IFEF_MPSAFE; ifp->if_snd.ifq_maxlen = uimax(ifqmaxlen, NET_TX_RING_SIZE * 2); ifp->if_capabilities = - IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_IPv4_Tx - | IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv4_Tx + IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv4_Tx | IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv4_Tx | IFCAP_CSUM_UDPv6_Rx | IFCAP_CSUM_TCPv6_Rx; -#define XN_M_CSUM_SUPPORTED ( \ - M_CSUM_TCPv4 | M_CSUM_UDPv4 | M_CSUM_IPv4 \ - | M_CSUM_TCPv6 | M_CSUM_UDPv6 \ - ) +#define XN_M_CSUM_SUPPORTED \ + (M_CSUM_TCPv4 | M_CSUM_UDPv4 | | M_CSUM_TCPv6 | M_CSUM_UDPv6) + if (sc->sc_features & FEATURE_IPV6CSUM) { /* * If backend supports IPv6 csum offloading, we can skip Index: src/sys/arch/xen/xen/xennet_checksum.c diff -u src/sys/arch/xen/xen/xennet_checksum.c:1.13 src/sys/arch/xen/xen/xennet_checksum.c:1.14 --- src/sys/arch/xen/xen/xennet_checksum.c:1.13 Sun May 3 16:10:26 2020 +++ src/sys/arch/xen/xen/xennet_checksum.c Mon May 4 08:22:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xennet_checksum.c,v 1.13 2020/05/03 16:10:26 jdolecek Exp $ */ +/* $NetBSD: xennet_checksum.c,v 1.14 2020/05/04 08:22:45 jdolecek Exp $ */ /*- * Copyright (c)2006 YAMAMOTO Takashi, @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.13 2020/05/03 16:10:26 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xennet_checksum.c,v 1.14 2020/05/04 08:22:45 jdolecek Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -147,7 +147,7 @@ xennet_checksum_fill(struct ifnet *ifp, switch (nxt) { case IPPROTO_UDP: if (iph) - m->m_pkthdr.csum_flags = M_CSUM_UDPv4 | M_CSUM_IPv4; + m->m_pkthdr.csum_flags = M_CSUM_UDPv4; #ifdef INET6 else m->m_pkthdr.csum_flags = M_CSUM_UDPv6; @@ -157,7 +157,7 @@ xennet_checksum_fill(struct ifnet *ifp, break; case IPPROTO_TCP: if (iph) - m->m_pkthdr.csum_flags = M_CSUM_TCPv4 | M_CSUM_IPv4; + m->m_pkthdr.csum_flags = M_CSUM_TCPv4; #ifdef INET6 else m->m_pkthdr.csum_flags = M_CSUM_TCPv6; @@ -167,10 +167,6 @@ xennet_checksum_fill(struct ifnet *ifp, break; case IPPROTO_ICMP: case IPPROTO_IGMP: - if (iph) - m->m_pkthdr.csum_flags = M_CSUM_IPv4; - m->m_pkthdr.csum_data = iphlen << 16; - break; case IPPROTO_HOPOPTS: case IPPROTO_ICMPV6: case IPPROTO_FRAGMENT: @@ -196,17 +192,9 @@ xennet_checksum_fill(struct ifnet *ifp, */ sw_csum = m->m_pkthdr.csum_flags & ~ifp->if_csum_flags_rx; - /* - * Always initialize the sum to 0! Some HW assisted - * checksumming requires this. in_undefer_cksum() - * also needs it to be zero. - */ - if (iph != NULL && (m->m_pkthdr.csum_flags & M_CSUM_IPv4)) - iph->ip_sum = 0; - - if (sw_csum & (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4)) { + if (sw_csum & (M_CSUM_UDPv4|M_CSUM_TCPv4)) { in_undefer_cksum(m, ehlen, - sw_csum & (M_CSUM_IPv4|M_CSUM_UDPv4|M_CSUM_TCPv4)); + sw_csum & (M_CSUM_UDPv4|M_CSUM_TCPv4)); } #ifdef INET6 Index: src/sys/arch/xen/xen/xennetback_xenbus.c diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.103 src/sys/arch/xen/xen/xennetback_xenbus.c:1.104 --- src/sys/arch/xen/xen/xennetback_xenbus.c:1.103 Sun May 3 17:56:19 2020 +++ src/sys/arch/xen/xen/xennetback_xenbus.c Mon May 4 08:22:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: xennetback_xenbus.c,v 1.103 2020/05/03 17:56:19 jdolecek Exp $ */ +/* $NetBSD: xennetback_xenbus.c,v 1.104 2020/05/04 08:22:45 jdo