aboutsummaryrefslogtreecommitdiff
path: root/src/lib
AgeCommit message (Collapse)Author
2022-10-14Merge branch 'maint-0.4.7'David Goulet
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-07-07LibreSSL 3.5 compatibilityAlex Xu (Hello71)
LibreSSL is now closer to OpenSSL 1.1 than OpenSSL 1.0. According to https://undeadly.org/cgi?action=article;sid=20220116121253, this is the intention of OpenBSD developers. According to #40630, many special cases are needed to compile Tor against LibreSSL 3.5 when using Tor's OpenSSL 1.0 compatibility mode, whereas only a small number of #defines are required when using OpenSSL 1.1 compatibility mode. One additional workaround is required for LibreSSL 3.4 compatibility. Compiles and passes unit tests with LibreSSL 3.4.3 and 3.5.1.
2022-05-31Fix dispatch_cfg_t commentAlex Xu (Hello71)
2022-05-16Merge branch 'tor-gitlab/mr/561'David Goulet
2022-05-16Merge branch 'tor-gitlab/mr/562'David Goulet
2022-05-09Merge branch 'maint-0.4.6' into maint-0.4.7Alexander Færøy
2022-05-09Merge branch 'maint-0.4.7'Alexander 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-05-04sandbox: replace SCMP_CMP_NEG with masked equality checksPierre Bourdon
For some syscalls the kernel ABI uses 32 bit signed integers. Whether these 32 bit integer values are sign extended or zero extended to the native 64 bit register sizes is undefined and dependent on the {arch, compiler, libc} being used. Instead of trying to detect which cases zero-extend and which cases sign-extend, this commit uses a masked equality check on the lower 32 bits of the value.
2022-04-30sandbox: filter {chown,chmod,rename} via their *at variant on Aarch64Pierre Bourdon
The chown/chmod/rename syscalls have never existed on AArch64, and libc implements the POSIX functions via the fchownat/fchmodat/renameat syscalls instead. Add new filter functions for fchownat/fchmodat/renameat, not made architecture specific since the syscalls exists everywhere else too. However, in order to limit seccomp filter space usage, we only insert rules for one of {chown, chown32, fchownat} depending on the architecture (resp. {chmod, fchmodat}, {rename, renameat}).
2022-04-30sandbox: fix openat filtering on AArch64Pierre Bourdon
New glibc versions not sign-extending 32 bit negative constants seems to not be a thing on AArch64. I suspect that this might not be the only architecture where the sign-extensions is happening, and the correct fix might be instead to use a proper 32 bit comparison for the first openat parameter. For now, band-aid fix this so the sandbox can work again on AArch64.
2022-04-23geoip: make geoip_get_country_by_* STATICAlex Xu (Hello71)
slightly simplifies code and reduces compiled size.
2022-04-20Use tor_event_free instead of event_del+tor_freeAlex Xu (Hello71)
Using tor_free is wrong; event_free must be called for objects obtained from event_new. Additionally, this slightly simplifies the code. Also, add a static_assert to prevent further instances.
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.
2021-06-10Merge branch 'maint-0.4.6'Nick Mathewson
2021-06-10Merge branch 'maint-0.4.5' into maint-0.4.6Nick Mathewson