* [PATCH] firmware: improve LSM/IMA security behaviour
@ 2019-06-17 18:23 Sven Van Asbroeck
2019-06-17 18:34 ` Mimi Zohar
0 siblings, 1 reply; 2+ messages in thread
From: Sven Van Asbroeck @ 2019-06-17 18:23 UTC (permalink / raw)
To: Luis Chamberlain
Cc: Stable, Mimi Zohar, Kees Cook, Greg Kroah-Hartman,
Rafael J. Wysocki, linux-kernel
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>
---
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.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] firmware: improve LSM/IMA security behaviour
2019-06-17 18:23 [PATCH] firmware: improve LSM/IMA security behaviour Sven Van Asbroeck
@ 2019-06-17 18:34 ` Mimi Zohar
0 siblings, 0 replies; 2+ messages in thread
From: Mimi Zohar @ 2019-06-17 18:34 UTC (permalink / raw)
To: Sven Van Asbroeck, Luis Chamberlain
Cc: Stable, Mimi Zohar, Kees Cook, Greg Kroah-Hartman,
Rafael J. Wysocki, linux-kernel
On Mon, 2019-06-17 at 14:23 -0400, Sven Van Asbroeck wrote:
> 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.
Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-17 18:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 18:23 [PATCH] firmware: improve LSM/IMA security behaviour Sven Van Asbroeck
2019-06-17 18:34 ` Mimi Zohar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).