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

More strict fuzzing #388

Closed
wants to merge 10 commits into from
Closed

Conversation

cgzones
Copy link
Contributor

@cgzones cgzones commented Apr 20, 2023

ci-fuzz test.

cgzones added 10 commits May 12, 2023 10:49
Validate the policy after optimization and validate writing back in
binary format is successful.  This treats OOM failures as critical,
which hopefully is not an issue with the OSS-FUZZ infrastructure.
Writing policies in conf or CIL format might still fail, e.g. due to
unsupported policy capabilities.

Set the O_CLOEXEC flag for /dev/null, in the case of the existence of
sibling threads.

Signed-off-by: Christian Göttsche <[email protected]>
---
TODO:
   should policy validation reject unsupported (newer) policy
   capabilities?
Ensure various object context entries have a name, since they are
duplicated via strdup(3), and the order for ports and memory regions is
valid.

Signed-off-by: Christian Göttsche <[email protected]>
For old style range transition rules the class defaults to process.
However the policy might not declare the process class leading to
setting a wrong bit later on via:

    if (ebitmap_set_bit(&rtr->tclasses, rt->target_class - 1, 1))

UBSAN output:

    policydb.c:3684:56: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'uint32_t' (aka 'unsigned int')

Signed-off-by: Christian Göttsche <[email protected]>
Bail out on expanding levels with invalid low category.

UBSAN oreport:

    expand.c:952:21: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'uint32_t' (aka 'unsigned int')
otherwse writing will fail if fuzing
sepol_log_err() will already append a newline unconditionally.
@cgzones cgzones closed this Jul 5, 2023
@cgzones cgzones deleted the strict_fuzz branch July 5, 2023 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant