- 01 Dec, 2019 3 commits
-
-
global: convert to fiber-local storage to fix exit races
Edward Thomson committed -
Fix copy&paste in git_cherrypick_commit docstring
Edward Thomson committed -
patch_parse: fix out-of-bounds reads caused by integer underflow
Edward Thomson committed
-
- 29 Nov, 2019 2 commits
-
-
Dave Lee committed
-
On Windows platforms, we automatically clean up the thread-local storage upon detaching a thread via `DllMain()`. The thing is that this happens for every thread of applications that link against the libgit2 DLL, even those that don't have anything to do with libgit2 itself. As a result, we cannot assume that these unsuspecting threads make use of our `git_libgit2_init()` and `git_libgit2_shutdow()` reference counting, which may lead to racy situations: Thread 1 Thread 2 git_libgit2_shutdown() DllMain(DETACH_THREAD) git__free_tls_data() git_atomic_dec() == 0 git__free_tls_data() TlsFree(_tls_index) TlsGetValue(_tls_index) Due to the second thread never having executed `git_libgit2_init()`, the first thread will clean up TLS data and as a result also free the `_tls_index` variable. When detaching the second thread, we unconditionally access the now-free'd `_tls_index` variable, which is obviously not going to work out well. Fix the issue by converting the code to use fiber-local storage instead of thread-local storage. While FLS will behave the exact same as TLS if no fibers are in use, it does allow us to specify a destructor similar to the one that is accepted by pthread_key_create(3P). Like this, we do not have to manually free indices anymore, but will let the FLS handle calling the destructor. This allows us to get rid of `DllMain()` completely, as we only used it to keep track of when threads were exiting and results in an overall simplification of TLS cleanup.
Patrick Steinhardt committed
-
- 28 Nov, 2019 16 commits
-
-
tests: fix compiler warning if tracing is disabled
Edward Thomson committed -
tests: config: only test parsing huge file with GITTEST_INVASIVE_SPEED
Edward Thomson committed -
The test in config::stress::huge_section_with_many_values takes quite a long time to execute. Hide it behind the GITTEST_INVASIVE_SPEED environment varibale to not needlessly blow up execution time of tests. As this environment variable is being set by the continuous integration, we will execute it regularly anyway.
Patrick Steinhardt committed -
The patch format for binary files is a simple Base85 encoding with a length byte as prefix that encodes the current line's length. For each line, we thus check whether the line's actual length matches its expected length in order to not faultily apply a truncated patch. This also acts as a check to verify that we're not reading outside of the line's string: if (encoded_len > ctx->parse_ctx.line_len - 1) { error = git_parse_err(...); goto done; } There is the possibility for an integer underflow, though. Given a line with a single prefix byte, only, `line_len` will be zero when reaching this check. As a result, subtracting one from that will result in an integer underflow, causing us to assume that there's a wealth of bytes available later on. Naturally, this may result in an out-of-bounds read. Fix the issue by checking both `encoded_len` and `line_len` for a non-zero value. The binary format doesn't make use of zero-length lines anyway, so we need to know that there are both encoded bytes and remaining characters available at all. This patch also adds a test that works based on the last error message. Checking error messages is usually too tightly coupled, but in fact parsing the patch failed even before the change. Thus the only possibility is to use e.g. Valgrind, but that'd result in us not catching issues when run without Valgrind. As a result, using the error message is considered a viable tradeoff as we know that we didn't start decoding Base85 in the first place.
Patrick Steinhardt committed -
If building libgit2's test suite with tracing disabled, then the compiler will emit a warning due to the unused `message_prefix` function. Fix the issue by wrapping the whole file into ifdef's for `GIT_TRACE` and providing separate empty function implementations for both `cl_global_trace_register` and `cl_global_trace_disable`.
Patrick Steinhardt committed -
diff: complete support for git patchid
Patrick Steinhardt committed -
Memory optimizations for config entries
Patrick Steinhardt committed -
Current implementation of patchid is not computing a correct patchid when given a patch where, for example, a new file is added or removed. Some more corner cases need to be handled to have same behavior as git patch-id command. Add some more tests to cover those corner cases. Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
Gregory Herrero committed -
ssh: include sha256 host key hash when supported
Patrick Steinhardt committed -
Various examples shape-ups
Patrick Steinhardt committed -
Improve trace support in tests
Patrick Steinhardt committed -
Move `git_off_t` to `git_object_size_t`
Patrick Steinhardt committed -
Add compat typdef for git_attr_t
Edward Thomson committed -
Lukas Berk committed
-
Lukas Berk committed
-
Some libraries haven't updated to git_attr_value_t and break. Adding the comapt typedef as suggested.
Lukas Berk committed
-
- 27 Nov, 2019 4 commits
-
-
Only show test trace execution when the CLAR_TRACE_TESTS environment variable is set. This reduces the noise during tracing.
Edward Thomson committed -
Edward Thomson committed
-
Tracing is meant to be extremely low-impact when not enabled. We currently ship no tracing calls in libgit2, but if / when we do, the tracing infrastructure is created to skip tracing as quickly as possible. It should compile to a simple test when tracing is off. Thus, there's on reason to not enable it by default.
Edward Thomson committed -
CI Build Updates
Edward Thomson committed
-
- 25 Nov, 2019 5 commits
-
-
Prefer `off64_t` internally.
Edward Thomson committed -
Use int64_t internally for type visibility.
Edward Thomson committed -
Prefer `off64_t` to `git_off_t` internally for visibility.
Edward Thomson committed -
Prefer `off64_t` to `git_off_t` for internal visibility.
Edward Thomson committed -
64 bit types are always 64 bit.
Edward Thomson committed
-
- 24 Nov, 2019 10 commits
-
-
Edward Thomson committed
-
Provide usage hints to valgrind. We trust the data coming back from OpenSSL to have been properly initialized. (And if it has not, it's an OpenSSL bug, not a libgit2 bug.) We previously took the `VALGRIND` option to CMake as a hint to disable mmap. Remove that; it's broken. Now use it to pass on the `VALGRIND` definition so that sources can provide valgrind hints.
Edward Thomson committed -
valgrind will warn that OpenSSL will use undefined data in connect/read when talking to certain other TLS stacks. Thankfully, this only seems to occur when gcc is the compiler, so hopefully valgrind is just misunderstanding an optimization. Regardless, suppress this warning.
Edward Thomson committed -
We currently talk to Azure Repos for executing an online test (online::clone::path_whitespace). Add a simpler test to talk to Azure Repos to make it obvious that strange test failures are not likely the whitespace in the path, but actually a function of talking to Azure Repos itself.
Edward Thomson committed -
Our docker builds are getting expensive, let's cache some of this.
Edward Thomson committed -
Edward Thomson committed
-
The valgrind in the PPA is broken and ignores `--exit-errorcode`. Build and install our own.
Edward Thomson committed -
Edward Thomson committed
-
Edward Thomson committed
-
Use a multi-stage docker build so that we can cache early stages and not need to download the apt-provided dependencies during every build (when only later stages change).
Edward Thomson committed
-