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 2055464

Summary: Not all exported symbols are present in RPM "Provides:" tags
Product: Red Hat Enterprise Linux 9 Reporter: Eugene Syromiatnikov <esyr>
Component: kernel-srpm-macrosAssignee: Eugene Syromiatnikov <esyr>
Status: CLOSED ERRATA QA Contact: Ziqian SUN (Zamir) <zsun>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: jstodola
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: kernel-srpm-macros-1.0-11.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 13:05:26 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 Eugene Syromiatnikov 2022-02-17 03:10:05 UTC
Description of problem:

Some symbols

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

How reproducible:
With some effort.

Steps to Reproduce:
1. Check that a kernel module exports symbols: 
    $ zgrep drivers/net/net_failover /boot/symvers-5.14.0-60.kpq0.el9.ppc64le.gz
    0x276ca9dc	net_failover_destroy	drivers/net/net_failover	EXPORT_SYMBOL_GPL	
    0xbbd68512	net_failover_create	drivers/net/net_failover	EXPORT_SYMBOL_GPL	

2. Check the package it is related to: 
    $ rpm -qf /lib/modules/5.14.0-60.kpq0.el9.ppc64le/kernel/drivers/net/net_failover.ko.xz 
    $ kernel-core-5.14.0-60.kpq0.el9.ppc64le

3. Check the generated "Provides:" tags for the package:
    $ rpm  -q --provides kernel-core-5.14.0-60.kpq0.el9.ppc64le | grep -f <(zgrep drivers/net/net_failover /boot/symvers-5.14.0-60.kpq0.el9.ppc64le.gz| cut -f2 -d'  '|sed 's/^/kernel(/; s/$/)/')

Actual results:
None of the exported symbols present.

Expected results:
All of the exported symbols present, like for some other kmods:
    $ rpm  -q --provides kernel-core-5.14.0-60.kpq0.el9.ppc64le | grep -f <(zgrep drivers/scsi/libiscsi  /boot/symvers-5.14.0-60.kpq0.el9.ppc64le.gz| cut -f2 -d'     '|sed 's/^/kernel(/; s/$/)/')
    kernel(__iscsi_complete_pdu) = 0xd81bb5cf
    kernel(__iscsi_get_task) = 0xfc8aedeb
    kernel(__iscsi_put_task) = 0xf8378ded
    kernel(iscsi_complete_pdu) = 0xe9a4c8b6
    kernel(iscsi_complete_scsi_task) = 0x778766fe

Additional info:
It seems that the bug is a result of a change in binutils[1] that unraveled the fact that ".rodata" sections in some *.ko files are read-write and not read-only, which changed the symbol type printed by nm 2.35 and newer for __crc_* symbols on the architectures with MODULE_REL_CRCS (namely, ppc64* and s390*) from 'R' to 'D' for these *.ko files.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=49d9fd42acef

Comment 4 Eugene Syromiatnikov 2022-02-17 22:08:31 UTC
A kernel built against the updated kernel-srpm-macros version shows only the following discrepancies between Provides: and symvers:

--->8---
$ comm -3 <(rpm -qp --provides kernel-core-5.14.0-60.kpq0.el9.ppc64le.rpm kernel-modules*rpm | cut -f 1 -d' ' | sed -n 's/)$//; s/^kernel(//p' | sort -u) <(zcat $(rpm2cpio kernel-core-5.14.0-60.kpq0.el9.ppc64le.rpm | cpio --quiet -uidmv '*symvers*' 2>&1) | cut -f2 -d'      ' | sort -u)
        stutter_wait
        torture_cleanup_begin
        torture_cleanup_end
        _torture_create_kthread
        torture_hrtimeout_jiffies
        torture_hrtimeout_ms
        torture_hrtimeout_ns
        torture_hrtimeout_s
        torture_hrtimeout_us
        torture_init_begin
        torture_init_end
        torture_kthread_stopping
        torture_must_stop
        torture_must_stop_irq
        torture_num_online_cpus
        torture_offline
        torture_online
        torture_onoff_failures
        torture_onoff_init
        torture_onoff_stats
        torture_random
        torture_shuffle_init
        torture_shuffle_task_register
        torture_shutdown_absorb
        torture_shutdown_init
        _torture_stop_kthread
        torture_stutter_init
        verbose_torout_sleep
---8<---

They all stemmed from internal/kernel/torture.ko, part of kernel-modules-internal, and it's due to the fact that find-provides.ksyms currently generates kernel() provides only for kmods under /lib/modules/KERNEL_VERION/kernel and not /lib/modules/KERNEL_VERION/internal.  It's a separate issue and I'm not yet quite confident whether it's an issue on the generator's side.  Otherwise, there are no discrepancies:

---8<---
$ comm -3 <(rpm -qp --provides kernel-core-5.14.0-60.kpq0.el9.ppc64le.rpm kernel-modules*rpm | cut -f 1 -d' ' | sed -n 's/)$//; s/^\(kernel\|ksym\)(//p' | sort -u) <(zcat $(rpm2cpio kernel-core-5.14.0-60.kpq0.el9.ppc64le.rpm | cpio --quiet -uidmv '*symvers*' 2>&1) | cut -f2 -d'    ' | sort -u) | wc -l
0
--->8---

I've sent a scratch build[1] against the new kernel-srpm=-macros, but it's not finished yet.

[1] https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=43155006

Comment 5 Eugene Syromiatnikov 2022-02-21 17:30:11 UTC
More precisely, the actual offending nm change is [1] (as it gave priority to decode_section_type() which generates section type character based on section flags), [2] restored the call order (so special section name processing implemented in coff_section_type() takes priority again) along with removal of special handling of ".rodata" (so the observable behaviour remained to be changed). Notably, 2.34 patch backport[3] doesn't remove the ".rodata" handling, only restores the call order, so there seems to be some back-and-forth in nm's behaviour in 2.32—2.35 in that respect.

[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=a288c270991d
[2] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=49d9fd42acef
[3] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=40bfb9762747

Comment 13 errata-xmlrpc 2022-05-17 13:05:26 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: kernel-srpm-macros), 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:2452