Skip to content

Fix UB shm allocation cleanup crashes#11

Merged
zchuango merged 1 commit into
zchuango:ubshm_transport_devfrom
YChange01:ubshm_transport_dev
May 29, 2026
Merged

Fix UB shm allocation cleanup crashes#11
zchuango merged 1 commit into
zchuango:ubshm_transport_devfrom
YChange01:ubshm_transport_dev

Conversation

@YChange01
Copy link
Copy Markdown

Summary

  • Reserve POSIX shm backing with posix_fallocate() after ftruncate() on Linux and validate remote object size before mmap().
  • Clear shm pointers after unmap/free and remove double remote-free paths.
  • Return EMSGSIZE for payloads that cannot fit in the ring and fix fd truncation in the handshake.

Test Plan

  • git diff --check
  • cmake --build build --target brpc_ubshm_unittest -j 8
  • ./build/test/brpc_ubshm_unittest

Note: local macOS sandbox skips POSIX shm tests because shm_open returns EPERM; Linux should execute them.

Related to apache#3290 reviewer crash reports.

@zchuango zchuango merged commit c72e671 into zchuango:ubshm_transport_dev May 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants