[PATCH] libsepol/fuzz: Exercise module to CIL code when fuzzing
James Carter <[email protected]> Thu, 30 Jul 2026 10:39:11 -0400
| Newsgroups | org.kernel.vger.selinux |
|---|---|
| Message-ID | <[email protected]> |
When fuzzing a kernel policy both sepol_kernel_policydb_to_conf() and sepol_kernel_policydb_to_cil() are called to test those parts of the code base. Call sepol_module_policydb_to_cil() for base and module policies to test that part of the code base. Signed-off-by: James Carter <[email protected]> --- libsepol/fuzz/binpolicy-fuzzer.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libsepol/fuzz/binpolicy-fuzzer.c b/libsepol/fuzz/binpolicy-fuzzer.c index c0d96d8f..fd9dec91 100644 --- a/libsepol/fuzz/binpolicy-fuzzer.c +++ b/libsepol/fuzz/binpolicy-fuzzer.c @@ -72,8 +72,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) if (sepol_kernel_policydb_to_cil(devnull, &policydb)) abort(); + } else { + if (sepol_module_policydb_to_cil(devnull, &policydb, 0)) + abort(); + } - } else if (policydb.policy_type == POLICY_BASE) { + if (policydb.policy_type == POLICY_BASE) { if (link_modules(NULL, &policydb, NULL, 0, VERBOSE)) goto exit; -- 2.55.0