kpatch/test/integration/rhel-8.10/module.patch
Joe Lawrence 560318641a test/integration/rhel-8.10: add kernel-4.18.0-552.el8_10 tests
Signed-off-by: Ryan Sullivan <rysulliv@redhat.com>
2024-04-23 14:29:19 -04:00

61 lines
1.6 KiB
Diff

diff -Nupr src.orig/fs/xfs/xfs_stats.c src/fs/xfs/xfs_stats.c
--- src.orig/fs/xfs/xfs_stats.c 2024-04-18 14:12:03.471375109 -0400
+++ src/fs/xfs/xfs_stats.c 2024-04-18 14:12:46.797280945 -0400
@@ -16,6 +16,8 @@ static int counter_val(struct xfsstats _
return val;
}
+extern char *kpatch_string(void);
+
int xfs_stats_format(struct xfsstats __percpu *stats, char *buf)
{
int i, j;
@@ -85,6 +87,34 @@ int xfs_stats_format(struct xfsstats __p
0);
#endif
+ /* Reference a symbol outside the .o yet inside the patch module: */
+ len += scnprintf(buf + len, PATH_MAX-len, "%s\n", kpatch_string());
+
+#ifdef CONFIG_X86_64
+ /* Test alternatives patching: */
+ alternative("ud2", "nop", X86_FEATURE_ALWAYS);
+ alternative("nop", "ud2", X86_FEATURE_IA64);
+
+ /* Test paravirt patching: */
+ slow_down_io(); /* paravirt call */
+#endif
+
+ /* Test pr_debug: */
+ pr_debug("kpatch: pr_debug() test\n");
+
+{
+ /* Test static branches: */
+ 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);
+}
+
return len;
}
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 14:12:03.660374698 -0400
+++ src/net/netlink/af_netlink.c 2024-04-18 14:12:46.798280943 -0400
@@ -2888,4 +2888,9 @@ panic:
panic("netlink_init: Cannot allocate nl_table\n");
}
+char *kpatch_string(void)
+{
+ return "kpatch";
+}
+
core_initcall(netlink_proto_init);