Commit Graph

37044 Commits

Author SHA1 Message Date
David Goulet
19e8844622 Merge branch 'maint-0.4.5' 2021-03-10 10:06:49 -05:00
David Goulet
d382f26914 Merge branch 'tor-gitlab/mr/331' into maint-0.4.5 2021-03-10 10:06:44 -05:00
David Goulet
6fce18916f Merge branch 'tor-gitlab/mr/331' 2021-03-10 10:06:20 -05:00
David Goulet
fc080b4113 Merge branch 'maint-0.4.5' 2021-03-10 10:04:26 -05:00
Nick Mathewson
05564a8521 Start a changelog for 0.4.6.1-alpha 2021-03-09 11:58:46 -05:00
Nick Mathewson
4f138f2ed2 Remove changes files that are already merged in 0.4.5.x 2021-03-09 11:44:54 -05:00
Nick Mathewson
b599f489ae Fix documentation formatting for VirtualAddrNetworkIPv6
Fixes bug #40256; bugfix on 0.2.9.4-alpha.
2021-03-08 11:17:24 -05:00
Nick Mathewson
690c7be253 Fix parsing bug in linux get_total_system_memory().
Use find_str_at_start_of_line(), not strstr() here: we don't want
to match "MemTotal: " if it appears in the middle of a line.

Fixes #40315; bugfix on 0.2.5.4-alpha.
2021-03-03 14:52:15 -05:00
Alexander Færøy
80b6054bb0 Merge remote-tracking branch 'tor-gitlab/mr/213' 2021-03-03 15:16:20 +00:00
Nick Mathewson
a1ce89a554 Add geoip-db-tool/Cargo.lock to version control, as is the custom. 2021-03-02 08:52:25 -05:00
David Goulet
2eb015372b Merge branch 'tor-gitlab/mr/328' 2021-03-01 08:36:02 -05:00
David Goulet
49ce31b2b6 Merge branch 'maint-0.4.4' into maint-0.4.5 2021-03-01 08:33:47 -05:00
David Goulet
997bf3f840 Merge branch 'maint-0.4.5' 2021-03-01 08:33:47 -05:00
David Goulet
eb1759633a Merge branch 'maint-0.3.5' into maint-0.4.4 2021-03-01 08:33:41 -05:00
Nick Mathewson
6b7a145409 git-list-tor-branches: remove 0.4.3 2021-03-01 08:28:53 -05:00
Nick Mathewson
1b36e50fdd Correct documentation for lib_meminfo.md 2021-03-01 08:13:32 -05:00
Alexander Færøy
a497a97e4c Change %lu to %TOR_PRIuSZ in dos.c.
This patch unbreaks the Windows build on master that was introduced in
99703eaca0.
2021-02-26 18:16:08 +00:00
George Kadianakis
8020ae02ab Merge remote-tracking branch 'tor-gitlab/mr/317' 2021-02-26 12:56:14 +02:00
David Goulet
f75baf5ea5 Merge branch 'maint-0.4.5' 2021-02-24 13:55:30 -05:00
David Goulet
6ea7eb58c6 Merge branch 'tor-gitlab/mr/321' into maint-0.4.5 2021-02-24 13:55:21 -05:00
George Kadianakis
830b0f8c62 Merge remote-tracking branch 'tor-gitlab/mr/306' 2021-02-24 12:35:55 +02:00
David Goulet
6edb648aa0 Merge branch 'maint-0.4.5' 2021-02-23 12:28:04 -05:00
David Goulet
97e51dd01b Merge branch 'tor-gitlab/mr/326' into maint-0.4.5 2021-02-23 12:27:59 -05:00
David Goulet
ad4f87ed3f Remove mallinfo() from codebase
Now deprecated in libc >= 2.33

Closes #40309

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 12:16:58 -05:00
David Goulet
296a557bfc Remove mallinfo() from codebase
Now deprecated in libc >= 2.33

Closes #40309

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 11:02:33 -05:00
David Goulet
39d0f69dfe relay: Avoid a directory early fetch
The directory_fetches_from_authorities() is used to know if a client or relay
should fetch data from an authority early in the boot process.

We had a condition in that function that made a relay trigger that fetch if it
didn't know its address (so we can learn it). However, when this is called,
the address discovery has not been done yet so it would always return true for
a relay.

Furthermore, it would always trigger a log notice that the IPv4 couldn't be
found which was inevitable because the address discovery process has not been
done yet (done when building our first descriptor).

It is also important to point out that starting in 0.4.5.1-alpha, asking an
authority for an address is done during address discovery time using a one-hop
circuit thus independent from the relay deciding to fetch or not documents
from an authority.

Small fix also is to reverse the "IPv(4|6)Only" flag in the notice so that if
we can't find IPv6 it would output to use IPv4Only.

Fixes #40300

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 09:49:45 -05:00
Nick Mathewson
bc799a1eaf Merge remote-tracking branch 'tor-gitlab/mr/320' 2021-02-23 09:29:49 -05:00
David Goulet
c96465259a dos: Change the DoS heartbeat line format
Fix a bug introduced in 94b56eaa75 which
overwrite the connection message line.

Furthermore, improve how we generate that line by using a smartlist and change
the format so it is clearer of what is being rejected/detected and, if
applicable, which option is disabled thus yielding no stats.

Closes #40308

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 08:54:45 -05:00
Nick Mathewson
100221baac Merge remote-tracking branch 'origin/master' 2021-02-23 08:43:19 -05:00
Nick Mathewson
09614e0c9d Tweak documentation on 40282 2021-02-23 08:42:31 -05:00
Nick Mathewson
4321755de7 Merge branch 'ticket40282_046_01_squashed' 2021-02-23 08:32:58 -05:00
David Goulet
1c45a3df7c changes: Add changes file for #40282
Closes #40282

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 08:29:32 -05:00
David Goulet
100c758cd8 man: Note that relay now ignore the DirPort option
Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-23 08:29:32 -05:00
Alexander Færøy
83ab6adb10 Merge remote-tracking branch 'tor-gitlab/mr/276' 2021-02-22 20:52:44 +00:00
David Goulet
45113b648b test: Add DoS connection rate unit test
Related to #40253

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 15:48:52 -05:00
David Goulet
99703eaca0 dos: Move concurrent count into conn_stats object
No behavior change except for logging. This is so the connection related
statistics are in the right object.

Related to #40253

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 15:48:43 -05:00
David Goulet
94b56eaa75 dos: New client connect rate detection
This is a new detection type which is that a relay can now control the rate of
client connections from a single address.

The mechanism is pretty simple, if the rate/burst is reached, the address is
marked for a period of time and any connection from that address is denied.

Closes #40253

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 15:48:42 -05:00
Nick Mathewson
8907800549 Merge remote-tracking branch 'tor-gitlab/mr/319' 2021-02-22 15:39:30 -05:00
Nick Mathewson
6e3a7c410f Merge branch 'maint-0.4.5' 2021-02-22 15:37:39 -05:00
Nick Mathewson
bc21ed3290 Merge remote-tracking branch 'tor-gitlab/mr/316' into maint-0.4.5 2021-02-22 15:37:31 -05:00
David Goulet
d98c77b78e relay: Reduce streaming compression ratio from HIGH to LOW
Fixes #40301

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 14:47:42 -05:00
Alexander Færøy
a4df1e8ea4 Merge branch 'maint-0.4.5' 2021-02-22 19:13:12 +00:00
Alexander Færøy
26c2e843f9 Merge remote-tracking branch 'tor-gitlab/mr/309' into maint-0.4.5 2021-02-22 19:12:53 +00:00
Nick Mathewson
85dcd4ce07 Use rangemap 0.1.10
0.1.9 fixed a range-coalescing bug; 0.1.10 fixed a performance
regression.
2021-02-22 13:22:38 -05:00
Nick Mathewson
dcad439e94 script to generate a commit for an updated geoip file 2021-02-22 12:41:03 -05:00
Nick Mathewson
0d4237839b Rust tool to convert IPFire Location dump into CSV format.
The IPFire people provide a tool that collects data from several
top-level sources, combines it into a single database, and annotates
it with optional overrides.  This tool transforms the "dump" format
of their database into the form Tor expects.
2021-02-22 12:25:18 -05:00
David Goulet
4d7f31b964 relay: Move log notice after suggested address lookup
When trying to find our address to publish, we would log notice if we couldn't
find it from the cache but then we would look at the suggested cache (which
contains the address from the authorities) in which we might actually have the
address.

Thus that log notice was misplaced. Move it down after the suggested address
cache lookup.

Closes #40300

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 09:13:54 -05:00
David Goulet
9541ed63a1 relay: Only authorities publish a DirPort
Relay will always publish 0 as DirPort value in their descriptor from now on
except authorities.

Related to #40282

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 08:52:15 -05:00
David Goulet
38649b4f95 relay: Remove dirport reachability self test
Regular relays are about to get their DirPort removed so that reachability
test is not useful anymore

Authorities will still use the DirPort but because network reentry towards
their DirPort is now denied network wide, this test is not useful anymore and
so it should simply be considered reachable at all time.

Part of #40282

Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-02-22 08:52:06 -05:00
George Kadianakis
c0589d06be Fix a test failure in test_hs_control_add_onion_helper_add_service().
This bug made the pipeline fail. It basically tries to access a service we just
freed because it's still on the service list.

It only occurs about once every 10 tests and it looks like this:

$ ./src/test/test hs_control/hs_control_add_onion_helper_add_service
hs_control/hs_control_add_onion_helper_add_service: [forking] =================================================================
==354311==ERROR: AddressSanitizer: heap-use-after-free on address 0x613000000940 at pc 0x55a159251b03 bp 0x7ffc6abb5b30 sp 0x7ffc6abb5b28
READ of size 8 at 0x613000000940 thread T0
^[[A
    #0 0x55a159251b02 in hs_service_ht_HT_FIND_P_ src/feature/hs/hs_service.c:153
    #1 0x55a159251b02 in hs_service_ht_HT_FIND src/feature/hs/hs_service.c:153
    #2 0x55a159251b02 in find_service src/feature/hs/hs_service.c:175
    #3 0x55a159251c2c in register_service src/feature/hs/hs_service.c:188
    #4 0x55a159262379 in hs_service_add_ephemeral src/feature/hs/hs_service.c:3811
    #5 0x55a158e865e6 in test_hs_control_add_onion_helper_add_service src/test/test_hs_control.c:847
    #6 0x55a1590fe77b in testcase_run_bare_ src/ext/tinytest.c:107
    #7 0x55a1590fee98 in testcase_run_forked_ src/ext/tinytest.c:201
    #8 0x55a1590fee98 in testcase_run_one src/ext/tinytest.c:267
    #9 0x55a1590ffb06 in tinytest_main src/ext/tinytest.c:454
    #10 0x55a158b1b1a4 in main src/test/testing_common.c:420
    #11 0x7f7f06f8dd09 in __libc_start_main ../csu/libc-start.c:308
    #12 0x55a158b21f69 in _start (/home/f/Computers/tor/mytor/src/test/test+0x372f69)

0x613000000940 is located 64 bytes inside of 344-byte region [0x613000000900,0x613000000a58)
freed by thread T0 here:
    #0 0x7f7f0774ab6f in __interceptor_free ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:123
    #1 0x55a158e86508 in test_hs_control_add_onion_helper_add_service src/test/test_hs_control.c:838
    #2 0x55a1590fe77b in testcase_run_bare_ src/ext/tinytest.c:107
    #3 0x55a1590fee98 in testcase_run_forked_ src/ext/tinytest.c:201
    #4 0x55a1590fee98 in testcase_run_one src/ext/tinytest.c:267
    #5 0x55a1590ffb06 in tinytest_main src/ext/tinytest.c:454
    #6 0x55a158b1b1a4 in main src/test/testing_common.c:420
    #7 0x7f7f06f8dd09 in __libc_start_main ../csu/libc-start.c:308

previously allocated by thread T0 here:
    #0 0x7f7f0774ae8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
    #1 0x55a15948b728 in tor_malloc_ src/lib/malloc/malloc.c:45
    #2 0x55a15948b7c0 in tor_malloc_zero_ src/lib/malloc/malloc.c:71
    #3 0x55a159261bb5 in hs_service_new src/feature/hs/hs_service.c:4290
    #4 0x55a159261f49 in hs_service_add_ephemeral src/feature/hs/hs_service.c:3758
    #5 0x55a158e8619f in test_hs_control_add_onion_helper_add_service src/test/test_hs_control.c:832
    #6 0x55a1590fe77b in testcase_run_bare_ src/ext/tinytest.c:107
    #7 0x55a1590fee98 in testcase_run_forked_ src/ext/tinytest.c:201
    #8 0x55a1590fee98 in testcase_run_one src/ext/tinytest.c:267
    #9 0x55a1590ffb06 in tinytest_main src/ext/tinytest.c:454
    #10 0x55a158b1b1a4 in main src/test/testing_common.c:420
    #11 0x7f7f06f8dd09 in __libc_start_main ../csu/libc-start.c:308

SUMMARY: AddressSanitizer: heap-use-after-free src/feature/hs/hs_service.c:153 in hs_service_ht_HT_FIND_P_
Shadow bytes around the buggy address:
  0x0c267fff80d0: 00 00 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x0c267fff80e0: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c267fff80f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c267fff8100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c267fff8110: 00 00 00 00 00 00 00 00 fa fa fa fa fa fa fa fa
=>0x0c267fff8120: fd fd fd fd fd fd fd fd[fd]fd fd fd fd fd fd fd
  0x0c267fff8130: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c267fff8140: fd fd fd fd fd fd fd fd fd fd fd fa fa fa fa fa
  0x0c267fff8150: fa fa fa fa fa fa fa fa 00 00 00 00 00 00 00 00
  0x0c267fff8160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c267fff8170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==354311==ABORTING
[Lost connection!]
  [hs_control_add_onion_helper_add_service FAILED]
1/1 TESTS FAILED. (0 skipped)
2021-02-22 13:31:29 +02:00