-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Added a mechanism to catch kernel interfaces breaking. #12102
Conversation
Between openzfs#12060 and openzfs#12076, we've had two bugs where Linux breaking an interface in a way we didn't have an explicit case for silently broke functionality. Import ax_compare_version to do the comparisons, then Introduce a config test that lets you specify "I expect this feature to exist starting at version A (and, optionally, up to version B)"; if it doesn't, error out. Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
One quick note that might not be obvious to people, and I'll put in a comment whether it gets changed or not - if I understand how the version comparison macro I pulled in works correctly, it would turn, say, 5.10.0 into "0005001000000000" for comparison - and "5.10.0-rc4" into 0005001000000004, which means that "5.10.0 < 5.10.0-rc4" would return true, among other possibly-surprising outcomes. The three options I see for handling this are:
I think my preference is 2, then either 1 or 3, so I'll probably push something doing 2 soon if nobody proposes a better plan before I do. |
There is an alternative solution that I advocated in the past, but it never caught on. The reason for these issues is that the autotool checks are written like this:
They should be written like this:
In checks that I wrote in the past, I would do the latter. To give a few examples: I wanted to eventually rewrite all of the existing checks to match this style, but I never did and others did not follow my example. :/ |
One of the difficulties with a version number based approach is it's common for Enterprise Distributions, like RHEL or SLES, to backport significant kernel changes to much older kernels. We also see this kind of thing to a lesser degree with other distribution kernels which choose to apply patches for their own reasons.
We've been gradually been moving the code base to this style of check and making the checks themselves stricter. However, we haven't made a push to systematically convert all the remains checks. I think it'd be great if someone wanted to work on this. There's a good example of an updated check in kernel-put-link.m4. |
Sure, it's not going to solve RHEL kernels breaking, but nothing on earth is going to solve that mess. The goal was to try and catch at least some common cases of "we are past the minimum version for X feature, and the check failed" versus failing open. Since it sounds like everyone dislikes this solution, I'll close it. |
I envision writing a script that will batch fetch every major Linux release and compile the ZFS kernel modules against it. That would be needed to verify that a rework of all of the autotools checks in the old style into the new style works properly against all supported kernel versions. I imagine the runtime would be excessive (even if |
Motivation and Context
Between #12060 and #12076, we've had two bugs where Linux
breaking an interface in a way we didn't have an explicit case
for silently broke functionality.
(If this lands first, #12073's version checks could be refactored to use this macro instead...)
Description
Import ax_compare_version to do the comparisons, then Introduce a
config test that lets you specify "I expect this feature to exist
starting at version A (and, optionally, up to version B)"; if it
doesn't, error out.
This PR adds a check that will pass, because it bounds the version comparison to 5.12, where the interface broke.
How Has This Been Tested?
Tried the test with "[]" version max on 5.10 (it passed), and 5.12.1 (it failed).
Tried the test with "[5.12]" max on 5.10 (it passed), and 5.12.1 (it also passed).
If people like this idea, I'll follow it up with more checks.
Types of changes
Checklist:
Signed-off-by
.