1. 09 Dec, 2020 3 commits
    • alloc: set up an allocator that fails before library init · 08f28ff5
      We require the library to be initialized with git_libgit2_init before it
      is functional.  However, if a user tries to uses the library without
      doing so - as they might when getting started with the library for the
      first time - we will likely crash.
      
      This commit introduces some guard rails - now instead of having _no_
      allocator by default, we'll have an allocator that always fails, and
      never tries to set an error message (since the thread-local state is
      set up by git_libgit2_init).  We've modified the error retrieval
      function to (try to) ensure that the library has been initialized before
      getting the thread-local error message.
      
      (Unfortunately, we cannot determine if the thread local storage has
      actually been configured, this does require initialization by
      git_libgit2_init.  But a naive attempt should be good enough for most
      cases.)
      Edward Thomson committed
    • libgit2: provide init_count of the library · 6c51014d
      A function to provide the initialization count of the library; this is
      subject to race conditions but is useful for a naive determination as to
      whether the library has been initialized or not.
      Edward Thomson committed
    • Merge pull request #5720 from libgit2/ethomson/tlsdata · a5cb2cc9
      Thread-local storage: a generic internal library (with no allocations)
      Edward Thomson committed
  2. 08 Dec, 2020 3 commits
  3. 06 Dec, 2020 5 commits
  4. 05 Dec, 2020 5 commits
  5. 29 Nov, 2020 3 commits
    • Merge pull request #5593 from lhchavez/fix-mwindow-thread-unsafety · 87e4597c
      Make the pack and mwindow implementations data-race-free
      Edward Thomson committed
    • Merge pull request #5595 from lhchavez/odb-race-free · 5699ef81
      Make the odb race-free
      Edward Thomson committed
    • Make the pack and mwindow implementations data-race-free · 322c15ee
      This change fixes a packfile heap corruption that can happen when
      interacting with multiple packfiles concurrently across multiple
      threads. This is exacerbated by setting a lower mwindow open file limit.
      
      This change:
      
      * Renames most of the internal methods in pack.c to clearly indicate
        that they expect to be called with a certain lock held, making
        reasoning about the state of locks a bit easier.
      * Splits the `git_pack_file` lock in two: the one in `git_pack_file`
        only protects the `index_map`. The protection to `git_mwindow_file` is
        now in that struct.
      * Explicitly checks for freshness of the `git_pack_file` in
        `git_packfile_unpack_header`: this allows the mwindow implementation
        to close files whenever there is enough cache pressure, and
        `git_packfile_unpack_header` will reopen the packfile if needed.
      * After a call to `p_munmap()`, the `data` and `len` fields are poisoned
        with `NULL` to make use-after-frees more evident and crash rather than
        being open to the possibility of heap corruption.
      * Adds a test case to prevent this from regressing in the future.
      
      Fixes: #5591
      lhchavez committed
  6. 28 Nov, 2020 1 commit
  7. 27 Nov, 2020 20 commits