Wave icon indicating copy to clipboard operation
Wave copied to clipboard

Check executable OS and loader compatibility when selecting ELF package tools

Open LunaStev opened this issue 3 weeks ago • 0 comments

Problem

Matching ELF architecture/width is insufficient to distinguish Linux and FreeBSD package executables. Tool selection currently accepts a Linux executable for a FreeBSD target.

Reproduction and evidence

Audited canonical master 69a67c6e0fb700f37ee6114f5a66d37ee13771a5 (0.0.1-alpha-dev). Matching checkout-built compiler/std were used for compiler probes on Linux amd64 with Rust 1.89.0 and LLVM 21.1.8. Artifact inspection, mocked/projection checks and foreign-target object emission are identified below and are not native execution on those operating systems.

println!("{:?}", wave_tools::binary::inspect(
    std::path::Path::new("/bin/true"), Some("x86_64-unknown-freebsd")
));

Executed on Linux: Ok with format Elf, x86_64/64 bits and interpreter /lib64/ld-linux-x86-64.so.2. package::tool relies on this same check. This is artifact-selection evidence, not a FreeBSD execution test.

Scope

Make expected binary role and target OS/ABI evidence explicit. Keep OS-neutral relocatable inputs distinct from runnable tools and runtime DSOs.

Starting points: tools/src/binary.rs:414, tools/src/package.rs:51.

Design discussion required

Recommended: validate known executable loader/ABI evidence by role, and require appropriate provenance for cases where bytes do not identify an OS. A raw OSABI-byte-only rule would reject legitimate System V-neutral objects; choose the fallback evidence before implementing it.

Please mention @LunaStev to discuss the design before starting implementation.

Completion criteria

  • [ ] A Linux-loader executable cannot satisfy a FreeBSD runnable-tool contract.
  • [ ] Correct selected-target tools still pass.
  • [ ] Cover static/OSABI-neutral cases under the approved policy without blanket rejection of valid objects.

Related: #413, #562. Related broad trackers or completed implementations are context, not claims that their entire scope is unfinished.

LunaStev avatar Nov 12 '26 12:11 LunaStev