From 24312e21be3acc25e7c1d0108368bd177d1f2363 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Thu, 17 Feb 2022 04:41:45 +0100 Subject: [PATCH] find-provides.ksyms, find-requires.ksyms: work around printed __crc_* type change Commit binutils-2_33~1385[1] has changed (and binutils-2_35~1768[2] has not reverted) the calculated type for symbols in read-write .rodata section from 'R' to 'D' on architectures where CONFIG_MODULE_REL_CRCS is enabled (namely, ppc64* and s390*), since, apparently, many kernel modules have it indeed read-write. Work around it by matching both D and R as possible __crc_* symbol type. [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 * find-provides.ksyms: Match D as possible __crc_* symbol type in addition to R. * find-requires.ksyms: Likewise. * kernel-srpm-macros.spec (Release): Bump to 11%{?dist}. (%changelog): Mention the change. Resolves: #2055464 Signed-off-by: Eugene Syromiatnikov --- find-provides.ksyms | 9 ++++++++- find-requires.ksyms | 9 ++++++++- kernel-srpm-macros.spec | 7 ++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/find-provides.ksyms b/find-provides.ksyms index af98b90..92d6220 100755 --- a/find-provides.ksyms +++ b/find-provides.ksyms @@ -45,7 +45,14 @@ for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do else RODATA=$ELFRODATA fi - for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do + # Commit binutils-2_33~1385[1] has changed (and binutils-2_35~1768[2] + # has not reverted it) the calculated type for symbols in read-write + # .rodata section from 'R' to 'D', since, apparently, many kernel + # modules have it indeed read-write. + # + # [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 + for sym in $(nm $module | sed -r -ne 's:^0*([0-9a-f]+) [DR] __crc_(.+):0x\1 \2:p'); do echo $sym $RODATA done \ | awk --non-decimal-data '{printf("'"${dep_pfx}"'(%s) = 0x%08s\n", $2, substr($3,($1*2)+1,8))}' \ diff --git a/find-requires.ksyms b/find-requires.ksyms index 533fac0..78a2105 100755 --- a/find-requires.ksyms +++ b/find-requires.ksyms @@ -46,7 +46,14 @@ all_provides() { else RODATA=$ELFRODATA fi - for sym in $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) R __crc_(.+):0x\1 \2:p'); do + # Commit binutils-2_33~1385[1] has changed (and binutils-2_35~1768[2] + # has not reverted it) the calculated type for symbols in read-write + # .rodata section from 'R' to 'D', since, apparently, many kernel + # modules have it indeed read-write. + # + # [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 + for sym in $(nm "$module" | sed -r -ne 's:^0*([0-9a-f]+) [DR] __crc_(.+):0x\1 \2:p'); do echo $sym $RODATA done \ | awk --non-decimal-data '{printf("%s:0x%08s\n", $2, substr($3,($1*2)+1,8))}' diff --git a/kernel-srpm-macros.spec b/kernel-srpm-macros.spec index 54cb3f1..5500b0a 100644 --- a/kernel-srpm-macros.spec +++ b/kernel-srpm-macros.spec @@ -1,6 +1,6 @@ Name: kernel-srpm-macros Version: 1.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: RPM macros that list arches the full kernel is built on # This package only exist in Fedora repositories # The license is the standard (MIT) specified in @@ -121,6 +121,11 @@ install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" modalias.attr %{rrcdir}/find-provides.d/modalias.prov %changelog +* Thu Feb 17 2022 Eugene Syromiatnikov - 1.0-11 +- Work around a change in type of __crc_* symbols for some kmods printed by nm + on ppc64le and s390x +- Resolves: #2055464 + * Thu Nov 18 2021 Eugene Syromiatnikov - 1.0-10 - Add conflicts of kernel-srpm-macros with kernel-rpm-macros < 185-9 as macros.kmp, kmodtool, and rpmsort were moved from the latter