Commit Graph

1528 Commits

Author SHA1 Message Date
Roger Dingledine
7cca6dc1a3 don't build preemptive conflux circuits if no predicted ports
Conflux circuit building was ignoring the "predicted ports" feature,
which aims to make Tor stop building circuits if there have been
no user requests lately. This bug led to every idle Tor on the
network building and discarding circuits every 30 seconds, which
added overall load to the network, used bandwidth and battery from
clients that weren't actively using their Tor, and kept sockets open
on guards which added connection padding essentially forever.

Bug went in on commit 39c2927d when we added preemptive conflux circuit
pools.

Fixes bug 40981; bugfix on 0.4.8.1-alpha.
2024-10-15 15:59:25 -04:00
Waldemar Zimpel
6feaea8fa4 Fix: Memory leaks in cpuworker on shutdown
Resources allocated by cpuworker weren't being freed on clean shutdown.
This applies for worker threads, worker thread pool, reply queue, reply
event, ...
2024-10-10 09:55:46 -04:00
hiro
7708f9a4ea Fix typo in tor-relays list address 2024-04-30 15:34:07 -04:00
David Goulet
bedc6a90d2 circuit: Remove log_warn triggered by a proto violation
Fixes #40932

Signed-off-by: David Goulet <dgoulet@torproject.org>
2024-04-16 13:49:42 -04:00
David Goulet
29e3601c42 Merge branch 'tor-gitlab/mr/808' into maint-0.4.8 2024-04-15 15:11:16 -04:00
David Goulet
612b801ea5 conflux: Don't process a closed circuit on get packaged window
Signed-off-by: David Goulet <dgoulet@torproject.org>
2024-04-15 14:45:29 -04:00
David Goulet
269b4561a1 conflux: Avoid noting a cell was sent on a closed circuit
It turns out that circuit_package_relay_cell() returns 0 in order to drop a
cell but there is a code path, if the circuit queue is full, that also silently
closes the circuit and returns 0.

This lead to Conflux thinking a cell was sent but actually the cell was not and
the circuit was closed leading to the hard assert.

And so this function makes sure that circuit_package_relay_cell() and
append_cell_to_circuit_queue() returns a value that indicate what happened with
the cell and circuit so the caller can make an informed decision with it.

This change makes it that we do NOT enter the Conflux subsystem if the cell is
not queued on the circuit.

Fixes #40921

Signed-off-by: David Goulet <dgoulet@torproject.org>
2024-04-15 14:24:45 -04:00
David Goulet
6fbbcdde35 Merge remote-tracking branch 'mikeperry-private/bug40897' into maint-0.4.8 2023-12-08 13:19:40 -05:00
Alexander Færøy
1b1f6e8574 Merge remote-tracking branch 'origin/merge-requests/776' into maint-0.4.8 2023-12-07 21:38:03 +00:00
Mike Perry
cc52f7e5b7 Bug 40897 Bug Bounty: Double the number of max conflux circs
We strongly suspect that bug 40897 was caused by a custom Tor client that
tried to use more than the default number of conflux circuits, for either
performance or traffic analysis defense gains, or both.

This entity hit a safety check on the exit side, which caused a UAF. Our
"belt and suspenders" snapped off, and hit us in the face... again...

Since there are good reasons to try more than 2 conflux legs, and research has
found some traffic analysis benefits with as many as 5, we're going to raise
and parameterize this limit as a form of bug bounty for finding this UAF, so
that this entity can try out a little more confluxing.

This should also make it easier for researchers to try things like gathering
traces with larger amounts of confluxing than normal, to measure real-world
traffic analysis impacts of conflux.

Shine on, you yoloing anonymous diamond. Let us know if you find out anything
interesting!
2023-12-07 18:37:30 +00:00
Mike Perry
03778a0f34 Bug 40897: Add more checks to free paths
Similar double-frees would be caught earlier by these, so long as the pointers
remain nulled out.
2023-12-07 18:37:30 +00:00
Mike Perry
d02eb4502a Bug 40897: Move safety check to proper location and give it error handling. 2023-12-07 18:37:26 +00:00
Mike Perry
d9e7759088 Bug 40878: Count a valid conflux linked cell as valid data
For vanguards addon.
2023-10-30 16:54:49 +00:00
trinity-1686a
efc7159e08
fix bridge transport statistics 2023-10-12 18:44:54 +02:00
Mike Perry
d499de5813 Bug 40862: Check if circuits are unused more ways 2023-09-20 23:35:36 +00:00
Mike Perry
7666dd777a Bug #40842: Additional diagnostics
Just in case there are other instances hiding in the maze.
2023-08-25 22:53:07 +00:00
Mike Perry
fd6f098c9d Bug #40842: Don't send on sets that are being torn down 2023-08-25 22:45:07 +00:00
Mike Perry
380727a16d Bug #40841: Demote extra legs to protocol warn.
Also add more info to leg dump.
2023-08-25 16:32:59 +00:00
David Goulet
97d3cf3950 doxygen: Typo fix in relay.c comment
HTML in comment, what a bad idea...

Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-23 17:02:25 -04:00
David Goulet
c56ba686d6 typo: Fix a doxygen html unclosed tag
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-23 16:41:36 -04:00
David Goulet
e39fb0962f Merge remote-tracking branch 'mbeth-private/ticket40821_mr' 2023-08-22 13:09:54 -04:00
Mike Perry
a56434a82b Bug 40834: Remove assert and add logs to track no-leg case 2023-08-15 15:05:25 +00:00
Mike Perry
72164740a2 Revert "Nullify on_circuit if last conflux leg"
This reverts commit 5487476fd9.
2023-08-15 14:53:17 +00:00
Micah Elizabeth Scott
2b8d629079 Extend DoS protection to IP addresses with known relays
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-11 16:32:22 -07:00
Micah Elizabeth Scott
3e18507dc7 Extend DoS protection to partially-open channels
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-09 18:07:34 -07:00
David Goulet
3ed37ae53c relay: Remove logging for a bug. It triggers a BUG() later
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-02 12:09:41 -04:00
David Goulet
f1fdb58611 Merge branch 'bug40827' into 'main'
Fix assert crash on relay-side due to on_circuit backpointer

See merge request tpo/core/tor!737
2023-08-01 20:13:32 +00:00
Mike Perry
e3ad41e7e5 Bug 40827: Add additional logs and checks for 0-leg conflux case 2023-08-01 17:13:48 +00:00
David Goulet
5487476fd9 Nullify on_circuit if last conflux leg
Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-08-01 17:12:11 +00:00
Mike Perry
74d6fd534a Bug 40828: Add more log scrubbing to protocol warnings 2023-07-31 14:12:39 +00:00
David Goulet
28dfa07069 Merge branch 'maint-0.4.7' 2023-07-24 10:18:53 -04:00
David Goulet
d6fd7d1035 Fix all -Werror=enum-int-mismatch warnings
Close #40824

Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-07-24 09:44:42 -04:00
trinity-1686a
1901720fb9
Warn when operating as bridge and exit 2023-07-17 19:40:26 +02:00
Mike Perry
04d7f11086 Bug 40566: Remove unused BDP estimators 2023-06-27 19:27:10 +00:00
Mike Perry
7d85298b63 Bug 40566: Remove unused congestion control alg structs. 2023-06-27 16:44:07 +00:00
Mike Perry
641ed48e6d Bug 40566: Unhook unused congestion control algs 2023-06-27 16:44:07 +00:00
Mike Perry
99ad0de9f5 Bug 40566: Remove unused cc alg files 2023-06-27 14:52:56 +00:00
Mike Perry
53748705f7 Export variables and functions for CC unit tests. 2023-06-23 15:08:57 +00:00
Mike Perry
646212ce58 Bug 40709: Update and clean up tests for consensus params 2023-06-23 15:08:54 +00:00
Mike Perry
9d022be9fc Bug 40709: Update congestion control parameters
This brings us into sync with the consensus, and will be useful for test
vectors, to ensure behavior consistent with the consensus params.
2023-06-23 15:08:49 +00:00
Mike Perry
796e65e487 Bug 40569: Reduce accepted range for negotiated cc_sendme_inc 2023-06-22 23:12:34 +00:00
Mike Perry
27a0fee882 Bug 40808: Change KISTSchedRunInterval range and default; add KISTSchedRunIntervalClient 2023-06-20 16:29:48 +00:00
Mike Perry
44cd704636 Bug 40811: Count conflux leg launch attempts early.
Also, double check that the consensus has enough overall exits before
attempting conflux set launch.
2023-06-15 16:13:34 +00:00
Mike Perry
5d63842e86 Bug 40810: Avoid using 0 RTT legs 2023-06-13 18:18:46 +00:00
Mike Perry
dbd37c0e7b Bug 40810: Improve validation checks to ignore 0-RTT legs
Also add calls to dump the legs of a conflux set if we have too many
2023-06-13 18:18:07 +00:00
Mike Perry
6a513e2ff5 Bug 40801: Do not change read state of marked conns 2023-06-09 16:29:10 +00:00
Mike Perry
da50d21c42 Bug 40801: Send LINKED_ACK before attaching streams
Otherwise, the BEGIN cell arrives at the exit before it has an RTT,
and then it does not know which circuit to prefer in response.
2023-06-09 16:29:10 +00:00
Mike Perry
ff59e2f490 Add BUG() macro to marked edge reads
This will give us a full stacktrace.
2023-06-09 16:24:03 +00:00
Mike Perry
176f0929bb Add conflux logs to diagnose cases where RTTs are absent/zero. 2023-06-09 16:24:03 +00:00
Mike Perry
03d63bc7bd Add a conflux helper to log conflux sets. 2023-06-06 15:15:20 +00:00