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 1956998

Summary: annocheck reports that pigz is compiled without -fstack-protector-strong, -D_FORTIFY_SOURCE=2, and -fPIE/-fPIC
Product: Red Hat Enterprise Linux 9 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: pigzAssignee: Prarit Bhargava <prarit>
Status: CLOSED ERRATA QA Contact: Robin Hack <rhack>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: bnater, hwkernel-mgr, jjaburek, jpazdziora, lpol, prarit, qe-baseos-daemons, rhack, rlemosor
Target Milestone: betaKeywords: TestCaseNotNeeded, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pigz-2.5-4.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 15:52:50 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:
Bug Depends On:    
Bug Blocks: 2044387    

Description Jan Pazdziora (Red Hat) 2021-05-04 20:04:32 UTC
Description of problem:

Running annocheck on pigz reports that binaries in /usr/bin were compiled without stack protector and without position independent code.

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

pigz-2.5-2.el9.x86_64

How reproducible:

Deterministic

Steps to Reproduce:
1. rpm -ql pigz | xargs annocheck -v --ignore-gaps | grep FAIL:

Actual results:

Hardened: /usr/bin/unpigz: FAIL: pie test because not linked with -Wl,-pie 
Hardened: /usr/bin/unpigz: FAIL: bind-now test because not linked with -Wl,-z,now 
Hardened: /usr/bin/unpigz: FAIL: stack-prot test because stack protection deliberately disabled (addr range: 0x403580..0x403585) 
Hardened: /usr/bin/pigz: FAIL: pie test because not linked with -Wl,-pie 
Hardened: /usr/bin/pigz: FAIL: bind-now test because not linked with -Wl,-z,now 
Hardened: /usr/bin/pigz: FAIL: stack-prot test because stack protection deliberately disabled (addr range: 0x403580..0x403585) 

Expected results:

No FAILs reported by annocheck.

Additional info:

Comment 6 Jan Pazdziora (Red Hat) 2021-10-05 20:11:29 UTC
Any reason why the Makefile sets its own flags rather than using the defaults from rpm macros, for example via %{optflags}, per https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc?

Comment 7 Jan Pazdziora (Red Hat) 2021-10-06 14:58:45 UTC
This document might also be useful: https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/buildflags.md.

I see that pigz.spec already does

  %make_build CFLAGS="$RPM_OPT_FLAGS"

so it might be just a matter of using

  %make_build CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"

or

  %make_build CFLAGS="%{build_cflags}" LDFLAGS="%{build_ldflags}"

Comment 8 Prarit Bhargava 2021-10-06 17:58:40 UTC
(In reply to Jan Pazdziora from comment #7)
> This document might also be useful:
> https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/
> buildflags.md.
> 
> I see that pigz.spec already does
> 
>   %make_build CFLAGS="$RPM_OPT_FLAGS"
> 
> so it might be just a matter of using
> 
>   %make_build CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS"
> 
> or
> 
>   %make_build CFLAGS="%{build_cflags}" LDFLAGS="%{build_ldflags}"

Yep.  My above comment was kind of to myself :)

P.

Comment 9 Prarit Bhargava 2021-10-06 19:46:05 UTC
QE: This is a small change.  Before these changes,

[03:40 PM root@intel-purley-04 SPECS]# rpm -ivh pigz-2.5-3.el9.x86_64.rpm
[03:40 PM root@intel-purley-04 SPECS]# rpm -ql pigz | xargs annocheck -v --ignore-gaps | grep FAIL: | grep pigz

<snip>
Hardened: /usr/bin/pigz: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) 
Hardened: /usr/bin/pigz: FAIL: bind-now test because not linked with -Wl,-z,now 
Hardened: /usr/bin/unpigz: FAIL: pie test because not built with '-Wl,-pie' (gcc/clang) or '-buildmode pie' (go) 
Hardened: /usr/bin/unpigz: FAIL: bind-now test because not linked with -Wl,-z,now 
<snip>

Note, you will see warnings from static /usr/lib/.build-id/ files.  These are okay.

After the change

[03:43 PM root@intel-purley-04 SPECS]# rpm -ivh pigz-2.5-4.el9.x86_64.rpm
[03:43 PM root@intel-purley-04 SPECS]# rpm -ql pigz | xargs annocheck -v --ignore-gaps | grep FAIL: | grep pigz

You will not see any warnings from /usr/bin/pigz.

QE can you set ITM and provide qa_ack?

Thanks,

P.

Comment 10 Prarit Bhargava 2021-10-11 23:21:51 UTC
QE?  ping?

P.

Comment 21 errata-xmlrpc 2022-05-17 15:52:50 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: pigz), 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/RHBA-2022:3944