aboutsummaryrefslogtreecommitdiff
path: root/tests/sys
Commit message (Collapse)AuthorAgeFilesLines
* tests/sys/audit: add missing comma delimiter between fieldsAlex Richardson2021-03-021-0/+1
| | | | | | | | | This makes the `kyua report --verbose` output a lot easier to parse when looking at failed tests. It also fixes the closefrom() test since I tested my changes with this commit but forgot to push it together with fa32350347b4e351a144b5423f0fb2ca9d67f4ca. Fixes: fa32350347b4 ("close_range: add audit support")
* Simplify the capsicum-test wrapper scriptAlex Richardson2021-03-021-53/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of running tests one-by-one with the shell wrapper we now run the full gtest testsuite twice (once as root, once as non root). This significantly speeds up running tests despite running them twice. This change also passes the missing -u flag to capsicum-test that caused test failures (https://bugs.freebsd.org/250178) Previously, running the testsuite with the wrapper script took ~3s per test on aarch64 QEMU, i.e. a total of almost 5 minutes. Now it takes 6 seconds to run all tests twice. Before: root@freebsd-aarch64:/usr/tests/sys/capsicum # /usr/bin/time kyua test functional 94/96 passed (2 failed) 309.97 real 58.46 user 244.31 sys After: root@freebsd-aarch64:/usr/tests/sys/capsicum # /usr/bin/time kyua test functional functional:test_root -> passed [2.659s] functional:test_unprivileged -> passed [2.391s] 2/2 passed (0 failed) 5.48 real 1.06 user 2.52 sys This overhead is caused by kyua + atf-sh spawning lots of additional processes and can be avoided by just running the googletest test binary. syscall seconds calls errors fork 39.810229456 1275 0 sigprocmask 13.546928736 572 0 i.e. 1275 processes spawned to run a single test. Test Plan: All tests pass with D28907. PR: 250178 Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D29014
* Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40Alex Richardson2021-03-021-1/+1
| | | | | | | | | | | | | | This includes various fixes that I submitted recently such as updating the pdkill() tests for the actual implemented behaviour (https://github.com/google/capsicum-test/pull/53) and lots of changes to avoid calling sleep() and replacing it with reliable synchronization (pull requests 49,51,52,53,54). This should make the testsuite more reliable when running on Jenkins. Additionally, process status is now retrieved using libprocstat instead of running `ps` and parsing the output (https://github.com/google/capsicum-test/pull/50). This fixes one previously failing test and speeds up execution. Overall, this update reduces the total runtime from ~60s to about 4-5 seconds.
* Fix ptrace_test:ptrace__syscall_args after ATF upgradeAlex Richardson2021-03-011-2/+3
| | | | | | | | | ATF now opens the results file (without CLOEXEC), so the child actually has a valid file descriptor 3. To fix this simply use a large number that will definitely not be a valid file descriptor. Reviewed by: jhb, cem, lwhsu Differential Revision: https://reviews.freebsd.org/D28889
* Remove atf_tc_skip calls from ptrace_testAlex Richardson2021-03-011-27/+2
| | | | | | | | | | | I've run these tests many times in a loop on multiple architectures and it works reliably for me, maybe it's time to retire these skips? This also adds an additional waitpid to one of the tests to avoid a potential race condition (suggested by markj@). PR: 239397, 244056, 239425, 240510, 220841, 243605 Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D28888
* ptrace_test: Add more debug output on test failuresAlex Richardson2021-03-011-746/+770
| | | | | | | | | | | | | | | | Mostly automatic, using `CHILD_REQUIRE\(([^|&\n]*) ==` -> `CHILD_REQUIRE_EQ_INT($1,` `ATF_REQUIRE\(([^|&\n]*) ==` -> `REQUIRE_EQ_INT($1,` followed by git-clang-format -f and then manually checking ones that contain ||/&&. Test Plan: Still getting the same failure but now it prints `psr.sr_error (0) == EBADF (9) not met` instead of just failing without printing the values. PR: 243605 Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D28887
* tests/sys/netpfil/pf: Add missing python3 requirementsAlex Richardson2021-03-012-1/+3
| | | | | | | | | This also fixes a typo in the dup test that caused the head function to not be called. On my test system without python3 the tests are now skipped instead of failing. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D28903
* bridge tests: Test that we also forward on some interfacesKristof Provost2021-02-251-0/+18
| | | | | | | | | | Ensure that we not only block on some interfaces, but also forward on some. Without the previous commit we wound up discarding on all ports, rather than only on the ports needed to break the loop. MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28917
* Remove __NO_TLS.Konstantin Belousov2021-02-231-1/+0
| | | | | | | | | All supported platforms support thread-local vars and __thread. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28796
* close_range: add audit supportAlex Richardson2021-02-231-2/+2
| | | | | | | | | | | | | This fixes the closefrom test in sys/audit. Includes cherry-picks of the following commits from openbsm: https://github.com/openbsm/openbsm/commit/4dfc628aafe589d68848f7033f3d3488c4d979e0 https://github.com/openbsm/openbsm/commit/99ff6fe32aebc5a4b8d40d60062b8574697df557 https://github.com/openbsm/openbsm/commit/da48a0399e95448693d3fa2be48454ca564c1be8 Reviewed By: kevans Differential Revision: https://reviews.freebsd.org/D28388
* tests/sys/netgraph: Tell kyua that perl is requiredAlex Richardson2021-02-231-1/+2
| | | | | | | Otherwise these tests fail with incomprehensible error messages. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D28894
* bridge tests: Test STP on top of VLAN devicesKristof Provost2021-02-231-0/+66
| | | | | | | | | This is basically the same test as the existing STP test, but now on top of VLAN interfaces instead of directly using the epair devices. MFC after: 1 week Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D28861
* Add arp/ndp tests in addition to rtsock ll tests.Alexander V. Chernikov2021-02-204-2/+215
|
* tests/sys/audit: force PIE offEd Maste2021-02-191-0/+1
| | | | | | | | df093aa9463b linked against libprivateauditd.a, but that is currently (and incorrectly) built as position-dependent. For now just force PIE off for this test to fix the WITH_PIE build. Sponsored by: The FreeBSD Foundation
* tests/sys/audit: Avoid race caused by starting auditd(8) for testingAlex Richardson2021-02-183-12/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the CheriBSD CI we reproducibly see the first test in sys/audit (administrative:acct_failure) fail due to a missing startup message. It appears this is caused by a race condition when starting auditd: `service auditd onestart` returns as soon as the initial auditd() parent exits (after the daemon(3) call). We can avoid this problem by setting up the auditd infrastructure in-process: libauditd contains audit_quick_{start,stop}() functions that look like they are ideally suited to this task. This patch also avoids forking lots of shell processes for each of the 418 tests by using `auditon(A_SENDTRIGGER, &trigger, sizeof(trigger))` to check for a running auditd(8) instead of using `service auditd onestatus`. With these two changes (and D28388 to fix the XFAIL'd test) I can now boot and run `cd /usr/tests/sys/audit && kyua test` without any failures in a single-core QEMU instance. Before there would always be at least one failed test. Besides making the tests more reliable in CI, a nice side-effect of this change is that it also significantly speeds up running them by avoiding lots of fork()/execve() caused by shell scripts: Running kyua test on an AArch64 QEMU took 315s before and now takes 68s, so it's roughly 3.5 times faster. This effect is even larger when running on a CHERI-RISC-V QEMU since emulating CHERI instructions on an x86 host is noticeably slower than emulating AArch64. Test Plan: aarch64+amd64 QEMU no longer fail. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D28451
* pf tests: Explicitly ask for python3Kristof Provost2021-02-173-3/+3
| | | | | | | | If we install the scapy package (which we do list as a dependency) we don't automatically install python (but we do have python3). MFC after: 1 week Sponsored by: Rubicon Communications, LLC (“Netgate”’)
* Fix dst/netmask handling in routing socket code.Alexander V. Chernikov2021-02-161-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally routing socket code did almost zero checks on the input message except for the most basic size checks. This resulted in the unclear KPI boundary for the routing system code (`rtrequest*` and now `rib_action()`) w.r.t message validness. Multiple potential problems and nuances exists: * Host bits in RTAX_DST sockaddr. Existing applications do send prefixes with hostbits uncleared. Even `route(8)` does this, as they hope the kernel would do the job of fixing it. Code inside `rib_action()` needs to handle it on its own (see `rt_maskedcopy()` ugly hack). * There are multiple way of adding the host route: it can be DST without netmask or DST with /32(/128) netmask. Also, RTF_HOST has to be set correspondingly. Currently, these 2 options create 2 DIFFERENT routes in the kernel. * no sockaddr length/content checking for the "secondary" fields exists: nothing stops rtsock application to send sockaddr_in with length of 25 (instead of 16). Kernel will accept it, install to RIB as is and propagate to all rtsock consumers, potentially triggering bugs in their code. Same goes for sin_port, sin_zero, etc. The goal of this change is to make rtsock verify all sockaddr and prefix consistency. Said differently, `rib_action()` or internals should NOT require to change any of the sockaddrs supplied by `rt_addrinfo` structure due to incorrectness. To be more specific, this change implements the following: * sockaddr cleanup/validation check is added immediately after getting sockaddrs from rtm. * Per-family dst/netmask checks clears host bits in dst and zeros all dst/netmask "secondary" fields. * The same netmask checking code converts /32(/128) netmasks to "host" route case (NULL netmask, RTF_HOST), removing the dualism. * Instead of allowing ANY "known" sockaddr families (0<..<AF_MAX), allow only actually supported ones (inet, inet6, link). * Automatically convert `sockaddr_sdl` (AF_LINK) gateways to `sockaddr_sdl_short`. Reported by: Guy Yur <guyyur at gmail.com> Reviewed By: donner Differential Revision: https://reviews.freebsd.org/D28668 MFC after: 3 days
* pf tests: Test unicast reverse path forwarding checkKristof Provost2021-02-162-0/+119
| | | | | | | | | Ensure that pf's urpf-failed keyword works as expected. PR: 253479 MFC after: 1 week Reviewed by: melifaro@ Differential Revision: https://reviews.freebsd.org/D28694
* fusefs: set d_off during VOP_READDIRAlan Somers2021-02-132-10/+67
| | | | | | | | | | | | This allows d_off to be used with lseek to position the file so that getdirentries(2) will return the next entry. It is not used by readdir(3). PR: 253411 Reported by: John Millikin <jmillikin@gmail.com> Reviewed by: cem MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28605
* tests/sys/vfs/lookup_cap_dotdot: No longer aborts after ATF updateAlex Richardson2021-02-041-8/+1
| | | | | | It appears this test no longer fails after c203bd70b5957f85616424b6fa374479372d06e3. PR: 215690
* Fix build with read-only source dir after 83c20b8a2da0Alex Richardson2021-02-031-2/+4
| | | | | | | | | | I changed the Makefile to use SRCS instead of LDADD, but since there is still and absolute path to the source the .o file was created inside the source directory instead of the build directory. It would be nice if this was an error/warning by default, but for now just fix this issue by using .PATH and the base name of the file. Reported by: cy, peterj
* Allow setting alias port ranges in libalias and ipfw. This will allow a systemNeel Chauhan2021-02-021-1/+98
| | | | | | | | | to be a true RFC 6598 NAT444 setup, where each network segment (e.g. user, subnet) can have their own dedicated port aliasing ranges. Reviewed by: donner, kp Approved by: 0mp (mentor), donner, kp Differential Revision: https://reviews.freebsd.org/D23450
* tests/sys/audit: Skip extattr tests if extattrs are not supportedAlex Richardson2021-02-024-101/+173
| | | | | | | | | | | | | In the CheriBSD CI, we run the testsuite with /tmp as tmpfs. This causes the extattr audit tests to fail since tmpfs does not (yet) support extattrs. Skip those tests if the target path is on a file system that does not support extended file attributes. While touching these two files also convert the ATF_REQUIRE_EQ(-1, ...) checks to use ATF_REQURIE_ERRNO(). Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D28392
* tests/sys/kern/crc32: Check for SSE4.2 before using itAlex Richardson2021-02-022-39/+48
| | | | | | | | | | | This avoids a SIGILL when running these tests on QEMU (which defaults to a basic amd64 CPU without SSE4.2). This commit also tests the table-based implementations in addition to testing the hw-accelerated crc32 versions. Reviewed By: cem, kib, markj Differential Revision: https://reviews.freebsd.org/D28395
* tests/sys/audit: fix timeout calculationAlex Richardson2021-01-281-3/+8
| | | | | | | | | | | | | This changes the behaviour to a 30s total timeout (needed when running on slow emulated uniprocessor systems) and timing out after 10s without any input. This also uses timespecsub() instead of ignoring the nanoseconds field. After this change the tests runs more reliably on QEMU and time out less frequently. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D28391
* pf tests: Test that dup-to doesn't produce extra duplicate packetsKristof Provost2021-01-284-2/+119
|
* altq tests: Basic ALTQ testKristof Provost2021-01-253-1/+75
| | | | | | | Activate ALTQ_HFSC, crudely check if it really limits bandwidth as we'd expect. Reviewed by: donner@ Differential Revision: https://reviews.freebsd.org/D28303
* Split rtinit() into multiple functions.Alexander V. Chernikov2021-01-161-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rtinit[1]() is a function used to add or remove interface address prefix routes, similar to ifa_maintain_loopback_route(). It was intended to be family-agnostic. There is a problem with this approach in reality. 1) IPv6 code does not use it for the ifa routes. There is a separate layer, nd6_prelist_(), providing interface for maintaining interface routes. Its part, responsible for the actual route table interaction, mimics rtenty() code. 2) rtinit tries to combine multiple actions in the same function: constructing proper route attributes and handling iterations over multiple fibs, for the non-zero net.add_addr_allfibs use case. It notably increases the code complexity. 3) dstaddr handling. flags parameter re-uses RTF_ flags. As there is no special flag for p2p connections, host routes and p2p routes are handled in the same way. Additionally, mapping IFA flags to RTF flags makes the interface pretty messy. It make rtinit() to clash with ifa_mainain_loopback_route() for IPV4 interface aliases. 4) rtinit() is the last customer passing non-masked prefixes to rib_action(), complicating rib_action() implementation. 5) rtinit() coupled ifa announce/withdrawal notifications, producing "false positive" ifa messages in certain corner cases. To address all these points, the following has been done: * rtinit() has been split into multiple functions: - Route attribute construction were moved to the per-address-family functions, dealing with (2), (3) and (4). - funnction providing net.add_addr_allfibs handling and route rtsock notificaions is the new routing table inteface. - rtsock ifa notificaion has been moved out as well. resulting set of funcion are only responsible for the actual route notifications. Side effects: * /32 alias does not result in interface routes (/32 route and "host" route) * RTF_PINNED is now set for IPv6 prefixes corresponding to the interface addresses Differential revision: https://reviews.freebsd.org/D28186
* pf tests: pass NULL buffer to DIOCRCLRTSTATSKristof Provost2021-01-131-0/+5
| | | | | | As discovered by syzcaller this used to provoke panics. MFC after: 1 week
* lio_listio: validate aio_lio_opcodeAlan Somers2021-01-121-0/+51
| | | | | | | | | | | | | | | Previously, we would accept any kind of LIO_* opcode, including ones that were intended for in-kernel use only like LIO_SYNC (which is not defined in userland). The situation became more serious with 022ca2fc7fe08d51f33a1d23a9be49e6d132914e. After that revision, setting aio_lio_opcode to LIO_WRITEV or LIO_READV would trigger an assertion. Note that POSIX does not specify what should happen if aio_lio_opcode is invalid. MFC-with: 022ca2fc7fe08d51f33a1d23a9be49e6d132914e Reviewed by: jhb, tmunro, 0mp Differential Revision: <https://reviews.freebsd.org/D28078
* aio: fix the tests when ZFS is not availableAlan Somers2021-01-101-0/+4
| | | | | | | | Don't try to cleanup the zpool if we couldn't create a zpool in the first place. Submitted by: tmunro MFC-with: 022ca2fc7fe08d51f33a1d23a9be49e6d132914e
* aio_fsync(2): Support O_DSYNC.Thomas Munro2021-01-081-5/+18
| | | | | | | aio_fsync(O_DSYNC, ...) is the asynchronous version of fdatasync(2). Reviewed by: kib, asomers, jhb Differential Review: https://reviews.freebsd.org/D25071
* Add aio_writev and aio_readvAlan Somers2021-01-031-67/+672
| | | | | | | | | | | | | | POSIX AIO is great, but it lacks vectored I/O functions. This commit fixes that shortcoming by adding aio_writev and aio_readv. They aren't part of the standard, but they're an obvious extension. They work just like their synchronous equivalents pwritev and preadv. It isn't yet possible to use vectored aiocbs with lio_listio, but that could be added in the future. Reviewed by: jhb, kib, bcr Relnotes: yes Differential Revision: https://reviews.freebsd.org/D27743
* fusefs: implement FUSE_COPY_FILE_RANGE.Alan Somers2021-01-016-3/+531
| | | | | | | | | | This updates the FUSE protocol to 7.28, though most of the new features are optional and are not yet implemented. MFC after: 2 weeks Relnotes: yes Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D27818
* fusefs: fix an expectation in one of the testsAlan Somers2021-01-012-5/+3
| | | | | | | | | | An order-of-operations problem caused an expectation intended for FUSE_READ to instead match FUSE_ACCESS. Surprisingly, only one test case was affected. MFC after: 2 weeks Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D27818
* Fix i386 build following 37df9d3bba8577fcdd63382ff5a4a5cbb4aa55b4.Cy Schubert2021-01-011-3/+3
| | | | | MFC after: 2 weeks X-MFC with: 37df9d3bba8577fcdd63382ff5a4a5cbb4aa55b4
* fusefs: update FUSE protocol to 7.24 and implement FUSE_LSEEKAlan Somers2020-12-314-4/+394
| | | | | | | | | | FUSE_LSEEK reports holes on fuse file systems, and is used for example by bsdtar. MFC after: 2 weeks Relnotes: yes Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D27804
* fusefs: fix the tests for a wider range of maxphysAlan Somers2020-12-286-17/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | maxphys is now a tunable, ever since r368124. The default value is also larger than it used to be. That broke several fusefs tests that made assumptions about maxphys. * WriteCluster.clustering used the MAXPHYS compile-time constant. * WriteBackAsync.direct_io_partially_overlaps_cached_block implicitly depended on the default value of maxphys. Fix it by making the dependency explicit. * Write.write_large implicitly assumed that maxphys would be no more than twice maxbcachebuf. Fix it by explicitly setting m_max_write. * WriteCluster.clustering and several others failed because the MockFS module did not work for max_write > 128KB (which most tests would set when maxphys > 256KB). Limit max_write accordingly. This is the same as fusefs-libs's behavior. * Bmap's tests were originally written for MAXPHYS=128KB. With larger values, the simulated file size was too small. PR: 252096 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D27769
* pf tests: Verify (tcp) checksum modification on unaligned optionsKristof Provost2020-12-233-4/+151
| | | | | | | | | | | | | It turns out pf incorrectly updates the TCP checksum if the TCP option we're modifying is not 2-byte algined with respect to the start of the packet. Create a TCP packet with such an option and throw it through a scrub rule, which will update timestamps and modify the packet. PR: 240416 MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27688
* pf tests: Sort Makefile entriesKristof Provost2020-12-231-10/+10
| | | | MFC after: 1 week
* net tests: Re-enable most if_clone testsKristof Provost2020-12-171-16/+0
| | | | | | | | All but one of these (tap_ipv6_up_stress) currently pass, so we should enable them so we don't regress. Notes: svn path=/head/; revision=368743
* posixshm_test.c: remove tautological checksRyan Libby2020-12-111-2/+0
| | | | | | | | | Reviewed by: kib, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27564 Notes: svn path=/head/; revision=368570
* fdgrowtable_test.c: appease gccRyan Libby2020-12-111-1/+1
| | | | | | | | | | | | | Work around bogus gcc -Wreturn-type. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44511 Reviewed by: kevans, rew Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D27563 Notes: svn path=/head/; revision=368569
* New Netgraph module ng_macfilter:Nick Hibma2020-12-083-0/+445
| | | | | | | | | | | | | | | Macfilter to route packets through different hooks based on sender MAC address. Based on ng_macfilter written by Pekka Nikander Sponsered by Retina b.v. Reviewed by: afedorov MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27268 Notes: svn path=/head/; revision=368443
* ossl: port to arm64Mitchell Horne2020-12-041-1/+1
| | | | | | | | | | | | | | Enable in-kernel acceleration of SHA1 and SHA2 operations on arm64 by adding support for the ossl(4) crypto driver. This uses OpenSSL's assembly routines under the hood, which will detect and use SHA intrinsics if they are supported by the CPU. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27390 Notes: svn path=/head/; revision=368350
* pf tests: Test case for bug #251414Kristof Provost2020-12-021-0/+39
| | | | | | | | | | | | Changing a table from not having counters to having counters (or vice versa) may trigger panics. PR: 251414 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27441 Notes: svn path=/head/; revision=368277
* AIO tests: update expected failure messages after r368265Alan Somers2020-12-021-7/+2
| | | | | | | | | PR: 220398, 251515 MFC after: 1 week MFC-With: r368265 Notes: svn path=/head/; revision=368272
* pf tests: Re-enable panicing testsKristof Provost2020-12-013-6/+0
| | | | | | | | | | | We've fixed the vnet/epair cleanup race, so it is now safe to re-enable these tests. MFC after: 2 weeks Sponsored by: Modirum MDPay Notes: svn path=/head/; revision=368239
* ping: fix some man pages and tests after r368045Alan Somers2020-11-269-31/+31
| | | | | | | MFC-with: r368045 Notes: svn path=/head/; revision=368046
* Remove uses of CRIOGET in OCF tests after r368005.John Baldwin2020-11-253-32/+7
| | | | | | | | | Pointy hat to: jhb Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27367 Notes: svn path=/head/; revision=368008