Currently, the Rust code in kata-containers is built without default Fedora compiler flags for Rust code (i.e. "-Copt-level=3 -Cdebuginfo=2 -Ccodegen-units=1 -Clink-arg=-Wl,-z,relro -Clink-arg=-Wl,-z,now --cap-lints=warn" on Fedora 37) - essentially, the code is not fully optimized, and does not contain debuginfo or frame pointers. RUSTFLAGS are the standard environment variable for setting compiler flags for rustc (similar to CFLAGS / CXXFLAGS / LDFLAGS), but they aren't set by default (and not yet included in %set_build_flags, but I've reported an RFE about this). It appears that the kata-containers Makfiles currently hard-codes only the "--release" flag for cargo (which is equivalent to `-Copt-level=2`). This results in Rust code which is compiled as part of kata-containers not being optimized at the same level as other Rust code in Fedora (i.e. `-Copt-level=3` is default in Fedora), it doesn't get debug symbols (missing `-Cdebuginfo=2` flag, which is non-standard for `--release` mode), and it also doesn't include the other mandatory compiler flags, which result in better quality of generated code (`-Ccodegen-units=1`), and on rawhide, includes frame pointers on x86_64 and aarch64. Usually exporting RUSTFLAGS="%build_rustflags" environment variable in such cases should be enough, but looking at the Makefiles in kata-containers, they seem to override this variable whether it was set in the environment or not ... so fixing this problem might involve patching some Makefiles.
Thanks for the report I'll be working on it, bringing the issue upstream.
This bug appears to have been reported against 'rawhide' during the Fedora Linux 38 development cycle. Changing version to 38.
Has there been any progress? Is there an upstream issue that we can link here?
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle. Changing version to 39.
(In reply to Fabio Valentini from comment #3) > Has there been any progress? Is there an upstream issue that we can link here? I just created https://github.com/kata-containers/kata-containers/issues/7892
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle. Changing version to 40.