mirror of
https://github.com/dynup/kpatch
synced 2025-02-20 03:36:52 +00:00
Merge pull request #1086 from kamalesh-babulal/rhel8-1-testcases-rebase
test/intergation: Rebase to RHEL 8.1
This commit is contained in:
commit
421df07ffa
12
test/integration/rhel-8.1/bug-table-section.patch
Normal file
12
test/integration/rhel-8.1/bug-table-section.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nupr src/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c
|
||||
--- src/fs/proc/proc_sysctl.c 2020-03-11 11:23:26.886602663 +0000
|
||||
+++ src/fs/proc/proc_sysctl.c 2020-03-11 11:23:39.822895153 +0000
|
||||
@@ -333,6 +333,8 @@ static void start_unregistering(struct c
|
||||
|
||||
static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
|
||||
{
|
||||
+ if (jiffies == 0)
|
||||
+ printk("kpatch-test: testing __bug_table section changes\n");
|
||||
BUG_ON(!head);
|
||||
spin_lock(&sysctl_lock);
|
||||
if (!use_table(head))
|
13
test/integration/rhel-8.1/cmdline-string.patch
Normal file
13
test/integration/rhel-8.1/cmdline-string.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff -Nupr src/fs/proc/cmdline.c src/fs/proc/cmdline.c
|
||||
--- src/fs/proc/cmdline.c 2020-03-11 11:23:26.878602482 +0000
|
||||
+++ src/fs/proc/cmdline.c 2020-03-11 11:24:37.984218859 +0000
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
static int cmdline_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
- seq_puts(m, saved_command_line);
|
||||
- seq_putc(m, '\n');
|
||||
+ seq_printf(m, "%s kpatch=1\n", saved_command_line);
|
||||
return 0;
|
||||
}
|
||||
|
20
test/integration/rhel-8.1/data-new.patch
Normal file
20
test/integration/rhel-8.1/data-new.patch
Normal file
@ -0,0 +1,20 @@
|
||||
diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000
|
||||
+++ src/fs/proc/meminfo.c 2020-03-11 11:25:35.401538436 +0000
|
||||
@@ -30,6 +30,8 @@ static void show_val_kb(struct seq_file
|
||||
seq_write(m, " kB\n", 4);
|
||||
}
|
||||
|
||||
+static int foo = 5;
|
||||
+
|
||||
static int meminfo_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct sysinfo i;
|
||||
@@ -141,6 +143,7 @@ static int meminfo_proc_show(struct seq_
|
||||
show_val_kb(m, "CmaFree: ",
|
||||
global_zone_page_state(NR_FREE_CMA_PAGES));
|
||||
#endif
|
||||
+ seq_printf(m, "kpatch: %d\n", foo);
|
||||
|
||||
hugetlb_report_meminfo(m);
|
||||
|
13
test/integration/rhel-8.1/data-read-mostly.patch.disabled
Normal file
13
test/integration/rhel-8.1/data-read-mostly.patch.disabled
Normal file
@ -0,0 +1,13 @@
|
||||
Disabled due to https:/github.com/dynup/kpatch/issues/940
|
||||
---
|
||||
diff -Nupr src/net/core/dev.c src/net/core/dev.c
|
||||
--- src/net/core/dev.c 2020-03-11 11:23:32.550730639 +0000
|
||||
+++ src/net/core/dev.c 2020-03-11 11:43:53.348022834 +0000
|
||||
@@ -4893,6 +4893,7 @@ skip_classify:
|
||||
case RX_HANDLER_PASS:
|
||||
break;
|
||||
default:
|
||||
+ printk("BUG!\n");
|
||||
BUG();
|
||||
}
|
||||
}
|
11
test/integration/rhel-8.1/fixup-section.patch
Normal file
11
test/integration/rhel-8.1/fixup-section.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -Nupr src/fs/readdir.c src/fs/readdir.c
|
||||
--- src/fs/readdir.c 2020-03-11 11:23:24.210542249 +0000
|
||||
+++ src/fs/readdir.c 2020-03-11 11:26:32.322857837 +0000
|
||||
@@ -189,6 +189,7 @@ static int filldir(struct dir_context *c
|
||||
goto efault;
|
||||
}
|
||||
dirent = buf->current_dir;
|
||||
+ asm("nop");
|
||||
if (__put_user(d_ino, &dirent->d_ino))
|
||||
goto efault;
|
||||
if (__put_user(reclen, &dirent->d_reclen))
|
13
test/integration/rhel-8.1/gcc-constprop.patch.disabled
Normal file
13
test/integration/rhel-8.1/gcc-constprop.patch.disabled
Normal file
@ -0,0 +1,13 @@
|
||||
diff -Nupr src/kernel/time/timekeeping.c src/kernel/time/timekeeping.c
|
||||
--- src/kernel/time/timekeeping.c 2020-03-11 11:23:30.538685163 +0000
|
||||
+++ src/kernel/time/timekeeping.c 2020-03-11 11:44:47.885367244 +0000
|
||||
@@ -1221,6 +1221,9 @@ void do_gettimeofday(struct timeval *tv)
|
||||
{
|
||||
struct timespec64 now;
|
||||
|
||||
+ if (!tv)
|
||||
+ return;
|
||||
+
|
||||
getnstimeofday64(&now);
|
||||
tv->tv_sec = now.tv_sec;
|
||||
tv->tv_usec = now.tv_nsec/1000;
|
11
test/integration/rhel-8.1/gcc-isra.patch
Normal file
11
test/integration/rhel-8.1/gcc-isra.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -Nupr src/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c
|
||||
--- src/fs/proc/proc_sysctl.c 2020-03-11 11:23:26.886602663 +0000
|
||||
+++ src/fs/proc/proc_sysctl.c 2020-03-11 11:27:30.392214139 +0000
|
||||
@@ -48,6 +48,7 @@ void proc_sys_poll_notify(struct ctl_tab
|
||||
if (!poll)
|
||||
return;
|
||||
|
||||
+ printk("kpatch-test: testing gcc .isra function name mangling\n");
|
||||
atomic_inc(&poll->event);
|
||||
wake_up_interruptible(&poll->wait);
|
||||
}
|
13
test/integration/rhel-8.1/gcc-mangled-3.patch
Normal file
13
test/integration/rhel-8.1/gcc-mangled-3.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff -Nupr src/mm/slub.c src/mm/slub.c
|
||||
--- src/mm/slub.c 2020-03-11 11:23:32.406727384 +0000
|
||||
+++ src/mm/slub.c 2020-03-11 11:28:27.973568215 +0000
|
||||
@@ -5836,6 +5836,9 @@ void get_slabinfo(struct kmem_cache *s,
|
||||
int node;
|
||||
struct kmem_cache_node *n;
|
||||
|
||||
+ if (!jiffies)
|
||||
+ printk("slabinfo\n");
|
||||
+
|
||||
for_each_kmem_cache_node(s, node, n) {
|
||||
nr_slabs += node_nr_slabs(n);
|
||||
nr_objs += node_nr_objs(n);
|
13
test/integration/rhel-8.1/gcc-static-local-var-2.patch
Normal file
13
test/integration/rhel-8.1/gcc-static-local-var-2.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff -Nupr src/mm/mmap.c src/mm/mmap.c
|
||||
--- src/mm/mmap.c 2020-03-11 11:23:32.386726932 +0000
|
||||
+++ src/mm/mmap.c 2020-03-11 11:29:26.610955502 +0000
|
||||
@@ -1685,6 +1685,9 @@ unsigned long mmap_region(struct file *f
|
||||
struct rb_node **rb_link, *rb_parent;
|
||||
unsigned long charged = 0;
|
||||
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch mmap foo\n");
|
||||
+
|
||||
/* Check against address space limit. */
|
||||
if (!may_expand_vm(mm, vm_flags, len >> PAGE_SHIFT)) {
|
||||
unsigned long nr_pages;
|
19
test/integration/rhel-8.1/gcc-static-local-var-3.patch
Normal file
19
test/integration/rhel-8.1/gcc-static-local-var-3.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff -Nupr src/kernel/reboot.c src/kernel/reboot.c
|
||||
--- src/kernel/reboot.c 2020-03-11 11:23:30.502684349 +0000
|
||||
+++ src/kernel/reboot.c 2020-03-11 11:30:24.412330397 +0000
|
||||
@@ -393,8 +393,15 @@ SYSCALL_DEFINE4(reboot, int, magic1, int
|
||||
return ret;
|
||||
}
|
||||
|
||||
+void kpatch_bar(void)
|
||||
+{
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch_foo\n");
|
||||
+}
|
||||
+
|
||||
static void deferred_cad(struct work_struct *dummy)
|
||||
{
|
||||
+ kpatch_bar();
|
||||
kernel_restart(NULL);
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
Disabled due to https:/github.com/dynup/kpatch/issues/940
|
||||
---
|
||||
diff -Nupr src/fs/aio.c src/fs/aio.c
|
||||
--- src/fs/aio.c 2020-03-11 11:23:24.150540895 +0000
|
||||
+++ src/fs/aio.c 2020-03-11 11:45:44.710769201 +0000
|
||||
@@ -251,11 +251,18 @@ static int __init aio_setup(void)
|
||||
}
|
||||
__initcall(aio_setup);
|
||||
|
||||
+void kpatch_aio_foo(void)
|
||||
+{
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch aio foo\n");
|
||||
+}
|
||||
+
|
||||
static void put_aio_ring_file(struct kioctx *ctx)
|
||||
{
|
||||
struct file *aio_ring_file = ctx->aio_ring_file;
|
||||
struct address_space *i_mapping;
|
||||
|
||||
+ kpatch_aio_foo();
|
||||
if (aio_ring_file) {
|
||||
truncate_setsize(file_inode(aio_ring_file), 0);
|
||||
|
@ -0,0 +1,45 @@
|
||||
diff -Nupr src/kernel/audit.c src/kernel/audit.c
|
||||
--- src/kernel/audit.c 2020-03-11 11:23:30.394681909 +0000
|
||||
+++ src/kernel/audit.c 2020-03-11 11:46:41.484170922 +0000
|
||||
@@ -325,6 +325,12 @@ void audit_panic(const char *message)
|
||||
}
|
||||
}
|
||||
|
||||
+void kpatch_audit_foo(void)
|
||||
+{
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch audit foo\n");
|
||||
+}
|
||||
+
|
||||
static inline int audit_rate_check(void)
|
||||
{
|
||||
static unsigned long last_check = 0;
|
||||
@@ -335,6 +341,7 @@ static inline int audit_rate_check(void)
|
||||
unsigned long elapsed;
|
||||
int retval = 0;
|
||||
|
||||
+ kpatch_audit_foo();
|
||||
if (!audit_rate_limit) return 1;
|
||||
|
||||
spin_lock_irqsave(&lock, flags);
|
||||
@@ -354,6 +361,11 @@ static inline int audit_rate_check(void)
|
||||
return retval;
|
||||
}
|
||||
|
||||
+noinline void kpatch_audit_check(void)
|
||||
+{
|
||||
+ audit_rate_check();
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* audit_log_lost - conditionally log lost audit message event
|
||||
* @message: the message stating reason for lost audit message
|
||||
@@ -400,6 +412,8 @@ static int audit_log_config_change(char
|
||||
struct audit_buffer *ab;
|
||||
int rc = 0;
|
||||
|
||||
+ kpatch_audit_check();
|
||||
+
|
||||
ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
|
||||
if (unlikely(!ab))
|
||||
return rc;
|
22
test/integration/rhel-8.1/gcc-static-local-var-6.patch
Normal file
22
test/integration/rhel-8.1/gcc-static-local-var-6.patch
Normal file
@ -0,0 +1,22 @@
|
||||
diff -Nupr src/net/ipv6/netfilter.c src/net/ipv6/netfilter.c
|
||||
--- src/net/ipv6/netfilter.c 2020-03-11 11:23:32.702734076 +0000
|
||||
+++ src/net/ipv6/netfilter.c 2020-03-11 11:31:22.397716246 +0000
|
||||
@@ -87,6 +87,8 @@ static int nf_ip6_reroute(struct sk_buff
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#include "kpatch-macros.h"
|
||||
+
|
||||
static int nf_ip6_route(struct net *net, struct dst_entry **dst,
|
||||
struct flowi *fl, bool strict)
|
||||
{
|
||||
@@ -100,6 +102,9 @@ static int nf_ip6_route(struct net *net,
|
||||
struct dst_entry *result;
|
||||
int err;
|
||||
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch nf_ip6_route foo\n");
|
||||
+
|
||||
result = ip6_route_output(net, sk, &fl->u.ip6);
|
||||
err = result->error;
|
||||
if (err)
|
155
test/integration/rhel-8.1/macro-callbacks.patch
Normal file
155
test/integration/rhel-8.1/macro-callbacks.patch
Normal file
@ -0,0 +1,155 @@
|
||||
diff -Nupr src/drivers/input/joydev.c src/drivers/input/joydev.c
|
||||
--- src/drivers/input/joydev.c 2020-03-11 11:23:07.890174500 +0000
|
||||
+++ src/drivers/input/joydev.c 2020-03-11 11:32:20.859119425 +0000
|
||||
@@ -1068,3 +1068,47 @@ static void __exit joydev_exit(void)
|
||||
|
||||
module_init(joydev_init);
|
||||
module_exit(joydev_exit);
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include "kpatch-macros.h"
|
||||
+
|
||||
+static const char *const module_state[] = {
|
||||
+ [MODULE_STATE_LIVE] = "[MODULE_STATE_LIVE] Normal state",
|
||||
+ [MODULE_STATE_COMING] = "[MODULE_STATE_COMING] Full formed, running module_init",
|
||||
+ [MODULE_STATE_GOING] = "[MODULE_STATE_GOING] Going away",
|
||||
+ [MODULE_STATE_UNFORMED] = "[MODULE_STATE_UNFORMED] Still setting it up",
|
||||
+};
|
||||
+
|
||||
+static void callback_info(const char *callback, patch_object *obj)
|
||||
+{
|
||||
+ if (obj->mod)
|
||||
+ pr_info("%s: %s -> %s\n", callback, obj->mod->name,
|
||||
+ module_state[obj->mod->state]);
|
||||
+ else
|
||||
+ pr_info("%s: vmlinux\n", callback);
|
||||
+}
|
||||
+
|
||||
+static int pre_patch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+ return 0; /* return -ENODEV; */
|
||||
+}
|
||||
+KPATCH_PRE_PATCH_CALLBACK(pre_patch_callback);
|
||||
+
|
||||
+static void post_patch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_POST_PATCH_CALLBACK(post_patch_callback);
|
||||
+
|
||||
+static void pre_unpatch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_PRE_UNPATCH_CALLBACK(pre_unpatch_callback);
|
||||
+
|
||||
+static void post_unpatch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_POST_UNPATCH_CALLBACK(post_unpatch_callback);
|
||||
diff -Nupr src/drivers/input/misc/pcspkr.c src/drivers/input/misc/pcspkr.c
|
||||
--- src/drivers/input/misc/pcspkr.c 2020-03-11 11:23:07.962176120 +0000
|
||||
+++ src/drivers/input/misc/pcspkr.c 2020-03-11 11:32:20.859119425 +0000
|
||||
@@ -138,3 +138,46 @@ static struct platform_driver pcspkr_pla
|
||||
};
|
||||
module_platform_driver(pcspkr_platform_driver);
|
||||
|
||||
+#include <linux/module.h>
|
||||
+#include "kpatch-macros.h"
|
||||
+
|
||||
+static const char *const module_state[] = {
|
||||
+ [MODULE_STATE_LIVE] = "[MODULE_STATE_LIVE] Normal state",
|
||||
+ [MODULE_STATE_COMING] = "[MODULE_STATE_COMING] Full formed, running module_init",
|
||||
+ [MODULE_STATE_GOING] = "[MODULE_STATE_GOING] Going away",
|
||||
+ [MODULE_STATE_UNFORMED] = "[MODULE_STATE_UNFORMED] Still setting it up",
|
||||
+};
|
||||
+
|
||||
+static void callback_info(const char *callback, patch_object *obj)
|
||||
+{
|
||||
+ if (obj->mod)
|
||||
+ pr_info("%s: %s -> %s\n", callback, obj->mod->name,
|
||||
+ module_state[obj->mod->state]);
|
||||
+ else
|
||||
+ pr_info("%s: vmlinux\n", callback);
|
||||
+}
|
||||
+
|
||||
+static int pre_patch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+ return 0;
|
||||
+}
|
||||
+KPATCH_PRE_PATCH_CALLBACK(pre_patch_callback);
|
||||
+
|
||||
+static void post_patch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_POST_PATCH_CALLBACK(post_patch_callback);
|
||||
+
|
||||
+static void pre_unpatch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_PRE_UNPATCH_CALLBACK(pre_unpatch_callback);
|
||||
+
|
||||
+static void post_unpatch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_POST_UNPATCH_CALLBACK(post_unpatch_callback);
|
||||
diff -Nupr src/fs/aio.c src/fs/aio.c
|
||||
--- src/fs/aio.c 2020-03-11 11:23:24.150540895 +0000
|
||||
+++ src/fs/aio.c 2020-03-11 11:32:20.859119425 +0000
|
||||
@@ -49,6 +49,50 @@
|
||||
|
||||
#define KIOCB_KEY 0
|
||||
|
||||
+#include <linux/module.h>
|
||||
+#include "kpatch-macros.h"
|
||||
+
|
||||
+static const char *const module_state[] = {
|
||||
+ [MODULE_STATE_LIVE] = "[MODULE_STATE_LIVE] Normal state",
|
||||
+ [MODULE_STATE_COMING] = "[MODULE_STATE_COMING] Full formed, running module_init",
|
||||
+ [MODULE_STATE_GOING] = "[MODULE_STATE_GOING] Going away",
|
||||
+ [MODULE_STATE_UNFORMED] = "[MODULE_STATE_UNFORMED] Still setting it up",
|
||||
+};
|
||||
+
|
||||
+static void callback_info(const char *callback, patch_object *obj)
|
||||
+{
|
||||
+ if (obj->mod)
|
||||
+ pr_info("%s: %s -> %s\n", callback, obj->mod->name,
|
||||
+ module_state[obj->mod->state]);
|
||||
+ else
|
||||
+ pr_info("%s: vmlinux\n", callback);
|
||||
+}
|
||||
+
|
||||
+static int pre_patch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+ return 0;
|
||||
+}
|
||||
+KPATCH_PRE_PATCH_CALLBACK(pre_patch_callback);
|
||||
+
|
||||
+static void post_patch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_POST_PATCH_CALLBACK(post_patch_callback);
|
||||
+
|
||||
+static void pre_unpatch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_PRE_UNPATCH_CALLBACK(pre_unpatch_callback);
|
||||
+
|
||||
+static void post_unpatch_callback(patch_object *obj)
|
||||
+{
|
||||
+ callback_info(__func__, obj);
|
||||
+}
|
||||
+KPATCH_POST_UNPATCH_CALLBACK(post_unpatch_callback);
|
||||
+
|
||||
#define AIO_RING_MAGIC 0xa10a10a1
|
||||
#define AIO_RING_COMPAT_FEATURES 1
|
||||
#define AIO_RING_INCOMPAT_FEATURES 0
|
148
test/integration/rhel-8.1/macro-printk.patch.disabled
Normal file
148
test/integration/rhel-8.1/macro-printk.patch.disabled
Normal file
@ -0,0 +1,148 @@
|
||||
diff -Nupr src/net/ipv4/fib_frontend.c src/net/ipv4/fib_frontend.c
|
||||
--- src/net/ipv4/fib_frontend.c 2020-03-11 11:23:32.622732267 +0000
|
||||
+++ src/net/ipv4/fib_frontend.c 2020-03-11 11:47:37.897564680 +0000
|
||||
@@ -777,6 +777,7 @@ errout:
|
||||
return err;
|
||||
}
|
||||
|
||||
+#include "kpatch-macros.h"
|
||||
static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
@@ -798,6 +799,7 @@ static int inet_rtm_newroute(struct sk_b
|
||||
err = fib_table_insert(net, tb, &cfg, extack);
|
||||
if (!err && cfg.fc_type == RTN_LOCAL)
|
||||
net->ipv4.fib_has_custom_local_routes = true;
|
||||
+ KPATCH_PRINTK("[inet_rtm_newroute]: err is %d\n", err);
|
||||
errout:
|
||||
return err;
|
||||
}
|
||||
diff -Nupr src/net/ipv4/fib_semantics.c src/net/ipv4/fib_semantics.c
|
||||
--- src/net/ipv4/fib_semantics.c 2020-03-11 11:23:32.626732358 +0000
|
||||
+++ src/net/ipv4/fib_semantics.c 2020-03-11 11:47:37.897564680 +0000
|
||||
@@ -1025,6 +1025,7 @@ fib_convert_metrics(struct fib_info *fi,
|
||||
fi->fib_metrics->metrics);
|
||||
}
|
||||
|
||||
+#include "kpatch-macros.h"
|
||||
struct fib_info *fib_create_info(struct fib_config *cfg,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
@@ -1058,6 +1059,7 @@ struct fib_info *fib_create_info(struct
|
||||
#endif
|
||||
|
||||
err = -ENOBUFS;
|
||||
+ KPATCH_PRINTK("[fib_create_info]: create error err is %d\n",err);
|
||||
if (fib_info_cnt >= fib_info_hash_size) {
|
||||
unsigned int new_size = fib_info_hash_size << 1;
|
||||
struct hlist_head *new_info_hash;
|
||||
@@ -1078,6 +1080,7 @@ struct fib_info *fib_create_info(struct
|
||||
if (!fib_info_hash_size)
|
||||
goto failure;
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 2 create error err is %d\n",err);
|
||||
|
||||
fi = kzalloc(sizeof(*fi)+nhs*sizeof(struct fib_nh), GFP_KERNEL);
|
||||
if (!fi)
|
||||
@@ -1093,6 +1096,8 @@ struct fib_info *fib_create_info(struct
|
||||
fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics;
|
||||
}
|
||||
fib_info_cnt++;
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 3 create error err is %d\n",err);
|
||||
+
|
||||
fi->fib_net = net;
|
||||
fi->fib_protocol = cfg->fc_protocol;
|
||||
fi->fib_scope = cfg->fc_scope;
|
||||
@@ -1109,8 +1114,10 @@ struct fib_info *fib_create_info(struct
|
||||
if (!nexthop_nh->nh_pcpu_rth_output)
|
||||
goto failure;
|
||||
} endfor_nexthops(fi)
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 4 create error err is %d\n",err);
|
||||
|
||||
err = fib_convert_metrics(fi, cfg);
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 5 create error err is %d\n",err);
|
||||
if (err)
|
||||
goto failure;
|
||||
|
||||
@@ -1172,6 +1179,7 @@ struct fib_info *fib_create_info(struct
|
||||
nh->nh_weight = 1;
|
||||
#endif
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 6 create error err is %d\n",err);
|
||||
|
||||
if (fib_props[cfg->fc_type].error) {
|
||||
if (cfg->fc_gw || cfg->fc_oif || cfg->fc_mp) {
|
||||
@@ -1193,6 +1201,7 @@ struct fib_info *fib_create_info(struct
|
||||
goto err_inval;
|
||||
}
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 7 create error err is %d\n",err);
|
||||
|
||||
if (cfg->fc_scope > RT_SCOPE_HOST) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid scope");
|
||||
@@ -1231,6 +1240,7 @@ struct fib_info *fib_create_info(struct
|
||||
if (linkdown == fi->fib_nhs)
|
||||
fi->fib_flags |= RTNH_F_LINKDOWN;
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 8 create error err is %d\n",err);
|
||||
|
||||
if (fi->fib_prefsrc && !fib_valid_prefsrc(cfg, fi->fib_prefsrc)) {
|
||||
NL_SET_ERR_MSG(extack, "Invalid prefsrc address");
|
||||
@@ -1240,6 +1250,7 @@ struct fib_info *fib_create_info(struct
|
||||
change_nexthops(fi) {
|
||||
fib_info_update_nh_saddr(net, nexthop_nh);
|
||||
} endfor_nexthops(fi)
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 9 create error err is %d\n",err);
|
||||
|
||||
fib_rebalance(fi);
|
||||
|
||||
@@ -1251,6 +1262,7 @@ link_it:
|
||||
ofi->fib_treeref++;
|
||||
return ofi;
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 10 create error err is %d\n",err);
|
||||
|
||||
fi->fib_treeref++;
|
||||
refcount_set(&fi->fib_clntref, 1);
|
||||
@@ -1274,6 +1286,7 @@ link_it:
|
||||
hlist_add_head(&nexthop_nh->nh_hash, head);
|
||||
} endfor_nexthops(fi)
|
||||
spin_unlock_bh(&fib_info_lock);
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 11 create error err is %d\n",err);
|
||||
return fi;
|
||||
|
||||
err_inval:
|
||||
@@ -1284,6 +1297,7 @@ failure:
|
||||
fi->fib_dead = 1;
|
||||
free_fib_info(fi);
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 12 create error err is %d\n",err);
|
||||
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
diff -Nupr src/net/ipv4/fib_trie.c src/net/ipv4/fib_trie.c
|
||||
--- src/net/ipv4/fib_trie.c 2020-03-11 11:23:32.626732358 +0000
|
||||
+++ src/net/ipv4/fib_trie.c 2020-03-11 11:47:37.897564680 +0000
|
||||
@@ -1121,6 +1121,7 @@ static bool fib_valid_key_len(u32 key, u
|
||||
}
|
||||
|
||||
/* Caller must hold RTNL. */
|
||||
+#include "kpatch-macros.h"
|
||||
int fib_table_insert(struct net *net, struct fib_table *tb,
|
||||
struct fib_config *cfg, struct netlink_ext_ack *extack)
|
||||
{
|
||||
@@ -1143,11 +1144,14 @@ int fib_table_insert(struct net *net, st
|
||||
|
||||
pr_debug("Insert table=%u %08x/%d\n", tb->tb_id, key, plen);
|
||||
|
||||
+ KPATCH_PRINTK("[fib_table_insert]: start\n");
|
||||
fi = fib_create_info(cfg, extack);
|
||||
if (IS_ERR(fi)) {
|
||||
err = PTR_ERR(fi);
|
||||
+ KPATCH_PRINTK("[fib_table_insert]: create error err is %d\n",err);
|
||||
goto err;
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_table_insert]: cross\n");
|
||||
|
||||
l = fib_find_node(t, &tp, key);
|
||||
fa = l ? fib_find_alias(&l->leaf, slen, tos, fi->fib_priority,
|
11
test/integration/rhel-8.1/meminfo-init-FAIL.patch
Normal file
11
test/integration/rhel-8.1/meminfo-init-FAIL.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000
|
||||
+++ src/fs/proc/meminfo.c 2020-03-11 11:34:17.189926874 +0000
|
||||
@@ -151,6 +151,7 @@ static int meminfo_proc_show(struct seq_
|
||||
|
||||
static int __init proc_meminfo_init(void)
|
||||
{
|
||||
+ printk("a\n");
|
||||
proc_create_single("meminfo", 0, NULL, meminfo_proc_show);
|
||||
return 0;
|
||||
}
|
19
test/integration/rhel-8.1/meminfo-init2-FAIL.patch
Normal file
19
test/integration/rhel-8.1/meminfo-init2-FAIL.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000
|
||||
+++ src/fs/proc/meminfo.c 2020-03-11 11:33:19.732537882 +0000
|
||||
@@ -40,6 +40,7 @@ static int meminfo_proc_show(struct seq_
|
||||
unsigned long sreclaimable, sunreclaim;
|
||||
int lru;
|
||||
|
||||
+ printk("a\n");
|
||||
si_meminfo(&i);
|
||||
si_swapinfo(&i);
|
||||
committed = percpu_counter_read_positive(&vm_committed_as);
|
||||
@@ -151,6 +152,7 @@ static int meminfo_proc_show(struct seq_
|
||||
|
||||
static int __init proc_meminfo_init(void)
|
||||
{
|
||||
+ printk("a\n");
|
||||
proc_create_single("meminfo", 0, NULL, meminfo_proc_show);
|
||||
return 0;
|
||||
}
|
12
test/integration/rhel-8.1/meminfo-string.patch
Normal file
12
test/integration/rhel-8.1/meminfo-string.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000
|
||||
+++ src/fs/proc/meminfo.c 2020-03-11 11:35:15.879349884 +0000
|
||||
@@ -120,7 +120,7 @@ static int meminfo_proc_show(struct seq_
|
||||
seq_printf(m, "VmallocTotal: %8lu kB\n",
|
||||
(unsigned long)VMALLOC_TOTAL >> 10);
|
||||
show_val_kb(m, "VmallocUsed: ", 0ul);
|
||||
- show_val_kb(m, "VmallocChunk: ", 0ul);
|
||||
+ show_val_kb(m, "VMALLOCCHUNK: ", 0ul);
|
||||
|
||||
#ifdef CONFIG_MEMORY_FAILURE
|
||||
seq_printf(m, "HardwareCorrupted: %5lu kB\n",
|
33
test/integration/rhel-8.1/module-call-external.patch
Normal file
33
test/integration/rhel-8.1/module-call-external.patch
Normal file
@ -0,0 +1,33 @@
|
||||
diff -Nupr src/fs/nfsd/export.c src/fs/nfsd/export.c
|
||||
--- src/fs/nfsd/export.c 2020-03-11 11:23:26.690598237 +0000
|
||||
+++ src/fs/nfsd/export.c 2020-03-11 11:36:14.892784598 +0000
|
||||
@@ -1196,6 +1196,8 @@ static void exp_flags(struct seq_file *m
|
||||
}
|
||||
}
|
||||
|
||||
+extern char *kpatch_string(void);
|
||||
+
|
||||
static int e_show(struct seq_file *m, void *p)
|
||||
{
|
||||
struct cache_head *cp = p;
|
||||
@@ -1205,6 +1207,7 @@ static int e_show(struct seq_file *m, vo
|
||||
if (p == SEQ_START_TOKEN) {
|
||||
seq_puts(m, "# Version 1.1\n");
|
||||
seq_puts(m, "# Path Client(Flags) # IPs\n");
|
||||
+ seq_puts(m, kpatch_string());
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff -Nupr src/net/netlink/af_netlink.c src/net/netlink/af_netlink.c
|
||||
--- src/net/netlink/af_netlink.c 2020-03-11 11:23:32.886738235 +0000
|
||||
+++ src/net/netlink/af_netlink.c 2020-03-11 11:36:14.896784696 +0000
|
||||
@@ -2809,4 +2809,9 @@ panic:
|
||||
panic("netlink_init: Cannot allocate nl_table\n");
|
||||
}
|
||||
|
||||
+char *kpatch_string(void)
|
||||
+{
|
||||
+ return "# kpatch\n";
|
||||
+}
|
||||
+
|
||||
core_initcall(netlink_proto_init);
|
25
test/integration/rhel-8.1/new-function.patch
Normal file
25
test/integration/rhel-8.1/new-function.patch
Normal file
@ -0,0 +1,25 @@
|
||||
diff -Nupr src/drivers/tty/n_tty.c src/drivers/tty/n_tty.c
|
||||
--- src/drivers/tty/n_tty.c 2020-03-11 11:23:23.062516341 +0000
|
||||
+++ src/drivers/tty/n_tty.c 2020-03-11 11:37:13.226206161 +0000
|
||||
@@ -2296,7 +2296,7 @@ static ssize_t n_tty_read(struct tty_str
|
||||
* lock themselves)
|
||||
*/
|
||||
|
||||
-static ssize_t n_tty_write(struct tty_struct *tty, struct file *file,
|
||||
+static ssize_t noinline kpatch_n_tty_write(struct tty_struct *tty, struct file *file,
|
||||
const unsigned char *buf, size_t nr)
|
||||
{
|
||||
const unsigned char *b = buf;
|
||||
@@ -2383,6 +2383,12 @@ break_out:
|
||||
return (b - buf) ? b - buf : retval;
|
||||
}
|
||||
|
||||
+static ssize_t __attribute__((optimize("-fno-optimize-sibling-calls"))) n_tty_write(struct tty_struct *tty, struct file *file,
|
||||
+ const unsigned char *buf, size_t nr)
|
||||
+{
|
||||
+ return kpatch_n_tty_write(tty, file, buf, nr);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* n_tty_poll - poll method for N_TTY
|
||||
* @tty: terminal device
|
34
test/integration/rhel-8.1/new-globals.patch
Normal file
34
test/integration/rhel-8.1/new-globals.patch
Normal file
@ -0,0 +1,34 @@
|
||||
diff -Nupr src/fs/proc/cmdline.c src/fs/proc/cmdline.c
|
||||
--- src/fs/proc/cmdline.c 2020-03-11 11:23:26.878602482 +0000
|
||||
+++ src/fs/proc/cmdline.c 2020-03-11 11:38:10.295599825 +0000
|
||||
@@ -17,3 +17,10 @@ static int __init proc_cmdline_init(void
|
||||
return 0;
|
||||
}
|
||||
fs_initcall(proc_cmdline_init);
|
||||
+
|
||||
+#include <linux/printk.h>
|
||||
+void kpatch_print_message(void)
|
||||
+{
|
||||
+ if (!jiffies)
|
||||
+ printk("hello there!\n");
|
||||
+}
|
||||
diff -Nupr src/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src/fs/proc/meminfo.c 2020-03-11 11:23:26.882602572 +0000
|
||||
+++ src/fs/proc/meminfo.c 2020-03-11 11:38:10.295599825 +0000
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <asm/pgtable.h>
|
||||
#include "internal.h"
|
||||
|
||||
+void kpatch_print_message(void);
|
||||
+
|
||||
void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
|
||||
{
|
||||
}
|
||||
@@ -56,6 +58,7 @@ static int meminfo_proc_show(struct seq_
|
||||
sreclaimable = global_node_page_state(NR_SLAB_RECLAIMABLE);
|
||||
sunreclaim = global_node_page_state(NR_SLAB_UNRECLAIMABLE);
|
||||
|
||||
+ kpatch_print_message();
|
||||
show_val_kb(m, "MemTotal: ", i.totalram);
|
||||
show_val_kb(m, "MemFree: ", i.freeram);
|
||||
show_val_kb(m, "MemAvailable: ", available);
|
11
test/integration/rhel-8.1/parainstructions-section.patch
Normal file
11
test/integration/rhel-8.1/parainstructions-section.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -Nupr src/fs/proc/generic.c src/fs/proc/generic.c
|
||||
--- src/fs/proc/generic.c 2020-03-11 11:23:26.878602482 +0000
|
||||
+++ src/fs/proc/generic.c 2020-03-11 11:39:07.677003695 +0000
|
||||
@@ -205,6 +205,7 @@ int proc_alloc_inum(unsigned int *inum)
|
||||
{
|
||||
int i;
|
||||
|
||||
+ printk("kpatch-test: testing change to .parainstructions section\n");
|
||||
i = ida_simple_get(&proc_inum_ida, 0, UINT_MAX - PROC_DYNAMIC_FIRST + 1,
|
||||
GFP_KERNEL);
|
||||
if (i < 0)
|
77
test/integration/rhel-8.1/shadow-newpid.patch.disabled
Normal file
77
test/integration/rhel-8.1/shadow-newpid.patch.disabled
Normal file
@ -0,0 +1,77 @@
|
||||
Disabled due to https:/github.com/dynup/kpatch/issues/940
|
||||
---
|
||||
diff -Nupr src/fs/proc/array.c src/fs/proc/array.c
|
||||
--- src/fs/proc/array.c 2020-03-11 11:23:26.874602392 +0000
|
||||
+++ src/fs/proc/array.c 2020-03-11 11:48:34.514964309 +0000
|
||||
@@ -370,12 +370,19 @@ static inline void task_seccomp(struct s
|
||||
seq_putc(m, '\n');
|
||||
}
|
||||
|
||||
+#include <linux/livepatch.h>
|
||||
static inline void task_context_switch_counts(struct seq_file *m,
|
||||
struct task_struct *p)
|
||||
{
|
||||
+ int *newpid;
|
||||
+
|
||||
seq_put_decimal_ull(m, "voluntary_ctxt_switches:\t", p->nvcsw);
|
||||
seq_put_decimal_ull(m, "\nnonvoluntary_ctxt_switches:\t", p->nivcsw);
|
||||
seq_putc(m, '\n');
|
||||
+
|
||||
+ newpid = klp_shadow_get(p, 0);
|
||||
+ if (newpid)
|
||||
+ seq_printf(m, "newpid:\t%d\n", *newpid);
|
||||
}
|
||||
|
||||
static void task_cpus_allowed(struct seq_file *m, struct task_struct *task)
|
||||
diff -Nupr src/kernel/exit.c src/kernel/exit.c
|
||||
--- src/kernel/exit.c 2020-03-11 11:23:30.434682812 +0000
|
||||
+++ src/kernel/exit.c 2020-03-11 11:48:34.514964309 +0000
|
||||
@@ -762,6 +762,7 @@ static void check_stack_usage(void)
|
||||
static inline void check_stack_usage(void) {}
|
||||
#endif
|
||||
|
||||
+#include <linux/livepatch.h>
|
||||
void __noreturn do_exit(long code)
|
||||
{
|
||||
struct task_struct *tsk = current;
|
||||
@@ -868,6 +869,8 @@ void __noreturn do_exit(long code)
|
||||
exit_thread(tsk);
|
||||
exit_umh(tsk);
|
||||
|
||||
+ klp_shadow_free(tsk, 0, NULL);
|
||||
+
|
||||
/*
|
||||
* Flush inherited counters to the parent - before the parent
|
||||
* gets woken up by child-exit notifications.
|
||||
diff -Nupr src/kernel/fork.c src/kernel/fork.c
|
||||
--- src/kernel/fork.c 2020-03-11 11:23:30.438682903 +0000
|
||||
+++ src/kernel/fork.c 2020-03-11 11:48:34.514964309 +0000
|
||||
@@ -2210,6 +2210,7 @@ struct task_struct *fork_idle(int cpu)
|
||||
* It copies the process, and if successful kick-starts
|
||||
* it and waits for it to finish using the VM if required.
|
||||
*/
|
||||
+#include <linux/livepatch.h>
|
||||
long _do_fork(unsigned long clone_flags,
|
||||
unsigned long stack_start,
|
||||
unsigned long stack_size,
|
||||
@@ -2222,6 +2223,8 @@ long _do_fork(unsigned long clone_flags,
|
||||
struct task_struct *p;
|
||||
int trace = 0;
|
||||
long nr;
|
||||
+ int *newpid;
|
||||
+ static int ctr = 0;
|
||||
|
||||
/*
|
||||
* Determine whether and which event to report to ptracer. When
|
||||
@@ -2248,6 +2251,11 @@ long _do_fork(unsigned long clone_flags,
|
||||
if (IS_ERR(p))
|
||||
return PTR_ERR(p);
|
||||
|
||||
+ newpid = klp_shadow_get_or_alloc(p, 0, sizeof(*newpid), GFP_KERNEL,
|
||||
+ NULL, NULL);
|
||||
+ if (newpid)
|
||||
+ *newpid = ctr++;
|
||||
+
|
||||
/*
|
||||
* Do this prior waking up the new thread - the thread pointer
|
||||
* might get invalid after that point, if the thread exits quickly.
|
13
test/integration/rhel-8.1/smp-locks-section.patch
Normal file
13
test/integration/rhel-8.1/smp-locks-section.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff -Nupr src/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c
|
||||
--- src/drivers/tty/tty_buffer.c 2020-03-11 11:23:23.138518056 +0000
|
||||
+++ src/drivers/tty/tty_buffer.c 2020-03-11 11:40:04.174388205 +0000
|
||||
@@ -256,6 +256,9 @@ static int __tty_buffer_request_room(str
|
||||
struct tty_buffer *b, *n;
|
||||
int left, change;
|
||||
|
||||
+ if (!size)
|
||||
+ printk("kpatch-test: testing .smp_locks section changes\n");
|
||||
+
|
||||
b = buf->tail;
|
||||
if (b->flags & TTYB_NORMAL)
|
||||
left = 2 * b->size - b->used;
|
22
test/integration/rhel-8.1/special-static.patch.disabled
Normal file
22
test/integration/rhel-8.1/special-static.patch.disabled
Normal file
@ -0,0 +1,22 @@
|
||||
diff -Nupr src/kernel/fork.c src/kernel/fork.c
|
||||
--- src/kernel/fork.c 2020-03-11 11:23:30.438682903 +0000
|
||||
+++ src/kernel/fork.c 2020-03-11 11:41:01.567796732 +0000
|
||||
@@ -1524,10 +1524,18 @@ static void posix_cpu_timers_init_group(
|
||||
static inline void posix_cpu_timers_init_group(struct signal_struct *sig) { }
|
||||
#endif
|
||||
|
||||
+void kpatch_foo(void)
|
||||
+{
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch copy signal\n");
|
||||
+}
|
||||
+
|
||||
static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
|
||||
{
|
||||
struct signal_struct *sig;
|
||||
|
||||
+ kpatch_foo();
|
||||
+
|
||||
if (clone_flags & CLONE_THREAD)
|
||||
return 0;
|
||||
|
13
test/integration/rhel-8.1/tracepoints-section.patch
Normal file
13
test/integration/rhel-8.1/tracepoints-section.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff -Nupr src/kernel/time/timer.c src/kernel/time/timer.c
|
||||
--- src/kernel/time/timer.c 2020-03-11 11:23:30.542685253 +0000
|
||||
+++ src/kernel/time/timer.c 2020-03-11 11:41:58.129186658 +0000
|
||||
@@ -1692,6 +1692,9 @@ static __latent_entropy void run_timer_s
|
||||
{
|
||||
struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]);
|
||||
|
||||
+ if (!base)
|
||||
+ printk("kpatch-test: testing __tracepoints section changes\n");
|
||||
+
|
||||
__run_timers(base);
|
||||
if (IS_ENABLED(CONFIG_NO_HZ_COMMON))
|
||||
__run_timers(this_cpu_ptr(&timer_bases[BASE_DEF]));
|
8
test/integration/rhel-8.1/warn-detect-FAIL.patch
Normal file
8
test/integration/rhel-8.1/warn-detect-FAIL.patch
Normal file
@ -0,0 +1,8 @@
|
||||
diff -Nupr src/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c
|
||||
--- src/arch/x86/kvm/x86.c 2020-03-11 11:22:57.389938541 +0000
|
||||
+++ src/arch/x86/kvm/x86.c 2020-03-11 11:42:55.798605475 +0000
|
||||
@@ -1,3 +1,4 @@
|
||||
+
|
||||
/*
|
||||
* Kernel-based Virtual Machine driver for Linux
|
||||
*
|
Loading…
Reference in New Issue
Block a user