Skip to content

eBPF-based security platform

proofs: give keepalive-emit's counters more than one digit

Daniel Borkmann16a20e1a5e6f
diff --git a/Documentation/contribute/testing/proof-coverage.rst b/Documentation/contribute/testing/proof-coverage.rst
index 8724a1d9..110a51ab 100644
--- a/Documentation/contribute/testing/proof-coverage.rst
+++ b/Documentation/contribute/testing/proof-coverage.rst
@@ -798,10 +798,11 @@ or shorter, and "lengths 0 to 6" every input of each of those lengths.
* - ``keepalive-emit``
- ``keepalive_emit()``
- Three fixed bodies, without a tree, with a tree and nothing else
- that may be null, and with every value; the last of these with a
- last number of up to 4 digits in a buffer that holds 0 to 3 of
- them; rooms of 0, 1 and 224 bytes; a missing string, a bad hash
- and a byte that is not UTF-8
+ that may be null, and with every value, counters of 20, 2 and 1
+ digits among them; the last of these with a last number of up to
+ 4 digits in a buffer that holds 0 to 3 of them; rooms of 0, 1 and
+ 240 bytes; a missing string, a bad hash and a byte that is not
+ UTF-8
- Each body one JSON object of 23 members by a byte-level
recognizer, terminated in the buffer; another last number
changes only its digits, without a leading zero, or is
diff --git a/testing/proofs/cbmc/keepalive-emit.c b/testing/proofs/cbmc/keepalive-emit.c
index d7fb4cae..b7852395 100644
--- a/testing/proofs/cbmc/keepalive-emit.c
+++ b/testing/proofs/cbmc/keepalive-emit.c
@@ -20,14 +20,15 @@
#define NOT_A_HASH "sha256:0123456789abcdef"
#define MEMBERS 23
/* Past the longest of these bodies, and a room inside the shortest. */
-#define ROOM 896
+#define ROOM 960
#define CUT_SHORT (ROOM / 4)
enum state { START, KEY, STRING, COLON, VALUE, ELEMENT, ZERO, DIGITS, WORD,
NEXT, END };
-static const __u64 counters[TAMPER_MAX];
-static const __u64 integrity[INTEGRITY_MAX];
+/* Counters of the widest value, of two digits and of one. */
+static const __u64 counters[TAMPER_MAX] = { UINT64_MAX, 10 };
+static const __u64 integrity[INTEGRITY_MAX] = { UINT64_MAX };
static char reference[ROOM];
/* keepalive_mask() is not reached: the mask comes in as text. */
diff --git a/testing/proofs/cbmc/proofs.list b/testing/proofs/cbmc/proofs.list
index 9c760480..0ba603e5 100644
--- a/testing/proofs/cbmc/proofs.list
+++ b/testing/proofs/cbmc/proofs.list
@@ -59,7 +59,7 @@ log-escape --unwind 7 LEN=0-5
json-emit-string --unwind 5 --unwindset json_string.0:27,put_string_n.0:5,put_raw.0:7,well_formed.0:27,replaced.0:5,memchr.0:9,memcmp.0:13 LEN=0-4
json-emit-buffer --unwind 1 --unwindset json_raw_value.0:5,harness.0:5 --malloc-may-fail --malloc-fail-null LEN=0-4
json-emit-nest --object-bits 12 --unwind 1 --unwindset json_text.0:57,sequences.0:4,sequences.1:5,any_depth.0:4,any_depth.1:4,strcmp.0:12,memchr.0:9,put_string_n.0:2,put_string_n.1:2,put_raw.0:8,json_kv_raw.0:3,json_raw_value.0:3,json_raw.0:5,strlen.0:3,vsnprintf.2:5,vsnprintf.0:2,format_number.0:3,format_number.2:5,format_number.3:3
-keepalive-emit --object-bits 12 --max-field-sensitivity-array-size 896 --unwind 1 --unwindset json_members.0:897,power_of_ten.0:6,put_string_n.0:5,put_string_n.1:66,put_raw.0:7,strlen.0:66,hex_is_lower.0:66,kv_counters.0:43,kv_no_tree.0:8,json_raw_value.0:6,vsnprintf.2:4,vsnprintf.0:2,format_number.0:6,format_number.2:5,format_number.3:6,ends_in_any_number.0:6,ends_in_any_number.1:897,ends_in_any_number.2:5 LEN=0-3
+keepalive-emit --object-bits 12 --max-field-sensitivity-array-size 960 --unwind 1 --unwindset json_members.0:961,power_of_ten.0:6,put_string_n.0:5,put_string_n.1:66,put_raw.0:7,strlen.0:66,hex_is_lower.0:66,kv_counters.0:43,kv_no_tree.0:8,json_raw_value.0:21,vsnprintf.2:4,vsnprintf.0:2,format_number.0:21,format_number.2:5,format_number.3:21,ends_in_any_number.0:6,ends_in_any_number.1:961,ends_in_any_number.2:5 LEN=0-3
json-string --unwind 5 --unwindset json_string.0:7,parse_string.0:5,parse_string.1:7,memchr.0:9,memcmp.0:7,harness.0:8 LEN=0-6
json-escape --unwind 5 --unwindset parse_string.0:4,memcmp.0:9
json-roundtrip --unwind 1 --unwindset put_string_n.0:5,put_string_n.1:5,put_raw.0:7,vsnprintf.2:4,vsnprintf.0:2,format_number.0:3,format_number.2:5,format_number.3:3,parse_string.1:6,parse_string.0:4,hex4.0:5,utf8_width.0:4,memcmp.0:5 LEN=0-4