1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 02:21:16 +02:00
nix/src
Dominique Martinet 0ccd1fa0a4 libutil: thread-pool: ensure threads finished on error
This fixes segfaults with nix copy when there was an error processing
addMultipleToStore.

Running with ASAN/TSAN pointed at an use-after-free with threads from
the pool accessing the graph declared in processGraph after the function
was exiting and destructing the variables.

It turns out that if there is an error before pool.process() is called,
for example while we are still enqueuing tasks, then pool.process()
isn't called and threads are still left to run.

By creating the pool last we ensure that it is stopped first before
running other destructors even if an exception happens early.

[ lix porting note: nix does not name threads so the patch has been
adapted to not pass thread name ]

Link: https://git.lix.systems/lix-project/lix/issues/618
Link: https://gerrit.lix.systems/c/lix/+/2355
(cherry picked from commit afac093b34)
2025-01-13 08:03:12 +00:00
..
build-remote build-remote: only allocate storeUri once 2024-07-25 14:04:03 +02:00
external-api-docs make doxygen build more silent 2024-10-22 09:53:49 +02:00
internal-api-docs make doxygen build more silent 2024-10-22 09:53:49 +02:00
libcmd libcmd: update to support lowdown-1.4 API 2025-01-10 09:43:18 +00:00
libexpr Merge pull request #12210 from NixOS/mergify/bp/2.25-maintenance/pr-11294 2025-01-10 20:39:33 +00:00
libexpr-c Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
libexpr-test-support Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
libexpr-tests parser-state: fix attribute merging 2025-01-10 10:40:07 +00:00
libfetchers ParsedURL: Remove base field 2025-01-10 13:37:05 +01:00
libfetchers-tests Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
libflake parsePathFlakeRefWithFragment(): Handle query params in the non-git case 2025-01-10 13:37:28 +01:00
libflake-tests Attempt to make the FlakeRef test succeed on macOS 2025-01-10 13:37:40 +01:00
libmain fix(libmain/common-args): do not exceed maximum allowed verbosity 2025-01-10 10:04:40 +00:00
libmain-c Set Windows API version in Meson 2024-11-05 23:36:08 +11:00
libstore libutil: thread-pool: ensure threads finished on error 2025-01-13 08:03:12 +00:00
libstore-c Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
libstore-test-support Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
libstore-tests Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
libutil libutil: thread-pool: ensure threads finished on error 2025-01-13 08:03:12 +00:00
libutil-c Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
libutil-test-support Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
libutil-tests ParsedURL: Remove base field 2025-01-10 13:37:05 +01:00
nix nix upgrade-nix: Give a better error message if the profile is using 'nix profile' 2025-01-11 20:07:00 +00:00
nix-build Fix issue 11892 2024-11-26 11:19:29 +00:00
nix-channel Don't use OS_STR in nix-channel.cc 2024-08-18 18:27:20 +05:30
nix-collect-garbage More std::filesystem for nix-collect-garbage 2024-08-26 17:29:23 -04:00
nix-copy-closure Restrict some code to StoreDirConfig 2023-11-04 19:05:36 -04:00
nix-env MacOS built: add workaround for missing view() member of std::ostringstream 2024-10-07 02:05:53 +02:00
nix-instantiate No global settings in libnixfetchers and libnixflake 2024-07-12 08:50:28 -04:00
nix-store fix: Resolve CLI parent symlinks before adding to store 2025-01-07 06:03:57 +00:00
perl Revert "Merge pull request #11804 from obsidiansystems/remove-old-make" 2024-11-07 13:46:37 +01:00
nix-functional-tests Build Functional tests with Meson 2024-08-14 15:35:40 -04:00
nix-manual Build the manual with Meson 2024-10-09 11:58:17 -04:00