Add mprotect syscall events#367
Open
Aegrah wants to merge 9 commits into
Open
Conversation
Collect only read-write protection changes to keep event volume bounded while exposing raw and decoded protection data to consumers. Co-authored-by: Cursor <cursoragent@cursor.com>
Preserve the new CLOCK_BOOTTIME contract while moving the mprotect queue flag to the next available bit. Co-authored-by: Cursor <cursoragent@cursor.com>
Exercise every suppressed protection mask and keep the public event representation and documentation consistent. Co-authored-by: Cursor <cursoragent@cursor.com>
Describe the permission-bit filter without implying that optional protection modifiers are rejected.
Correlate syscall entry and exit so only successful X, RX, WX, and RWX requests reach the event stream.
Collaborator
|
heya, sorry for the delay, I'm trying to priorize things that are blocking others before my final date, I assume this is not WIP anymore as the title suggests? |
Read sys_exit_mprotect return values through the tracepoint layout instead of BPF_CORE_READ, and teach t_mprotect to skip W^X-rejected executable transitions while still validating every successful X/RX/WX/RWX request the kernel accepts. Co-authored-by: Cursor <cursoragent@cursor.com>
This reverts commit 45ccaf9.
Exclude the mprotect quark-test on RHEL 9.3 alongside the existing memfd and shmget exclusions. Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Correct @haesbaert. We are passing unit tests now and should be g2g for an initial review! Removed the WIP from the title. Please be thorough on this one; any feedback I can use to improve anything pushed in the future. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Collect successful executable-memory
mprotect()calls as an eBPF-only Quark event.sys_enter_mprotectrecords address, length, and protection whenPROT_EXECis requested.sys_exit_mprotectcorrelates the call, deletes its state, and emits only when the syscall succeeded. Emitted masks are X, RX, WX, and RWX; non-executable masks and failed calls are suppressed. No kprobe fallback is added.Issue: https://github.com/elastic/endpoint-dev/issues/20408
Workflow and proof
The contract workflow built and tested Quark, regenerated package/schema outputs, built Endpoint, ran focused unit/EAF tests, deployed through Fleet, and asserted Elasticsearch output.
20260722T124741Z-mprotect-preflight: PASS20260722T142745Z-mprotecton Stack/Agent/Endpoint 9.4.2: PASS20260722T103000Z-mprotect-realistic-smoke: PASSCompanion PR