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 1617902

Summary: [Cavium 7.5 Bug] find-debuginfo.sh generates blank debuginfo rpm
Product: Red Hat Enterprise Linux 7 Reporter: Nilesh Javali <nilesh.javali>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 7.5CC: cdupuis, craig.lamparter, ffesti, girish.basrur, manish.rangankar, nilesh.javali, packaging-team-maint, pmatilai, pmoravco, rick.beldin, sarang.radke
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-08-26 13:50:15 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:
Attachments:
Description Flags
fastlinq src rpm none

Description Nilesh Javali 2018-08-16 06:52:36 UTC
Created attachment 1476365 [details]
fastlinq src rpm

Description of problem:
debuginfo rpm generated has no contents in it and is blank.

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

How reproducible:
100%, always reproducible on all RHEL OS versions.

Steps to Reproduce:
1. Use QLogic fastlinq spec to generate debuginfo rpm
2. At the end of command "rpmbuild -ba fastlinq-7.x.spec", the debuginfo rpm generated is blank

Actual results:
The debuginfo rpm generated is blank.

Expected results:
The debuginfo rpm must contain valid debug enabled .ko and source. 

Additional info:
1. I suspect issue in find-debuginfo.sh below,
find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \
                    \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \
                    -print |
file -N -f - | sed -n -e 's/^\(.*\):[  ]*.*ELF.*, not stripped.*/\1/p' |
xargs --no-run-if-empty stat -c '%h %D_%i %n' |

2. By changing the above line to as below, the debuginfo rpm was built successfully with proper contents,
find $RPM_BUILD_ROOT ! -path "${debugdir}/*.debug" -type f \( -perm /111 -or -name "*.so*" -or -name "*.ko" \) ! -name "*.a" -print0 | sort -z |
xargs --no-run-if-empty -0 stat -c '%h %D_%i %n' |

3. I'm not sure if this is correct way to fix the line in point 1. Please review.

Comment 2 Pavlina Moravcova Varekova 2018-08-20 14:37:36 UTC
In Packaging:Debuginfo (https://fedoraproject.org/wiki/Packaging:Debuginfo) 
is written:

  "find-debuginfo.sh processes only files that are executable when it's run;
   for practical purposes one can assume that happens under the hood after
   the %install section. Make sure that all ELF binaries (executables,
   shared libraries, DSO's) are executable at end of %install."

This Fedora documentation applies to RHEL as well.

Thus it is intentional that .ko and source files are omitted if they are not 
executable when find-debuginfo.sh is run (at end of %install). So you can add 
executable bit on the files in the %install section and remove the executable 
bit again in the %post section if this is desired.

Comment 3 Sarang Radke 2018-08-22 20:09:03 UTC
Hi Pavlina,

As suggested we tried making the binary .ko executable. Doing this does generate a meaningful debuginfo RPM. However, this is also introducing another error.

All our binaries are UEFI Signed in order to support secure boot. It is noticed that if the modules are made executable, the signature is stripped out of the binary. Can you help us understand why it might be happening and if there is anyway we could avoid it.

Comment 4 Pavlina Moravcova Varekova 2018-08-26 13:50:15 UTC
I am not familiar with UEFI Signing. Only two ideas come to my mind. The problem can be caused by ordering of adding +x and creating the signature (can you switch the order)? Or maybe instead of adding and removing +x flag you can: 
 - in %install phase: create backup directory, copy all source + .ko files into it and after that add +x to the original source + .ko files.
 - in %post phase: replace the source + .ko files with x permissions by the "backups"        

Because this looks like a support request and it does not refer to a bug in rpm, I will close this bugzilla. If you need more guidance/support, you can create a support case via Red Hat customer portal.

Comment 5 Panu Matilainen 2018-08-27 06:15:42 UTC
If stripping breaks the binaries then it's more productive to just disable debuginfo generation than fight it. Adding this to the spec should do it:

%define debug_package %{nil}

Comment 6 Sarang Radke 2018-10-03 23:35:28 UTC
Hi Panu,

The reason of opening this bug was to have a meaningful debuginfo RPM generated. So disabling its generation would not solve that problem.

So far in my attempts, signature is getting stripped off if I am able to get the correct debuginfo RPM.

Do you have any other suggestions that I can try?

Comment 7 craig 2018-11-26 14:54:18 UTC
I'm keenly interested in this as well, as we need signed debuginfo objects and signed stripped objects.

Comment 8 Florian Festi 2020-07-23 15:21:28 UTC
I just realized this has still NEEDINFO set although is is closed.

In case anyone is still interested:

The files are stripped in %__os_install_post executed at the end of %install and defined in /usr/lib/rpm/platform/*/macros
By re-defining those this macro you should be able to re-sign those files aber they have been mangled by the debug-info machinery.