-
Notifications
You must be signed in to change notification settings - Fork 0
/
0004-kernel-module-Custom-module-blacklist.patch
60 lines (53 loc) · 1.5 KB
/
0004-kernel-module-Custom-module-blacklist.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 2c48cf375d0ebc5008e13dee4a0a215b04bc7680 Mon Sep 17 00:00:00 2001
From: Pzqqt <[email protected]>
Date: Thu, 28 Sep 2023 14:02:48 +0800
Subject: [PATCH 4/7] kernel: module: Custom module blacklist
- It does not affect behavior of the default module blacklist.
Signed-off-by: dodyirawan85 <[email protected]>
---
kernel/module.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/kernel/module.c b/kernel/module.c
index 5b77d9f2e..532719914 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -3551,13 +3551,26 @@ int __weak module_frob_arch_sections(Elf_Ehdr *hdr,
/* module_blacklist is a comma-separated list of module names */
static char *module_blacklist;
+static char *custom_module_blacklist[] = {
+#if IS_BUILTIN(CONFIG_CRYPTO_LZO)
+ "lzo", "lzo_rle",
+#endif
+#if IS_BUILTIN(CONFIG_ZRAM)
+ "zram",
+#endif
+#if IS_BUILTIN(CONFIG_ZSMALLOC)
+ "zsmalloc",
+#endif
+};
+
static bool blacklisted(const char *module_name)
{
const char *p;
size_t len;
+ int i;
if (!module_blacklist)
- return false;
+ goto custom_blacklist;
for (p = module_blacklist; *p; p += len) {
len = strcspn(p, ",");
@@ -3566,6 +3579,12 @@ static bool blacklisted(const char *module_name)
if (p[len] == ',')
len++;
}
+
+custom_blacklist:
+ for (i = 0; i < ARRAY_SIZE(custom_module_blacklist); i++)
+ if (!strcmp(module_name, custom_module_blacklist[i]))
+ return true;
+
return false;
}
core_param(module_blacklist, module_blacklist, charp, 0400);
--
2.34.1