feat(fs): binary-safe length-bearing file I/O through the native ABI and libc (refs #765) - #773
Merged
Merged
Conversation
…nd libc (refs #765) DEMO-01 slice: native applications can read and persist arbitrary binary payloads without NUL truncation. - secureos_api.h: declare os_fs_read_file_bytes / os_fs_write_file_bytes with an explicit capacity/EOF/deny contract (additive, no OS_ABI_VERSION bump). - launcher_exec.c: bridge slots fs_read_file_bytes / fs_write_file_bytes; kernel bridge version 4 -> 5; implementations reuse fs_read_file_bytes/fs_write_file_bytes with the same CAP_FS_READ/CAP_FS_WRITE + CAP_DISK_IO_REQUEST + per-operation disk-IO consent gates (denied access performs no write). - secureos_api_stubs.c: v5 handshake + wrapper mappings; guards run before any bridge dereference (no-bridge hosts never touch 0x9FF000); *out_len pinned to 0 on every failure path. - posix_fd.c: snapshots read AND flush with explicit byte lengths via the byte APIs; strnlen length inference and embedded-NUL flush truncation removed; text write/append compatibility preserved. - clib_posix_fd gate: byte-exact leading/interior/trailing NUL read + create/append round-trips. - New native_fs_bytes_wrapper dynamic host gate (synthetic v5 bridge page: exact-byte transport, pre-v5 degrade, return-code mapping, argument guards); wired into test.sh + validate_bundle TEST_TARGETS. - process_exit_qemu / process_spawn_argv_roundtrip: synthetic bridge pages bumped to v5 (same as every prior bridge-version bump). - docs/abi syscalls + clib-symbols tables and the tinycc libc-deps open-symbol note aligned with the retired text-only limitation. - State snapshot for 2026-09-11.
…apper gate The pinned toolchain container compiles with stricter feature-test macros than the dev host glibc; mirrors tests/process_exit_qemu_test.c which defines _GNU_SOURCE for the same MAP_FIXED page setup.
…(refs #765) Intentional documented drift: secureos_api.h and secureos_api_stubs.c gain the os_fs_read_file_bytes / os_fs_write_file_bytes wrappers in this PR (bridge v5), changing the pinned input hashes and the derived hello.bin output hash. Hash provenance: the three new values are the exact 'actual' hashes emitted by the pinned-toolchain hello_sof_golden run in CI (actions run 34655783679, job build-and-validate), verified byte-identical to local sha256sum for both changed input files. toolchain.lock, dev/hello.c and crt0.c pins are unchanged (PASS in that run).
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DEMO-01 (#765) slice: binary-safe, length-bearing file I/O through the native ABI and libc, reusing the existing kernel fs operations and capability/consent gates.
secureos_api.h,secureos_api_stubs.c): newos_fs_read_file_bytes/os_fs_write_file_byteswrappers. Additive native-bridge slots; bridge version 4 -> 5; noOS_ABI_VERSIONbump. Argument guards run before any bridge dereference;*out_lenis pinned to 0 on every failure path; empty-file read is a clean OK-with-zero-length EOF.launcher_exec.c):app_native_fs_read_file_bytes/app_native_fs_write_file_bytescall the existingfs_read_file_bytes/fs_write_file_bytesops behind the exact sameCAP_FS_READ/CAP_FS_WRITE+CAP_DISK_IO_REQUEST+ per-operation disk-IO consent gates as the text pair — denied access performs no write and reports denial. Wire errors map NOT_FOUND vs capacity/storage distinctly.posix_fd.c): snapshots now read and flush with actual byte lengths; thestrnlenlength inference and the documented embedded-NUL flush truncation are gone. Existing text callers keep their behavior (the text pair itself is unchanged).clib_posix_fdextended with byte-exact leading/interior/trailing NUL read + create/append round-trips; newnative_fs_bytes_wrapperhost gate drives the wrappers over a synthetic v5 bridge page (exact-byte transport, pre-v5 handshake degrade, full return-code mapping, argument guards). Wired intotest.sh, its usage list, andvalidate_bundle.shTEST_TARGETS.process_exit_qemu/process_spawn_argv_roundtripsynthetic bridge pages bumped to v5 (required by the runtime handshake — same bookkeeping as every prior bridge bump).docs/abi/syscalls.mdfilesystem table gains both calls with the explicit short-read/EOF/capacity/deny contract;docs/abi/clib-symbols.mdfd-surface notes and thevendor/tinycc/libc-deps.jsonopen-symbol note retire the text-payload limitation. Two-commit stamp pattern: stamp-only commit repoints both docs'Last verifiedlines to the content commit.Test evidence (host gates, local green)
clib_posix_fd,native_fs_bytes_wrapper,abi_version,clib_stdio,clib_symbol_drift,fs_service,launcher_fs,app_runtime,mem_brk_wrapper,clib_os_brk,mem_brk_qemu,mem_brk_arena_cap_deny,process_exit_wrapper,process_exit_qemu,process_spawn_wrapper,process_spawn_argv_roundtrip,sosh_cap_cat_ls,sosh_cap_write_append,validate_sosh_capability_contract,tinycc_libc_deps,validate_abi_stamps.Scope notes
Closes #765.Refs #765