summaryrefslogtreecommitdiff
path: root/src/lib
AgeCommit message (Collapse)Author
2023-11-03Fix TROVE-2023-004: Remote crash when compiled against OpenSSLAlexander Færøy
Fixes #40874 Signed-off-by: David Goulet <dgoulet@torproject.org>
2023-09-14Lower the log-level and soften the language for our Zstd ABI compat check.Alexander Færøy
See: tpo/core/tor#40815.
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-05-31Update CI builds to Debian Bullseye, fix associated compatibility bugsMicah Elizabeth Scott
This is a change intended for 0.4.7 maintenance as well as main. The CI builds use Debian Buster which is now end of life, and I was experiencing inconsistent CI failures with accessing its security update server. I wanted to update CI to a distro that isn't EOL, and Bullseye is the current stable release of Debian. This opened up a small can of worms that this commit also deals with. In particular there's a docker engine bug that we work around by removing the docker-specific apt cleanup script if it exists, and there's a new incompatibility between tracing and sandbox support. The tracing/sandbox incompatibility itself had two parts: - The membarrier() syscall is used to deliver inter-processor synchronization events, and the external "userspace-rcu" data structure library would make assumptions that if membarrier is available at initialization it always will be. This caused segfaults in some cases when running trace + sandbox. Resolved this by allowing membarrier entirely, in the sandbox. - userspace-rcu also assumes it can block signals, and fails hard if this can't be done. We already include a similar carveout to allow this in the sandbox for fragile-hardening, so I extended that to cover tracing as well. Addresses issue #40799 Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2023-01-25Merge branch 'maint-0.4.5' into maint-0.4.7David Goulet
2023-01-25compress_lzma: New enum values from liblzma 5.3.xmaint-0.4.5Micah Elizabeth Scott
Add new liblzma enums (LZMA_SEEK_NEEDED and LZMA_RET_INTERNAL*) conditional to the API version they arrived in. The first stable version of liblzma this affects is 5.4.0 Fixes #40741 Signed-off-by: Micah Elizabeth Scott <beth@torproject.org>
2022-12-20Enable IP_BIND_ADDRESS_NO_PORT if supportedAlex Xu (Hello71)
Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-11-23relay: Use the configured number of threads for worker work calculationDavid Goulet
We cap our number of CPU worker threads to at least 2 even if we have a single core. But also, before we used to always add one extra thread regardless of the number of core. This meant that we were off when re-using the get_num_cpus() function when calculating our onionskin work overhead because we were always off by one. This commit makes it that we always use the number of thread our actual thread pool was configured with. Fixes #40719 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-11-09relay: Make the max pending tasks per CPU a consensus parameterDavid Goulet
Until now, there was this magic number (64) used as the maximum number of tasks a CPU worker can take at once. This commit makes it a consensus parameter so our future selves can think of a better value depending on network conditions. Part of #40704 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-11-09metrics: Use N_EWMA for moving avg, with N=100.Mike Perry
Part of #40708.
2022-11-07math: Replace naughty macro by an inline functionDavid Goulet
Part of #40708 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-11-07metrics: Add running average of CC cwnd when exiting slow startDavid Goulet
Part of #40708 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-28thread: Bump max detectable CPU from 16 to 128David Goulet
Lets take advantage of those beefy machines ;). Closes #40703 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-10-14Merge branch 'maint-0.4.5' into maint-0.4.7David Goulet
2022-10-13Fix a completely wrong calculation in mach monotime_init_internal()Nick Mathewson
Bug 1: We were purporting to calculate milliseconds per tick, when we *should* have been computing ticks per millisecond. Bug 2: Instead of computing either one of those, we were _actually_ computing femtoseconds per tick. These two bugs covered for one another on x86 hardware, where 1 tick == 1 nanosecond. But on M1 OSX, 1 tick is about 41 nanoseconds, causing surprising results. Fixes bug 40684; bugfix on 0.3.3.1-alpha.
2022-05-09Merge branch 'maint-0.4.6' into maint-0.4.7Alexander Færøy
2022-05-09Merge branch 'maint-0.4.5' into maint-0.4.6Alexander Færøy
2022-05-09sandbox: Permit rseq syscall as wellpmu-ipf
This was found to be necessary in conjunction with glibc 2.35 on Linux. Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
2022-03-28Merge branch 'maint-0.4.6'David Goulet
2022-03-28Merge branch 'maint-0.4.5' into maint-0.4.6David Goulet
2022-03-28Merge branch 'tor-gitlab/mr/556' into maint-0.4.5David Goulet
2022-03-27Sandbox: Permit the clone3 system callNick Mathewson
Apparently glibc-2.34 uses clone3, when previously it just used clone. Closes ticket #40590.
2022-03-16Merge branch 'tor-gitlab/mr/490'David Goulet
2022-03-15crypto: Clarifying comment for the random hostname calculationDavid Goulet
Closes #40520 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-02-25Fix typosDimitris Apostolou
2022-02-09Merge branch 'tor-gitlab/mr/518'David Goulet
2022-02-08nss: Don't write empty payload on the wireDavid Goulet
Part of #40548 Signed-off-by: David Goulet <dgoulet@torproject.org>
2022-01-23conn: add ClientHello Padding TLS extensionpseudonymisaTor
2021-11-08Merge remote-tracking branch 'tor-gitlab/mr/485' into mainAlexander Færøy
2021-11-05Prefer use of __MINGW_PRINTF/SCANF_FORMAT if available.Nick Mathewson
Mingw headers sometimes like to define alternative scanf/printf format attributes depending on whether they're using clang, UCRT, MINGW_ANSI_STDIO, or the microsoft version of printf/scanf. This change attempts to use the right one on the given platform. This is an attempt to fix part of #40355.
2021-11-05sandbox: Allow "statx" syscall on i386 for glibc 2.33Simon South
glibc versions 2.33 and newer use the modern "statx" system call in their implementations of stat() and opendir() for Linux on i386. Prevent failures in the sandbox unit tests by modifying the sandbox to allow this system call without restriction on i386 when it is available, and update the test suite to skip the "sandbox/stat_filename" test in this case as it is certain to fail.
2021-11-05sandbox: Allow "clock_gettime64" syscall where definedSimon South
On 32-bit architectures where Linux provides the "clock_gettime64" system call, including i386, glibc uses it in place of "clock_gettime". Modify the sandbox implementation to match, to prevent Tor's monotonic-time functions (in src/lib/time/compat_time.c) failing when the sandbox is active.
2021-11-05sandbox: Filter "chown32" syscall on i386Simon South
On i386 glibc uses the "chown32" system call instead of "chown". Prevent attempts to filter calls to chown() on this architecture from failing by modifying the sandbox implementation to match.
2021-10-14Merge remote-tracking branch 'tor-gitlab/mr/433' into mainAlexander Færøy
2021-10-04net: Reject invalid characters in port rangesc
Fixes issue #22469 where port strings such as '0x00' get accepted, not because the string gets converted to hex, but because the string is silently truncated past the invalid character 'x'. This also causes issues for strings such as '0x01-0x02' which look like a hex port range, but in reality gets truncated to '0', which is definitely not what a user intends. Warn and reject such port strings as invalid. Also, since we're throwing that "malformed port" warning a lot in the function, wrap it up in a nice goto. Fixes #22469
2021-09-28sandbox: Allow use with fragile hardeningSimon South
When building with --enable-fragile-hardening, add or relax Linux seccomp rules to allow AddressSanitizer to execute normally if the process terminates with the sandbox active. Further resolves issue 11477.
2021-09-09Fix compilation error when __NR_time is not defined. #40465Daniel Pinto
2021-08-11Merge branch 'maint-0.4.6' into mainAlexander Færøy
2021-08-11Merge branch 'maint-0.4.5' into maint-0.4.6Alexander Færøy
2021-08-11Merge branch 'maint-0.3.5' into maint-0.4.5Alexander Færøy
2021-08-11Disable ed25519-donna's batch verification.George Kadianakis
Fixes bug 40078. As reported by hdevalence our batch verification logic can cause an assert crash. The assert happens because when the batch verification of ed25519-donna fails, the code in `ed25519_checksig_batch()` falls back to doing a single verification for each signature. The crash occurs because batch verification failed, but then all signatures individually verified just fine. That's because batch verification and single verification use a different equation which means that there are sigs that can pass single verification but fail batch verification. Fixing this would require modding ed25519-donna which is not in scope for this ticket, and will be soon deprecated in favor of arti and ed25519-dalek, so my branch instead removes batch verification.
2021-08-11relay: Reduce streaming compression ratio from HIGH to LOWDavid Goulet
Fixes #40301 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-08-11relay: Reduce streaming compression ratio from HIGH to LOWDavid Goulet
Fixes #40301 Signed-off-by: David Goulet <dgoulet@torproject.org>
2021-07-06Merge branch 'maint-0.4.6'George Kadianakis
2021-07-06Merge branch 'maint-0.4.5' into maint-0.4.6George Kadianakis
2021-07-06Merge branch 'mr/395' into maint-0.4.5George Kadianakis
2021-07-06Use native timegm when available.Nick Mathewson
Continue having a tor_gmtime_impl() unit test so that we can detect any problems in our replacement function; add a new test function to make sure that gmtime<->timegm are a round-trip on now-ish times. This is a fix for bug #40383, wherein we ran into trouble because tor_timegm() does not believe that time_t should include a count of leap seconds, but FreeBSD's gmtime believes that it should. This disagreement meant that for a certain amount of time each day, instead of calculating the most recent midnight, our voting-schedule functions would calculate the second-most-recent midnight, and lead to an assertion failure. I am calling this a bugfix on 0.2.0.3-alpha when we first started calculating our voting schedule in this way.
2021-06-29Merge branch 'maint-0.4.5' into maint-0.4.6David Goulet
2021-06-29Merge branch 'maint-0.4.6'David Goulet
2021-06-28Suppress strict-prototypes warning on NSS pk11pub.h headerNick Mathewson
We already did this in a couple of places, but there are more that we didn't get. This is necessary for systems with versions of NSS that don't do their prototypes properly. Fixes #40409; bugfix on 0.3.5.1-alpha.