Bug 1869980 - rust-ring not supported on ppc64le and s390x
Summary: rust-ring not supported on ppc64le and s390x
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rust-ring
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Rust SIG
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: ZedoraTracker PPCTracker rust-ring 2080743
TreeView+ depends on / blocked
 
Reported: 2020-08-19 07:16 UTC by Dan Horák
Modified: 2023-10-27 20:20 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-10-27 20:20:53 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github briansmith ring issues 389 0 None open Support Power/PowerPC 2022-05-08 14:12:07 UTC
Github briansmith ring issues 971 0 None closed Support AES-GCM on targets for which we do not have assembly language code. 2022-05-08 14:12:07 UTC
Github briansmith ring issues 986 0 None open "cargo build" failed on s390x platform 2022-05-08 14:12:07 UTC

Description Dan Horák 2020-08-19 07:16:29 UTC
Description of problem:
Rust crashes on ppc64le and s390x when compiling the "ring" crate, the ppc64le and s390x backtraces differ only in minor details.

...
     Running `/usr/bin/rustc --crate-name build_script_build --edition=2018 build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no -C codegen-units=1 --cfg 'feature="alloc"' --cfg 'feature="default"' --cfg 'feature="dev_urandom_fallback"' --cfg 'feature="once_cell"' -C metadata=a49c1dd9c38b4890 -C extra-filename=-a49c1dd9c38b4890 --out-dir /builddir/build/BUILD/ring-0.16.15/target/release/build/ring-a49c1dd9c38b4890 -L dependency=/builddir/build/BUILD/ring-0.16.15/target/release/deps --extern cc=/builddir/build/BUILD/ring-0.16.15/target/release/deps/libcc-58e99f30897668ea.rlib -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now -Ccodegen-units=1 --cap-lints=warn`
     Running `/builddir/build/BUILD/ring-0.16.15/target/release/build/ring-a49c1dd9c38b4890/build-script-build`
error: failed to run custom build command for `ring v0.16.15 (/builddir/build/BUILD/ring-0.16.15)`

Caused by:
  process didn't exit successfully: `/builddir/build/BUILD/ring-0.16.15/target/release/build/ring-a49c1dd9c38b4890/build-script-build` (exit code: 101)
--- stderr
ENV CARGO=/usr/bin/cargo
ENV CARGO_CFG_TARGET_ARCH=powerpc64
ENV CARGO_CFG_TARGET_ENDIAN=little
ENV CARGO_CFG_TARGET_ENV=gnu
ENV CARGO_CFG_TARGET_FAMILY=unix
ENV CARGO_CFG_TARGET_FEATURE=altivec,power8-altivec,power8-vector,vsx
ENV CARGO_CFG_TARGET_HAS_ATOMIC=16,32,64,8,ptr
ENV CARGO_CFG_TARGET_HAS_ATOMIC_LOAD_STORE=16,32,64,8,ptr
ENV CARGO_CFG_TARGET_OS=linux
ENV CARGO_CFG_TARGET_POINTER_WIDTH=64
ENV CARGO_CFG_TARGET_THREAD_LOCAL=
ENV CARGO_CFG_TARGET_VENDOR=unknown
ENV CARGO_CFG_UNIX=
ENV CARGO_FEATURE_ALLOC=1
ENV CARGO_FEATURE_DEFAULT=1
ENV CARGO_FEATURE_DEV_URANDOM_FALLBACK=1
ENV CARGO_FEATURE_ONCE_CELL=1
ENV CARGO_HOME=.cargo
ENV CARGO_MAKEFLAGS=--jobserver-fds=5,6 -j --jobserver-auth=5,6 -j
ENV CARGO_MANIFEST_DIR=/builddir/build/BUILD/ring-0.16.15
ENV CARGO_MANIFEST_LINKS=ring-asm
ENV CARGO_PKG_AUTHORS=Brian Smith <brian>
ENV CARGO_PKG_DESCRIPTION=Safe, fast, small crypto using Rust.
ENV CARGO_PKG_HOMEPAGE=
ENV CARGO_PKG_NAME=ring
ENV CARGO_PKG_REPOSITORY=https://github.com/briansmith/ring
ENV CARGO_PKG_VERSION=0.16.15
ENV CARGO_PKG_VERSION_MAJOR=0
ENV CARGO_PKG_VERSION_MINOR=16
ENV CARGO_PKG_VERSION_PATCH=15
ENV CARGO_PKG_VERSION_PRE=
ENV CONFIG_SITE=NONE
ENV DEBUG=false
ENV HISTCONTROL=ignoredups
ENV HISTSIZE=1000
ENV HOME=/builddir
ENV HOST=powerpc64le-unknown-linux-gnu
ENV HOSTNAME=
ENV LANG=C
ENV LD_LIBRARY_PATH=/builddir/build/BUILD/ring-0.16.15/target/release/deps:/builddir/build/BUILD/ring-0.16.15/target/release:/usr/lib/rustlib/powerpc64le-unknown-linux-gnu/lib
ENV LOGNAME=root
ENV LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.m4a=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.oga=01;36:*.opus=01;36:*.spx=01;36:*.xspf=01;36:
ENV MAIL=/var/spool/mail/root
ENV NUM_JOBS=64
ENV OLDPWD=/builddir/build/BUILD
ENV OPT_LEVEL=3
ENV OUT_DIR=/builddir/build/BUILD/ring-0.16.15/target/release/build/ring-913b5019ea40e460/out
ENV PATH=/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
ENV PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig
ENV PROFILE=release
ENV PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007"
ENV PWD=/builddir/build/BUILD/ring-0.16.15
ENV RPM_ARCH=ppc64le
ENV RPM_BUILD_DIR=/builddir/build/BUILD
ENV RPM_BUILD_NCPUS=64
ENV RPM_BUILD_ROOT=/builddir/build/BUILDROOT/rust-ring-0.16.15-1.fc34.ppc64le
ENV RPM_DOC_DIR=/usr/share/doc
ENV RPM_LD_FLAGS=-Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
ENV RPM_OPT_FLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -mcpu=power8 -mtune=power8 -fasynchronous-unwind-tables -fstack-clash-protection
ENV RPM_OS=linux
ENV RPM_PACKAGE_NAME=rust-ring
ENV RPM_PACKAGE_RELEASE=1.fc34
ENV RPM_PACKAGE_VERSION=0.16.15
ENV RPM_SOURCE_DIR=/builddir/build/SOURCES
ENV RUSTC=/usr/bin/rustc
ENV RUSTC_BOOTSTRAP=1
ENV RUSTDOC=/usr/bin/rustdoc
ENV RUST_BACKTRACE=full
ENV SHELL=/bin/bash
ENV SHLVL=2
ENV SOURCE_DATE_EPOCH=1596141632
ENV SSL_CERT_DIR=/etc/pki/tls/certs
ENV SSL_CERT_FILE=/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
ENV TARGET=powerpc64le-unknown-linux-gnu
ENV TERM=xterm-256color
ENV USER=root
ENV _=/usr/bin/env
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', build.rs:372:34
stack backtrace:
   0:        0x13cb8af9c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4fcb7f26745d37a7
   1:        0x13cbb9664 - core::fmt::write::hbe777d1448617ddb
   2:        0x13cb73658 - std::io::Write::write_fmt::h5da84f19cb157bd4
   3:        0x13cb7aa04 - std::panicking::default_hook::{{closure}}::h2c02ea2fb859f5eb
   4:        0x13cb7a614 - std::panicking::default_hook::h14da7a3c05ae8496
   5:        0x13cb7b350 - std::panicking::rust_panic_with_hook::h414a9a29d90ee5d0
   6:        0x13cb7ad78 - rust_begin_unwind
   7:        0x13cbb8f2c - core::panicking::panic_fmt::h63c71e6feaa725d9
   8:        0x13cbb8e40 - core::panicking::panic::ha503bf5d252f1a25
   9:        0x13cb4f268 - core::option::Option<T>::unwrap::hc9d9d2c4cd73f940
                               at /builddir/build/BUILD/rustc-1.45.2-src/src/libcore/macros/mod.rs:10
  10:        0x13cb4f268 - build_script_build::build_c_code::h74d5edaeb91ddd8c
                               at /builddir/build/BUILD/ring-0.16.15/build.rs:372
  11:        0x13cb4f268 - build_script_build::ring_build_rs_main::h5c20a81bbbfd4131
                               at /builddir/build/BUILD/ring-0.16.15/build.rs:298
  12:        0x13cb4f268 - build_script_build::main::h38b6873d1b11dba9
                               at /builddir/build/BUILD/ring-0.16.15/build.rs:255
  13:        0x13cb49524 - std::rt::lang_start::{{closure}}::h7b9b4c60f5da7d5b
                               at /builddir/build/BUILD/rustc-1.45.2-src/src/libstd/rt.rs:67
  14:        0x13cb8b2e4 - std::sys_common::backtrace::__rust_begin_short_backtrace::hcf5723025ae51224
  15:        0x13cb7818c - std::rt::lang_start_internal::hd7a80487e9a3301a
  16:        0x13cb52a70 - main
  17:     0x7fffb6679cdc - generic_start_main.constprop.0.isra.0
  18:     0x7fffb6679ec0 - __libc_start_main
  19:                0x0 - <unknown>

error: Bad exit status from /var/tmp/rpm-tmp.4UUiGk (%build)


Version-Release number of selected component (if applicable):
rust-1.45.2-1.fc33
rust-1.44.1-1.fc33

How reproducible:
100%

Steps to Reproduce:
1. try building rust-ring package


Actual results:
https://koji.fedoraproject.org/koji/taskinfo?taskID=49475014


Expected results:
package built

Additional info:
It's a new package so there is no history with older rust or llvm versions.

Comment 1 Josh Stone 2020-08-19 16:03:55 UTC
> thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', build.rs:372:34

This is not a compiler crash, but rather an action from ring's own build script.

 372   │     let (_, _, perlasm_format) = ASM_TARGETS
 373   │         .iter()
 374   │         .find(|entry| {
 375   │             let &(entry_arch, entry_os, _) = *entry;
 376   │             entry_arch == &target.arch && is_none_or_equals(entry_os, &target.os)
 377   │         })
 378   │         .unwrap();

Here is that target list:

 230   │ // None means "any OS" or "any target". The first match in sequence order is
 231   │ // taken.
 232   │ const ASM_TARGETS: &[(&str, Option<&str>, Option<&str>)] = &[
 233   │     ("x86_64", Some("ios"), Some("macosx")),
 234   │     ("x86_64", Some("macos"), Some("macosx")),
 235   │     ("x86_64", Some(WINDOWS), Some("nasm")),
 236   │     ("x86_64", None, Some("elf")),
 237   │     ("aarch64", Some("ios"), Some("ios64")),
 238   │     ("aarch64", None, Some("linux64")),
 239   │     ("x86", Some(WINDOWS), Some("win32n")),
 240   │     ("x86", Some("ios"), Some("macosx")),
 241   │     ("x86", None, Some("elf")),
 242   │     ("arm", Some("ios"), Some("ios32")),
 243   │     ("arm", None, Some("linux32")),
 244   │     ("wasm32", None, None),
 245   │ ];

So it would seem that ring just doesn't support ppc64le or s390x yet.

Comment 2 Peter Robinson 2020-08-19 17:04:29 UTC
Digging further seems it's not supported upstream. There's a number of bugs around this bug the two main ones seem to be:
s390x: https://github.com/briansmith/ring/issues/986
ppc64le: https://github.com/briansmith/ring/issues/389

Plus some like there around support for generic C fallbacks: https://github.com/briansmith/ring/issues/971

Comment 3 Dan Horák 2020-08-20 13:58:08 UTC
Thanks, Josh, I'll probably never understand what is rust trying to tell me :-)

Comment 4 Fedora Admin user for bugzilla script actions 2021-01-03 14:51:34 UTC
This package has changed maintainer in the Fedora.
Reassigning to the new maintainer of this component.

Comment 5 Ben Cotton 2021-02-09 15:15:53 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 6 Fabio Valentini 2023-02-09 12:01:29 UTC
To provide a small update here: It appears that the "ring" project is more or less abandoned. Some in the Rust community have started calling it the place "where Pull Requests go to die" (I'm not joking). The Pull Requests that work on ppc64le / s390x support either by adding a generic arch-independent C / Rust implementation or by adding assembly for these architectures have effectively been ignored and were subsequently abandoned.

The main developer of "ring" (and as far as I can tell, the only person with commit privileges on the GitHub project) is often inactive and unreachable for months, with development of "ring" stalled entirely during these times.

The last stable release of "ring" is over two years old:
https://crates.io/crates/ring/versions
Which means the version we currently have in Fedora is missing two years' worth of security patches from BoringSSL.

This sorry state of affairs has already caused other Rust projects that depend on "ring" to look elsewhere - for example, RusTLS (the most prominent user of "ring") is currently working on adding support for alternative crypto backends (https://github.com/rustls/rustls/pull/1184), given that "ring" has not proven to be a project that can be relied on, especially considering its security sensitive nature.

As such, I would strongly recommend that no new software that uses "ring" is packaged for Fedora. For projects that provide support for multiple cryptography backends (e.g. the "openssl", "native-tls", or RustCrypto crates), I strongly recommend using one of these backends, instead - which also works around the problem of "ring" not being available on all architectures that Fedora supports.

Comment 7 Petr Menšík 2023-04-03 19:47:54 UTC
Would it make sense to convert rust-ring devel packages to arch packages, which would *not* provide packages on platforms where they are know to not build? That way any dependency attempting to use it would fail just on those architectures. It would avoid leaf dependencies doing hacks around missing platform support on their side. All the end dependencies would need to do would be not building any projects actually using those dependencies.

Does it make sense to provide devel files for all architectures, where they are known to be unusable?

Comment 8 Fabio Valentini 2023-04-03 20:15:05 UTC
> Does it make sense to provide devel files for all architectures, where they are known to be unusable?

As I mentioned on the rust-domain review request, I've been working on automating this. rust2rpm v24.3.0 supports generating spec files like this now.
I will update the "rust-ring" package and a few other rustls-related packages to use this approach.

Comment 9 Fabio Valentini 2023-10-27 20:20:53 UTC
As of version 0.17+ of ring, ppc64le and s390x are now supported.

Packages that update their "ring" dependency from v0.16 to v0.17 can drop workarounds for missing s390x and ppc64le support.


Note You need to log in before you can comment on or make changes to this bug.