mirror of
https://github.com/dynup/kpatch
synced 2025-05-05 09:28:08 +00:00
Merge pull request #522 from jpoimboe/integration-test-cleanup
Integration test cleanups
This commit is contained in:
commit
d4d4fb2b0e
@ -1,11 +0,0 @@
|
||||
all: clean
|
||||
./kpatch-test
|
||||
|
||||
quick: clean
|
||||
./kpatch-test --quick
|
||||
|
||||
cached:
|
||||
./kpatch-test --cached
|
||||
|
||||
clean:
|
||||
rm -f *.ko *.log COMBINED.patch
|
39
test/integration/f22/Makefile
Normal file
39
test/integration/f22/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
all:
|
||||
$(error please specify local or remote)
|
||||
|
||||
local: slow
|
||||
|
||||
remote: remote_slow
|
||||
|
||||
slow: clean
|
||||
../kpatch-test
|
||||
|
||||
quick: clean
|
||||
../kpatch-test --quick
|
||||
|
||||
cached:
|
||||
../kpatch-test --cached
|
||||
|
||||
clean:
|
||||
rm -f *.ko *.log COMBINED.patch
|
||||
|
||||
check_host:
|
||||
ifndef SSH_HOST
|
||||
$(error SSH_HOST is undefined)
|
||||
endif
|
||||
|
||||
SSH_USER ?= root
|
||||
|
||||
remote_setup: check_host
|
||||
ssh $(SSH_USER)@$(SSH_HOST) exit
|
||||
ssh $(SSH_USER)@$(SSH_HOST) "ls kpatch-setup &> /dev/null" || \
|
||||
(scp remote-setup $(SSH_USER)@$(SSH_HOST):kpatch-setup && \
|
||||
ssh $(SSH_USER)@$(SSH_HOST) "./kpatch-setup")
|
||||
|
||||
remote_sync: remote_setup
|
||||
ssh $(SSH_USER)@$(SSH_HOST) "rm -rf kpatch-test"
|
||||
rsync -Cavz --include=core $(shell readlink -f ../../..) $(SSH_USER)@$(SSH_HOST):kpatch-test
|
||||
ssh $(SSH_USER)@$(SSH_HOST) "cd kpatch-test/kpatch && make"
|
||||
|
||||
remote_slow: remote_sync
|
||||
ssh $(SSH_USER)@$(SSH_HOST) "cd kpatch-test/kpatch/test/integration/f22 && make slow"
|
1
test/integration/f22/README
Normal file
1
test/integration/f22/README
Normal file
@ -0,0 +1 @@
|
||||
4.2.3-200.fc22.x86_64
|
@ -1,13 +1,16 @@
|
||||
ensure timekeeping_forward_now.constprop.8 and
|
||||
timekeeping_forward_now.constprop.9 are correlated.
|
||||
Index: src/kernel/time/timekeeping.c
|
||||
===================================================================
|
||||
--- src.orig/kernel/time/timekeeping.c
|
||||
+++ src/kernel/time/timekeeping.c
|
||||
@@ -480,6 +480,8 @@ void do_gettimeofday(struct timeval *tv)
|
||||
@@ -781,6 +781,9 @@ void do_gettimeofday(struct timeval *tv)
|
||||
{
|
||||
struct timespec now;
|
||||
struct timespec64 now;
|
||||
|
||||
+ if (!tv)
|
||||
+ return;
|
||||
getnstimeofday(&now);
|
||||
+
|
||||
getnstimeofday64(&now);
|
||||
tv->tv_sec = now.tv_sec;
|
||||
tv->tv_usec = now.tv_nsec/1000;
|
16
test/integration/f22/gcc-mangled-3.patch
Normal file
16
test/integration/f22/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.
|
||||
Index: src/mm/slub.c
|
||||
===================================================================
|
||||
--- src.orig/mm/slub.c
|
||||
+++ src/mm/slub.c
|
||||
@@ -5320,6 +5320,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);
|
@ -2,7 +2,7 @@ Index: src/net/ipv4/fib_frontend.c
|
||||
===================================================================
|
||||
--- src.orig/net/ipv4/fib_frontend.c
|
||||
+++ src/net/ipv4/fib_frontend.c
|
||||
@@ -626,6 +626,7 @@ errout:
|
||||
@@ -686,6 +686,7 @@ errout:
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ Index: src/net/ipv4/fib_frontend.c
|
||||
static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh)
|
||||
{
|
||||
struct net *net = sock_net(skb->sk);
|
||||
@@ -644,6 +645,7 @@ static int inet_rtm_newroute(struct sk_b
|
||||
@@ -704,6 +705,7 @@ static int inet_rtm_newroute(struct sk_b
|
||||
}
|
||||
|
||||
err = fib_table_insert(tb, &cfg);
|
||||
@ -22,7 +22,7 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
===================================================================
|
||||
--- src.orig/net/ipv4/fib_semantics.c
|
||||
+++ src/net/ipv4/fib_semantics.c
|
||||
@@ -773,6 +773,7 @@ __be32 fib_info_update_nh_saddr(struct n
|
||||
@@ -760,6 +760,7 @@ __be32 fib_info_update_nh_saddr(struct n
|
||||
return nh->nh_saddr;
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
struct fib_info *fib_create_info(struct fib_config *cfg)
|
||||
{
|
||||
int err;
|
||||
@@ -797,6 +798,7 @@ struct fib_info *fib_create_info(struct
|
||||
@@ -784,6 +785,7 @@ struct fib_info *fib_create_info(struct
|
||||
#endif
|
||||
|
||||
err = -ENOBUFS;
|
||||
@ -38,23 +38,23 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
if (fib_info_cnt >= fib_info_hash_size) {
|
||||
unsigned int new_size = fib_info_hash_size << 1;
|
||||
struct hlist_head *new_info_hash;
|
||||
@@ -817,6 +819,7 @@ struct fib_info *fib_create_info(struct
|
||||
@@ -804,6 +806,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 == NULL)
|
||||
@@ -828,6 +831,7 @@ struct fib_info *fib_create_info(struct
|
||||
if (!fi)
|
||||
@@ -815,6 +818,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 = hold_net(net);
|
||||
fi->fib_net = net;
|
||||
fi->fib_protocol = cfg->fc_protocol;
|
||||
@@ -844,6 +848,7 @@ struct fib_info *fib_create_info(struct
|
||||
@@ -831,6 +835,7 @@ struct fib_info *fib_create_info(struct
|
||||
if (!nexthop_nh->nh_pcpu_rth_output)
|
||||
goto failure;
|
||||
} endfor_nexthops(fi)
|
||||
@ -62,7 +62,7 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
|
||||
if (cfg->fc_mx) {
|
||||
struct nlattr *nla;
|
||||
@@ -866,6 +871,7 @@ struct fib_info *fib_create_info(struct
|
||||
@@ -862,6 +867,7 @@ struct fib_info *fib_create_info(struct
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -70,7 +70,7 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
|
||||
if (cfg->fc_mp) {
|
||||
#ifdef CONFIG_IP_ROUTE_MULTIPATH
|
||||
@@ -898,6 +904,7 @@ struct fib_info *fib_create_info(struct
|
||||
@@ -894,6 +900,7 @@ struct fib_info *fib_create_info(struct
|
||||
nh->nh_weight = 1;
|
||||
#endif
|
||||
}
|
||||
@ -78,7 +78,7 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
|
||||
if (fib_props[cfg->fc_type].error) {
|
||||
if (cfg->fc_gw || cfg->fc_oif || cfg->fc_mp)
|
||||
@@ -915,6 +922,7 @@ struct fib_info *fib_create_info(struct
|
||||
@@ -911,6 +918,7 @@ struct fib_info *fib_create_info(struct
|
||||
goto err_inval;
|
||||
}
|
||||
}
|
||||
@ -86,15 +86,15 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
|
||||
if (cfg->fc_scope > RT_SCOPE_HOST)
|
||||
goto err_inval;
|
||||
@@ -937,6 +945,7 @@ struct fib_info *fib_create_info(struct
|
||||
goto failure;
|
||||
} endfor_nexthops(fi)
|
||||
@@ -939,6 +947,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) {
|
||||
if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
|
||||
@@ -948,6 +957,7 @@ struct fib_info *fib_create_info(struct
|
||||
@@ -950,6 +959,7 @@ struct fib_info *fib_create_info(struct
|
||||
change_nexthops(fi) {
|
||||
fib_info_update_nh_saddr(net, nexthop_nh);
|
||||
} endfor_nexthops(fi)
|
||||
@ -102,7 +102,7 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
|
||||
link_it:
|
||||
ofi = fib_find_info(fi);
|
||||
@@ -957,6 +967,7 @@ link_it:
|
||||
@@ -959,6 +969,7 @@ link_it:
|
||||
ofi->fib_treeref++;
|
||||
return ofi;
|
||||
}
|
||||
@ -110,7 +110,7 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
|
||||
fi->fib_treeref++;
|
||||
atomic_inc(&fi->fib_clntref);
|
||||
@@ -980,6 +991,7 @@ link_it:
|
||||
@@ -982,6 +993,7 @@ link_it:
|
||||
hlist_add_head(&nexthop_nh->nh_hash, head);
|
||||
} endfor_nexthops(fi)
|
||||
spin_unlock_bh(&fib_info_lock);
|
||||
@ -118,7 +118,7 @@ Index: src/net/ipv4/fib_semantics.c
|
||||
return fi;
|
||||
|
||||
err_inval:
|
||||
@@ -990,6 +1002,7 @@ failure:
|
||||
@@ -992,6 +1004,7 @@ failure:
|
||||
fi->fib_dead = 1;
|
||||
free_fib_info(fi);
|
||||
}
|
||||
@ -130,17 +130,17 @@ Index: src/net/ipv4/fib_trie.c
|
||||
===================================================================
|
||||
--- src.orig/net/ipv4/fib_trie.c
|
||||
+++ src/net/ipv4/fib_trie.c
|
||||
@@ -1161,6 +1161,7 @@ done:
|
||||
/*
|
||||
* Caller must hold RTNL.
|
||||
*/
|
||||
@@ -1077,6 +1077,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;
|
||||
@@ -1187,11 +1188,14 @@ int fib_table_insert(struct fib_table *t
|
||||
|
||||
key = key & mask;
|
||||
struct trie *t = (struct trie *)tb->tb_data;
|
||||
@@ -1100,11 +1101,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);
|
||||
@ -151,5 +151,5 @@ Index: src/net/ipv4/fib_trie.c
|
||||
}
|
||||
+ KPATCH_PRINTK("[fib_table_insert]: cross\n");
|
||||
|
||||
l = fib_find_node(t, key);
|
||||
fa = NULL;
|
||||
l = fib_find_node(t, &tp, key);
|
||||
fa = l ? fib_find_alias(&l->leaf, slen, tos, fi->fib_priority,
|
45
test/integration/f22/remote-setup
Executable file
45
test/integration/f22/remote-setup
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash -x
|
||||
|
||||
# install rpms on a Fedora 22 system to prepare it for kpatch integration tests
|
||||
|
||||
set -o errexit
|
||||
|
||||
[[ $UID != 0 ]] && sudo=sudo
|
||||
|
||||
warn() {
|
||||
echo "ERROR: $1" >&2
|
||||
}
|
||||
|
||||
die() {
|
||||
warn "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
install_rpms() {
|
||||
# crude workaround for a weird dnf bug where it fails to download
|
||||
$sudo dnf install -y $* || $sudo dnf install -y $*
|
||||
}
|
||||
|
||||
install_rpms gcc elfutils elfutils-devel rpmdevtools pesign openssl numactl-devel wget patchutils
|
||||
|
||||
$sudo dnf builddep -y kernel || $sudo dnf builddep -y kernel
|
||||
|
||||
# install kernel debuginfo and devel RPMs for target kernel
|
||||
kverrel=$(uname -r)
|
||||
kverrel=${kverrel%.x86_64}
|
||||
kver=${kverrel%%-*}
|
||||
krel=${kverrel#*-}
|
||||
install_rpms https://kojipkgs.fedoraproject.org/packages/kernel/$kver/$krel/x86_64/kernel-debuginfo-$kver-$krel.x86_64.rpm https://kojipkgs.fedoraproject.org/packages/kernel/$kver/$krel/x86_64/kernel-debuginfo-common-x86_64-$kver-$krel.x86_64.rpm https://kojipkgs.fedoraproject.org/packages/kernel/$kver/$krel/x86_64/kernel-devel-$kver-$krel.x86_64.rpm
|
||||
|
||||
# install version of gcc which was used to build the target kernel
|
||||
gccver=$(gcc --version |head -n1 |cut -d' ' -f3-)
|
||||
kgccver=$(readelf -p .comment /usr/lib/debug/lib/modules/$(uname -r)/vmlinux |grep GCC: | tr -s ' ' | cut -d ' ' -f6-)
|
||||
if [[ $gccver != $kgccver ]]; then
|
||||
gver=$(echo $kgccver | awk '{print $1}')
|
||||
grel=$(echo $kgccver | sed 's/.*-\(.*\))/\1/')
|
||||
grel=$grel.$(rpm -q gcc |sed 's/.*\.\(.*\)\.x86_64/\1/')
|
||||
install_rpms https://kojipkgs.fedoraproject.org/packages/gcc/$gver/$grel/x86_64/cpp-$gver-$grel.x86_64.rpm https://kojipkgs.fedoraproject.org/packages/gcc/$gver/$grel/x86_64/gcc-$gver-$grel.x86_64.rpm https://kojipkgs.fedoraproject.org/packages/gcc/$gver/$grel/x86_64/libgomp-$gver-$grel.x86_64.rpm
|
||||
fi
|
||||
|
||||
install_rpms ccache
|
||||
ccache -M 5G
|
@ -2,12 +2,12 @@ Index: src/arch/x86/kvm/x86.c
|
||||
===================================================================
|
||||
--- src.orig/arch/x86/kvm/x86.c
|
||||
+++ src/arch/x86/kvm/x86.c
|
||||
@@ -211,6 +211,8 @@ static void shared_msr_update(unsigned s
|
||||
@@ -218,6 +218,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);
|
||||
if (slot >= shared_msrs_global.nr)
|
||||
shared_msrs_global.nr = slot + 1;
|
||||
shared_msrs_global.msrs[slot] = msr;
|
@ -2,15 +2,15 @@ Index: src/kernel/fork.c
|
||||
===================================================================
|
||||
--- src.orig/kernel/fork.c
|
||||
+++ src/kernel/fork.c
|
||||
@@ -1572,6 +1572,7 @@ struct task_struct *fork_idle(int cpu)
|
||||
@@ -1676,6 +1676,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,
|
||||
long _do_fork(unsigned long clone_flags,
|
||||
unsigned long stack_start,
|
||||
unsigned long stack_size,
|
||||
@@ -1622,6 +1623,13 @@ long do_fork(unsigned long clone_flags,
|
||||
@@ -1714,6 +1715,13 @@ long _do_fork(unsigned long clone_flags,
|
||||
if (!IS_ERR(p)) {
|
||||
struct completion vfork;
|
||||
struct pid *pid;
|
||||
@ -28,7 +28,7 @@ Index: src/fs/proc/array.c
|
||||
===================================================================
|
||||
--- src.orig/fs/proc/array.c
|
||||
+++ src/fs/proc/array.c
|
||||
@@ -337,13 +337,20 @@ static inline void task_seccomp(struct s
|
||||
@@ -331,13 +331,20 @@ static inline void task_seccomp(struct s
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ Index: src/kernel/exit.c
|
||||
===================================================================
|
||||
--- src.orig/kernel/exit.c
|
||||
+++ src/kernel/exit.c
|
||||
@@ -694,6 +694,7 @@ static void check_stack_usage(void)
|
||||
@@ -650,6 +650,7 @@ static void check_stack_usage(void)
|
||||
static inline void check_stack_usage(void) {}
|
||||
#endif
|
||||
|
||||
@ -61,7 +61,7 @@ Index: src/kernel/exit.c
|
||||
void do_exit(long code)
|
||||
{
|
||||
struct task_struct *tsk = current;
|
||||
@@ -790,6 +791,8 @@ void do_exit(long code)
|
||||
@@ -746,6 +747,8 @@ void do_exit(long code)
|
||||
exit_task_work(tsk);
|
||||
exit_thread();
|
||||
|
15
test/integration/f22/tracepoints-section.patch
Normal file
15
test/integration/f22/tracepoints-section.patch
Normal file
@ -0,0 +1,15 @@
|
||||
ensure __jump_table is parsed and we can tell that it effectively didn't change
|
||||
Index: src/kernel/time/timer.c
|
||||
===================================================================
|
||||
--- src.orig/kernel/time/timer.c
|
||||
+++ src/kernel/time/timer.c
|
||||
@@ -1410,6 +1410,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);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
Index: src/mm/slub.c
|
||||
===================================================================
|
||||
--- src.orig/mm/slub.c
|
||||
+++ src/mm/slub.c
|
||||
@@ -5346,6 +5346,9 @@ void get_slabinfo(struct kmem_cache *s,
|
||||
unsigned long nr_free = 0;
|
||||
int node;
|
||||
|
||||
+ if (!jiffies)
|
||||
+ printk("slabinfo\n");
|
||||
+
|
||||
for_each_online_node(node) {
|
||||
struct kmem_cache_node *n = get_node(s, node);
|
||||
|
@ -45,6 +45,7 @@ ROOTDIR="$(readlink -f $SCRIPTDIR/../..)"
|
||||
# TODO: option to use system-installed binaries instead
|
||||
KPATCH="sudo $ROOTDIR/kpatch/kpatch"
|
||||
RMMOD="sudo rmmod"
|
||||
unset CCACHE_HASHDIR
|
||||
KPATCHBUILD="$ROOTDIR"/kpatch-build/kpatch-build
|
||||
ERROR=0
|
||||
LOG=test.log
|
||||
@ -256,8 +257,6 @@ run_combined_test() {
|
||||
echo "clearing printk buffer"
|
||||
sudo dmesg -C
|
||||
|
||||
cd "$SCRIPTDIR"
|
||||
|
||||
if [[ $QUICK != 1 ]]; then
|
||||
for file in *.patch; do
|
||||
build_module $file
|
||||
|
@ -1,14 +0,0 @@
|
||||
Index: src/kernel/timer.c
|
||||
===================================================================
|
||||
--- src.orig/kernel/timer.c
|
||||
+++ src/kernel/timer.c
|
||||
@@ -1370,6 +1370,9 @@ static void run_timer_softirq(struct sof
|
||||
{
|
||||
struct tvec_base *base = __this_cpu_read(tvec_bases);
|
||||
|
||||
+ if (!base)
|
||||
+ printk("kpatch-test: testing __tracepoints section changes\n");
|
||||
+
|
||||
hrtimer_run_pending();
|
||||
|
||||
if (time_after_eq(jiffies, base->timer_jiffies))
|
Loading…
Reference in New Issue
Block a user