One path

Every path ral judges is the path of an object its own walk opened, and every operation on it is relative to the handle that walk holds. A name is never authority: it is a way to find an object, resolved once, by path/walk.rs, through directory handles and never by the kernel’s following. What the grant judges is the transcript of that walk; what is then read or written is the object it acquired. How a judgment runs is path-judgment. Amends access-is-physical (the walk is now the only resolver, and policy is resolved by it) and authority-is-belnap-evidence (a table is two sets; evidence is computed).

Context

Several resolvers looked a name up at several moments, and every gap between two lookups let the name change meaning: a lenient canonicaliser and a walk, a judgment of a string and an open of the original, an enumeration by ignore that listed, statted and followed by name. The grant’s own exclusions were re-resolved at every check, so the same trick worked on the rules. Policy held its authored form beside its resolution, and the two could disagree.

Decision

  • The walk is the one resolver, and the step is its unit. One primitive per host opens a child of a held handle and reports that child’s stored name and identity, both read through the handle just opened. A Trace (the root’s identity, the steps, the missing tail) is the evidence; its RealPath, its identities and its leaf are projections of the steps, so the three hosts share one construction.
  • Four roles, four types. A Trace is evidence; a Hold is an anchor (a trace plus a handle, on the wire the trace alone, re-held on arrival); Dir and Located are possession; a Listed is what a listing saw. The handle’s type says who vouched (Unjudged, Reading, Writing, Installing), each minted at one door, so walk(p)?.read() does not compile.
  • Two readings, one per polarity. An allowance holds by position (RealPath::contains), which is transitive and survives a directory removed and recreated. An exclusion holds by position under collision_key or by identity (Excluded::matches): the object, wherever it is reached and whatever it is called, and its name under a renamed ancestor. Identity’s only effect is negative, so a reused id over-denies and never admits. A transcript’s identity is read once, and holding the handle does not keep it the object’s alone: macOS revokes an event-only descriptor at an unmount, after which a remount may reuse the id, and a FAT id is a directory slot that a rename vacates for the next file. So no admission rests on two transcripts’ identities being equal: git discovery checks a back-pointer by the positions two walks reached.
  • An exclusion reaches the object it was fixed to, not what is moved out of it. A file renamed or hard-linked out of a denied folder by a process that may write that folder is a new name, judged on its own. A planted link is not the denied object, and what it reaches is judged on its own.
  • A layer is resolved where it is decoded and is its rules and nothing beside them. Each spelling is walked once; an exclusion holds the object and, where it was a link, its target, both through the handles of that walk; a bare exec name is resolved on the decoding PATH. Nothing is resolved again. A stack crosses a process boundary as traces and the receiver re-holds by walking; a received stack is never refused.
  • Use goes through the handle. A Located opens, stats, stages and publishes relative to its directory handle; a leaf absent at the walk is created exclusively; ral enumerates trees itself. A program is judged as a Located and started by its real name. A child walk from a held directory — a link followed by the tree walk, an ignore file located beneath it — splices .. through the directories the walk opened above that directory, never through the names a caller descended by.
  • The OS sandbox side consumes RealPath and Hold. Linux and macOS render exclusions at recorded and verified current positions at launch; Landlock and Windows carving also judge enumerated entries by identity. Carving stamps through the handles it examined. The remaining limits are stated in two-enforcers.

Rejected

  • Identity on both polarities (the meet). The Table meet needs positive containment to be transitive, and “same object or same name” is not; a directory recreated under a grant would stop working, as the kernel enforcer also sees it.
  • Live exclusions. Re-resolving at every check is two instants and a race between them.
  • Resolution-time handles for allowances. They are positional, and the kernel sees the recreated directory.
  • Ancestor protection in the guard. It is the kernel’s, through pinned_dirs.
  • Exec through a descriptor. An interpreter needs a name for $0, and Landlock rules only allow and cannot require the judged object.
  • Windows handles on exclusions. They lock the tree.
  • Refusing a received stack. Every atomic save of a denied file would refuse the next spawn.
  • A summary record instead of a transcript. A path string and an aligned vector of identities are two observations stitched together, and the stitching comes apart under a move.
  • One type for evidence and anchor. A judgment would accept an address where it needs evidence, and a consumer wanting evidence would keep possession for a pipeline.
  • A wire hierarchy beside the runtime types. The unheld state is sound, so a type parameter proving a stack was re-held guards no safety property; a Hold serialises as its trace and GrantStack::rehold at the two receive sites is the protocol.
  • Refusing exclusions on volumes that reuse ids. It bricks a default profile on a host with a redirected home; over-denying is the cost, as for FUSE and NFS.

Where

  • core/src/path/handle.rs and its host modules: Trace, RealPath, Hold, Excluded, Dir, Located, walk, walk_excluded.
  • core/src/path/identity.rs — the two readings.
  • core/src/authority/policy/{lattice,fs,exec}.rs — GrantLayer, GrantPath, Extent, GrantStack::{judge, rehold}.
  • core/src/path/tree.rs — domain enumeration (Walk), with core/src/shell/runtime/walk.rs the live-shell adapter (AdmittedWalk, Shell::admitted_walk).

Verification

The macOS and Windows code of this commit — the macos and windows host modules of path/walk.rs (step 1) and their tests — was cross-compiled only, on a Linux host: just check, at full workspace scope. Neither has run on its host. The host-assertion tests that have not, by name:

  • macOS (path/walk/tests/macos.rs): a_case_variant_is_recorded_at_the_spelling_the_directory_stores, the_stored_name_rule_takes_a_spelling_and_lists_for_another_links_name, a_hard_link_is_recorded_under_the_name_it_was_opened_by (the APFS hard-link experiment the plan’s §9 item 39 assigns to this step, and the one that asserts the packing of getattrlistat answers), a_link_is_read_through_its_o_symlink_descriptor, a_file_the_user_cannot_read_is_stated_and_never_opened, a_walk_through_a_firmlink_records_the_identity_openat_reached, a_leaf_link_is_held_under_every_mode, a_dangling_link_under_follow_is_a_create_target_with_no_real_path, a_case_sensitive_volume_keeps_two_links_apart, an_ambiguous_fold_refuses, a_special_file_is_stated_and_never_held, a_stream_to_a_fifo_is_opened_by_name_and_must_find_a_fifo, a_stream_to_a_fifo_swapped_for_another_is_refused, an_object_replaced_between_lookup_and_open_is_refused, pick_takes_the_byte_equal_name_then_the_unique_fold, parse_lookup_reads_by_the_returned_set; in identity.rs, relative_to_reads_a_firmlink_twin; in path/tree/walk/tests.rs, a_root_the_walk_cannot_enter_is_unentered_with_the_walks_error; in core/tests/gitdir_sigil.rs, gitdir_takes_a_claim_whose_tree_the_walk_only_states; in sandbox/carriers.rs, a_launched_programs_interpreter_is_read_through_the_judged_handle (the None arm); in core/tests/surface_io_effect.rs, a_write_to_a_file_the_walk_cannot_hold_is_refused_and_leaves_it; in synod’s manifest.rs, a_root_that_cannot_be_entered_fails_the_manifest; and the Unix set of path/walk/tests/unix.rs that is not gated to Linux, a_search_only_ancestor_is_walked among it, which has not run on macOS against the new engine.
  • Windows (path/walk/tests/windows.rs): an_identity_is_the_file_id_of_the_handle, file_normalized_name_info_answers_the_stored_case, a_held_prefix_refuses_a_rename_while_it_lives (the no-delete-share premise), a_listing_uses_the_handles_64_bit_identity_on_a_volume_without_128_bit_ids (gated on RAL_TEST_FAT_VOLUME, the path of a directory on a FAT VHD, and skipped with its reason where unset), a_stat_carries_the_length, a_reparse_buffer_decodes_to_the_target_it_names, a_reparse_point_that_names_no_path_is_no_link, a_component_renamed_is_adopted_and_one_moved_is_refused, publish_through_file_rename_information_ex_lands_the_file (the plan’s §9 item 3 pin: the held RootDirectory), and the three converted tests, existing_and_absent_leaves_use_the_parents_stored_case, a_walk_starts_only_from_a_parsed_root and a_file_reached_by_its_short_alias_locates_at_its_long_name; and, in walk/tests/windows.rs, a_directory_step_holds_by_traverse_and_a_leaf_step_by_nothing, an_ancestor_the_user_may_traverse_but_not_list_is_walked, a_file_in_a_directorys_place_is_not_a_directory_whatever_its_rights, create_dir_makes_the_entry_under_the_held_directory, a_dropped_or_failed_staged_write_leaves_no_sibling, an_unsupported_class_is_the_two_codes_and_no_other; in identity.rs, relative_to_compares_roots_under_the_stored_identity; in sandbox.rs, an_installing_directory_is_held_without_delete_sharing; in dacl/frozen/tests.rs, a_share_is_refused; in capability/fs.rs, the_meet_folds_a_windows_spelling_of_a_present_directory_and_keeps_an_absent_name_s_case; and in guard/freeze.rs, the Windows arm of the_root_spelling_is_everywhere_on_every_host.

Step 3 (the layer, part a) adds no host-assertion test of its own: its macOS and Windows changes — the Seatbelt and AppContainer renderers reading the resolved exec and fs rules, FreezeCtx’s home walk, the floor’s walk of SystemRoot and ProgramFiles — were cross-compiled only, and the layer tests it ports run on those hosts under the same first green run.

Step 4 (who vouched, part a) is likewise cross-compiled only where it is not Linux: on Windows, windows/session.rs::listing, the carving lister, now holds each directory by RealPath::open_dir_nofollow as Installing and lists it through Dir::read_dir, and the host’s reopen_shared and is_local (GetFinalPathNameByHandleW and GetDriveTypeW) behind the Installing doors reopen and is_local are written and unused until the sandbox’s step; on macOS, the pin of ral’s own binary (reexec.rs) is by ObjectId, which From<&std::fs::Metadata> makes of the by-name stat verify compares. dacl/frozen.rs and dacl/deny.rs open by name as before. Their tests run on those hosts under the same first green run.

Step 7 (the sandbox, mechanically), on Windows, is cross-compiled only. carve runs over a lister that opens each directory it lists as Dir<Installing> (windows/session.rs::listing); FrozenPin::open holds its position by open_nofollow, refuses a share by Located::is_local and derives its stamping handle by reopen; ensure_unreachable holds each exclusion, a file or a directory, and reads every descriptor through reopen(READ_CONTROL); the by-name opens, ensure_local_canonical_prefix and dacl/acl.rs’s named route are gone. Windows runtime CI subsequently rejected the FileRenameInfoEx premise with a non-null RootDirectory (plan §9 item 3): the Win32 setter does not preserve the relative destination. The implementation now calls native NtSetInformationFile(FileRenameInformationEx), whose RootDirectory contract accepts the held target directory and a simple relative filename. The publication regression and its moved-directory/source variant pin that form. Directory derivation likewise uses empty-name NtCreateFile, not ReOpenFile, which forces a non-directory open. The step-7 host assertions originally awaiting runtime verification were: an_exact_file_exclusion_is_verified_and_reported and a_junction_and_a_symlink_beneath_an_exclusion_are_not_followed (dacl/tests.rs), a_share_is_refused and the junction cases (dacl/frozen/tests.rs), and carving_meets_a_junction_and_a_symlink_as_links (windows/session/tests.rs).

Step 7 (the sandbox, mechanically), on macOS, is cross-compiled only. The pin of ral’s own binary keeps the Trace of the walk that found it (Pinned::open), and reexec::OWN is the one hold on it: ral_binary(), the launch’s Windows image and verify read it, and verify walks the pinned name again and compares the leaf’s ObjectId with the pin’s, where it re-statted by name before. The Seatbelt profile’s pins are RealPath::ancestors_within of the positions each exclusion holds, rendered with their firmlink twins, and an exclusion renders from those positions, its name’s and its link’s target’s, never from the text as written; shims compares program.parent() by RealPath::parent. No macOS host assertion is new: mac_profile_lets_a_lookup_stat_the_surface_of_a_frozen_allowance and the profile tests that build exclusions (now GrantPath<Excluded>, so walked) are the existing ones, unrun on a Mac.

Step 10 (macOS): an_exclusion_holds_its_leaf_by_the_walks_own_o_evtonly_descriptor and an_unmounted_volume_leaves_an_exclusion_unheld_by_position (path/walk/tests/macos.rs, the latter attaching and force-detaching an APFS image with hdiutil) were cross-compiled only; neither has run on a Mac.

Two names of the deleted list remain at lexical boundaries:

  • RealPath::rendered (Linux only): the bwrap renderer walks a Rendered envelope name back to a position.
  • FrozenPath::{lexical, freeze}: a grant’s written spelling enters the walk, and a path held natively is frozen as a grant.

The first green macOS and Windows legs of ci.yml on the landing commit discharges them; it is recorded here when it comes.