Commit Graph

258406 Commits

Author SHA1 Message Date
christos fef18fab8e fix the build: tcpiphdr is now defined in tcp_var.h and tcp_var.h needs
tcp_timer.h. This struct move is more trouble than its worth. It breaks
header compatibility with other BSD's and can't be really removed because
it is an installed header that will break other 3rd party software. I
suggest that it gets reverted!
2018-04-29 15:59:07 +00:00
christos c796a4efe9 keep going if there is a CVS directory already, but warn 2018-04-29 15:47:01 +00:00
maxv 417565290f Remove useless icmp6.h include, remove manual externs and include in6.h
to get proper definitions, and remove duplicate logic in
ipsec6_common_input_cb.
2018-04-29 14:54:09 +00:00
maxv fa4d17703e Remove obsolete/dead code, the IP-in-IP encapsulation doesn't work this
way anymore (XF_IP4 partly dropped by FAST_IPSEC).
2018-04-29 14:35:35 +00:00
sevan d57d6d22a8 Add the following functions to the list (TODO - add descriptions)
netpgp_unsetvar
netpgp_list_keys_json
netpgp_match_keys
netpgp_match_keys_json
netpgp_match_pubkeys
netpgp_validate_sigs
netpgp_format_json

Remove netpgp_match_list_keys() as function does not exist

Add missing output file to netpgp_verify_file() argument list

Sprinkle const to arguments
2018-04-29 14:21:16 +00:00
kamil 66a7857d57 Add two new ptrace(2) ATF tests
Added:

 - traceme_pid1_parent
   Assert that a process cannot mark its parent a debugger twice

 - traceme_twice
   Verify that PT_TRACE_ME is not allowed when our parent is PID1

All tests pass.

Sponsored by <The NetBSD Foundation>
2018-04-29 13:56:00 +00:00
maxv 24e9c1c9d0 Move struct tcpiphdr from tcpip.h to tcp_var.h, to match UDP (udpiphdr in
udp_var.h).

tcpip.h is now empty, and can be removed.
2018-04-29 12:12:42 +00:00
ryo c16ac9a2d9 fix KASSERT panic. pv_entry may not be exists in pvlist when pmap_remove(). 2018-04-29 12:07:05 +00:00
ryo 591dd654f8 delete unused code 2018-04-29 12:05:39 +00:00
maxv d920327205 Remove unused and misleading argument from ipsec_set_policy. 2018-04-29 11:51:08 +00:00
maxv dfacb206a8 Remove unused function. 2018-04-29 11:42:09 +00:00
maxv dc72a4cb13 Remove duplicate prototype. 2018-04-29 07:24:38 +00:00
maxv 8fc5fcd18c Add missing pserialize_read_exit in error branch, spotted during my
previous commit.
2018-04-29 07:16:28 +00:00
maxv 37402c2ad5 Remove references to m_copy in comments. 2018-04-29 07:13:10 +00:00
maxv 31407650d2 Replace
m_copym(m, 0, M_COPYALL, M_DONTWAIT)
by
	m_copypacket(m, M_DONTWAIT)
when it is obvious that 'm' has M_PKTHDR set.
2018-04-29 07:05:13 +00:00
maxv d0685720cb Add KASSERTs in the rcvif functions. 2018-04-29 06:52:55 +00:00
spz 3d2ae3570c avoid busy-waiting on a dead child 2018-04-29 05:36:04 +00:00
kamil 3e684ebdec 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 <sys/types.h>
#include <sys/ptrace.h>

#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>

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 <The NetBSD Foundation>
2018-04-29 04:28:09 +00:00
jmcneill 04e10e3e38 Enable motg 2018-04-28 20:35:05 +00:00
jmcneill 8fa5d113ea Enable Allwinner SID and thermal sensor controller 2018-04-28 20:30:50 +00:00
kamil 7c9ce7b74f 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 <The NetBSD Foundation>
2018-04-28 19:00:25 +00:00
jmcneill 33212e89bd 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 2018-04-28 18:47:53 +00:00
jmcneill 1eecc1e024 Add sun50i-a64-teres-i.dts, sun50i-h5-orangepi-zero-plus.dts 2018-04-28 18:42:20 +00:00
jmcneill 5985fb0710 Update to Linux dts 4.17-rc2 2018-04-28 18:29:21 +00:00
jmcneill c6ee38088e merge conflicts 2018-04-28 18:28:25 +00:00
jakllsch f6c244b639 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.
2018-04-28 18:26:53 +00:00
jmcneill a2acc37588 Import dts from Linux 4.17-rc2 2018-04-28 18:25:52 +00:00
kamil 736f73b24b 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 <The NetBSD Foundation>
2018-04-28 18:07:15 +00:00
kamil f738c48337 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 <The NetBSD Foundation>
2018-04-28 17:56:55 +00:00
ryo e11b270d28 Oops, my previous commit is totally wrong. recast mask/pattern list.
pointed out by David Binderman in PR/53224, thanks.
2018-04-28 17:42:07 +00:00
maxv 68df48a8f0 Remove IPSEC_SPLASSERT_SOFTNET, it has always been a no-op. 2018-04-28 15:45:16 +00:00
jmcneill a756758d12 Initialize clk domain name and call clk_attach to register sysctl nodes 2018-04-28 15:21:05 +00:00
jmcneill ed41487b0c Create private sysctl nodes for inspecting clock trees. 2018-04-28 15:20:33 +00:00
maxv f193022c1a Inline M_EXT_WRITABLE directly, and remove the XXX, there's nothing wrong
in the use of !M_READONLY.
2018-04-28 14:39:34 +00:00
maxv c075b705a8 Move the ipsec6_input prototype into ipsec6.h, and style. 2018-04-28 14:25:56 +00:00
maxv 19f9cae6f8 Stop using a macro, rename the function to ipsec_init_pcbpolicy directly. 2018-04-28 14:21:03 +00:00
maxv 6f320ea66c Style and remove unused stuff. 2018-04-28 14:01:50 +00:00
maxv ab18d0d461 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.
2018-04-28 13:44:19 +00:00
riastradh 7bc66ed4ff Add -f option to ftpd to stay in foreground with -D.
From nia in PR bin/53221.
2018-04-28 13:38:00 +00:00
maxv 2489795f85 Remove unused ipsec_var.h includes. 2018-04-28 13:26:57 +00:00
maxv 2f2fea5f0e Remove unused macros. 2018-04-28 13:23:17 +00:00
jmcneill 3117ca5607 Create bpf and openfirm devices 2018-04-28 12:45:03 +00:00
jmcneill 6320cfdbae Define __HAVE_OLD_DISKLABEL for compatibility with the arm32 port. 2018-04-28 12:33:17 +00:00
nonaka d54c6989c4 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.
2018-04-28 12:20:40 +00:00
jmcneill 7ee63b91ad Add support for Pinebook lid switch and eMMC 2018-04-28 11:49:48 +00:00
jmcneill 75dc1f1c7e Add support for lid switch event codes. 2018-04-28 11:49:06 +00:00
jmcneill 11e00a763e Increase default MSGBUFSIZE to match arm32 defaults 2018-04-28 10:53:02 +00:00
maxv 70fbd42a2e Rename the 'flags' and 'nowait' arguments to 'how'. The other BSDs did the
same. Also, in m_defrag, rename 'mold' to 'm'.
2018-04-28 08:34:45 +00:00
maxv 7155a9b4d8 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.
2018-04-28 08:16:15 +00:00
mlelstv ac6073da9a regen 2018-04-28 05:12:54 +00:00