Data model
Single-page view · as markdown
Data model
Peios Kernel / Internals / LCS / Data model
Use these articles to understand data model in the Peios kernel.
Hives and Routing
Peios Kernel / Internals / LCS / Data model
A hive is a top-level namespace — the first component of every registry path. LCS keeps a routing table mapping hive names to registered sources, and that table is built entirely from what registers. There is no static configuration.
Status is a property of the source slot rather than of the individual hive, which amounts to the same thing: a slot's hives are exactly one source's, and they go Down together.
Route identity #
A hive route is identified by the pair (case-folded name, scope), where the scope is either the global namespace or one private scope GUID.
That pair must be unique across every registered source; a source claiming one another source already holds is rejected.
The same name may appear in different scopes, which is precisely how a private hive shadows a global one without colliding with it.
A hive is backed by exactly one source. A source may back many.
Routing a path #
LCS takes the first component of a path — everything before the first separator — and looks it up.
- Registered and active routes to the backing source.
- Not registered is
ENOENT. - Registered but Down is
EIO.
Before any source registers, the table is empty and every path yields
ENOENT (The Bootstrap Problem).
CurrentUser is not a hive #
CurrentUser\ is a kernel-level alias. When a caller-supplied absolute
path starts with it, LCS reads the user SID from the calling thread's
effective token and rewrites the path to Users\<SID>\... before
routing.
The rewritten path is re-checked against the total-length limit, since a textual SID is longer than the alias it replaced.
Three constraints keep this safe.
It applies only to the first component of a path, and only to a caller-supplied absolute one.
It does not apply to symlink targets: a target beginning with
CurrentUser\ is followed literally, routes as a hive of that name,
and finds nothing. Without that rule, a symlink
containing CurrentUser\ would redirect a privileged service into the
service's own user hive — a confused deputy.
And CurrentUser cannot be registered as a hive name. LCS rejects the
registration with EINVAL, so the alias can never collide with a real
hive.
Symlink targets are subject to ordinary hive routing, private hives included. A sandboxed process resolving a symlink sees the same registry through it that it sees directly, which is the point of sandboxing it.
Two names the kernel knows #
LCS is source-agnostic about routing but not entirely ignorant of
names. Users is compiled in as the target of CurrentUser\
rewriting. Machine is matched, case-insensitively and only for a
global hive, to decide when to run the bootstrap refresh that reads
LCS's own configuration (The Boot Sequence).
Neither is a routing decision — an unregistered Machine routes
nowhere like any other name — but the two names do exist in the kernel.
In practice loregd registers Machine and Users at boot. Other
sources may register other hives at any time.
Names #
Hive names follow the same rules as key name components: no backslash,
no forward slash, no null byte, valid UTF-8, non-empty, and no longer
than MaxPathComponentLength. They are case-preserving and compared
case-insensitively (Names and Case).
Private Hives
Peios Kernel / Internals / LCS / Data model
A private hive is registered with the RSI_HIVE_PRIVATE flag and a
scope GUID.
It is invisible in the global namespace and reachable only by a thread whose token carries that scope GUID.
Routing #
Private hives are checked before global ones.
For each scope GUID on the calling thread's token, in the order the token carries them, LCS looks for a private hive with the path's name and that scope. The first match wins. Only if none matches is the global table consulted.
A private hive can therefore shadow a global one, and no name is exempt — a thread with a private Machine\ sees the private one. That is what
makes complete registry isolation possible for a container or a
sandbox without giving it a differently-named hive to notice.
MaxScopeGUIDsPerToken, default 8, bounds the per-syscall iteration
cost; a token above the cap fails every registry operation with E2BIG
(Private Layers). Duplicate scope GUIDs on a token are rejected.
Scope GUIDs on a token #
Scope GUIDs reach a thread through the KACS token's LCS credential extension: a versioned block in the token specification carrying the thread's scope GUIDs and its private layer names (Private Layers). It parses at a fixed offset, and:
- rejects a nil scope GUID;
- rejects duplicate scope GUIDs;
- caps the count at 256 — a hard KACS limit, above the configurable LCS one.
The credentials propagate across fork, duplication and impersonation like the rest of the token.
Attaching them is gated by SeCreateTokenPrivilege, because scope
GUIDs can only enter a token when the token is created. That is a
blanket privilege rather than a per-scope authorisation: a caller that
can create tokens at all can create one claiming any scope. Isolation
between private hives therefore rests on who may create tokens, not on
who owns a scope.
Scope lifecycle #
A scope GUID is an opaque 128-bit value with no lifecycle. LCS neither creates nor tracks one; it only compares. A scope exists as long as some private hive or some token references it, and when the last reference goes it is simply a number nobody uses.
Nothing in the kernel generates scope GUIDs. Key GUIDs and token GUIDs come from the kernel's UUIDv4 generator; scope GUIDs are supplied by userspace, and choosing them unpredictably is userspace's responsibility.
Registration rules #
Registration enforces more than the route-identity uniqueness of Hives and Routing — the full list is Registration and Slots, and the rules that exist for private hives are these:
- A hive's root GUID may not be nil.
- The root GUIDs within one registration request must be distinct.
- A hive without the
RSI_HIVE_PRIVATEflag may not carry a non-nil scope GUID. - A hive with the flag may not carry a nil one. No token
can carry a nil scope GUID, so such a hive would be registrable and
then permanently unroutable — holding its name against other sources
in that scope while every lookup returned
ENOENT. - Unknown flag bits are rejected.
- Opening
/dev/pkm_registryat all requires an enabledSeTcbPrivilege, checked in the device'sopen()handler (Registration and Slots).
Keys
Peios Kernel / Internals / LCS / Data model
A key is a node in the hierarchy: a container holding subkeys and values. The filesystem analogy is an inode. A key carries identity and properties; naming lives in path entries (Path Entries).
| Field | Mutable | Layered | Description |
|---|---|---|---|
| GUID | No | No | Identity, assigned by LCS at creation, persisted by the source. |
| Name | No | No | The key's own name component. Informational; the path entry resolves the identity. QUERY_KEY_INFO preserves this spelling only when it folds to that resolved leaf, and audits and refuses a mismatch with EIO. |
| Parent GUID | No | No | The parent key. Nil for a hive root. |
| Security Descriptor | Yes | No | Computed from the parent at creation; changed at runtime with WRITE_DAC / WRITE_OWNER. |
| Last write time | Yes | No | Updated when a value is written or deleted or the descriptor changes. |
| Volatile | No | No | The source stores this key in non-persistent storage only. |
| Symlink | No | No | This key is a symbolic link (Symlinks). |
No key property is layer-qualified. Properties belong to the object. Changing a key's structural type through a layer is not a matter of setting a flag; the layer hides the original key and creates a new one at the same path, which is the ordinary overlay pattern.
Identity #
A key's identity is its GUID, not its path. Two keys occupying the same path at different times are different objects with different GUIDs. A path is a name that maps to an identity; the identity outlives the name.
GUIDs are assigned by LCS — never by a source — and pushed to the source at creation, where they become the primary key of its storage.
Once a path has been resolved to a GUID at open time, every subsequent RSI operation uses the GUID directly.
The generator is the kernel's version-4 GUID generator: random bytes
from the kernel CSPRNG with the version and variant bits set in the
PCDS layout — the version nibble in the high nibble of byte 7, because
Data3 is little-endian in bytes 6–7, and the variant bits in byte 8.
Freshness is the collision resistance of UUIDv4 plus a check against the keys LCS currently tracks, with a bounded retry.
There is no persistent retired-GUID catalogue, and no code anywhere that would maintain one. A GUID dropped by orphan cleanup is not remembered.
If a source answers RSI_CREATE_KEY for a freshly generated GUID with
RSI_ALREADY_EXISTS, that is not a race to retry — the kernel believes
the GUID is unused and the source disagrees. LCS treats it as source
inconsistency and fails closed with EIO.
It is never retried as an open and EEXIST never reaches userspace
from reg_create_key.
A GUID appears at exactly one canonical location. LCS validates that and rejects a source that reports otherwise.
Volatile keys #
Volatile is a flag LCS carries and forwards. Storing a volatile key in non-persistent storage is the source's obligation; nothing in the kernel enforces it.
What the kernel does enforce is the containment rule: a non-volatile
key may not be created under a volatile parent (EINVAL).
The converse is allowed — a volatile key under a persistent parent is ordinary.
Naming #
Three bytes are forbidden in a key name component: backslash and forward slash, both of which are separators, and the null byte.
Every other valid UTF-8 sequence is permitted, spaces and arbitrary Unicode included.
Empty components are forbidden, which rules out a leading separator and
consecutive separators (Machine\\System).
A trailing separator (Machine\System\) is likewise
invalid.
Length limits are byte counts: MaxPathComponentLength per component,
MaxTotalPathLength for the whole path, MaxKeyDepth for nesting.
Forward slash normalisation is achieved by treating / as a separator
wherever a separator is recognised, rather than by rewriting the string — so a materialised component never contains either separator, and the
canonical form is per-component rather than a canonicalised string.
Symlinks
Peios Kernel / Internals / LCS / Data model
A symlink key uses two mechanisms, and both are load-bearing.
The symlink flag on the key record marks the key's structural type.
It is set at creation by REG_OPTION_CREATE_LINK and is immutable
afterwards.
RSI_WRITE_KEY can update only the descriptor and the last write time,
so there is no operation that could change it.
The default value, of type REG_LINK, supplies the target
path.
It is an ordinary layered value, which means a higher-precedence layer
can redirect a symlink by writing a different REG_LINK default value,
and removing that layer restores the original target.
The flag marks identity; the value provides the target.
Resolution #
LCS follows symlinks during path resolution and the fd it returns refers to the resolved target — its GUID, its position in the tree, its ancestor chain — not to the link.
The target is resolved by issuing a separate RSI_QUERY_VALUES for the
key's default value (the empty name) and applying ordinary layer
resolution to the result, so the target participates in the layer
system exactly as any other value does.
If the effective default value is missing, or is not of type
REG_LINK, resolution fails with EINVAL.
LCS does not validate the type at write time: a layer that writes a
REG_SZ default value over a symlink's target breaks resolution at the
next open, and removing that layer fixes it.
The offending value stays in the registry; a failed resolution writes nothing.
The target path #
The REG_LINK payload is a length-delimited UTF-8 registry path. No
trailing null is required or permitted — the length delimits it, and a
null byte inside that length is rejected like any
other. Forward
slashes are handled as separators as everywhere else.
The target is validated with exactly the same rules as a syscall path: UTF-8, no null bytes, per-component and total length, no empty components, no trailing separator, maximum depth. The only difference is that a syscall path arrives null-terminated and has its terminator stripped first.
A target is always interpreted as absolute — its first component is routed as a hive name.
Resolution has no check that rejects a relative-looking target as
malformed. A target of Sub\Key is not an error; it is a request for a
hive named Sub, and it yields ENOENT unless such a hive happens to
be registered, in which case it resolves there.
Writing one is different. REG_IOC_SET_VALUE of a REG_LINK value
routes the target's first component at write time, with the writer's
scope GUIDs, and answers EINVAL if it names no registered hive. That
is what stops a dangling target being captured later by whoever
registers a private hive of that name: a target that cannot be written
cannot be captured, and the failure lands on whoever authored it. The
cost is that a symlink cannot forward-reference a hive registered after
it. A target that arrives in source data or a backup stream is not
gated, which is why resolution still has to treat the shape as a hive
request.
CurrentUser\ rewriting is not applied (Hives and Routing), so a target beginning
with CurrentUser\ routes as a hive of that name and cannot be
registered, and therefore always fails. Ordinary hive routing does
apply, private hives included, for the resolving thread.
Depth #
Symlink resolution is bounded by SymlinkDepthLimit, default 16,
configurable from 1 to 64. Exceeding it is ELOOP.
Opening the link itself #
REG_OPEN_LINK on reg_open_key opens the symlink key rather than
following it, which is how a symlink is managed at all — deleted,
retargeted, inspected.
It applies to the final path component only. A symlink encountered part-way along a path is followed whether or not the flag is set.
The access check follows the same rule: with REG_OPEN_LINK the check
is against the link, otherwise against the target.
Creation #
Creating a symlink needs all of:
KEY_CREATE_SUB_KEYon the parent, as for any key;KEY_CREATE_LINKon the parent;- either an enabled
SeTcbPrivilegeor membership of Administrators.
The last is a genuine disjunction — either satisfies it — and the privilege branch marks the privilege used.
Path Entries
Peios Kernel / Internals / LCS / Data model
Key existence and naming are layer-qualified; key identity is not. The source stores a path entry per layer, which separates the two. The overlay-filesystem analogy is exact: directory entries are per-layer, inodes are shared.
On the wire a HIDDEN entry is a target type of 1 with an all-zero GUID (LCS ABI Reference).
A source returning a non-zero GUID on a HIDDEN entry is returning malformed data.
Creating a key #
Creating a key in a layer always assigns a fresh GUID and produces two
records: a path entry (parent, name, layer) → GUID with a new
sequence number, and a key record carrying that GUID.
LCS sends RSI_CREATE_ENTRY first and RSI_CREATE_KEY
second.
That order matters for the race: if another caller got there first, the
entry creation returns RSI_ALREADY_EXISTS and LCS retries the whole
thing as an open, reporting REG_OPENED_EXISTING. Failure on the
second call, for a GUID LCS just minted, is not a race and fails
closed (Keys).
If a different layer already has a key at that path, the new layer gets its own distinct GUID. Each layer has its own key object, and resolution decides which is visible.
No operation creates a path entry pointing at an existing GUID.
reg_create_key always mints a new one. The namespace is a tree, never
a graph.
No GUID sharing across layers #
The path table's shape would technically permit two entries referencing one GUID, which would be a hard link. No API exposes it.
Every key has exactly one canonical parent and name, and LCS validates
that a source is not reporting otherwise: the key record's parent must
be the parent the key was reached through, and its name must fold to the
component the key was reached by. A record that says otherwise is
malformed key metadata — REG_IOC_QUERY_KEY_INFO answers
EIO and the source-data validation failure is audited.
Aliasing has an explicit, visible mechanism, and it is symlinks. Hard links would make parent-GUID semantics, descriptor inheritance, subtree enumeration and watch dispatch all ambiguous at once.
Hiding #
A layer can create a HIDDEN entry at a path, making the key invisible regardless of what lower-precedence layers say.
It is the path-level equivalent of a value tombstone, and when the hiding layer is removed the lower key reappears.
A HIDDEN entry gets a sequence number like any other entry, so a conflict between a GUID entry in one layer and a HIDDEN entry in another at the same precedence resolves deterministically: the higher sequence number wins.
Hide and replace #
A single layer can hide an existing key and put a new one at the same
path, and no special mechanism is needed for it. The layer creates its
own path entry pointing at its own new GUID; lower-precedence entries
for the same (parent, name) are masked because this layer's entry
wins on precedence.
Removing the layer removes both the new key and its masking effect, and the lower key comes back.
This falls out of per-layer path entries and precedence ordering without a line of code that knows about it.
Hive roots #
A hive root has no parent GUID and no child name, so there is no
(parent, name, layer) tuple to remove or mask.
Deleting or hiding a hive root fd is EINVAL, rejected before source
dispatch, before transaction enlistment, before sequence allocation and
before any watch event is generated.
Values
Peios Kernel / Internals / LCS / Data model
A value is a named, typed datum inside a key. Values hold the configuration data; keys hold values.
A key holds many values with distinct names, and at most one unnamed one.
One name, many entries #
A single (key GUID, value name) pair can have several entries in the
source — one per layer that has written to it.
The source stores them all and returns them all.
LCS resolves the effective value at read time (Resolution).
That is the mechanism that makes layer deletion revert configuration automatically. Delete the layer, its entries go, and the next-highest-precedence entry becomes effective. Nothing has to be recomputed or rewritten.
Types #
The full Windows type set is supported, for registry.pol fidelity:
REG_NONE, REG_SZ, REG_EXPAND_SZ, REG_BINARY, REG_DWORD,
REG_DWORD_BIG_ENDIAN, REG_LINK, REG_MULTI_SZ,
REG_RESOURCE_LIST, REG_FULL_RESOURCE_DESCRIPTOR,
REG_RESOURCE_REQUIREMENTS_LIST and REG_QWORD, numbered 0 to 11.
Values are in LCS ABI Reference.
LCS stores the type tag and returns it on read but does not interpret
the data. The single exception is REG_LINK read as a symlink key's
default value, which triggers target resolution (Symlinks).
The three hardware-resource types, 8 to 10, describe device resource
assignments in the Windows HKLM\HARDWARE hive, which the Windows
kernel rebuilds at every boot. Peios has no equivalent: hardware
enumeration belongs to the Linux device model, sysfs and /proc/iomem,
not to the registry. LCS accepts these tags only so a value carrying
one round-trips without loss. They have no semantics, LCS never
produces one, and for every operation they behave as REG_BINARY.
Rejecting a faithfully-copied value would break the fidelity guarantee
that is the reason the registry exists.
Type tags are validated at every write boundary, before sequence
allocation, transaction enlistment or source dispatch. An unknown code
is EINVAL.
REG_TOMBSTONE #
One further type, REG_TOMBSTONE (0xFFFF), is internal. It is never
returned to a caller reading a value — a caller whose effective entry
is a tombstone gets ENOENT, which is exactly what a tombstone
means.
There is no separate tombstone flag in the REG_IOC_SET_VALUE
argument. Writing type REG_TOMBSTONE is the explicit tombstone
operation.
It must carry zero-length data; non-empty tombstone data is EINVAL,
again before sequence allocation, enlistment or dispatch.
Naming #
Value names use the same case rules as key names: Unicode Simple Case Folding, case-preserving, case-insensitive.
They differ in one respect. Backslash and forward slash are permitted in a value name. Value names are not hierarchical, so a separator has no meaning in one.
Only the null byte is forbidden, and invalid UTF-8 is rejected. The empty string is reserved for the default value.
That difference is why watch event path components are length-prefixed rather than joined by a separator (Event Records) — a value name can contain the separator.
Size #
MaxValueSize defaults to 1 MB and is configurable from 4 KB to 64 MB
(Operational Parameters).
Value data is opaque bytes and is not subject to the UTF-8 validation that applies to every string in the interface.
Tool value encodings #
reg, Registry Editor and the peios Rust crate use these representations:
REG_SZandREG_EXPAND_SZ: UTF-8 ending in one null byte, rather than Windows' UTF-16 representation.REG_LINK: the absolute target path in UTF-8, with no null byte. Its length determines its end; a target containing a null is not followed.REG_MULTI_SZ: each string followed by a null byte, with one additional null byte ending the list.- Integers: little-endian, except for
REG_DWORD_BIG_ENDIAN.
These are data conventions shared by tools. LCS still treats ordinary
value payloads as opaque bytes; its special handling of a link key's
REG_LINK default value is described in Symlinks. For choosing and entering
a type as an operator, see
Keys, values, and types.
Tombstones
Peios Kernel / Internals / LCS / Data model
An overlay that can only add is not enough. registry.pol expresses
absence — **Del.ValueName deletes a specific value,
**DelVals deletes every value in a key before applying new ones — and
a higher-precedence layer that can only override cannot say "this value
must not be configured". Tombstones are how absence is expressed.
Both kinds are per-layer, and both vanish with their layer, restoring whatever they were masking.
Value tombstones #
A value tombstone is a layer entry that says the value does not exist in this layer and lower-precedence layers are masked.
Resolution treats a winning tombstone as "not found" without falling through.
In the source's storage it is an entry of type REG_TOMBSTONE with no
data. A caller who wins with one gets ENOENT.
Removing the tombstone's layer makes the lower-precedence value effective again, which is the whole point.
Blanket tombstones #
A blanket tombstone is a per-layer marker on a key that masks every value from lower-precedence layers, whatever its name.
Where a value tombstone names one value, a blanket names none and
covers all — including values whose names were not known when the
blanket was written, which is exactly what **DelVals
requires.
It is stored as a flag on the (key GUID, layer) relationship and
occupies no per-name entry. It has its own sequence
number.
How it competes #
A blanket does not short-circuit resolution. It enters the candidate
pool as a tombstone candidate for every value name, at its own
(precedence, sequence), and the ordinary rule picks the winner
(Resolution).
So a per-value entry that beats the blanket on the tuple overrides it, and one that loses is masked.
A layer can write a blanket and write specific values in the same
layer: the specific values are visible because they were written
afterwards and carry higher sequence numbers, and everything else from
below is masked. That is **DelVals followed by new writes,
expressed without a special case.
An exact tie — same precedence and same sequence — between a blanket
and a per-value entry is not resolved in the blanket's favour or
anyone's. It is malformed source data and the operation fails with
EIO (Resolution).
Enumeration #
Enumerating a key with a blanket applies the same per-name rule to each name, so what a caller sees is the set of names whose winning candidate is not the blanket.
It is not simply "the blanket's layer and above": a different layer at the same precedence with a higher sequence number surfaces, and one with a lower sequence number does not.
Removal #
Removing a blanket, or the layer holding it, unmasks everything it was hiding.
What a watcher sees #
Nothing about tombstones. Writing a blanket produces one
VALUE_DELETED per name it newly masks; removing one produces one
VALUE_SET per name that became visible. A watcher sees per-value
effective state and never has to know the mechanism (The Watch Model).
Names and Case
Peios Kernel / Internals / LCS / Data model
Every string in the LCS interface — key names, value names, hive names,
layer names, paths — is UTF-8. Invalid UTF-8 is rejected with EINVAL
before parsing, routing, folding, layer resolution or source
dispatch.
Null bytes are rejected in all of them.
The rejection is EINVAL where the string is length-delimited — ioctl
and RSI strings — because there the null byte sits inside the counted
length. A syscall argument (a path or reg_create_key's layer name) is
a C string, and a null byte there is its terminator: the name the
kernel validates ends at it, and nothing after it is read.
The one thing that is not a string is value data, which is opaque bytes.
Lengths are byte counts #
Every configured length limit is measured in UTF-8 bytes, not Unicode scalar values and not display characters.
MaxPathComponentLength(default 255) bounds one component or one value or layer name.MaxTotalPathLength(default 16383) bounds a whole path.MaxKeyDepth(default 512) bounds nesting.
A syscall path arrives as a null-terminated C string, is copied under a hard bound, and has its terminator stripped before anything is measured — so the terminator is not part of the length.
Ioctl and RSI strings are length-delimited and need no terminator; a terminator byte included in the length is a null byte and is therefore invalid.
Separators #
Backslash is canonical. Forward slash is accepted on input and treated as a separator wherever a separator is recognised, so a component can never contain either.
There is no string-rewriting step: normalisation is a property of how paths are split rather than a transformation applied to them.
Case folding #
Comparison is case-insensitive and storage is case-preserving.
The algorithm is Unicode Simple Case Folding — the C and S
status entries of CaseFolding.txt, with the full (F) and Turkic
(T) entries excluded.
It is a fixed one-to-one codepoint mapping with no locale input, applied after decoding from UTF-8, never to raw bytes.
The Unicode version is pinned at 16.0. The table is generated by
peios/generate-casefold-table.py and checked in with the
digest of the source data, so adopting a newer Unicode version means
regenerating the table deliberately. It is not something that happens
by updating a dependency.
This gives practical compatibility with Windows'
RtlCompareUnicodeString without claiming byte-identical behaviour in
every edge case.
Unicode normalisation is not performed. NFC and NFD forms of the same visual character are different names, matching Windows.
Case folding is what "identity" means throughout: a layer's identity is
its folded name, a hive route's identity includes its folded name, and
a duplicate is a folded-equal duplicate. RoleA and rolea are one
layer, not two.
Every comparison folds, on both sides of the kernel boundary. The
Kernel Access Control Subsystem (KACS) parses private layer names into
a token and rejects a duplicate with EINVAL; that duplicate check
uses the same folding routine and the same table as LCS, so a pair
that LCS treats as one layer cannot occupy two of a token's slots.
There were two ASCII-only comparators, the base check on two of its
call sites and this KACS check, and both are gone (The Base Layer for
base).
Deletion and Orphans
Peios Kernel / Internals / LCS / Data model
Deletion operates on two levels, because naming and identity are separate things.
Deleting a key #
REG_IOC_DELETE_KEY removes one layer's path entry. The key's data — its GUID, descriptor and values — is untouched; only a name is
removed.
LCS derives the parent GUID from the fd's ancestor chain and the child
name from the last component of its resolved path, and sends
RSI_DELETE_ENTRY.
If path entries remain in other layers, the key is still visible through them.
If none remain anywhere, the key is orphaned.
A key with visible children cannot be deleted:
ENOTEMPTY.
Visibility is evaluated globally, across all enabled layers, and deliberately ignores the caller's private layer set — so whether a deletion succeeds does not depend on who is asking.
Recursive deletion is a client-side tree walk, not a kernel primitive.
Deleting a key does not delete its values. Values belong to the GUID, not to the path entry, and go when the GUID goes.
Hive roots cannot be deleted or hidden (Path Entries).
Layer deletion #
Deleting a layer removes all of its path entries, value entries and blanket tombstones, across every source.
LCS broadcasts RSI_DELETE_LAYER and each source returns the GUIDs
that lost their last path entry as a
result.
Effects on live state follow from the model with no special cases:
- keys named only by that layer become orphaned;
- where the layer held the winning value entry, the next layer's value becomes effective;
- blanket tombstones it held are removed and unmask what they were hiding;
- and Security Descriptors are unchanged, because they were never layered.
Watchers are notified by whatever recovery mechanism applies —
per-key events for the orphaned keys, and a source-wide OVERFLOW for
the rest (Dispatch).
Before sending RSI_DELETE_LAYER, LCS aborts every bound transaction
whose mutation log touched that layer. Otherwise a transaction could
commit writes into a layer that no longer exists.
Those transactions return EINVAL on their next operation or commit
attempt.
Layer deletion is what role uninstallation and Group Policy removal are.
Orphaned keys #
An orphaned key is a GUID with no path entry in any layer. It follows the Linux unlink model: alive but unnamed.
Existing fds keep working. Operations that address the key by GUID proceed normally:
- querying, setting and deleting values;
- setting and removing blanket tombstones;
- querying and setting the Security Descriptor;
- querying key metadata;
- flushing the key's hive;
- closing the fd.
Namespace operations return ENOENT:
- creating a child key under it;
- opening or creating anything relative to it;
- deleting its path entry;
- hiding it;
- backing it up.
The reason is that an orphaned key is no longer a reachable subtree root. Allowing new names beneath an unnamed key would build a subgraph nothing can reach.
Watches on an orphaned key #
A watch armed before the key was orphaned stays armed, and the
transition delivers KEY_DELETED.
After that the watch may still observe GUID-local changes made through the surviving fds, though the subtree is no longer expanded through the orphaned key.
Arming a new watch on an already-orphaned key is
ENOENT.
Re-arming one that is already armed is allowed.
Dropping the GUID #
When the last fd to an orphaned key closes and the source is Active,
LCS sends RSI_DROP_KEY, which purges the key record, every value
entry across every layer, and any remaining blanket
tombstones.
It is dispatched before the in-kernel key state is released.
The request is asynchronous: nothing waits for the answer, and a valid
response is processed as an ordinary response rather than as a late
one (Failure and Late Responses). That distinction is load-bearing — RSI_DROP_KEY is a
mutating operation, and without it the arrival of a perfectly normal
answer to a caller-less request would look like an unaccounted
mutation and tear the source down.
If the source is Down, LCS releases its in-kernel state and does not queue a deferred drop. There is no deferred-drop queue. Recovering the key record then falls to the source's own startup obligation, under the Registry Source Interface specification in PSPK, to purge records with no path entries before it becomes Active.
close() never reports orphan cleanup failure to userspace, and never
can: it returns 0 unconditionally.
A new key at the same path #
A layer can create a new key where another layer's key already exists. Each layer has its own path entry pointing at its own GUID, and resolution decides which is visible.
Fds referencing the other GUID are completely isolated from it: different identity, different data, different value entries. Nothing observable connects two keys that merely share a name.