Skip to content

eBPF-based security platform

proofs: store each write of the tree sync model's log once

Daniel Borkmann34f37bb829a1
diff --git a/Documentation/contribute/testing/proofs.rst b/Documentation/contribute/testing/proofs.rst
index 56b434d3..2dad9bd6 100644
--- a/Documentation/contribute/testing/proofs.rst
+++ b/Documentation/contribute/testing/proofs.rst
@@ -136,7 +136,7 @@ reads, which ``CHANGED`` finds, run it by hand with its memory capped:
.. code-block:: console
$ ulimit -v 24000000
- $ make proofs-cbmc PROOFS=bpm-tree-recovery-model
+ $ make proofs-cbmc PROOFS=bpm-tree-sync-walk
Write a CBMC proof
------------------
diff --git a/testing/proofs/cbmc/bpm-tree-sync-model.c b/testing/proofs/cbmc/bpm-tree-sync-model.c
index 8b07d99a..01c9822e 100644
--- a/testing/proofs/cbmc/bpm-tree-sync-model.c
+++ b/testing/proofs/cbmc/bpm-tree-sync-model.c
@@ -771,46 +771,45 @@ struct mstate {
__u8 hist[32];
};
+/*
+ * Each write is put together on its own and stored in want[] once: n_want
+ * is symbolic past a branch, and CBMC turns a store at a symbolic index
+ * into one to every entry, so a store per byte multiplies the program many
+ * times over. Each index is stored once, into the zeros want[] starts as.
+ */
static void want_write(int kind, int op, __s64 seq, const __u8 *d,
const struct mstate *st)
{
- int index;
+ struct write w = { .kind = kind, .op = op,
+ .seq = st ? st->last_seq : seq };
__CPROVER_assert(n_want < MAX_WRITES, "expected write log fits");
- index = n_want++;
- want[index].kind = kind;
- want[index].op = op;
- want[index].seq = st ? st->last_seq : seq;
if (d)
for (int i = 0; i < 32; i++)
- want[index].d[i] = d[i];
+ w.d[i] = d[i];
if (st) {
for (int i = 0; i < 32; i++)
- want[index].d[i] = st->root[i];
- want[index].generation = st->generation;
- want[index].manifest[0] = st->manifest[0];
- want[index].manifest[1] = '\0';
- want[index].tree_id[0] = st->tree_id[0];
- want[index].tree_id[1] = '\0';
- want[index].head_seq = st->head_seq;
- want[index].base_seq = st->base_seq;
+ w.d[i] = st->root[i];
+ w.generation = st->generation;
+ w.manifest[0] = st->manifest[0];
+ w.tree_id[0] = st->tree_id[0];
+ w.head_seq = st->head_seq;
+ w.base_seq = st->base_seq;
}
+ want[n_want++] = w;
}
static void want_outcome(__s64 seq, int outcome, const __u8 *root,
const __u8 *hist)
{
- int index;
+ struct write w = { .kind = W_OUTCOME, .seq = seq, .outcome = outcome };
__CPROVER_assert(n_want < MAX_WRITES, "expected write log fits");
- index = n_want++;
- want[index].kind = W_OUTCOME;
- want[index].seq = seq;
- want[index].outcome = outcome;
for (int i = 0; i < 32; i++)
- want[index].d[i] = root[i];
+ w.d[i] = root[i];
for (int i = 0; i < 32; i++)
- want[index].h[i] = hist[i];
+ w.h[i] = hist[i];
+ want[n_want++] = w;
}
static bool same_history(const struct write *actual, int index)
diff --git a/testing/proofs/cbmc/ci-skip.list b/testing/proofs/cbmc/ci-skip.list
index c5c5502c..50bb1bc2 100644
--- a/testing/proofs/cbmc/ci-skip.list
+++ b/testing/proofs/cbmc/ci-skip.list
@@ -7,4 +7,3 @@ bpm-tree-sync-model no result after 7 hours, past 15 GB
bpm-tree-sync-application no result after 7 hours, past 15 GB
bpm-tree-sync-pending no result after 7 hours, past 15 GB
bpm-tree-sync-walk no result after 7 hours, past 15 GB
-bpm-tree-recovery-model 76 to 97 minutes, once no result in 2 hours