Skip to content

Commit

Permalink
Add unit test for syscall support
Browse files Browse the repository at this point in the history
This does a madvise, which doesn't have a ppm event type, both directly
and indirectly via syscall(__NR_madvise, ...), as well as an open
directly + indirectly. The corresponding rules file matches on madvise
and open.

The test ensures that both opens and both madvises are detected.
  • Loading branch information
mstemm committed Apr 17, 2018
1 parent b937a61 commit 940f415
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/falco_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -689,3 +689,13 @@ trace_files: !mux
rules_file:
- rules/detect_connect_using_in.yaml
trace_file: trace_files/connect_localhost.scap

syscalls:
detect: True
detect_level: INFO
rules_file:
- rules/syscalls.yaml
detect_counts:
- syscall_madvise: 2
- syscall_open: 2
trace_file: trace_files/syscall.scap
11 changes: 11 additions & 0 deletions test/rules/syscalls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- rule: detect_madvise
desc: Detect any call to madvise
condition: evt.type=madvise and evt.dir=<
output: A madvise syscall was seen (command=%proc.cmdline evt=%evt.type)
priority: INFO

- rule: detect_open
desc: Detect any call to open
condition: evt.type=open and evt.dir=< and fd.name=/dev/null
output: An open syscall was seen (command=%proc.cmdline evt=%evt.type file=%fd.name)
priority: INFO
Binary file added test/trace_files/syscall.scap
Binary file not shown.

0 comments on commit 940f415

Please sign in to comment.