eBPF-based security platform
proofs: run bpm-tree-state-match with a label table of four
Daniel Borkmanne9683234ba5a
diff --git a/Documentation/contribute/testing/proof-coverage.rst b/Documentation/contribute/testing/proof-coverage.rstindex 2483f33e..820da223 100644--- a/Documentation/contribute/testing/proof-coverage.rst+++ b/Documentation/contribute/testing/proof-coverage.rst@@ -337,7 +337,9 @@ or shorter, and "lengths 0 to 6" every input of each of those lengths.architectures against any release, machine and build ID, and ofup to 2 labels against five fixed label lines or labels thatcannot be read; strings up to 2 bytes. The node's files are- stubs. Not a selector that names a kernel option+ stubs, and its label table holds 4 entries rather than 64,+ which the 3 labels never fill. Not a selector that names a+ kernel option- 1 exactly where ``selectorMatches`` of the Lean model``Shirudo.TreeOverlap`` holds, 0 where not, an error only forlabels it could not read; the labels closed and their linediff --git a/testing/proofs/cbmc/bpm-tree-state-match.c b/testing/proofs/cbmc/bpm-tree-state-match.cindex 8df26486..6e92a65c 100644--- a/testing/proofs/cbmc/bpm-tree-state-match.c+++ b/testing/proofs/cbmc/bpm-tree-state-match.c@@ -14,6 +14,15 @@/* CBMC's own memcpy() of a length it does not know runs out of memory. */#define PROOF_MEMCPY_BYTEWISE+/*+ * tree_selector_matches() keeps the node's labels in a table of+ * TREE_MAX_LABELS entries of 512 bytes and reads a value through the+ * pointer kv_value() returns, which CBMC lets be any byte of the table:+ * 64 entries take 11 GB. The labels here never fill four, as LABELS_FIT+ * checks, so a table of four takes the paths one of 64 does.+ */+#define TREE_MAX_LABELS 4+/* For an errno that keeps what a stub stored. */#define PROOF_FILE 1@@ -85,6 +94,7 @@ static const char *model_kconfig(const char *key)#define LINE_FAILS (LEN == 3)#define LABEL_LINES (IMAGE_ACTIVE ? 0 : 5)#define LABELS (IMAGE_ACTIVE ? 0 : 3)+_Static_assert(LABELS <= TREE_MAX_LABELS, "LABELS_FIT: the labels fit");static const char *const label_lines[] = {"a=x\n", "# c=1\n", " b = y\x20\n", "junk\n", "a=z\n",diff --git a/testing/proofs/cbmc/ci-skip.list b/testing/proofs/cbmc/ci-skip.listindex 84940470..329a9552 100644--- a/testing/proofs/cbmc/ci-skip.list+++ b/testing/proofs/cbmc/ci-skip.list@@ -9,4 +9,3 @@ bpm-tree-sync-pending no result after 7 hours, past 15 GBbpm-tree-sync-walk no result after 7 hours, past 15 GBbpm-tree-recovery-model 76 to 97 minutes, once no result in 2 hoursupatch-prog-uprobes 12 GB at its peak-bpm-tree-state-match 11 GB at its peak, for labels read from /etcdiff --git a/util/bpm_tree.h b/util/bpm_tree.hindex ef7064a0..162fd72b 100644--- a/util/bpm_tree.h+++ b/util/bpm_tree.h@@ -12,7 +12,10 @@#define TREE_MAX_OPS 512#define TREE_MAX_KCONFIG 64+/* A proof sets it lower: CBMC's cost grows with the table. */+#ifndef TREE_MAX_LABELS#define TREE_MAX_LABELS 64+#endif#define TREE_MAX_SELECTOR_VALUES 16#define TREE_STRING_MAX 256