[d-kernel] [PATCH v2 1/6] mtd: slram: Add the kernel lock down check
Egor Ignatov
egori на altlinux.org
Ср Май 27 11:25:34 MSK 2026
The slram MTD driver may map any memory pages no matter whether it's
reserved or whatever used for systems, which basically allows user
bypassing the lock down.
Add the check and abort the probe if the kernel is locked down for
LOCKDOWN_DEV_MEM.
Based on commit b3c782868ece ("mtd: phram: Add the kernel lock down check")
Suggested-by: Vitaly Chikunov <vt at altlinux.org>
Signed-off-by: Egor Ignatov <egori at altlinux.org>
---
drivers/mtd/devices/slram.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index 69cb63d99f..2928d12343 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -43,6 +43,7 @@
#include <linux/ioctl.h>
#include <linux/init.h>
#include <linux/io.h>
+#include <linux/security.h>
#include <linux/mtd/mtd.h>
@@ -277,6 +278,11 @@ __setup("slram=", mtd_slram_setup);
static int __init init_slram(void)
{
char *devname;
+ int ret;
+
+ ret = security_locked_down(LOCKDOWN_DEV_MEM);
+ if (ret)
+ return ret;
#ifndef MODULE
char *devstart;
--
2.50.1
Подробная информация о списке рассылки devel-kernel