CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Wed Oct 16 04:07:42 UTC 2019 Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c Log Message: Apply FreeBSD r353599: > ixgbe: Disable EEE for backplane X550EM_X > > From Zach: > Intel documentation indicates that backplane X550EM_X KR devices do not > support Energy Efficient Ethernet. Prior to this patch, X552 devices > (device ID 0x15AB) will crash the system when transitioning EEE state > via sysctl. > > Signed-off-by: Zach Vargas > > PR: 240320 > Submitted by:Zach Vargas > Reviewed by: erj@ > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D21673 To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/sys/dev/pci/ixgbe/ixgbe.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/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.213 src/sys/dev/pci/ixgbe/ixgbe.c:1.214 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.213 Wed Sep 18 10:42:44 2019 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Oct 16 04:07:42 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.213 2019/09/18 10:42:44 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.214 2019/10/16 04:07:42 msaitoh Exp $ */ /** @@ -5860,7 +5860,7 @@ ixgbe_sysctl_eee_state(SYSCTLFN_ARGS) if ((new_eee < 0) || (new_eee > 1)) return (EINVAL); - retval = adapter->hw.mac.ops.setup_eee(>hw, new_eee); + retval = ixgbe_setup_eee(>hw, new_eee); if (retval) { device_printf(dev, "Error in EEE setup: 0x%08X\n", retval); return (EINVAL); @@ -6034,8 +6034,6 @@ ixgbe_init_device_features(struct adapte */ adapter->feat_cap |= IXGBE_FEATURE_SRIOV; adapter->feat_cap |= IXGBE_FEATURE_FDIR; - if (adapter->hw.device_id == IXGBE_DEV_ID_X550EM_X_KR) - adapter->feat_cap |= IXGBE_FEATURE_EEE; break; case ixgbe_mac_X550EM_a: /*
CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Wed Oct 16 04:07:42 UTC 2019 Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c Log Message: Apply FreeBSD r353599: > ixgbe: Disable EEE for backplane X550EM_X > > From Zach: > Intel documentation indicates that backplane X550EM_X KR devices do not > support Energy Efficient Ethernet. Prior to this patch, X552 devices > (device ID 0x15AB) will crash the system when transitioning EEE state > via sysctl. > > Signed-off-by: Zach Vargas > > PR: 240320 > Submitted by:Zach Vargas > Reviewed by: erj@ > MFC after: 3 days > Differential Revision: https://reviews.freebsd.org/D21673 To generate a diff of this commit: cvs rdiff -u -r1.213 -r1.214 src/sys/dev/pci/ixgbe/ixgbe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/dist
Module Name:src Committed By: msaitoh Date: Wed Oct 16 01:44:48 UTC 2019 Modified Files: src/sys/external/bsd/drm2/dist/drm/radeon: r600d.h rv770d.h src/sys/external/bsd/drm2/dist/include/drm: drm_fixed.h Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/radeon/r600d.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/include/drm/drm_fixed.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/dist
Module Name:src Committed By: msaitoh Date: Wed Oct 16 01:44:48 UTC 2019 Modified Files: src/sys/external/bsd/drm2/dist/drm/radeon: r600d.h rv770d.h src/sys/external/bsd/drm2/dist/include/drm: drm_fixed.h Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/external/bsd/drm2/dist/drm/radeon/r600d.h cvs rdiff -u -r1.2 -r1.3 src/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h cvs rdiff -u -r1.2 -r1.3 \ src/sys/external/bsd/drm2/dist/include/drm/drm_fixed.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/external/bsd/drm2/dist/drm/radeon/r600d.h diff -u src/sys/external/bsd/drm2/dist/drm/radeon/r600d.h:1.3 src/sys/external/bsd/drm2/dist/drm/radeon/r600d.h:1.4 --- src/sys/external/bsd/drm2/dist/drm/radeon/r600d.h:1.3 Sat Aug 17 15:50:05 2019 +++ src/sys/external/bsd/drm2/dist/drm/radeon/r600d.h Wed Oct 16 01:44:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: r600d.h,v 1.3 2019/08/17 15:50:05 msaitoh Exp $ */ +/* $NetBSD: r600d.h,v 1.4 2019/10/16 01:44:48 msaitoh Exp $ */ /* * Copyright 2009 Advanced Micro Devices, Inc. @@ -644,7 +644,7 @@ #define DMA_MODE 0xd0bc /* async DMA packets */ -#define DMA_PACKET(cmd, t, s, n) cmd) & 0xF) << 28) | \ +#define DMA_PACKET(cmd, t, s, n) u32)(cmd) & 0xF) << 28) | \ (((t) & 0x1) << 23) | \ (((s) & 0x1) << 22) | \ (((n) & 0x) << 0)) Index: src/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h diff -u src/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h:1.2 src/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h:1.3 --- src/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h:1.2 Mon Aug 27 04:58:36 2018 +++ src/sys/external/bsd/drm2/dist/drm/radeon/rv770d.h Wed Oct 16 01:44:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rv770d.h,v 1.2 2018/08/27 04:58:36 riastradh Exp $ */ +/* $NetBSD: rv770d.h,v 1.3 2019/10/16 01:44:48 msaitoh Exp $ */ /* * Copyright 2009 Advanced Micro Devices, Inc. @@ -563,7 +563,7 @@ #define SQ_DYN_GPR_SIZE_SIMD_AB_5 0x8DC4 #define SQ_DYN_GPR_SIZE_SIMD_AB_6 0x8DC8 #define SQ_DYN_GPR_SIZE_SIMD_AB_7 0x8DCC -#define ES_PRIO(x) ((x) << 30) +#define ES_PRIO(x) ((u32)(x) << 30) #define SQ_GPR_RESOURCE_MGMT_10x8C04 #define NUM_PS_GPRS(x) ((x) << 0) #define NUM_VS_GPRS(x) ((x) << 16) @@ -661,7 +661,7 @@ #define DMA_RB_WPTR 0xd00c /* async DMA packets */ -#define DMA_PACKET(cmd, t, s, n) cmd) & 0xF) << 28) | \ +#define DMA_PACKET(cmd, t, s, n) u32)(cmd) & 0xF) << 28) | \ (((t) & 0x1) << 23) | \ (((s) & 0x1) << 22) | \ (((n) & 0x) << 0)) Index: src/sys/external/bsd/drm2/dist/include/drm/drm_fixed.h diff -u src/sys/external/bsd/drm2/dist/include/drm/drm_fixed.h:1.2 src/sys/external/bsd/drm2/dist/include/drm/drm_fixed.h:1.3 --- src/sys/external/bsd/drm2/dist/include/drm/drm_fixed.h:1.2 Mon Aug 27 04:58:37 2018 +++ src/sys/external/bsd/drm2/dist/include/drm/drm_fixed.h Wed Oct 16 01:44:48 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: drm_fixed.h,v 1.2 2018/08/27 04:58:37 riastradh Exp $ */ +/* $NetBSD: drm_fixed.h,v 1.3 2019/10/16 01:44:48 msaitoh Exp $ */ /* * Copyright 2009 Red Hat Inc. @@ -34,7 +34,7 @@ typedef union dfixed { } fixed20_12; -#define dfixed_const(A) (u32)(((A) << 12))/* + ((B + 0.000122)*4096)) */ +#define dfixed_const(A) (((u32)(A) << 12))/* + ((B + 0.000122)*4096)) */ #define dfixed_const_half(A) (u32)(((A) << 12) + 2048) #define dfixed_const_666(A) (u32)(((A) << 12) + 2731) #define dfixed_const_8(A) (u32)(((A) << 12) + 3277)
Re: CVS commit: src/external/cddl/osnet/dist/uts/common/fs/zfs
On Tue, 15 Oct 2019, J. Hannken-Illjes wrote: Should be fixed with Rev. 1.4 of src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c Yup - thanks! ++--+---+ | Paul Goyette | PGP Key fingerprint: | E-mail addresses: | | (Retired) | FA29 0E3B 35AF E8AE 6651 | p...@whooppee.com | | Software Developer | 0786 F758 55DE 53BA 7731 | pgoye...@netbsd.org | ++--+---+
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Tue Oct 15 19:44:45 UTC 2019 Modified Files: src/doc [netbsd-9]: CHANGES-9.0 Log Message: Tickets #305 - #334 To generate a diff of this commit: cvs rdiff -u -r1.1.2.76 -r1.1.2.77 src/doc/CHANGES-9.0 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.0 diff -u src/doc/CHANGES-9.0:1.1.2.76 src/doc/CHANGES-9.0:1.1.2.77 --- src/doc/CHANGES-9.0:1.1.2.76 Sat Oct 12 15:12:09 2019 +++ src/doc/CHANGES-9.0 Tue Oct 15 19:44:45 2019 @@ -1,5 +1,5 @@ -# $NetBSD: CHANGES-9.0,v 1.1.2.76 2019/10/12 15:12:09 bouyer Exp $ +# $NetBSD: CHANGES-9.0,v 1.1.2.77 2019/10/15 19:44:45 martin Exp $ A complete list of changes from the initial NetBSD 9.0 branch on 2019-07-30 until the 9.0 release: @@ -4510,3 +4510,185 @@ sbin/newfs_msdos/mkfs_msdos.c 1.15 parameters. [martin, ticket #303] +sys/arch/x86/pci/msipic.c 1.18 + + Change bus_space_map to use _x86_memio_map to avoid reservation + conflicts. + [tnn, ticket #305] + +sys/arch/amd64/conf/GENERIC 1.536 + + amd64: add mcx(4) to GENERIC. + [tnn, ticket #306] + +sys/kern/vnode_if.sh1.67 +sys/kern/vnode_if.src1.78 +sys/kern/vnode_if.c(regen) + + Add fstrans type LAZY and use it for VOP_STRATEGY(). + [hannken, ticket #307] + +external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c 1.3,1.4 +external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h 1.4 +external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c 1.21 + + Change dmu_diff() back to use a "file" instead of a "vnode". + [hannken, ticket #308] + +sys/kern/sys_ptrace_common.c 1.67 + + Avoid signed integer overflow for -lwp where lwp is INT_MIN. + [kamil, ticket #309] + +tests/lib/libc/sys/t_ptrace_wait.c 1.134 + + Remove ATF t_ptrace_wait test suspend1. + [kamil, ticket #310] + +sys/compat/sys/siginfo.h 1.8 (patch) +sys/kern/kern_exec.c1.482 (patch) +sys/kern/kern_fork.c1.214 (patch) +sys/kern/kern_lwp.c1.203 (patch) +sys/kern/kern_sig.c1.365 (patch) +sys/kern/sys_lwp.c1.70 (patch) +sys/kern/sys_ptrace_common.c 1.59 (patch) +sys/sys/siginfo.h1.34 (patch) +sys/sys/signalvar.h1.96 (patch) + + Move TRAP_CHLD/TRAP_LWP ptrace information from struct proc to siginfo. + [kamil, ticket #311] + +tests/lib/libc/sys/t_ptrace_wait.c 1.135 + + Bump the number of threads in LWP t_ptrace_wait*() tests from to 100. + [kamil, ticket #312] + +sys/kern/sys_ptrace_common.c 1.60 + + Restore the old behavior in PT_GET_PROCESS_STATE for non child or lwp + events. + [kamil, ticket #313] + +tests/lib/libc/sys/t_ptrace_wait.c 1.137 + + Fix race in t_ptrace_wait* LWP tests. + [kamil, ticket #314] + +tests/lib/libc/sys/t_ptrace_wait.c 1.132 + + Add a few static asserts in t_ptrace_wait.c for invariants. + [kamil, ticket #315] + +tests/lib/libc/sys/t_ptrace_wait.c 1.133 + + Merge PT_GET_PROCESS_STATE checks into traceme_raise ATF ptrace tests. + [kamil, ticket #317] + +sys/sys/lwp.h 1.187 + + Define LW_DBGSUSPEND in sys/lwp.h. + [kamil, ticket #318] + +sys/kern/sys_ptrace_common.c 1.61 + + Remove 2 static asserts from the kernel ptrace code. + [kamil, ticket #319] + +sys/kern/kern_exit.c1.277 +sys/kern/kern_lwp.c1.204 +sys/kern/kern_sig.c1.366 +sys/kern/kern_synch.c1.324 +sys/kern/sys_ptrace_common.c 1.62 + + Separate flag for suspended by _lwp_suspend and suspended by a + debugger. + [kamil, ticket #320] + +sys/kern/sys_ptrace_common.c 1.63 + + Add two KASSERTS in the ptrace(2) kernel code to + verify that we will never return empty ptrace_state for + CHILD/LWP event. + [kamil, ticket #321] + +sys/kern/sysv_msg.c1.76 + + Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX. + [kamil, ticket #322] + +sys/kern/sys_ptrace_common.c 1.65 + + Correct the same expression on both sides of |. + [kamil, ticket #323] + +sys/kern/kern_sig.c1.367 + + Enhance reliability of ptrace(2) in a debuggee with multiple LWPs. + [kamil, ticket #324] + +sys/kern/sys_ptrace_common.c 1.66 +sys/sys/ptrace.h1.66 + + Introduce new ptrace(2) operation PT_STOP. + [kamil, ticket #325] + +lib/libc/sys/ptrace.21.81 + + Document PT_STOP, update PT_KILL in the ptrace(2) man-page. + [kamil, ticket #326] + +sys/kern/kern_sig.c1.369 +sys/sys/signalvar.h1.97 + + Refactor sigswitch(). + [kamil, ticket #328] + +sys/kern/kern_sig.c1.370 + + Add sigswitch_unlock_and_switch_away(), extracted from sigswitch() + and use it where possible. + [kamil, ticket #327] + +sys/kern/kern_sig.c1.371 + + Fix one of the root causes of unreliability of the ptrace(2)ed + threads. + [kamil, ticket #329] + +sys/kern/kern_sig.c1.372 + + Avoid double lwp_exit() in eventswitch(). + [kamil, ticket #330] + +sys/dev/pci/pci.c1.155 + + pci(4): fix undefined behavior in device enumeration. + [jmcneill, ticket #331] + +sys/arch/arm/acpi/acpi_pci_machdep.c 1.10,1.11 +sys/arch/arm/acpi/acpi_pci_machdep.h 1.3
CVS commit: [netbsd-9] src/sys/arch/arm
Module Name:src Committed By: martin Date: Tue Oct 15 19:40:34 UTC 2019 Modified Files: src/sys/arch/arm/acpi [netbsd-9]: files.acpi gic_acpi.c gicv3_acpi.c src/sys/arch/arm/cortex [netbsd-9]: files.cortex gic_v2m.c gic_v2m.h Added Files: src/sys/arch/arm/acpi [netbsd-9]: gic_v2m_acpi.c gic_v2m_acpi.h Log Message: Pull up following revision(s) (requested by jmcneill in ticket #334): sys/arch/arm/cortex/gic_v2m.c: revision 1.7 sys/arch/arm/acpi/gicv3_acpi.c: revision 1.5 sys/arch/arm/acpi/files.acpi: revision 1.8 sys/arch/arm/acpi/gic_acpi.c: revision 1.4 sys/arch/arm/cortex/files.cortex: revision 1.13 sys/arch/arm/acpi/gic_v2m_acpi.c: revision 1.1 sys/arch/arm/acpi/gic_v2m_acpi.h: revision 1.1 sys/arch/arm/cortex/gic_v2m.h: revision 1.2 Add support for Amazon's Graviton MSI controller. Graviton has a GICv3 with a modified GICv2m (!) for MSIs. Instead of sending messages to a fixed address with the SPI as data, the Graviton's GICv2m uses a different address for each vector with "don't care" as data. To generate a diff of this commit: cvs rdiff -u -r1.6.6.1 -r1.6.6.2 src/sys/arch/arm/acpi/files.acpi cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/acpi/gic_acpi.c cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/acpi/gic_v2m_acpi.c \ src/sys/arch/arm/acpi/gic_v2m_acpi.h cvs rdiff -u -r1.3.8.1 -r1.3.8.2 src/sys/arch/arm/acpi/gicv3_acpi.c cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/arch/arm/cortex/files.cortex cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/cortex/gic_v2m.c cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/cortex/gic_v2m.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/acpi/files.acpi diff -u src/sys/arch/arm/acpi/files.acpi:1.6.6.1 src/sys/arch/arm/acpi/files.acpi:1.6.6.2 --- src/sys/arch/arm/acpi/files.acpi:1.6.6.1 Mon Sep 23 07:06:31 2019 +++ src/sys/arch/arm/acpi/files.acpi Tue Oct 15 19:40:34 2019 @@ -1,4 +1,4 @@ -# $NetBSD: files.acpi,v 1.6.6.1 2019/09/23 07:06:31 martin Exp $ +# $NetBSD: files.acpi,v 1.6.6.2 2019/10/15 19:40:34 martin Exp $ # # Configuration info for ACPI compliant ARM boards. # @@ -26,6 +26,8 @@ file arch/arm/acpi/gic_acpi.c gic_acpi attach gicvthree at acpimadtbus with gicv3_acpi file arch/arm/acpi/gicv3_acpi.c gicv3_acpi +file arch/arm/acpi/gic_v2m_acpi.c (gic_acpi | gicv3_acpi) & pci + attach gtmr at acpisdtbus with gtmr_acpi file arch/arm/acpi/gtmr_acpi.c gtmr_acpi Index: src/sys/arch/arm/acpi/gic_acpi.c diff -u src/sys/arch/arm/acpi/gic_acpi.c:1.3 src/sys/arch/arm/acpi/gic_acpi.c:1.3.6.1 --- src/sys/arch/arm/acpi/gic_acpi.c:1.3 Mon Nov 12 12:56:05 2018 +++ src/sys/arch/arm/acpi/gic_acpi.c Tue Oct 15 19:40:34 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: gic_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $ */ +/* $NetBSD: gic_acpi.c,v 1.3.6.1 2019/10/15 19:40:34 martin Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "pci.h" #include -__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.3 2018/11/12 12:56:05 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v 1.3.6.1 2019/10/15 19:40:34 martin Exp $"); #include #include @@ -43,16 +43,17 @@ __KERNEL_RCSID(0, "$NetBSD: gic_acpi.c,v #include #include +#include + #include #include #include #include -#include +#include #define GICD_SIZE 0x1000 #define GICC_SIZE 0x1000 -#define GICMSIFRAME_SIZE 0x1000 extern struct bus_space arm_generic_bs_tag; extern struct pic_softc *pic_list[]; @@ -61,9 +62,6 @@ static int gic_acpi_match(device_t, cfda static void gic_acpi_attach(device_t, device_t, void *); static ACPI_STATUS gic_acpi_find_gicc(ACPI_SUBTABLE_HEADER *, void *); -#if NPCI > 0 -static ACPI_STATUS gic_acpi_find_msi_frame(ACPI_SUBTABLE_HEADER *, void *); -#endif CFATTACH_DECL_NEW(gic_acpi, 0, gic_acpi_match, gic_acpi_attach, NULL, NULL); @@ -130,7 +128,7 @@ gic_acpi_attach(device_t parent, device_ arm_fdt_irq_set_handler(armgic_irq_handler); #if NPCI > 0 - acpi_madt_walk(gic_acpi_find_msi_frame, armgic); + acpi_madt_walk(gic_v2m_acpi_find_msi_frame, armgic); #endif } @@ -146,46 +144,3 @@ gic_acpi_find_gicc(ACPI_SUBTABLE_HEADER return AE_LIMIT; } - -#if NPCI > 0 -static ACPI_STATUS -gic_acpi_find_msi_frame(ACPI_SUBTABLE_HEADER *hdrp, void *aux) -{ - ACPI_MADT_GENERIC_MSI_FRAME *msi_frame = (ACPI_MADT_GENERIC_MSI_FRAME *)hdrp; - struct gic_v2m_frame *frame; - struct pic_softc *pic = pic_list[0]; - device_t armgic = aux; - - if (hdrp->Type != ACPI_MADT_TYPE_GENERIC_MSI_FRAME) - return AE_OK; - - frame = kmem_zalloc(sizeof(*frame), KM_SLEEP); - frame->frame_reg = msi_frame->BaseAddress; - frame->frame_pic = pic; - if (msi_frame->Flags & ACPI_MADT_OVERRIDE_SPI_VALUES) { - frame->frame_base = msi_frame->SpiBase; - frame->frame_count = msi_frame->SpiCount; - } else { - bus_space_tag_t bst = _generic_bs_tag; -
CVS commit: [netbsd-9] src/sys/arch/arm
Module Name:src Committed By: martin Date: Tue Oct 15 19:40:34 UTC 2019 Modified Files: src/sys/arch/arm/acpi [netbsd-9]: files.acpi gic_acpi.c gicv3_acpi.c src/sys/arch/arm/cortex [netbsd-9]: files.cortex gic_v2m.c gic_v2m.h Added Files: src/sys/arch/arm/acpi [netbsd-9]: gic_v2m_acpi.c gic_v2m_acpi.h Log Message: Pull up following revision(s) (requested by jmcneill in ticket #334): sys/arch/arm/cortex/gic_v2m.c: revision 1.7 sys/arch/arm/acpi/gicv3_acpi.c: revision 1.5 sys/arch/arm/acpi/files.acpi: revision 1.8 sys/arch/arm/acpi/gic_acpi.c: revision 1.4 sys/arch/arm/cortex/files.cortex: revision 1.13 sys/arch/arm/acpi/gic_v2m_acpi.c: revision 1.1 sys/arch/arm/acpi/gic_v2m_acpi.h: revision 1.1 sys/arch/arm/cortex/gic_v2m.h: revision 1.2 Add support for Amazon's Graviton MSI controller. Graviton has a GICv3 with a modified GICv2m (!) for MSIs. Instead of sending messages to a fixed address with the SPI as data, the Graviton's GICv2m uses a different address for each vector with "don't care" as data. To generate a diff of this commit: cvs rdiff -u -r1.6.6.1 -r1.6.6.2 src/sys/arch/arm/acpi/files.acpi cvs rdiff -u -r1.3 -r1.3.6.1 src/sys/arch/arm/acpi/gic_acpi.c cvs rdiff -u -r0 -r1.1.2.2 src/sys/arch/arm/acpi/gic_v2m_acpi.c \ src/sys/arch/arm/acpi/gic_v2m_acpi.h cvs rdiff -u -r1.3.8.1 -r1.3.8.2 src/sys/arch/arm/acpi/gicv3_acpi.c cvs rdiff -u -r1.11.4.1 -r1.11.4.2 src/sys/arch/arm/cortex/files.cortex cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/cortex/gic_v2m.c cvs rdiff -u -r1.1 -r1.1.8.1 src/sys/arch/arm/cortex/gic_v2m.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/arch/arm/acpi
Module Name:src Committed By: martin Date: Tue Oct 15 19:37:58 UTC 2019 Modified Files: src/sys/arch/arm/acpi [netbsd-9]: acpi_pci_machdep.c acpi_pci_machdep.h acpipchb.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #332): sys/arch/arm/acpi/acpipchb.c: revision 1.10 sys/arch/arm/acpi/acpipchb.c: revision 1.11 sys/arch/arm/acpi/acpipchb.c: revision 1.12 sys/arch/arm/acpi/acpi_pci_machdep.h: revision 1.3 sys/arch/arm/acpi/acpi_pci_machdep.h: revision 1.4 sys/arch/arm/acpi/acpi_pci_machdep.c: revision 1.10 sys/arch/arm/acpi/acpi_pci_machdep.c: revision 1.11 Add quirks for Amazon Graviton PCIe root ports. Configuration space for the root port is found in a child AMZN0001 resource, not the MCFG table. - More Amazon Graviton quirks: - Ignore devno > 0 on the PCIe root port. - Fixup PCIe bridge bus number register on the root port. - Move quirk handling to acpipchb so it can be applied before the bus is configured. - Fix detection of root port resources for Graviton and remove no longer required bridge fixup To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/arch/arm/acpi/acpi_pci_machdep.c cvs rdiff -u -r1.2 -r1.2.8.1 src/sys/arch/arm/acpi/acpi_pci_machdep.h cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/arm/acpi/acpipchb.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/arm/acpi/acpi_pci_machdep.c diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.9 src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.9.6.1 --- src/sys/arch/arm/acpi/acpi_pci_machdep.c:1.9 Sat Dec 8 15:04:40 2018 +++ src/sys/arch/arm/acpi/acpi_pci_machdep.c Tue Oct 15 19:37:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci_machdep.c,v 1.9 2018/12/08 15:04:40 jmcneill Exp $ */ +/* $NetBSD: acpi_pci_machdep.c,v 1.9.6.1 2019/10/15 19:37:58 martin Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.9 2018/12/08 15:04:40 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_pci_machdep.c,v 1.9.6.1 2019/10/15 19:37:58 martin Exp $"); #include #include @@ -215,6 +215,11 @@ acpi_pci_md_attach_hook(device_t parent, static int acpi_pci_md_bus_maxdevs(void *v, int busno) { + struct acpi_pci_context * const ap = v; + + if (ap->ap_bus_maxdevs != NULL) + return ap->ap_bus_maxdevs(ap, busno); + return 32; } @@ -260,7 +265,10 @@ acpi_pci_md_conf_read(void *v, pcitag_t if (offset < 0 || offset >= PCI_EXTCONF_SIZE) return (pcireg_t) -1; - acpimcfg_conf_read(>ap_pc, tag, offset, ); + if (ap->ap_conf_read != NULL) + ap->ap_conf_read(>ap_pc, tag, offset, ); + else + acpimcfg_conf_read(>ap_pc, tag, offset, ); return val; } @@ -273,7 +281,10 @@ acpi_pci_md_conf_write(void *v, pcitag_t if (offset < 0 || offset >= PCI_EXTCONF_SIZE) return; - acpimcfg_conf_write(>ap_pc, tag, offset, val); + if (ap->ap_conf_write != NULL) + ap->ap_conf_write(>ap_pc, tag, offset, val); + else + acpimcfg_conf_write(>ap_pc, tag, offset, val); } static int Index: src/sys/arch/arm/acpi/acpi_pci_machdep.h diff -u src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.2 src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.2.8.1 --- src/sys/arch/arm/acpi/acpi_pci_machdep.h:1.2 Fri Oct 19 11:40:27 2018 +++ src/sys/arch/arm/acpi/acpi_pci_machdep.h Tue Oct 15 19:37:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci_machdep.h,v 1.2 2018/10/19 11:40:27 jmcneill Exp $ */ +/* $NetBSD: acpi_pci_machdep.h,v 1.2.8.1 2019/10/15 19:37:58 martin Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -36,7 +36,15 @@ extern struct arm32_pci_chipset arm_acpi struct acpi_pci_context { struct arm32_pci_chipset ap_pc; + device_t ap_dev; u_int ap_seg; + int ap_bus; + ACPI_HANDLE ap_handle; + bus_space_tag_t ap_bst; + bus_space_handle_t ap_conf_bsh; + int (*ap_conf_read)(pci_chipset_tag_t, pcitag_t, int, pcireg_t *); + int (*ap_conf_write)(pci_chipset_tag_t, pcitag_t, int, pcireg_t); + int (*ap_bus_maxdevs)(struct acpi_pci_context *, int); }; #endif /* !_ARM_ACPI_PCI_MACHDEP_H */ Index: src/sys/arch/arm/acpi/acpipchb.c diff -u src/sys/arch/arm/acpi/acpipchb.c:1.9 src/sys/arch/arm/acpi/acpipchb.c:1.9.2.1 --- src/sys/arch/arm/acpi/acpipchb.c:1.9 Tue Jun 25 22:23:39 2019 +++ src/sys/arch/arm/acpi/acpipchb.c Tue Oct 15 19:37:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: acpipchb.c,v 1.9 2019/06/25 22:23:39 jmcneill Exp $ */ +/* $NetBSD: acpipchb.c,v 1.9.2.1 2019/10/15 19:37:58 martin Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.9 2019/06/25 22:23:39 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpipchb.c,v 1.9.2.1 2019/10/15 19:37:58 martin Exp $"); #include #include @@ -92,6 +92,132 @@ struct acpipchb_softc { struct
CVS commit: [netbsd-9] src/sys/arch/arm/acpi
Module Name:src Committed By: martin Date: Tue Oct 15 19:37:58 UTC 2019 Modified Files: src/sys/arch/arm/acpi [netbsd-9]: acpi_pci_machdep.c acpi_pci_machdep.h acpipchb.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #332): sys/arch/arm/acpi/acpipchb.c: revision 1.10 sys/arch/arm/acpi/acpipchb.c: revision 1.11 sys/arch/arm/acpi/acpipchb.c: revision 1.12 sys/arch/arm/acpi/acpi_pci_machdep.h: revision 1.3 sys/arch/arm/acpi/acpi_pci_machdep.h: revision 1.4 sys/arch/arm/acpi/acpi_pci_machdep.c: revision 1.10 sys/arch/arm/acpi/acpi_pci_machdep.c: revision 1.11 Add quirks for Amazon Graviton PCIe root ports. Configuration space for the root port is found in a child AMZN0001 resource, not the MCFG table. - More Amazon Graviton quirks: - Ignore devno > 0 on the PCIe root port. - Fixup PCIe bridge bus number register on the root port. - Move quirk handling to acpipchb so it can be applied before the bus is configured. - Fix detection of root port resources for Graviton and remove no longer required bridge fixup To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.9.6.1 src/sys/arch/arm/acpi/acpi_pci_machdep.c cvs rdiff -u -r1.2 -r1.2.8.1 src/sys/arch/arm/acpi/acpi_pci_machdep.h cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/arm/acpi/acpipchb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Tue Oct 15 19:33:24 UTC 2019 Modified Files: src/sys/dev/pci [netbsd-9]: pci.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #331): sys/dev/pci/pci.c: revision 1.155 The PCI Local Bus Specification says that we should probe devices by reading PCI_ID_REG. pci_enumerate_bus was incorrectly reading PCI_BHLC_REG first, which surprisingly has worked for the past 16 years. Unfortunately, this undefined behavior does the wrong thing on Amazon's Annapurna Labs PCIe host controller. To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.154.4.1 src/sys/dev/pci/pci.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/pci/pci.c diff -u src/sys/dev/pci/pci.c:1.154 src/sys/dev/pci/pci.c:1.154.4.1 --- src/sys/dev/pci/pci.c:1.154 Sat Dec 15 05:38:45 2018 +++ src/sys/dev/pci/pci.c Tue Oct 15 19:33:23 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.c,v 1.154 2018/12/15 05:38:45 msaitoh Exp $ */ +/* $NetBSD: pci.c,v 1.154.4.1 2019/10/15 19:33:23 martin Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154 2018/12/15 05:38:45 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.154.4.1 2019/10/15 19:33:23 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -723,10 +723,6 @@ pci_enumerate_bus(struct pci_softc *sc, tag = pci_make_tag(pc, sc->sc_bus, device, 0); - bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG); - if (PCI_HDRTYPE_TYPE(bhlcr) > 2) - continue; - id = pci_conf_read(pc, tag, PCI_ID_REG); /* Invalid vendor ID value? */ @@ -736,6 +732,10 @@ pci_enumerate_bus(struct pci_softc *sc, if (PCI_VENDOR(id) == 0) continue; + bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG); + if (PCI_HDRTYPE_TYPE(bhlcr) > 2) + continue; + qd = pci_lookup_quirkdata(PCI_VENDOR(id), PCI_PRODUCT(id)); if (qd != NULL &&
CVS commit: [netbsd-9] src/sys/dev/pci
Module Name:src Committed By: martin Date: Tue Oct 15 19:33:24 UTC 2019 Modified Files: src/sys/dev/pci [netbsd-9]: pci.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #331): sys/dev/pci/pci.c: revision 1.155 The PCI Local Bus Specification says that we should probe devices by reading PCI_ID_REG. pci_enumerate_bus was incorrectly reading PCI_BHLC_REG first, which surprisingly has worked for the past 16 years. Unfortunately, this undefined behavior does the wrong thing on Amazon's Annapurna Labs PCIe host controller. To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.154.4.1 src/sys/dev/pci/pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/dev/acpi
Module Name:src Committed By: martin Date: Tue Oct 15 19:30:50 UTC 2019 Modified Files: src/sys/dev/acpi [netbsd-9]: acpi_mcfg.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #333): sys/dev/acpi/acpi_mcfg.c: revision 1.17 The MCFG base address field is the physical address of the base of mmio space relative to bus 0, not the start bus number specified in the table entry. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/dev/acpi/acpi_mcfg.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_mcfg.c diff -u src/sys/dev/acpi/acpi_mcfg.c:1.16 src/sys/dev/acpi/acpi_mcfg.c:1.16.4.1 --- src/sys/dev/acpi/acpi_mcfg.c:1.16 Thu Dec 20 19:16:17 2018 +++ src/sys/dev/acpi/acpi_mcfg.c Tue Oct 15 19:30:50 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_mcfg.c,v 1.16 2018/12/20 19:16:17 jmcneill Exp $ */ +/* $NetBSD: acpi_mcfg.c,v 1.16.4.1 2019/10/15 19:30:50 martin Exp $ */ /*- * Copyright (C) 2015 NONAKA Kimihiro @@ -28,7 +28,7 @@ #include "opt_pci.h" #include -__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.16 2018/12/20 19:16:17 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.16.4.1 2019/10/15 19:30:50 martin Exp $"); #include #include @@ -575,7 +575,7 @@ acpimcfg_map_bus(device_t self, pci_chip return 0; mb = >ms_bus[boff]; - baddr = seg->ms_address + (boff * ACPIMCFG_SIZE_PER_BUS); + baddr = seg->ms_address + (bus * ACPIMCFG_SIZE_PER_BUS); /* Map extended configration space of all dev/func. */ error = bus_space_map(seg->ms_bst, baddr, ACPIMCFG_SIZE_PER_BUS, 0, @@ -832,7 +832,7 @@ acpimcfg_configure_bus(device_t self, pc for (b = seg->ms_bus_start; b <= seg->ms_bus_end; b++) { boff = b - seg->ms_bus_start; mb = >ms_bus[boff]; - baddr = seg->ms_address + (boff * ACPIMCFG_SIZE_PER_BUS); + baddr = seg->ms_address + (b * ACPIMCFG_SIZE_PER_BUS); /* Map extended configration space of all dev/func. */ error = bus_space_map(seg->ms_bst, baddr, ACPIMCFG_SIZE_PER_BUS, 0,
CVS commit: [netbsd-9] src/sys/dev/acpi
Module Name:src Committed By: martin Date: Tue Oct 15 19:30:50 UTC 2019 Modified Files: src/sys/dev/acpi [netbsd-9]: acpi_mcfg.c Log Message: Pull up following revision(s) (requested by jmcneill in ticket #333): sys/dev/acpi/acpi_mcfg.c: revision 1.17 The MCFG base address field is the physical address of the base of mmio space relative to bus 0, not the start bus number specified in the table entry. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.16.4.1 src/sys/dev/acpi/acpi_mcfg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: christos Date: Tue Oct 15 19:29:58 UTC 2019 Modified Files: src/sys/dev/pci: isp_pci.c Log Message: remove conditional portion that was wrong and always false. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/sys/dev/pci/isp_pci.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/pci/isp_pci.c diff -u src/sys/dev/pci/isp_pci.c:1.120 src/sys/dev/pci/isp_pci.c:1.121 --- src/sys/dev/pci/isp_pci.c:1.120 Sun Dec 9 06:14:02 2018 +++ src/sys/dev/pci/isp_pci.c Tue Oct 15 15:29:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: isp_pci.c,v 1.120 2018/12/09 11:14:02 jdolecek Exp $ */ +/* $NetBSD: isp_pci.c,v 1.121 2019/10/15 19:29:58 christos Exp $ */ /* * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration * All rights reserved. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.120 2018/12/09 11:14:02 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isp_pci.c,v 1.121 2019/10/15 19:29:58 christos Exp $"); #include #include @@ -1137,8 +1137,7 @@ isp_pci_rd_reg_1080(struct ispsoftc *isp uint16_t rv, oc = 0; struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; - if ((regoff & _BLK_REG_MASK) == SXP_BLOCK || - (regoff & _BLK_REG_MASK) == (SXP_BLOCK|SXP_BANK1_SELECT)) { + if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) { uint16_t tc; /* * We will assume that someone has paused the RISC processor. @@ -1168,8 +1167,7 @@ isp_pci_wr_reg_1080(struct ispsoftc *isp struct isp_pcisoftc *pcs = (struct isp_pcisoftc *) isp; int oc = 0; - if ((regoff & _BLK_REG_MASK) == SXP_BLOCK || - (regoff & _BLK_REG_MASK) == (SXP_BLOCK|SXP_BANK1_SELECT)) { + if ((regoff & _BLK_REG_MASK) == SXP_BLOCK) { uint16_t tc; /* * We will assume that someone has paused the RISC processor.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: christos Date: Tue Oct 15 19:29:58 UTC 2019 Modified Files: src/sys/dev/pci: isp_pci.c Log Message: remove conditional portion that was wrong and always false. To generate a diff of this commit: cvs rdiff -u -r1.120 -r1.121 src/sys/dev/pci/isp_pci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:28:17 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c Log Message: Pull up following revision(s) (requested by kamil in ticket #330): sys/kern/kern_sig.c: revision 1.372 Avoid double lwp_exit() in eventswitch() For the PTRACE_LWP_EXIT event, the eventswitch() call is triggered from lwp_exit(). In the case of setting the program status to PS_WEXIT, do not try to demise in place, by calling lwp_exit() as it causes panic. In this scenario bail out from the function and resume the lwp_exit() procedure. To generate a diff of this commit: cvs rdiff -u -r1.364.2.6 -r1.364.2.7 src/sys/kern/kern_sig.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/kern_sig.c diff -u src/sys/kern/kern_sig.c:1.364.2.6 src/sys/kern/kern_sig.c:1.364.2.7 --- src/sys/kern/kern_sig.c:1.364.2.6 Tue Oct 15 19:27:04 2019 +++ src/sys/kern/kern_sig.c Tue Oct 15 19:28:16 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.364.2.6 2019/10/15 19:27:04 martin Exp $ */ +/* $NetBSD: kern_sig.c,v 1.364.2.7 2019/10/15 19:28:16 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.6 2019/10/15 19:27:04 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.7 2019/10/15 19:28:16 martin Exp $"); #include "opt_ptrace.h" #include "opt_dtrace.h" @@ -1612,6 +1612,12 @@ repeat: if (__predict_false(ISSET(p->p_sflag, PS_WEXIT))) { mutex_exit(p->p_lock); mutex_exit(proc_lock); + + if (pe_report_event == PTRACE_LWP_EXIT) { + /* Avoid double lwp_exit() and panic. */ + return; + } + lwp_exit(l); panic("eventswitch"); /* NOTREACHED */
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:28:17 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c Log Message: Pull up following revision(s) (requested by kamil in ticket #330): sys/kern/kern_sig.c: revision 1.372 Avoid double lwp_exit() in eventswitch() For the PTRACE_LWP_EXIT event, the eventswitch() call is triggered from lwp_exit(). In the case of setting the program status to PS_WEXIT, do not try to demise in place, by calling lwp_exit() as it causes panic. In this scenario bail out from the function and resume the lwp_exit() procedure. To generate a diff of this commit: cvs rdiff -u -r1.364.2.6 -r1.364.2.7 src/sys/kern/kern_sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:27:04 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c Log Message: Pull up following revision(s) (requested by kamil in ticket #329): sys/kern/kern_sig.c: revision 1.371 Fix one the the root causes of unreliability of the ptrace(2)ed threads In case of sigswitchin away in issignal() and continuing the execution on PT_CONTINUE (or equivalent call), there is a time window when another thread could cause the process state to be changed to PS_STOPPING. In the current logic, a thread would receive signal 0 (no-signal) and exit from issignal(), returning to userland and never finishing the process of stopping all LWPs. This causes hangs waitpid() waiting for SIGCHLD and the callout polling for the state of the process in an infinite loop. Instead of prompting for a returned signal from a debugger, repeat the issignal() loop, this will cause checking the PS_STOPPING flag again and sigswitching away in the scenario of stopping the process. To generate a diff of this commit: cvs rdiff -u -r1.364.2.5 -r1.364.2.6 src/sys/kern/kern_sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:27:04 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c Log Message: Pull up following revision(s) (requested by kamil in ticket #329): sys/kern/kern_sig.c: revision 1.371 Fix one the the root causes of unreliability of the ptrace(2)ed threads In case of sigswitchin away in issignal() and continuing the execution on PT_CONTINUE (or equivalent call), there is a time window when another thread could cause the process state to be changed to PS_STOPPING. In the current logic, a thread would receive signal 0 (no-signal) and exit from issignal(), returning to userland and never finishing the process of stopping all LWPs. This causes hangs waitpid() waiting for SIGCHLD and the callout polling for the state of the process in an infinite loop. Instead of prompting for a returned signal from a debugger, repeat the issignal() loop, this will cause checking the PS_STOPPING flag again and sigswitching away in the scenario of stopping the process. To generate a diff of this commit: cvs rdiff -u -r1.364.2.5 -r1.364.2.6 src/sys/kern/kern_sig.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/kern_sig.c diff -u src/sys/kern/kern_sig.c:1.364.2.5 src/sys/kern/kern_sig.c:1.364.2.6 --- src/sys/kern/kern_sig.c:1.364.2.5 Tue Oct 15 19:25:11 2019 +++ src/sys/kern/kern_sig.c Tue Oct 15 19:27:04 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.364.2.5 2019/10/15 19:25:11 martin Exp $ */ +/* $NetBSD: kern_sig.c,v 1.364.2.6 2019/10/15 19:27:04 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.5 2019/10/15 19:25:11 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.6 2019/10/15 19:27:04 martin Exp $"); #include "opt_ptrace.h" #include "opt_dtrace.h" @@ -1863,7 +1863,7 @@ issignal(struct lwp *l) if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) { sigswitch_unlock_and_switch_away(l); mutex_enter(p->p_lock); - signo = sigchecktrace(); + continue; } else if (p->p_stat == SACTIVE) signo = sigchecktrace(); else
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:25:12 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c Log Message: Pull up following revision(s) (requested by kamil in ticket #327): sys/kern/kern_sig.c: revision 1.370 Add sigswitch_unlock_and_switch_away(), extracted from sigswitch() Use sigswitch_unlock_and_switch_away() whenever there is no need for sigswitch(). To generate a diff of this commit: cvs rdiff -u -r1.364.2.4 -r1.364.2.5 src/sys/kern/kern_sig.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/kern_sig.c diff -u src/sys/kern/kern_sig.c:1.364.2.4 src/sys/kern/kern_sig.c:1.364.2.5 --- src/sys/kern/kern_sig.c:1.364.2.4 Tue Oct 15 19:23:09 2019 +++ src/sys/kern/kern_sig.c Tue Oct 15 19:25:11 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.364.2.4 2019/10/15 19:23:09 martin Exp $ */ +/* $NetBSD: kern_sig.c,v 1.364.2.5 2019/10/15 19:25:11 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.4 2019/10/15 19:23:09 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.5 2019/10/15 19:25:11 martin Exp $"); #include "opt_ptrace.h" #include "opt_dtrace.h" @@ -126,6 +126,7 @@ static int sigpost(struct lwp *, sig_t, static int sigput(sigpend_t *, struct proc *, ksiginfo_t *); static int sigunwait(struct proc *, const ksiginfo_t *); static void sigswitch(int, int, bool); +static void sigswitch_unlock_and_switch_away(struct lwp *); static void sigacts_poolpage_free(struct pool *, void *); static void *sigacts_poolpage_alloc(struct pool *, int); @@ -932,10 +933,11 @@ repeat: * The process is already stopping. */ if ((p->p_sflag & PS_STOPPING) != 0) { - sigswitch(0, p->p_xsig, true); + mutex_exit(proc_lock); + sigswitch_unlock_and_switch_away(l); mutex_enter(proc_lock); mutex_enter(p->p_lock); - goto repeat; /* XXX */ + goto repeat; } mask = >l_sigmask; @@ -1640,10 +1642,11 @@ repeat: * The process is already stopping. */ if ((p->p_sflag & PS_STOPPING) != 0) { - sigswitch(0, p->p_xsig, true); + mutex_exit(proc_lock); + sigswitch_unlock_and_switch_away(l); mutex_enter(proc_lock); mutex_enter(p->p_lock); - goto repeat; /* XXX */ + goto repeat; } KSI_INIT_TRAP(); @@ -1690,7 +1693,6 @@ sigswitch(int ppmask, int signo, bool pr { struct lwp *l = curlwp; struct proc *p = l->l_proc; - int biglocks; KASSERT(mutex_owned(p->p_lock)); KASSERT(l->l_stat == LSONPROC); @@ -1750,10 +1752,26 @@ sigswitch(int ppmask, int signo, bool pr mutex_exit(proc_lock); } - /* - * Unlock and switch away. - */ + sigswitch_unlock_and_switch_away(l); +} + +/* + * Unlock and switch away. + */ +static void +sigswitch_unlock_and_switch_away(struct lwp *l) +{ + struct proc *p; + int biglocks; + + p = l->l_proc; + + KASSERT(mutex_owned(p->p_lock)); KASSERT(!mutex_owned(proc_lock)); + + KASSERT(l->l_stat == LSONPROC); + KASSERT(p->p_nrlwps > 0); + KERNEL_UNLOCK_ALL(l, ); if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) { p->p_nrlwps--; @@ -1843,7 +1861,7 @@ issignal(struct lwp *l) * we awaken, check for a signal from the debugger. */ if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) { - sigswitch(PS_NOCLDSTOP, 0, false); + sigswitch_unlock_and_switch_away(l); mutex_enter(p->p_lock); signo = sigchecktrace(); } else if (p->p_stat == SACTIVE) @@ -2525,9 +2543,9 @@ repeat: * The process is already stopping. */ if ((p->p_sflag & PS_STOPPING) != 0) { - sigswitch(0, p->p_xsig, false); + sigswitch_unlock_and_switch_away(l); mutex_enter(p->p_lock); - goto repeat; /* XXX */ + goto repeat; } /* Needed for ktrace */
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:25:12 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c Log Message: Pull up following revision(s) (requested by kamil in ticket #327): sys/kern/kern_sig.c: revision 1.370 Add sigswitch_unlock_and_switch_away(), extracted from sigswitch() Use sigswitch_unlock_and_switch_away() whenever there is no need for sigswitch(). To generate a diff of this commit: cvs rdiff -u -r1.364.2.4 -r1.364.2.5 src/sys/kern/kern_sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Tue Oct 15 19:23:09 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c src/sys/sys [netbsd-9]: signalvar.h Log Message: Pull up following revision(s) (requested by kamil in ticket #328): sys/kern/kern_sig.c: revision 1.369 sys/sys/signalvar.h: revision 1.97 Refactor sigswitch() Make the function static as it is now local to kern_sig.c. Rename the 'relock' argument to 'proc_lock_held' as it is more verbose. This was suggested by mjg@freebsd. While there this flips the users between true<->false. Add additional KASSERT(9) calls here to validate whethe proc_lock is used accordingly. To generate a diff of this commit: cvs rdiff -u -r1.364.2.3 -r1.364.2.4 src/sys/kern/kern_sig.c cvs rdiff -u -r1.93.2.1 -r1.93.2.2 src/sys/sys/signalvar.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_sig.c diff -u src/sys/kern/kern_sig.c:1.364.2.3 src/sys/kern/kern_sig.c:1.364.2.4 --- src/sys/kern/kern_sig.c:1.364.2.3 Tue Oct 15 19:08:46 2019 +++ src/sys/kern/kern_sig.c Tue Oct 15 19:23:09 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.364.2.3 2019/10/15 19:08:46 martin Exp $ */ +/* $NetBSD: kern_sig.c,v 1.364.2.4 2019/10/15 19:23:09 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.3 2019/10/15 19:08:46 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.4 2019/10/15 19:23:09 martin Exp $"); #include "opt_ptrace.h" #include "opt_dtrace.h" @@ -125,6 +125,7 @@ static int sigchecktrace(void); static int sigpost(struct lwp *, sig_t, int, int); static int sigput(sigpend_t *, struct proc *, ksiginfo_t *); static int sigunwait(struct proc *, const ksiginfo_t *); +static void sigswitch(int, int, bool); static void sigacts_poolpage_free(struct pool *, void *); static void *sigacts_poolpage_alloc(struct pool *, int); @@ -931,7 +932,7 @@ repeat: * The process is already stopping. */ if ((p->p_sflag & PS_STOPPING) != 0) { - sigswitch(0, p->p_xsig, false); + sigswitch(0, p->p_xsig, true); mutex_enter(proc_lock); mutex_enter(p->p_lock); goto repeat; /* XXX */ @@ -949,7 +950,7 @@ repeat: p->p_sigctx.ps_faked = true; p->p_sigctx.ps_lwp = ksi->ksi_lid; p->p_sigctx.ps_info = ksi->ksi_info; - sigswitch(0, signo, false); + sigswitch(0, signo, true); if (ktrpoint(KTR_PSIG)) { if (p->p_emul->e_ktrpsig) @@ -1639,7 +1640,7 @@ repeat: * The process is already stopping. */ if ((p->p_sflag & PS_STOPPING) != 0) { - sigswitch(0, p->p_xsig, false); + sigswitch(0, p->p_xsig, true); mutex_enter(proc_lock); mutex_enter(p->p_lock); goto repeat; /* XXX */ @@ -1664,7 +1665,7 @@ repeat: p->p_sigctx.ps_lwp = ksi.ksi_lid; p->p_sigctx.ps_info = ksi.ksi_info; - sigswitch(0, signo, false); + sigswitch(0, signo, true); if (code == TRAP_CHLD) { mutex_enter(proc_lock); @@ -1684,8 +1685,8 @@ repeat: /* * Stop the current process and switch away when being stopped or traced. */ -void -sigswitch(int ppmask, int signo, bool relock) +static void +sigswitch(int ppmask, int signo, bool proc_lock_held) { struct lwp *l = curlwp; struct proc *p = l->l_proc; @@ -1695,6 +1696,12 @@ sigswitch(int ppmask, int signo, bool re KASSERT(l->l_stat == LSONPROC); KASSERT(p->p_nrlwps > 0); + if (proc_lock_held) { + KASSERT(mutex_owned(proc_lock)); + } else { + KASSERT(!mutex_owned(proc_lock)); + } + /* * If we are exiting, demise now. * @@ -1702,7 +1709,7 @@ sigswitch(int ppmask, int signo, bool re */ if (__predict_false(ISSET(p->p_sflag, PS_WEXIT))) { mutex_exit(p->p_lock); - if (!relock) { + if (proc_lock_held) { mutex_exit(proc_lock); } lwp_exit(l); @@ -1726,7 +1733,7 @@ sigswitch(int ppmask, int signo, bool re * a new signal, then signal the parent. */ if ((p->p_sflag & PS_STOPPING) != 0) { - if (relock && !mutex_tryenter(proc_lock)) { + if (!proc_lock_held && !mutex_tryenter(proc_lock)) { mutex_exit(p->p_lock); mutex_enter(proc_lock); mutex_enter(p->p_lock); @@ -1746,6 +1753,7 @@ sigswitch(int ppmask, int signo, bool re /* * Unlock and switch away. */ + KASSERT(!mutex_owned(proc_lock)); KERNEL_UNLOCK_ALL(l, ); if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) { p->p_nrlwps--; @@ -1835,7 +1843,7 @@ issignal(struct lwp *l) * we awaken, check for a signal from the debugger. */ if (p->p_stat == SSTOP || (p->p_sflag & PS_STOPPING) != 0) { - sigswitch(PS_NOCLDSTOP, 0, true); + sigswitch(PS_NOCLDSTOP, 0, false); mutex_enter(p->p_lock); signo = sigchecktrace(); } else if (p->p_stat == SACTIVE) @@ -1907,7 +1915,7 @@ issignal(struct lwp *l) p->p_xsig = signo; /* Handling of signal trace */ - sigswitch(0, signo, true); + sigswitch(0, signo,
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Tue Oct 15 19:23:09 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c src/sys/sys [netbsd-9]: signalvar.h Log Message: Pull up following revision(s) (requested by kamil in ticket #328): sys/kern/kern_sig.c: revision 1.369 sys/sys/signalvar.h: revision 1.97 Refactor sigswitch() Make the function static as it is now local to kern_sig.c. Rename the 'relock' argument to 'proc_lock_held' as it is more verbose. This was suggested by mjg@freebsd. While there this flips the users between true<->false. Add additional KASSERT(9) calls here to validate whethe proc_lock is used accordingly. To generate a diff of this commit: cvs rdiff -u -r1.364.2.3 -r1.364.2.4 src/sys/kern/kern_sig.c cvs rdiff -u -r1.93.2.1 -r1.93.2.2 src/sys/sys/signalvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 19:13:22 UTC 2019 Modified Files: src/lib/libc/sys [netbsd-9]: ptrace.2 Log Message: Pull up following revision(s) (requested by kamil in ticket #326): lib/libc/sys/ptrace.2: revision 1.81 Document PT_STOP, update PT_KILL in the ptrace(2) man-page Formatting by To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.79.2.1 src/lib/libc/sys/ptrace.2 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/sys/ptrace.2 diff -u src/lib/libc/sys/ptrace.2:1.79 src/lib/libc/sys/ptrace.2:1.79.2.1 --- src/lib/libc/sys/ptrace.2:1.79 Thu Jul 11 03:30:01 2019 +++ src/lib/libc/sys/ptrace.2 Tue Oct 15 19:13:22 2019 @@ -1,7 +1,7 @@ -.\" $NetBSD: ptrace.2,v 1.79 2019/07/11 03:30:01 mgorny Exp $ +.\" $NetBSD: ptrace.2,v 1.79.2.1 2019/10/15 19:13:22 martin Exp $ .\" .\" This file is in the public domain. -.Dd July 11, 2019 +.Dd October 9, 2019 .Dt PTRACE 2 .Os .Sh NAME @@ -249,9 +249,37 @@ ID of the thread to be resumed, and only .It Dv PT_KILL The traced process terminates, as if .Dv PT_CONTINUE -had been used with +has been used with .Dv SIGKILL given as the signal to be delivered. +However, unlike +.Dv PT_CONTINUE , +.Dv PT_KILL +can be used on a non-stopped tracee. +The +.Fa addr +and +.Fa data +arguments are ignored. +.It Dv PT_STOP +The traced process stops, as if +.Xr kill +has been used with +.Dv SIGSTOP +given as the signal to be delivered. +.Xr wait 2 +will report the child (again) as stopped even if it was stopped before. +The +.Fa addr +and +.Fa data +arguments are ignored. +Unlike +.Dv PT_CONTINUE +call with +.Dv SIGSTOP , +.Dv PT_STOP +works both on running and stopped processes. .It Dv PT_ATTACH This request allows a process to gain control of an otherwise unrelated process and begin tracing it.
CVS commit: [netbsd-9] src/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 19:13:22 UTC 2019 Modified Files: src/lib/libc/sys [netbsd-9]: ptrace.2 Log Message: Pull up following revision(s) (requested by kamil in ticket #326): lib/libc/sys/ptrace.2: revision 1.81 Document PT_STOP, update PT_KILL in the ptrace(2) man-page Formatting by To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.79.2.1 src/lib/libc/sys/ptrace.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Tue Oct 15 19:11:02 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c src/sys/sys [netbsd-9]: ptrace.h Log Message: Pull up following revision(s) (requested by kamil in ticket #325): sys/sys/ptrace.h: revision 1.66 sys/kern/sys_ptrace_common.c: revision 1.66 Introduce new ptrace(2) operation PT_STOP It works like: - kill(SIGSTOP) for unstopped tracee - ptrace(PT_CONTINUE,SIGSTOP) for stopped tracee The child will be stopped and always possible to be waited (with wait(2) like calls). For stopped traccee kill(SIGSTOP) has no effect. PT_CONTINUE+SIGSTOP cannot be used on an unstopped process (EBUSY). This operation is modeled after PT_KILL that is similar for the SIGKILL call. While there, allow PT_KILL on unstopped traced child. This operation is useful in an abnormal exit of a debugger from a signal handler, usually followed by waitpid(2) and ptrace(PT_DETACH). To generate a diff of this commit: cvs rdiff -u -r1.58.2.7 -r1.58.2.8 src/sys/kern/sys_ptrace_common.c cvs rdiff -u -r1.65 -r1.65.2.1 src/sys/sys/ptrace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Tue Oct 15 19:11:02 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c src/sys/sys [netbsd-9]: ptrace.h Log Message: Pull up following revision(s) (requested by kamil in ticket #325): sys/sys/ptrace.h: revision 1.66 sys/kern/sys_ptrace_common.c: revision 1.66 Introduce new ptrace(2) operation PT_STOP It works like: - kill(SIGSTOP) for unstopped tracee - ptrace(PT_CONTINUE,SIGSTOP) for stopped tracee The child will be stopped and always possible to be waited (with wait(2) like calls). For stopped traccee kill(SIGSTOP) has no effect. PT_CONTINUE+SIGSTOP cannot be used on an unstopped process (EBUSY). This operation is modeled after PT_KILL that is similar for the SIGKILL call. While there, allow PT_KILL on unstopped traced child. This operation is useful in an abnormal exit of a debugger from a signal handler, usually followed by waitpid(2) and ptrace(PT_DETACH). To generate a diff of this commit: cvs rdiff -u -r1.58.2.7 -r1.58.2.8 src/sys/kern/sys_ptrace_common.c cvs rdiff -u -r1.65 -r1.65.2.1 src/sys/sys/ptrace.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/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.58.2.7 src/sys/kern/sys_ptrace_common.c:1.58.2.8 --- src/sys/kern/sys_ptrace_common.c:1.58.2.7 Tue Oct 15 19:07:14 2019 +++ src/sys/kern/sys_ptrace_common.c Tue Oct 15 19:11:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.58.2.7 2019/10/15 19:07:14 martin Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.58.2.8 2019/10/15 19:11:02 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.7 2019/10/15 19:07:14 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.8 2019/10/15 19:11:02 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -286,6 +286,7 @@ ptrace_listener_cb(kauth_cred_t cred, ka case PT_DUMPCORE: case PT_RESUME: case PT_SUSPEND: + case PT_STOP: result = KAUTH_RESULT_ALLOW; break; @@ -493,6 +494,7 @@ ptrace_allowed(struct lwp *l, int req, s case PT_GET_PROCESS_STATE: case PT_RESUME: case PT_SUSPEND: + case PT_STOP: /* * You can't do what you want to the process if: * (1) It's not being traced at all, @@ -511,8 +513,11 @@ ptrace_allowed(struct lwp *l, int req, s /* * (3) it's not currently stopped. + * + * As an exception allow PT_KILL and PT_STOP here. */ - if (t->p_stat != SSTOP || !t->p_waited /* XXXSMP */) { + if (req != PT_KILL && req != PT_STOP && + (t->p_stat != SSTOP || !t->p_waited /* XXXSMP */)) { DPRINTF(("stat %d flag %d\n", t->p_stat, !t->p_waited)); return EBUSY; @@ -540,6 +545,7 @@ ptrace_needs_hold(int req) case PT_TRACE_ME: case PT_GET_SIGINFO: case PT_SET_SIGINFO: + case PT_STOP: return 1; default: return 0; @@ -891,7 +897,7 @@ ptrace_regs(struct lwp *l, struct lwp ** #endif static int -ptrace_sendsig(struct proc *t, struct lwp *lt, int signo, int resume_all) +ptrace_sendsig(struct lwp *l, int req, struct proc *t, struct lwp *lt, int signo, int resume_all) { ksiginfo_t ksi; @@ -919,23 +925,20 @@ ptrace_sendsig(struct proc *t, struct lw return 0; } - KSI_INIT_EMPTY(); - if (t->p_sigctx.ps_faked) { - if (signo != t->p_sigctx.ps_info._signo) - return EINVAL; - t->p_sigctx.ps_faked = false; - ksi.ksi_info = t->p_sigctx.ps_info; - ksi.ksi_lid = t->p_sigctx.ps_lwp; - } else if (signo == 0) { - return 0; - } else { - ksi.ksi_signo = signo; - } + KASSERT(req == PT_KILL || req == PT_STOP || req == PT_ATTACH); + + KSI_INIT(); + ksi.ksi_signo = signo; + ksi.ksi_code = SI_USER; + ksi.ksi_pid = l->l_proc->p_pid; + ksi.ksi_uid = kauth_cred_geteuid(l->l_cred); + + t->p_sigctx.ps_faked = false; + DPRINTF(("%s: pid=%d.%d signal=%d resume_all=%d\n", __func__, t->p_pid, - t->p_sigctx.ps_lwp, signo, resume_all)); + lt->l_lid, signo, resume_all)); - kpsignal2(t, ); - return 0; + return kpsignal2(t, ); } static int @@ -1332,7 +1335,7 @@ do_ptrace(struct ptrace_methods *ptm, st CLR(lt->l_pflag, LP_SINGLESTEP); } sendsig: - error = ptrace_sendsig(t, lt, signo, resume_all); + error = ptrace_sendsig(l, req, t, lt, signo, resume_all); break; case PT_SYSCALLEMU: @@ -1365,6 +1368,11 @@ do_ptrace(struct ptrace_methods *ptm, st signo = SIGKILL; goto sendsig; /* in PT_CONTINUE, above. */ + case PT_STOP: + /* just send the process a STOP signal. */ + signo = SIGSTOP; + goto sendsig; /* in PT_CONTINUE, above. */ + case PT_ATTACH: /* * Go ahead and set the trace flag. Index: src/sys/sys/ptrace.h diff -u src/sys/sys/ptrace.h:1.65 src/sys/sys/ptrace.h:1.65.2.1 --- src/sys/sys/ptrace.h:1.65 Tue Jun 11 23:18:55 2019 +++ src/sys/sys/ptrace.h Tue Oct 15
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:08:46 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c Log Message: Pull up following revision(s) (requested by kamil in ticket #324): sys/kern/kern_sig.c: revision 1.367 Enhance reliability of ptrace(2) in a debuggee with multiple LWPs Stop competing between threads which one emits event signal quicker and overwriting the signal from another thread. This fixes missed in action signals. NetBSD truss can now report reliably all TRAP_SCE/SCX/etc events without reports of missed ones. his was one of the reasons why debuggee with multiple threads misbehaved under a debugger. This change is v.2 of the previously reverted commit for the same fix. This version contains recovery path that stopps triggering event SIGTRAP for a detached debugger. To generate a diff of this commit: cvs rdiff -u -r1.364.2.2 -r1.364.2.3 src/sys/kern/kern_sig.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:08:46 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_sig.c Log Message: Pull up following revision(s) (requested by kamil in ticket #324): sys/kern/kern_sig.c: revision 1.367 Enhance reliability of ptrace(2) in a debuggee with multiple LWPs Stop competing between threads which one emits event signal quicker and overwriting the signal from another thread. This fixes missed in action signals. NetBSD truss can now report reliably all TRAP_SCE/SCX/etc events without reports of missed ones. his was one of the reasons why debuggee with multiple threads misbehaved under a debugger. This change is v.2 of the previously reverted commit for the same fix. This version contains recovery path that stopps triggering event SIGTRAP for a detached debugger. To generate a diff of this commit: cvs rdiff -u -r1.364.2.2 -r1.364.2.3 src/sys/kern/kern_sig.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/kern_sig.c diff -u src/sys/kern/kern_sig.c:1.364.2.2 src/sys/kern/kern_sig.c:1.364.2.3 --- src/sys/kern/kern_sig.c:1.364.2.2 Tue Oct 15 19:01:06 2019 +++ src/sys/kern/kern_sig.c Tue Oct 15 19:08:46 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.364.2.2 2019/10/15 19:01:06 martin Exp $ */ +/* $NetBSD: kern_sig.c,v 1.364.2.3 2019/10/15 19:08:46 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.2 2019/10/15 19:01:06 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.3 2019/10/15 19:08:46 martin Exp $"); #include "opt_ptrace.h" #include "opt_dtrace.h" @@ -913,6 +913,7 @@ trapsignal(struct lwp *l, ksiginfo_t *ks mutex_enter(proc_lock); mutex_enter(p->p_lock); +repeat: /* * If we are exiting, demise now. * @@ -926,6 +927,16 @@ trapsignal(struct lwp *l, ksiginfo_t *ks /* NOTREACHED */ } + /* + * The process is already stopping. + */ + if ((p->p_sflag & PS_STOPPING) != 0) { + sigswitch(0, p->p_xsig, false); + mutex_enter(proc_lock); + mutex_enter(p->p_lock); + goto repeat; /* XXX */ + } + mask = >l_sigmask; ps = p->p_sigacts; action = SIGACTION_PS(ps, signo).sa_handler; @@ -1589,11 +1600,12 @@ eventswitch(int code, int pe_report_even KASSERT((code == TRAP_CHLD) || (code == TRAP_LWP) || (code == TRAP_EXEC)); +repeat: /* * If we are exiting, demise now. * * This avoids notifying tracer and deadlocking. - */ + */ if (__predict_false(ISSET(p->p_sflag, PS_WEXIT))) { mutex_exit(p->p_lock); mutex_exit(proc_lock); @@ -1603,6 +1615,17 @@ eventswitch(int code, int pe_report_even } /* + * If we are no longer traced, abandon this event signal. + * + * This avoids killing a process after detaching the debugger. + */ + if (__predict_false(!ISSET(p->p_slflag, PSL_TRACED))) { + mutex_exit(p->p_lock); + mutex_exit(proc_lock); + return; + } + + /* * If there's a pending SIGKILL process it immediately. */ if (p->p_xsig == SIGKILL || @@ -1612,6 +1635,16 @@ eventswitch(int code, int pe_report_even return; } + /* + * The process is already stopping. + */ + if ((p->p_sflag & PS_STOPPING) != 0) { + sigswitch(0, p->p_xsig, false); + mutex_enter(proc_lock); + mutex_enter(p->p_lock); + goto repeat; /* XXX */ + } + KSI_INIT_TRAP(); ksi.ksi_lid = l->l_lid; ksi.ksi_signo = signo; @@ -2448,6 +2481,7 @@ proc_stoptrace(int trapno, int sysnum, c mutex_enter(p->p_lock); +repeat: /* * If we are exiting, demise now. * @@ -2469,6 +2503,25 @@ proc_stoptrace(int trapno, int sysnum, c return; } + /* + * If we are no longer traced, abandon this event signal. + * + * This avoids killing a process after detaching the debugger. + */ + if (__predict_false(!ISSET(p->p_slflag, PSL_TRACED))) { + mutex_exit(p->p_lock); + return; + } + + /* + * The process is already stopping. + */ + if ((p->p_sflag & PS_STOPPING) != 0) { + sigswitch(0, p->p_xsig, true); + mutex_enter(p->p_lock); + goto repeat; /* XXX */ + } + /* Needed for ktrace */ ps = p->p_sigacts; action = SIGACTION_PS(ps, signo).sa_handler;
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:07:14 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #323): sys/kern/sys_ptrace_common.c: revision 1.65 Correct the same expression on both sides of | PR sw-bug/54610 by David Binderman To generate a diff of this commit: cvs rdiff -u -r1.58.2.6 -r1.58.2.7 src/sys/kern/sys_ptrace_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:07:14 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #323): sys/kern/sys_ptrace_common.c: revision 1.65 Correct the same expression on both sides of | PR sw-bug/54610 by David Binderman To generate a diff of this commit: cvs rdiff -u -r1.58.2.6 -r1.58.2.7 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.58.2.6 src/sys/kern/sys_ptrace_common.c:1.58.2.7 --- src/sys/kern/sys_ptrace_common.c:1.58.2.6 Tue Oct 15 19:03:20 2019 +++ src/sys/kern/sys_ptrace_common.c Tue Oct 15 19:07:14 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.58.2.6 2019/10/15 19:03:20 martin Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.58.2.7 2019/10/15 19:07:14 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.6 2019/10/15 19:03:20 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.7 2019/10/15 19:07:14 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -1265,7 +1265,7 @@ do_ptrace(struct ptrace_methods *ptm, st break; } } else { - if (lt->l_flag & (LW_WSUSPEND | LW_WSUSPEND)) { + if (lt->l_flag & (LW_WSUSPEND | LW_DBGSUSPEND)) { error = EDEADLK; break; }
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:05:38 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sysv_msg.c Log Message: Pull up following revision(s) (requested by kamil in ticket #322): sys/kern/sysv_msg.c: revision 1.76 Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX This logic (found in Linux) avoids undefined behavior. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.74.4.1 src/sys/kern/sysv_msg.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/sysv_msg.c diff -u src/sys/kern/sysv_msg.c:1.74 src/sys/kern/sysv_msg.c:1.74.4.1 --- src/sys/kern/sysv_msg.c:1.74 Wed Apr 10 10:03:50 2019 +++ src/sys/kern/sysv_msg.c Tue Oct 15 19:05:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sysv_msg.c,v 1.74 2019/04/10 10:03:50 pgoyette Exp $ */ +/* $NetBSD: sysv_msg.c,v 1.74.4.1 2019/10/15 19:05:38 martin Exp $ */ /*- * Copyright (c) 1999, 2006, 2007 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.74 2019/04/10 10:03:50 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sysv_msg.c,v 1.74.4.1 2019/10/15 19:05:38 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_sysv.h" @@ -1104,6 +1104,7 @@ restart: */ if (msgtyp != msghdr->msg_type && +msgtyp != LONG_MIN && msghdr->msg_type > -msgtyp) continue;
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:05:38 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sysv_msg.c Log Message: Pull up following revision(s) (requested by kamil in ticket #322): sys/kern/sysv_msg.c: revision 1.76 Avoid -LONG_MIN msgtyp in msgrcv(2) and treat it as LONG_MAX This logic (found in Linux) avoids undefined behavior. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.74.4.1 src/sys/kern/sysv_msg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:03:20 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #321): sys/kern/sys_ptrace_common.c: revision 1.63 Add two KASSERTS in the ptrace(2) kernel code Verify that we will never return empty ptrace_state for CHILD/LWP event. To generate a diff of this commit: cvs rdiff -u -r1.58.2.5 -r1.58.2.6 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.58.2.5 src/sys/kern/sys_ptrace_common.c:1.58.2.6 --- src/sys/kern/sys_ptrace_common.c:1.58.2.5 Tue Oct 15 19:01:06 2019 +++ src/sys/kern/sys_ptrace_common.c Tue Oct 15 19:03:20 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.58.2.5 2019/10/15 19:01:06 martin Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.58.2.6 2019/10/15 19:03:20 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.5 2019/10/15 19:01:06 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.6 2019/10/15 19:03:20 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -702,6 +702,10 @@ ptrace_get_process_state(struct proc *t, memset(, 0, sizeof(ps)); } else { si = >p_sigctx.ps_info; + + KASSERT(si->_reason._ptrace_state._pe_report_event > 0); + KASSERT(si->_reason._ptrace_state._option._pe_other_pid > 0); + ps.pe_report_event = si->_reason._ptrace_state._pe_report_event; CTASSERT(sizeof(ps.pe_other_pid) == sizeof(ps.pe_lwp));
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:03:20 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #321): sys/kern/sys_ptrace_common.c: revision 1.63 Add two KASSERTS in the ptrace(2) kernel code Verify that we will never return empty ptrace_state for CHILD/LWP event. To generate a diff of this commit: cvs rdiff -u -r1.58.2.5 -r1.58.2.6 src/sys/kern/sys_ptrace_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:01:06 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_exit.c kern_lwp.c kern_sig.c kern_synch.c sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #320): sys/kern/kern_synch.c: revision 1.324 sys/kern/kern_sig.c: revision 1.366 sys/kern/kern_exit.c: revision 1.277 sys/kern/kern_lwp.c: revision 1.204 sys/kern/sys_ptrace_common.c: revision 1.62 Separate flag for suspended by _lwp_suspend and suspended by a debugger Once a thread was stopped with ptrace(2), userland process must not be able to unstop it deliberately or by an accident. This was a Windows-style behavior that makes threading tracing fragile. To generate a diff of this commit: cvs rdiff -u -r1.276 -r1.276.2.1 src/sys/kern/kern_exit.c cvs rdiff -u -r1.202.2.1 -r1.202.2.2 src/sys/kern/kern_lwp.c cvs rdiff -u -r1.364.2.1 -r1.364.2.2 src/sys/kern/kern_sig.c cvs rdiff -u -r1.323 -r1.323.4.1 src/sys/kern/kern_synch.c cvs rdiff -u -r1.58.2.4 -r1.58.2.5 src/sys/kern/sys_ptrace_common.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/kern_exit.c diff -u src/sys/kern/kern_exit.c:1.276 src/sys/kern/kern_exit.c:1.276.2.1 --- src/sys/kern/kern_exit.c:1.276 Thu Jun 13 20:20:18 2019 +++ src/sys/kern/kern_exit.c Tue Oct 15 19:01:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exit.c,v 1.276 2019/06/13 20:20:18 kamil Exp $ */ +/* $NetBSD: kern_exit.c,v 1.276.2.1 2019/10/15 19:01:06 martin Exp $ */ /*- * Copyright (c) 1998, 1999, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.276 2019/06/13 20:20:18 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exit.c,v 1.276.2.1 2019/10/15 19:01:06 martin Exp $"); #include "opt_ktrace.h" #include "opt_dtrace.h" @@ -617,6 +617,7 @@ retry: l2->l_flag |= LW_WEXIT; if ((l2->l_stat == LSSLEEP && (l2->l_flag & LW_SINTR)) || l2->l_stat == LSSUSPENDED || l2->l_stat == LSSTOP) { + l2->l_flag &= ~LW_DBGSUSPEND; /* setrunnable() will release the lock. */ setrunnable(l2); continue; Index: src/sys/kern/kern_lwp.c diff -u src/sys/kern/kern_lwp.c:1.202.2.1 src/sys/kern/kern_lwp.c:1.202.2.2 --- src/sys/kern/kern_lwp.c:1.202.2.1 Tue Oct 15 18:32:13 2019 +++ src/sys/kern/kern_lwp.c Tue Oct 15 19:01:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_lwp.c,v 1.202.2.1 2019/10/15 18:32:13 martin Exp $ */ +/* $NetBSD: kern_lwp.c,v 1.202.2.2 2019/10/15 19:01:06 martin Exp $ */ /*- * Copyright (c) 2001, 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -211,7 +211,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.202.2.1 2019/10/15 18:32:13 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.202.2.2 2019/10/15 19:01:06 martin Exp $"); #include "opt_ddb.h" #include "opt_lockdebug.h" @@ -408,6 +408,11 @@ lwp_suspend(struct lwp *curl, struct lwp return (EDEADLK); } + if ((t->l_flag & LW_DBGSUSPEND) != 0) { + lwp_unlock(t); + return 0; + } + error = 0; switch (t->l_stat) { @@ -472,7 +477,7 @@ lwp_continue(struct lwp *l) l->l_flag &= ~LW_WSUSPEND; - if (l->l_stat != LSSUSPENDED) { + if (l->l_stat != LSSUSPENDED || (l->l_flag & LW_DBGSUSPEND) != 0) { lwp_unlock(l); return; } @@ -497,6 +502,8 @@ lwp_unstop(struct lwp *l) lwp_lock(l); + KASSERT((l->l_flag & LW_DBGSUSPEND) == 0); + /* If not stopped, then just bail out. */ if (l->l_stat != LSSTOP) { lwp_unlock(l); Index: src/sys/kern/kern_sig.c diff -u src/sys/kern/kern_sig.c:1.364.2.1 src/sys/kern/kern_sig.c:1.364.2.2 --- src/sys/kern/kern_sig.c:1.364.2.1 Tue Oct 15 18:32:13 2019 +++ src/sys/kern/kern_sig.c Tue Oct 15 19:01:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sig.c,v 1.364.2.1 2019/10/15 18:32:13 martin Exp $ */ +/* $NetBSD: kern_sig.c,v 1.364.2.2 2019/10/15 19:01:06 martin Exp $ */ /*- * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.1 2019/10/15 18:32:13 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.364.2.2 2019/10/15 19:01:06 martin Exp $"); #include "opt_ptrace.h" #include "opt_dtrace.h" @@ -1108,11 +1108,20 @@ sigpost(struct lwp *l, sig_t action, int SDT_PROBE(proc, kernel, , signal__send, l, p, sig, 0, 0); + lwp_lock(l); + if (__predict_false((l->l_flag & LW_DBGSUSPEND) != 0)) { + if ((prop & SA_KILL) != 0) + l->l_flag &= ~LW_DBGSUSPEND; + else { + lwp_unlock(l); + return 0; + } + } + /* * Have the LWP check for signals. This ensures that even if no LWP * is found to take the signal immediately, it should be taken soon. */ - lwp_lock(l); l->l_flag |= LW_PENDSIG; /* @@ -2179,7 +2188,8 @@ sigexit(struct lwp *l, int signo) LIST_FOREACH(t, >p_lwps, l_sibling) {
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 19:01:06 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: kern_exit.c kern_lwp.c kern_sig.c kern_synch.c sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #320): sys/kern/kern_synch.c: revision 1.324 sys/kern/kern_sig.c: revision 1.366 sys/kern/kern_exit.c: revision 1.277 sys/kern/kern_lwp.c: revision 1.204 sys/kern/sys_ptrace_common.c: revision 1.62 Separate flag for suspended by _lwp_suspend and suspended by a debugger Once a thread was stopped with ptrace(2), userland process must not be able to unstop it deliberately or by an accident. This was a Windows-style behavior that makes threading tracing fragile. To generate a diff of this commit: cvs rdiff -u -r1.276 -r1.276.2.1 src/sys/kern/kern_exit.c cvs rdiff -u -r1.202.2.1 -r1.202.2.2 src/sys/kern/kern_lwp.c cvs rdiff -u -r1.364.2.1 -r1.364.2.2 src/sys/kern/kern_sig.c cvs rdiff -u -r1.323 -r1.323.4.1 src/sys/kern/kern_synch.c cvs rdiff -u -r1.58.2.4 -r1.58.2.5 src/sys/kern/sys_ptrace_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:50:44 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #319): sys/kern/sys_ptrace_common.c: revision 1.61 Remove 2 static asserts from the kernel ptrace code sizeof(pid) and sizeof(lwp) will unlikely ever change and the check can confuse. The assert has been moved to ATF t_ptrace_wait.c r.1.132. Requested by To generate a diff of this commit: cvs rdiff -u -r1.58.2.3 -r1.58.2.4 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.58.2.3 src/sys/kern/sys_ptrace_common.c:1.58.2.4 --- src/sys/kern/sys_ptrace_common.c:1.58.2.3 Tue Oct 15 18:38:39 2019 +++ src/sys/kern/sys_ptrace_common.c Tue Oct 15 18:50:44 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.58.2.3 2019/10/15 18:38:39 martin Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.58.2.4 2019/10/15 18:50:44 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.3 2019/10/15 18:38:39 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.4 2019/10/15 18:50:44 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -704,12 +704,7 @@ ptrace_get_process_state(struct proc *t, si = >p_sigctx.ps_info; ps.pe_report_event = si->_reason._ptrace_state._pe_report_event; - CTASSERT(sizeof(ps.pe_other_pid) == - sizeof(si->_reason._ptrace_state._option._pe_other_pid)); - CTASSERT(sizeof(ps.pe_lwp) == - sizeof(si->_reason._ptrace_state._option._pe_other_pid)); CTASSERT(sizeof(ps.pe_other_pid) == sizeof(ps.pe_lwp)); - ps.pe_other_pid = si->_reason._ptrace_state._option._pe_other_pid; }
CVS commit: src/sys/external/bsd/drm2/dist/drm/i915
Module Name:src Committed By: msaitoh Date: Tue Oct 15 18:50:45 UTC 2019 Modified Files: src/sys/external/bsd/drm2/dist/drm/i915: intel_dp.c Log Message: Don't pass null pointer as argument 2 of memcpy(). Same as Linux. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/external/bsd/drm2/dist/drm/i915
Module Name:src Committed By: msaitoh Date: Tue Oct 15 18:50:45 UTC 2019 Modified Files: src/sys/external/bsd/drm2/dist/drm/i915: intel_dp.c Log Message: Don't pass null pointer as argument 2 of memcpy(). Same as Linux. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.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/external/bsd/drm2/dist/drm/i915/intel_dp.c diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c:1.19 src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c:1.20 --- src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c:1.19 Thu Sep 13 08:25:55 2018 +++ src/sys/external/bsd/drm2/dist/drm/i915/intel_dp.c Tue Oct 15 18:50:44 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: intel_dp.c,v 1.19 2018/09/13 08:25:55 mrg Exp $ */ +/* $NetBSD: intel_dp.c,v 1.20 2019/10/15 18:50:44 msaitoh Exp $ */ /* * Copyright © 2008 Intel Corporation @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.19 2018/09/13 08:25:55 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.20 2019/10/15 18:50:44 msaitoh Exp $"); #include #include @@ -989,7 +989,10 @@ intel_dp_aux_transfer(struct drm_dp_aux if (WARN_ON(txsize > 20)) return -E2BIG; - memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size); + WARN_ON(!msg->buffer != !msg->size); + + if (msg->buffer) + memcpy(txbuf + HEADER_SIZE, msg->buffer, msg->size); ret = intel_dp_aux_ch(intel_dp, txbuf, txsize, rxbuf, rxsize); if (ret > 0) {
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:50:44 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #319): sys/kern/sys_ptrace_common.c: revision 1.61 Remove 2 static asserts from the kernel ptrace code sizeof(pid) and sizeof(lwp) will unlikely ever change and the check can confuse. The assert has been moved to ATF t_ptrace_wait.c r.1.132. Requested by To generate a diff of this commit: cvs rdiff -u -r1.58.2.3 -r1.58.2.4 src/sys/kern/sys_ptrace_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:48:56 UTC 2019 Modified Files: src/sys/sys [netbsd-9]: lwp.h Log Message: Pull up following revision(s) (requested by kamil in ticket #318): sys/sys/lwp.h: revision 1.187 Define LW_DBGSUSPEND in sys/lwp.h This flag specifies the suspended by debugger property, as used by PT_SUSPEND in ptrace(2). To generate a diff of this commit: cvs rdiff -u -r1.186 -r1.186.2.1 src/sys/sys/lwp.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/sys/lwp.h diff -u src/sys/sys/lwp.h:1.186 src/sys/sys/lwp.h:1.186.2.1 --- src/sys/sys/lwp.h:1.186 Wed Jun 19 21:39:53 2019 +++ src/sys/sys/lwp.h Tue Oct 15 18:48:56 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: lwp.h,v 1.186 2019/06/19 21:39:53 kamil Exp $ */ +/* $NetBSD: lwp.h,v 1.186.2.1 2019/10/15 18:48:56 martin Exp $ */ /* * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010 @@ -236,6 +236,7 @@ extern int maxlwp __read_mostly; /* max #define LW_CVLOCKDEBUG 0x0004 /* Waker does lockdebug */ #define LW_SINTR 0x0080 /* Sleep is interruptible. */ #define LW_SYSTEM 0x0200 /* Kernel thread */ +#define LW_DBGSUSPEND 0x0001 /* Suspend by debugger */ #define LW_WSUSPEND 0x0002 /* Suspend before return to user */ #define LW_BATCH 0x0004 /* LWP tends to hog CPU */ #define LW_WCORE 0x0008 /* Stop for core dump on return to user */
CVS commit: [netbsd-9] src/sys/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:48:56 UTC 2019 Modified Files: src/sys/sys [netbsd-9]: lwp.h Log Message: Pull up following revision(s) (requested by kamil in ticket #318): sys/sys/lwp.h: revision 1.187 Define LW_DBGSUSPEND in sys/lwp.h This flag specifies the suspended by debugger property, as used by PT_SUSPEND in ptrace(2). To generate a diff of this commit: cvs rdiff -u -r1.186 -r1.186.2.1 src/sys/sys/lwp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:47:03 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #317): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.133 Merge PT_GET_PROCESS_STATE checks into traceme_raise ATF ptrace tests Assert that PT_GET_PROCESS_STATE for !child and !lwp events returns non-error and zeroed struct ptrace_state. These checks are not really special to traceme_raise, it's just an opportunity to reuse them in an existing tests without writing a dedicated one. This behavior is needed to maintain in 3rd party software (GDB). To generate a diff of this commit: cvs rdiff -u -r1.131.2.4 -r1.131.2.5 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.131.2.4 src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.5 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.4 Tue Oct 15 18:43:02 2019 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:47:03 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.131.2.4 2019/10/15 18:43:02 martin Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.131.2.5 2019/10/15 18:47:03 martin Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.4 2019/10/15 18:43:02 martin Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.5 2019/10/15 18:47:03 martin Exp $"); #include #include @@ -140,7 +140,10 @@ traceme_raise(int sigval) int status; #endif + ptrace_state_t state, zero_state; + const int slen = sizeof(state); struct ptrace_siginfo info; + memset(_state, 0, sizeof(zero_state)); memset(, 0, sizeof(info)); DPRINTF("Before forking process PID=%d\n", getpid()); @@ -170,6 +173,9 @@ traceme_raise(int sigval) switch (sigval) { case SIGKILL: validate_status_signaled(status, sigval, 0); + SYSCALL_REQUIRE( + ptrace(PT_GET_PROCESS_STATE, child, , slen) == -1); + break; default: validate_status_stopped(status, sigval); @@ -188,6 +194,11 @@ traceme_raise(int sigval) ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval); ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP); + DPRINTF("Assert that PT_GET_PROCESS_STATE returns non-error"); + SYSCALL_REQUIRE( + ptrace(PT_GET_PROCESS_STATE, child, , slen) != -1); + ATF_REQUIRE(memcmp(, _state, slen) == 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);
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:47:03 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #317): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.133 Merge PT_GET_PROCESS_STATE checks into traceme_raise ATF ptrace tests Assert that PT_GET_PROCESS_STATE for !child and !lwp events returns non-error and zeroed struct ptrace_state. These checks are not really special to traceme_raise, it's just an opportunity to reuse them in an existing tests without writing a dedicated one. This behavior is needed to maintain in 3rd party software (GDB). To generate a diff of this commit: cvs rdiff -u -r1.131.2.4 -r1.131.2.5 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.
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:43:02 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #315): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.132 Add a few static asserts in t_ptrace_wait.c for conditions that must be kept Assert that ptrace_state and siginfo_t's _ptrace_state are synchronized. To generate a diff of this commit: cvs rdiff -u -r1.131.2.3 -r1.131.2.4 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.131.2.3 src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.4 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.3 Tue Oct 15 18:40:02 2019 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:43:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.131.2.4 2019/10/15 18:43:02 martin Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.4 2019/10/15 18:43:02 martin Exp $"); #include #include @@ -41,6 +41,7 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.13 #include #include #include +#include #include #include #include @@ -73,6 +74,20 @@ __RCSID("$NetBSD: t_ptrace_wait.c,v 1.13 #include +/* Assumptions in the kernel code that must be kept. */ +static_assert(sizeof(((struct ptrace_state *)0)->pe_report_event) == +sizeof(((siginfo_t *)0)->si_pe_report_event), +"pe_report_event and si_pe_report_event must be of the same size"); +static_assert(sizeof(((struct ptrace_state *)0)->pe_other_pid) == +sizeof(((siginfo_t *)0)->si_pe_other_pid), +"pe_other_pid and si_pe_other_pid must be of the same size"); +static_assert(sizeof(((struct ptrace_state *)0)->pe_lwp) == +sizeof(((siginfo_t *)0)->si_pe_lwp), +"pe_lwp and si_pe_lwp must be of the same size"); +static_assert(sizeof(((struct ptrace_state *)0)->pe_other_pid) == +sizeof(((struct ptrace_state *)0)->pe_lwp), +"pe_other_pid and pe_lwp must be of the same size"); + #include "h_macros.h" #include "t_ptrace_wait.h"
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:43:02 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #315): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.132 Add a few static asserts in t_ptrace_wait.c for conditions that must be kept Assert that ptrace_state and siginfo_t's _ptrace_state are synchronized. To generate a diff of this commit: cvs rdiff -u -r1.131.2.3 -r1.131.2.4 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.
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:40:02 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #314): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.137 Fix race in t_ptrace_wait* LWP tests Increment the done variable under a mutex. This variable was updated non-atomically and sometimes not reaching the expected treshold. To generate a diff of this commit: cvs rdiff -u -r1.131.2.2 -r1.131.2.3 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.131.2.2 src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.3 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.2 Tue Oct 15 18:34:34 2019 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:40:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.131.2.2 2019/10/15 18:34:34 martin Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.2 2019/10/15 18:34:34 martin Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.3 2019/10/15 18:40:02 martin Exp $"); #include #include @@ -5432,12 +5432,15 @@ TRACEME_EXEC(traceme_signalignored_exec, #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(_threads_mtx); done++; + pthread_mutex_unlock(_threads_mtx); while (done < TRACE_THREADS_NUM) sched_yield();
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:40:02 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #314): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.137 Fix race in t_ptrace_wait* LWP tests Increment the done variable under a mutex. This variable was updated non-atomically and sometimes not reaching the expected treshold. To generate a diff of this commit: cvs rdiff -u -r1.131.2.2 -r1.131.2.3 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.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:38:40 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #313): sys/kern/sys_ptrace_common.c: revision 1.60 Restore the old behavior in PT_GET_PROCESS_STATE For !child and !lwp events return zeroed struct ptrace_state. There is code that depends on it (GDB). Fixes PR toolchain/54590 by martin@ To generate a diff of this commit: cvs rdiff -u -r1.58.2.2 -r1.58.2.3 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.58.2.2 src/sys/kern/sys_ptrace_common.c:1.58.2.3 --- src/sys/kern/sys_ptrace_common.c:1.58.2.2 Tue Oct 15 18:32:13 2019 +++ src/sys/kern/sys_ptrace_common.c Tue Oct 15 18:38:39 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.58.2.2 2019/10/15 18:32:13 martin Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.58.2.3 2019/10/15 18:38:39 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.2 2019/10/15 18:32:13 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.3 2019/10/15 18:38:39 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -688,6 +688,7 @@ ptrace_set_event_mask(struct proc *t, vo static int ptrace_get_process_state(struct proc *t, void *addr, size_t data) { + struct _ksiginfo *si; struct ptrace_state ps; if (data != sizeof(ps)) { @@ -698,20 +699,20 @@ ptrace_get_process_state(struct proc *t, if (t->p_sigctx.ps_info._signo != SIGTRAP || (t->p_sigctx.ps_info._code != TRAP_CHLD && t->p_sigctx.ps_info._code != TRAP_LWP)) { - return EINVAL; - } - - ps.pe_report_event = - t->p_sigctx.ps_info._reason._ptrace_state._pe_report_event; + memset(, 0, sizeof(ps)); + } else { + si = >p_sigctx.ps_info; + ps.pe_report_event = si->_reason._ptrace_state._pe_report_event; - CTASSERT(sizeof(ps.pe_other_pid) == - sizeof(t->p_sigctx.ps_info._reason._ptrace_state._option._pe_other_pid)); - CTASSERT(sizeof(ps.pe_lwp) == - sizeof(t->p_sigctx.ps_info._reason._ptrace_state._option._pe_other_pid)); - CTASSERT(sizeof(ps.pe_other_pid) == sizeof(ps.pe_lwp)); + CTASSERT(sizeof(ps.pe_other_pid) == + sizeof(si->_reason._ptrace_state._option._pe_other_pid)); + CTASSERT(sizeof(ps.pe_lwp) == + sizeof(si->_reason._ptrace_state._option._pe_other_pid)); + CTASSERT(sizeof(ps.pe_other_pid) == sizeof(ps.pe_lwp)); - ps.pe_other_pid = - t->p_sigctx.ps_info._reason._ptrace_state._option._pe_other_pid; + ps.pe_other_pid = + si->_reason._ptrace_state._option._pe_other_pid; + } DPRINTF(("%s: lwp=%d event=%#x pid=%d lwp=%d\n", __func__, t->p_sigctx.ps_lwp, ps.pe_report_event,
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:38:40 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #313): sys/kern/sys_ptrace_common.c: revision 1.60 Restore the old behavior in PT_GET_PROCESS_STATE For !child and !lwp events return zeroed struct ptrace_state. There is code that depends on it (GDB). Fixes PR toolchain/54590 by martin@ To generate a diff of this commit: cvs rdiff -u -r1.58.2.2 -r1.58.2.3 src/sys/kern/sys_ptrace_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin
Module Name:src Committed By: christos Date: Tue Oct 15 18:33:24 UTC 2019 Modified Files: src/usr.sbin: Makefile Removed Files: src/usr.sbin/sup: Makefile Makefile.inc README src/usr.sbin/sup/lib: Makefile src/usr.sbin/sup/source: Makefile atoo.c c.h cvt.c estrdup.c expand.c ffilecopy.c filecopy.c libc.h log.c netcryptvoid.c nxtarg.c path.c quit.c read_line.c run.c scan.c scm.c scmio.c setproctitle.c skipto.c stree.c sup.1 sup.h supcdefs.h supcmain.c supcmeat.c supcmisc.c supcname.c supcparse.c supcvers.c supextern.h supfilesrv.c supmsg.c supmsg.h supscan.c supservers.8 vprintf.c src/usr.sbin/sup/source/sys: viceioctl.h src/usr.sbin/sup/sup: Makefile src/usr.sbin/sup/supfilesrv: Makefile src/usr.sbin/sup/supscan: Makefile Log Message: remove sup To generate a diff of this commit: cvs rdiff -u -r1.280 -r1.281 src/usr.sbin/Makefile cvs rdiff -u -r1.3 -r0 src/usr.sbin/sup/Makefile cvs rdiff -u -r1.13 -r0 src/usr.sbin/sup/Makefile.inc cvs rdiff -u -r1.2 -r0 src/usr.sbin/sup/README cvs rdiff -u -r1.15 -r0 src/usr.sbin/sup/lib/Makefile cvs rdiff -u -r1.32 -r0 src/usr.sbin/sup/source/Makefile cvs rdiff -u -r1.5 -r0 src/usr.sbin/sup/source/atoo.c \ src/usr.sbin/sup/source/filecopy.c src/usr.sbin/sup/source/path.c \ src/usr.sbin/sup/source/setproctitle.c src/usr.sbin/sup/source/supcvers.c cvs rdiff -u -r1.7 -r0 src/usr.sbin/sup/source/c.h \ src/usr.sbin/sup/source/supmsg.h cvs rdiff -u -r1.4 -r0 src/usr.sbin/sup/source/cvt.c cvs rdiff -u -r1.1 -r0 src/usr.sbin/sup/source/estrdup.c cvs rdiff -u -r1.19 -r0 src/usr.sbin/sup/source/expand.c cvs rdiff -u -r1.11 -r0 src/usr.sbin/sup/source/ffilecopy.c cvs rdiff -u -r1.9 -r0 src/usr.sbin/sup/source/libc.h \ src/usr.sbin/sup/source/read_line.c src/usr.sbin/sup/source/vprintf.c cvs rdiff -u -r1.12 -r0 src/usr.sbin/sup/source/log.c \ src/usr.sbin/sup/source/sup.h src/usr.sbin/sup/source/supservers.8 cvs rdiff -u -r1.10 -r0 src/usr.sbin/sup/source/netcryptvoid.c cvs rdiff -u -r1.6 -r0 src/usr.sbin/sup/source/nxtarg.c \ src/usr.sbin/sup/source/quit.c src/usr.sbin/sup/source/skipto.c cvs rdiff -u -r1.14 -r0 src/usr.sbin/sup/source/run.c cvs rdiff -u -r1.33 -r0 src/usr.sbin/sup/source/scan.c cvs rdiff -u -r1.30 -r0 src/usr.sbin/sup/source/scm.c cvs rdiff -u -r1.23 -r0 src/usr.sbin/sup/source/scmio.c \ src/usr.sbin/sup/source/sup.1 cvs rdiff -u -r1.15 -r0 src/usr.sbin/sup/source/stree.c \ src/usr.sbin/sup/source/supcdefs.h cvs rdiff -u -r1.35 -r0 src/usr.sbin/sup/source/supcmain.c cvs rdiff -u -r1.43 -r0 src/usr.sbin/sup/source/supcmeat.c cvs rdiff -u -r1.24 -r0 src/usr.sbin/sup/source/supcmisc.c cvs rdiff -u -r1.8 -r0 src/usr.sbin/sup/source/supcname.c cvs rdiff -u -r1.17 -r0 src/usr.sbin/sup/source/supcparse.c cvs rdiff -u -r1.28 -r0 src/usr.sbin/sup/source/supextern.h cvs rdiff -u -r1.53 -r0 src/usr.sbin/sup/source/supfilesrv.c cvs rdiff -u -r1.18 -r0 src/usr.sbin/sup/source/supmsg.c cvs rdiff -u -r1.25 -r0 src/usr.sbin/sup/source/supscan.c cvs rdiff -u -r1.4 -r0 src/usr.sbin/sup/source/sys/viceioctl.h cvs rdiff -u -r1.6 -r0 src/usr.sbin/sup/sup/Makefile cvs rdiff -u -r1.5 -r0 src/usr.sbin/sup/supfilesrv/Makefile cvs rdiff -u -r1.7 -r0 src/usr.sbin/sup/supscan/Makefile 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/Makefile diff -u src/usr.sbin/Makefile:1.280 src/usr.sbin/Makefile:1.281 --- src/usr.sbin/Makefile:1.280 Wed Dec 12 02:04:06 2018 +++ src/usr.sbin/Makefile Tue Oct 15 14:33:23 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.280 2018/12/12 07:04:06 maxv Exp $ +# $NetBSD: Makefile,v 1.281 2019/10/15 18:33:23 christos Exp $ # from: @(#)Makefile 5.20 (Berkeley) 6/12/93 .include @@ -26,7 +26,7 @@ SUBDIR= ac accton acpitools altq apm apm rpc.pcnfsd rpc.statd rpcbind rwhod \ sa screenblank sdpd service services_mkdb sesd schedctl \ sliplogin spray \ - srtconfig sti sunlabel sup sysinst syslogd \ + srtconfig sti sunlabel sysinst syslogd \ tadpolectl tcpdchk tcpdmatch tcpdrop timed tpctl tprof traceroute trpt \ unlink usbdevs user \ videomode vipw veriexecgen vnconfig \
CVS commit: src/distrib/sets/lists
Module Name:src Committed By: christos Date: Tue Oct 15 18:33:58 UTC 2019 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/debug: mi src/distrib/sets/lists/man: mi src/distrib/sets/lists/misc: mi Log Message: remove sup To generate a diff of this commit: cvs rdiff -u -r1.1218 -r1.1219 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.288 -r1.289 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.1656 -r1.1657 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.215 -r1.216 src/distrib/sets/lists/misc/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.1218 src/distrib/sets/lists/base/mi:1.1219 --- src/distrib/sets/lists/base/mi:1.1218 Wed Oct 2 20:59:49 2019 +++ src/distrib/sets/lists/base/mi Tue Oct 15 14:33:57 2019 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1218 2019/10/03 00:59:49 mrg Exp $ +# $NetBSD: mi,v 1.1219 2019/10/15 18:33:57 christos Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -1991,9 +1991,9 @@ ./usr/sbin/stdhostsbase-nis-bin yp ./usr/sbin/sti base-sysutil-bin ./usr/sbin/sunlabelbase-sysutil-bin -./usr/sbin/sup base-sup-bin -./usr/sbin/supfilesrvbase-sup-bin -./usr/sbin/supscanbase-sup-bin +./usr/sbin/sup base-obsolete obsolete +./usr/sbin/supfilesrvbase-obsolete obsolete +./usr/sbin/supscanbase-obsolete obsolete ./usr/sbin/sushibase-obsolete obsolete ./usr/sbin/sysconfdbase-obsolete obsolete ./usr/sbin/sysctlbase-obsolete obsolete @@ -2282,7 +2282,7 @@ ./usr/share/examples/rtadvd base-router-examples ./usr/share/examples/slip base-slip-examples ./usr/share/examples/smbfs base-sysutil-examples -./usr/share/examples/supfiles base-sup-examples +./usr/share/examples/supfiles base-obsolete obsolete ./usr/share/examples/syslogd base-sysutil-examples ./usr/share/examples/veriexecctl base-obsolete obsolete ./usr/share/examples/veriexecctl/fpgen.sh base-obsolete obsolete Index: src/distrib/sets/lists/debug/mi diff -u src/distrib/sets/lists/debug/mi:1.288 src/distrib/sets/lists/debug/mi:1.289 --- src/distrib/sets/lists/debug/mi:1.288 Sun Sep 15 12:58:11 2019 +++ src/distrib/sets/lists/debug/mi Tue Oct 15 14:33:57 2019 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.288 2019/09/15 16:58:11 christos Exp $ +# $NetBSD: mi,v 1.289 2019/10/15 18:33:57 christos Exp $ ./etc/mtree/set.debug comp-sys-root ./usr/lib comp-sys-usr compatdir ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile @@ -1280,9 +1280,9 @@ ./usr/libdata/debug/usr/sbin/stdhosts.debug comp-nis-debug yp,debug ./usr/libdata/debug/usr/sbin/sti.debug comp-sysutil-debug debug ./usr/libdata/debug/usr/sbin/sunlabel.debug comp-sysutil-debug debug -./usr/libdata/debug/usr/sbin/sup.debug comp-sup-debug debug -./usr/libdata/debug/usr/sbin/supfilesrv.debug comp-sup-debug debug -./usr/libdata/debug/usr/sbin/supscan.debug comp-sup-debug debug +./usr/libdata/debug/usr/sbin/sup.debug comp-obsolete obsolete +./usr/libdata/debug/usr/sbin/supfilesrv.debug comp-obsolete obsolete +./usr/libdata/debug/usr/sbin/supscan.debug comp-obsolete obsolete ./usr/libdata/debug/usr/sbin/sysinst.debug comp-sysutil-debug debug ./usr/libdata/debug/usr/sbin/syslogd.debug comp-sysutil-debug debug ./usr/libdata/debug/usr/sbin/tcpdchk.debug comp-netutil-debug debug Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1656 src/distrib/sets/lists/man/mi:1.1657 --- src/distrib/sets/lists/man/mi:1.1656 Mon Oct 7 07:53:40 2019 +++ src/distrib/sets/lists/man/mi Tue Oct 15 14:33:57 2019 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1656 2019/10/07 11:53:40 msaitoh Exp $ +# $NetBSD: mi,v 1.1657 2019/10/15 18:33:57 christos Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -549,7 +549,7 @@ ./usr/share/man/cat1/stty.0 man-util-catman .cat ./usr/share/man/cat1/su.0 man-util-catman .cat ./usr/share/man/cat1/sum.0 man-util-catman .cat -./usr/share/man/cat1/sup.0 man-sup-catman .cat +./usr/share/man/cat1/sup.0 man-obsolete obsolete ./usr/share/man/cat1/suspend.0 man-util-catman .cat ./usr/share/man/cat1/sys_info.0 man-util-catman .cat ./usr/share/man/cat1/sysstat.0 man-util-catman .cat @@ -3120,9 +3120,9 @@ ./usr/share/man/cat8/sun3x man-obsolete obsolete ./usr/share/man/cat8/sun3x/installboot.0 man-obsolete obsolete ./usr/share/man/cat8/sunlabel.0 man-sysutil-catman .cat -./usr/share/man/cat8/supfilesrv.0 man-sup-catman .cat -./usr/share/man/cat8/supscan.0 man-sup-catman .cat -./usr/share/man/cat8/supservers.0 man-sup-catman .cat +./usr/share/man/cat8/supfilesrv.0 man-obsolete obsolete +./usr/share/man/cat8/supscan.0 man-obsolete obsolete +./usr/share/man/cat8/supservers.0
CVS commit: src/doc
Module Name:src Committed By: christos Date: Tue Oct 15 18:35:29 UTC 2019 Modified Files: src/doc: CHANGES Log Message: sup was removed. RIP. To generate a diff of this commit: cvs rdiff -u -r1.2594 -r1.2595 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.2594 src/doc/CHANGES:1.2595 --- src/doc/CHANGES:1.2594 Tue Oct 15 12:17:43 2019 +++ src/doc/CHANGES Tue Oct 15 14:35:29 2019 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2594 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2595 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -57,3 +57,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: dhcpcd(8): Import dhcpcd-8.1.0 [roy 20191011] OpenSSH: Import 8.1. [christos 20191012] acpi(4): Updated ACPICA to 20190816. [christos 20191015] + sup: removed, use ftp://ftp.astron.com/pub/sup [christos 20191015]
CVS commit: src/distrib/sets/lists
Module Name:src Committed By: christos Date: Tue Oct 15 18:33:58 UTC 2019 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/debug: mi src/distrib/sets/lists/man: mi src/distrib/sets/lists/misc: mi Log Message: remove sup To generate a diff of this commit: cvs rdiff -u -r1.1218 -r1.1219 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.288 -r1.289 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.1656 -r1.1657 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.215 -r1.216 src/distrib/sets/lists/misc/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: christos Date: Tue Oct 15 18:36:38 UTC 2019 Modified Files: src/sys/rump/librump/rumpkern: rump.c Log Message: Add a function cast for enosys To generate a diff of this commit: cvs rdiff -u -r1.334 -r1.335 src/sys/rump/librump/rumpkern/rump.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/rump/librump/rumpkern/rump.c diff -u src/sys/rump/librump/rumpkern/rump.c:1.334 src/sys/rump/librump/rumpkern/rump.c:1.335 --- src/sys/rump/librump/rumpkern/rump.c:1.334 Thu May 16 23:34:26 2019 +++ src/sys/rump/librump/rumpkern/rump.c Tue Oct 15 14:36:38 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rump.c,v 1.334 2019/05/17 03:34:26 ozaki-r Exp $ */ +/* $NetBSD: rump.c,v 1.335 2019/10/15 18:36:38 christos Exp $ */ /* * Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.334 2019/05/17 03:34:26 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.335 2019/10/15 18:36:38 christos Exp $"); #include #define ELFSIZE ARCH_ELFSIZE @@ -807,7 +807,7 @@ rump_syscall_boot_establish(const struct for (i = 0; i < ncall; i++) { callp = rump_sysent + calls[i].ros_num; KASSERT(bootlwp != NULL - && callp->sy_call == (sy_call_t *)enosys); + && callp->sy_call == (sy_call_t *)(void *)enosys); callp->sy_call = calls[i].ros_handler; } }
CVS commit: src/doc
Module Name:src Committed By: christos Date: Tue Oct 15 18:35:29 UTC 2019 Modified Files: src/doc: CHANGES Log Message: sup was removed. RIP. To generate a diff of this commit: cvs rdiff -u -r1.2594 -r1.2595 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:34:34 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #312): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.135 Bump the number of threads in LWP t_ptrace_wait*() tests from to 100 This is a torture, but on purpose to catch LWP_CREATED and LWP_EXITED bugs. The threads do nothing other than calling sched_yield() in a loop. MAXLWP is now defined to 2048 on all ports. This change effects the following tests: - trace_thread_nolwpevents - trace_thread_lwpexit - trace_thread_lwpcreate - trace_thread_lwpcreate_and_exit To generate a diff of this commit: cvs rdiff -u -r1.131.2.1 -r1.131.2.2 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.
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:34:34 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #312): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.135 Bump the number of threads in LWP t_ptrace_wait*() tests from to 100 This is a torture, but on purpose to catch LWP_CREATED and LWP_EXITED bugs. The threads do nothing other than calling sched_yield() in a loop. MAXLWP is now defined to 2048 on all ports. This change effects the following tests: - trace_thread_nolwpevents - trace_thread_lwpexit - trace_thread_lwpcreate - trace_thread_lwpcreate_and_exit To generate a diff of this commit: cvs rdiff -u -r1.131.2.1 -r1.131.2.2 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.131.2.1 src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.2 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.1 Tue Oct 15 18:22:55 2019 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:34:34 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.131.2.1 2019/10/15 18:22:55 martin Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.131.2.2 2019/10/15 18:34:34 martin Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.1 2019/10/15 18:22:55 martin Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.2 2019/10/15 18:34:34 martin Exp $"); #include #include @@ -5429,6 +5429,8 @@ TRACEME_EXEC(traceme_signalignored_exec, /// +#define TRACE_THREADS_NUM 100 + static volatile int done; static void * @@ -5437,8 +5439,8 @@ trace_threads_cb(void *arg __unused) done++; - while (done < 3) - continue; + while (done < TRACE_THREADS_NUM) + sched_yield(); return NULL; } @@ -5457,7 +5459,7 @@ trace_threads(bool trace_create, bool tr const int elen = sizeof(event); struct ptrace_siginfo info; - pthread_t t[3]; + pthread_t t[TRACE_THREADS_NUM]; int rv; size_t n; lwpid_t lid;
CVS commit: src/sys/rump/librump/rumpkern
Module Name:src Committed By: christos Date: Tue Oct 15 18:36:38 UTC 2019 Modified Files: src/sys/rump/librump/rumpkern: rump.c Log Message: Add a function cast for enosys To generate a diff of this commit: cvs rdiff -u -r1.334 -r1.335 src/sys/rump/librump/rumpkern/rump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.sbin
Module Name:src Committed By: christos Date: Tue Oct 15 18:33:24 UTC 2019 Modified Files: src/usr.sbin: Makefile Removed Files: src/usr.sbin/sup: Makefile Makefile.inc README src/usr.sbin/sup/lib: Makefile src/usr.sbin/sup/source: Makefile atoo.c c.h cvt.c estrdup.c expand.c ffilecopy.c filecopy.c libc.h log.c netcryptvoid.c nxtarg.c path.c quit.c read_line.c run.c scan.c scm.c scmio.c setproctitle.c skipto.c stree.c sup.1 sup.h supcdefs.h supcmain.c supcmeat.c supcmisc.c supcname.c supcparse.c supcvers.c supextern.h supfilesrv.c supmsg.c supmsg.h supscan.c supservers.8 vprintf.c src/usr.sbin/sup/source/sys: viceioctl.h src/usr.sbin/sup/sup: Makefile src/usr.sbin/sup/supfilesrv: Makefile src/usr.sbin/sup/supscan: Makefile Log Message: remove sup To generate a diff of this commit: cvs rdiff -u -r1.280 -r1.281 src/usr.sbin/Makefile cvs rdiff -u -r1.3 -r0 src/usr.sbin/sup/Makefile cvs rdiff -u -r1.13 -r0 src/usr.sbin/sup/Makefile.inc cvs rdiff -u -r1.2 -r0 src/usr.sbin/sup/README cvs rdiff -u -r1.15 -r0 src/usr.sbin/sup/lib/Makefile cvs rdiff -u -r1.32 -r0 src/usr.sbin/sup/source/Makefile cvs rdiff -u -r1.5 -r0 src/usr.sbin/sup/source/atoo.c \ src/usr.sbin/sup/source/filecopy.c src/usr.sbin/sup/source/path.c \ src/usr.sbin/sup/source/setproctitle.c src/usr.sbin/sup/source/supcvers.c cvs rdiff -u -r1.7 -r0 src/usr.sbin/sup/source/c.h \ src/usr.sbin/sup/source/supmsg.h cvs rdiff -u -r1.4 -r0 src/usr.sbin/sup/source/cvt.c cvs rdiff -u -r1.1 -r0 src/usr.sbin/sup/source/estrdup.c cvs rdiff -u -r1.19 -r0 src/usr.sbin/sup/source/expand.c cvs rdiff -u -r1.11 -r0 src/usr.sbin/sup/source/ffilecopy.c cvs rdiff -u -r1.9 -r0 src/usr.sbin/sup/source/libc.h \ src/usr.sbin/sup/source/read_line.c src/usr.sbin/sup/source/vprintf.c cvs rdiff -u -r1.12 -r0 src/usr.sbin/sup/source/log.c \ src/usr.sbin/sup/source/sup.h src/usr.sbin/sup/source/supservers.8 cvs rdiff -u -r1.10 -r0 src/usr.sbin/sup/source/netcryptvoid.c cvs rdiff -u -r1.6 -r0 src/usr.sbin/sup/source/nxtarg.c \ src/usr.sbin/sup/source/quit.c src/usr.sbin/sup/source/skipto.c cvs rdiff -u -r1.14 -r0 src/usr.sbin/sup/source/run.c cvs rdiff -u -r1.33 -r0 src/usr.sbin/sup/source/scan.c cvs rdiff -u -r1.30 -r0 src/usr.sbin/sup/source/scm.c cvs rdiff -u -r1.23 -r0 src/usr.sbin/sup/source/scmio.c \ src/usr.sbin/sup/source/sup.1 cvs rdiff -u -r1.15 -r0 src/usr.sbin/sup/source/stree.c \ src/usr.sbin/sup/source/supcdefs.h cvs rdiff -u -r1.35 -r0 src/usr.sbin/sup/source/supcmain.c cvs rdiff -u -r1.43 -r0 src/usr.sbin/sup/source/supcmeat.c cvs rdiff -u -r1.24 -r0 src/usr.sbin/sup/source/supcmisc.c cvs rdiff -u -r1.8 -r0 src/usr.sbin/sup/source/supcname.c cvs rdiff -u -r1.17 -r0 src/usr.sbin/sup/source/supcparse.c cvs rdiff -u -r1.28 -r0 src/usr.sbin/sup/source/supextern.h cvs rdiff -u -r1.53 -r0 src/usr.sbin/sup/source/supfilesrv.c cvs rdiff -u -r1.18 -r0 src/usr.sbin/sup/source/supmsg.c cvs rdiff -u -r1.25 -r0 src/usr.sbin/sup/source/supscan.c cvs rdiff -u -r1.4 -r0 src/usr.sbin/sup/source/sys/viceioctl.h cvs rdiff -u -r1.6 -r0 src/usr.sbin/sup/sup/Makefile cvs rdiff -u -r1.5 -r0 src/usr.sbin/sup/supfilesrv/Makefile cvs rdiff -u -r1.7 -r0 src/usr.sbin/sup/supscan/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/share/examples
Module Name:src Committed By: christos Date: Tue Oct 15 18:32:59 UTC 2019 Modified Files: src/share/examples: Makefile Removed Files: src/share/examples/supfiles: Makefile sup.jp.netbsd.org sup2.fr.netbsd.org Log Message: remove sup examples To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/share/examples/Makefile cvs rdiff -u -r1.13 -r0 src/share/examples/supfiles/Makefile cvs rdiff -u -r1.5 -r0 src/share/examples/supfiles/sup.jp.netbsd.org cvs rdiff -u -r1.2 -r0 src/share/examples/supfiles/sup2.fr.netbsd.org Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/examples/Makefile diff -u src/share/examples/Makefile:1.23 src/share/examples/Makefile:1.24 --- src/share/examples/Makefile:1.23 Sun Sep 23 03:24:20 2018 +++ src/share/examples/Makefile Tue Oct 15 14:32:59 2019 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.23 2018/09/23 07:24:20 maxv Exp $ +# $NetBSD: Makefile,v 1.24 2019/10/15 18:32:59 christos Exp $ SUBDIR= amd apm asm disktab emul fstab ftpd getdate hostapd \ -lua npf pppd racoon supfiles syslogd wpa_supplicant wsmoused +lua npf pppd racoon syslogd wpa_supplicant wsmoused .include
CVS commit: src/share/examples
Module Name:src Committed By: christos Date: Tue Oct 15 18:32:59 UTC 2019 Modified Files: src/share/examples: Makefile Removed Files: src/share/examples/supfiles: Makefile sup.jp.netbsd.org sup2.fr.netbsd.org Log Message: remove sup examples To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/share/examples/Makefile cvs rdiff -u -r1.13 -r0 src/share/examples/supfiles/Makefile cvs rdiff -u -r1.5 -r0 src/share/examples/supfiles/sup.jp.netbsd.org cvs rdiff -u -r1.2 -r0 src/share/examples/supfiles/sup2.fr.netbsd.org Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:32:13 UTC 2019 Modified Files: src/sys/compat/sys [netbsd-9]: siginfo.h src/sys/kern [netbsd-9]: kern_exec.c kern_fork.c kern_lwp.c kern_sig.c sys_lwp.c sys_ptrace_common.c src/sys/sys [netbsd-9]: siginfo.h signalvar.h Log Message: Pull up following revision(s) (requested by kamil in ticket #311): sys/sys/siginfo.h: revision 1.34 sys/kern/sys_ptrace_common.c: revision 1.59 sys/kern/sys_lwp.c: revision 1.70 sys/compat/sys/siginfo.h: revision 1.8 sys/kern/kern_sig.c: revision 1.365 sys/kern/kern_lwp.c: revision 1.203 sys/sys/signalvar.h: revision 1.96 sys/kern/kern_exec.c: revision 1.482 sys/kern/kern_fork.c: revision 1.214 Move TRAP_CHLD/TRAP_LWP ptrace information from struct proc to siginfo Storing struct ptrace_state information inside struct proc was vulnerable to synchronization bugs, as multiple events emitted in the same time were overwritting other ones. Cache the original parent process id in p_oppid. Reusing here p_opptr is in theory prone to slight race codition. Change the semantics of PT_GET_PROCESS_STATE, reutning EINVAL for calls prompting for the value in cases when there wasn't registered an appropriate event. Add an alternative approach to check the ptrace_state information, directly from the siginfo_t value returned from PT_GET_SIGINFO. The original PT_GET_PROCESS_STATE approach is kept for compat with older NetBSD and OpenBSD. New code is recommended to keep using PT_GET_PROCESS_STATE. Add a couple of compile-time asserts for assumptions in the code. No functional change intended in existing ptrace(2) software. All ATF ptrace(2) and ATF GDB tests pass. This change improves reliability of the threading ptrace(2) code. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/compat/sys/siginfo.h cvs rdiff -u -r1.478 -r1.478.2.1 src/sys/kern/kern_exec.c cvs rdiff -u -r1.213 -r1.213.2.1 src/sys/kern/kern_fork.c cvs rdiff -u -r1.202 -r1.202.2.1 src/sys/kern/kern_lwp.c cvs rdiff -u -r1.364 -r1.364.2.1 src/sys/kern/kern_sig.c cvs rdiff -u -r1.69 -r1.69.2.1 src/sys/kern/sys_lwp.c cvs rdiff -u -r1.58.2.1 -r1.58.2.2 src/sys/kern/sys_ptrace_common.c cvs rdiff -u -r1.33 -r1.33.2.1 src/sys/sys/siginfo.h cvs rdiff -u -r1.93 -r1.93.2.1 src/sys/sys/signalvar.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/compat/sys/siginfo.h diff -u src/sys/compat/sys/siginfo.h:1.7 src/sys/compat/sys/siginfo.h:1.7.2.1 --- src/sys/compat/sys/siginfo.h:1.7 Sun Jun 30 08:49:21 2019 +++ src/sys/compat/sys/siginfo.h Tue Oct 15 18:32:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: siginfo.h,v 1.7 2019/06/30 08:49:21 martin Exp $ */ +/* $NetBSD: siginfo.h,v 1.7.2.1 2019/10/15 18:32:13 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -75,6 +75,14 @@ struct __ksiginfo32 { int _error; uint64_t _args[8]; /* SYS_MAXSYSARGS */ } _syscall; + + struct { + int _pe_report_event; + union { +pid_t _pe_other_pid; +lwpid_t _pe_lwp; + } _option; + } _ptrace_state; } _reason; }; Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.478 src/sys/kern/kern_exec.c:1.478.2.1 --- src/sys/kern/kern_exec.c:1.478 Fri Jul 5 17:14:48 2019 +++ src/sys/kern/kern_exec.c Tue Oct 15 18:32:13 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.478 2019/07/05 17:14:48 maxv Exp $ */ +/* $NetBSD: kern_exec.c,v 1.478.2.1 2019/10/15 18:32:13 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.478 2019/07/05 17:14:48 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.478.2.1 2019/10/15 18:32:13 martin Exp $"); #include "opt_exec.h" #include "opt_execfmt.h" @@ -1285,7 +1285,7 @@ execve_runproc(struct lwp *l, struct exe /* posix_spawn(3) reports a single event with implied exec(3) */ if ((p->p_slflag & PSL_TRACED) && !is_spawn) { mutex_enter(p->p_lock); - eventswitch(TRAP_EXEC); + eventswitch(TRAP_EXEC, 0, 0); mutex_enter(proc_lock); } @@ -2197,7 +2197,7 @@ spawn_return(void *arg) } mutex_enter(p->p_lock); - eventswitch(TRAP_CHLD); + eventswitch(TRAP_CHLD, PTRACE_POSIX_SPAWN, p->p_opptr->p_pid); } cpu_return: @@ -2578,8 +2578,6 @@ do_posix_spawn(struct lwp *l1, pid_t *pi if ((p1->p_slflag & (PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) == (PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) { proc_changeparent(p2, p1->p_pptr); - p1->p_pspid = p2->p_pid; - p2->p_pspid = p1->p_pid; } LIST_INSERT_AFTER(p1, p2, p_pglist); @@ -2633,7 +2631,7 @@ do_posix_spawn(struct lwp *l1, pid_t *pi } mutex_enter(p1->p_lock); - eventswitch(TRAP_CHLD); + eventswitch(TRAP_CHLD, PTRACE_POSIX_SPAWN, pid); } return 0; Index: src/sys/kern/kern_fork.c diff -u
CVS commit: [netbsd-9] src/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:32:13 UTC 2019 Modified Files: src/sys/compat/sys [netbsd-9]: siginfo.h src/sys/kern [netbsd-9]: kern_exec.c kern_fork.c kern_lwp.c kern_sig.c sys_lwp.c sys_ptrace_common.c src/sys/sys [netbsd-9]: siginfo.h signalvar.h Log Message: Pull up following revision(s) (requested by kamil in ticket #311): sys/sys/siginfo.h: revision 1.34 sys/kern/sys_ptrace_common.c: revision 1.59 sys/kern/sys_lwp.c: revision 1.70 sys/compat/sys/siginfo.h: revision 1.8 sys/kern/kern_sig.c: revision 1.365 sys/kern/kern_lwp.c: revision 1.203 sys/sys/signalvar.h: revision 1.96 sys/kern/kern_exec.c: revision 1.482 sys/kern/kern_fork.c: revision 1.214 Move TRAP_CHLD/TRAP_LWP ptrace information from struct proc to siginfo Storing struct ptrace_state information inside struct proc was vulnerable to synchronization bugs, as multiple events emitted in the same time were overwritting other ones. Cache the original parent process id in p_oppid. Reusing here p_opptr is in theory prone to slight race codition. Change the semantics of PT_GET_PROCESS_STATE, reutning EINVAL for calls prompting for the value in cases when there wasn't registered an appropriate event. Add an alternative approach to check the ptrace_state information, directly from the siginfo_t value returned from PT_GET_SIGINFO. The original PT_GET_PROCESS_STATE approach is kept for compat with older NetBSD and OpenBSD. New code is recommended to keep using PT_GET_PROCESS_STATE. Add a couple of compile-time asserts for assumptions in the code. No functional change intended in existing ptrace(2) software. All ATF ptrace(2) and ATF GDB tests pass. This change improves reliability of the threading ptrace(2) code. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/compat/sys/siginfo.h cvs rdiff -u -r1.478 -r1.478.2.1 src/sys/kern/kern_exec.c cvs rdiff -u -r1.213 -r1.213.2.1 src/sys/kern/kern_fork.c cvs rdiff -u -r1.202 -r1.202.2.1 src/sys/kern/kern_lwp.c cvs rdiff -u -r1.364 -r1.364.2.1 src/sys/kern/kern_sig.c cvs rdiff -u -r1.69 -r1.69.2.1 src/sys/kern/sys_lwp.c cvs rdiff -u -r1.58.2.1 -r1.58.2.2 src/sys/kern/sys_ptrace_common.c cvs rdiff -u -r1.33 -r1.33.2.1 src/sys/sys/siginfo.h cvs rdiff -u -r1.93 -r1.93.2.1 src/sys/sys/signalvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/libexec/ftpd
Module Name:src Committed By: christos Date: Tue Oct 15 18:29:32 UTC 2019 Modified Files: src/libexec/ftpd: extern.h ftpd.c Log Message: bump sizes To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/libexec/ftpd/extern.h cvs rdiff -u -r1.204 -r1.205 src/libexec/ftpd/ftpd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ftpd/extern.h diff -u src/libexec/ftpd/extern.h:1.64 src/libexec/ftpd/extern.h:1.65 --- src/libexec/ftpd/extern.h:1.64 Sat Jun 23 03:21:00 2018 +++ src/libexec/ftpd/extern.h Tue Oct 15 14:29:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.64 2018/06/23 07:21:00 gson Exp $ */ +/* $NetBSD: extern.h,v 1.65 2019/10/15 18:29:32 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -330,7 +330,7 @@ GLOBAL char proctitle[BUFSIZ]; /* initi GLOBAL struct passwd *pw; GLOBAL int quietmessages; GLOBAL char remotehost[MAXHOSTNAMELEN+1]; -GLOBAL char remoteloghost[2 * MAXHOSTNAMELEN+1]; +GLOBAL char remoteloghost[2 * MAXHOSTNAMELEN + 4]; GLOBAL off_t restart_point; GLOBAL char tmpline[FTP_BUFLEN]; GLOBAL int type; Index: src/libexec/ftpd/ftpd.c diff -u src/libexec/ftpd/ftpd.c:1.204 src/libexec/ftpd/ftpd.c:1.205 --- src/libexec/ftpd/ftpd.c:1.204 Sat Apr 28 09:38:00 2018 +++ src/libexec/ftpd/ftpd.c Tue Oct 15 14:29:32 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ftpd.c,v 1.204 2018/04/28 13:38:00 riastradh Exp $ */ +/* $NetBSD: ftpd.c,v 1.205 2019/10/15 18:29:32 christos Exp $ */ /* * Copyright (c) 1997-2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 19 #if 0 static char sccsid[] = "@(#)ftpd.c 8.5 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: ftpd.c,v 1.204 2018/04/28 13:38:00 riastradh Exp $"); +__RCSID("$NetBSD: ftpd.c,v 1.205 2019/10/15 18:29:32 christos Exp $"); #endif #endif /* not lint */ @@ -2863,7 +2863,7 @@ logremotehost(struct sockinet *who) { #if defined(HAVE_SOCKADDR_SNPRINTF) - char abuf[BUFSIZ]; + char abuf[MAXHOSTNAMELEN]; #endif struct sockaddr *sa = (struct sockaddr *)>si_su;
CVS commit: src/libexec/ftpd
Module Name:src Committed By: christos Date: Tue Oct 15 18:29:32 UTC 2019 Modified Files: src/libexec/ftpd: extern.h ftpd.c Log Message: bump sizes To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/libexec/ftpd/extern.h cvs rdiff -u -r1.204 -r1.205 src/libexec/ftpd/ftpd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/libexec/ftpd
Module Name:src Committed By: christos Date: Tue Oct 15 18:29:21 UTC 2019 Modified Files: src/libexec/ftpd: Makefile Log Message: use strncpy... To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/libexec/ftpd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/ftpd/Makefile diff -u src/libexec/ftpd/Makefile:1.66 src/libexec/ftpd/Makefile:1.67 --- src/libexec/ftpd/Makefile:1.66 Sun Oct 13 03:28:11 2019 +++ src/libexec/ftpd/Makefile Tue Oct 15 14:29:21 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.66 2019/10/13 07:28:11 mrg Exp $ +# $NetBSD: Makefile,v 1.67 2019/10/15 18:29:21 christos Exp $ # @(#)Makefile 8.2 (Berkeley) 4/4/94 .include @@ -39,6 +39,9 @@ LDADD+= -lskey .endif .endif # USE_PAM == no +COPTS.ftpd.c += ${GCC_NO_STRINGOP_TRUNCATION} +COPTS.logwtmp.c += ${GCC_NO_STRINGOP_TRUNCATION} + ftpd.o ftpcmd.o: version.h #.if (${USE_KERBEROS} != "no")
CVS commit: src/libexec/ftpd
Module Name:src Committed By: christos Date: Tue Oct 15 18:29:21 UTC 2019 Modified Files: src/libexec/ftpd: Makefile Log Message: use strncpy... To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/libexec/ftpd/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:22:55 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #310): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.134 Remove ATF t_ptrace_wait test suspend1 The tests verifies that a thread can be suspended by a debugger and later resumed by a tracee. This is an unwanted behavior and will be fixed soon. To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.131.2.1 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.131 src/tests/lib/libc/sys/t_ptrace_wait.c:1.131.2.1 --- src/tests/lib/libc/sys/t_ptrace_wait.c:1.131 Mon Jul 1 02:04:37 2019 +++ src/tests/lib/libc/sys/t_ptrace_wait.c Tue Oct 15 18:22:55 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.c,v 1.131 2019/07/01 02:04:37 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.c,v 1.131.2.1 2019/10/15 18:22:55 martin Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131 2019/07/01 02:04:37 kamil Exp $"); +__RCSID("$NetBSD: t_ptrace_wait.c,v 1.131.2.1 2019/10/15 18:22:55 martin Exp $"); #include #include @@ -6328,133 +6328,6 @@ lwp_main_stop(void *arg) _lwp_exit(); } -ATF_TC(suspend1); -ATF_TC_HEAD(suspend1, tc) -{ - atf_tc_set_md_var(tc, "descr", - "Verify that a thread can be suspended by a debugger and later " - "resumed by a tracee"); -} - -ATF_TC_BODY(suspend1, tc) -{ - const int exitval = 5; - const int sigval = SIGSTOP; - pid_t child, wpid; -#if defined(TWAIT_HAVE_STATUS) - int status; -#endif - ucontext_t uc; - lwpid_t lid; - static const size_t ssize = 16*1024; - void *stack; - struct ptrace_lwpinfo pl; - struct ptrace_siginfo psi; - volatile int go = 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); - - DPRINTF("Before raising %s from child\n", strsignal(sigval)); - FORKEE_ASSERT(raise(sigval) == 0); - - DPRINTF("Before allocating memory for stack in child\n"); - FORKEE_ASSERT((stack = malloc(ssize)) != NULL); - - DPRINTF("Before making context for new lwp in child\n"); - _lwp_makecontext(, lwp_main_stop, NULL, NULL, stack, ssize); - - DPRINTF("Before creating new in child\n"); - FORKEE_ASSERT(_lwp_create(, 0, ) == 0); - - while (go == 0) - continue; - - raise(SIGINT); - - FORKEE_ASSERT(_lwp_continue(lid) == 0); - - DPRINTF("Before waiting for lwp %d to exit\n", lid); - FORKEE_ASSERT(_lwp_wait(lid, NULL) == 0); - - DPRINTF("Before verifying that reported %d and running lid %d " - "are the same\n", lid, the_lwp_id); - FORKEE_ASSERT_EQ(lid, the_lwp_id); - - 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, , 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_CONTINUE, child, (void *)1, 0) != -1); - - DPRINTF("Before calling %s() for the child - expected stopped " - "SIGTRAP\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child); - - validate_status_stopped(status, SIGTRAP); - - DPRINTF("Before reading siginfo and lwpid_t\n"); - SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, , sizeof(psi)) != -1); - - DPRINTF("Before suspending LWP %d\n", psi.psi_lwpid); - SYSCALL_REQUIRE(ptrace(PT_SUSPEND, child, NULL, psi.psi_lwpid) != -1); - -DPRINTF("Write new go to tracee (PID=%d) from tracer (PID=%d)\n", - child, getpid()); - SYSCALL_REQUIRE(ptrace(PT_WRITE_D, child, __UNVOLATILE(), 1) != -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); - - DPRINTF("Before calling %s() for the child - expected stopped " - "SIGINT\n", TWAIT_FNAME); - TWAIT_REQUIRE_SUCCESS(wpid = TWAIT_GENERIC(child, , 0), child); - - validate_status_stopped(status, SIGINT); - - pl.pl_lwpid = 0; - - SYSCALL_REQUIRE(ptrace(PT_LWPINFO, child, , sizeof(pl)) != -1); - while (pl.pl_lwpid != 0) { - - SYSCALL_REQUIRE(ptrace(PT_LWPINFO, child, , sizeof(pl)) != -1); - switch (pl.pl_lwpid) { - case 1: - ATF_REQUIRE_EQ(pl.pl_event, PL_EVENT_SIGNAL); - break; - case 2: - ATF_REQUIRE_EQ(pl.pl_event, PL_EVENT_SUSPENDED); - break; - } -
CVS commit: [netbsd-9] src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Tue Oct 15 18:22:55 UTC 2019 Modified Files: src/tests/lib/libc/sys [netbsd-9]: t_ptrace_wait.c Log Message: Pull up following revision(s) (requested by kamil in ticket #310): tests/lib/libc/sys/t_ptrace_wait.c: revision 1.134 Remove ATF t_ptrace_wait test suspend1 The tests verifies that a thread can be suspended by a debugger and later resumed by a tracee. This is an unwanted behavior and will be fixed soon. To generate a diff of this commit: cvs rdiff -u -r1.131 -r1.131.2.1 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.
CVS commit: src/sys/dev/ieee1394
Module Name:src Committed By: msaitoh Date: Tue Oct 15 18:21:47 UTC 2019 Modified Files: src/sys/dev/ieee1394: firewire.c fwohci.c fwohcireg.h Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ieee1394/firewire.c cvs rdiff -u -r1.142 -r1.143 src/sys/dev/ieee1394/fwohci.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ieee1394/fwohcireg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ieee1394
Module Name:src Committed By: msaitoh Date: Tue Oct 15 18:21:47 UTC 2019 Modified Files: src/sys/dev/ieee1394: firewire.c fwohci.c fwohcireg.h Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/dev/ieee1394/firewire.c cvs rdiff -u -r1.142 -r1.143 src/sys/dev/ieee1394/fwohci.c cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ieee1394/fwohcireg.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/dev/ieee1394/firewire.c diff -u src/sys/dev/ieee1394/firewire.c:1.48 src/sys/dev/ieee1394/firewire.c:1.49 --- src/sys/dev/ieee1394/firewire.c:1.48 Mon Sep 3 16:29:31 2018 +++ src/sys/dev/ieee1394/firewire.c Tue Oct 15 18:21:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $ */ +/* $NetBSD: firewire.c,v 1.49 2019/10/15 18:21:47 msaitoh Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.48 2018/09/03 16:29:31 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: firewire.c,v 1.49 2019/10/15 18:21:47 msaitoh Exp $"); #include #include @@ -1407,12 +1407,12 @@ fw_reset_csr(struct firewire_comm *fc) CSRARC(fc, BANDWIDTH_AV) = 4915; CSRARC(fc, CHANNELS_AV_HI) = 0x; CSRARC(fc, CHANNELS_AV_LO) = 0x; - CSRARC(fc, IP_CHANNELS) = (1 << 31); + CSRARC(fc, IP_CHANNELS) = (1U << 31); CSRARC(fc, CONF_ROM) = 0x04 << 24; CSRARC(fc, CONF_ROM + 4) = 0x31333934; /* means strings 1394 */ CSRARC(fc, CONF_ROM + 8) = - 1 << 31 | 1 << 30 | 1 << 29 | 1 << 28 | 0xff << 16 | 0x09 << 8; + 1U << 31 | 1 << 30 | 1 << 29 | 1 << 28 | 0xff << 16 | 0x09 << 8; CSRARC(fc, CONF_ROM + 0xc) = 0; /* DV depend CSRs see blue book */ Index: src/sys/dev/ieee1394/fwohci.c diff -u src/sys/dev/ieee1394/fwohci.c:1.142 src/sys/dev/ieee1394/fwohci.c:1.143 --- src/sys/dev/ieee1394/fwohci.c:1.142 Tue May 28 08:59:34 2019 +++ src/sys/dev/ieee1394/fwohci.c Tue Oct 15 18:21:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fwohci.c,v 1.142 2019/05/28 08:59:34 msaitoh Exp $ */ +/* $NetBSD: fwohci.c,v 1.143 2019/10/15 18:21:47 msaitoh Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa @@ -37,7 +37,7 @@ * */ #include -__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.142 2019/05/28 08:59:34 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.143 2019/10/15 18:21:47 msaitoh Exp $"); #include #include @@ -224,7 +224,7 @@ static void fwohci_arcv(struct fwohci_so #define OHCI_ATRETRY 0x008 #define OHCI_CROMHDR 0x018 #define OHCI_BUS_OPT 0x020 -#define OHCI_BUSIRMC (1 << 31) +#define OHCI_BUSIRMC (1U << 31) #define OHCI_BUSCMC (1 << 30) #define OHCI_BUSISC (1 << 29) #define OHCI_BUSBMC (1 << 28) @@ -250,7 +250,7 @@ static void fwohci_arcv(struct fwohci_so #define OHCI_SID_BUF 0x064 #define OHCI_SID_CNT 0x068 -#define OHCI_SID_ERR (1 << 31) +#define OHCI_SID_ERR (1U << 31) #define OHCI_SID_CNT_MASK 0xffc #define OHCI_IT_STAT 0x090 @@ -752,7 +752,7 @@ fwohci_set_bus_manager(struct firewire_c OWRITE(sc, OHCI_CSR_DATA, node); OWRITE(sc, OHCI_CSR_COMP, 0x3f); OWRITE(sc, OHCI_CSR_CONT, OHCI_BUS_MANAGER_ID); - for (i = 0; !(OREAD(sc, OHCI_CSR_CONT) & (1<<31)) && (i < 1000); i++) + for (i = 0; !(OREAD(sc, OHCI_CSR_CONT) & (1U <<31)) && (i < 1000); i++) DELAY(10); bm = OREAD(sc, OHCI_CSR_DATA); if ((bm & 0x3f) == 0x3f) @@ -1296,7 +1296,7 @@ fwohci_reset(struct fwohci_softc *sc) /* AT Retries */ OWRITE(sc, FWOHCI_RETRY, /* CycleLimit PhyRespRetries ATRespRetries ATReqRetries */ - (0x << 16) | (0x0f << 8) | (0x0f << 4) | 0x0f); + (0xU << 16) | (0x0f << 8) | (0x0f << 4) | 0x0f); sc->atrq.top = STAILQ_FIRST(>atrq.db_trq); sc->atrs.top = STAILQ_FIRST(>atrs.db_trq); @@ -2013,7 +2013,7 @@ fwohci_intr_core(struct fwohci_softc *sc OWRITE(sc, FWOHCI_INTMASK, OHCI_INT_PHY_BUS_R); /* Allow async. request to us */ - OWRITE(sc, OHCI_AREQHI, 1 << 31); + OWRITE(sc, OHCI_AREQHI, 1U << 31); if (firewire_phydma_enable) { /* allow from all nodes */ OWRITE(sc, OHCI_PREQHI, 0x7fff); Index: src/sys/dev/ieee1394/fwohcireg.h diff -u src/sys/dev/ieee1394/fwohcireg.h:1.19 src/sys/dev/ieee1394/fwohcireg.h:1.20 --- src/sys/dev/ieee1394/fwohcireg.h:1.19 Sat Mar 31 14:50:45 2018 +++ src/sys/dev/ieee1394/fwohcireg.h Tue Oct 15 18:21:47 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: fwohcireg.h,v 1.19 2018/03/31 14:50:45 sevan Exp $ */ +/* $NetBSD: fwohcireg.h,v 1.20 2019/10/15 18:21:47 msaitoh Exp $ */ /*- * Copyright (c) 2003 Hidetoshi Shimokawa @@ -285,13 +285,13 @@ struct ohci_registers { fwohcireg_t link_cntl_clr; /* Chip control clear 0xe4*/ #define FWOHCI_NODEID 0xe8 fwohcireg_t node; /* Node ID 0xe8 */ -#define OHCI_NODE_VALID (1 << 31) +#define OHCI_NODE_VALID (1U << 31)
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Tue Oct 15 18:20:44 UTC 2019 Modified Files: src/sys/dev/pci: pccbbreg.h Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/pccbbreg.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/dev/pci/pccbbreg.h diff -u src/sys/dev/pci/pccbbreg.h:1.15 src/sys/dev/pci/pccbbreg.h:1.16 --- src/sys/dev/pci/pccbbreg.h:1.15 Tue Dec 15 22:17:12 2009 +++ src/sys/dev/pci/pccbbreg.h Tue Oct 15 18:20:44 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: pccbbreg.h,v 1.15 2009/12/15 22:17:12 snj Exp $ */ +/* $NetBSD: pccbbreg.h,v 1.16 2019/10/15 18:20:44 msaitoh Exp $ */ /* * Copyright (c) 1999 HAYAKAWA Koichi. All rights reserved. @@ -67,7 +67,7 @@ /* PCI_CB_LSCP_REG */ #define PCI_CB_LATENCY_SHIFT 24 -#define PCI_CB_LATENCY_MASK 0xff +#define PCI_CB_LATENCY_MASK 0xffU #define PCI_CB_LATENCY(x) (((x) >> PCI_CB_LATENCY_SHIFT) & PCI_CB_LATENCY_MASK)
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Tue Oct 15 18:20:44 UTC 2019 Modified Files: src/sys/dev/pci: pccbbreg.h Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/pccbbreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:21:06 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #309): sys/kern/sys_ptrace_common.c: revision 1.67 Avoid signed integer overflow for -lwp where lwp is INT_MIN To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.58.2.1 src/sys/kern/sys_ptrace_common.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:21:06 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: sys_ptrace_common.c Log Message: Pull up following revision(s) (requested by kamil in ticket #309): sys/kern/sys_ptrace_common.c: revision 1.67 Avoid signed integer overflow for -lwp where lwp is INT_MIN To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.58.2.1 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c diff -u src/sys/kern/sys_ptrace_common.c:1.58 src/sys/kern/sys_ptrace_common.c:1.58.2.1 --- src/sys/kern/sys_ptrace_common.c:1.58 Thu Jul 18 20:10:46 2019 +++ src/sys/kern/sys_ptrace_common.c Tue Oct 15 18:21:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_ptrace_common.c,v 1.58 2019/07/18 20:10:46 kamil Exp $ */ +/* $NetBSD: sys_ptrace_common.c,v 1.58.2.1 2019/10/15 18:21:06 martin Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -118,7 +118,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58 2019/07/18 20:10:46 kamil Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.58.2.1 2019/10/15 18:21:06 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_ptrace.h" @@ -1205,8 +1205,12 @@ do_ptrace(struct ptrace_methods *ptm, st signo = tmp; tmp = 0; /* don't search for LWP */ } - } else + } else if (tmp == INT_MIN) { + error = ESRCH; + break; + } else { tmp = -tmp; + } if (tmp > 0) { if (req == PT_DETACH) {
CVS commit: [netbsd-9] src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: martin Date: Tue Oct 15 18:17:06 UTC 2019 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs [netbsd-9]: dmu_diff.c zfs_ioctl.c src/external/cddl/osnet/dist/uts/common/fs/zfs/sys [netbsd-9]: dmu.h Log Message: Pull up following revision(s) (requested by hannken in ticket #308): external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c: revision 1.21 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c: revision 1.3 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c: revision 1.4 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h: revision 1.4 Change dmu_diff() back to use a "file" instead of a "vnode". Command "zfs diff" calls it with a pipe, not a plain file. Fixes PR kern/54541: kernel panic using "zfs diff" - Add missing "#ifdef _KERNEL" to fix the build of userland zfs libraries. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.6.1 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c cvs rdiff -u -r1.20 -r1.20.2.1 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c cvs rdiff -u -r1.3 -r1.3.4.1 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/external/cddl/osnet/dist/uts/common/fs/zfs
Module Name:src Committed By: martin Date: Tue Oct 15 18:17:06 UTC 2019 Modified Files: src/external/cddl/osnet/dist/uts/common/fs/zfs [netbsd-9]: dmu_diff.c zfs_ioctl.c src/external/cddl/osnet/dist/uts/common/fs/zfs/sys [netbsd-9]: dmu.h Log Message: Pull up following revision(s) (requested by hannken in ticket #308): external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c: revision 1.21 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c: revision 1.3 external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c: revision 1.4 external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h: revision 1.4 Change dmu_diff() back to use a "file" instead of a "vnode". Command "zfs diff" calls it with a pipe, not a plain file. Fixes PR kern/54541: kernel panic using "zfs diff" - Add missing "#ifdef _KERNEL" to fix the build of userland zfs libraries. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.6.1 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c cvs rdiff -u -r1.20 -r1.20.2.1 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c cvs rdiff -u -r1.3 -r1.3.4.1 \ src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.2 src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.2.6.1 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c:1.2 Mon May 28 21:05:07 2018 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/dmu_diff.c Tue Oct 15 18:17:06 2019 @@ -43,16 +43,13 @@ struct diffarg { #ifdef __FreeBSD__ kthread_t *da_td; - struct file *da_fp; /* file to which we are reporting */ -#else - struct vnode *da_vp; /* file to which we are reporting */ #endif + struct file *da_fp; /* file to which we are reporting */ offset_t *da_offp; int da_err; /* error that stopped diff search */ dmu_diff_record_t da_ddr; }; -#ifdef __FreeBSD__ static int write_bytes(struct diffarg *da) { @@ -66,18 +63,32 @@ write_bytes(struct diffarg *da) auio.uio_resid = aiov.iov_len; auio.uio_rw = UIO_WRITE; auio.uio_offset = (off_t)-1; +#ifdef __FreeBSD__ auio.uio_segflg = UIO_SYSSPACE; auio.uio_td = da->da_td; +#else #ifdef _KERNEL + auio.uio_vmspace = vmspace_kernel(); +#endif +#endif /* __FreeBSD__ */ +#ifdef _KERNEL +#ifdef __FreeBSD__ if (da->da_fp->f_type == DTYPE_VNODE) bwillwrite(); return (fo_write(da->da_fp, , da->da_td->td_ucred, 0, da->da_td)); #else + int flags = 0; + + if (da->da_fp->f_type == DTYPE_VNODE) + flags |= FOF_UPDATE_OFFSET; + return (*da->da_fp->f_ops->fo_write)(da->da_fp, >da_fp->f_offset, + , da->da_fp->f_cred, flags); +#endif /* __FreeBSD__ */ +#else fprintf(stderr, "%s: returning EOPNOTSUPP\n", __func__); return (EOPNOTSUPP); #endif } -#endif /* __FreeBSD__ */ static int write_record(struct diffarg *da) @@ -89,13 +100,7 @@ write_record(struct diffarg *da) return (0); } -#ifdef __FreeBSD__ da->da_err = write_bytes(da); -#else - da->da_err = vn_rdwr(UIO_WRITE, da->da_vp, (caddr_t)>da_ddr, - sizeof (da->da_ddr), 0, UIO_SYSSPACE, FAPPEND, - RLIM64_INFINITY, CRED(), ); -#endif *da->da_offp += sizeof (da->da_ddr); return (da->da_err); } @@ -193,11 +198,7 @@ diff_cb(spa_t *spa, zilog_t *zilog, cons int dmu_diff(const char *tosnap_name, const char *fromsnap_name, -#ifdef __FreeBSD__ struct file *fp, offset_t *offp) -#else -struct vnode *vp, offset_t *offp) -#endif { struct diffarg da; dsl_dataset_t *fromsnap; @@ -242,10 +243,8 @@ dmu_diff(const char *tosnap_name, const #ifdef __FreeBSD__ da.da_td = curthread; - da.da_fp = fp; -#else - da.da_vp = vp; #endif + da.da_fp = fp; da.da_offp = offp; da.da_ddr.ddr_type = DDR_NONE; da.da_ddr.ddr_first = da.da_ddr.ddr_last = 0; Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.20 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.20.2.1 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c:1.20 Wed May 22 08:46:27 2019 +++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c Tue Oct 15 18:17:06 2019 @@ -5296,11 +5296,7 @@ zfs_ioc_diff(zfs_cmd_t *zc) off = fp->f_offset; -#ifdef __FreeBSD__ error = dmu_diff(zc->zc_name, zc->zc_value, fp, ); -#else - error = dmu_diff(zc->zc_name, zc->zc_value, fp->f_vnode, ); -#endif if (off >= 0 && off <= MAXOFFSET_T) fp->f_offset = off; Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h:1.3 src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h:1.3.4.1 --- src/external/cddl/osnet/dist/uts/common/fs/zfs/sys/dmu.h:1.3 Mon May 28 21:05:07 2018 +++
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:13:56 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: vnode_if.c Log Message: Regen (for ticket #307) To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.107.10.1 src/sys/kern/vnode_if.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/vnode_if.c diff -u src/sys/kern/vnode_if.c:1.107 src/sys/kern/vnode_if.c:1.107.10.1 --- src/sys/kern/vnode_if.c:1.107 Wed Jul 12 09:31:59 2017 +++ src/sys/kern/vnode_if.c Tue Oct 15 18:13:55 2019 @@ -1,13 +1,13 @@ -/* $NetBSD: vnode_if.c,v 1.107 2017/07/12 09:31:59 hannken Exp $ */ +/* $NetBSD: vnode_if.c,v 1.107.10.1 2019/10/15 18:13:55 martin Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! * (Modifications made here may easily be lost!) * * Created from the file: - * NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp + * NetBSD: vnode_if.src,v 1.77.10.1 2019/10/15 18:12:25 martin Exp * by the script: - * NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp + * NetBSD: vnode_if.sh,v 1.66.10.1 2019/10/15 18:12:25 martin Exp */ /* @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.107 2017/07/12 09:31:59 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.107.10.1 2019/10/15 18:13:55 martin Exp $"); #include #include @@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v #include #include -enum fst_op { FST_NO, FST_YES, FST_TRY }; +enum fst_op { FST_NO, FST_YES, FST_LAZY, FST_TRY }; static inline int vop_pre(vnode_t *vp, struct mount **mp, bool *mpsafe, enum fst_op op) @@ -62,7 +62,7 @@ vop_pre(vnode_t *vp, struct mount **mp, KERNEL_LOCK(1, curlwp); } - if (op == FST_YES || op == FST_TRY) { + if (op == FST_YES || op == FST_LAZY || op == FST_TRY) { for (;;) { *mp = vp->v_mount; if (op == FST_TRY) { @@ -73,6 +73,8 @@ vop_pre(vnode_t *vp, struct mount **mp, } return error; } + } else if (op == FST_LAZY) { +fstrans_start_lazy(*mp); } else { fstrans_start(*mp); } @@ -91,7 +93,7 @@ static inline void vop_post(vnode_t *vp, struct mount *mp, bool mpsafe, enum fst_op op) { - if (op == FST_YES) { + if (op == FST_YES || op == FST_LAZY) { fstrans_done(mp); } @@ -1378,11 +1380,11 @@ VOP_STRATEGY(struct vnode *vp, a.a_desc = VDESC(vop_strategy); a.a_vp = vp; a.a_bp = bp; - error = vop_pre(vp, , , FST_YES); + error = vop_pre(vp, , , FST_LAZY); if (error) return error; error = (VCALL(vp, VOFFSET(vop_strategy), )); - vop_post(vp, mp, mpsafe, FST_YES); + vop_post(vp, mp, mpsafe, FST_LAZY); return error; }
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:13:56 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: vnode_if.c Log Message: Regen (for ticket #307) To generate a diff of this commit: cvs rdiff -u -r1.107 -r1.107.10.1 src/sys/kern/vnode_if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:12:25 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: vnode_if.sh vnode_if.src Log Message: Pull up following revision(s) (requested by hannken in ticket #307): sys/kern/vnode_if.sh: revision 1.67 sys/kern/vnode_if.src: revision 1.78 As VOP_STRATEGY() usually calls itself on the file system holding "/dev" it may deadlock on suspension of this file system. Add fstrans type LAZY and use it for VOP_STRATEGY(). Adress PR kern/53624 (dom0 freeze on domU exit) is still there To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.66.10.1 src/sys/kern/vnode_if.sh cvs rdiff -u -r1.77 -r1.77.10.1 src/sys/kern/vnode_if.src 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/vnode_if.sh diff -u src/sys/kern/vnode_if.sh:1.66 src/sys/kern/vnode_if.sh:1.66.10.1 --- src/sys/kern/vnode_if.sh:1.66 Sun Jun 4 08:03:26 2017 +++ src/sys/kern/vnode_if.sh Tue Oct 15 18:12:25 2019 @@ -29,7 +29,7 @@ copyright="\ * SUCH DAMAGE. */ " -SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.66 2017/06/04 08:03:26 hannken Exp $' +SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.66.10.1 2019/10/15 18:12:25 martin Exp $' # Script to produce VFS front-end sugar. # @@ -318,7 +318,7 @@ echo ' if [ -z "${rump}" ] ; then echo " -enum fst_op { FST_NO, FST_YES, FST_TRY }; +enum fst_op { FST_NO, FST_YES, FST_LAZY, FST_TRY }; static inline int vop_pre(vnode_t *vp, struct mount **mp, bool *mpsafe, enum fst_op op) @@ -331,7 +331,7 @@ vop_pre(vnode_t *vp, struct mount **mp, KERNEL_LOCK(1, curlwp); } - if (op == FST_YES || op == FST_TRY) { + if (op == FST_YES || op == FST_LAZY || op == FST_TRY) { for (;;) { *mp = vp->v_mount; if (op == FST_TRY) { @@ -342,6 +342,8 @@ vop_pre(vnode_t *vp, struct mount **mp, } return error; } + } else if (op == FST_LAZY) { +fstrans_start_lazy(*mp); } else { fstrans_start(*mp); } @@ -360,7 +362,7 @@ static inline void vop_post(vnode_t *vp, struct mount *mp, bool mpsafe, enum fst_op op) { - if (op == FST_YES) { + if (op == FST_YES || op == FST_LAZY) { fstrans_done(mp); } Index: src/sys/kern/vnode_if.src diff -u src/sys/kern/vnode_if.src:1.77 src/sys/kern/vnode_if.src:1.77.10.1 --- src/sys/kern/vnode_if.src:1.77 Wed Jul 12 09:31:07 2017 +++ src/sys/kern/vnode_if.src Tue Oct 15 18:12:25 2019 @@ -1,4 +1,4 @@ -# $NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 hannken Exp $ +# $NetBSD: vnode_if.src,v 1.77.10.1 2019/10/15 18:12:25 martin Exp $ # # Copyright (c) 1992, 1993 # The Regents of the University of California. All rights reserved. @@ -436,6 +436,7 @@ vop_bmap { #% strategy vp = = = # vop_strategy { + FSTRANS=LAZY IN struct vnode *vp; IN struct buf *bp; };
CVS commit: [netbsd-9] src/sys/kern
Module Name:src Committed By: martin Date: Tue Oct 15 18:12:25 UTC 2019 Modified Files: src/sys/kern [netbsd-9]: vnode_if.sh vnode_if.src Log Message: Pull up following revision(s) (requested by hannken in ticket #307): sys/kern/vnode_if.sh: revision 1.67 sys/kern/vnode_if.src: revision 1.78 As VOP_STRATEGY() usually calls itself on the file system holding "/dev" it may deadlock on suspension of this file system. Add fstrans type LAZY and use it for VOP_STRATEGY(). Adress PR kern/53624 (dom0 freeze on domU exit) is still there To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.66.10.1 src/sys/kern/vnode_if.sh cvs rdiff -u -r1.77 -r1.77.10.1 src/sys/kern/vnode_if.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/arch/amd64/conf
Module Name:src Committed By: martin Date: Tue Oct 15 18:10:09 UTC 2019 Modified Files: src/sys/arch/amd64/conf [netbsd-9]: GENERIC Log Message: Pull up following revision(s) (requested by tnn in ticket #306): sys/arch/amd64/conf/GENERIC: revision 1.536 add mcx(4) to GENERIC Tested on dual-port ConnectX-4 with 25 Gbit/s AOC To generate a diff of this commit: cvs rdiff -u -r1.531.2.2 -r1.531.2.3 src/sys/arch/amd64/conf/GENERIC 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/conf/GENERIC diff -u src/sys/arch/amd64/conf/GENERIC:1.531.2.2 src/sys/arch/amd64/conf/GENERIC:1.531.2.3 --- src/sys/arch/amd64/conf/GENERIC:1.531.2.2 Fri Aug 9 16:06:39 2019 +++ src/sys/arch/amd64/conf/GENERIC Tue Oct 15 18:10:09 2019 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.531.2.2 2019/08/09 16:06:39 martin Exp $ +# $NetBSD: GENERIC,v 1.531.2.3 2019/10/15 18:10:09 martin Exp $ # # GENERIC machine description file # @@ -22,7 +22,7 @@ include "arch/amd64/conf/std.amd64" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.531.2.2 $" +#ident "GENERIC-$Revision: 1.531.2.3 $" maxusers 64 # estimated number of users @@ -792,6 +792,7 @@ hme* at pci? dev ? function ? # Sun Micr le* at pci? dev ? function ? # PCnet-PCI Ethernet lii* at pci? dev ? function ? # Atheros L2 Fast-Ethernet malo* at pci? dev ? function ? # Marvell Libertas Wireless +mcx* at pci? dev ? function ? # Mellanox 5th generation Ethernet mskc* at pci? dev ? function ? # Marvell Yukon 2 Gigabit Ethernet msk* at mskc? # Marvell Yukon 2 Gigabit Ethernet mtd* at pci? dev ? function ? # Myson MTD803 3-in-1 Ethernet
CVS commit: [netbsd-9] src/sys/arch/amd64/conf
Module Name:src Committed By: martin Date: Tue Oct 15 18:10:09 UTC 2019 Modified Files: src/sys/arch/amd64/conf [netbsd-9]: GENERIC Log Message: Pull up following revision(s) (requested by tnn in ticket #306): sys/arch/amd64/conf/GENERIC: revision 1.536 add mcx(4) to GENERIC Tested on dual-port ConnectX-4 with 25 Gbit/s AOC To generate a diff of this commit: cvs rdiff -u -r1.531.2.2 -r1.531.2.3 src/sys/arch/amd64/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-9] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Tue Oct 15 18:08:31 UTC 2019 Modified Files: src/sys/arch/x86/pci [netbsd-9]: msipic.c Log Message: Pull up following revision(s) (requested by tnn in ticket #305): sys/arch/x86/pci/msipic.c: revision 1.18 change bus_space_map to _x86_memio_map Resolves bus space reservation conflict between MI and MD code. Discussion: http://mail-index.netbsd.org/port-amd64/2019/09/28/msg003014.html To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.17.2.1 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.
CVS commit: [netbsd-9] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Tue Oct 15 18:08:31 UTC 2019 Modified Files: src/sys/arch/x86/pci [netbsd-9]: msipic.c Log Message: Pull up following revision(s) (requested by tnn in ticket #305): sys/arch/x86/pci/msipic.c: revision 1.18 change bus_space_map to _x86_memio_map Resolves bus space reservation conflict between MI and MD code. Discussion: http://mail-index.netbsd.org/port-amd64/2019/09/28/msg003014.html To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.17.2.1 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.17 src/sys/arch/x86/pci/msipic.c:1.17.2.1 --- src/sys/arch/x86/pci/msipic.c:1.17 Wed Jun 26 10:20:06 2019 +++ src/sys/arch/x86/pci/msipic.c Tue Oct 15 18:08:31 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $ */ +/* $NetBSD: msipic.c,v 1.17.2.1 2019/10/15 18:08:31 martin Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.17 2019/06/26 10:20:06 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.17.2.1 2019/10/15 18:08:31 martin Exp $"); #include "opt_intrdebug.h" @@ -711,7 +711,7 @@ msipic_construct_msix_pic(const struct p flags &= ~BUS_SPACE_MAP_PREFETCHABLE; } bssize = roundup(table_size, PAGE_SIZE); - err = bus_space_map(pa->pa_memt, memaddr + table_offset, bssize, flags, + err = _x86_memio_map(pa->pa_memt, memaddr + table_offset, bssize, flags, ); bstag = pa->pa_memt; #endif @@ -739,8 +739,8 @@ msipic_destruct_msix_pic(struct pic *msi KASSERT(msix_pic->pic_type == PIC_MSIX); msipic = msix_pic->pic_msipic; - bus_space_unmap(msipic->mp_bstag, msipic->mp_bshandle, - msipic->mp_bssize); + _x86_memio_unmap(msipic->mp_bstag, msipic->mp_bshandle, + msipic->mp_bssize, NULL); msipic_destruct_common_msi_pic(msix_pic); }
CVS commit: src/sys/arch/arm/fdt
Module Name:src Committed By: bad Date: Tue Oct 15 17:25:02 UTC 2019 Modified Files: src/sys/arch/arm/fdt: cpu_fdt.c Log Message: flush the dcache in cpu_enable_psci() before calling psci_cpu_on(). fixes the kernel hanging with multiple "mpstart" on (at least) NanoPi R1. OK jmcneill@, skrll@ XXX pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/fdt/cpu_fdt.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/arm/fdt/cpu_fdt.c diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.25 src/sys/arch/arm/fdt/cpu_fdt.c:1.26 --- src/sys/arch/arm/fdt/cpu_fdt.c:1.25 Sat Apr 13 19:15:25 2019 +++ src/sys/arch/arm/fdt/cpu_fdt.c Tue Oct 15 17:25:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_fdt.c,v 1.25 2019/04/13 19:15:25 jmcneill Exp $ */ +/* $NetBSD: cpu_fdt.c,v 1.26 2019/10/15 17:25:02 bad Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -30,7 +30,7 @@ #include "psci_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.25 2019/04/13 19:15:25 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.26 2019/10/15 17:25:02 bad Exp $"); #include #include @@ -348,6 +348,7 @@ cpu_enable_psci(int phandle) fdtbus_get_reg64(phandle, 0, , NULL); + cpu_dcache_wbinv_all(); ret = psci_cpu_on(mpidr, cpu_fdt_mpstart_pa(), 0); if (ret != PSCI_SUCCESS) return EIO;
CVS commit: src/sys/arch/arm/fdt
Module Name:src Committed By: bad Date: Tue Oct 15 17:25:02 UTC 2019 Modified Files: src/sys/arch/arm/fdt: cpu_fdt.c Log Message: flush the dcache in cpu_enable_psci() before calling psci_cpu_on(). fixes the kernel hanging with multiple "mpstart" on (at least) NanoPi R1. OK jmcneill@, skrll@ XXX pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/fdt/cpu_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Tue Oct 15 17:19:05 UTC 2019 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: correct pointer arithmetics To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.66 src/sys/dev/ic/dwc_gmac.c:1.67 --- src/sys/dev/ic/dwc_gmac.c:1.66 Tue Oct 15 16:30:49 2019 +++ src/sys/dev/ic/dwc_gmac.c Tue Oct 15 17:19:05 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.66 2019/10/15 16:30:49 tnn Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.67 2019/10/15 17:19:05 tnn Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.66 2019/10/15 16:30:49 tnn Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.67 2019/10/15 17:19:05 tnn Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -501,8 +501,7 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s } data->rd_m->m_len = data->rd_m->m_pkthdr.len = data->rd_m->m_ext.ext_size; - m_adj(data->rd_m, - roundup((uintptr_t)data->rd_m->m_data & 0x3f, 0x40)); + m_adj(data->rd_m, (-(uintptr_t)data->rd_m->m_data) & 0x3f); if (data->rd_m->m_len > AWGE_MAX_PACKET) { data->rd_m->m_len = data->rd_m->m_pkthdr.len = AWGE_MAX_PACKET; @@ -1276,7 +1275,7 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc * goto skip; } mnew->m_len = mnew->m_pkthdr.len = mnew->m_ext.ext_size; - m_adj(mnew, roundup((uintptr_t)mnew->m_data & 0x3f, 0x40)); + m_adj(mnew, (-(uintptr_t)mnew->m_data) & 0x3f); if (mnew->m_len > AWGE_MAX_PACKET) { mnew->m_len = mnew->m_pkthdr.len = AWGE_MAX_PACKET; }
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Tue Oct 15 17:19:05 UTC 2019 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: correct pointer arithmetics To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Tue Oct 15 16:59:16 UTC 2019 Modified Files: src/sys/dev/pci: agp.c Log Message: Use unsigned to avoid undefined behavior in agpattach(). Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/dev/pci/agp.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/pci/agp.c diff -u src/sys/dev/pci/agp.c:1.85 src/sys/dev/pci/agp.c:1.86 --- src/sys/dev/pci/agp.c:1.85 Mon Aug 27 07:34:54 2018 +++ src/sys/dev/pci/agp.c Tue Oct 15 16:59:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: agp.c,v 1.85 2018/08/27 07:34:54 riastradh Exp $ */ +/* $NetBSD: agp.c,v 1.86 2019/10/15 16:59:15 msaitoh Exp $ */ /*- * Copyright (c) 2000 Doug Rabson @@ -65,7 +65,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.85 2018/08/27 07:34:54 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: agp.c,v 1.86 2019/10/15 16:59:15 msaitoh Exp $"); #include #include @@ -312,7 +312,7 @@ agpmatch(device_t parent, cfdata_t match return (1); } -static const int agp_max[][2] = { +static const u_int agp_max[][2] = { {0, 0}, {32, 4}, {64, 28}, @@ -332,7 +332,8 @@ agpattach(device_t parent, device_t self struct pci_attach_args *pa = >apa_pci_args; struct agp_softc *sc = device_private(self); const struct agp_product *ap; - int memsize, i, ret; + int ret; + u_int memsize, i; ap = agp_lookup(pa); KASSERT(ap != NULL);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Tue Oct 15 16:59:16 UTC 2019 Modified Files: src/sys/dev/pci: agp.c Log Message: Use unsigned to avoid undefined behavior in agpattach(). Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/dev/pci/agp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Tue Oct 15 16:30:49 UTC 2019 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: awge: fix issue that caused rx packets to be corrupt with DIAGNOSTIC kernel It seems the hardware can only reliably do rx DMA to addresses that are dcache size aligned. This is hinted at by some GMAC data sheets but hard to find an authoritative source. on non-DIAGNOSTIC kernels we always implicitly get MCLBYTES-aligned mbuf data pointers, but with the reintroduction of POOL_REDZONE for DIAGNOSTIC we can get 8-byte alignment due to redzone padding. So align rx pointers to 64 bytes which should be good for both arm32 and aarch64. While here change some bus_dmamap_load() to bus_dmamap_load_mbuf() and add one missing bus_dmamap_sync(). Also fixes the code to not assume that MCLBYTES == AWGE_MAX_PACKET. User may override MCLSHIFT in kernel config. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/dev/ic/dwc_gmac.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Tue Oct 15 16:30:49 UTC 2019 Modified Files: src/sys/dev/ic: dwc_gmac.c Log Message: awge: fix issue that caused rx packets to be corrupt with DIAGNOSTIC kernel It seems the hardware can only reliably do rx DMA to addresses that are dcache size aligned. This is hinted at by some GMAC data sheets but hard to find an authoritative source. on non-DIAGNOSTIC kernels we always implicitly get MCLBYTES-aligned mbuf data pointers, but with the reintroduction of POOL_REDZONE for DIAGNOSTIC we can get 8-byte alignment due to redzone padding. So align rx pointers to 64 bytes which should be good for both arm32 and aarch64. While here change some bus_dmamap_load() to bus_dmamap_load_mbuf() and add one missing bus_dmamap_sync(). Also fixes the code to not assume that MCLBYTES == AWGE_MAX_PACKET. User may override MCLSHIFT in kernel config. To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c diff -u src/sys/dev/ic/dwc_gmac.c:1.65 src/sys/dev/ic/dwc_gmac.c:1.66 --- src/sys/dev/ic/dwc_gmac.c:1.65 Fri Sep 13 07:55:06 2019 +++ src/sys/dev/ic/dwc_gmac.c Tue Oct 15 16:30:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc_gmac.c,v 1.65 2019/09/13 07:55:06 msaitoh Exp $ */ +/* $NetBSD: dwc_gmac.c,v 1.66 2019/10/15 16:30:49 tnn Exp $ */ /*- * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.65 2019/09/13 07:55:06 msaitoh Exp $"); +__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.66 2019/10/15 16:30:49 tnn Exp $"); /* #define DWC_GMAC_DEBUG 1 */ @@ -499,15 +499,24 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s error = ENOMEM; goto fail; } + data->rd_m->m_len = data->rd_m->m_pkthdr.len + = data->rd_m->m_ext.ext_size; + m_adj(data->rd_m, + roundup((uintptr_t)data->rd_m->m_data & 0x3f, 0x40)); + if (data->rd_m->m_len > AWGE_MAX_PACKET) { + data->rd_m->m_len = data->rd_m->m_pkthdr.len + = AWGE_MAX_PACKET; + } - error = bus_dmamap_load(sc->sc_dmat, data->rd_map, - mtod(data->rd_m, void *), MCLBYTES, NULL, - BUS_DMA_READ | BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf(sc->sc_dmat, data->rd_map, + data->rd_m, BUS_DMA_READ | BUS_DMA_NOWAIT); if (error != 0) { aprint_error_dev(sc->sc_dev, "could not load rx buf DMA map #%d", i); goto fail; } + bus_dmamap_sync(sc->sc_dmat, data->rd_map, 0, + data->rd_map->dm_mapsize, BUS_DMASYNC_PREREAD); physaddr = data->rd_map->dm_segs[0].ds_addr; desc = >sc_rxq.r_desc[i]; @@ -516,7 +525,7 @@ dwc_gmac_alloc_rx_ring(struct dwc_gmac_s desc->ddesc_next = htole32(ring->r_physaddr + next * sizeof(*desc)); sc->sc_descm->rx_init_flags(desc); - sc->sc_descm->rx_set_len(desc, AWGE_MAX_PACKET); + sc->sc_descm->rx_set_len(desc, data->rd_m->m_len); sc->sc_descm->rx_set_owned_by_dev(desc); } @@ -538,13 +547,15 @@ dwc_gmac_reset_rx_ring(struct dwc_gmac_s struct dwc_gmac_rx_ring *ring) { struct dwc_gmac_dev_dmadesc *desc; + struct dwc_gmac_rx_data *data; int i; mutex_enter(>r_mtx); for (i = 0; i < AWGE_RX_RING_COUNT; i++) { desc = >sc_rxq.r_desc[i]; + data = >sc_rxq.r_data[i]; sc->sc_descm->rx_init_flags(desc); - sc->sc_descm->rx_set_len(desc, AWGE_MAX_PACKET); + sc->sc_descm->rx_set_len(desc, data->rd_m->m_len); sc->sc_descm->rx_set_owned_by_dev(desc); } @@ -1264,6 +1275,11 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc * ifp->if_ierrors++; goto skip; } + mnew->m_len = mnew->m_pkthdr.len = mnew->m_ext.ext_size; + m_adj(mnew, roundup((uintptr_t)mnew->m_data & 0x3f, 0x40)); + if (mnew->m_len > AWGE_MAX_PACKET) { + mnew->m_len = mnew->m_pkthdr.len = AWGE_MAX_PACKET; + } /* unload old DMA map */ bus_dmamap_sync(sc->sc_dmat, data->rd_map, 0, @@ -1271,15 +1287,13 @@ dwc_gmac_rx_intr(struct dwc_gmac_softc * bus_dmamap_unload(sc->sc_dmat, data->rd_map); /* and reload with new mbuf */ - error = bus_dmamap_load(sc->sc_dmat, data->rd_map, - mtod(mnew, void*), MCLBYTES, NULL, - BUS_DMA_READ | BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf(sc->sc_dmat, data->rd_map, + mnew, BUS_DMA_READ | BUS_DMA_NOWAIT); if (error != 0) { m_freem(mnew); /* try to reload old mbuf */ - error = bus_dmamap_load(sc->sc_dmat, data->rd_map, - mtod(data->rd_m, void*), MCLBYTES, NULL, - BUS_DMA_READ | BUS_DMA_NOWAIT); + error = bus_dmamap_load_mbuf(sc->sc_dmat, data->rd_map, + data->rd_m, BUS_DMA_READ | BUS_DMA_NOWAIT); if (error != 0) { panic("%s: could not load old rx mbuf", device_xname(sc->sc_dev)); @@ -1308,7 +1322,7 @@ skip: data->rd_map->dm_mapsize, BUS_DMASYNC_PREREAD); sc->sc_descm->rx_init_flags(desc); - sc->sc_descm->rx_set_len(desc, AWGE_MAX_PACKET); +
CVS commit: src/doc
Module Name:src Committed By: christos Date: Tue Oct 15 16:17:43 UTC 2019 Modified Files: src/doc: 3RDPARTY CHANGES Log Message: new acpica To generate a diff of this commit: cvs rdiff -u -r1.1662 -r1.1663 src/doc/3RDPARTY cvs rdiff -u -r1.2593 -r1.2594 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/3RDPARTY diff -u src/doc/3RDPARTY:1.1662 src/doc/3RDPARTY:1.1663 --- src/doc/3RDPARTY:1.1662 Sat Oct 12 14:35:52 2019 +++ src/doc/3RDPARTY Tue Oct 15 12:17:43 2019 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1662 2019/10/12 18:35:52 christos Exp $ +# $NetBSD: 3RDPARTY,v 1.1663 2019/10/15 16:17:43 christos Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -41,7 +41,7 @@ # Package: acpica -Version: 20190405 +Version: 20190816 Current Vers: 20190816 Maintainer: Intel Archive Site: http://www.acpica.org/downloads/ Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2593 src/doc/CHANGES:1.2594 --- src/doc/CHANGES:1.2593 Sat Oct 12 14:35:52 2019 +++ src/doc/CHANGES Tue Oct 15 12:17:43 2019 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2593 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2594 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -56,3 +56,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: [sevan 20191009] dhcpcd(8): Import dhcpcd-8.1.0 [roy 20191011] OpenSSH: Import 8.1. [christos 20191012] + acpi(4): Updated ACPICA to 20190816. [christos 20191015]
CVS commit: src/doc
Module Name:src Committed By: christos Date: Tue Oct 15 16:17:43 UTC 2019 Modified Files: src/doc: 3RDPARTY CHANGES Log Message: new acpica To generate a diff of this commit: cvs rdiff -u -r1.1662 -r1.1663 src/doc/3RDPARTY cvs rdiff -u -r1.2593 -r1.2594 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/external/bsd/acpica/bin/iasl
Module Name:src Committed By: christos Date: Tue Oct 15 16:14:49 UTC 2019 Modified Files: src/external/bsd/acpica/bin/iasl: Makefile Log Message: add new grammar file To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/external/bsd/acpica/bin/iasl/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/acpica/bin/iasl/Makefile diff -u src/external/bsd/acpica/bin/iasl/Makefile:1.24 src/external/bsd/acpica/bin/iasl/Makefile:1.25 --- src/external/bsd/acpica/bin/iasl/Makefile:1.24 Thu Jan 10 05:04:43 2019 +++ src/external/bsd/acpica/bin/iasl/Makefile Tue Oct 15 12:14:49 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.24 2019/01/10 10:04:43 martin Exp $ +# $NetBSD: Makefile,v 1.25 2019/10/15 16:14:49 christos Exp $ .if (${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "aarch64") PROG= iasl @@ -19,7 +19,8 @@ LDADD+= -ll -ly DPADD+= ${LIBL} ${LIBY} DPSRCS= aslcompilerparse.y aslcompilerlex.c aslcompilerparse.c \ - dtparserparse.c dtparserlex.c prparserparse.c prparserlex.c + dtparserparse.c dtparserlex.c prparserparse.c prparserlex.c \ + dtcompilerparserparse.c dtcompilerparserlex.c .PATH: ${TOPDIR} SRCS+= \ @@ -90,6 +91,8 @@ SRCS+= \ dtexpress.c \ dtfield.c \ dtio.c \ + dtcompilerparserlex.c \ + dtcompilerparserparse.c \ dtparserlex.c \ dtparserparse.c \ dtsubtable.c \ @@ -299,6 +302,18 @@ LPREFIX.dtparserlex.l=DtParser dtparserlex.l: ${TOPDIR}/dtparser.l ln -sf ${.ALLSRC} ${.TARGET} +YPREFIX.dtcompilerparserparse.y=DtCompilerParser +YFLAGS.dtcompilerparserparse.y += -L +dtcompilerparserparse.y: ${TOPDIR}/dtcompilerparser.y + ln -sf ${.ALLSRC} ${.TARGET} + +dtcompilerparser.y.h: dtcompilerparserparse.h + ln -sf ${.ALLSRC} ${.TARGET} + +LPREFIX.dtcompilerparserlex.l=DtCompilerParser +LFLAGS.dtcompilerparserlex.l += --bison-locations +dtcompilerparserlex.l: ${TOPDIR}/dtcompilerparser.l + ln -sf ${.ALLSRC} ${.TARGET} YPREFIX.prparserparse.y=PrParser prparserparse.y: ${TOPDIR}/prparser.y @@ -311,23 +326,29 @@ LPREFIX.prparserlex.l=PrParser prparserlex.l: ${TOPDIR}/prparser.l ln -sf ${.ALLSRC} ${.TARGET} -CLEANFILES+= aslcompilerparse.y aslcompilerparse.c \ - aslcompilerparse.h \ - aslcompiler.y.h aslcompilerparse.output \ - aslcompilerlex.l aslcompilerlex.c \ - \ - dtparserparse.y dtparserparse.c \ - dtparserparse.h\ - dtparserlex.l dtparserlex.c \ - dtparser.y.h dtparserparse.output \ - \ - prparserparse.y prparserparse.c \ - prparserparse.h\ - prparserlex.l prparserlex.c \ - prparser.y.h prparserparse.output \ - \ +CLEANFILES+= aslcompilerparse.y aslcompilerparse.c \ + aslcompilerparse.h \ + aslcompiler.y.h aslcompilerparse.output \ + aslcompilerlex.l aslcompilerlex.c \ + \ + dtparserparse.y dtparserparse.c\ + dtparserparse.h \ + dtparserlex.l dtparserlex.c\ + dtparser.y.h dtparserparse.output \ + \ + dtcompilerparserparse.y dtcompilerparserparse.c \ + dtcompilerparserparse.h \ + dtcompilerparserlex.l dtcompilerparserlex.c \ + dtcompilerparser.y.h dtcompilerparserparse.output \ + \ + prparserparse.y prparserparse.c\ + prparserparse.h \ + prparserlex.l prparserlex.c\ + prparser.y.h prparserparse.output \ + \ y.output y.tab.h .include -${__DPSRCS.d} ${OBJS}: prparser.y.h dtparser.y.h aslcompiler.y.h +${__DPSRCS.d} ${OBJS}: prparser.y.h dtparser.y.h aslcompiler.y.h \ + dtcompilerparser.y.h
CVS commit: src/external/bsd/acpica/bin/iasl
Module Name:src Committed By: christos Date: Tue Oct 15 16:14:49 UTC 2019 Modified Files: src/external/bsd/acpica/bin/iasl: Makefile Log Message: add new grammar file To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/external/bsd/acpica/bin/iasl/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.