- Build a second C provider reporting ABI v2 and assert registration fails with resource.unsupported. - Assert pure/strict refuse a registered C provider kind with permission.denied. - Refresh the C ABI evidence/test README. Gate: fmt, clippy -D warnings, 436 tests passed.
2.3 KiB
RFC-CM CM-A09 evidence: C ABI ResourceProvider v1
Date: 2026-11-20 (Asia/Shanghai)
Repository: marqdo-cli
Baseline: 12be02e plus this step's changes.
Decision record: ADR-0036
Header: marqdo_resource_provider.h
Related: in-process provider,
worker provider, STATUS §5.
Scope: trusted native C ABI adapter; plugin-Worker binding still open.
ABI
marqdo_resource_provider_abi_version() -> uint32_t (must be 1)
marqdo_resource_open(kind, descriptor, rights_csv, *token) -> i32
marqdo_resource_read(token, buffer, capacity, *read, *eof) -> i32
marqdo_resource_write(token, bytes, length, *written) -> i32
marqdo_resource_close(token) -> i32
marqdo_resource_last_error(buffer, capacity) -> i32
The host resolves these symbols at registration, rejects non-v1 libraries and
missing symbols, attaches callsite spans to errors, and never lets a provider
token enter a language Value, wire frame or trace.
Test
crates/marqdo-host/tests/c_provider.rs (#[cfg(unix)]):
- builds a C shared library with
cc -shared -fPIC(skips ifccis absent); - registers it as provider
cabifor kindcabi.sensorwith a project-mode grant; resource.open/read/write/closeround-tripsc-/abi,write=3, second closeresource.closed;- a missing library path fails with
kernel.unavailable; - a library reporting ABI version 2 fails with
resource.unsupported; - pure/strict refuse the C provider kind with
permission.denied.
No Rust runtime/HostOp/parser change was needed; language code still sees the
same resource.* surface.
Security boundary
The C library is loaded in-process with host privileges. It is trusted native code and explicitly not a sandbox. Pure/strict refuse provider kinds; strict remains fail-closed. Untrusted plugin loading remains the separate plugin Worker transport.
Not done
- Plugin-Worker resource-provider binding through the existing plugin ABI.
- Provider package installation/signatures/discovery.
- ABI version negotiation beyond v1 rejection.
- Untrusted-provider isolation or strict-mode providers.
- Windows shared-library build/lane.