diff --git a/SOURCES/find-provides.ksyms b/SOURCES/find-provides.ksyms deleted file mode 100755 index 6b676e5..0000000 --- a/SOURCES/find-provides.ksyms +++ /dev/null @@ -1,91 +0,0 @@ -#! /bin/bash - -IFS=$'\n' -export LC_ALL=C - -# Prevent elfutils from trying to download debuginfos -unset DEBUGINFOD_URLS - - -for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do - dep_pfx="ksym" - # For built-in kmods, "kernel()" syntax is used instead of "ksym()" - printf "%s" "$module" | grep -v "^${RPM_BUILD_ROOT}/\?lib/modules/[1-9][^/]*/kernel" > /dev/null \ - || dep_pfx="kernel" - - tmpfile="" - if [ "x${module%.ko}" = "x${module}" ]; then - tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko) - proc_bin= - case "${module##*.}" in - zst) - proc_bin=zstd - ;; - xz) - proc_bin=xz - ;; - bz2) - proc_bin=bzip2 - ;; - gz) - proc_bin=gzip - ;; - esac - - [ -n "$proc_bin" ] || continue - - "$proc_bin" -d -c - < "$module" > "$tmpfile" || continue - module="$tmpfile" - fi - - # awk script return code: - # 0 - absolute __crc_* symbols have been found, output has been - # generated; - # 23 - a non-absolute __crc_* symbold has been found; - # 42 - no __crc_* symbols have been found. - nm "$module" \ - | awk \ - -v 'dep_pfx='"$dep_pfx" \ - --non-decimal-data \ - 'BEGIN { exit_code = 42 } - match($0, /^([0-9a-f]+) (.) __crc_(.+)/, a) { - if (a[2] == "A") { - printf("%s(%s) = 0x%08x\n", dep_pfx, a[3], strtonum("0x" a[1])); - exit_code = 0; - } else { - exit_code = 23; - exit; - } - } - END { exit exit_code }' - - [ 23 = "$?" ] && { - kmod_elf_hdr="$(readelf -h "$module")" - [ "x$kmod_elf_hdr" = "x${kmod_elf_hdr%Data:*little endian*}" ] - revbytes="$?" - - objdump -t "$module" \ - | awk \ - -v 'dep_pfx='"$dep_pfx" \ - -v 'module='"$module" \ - -v 'revbytes='"$revbytes" \ - --non-decimal-data \ - 'function readsect(name, a, t) { - a = ""; - while (("readelf -R \"" name "\" \"" module "\"" | getline t) > 0) { - if (match(t, /^ 0x[0-9a-f]{8}/)) - a = a substr(t, 14, 8) substr(t, 23, 8) substr(t, 32, 8) substr(t, 41, 8); - } - if (revbytes) { a = gensub(/(..)(..)(..)(..)/, "\\4\\3\\2\\1", "g", a); } - sectdata[name] = a; - } - - match($0, /^([0-9a-f]+) [gl]...... (.*) [0-9a-f]+ __crc_(.*)$/, a) { - if (!(a[2] in sectdata)) { readsect(a[2]) } - printf("%s(%s) = 0x%08s\n", dep_pfx, a[3], substr(sectdata[a[2]], (strtonum("0x" a[1]) * 2) + 1, 8)) - }' - } - - [ -z "$tmpfile" ] || rm -f -- "$tmpfile" -done \ -| sort -k1,1 -u diff --git a/SOURCES/kmod.attr b/SOURCES/kmod.attr deleted file mode 100644 index 23b1289..0000000 --- a/SOURCES/kmod.attr +++ /dev/null @@ -1,31 +0,0 @@ -%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz|.*\.ko\.zst)$ -%__kmod_provides() %{lua: - function basename(fn) - return string.gsub(fn, "(.*/)(.*)", "%2") - end - function strip_compress_sfx(fn) - return string.gsub(fn, "(.*)(\.gz|\.bz2|\.xz|\.zst)?$", "%1") - end - function printdep(mod) - print("kmod("..mod..") ") - end - local fn = rpm.expand("%{1}") - local bn = basename(fn) - if bn == "modules.builtin" then - for l in io.lines(fn) do - local builtin_mod = basename(l) - printdep(builtin_mod) - if strip_compress_sfx(builtin_mod) ~= builtin_mod then - printdep(strip_compress_sfx(builtin_mod)) - end - end - else - local mod = string.match(bn, "%g+.ko") - if mod then - printdep(mod) - if strip_compress_sfx(mod) ~= mod then - printdep(strip_compress_sfx(mod)) - end - end - end -} diff --git a/SOURCES/modalias.prov b/SOURCES/modalias.prov deleted file mode 100644 index 6408a6e..0000000 --- a/SOURCES/modalias.prov +++ /dev/null @@ -1,78 +0,0 @@ -#! /bin/bash -efu - -# heavily based upon find-suggests.ksyms by Andreas Gruenbacher . -# with modifications by Michael Brown -# -# -- added module versioning info to modalias() symbols -# -- removed code which inspects spec files. - -IFS=$'\n' - -# -# Initially, dont generate modalias() lines for kernel package. This needs -# additional discussion. Would like to eventually add them for -# completeness, so that we can determine when drivers are folded into -# mainline kernel. -# -is_kernel_package="" -case "${1:-}" in -kernel-module-*) ;; # Fedora kernel module package names start with - # kernel-module. -kernel*) is_kernel_package=1 ;; -esac - -if ! [ -z "$is_kernel_package" ]; then - cat > /dev/null - exit 0 -fi - -# Check for presence of the commands used -which /sbin/modinfo >/dev/null || exit 0 -which sed >/dev/null || exit 0 -which sort >/dev/null || exit 0 - -print_modaliases() { - declare class=$1 variants=$2 pos=$3 - if [ -n "$variants" ]; then - echo "${class:0:pos}[$variants]${class:pos+1}" - else - [ -z "$class" ] || echo "$class" - fi -} - -combine_modaliases() { - declare tag class variants="" pos="" n - read class - while read tag; do - for ((n=0; n<${#class}; n++)); do - if [ "*" != "${class:n:1}" -a \ - "${class:0:n}" = "${tag:0:n}" -a \ - "${class:n+1}" = "${tag:n+1}" ] && - ( [ -z "$pos" ] || [ $n = $pos ] ); then - variants="${variants:-${class:n:1}}${tag:n:1}" - pos=$n - break - fi - done - if [ $n -eq ${#class} ]; then - print_modaliases "$class" "$variants" "$pos" - variants= - pos= - class=$tag - fi - done - print_modaliases "$class" "$variants" "$pos" -} - -for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do - # | head -n1 because some modules have *two* version tags. *cough*b44*cough* - modver=$(/sbin/modinfo -F version "$module"| head -n1) - modver=${modver//[^0-9a-zA-Z._]/_} - # only add version tag if it has a version - [ -z "$modver" ] || modver=" = $modver" - - /sbin/modinfo -F alias "$module" \ - | sed -nre "s,[^][0-9a-zA-Z._:*?/-],_,g; s,(.+),modalias(\\1)$modver,p" -done \ -| sort -u \ -| combine_modaliases diff --git a/SOURCES/brp-kmod-restore-perms b/brp-kmod-restore-perms similarity index 100% rename from SOURCES/brp-kmod-restore-perms rename to brp-kmod-restore-perms diff --git a/SOURCES/brp-kmod-set-exec-bit b/brp-kmod-set-exec-bit similarity index 100% rename from SOURCES/brp-kmod-set-exec-bit rename to brp-kmod-set-exec-bit diff --git a/find-provides.ksyms b/find-provides.ksyms new file mode 100755 index 0000000..230fc09 --- /dev/null +++ b/find-provides.ksyms @@ -0,0 +1,138 @@ +#! /bin/bash + +IFS=$'\n' +export LC_ALL=C + +# Prevent elfutils from trying to download debuginfos +unset DEBUGINFOD_URLS + +for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do + dep_pfx="ksym" + # For built-in kmods, "kernel()" syntax is used instead of "ksym()" + printf "%s" "$module" | grep -v "^${RPM_BUILD_ROOT}/\?lib/modules/[1-9][^/]*/kernel" > /dev/null \ + || dep_pfx="kernel" + + tmpfile="" + if [ "x${module%.ko}" = "x${module}" ]; then + tmpfile=$(mktemp -t ${0##*/}.XXXXXX.ko) + proc_bin= + case "${module##*.}" in + zst) + proc_bin=zstd + ;; + xz) + proc_bin=xz + ;; + bz2) + proc_bin=bzip2 + ;; + gz) + proc_bin=gzip + ;; + esac + + [ -n "$proc_bin" ] || continue + + "$proc_bin" -d -c - < "$module" > "$tmpfile" || continue + module="$tmpfile" + fi + + # A modversion can be stored as an ELF symbol in various ways: + # - An immediate symbol whose value is available directly; it shows up + # in the nm or objdump -t output, for example: + # $ nm mlx5_core_5.14.x86_64.ko | grep '__crc_' | head -n 3 + # 0000000092f175ca A __crc_mlx5_access_reg + # 000000005b88c9f1 A __crc_mlx5_add_flow_rules + # 00000000e7c0ec8a A __crc_mlx5_alloc_bfreg + # $ objdump -t lib/modules/mlx5_core_5.14.x86_64.ko | grep __crc_ | sort -k 5,5 | head -n 3 + # 0000000092f175ca g *ABS* 0000000000000000 __crc_mlx5_access_reg + # 000000005b88c9f1 g *ABS* 0000000000000000 __crc_mlx5_add_flow_rules + # 00000000e7c0ec8a g *ABS* 0000000000000000 __crc_mlx5_alloc_bfreg + # $ zgrep mlx5_access_reg ./lib/modules/5.14.0-284.15.1.el9_2.x86_64/symvers.gz + # 0x92f175ca mlx5_access_reg drivers/net/ethernet/mellanox/mlx5/core/mlx5_core EXPORT_SYMBOL_GPL + # This approach was being used on x86 and arm before Linux 5.19, + # for example. + # + # - A globally or locally visible symbol in a read-only (or not; + # sometimes .rodata is not a read-only section, after all, as binutils + # commit binutils-2_33~1385 has revealed (and binutils-2_35~1768 hasn't + # concealed back)) section (historically .rodata, __kcrctab/__kcrctab_gpl + # since Linux v5.19-rc1~139^2~2): + # $ nm mlx5_core_5.14.s390x.ko | grep '__crc_' | head -n 3 + # 0000000000002f7c R __crc_mlx5_access_reg + # 0000000000003304 R __crc_mlx5_add_flow_rules + # 0000000000002d2c R __crc_mlx5_alloc_bfreg + # This layout is used on ppc since Linux v4.10-rc7~15^2~1, for example, + # and on all architectures since Linux 5.19. To extract the symbol + # versions in this case, we get the offset and the section name + # from the "objdump -t" output: + # $ objdump -t lib/modules/mlx5_core_5.14.s390x.ko | grep '__crc_' | sort -k 5,5 | head -n 2 + # 0000000000002f7c g .rodata 0000000000000000 __crc_mlx5_access_reg + # 0000000000003304 g .rodata 0000000000000000 __crc_mlx5_add_flow_rules + # and the section contents from the "readelf -R" call: + # $ readelf -R .rodata mlx5_core_5.14.s390x.ko + # [... skipped output ...] + # 0x00002f70 6c6f635f 6e6f6465 00000000 ed6560a8 loc_node.....e`. + # ^^^^^^^^ + # comparison with the contents + # of lib/modules/5.14.0-284.15.1.el9_2.s390x/symvers.gz corroborates + # its correctness: + # 0xed6560a8 mlx5_access_reg drivers/net/ethernet/mellanox/mlx5/core/mlx5_core EXPORT_SYMBOL_GPL + # As mentioned earlier, for the later kernel versions, __kcrctab{,_gpl} + # sections are used: + # $ objdump -t lib/modules/mlx5_core_6.4.x86_64.ko | grep '__crc_' | sort -k 5,5 | head -n 2 + # 0000000000000000 l __kcrctab_gpl 0000000000000000 __crc_mlx5_access_reg + # 0000000000000090 l __kcrctab 0000000000000000 __crc_mlx5_add_flow_rules + # $ readelf -R __kcrctab_gpl mlx5_core_6.4.x86_64.ko + # 0x00000000 38b0d3c3 1840ce35 b99babc7 70b4700c 8....@.5....p.p. + # ^^^^^^^^ + # and in lib/modules/6.4.0-0.rc1.20230511git80e62bc8487b.19.eln126.x86_64/symvers.xz + # we see that it is correct (when accounted for the little endianness): + # 0xc3d3b038 mlx5_access_reg drivers/net/ethernet/mellanox/mlx5/core/mlx5_core EXPORT_SYMBOL_GPL + # This data, after some post-processing, can be used in the awk script + # that extracts parts of the section according to the offsets got + # from the "objdump -t" output. + objdump -t "$module" \ + | awk \ + -v 'dep_pfx='"$dep_pfx" \ + -v 'module='"$module" \ + --non-decimal-data \ + 'BEGIN { revbytes = 0 } + + function check_endianness( t) { + if (revbytes) return revbytes; + + revbytes = -1; + while (("readelf -h \"" module "\"" | getline t) > 0) { + if (match(t, /^ Data: *2\047s complement, little endian$/)) { + revbytes = 1; + break; + } + } + + return revbytes; + } + + function readsect(name, a, t) { + a = ""; + while (("readelf -R \"" name "\" \"" module "\"" | getline t) > 0) { + if (match(t, /^ 0x[0-9a-f]{8}/)) + a = a substr(t, 14, 8) substr(t, 23, 8) substr(t, 32, 8) substr(t, 41, 8); + } + if (check_endianness() == 1) + a = gensub(/(..)(..)(..)(..)/, "\\4\\3\\2\\1", "g", a); + sectdata[name] = a; + } + + match($0, /^([0-9a-f]+) [gl]...... (.*) [0-9a-f]+ __crc_(.*)$/, a) { + if (a[2] == "*ABS*") { + printf("%s(%s) = 0x%08x\n", dep_pfx, a[3], strtonum("0x" a[1])); + } else { + if (!(a[2] in sectdata)) { readsect(a[2]) } + printf("%s(%s) = 0x%08s\n", dep_pfx, a[3], substr(sectdata[a[2]], (strtonum("0x" a[1]) * 2) + 1, 8)) + } + }' + + [ -z "$tmpfile" ] || rm -f -- "$tmpfile" +done \ +| sort -k1,1 -u diff --git a/SOURCES/find-requires.ksyms b/find-requires.ksyms old mode 100644 new mode 100755 similarity index 72% rename from SOURCES/find-requires.ksyms rename to find-requires.ksyms index eac4010..8ac7c40 --- a/SOURCES/find-requires.ksyms +++ b/find-requires.ksyms @@ -11,7 +11,6 @@ export LC_ALL=C # Prevent elfutils from trying to download debuginfos unset DEBUGINFOD_URLS - # Extract all of the symbols provided by this module. all_provides() { for module in "$@"; do @@ -40,53 +39,45 @@ all_provides() { module="$tmpfile" fi - # awk script return code: - # 0 - absolute __crc_* symbols have been found, output has been - # generated; - # 23 - a non-absolute __crc_* symbold has been found; - # 42 - no __crc_* symbols have been found. - nm "$module" \ + objdump -t "$module" \ | awk \ - -v 'dep_pfx='"$dep_pfx" \ - --non-decimal-data \ - 'BEGIN { exit_code = 42 } - match($0, /^([0-9a-f]+) (.) __crc_(.+)/, a) { - if (a[2] == "A") { - printf("%s(%s) = 0x%08x\n", dep_pfx, a[3], strtonum("0x" a[1])); - exit_code = 0; - } else { - exit_code = 23; - exit; - } - } - END { exit exit_code }' + -v 'dep_pfx='"$dep_pfx" \ + -v 'module='"$module" \ + --non-decimal-data \ + 'BEGIN { revbytes = 0 } - [ 23 = "$?" ] && { - kmod_elf_hdr="$(readelf -h "$module")" - [ "x$kmod_elf_hdr" = "x${kmod_elf_hdr%Data:*little endian*}" ] - revbytes="$?" + function check_endianness( t) { + if (revbytes) return revbytes; - objdump -t "$module" \ - | awk \ - -v 'dep_pfx='"$dep_pfx" \ - -v 'module='"$module" \ - -v 'revbytes='"$revbytes" \ - --non-decimal-data \ - 'function readsect(name, a, t) { - a = ""; - while (("readelf -R \"" name "\" \"" module "\"" | getline t) > 0) { - if (match(t, /^ 0x[0-9a-f]{8}/)) - a = a substr(t, 14, 8) substr(t, 23, 8) substr(t, 32, 8) substr(t, 41, 8); + revbytes = -1; + while (("readelf -h \"" module "\"" | getline t) > 0) { + if (match(t, /^ Data: *2\047s complement, little endian$/)) { + revbytes = 1; + break; } - if (revbytes) { a = gensub(/(..)(..)(..)(..)/, "\\4\\3\\2\\1", "g", a); } - sectdata[name] = a; } - match($0, /^([0-9a-f]+) [gl]...... (.*) [0-9a-f]+ __crc_(.*)$/, a) { + return revbytes; + } + + function readsect(name, a, t) { + a = ""; + while (("readelf -R \"" name "\" \"" module "\"" | getline t) > 0) { + if (match(t, /^ 0x[0-9a-f]{8}/)) + a = a substr(t, 14, 8) substr(t, 23, 8) substr(t, 32, 8) substr(t, 41, 8); + } + if (revbytes) { a = gensub(/(..)(..)(..)(..)/, "\\4\\3\\2\\1", "g", a); } + sectdata[name] = a; + } + + match($0, /^([0-9a-f]+) [gl]...... (.*) [0-9a-f]+ __crc_(.*)$/, a) { + if (a[2] == "*ABS*") { + printf("%s(%s) = 0x%08x\n", dep_pfx, a[3], strtonum("0x" a[1])); + } else { if (!(a[2] in sectdata)) { readsect(a[2]) } printf("%s(%s) = 0x%08s\n", dep_pfx, a[3], substr(sectdata[a[2]], (strtonum("0x" a[1]) * 2) + 1, 8)) - }' - } + } + }' [ -z "$tmpfile" ] || rm -f -- "$tmpfile" done \ @@ -186,9 +177,12 @@ if [ ${#modules[@]} -gt 0 ]; then join -t $'\t' -j 1 -v 2 $symvers "$mod_req" | sort -u \ | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print "ksym(" $1 ") = " $2 }' - # Check kABI if the kabi-stablelists package is installed - # Do this last so we can try to output this error at the end - kabi_check_symbols=($(join -t $'\t' -j 1 $symvers "$mod_req" | sort -u \ - | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print $1 }')) - check_kabi "${kabi_check_symbols[@]}" + os_id=$(sed -nr '/^ID[[:space:]]*=/{ s/ID[[:space:]]*=[[:space:]]*//; s/^"(.*)"$/\1/; p }' /etc/os-release) + if [ "rhel" = "$os_id" ]; then + # Check kABI if the kabi-stablelists package is installed + # Do this last so we can try to output this error at the end + kabi_check_symbols=($(join -t $'\t' -j 1 $symvers "$mod_req" | sort -u \ + | awk 'BEGIN { FS = "[\t:]" ; OFS = "\t" } { print $1 }')) + check_kabi "${kabi_check_symbols[@]}" + fi fi diff --git a/SOURCES/firmware.prov b/firmware.prov similarity index 100% rename from SOURCES/firmware.prov rename to firmware.prov diff --git a/SOURCES/kabi.attr b/kabi.attr similarity index 100% rename from SOURCES/kabi.attr rename to kabi.attr diff --git a/SOURCES/kabi.sh b/kabi.sh similarity index 100% rename from SOURCES/kabi.sh rename to kabi.sh diff --git a/SPECS/kernel-srpm-macros.spec b/kernel-srpm-macros.spec similarity index 60% rename from SPECS/kernel-srpm-macros.spec rename to kernel-srpm-macros.spec index 76beedc..2829050 100644 --- a/SPECS/kernel-srpm-macros.spec +++ b/kernel-srpm-macros.spec @@ -1,6 +1,7 @@ Name: kernel-srpm-macros Version: 1.0 -Release: 13%{?dist} +# when bumping version and resetting release, don't forget to bump version of kernel-rpm-macros as well +Release: 25%{?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 @@ -10,10 +11,10 @@ License: MIT URL: https://src.fedoraproject.org/rpms/kernel-srpm-macros BuildArch: noarch # We are now the ones shipping kmod.attr -Conflicts: redhat-rpm-config <= 184 +Conflicts: redhat-rpm-config < 205 # macros.kmp, kmodtool and rpmsort were moved from kernel-rpm-macros # to kernel-srpm-macros in 1.0-9/185-9 -Conflicts: kernel-rpm-macros < 185-9 +Conflicts: kernel-rpm-macros < 205 # Macros Source0: macros.kernel-srpm @@ -53,10 +54,11 @@ the full kernel is built on. The variable to use is kernel_arches. %package -n kernel-rpm-macros -Version: 185 -Release: %{release} +Version: 205 Summary: Macros and scripts for building kernel module packages -Requires: redhat-rpm-config >= 13 +# rpmsort is GPL-2.0-or-later +License: MIT AND GPL-2.0-or-later +Requires: redhat-rpm-config >= 205 # for brp-kmod-compress Requires: %{_bindir}/xz @@ -113,12 +115,10 @@ install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" modalias.attr %files %{_rpmconfigdir}/macros.d/macros.kernel-srpm -%{_rpmconfigdir}/macros.d/macros.kmp %{_fileattrsdir}/kmod.attr -%{rrcdir}/kmodtool -%{rrcdir}/rpmsort %files -n kernel-rpm-macros +%{_rpmconfigdir}/macros.d/macros.kmp %{_rpmconfigdir}/kabi.sh %{_fileattrsdir}/kabi.attr %{_fileattrsdir}/modalias.attr @@ -132,52 +132,83 @@ install -p -m 644 -t "%{buildroot}%{_fileattrsdir}" modalias.attr %{rrcdir}/find-requires.ksyms %{rrcdir}/find-provides.d/firmware.prov %{rrcdir}/find-provides.d/modalias.prov +%{rrcdir}/kmodtool +%{rrcdir}/rpmsort %changelog -* Mon Jun 12 2023 Eugene Syromiatnikov - 1.0-13 -- Handle symvers.xz in kabi.attr (#2209253). -- Fix indirect __crc_* sumbols parsing in find-provides.ksyms - and find-requires.ksyms to avoid matching multiple sections - producing bogus duplicate provides for kmods that have both __kcrctab - and __kcrctab_gpl sections (#2115811, #2178935). -- Call "readelf -R" on a correct section in find-requires.ksyms. -- Rewrite section data extraction in find-provides.ksyms and find-requires.ksyms - to avoid garbage at the end of extracted sections, causing unnecessary awk - complaints (#2115811). -- Perform section parsing inside the awk script in find-provides.ksyms - and find-requires.ksyms to avoid hitting command line argument limit - when handling large .rodata sections (#2178935). +* Tue Oct 29 2024 Troy Dawson - 1.0-25 +- Bump release for October 2024 mass rebuild: + Resolves: RHEL-64018 -* Tue Jan 31 2023 Eugene Syromiatnikov - 1.0-12 +* Mon Jun 24 2024 Troy Dawson - 1.0-24 +- Bump release for June 2024 mass rebuild + +* Wed Mar 06 2024 David Abdurachmanov - 1.0-23 +- Add riscv64 + +* Wed Jan 24 2024 Fedora Release Engineering - 1.0-22 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Sun Jan 21 2024 Fedora Release Engineering - 1.0-21 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + +* Thu Jul 20 2023 Fedora Release Engineering - 1.0-20 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Tue May 09 2023 Eugene Syromiatnikov - 1.0-19 +- Capture local __crc_* symbols for "Provides: kernel()". +- Add support for XZ compression for the symvers file. +- Fix "Provides: kernel()" generation when both __kcrctab and __kcrctab_gpl + are present. +- Fix regression for "Provides:" generation in cases when modversions are stored + in a section that is over 64K in size. +- Speedup and cleanup changes in find-provides.ksyms and find-requires.ksyms. +- Fix regex usage in kmod.attr. (Denys Vlasenko) +- Implement modalias "Provides:" grouping. (Denys Vlasenko) +- Speedup and cleanup changes in modalias.prov and kmod.attr. (Denys Vlasenko) + +* Tue Mar 30 2023 Eugene Syromiatnikov - 1.0-18 +- Avoid triggering debuginfod during elfutils tools usage. + +* Tue Jan 31 2023 Eugene Syromiatnikov - 1.0-17 - Support storing of __crc_* symbols in sections other than .rodata. -- Resolves: #2135047 - -* 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 + on ppc64le and s390x. + +* Thu Jan 19 2023 Fedora Release Engineering - 1.0-16 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Jul 21 2022 Fedora Release Engineering - 1.0-15 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Thu Jan 20 2022 Fedora Release Engineering - 1.0-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Thu Nov 18 2021 Miro Hrončok - 1.0-13 +- Bump kernel-rpm-macros to 205 to provide clear upgrade path + +* Thu Nov 18 2021 Miro Hrončok - 1.0-12 +- Correct conflicts to redhat-rpm-macros < 205 +- Move Perl scripts back to kernel-rpm-macros to avoid Perl in the default buildroot + +* Thu Nov 18 2021 Eugene Syromiatnikov - 1.0-11 +- Add conflicts of redhat-rpm-macros < 204 as macros.kmp, kmodtool, + and rpmsort were moved from the latter to the former. +- Remove RHEL-specific kABI bits from find-requires.ksyms and macros.kmp. * 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 to the former. -* Mon Sep 20 2021 Eugene Syromiatnikov - 1.0-9 +* Thu Nov 18 2021 Eugene Syromiatnikov - 1.0-9 - Update scripts with RHEL-specific changes. -* Mon Aug 09 2021 Mohan Boddu - 1.0-8 -- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags - Related: rhbz#1991688 +* Thu Jul 22 2021 Fedora Release Engineering - 1.0-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild -* Tue May 25 2021 Michal Domonkos - 1.0-7 -- Bump release for a rebuild in a sidetag - -* Wed May 12 2021 Michal Domonkos - 1.0-6 -- Adopt kernel-rpm-macros subpackage & kmod.attr from redhat-rpm-config -- Resolves: #1959914 - -* Fri Apr 16 2021 Mohan Boddu - 1.0-5 -- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 +* Thu Jun 03 2021 Michal Domonkos - 1.0-5 +- Adopt kernel-rpm-macros & kmod.attr subpackage from redhat-rpm-config * Tue Jan 26 2021 Fedora Release Engineering - 1.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/kmod.attr b/kmod.attr new file mode 100644 index 0000000..8c57d0b --- /dev/null +++ b/kmod.attr @@ -0,0 +1,54 @@ +%__kmod_path ^/lib/modules/.*/(modules.builtin|.*\.ko|.*\.ko\.gz|.*\.ko\.bz2|.*\.ko\.xz|.*\.ko\.zst)$ + +# Notes on Lua: +# The backslash in strings (like "\n" newline) needs to be doubled +# because we are inside rpm macro. Single backslashes before most chars +# disappear (removed by rpm's parser), so "\n" turns into just "n". +# In string.gsub patterns, unlike regexps, backslash has no special meaning. +# It can't escape . and such. (Use one-character set [.] to represent +# literal period, or lua's percent escape: %.) +# Pipe (|) has no special meaning too. + +%__kmod_provides() %{lua: + function basename(fn) + local b = string.gsub(fn, ".*/", "") + -- the above adjusts gsub() result to 1 value + -- "return f()" construct would return _all_ values, two in case of gsub() + return b + end + function strip_compress_sfx(fn) + local cnt + fn, cnt = string.gsub(fn, "%.gz$", "") + if cnt == 1 then return fn; end + fn, cnt = string.gsub(fn, "%.bz2$", "") + if cnt == 1 then return fn; end + fn, cnt = string.gsub(fn, "%.xz$", "") + if cnt == 1 then return fn; end + fn, cnt = string.gsub(fn, "%.zst$", "") + return fn + end + function printdep(mod) + print("kmod("..mod..") ") + end + local fn = rpm.expand("%1") + local bn = basename(fn) + if bn == "modules.builtin" then + for l in io.lines(fn) do + local builtin_mod = basename(l) + printdep(builtin_mod) + local nocompr = strip_compress_sfx(builtin_mod) + if nocompr ~= builtin_mod then + printdep(nocompr) + end + end + else + local mod = string.match(bn, "%g+%.ko") + if mod then + printdep(mod) + local nocompr = strip_compress_sfx(mod) + if nocompr ~= mod then + printdep(nocompr) + end + end + end +} diff --git a/SOURCES/kmodtool b/kmodtool similarity index 100% rename from SOURCES/kmodtool rename to kmodtool diff --git a/SOURCES/macros.kernel-srpm b/macros.kernel-srpm similarity index 52% rename from SOURCES/macros.kernel-srpm rename to macros.kernel-srpm index c7110f6..5f6bb98 100644 --- a/SOURCES/macros.kernel-srpm +++ b/macros.kernel-srpm @@ -1,3 +1,3 @@ # kernel_arches lists what arches the full kernel is built for. -%kernel_arches x86_64 s390x ppc64le aarch64 %{arm} +%kernel_arches x86_64 s390x ppc64le aarch64 %{arm} riscv64 diff --git a/SOURCES/macros.kmp b/macros.kmp similarity index 97% rename from SOURCES/macros.kmp rename to macros.kmp index f8034ee..00c0467 100644 --- a/SOURCES/macros.kmp +++ b/macros.kmp @@ -13,7 +13,7 @@ redhat_kmp_has_post_hooks 1 # [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ... %kernel_module_package_buildreqs %global kmodtool_generate_buildreqs 1 \ - kernel-devel kernel-abi-stablelists redhat-rpm-config kernel-rpm-macros elfutils-libelf-devel kmod + kernel-devel redhat-rpm-config kernel-rpm-macros elfutils-libelf-devel kmod %kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \ ## An ugly hack: we want kmods to be processed by find-debuginfo, diff --git a/SOURCES/modalias.attr b/modalias.attr similarity index 100% rename from SOURCES/modalias.attr rename to modalias.attr diff --git a/modalias.prov b/modalias.prov new file mode 100755 index 0000000..7707991 --- /dev/null +++ b/modalias.prov @@ -0,0 +1,128 @@ +#! /bin/bash -efu + +# heavily based upon find-suggests.ksyms by Andreas Gruenbacher . +# with modifications by Michael Brown +# +# -- added module versioning info to modalias() symbols +# -- removed code which inspects spec files. + +IFS=$'\n' + +# +# Initially, dont generate modalias() lines for kernel package. This needs +# additional discussion. Would like to eventually add them for +# completeness, so that we can determine when drivers are folded into +# mainline kernel. +# +is_kernel_package="" +case "${1:-}" in +kernel-module-*) ;; # Fedora kernel module package names start with + # kernel-module. +kernel*) is_kernel_package=1 ;; +esac + +if ! [ -z "$is_kernel_package" ]; then + cat > /dev/null + exit 0 +fi + +# Check for presence of the commands used. +# "command" is a builtin, faster to use than fork+execing "which" - see +# https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html +command -v /sbin/modinfo >/dev/null || exit 1 +command -v sed >/dev/null || exit 1 +command -v sort >/dev/null || exit 1 + +print_modaliases() { + local class="$1" variants="$2" pos="$3" + if [ -n "$variants" ]; then + echo "${class:0:pos}[$variants]${class:pos+1}" + else + [ -z "$class" ] || echo "$class" + fi +} + +# Try to make "provides" list a bit smaller: +# find "mergeable" strings a-la +# modalias(pci:v0000168Cd00000023sv*sd*bc*sc*i*) +# modalias(pci:v0000168Cd00000024sv*sd*bc*sc*i*) +# modalias(pci:v0000168Cd00000027sv*sd*bc*sc*i*) +# modalias(pci:v0000168Cd00000029sv*sd*bc*sc*i*) +# replace with +# modalias(pci:v0000168Cd0000002[3479]sv*sd*bc*sc*i*) +combine_modaliases() { + local unused_len next prev variants="" pos="" n end xc + + # Due to set -e, we can exit with exitcode 1 on read EOF + # and this makes our caller think we failed. "|| return 0" prevents this: + IFS=' ' read unused_len prev || return 0 + + # For each line after the first... + while IFS=' ' read unused_len next; do + if [ -z "$pos" ]; then + # 2nd line: after "modalias(" prefix, for each char in prev line... + n=9 + end=${#prev} + # TODO speedup? if [ $end != ${#next} ]; then line is not mergeable + else + # 3rd+ lines: only check the char at the same position + n=$pos + end=$((pos + 1)) + fi + # Search for aaaNbbb,aaaMbbb line pair, where N and M chars differ. + # sort -u guarantees there are no identical line pairs. + # We assume that lines will not differ only in " = version" suffix. + for ((; n < $end; n++)); do + if [ "${prev:0:n}" != "${next:0:n}" ]; then + # the prefixes already aren't the same: break + n=$end + break + fi + # If suffixes differ, go to next char + [ x"${prev:n+1}" != x"${next:n+1}" ] && continue + # Found aaaNbbb,aaaMbbb. If N and M aren't special... + xc=x"${prev:n:1}" + [ x"[" = "$xc" -o x"]" = "$xc" ] && continue + [ x"?" = "$xc" -o x"*" = "$xc" ] && continue + xc=x"${next:n:1}" + [ x"[" = "$xc" -o x"]" = "$xc" ] && continue + [ x"?" = "$xc" -o x"*" = "$xc" ] && continue + # Add M (and maybe N) to $variants, go to next line + variants="${variants:-${prev:n:1}}${next:n:1}" + pos=$n + break + done + if [ $n -eq $end ]; then + # This line is not mergeable with the previous one(s), + # print collected merged line and reset the state + print_modaliases "$prev" "$variants" "$pos" + variants="" + pos="" + prev=$next + fi + done + # Print last collected merged line + print_modaliases "$prev" "$variants" "$pos" +} + +for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz|\.zst)?$') "$@"; do + modver=$(/sbin/modinfo -F version "$module") + # delete possible extra lines because some modules have *two* version tags. *cough*b44*cough* + modver=${modver%%$'\n'*} # using $'' bashism, avoid running "head -n1" process + # replace any strange chars with underscores. + # [!...] is glob's "match any char not in set" pattern + # (although bash supports [^...] too, it is not standard) + modver=${modver//[!0-9a-zA-Z._]/_} + # only add version tag if it indeed has a version + [ -z "$modver" ] || modver=" = $modver" + + /sbin/modinfo -F alias "$module" \ + | sed -E "s,[^][0-9a-zA-Z._:*?/-],_,g; s,(.+),modalias(\\1)$modver," + + # Below: combining code can only possibly combine lines of equal length. + # Prepend line lengths before sort, so that same-length lines end up next + # to each other. (The lengths are discarded by combine_modaliases). +done \ +| { while read line; do echo "${#line} $line"; done } \ +| LC_ALL=C sort -u \ +| combine_modaliases diff --git a/SOURCES/provided_ksyms.attr b/provided_ksyms.attr similarity index 100% rename from SOURCES/provided_ksyms.attr rename to provided_ksyms.attr diff --git a/SOURCES/required_ksyms.attr b/required_ksyms.attr similarity index 100% rename from SOURCES/required_ksyms.attr rename to required_ksyms.attr diff --git a/SOURCES/rpmsort b/rpmsort similarity index 100% rename from SOURCES/rpmsort rename to rpmsort diff --git a/SOURCES/symset-table b/symset-table similarity index 100% rename from SOURCES/symset-table rename to symset-table