Skip to content

Cherry-Pick #5263#5265

Closed
kumarvin123 wants to merge 4 commits into
mainfrom
user/vinodko/v1.2-procdump
Closed

Cherry-Pick #5263#5265
kumarvin123 wants to merge 4 commits into
mainfrom
user/vinodko/v1.2-procdump

Conversation

@kumarvin123
Copy link
Copy Markdown
Contributor

Description

Cherry-Pick #5263

Describe the purpose of and changes within this Pull Request.
Please reference an issue with a keyword such as Fixes #abc, Closes #xyz, etc., so the work can be tracked.

Testing

Do any existing tests cover this change? Are new tests needed?

If new tests were added:

  • Unit tests are added.
  • Driver tests are added.

Documentation

Is there any documentation impact for this change?

Installation

Is there any installer impact for this change?

kumarvin123 and others added 4 commits May 5, 2026 22:00
* Adding connect_redirect_tests.exe to vpack (#5208)

* Added tcp_udp_listener.exe to vpack (#5211)

* Remove map level lock from custom map operations. (#5186)

* remove lock, add concurrency test

* remove lock from delete flow

* cr comments, make delete entry callback void

* fix tests

* remove fault injection from delete entry path

* fix test failure

* Update tests/end_to_end/end_to_end.cpp

Co-authored-by: Dave Thaler <dthaler1968@gmail.com>

* fix

* fix

* update tests

---------

Co-authored-by: Dave Thaler <dthaler1968@gmail.com>

* [custom maps] bugfix: Update check for `pre-free` case (#5224)

* fix

* fix leak

---------

Co-authored-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com>
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Adding connect_redirect_tests.exe to vpack (#5208)

* Added tcp_udp_listener.exe to vpack (#5211)

* Remove map level lock from custom map operations. (#5186)

* remove lock, add concurrency test

* remove lock from delete flow

* cr comments, make delete entry callback void

* fix tests

* remove fault injection from delete entry path

* fix test failure

* Update tests/end_to_end/end_to_end.cpp

Co-authored-by: Dave Thaler <dthaler1968@gmail.com>

* fix

* fix

* update tests

---------

Co-authored-by: Dave Thaler <dthaler1968@gmail.com>

* Fix OneBranch signed-nupkg repack after #5131 (#5210)

PR #5131 made nuget.vcxproj and redist-package.vcxproj incrementally
correct, which inadvertently broke the OneBranch post-signing repack.
The post-build.ps1 script re-invokes MSBuild on these projects to
repack nupkgs with signed binaries, but MSBuild now correctly skips
the CustomBuild step because the output nupkg from the initial build
is newer than all tracked AdditionalInputs (none of which changed
during signing).

Add a ForceRepack target that deletes the existing nupkg before the
up-to-date check, gated on /p:ForceRepack=true so normal incremental
builds are unaffected. Update post-build.ps1 to pass ForceRepack=true
on the nuget and redist-package repack calls.

Co-authored-by: Michael Agun <danielagun@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com>
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
Co-authored-by: D. Michael Agun <mikeagun@gmail.com>
Co-authored-by: Michael Agun <danielagun@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Updating Prodcump.zip Hash (#5252)

* Miscellaneous Bug Fixes for 26_05  (#5229)

* IOCTL Interface changes

* Ring Buffer Unmap changes

* Fix perf_event_array test for ring buffer unmap API change

* Fix SAL annotations on unused unmap parameters

Change _In_ to _In_opt_ for consumer, producer, and data parameters
in ebpf_ring_buffer_map_unmap_buffer_with_index since these values
are no longer used (the kernel now stores addresses internally).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Merged PR 15195991: Fix perf event array and ring buffer re-open failure within same process

Depends on !15195978

Commit a04a1529: Fix perf event array re-open failure within same process

When ebpf_map_subscribe maps per-CPU rings via EBPF_OPERATION_MAP_QUERY_BUFFER, the kernel sets user_consumer_address on each ring. When ebpf_map_unsubscribe later
cancels async IOCTLs, it never sends EBPF_OPERATION_RING_BUFFER_MAP_UNMAP_BUFFER to clear that address. A subsequent perf_buffer__new on the same map then fails
with EBPF_INVALID_ARGUMENT because ebpf_ring_map_user rejects the already-mapped ring.

Fix: In ebpf_map_unsubscribe, collect per-CPU IDs before cancellation erases contexts, then send unmap IOCTLs after all async completions drain. This clears
user_consumer_address in the kernel, allowing re-subscription.

Add tests:

 - Unit: perf_event_array_map_unmap_remap — validates kernel-side map/unmap/remap
 cycle on a perf event array per-CPU ring.
 - API: perf_buffer_async_reopen — creates and frees an async perf buffer, then
 creates a second on the same map and verifies events are received.
 - API: perf_buffer_sync_reopen — same pattern for synchronous perf buffers.

----
Bug fix to allow perf event array and ring buffer maps to be re-opened within the same process by properly unmapping per-CPU ring buffers during subscription cleanup.

Fixes a failure when attempting to create a second perf buffer or ring buffer on the same map within the same process by ensuring per-CPU ring buffers are unmapped during cleanup, allowing the kernel to clear user-mode mappings.

- `ebpf_api.cpp`: Modified `ebpf_map_unsubscribe` to collect CPU IDs and call `ebpf_ring_buffer_map_unmap_buffer_with_handle` for each per-CPU ring buffer after async context cancellation, and extracted shared unmap IOCTL logic into helper function
- `api_test.cpp`: Added four new test cases (`perf_buffer_async_reopen`, `perf_buffer_sync_reopen`, `ring_buffer_async_reopen`, `ring_buffer_sync_reopen`) to validate re-opening perf/ring buffers on the same map, and added `release_perf_buffer` helper method to test helper class
- `execution_context_unit_test.cpp`: Added kernel-side unit tests (`perf_event_array_map_unmap_remap`, `ring_buffer_map_unmap_remap`) to validate map-unmap-remap cycles work correctly
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->

* Fixed an analysis error and a CR comment

* Updated ProcDump hash zip

* Fixed the stale offset in perf_buffer_async_reopen and ring_buffer_async_reopen

---------

Co-authored-by: Michael Agun <danielagun@microsoft.com>
Co-authored-by: Alan Jowett <Alan.Jowett@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Michael Agun <danielagun@microsoft.com>
Co-authored-by: Alan Jowett <Alan.Jowett@microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@kumarvin123 kumarvin123 deleted the user/vinodko/v1.2-procdump branch May 13, 2026 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant