Skip to content

eBPF-based security platform

upatch: remove proof-only decoder length

Tobias Klauserfcca2e58f94d
diff --git a/testing/proofs/cbmc/upatch-decoders.c b/testing/proofs/cbmc/upatch-decoders.c
index dc7de786..32f1622d 100644
--- a/testing/proofs/cbmc/upatch-decoders.c
+++ b/testing/proofs/cbmc/upatch-decoders.c
@@ -63,7 +63,6 @@ void harness(void)
return;
}
__CPROVER_assert((const __u8 *)u.decoder_blob == bp &&
- u.decoder_blob_len == len &&
u.nr_decoders == get_le32(bp + 8) && u.nr_decoders,
"the whole section and its count");
for (i = 0; i < NR_MAX; i++)
diff --git a/testing/proofs/cbmc/upatch-signed-sections.c b/testing/proofs/cbmc/upatch-signed-sections.c
index 73354d7f..11e09535 100644
--- a/testing/proofs/cbmc/upatch-signed-sections.c
+++ b/testing/proofs/cbmc/upatch-signed-sections.c
@@ -79,7 +79,7 @@ static void forgotten(const struct upatch *u)
{
__CPROVER_assert(!u->signed_attach_len &&
!u->signed_policy_labels_len &&
- !u->decoder_blob_len && !u->nr_decoders &&
+ !u->nr_decoders &&
!u->signed_policy_map_idx &&
!u->signed_socket_policy_map_idx &&
!u->signed_jar_len,
@@ -146,7 +146,10 @@ void harness(void)
__CPROVER_assert(!u.signed_policy_labels, "no policy labels");
__CPROVER_assert(!u.decoder_blob ||
(u.nr_decoders &&
- below(&u, u.decoder_blob, u.decoder_blob_len,
+ below(&u, u.decoder_blob,
+ sizeof(struct upatch_decoder_blob) +
+ (size_t)u.nr_decoders *
+ sizeof(struct upatch_decoder_entry),
dir_off)),
"decoders below the directory");
}
diff --git a/testing/proofs/cbmc/upatch-writer-load.c b/testing/proofs/cbmc/upatch-writer-load.c
index bbcb2c4f..dd66153a 100644
--- a/testing/proofs/cbmc/upatch-writer-load.c
+++ b/testing/proofs/cbmc/upatch-writer-load.c
@@ -73,7 +73,6 @@ void harness(void)
"the name and the attach metadata");
__CPROVER_assert(written(&u, u.decoder_blob, DECODERS_OFF, decoders,
DECODERS_LEN) &&
- u.decoder_blob_len == DECODERS_LEN &&
u.nr_decoders == alone.nr_decoders,
"the decoders behind the padding");
__CPROVER_assert(written(&u, u.signed_policy_labels, LABELS_OFF,
diff --git a/util/upatch.c b/util/upatch.c
index 71c35b5a..95c95ad1 100644
--- a/util/upatch.c
+++ b/util/upatch.c
@@ -251,7 +251,6 @@ static bool parse_decoders(struct upatch *u, const __u8 *bp,
}
u->decoder_blob = (const void *)bp;
- u->decoder_blob_len = decoder_len;
u->nr_decoders = nr_decoders;
return true;
}
@@ -259,7 +258,6 @@ static bool parse_decoders(struct upatch *u, const __u8 *bp,
static void forget_signed_sections(struct upatch *u)
{
u->decoder_blob = NULL;
- u->decoder_blob_len = 0;
u->nr_decoders = 0;
u->signed_name = NULL;
u->signed_attach = NULL;
diff --git a/util/upatch.h b/util/upatch.h
index a521716b..71be868c 100644
--- a/util/upatch.h
+++ b/util/upatch.h
@@ -48,7 +48,6 @@ struct upatch {
bool owned;
bool rodata_offset_in_header;
const struct upatch_decoder_blob *decoder_blob;
- __u32 decoder_blob_len;
__u32 nr_decoders;
const char *signed_name; /* UPATCH_NAME_MAX */
const __u8 *signed_attach;