]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
stable: clamp SUBLEVEL in 4.4 and 4.9
authorSasha Levin <sashal@kernel.org>
Fri, 5 Feb 2021 17:47:02 +0000 (12:47 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Feb 2021 08:09:24 +0000 (09:09 +0100)
Right now SUBLEVEL is overflowing, and some userspace may start treating
4.9.256 as 4.10. While out of tree modules have different ways of
  extracting the version number (and we're generally ok with breaking
them), we do care about breaking userspace and it would appear that this
overflow might do just that.

Our rules around userspace ABI in the stable kernel are pretty simple:
we don't break it. Thus, while userspace may be checking major/minor, it
shouldn't be doing anything with sublevel.

This patch applies a big band-aid to the 4.9 and 4.4 kernels in the form
of clamping their sublevel to 255.

The clamp is done for the purpose of LINUX_VERSION_CODE only, and
extracting the version number from the Makefile or "make kernelversion"
will continue to work as intended.

We might need to do it later in newer trees, but maybe we'll have a
better solution by then, so I'm ignoring that problem for now.

Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Makefile

index 69af44d3dcd148d69492aa3d49eff2af8bc3c2ff..93f7ce06fc8c9e62d5a43e18684ee010182b1122 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1141,7 +1141,7 @@ endef
 
 define filechk_version.h
        (echo \#define LINUX_VERSION_CODE $(shell                         \
-       expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
+       expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 255); \
        echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
 endef