Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2039209

Summary: python-cryptography fails annocheck due to missing .note.gnu.property ELF section
Product: Red Hat Enterprise Linux 9 Reporter: Christian Heimes <cheimes>
Component: annobinAssignee: Nick Clifton <nickc>
Status: CLOSED ERRATA QA Contact: Václav Kadlčík <vkadlcik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: fweimer, jistone, mcermak, mreynolds, nickc, vkadlcik
Target Milestone: rcKeywords: Bugfix, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: annobin-10.47-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 12:33:28 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 Christian Heimes 2022-01-11 09:16:37 UTC
Description of problem:
python-cryptography's _rust.abi3.so fails annocheck on X86_64 because the ELF binary has no .note.gnu.property

FAIL: cf-protection test because no .note.gnu.property section = no control flow information 

Version-Release number of selected component (if applicable):
python3-cryptography-3.4.7-5.el9.x86_64

How reproducible:
always

Steps to Reproduce:
1. dnf install -y python3-cryptography annobin-annocheck binutils
2. dnf debuginfo-install -y python3-cryptography
3. annocheck --ignore-unknown --verbose /usr/lib64/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so

Actual results:
(note: I stripped /usr/lib64/python3.9/site-packages/cryptography/hazmat/bindings/ from the output)

Hardened: _rust.abi3.so: PASS: pie test 
Hardened: _rust.abi3.so: info: Written in a language other than C/C++/Go/Rust.
Hardened: _rust.abi3.so: Command line options not recorded in DWARF DW_AT_producer variable.
Hardened: _rust.abi3.so: PASS: writable-got test 
Hardened: _rust.abi3.so: PASS: dynamic-segment test 
Hardened: _rust.abi3.so: PASS: bind-now test 
Hardened: _rust.abi3.so: skip: entry test because shared libraries do not use entry points 
Hardened: _rust.abi3.so: PASS: gnu-stack test because stack segment exists with the correct permissions 
Hardened: _rust.abi3.so: PASS: gnu-relro test 
Hardened: _rust.abi3.so: PASS: notes test 
Hardened: _rust.abi3.so: skip: not-branch-protection test because not an AArch64 binary 
Hardened: _rust.abi3.so: FAIL: cf-protection test because no .note.gnu.property section = no control flow information 
Hardened: _rust.abi3.so: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-cf-protection.html
Hardened: _rust.abi3.so: skip: not-dynamic-tags test because AArch64 specific 
Hardened: _rust.abi3.so: skip: fortify test because no C/C++ compiled code found 
Hardened: _rust.abi3.so: skip: glibcxx-assertions test because source language not C++ 
Hardened: _rust.abi3.so: skip: go-revision test because no GO compiled code found 
Hardened: _rust.abi3.so: skip: lto test because not compiled C/C++ code 
Hardened: _rust.abi3.so: skip: only-go test because no GO compiled code found 
Hardened: _rust.abi3.so: skip: optimization test because not C/C++ compiled code 
Hardened: _rust.abi3.so: skip: pic test because not C/C++ compiled code 
Hardened: _rust.abi3.so: PASS: production test 
Hardened: _rust.abi3.so: FAIL: property-note test because no .note.gnu.property section found 
Hardened: _rust.abi3.so: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-property-note.html
Hardened: _rust.abi3.so: PASS: run-path test 
Hardened: _rust.abi3.so: PASS: rwx-seg test 
Hardened: _rust.abi3.so: PASS: short-enums test 
Hardened: _rust.abi3.so: skip: stack-clash test because no C/C++ compiled code found 
Hardened: _rust.abi3.so: skip: stack-prot test because not compiled C/C++ code 
Hardened: _rust.abi3.so: skip: stack-realign test because not a 32-bit i686 executable 
Hardened: _rust.abi3.so: PASS: textrel test 
Hardened: _rust.abi3.so: PASS: threads test 
Hardened: _rust.abi3.so: PASS: unicode test 
Hardened: _rust.abi3.so: skip: warnings test because no C/C++ compiled code found 
Hardened: _rust.abi3.so: Overall: FAIL.


Expected results:
annocheck should not fail


Additional info:
The Rust shared library has no .note.gnu.property ELF section:

# readelf -n /usr/lib64/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so 

Displaying notes found in: .note.gnu.build-id
  Owner                Data size        Description
  GNU                  0x00000014       NT_GNU_BUILD_ID (unique build ID bitstring)
    Build ID: 67d0be56177a18f846b96331c58d41c5ddaf9a98

Displaying notes found in: .gnu.build.attributes
  Owner                Data size        Description
  GA$<version>3a1      0x00000010       OPEN
    Applies to region from 0x6000 to 0x3af25

Comment 1 Christian Heimes 2022-01-11 09:19:36 UTC
Josh, could you take a look please? How are you dealing with failing annocheck for other Rust packages?

Comment 2 Christian Heimes 2022-01-11 09:47:55 UTC
Rust 1.47 and newer has support for "-C control-flow-guard", but the feature is only available on MSVC (Windows) platforms.

https://doc.rust-lang.org/beta/unstable-book/compiler-flags/control-flow-guard.html
https://github.com/rust-lang/rust/issues/68793

Comment 3 Nick Clifton 2022-01-11 18:16:06 UTC
If I may, I would like to take this BZ.

Rust does not support Intel's CET feature (yet) and annocheck ought to know this...

Comment 4 Josh Stone 2022-01-11 18:20:42 UTC
I also learned that there are LLVM module options for cf-protection (this is separate from control-flow-guard), so I'm going to try enabling that in rustc. I still have rebuilds coming up for 1.58 this week (bug 2002885), and this is something that I should be able to add in pretty easily if it works.

Separately, we do need proper rustc integration/plugin for annobin, but that will be longer term. Until we have that, there may still be some part of this that annocheck won't be able to tell, so it might require waiving even with real CET working fine. (Unless Nick just teaches the tool to ignore it for now...)

Comment 5 Christian Heimes 2022-01-12 15:07:39 UTC
Thanks for taking over the bug, Nick! Much appreciated. An improved annocheck is the next best solution until Josh has figured out how to enable FCF on Linux.

Comment 7 Nick Clifton 2022-01-17 10:09:32 UTC
Fixed in annobin-10.47-1.el9

Comment 16 errata-xmlrpc 2022-05-17 12:33:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (new packages: annobin), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2022:2342