Bug 2581510

Summary: libzstd lost Shadow Stack (IBT/SHSTK) marking after switch to CMake: huf_decompress_amd64.S built without -fcf-protection
Product: [Fedora] Fedora Reporter: Rajeev Shrestha <rajeev.shrestha>
Component: zstdAssignee: Pádraig Brady <p>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: fweimer, igor.raits, p, rajeev.shrestha, xinghong.chen
Target Milestone: ---Keywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: zstd-1.6.0-1.fc46 zstd-1.6.0-1.fc45 zstd-1.6.0-1.fc44 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2026-11-25 15:29:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2458434    
Attachments:
Description Flags
Proposed fix: export ASMFLAGS in %build none

Description Rajeev Shrestha 2026-11-23 05:03:10 UTC
libzstd.so.1 in Rawhide (zstd-1.5.7-6.fc45, also shipped in F45 and F46) has no x86 CET feature property, so every program that loads it will run without Shadow Stack under the change tracked in bug 2458434.

Cause: CMake compiles lib/decompress/huf_decompress_amd64.S as the ASM language, which takes flags from ASMFLAGS / CMAKE_ASM_FLAGS rather than CFLAGS. %set_build_flags does not export ASMFLAGS, so the file is built without -fcf-protection, <cet.h> emits no .note.gnu.property, and the linker drops IBT/SHSTK for the whole library. Rebuilding the current SRPM with -Wl,-z,cet-report=warning reports only:
    lib/libzstd.a(huf_decompress_amd64.S.o): warning: missing IBT and SHSTK properties

Reproducible: Always

Steps to Reproduce:
1. podman run --rm -it fedora:rawhide bash
2. dnf -y install binutils annobin-annocheck
3. readelf -n /usr/lib64/libzstd.so.1.5.7 | grep 'x86 feature'; annocheck -f /usr/lib64/libzstd.so.1
Actual Results:
Properties: x86 feature used: x86, XMM
(no "x86 feature: IBT, SHSTK" line)
annocheck: FAIL: cf-protection test because no .note.gnu.property section
annocheck: FAIL: property-note test because the .note.gnu.property section does not show CET as being enabled

Expected Results:
Properties: x86 feature: IBT, SHSTK  (as in zstd-1.5.7-2.fc43, where annocheck reports PASS)

Additional Information:
Regression range: the marking was lost when the package switched to CMake in 1.5.7-3 (bz#2088517).
- zstd-1.5.7-2.fc43: "x86 feature: IBT, SHSTK"; annocheck PASS (F43 is unaffected)
- zstd-1.5.7-3.fc44 (first CMake build): no x86 feature property
- zstd-1.5.7-6.fc45 (current Rawhide): no x86 feature property; annocheck FAIL

Impact: in a static scan of a Fedora 45 container image with a general-purpose package set, libzstd.so.1 was the most common reason a program could not run with Shadow Stack: it blocked 81 of the 97 blocked programs. With the fixed library swapped in, 73 of those 81 become ready; the other 8 also depend on libgnutls (bug 2458657) or libunwind (bug 2458478).

History: this is the third time libzstd has lost CET marking in Fedora (bug 1839611 in 2020, bug 2039353 in 2022). Upstream issue for the CMake build: https://github.com/facebook/zstd/issues/4535

Proposed fix (pull request to follow): in %build, before the %cmake calls:
    export ASMFLAGS="%{build_cflags}"
Tested in fedora:rawhide: builds, no cet-report warnings, libzstd.so.1.5.7 shows "x86 feature: IBT, SHSTK", and %check passes (ctest 4/4).
A narrower alternative is -DCMAKE_ASM_FLAGS="-fcf-protection" on both %cmake calls; I'm happy to use whichever the maintainer prefers.

Disclosure: I used AI tools (Claude) to help analyze and draft this; I verified the results above myself.

Comment 1 Rajeev Shrestha 2026-11-23 05:08:54 UTC
Created attachment 2164076 [details]
Proposed fix: export ASMFLAGS in %build

Attached the proposed fix as a git patch against the rawhide branch (Release bumped to 7, changelog entry added). I'll also open a pull request on src.fedoraproject.org once my SSH key is active.

Comment 2 Rajeev Shrestha 2026-11-23 07:02:59 UTC
Pull request with the fix: https://src.fedoraproject.org/rpms/zstd/pull-request/10

Comment 3 Fedora Update System 2026-11-24 21:37:29 UTC
FEDORA-2026-69eed7f7f3 (zstd-1.6.0-1.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-69eed7f7f3

Comment 4 Fedora Update System 2026-11-24 21:37:34 UTC
FEDORA-2026-679c43d99e (zstd-1.6.0-1.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-679c43d99e

Comment 5 Fedora Update System 2026-11-24 21:47:06 UTC
FEDORA-2026-449d387f09 (zstd-1.6.0-1.fc46) has been submitted as an update to Fedora 46.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-449d387f09

Comment 6 Fedora Update System 2026-11-25 15:29:53 UTC
FEDORA-2026-449d387f09 (zstd-1.6.0-1.fc46) has been pushed to the Fedora 46 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2026-11-26 02:38:45 UTC
FEDORA-2026-69eed7f7f3 has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-69eed7f7f3`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-69eed7f7f3

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2026-11-26 03:01:51 UTC
FEDORA-2026-679c43d99e has been pushed to the Fedora 45 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-679c43d99e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-679c43d99e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2026-11-27 01:48:11 UTC
FEDORA-2026-679c43d99e (zstd-1.6.0-1.fc45) has been pushed to the Fedora 45 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2026-11-27 02:07:19 UTC
FEDORA-2026-69eed7f7f3 (zstd-1.6.0-1.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.