aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* compat: handle backported rng and blake2sJason A. Donenfeld2022-06-221-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: give up on RHEL8 in CIJason A. Donenfeld2022-05-051-6/+0
| | | | | | | | | They keep breaking their kernel and being difficult when I send patches to fix it, so just give up on trying to support this in the CI. It'll bitrot and people will complain and we'll see what happens at that point. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: set panic_on_warn=1 from cmdlineJason A. Donenfeld2022-05-0514-19/+13
| | | | | | | | Rather than setting this once init is running, set panic_on_warn from the kernel command line, so that it catches splats from WireGuard initialization code and the various crypto selftests. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: use vports on armJason A. Donenfeld2022-05-055-6/+25
| | | | | | Rather than having to hack up QEMU, just use the virtio serial device. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: limit parallelism to $(nproc) tests at onceJason A. Donenfeld2022-05-051-10/+10
| | | | | | | | | | | The parallel tests were added to catch queueing issues from multiple cores. But what happens in reality when testing tons of processes is that these separate threads wind up fighting with the scheduler, and we wind up with contention in places we don't care about that decrease the chances of hitting a bug. So just do a test with the number of CPU cores, rather than trying to scale up arbitrarily. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: make routing loop test non-fatalJason A. Donenfeld2022-05-051-1/+13
| | | | | | | | | | | | | I hate to do this, but I still do not have a good solution to actually fix this bug across architectures. So just disable it for now, so that the CI can still deliver actionable results. This commit adds a large red warning, so that at least the failure isn't lost forever, and hopefully this can be revisited down the line. Link: https://lore.kernel.org/netdev/CAHmME9pv1x6C4TNdL6648HydD8r+txpV4hTUXOBVkrapBXH4QQ@mail.gmail.com/ Link: https://lore.kernel.org/netdev/YmszSXueTxYOC41G@zx2c4.com/ Link: https://lore.kernel.org/wireguard/CAHmME9rNnBiNvBstb7MPwK-7AmAN0sOfnhdR=eeLrowWcKxaaQ@mail.gmail.com/ Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: enable ACPI for SMPJason A. Donenfeld2022-04-062-0/+2
| | | | | | | | | It turns out that by having CONFIG_ACPI=n, we've been failing to boot additional CPUs, and so these systems were functionally UP. The code bloat is unfortunate for build times, but I don't see an alternative. So this commit sets CONFIG_ACPI=y for x86_64 and i686 configs. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: simplify RNG seedingJason A. Donenfeld2022-03-031-18/+8
| | | | | | | | | We don't actualy need to write anything in the pool. Instead, we just force the total over 128, and we should be good to go for all old kernels. We also only need this on getrandom() kernels, which simplifies things too. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* device: reset peer src endpoint when netns exitsJason A. Donenfeld2021-12-031-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Each peer's endpoint contains a dst_cache entry that takes a reference to another netdev. When the containing namespace exits, we take down the socket and prevent future sockets from being created (by setting creating_net to NULL), which removes that potential reference on the netns. However, it doesn't release references to the netns that a netdev cached in dst_cache might be taking, so the netns still might fail to exit. Since the socket is gimped anyway, we can simply clear all the dst_caches (by way of clearing the endpoint src), which will release all references. However, the current dst_cache_reset function only releases those references lazily. But it turns out that all of our usages of wg_socket_clear_peer_endpoint_src are called from contexts that are not exactly high-speed or bottle-necked. For example, when there's connection difficulty, or when userspace is reconfiguring the interface. And in particular for this patch, when the netns is exiting. So for those cases, it makes more sense to call dst_release immediately. For that, we add a small helper function to dst_cache. This patch also adds a test to netns.sh from Hangbin Liu to ensure this doesn't regress. Test-by: Hangbin Liu <liuhangbin@gmail.com> Reported-by: Xiumei Mu <xmu@redhat.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: actually test for routing loopsJason A. Donenfeld2021-12-031-1/+5
| | | | | | | | | | | | | We previously removed the restriction on looping to self, and then added a test to make sure the kernel didn't blow up during a routing loop. The kernel didn't blow up, thankfully, but on certain architectures where skb fragmentation is easier, such as ppc64, the skbs weren't actually being discarded after a few rounds through. But the test wasn't catching this. So actually test explicitly for massive increases in tx to see if we have a routing loop. Note that the actual loop problem will need to be addressed in a different commit. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: increase default dmesg log sizeJason A. Donenfeld2021-06-061-0/+1
| | | | | | | | | | The selftests currently parse the kernel log at the end to track potential memory leaks. With these tests now reading off the end of the buffer, due to recent optimizations, some creation messages were lost, making the tests think that there was a free without an alloc. Fix this by increasing the kernel log size. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: add disgusting hacks for RHEL 8Jason A. Donenfeld2021-06-061-1/+7
| | | | | | | | | Red Hat does awful things to their kernel for RHEL 8, such that it doesn't even compile in most configurations. This is utter craziness, and their response to me sending patches to fix this stuff has been to stonewall for months on end and then do nothing. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: make sure rp_filter is disabled on vethcJason A. Donenfeld2021-06-021-0/+1
| | | | | | | | Some distros may enable strict rp_filter by default, which will prevent vethc from receiving the packets with an unroutable reverse path address. Reported-by: Hangbin Liu <liuhangbin@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: bump default kernel versionJason A. Donenfeld2021-02-191-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* selftests: test multiple parallel streamsJason A. Donenfeld2021-02-181-1/+17
| | | | | | | | | | In order to test ndo_start_xmit being called in parallel, explicitly add separate tests, which should all run on different cores. This should help tease out bugs associated with queueing up packets from different cores in parallel. Currently, it hasn't found those types of bugs, but given future planned work, this is a useful regression to avoid. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: bump default testing versionJason A. Donenfeld2020-11-121-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: drop build support for rhel 8.2Jason A. Donenfeld2020-11-041-1/+0
| | | | | | This reverts commit feb89cab65c6ab1a6cbeeaaeb11b1a174772cea8. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: check that route_me_harder packets use the right skJason A. Donenfeld2020-10-292-0/+11
| | | | | | | | | | | | If netfilter changes the packet mark, the packet is rerouted. The ip_route_me_harder family of functions fails to use the right sk, opting to instead use skb->sk, resulting in a routing loop when used with tunnels. Fixing this inside of the compat layer with skb_orphan would work but would cause other problems, by disabling TSQ, so instead we warn if the calling kernel hasn't yet backported the fix for this. Reported-by: Chen Minqiang <ptpt52@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: workaround bad 5.2.y backportJason A. Donenfeld2020-06-221-1/+2
| | | | | | | | ca7a03c4175 was backported to 5.2 to fix 7d9e5f422150, but 7d9e5f422150 wasn't added until 5.3, so this fix for a reference underflow in 5.3 becomes a memory leak in 5.2. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* device: avoid circular netns referencesJason A. Donenfeld2020-06-221-1/+12
| | | | | | | | | | | | | | | | Before, we took a reference to the creating netns if the new netns was different. This caused issues with circular references, with two wireguard interfaces swapping namespaces. The solution is to rather not take any extra references at all, but instead simply invalidate the creating netns pointer when that netns is deleted. In order to prevent this from happening again, this commit improves the rough object leak tracking by allowing it to account for created and destroyed interfaces, aside from just peers and keys. That then makes it possible to check for the object leak when having two interfaces take a reference to each others' namespaces. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: mark per_cpu_load_addr as static for gcc-10Jason A. Donenfeld2020-05-281-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: work around broken centos8 kernelJason A. Donenfeld2020-05-281-0/+1
| | | | | | | RHEL needs to apply https://lore.kernel.org/patchwork/patch/974664/ before we can revert this monstrosity. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: patch in UTS_UBUNTU_RELEASE_ABI for Ubuntu detectionJason A. Donenfeld2020-05-281-0/+1
| | | | | | | | This kind of thing really makes me queezy and upset, but there's little that can be done about such situations when dealing with Canonical's kernel. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: support fetching kernels for arbitrary URLsJason A. Donenfeld2020-05-281-1/+11
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: add extra fill in idt handler for newer binutilsJason A. Donenfeld2020-05-211-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: use cbuild gcc for avx512 exclusionJason A. Donenfeld2020-05-211-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: force 2MB pages for binutils 2.31Jason A. Donenfeld2020-05-211-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: patch kernels that rely on ancient makeJason A. Donenfeld2020-05-211-0/+1
| | | | | | | | Kernels without 9feeb638cde0 ("tools build: fix # escaping in .cmd files for future Make") face problems when building with more recent make, so patch these to avoid issues. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: remove -Werror in order to build ancient kernels betterJason A. Donenfeld2020-05-211-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: always use cbuild gcc rather than system gccJason A. Donenfeld2020-05-211-3/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: add -fcommon for compiling ping with gcc-10Jason A. Donenfeld2020-05-191-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: use newer iproute2 for gcc-10Jason A. Donenfeld2020-05-081-1/+1
| | | | | | | | | | gcc-10 switched to defaulting to -fno-common, which broke iproute2-5.4. This was fixed in iproute-5.6, so switch to that. Because we're after a stable testing surface, we generally don't like to bump these unnecessarily, but in this case, being able to actually build is a basic necessity. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* socket: remove errant restriction on looping to selfJason A. Donenfeld2020-05-041-3/+51
| | | | | | | | | | | | | | | | | | | | | | | It's already possible to create two different interfaces and loop packets between them. This has always been possible with tunnels in the kernel, and isn't specific to wireguard. Therefore, the networking stack already needs to deal with that. At the very least, the packet winds up exceeding the MTU and is discarded at that point. So, since this is already something that happens, there's no need to forbid the not very exceptional case of routing a packet back to the same interface; this loop is no different than others, and we shouldn't special case it, but rather rely on generic handling of loops in general. This also makes it easier to do interesting things with wireguard such as onion routing. At the same time, we add a selftest for this, ensuring that both onion routing works and infinite routing loops do not crash the kernel. We also add a test case for wireguard interfaces nesting packets and sending traffic between each other, as well as the loop in this case too. We make sure to send some throughput-heavy traffic for this use case, to stress out any possible recursion issues with the locks around workqueues. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: use normal kernel stack size on ppc64Jason A. Donenfeld2020-05-031-0/+1
| | | | | | | | | | | While at some point it might have made sense to be running these tests on ppc64 with 4k stacks, the kernel hasn't actually used 4k stacks on 64-bit powerpc in a long time, and more interesting things that we test don't really work when we deviate from the default (16k). So, we stop pushing our luck in this commit, and return to the default instead of the minimum. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: loop entropy adding until getrandom doesn't blockJason A. Donenfeld2020-05-031-1/+4
| | | | | | | Before the 256 was just a guess, which was made wrong by qemu 5.0, so instead actually query whether or not we're all set. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: bump default kernel to 5.5.14Jason A. Donenfeld2020-04-011-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* noise: error out precomputed DH during handshake rather than configJason A. Donenfeld2020-03-181-5/+10
| | | | | | | | | | | | | | | | | We precompute the static-static ECDH during configuration time, in order to save an expensive computation later when receiving network packets. However, not all ECDH computations yield a contributory result. Prior, we were just not letting those peers be added to the interface. However, this creates a strange inconsistency, since it was still possible to add other weird points, like a valid public key plus a low-order point, and, like points that result in zeros, a handshake would not complete. In order to make the behavior more uniform and less surprising, simply allow all peers to be added. Then, we'll error out later when doing the crypto if there's an issue. This also adds more separation between the crypto layer and the configuration layer. Discussed-with: Mathias Hall-Andersen <mathias@hall-andersen.dk> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: ensure that icmp src address is correct with natJason A. Donenfeld2020-02-121-0/+11
| | | | | | | | | | This is a small test to ensure that icmp_ndo_send is actually doing the right with with regards to the source address. It tests this by ensuring that the error comes back along the right path. Also, backport the new ndo function for this. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: ensure non-addition of peers with failed precomputationJason A. Donenfeld2020-02-051-0/+6
| | | | | | | | Ensure that peers with low order points are ignored, both in the case where we already have a device private key and in the case where we do not. This adds points that naturally give a zero output. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: tie socket waiting to target pidJason A. Donenfeld2020-02-051-9/+8
| | | | | | | | Without this, we wind up proceeding too early sometimes when the previous process has just used the same listening port. So, we tie the listening socket query to the specific pid we're interested in. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: bump kernelJason A. Donenfeld2020-01-281-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: only compare archs when deciding whether to use kvmJason A. Donenfeld2020-01-021-14/+15
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: re-add dependency on wireguard sourcesJason A. Donenfeld2020-01-021-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: bump packages and support m68k properlyJason A. Donenfeld2020-01-015-17/+22
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: remove remaining tools referencesJason A. Donenfeld2019-12-262-11/+12
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: bump versionJason A. Donenfeld2019-11-271-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: respect PATH when finding CBUILDJason A. Donenfeld2019-11-271-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: work around build bug with powerpc64leJason A. Donenfeld2019-11-271-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* netns: add test for failing 5.3 FIB changesJason A. Donenfeld2019-10-112-1/+24
| | | | | Reference: https://lore.kernel.org/netdev/20190924073615.31704-1-Jason@zx2c4.com/ Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* qemu: bump default versionJason A. Donenfeld2019-10-111-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>