CVS commit: src/sys/kern

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 08:16:15 UTC 2018

Modified Files:
src/sys/kern: uipc_mbuf.c

Log Message:
Modify m_defrag, so that it never frees the first mbuf of the chain. While
here use the given 'flags' argument, and not M_DONTWAIT.

We have a problem with several drivers: they poll an mbuf chain from their
queues and call m_defrag on them, but m_defrag could update the mbuf
pointer, so the mbuf in the queue is no longer valid. It is not easy to
fix each driver, because doing pop+push will reorder the queue, and we
don't really want that to happen.

This problem was independently spotted by me, Kengo, Masanobu, and other
people too it seems (perhaps PR/53218).

Now m_defrag leaves the first mbuf in place, and compresses the chain
only starting from the second mbuf in the chain.

It is important not to compress the first mbuf with hacks, because the
storage of this first mbuf may be shared with other mbufs.


To generate a diff of this commit:
cvs rdiff -u -r1.210 -r1.211 src/sys/kern/uipc_mbuf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 08:34:45 UTC 2018

Modified Files:
src/share/man/man9: mbuf.9
src/sys/kern: uipc_mbuf.c

Log Message:
Rename the 'flags' and 'nowait' arguments to 'how'. The other BSDs did the
same. Also, in m_defrag, rename 'mold' to 'm'.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/share/man/man9/mbuf.9
cvs rdiff -u -r1.211 -r1.212 src/sys/kern/uipc_mbuf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/aarch64/include

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 10:53:03 UTC 2018

Modified Files:
src/sys/arch/aarch64/include: param.h

Log Message:
Increase default MSGBUFSIZE to match arm32 defaults


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/aarch64/include/param.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/fdt

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 11:49:06 UTC 2018

Modified Files:
src/sys/dev/fdt: gpiokeys.c

Log Message:
Add support for lid switch event codes.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/dev/fdt/gpiokeys.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/dts

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 11:49:48 UTC 2018

Modified Files:
src/sys/arch/arm/dts: sun50i-a64-pinebook.dts

Log Message:
Add support for Pinebook lid switch and eMMC


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/dts/sun50i-a64-pinebook.dts

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl2/gmake/dist

2018-04-28 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Sat Apr 28 12:20:41 UTC 2018

Modified Files:
src/external/gpl2/gmake/dist: configure configure.in

Log Message:
gmake: Apply patch to support GLIBC glob interface v2

http://git.savannah.gnu.org/cgit/make.git/commit/?id=48c8a116

Fix a build failure on Ubuntu 18.04.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/gmake/dist/configure \
src/external/gpl2/gmake/dist/configure.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/aarch64/include

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 12:33:17 UTC 2018

Modified Files:
src/sys/arch/aarch64/include: types.h

Log Message:
Define __HAVE_OLD_DISKLABEL for compatibility with the arm32 port.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/aarch64/include/types.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/etc/etc.aarch64

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 12:45:03 UTC 2018

Modified Files:
src/etc/etc.aarch64: MAKEDEV.conf

Log Message:
Create bpf and openfirm devices


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/etc.aarch64/MAKEDEV.conf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netipsec

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 13:23:18 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_var.h key_var.h

Log Message:
Remove unused macros.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/netipsec/ipsec_var.h
cvs rdiff -u -r1.4 -r1.5 src/sys/netipsec/key_var.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 13:26:57 UTC 2018

Modified Files:
src/sys/netinet: raw_ip.c tcp_input.c udp_usrreq.c
src/sys/netinet6: icmp6.c raw_ip6.c udp6_usrreq.c

Log Message:
Remove unused ipsec_var.h includes.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/netinet/raw_ip.c
cvs rdiff -u -r1.405 -r1.406 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.248 -r1.249 src/sys/netinet/udp_usrreq.c
cvs rdiff -u -r1.233 -r1.234 src/sys/netinet6/icmp6.c
cvs rdiff -u -r1.169 -r1.170 src/sys/netinet6/raw_ip6.c
cvs rdiff -u -r1.140 -r1.141 src/sys/netinet6/udp6_usrreq.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

2018-04-28 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 28 13:38:00 UTC 2018

Modified Files:
src/libexec/ftpd: ftpd.8 ftpd.c

Log Message:
Add -f option to ftpd to stay in foreground with -D.

>From nia in PR bin/53221.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/libexec/ftpd/ftpd.8
cvs rdiff -u -r1.203 -r1.204 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/sys/netipsec

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 13:44:19 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_netbsd.c

Log Message:
Fix the net.inet6.ipsec6.def_policy node, the variable should be
&ip6_def_policy.policy, otherwise we're overwriting other fields of the
structure.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/netipsec/ipsec_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netipsec

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 14:01:51 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c ipsec.h

Log Message:
Style and remove unused stuff.


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.74 -r1.75 src/sys/netipsec/ipsec.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 14:21:04 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c ipsec.h
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
Stop using a macro, rename the function to ipsec_init_pcbpolicy directly.


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.75 -r1.76 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.32 -r1.33 src/sys/rump/librump/rumpnet/net_stub.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netipsec

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 14:25:56 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.h ipsec6.h

Log Message:
Move the ipsec6_input prototype into ipsec6.h, and style.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/netipsec/ipsec.h
cvs rdiff -u -r1.27 -r1.28 src/sys/netipsec/ipsec6.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netipsec

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 14:39:34 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_mbuf.c ipsec_private.h

Log Message:
Inline M_EXT_WRITABLE directly, and remove the XXX, there's nothing wrong
in the use of !M_READONLY.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/netipsec/ipsec_mbuf.c
cvs rdiff -u -r1.7 -r1.8 src/sys/netipsec/ipsec_private.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/clk

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 15:20:33 UTC 2018

Modified Files:
src/sys/dev/clk: clk.c clk_backend.h

Log Message:
Create private sysctl nodes for inspecting clock trees.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/clk/clk.c src/sys/dev/clk/clk_backend.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/fdt

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 15:21:05 UTC 2018

Modified Files:
src/sys/dev/fdt: fixedclock.c fixedfactorclock.c

Log Message:
Initialize clk domain name and call clk_attach to register sysctl nodes


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fixedclock.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fixedfactorclock.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/arm/sunxi

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 15:21:24 UTC 2018

Modified Files:
src/sys/arch/arm/sunxi: sunxi_ccu.c

Log Message:
Initialize clk domain name and call clk_attach to register sysctl nodes


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/sunxi/sunxi_ccu.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netipsec

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr 28 15:45:16 UTC 2018

Modified Files:
src/sys/netipsec: ipsec.c ipsec_input.c ipsec_output.c ipsec_private.h
key.c xform_ah.c xform_esp.c xform_ipcomp.c xform_ipip.c

Log Message:
Remove IPSEC_SPLASSERT_SOFTNET, it has always been a no-op.


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/netipsec/ipsec.c
cvs rdiff -u -r1.66 -r1.67 src/sys/netipsec/ipsec_input.c
cvs rdiff -u -r1.73 -r1.74 src/sys/netipsec/ipsec_output.c
cvs rdiff -u -r1.8 -r1.9 src/sys/netipsec/ipsec_private.h
cvs rdiff -u -r1.254 -r1.255 src/sys/netipsec/key.c
cvs rdiff -u -r1.94 -r1.95 src/sys/netipsec/xform_ah.c
cvs rdiff -u -r1.81 -r1.82 src/sys/netipsec/xform_esp.c
cvs rdiff -u -r1.62 -r1.63 src/sys/netipsec/xform_ipcomp.c
cvs rdiff -u -r1.68 -r1.69 src/sys/netipsec/xform_ipip.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/aarch64/include

2018-04-28 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Sat Apr 28 17:42:07 UTC 2018

Modified Files:
src/sys/arch/aarch64/include: db_machdep.h

Log Message:
Oops, my previous commit is totally wrong. recast mask/pattern list.
pointed out by David Binderman in PR/53224, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/aarch64/include/db_machdep.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/sys

2018-04-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Apr 28 17:56:55 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.h

Log Message:
Handle core dumps in ATF ptrace(2) tests easier

Cast WCOREDUMP() to either 1 or 0.

It could be changed to a boolean type, but it's already good enough.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/t_ptrace_wait.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/sys

2018-04-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Apr 28 18:07:15 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Refactor the traceme3 ATF ptrace(2) test

Replace traceme3 with new ATF tests using diverse signals:

 - traceme_signal_nohandler1 SIGKILL
 - traceme_signal_nohandler2 SIGSTOP (temporarily disabled)
 - traceme_signal_nohandler3 SIGABRT (emits core dump)
 - traceme_signal_nohandler4 SIGHUP
 - traceme_signal_nohandler5 SIGCONT

These SIGSTOP test does not work properly right now as it unstops the
traccee.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 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/arch/arm/cortex

2018-04-28 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Apr 28 18:26:53 UTC 2018

Modified Files:
src/sys/arch/arm/cortex: gic.c

Log Message:
Cover all pic_maxsources lines for armgic_cpu_init_priorities() and
armgic_cpu_update_priorities().

Previously only the first 32 lines were covered, which is significantly
less than the 1000-some interrupt lines possible.

Only relevant to MULTIPROCESSOR configurations.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/cortex/gic.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/gpl2/dts/dist

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 18:28:26 UTC 2018

Modified Files:
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts: bcm2835-rpi.dtsi
bcm283x.dtsi
src/sys/external/gpl2/dts/dist/include/dt-bindings/input:
linux-event-codes.h
Removed Files:
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts:
cloudengines-pogoplug-series-3.dts imx6qdl-microsom-ar8035.dtsi
imx6qdl-microsom.dtsi imx7d-pico.dts samsung_k3pe0e000b.dtsi
wd-mbwe.dts
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/marvell:
armada-cp110-master.dtsi armada-cp110-slave.dtsi

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm2835-rpi.dtsi \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/bcm283x.dtsi
cvs rdiff -u -r1.1.1.1 -r0 \

src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/cloudengines-pogoplug-series-3.dts
 \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/imx6qdl-microsom.dtsi \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/wd-mbwe.dts
cvs rdiff -u -r1.1.1.2 -r0 \

src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/imx6qdl-microsom-ar8035.dtsi \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/imx7d-pico.dts \
src/sys/external/gpl2/dts/dist/arch/arm/boot/dts/samsung_k3pe0e000b.dtsi
cvs rdiff -u -r1.1.1.4 -r0 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/marvell/armada-cp110-master.dtsi
 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/marvell/armada-cp110-slave.dtsi
cvs rdiff -u -r1.5 -r1.6 \
src/sys/external/gpl2/dts/dist/include/dt-bindings/input/linux-event-codes.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/doc

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 18:29:21 UTC 2018

Modified Files:
src/doc: 3RDPARTY

Log Message:
Update to Linux dts 4.17-rc2


To generate a diff of this commit:
cvs rdiff -u -r1.1516 -r1.1517 src/doc/3RDPARTY

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/evbarm/conf

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 18:42:20 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
Add sun50i-a64-teres-i.dts, sun50i-h5-orangepi-zero-plus.dts


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/conf/GENERIC64

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/evbarm/conf

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 18:47:53 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: SUNXI

Log Message:
Add sun7i-a20-olimex-som204-evb-emmc.dts, sun7i-a20-olimex-som204-evb.dts, 
sun8i-h2-plus-bananapi-m2-zero.dts, sun8i-h2-plus-orangepi-r1.dts, 
sun8i-h3-libretech-all-h3-cc.dts, sun50i-a64-teres-i.dts, 
sun50i-h5-orangepi-zero-plus.dts


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/evbarm/conf/SUNXI

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/lib/libc/sys

2018-04-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Apr 28 19:00:26 UTC 2018

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c

Log Message:
Enable traceme_raise1 in the ATF ptrace(2) tests

This test checks raise(SIGKILL). If we enter the kernel with this signal
we report a signaled child in a debugger, not stopped with an option to
make an action.

FreeBSD behaves differently and allows intercepting this event in a tracer.
Follow the Linux behavior.

If we really want to prevent raise(SIGKILL) from signaling the tracee, we
still can breakpoint raise(3) and alter the syscall arguments (or use
the PT_SYSCALL mode). If we are already in the kernel, SIGKILL always means
killing the process, whether or not traced and the source of SIGKILL.

This tests passes on NetBSD without kernel changes.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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/arch/evbarm/conf

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 20:30:50 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
Enable Allwinner SID and thermal sensor controller


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/GENERIC64

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/arch/evbarm/conf

2018-04-28 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr 28 20:35:05 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
Enable motg


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/GENERIC64

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/kern

2018-04-28 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Apr 29 04:28:10 UTC 2018

Modified Files:
src/sys/kern: sys_ptrace_common.c

Log Message:
Harden the NetBSD PT_TRACE_ME operation

You can't say to the parent of a process to start tracing if:
(1) the parent is initproc,
(2) the child is already traced.

Rationale:
 (1) - It has a side effect of being an anti-debugger functionality,
   as we cannot kill initproc (PID1) and reset the traced flag.
 - initproc is not a debugger, raising debugging events from a child
   to initproc can result in at least a stopped/hanging process
   in the system.
 (2) - It does not make sense to be simultanously traced by two debuggers.
 - It does not make sense to be traced twice by the same debugger.

Permit enable tracing for a parent that has been chroot(8)ed, as this is
harmless and the parent is already monitoring for child signals.

The same semantics exist in FreeBSD.

If you are looking for an antidebugging trick for old NetBSD (pre 8.0)
or other popular kernels, here is an example:

$ cat antidebug.c
#include 
#include 

#include 
#include 
#include 
#include 

int
main(int argc, char **argv)
{
pid_t child;
int rv;
int n = 0;

child = fork();
if (child == 0) {
while (getppid() != 1)
continue;
rv = ptrace(PT_TRACE_ME, 0, 0, 0);
if (rv != 0)
abort();
printf("Try to detach to me with a debugger!! ");
printf("haha My PID is %d\n", getpid());
while (1) {
printf("%d\n", n++);
sleep(1);
}
}
exit(0);
}

A developer is no longer able to attach GDB, strace or LLDB to this program
without killing the initproc (your favourite system daemon).. this action
would be fatal for the operation of the whole Operating System stability.

Examples from a current non-NetBSD popular kernel:

$ ps -o ppid= -p 17904
1

$ strace -p 17904
strace: attach: ptrace(PTRACE_SEIZE, 17904): Operation not permitted

$ gdb -p 17904
[...]
Attaching to process 17904
warning: process 17904 is already traced by process 1
ptrace: Operation not permitted.
(gdb)

$ lldb-3.9 -p 17904
(lldb) process attach --pid 17904
error: attach failed: unable to attach

On NetBSD 8.0 and newer it is now guaranteed to have an option to kill
a malevolent (fake?) debugger and attach with a new tracer to the process.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 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/crypto/external/bsd/heimdal/dist/kdc

2018-04-28 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sun Apr 29 05:36:04 UTC 2018

Modified Files:
src/crypto/external/bsd/heimdal/dist/kdc: connect.c

Log Message:
avoid busy-waiting on a dead child


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/crypto/external/bsd/heimdal/dist/kdc/connect.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/sys

2018-04-28 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 29 06:52:55 UTC 2018

Modified Files:
src/sys/sys: mbuf.h

Log Message:
Add KASSERTs in the rcvif functions.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/sys/mbuf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.