Skip to content

Fix racy shared RX test input buffers in set_job#1

Merged
MoneroOcean merged 1 commit into
mainfrom
codex/propose-fix-for-static-rx-input-vulnerability
May 27, 2026
Merged

Fix racy shared RX test input buffers in set_job#1
MoneroOcean merged 1 commit into
mainfrom
codex/propose-fix-for-static-rx-input-vulnerability

Conversation

@MoneroOcean

Copy link
Copy Markdown
Owner

Motivation

  • A function-local static container was used for parsed RX inputs, allowing concurrent RX worker threads to read job-specific data after a later set_job reassigns it, causing racy out-of-bounds accesses and undefined behavior.
  • The change eliminates cross-job mutable shared state so worker tasks retain stable per-job input data for their lifetime.

Description

  • Replaced function-local static std::vector<std::string> new_input_hexes with a per-job std::shared_ptr<std::vector<std::string>> created from split_input(new_input_hex) and updated size checks to use the shared pointer.
  • Replaced function-local static std::vector<std::vector<uint8_t>> new_inputs with a per-job std::shared_ptr<std::vector<std::vector<uint8_t>>> and populate it from the dereferenced new_input_hexes.
  • Captured new_inputs and new_input_hexes by value in the RX worker lambda and updated all worker accesses to dereference those shared pointers (for example (*new_inputs)[thread_id] and (*new_input_hexes)[thread_id]).
  • Updated non-RX code paths (e.g. m_input_cn_len, memcpy, nonce initialization) to reference the dereferenced new_inputs so behavior is preserved while fixing lifetime/synchronization issues.

Testing

  • No automated tests or CI runs were executed in this environment after the change.

Codex Task

@MoneroOcean MoneroOcean merged commit 3ea5241 into main May 27, 2026
1 check passed
@MoneroOcean MoneroOcean deleted the codex/propose-fix-for-static-rx-input-vulnerability branch May 27, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant