Repository navigation
Leakage-aware specification for memmove - #581
Open
JasonGross wants to merge 1 commit into
Open
JasonGross wants to merge 1 commit into
JasonGross wants to merge 1 commit into
Conversation
Both spec instances of memmove (spec_of_memmove over map.of_list_word_at and spec_of_memmove_array over Array.array ptsto) now use the leakage program logic: the postcondition additionally says k' = f dst src n ++ k, where the leakage function f is quantified before the ghost variables, so the leakage of memmove depends only on the two pointers and the length, never on the bytes being moved. f is memmove_trace: it branches on the same pointer comparison the code does and then unrolls the copy loop (memmove_loop_trace) leaking the store and load addresses of every iteration. The two loop proofs use LeakageLoops.tailrec with the leakage equation in the loop invariant. br_memcpy in memcpy.v is the only caller of these specs; its spec becomes a leakage spec too (k' = f p_d p_s n ++ k, with f = memmove's leakage function followed by the call's leak_unit). Requested by Andres Erbsen in mit-plv#565. Written by Claude Fable 5.1. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both spec instances of
memmove(spec_of_memmoveandspec_of_memmove_array) now use the leakage program logic: the postcondition additionally saysk' = f dst src n ++ k, where the leakage functionfis quantified before the ghost variables, so the leakage depends only on the two pointers and the length, never on the bytes being moved. The concrete function ismemmove_trace: it branches on the same pointer comparison the code does and then unrolls the copy loop, leaking the store and load addresses of every iteration. The two loop proofs useLeakageLoops.tailrecwith the leakage equation in the loop invariant.br_memcpyin memcpy.v is the only caller of these specs, so its spec becomes a leakage spec too (memmove's leakage followed by the call'sleak_unit).Requested in #565.
Written by Claude Fable 5.1.
🤖 Generated with Claude Code
https://claude.ai/code/session_01YJbiRBkJtM7x6PvYV6hmEm