Curls OS enforces strict input/output contracts at every syscall and K-ABI bridge boundary to ensure system stability.
- K-ABI (Kernel-Internal): Violations represent a kernel bug and trigger a
panic(). - U-ABI (Syscall Dispatch): User-program mistakes trigger a
[VALIDATE FAIL]diagnostic and return an error code to the caller.
When adding new K-ABI or U-ABI functions, developers MUST:
- Validate All Pointers: Use
KABI_VALIDATE_PTRorUABI_VALIDATE_PTR. - Check Ranges: Use
KABI_VALIDATE_RANGEfor parameters. - Verify FDs: Use
UABI_VALIDATE_FD.
| Macro | Layer | Checks | On failure |
|---|---|---|---|
KABI_VALIDATE_PTR |
KABI | ptr != NULL |
panic() |
KABI_VALIDATE_RANGE |
KABI | lo <= val <= hi |
panic() |
UABI_VALIDATE_PTR |
UABI | ptr != NULL |
return -1 |
UABI_VALIDATE_FD |
UABI | 0 <= fd < MAX_FD |
return -1 |
UABI_VALIDATE_OUTPUT |
UABI | ret >= -5 |
warn only |
New validated functions must have corresponding tests in Phase 15 of the core test suite. These must prove:
- ✅ Positive Case: Valid inputs are accepted.
- ❌ Negative Case: Invalid inputs are correctly rejected with the appropriate error code.
All tests must pass in both native QEMU/KVM and the Docker-based TCG environment. The TCG emulation backend exposes stricter memory ordering semantics and scheduling non-determinism, making it a valuable stress target for SMP correctness.
Run the full suite in Docker with:
make docker64-debug