From b106fad29f679e47f6ee7abe9066ff8696a9f60d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 11 Mar 2024 15:57:02 +0100 Subject: [PATCH] checkpolicy/fuzz: drop redundant notdefined check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The level_datum_t member notdefined is checked to be 1 during validation and the fuzzer calls policydb_validate(). Drop the redundant check (as announced in the TODO). Signed-off-by: Christian Göttsche Acked-by: James Carter --- checkpolicy/fuzz/checkpolicy-fuzzer.c | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/checkpolicy/fuzz/checkpolicy-fuzzer.c b/checkpolicy/fuzz/checkpolicy-fuzzer.c index a3da0b57..f3a17cce 100644 --- a/checkpolicy/fuzz/checkpolicy-fuzzer.c +++ b/checkpolicy/fuzz/checkpolicy-fuzzer.c @@ -130,21 +130,6 @@ static int read_source_policy(policydb_t *p, const uint8_t *data, size_t size) return 0; } -static int check_level(hashtab_key_t key, hashtab_datum_t datum, void *arg __attribute__ ((unused))) -{ - const level_datum_t *levdatum = (level_datum_t *) datum; - - // TODO: drop member defined if proven to be always set - if (!levdatum->isalias && levdatum->notdefined) { - fprintf(stderr, - "Error: sensitivity %s was not used in a level definition!\n", - key); - abort(); - } - - return 0; -} - static int write_binary_policy(FILE *outfp, policydb_t *p) { struct policy_file pf; @@ -198,8 +183,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) if (read_source_policy(&parsepolicydb, data, size)) goto exit; - (void) hashtab_map(parsepolicydb.p_levels.table, check_level, NULL); - if (parsepolicydb.policy_type == POLICY_BASE) { if (link_modules(NULL, &parsepolicydb, NULL, 0, VERBOSE)) goto exit;