Documentation

Miri.Memory.ProvenanceMap

The pointer-sized and byte-fragment representation from rustc's pinned allocation/provenance_map.rs. Read operations preserve the distinction between no provenance, wildcard provenance, and a partial CTFE pointer error. The checked construction below enforces sorted unique map keys. It does not replace the allocation's bounds/initialization/aliasing checks.

structure Miri.Memory.PointerFrag (Prov : Type u) :
Instances For
    def Miri.Memory.instDecidableEqPointerFrag.decEq {Prov✝ : Type u_1} [DecidableEq Prov✝] (x✝ x✝¹ : PointerFrag Prov✝) :
    Decidable (x✝ = x✝¹)
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Miri.Memory.instReprPointerFrag.repr {Prov✝ : Type u_1} [Repr Prov✝] :
      PointerFrag Prov✝ → Nat → Std.Format
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        @[instance_reducible]
        instance Miri.Memory.instReprPointerFrag {Prov✝ : Type u_1} [Repr Prov✝] :
        Repr (PointerFrag Prov✝)
        Equations
        Instances For
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              structure Miri.Memory.ProvenanceMap (Prov : Type u) :
              Instances For
                def Miri.Memory.instDecidableEqProvenanceMap.decEq {Prov✝ : Type u_1} [DecidableEq Prov✝] (x✝ x✝¹ : ProvenanceMap Prov✝) :
                Decidable (x✝ = x✝¹)
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  def Miri.Memory.instReprProvenanceMap.repr {Prov✝ : Type u_1} [Repr Prov✝] :
                  ProvenanceMap Prov✝ → Nat → Std.Format
                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[instance_reducible]
                    instance Miri.Memory.instReprProvenanceMap {Prov✝ : Type u_1} [Repr Prov✝] :
                    Equations
                    structure Miri.Memory.ProvenanceCopy (Prov : Type u) :
                    Instances For
                      def Miri.Memory.instDecidableEqProvenanceCopy.decEq {Prov✝ : Type u_1} [DecidableEq Prov✝] (x✝ x✝¹ : ProvenanceCopy Prov✝) :
                      Decidable (x✝ = x✝¹)
                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def Miri.Memory.instReprProvenanceCopy.repr {Prov✝ : Type u_1} [Repr Prov✝] :
                        ProvenanceCopy Prov✝ → Nat → Std.Format
                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          @[instance_reducible]
                          instance Miri.Memory.instReprProvenanceCopy {Prov✝ : Type u_1} [Repr Prov✝] :
                          Equations
                          Equations
                          Instances For

                            The source requires sorted, duplicate-free keys at this entry point.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              A fragment-state decoder with the same sorted-map key invariants. It is not a replacement for source prepare_copy/apply_copy/clear operations.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def Miri.Memory.ProvenanceMap.getPtr {Prov : Type u_1} (self : ProvenanceMap Prov) (offset : ABI.Size) :
                                Option Prov
                                Equations
                                Instances For
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      def Miri.Memory.ProvenanceMap.getByte {Prov : Type} (self : ProvenanceMap Prov) (offset pointerSize : ABI.Size) :
                                      Equations
                                      • One or more equations did not get rendered due to their size.
                                      Instances For

                                        Source get_range yields whole pointer entries first, then byte entries.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          def Miri.Memory.ProvenanceMap.provenances {Prov : Type u_1} (self : ProvenanceMap Prov) :
                                          Array Prov
                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            def Miri.Memory.ProvenanceMap.readPtr {Prov : Type} [DecidableEq Prov] [PointerProvenance Prov] (self : ProvenanceMap Prov) (offset pointerSize : ABI.Size) :
                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For
                                              theorem Miri.Memory.ProvenanceMap.read_exact_pointer {Prov : Type} [DecidableEq Prov] [PointerProvenance Prov] (self : ProvenanceMap Prov) (offset pointerSize : ABI.Size) (prov : Prov) (h : self.getPtr offset = some prov) :
                                              self.readPtr offset pointerSize = Except.ok (some prov)

                                              Mutating source operations keep the updated state even on assertion failure, using the standard library's EStateM result representation.

                                              def Miri.Memory.ProvenanceMap.insertPtr {Prov : Type} (offset : ABI.Size) (prov : Prov) (pointerSize : ABI.Size) :
                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                def Miri.Memory.ProvenanceMap.clear {Prov : Type} (range : AllocRange) (data : Array UInt8) (pointerSize : ABI.Size) :
                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  def Miri.Memory.ProvenanceMap.writeWildcards {Prov : Type} [PointerProvenance Prov] (range : AllocRange) (data : Array UInt8) (pointerSize : ABI.Size) :
                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For
                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        def Miri.Memory.ProvenanceMap.applyCopy {Prov : Type} (copy : ProvenanceCopy Prov) (range : AllocRange) (repeatCount : UInt64) :

                                                        Source apply_copy requires the affected range to have been cleared. The map insertions retain the source's replacement behavior at existing keys.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For
                                                          theorem Miri.Memory.ProvenanceMap.clear_new {P : Type} (range : AllocRange) (data : Array UInt8) (pointerSize finish : ABI.Size) (positive : pointerSize.bytes ≠ 0) (endEq : range.endExclusive = Except.ok finish) :
                                                          clear range data pointerSize new = EStateM.Result.ok () new
                                                          theorem Miri.Memory.ProvenanceMap.insertPtr_new {P : Type} (offset pointerSize finish : ABI.Size) (provenance : P) (positive : pointerSize.bytes ≠ 0) (endEq : (allocRange offset pointerSize).endExclusive = Except.ok finish) :
                                                          insertPtr offset provenance pointerSize new = EStateM.Result.ok () { ptrs := #[(offset, provenance)], byteFragments := none }
                                                          theorem Miri.Memory.ProvenanceMap.clear_singleton_before {P : Type} (range : AllocRange) (data : Array UInt8) (pointerSize finish : ABI.Size) (provenance : P) (positive : pointerSize.bytes ≠ 0) (before : pointerSize.bytes.toNat ≤ range.start.bytes.toNat) (endEq : range.endExclusive = Except.ok finish) :
                                                          clear range data pointerSize { ptrs := #[(ABI.Size.ZERO, provenance)], byteFragments := none } = EStateM.Result.ok () { ptrs := #[(ABI.Size.ZERO, provenance)], byteFragments := none }
                                                          theorem Miri.Memory.ProvenanceMap.insertPtr_singleton_after {P : Type} (offset pointerSize finish : ABI.Size) (old newProvenance : P) (positive : pointerSize.bytes ≠ 0) (before : pointerSize.bytes.toNat ≤ offset.bytes.toNat) (endEq : (allocRange offset pointerSize).endExclusive = Except.ok finish) :
                                                          ∃ (updated : ProvenanceMap P), insertPtr offset newProvenance pointerSize { ptrs := #[(ABI.Size.ZERO, old)], byteFragments := none } = EStateM.Result.ok () updated