Skip to content

Auto-optimize's RUSTFLAGS overrides .cargo/config.toml, so any auto-optimized binary aborts on throw (#7305 check) #7315

Description

@jdalton

On current main, an auto-optimized binary that throws aborts:

perry: FATAL: unwind tables are missing from this runtime build (0 frame(s) visible to the unwinder).

Cause — a collision between two recent changes

#7305's exception lowering added a hard runtime check that aborts when the unwinder can see no frames. Separately, .cargo/config.toml carries rustflags = ["-C", "force-unwind-tables=yes"], and its own comment warns that an environment RUSTFLAGS overrides the config file entirely.

Auto-optimize sets exactly that. crates/perry/src/commands/compile/optimized_libs/driver.rs:893 builds a RUSTFLAGS vector (including -C panic=abort) and hands it to cargo, which then discards the config file's force-unwind-tables=yes. The runtime is built without unwind tables, and #7305's check fires on the first throw.

So the two changes are individually reasonable and jointly fatal: any auto-optimized binary that throws an exception aborts instead of unwinding.

Impact

This is not specific to one workload — it should affect any auto-optimized build that throws. It was found while compiling Socket Firewall's sfw-registry, which cannot compile-and-run on main at 0062683f9 as a result.

Suggested direction (not a prescription)

Have the auto-optimize RUSTFLAGS construction append to, rather than replace, the flags the config file would have supplied — or explicitly re-add -C force-unwind-tables=yes to that vector. A regression test that compiles an auto-optimized binary which throws and asserts it unwinds rather than aborting would keep the two from drifting apart again.

Worth noting the general shape: a config file whose own comment documents that an env var silently overrides it is a hazard waiting for exactly this. If any other flag in .cargo/config.toml matters for correctness rather than performance, it has the same exposure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions