aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-09-13Add diagnostic log message for compression bombs.Alexander Færøy
This patch causes `tor_compress_is_compression_bomb()` to emit a warning-level log message that lets us learn the potential ratio of the input to output buffer sizes. Hopefully, this will give us a bit of a better idea whether the compression bomb ratio needs some tuning. See: tpo/core/tor#40739.
2023-09-12Make networkstatus_getinfo_by_purpose report published_on again.Nick Mathewson
When we implemented prop275 in 0.4.8.1-alpha, we changed the behavior of networkstatus_getinfo_helper_single to omit meaningful published_on times, replacing them with "2038-01-01". This is necessary when we're formatting a routerstatus with no additional info, since routerstatus objects no longer include a published_on. But in networkstatus_getinfo_by_purpose, we do have a routerinfo that does have a published_on. This patch uses that information to report published_on times in our output when we're making a "virtual" networkstatus for a big file of routerinfo_t objects. This is mostly important for bridge authorities, since when they dump a secret list of the bridges, they want to include published_on times. Closes #40855. Bugfix on 0.4.8.1-alpha.
2023-08-30fallbackdir: Update list generated on August 30, 2023Tor CI Release
2023-08-30Update geoip files to match ipfire location db, 2023/08/30.Tor CI Release
2023-08-28Merge branch 'tor-gitlab/mr/750' into maint-0.4.8David Goulet
2023-08-28equix: Disable huge page support by defaultMicah Elizabeth Scott
Equi-X supports optionally allocating its solver memory using huge pages, to reduce the virtual memory subsystem overhead required to make the entire solver buffer live. Tor doesn't use this feature, since it seems to have no noticeable performance benefit at this time, but we still included code for it at compile time. To improve portability, this patch disables huge page support by default and enables it only in the cmake build system used for equix benchmarks. With this patch equix-bench still supports huge pages. Verified using strace that we're making the hugepage allocation. There's no fallback for huge pages, so Equi-X initialization will fail if they are requested and we don't support them for any runtime or compile-time reason. Addresses #40843 (NetBSD) but also prevents future porting issues related to huge pages.
2023-08-28hashx: Fix compiled hash function on NetBSDMicah Elizabeth Scott
NetBSD includes the idea of a 'maximum protection' per-region, and an mprotect which exceeds the max protection will be denied. If we explicitly ask for a maximum which includes execute permission, we can successfully swap our code buffer's permissions between read-write and read-execute when each hash program is compiled. With this patch, the crypto/hashx tests pass on NetBSD 9. This addresses bug #40844
2023-08-28hashx: Avoid unused arg warning on OpenBSD and NetBSDMicah Elizabeth Scott
This path in hashx_vm_alloc_huge() for OpenBSD and NetBSD always fails without checking its parameter. Fix the warning.
2023-08-28equix: Add NetBSD to "huge pages not supported" pathMicah Elizabeth Scott
As suggested by @wiz on #40843, let's add an explicit check to hashx_vm_alloc_huge() that avoids using a Linux-style default on NetBSD targets. This doesn't change the questionable Linux-style default, but a future patch will disable this code by default so it's not a portability liability. (This code is in hashx's VM layer but it's actually only relevant to equix.) This addresses bug #40843. Another patch will disable huge pages by default entirely, but this patch is sufficient to fix the NetBSD build.
2023-08-25Bug #40842: Additional diagnosticsMike Perry
Just in case there are other instances hiding in the maze.
2023-08-25Bug #40842: Don't send on sets that are being torn downMike Perry
2023-08-25Merge branch 'tor-gitlab/mr/748' into maint-0.4.8David Goulet
2023-08-25fix lint clippy::arc_with_non_send_synctrinity-1686a
2023-08-25Bug #40841: Demote extra legs to protocol warn.Mike Perry
Also add more info to leg dump.
2023-08-23doxygen: Typo fix in relay.c commentDavid Goulet
HTML in comment, what a bad idea... Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-23typo: Fix a doxygen html unclosed tagDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-23fallbackdir: Update list generated on August 23, 2023Tor CI Release
2023-08-23Update geoip files to match ipfire location db, 2023/08/23.Tor CI Release
2023-08-22Fix compilation errors for FreeBSDDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-22Merge remote-tracking branch 'mbeth-private/ticket40833_mr'David Goulet
2023-08-22Merge remote-tracking branch 'mbeth-private/ticket40821_mr'David Goulet
2023-08-15CI: Diagnostic for failure in test_rebind cleanupMicah Elizabeth Scott
I saw this test fail intermittently due to what seemed like a filesystem race in docker? The cleanup task was failing with a 'directory not empty' error, despite trying to do a recursive 'rm'. This patch adds an 'ls' to the same directory, hoping the output might be useful to diagnose future intermittent failures.
2023-08-15tor-c-equix: Fix clippy warningMicah Elizabeth Scott
Clippy found a transmute that could have been a reborrow.
2023-08-15Merge branch 'maint-0.4.7'David Goulet
2023-08-15Bug 40834: Remove assert and add logs to track no-leg caseMike Perry
2023-08-15Revert "Nullify on_circuit if last conflux leg"Mike Perry
This reverts commit 5487476fd919703b55cb1f1544d575224c9b685e.
2023-08-14zstd: Check errors right affer compressing/decompressingDavid Goulet
Considering a compression bomb before looking for errors led to false negative log warnings. Instead, it is possible the work failed for whatever reasons which is not indicative of a compression bomb. Fixes #40739 Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-11test_dos: Fixes for uninitialized stack memoryMicah Elizabeth Scott
This was causing CI failures that didn't reproduce on my local machine. The DoS subsystem now has a new assert() which triggers a BUG on some nonzero memory contents (or_conn->tracked_for_dos_mitigation), and uninitialized stack memory might be nonzero.
2023-08-11Extend DoS protection to IP addresses with known relaysMicah Elizabeth Scott
This exemption used to be helpful in keeping exit relays from tripping the DoS detection subsystem and losing Tor connectivity. Now exit relays block re-entry into the network (tor issue #2667) so it's no longer needed. We'd like to re-enable protection on these addresses to avoid giving attackers a way around our DoS mitigations.
2023-08-11hashx: Fix rare compiler output overflow on aarch64Micah Elizabeth Scott
This is a fix for a very rare buffer overflow in hashx, specific to the dynamic compiler on aarch64 platforms. In practice this issue is extremely unlikely to hit randomly, and it's only been seen in unit tests that supply unusual mock PRNG output to the program generator. My best attempt at estimating the probability of hitting the overflow randomly is about 10^-23. Crafting an input with the intent to overflow can be done only as fast as an exhaustive search, so long as Blake2B is unbroken. The root cause is that hashx writes assembly code without any length checks, and it uses an estimated size rather than an absolute maximum size to allocate the buffer for compiled code. Some instructions are much longer than others, especially on aarch64. The length of the overflow is nearly 300 bytes in the worst synthetic test cases I've developed so far. Overflow occurs during hashx_make(), and the subsequent hashx_exec() will always SIGSEGV as the written code crosses outside the region that's been marked executable. In typical use, hashx_exec() is called immediately after hashx_make(). This fix increases the buffer size from 1 page to 2 pages on aarch64, adds an analysis of the compiled code size, and adds runtime checks so we can gracefully fail on overflow. It also adds a unit test (written in Rust) that includes a PRNG sequence exercising the overflow. Without this patch the unit test shows a SIGSEGV on aarch64, with this patch it runs successfully and matches interpreter output. Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-08-09Extend DoS protection to partially-open channelsMicah Elizabeth Scott
tor only marks a channel as 'open' once the TLS and OR handshakes have both completed, and normal "client" (ORPort) DoS protection is not enabled until the channel becomes open. This patch adds an additional earlier initialization path for DoS protection on incoming TLS connections. This leaves the existing dos_new_client_conn() call sites intact, but adds a guard against multiple-initialization using the existing tracked_for_dos_mitigation flag. Other types of channels shouldn't be affected by this patch.
2023-08-07hashx: Fix a few more compiler warningsMicah Elizabeth Scott
Fix a couple cases where size_t values were being confused with int. Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-08-04fallbackdir: Update list generated on August 04, 2023Tor CI Release
2023-08-04Update geoip files to match ipfire location db, 2023/08/04.Tor CI Release
2023-08-02relay: Remove logging for a bug. It triggers a BUG() laterDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-01Merge branch 'cargo_hashx_rng' into 'main'David Goulet
hashx: Rust hook for inspecting and modifying the random number stream See merge request tpo/core/tor!734
2023-08-01Merge branch 'bug40827' into 'main'David Goulet
Fix assert crash on relay-side due to on_circuit backpointer See merge request tpo/core/tor!737
2023-08-01Bug 40827: Add additional logs and checks for 0-leg conflux caseMike Perry
2023-08-01Nullify on_circuit if last conflux legDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-07-31Bug 40828: Add more log scrubbing to protocol warningsMike Perry
2023-07-28hashx: Rust hook for inspecting and modifying the random number streamMicah Elizabeth Scott
This patch has no effect on the C tor build. Adds a function hashx_rng_callback() to the hashx API, defined only when HASHX_RNG_CALLBACK is defined. This is then used in the Rust wrapper to implement a similar rng_callback(). Included some minimal test cases. This code is intented for use in cross-compatibility fuzzing tests which drive multiple implementations of hashx with the same custom Rng stream. Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-07-26Include a basic Rust wrapper for Equi-X and HashXMicah Elizabeth Scott
The idea behind this is that we may want to start exporting more pieces of c-tor as Rust crates so that Arti can perform cross compatibility and comparison testing using Rust tooling. This turns the 'tor' repo into a Cargo workspace, and adds one crate to start with: "tor-c-equix", rooted in src/ext/equix. This actually includes both Equi-X itself and HashX, since there's less overall duplication if we package these together instead of packaging HashX separately. This patch adds a basic safe Rust interface, but doesn't expose any additional internals for testing purposes. No changes to the C code here or the normal Tor build system. Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-07-26version: Bump version to 0.4.7.14-devTor CI Release
2023-07-26version: Bump version to 0.4.7.14Tor CI Release
2023-07-26Merge branch 'maint-0.4.7'David Goulet
2023-07-26fallbackdir: Update list generated on July 26, 2023Tor CI Release
2023-07-26Update geoip files to match ipfire location db, 2023/07/26.Tor CI Release
2023-07-26fallback: Take file from main for our release CIDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-07-26geoip: Take the database from mainDavid Goulet
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-07-24Merge branch 'maint-0.4.7'David Goulet