Documentation

Miri.Interpreter.ValidityVisitor

Canonical typed runtime visitor from pinned validity.rs and visitor.rs. Traversal consumes actual RuntimePlace/TyAndLayout, not a pre-resolved value graph. Compiler facts and machine accesses remain required effectful leaves.

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
        Instances For
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Instances For
              def Miri.Interpreter.ValidityVisitor.instDecidableEqKey.decEq {P✝ : Type} [DecidableEq P✝] (x✝ x✝¹ : Key P✝) :
              Decidable (x✝ = x✝¹)
              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.Interpreter.ValidityVisitor.Hooks (P S C E Fn ABI Padding : Type) :

                  Memory operations here run under withGhostValidation, including provenance writes. Retagging is the source exception: its actual machine reborrow effects must still execute. readBytes strips provenance and checks initialization; it must not validate UTF-8 (source str validity only checks bytes). beginPadding obtains mutable allocation access once, followed by writePadding per gap.

                  Instances For

                    validity.rs::check_safe_pointer gives retag failures two pieces of source-specific treatment. A mutable reborrow of immutable memory is reported as a validity failure at the current path, while an aliasing-model machine stop carries the path as diagnostic context. This runner keeps the callback's successor state in either case, including when it fails after changing the borrow tree.

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

                        Keep the source check_ptr_align successor state when turning its one source-remapped failure into a validation UB. Other machine failures retain their original classification and successor state.

                        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.Interpreter.ValidityVisitor.retagSafePointer {C : Sort u_1} {P S : Type} (path : Memory.ValidationPath) (kind : Memory.SafePointerKind) (retag : C → RvalueImmTy P → MIR.TyId → M S (Option (RvalueImmTy P))) (c : C) (pointer : RvalueImmTy P) (ty : MIR.TyId) :
                            Equations
                            Instances For

                              Data-byte union layout walk. It traverses compiler layouts, never reads an active union field, and preserves the source scalar-array fast path.

                              Equations
                              Instances For
                                def Miri.Interpreter.ValidityVisitor.visit {P S C E F A Pad : Type} [Memory.PointerProvenance P] [DecidableEq P] (h : Hooks P S C E F A Pad) (c : C) :
                                Nat → Session P → RuntimePlace P → M S (Session P)

                                Recursive ValueVisitor plus validity-specific primitive/array/union rules. Fuel exhaustion is visible resource failure; it never validates an unexplored subvalue. Fields follow in-memory order; enum tag precedes active variant.

                                Equations
                                Instances For
                                  theorem Miri.Interpreter.ValidityVisitor.visit_fieldless {P S C E F A Pad : Type} [Memory.PointerProvenance P] [DecidableEq P] (h : Hooks P S C E F A Pad) (c : C) (fuel : Nat) (session : Session P) (place : RuntimePlace P) (state : S) (variant : Nat) (classify : h.classify c place.layout.ty state = EStateM.Result.ok (TypeKind.aggregate false false false) state) (inhabited : h.opsemInhabited c place.layout.ty state = EStateM.Result.ok true state) (fields : place.layout.layout.fields = ABI.FieldsShape.Arbitrary #[] #[]) (variants : place.layout.layout.variants = ABI.Variants.Single variant) (runtime : session.ctfeMode = none) (debugOff : h.debugAssertions = false) :
                                  visit h c (fuel + 1) session place state = EStateM.Result.ok session state

                                  A fieldless inhabited aggregate has no value bytes or child accesses. The premises expose compiler queries at this state, rather than assuming a validation-operation outcome.

                                  @[simp]
                                  theorem Miri.Interpreter.ValidityVisitor.resetPadding_no_ranges {P S C E F A Pad : Type} (h : Hooks P S C E F A Pad) (c : C) (session : Session P) (place : RuntimePlace P) (empty : session.dataBytes = none) :

                                  No padding allocation is needed for a local-only validation session.

                                  theorem Miri.Interpreter.ValidityVisitor.resetPadding_memory_zero {P S C E F A Pad : Type} [Memory.PointerProvenance P] (h : Hooks P S C E F A Pad) (c : C) (session : Session P) (place : MPlaceTy P) (state : S) (ranges : session.dataBytes = some Memory.Validity.DataRangeSet.empty) (size : place.layout.layout.size = ABI.Size.ZERO) (dynamic : h.sizeAndAlign c place state = EStateM.Result.ok (some (ABI.Size.ZERO, place.layout.layout.align.abi)) state) (padding : h.beginPadding c place ABI.Size.ZERO state = EStateM.Result.ok none state) :

                                  Unit memory validation has no padding bytes. Its zero-size mutable-access query produces no handle, so reset performs no writes or allocation.

                                  def Miri.Interpreter.ValidityVisitor.validatePlace {P S C E F A Pad : Type} [Memory.PointerProvenance P] [DecidableEq P] (h : Hooks P S C E F A Pad) (c : C) (fuel : Nat) (place : RuntimePlace P) (recursive reset : Bool) :

                                  Runtime validation: root may retag/reset; tracked pointees are checked in LIFO order without reset, without further tracking, and under may_dangle.

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

                                    Const validation exposes the updated worklist to its outer interning loop; CTFE restrictions are distinct from ordinary recursive runtime checks.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      theorem Miri.Interpreter.ValidityVisitor.resetPadding_forced_zero {P S C E F A Pad : Type} [Memory.PointerProvenance P] (h : Hooks P S C E F A Pad) (c : C) (session : Session P) (original : RuntimePlace P) (place : MPlaceTy P) (state : S) (ranges : session.dataBytes = some Memory.Validity.DataRangeSet.empty) (forced : forceAllocation h.projection.place c original state = EStateM.Result.ok place state) (size : place.layout.layout.size = ABI.Size.ZERO) (dynamic : h.sizeAndAlign c place state = EStateM.Result.ok (some (ABI.Size.ZERO, place.layout.layout.align.abi)) state) (padding : h.beginPadding c place ABI.Size.ZERO state = EStateM.Result.ok none state) :

                                      Internal zero-padding composition after the original local place has been proved to denote its existing backing.