Skip to contentSkip to conversation

Patch "module: Issue warnings when tainting kernel" has been added to the 4.4-stable tree

PATCH [email protected] 2 participants 4 messages Jan 8, 2018 – Jan 10, 2018 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

module: Issue warnings when tainting kernel

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
module-issue-warnings-when-tainting-kernel.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 3205c36cf7d96024626f92d65f560035df1abcb2 Mon Sep 17 00:00:00 2001

From: Libor Pechacek <[email protected]>
Date: Wed, 13 Apr 2016 11:06:12 +0930
Subject: module: Issue warnings when tainting kernel

From: Libor Pechacek <[email protected]>

commit 3205c36cf7d96024626f92d65f560035df1abcb2 upstream.

While most of the locations where a kernel taint bit is set are accompanied with a warning message, there are two which set their bits silently. If the tainting module gets unloaded later on, it is almost impossible to tell what was the reason for setting the flag.

---
 kernel/module.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
kernel/module.c +10 -1
@@ -2888,8 +2888,12 @@ static int check_modinfo(struct module *
 		return -ENOEXEC;
 	}
 
-	if (!get_modinfo(info, "intree"))
+	if (!get_modinfo(info, "intree")) {
+		if (!test_taint(TAINT_OOT_MODULE))
+			pr_warn("%s: loading out-of-tree module taints kernel.\n",
+				mod->name);
 		add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
+	}
 
 	if (get_modinfo(info, "staging")) {
 		add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
@@ -3054,6 +3058,8 @@ static int move_module(struct module *mo
 
 static int check_module_license_and_versions(struct module *mod)
 {
+	int prev_taint = test_taint(TAINT_PROPRIETARY_MODULE);
+
 	/*
 	 * ndiswrapper is under GPL by itself, but loads proprietary modules.
 	 * Don't use add_taint_module(), as it would prevent ndiswrapper from
@@ -3072,6 +3078,9 @@ static int check_module_license_and_vers
 		add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
 				 LOCKDEP_NOW_UNRELIABLE);
 
+	if (!prev_taint && test_taint(TAINT_PROPRIETARY_MODULE))
+		pr_warn("%s: module license taints kernel.\n", mod->name);
+
 #ifdef CONFIG_MODVERSIONS
 	if ((mod->num_syms && !mod->crcs)
 	    || (mod->num_gpl_syms && !mod->gpl_crcs)

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/module-issue-warnings-when-tainting-kernel.patch

#1 lore raw

Greg,

I appreciate the notifications about patch moves. They make my life easier. However, I don't understand how this change qualified for -stable. The issue does not look serious enough to me to pass the criteria described in Documentation/process/stable-kernel-rules.rst and I don't see which other patch may require this one in v4.4.111.

What is the background for including this patch in -stable, please?

Libor

Quoted 79 lines · On Mon 08-01-18 13:52:57, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

module: Issue warnings when tainting kernel

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
module-issue-warnings-when-tainting-kernel.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

From 3205c36cf7d96024626f92d65f560035df1abcb2 Mon Sep 17 00:00:00 2001
From: Libor Pechacek <[email protected]>
Date: Wed, 13 Apr 2016 11:06:12 +0930
Subject: module: Issue warnings when tainting kernel

From: Libor Pechacek <[email protected]>

commit 3205c36cf7d96024626f92d65f560035df1abcb2 upstream.

While most of the locations where a kernel taint bit is set are accompanied with a warning message, there are two which set their bits silently. If the tainting module gets unloaded later on, it is almost impossible to tell what was the reason for setting the flag.

---
 kernel/module.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
kernel/module.c +10 -1
@@ -2888,8 +2888,12 @@ static int check_modinfo(struct module *
 		return -ENOEXEC;
 	}
 
-	if (!get_modinfo(info, "intree"))
+	if (!get_modinfo(info, "intree")) {
+		if (!test_taint(TAINT_OOT_MODULE))
+			pr_warn("%s: loading out-of-tree module taints kernel.\n",
+				mod->name);
 		add_taint_module(mod, TAINT_OOT_MODULE, LOCKDEP_STILL_OK);
+	}
 
 	if (get_modinfo(info, "staging")) {
 		add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
@@ -3054,6 +3058,8 @@ static int move_module(struct module *mo
 
 static int check_module_license_and_versions(struct module *mod)
 {
+	int prev_taint = test_taint(TAINT_PROPRIETARY_MODULE);
+
 	/*
 	 * ndiswrapper is under GPL by itself, but loads proprietary modules.
 	 * Don't use add_taint_module(), as it would prevent ndiswrapper from
@@ -3072,6 +3078,9 @@ static int check_module_license_and_vers
 		add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
 				 LOCKDEP_NOW_UNRELIABLE);
 
+	if (!prev_taint && test_taint(TAINT_PROPRIETARY_MODULE))
+		pr_warn("%s: module license taints kernel.\n", mod->name);
+
 #ifdef CONFIG_MODVERSIONS
 	if ((mod->num_syms && !mod->crcs)
 	    || (mod->num_gpl_syms && !mod->gpl_crcs)

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/module-issue-warnings-when-tainting-kernel.patch

Signature · 2 lines
Libor Pechacek
SUSE Labs
author maintainer
#2 lore raw
Quoted 9 lines · Libor Pechacek

Greg,

I appreciate the notifications about patch moves. They make my life easier. However, I don't understand how this change qualified for -stable. The issue does not look serious enough to me to pass the criteria described in Documentation/process/stable-kernel-rules.rst and I don't see which other patch may require this one in v4.4.111.

What is the background for including this patch in -stable, please?

This patch fixes an issue, and was a "good enough" fix that at least one distro has been shipping it in their kernel for a long time. So I figured it would be good for everyone to benifit from the bugfix, not just a tiny subset of the 4.4 kernel users :)

Hope this helps,

greg k-h

#3 lore raw
Quoted 9 lines · Greg KH
Quoted 8 lines · Libor Pechacek

Greg,

I appreciate the notifications about patch moves. They make my life easier. However, I don't understand how this change qualified for -stable. The issue does not look serious enough to me to pass the criteria described in Documentation/process/stable-kernel-rules.rst and I don't see which other patch may require this one in v4.4.111.

Quoted 6 lines
Quoted 1 line

What is the background for including this patch in -stable, please?

This patch fixes an issue, and was a "good enough" fix that at least one distro has been shipping it in their kernel for a long time. So I figured it would be good for everyone to benifit from the bugfix, not just a tiny subset of the 4.4 kernel users :)

Oh, fairness is a strong argument. However, I'm unhappy to hear that our community is tiny part of Linux user base. ;-)

Quoted 1 line

Hope this helps,

Indeed it does. Thanks!

Libor

Signature · 2 lines
Libor Pechacek
SUSE Labs