forked from VirusTotal/yara
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reduce memory pressure caused by Linux process scanning (VirusTotal#1470
) Reading memory pages from /proc/$PID/mem has the unpleasant side effect of forcing otherwise unused process memory pages into the target process VM, considerably increasing the target process' resident set size. As a typical example, many programs only make use of a subset of code from shared libraries that they are linked against. The solution consists of replicating memory mappings mappings from files if they are directly available through the filesystem. All information needed to find the file (and to determine if it is indeed identical to the file mapped by the target process) is available from /proc/$PID/maps. Only pages that may have been changed according to /proc/$PID/pagemap are then read via /proc/$PID/mem to overwrite the local mapping. Mappings whose underlying filesystem object has changed read from /proc/$PID/mem as before. Mappings that are not backed by a regular file (block devices, stack or heap sections, etc.) are assumed to behave like zeroed-out files and otherwise treated the same.
- Loading branch information
Showing
5 changed files
with
386 additions
and
110 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.