tools/compile_seccomp_policy: support kill syscall
The parsing fails on statements like:
kill: 1
since 'kill' is matched as an action.
I added these to tests/seccomp.policy and verified the script
now runs to completion.
Bug: chromium:1024021
Test: ./tools/compiler_unittest.py
Test: ./tools/parser_unittest.py
Test: ./tools/compile_seccomp_policy.py \
test/seccomp.policy test/seccomp.bpf
Change-Id: Idd9476f2d3bc4d69dd1f4bbaac4505bff2ce9801
Signed-off-by: Matt Delco <[email protected]>
diff --git a/tools/parser_unittest.py b/tools/parser_unittest.py
index e9f0ce2..36bb3bf 100755
--- a/tools/parser_unittest.py
+++ b/tools/parser_unittest.py
@@ -426,6 +426,14 @@
), [
parser.Filter([[parser.Atom(0, '==', 0)]], bpf.Allow()),
]))
+ self.assertEqual(
+ self.parser.parse_filter_statement(
+ self._tokenize('kill: arg0 == 0')),
+ parser.ParsedFilterStatement((
+ parser.Syscall('kill', 62),
+ ), [
+ parser.Filter([[parser.Atom(0, '==', 0)]], bpf.Allow()),
+ ]))
def test_parse_metadata(self):
"""Accept valid filter statements with metadata."""