danos/system/kernel
Daniel Samson 8d4a7cf240
kernel: user memory is reached only through a checked copy
A new user-memory module owns every kernel touch of a user buffer:
copyFromUser, the new copyToUser, and the resolve behind both. The walk
accumulates the U/S and writable bits down all four levels with the MMU's
own AND rule — folding a 2 MiB leaf in before it resolves and refusing a
1 GiB leaf outright — so a copy honours what ring 3 itself would be
allowed, closing the presence-only trust model the IPC layer carried since
bring-up. It then confirms the frame is physmap-backed, because that is how
the copy reaches it: an mmio_map'd BAR passes the permission walk and would
otherwise fault ring 0 on an alias the physmap never mapped, on the IPC path
as much as the new one.

The nine stragglers that dereferenced user pointers raw now route through
it, so a bad pointer returns -EFAULT where it used to fault the kernel.
The write direction restructures its callees around kernel bounce buffers:
scheduler and devices-broker enumerate from a slot cursor (a task exiting
between chunks can neither duplicate nor lose an entry), klog_read drains
the ring in chunks, and fs_node stages headers and names contiguously.
fs_resolve copies out before installing the endpoint handle, so a faulting
copy cannot strand a capability; its out-capacity bound no longer adds an
unbounded ring-3 length to the base, which wrapped and trapped the kernel's
own overflow check. debug_write reads the caller's message once.

Suite 107/107 (new user-memory case: seven bad pointers refused, each
paired with a sound call that must still succeed).
2026-07-31 20:57:49 +01:00
..
architecture/x86_64 kernel: user memory is reached only through a checked copy 2026-07-31 20:57:49 +01:00
acpi.zig kernel: the IOMMU backends move behind the architecture boundary 2026-07-30 07:16:08 +01:00
console.zig console: page-wrap instead of scrolling — never read the framebuffer 2026-07-21 19:22:59 +01:00
device-model.zig kernel: flatten the device/discovery code, merge power into acpi, rename fdt 2026-07-22 21:49:20 +01:00
devices-broker.zig kernel: user memory is reached only through a checked copy 2026-07-31 20:57:49 +01:00
fdt.zig kernel: flatten the device/discovery code, merge power into acpi, rename fdt 2026-07-22 21:49:20 +01:00
font.psf Re-organize the source tree as a monorepo mirroring the FHS 2026-07-10 12:55:56 +01:00
heap.zig docs: audit all 'what's next' sections against the code; fix stale comments 2026-07-22 02:23:51 +01:00
iommu.zig kernel: the IOMMU backends move behind the architecture boundary 2026-07-30 07:16:08 +01:00
ipc-synchronous.zig kernel: user memory is reached only through a checked copy 2026-07-31 20:57:49 +01:00
ipc.zig Re-organize the source tree as a monorepo mirroring the FHS 2026-07-10 12:55:56 +01:00
irq.zig M15: interrupts for PCI devices (ECAM config space + MSI) 2026-07-10 19:59:09 +01:00
kernel.zig iommu: enable Intel VT-d translation with per-claim device confinement 2026-07-26 18:31:27 +01:00
log-ring.zig build: the unix paths retire — configuration, logs, and volumes move into the danos tree 2026-07-31 19:41:35 +01:00
log.zig kernel: the boot transcript on screen, every line timestamped 2026-07-21 19:09:34 +01:00
platform.zig kernel: flatten the device/discovery code, merge power into acpi, rename fdt 2026-07-22 21:49:20 +01:00
pmm.zig M14b: DMA memory (dma_alloc / dma_free) 2026-07-10 19:43:59 +01:00
process.zig kernel: user memory is reached only through a checked copy 2026-07-31 20:57:49 +01:00
scheduler.zig kernel: user memory is reached only through a checked copy 2026-07-31 20:57:49 +01:00
sync.zig kernel: contain a fatal fault — name the task, release the BKL before halt 2026-07-14 09:05:10 +01:00
tests.zig kernel: user memory is reached only through a checked copy 2026-07-31 20:57:49 +01:00
user-memory.zig kernel: user memory is reached only through a checked copy 2026-07-31 20:57:49 +01:00
vfs.zig kernel: user memory is reached only through a checked copy 2026-07-31 20:57:49 +01:00
wall-clock.zig kernel: tagged log ring — per-line pid/name/level records, klog_status 2026-07-21 15:30:28 +01:00