Skip to content

Fix interconnection udpifc UAF in ipc teardown#95

Merged
avamingli merged 1 commit intoapache:mainfrom
avamingli:pick_ic_proxy
Jul 27, 2023
Merged

Fix interconnection udpifc UAF in ipc teardown#95
avamingli merged 1 commit intoapache:mainfrom
avamingli:pick_ic_proxy

Conversation

@avamingli
Copy link
Copy Markdown
Contributor

Cherry-pick from Gitlab master branch to fix udpifc crash.

Problem details:

In function chunkTransportStateEntryInitialized got wrong valid with motNodeID When tear down happen in udpifc, the outgoing route may not delete entry in shared htab. The htab will be shared with rxthread.

After main thread tear down, some of conns will be freed by MemoryContextReset But in the same time, htab will hold the invalid conn ptr in rxthread Then got core dump.

Fixed:

Changed the chunkTransportStateEntryInitialized, using the getChunkTransportState* to get the right entry Also do not direct access states in ChunkTransportState.

closes: #ISSUE


Change logs

Describe your change clearly, including what problem is being solved or what feature is being added.

If it has some breaking backward or forward compatibility, please clary.

Why are the changes needed?

Describe why the changes are necessary.

Does this PR introduce any user-facing change?

If yes, please clarify the previous behavior and the change this PR proposes.

How was this patch tested?

Please detail how the changes were tested, including manual tests and any relevant unit or integration tests.

Contributor's Checklist

Here are some reminders before you submit the pull request:

  • Document changes
  • Communicate in the GitHub Issues or Discussions (list them if needed)
  • Add tests for the change
  • Pass make installcheck
  • Pass make -C src/test installcheck-cbdb-parallel

@avamingli avamingli requested review from jiaqizho and my-ship-it July 26, 2023 04:56
@avamingli avamingli added the priority: High After critical issues are fixed, these should be dealt with before any further issues. label Jul 26, 2023
Problem details:

In function chunkTransportStateEntryInitialized got **wrong** valid with motNodeID
When tear down happen in udpifc, the outgoing route may not delete entry in shared htab.
The htab will be shared with rxthread.

After main thread tear down, some of conns will be freed by MemoryContextReset
But in the same time, htab will hold the invalid conn ptr in rxthread Then got core dump.

Fixed:

Changed the chunkTransportStateEntryInitialized, using the getChunkTransportState* to get the right entry
Also do not direct access states in ChunkTransportState.
@jiaqizho
Copy link
Copy Markdown
Contributor

LGTM

@avamingli avamingli merged commit 36a9f1d into apache:main Jul 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: High After critical issues are fixed, these should be dealt with before any further issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants