Kernel reads, remapped views, freed memory and lost writes of title memory

- What the kernel is writing (file reads) is not guarded by a refresh before
  the call is done (`kernel_writing`): the read would have failed.
- A title thread that uses a page while the runtime remaps another page of
  the same view waits for that in the fault handler; it faulted on a page
  the title never gave up.
- Blocks being unmapped are not guarded again, memory the title frees leaves
  no notes of its blocks (its VirtualFree is taken over), and other memory at
  an address once guarded or absent keeps its protection.
- The second part of a submission's one asking has a number of its own.
- What shaders wrote waits for a change of mapping instead of being lost;
  what could not be written is counted and said; zeros into title memory
  that went are no fault.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-24 23:10:44 -06:00
1 parent 9f22d574bc
commit 8a475da9cf
9 files changed
+803 -32

No files matched your search

+21 -1
View File
@@ -499,6 +499,7 @@ unsafe fn piece_at(
spent(stat::NOTES, opening);
}
let into = beside.unwrap_or(title);
let since = crate::watch::changes();
let (mut pages, mut new_pages, mut blocks, mut dwords, mut missing) = (0, 0u64, 0, 0, 0);
let mut span: Option<(usize, usize)> = None;
for_pages(title, parts, |from, n| {
@@ -508,7 +509,26 @@ unsafe fn piece_at(
}
// SAFETY: the caller's; title memory, by an address that shows it
// (`beside`) or the title's own.
let done = unsafe { crate::safecopy::merge(into.wrapping_add(from) as *mut u8, now.add(from), held.add(from), n, take) };
let merge = |take| unsafe { crate::safecopy::merge(into.wrapping_add(from) as *mut u8, now.add(from), held.add(from), n, take) };
let mut done = merge(take && beside.is_some());
if !done.there && beside.is_none() {
// Away only while the runtime changes a mapping beside it: the
// rest of it when that is done. What is still not there then is
// taken as the caller says.
let mut put = done.dwords;
let again = crate::watch::again_after_change(since, || {
done = merge(false);
put += done.dwords;
done.there
});
if !again && take {
done = merge(true);
put += done.dwords;
}
done.dwords = put;
// (What was new to the first try was new.)
done.new = done.new.max(1);
}
blocks += done.new;
dwords += done.dwords;
missing += u64::from(!done.there);