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

Implemented vectorscan match engine #242

Merged
merged 27 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8dbf57c
Added basic support for vectorscan
akenion Feb 16, 2024
5c8ccf9
Made adjustments to pass flake8 validation
akenion Feb 16, 2024
6247459
Implemented caching for compiled vectorscan signatures
akenion Mar 11, 2024
173e16b
Updated vectorscan implementation to use streaming mode instead of bl…
akenion Mar 22, 2024
db62725
Added profiling support for malware scans
akenion Mar 27, 2024
63352ac
Improved signal handling when compiling vectorscan signatures
akenion Apr 2, 2024
c68f9e8
Made main.py executable
akenion Apr 2, 2024
0665b00
Added option to output profile results to file
akenion Apr 2, 2024
a4579a4
Fixed vectorscan availability output
akenion Apr 2, 2024
f7b87ea
Added lazy option to vectorscan match engine
akenion Apr 2, 2024
15f7e4c
Fixed additional issue where input queue can fill up and cause scans …
akenion Apr 2, 2024
f4b7227
Adjusted profiling options for malware scan command
akenion Apr 2, 2024
4567977
Corrected order of profile results in debug output
akenion Apr 3, 2024
ed25217
Added support for using direct IO to read files when scanning for mal…
akenion Apr 4, 2024
fef75bb
Changed profile output to use INFO log level instead of DEBUG
akenion Apr 5, 2024
62f724e
Fixed arithmetic error in calculating read offset for direct IO
akenion Apr 5, 2024
2699438
Added option to use custom path for precompiled pattern database
akenion Apr 12, 2024
e02c848
Fixed issue with pattern database compilation
akenion Apr 12, 2024
4aabdf7
Added support for downloading pre-compiled signatures
akenion Apr 29, 2024
6cf44b6
Skipped pre-compiled signature check when explicitly compiling signat…
akenion Apr 29, 2024
d46352d
Fixed issues with pre-compiled signature support
akenion Apr 29, 2024
2e20a16
Continued work on pre-compiled pattern support
akenion Apr 30, 2024
bce59dd
Fixed handling of license assignment for nested signature set instances
akenion Apr 30, 2024
b972229
Added support for filtering signatures with pre-compiled databases
akenion Apr 30, 2024
a2f0b71
Improved handling of incompatible pre-compiled signature databases
akenion Apr 30, 2024
b0a805f
Removed unused imports
akenion Apr 30, 2024
5e1914a
Adjusted signature compilation options
akenion Apr 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed arithmetic error in calculating read offset for direct IO
  • Loading branch information
akenion committed Apr 5, 2024
commit 62f724eac35a40a12533d8bd20bafc3ccf446cd6
5 changes: 3 additions & 2 deletions wordfence/scanning/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,7 @@ def __init__(
self._logging_initializer = logging_initializer
self._profile = profile
self._opener = self._open_direct if direct_io else self._open
if direct_io:
self._direct_io_buffer = DirectIoBuffer(self._chunk_size)
self._direct_io = direct_io
self.complete = Value(c_bool, False)
self._timer = None
super().__init__(name=self._generate_name())
Expand All @@ -429,6 +428,8 @@ def work(self):
'scan_worker',
is_global=True
)
if self._direct_io:
self._direct_io_buffer = DirectIoBuffer(self._chunk_size)
try:
self._working = True
self._matcher.prepare(thread=True)
Expand Down
2 changes: 1 addition & 1 deletion wordfence/util/direct_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __init__(self, path: str, buffer: DirectIoBuffer):
self.offset = 0

def read(self, limit: Optional[int] = None) -> bytes:
read_offset = math.floor(self.offset / mmap.PAGESIZE)
read_offset = math.floor(self.offset / mmap.PAGESIZE) * mmap.PAGESIZE
skip = self.offset % mmap.PAGESIZE
read_length = os.preadv(self.fd, self.buffer.buffers, read_offset)
read_length -= skip
Expand Down
Loading