Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve module version type positions #66

Merged
merged 1 commit into from
Nov 10, 2018

Conversation

spbnick
Copy link
Contributor

@spbnick spbnick commented Nov 10, 2018

Initialize the "res" array of get_module_verinfo() to three empty elements to
preserve relative positions of different version types stored there, when the
"res" array is expanded in check_version_sanity(), and to allow comparison
between compatible version types only.

Without that, if the module in question only had "srcversion", which is
assigned to "res[1]", then after e.g. this assignment in
check_version_sanity():

kernels_info=("${res[@]}")

The value will end up in "kernels_info[0]", the position that is
supposed to be occupied by the regular "version".

In the case of the stock kernel's module having only "srcversion", but
the installed module having a regular "version", this could lead to a
comparison between them, in check_version_sanity(), and an incorrect
conclusion about the module being (not) newer in the kernel.

E.g. when the stock kernel's module only has this field in modinfo:

filename: /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/drivers/hid/hid-uclogic.ko.xz
srcversion: 27A2028780DCB320780F53D

but the module being installed has these fields:

filename: /var/lib/dkms/digimend/9/3.10.0-862.14.4.el7.x86_64/x86_64/module//hid-uclogic.ko.xz
version: 9
srcversion: 0485A47017CB313B2F84B27

DKMS would incorrectly conclude:

Error! Module version 9 for hid-uclogic.ko.xz
is not newer than what is already found in kernel 3.10.0-862.14.4.el7.x86_64 (27A2028780DCB320780F53D).

Initialize the "res" array of get_module_verinfo() to three empty elements to
preserve relative positions of different version types stored there, when the
"res" array is expanded in check_version_sanity(), and to allow comparison
between compatible version types only.

Without that, if the module in question only had "srcversion", which is
assigned to "res[1]", then after e.g. this assignment in
check_version_sanity():

    kernels_info=("${res[@]}")

The value will end up in "kernels_info[0]", the position that is
supposed to be occupied by the regular "version".

In the case of the stock kernel's module having only "srcversion", but
the installed module having a regular "version", this could lead to a
comparison between them, in check_version_sanity(), and an incorrect
conclusion about the module being (not) newer in the kernel.

E.g. when the stock kernel's module only has this field in modinfo:

    filename: /lib/modules/3.10.0-862.14.4.el7.x86_64/kernel/drivers/hid/hid-uclogic.ko.xz
    srcversion: 27A2028780DCB320780F53D

but the module being installed has these fields:

    filename: /var/lib/dkms/digimend/9/3.10.0-862.14.4.el7.x86_64/x86_64/module//hid-uclogic.ko.xz
    version: 9
    srcversion: 0485A47017CB313B2F84B27

DKMS would incorrectly conclude:

    Error! Module version 9 for hid-uclogic.ko.xz
    is not newer than what is already found in kernel 3.10.0-862.14.4.el7.x86_64 (27A2028780DCB320780F53D).
@spbnick
Copy link
Contributor Author

spbnick commented Nov 10, 2018

This is needed to fix installion of digimend-kernel-drivers on CentOS. Thank you!

@scaronni scaronni merged commit 3a88e1d into dell:master Nov 10, 2018
@spbnick spbnick deleted the compare_same_module_version_types branch March 15, 2020 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants