-
Notifications
You must be signed in to change notification settings - Fork 361
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
checkpolicy/oss-fuzz: add libfuzz based fuzzer #313
Commits on Jan 22, 2024
-
checkpolicy: add libfuzz based fuzzer
Introduce a libfuzz[1] based fuzzer testing the parsing and policy generation code used within checkpolicy(8) and checkmodule(8), similar to the fuzzer for secilc(8). The fuzzer will work on generated source policy input and try to parse, link, expand, optimize, sort and output it. This fuzzer will also ensure policy validation is not too strict by checking compilable source policies are valid. Build the fuzzer in the oss-fuzz script. [1]: https://llvm.org/docs/LibFuzzer.html Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for 8aed880 - Browse repository at this point
Copy the full SHA 8aed880View commit details -
checkpolicy: cleanup resources on parse error
Close the input file and free all memory by the queue and lexer on a syntax or parse error. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for e7ba55f - Browse repository at this point
Copy the full SHA e7ba55fView commit details -
checkpolicy: cleanup identifiers on error
Free identifiers removed from the queue but not yet owned by the policy on errors. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for 748bbaf - Browse repository at this point
Copy the full SHA 748bbafView commit details -
checkpolicy: free ebitmap on error
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for 7a38093 - Browse repository at this point
Copy the full SHA 7a38093View commit details -
checkpolicy: check allocation and free memory on error at type defini…
…tion Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for 8ec2078 - Browse repository at this point
Copy the full SHA 8ec2078View commit details -
checkpolicy: clean expression on error
The passed expression needs to be transferred into the policy or free'd by the sink functions define_constraint() and define_validatetrans(). Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for cf8fcbc - Browse repository at this point
Copy the full SHA cf8fcbcView commit details -
checkpolicy: call YYABORT on parse errors
Calling the parser macro YYABORT allows the parser to cleanup up any allocated resources before returning. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for b8d7c36 - Browse repository at this point
Copy the full SHA b8d7c36View commit details -
checkpolicy: bail out on invalid role
Return early on invalid roles in user definition. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for ee32f0b - Browse repository at this point
Copy the full SHA ee32f0bView commit details -
Convert the only usage of the raw type struct level_datum to use the typedef. Simplifies refactorizations on the type. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for 7a21205 - Browse repository at this point
Copy the full SHA 7a21205View commit details -
libsepol: add copy member to level_datum
Add a new member to the struct level_datum to indicate whether the member `level` is owned by the current instance, and free it on cleanup only then. This helps to implement a fix for a use-after-free issue in the checkpolicy(8) compiler. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for ce8ddaf - Browse repository at this point
Copy the full SHA ce8ddafView commit details -
checkpolicy: fix use-after-free on invalid sens alias
During compilation sensitivity aliases share the level with their prime sensitivity, until after the level has been fully defined they are deduplicated. If an error happens by that time the cleanup will free the shared level multiple times, leading to a use-after-free. Make use of the added new member of the struct level_datum. Example policy: class c sid e class c{i}sensitivity S alias L; Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for ecb67d0 - Browse repository at this point
Copy the full SHA ecb67d0View commit details -
checkpolicy: provide more descriptive error messages
Provide more descriptive error messages by including the identifier or other kind of value if available. Also drop duplicate newlines at the end of messages. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for 9c7b2be - Browse repository at this point
Copy the full SHA 9c7b2beView commit details -
checkpolicy: free temporary bounds type
Free the temporary bounds type in the error branches. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for 42fd67e - Browse repository at this point
Copy the full SHA 42fd67eView commit details -
checkpolicy: avoid assigning garbage values
Only assign the computed value on success, since it is not set by declare_symbol() on failure. Reported by GCC: module_compiler.c: In function 'create_role': module_compiler.c:287:24: warning: use of uninitialized value 'value' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 287 | datum->s.value = value; | ~~~~~~~~~~~~~~~^~~~~~~ Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for 7f429a8 - Browse repository at this point
Copy the full SHA 7f429a8View commit details -
checkpolicy: misc policy_define.c cleanup
Sync function parameter names. Drop superfluous return value. The function avrule_merge_ioctls() has no failure conditions and always returns 0. Drop duplicate include. Use native type for ranges. Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Configuration menu - View commit details
-
Copy full SHA for d4bb604 - Browse repository at this point
Copy the full SHA d4bb604View commit details