[BUG] Retained table inspection exposes mutable hardware-visible word references #42

Open
opened 2026-09-24 15:31:19 +02:00 by erikinkinen · 0 comments
Owner

Summary

Owned table storage exposed an ordinary mutable array even after publication into hardware page tables. Retained-table inspection obtained that reference merely to derive the allocation address. This is a source-level storage-boundary finding: no original runtime failure, observed undefined-behavior outcome or exploit is asserted. The corrected representation is published after strict and native validation.

Reproduction

At Kernel 650cd1d62ae2847cf5a6d092bd276048a8f8b25c, trace TableStorage::entries through HeapTable and table_page::verify_retained_tables. The latter obtains the array after table publication to derive its virtual address before guarded translation. The huge-page witness likewise observes published words through ordinary references and volatile reads. Exact original source identities are retained; this review does not deliberately create conflicting references or demonstrate a runtime failure.

Expected and actual behavior

Table cleanup ownership must remain unique while hardware-visible words accommodate the processor's accessed/dirty updates. Software locking alone does not exclude those updates, and volatile access does not relax ordinary reference rules inside a Rust allocation. The original interface returned &mut [u64; 512] from one aligned owned page.

The correction removes that interface and retains scalar reads, explicit writes and descriptive allocation geometry over aligned atomic words. Acquire loads and release stores preserve entry access without returning ordinary word references. Copying, rollback, huge splitting and all native consumers use the same contract. Exactly one allocation owner remains; geometry grants no mapping, activation or cleanup authority. Existing table, interrupt, backing, root-identity and invalidation requirements remain mandatory. No resource ceiling or unsafe Send/Sync implementation is added.

Environment and identity

Original Kernel 650cd1d62ae2847cf5a6d092bd276048a8f8b25c; corrected executable Kernel b63921064e299e28525f0077511fbaee165b814e, Integration f2154e6f550330a400cb31ed2ac75a982e2cc572, unchanged Bootloader ec00005c324ae05dc6f2faf57c496185d297726b. Rust 1.97.1 and native x86-64 four-level paging under QEMU/OVMF. Private roots are still never activated; readiness, residency and remote invalidation remain separate work.

Evidence and prior checks

The contract follows official Rust interior-mutability rules, atomic word representation and Intel SDM 253668-092US section 11.1.2.1 on locked hardware accessed/dirty updates. Only longstanding load/store APIs are used; this does not claim a general language-model proof for arbitrary device memory.

Four strict Kernel configurations pass 915/939 tests with three existing ignored cases, including actual concurrent hardware-style observation and effective ancestor-policy controls. Eighteen native build/binary Clippy profiles, formatting and host/native/long-mode private rustdoc pass without warnings. Exact-module optimized x86-64 accessors use aligned MOV without locked exchange or fences; this is a code-generation check, not a timing benchmark.

Ten exact-source native executions satisfy eleven maintained contracts, including actual accessed bits in every one of the 512 split leaves, complete restoration before owner disposal, lifetime/invocation, both allocators, ordinary exec-successor and four SMP profiles. All original grants, markers and deadlines remain required. Source signatures and normally stripped packaged artifacts verify without image warnings or QEMU stderr. Integration helpers and both Rust crates retain identical fully validated inputs. The complete manual passes 45 tests and 2,445 pages, with all 455,574 word bounds and changed pages reviewed without final warnings or overflow.

Tracking

Validated changes: Kernel, Integration and manual. Owning Kernel PR 3, Integration PR 12, owned address spaces and Phase 6 completion retain the broader obligations. Keep this report open for publication CI review. No private-root activation, complete authority closure, performance improvement or full guest build is claimed.

## Summary Owned table storage exposed an ordinary mutable array even after publication into hardware page tables. Retained-table inspection obtained that reference merely to derive the allocation address. This is a source-level storage-boundary finding: no original runtime failure, observed undefined-behavior outcome or exploit is asserted. The corrected representation is published after strict and native validation. ## Reproduction At [Kernel 650cd1d62ae2847cf5a6d092bd276048a8f8b25c](https://git.erikinkinen.fi/erix/kernel/commit/650cd1d62ae2847cf5a6d092bd276048a8f8b25c), trace `TableStorage::entries` through `HeapTable` and `table_page::verify_retained_tables`. The latter obtains the array after table publication to derive its virtual address before guarded translation. The huge-page witness likewise observes published words through ordinary references and volatile reads. Exact original source identities are retained; this review does not deliberately create conflicting references or demonstrate a runtime failure. ## Expected and actual behavior Table cleanup ownership must remain unique while hardware-visible words accommodate the processor's accessed/dirty updates. Software locking alone does not exclude those updates, and volatile access does not relax ordinary reference rules inside a Rust allocation. The original interface returned `&mut [u64; 512]` from one aligned owned page. The correction removes that interface and retains scalar reads, explicit writes and descriptive allocation geometry over aligned atomic words. Acquire loads and release stores preserve entry access without returning ordinary word references. Copying, rollback, huge splitting and all native consumers use the same contract. Exactly one allocation owner remains; geometry grants no mapping, activation or cleanup authority. Existing table, interrupt, backing, root-identity and invalidation requirements remain mandatory. No resource ceiling or unsafe Send/Sync implementation is added. ## Environment and identity Original Kernel `650cd1d62ae2847cf5a6d092bd276048a8f8b25c`; corrected executable Kernel `b63921064e299e28525f0077511fbaee165b814e`, Integration `f2154e6f550330a400cb31ed2ac75a982e2cc572`, unchanged Bootloader `ec00005c324ae05dc6f2faf57c496185d297726b`. Rust 1.97.1 and native x86-64 four-level paging under QEMU/OVMF. Private roots are still never activated; readiness, residency and remote invalidation remain separate work. ## Evidence and prior checks The contract follows official [Rust interior-mutability rules](https://doc.rust-lang.org/core/cell/struct.UnsafeCell.html), [atomic word representation](https://doc.rust-lang.org/core/sync/atomic/type.AtomicU64.html) and Intel SDM 253668-092US section 11.1.2.1 on locked hardware accessed/dirty updates. Only longstanding load/store APIs are used; this does not claim a general language-model proof for arbitrary device memory. Four strict Kernel configurations pass 915/939 tests with three existing ignored cases, including actual concurrent hardware-style observation and effective ancestor-policy controls. Eighteen native build/binary Clippy profiles, formatting and host/native/long-mode private rustdoc pass without warnings. Exact-module optimized x86-64 accessors use aligned MOV without locked exchange or fences; this is a code-generation check, not a timing benchmark. Ten exact-source native executions satisfy eleven maintained contracts, including actual accessed bits in every one of the 512 split leaves, complete restoration before owner disposal, lifetime/invocation, both allocators, ordinary exec-successor and four SMP profiles. All original grants, markers and deadlines remain required. Source signatures and normally stripped packaged artifacts verify without image warnings or QEMU stderr. Integration helpers and both Rust crates retain identical fully validated inputs. The complete manual passes 45 tests and 2,445 pages, with all 455,574 word bounds and changed pages reviewed without final warnings or overflow. ## Tracking Validated changes: [Kernel](https://git.erikinkinen.fi/erix/kernel/commit/1bde8e13de214fb45f029e2d23b39e83f23033b2), [Integration](https://git.erikinkinen.fi/erix/integration/commit/46ae17e84abdc1e72e89fd7c50c766c54f3bcc03) and [manual](https://git.erikinkinen.fi/erix/docs/commit/693fa073cb21f8e4abcd291409f4449ab29c56a5). Owning [Kernel PR 3](https://git.erikinkinen.fi/erix/kernel/pulls/3), [Integration PR 12](https://git.erikinkinen.fi/erix/integration/pulls/12), [owned address spaces](https://git.erikinkinen.fi/erix/kernel/issues/22) and [Phase 6 completion](https://git.erikinkinen.fi/erix/integration/issues/65) retain the broader obligations. Keep this report open for publication CI review. No private-root activation, complete authority closure, performance improvement or full guest build is claimed.
erikinkinen added this to the Alpha 1 milestone 2026-10-30 09:34:29 +01:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
erix/kernel#42
No description provided.