aboutsummaryrefslogtreecommitdiff
path: root/tests
Commit message (Collapse)AuthorAgeFilesLines
* Fix lseek(SEEK_DATA/SEEK_HOLE) mmap consistencyBrian Behlendorf2022-03-153-0/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When using lseek(2) to report data/holes memory mapped regions of the file were ignored. This could result in incorrect results. To handle this zfs_holey_common() was updated to asynchronously writeback any dirty mmap(2) regions prior to reporting holes. Additionally, while not strictly required, the dn_struct_rwlock is now held over the dirty check to prevent the dnode structure from changing. This ensures that a clean dnode can't be dirtied before the data/hole is located. The range lock is now also taken to ensure the call cannot race with zfs_write(). Furthermore, the code was refactored to provide a dnode_is_dirty() helper function which checks the dnode for any dirty records to determine its dirtiness. Reviewed-by: Matthew Ahrens <mahrens@delphix.com> Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Rich Ercolani <rincebrain@gmail.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #11900 Closes #12724 (cherry picked from commit 664d487a5dbd758216ac613934a4080fcc1de347) Approved by: so Security: FreeBSD-EN-22:11.zfs
* Fix dst/netmask handling in routing socket code.Alexander V. Chernikov2021-03-111-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 Approved by: re(gjb) Differential Revision: https://reviews.freebsd.org/D28668 (cherry picked from commit e1bdecd9f60a80604a351e38cab7cfc56e308c66)
* Remove __NO_TLS.Konstantin Belousov2021-03-021-1/+0
| | | | | | Approved by: re (gjb) (cherry picked from commit 3ae8d83d04a7a6ec11b64c89ee60c180b0bde30e)
* bc: Correct mis-merge of contrib/bc on upgrade to version 3.2.6Stefan Eßer2021-02-09148-5067/+0
| | | | | | | | | | | | | | | | | Revert "bc: Vendor import of Gavin Howard's bc version 3.2.6" This reverts commit 601ac82194693fcae9d7d2a7ec7d66ebaf3fd61e. Vendor import of Gavin Howard's bc version 3.2.6 (cherry picked from commit 47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc) The files README.md and .gitignore had been lost and are restored by this commit. A lot of files used for fuzzing had been moved to a new place and still existed in their previous location. Delete the now obsolete files from the old location. Approved by: re
* bc: Vendor import of Gavin Howard's bc version 3.2.6Stefan Eßer2021-02-03148-0/+5067
| | | | (cherry picked from commit 47a52dc4d48f259ab7d9f9ba6b65f4f2331a22dc)
* 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
* pf tests: provoke tag hashing panicKristof Provost2020-11-241-0/+38
| | | | | | | | | | Attempt to provoke the panic fixed in r367987. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27350 Notes: svn path=/head/; revision=367990
* fd: free old file descriptor tables when not sharedRobert Wing2020-11-222-0/+269
| | | | | | | | | | | | | | | | | During the life of a process, new file descriptor tables may be allocated. When a new table is allocated, the old table is placed in a free list and held onto until all processes referencing them exit. When a new file descriptor table is allocated, the old file descriptor table can be freed when the current process has a single-thread and the file descriptor table is not being shared with any other processes. Reviewed by: kevans Approved by: kevans (mentor) Differential Revision: https://reviews.freebsd.org/D18617 Notes: svn path=/head/; revision=367927
* pf tests: Basic source tracking testKristof Provost2020-11-202-0/+67
| | | | | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27255 Notes: svn path=/head/; revision=367869
* Add a regression test for the port-selection behavior fixed in r367680.Jonathan T. Looney2020-11-142-1/+336
| | | | | | | | | Reviewed by: markj, olivier, tuexen Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D27173 Notes: svn path=/head/; revision=367685
* [tests] Fix unused variable warning in gccAdrian Chadd2020-11-131-2/+1
| | | | | | | | | Reviewed by: markj, imp, cem, Approved by: markj Differential Revision: https://reviews.freebsd.org/D26792 Notes: svn path=/head/; revision=367647
* cryptotest: Add qat(4) coverageMark Johnston2020-11-051-2/+3
| | | | | | | | MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Notes: svn path=/head/; revision=367388
* Make the tests work without COMPAT_FREEBSD12 in kernel.Jung-uk Kim2020-11-043-6/+6
| | | | | | | | | sysctl 'kern.cryptodevallowsoft' was renamed to 'kern.crypto.allow_soft' in r359374 and the prevous one is only available in kernel built with "options COMPAT_FREEBSD12". Notes: svn path=/head/; revision=367351
* Add ossl(4) to cryptotest.Jung-uk Kim2020-10-302-2/+3
| | | | Notes: svn path=/head/; revision=367185
* Drop "All rights reserved" from all my stuff. This includesEdward Tomasz Napierala2020-10-2812-12/+0
| | | | | | | | | | | | Foundation copyrights, approved by emaste@. It does not include files which carry other people's copyrights; if you're one of those people, feel free to make similar change. Reviewed by: emaste, imp, gbe (manpages) Differential Revision: https://reviews.freebsd.org/D26980 Notes: svn path=/head/; revision=367105
* Do not recommend to install kyua with pkg in the tests READMEMateusz Piotrowski2020-10-271-6/+4
| | | | | | | | | Kyua is now available in the base system. While here, reword the usage section a bit. Notes: svn path=/head/; revision=367074
* Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q).Alexander V. Chernikov2020-10-211-0/+178
| | | | | | | | | | | | | | | | | | | | | 802.1ad interfaces are created with ifconfig using the "vlanproto" parameter. Eg., the following creates a 802.1Q VLAN (id #42) over a 802.1ad S-VLAN (id #5) over a physical Ethernet interface (em0). ifconfig vlan5 create vlandev em0 vlan 5 vlanproto 802.1ad up ifconfig vlan42 create vlandev vlan5 vlan 42 inet 10.5.42.1/24 VLAN_MTU, VLAN_HWCSUM and VLAN_TSO capabilities should be properly supported. VLAN_HWTAGGING is only partially supported, as there is currently no IFCAP_VLAN_* denoting the possibility to set the VLAN EtherType to anything else than 0x8100 (802.1ad uses 0x88A8). Submitted by: Olivier Piras Sponsored by: RG Nets Differential Revision: https://reviews.freebsd.org/D26436 Notes: svn path=/head/; revision=366917
* Try to enable multipath routing in flowid tests.Alexander V. Chernikov2020-10-162-2/+25
| | | | Notes: svn path=/head/; revision=366773
* Fix write only mappings on arm64Andrew Turner2020-10-131-0/+16
| | | | | | | | | | | | When trapping on a wrote access to a buffer the kernel has mapped as write only we should only pass the VM_PROT_WRITE flag. Previously the call to vm_fault_trap as the VM_PROT_READ flag was unexpected. Reported by: manu Sponsored by: Innovate UK Notes: svn path=/head/; revision=366665
* pf tests: Test that 'set skip on <group>' works on new group membersKristof Provost2020-10-121-0/+33
| | | | | | | | | | | | | | | There's a know issue where new group members don't get the 'set skip on' applied until the rules are re-loaded. Do this by setting rules that block all traffic, but skip members of the 'epair' group. If we can communicate over the epair interface we know the set skip rule took effect, even if the rule was set before the interface was created. MFC after: 2 weeks Notes: svn path=/head/; revision=366648
* Temporarily skip failing test cases in CI:Li-Wen Hsu2020-10-071-0/+6
| | | | | | | | | | | sys.capsicum.functional.Capability__NoBypassDAC sys.capsicum.functional.Pdfork__OtherUserForked PR: 250178, 250179 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=366512
* Skip test written in Googltest in the wrapper scriptLi-Wen Hsu2020-10-071-1/+4
| | | | | | | | | | | This leaves the main test body untouched and only skip running in the CI env, makes doing local test easier while developing. PR: 244165 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=366509
* Temporarily skip failing test cases in CI:Li-Wen Hsu2020-10-061-1/+21
| | | | | | | | | | | sys.capsicum.functional.ForkedOpenatTest_WithFlagInCapabilityMode___ sys.capsicum.functional.OpenatTest__WithFlag PR: 249960 Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=366485
* Make capsicum test cases fine-grainedLi-Wen Hsu2020-10-062-1/+70
| | | | | | | | | | | | | | | Add a wrapping script to use ATF to run tests written with Googletest one by one. This helps locating and tracking the failing case in CI easier. This is a temporarily solution while Googletest support in Kyua is developing. We will revert this once Kyua+Googletest integration is ready. Reviewed by: emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D25896 Notes: svn path=/head/; revision=366470
* Clear the dmesg buffer to prevent rotating causes issuesLi-Wen Hsu2020-10-061-0/+2
| | | | | | | | | | | | | | | This is a workaround for the current continuously failing test case sys.kern.sonewconn_overflow.sonewconn_overflow_01 The side effect is the dmesg buffer got cleared and may effect other tests depends on dmesg output running in parallel. The better solution would be tailing the log file like /var/log/debug.log Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=366469
* Fix route flags update during RTM_CHANGE.Alexander V. Chernikov2020-10-041-11/+111
| | | | | | | | | | | | | | | | | | | Nexthop lookup was not consireding rt_flags when doing structure comparison, which lead to an original nexthop selection when changing flags. Fix the case by adding rt_flags field into comparison and rearranging nhop_priv fields to allow for efficient matching. Fix `route change X/Y flags` case - recent changes disallowed specifying RTF_GATEWAY flag without actual gateway. It turns out, route(8) fills in RTF_GATEWAY by default, unless -interface flag is specified. Fix regression by clearing RTF_GATEWAY flag instead of failing. Fix route flag reporting in RTM_CHANGE messages by explicitly updating rtm_flags after operation competion. Add IPv4/IPv6 tests for flag-only route changes. Notes: svn path=/head/; revision=366424
* fusefs tests: quell Coverity "Argument cannot be negative" warningsAlan Somers2020-10-029-55/+55
| | | | | | | | | | | | | Must abort tests early if open(2) fails. Reported by: Coverity Coverity CID: 1432810 and many others Reviewed by: kevans MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26635 Notes: svn path=/head/; revision=366365
* Do a sweep and remove most WARNS=6 settingsKyle Evans2020-10-0114-26/+0
| | | | | | | | | | | | | | | Repeating the default WARNS here makes it slightly more difficult to experiment with default WARNS changes, e.g. if we did something absolutely bananas and introduced a WARNS=7 and wanted to try lifting the default to that. Drop most of them; there is one in the blake2 kernel module, but I suspect it should be dropped -- the default WARNS in the rest of the build doesn't currently apply to kernel modules, and I haven't put too much thought into whether it makes sense to make it so. Notes: svn path=/head/; revision=366304