Bug 2148167

Summary: annocheck reports that Rust program is written in a language other than C/C++/Go/Rust
Product: Red Hat Enterprise Linux 9 Reporter: Jan Pazdziora <jpazdziora>
Component: annobinAssignee: Nick Clifton <nickc>
annobin sub component: gcc-toolset-12 QA Contact: Václav Kadlčík <vkadlcik>
Status: CLOSED CURRENTRELEASE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: jpazdziora, mcermak, nickc
Version: 9.0Keywords: Bugfix, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-17 12:00:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Pazdziora 2022-11-24 13:35:14 UTC
Description of problem:

Attempting to test if mdevctl binaries were properly built with stack protection via -fstack-protector-strong yields info: Written in a language other than C/C++/Go/Rust.

But the source looks like Rust, and the package was built with rustc.

Version-Release number of selected component (if applicable):

annobin-annocheck-10.54-2.el9.x86_64
mdevctl-1.1.0-4.el9.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. dnf install -y annobin-annocheck mdevctl
2. dnf -y --nogpgcheck debuginfo-install mdevctl
3. rpm -ql mdevctl | grep -E '/usr/s?bin/' | while read f ; do test -L $f || echo $f ; done | xargs -- annocheck --verbose --skip-all --test-stack-prot

Actual results:

annocheck: Version 10.54.
Hardened: /usr/sbin/mdevctl: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/sbin/mdevctl: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/sbin/mdevctl: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/sbin/mdevctl: Overall: PASS.

Expected results:

If annocheck understands C, C++, Go, and Rust, it should recognize this binary as built from Rust source.

Additional info:

Comment 1 Jan Pazdziora 2022-11-24 13:45:43 UTC
I see the same issue with nispor-1.2.3-1.el9.x86_64 and

Hardened: /usr/bin/npc: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/bin/npc: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/bin/npc: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/bin/npc: Overall: PASS.

sevctl-0.2.0-4.el9.x86_64 and

Hardened: /usr/bin/sevctl: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/bin/sevctl: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/bin/sevctl: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/bin/sevctl: Overall: PASS.

stratisd-2.4.2-3.el9.x86_64 and

Hardened: /usr/bin/stratis-min: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/bin/stratis-min: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/bin/stratis-min: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/bin/stratis-min: Overall: PASS.
Hardened: /usr/bin/stratis-predict-usage: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/bin/stratis-predict-usage: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/bin/stratis-predict-usage: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/bin/stratis-predict-usage: Overall: PASS.

and even for rust-1.58.1-1.el9.x86_64 itself

Hardened: /usr/bin/rustc: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/bin/rustc: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/bin/rustc: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/bin/rustc: Overall: PASS.
Hardened: /usr/bin/rustdoc: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/bin/rustdoc: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/bin/rustdoc: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/bin/rustdoc: Overall: PASS.

and rustfmt's

Hardened: /usr/bin/cargo-fmt: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/bin/cargo-fmt: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/bin/cargo-fmt: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/bin/cargo-fmt: Overall: PASS.
Hardened: /usr/bin/rustfmt: info: Written in a language other than C/C++/Go/Rust.
Hardened: /usr/bin/rustfmt: info: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: /usr/bin/rustfmt: info: ALSO written in Assembler (source: DW_AT_language string).
Hardened: /usr/bin/rustfmt: skip: stack-prot test because not compiled C/C++ code 
Hardened: /usr/bin/rustfmt: Overall: PASS.

Comment 2 Nick Clifton 2022-11-28 16:37:37 UTC
Investigating....

Comment 3 Nick Clifton 2022-11-28 16:54:55 UTC
This looks like a duplicate of:

  https://bugzilla.redhat.com/show_bug.cgi?id=2057737

Essentially what is happening is that annocheck was built in an environment that does not know about the DWARF value used to identify Rust binaries.  So it displays the message shown.

The problem was fixed with annobin 10.58, so using that version, or a later one, should solve the problem.  

Note - whilst RHEL 9.0 uses annobin 10.54, RHEL 9.1 will use annobin 10.73

Comment 4 Nick Clifton 2022-11-28 17:06:10 UTC
Oh and GTS 9.1 uses annobin 10.76, so it should be OK as well.

Comment 5 Nick Clifton 2022-11-28 17:14:18 UTC
(In reply to Nick Clifton from comment #4)
> Oh and GTS 9.1 uses annobin 10.76, so it should be OK as well.

Doh - I meant GTS 12 for RHEL 9.1....

Comment 9 Václav Kadlčík 2023-01-17 12:00:30 UTC
Thanks Jan, closing.