Phase 8 v3: refuse a same-VM, cross-device raw block copy from within StarshipOS
Two research passes confirmed the identity record itself (seed/pubkey/ cert) is already unreachable from any FORTH primitive -- only C-level read_devblock/write_devblock touch it. But a device's ordinary user block content CAN be copied between two attached devices today, using only stock, unpinned words: <src> BLOCK <dst> BUFFER 1024 MOVE UPDATE SAVE-BUFFERS, or the dedicated RELOCATE-BLOCK word (whose own doc comment already admits "performs no policy validation of its own"). Checked whether the existing per-block owner_fp/BLK-ACL-ALLOW@ metadata already solves this -- it doesn't: owner_fp encodes who (a VM identity pubkey), never where (physical device), and blk_get_buffer()/blk_update() never consult acl_allow/acl_ttl at all -- those fields are completely inert. Small, targeted fix, no rearchitecture: - blk_subsys_relocate_block() (block_subsystem.c): same-device check. Its own documented purpose is wear-leveling (relocate on the SAME device) -- never stated as cross-device, and nothing enforced that until now. - New public blk_lbn_device_handle() (block_subsystem.c/.h): the missing LBN-to-device direction (blk_get_device_range() already goes the other way). Opaque, stable, == comparable. - MOVE (memory_words.c) and CMOVE/CMOVE> (string_words.c): refuse when both addresses are block-window addresses backed by two different devices -- the exact shape of the composed attack. A copy where either end is ordinary VM memory (the overwhelming common case: staging text from PAD, editing a block in place) is untouched. - blk_vm_check_epoch()/blk_vm_slot_for_addr() exposed (block_words.h) so the two new call sites share the same window-slot invalidation contract rather than a second, divergent copy of it. Verified live on all three architectures, not just boot-clean: same- device MOVE/RELOCATE-BLOCK still succeed exactly as before; cross-device MOVE/CMOVE/RELOCATE-BLOCK all refused. Zero UNKNOWN WORD, identical dict_hash across all three (this change adds no FORTH-visible word, only internal refusal conditions, as predicted). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
b7d9ed5425
commit
26c1117ccd
@@ -44,6 +44,7 @@
|
||||
#include "../../include/word_registry.h"
|
||||
#include "vm.h"
|
||||
#include "../../include/log.h"
|
||||
#include "include/block_words.h" /* blk_vm_is_cross_device_copy() -- Phase 8 v3 */
|
||||
#include <string.h>
|
||||
|
||||
|
||||
@@ -231,6 +232,12 @@ void memory_word_move(VM *vm) {
|
||||
vm->error = 1;
|
||||
return;
|
||||
}
|
||||
/* Phase 8 v3 (2026-09-23): refuse a same-VM, cross-device raw block
|
||||
* copy -- see blk_vm_is_cross_device_copy()'s own doc comment. */
|
||||
if (blk_vm_is_cross_device_copy(vm, addr1, addr2)) {
|
||||
vm->error = 1;
|
||||
return;
|
||||
}
|
||||
uint8_t *src = vm_ptr(vm, addr1);
|
||||
uint8_t *dst = vm_ptr(vm, addr2);
|
||||
memmove(dst, src, len);
|
||||
|
||||
Reference in New Issue
Block a user