Proof coverage#
This page lists the CBMC proofs under testing/proofs/cbmc/ and the
Lean 4 proofs under testing/proofs/lean4/, what each one proves and
for which inputs, the source files no proof reads and the parsers no
proof covers yet. Prove code with CBMC and Lean 4 explains how to run and write them. CI
runs every proof after a push to main but the CBMC proofs
testing/proofs/cbmc/ci-skip.list names, which need more time or
memory than CI gives a proof: only a run a developer starts checks
those.
CBMC proofs#
Every CBMC proof shows that the code reads and writes nothing outside its objects and has no undefined arithmetic for the inputs it covers, besides the properties the table lists. “Every input” means every input of any length. A bound such as “up to 22 bytes” means every input of that length or shorter, and “lengths 0 to 6” every input of each of those lengths.
Proof |
Code |
Inputs |
Properties |
|---|---|---|---|
|
|
Up to 22 bytes, past the 20 digits of the largest value |
Refuses exactly what is empty or holds a non-digit; a number
within its bounds and of the sign the string spells; nothing
written on refusal; |
|
|
Up to 4 bytes |
The value of the Lean model |
|
|
Every input |
Equals Table 3-7 of the Unicode Standard, the well-formed byte sequences, row by row |
|
|
Lengths 0 to 6, with and without line breaks |
Leaves well-formed UTF-8 without a C0, DEL or C1 control but a
kept line break; changes a byte only to |
|
|
Strings and buffers up to 8 bytes |
Terminates what it writes; the whole string and its length, or
what fits and |
|
|
Spans and buffers up to 6 bytes, apart and the span in the buffer |
A string exactly when no byte of the span is a NUL and the bytes
fit with a terminator, |
|
|
Names up to 6 bytes, suffixes up to 3 |
True exactly when the name’s last bytes are the suffix and at least one byte comes before them |
|
|
Strings and spans up to 5 bytes, prefixes up to 3 |
The rest of the string exactly where it starts with the prefix,
in either case for the |
|
|
Lengths 0 to 4, one or two delimiters, every cursor |
A token lies inside the span, holds no delimiter and has one or the span’s end on either side; the cursor ends past it and past one delimiter; a walk gives the bytes that are no delimiter in order, each once, and no empty token |
|
|
Lengths 0 to 5, one or two bytes in the set, needles up to 2 bytes, strings up to 3 |
The length of what comes before the first byte of the set; the
first place the needle lies in the span, or |
|
|
Up to 4 bytes, strings up to 9 characters |
Lowercase hex that decodes back to the input, in the caller’s
buffer or one |
|
|
Up to 8 bytes, strings up to 17 characters, counts and capacities
up to 8 and past |
The result and the bytes of the Lean model |
|
|
Strings of 0, 6 to 8 and 70 to 72 bytes |
Accepted exactly as |
|
|
Up to 8 bytes |
Ends at a newline or is 0, with no newline behind it |
|
|
Files of 0 to 6 bytes, lines of up to 3; |
A line holding a line break or a NUL refused, the file unchanged; else the file cut back to its last line break, then the line and one line break; a failed write or sync cut back to that line break |
|
|
Up to 6 bytes |
A list is accepted exactly when it is decimal PCRs 0 to 23 apart by single commas, into the mask of those PCRs; a value exactly after a PCR to 23 and an equals sign |
|
|
Lengths 64 to 70 |
Accepted exactly when a name of 1 to 256 bytes runs to the first equals sign and 64 hex digits follow, into that name and their value |
|
|
Lengths 321 and 322: any 8 bytes, then letters to an equals sign and any 64 bytes |
The rule of |
|
|
Names up to 4 bytes, pin names up to 8 |
A name without |
|
|
Parts up to 2 bytes, every buffer size up to 7 |
The parts with one slash between them, terminated, exactly when
they fit, else |
|
|
A name and up to two parts of a byte each or none, buffers of 0, 1 and 28 to 35 bytes |
The pin directory, the pin name and each part after one slash,
terminated, exactly when they fit, else |
|
|
Every field of 8 and 12 bytes |
Accepted exactly as octal digits with blanks or NULs around them, at their value; nothing written on refusal |
|
|
Up to 8 bytes, buffers up to 18 |
The result and the string of the Lean model |
|
|
Every header without an octal checksum; the checksum against headers with 64 free bytes at three places |
Holds exactly when the field is the byte sum with its own bytes as blanks |
|
|
Names of 0 to 10 bytes |
A name passes exactly when it cannot leave its directory; a member exactly when it is the path below the one top directory |
|
|
Up to 129 bytes, past the 128-byte limit |
Exactly the character, length and first-character rules |
|
|
Names of lengths 0 to 10, members up to 3 bytes |
The decision of the Lean model |
|
|
Up to 11 bytes |
Valid exactly by the SemVer 2.0.0 grammar; the pre-release parsed
is the text between the core and |
|
|
Every pair of strings up to 7 bytes |
Antisymmetric; equal exactly up to build metadata; every version above every invalid string; the core by number; a pre-release below its release |
|
|
Every three strings up to 7 bytes |
Transitive, valid versions or not |
|
|
Identifiers up to 3 bytes, lists up to 5 |
Numeric by value and below alphanumeric, alphanumeric by bytes; the first difference decides, else the longer list |
|
|
Every pair of strings up to 9 bytes |
The sign of the Lean model |
|
|
|
Outputs terminated in their buffers; only the whole token
|
|
|
Answers up to 17 bytes, as text and as the bytes of a response,
NULs included, and every outcome |
The whole answer parsed; nothing written on refusal; a token
without controls, quotes or backslashes, the value of |
|
|
Header lines up to 26 bytes, NULs included, with the line’s copy and the challenge’s field set to 24 and 4 bytes for their 4096 and 2048 |
The whole line taken, and one too long for the copy or holding a NUL read not at all; values terminated, without a leading blank, a location without CR or LF; a challenge that fits kept whole, a longer one dropped rather than cut |
|
|
A buffer of 0, 3, 8, 12 and 15 bytes holding any shorter body,
every chunk of up to 8 bytes, allocations allowed to fail, with
|
|
|
|
Any descriptor or index entry, into an empty or a full table |
Kept exactly when whole, with a |
|
|
Strings up to 6 bytes, buffers up to 4 |
Terminated, what fits; a digest matches exactly |
|
|
Lines up to 22 bytes, settings of 4 bytes with their NUL |
A setting written only for its exact key, holding the text after
the first |
|
|
Any entry with a name and version of up to 6 bytes, into an empty
or a full table; a path buffer of 40 bytes, which some of those
paths outgrow, in place of |
Kept exactly when name, version and source are valid, the path is
|
|
|
None, one or both of two fixed entries, into buffers of 0 bytes and of each document’s size with and without its NUL |
0 exactly when the document fits with its NUL, then the state
document byte for byte and its length; nothing written past the
buffer, nor to the length on |
|
|
0 or 1 pairs, every limit, allocations allowed to fail |
|
|
|
Every pair and operation, into an empty or a full publication; every base and head with 0 or 1 operation at any seq, and a parent and segment keys of every content the parser leaves |
A key taken once, with a value, below its limit; an operation
taken exactly when whole and with room; a publication accepted
exactly with a parent that is none or a |
|
|
Payload and signature layers of fixed digests and sizes of 0 and 0, 1 and 4096, and 263 - 1 and 1; the SHA-256 of the empty config a stub |
The manifest bpm tree append writes reads back as its two layers, and a node takes it as their canonical form; the layers swapped, or two payloads in the publisher’s own form, refused |
|
|
Every count and capacity up to |
Room kept as it is; a full array grown to 16 operations or twice
its size, never past |
|
|
Every sequence number and generation; strings up to 2 bytes |
Refuses exactly a publication of another tree, of an earlier
generation unless the same manifest, naming another parent when
the next generation, or with its head before the node’s cursor;
asks for a walk exactly when one it accepts starts past the
cursor, or past 0 without a state. A step of the walk accepts
exactly the segment the successor names, of its tree, ending at
its base and of a lower generation. The walk is allowed exactly
|
|
|
Active or inactive image config; every signing-set count through capacity, every unvouched count through the set size, and parse, allocation, load, check and fetch failures |
An active image fetch receives the same set whose load and check succeeded, only when it is nonempty and fully vouched; preflight failures refuse the fetch and every allocated set is released |
|
|
The full command with 0 or 1 operation at any base, every pending state, selector answer, install answer and first failing I/O call, or no failure; a publication past the cursor asks for a walk the registry cannot serve. Names have one byte, and the previous root and the history roots the outcomes record holds at the cursor and at any other seq have 32 symbolic bytes each. |
Writes match the C restatement of the Lean model
|
|
|
Two operations with no pending record; every selector answer and first failing I/O call, or no failure. The previous root has 32 symbolic bytes. |
The same ordered-write properties as |
|
|
Two operations with a pending record; every selector answer, measured state and first failing I/O call, or no failure. TPM replay equals the previous root, the next root, or neither; the previous root has 32 symbolic bytes. |
The same ordered-write properties as |
|
|
The publication the tag names and a sealed segment the registry serves by its digest, one operation each, at any bases and generations; every pending state, selector answer, walk limit, link between the two and first failing I/O call, or no failure |
The same ordered-write properties as |
|
|
Publications with 0 to 2 operations, a pending record at, below or above the cursor that matches an operation or none, each TPM replay class, the measured flag, whether the upatch is loaded and every first failing I/O call. The previous root and the history root have all 32 symbolic bytes. |
The return decision, a record at or below the cursor removed whatever the publication holds included, ordered writes, the outcome lines of the operations passed over and of the pending one, cursor, tree ID, manifest, recorded head and base, both projection roots and the history root match the independent recovery model |
|
|
Every two selectors of up to 2 entries a list and a map and 2 values a pair, strings up to 2 bytes |
The decisions of the Lean model |
|
|
Publications of up to 3 operations, at every index; an |
|
|
|
Selectors of up to 2 release prefixes, build IDs and architectures against any release, machine and build ID, and of up to 2 labels against five fixed label lines or labels that cannot be read; strings up to 2 bytes. The node’s files are 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 |
|
|
Selectors of up to 2 kernel options, keys up to 2 bytes, a key twice among them |
A key is found at the first pair that has it, where the config’s value for it is kept, and no other key |
|
|
A key or a value of 0 to 2, 255 and 256 bytes into 0 to 2 pairs; up to 2 pairs and values of strings up to 2 bytes; digests up to 65 bytes |
A pair is added only below its limit and when both strings fit,
whole, and a refusal counts nothing; |
|
|
Any record |
Takes exactly a whole record of schema 1 with a positive seq, a upatch name and a sha256 digest; writes schema 1 and the operation’s seq, id and digest once, which reads back as the operation’s |
|
|
Tree eventlogs of 0 to 3 lines of any records; the read or the
hash failing. The JSON of a line, |
|
|
|
Tree eventlogs of 0 to 4 and 6 bytes, any bytes, whose lines hold records that replay but for one at most |
Each whole line read once and in order, nothing of a last line without its newline; a log with a NUL refused unread; the log released once |
|
|
Lengths 0 to 18 |
What install loads and uninstall unloads goes by the suffix alone; a pair refused exactly for a name that is neither and for a room short of what its kind needs, 8 bytes more than the name for a load and 6 fewer for an unload; else terminated, the other half, and pairing back to the name |
|
|
Names of 1, 99 and 100 bytes, every size and mode, after members
of every total up to 256 MiB, a file or a directory without
content; the checksum for names that end in 16 free bytes; every
value into a field of 8 and 12 bytes; |
Refused before a byte is written or counted from 100 bytes of name
on, and with |
|
|
Targets of 0 to 8 bytes; up to 4 bytes into a table that holds one target |
Takes exactly the paths the archive reader takes that have no final slash; a target joins the table once, none above or below one that is in it, and a refused one is not counted |
|
|
Targets of 0 to 6 bytes below a directory of 2, every buffer size |
Refused exactly when it does not fit, with nothing written; else the directory, a slash and the target, terminated; a target bpm build takes is the member the reader finds, and the directory’s own entry a path it takes |
|
|
Up to 129 bytes, past the 128-byte limit |
Takes exactly the names the target takes as a package’s, each one the repository index takes |
|
|
Versions of 5 to 9 bytes, behind a name of 1 |
A version bpm build takes is one the target takes, and
|
|
|
Values of 0 to 12 bytes, every buffer size up to one byte more |
Takes exactly a quoted string between blanks that fits, decoded as
a reference decoder does, with |
|
|
Values up to 10 bytes, a limit of 1 or 2 strings |
One string or more up to the limit, each terminated, between brackets; no row past the limit written; a refused array is not counted |
|
|
One element of 1023 to 1025 bytes with its quotes, around the 1024 its copy holds |
Refused, as too long for the copy or for its row, and not counted |
|
|
Arrays of three IDs of 0 to 2 bytes each, of any bytes but a
quote, a backslash and NUL; |
Taken exactly when each ID is a nonempty run of
|
|
|
Lines of 0 to 10 bytes; a string, a |
A line is cut at a |
|
|
One table header after every count of its kind up to the limit;
|
|
|
|
One package of fixed short strings into a namespace without an index, of sizes 1, 263 - 1, 0 and -1; registry, clock and signer stubs |
The document handed to the signer is one the target reads, with the one package and each field as pushed, but for a size of 0 or less, which the target refuses; one document signed, one manifest put |
|
|
An index of one package as the registry serves it, and a push of another package, of the same version again, and of the same version with another digest; registry, signature check, clock and signer stubs |
The index signed next is one the target reads, with the pushed package once and before the one listed, which is kept as it was; a version with other content is refused and nothing signed |
|
|
Five fixed publications without operations: the first of a tree, the last generation and sequence number, one past each, and one without a tree ID |
Tree, generation, parent, base and head read back as written;
the target reads up to generation and sequence number
263 - 2 and refuses the three |
|
|
Every file: the header is read from a buffer of exactly its size for files of any size |
Reads nothing past the header; an accepted header has its magic,
version, zero reserved field and a terminated name, a BPF or Java
payload, a signature, every section inside the file and behind
the header; a BPF payload has a loader of whole aligned
instructions and a |
|
|
Data of 15, 16, 40 and 64 bytes |
Sections kept only behind a valid trailer, the directory ending where the trailer begins, so that the signed trailer gives the length of the data, each section inside the data below the directory; none of a directory with a reserved word set or a tag unknown or repeated; nothing kept on refusal |
|
The |
A one-section directory in 288 bytes |
A kept name is terminated within 256 bytes; a refusal keeps neither |
|
|
Sections of every length declaring up to 2 decoders, and any count in a section too short for 3 entries |
Names terminated, each source non-empty and inside the section
behind the entries, every kind set, nothing kept on refusal,
|
|
|
Sections of 0, 1 and 2 labels and the lengths around them |
An accepted section fills its length exactly, with its magic and
version, two distinct map indexes below the map count, one bit
per label, a terminated name and an absolute path of at most 255
bytes that does not end in |
|
|
Names up to 24 bytes; names of 250 bytes, any 8 and then letters; archive names up to 31 |
Valid exactly for |
|
|
Tables of 3, 15, 16 and 176 bytes, as many programs as fit, every allocation allowed to fail |
A refusal leaves nothing allocated and |
|
The program count |
Tables of 3, 16, 176 and 336 bytes, any count larger than they hold |
Refused before the program table is allocated or an entry read, with nothing returned |
|
What |
One program and one record in 226 bytes, the table’s program count and the record’s lengths fixed: a path and a build ID of one byte, 1 or 2 offsets |
A uprobe program accepted with its entry valid, a glob without
|
|
|
The 50 bytes after one program in a 226-byte table, path and build ID up to 9 bytes, up to 2 offsets, the program’s entry any uprobe one |
Reads only the block and changes only the uprobe fields; an absolute path of its stated length without a NUL, one offset for a single uprobe, a build ID of 1 to 64 bytes, offsets non-empty and strictly rising, everything freed |
|
The kprobe multi target records of |
Arbitrary tables of 206 to 210 bytes, one program, 2 to 6 bytes of names, every allocation allowed to fail. Allocation requests dispatch to the original allocator at the same constant extent: one program, a buffer of 2 to 6 bytes or 1 to 3 symbol pointers; a request outside those bounds fails an assertion, as does an attempt to allocate a uprobe path, whose payload cannot fit |
At least one name, each terminated inside the record’s buffer, the names strictly rising, everything freed |
|
|
Loaders of 4, 5, 25 and 49 instructions |
Reads only the loader, and only instructions before the call it looks back from; reports exactly what it matched; every slot below the table’s size |
|
|
Loaders of 4, 10 and 15 instructions and 24 bytes of data |
The BTF it locates lies inside the data |
|
|
Any loader of 6 or 8 instructions; at 24, the shape the loader generator emits with every other field free; 48 bytes of data |
The value it locates lies inside the data, with the size and type its section declares |
|
|
BTF of 4 types, names up to 6 bytes, libbpf modelled |
A printed name is printable ASCII, an accepted declaration chain has no loop, an unwrapped type is 0 or has no qualifier |
|
|
Every encoding and every value of up to 8 bytes |
The bits stay inside the integer’s bytes; each bit of the value is the integer’s bit at its place, least significant first, then zero- or sign-extended |
|
|
Every value of every field and every name shorter than 256 bytes |
The reader takes the header from a file of any size and reads back each value; the name is padded with zeros to its 256 bytes |
|
|
Loader data of 0, 1, 7 and 8 bytes; a name with an unload digest, or with attach metadata of 1 to 8 bytes |
The reader finds each section where the writer put it, at an 8-byte boundary, with its bytes and length, the loader’s data in front and zeros between; a count of 0 or above 8 and data past what a length field holds are refused, with nothing written |
|
The four sections of a load, through the same two functions |
1 byte of loader data, 3 of attach metadata, any 217 bytes as decoders and any 4188 as policy labels |
Data of the length the format gives; the reader keeps the sections
exactly when |
|
|
0 to 2 decoders with sources of 3 and 1 bytes; any manifest the writer takes for one decoder, names of 2 bytes for two |
A section of the length the format gives, its reserved field zero; each view shows the manifest’s values, its names padded with zeros and the source’s bytes at its offset; no section without a decoder and none past what a length field holds |
|
|
22 objects of 0 to 2 programs from a table: the sections attached by BTF target, cgroup and netfilter, a test run, serializers of one and two maps, one with any 3 bytes behind its map’s first, a map name at its limit, and the sections and programs the writer must refuse; any map count, any two map names and any output map, or none |
A table of the length the format gives; the reader takes it and reads back each role, kind, target, offset and map; a refusal leaves nothing written and nothing allocated |
|
The kprobe entries and the kprobe multi target block of
|
23 objects from a table: a symbol of 1 to 127 bytes, alone or with
a decimal or hexadecimal offset of up to 64 bits; a kprobe multi
list of one name or two out of order, alone, beside another list
or behind a uprobe; and the sections the writer must refuse, a
symbol of 128 bytes, an offset behind |
The symbol and offset read back are the section’s, and a list’s names its own, sorted; a uprobe and a list in one object both read back; what the reader refuses, or would cut short, is refused. The mixed table’s fixed structural fields are asserted and stored again as equal constants before the reader runs. The mixed table’s growth request is asserted to match its exact base and final lengths before calling the original allocator with those extents. Its reader’s allocation extents and two-byte, non-NUL path are asserted before equivalent fixed-size allocations and path copying |
|
The XDP entries of |
|
The device classes read back are the decimal mask of the section; a mask the reader refuses, and a class two programs select, are refused. The writer’s fixed structural fields are asserted and stored again as equal constants before the reader runs; target block parser loops are unreachable |
|
The uprobe target block of |
22 objects from a table: each uprobe section form at the path
|
The reader takes the block and reads back each record’s path, build ID and offsets for the program it names, a function’s offset below 4 GiB; a refusal leaves nothing written and nothing allocated |
|
|
Certificates of 0 to 2 bytes, a set of two members, every allocation allowed to fail |
What |
|
|
Lengths 0 to 6, every room up to one byte more |
Accepts exactly the ECMA-404 strings without |
|
|
Every pair of code units |
A pair is its 4-byte UTF-8, a code unit its own; |
|
|
Values of 0 to 6 bytes |
An integer field takes exactly an ECMA-404 integer at its value; a
string fits its room; a boolean takes |
|
|
Lengths 0 to 6, every buffer up to 7 bytes or none, a
|
The result, end and bytes of the Lean model |
|
|
Every pair of |
The result, end and bytes of the Lean model |
|
|
Every document of up to 2 bytes, depth 2 |
Agrees with an independent ECMA-404 recognizer; containers in pairs, numbers whole with their integer flag |
|
The bounds of |
Fixed documents at small bounds |
Past the size or depth limit |
|
|
Strings of 0 to 4 bytes |
Refuses exactly a NUL or bytes that are not UTF-8; writes one ECMA-404 string that decodes back to the input, or with U+FFFD in place of each NUL and stray byte |
|
The writer and |
Strings of 0 to 4 bytes |
Every string the strict writer takes reads back whole |
|
|
Lengths 0 to 4 |
Refuses exactly where the Lean model |
|
|
Texts of 0 to 4 bytes, every room and limit, allocations allowed to fail |
Grows only up to its limit; fails exactly when the text does not fit, keeping the longest prefix that does, terminated |
|
Every container and key writer, |
Every sequence of up to 4 calls, every depth |
Valid JSON by a byte-level recognizer; a comma only after a
member; |
|
|
Three fixed bodies, without a tree, with a tree and nothing else 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
|
|
|
Every answer of the state’s reads, of any fields with strings of
one byte, of pending.json’s and of |
Tries up to the first whose two reads agree, the state handed
back the first read of the last try; |
|
|
Every outcome of the three encodings, rooms of 1, 19, 20 and 21 bytes |
|
|
The OTLP header checks and |
Strings up to 32 bytes |
Names exactly RFC 9110 tokens, values without controls but tab;
each |
|
|
Headers up to 32 bytes, dates modelled; lines of 139 to 142 bytes whose value is 122 to 130 bytes once trimmed, around the 128-byte buffer it is copied into |
A delay is at most 30 seconds, the value itself when shorter; a header line read only within itself, its value copied only when it fits |
|
The TPM reader primitives of |
Every reader state over an input of any size |
Every read stays inside what is left, and what is left still ends at the input’s end; a sized field lies inside the input and its bound; a name is at most 34 bytes |
|
|
Every input |
Accepts exactly ECDSA over SHA-256 with 32-byte r and s, in 72 bytes, and returns those bytes |
|
|
Every input; takes about 27 minutes |
Starts with |
|
|
Every signer of up to 34 bytes and key name; attestations of up to 16 bytes and signatures of up to 72; SHA-256 recording its input and ECDSA as any verdict |
The signer is the key exactly when it is |
|
|
Every input |
Accepts only the key shapes shirudo uses, P-256 or RSA-2048 with a 256-byte modulus, each spanning exactly the input |
|
The policy, name and cpHash digests of |
Names of any length, every PCR mask, up to 24 PCR values, SHA-256 as any result |
Each reads only whole inputs and writes only its output; an object name has a public area of 4 bytes or more; a writer’s authorization takes a nonce of 1 to 64 bytes |
|
|
Labels up to 66 bytes, outputs up to 64, any context |
Reads and writes only what it is given; an oversized context or party is refused |
|
|
Up to 16 characters |
Passes exactly |
|
|
Eventlogs of 1 to 3 records: an init of any reset count, the load of a BPF upatch, the unload of a Java one, a tree operation or another type, each with or without a record word, a digest, fields that decode and a valid name; hex decoding and event digests as stubs, the record types and their tags as copies |
Refuses exactly where |
|
|
Every index and 64-byte value text |
Stores only PCRs 0 to 23, the value its 64 hex digits spell under its index, and marks exactly that one; the other PCRs stay as they were; a refusal marks nothing |
|
|
Names of 0 to 8 and 255 to 257 bytes; every payload, digest, sequence number, register and history root |
SHA-256 is given exactly the bytes of the Lean model
|
|
|
Every sequence of up to six init, load and unload records over two names and two payloads |
The set holds a name with a payload exactly as the Lean model
|
|
|
Logs of 0 to 32 bytes |
Refuses exactly a log with a NUL; keeps whole lines unchanged up to the last newline, cutting only a torn last line |
|
|
Hash files of 0, 511, 512 and 4096 bytes |
Accepts exactly the version 1 SHA-256 layout with 4096-byte blocks, a 32-byte salt and 1 to 2^28 data blocks; the hash tree’s size by dm-verity’s own formula; nothing changed on refusal |
|
|
Values of 0 to 16 bytes, any earlier value |
A passphrase as it stands, |
|
|
Passphrases of 255 to 258 bytes, any 8 bytes and then letters, any earlier value |
A passphrase of up to 256 bytes as it stands; a longer one refused, the value before kept |
|
|
Values and names of 0 to 7 bytes |
A list exactly when empty or names apart by single commas; a name
exactly when labels of 1 to 63 letters, digits and hyphens apart
by single dots, none starting or ending with a hyphen, at most 253
bytes in all, not every label a number, decimal or |
|
|
Every record |
|
|
|
Every event the JSON parser can hand over, into a history of 0, 1, 15, 16, 128, 4095 and 4096 events, allocations allowed to fail |
Joins exactly when whole, with a positive sequence, a boot or update kind and a root of 64 hex digits, below 4096 events, as the values given; a refusal keeps the history as it was; room for more than 4096 events is never asked for |
|
|
Every value, or none, under each key of a config history of 0 to 2
events, cut or malformed at any point; |
Takes exactly a history with every key, schema 1, a PCR from 0 to
15 but 9 and 11 or the config NvPCR’s index, 32-bit counts, 64 hex
digits of initial value and one boot event then updates in
sequence, as said, and names one out of order with
|
|
|
Every view of 0 to 2 events; the JSON writer a model that records
each member under its key, |
The parser returns every field the writer was given, exactly for a
view that replays; a sequence past a |
|
|
Every view of 0 to 3 events, without events or past 4096 of them, every quote mask, TPM boot, PCR value, certified NvPCR value or none, and expectation; SHA-256 as any digest or failure |
Passes exactly when the register is a PCR from 0 to 15 but 9 and 11 that is quoted, or the config NvPCR, certified and with a history that starts at the digest of 64 zero bytes, and is the expected one, the reset count the quote’s, the events one boot event then updates in sequence, the quoted or certified value the initial one extended by each event’s digest in order, and the last root the expected one; a digest hashes the tag, the kind and the root; a root without its PCR is refused |
|
|
Every journal of 0 to 2 records and every active selection, the journal’s reader a stub that may fail; SHA-256 as any result |
Exports exactly the records of the selection’s reset count, in order, when they are on its PCR from its initial value, one boot event then updates in sequence, and end at the selection; a refusal returns nothing, with nothing left allocated |
|
|
One settings line of 0 to 8 bytes, failed reads and allocations, and an initially empty state with the root flag and runtime presence varied. These lines cannot contain a complete setting. |
A short line cannot add a certificate or set a PCR; the runtime and root presence flags stay unchanged |
|
|
Every earlier key count through capacity, each of the runtime’s
|
Only a distinct runtime path joins a non-full set; duplicates, those two paths and overflow leave the count unchanged; earlier paths keep their order |
|
|
Up to 8 bytes |
An accepted path is absolute, not |
|
|
Up to 7 bytes; names of 127 and 128 bytes, any 7 and then letters |
A name exactly when 1 to 127 of |
|
|
Notes of 0 to 24, 28, 32, 36 and 40 bytes; of 80 and 84 bytes with any first note header and name and fixed bytes after them |
Reads nothing past the notes; a build ID of 1 to 64 bytes, in 2 to 128 lowercase hex digits, that is the first GNU build ID note’s, or empty, none from a section whose one note is another, and none from a first GNU build ID of more than 64 bytes |
|
|
Releases and prefixes up to 8 bytes |
Matches exactly where the prefix ends with the release or before a
|
|
|
Messages of 0 to 5 bytes, every buffer size |
Terminated printable ASCII, every backslash a |
|
|
Every chunk |
Accepted exactly as the chunk asked for, by index, count, page and
cursors, of this invocation and format, naming no more bytes than
a chunk carries; |
|
|
Two strings of 0 to 3 bytes each, caps 1 to 3 |
The Levenshtein distance by its definition when it is within the cap, and more than the cap when it is not |
|
|
A word of 0 to 2 bytes, up to two commands of 0 to 2 bytes each,
every combination of the three lengths, capacities 0 to 2, with
|
Commands of the table within the cap, each with its distance, nearest first, never more than the capacity, none nearer left out |
|
|
A word and up to three commands of 0 to 2 bytes, capacities 0 to 2 |
The first command that is the word, else the commands the word begins, else those that begin it, in table order, as many as the capacity takes and none written past it |
|
|
One call from any state a run reaches, on up to three arguments of 0 to 6 bytes, against a table with an option of each kind |
Each call takes an argument, so a run ends; an argument or a value lies in an argument; a flag has no value; a value is there and not empty unless the option allows it; no option comes back twice unless it repeats; a number lies in its bounds |
|
|
One unknown option of 64 to 66 bytes, around the 65 its copy holds |
Refused, and a name suggested for it only when it fits the copy |
|
|
Every table of up to two options built from names |
A malformed table refused before any argument is read, a sound one read; each listing printed and the run done |
|
|
Every input |
The first verdict of its order that applies; |
|
|
Every input |
As many rows as there is room for, in the report’s order; with
room for all, each the first state of its row that applies, the
worst first but for |
|
|
Every text of up to 193 bytes; texts of 832 to 1024 bytes that start with a fixed 832 |
The whole text up to 191 bytes, else its first 188 and |
|
|
Masks of 0 to 9, 512 and 513 codes, every code and buffer size; 0 to 7 conditions of every known type, one unknown, and every status. OpenSSL’s encoder is a stub that keeps its input |
A window past 512 or a code past two bits is |
|
|
Values and texts of 0 to 6 bytes; values of 255, 256 and 257
bytes; command lines of a word, |
A value taken exactly when one or more printable bytes remain
after one pair of quotes and the escapes of double quotes, at
most 255 of them; of a key’s lines the last; the root
|
|
|
Netlink replies of 0 to 12, 16, 20, 24, 28, 32 and 40 bytes |
An attribute exactly in a run of whole attributes that names its type at most once, found where it lies; a string NUL-terminated within its room; a number only of its exact size; a device with an index, a name, terminated strings, and the bus and device of a devlink port |
|
|
Lines of 0 to 2, 10 and 21 to 23 bytes of any value, which reach an option set, one not set and every refusal |
Nothing read or written outside the line; a name that is
|
Lean 4 proofs#
Each proof holds for every input of the model; the last column says how the model follows the C.
Model |
Theorems |
Assumptions |
Follows the C |
|---|---|---|---|
|
|
|
CBMC, |
|
|
The hash never yields the initial value and is injective on the
(register, event) pairs: on every pair for |
Review; the bytes of the history root’s step are
|
|
|
SHA-256 maps no two different strings the histories hash to one
digest and none to 32 zero bytes, for |
CBMC, |
|
|
None |
Review |
|
|
|
Review; the |
|
|
The register value and its certification as
|
CBMC, |
|
|
None; numeric identifiers compare by value only without a leading
zero, which |
CBMC, |
|
|
A C string is shorter than 2^63 bytes |
CBMC, |
|
|
Resolution as the kernel walks a path, |
CBMC, |
|
|
A string is shorter than |
CBMC, |
|
|
The emitter has room; for |
CBMC, |
|
|
Commands one at a time; atomic renames of |
Review; CBMC, |
|
|
The lock excludes and a kill releases it; a kill keeps pins and
files; pin directory removals, archive renames and appends are
whole; a reboot clears pins and register and |
CBMC, |
|
|
A sync that walks is taken as one sync per segment, which it is
but for the state each segment but the last writes at its end, a
pending record an earlier segment passed, which stays to the next
sync rather than the next segment, and the cut a sync makes before
a walk back that refuses; the base and prefix checks are left out
of the model, as they only refuse more. A manifest digest names
one publication; the hash is injective on every (root, digest)
pair, an idealized hash, which no hash onto 32 bytes is, and
never 64 zeros; only sync writes the tree files,
each write whole, one sync at a time; the unlink of |
CBMC, all run in CI: |
|
|
One node for both selectors: its release, machine, build ID,
config values and labels are the same for the two matches, and
|
CBMC, |
Files without a proof#
A harness reads a source file by including it. Every file of
util/ and tools/shirudo-build/ that the repository tracks,
every builtin-*.c and shirudo.c is read by a harness or
listed here with the reason,
and .github/scripts/check-docs.sh fails when a file is neither or
when a harness reads a file this list still names. A file a harness
reads is not proven whole: the tables above say which of its functions
a proof covers.
Files |
Why no proof reads them |
|---|---|
|
Mostly calls into the kernel, which CBMC has no body for: files,
extended attributes, mounts, the device mapper, keyrings,
|
|
Mostly calls into a library a harness would have to model whole: OpenSSL, libcurl, libelf, the BTF reader of libbpf, tpm2-tss and LuaJIT |
|
Output for people: sizes, durations, help, the load report and
the table of loaded upatches. |
Data only: the embedded BPF objects |
|
The builder’s check of a jar the operator hands it, which reads
the zip directory and has zlib inflate the manifest. The |
|
|
Commands: options, the order of calls into |
Not covered yet#
The fuzz targets in Test coverage cover these parsers; no proof
does: how json_parse() dispatches objects, arrays and maps to their
schemas, and the members and elements of a JSON document longer than
the two bytes json-walk takes, the OTLP headers a configuration adds
and the collector’s reply to an export, the walk over a package’s tar
members, the registry references and URLs and the registry credentials
file, the lines a tree selector cuts a kernel configuration into and
the labels it reads,
the tree’s state.json and its outcomes record, the evidence document
beyond its PCRs and its config
history, the config update record, the site configuration file, the
config image’s settings and tree and the fields of a
shirudo-quote-check row. Of the eventlog’s lines, the Lean model
Shirudo.EventlogRecord covers what the reader takes from the fields
json_parse() returns, by review; the parse of a line itself, as the
replay and the walk of a boot read it, has the eventlog fuzz target
alone.
The .upatch reader, the TPM structures and the package, index and
tree readers are covered part by part, as the table shows; what joins
those parts has no proof. So it is with the package state:
bpm_state_parse() hands on_state_entry() to json_parse(),
and neither that nor reading back what bpm_state_emit() writes has a
proof, as a string of any contents moves all that follows it in the
document, which costs CBMC more memory than it has. The bpm_state
unit cases check both on fixed entries. Nor has the parse of a token
server’s answer: bpm-oci-token takes every outcome of
json_parse() its contract allows, as parsing 17 bytes of any value
outgrew 6 GB, and the bpm_oci unit cases and the oci-http fuzz
target read real answers. The zip directory walk of
jar_premain_class() in tools/shirudo-build/jar.c has neither
a fuzz target nor a proof; its unit cases cut and flip a jar byte by
byte.
Of util/io.c the proofs cover lines_len(),
read_text_line() and the append of a record. pread() never fails
in them, so the retry of last_line_end() after EINTR and its
refusal of a short read have no proof, nor have the readers of whole
files, which go to the kernel.
Of util/paths.c and util/serializer.c the proofs cover the
functions the table names. key_paths(), which calls
format_key_path() twice, keys_dir_resolve() and
path_exists(), and the serializer’s lock and invocation number, which
go to the environment or the kernel, have none, and neither has the loop
of util/upatch_maps.c that puts a page together from the chunks
serial_chunk_validate() accepted. edit_distance() of
util/similar.c is proven on strings of up to 3 bytes: at its
limit of 64 CBMC ends a run on the code as it is and none on the code
broken, so no proof of the limit is kept. options-next takes
parse_u64() by the contract string-number proves and leaves out
the text of the usage messages, which only pr_err() reads, and
opt_choice(), a comparison of the value with a fixed table, to the
unit cases. Of util/sysinfo.c the
proofs cover the image identity’s parsers; reading the files they parse,
and the readers of /proc and the root file system, go to the kernel
and have none. Of util/attest.c the proofs cover the functions
the table names, and Shirudo.AttestReplay models how
attest_verify() selects and replays the eventlog’s records. The
other steps of verify_document(), evidence_parse() to
verify_register(), verify_anchor() and
verify_expected_pcrs(), check_signed() and
pcr_values_digest(), which the target checks its quote with too,
have none; the attest fuzz target runs them. Neither has
quote_covers(), with which the target checks its own quote,
read_file_base64() and attest_challenge_read(), which read the
challenge on the target, or attest_challenge_make() and
cert_describes(), which read a target’s evidence to make one.
The config NvPCR certification check, verify_config_nvpcr(), has no
proof.
Of the other files the proofs read in part, these functions have no
proof: dns_name_valid() of util/string.c at its limits of a
63-byte label and a 253-byte name, as names that long take CBMC past
8 GB; tpm_public_marshal() and tpm_writer_public() of
util/tpm_wire.c, the first of which the tpm-wire fuzz target
round-trips; upatch_rodata_symbol_range() of
util/upatch_rodata.c, the range of .rodata the builder
rewrites; chain_init_event() of util/chain.c on a set that is
not empty; upatch_name_signed(), upatch_member_valid() and
prog_specs_xdp_classes() of util/upatch.c; the reading of
the eventlog behind boot restore in util/measured.c,
init_of_live(), record_event() and the walk of
verified_upatches(), and that upatches_line() of
util/eventlog.c hands init the names and payloads whose events
record_event() hashes, as no fuzz target reaches them and a proof
over one record of the two readers, json_parse() modelled, runs out
of 8 GB; check_table() of
util/dm_verity.c, which takes or refuses the kernel’s table of a
config image’s mapping, as CBMC 5.95 keeps the parameters of the
4096-byte reply symbolic even where a harness writes them and runs out
of 8 GB on a whole table, and no fuzz target reaches it either; the
refusal of
measured_event() at the set’s capacity of MEASURED_MAX, 4096
entries, whose proof runs past 40 minutes; and of util/xdp.c the loop of
nl_exchange() over a reply’s messages, the requests attr_put()
builds and the device class and selection that xdp_device_class(),
veth_peer() and xdp_device_selected() decide.
Logic of the files without a proof that sits between their calls and
could be proven, as neither a proof nor a fuzz target reads it:
split_describe() and the match of keyring_holds_exactly() in
util/keyring.c; guard_map_check() of util/identity.c
and the guard link and program checks of util/image_guards.c; the
host match of
tls_classical_host_allowed() in util/tls_openssl.c;
pin_index() and the pin set of util/upatch_pins.c;
rc_is(), public_from_tss() and marshal_signature() of
util/tpm.c; the slot arithmetic of shirudo.page_slots() and
shirudo.fixed_records() and the decoders’ memory cap in
util/upatch_decode.c; and the label comparisons of
util/seal.c.
Within the operator’s package builder and publisher, the proofs cover the
tar header, the member names, the Beefile’s values, lines, names, fixes
and table limits, and the index and the tree publication on fixed
documents.
The Beefile’s keys, defaults and the checks behind its last line,
build_validate(), the rodata commands, build_archive() and what
it puts into build-environment.json, a publication with operations,
the manifests but the tree publication’s, and the generation and
sequence numbers bpm tree append counts up have no proof. A value of any length in a JSON
document moves every byte behind it, and a tree operation takes 13 KiB
in each of its copies: a proof over either runs for minutes. Of
tools/shirudo-build/bpm-publish.c the proofs read
push_index() and what it calls; cmd_bpm_tree_append() and the
steps it runs, tree_append_parse() to tree_append_free(), have
none.
Within the .upatch reader, the proofs cover its parts but not their
composition: upatch_parse() and upatch_open_memory() join the
header, the signed sections, the decoders and the policy labels the
proofs cover one by one, and a proof of the whole file runs out of
memory. A program table of two or more programs, and with it the rule
that two XDP programs select disjoint device classes, which the
upatch unit cases check, find_rodata_data()
on loaders of other shapes, btf_dump_cost(), the .rodata printers
and the libbpf calls behind btf_rodata_btf() have no proof.
Within the .upatch writer, the proofs cover the functions that lay
out bytes, each with the reader of its part, but not what joins them:
finalize_object() and package_resign_symbols() compute the
header’s offsets around the loader libbpf generates and the signature
OpenSSL makes, build_package_load() writes the header of the policy
labels between its libbpf calls, and collect_decoder_manifests()
picks the manifests out of .rodata. The attach metadata is proven
for the sections of a table, not for every section name: a kprobe or
uprobe target of any bytes makes the reader’s side of the proof too
large, and no proof reaches a uprobe path at its 4095-byte limit.