File: module.patch

package info (click to toggle)
kpatch 0.9.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,716 kB
  • sloc: ansic: 9,716; sh: 2,592; makefile: 260; asm: 35
file content (64 lines) | stat: -rw-r--r-- 1,904 bytes parent folder | download
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
60
61
62
63
64
diff -Nupr src.orig/fs/nfsd/export.c src/fs/nfsd/export.c
--- src.orig/fs/nfsd/export.c	2024-04-18 11:19:38.144638397 -0400
+++ src/fs/nfsd/export.c	2024-04-18 11:19:51.106608412 -0400
@@ -1342,6 +1342,10 @@ static void exp_flags(struct seq_file *m
 	}
 }
 
+#include <linux/version.h>
+extern char *kpatch_string(void);
+
+__attribute__((optimize("-fno-optimize-sibling-calls")))
 static int e_show(struct seq_file *m, void *p)
 {
 	struct cache_head *cp = p;
@@ -1349,12 +1353,36 @@ static int e_show(struct seq_file *m, vo
 	struct cache_detail *cd = m->private;
 	bool export_stats = is_export_stats_file(m);
 
+#ifdef CONFIG_X86_64
+	alternative("ud2", "call single_task_running", X86_FEATURE_ALWAYS);
+	alternative("call single_task_running", "ud2", X86_FEATURE_IA64);
+
+	slow_down_io();   /* paravirt call */
+#endif
+
+	pr_debug("kpatch: pr_debug() test\n");
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
+{
+	static DEFINE_STATIC_KEY_TRUE(kpatch_key);
+
+	if (static_branch_unlikely(&memcg_kmem_enabled_key))
+		printk("kpatch: memcg_kmem_enabled_key\n");
+
+	BUG_ON(!static_branch_likely(&kpatch_key));
+	static_branch_disable(&kpatch_key);
+	BUG_ON(static_branch_likely(&kpatch_key));
+	static_branch_enable(&kpatch_key);
+}
+#endif
+
 	if (p == SEQ_START_TOKEN) {
 		seq_puts(m, "# Version 1.1\n");
 		if (export_stats)
 			seq_puts(m, "# Path Client Start-time\n#\tStats\n");
 		else
 			seq_puts(m, "# Path Client(Flags) # IPs\n");
+		seq_puts(m, kpatch_string());
 		return 0;
 	}
 
diff -Nupr src.orig/net/netlink/af_netlink.c src/net/netlink/af_netlink.c
--- src.orig/net/netlink/af_netlink.c	2024-04-18 11:19:38.442637708 -0400
+++ src/net/netlink/af_netlink.c	2024-04-18 11:19:51.107608409 -0400
@@ -2944,4 +2944,9 @@ panic:
 	panic("netlink_init: Cannot allocate nl_table\n");
 }
 
+char *kpatch_string(void)
+{
+	return "# kpatch\n";
+}
+
 core_initcall(netlink_proto_init);