Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_process_tree: add seqid, PID matching based on position in process sequence #958

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

psrok1
Copy link
Member

@psrok1 psrok1 commented Sep 2, 2024

Timestamps were used by build_process_tree to solve problem with PID reuse in Windows. It's not ideal solution because resolution of these timestamps is not high enough to be an unique identifier of an event in sequence. In the same time, process tree is build from procmon.log that has two specific properties:

  • First entries in procmon.log are RunningProcess entries

    {"Plugin": "procmon", "TimeStamp": "1725031702.563155", "PID": 4, "PPID": 0, "RunningProcess": "System"}
    {"Plugin": "procmon", "TimeStamp": "1725031702.563245", "PID": 92, "PPID": 4, "RunningProcess": "Registry"}
    

    These entries are list of kernel EPROCESS objects listed to show initial state of processes when Drakvuf was started. This list may contain both active and already terminated processes that are in signalled state and are waiting for removal (concept similar to zombie processes in Linux). PIDs should be unique within this list but PPID refers only to the processes that are on earlier positions than current process.

  • Next entries are events informing about process creation and termination among other events. Based on experiments, we can safely assume that they are emitted in the same order as the actual events. That's why we don't need to resolve any timestamps. If we need to find a process creation event that matches process termination event, we just need to traverse processes backwards.

This PR introduces PID matching starting from last registered process and seqid that is stored in process_tree.json to uniquely identify a specific process object.

@psrok1 psrok1 merged commit 864d5fa into master Sep 3, 2024
6 checks passed
@psrok1 psrok1 deleted the fix/sequence-based-process-tree branch September 3, 2024 09:25
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.

1 participant