Commit Graph

4974 Commits

Author SHA1 Message Date
Nick Mathewson
bb465be085 Revise our assertion and bug macros to work with -Wparentheses
On GCC and Clang, there's a feature to warn you about bad
conditionals like "if (a = b)", which should be "if (a == b)".
However, they don't warn you if there are extra parentheses around
"a = b".

Unfortunately, the tor_assert() macro and all of its kin have been
passing their inputs through stuff like PREDICT_UNLIKELY(expr) or
PREDICT_UNLIKELY(!(expr)), both of which expand to stuff with more
parentheses around "expr", thus suppressing these warnings.

To fix this, this patch introduces new macros that do not wrap
expr.  They're only used when GCC or Clang is enabled (both define
__GNUC__), since they require GCC's "({statement expression})"
syntax extension.  They're only used when we're building the
unit-test variant of the object files, since they suppress the
branch-prediction hints.

I've confirmed that tor_assert(), tor_assert_nonfatal(),
tor_assert_nonfatal_once(), BUG(), and IF_BUG_ONCE() all now give
compiler warnings when their argument is an assignment expression.

Fixes bug 27709.

Bugfix on 0.0.6, where we first introduced the "tor_assert()" macro.
2018-09-14 11:39:37 -04:00
Nick Mathewson
73a37d1e54 Check waitpid return value and exit status in tinytest.c
It's possible for a unit test to report success via its pipe, but to
fail as it tries to clean up and exit.  Notably, this happens on a
leak sanitizer failure.

Fixes bug 27658; bugfix on 0.2.2.4-alpha when tinytest was
introduced.
2018-09-12 08:57:18 -04:00
Nick Mathewson
198b6354e6 Merge remote-tracking branch 'teor/ticket27252-029' into maint-0.2.9 2018-09-11 13:08:57 -04:00
Karsten Loesing
19429fac23 Update geoip and geoip6 to the September 6 2018 database. 2018-09-11 09:26:59 +02:00
Nick Mathewson
2ec88a2a6d Tell openssl to build its TLS contexts with security level 1
Fixes bug 27344, where we'd break compatibility with old tors by
rejecting RSA1024 and DH1024.
2018-09-07 09:15:06 -04:00
Nick Mathewson
9fcb3ef787 Merge remote-tracking branch 'teor/bug27461-029' into maint-0.2.9 2018-09-07 08:46:35 -04:00
Nick Mathewson
912ae2b8dc Merge remote-tracking branch 'teor/bug27463-029' into maint-0.2.9 2018-09-07 08:44:36 -04:00
teor
8ef4bb7f3e
Windows: Stop calling SetProcessDEPPolicy() on 64-bit Windows
It is not supported, and always fails. Some compilers warn about the
function pointer cast on 64-bit Windows.

Fixes bug 27461; bugfix on 0.2.2.23-alpha.
2018-09-07 12:58:11 +10:00
teor
9d5c6317b5
hs: Silence a spurious warning in rend_client_send_introduction()
gcc 8 warns that extend_info_t.nickname might be truncated by strncpy().

But it doesn't know that nickname can either contain a hex id, or a
nicknames. hex ids are only used for general and HSDir circuits.

Fixes bug 27463; bugfix on 0.1.1.2-alpha.
2018-09-07 12:40:11 +10:00
teor
1570f17f97
Windows: Silence a spurious warning in the GetAdaptersAddresses cast
GetProcAddress() returns FARPROC, which is (long long int(*)()) on
64-bit Windows:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms683212(v=vs.85).aspx

But GetAdaptersAddresses() is (long unsigned int(*)()), on both 32-bit
and 64-bit Windows:
https://docs.microsoft.com/en-us/windows/desktop/api/iphlpapi/nf-iphlpapi-getadaptersaddresses

So gcc 8 issues a spurious "incompatible function pointer" warning
about the cast to GetAdaptersAddresses_fn_t.

Silence this warning by casting to a void function pointer, before
the cast to GetAdaptersAddresses_fn_t.

This issue is already fixed by 26481 in 0.3.5 and later, by removing
the lookup and cast.

Fixes bug 27465; bugfix on 0.2.3.11-alpha.
2018-09-07 11:03:10 +10:00
Nick Mathewson
ff1486385a Merge remote-tracking branch 'teor/bug27418-029' into maint-0.2.9 2018-09-05 10:14:56 -04:00
teor
35b0ac8d84
Travis: don't call echo with a --flag as the first argument
When we use echo in Travis, don't pass a --flag as the first argument.

Fixes bug 27418; bugfix on 0.3.4.7-rc.
2018-09-05 14:02:46 +10:00
teor
4e4b6a2476
Travis: when showing a log fails, keep trying to show other logs
When a Travis build fails, and showing a log fails, keep trying to
show the other logs.

Fixes bug 27453; bugfix on 0.3.4.7-rc.
2018-09-05 13:12:54 +10:00
teor
541b89b061
Test: avoid spurious failures in make test-network-all
Before running make test-network-all, delete old logs and test result
files, to avoid spurious failures.

Fixes bug 27295; bugfix on 0.2.7.3-rc.
2018-08-29 10:47:20 +10:00
teor
cc4ea34a26
Silence a compilation warning on MSVC 2017 and clang-cl
test.c no longer uses lround(), so we don't need to declare it,
and we can use math.h for fabs().

Fixes bug 27185; bugfix on 0.2.2.2-alpha.
2018-08-24 09:15:04 +10:00
teor
7cea5a287f
Travis: Skip gcc on Linux with default settings
It's redundant, because all the non-default builds use gcc on Linux.

Part of 27252.
2018-08-23 18:13:53 +10:00
teor
7ec84cc094
Travis: Skip a duplicate hardening-off build in Tor 0.2.9
Part of 27252.
2018-08-23 17:08:28 +10:00
teor
8f89fb8f39
Travis: skip gcc on OSX, because the default compiler is clang
Part of #27252.
2018-08-23 17:02:32 +10:00
Nick Mathewson
05d62a3b73 Merge remote-tracking branch 'teor/travis-osx-029' into maint-0.2.9 2018-08-21 20:03:19 -04:00
Nick Mathewson
85a8792344 Rewrite test_tortls_cert_matches_key()
Unlike the old test, this test no will no longer mess around with
the forbidden internals of any openssl data structures.

Additionally, it verifies several other behaviors of
tor_tls_cert_matches_key() that we had wanted to verify, such as
the possibility of the certificate's key not matching.

Fixes bug 27226; bugfix on 0.2.5.1-alpha.
2018-08-20 17:43:41 -04:00
Nick Mathewson
4c355ff185 Merge remote-tracking branch 'github/bug27081_029' into maint-0.2.9 2018-08-15 12:20:53 -04:00
teor
4cd3fcf248
Changes file for Travis: enable macOS builds 2018-08-10 12:10:56 +10:00
teor
23b242104b
Travis: run an asciidoc build
Implements 27087.
2018-08-09 22:19:00 +10:00
teor
286a6bc3b8
Travis: Use ccache
Part of ticket 26952.
2018-08-09 22:18:53 +10:00
teor
7cf7b52fca
Travis: create configure flags once, then echo the flags
Creating the configure flags once avoids inconsistent flags
between configure and distcheck configure.

Echoing the flags helps developers work out what configure is
doing.

(Backported to 0.2.9 and later as a precaution.)

Fixes 27088 on 0.3.4.1-alpha, adds logging in previous releases.
2018-08-09 22:18:12 +10:00
Karsten Loesing
fe19b40fe9 Update geoip and geoip6 to the August 7 2018 database. 2018-08-09 09:44:38 +02:00
Taylor Yu
340da669be
Add more optional packages to Travis
Apparently we weren't building with either libcap or libseccomp on
Travis.  Install libcap-dev and libseccomp-dev in .travis.yml.  Closes
ticket 26560.
2018-08-09 16:51:42 +10:00
Nick Mathewson
7a570b8182 Don't search for -lpthread on Windows
If we're building for Windows, we want to use windows threads no
matter what, and we don't want to link a pthread library even if it
is present.  Fixes bug 27081; bugfix on 1790dc6760 in 0.1.0.1-rc.
2018-08-08 09:56:51 -04:00
Nick Mathewson
27a2a6cb9b Changes file for 25440 2018-08-08 09:26:21 -04:00
Nick Mathewson
42c6ebda16 Merge branch 'fix_nonstandard_malloc_029' into maint-0.2.9 2018-08-03 07:33:39 -04:00
teor
6443812e34 Stop logging link auth warnings on Single Onion Services and Tor2web
Instead, log a protocol warning when single onion services or
Tor2web clients fail to authenticate direct connections to relays.

Fixes bug 26924; bugfix on 0.2.9.1-alpha.
2018-07-25 14:30:33 +10:00
Nick Mathewson
93da2cae49 Changes file for bug 26787 2018-07-18 16:39:22 -04:00
Nick Mathewson
a321d72401 Merge branch 'bug26485_029_squashed' into maint-0.2.9 2018-07-18 15:01:03 -04:00
Nick Mathewson
dcee4d4c9c Warn the directory authority operator if their versions list is bogus
Prevents bug 26485; bugfix on 0.1.1.6-alpha.
2018-07-18 15:00:53 -04:00
teor
6dafddd05d SKIP test_keygen.sh on Windows until the underlying issue is resolved
Skip an unreliable key generation test on Windows, until the underlying
issue in bug 26076 is resolved.

Fixes bug 26830; bugfix on 0.2.7.3-rc.
2018-07-17 14:56:18 -04:00
Roger Dingledine
cd4795ca3e put new bridge auth Serge into place
The "Bifroest" bridge authority has been retired; the new bridge authority
is "Serge", and it is operated by George from the TorBSD project.

Closes ticket 26771.
2018-07-12 14:12:13 -04:00
Nick Mathewson
16bdbddc2c When setting a nonstandard malloc, disable the system malloc.
Closes ticket 20424.
2018-07-11 09:37:29 -04:00
Nick Mathewson
8b53dfc362 Merge branch 'bug26269_029' into maint-0.2.9 2018-07-09 10:14:39 -04:00
Karsten Loesing
9faa28b60e Update geoip and geoip6 to the July 3 2018 database. 2018-07-06 20:54:03 +02:00
Nick Mathewson
fc5f8b6931 ntor_ref.py: pass only strings to subprocess.Popen
Recent Python3 versions seem to require this on Windows.

Fixes bug 26535; bug introduced in f4be34f70d, which
was apparently intended itself as a Python3 workaround.
2018-07-02 14:18:41 -04:00
Nick Mathewson
890bc15ab6 Changes file for 26467 2018-06-29 13:04:29 -04:00
Nick Mathewson
47ee7978fe Prefer recent Python 3 in autoconf.
Closes ticket 26372.
2018-06-21 09:31:01 -04:00
Nick Mathewson
015fcd0e11 Fix a GCC "potential null dereference" warning.
Fixes bug 26269; bugfix on c30be5a82d in 0.2.8.2-alpha
2018-06-13 10:34:53 -04:00
Linus Nordberg
2ef448da2f Add a changelog entry. 2018-06-12 09:44:01 -04:00
Karsten Loesing
ae540569ce Update geoip and geoip6 to the June 7 2018 database. 2018-06-11 21:58:55 +02:00
rl1987
719b5c1d27 Avoid out-of-bounds smartlist access in protover_compute_vote()
and contract_protocol_list()
2018-06-08 10:11:32 -04:00
Nick Mathewson
c380562aed Merge branch 'bug26116_029' into maint-0.2.9 2018-05-24 09:39:46 -04:00
Nick Mathewson
d1e4ffc710 Merge branch 'bug26072_029' into maint-0.2.9 2018-05-16 12:11:40 -04:00
Nick Mathewson
881f7157f6 Return -1 from our PEM password callback
Apparently, contrary to its documentation, this is how OpenSSL now
wants us to report an error.

Fixes bug 26116; bugfix on 0.2.5.16.
2018-05-16 11:39:42 -04:00
Karsten Loesing
033e4723f3 Update geoip and geoip6 to the May 1 2018 database. 2018-05-15 15:20:09 +02:00