Skip to content
Snippets Groups Projects
  1. Aug 28, 2023
    • Micah Elizabeth Scott's avatar
      hashx: Fix compiled hash function on NetBSD · 95e8ffa9
      Micah Elizabeth Scott authored
      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
      95e8ffa9
    • Micah Elizabeth Scott's avatar
      hashx: Avoid unused arg warning on OpenBSD and NetBSD · ee4e9f75
      Micah Elizabeth Scott authored
      This path in hashx_vm_alloc_huge() for OpenBSD and NetBSD always
      fails without checking its parameter. Fix the warning.
      ee4e9f75
    • Micah Elizabeth Scott's avatar
      equix: Add NetBSD to "huge pages not supported" path · 9cac0a85
      Micah Elizabeth Scott authored
      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.
      9cac0a85
  2. Aug 25, 2023
  3. Aug 23, 2023
  4. Aug 22, 2023
  5. Aug 15, 2023
  6. Aug 14, 2023
  7. Aug 12, 2023
    • Micah Elizabeth Scott's avatar
      test_dos: Fixes for uninitialized stack memory · d0343b12
      Micah Elizabeth Scott authored
      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.
      d0343b12
  8. Aug 11, 2023
    • Micah Elizabeth Scott's avatar
      Extend DoS protection to IP addresses with known relays · 2b8d6290
      Micah Elizabeth Scott authored
      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.
      2b8d6290
    • Micah Elizabeth Scott's avatar
      hashx: Fix rare compiler output overflow on aarch64 · a94ce252
      Micah Elizabeth Scott authored
      
      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: default avatarMicah Elizabeth Scott <beth@torproject.org>
      a94ce252
  9. Aug 10, 2023
    • Micah Elizabeth Scott's avatar
      Extend DoS protection to partially-open channels · 3e18507d
      Micah Elizabeth Scott authored
      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.
      3e18507d
  10. Aug 08, 2023
  11. Aug 04, 2023
  12. Aug 02, 2023
  13. Aug 01, 2023
  14. Jul 31, 2023
  15. Jul 29, 2023
  16. Jul 26, 2023
  17. Jul 24, 2023
  18. Jul 17, 2023
  19. Jul 16, 2023
  20. Jul 12, 2023
  21. Jul 06, 2023
    • Roger Dingledine's avatar
      replace L2 vanguards that aren't Fast or Stable · 33358293
      Roger Dingledine authored
      Rotate to a new L2 vanguard whenever an existing one loses the
      Stable or Fast flag. Previously, we would leave these relays in the
      L2 vanguard list but never use them, and if all of our vanguards
      end up like this we wouldn't have any middle nodes left to choose
      from so we would fail to make onion-related circuits.
      
      Fixes bug 40805; bugfix on 0.4.7.1-alpha.
      33358293
Loading