mirror of
https://github.com/dynup/kpatch
synced 2025-03-24 20:06:47 +00:00
testing: add and rebase integration tests for Ubuntu 16
Kernel version: 4.4.0-53-generic
This commit is contained in:
parent
11ce8102c2
commit
b6692c14d7
1
test/integration/ubuntu-16.04/README
Normal file
1
test/integration/ubuntu-16.04/README
Normal file
@ -0,0 +1 @@
|
||||
4.4.0-53-generic
|
12
test/integration/ubuntu-16.04/bug-table-section.patch
Normal file
12
test/integration/ubuntu-16.04/bug-table-section.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c
|
||||
--- src.orig/fs/proc/proc_sysctl.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/proc_sysctl.c 2016-12-15 19:56:00.204000000 +0000
|
||||
@@ -301,6 +301,8 @@ void sysctl_head_put(struct ctl_table_he
|
||||
|
||||
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))
|
3
test/integration/ubuntu-16.04/cmdline-string-LOADED.test
Executable file
3
test/integration/ubuntu-16.04/cmdline-string-LOADED.test
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
grep kpatch=1 /proc/cmdline
|
12
test/integration/ubuntu-16.04/cmdline-string.patch
Normal file
12
test/integration/ubuntu-16.04/cmdline-string.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c
|
||||
--- src.orig/fs/proc/cmdline.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/cmdline.c 2016-12-15 19:56:12.848000000 +0000
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
static int cmdline_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
- seq_printf(m, "%s\n", saved_command_line);
|
||||
+ seq_printf(m, "%s kpatch=1\n", saved_command_line);
|
||||
return 0;
|
||||
}
|
||||
|
3
test/integration/ubuntu-16.04/data-new-LOADED.test
Executable file
3
test/integration/ubuntu-16.04/data-new-LOADED.test
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
grep "kpatch: 5" /proc/meminfo
|
28
test/integration/ubuntu-16.04/data-new.patch
Normal file
28
test/integration/ubuntu-16.04/data-new.patch
Normal file
@ -0,0 +1,28 @@
|
||||
diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/meminfo.c 2016-12-15 19:56:17.076000000 +0000
|
||||
@@ -23,6 +23,8 @@ void __attribute__((weak)) arch_report_m
|
||||
{
|
||||
}
|
||||
|
||||
+static int foo = 5;
|
||||
+
|
||||
static int meminfo_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct sysinfo i;
|
||||
@@ -110,6 +112,7 @@ static int meminfo_proc_show(struct seq_
|
||||
"CmaTotal: %8lu kB\n"
|
||||
"CmaFree: %8lu kB\n"
|
||||
#endif
|
||||
+ "kpatch: %d"
|
||||
,
|
||||
K(i.totalram),
|
||||
K(i.freeram),
|
||||
@@ -169,6 +172,7 @@ static int meminfo_proc_show(struct seq_
|
||||
, K(totalcma_pages)
|
||||
, K(global_page_state(NR_FREE_CMA_PAGES))
|
||||
#endif
|
||||
+ ,foo
|
||||
);
|
||||
|
||||
hugetlb_report_meminfo(m);
|
11
test/integration/ubuntu-16.04/data-read-mostly.patch
Normal file
11
test/integration/ubuntu-16.04/data-read-mostly.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -Nupr src.orig/net/core/dev.c src/net/core/dev.c
|
||||
--- src.orig/net/core/dev.c 2016-12-15 19:55:39.848000000 +0000
|
||||
+++ src/net/core/dev.c 2016-12-15 19:56:21.344000000 +0000
|
||||
@@ -3926,6 +3926,7 @@ ncls:
|
||||
case RX_HANDLER_PASS:
|
||||
break;
|
||||
default:
|
||||
+ printk("BUG!\n");
|
||||
BUG();
|
||||
}
|
||||
}
|
12
test/integration/ubuntu-16.04/fixup-section.patch
Normal file
12
test/integration/ubuntu-16.04/fixup-section.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nupr src.orig/fs/readdir.c src/fs/readdir.c
|
||||
--- src.orig/fs/readdir.c 2016-12-15 19:55:39.196000000 +0000
|
||||
+++ src/fs/readdir.c 2016-12-15 19:56:25.868000000 +0000
|
||||
@@ -173,6 +173,8 @@ static int filldir(struct dir_context *c
|
||||
goto efault;
|
||||
}
|
||||
dirent = buf->current_dir;
|
||||
+ if (dirent->d_ino == 12345678)
|
||||
+ printk("kpatch-test: testing .fixup section changes\n");
|
||||
if (__put_user(d_ino, &dirent->d_ino))
|
||||
goto efault;
|
||||
if (__put_user(reclen, &dirent->d_reclen))
|
16
test/integration/ubuntu-16.04/gcc-constprop.patch
Normal file
16
test/integration/ubuntu-16.04/gcc-constprop.patch
Normal file
@ -0,0 +1,16 @@
|
||||
ensure timekeeping_forward_now.constprop.8 and
|
||||
timekeeping_forward_now.constprop.9 are correlated.
|
||||
|
||||
diff -Nupr src.orig/kernel/time/timekeeping.c src/kernel/time/timekeeping.c
|
||||
--- src.orig/kernel/time/timekeeping.c 2016-12-15 19:56:00.136000000 +0000
|
||||
+++ src/kernel/time/timekeeping.c 2016-12-15 19:56:30.496000000 +0000
|
||||
@@ -1148,6 +1148,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/ubuntu-16.04/gcc-isra.patch
Normal file
11
test/integration/ubuntu-16.04/gcc-isra.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -Nupr src.orig/fs/proc/proc_sysctl.c src/fs/proc/proc_sysctl.c
|
||||
--- src.orig/fs/proc/proc_sysctl.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/proc_sysctl.c 2016-12-15 19:56:34.800000000 +0000
|
||||
@@ -46,6 +46,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);
|
||||
}
|
16
test/integration/ubuntu-16.04/gcc-mangled-3.patch
Normal file
16
test/integration/ubuntu-16.04/gcc-mangled-3.patch
Normal file
@ -0,0 +1,16 @@
|
||||
ensure that __cmpxchg_double_slab.isra.45 and
|
||||
__cmpxchg_double_slab.isra.45.part.46 aren't correlated.
|
||||
|
||||
diff -Nupr src.orig/mm/slub.c src/mm/slub.c
|
||||
--- src.orig/mm/slub.c 2016-12-15 19:55:38.988000000 +0000
|
||||
+++ src/mm/slub.c 2016-12-15 19:56:39.068000000 +0000
|
||||
@@ -5531,6 +5531,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);
|
21
test/integration/ubuntu-16.04/gcc-static-local-var-2.patch
Normal file
21
test/integration/ubuntu-16.04/gcc-static-local-var-2.patch
Normal file
@ -0,0 +1,21 @@
|
||||
diff -Nupr src.orig/mm/mmap.c src/mm/mmap.c
|
||||
--- src.orig/mm/mmap.c 2016-12-15 19:55:38.992000000 +0000
|
||||
+++ src/mm/mmap.c 2016-12-15 19:56:43.684000000 +0000
|
||||
@@ -1538,6 +1538,7 @@ static inline int accountable_mapping(st
|
||||
return (vm_flags & (VM_NORESERVE | VM_SHARED | VM_WRITE)) == VM_WRITE;
|
||||
}
|
||||
|
||||
+#include "kpatch-macros.h"
|
||||
unsigned long mmap_region(struct file *file, unsigned long addr,
|
||||
unsigned long len, vm_flags_t vm_flags, unsigned long pgoff)
|
||||
{
|
||||
@@ -1547,6 +1548,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, len >> PAGE_SHIFT)) {
|
||||
unsigned long nr_pages;
|
19
test/integration/ubuntu-16.04/gcc-static-local-var-3.patch
Normal file
19
test/integration/ubuntu-16.04/gcc-static-local-var-3.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff -Nupr src.orig/kernel/reboot.c src/kernel/reboot.c
|
||||
--- src.orig/kernel/reboot.c 2016-12-15 19:56:00.196000000 +0000
|
||||
+++ src/kernel/reboot.c 2016-12-15 19:56:48.264000000 +0000
|
||||
@@ -366,8 +366,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);
|
||||
}
|
||||
|
20
test/integration/ubuntu-16.04/gcc-static-local-var-4.patch
Normal file
20
test/integration/ubuntu-16.04/gcc-static-local-var-4.patch
Normal file
@ -0,0 +1,20 @@
|
||||
diff -Nupr src.orig/fs/aio.c src/fs/aio.c
|
||||
--- src.orig/fs/aio.c 2016-12-15 19:55:38.992000000 +0000
|
||||
+++ src/fs/aio.c 2016-12-15 19:56:52.588000000 +0000
|
||||
@@ -271,9 +271,16 @@ 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;
|
||||
+ kpatch_aio_foo();
|
||||
if (aio_ring_file) {
|
||||
truncate_setsize(aio_ring_file->f_inode, 0);
|
||||
|
7
test/integration/ubuntu-16.04/gcc-static-local-var-4.test
Executable file
7
test/integration/ubuntu-16.04/gcc-static-local-var-4.test
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
if $(nm kpatch-gcc-static-local-var-4.ko | grep -q free_ioctx); then
|
||||
exit 1
|
||||
else
|
||||
exit 0
|
||||
fi
|
45
test/integration/ubuntu-16.04/gcc-static-local-var-5.patch
Normal file
45
test/integration/ubuntu-16.04/gcc-static-local-var-5.patch
Normal file
@ -0,0 +1,45 @@
|
||||
diff -Nupr src.orig/kernel/audit.c src/kernel/audit.c
|
||||
--- src.orig/kernel/audit.c 2016-12-15 19:56:00.196000000 +0000
|
||||
+++ src/kernel/audit.c 2016-12-15 19:56:56.868000000 +0000
|
||||
@@ -213,6 +213,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;
|
||||
@@ -223,6 +229,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);
|
||||
@@ -242,6 +249,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
|
||||
@@ -288,6 +300,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;
|
25
test/integration/ubuntu-16.04/gcc-static-local-var.patch
Normal file
25
test/integration/ubuntu-16.04/gcc-static-local-var.patch
Normal file
@ -0,0 +1,25 @@
|
||||
diff -Nupr src.orig/arch/x86/kernel/ldt.c src/arch/x86/kernel/ldt.c
|
||||
--- src.orig/arch/x86/kernel/ldt.c 2016-12-15 19:55:57.560000000 +0000
|
||||
+++ src/arch/x86/kernel/ldt.c 2016-12-15 19:57:01.124000000 +0000
|
||||
@@ -99,6 +99,12 @@ static void free_ldt_struct(struct ldt_s
|
||||
kfree(ldt);
|
||||
}
|
||||
|
||||
+void hi_there(void)
|
||||
+{
|
||||
+ if (!jiffies)
|
||||
+ printk("hi there\n");
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* we do not have to muck with descriptors here, that is
|
||||
* done in switch_mm() as needed.
|
||||
@@ -109,6 +115,8 @@ int init_new_context(struct task_struct
|
||||
struct mm_struct *old_mm;
|
||||
int retval = 0;
|
||||
|
||||
+ hi_there();
|
||||
+
|
||||
mutex_init(&mm->context.lock);
|
||||
old_mm = current->mm;
|
||||
if (!old_mm) {
|
3
test/integration/ubuntu-16.04/macro-hooks-LOADED.test
Executable file
3
test/integration/ubuntu-16.04/macro-hooks-LOADED.test
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $(cat /proc/sys/fs/aio-max-nr) = 262144 ]]
|
24
test/integration/ubuntu-16.04/macro-hooks.patch
Normal file
24
test/integration/ubuntu-16.04/macro-hooks.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff -Nupr src.orig/fs/aio.c src/fs/aio.c
|
||||
--- src.orig/fs/aio.c 2016-12-15 19:55:38.992000000 +0000
|
||||
+++ src/fs/aio.c 2016-12-15 19:57:05.396000000 +0000
|
||||
@@ -1716,6 +1716,20 @@ SYSCALL_DEFINE3(io_cancel, aio_context_t
|
||||
return ret;
|
||||
}
|
||||
|
||||
+static int aio_max_nr_orig;
|
||||
+void kpatch_load_aio_max_nr(void)
|
||||
+{
|
||||
+ aio_max_nr_orig = aio_max_nr;
|
||||
+ aio_max_nr = 0x40000;
|
||||
+}
|
||||
+void kpatch_unload_aio_max_nr(void)
|
||||
+{
|
||||
+ aio_max_nr = aio_max_nr_orig;
|
||||
+}
|
||||
+#include "kpatch-macros.h"
|
||||
+KPATCH_LOAD_HOOK(kpatch_load_aio_max_nr);
|
||||
+KPATCH_UNLOAD_HOOK(kpatch_unload_aio_max_nr);
|
||||
+
|
||||
/* io_getevents:
|
||||
* Attempts to read at least min_nr events and up to nr events from
|
||||
* the completion queue for the aio_context specified by ctx_id. If
|
145
test/integration/ubuntu-16.04/macro-printk.patch
Normal file
145
test/integration/ubuntu-16.04/macro-printk.patch
Normal file
@ -0,0 +1,145 @@
|
||||
diff -Nupr src.orig/net/ipv4/fib_frontend.c src/net/ipv4/fib_frontend.c
|
||||
--- src.orig/net/ipv4/fib_frontend.c 2016-12-15 19:55:39.724000000 +0000
|
||||
+++ src/net/ipv4/fib_frontend.c 2016-12-15 19:57:09.672000000 +0000
|
||||
@@ -728,6 +728,7 @@ errout:
|
||||
return err;
|
||||
}
|
||||
|
||||
+#include "kpatch-macros.h"
|
||||
static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
{
|
||||
struct net *net = sock_net(skb->sk);
|
||||
@@ -746,6 +747,7 @@ static int inet_rtm_newroute(struct sk_b
|
||||
}
|
||||
|
||||
err = fib_table_insert(tb, &cfg);
|
||||
+ KPATCH_PRINTK("[inet_rtm_newroute]: err is %d\n", err);
|
||||
errout:
|
||||
return err;
|
||||
}
|
||||
diff -Nupr src.orig/net/ipv4/fib_semantics.c src/net/ipv4/fib_semantics.c
|
||||
--- src.orig/net/ipv4/fib_semantics.c 2016-12-15 19:55:39.720000000 +0000
|
||||
+++ src/net/ipv4/fib_semantics.c 2016-12-15 19:57:09.672000000 +0000
|
||||
@@ -991,6 +991,7 @@ fib_convert_metrics(struct fib_info *fi,
|
||||
return 0;
|
||||
}
|
||||
|
||||
+#include "kpatch-macros.h"
|
||||
struct fib_info *fib_create_info(struct fib_config *cfg)
|
||||
{
|
||||
int err;
|
||||
@@ -1018,6 +1019,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;
|
||||
@@ -1038,6 +1040,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)
|
||||
@@ -1049,6 +1052,7 @@ struct fib_info *fib_create_info(struct
|
||||
goto failure;
|
||||
} else
|
||||
fi->fib_metrics = (u32 *) dst_default_metrics;
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 3 create error err is %d\n",err);
|
||||
|
||||
fi->fib_net = net;
|
||||
fi->fib_protocol = cfg->fc_protocol;
|
||||
@@ -1065,6 +1069,7 @@ 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);
|
||||
if (err)
|
||||
@@ -1117,6 +1122,8 @@ struct fib_info *fib_create_info(struct
|
||||
nh->nh_weight = 1;
|
||||
#endif
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 5 create error err is %d\n",err);
|
||||
+ 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)
|
||||
@@ -1134,6 +1141,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)
|
||||
goto err_inval;
|
||||
@@ -1162,6 +1170,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))
|
||||
goto err_inval;
|
||||
@@ -1170,6 +1179,7 @@ struct fib_info *fib_create_info(struct
|
||||
fib_info_update_nh_saddr(net, nexthop_nh);
|
||||
fib_add_weight(fi, nexthop_nh);
|
||||
} endfor_nexthops(fi)
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 9 create error err is %d\n",err);
|
||||
|
||||
fib_rebalance(fi);
|
||||
|
||||
@@ -1181,6 +1191,7 @@ link_it:
|
||||
ofi->fib_treeref++;
|
||||
return ofi;
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_create_info]: 10 create error err is %d\n",err);
|
||||
|
||||
fi->fib_treeref++;
|
||||
atomic_inc(&fi->fib_clntref);
|
||||
@@ -1204,6 +1215,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:
|
||||
@@ -1214,6 +1226,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.orig/net/ipv4/fib_trie.c src/net/ipv4/fib_trie.c
|
||||
--- src.orig/net/ipv4/fib_trie.c 2016-12-15 19:55:39.720000000 +0000
|
||||
+++ src/net/ipv4/fib_trie.c 2016-12-15 19:57:09.676000000 +0000
|
||||
@@ -1078,6 +1078,7 @@ static int fib_insert_alias(struct trie
|
||||
}
|
||||
|
||||
/* Caller must hold RTNL. */
|
||||
+#include "kpatch-macros.h"
|
||||
int fib_table_insert(struct fib_table *tb, struct fib_config *cfg)
|
||||
{
|
||||
struct trie *t = (struct trie *)tb->tb_data;
|
||||
@@ -1101,11 +1102,14 @@ int fib_table_insert(struct fib_table *t
|
||||
if ((plen < KEYLENGTH) && (key << plen))
|
||||
return -EINVAL;
|
||||
|
||||
+ KPATCH_PRINTK("[fib_table_insert]: start\n");
|
||||
fi = fib_create_info(cfg);
|
||||
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,
|
3
test/integration/ubuntu-16.04/meminfo-cmdline-rebuild-SLOW-LOADED.test
Executable file
3
test/integration/ubuntu-16.04/meminfo-cmdline-rebuild-SLOW-LOADED.test
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
grep VMALLOCCHUNK /proc/meminfo && grep kpatch=1 /proc/cmdline
|
@ -0,0 +1,35 @@
|
||||
diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c
|
||||
--- src.orig/fs/proc/cmdline.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/cmdline.c 2016-12-15 19:57:13.988000000 +0000
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
static int cmdline_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
- seq_printf(m, "%s\n", saved_command_line);
|
||||
+ seq_printf(m, "%s kpatch=1\n", saved_command_line);
|
||||
return 0;
|
||||
}
|
||||
|
||||
diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/meminfo.c 2016-12-15 19:57:13.988000000 +0000
|
||||
@@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_
|
||||
"Committed_AS: %8lu kB\n"
|
||||
"VmallocTotal: %8lu kB\n"
|
||||
"VmallocUsed: %8lu kB\n"
|
||||
- "VmallocChunk: %8lu kB\n"
|
||||
+ "VMALLOCCHUNK: %8lu kB\n"
|
||||
#ifdef CONFIG_MEMORY_FAILURE
|
||||
"HardwareCorrupted: %5lu kB\n"
|
||||
#endif
|
||||
diff -Nupr src.orig/include/linux/kernel.h src/include/linux/kernel.h
|
||||
--- src.orig/include/linux/kernel.h 2016-12-15 19:55:56.996000000 +0000
|
||||
+++ src/include/linux/kernel.h 2016-12-15 19:57:13.992000000 +0000
|
||||
@@ -2,6 +2,7 @@
|
||||
#define _LINUX_KERNEL_H
|
||||
|
||||
|
||||
+
|
||||
#include <stdarg.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/stddef.h>
|
11
test/integration/ubuntu-16.04/meminfo-init-FAIL.patch
Normal file
11
test/integration/ubuntu-16.04/meminfo-init-FAIL.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/meminfo.c 2016-12-15 19:57:22.564000000 +0000
|
||||
@@ -193,6 +193,7 @@ static const struct file_operations memi
|
||||
|
||||
static int __init proc_meminfo_init(void)
|
||||
{
|
||||
+ printk("a\n");
|
||||
proc_create("meminfo", 0, NULL, &meminfo_proc_fops);
|
||||
return 0;
|
||||
}
|
19
test/integration/ubuntu-16.04/meminfo-init2-FAIL.patch
Normal file
19
test/integration/ubuntu-16.04/meminfo-init2-FAIL.patch
Normal file
@ -0,0 +1,19 @@
|
||||
diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/meminfo.c 2016-12-15 19:57:18.240000000 +0000
|
||||
@@ -32,6 +32,7 @@ static int meminfo_proc_show(struct seq_
|
||||
unsigned long pages[NR_LRU_LISTS];
|
||||
int lru;
|
||||
|
||||
+ printk("a\n");
|
||||
/*
|
||||
* display in kilobytes.
|
||||
*/
|
||||
@@ -193,6 +194,7 @@ static const struct file_operations memi
|
||||
|
||||
static int __init proc_meminfo_init(void)
|
||||
{
|
||||
+ printk("a\n");
|
||||
proc_create("meminfo", 0, NULL, &meminfo_proc_fops);
|
||||
return 0;
|
||||
}
|
3
test/integration/ubuntu-16.04/meminfo-string-LOADED.test
Executable file
3
test/integration/ubuntu-16.04/meminfo-string-LOADED.test
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
grep VMALLOCCHUNK /proc/meminfo
|
12
test/integration/ubuntu-16.04/meminfo-string.patch
Normal file
12
test/integration/ubuntu-16.04/meminfo-string.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nupr src.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/meminfo.c 2016-12-15 19:57:26.828000000 +0000
|
||||
@@ -99,7 +99,7 @@ static int meminfo_proc_show(struct seq_
|
||||
"Committed_AS: %8lu kB\n"
|
||||
"VmallocTotal: %8lu kB\n"
|
||||
"VmallocUsed: %8lu kB\n"
|
||||
- "VmallocChunk: %8lu kB\n"
|
||||
+ "VMALLOCCHUNK: %8lu kB\n"
|
||||
#ifdef CONFIG_MEMORY_FAILURE
|
||||
"HardwareCorrupted: %5lu kB\n"
|
||||
#endif
|
33
test/integration/ubuntu-16.04/module-call-external.patch
Normal file
33
test/integration/ubuntu-16.04/module-call-external.patch
Normal file
@ -0,0 +1,33 @@
|
||||
diff -Nupr src.orig/fs/nfsd/export.c src/fs/nfsd/export.c
|
||||
--- src.orig/fs/nfsd/export.c 2016-12-15 19:55:39.012000000 +0000
|
||||
+++ src/fs/nfsd/export.c 2016-12-15 19:57:31.068000000 +0000
|
||||
@@ -1183,6 +1183,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;
|
||||
@@ -1192,6 +1194,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.orig/net/netlink/af_netlink.c src/net/netlink/af_netlink.c
|
||||
--- src.orig/net/netlink/af_netlink.c 2016-12-15 19:55:39.772000000 +0000
|
||||
+++ src/net/netlink/af_netlink.c 2016-12-15 19:57:31.072000000 +0000
|
||||
@@ -3353,4 +3353,9 @@ panic:
|
||||
panic("netlink_init: Cannot allocate nl_table\n");
|
||||
}
|
||||
|
||||
+char *kpatch_string(void)
|
||||
+{
|
||||
+ return "# kpatch\n";
|
||||
+}
|
||||
+
|
||||
core_initcall(netlink_proto_init);
|
12
test/integration/ubuntu-16.04/module-kvm-fixup.patch
Normal file
12
test/integration/ubuntu-16.04/module-kvm-fixup.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nupr src.orig/arch/x86/kvm/vmx.c src/arch/x86/kvm/vmx.c
|
||||
--- src.orig/arch/x86/kvm/vmx.c 2016-12-15 19:55:57.436000000 +0000
|
||||
+++ src/arch/x86/kvm/vmx.c 2016-12-15 19:57:35.344000000 +0000
|
||||
@@ -10574,6 +10574,8 @@ static int vmx_check_intercept(struct kv
|
||||
struct x86_instruction_info *info,
|
||||
enum x86_intercept_stage stage)
|
||||
{
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch vmx_check_intercept\n");
|
||||
return X86EMUL_CONTINUE;
|
||||
}
|
||||
|
24
test/integration/ubuntu-16.04/module-shadow.patch
Normal file
24
test/integration/ubuntu-16.04/module-shadow.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff -Nupr src.orig/arch/x86/kvm/vmx.c src/arch/x86/kvm/vmx.c
|
||||
--- src.orig/arch/x86/kvm/vmx.c 2016-12-15 19:55:57.436000000 +0000
|
||||
+++ src/arch/x86/kvm/vmx.c 2016-12-15 19:57:39.592000000 +0000
|
||||
@@ -10558,10 +10558,20 @@ static void vmx_leave_nested(struct kvm_
|
||||
* It should only be called before L2 actually succeeded to run, and when
|
||||
* vmcs01 is current (it doesn't leave_guest_mode() or switch vmcss).
|
||||
*/
|
||||
+#include "kpatch.h"
|
||||
static void nested_vmx_entry_failure(struct kvm_vcpu *vcpu,
|
||||
struct vmcs12 *vmcs12,
|
||||
u32 reason, unsigned long qualification)
|
||||
{
|
||||
+ int *kpatch;
|
||||
+
|
||||
+ kpatch = kpatch_shadow_alloc(vcpu, "kpatch", sizeof(*kpatch),
|
||||
+ GFP_KERNEL);
|
||||
+ if (kpatch) {
|
||||
+ kpatch_shadow_get(vcpu, "kpatch");
|
||||
+ kpatch_shadow_free(vcpu, "kpatch");
|
||||
+ }
|
||||
+
|
||||
load_vmcs12_host_state(vcpu, vmcs12);
|
||||
vmcs12->vm_exit_reason = reason | VMX_EXIT_REASONS_FAILED_VMENTRY;
|
||||
vmcs12->exit_qualification = qualification;
|
45
test/integration/ubuntu-16.04/multiple.test
Executable file
45
test/integration/ubuntu-16.04/multiple.test
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))"
|
||||
ROOTDIR="$(readlink -f $SCRIPTDIR/../../..)"
|
||||
KPATCH="sudo $ROOTDIR/kpatch/kpatch"
|
||||
|
||||
set -o errexit
|
||||
|
||||
die() {
|
||||
echo "ERROR: $@" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
ko_to_test() {
|
||||
tmp=${1%.ko}-LOADED.test
|
||||
echo ${tmp#kpatch-}
|
||||
}
|
||||
|
||||
# make sure any modules added here are disjoint
|
||||
declare -a modules=(kpatch-cmdline-string.ko kpatch-meminfo-string.ko)
|
||||
|
||||
for mod in "${modules[@]}"; do
|
||||
testprog=$(ko_to_test $mod)
|
||||
$SCRIPTDIR/$testprog && die "$SCRIPTDIR/$testprog succeeded before loading any modules"
|
||||
done
|
||||
|
||||
for mod in "${modules[@]}"; do
|
||||
$KPATCH load $mod
|
||||
done
|
||||
|
||||
for mod in "${modules[@]}"; do
|
||||
testprog=$(ko_to_test $mod)
|
||||
$SCRIPTDIR/$testprog || die "$SCRIPTDIR/$testprog failed after loading modules"
|
||||
done
|
||||
|
||||
for mod in "${modules[@]}"; do
|
||||
$KPATCH unload $mod
|
||||
done
|
||||
|
||||
for mod in "${modules[@]}"; do
|
||||
testprog=$(ko_to_test $mod)
|
||||
$SCRIPTDIR/$testprog && die "$SCRIPTDIR/$testprog succeeded after unloading modules"
|
||||
done
|
||||
|
||||
exit 0
|
25
test/integration/ubuntu-16.04/new-function.patch
Normal file
25
test/integration/ubuntu-16.04/new-function.patch
Normal file
@ -0,0 +1,25 @@
|
||||
diff -Nupr src.orig/drivers/tty/n_tty.c src/drivers/tty/n_tty.c
|
||||
--- src.orig/drivers/tty/n_tty.c 2016-12-15 19:55:54.840000000 +0000
|
||||
+++ src/drivers/tty/n_tty.c 2016-12-15 19:57:43.856000000 +0000
|
||||
@@ -2328,7 +2328,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;
|
||||
@@ -2415,6 +2415,12 @@ break_out:
|
||||
return (b - buf) ? b - buf : retval;
|
||||
}
|
||||
|
||||
+static ssize_t 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/ubuntu-16.04/new-globals.patch
Normal file
34
test/integration/ubuntu-16.04/new-globals.patch
Normal file
@ -0,0 +1,34 @@
|
||||
diff -Nupr src.orig/fs/proc/cmdline.c src/fs/proc/cmdline.c
|
||||
--- src.orig/fs/proc/cmdline.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/cmdline.c 2016-12-15 19:57:48.084000000 +0000
|
||||
@@ -27,3 +27,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.orig/fs/proc/meminfo.c src/fs/proc/meminfo.c
|
||||
--- src.orig/fs/proc/meminfo.c 2016-12-15 19:55:39.084000000 +0000
|
||||
+++ src/fs/proc/meminfo.c 2016-12-15 19:57:48.084000000 +0000
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <asm/pgtable.h>
|
||||
#include "internal.h"
|
||||
|
||||
+void kpatch_print_message(void);
|
||||
+
|
||||
void __attribute__((weak)) arch_report_meminfo(struct seq_file *m)
|
||||
{
|
||||
}
|
||||
@@ -53,6 +55,7 @@ static int meminfo_proc_show(struct seq_
|
||||
/*
|
||||
* Tagged format, for easy grepping and expansion.
|
||||
*/
|
||||
+ kpatch_print_message();
|
||||
seq_printf(m,
|
||||
"MemTotal: %8lu kB\n"
|
||||
"MemFree: %8lu kB\n"
|
11
test/integration/ubuntu-16.04/parainstructions-section.patch
Normal file
11
test/integration/ubuntu-16.04/parainstructions-section.patch
Normal file
@ -0,0 +1,11 @@
|
||||
diff -Nupr src.orig/fs/proc/generic.c src/fs/proc/generic.c
|
||||
--- src.orig/fs/proc/generic.c 2016-12-15 19:55:39.076000000 +0000
|
||||
+++ src/fs/proc/generic.c 2016-12-15 19:57:52.340000000 +0000
|
||||
@@ -195,6 +195,7 @@ int proc_alloc_inum(unsigned int *inum)
|
||||
unsigned int i;
|
||||
int error;
|
||||
|
||||
+ printk("kpatch-test: testing change to .parainstructions section\n");
|
||||
retry:
|
||||
if (!ida_pre_get(&proc_inum_ida, GFP_KERNEL))
|
||||
return -ENOMEM;
|
@ -0,0 +1,12 @@
|
||||
diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c
|
||||
--- src.orig/arch/x86/kvm/x86.c 2016-12-15 19:55:57.436000000 +0000
|
||||
+++ src/arch/x86/kvm/x86.c 2016-12-15 19:57:56.596000000 +0000
|
||||
@@ -230,6 +230,8 @@ static void shared_msr_update(unsigned s
|
||||
|
||||
void kvm_define_shared_msr(unsigned slot, u32 msr)
|
||||
{
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch kvm define shared msr\n");
|
||||
BUG_ON(slot >= KVM_NR_SHARED_MSRS);
|
||||
shared_msrs_global.msrs[slot] = msr;
|
||||
if (slot >= shared_msrs_global.nr)
|
3
test/integration/ubuntu-16.04/shadow-newpid-LOADED.test
Executable file
3
test/integration/ubuntu-16.04/shadow-newpid-LOADED.test
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
grep -q newpid: /proc/$$/status
|
69
test/integration/ubuntu-16.04/shadow-newpid.patch
Normal file
69
test/integration/ubuntu-16.04/shadow-newpid.patch
Normal file
@ -0,0 +1,69 @@
|
||||
diff -Nupr src.orig/fs/proc/array.c src/fs/proc/array.c
|
||||
--- src.orig/fs/proc/array.c 2016-12-15 19:55:39.080000000 +0000
|
||||
+++ src/fs/proc/array.c 2016-12-15 19:58:00.840000000 +0000
|
||||
@@ -334,13 +334,20 @@ static inline void task_seccomp(struct s
|
||||
#endif
|
||||
}
|
||||
|
||||
+#include "kpatch.h"
|
||||
static inline void task_context_switch_counts(struct seq_file *m,
|
||||
struct task_struct *p)
|
||||
{
|
||||
+ int *newpid;
|
||||
+
|
||||
seq_printf(m, "voluntary_ctxt_switches:\t%lu\n"
|
||||
"nonvoluntary_ctxt_switches:\t%lu\n",
|
||||
p->nvcsw,
|
||||
p->nivcsw);
|
||||
+
|
||||
+ newpid = kpatch_shadow_get(p, "newpid");
|
||||
+ 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.orig/kernel/exit.c src/kernel/exit.c
|
||||
--- src.orig/kernel/exit.c 2016-12-15 19:56:00.184000000 +0000
|
||||
+++ src/kernel/exit.c 2016-12-15 19:58:00.840000000 +0000
|
||||
@@ -650,6 +650,7 @@ static void check_stack_usage(void)
|
||||
static inline void check_stack_usage(void) {}
|
||||
#endif
|
||||
|
||||
+#include "kpatch.h"
|
||||
void do_exit(long code)
|
||||
{
|
||||
struct task_struct *tsk = current;
|
||||
@@ -758,6 +759,8 @@ void do_exit(long code)
|
||||
|
||||
cgroup_exit(tsk);
|
||||
|
||||
+ kpatch_shadow_free(tsk, "newpid");
|
||||
+
|
||||
/*
|
||||
* FIXME: do that only when needed, using sched_exit tracepoint
|
||||
*/
|
||||
diff -Nupr src.orig/kernel/fork.c src/kernel/fork.c
|
||||
--- src.orig/kernel/fork.c 2016-12-15 19:56:00.184000000 +0000
|
||||
+++ src/kernel/fork.c 2016-12-15 19:58:00.840000000 +0000
|
||||
@@ -1726,6 +1726,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 "kpatch.h"
|
||||
long _do_fork(unsigned long clone_flags,
|
||||
unsigned long stack_start,
|
||||
unsigned long stack_size,
|
||||
@@ -1764,6 +1765,13 @@ long _do_fork(unsigned long clone_flags,
|
||||
if (!IS_ERR(p)) {
|
||||
struct completion vfork;
|
||||
struct pid *pid;
|
||||
+ int *newpid;
|
||||
+ static int ctr = 0;
|
||||
+
|
||||
+ newpid = kpatch_shadow_alloc(p, "newpid", sizeof(*newpid),
|
||||
+ GFP_KERNEL);
|
||||
+ if (newpid)
|
||||
+ *newpid = ctr++;
|
||||
|
||||
trace_sched_process_fork(current, p);
|
||||
|
12
test/integration/ubuntu-16.04/smp-locks-section.patch
Normal file
12
test/integration/ubuntu-16.04/smp-locks-section.patch
Normal file
@ -0,0 +1,12 @@
|
||||
diff -Nupr src.orig/drivers/tty/tty_buffer.c src/drivers/tty/tty_buffer.c
|
||||
--- src.orig/drivers/tty/tty_buffer.c 2016-12-15 19:55:54.840000000 +0000
|
||||
+++ src/drivers/tty/tty_buffer.c 2016-12-15 19:58:05.088000000 +0000
|
||||
@@ -255,6 +255,8 @@ 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;
|
24
test/integration/ubuntu-16.04/special-static-2.patch
Normal file
24
test/integration/ubuntu-16.04/special-static-2.patch
Normal file
@ -0,0 +1,24 @@
|
||||
diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c
|
||||
--- src.orig/arch/x86/kvm/x86.c 2016-12-15 19:55:57.436000000 +0000
|
||||
+++ src/arch/x86/kvm/x86.c 2016-12-15 19:58:09.352000000 +0000
|
||||
@@ -2026,12 +2026,20 @@ static void record_steal_time(struct kvm
|
||||
&vcpu->arch.st.steal, sizeof(struct kvm_steal_time));
|
||||
}
|
||||
|
||||
+void kpatch_kvm_x86_foo(void)
|
||||
+{
|
||||
+ if (!jiffies)
|
||||
+ printk("kpatch kvm x86 foo\n");
|
||||
+}
|
||||
+
|
||||
int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
|
||||
{
|
||||
bool pr = false;
|
||||
u32 msr = msr_info->index;
|
||||
u64 data = msr_info->data;
|
||||
|
||||
+ kpatch_kvm_x86_foo();
|
||||
+
|
||||
switch (msr) {
|
||||
case MSR_AMD64_NB_CFG:
|
||||
case MSR_IA32_UCODE_REV:
|
22
test/integration/ubuntu-16.04/special-static.patch
Normal file
22
test/integration/ubuntu-16.04/special-static.patch
Normal file
@ -0,0 +1,22 @@
|
||||
diff -Nupr src.orig/kernel/fork.c src/kernel/fork.c
|
||||
--- src.orig/kernel/fork.c 2016-12-15 19:56:00.184000000 +0000
|
||||
+++ src/kernel/fork.c 2016-12-15 19:58:13.588000000 +0000
|
||||
@@ -1143,10 +1143,18 @@ static void posix_cpu_timers_init_group(
|
||||
INIT_LIST_HEAD(&sig->cpu_timers[2]);
|
||||
}
|
||||
|
||||
+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/ubuntu-16.04/tracepoints-section.patch
Normal file
13
test/integration/ubuntu-16.04/tracepoints-section.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff -Nupr src.orig/kernel/time/timer.c src/kernel/time/timer.c
|
||||
--- src.orig/kernel/time/timer.c 2016-01-10 23:01:32.000000000 +0000
|
||||
+++ src/kernel/time/timer.c 2016-12-15 20:27:00.368000000 +0000
|
||||
@@ -1433,6 +1433,9 @@ static void run_timer_softirq(struct sof
|
||||
{
|
||||
struct tvec_base *base = this_cpu_ptr(&tvec_bases);
|
||||
|
||||
+ if (!base)
|
||||
+ printk("kpatch-test: testing __tracepoints section changes\n");
|
||||
+
|
||||
if (time_after_eq(jiffies, base->timer_jiffies))
|
||||
__run_timers(base);
|
||||
}
|
8
test/integration/ubuntu-16.04/warn-detect-FAIL.patch
Normal file
8
test/integration/ubuntu-16.04/warn-detect-FAIL.patch
Normal file
@ -0,0 +1,8 @@
|
||||
diff -Nupr src.orig/arch/x86/kvm/x86.c src/arch/x86/kvm/x86.c
|
||||
--- src.orig/arch/x86/kvm/x86.c 2016-12-15 19:55:57.436000000 +0000
|
||||
+++ src/arch/x86/kvm/x86.c 2016-12-15 19:58:17.844000000 +0000
|
||||
@@ -1,3 +1,4 @@
|
||||
+
|
||||
/*
|
||||
* Kernel-based Virtual Machine driver for Linux
|
||||
*
|
Loading…
Reference in New Issue
Block a user