Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-07-21 10:23:21 +0200
committerJiri Slaby <jslaby@suse.cz>2019-07-21 10:23:24 +0200
commit022194a429c0bf06dbc2cc8501199fb3c31c4903 (patch)
tree6bc317485bc8d6363cb2e93b6b1731cd44d524d5
parentb116993c524a71e80e4ad558a1c8f4c1ac9d54b6 (diff)
firmware: improve LSM/IMA security behaviour (bnc#1012628).
-rw-r--r--patches.kernel.org/5.2.2-006-firmware-improve-LSM-IMA-security-behaviour.patch49
-rw-r--r--series.conf1
2 files changed, 50 insertions, 0 deletions
diff --git a/patches.kernel.org/5.2.2-006-firmware-improve-LSM-IMA-security-behaviour.patch b/patches.kernel.org/5.2.2-006-firmware-improve-LSM-IMA-security-behaviour.patch
new file mode 100644
index 0000000000..0a3a0b5c9c
--- /dev/null
+++ b/patches.kernel.org/5.2.2-006-firmware-improve-LSM-IMA-security-behaviour.patch
@@ -0,0 +1,49 @@
+From: Sven Van Asbroeck <thesven73@gmail.com>
+Date: Mon, 17 Jun 2019 14:23:54 -0400
+Subject: [PATCH] firmware: improve LSM/IMA security behaviour
+References: bnc#1012628
+Patch-mainline: 5.2.2
+Git-commit: 2472d64af2d3561954e2f05365a67692bb852f2a
+
+commit 2472d64af2d3561954e2f05365a67692bb852f2a upstream.
+
+The firmware loader queries if LSM/IMA permits it to load firmware
+via the sysfs fallback. Unfortunately, the code does the opposite:
+it expressly permits sysfs fw loading if security_kernel_load_data(
+LOADING_FIRMWARE) returns -EACCES. This happens because a
+zero-on-success return value is cast to a bool that's true on success.
+
+Fix the return value handling so we get the correct behaviour.
+
+Fixes: 6e852651f28e ("firmware: add call to LSM hook before firmware sysfs fallback")
+Cc: Stable <stable@vger.kernel.org>
+Cc: Mimi Zohar <zohar@linux.vnet.ibm.com>
+Cc: Kees Cook <keescook@chromium.org>
+To: Luis Chamberlain <mcgrof@kernel.org>
+Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: "Rafael J. Wysocki" <rafael@kernel.org>
+Cc: linux-kernel@vger.kernel.org
+Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com>
+Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ drivers/base/firmware_loader/fallback.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/base/firmware_loader/fallback.c b/drivers/base/firmware_loader/fallback.c
+index f962488546b6..103b5d37fa86 100644
+--- a/drivers/base/firmware_loader/fallback.c
++++ b/drivers/base/firmware_loader/fallback.c
+@@ -659,7 +659,7 @@ static bool fw_run_sysfs_fallback(enum fw_opt opt_flags)
+ /* Also permit LSMs and IMA to fail firmware sysfs fallback */
+ ret = security_kernel_load_data(LOADING_FIRMWARE);
+ if (ret < 0)
+- return ret;
++ return false;
+
+ return fw_force_sysfs_fallback(opt_flags);
+ }
+--
+2.22.0
+
diff --git a/series.conf b/series.conf
index 962d3e6a7d..8bd6985e88 100644
--- a/series.conf
+++ b/series.conf
@@ -93,6 +93,7 @@
patches.kernel.org/5.2.2-003-Input-synaptics-enable-SMBUS-on-T480-thinkpad-t.patch
patches.kernel.org/5.2.2-004-nilfs2-do-not-use-unexported-cpu_to_le32-le32_t.patch
patches.kernel.org/5.2.2-005-drivers-base-cacheinfo-Ensure-cpu-hotplug-work-.patch
+ patches.kernel.org/5.2.2-006-firmware-improve-LSM-IMA-security-behaviour.patch
########################################################
# Build fixes that apply to the vanilla kernel too.