fix(config): serialize load_primary_config against concurrent invocations (bug-1476)
myconf->lock (mylock_init/fini wiring) had landed but load_primary_config() itself was left in its RED-phase reproduction state (unguarded, decoding directly into the shared myconf->cluster_config field), so the fix's own regression test failed on resume: thread B raced through while thread A was parked mid-call. Wraps the whole free-decode-publish sequence in myconf->lock (acquired first, released on every return path) and decodes into a local cluster_config_t* first, publishing into myconf->cluster_config only after full decode and validation succeed -- closing the UAF/double-free window a live 3-node ASan soak caught (two concurrent handle_repl_config_push deliveries for the same standby racing two load_primary_config calls). Verified 4/4 clean full-suite runs (1036 tests, 0 failures) including the specific race test.
This commit is contained in:
parent
ce8df99037
commit
b08e392eeb
8 changed files with 704 additions and 31 deletions
|
|
@ -453,6 +453,16 @@ extern int (*xce_probe_config_tag_hook)(const char *host, uint16_t port,
|
|||
*/
|
||||
int load_primary_config_for_test(cluster_t *c);
|
||||
|
||||
/*
|
||||
* load_primary_config_race_hook: test-only synchronization seam. See the
|
||||
* doc comment at its definition (config_repl.c) for the exact semantics —
|
||||
* it lets a unit test deterministically force two concurrent
|
||||
* load_primary_config() calls for the SAME myconf_t through the race window
|
||||
* bug-1476's live ASan heap-use-after-free crossed. Set by test
|
||||
* infrastructure (test_config_repl.c) before the relevant tests run.
|
||||
*/
|
||||
extern void (*load_primary_config_race_hook)(void);
|
||||
|
||||
/*
|
||||
* push_ctx_t: exposed under XCE_TESTING so unit tests can construct
|
||||
* synthetic push contexts to drive wait_all_with_timeout_for_test().
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue