Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1695760

Summary: [FEAT]: Do not import weak-module -debug and non-debug kernel module information
Product: Red Hat Enterprise Linux 8 Reporter: Prarit Bhargava <prarit>
Component: kmodAssignee: Yauheni Kaliuta <ykaliuta>
Status: CLOSED WONTFIX QA Contact: Ziqian SUN (Zamir) <zsun>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.1CC: skozina
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-04-16 09:43:48 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:

Description Prarit Bhargava 2019-04-03 17:54:10 UTC
Description of problem:  If I install a kernel, add weak module, and then install the kernel-debug packages, /usr/sbin/weak-modules will attempt to import the weak-module from the non-debug kernel into the debug kernel.


Version-Release number of selected component (if applicable): kmod-25-11.el8.x86_64


How reproducible: 


Steps to Reproduce:
1. install kernel-4.18.0-80.el8
2. build and add a dummy entry to lib/modules/4.18.0-80.el8.x86_64/extra

(This can be easily done in the kernel git tree by compiling redhat/debug/dummy_module/)

3. install kernel-debug-4.18.0-80.el8 

Actual results: The /usr/sbin/weak-modules script will import the /extra module from the non-debug kernel into the debug kernel.  Even if this is resolved some other way (see https://bugzilla.redhat.com/show_bug.cgi?id=1689052), it is a waste of time to look at the non-debug and debug kernel comparison.  We know they are significantly different.

Expected results: Do not make a -debug & non-debug kernel comparison


Additional info:

+is_debug_kernel() {
+    local krel=${1:-$(uname -r)}
+    [ $(expr "$krel" : '.*\+debug') -ne 0 ] && echo "debug" && return
+    echo "notdebug"
+}
+
+is_rpm() {
+    rpm -qf /lib/modules/$1 >&/dev/null
+    [ $? -eq 0 ] && rpm -qf /lib/modules/$1 && return 0
+    echo ""
+}
+
+	if [ $(is_rpm "$k") ] && [ $(is_rpm "$krel") ]; then
+	    # do not mix modules from debug and non-debug kernels
+	    if [ $(is_debug_kernel "$krel") != $(is_debug_kernel "$k") ]; then
+                pr_verbose "debug/non-debug rpm kernel: skipping modules for $k"
+		continue
+	    fi

Comment 1 Yauheni Kaliuta 2019-04-16 09:43:48 UTC
While it will help a in this particular scenario (kernel and debug kernel installed) I do not see a lot of advantage of the shortcut for the end customer and see more mess in the script.