Commit graph

1178 commits

Author SHA1 Message Date
Warner Losh
fb732c57f1 Fix copyright to be like all my others in the tree
(cherry picked from commit 09f1ead230)
2021-12-06 08:55:57 -07:00
Warner Losh
359f5cf29f Basic signal tests: Can we deliver a signal?
Basic signal tests that tests can we deliver a signal via raise() and
can we deliver one via SIGALARM asynchronously.

In addition, tests whether or not on ARM T32 (Thumb) code can interrupt
A32 (normal) and vice versa.

While this test is aimed at ensuring basic qemu signals are working,
it's good to have in the base.

Sponsored by:		Netflix
Discussed with:		kevans, cognet
Differential Revision:	https://reviews.freebsd.org/D33078

(cherry picked from commit afc5ab870d)
2021-12-06 08:55:57 -07:00
Kristof Provost
1019910199 pf tests: Test PR259689
We didn't populate dyncnt/tblcnt, so `pfctl -sr -vv` might not have the
table element count.

PR:		259689
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32893

(cherry picked from commit 2de49deeca)
2021-12-01 16:53:20 +01:00
Kristof Provost
a40b765118 net tests: basic if_stf test
Test the 6to4 code.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32850

(cherry picked from commit eb5e0755f7)
2021-12-01 16:53:19 +01:00
Kristof Provost
9bb3c824f5 net tests: basic if_gif(4) test case
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32836

(cherry picked from commit 6e0755b37b)
2021-11-29 15:44:40 +01:00
Ed Maste
ee2e925603 Fix coredump_phnum test with ASLR enabled
coredump_phnum intends to generate a core file with many PT_LOAD
segments.  Previously it called mmap() in a loop with alternating
protections, relying on each mapping following the previous, to produce
a core file with many page-sized PT_LOAD segments.  With ASLR on we no
longer have this property of each mmap() following the previous.

Instead, perform a single allocation, and then use mprotect() to set
alternating pages to PROT_READ.

PR:		259970
Reported by:	lwhsu, mw
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33070

(cherry picked from commit 8ec4c5dae3)
2021-11-27 19:27:03 -05:00
Kristof Provost
07b8f5dca1 pf tests: basic test for ridentifier
MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32751

(cherry picked from commit 508161111d)
2021-11-26 04:39:33 +01:00
Kristof Provost
094b79ea73 pf tests: route_to:icmp_nat_head requires scapy
Document the requirement so the test is skipped if scapy is not
installed.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 11703705c2)
2021-11-24 17:45:51 +01:00
John Baldwin
abb212fe13 ktls tests: Check the return values of close().
Suggested by:	markj
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D33004

(cherry picked from commit 694c708d6a)
2021-11-23 15:11:54 -08:00
John Baldwin
b2d704ea88 ktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.
The TLS header length field is set by the kernel, so if it is
incorrect that is an indication of a kernel bug, not an internal error
in the tests.

Prompted by:	markj (comment in an earlier review)
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D33003

(cherry picked from commit d71830cdf0)
2021-11-23 15:11:54 -08:00
John Baldwin
6987f78ea1 ktls: Add tests ensuring unsupported receive cipher suites are rejected.
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32982

(cherry picked from commit 83a54b582f)
2021-11-23 15:11:54 -08:00
John Baldwin
e91446cd84 ktls: Add tests ensuring invalid receive cipher suites are rejected.
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32981

(cherry picked from commit 233ce578a4)
2021-11-23 15:11:54 -08:00
John Baldwin
38b44748ab ktls: Add simple receive tests of kernel TLS.
Similar to the simple transmit tests added in
a10482ea74, these tests test the kernel
TLS functionality directly by manually encrypting TLS records using
randomly generated keys and writing them to a socket to be processed
by the kernel.

Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32980

(cherry picked from commit 3e7f8a8da2)
2021-11-23 15:11:53 -08:00
John Baldwin
32993b8e58 ktls: Add tests ensuring various invalid cipher suites are rejected.
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32843

(cherry picked from commit d1c369f926)
2021-11-23 15:11:53 -08:00
John Baldwin
27d29db0fa ktls: Add tests for sending empty fragments for TLS 1.0 connections.
Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32841

(cherry picked from commit 0ff2a12ae3)
2021-11-23 15:11:53 -08:00
John Baldwin
9b6f4b35d2 ktls: Add padding tests for AES-CBC MTE cipher suites.
For each AES-CBC MTE cipher suite, test sending records with 1 to 16
bytes of payload.  This ensures that all of the potential padding
values are covered.

Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32840

(cherry picked from commit 44265dc3da)
2021-11-23 15:11:53 -08:00
Ed Maste
64ecbc0cd3 tests: do not build ktls_test if WITHOUT_OPENSSL
ktls_test requires libcrypto to build, and fails if it is not available
(which is the case when building WITHOUT_OPENSSL).

Reported by:	Michael Dexter, Build Option Survey
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32895

(cherry picked from commit e818178e3a)
2021-11-23 15:11:45 -08:00
John Baldwin
71e6792cbe ktls: Add simple transmit tests of kernel TLS.
Note that these tests test the kernel TLS functionality directly.
Rather than using OpenSSL to perform negotiation and generate keys,
these tests generate random keys send data over a pair of TCP sockets
manually decrypting the TLS records generated by the kernel.

Reviewed by:	markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D32652

(cherry picked from commit a10482ea74)
2021-11-23 15:11:45 -08:00
Marius Halden
b6237b8089 carp tests: negative demotion
PR:		259528
Reviewed by:	donner
MFC after:	3 weeks
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32760

(cherry picked from commit 847b0d07c4)
2021-11-22 02:55:07 +01:00
Kristof Provost
b0010a4931 pf tests: test NAT-ed ICMP errors
Ensure that the ICMP error is returned with the correct
source and destination addresses.

MFC after:	3 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D32572

(cherry picked from commit 30276ef12c)
2021-11-14 00:15:37 +01:00
Mark Johnston
c5bd130deb bitset: Reimplement BIT_FOREACH_IS(SET|CLR)
Eliminate the nested loops and re-implement following a suggestion from
rlibby.

Add some simple regression tests.

Reviewed by:	rlibby, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 51425cb210)
2021-11-01 09:20:11 -04:00
Kristof Provost
9365113e89 pf tests: ensure that $nr expansion is correct
Test the $nr expansion in labels is correct, even if the optimiser
reduces the rule count.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32489

(cherry picked from commit 914ec9c78d)
2021-10-22 09:34:33 +02:00
John Baldwin
dffa7f13db crypto: Test all of the AES-CCM KAT vectors.
Previously, only test vectors which used the default nonce and tag
sizes (12 and 16, respectively) were tested.  This now tests all of
the vectors.  This exposed some additional issues around requests with
an empty payload (which wasn't supported) and an empty AAD (which
falls back to CIOCCRYPT instead of CIOCCRYPTAEAD).

- Make use of the 'ivlen' and 'maclen' fields for CIOGSESSION2 to
  test AES-CCM vectors with non-default nonce and tag lengths.

- Permit requests with an empty payload.

- Permit an input MAC for requests without AAD.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32121

(cherry picked from commit 668770dc7d)
2021-10-21 14:19:24 -07:00
Mark Johnston
54a01b5326 vfs: Permit unix sockets to be opened with O_PATH
As with FIFOs, a path descriptor for a unix socket cannot be used with
kevent().

In principle connectat(2) and bindat(2) could be modified to support an
AT_EMPTY_PATH-like mode which operates on the socket referenced by an
O_PATH fd referencing a unix socket.  That would eliminate the path
length limit imposed by sockaddr_un.

Update O_PATH tests.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2bd9826995)
2021-10-17 17:15:44 -04:00
Mitchell Horne
d925085dcd riscv: fix VM_MAXUSER_ADDRESS checks in asm routines
There are two issues with the checks against VM_MAXUSER_ADDRESS. First,
the comparison should consider the values as unsigned, otherwise
addresses with the high bit set will fail to branch. Second, the value
of VM_MAXUSER_ADDRESS is, by convention, one larger than the maximum
mappable user address and invalid itself. Thus, use the bgeu instruction
for these comparisons.

Add a regression test case for copyin(9).

PR:		257193
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31209

(cherry picked from commit 8babb5582e)
2021-10-15 12:22:13 -03:00
Konstantin Belousov
5018dfb90f tests/sys/fs/fusefs/read.cc: fix build on powerpc64
There sig_atomic_t is shorter than void *.
As result, it cannot keep pointer.

Assigning to void * is actually safe for us in a signal handler.

(cherry picked from commit 3fcbde5e88)
2021-10-08 00:15:05 -05:00
Alan Somers
5dc6fedeb4 fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES
During VOP_GETPAGES, fusefs needs to determine the file's length, which
could require a FUSE_GETATTR operation.  If that fails, it's better to
SIGBUS than panic.

Sponsored by:	Axcient
Reviewed by: 	markj, kib
Differential Revision: https://reviews.freebsd.org/D31994

(cherry picked from commit 4f917847c9)
2021-10-07 15:43:45 -06:00
Alan Somers
4bfd530cca aio: revert the workaround for bug 251828 in the tests
This bug is no longer reproducible in 14.0-CURRENT and 13.0-RELEASE

PR:		251828
Reported by:	markj
Reviewed by:	markj
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D31535

(cherry picked from commit 825fb07c55)
2021-10-07 15:38:25 -06:00
Kristof Provost
4747ec0839 pf tests: Basic adaptive mode syncookie test
MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32139

(cherry picked from commit 2f20d80692)
2021-10-06 10:46:54 +02:00
Kristof Provost
767b29877e pf tests: Basic syncookie test
MFC after:	1 week
Sponsored by:	Modirum MDPay
Differential Revision:	https://reviews.freebsd.org/D32138

(cherry picked from commit dc0636636b)
2021-10-06 10:46:54 +02:00
Kyle Evans
121740e185 kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME
NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejected.  We
don't reject times in the past in general, so clamp this up to 0 as
needed such that the timer fires immediately rather than imposing what
looks like an arbitrary restriction.

Another possible scenario is that the system clock had to be adjusted
by ~minutes or ~hours and we have less than that in terms of uptime,
making a reasonable short-timeout suddenly invalid. Firing it is still
a valid choice in this scenario so that applications can at least
expect a consistent behavior.

(cherry picked from commit 9c999a259f)
(cherry picked from commit 2f4dbe279f)
2021-10-06 02:03:53 -05:00
Mark Johnston
8b1039f918 tests/sys/sys: Raise WARNS
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d7cf1b262f)
2021-10-01 10:06:41 -04:00
Li-Wen Hsu
60921d4b2d
gmultipath failloop test: Add a checker for dtrace executes successfully or not
To provide a more informative error message.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 819961c580)
(cherry picked from commit 38dac71d0a)
(cherry picked from commit b9b5a4dd59)
2021-09-30 11:57:06 +08:00
Li-Wen Hsu
095d3f98fb
Temporarily skip flaky tset cases under sys.aio.aio_test in CI
- sys.aio.aio_test.vectored_unaligned
- sys.aio.aio_test.vectored_zvol_poll

PR:		258766
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0b159faaca)
2021-09-30 03:38:35 +08:00
Kristof Provost
2134d9f05f pf tests: synproxy to localhost test
Test syn-proxying a connection to the local host.

Sponsored by:	Modirum MDPay
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D31854

(cherry picked from commit 6598cababf)
2021-09-17 17:55:40 +02:00
Mark Johnston
4bfe0d4059 path_test: Fix test sorting
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c4c6615324)
2021-09-15 09:09:32 -04:00
Mark Johnston
91533b4cd4 path_test: Fix the unix socket test
The intent was to specify O_PATH to open(2).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8b83b656a5)
2021-09-15 09:09:18 -04:00
Kristof Provost
d14ea58c22 netpfil tests: IPv6 dummynet queue test
Same as the v4 test, but with IPv6.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31789

(cherry picked from commit 12184311c1)
2021-09-14 22:00:25 +02:00
Kristof Provost
7674a7e404 netpfil tests: dummynet queue test
Test prioritisation and dummynet queues.
We need to give the pipe sufficient bandwidth for dummynet to work.
Given that we can't rely on the TCP connection failing alltogether, but
we can measure the effect of dummynet by imposing a time limit on a
larger data transfer.

If TCP is prioritised it'll get most of the pipe bandwidth and easily
manage to transfer the data in 3 seconds or less. When not prioritised
this will not succeed.

MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31788

(cherry picked from commit cb6bfef9ca)
2021-09-14 22:00:25 +02:00
Kristof Provost
c7e2400924 dummynet tests: pipe test for IPv6
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31787

(cherry picked from commit 5fda5913e1)
2021-09-14 22:00:24 +02:00
Kristof Provost
119806a6b7 pf tests: altq:codel_bridge requires if_bridge
Check that the bridge module is loaded before running this test.
It likely will be (as a result of running the bridge tests), but if it's
not we'll get spurious failures.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit d491b42535)
2021-09-04 14:25:49 +02:00
Kristof Provost
518ea72e95 pf tests: Test ALTQ on top of if_bridge
Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31676

(cherry picked from commit 062463698e)
2021-09-01 15:27:01 +02:00
Kristof Provost
4defcd9078 pf tests: ALTQ priority test
Test that ALTQ can prioritise one type of traffic over another. Do this
by establishing a slow link and saturating it with ICMP echos.
When prioritised TCP connections reliably go through. When not
prioritised TCP connections reliably fail.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit cd46399b9c)
2021-09-01 15:27:01 +02:00
Kristof Provost
f610aafaed pf tests: test ALTQ CBQ on top of if_vlan
The main purpose of this test is to verify that we can use ALTQ on top
of if_vlan, but while we're here we also exercise the CBQ code. There's
already a basis test for HFSC, so it makes sense to test another
algorithm while we test if_vlan.

Reviewed by:	donner
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D31649

(cherry picked from commit e62175df4e)
2021-09-01 15:27:01 +02:00
Cyril Zhang
2d4c599e7d vmm: Add credential to cdev object
Add a credential to the cdev object in sysctl_vmm_create(), then check
that we have the correct credentials in sysctl_vmm_destroy(). This
prevents a process in one jail from opening or destroying the /dev/vmm
file corresponding to a VM in a sibling jail.

Add regression tests.

Reviewed by:	jhb, markj
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a85404906b)
2021-09-01 09:07:42 -04:00
Dimitry Andric
e9dbd59b30 Silence more gtest warnings, now in fusefs tests
Follow-up d396c67f26 by also silencing warnings about deprecated
implicit copy constructors in the fusefs tests, which use googletest.

Fixes:		d396c67f26

(cherry picked from commit 5a3a8cb01a)
2021-08-31 21:05:47 +02:00
Kristof Provost
5b7336a489 pf tests: test killing states by ID
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit bbf832f344)
2021-08-31 09:47:27 +02:00
Kristof Provost
c2a5910552 netinet tests: delete an interface with pending lookups
This has been known to trigger panics. It currently doesn't, but we may
as well have a test for it.

MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e86469075c)
2021-08-24 09:03:21 +02:00
Alexander V. Chernikov
a6daf4d500 Add arp/ndp tests in addition to rtsock ll tests.
(cherry picked from commit f17f94cd1b)
2021-08-24 09:02:15 +02:00
Vladimir Kondratyev
8f559509a2 bitstring(3): Add bitstring traversal macros.
The macro bit_foreach() traverses all set bits in the bitstring in the
forward direction, assigning each location in turn to variable.

The macro bit_foreach_at() traverses all set bits in the bitstring in
the forward direction at or after the zero-based bit index, assigning
each location in turn to variable.

The bit_foreach_unset() and bit_foreach_unset_at() macros which
traverses unset bits are implemented for completeness.

Reviewed by:	asomers, dougm

(cherry picked from commit 14a4d6d013)
2021-08-24 01:23:10 +03:00