Skip to contentSkip to conversation

checkpolicy/fuzz: Update check_level() to use notdefined field

PATCH In review James Carter 2 participants 3 messages Mar 6, 2024 – Mar 7, 2024 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 checkpolicy/fuzz: Update check_level() to use notdefined field

Commit e16f586 (Fix potential double free of mls_level_t) renamed the "defined" field to "notdefined", but did not update this use of it.

Use the new field "notdefined" for the check.

---
 checkpolicy/fuzz/checkpolicy-fuzzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
checkpolicy/fuzz/checkpolicy-fuzzer.c +1 -1
index 0d749a02..a3da0b57 100644
@@ -135,7 +135,7 @@ static int check_level(hashtab_key_t key, hashtab_datum_t datum, void *arg __att
 	const level_datum_t *levdatum = (level_datum_t *) datum;
 
 	// TODO: drop member defined if proven to be always set
-	if (!levdatum->isalias && !levdatum->defined) {
+	if (!levdatum->isalias && levdatum->notdefined) {
 		fprintf(stderr,
 			"Error:  sensitivity %s was not used in a level definition!\n",
 			key);
Signature · 1 line
2.44.0
#1 lore raw
Quoted 6 lines · James Carter

Commit e16f586 (Fix potential double free of mls_level_t) renamed the "defined" field to "notdefined", but did not update this use of it.

Use the new field "notdefined" for the check.

Since the renamed member "notdefined" is checked during validation and the fuzzer calls policydb_valudate() I think the whole callback can be removed.

Quoted 21 lines
---
 checkpolicy/fuzz/checkpolicy-fuzzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
checkpolicy/fuzz/checkpolicy-fuzzer.c +1 -2
index 0d749a02..a3da0b57 100644
@@ -135,7 +135,7 @@ static int check_level(hashtab_key_t key, hashtab_datum_t datum, void *arg __att
        const level_datum_t *levdatum = (level_datum_t *) datum;
 
        // TODO: drop member defined if proven to be always set
-       if (!levdatum->isalias && !levdatum->defined) {
+       if (!levdatum->isalias && levdatum->notdefined) {
                fprintf(stderr,
                        "Error:  sensitivity %s was not used in a level definition!\n",
                        key);
--

2.44.0

#2 lore raw
Quoted 7 lines · Christian Göttsche
Quoted 5 lines · James Carter

Commit e16f586 (Fix potential double free of mls_level_t) renamed the "defined" field to "notdefined", but did not update this use of it.

Quoted 6 lines
Quoted 1 line

Use the new field "notdefined" for the check.

Since the renamed member "notdefined" is checked during validation and the fuzzer calls policydb_valudate() I think the whole callback can be removed.

I left it in for now because checkpolicy does a similar check and I wanted to get this merged as soon as possible since it was breaking the fuzzer.

Quoted 1 line
Quoted 1 line

This patch has been merged.

Thanks,
Jim

Quoted 20 lines
Quoted 20 lines
---
 checkpolicy/fuzz/checkpolicy-fuzzer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
checkpolicy/fuzz/checkpolicy-fuzzer.c +1 -2
index 0d749a02..a3da0b57 100644
@@ -135,7 +135,7 @@ static int check_level(hashtab_key_t key, hashtab_datum_t datum, void *arg __att
        const level_datum_t *levdatum = (level_datum_t *) datum;
 
        // TODO: drop member defined if proven to be always set
-       if (!levdatum->isalias && !levdatum->defined) {
+       if (!levdatum->isalias && levdatum->notdefined) {
                fprintf(stderr,
                        "Error:  sensitivity %s was not used in a level definition!\n",
                        key);
--

2.44.0