Skip to content

Update checks for invalid rules in blocks

James Carter selinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest12 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12libsepol/cil: Reorder checks for invalid rules when building ASTlibsepol/cil/src/cil_build_ast.c+50 -500 replies
2/12libsepol/cil: Cleanup build AST helper functionslibsepol/cil/src/cil_build_ast.c+10 -340 replies
3/12libsepol/cil: Create new first child helper function for building ASTlibsepol/cil/src/cil_build_ast.c+25 -170 replies
4/12libsepol/cil: Use AST to track blocks and optionals when resolvinglibsepol/cil/src/cil_resolve_ast.c+32 -750 replies
5/12libsepol/cil: Reorder checks for invalid rules when resolving ASTlibsepol/cil/src/cil_resolve_ast.c+39 -370 replies
6/12libsepol/cil: Sync checks for invalid rules in booleanifslibsepol/cil/src/cil_build_ast.c libsepol/cil/src/cil_resolve_ast.c+17 -90 replies
7/12libsepol/cil: Check for statements not allowed in optional blockslibsepol/cil/src/cil_build_ast.c libsepol/cil/src/cil_resolve_ast.c+35 -10 replies
8/12libsepol/cil: Sync checks for invalid rules in macroslibsepol/cil/src/cil_resolve_ast.c+3 -10 replies
9/12libsepol/cil: Do not allow tunable declarations in in-statementslibsepol/cil/src/cil_build_ast.c+2 -10 replies
10/12libsepol/cil: Make invalid statement error messages consistentlibsepol/cil/src/cil_build_ast.c libsepol/cil/src/cil_resolve_ast.c+11 -160 replies
11/12libsepol/cil: Use CIL_ERR for error messages in cil_compile()libsepol/cil/src/cil.c+4 -40 replies
12/12secilc/docs: Update the CIL documentation for various blockssecilc/docs/cil_call_macro_statements.md secilc/docs/cil_conditional_statements.md secilc/docs/cil_container_statements.md+26 -102 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/12] Update checks for invalid rules in blocks

Looking into a bug that OSS-Fuzz found led to patch 7, Check for statements not allowed in optional blocks, which is the most important patch in this series. Working on patch 7 led to fixing some other problems with the checks for invalid rules, cleaning up some of the code, and improving the CIL documentation.

Patches 1, 2, 4, 5, and 10 are doing various cleanups.
Patch 3 fixes a bug that prevents the first rule in a block from being checked. Patches 6, 7, 8, and 9 update the checks for invalid rules.
Patch 11 fixes a bug that prevented some error messages from being displayed. Patch 12 updates the CIL documentation.

There is still work to do in this area. I am not sure why sensitivity and category statements are not allowed in blocks, but everything else is. That is why I didn't add those checks when building the AST. It is not clear if mls, handleunknown, defaultuser, defaultrole, defaulttype, defaultrange, and policycap should be restricted to the global namespace.

James Carter (12):
libsepol/cil: Reorder checks for invalid rules when building AST libsepol/cil: Cleanup build AST helper functions libsepol/cil: Create new first child helper function for building AST libsepol/cil: Use AST to track blocks and optionals when resolving libsepol/cil: Reorder checks for invalid rules when resolving AST libsepol/cil: Sync checks for invalid rules in booleanifs libsepol/cil: Check for statements not allowed in optional blocks libsepol/cil: Sync checks for invalid rules in macros libsepol/cil: Do not allow tunable declarations in in-statements libsepol/cil: Make invalid statement error messages consistent libsepol/cil: Use CIL_ERR for error messages in cil_compile() secilc/docs: Update the CIL documentation for various blocks

 libsepol/cil/src/cil.c                    |   8 +-
 libsepol/cil/src/cil_build_ast.c          | 193 ++++++++++++----------
 libsepol/cil/src/cil_resolve_ast.c        | 174 ++++++++-----------
 secilc/docs/cil_call_macro_statements.md  |   2 +
 secilc/docs/cil_conditional_statements.md |   6 +
 secilc/docs/cil_container_statements.md   |  28 ++--
 6 files changed, 205 insertions(+), 206 deletions(-)
Signature · 1 line
2.26.3