mirror of https://github.com/dynup/kpatch
Merge pull request #190 from jpoimboe/test-special-sections
add tests for special sections
This commit is contained in:
commit
d349d705bf
|
@ -1,2 +1,11 @@
|
||||||
|
all:
|
||||||
|
./kpatch-test
|
||||||
|
|
||||||
|
# Just reuse any already-built modules for the tests. This isn't a
|
||||||
|
# reliable way to run tests if the code has changed, but it comes in
|
||||||
|
# handy when creating new tests.
|
||||||
|
quick:
|
||||||
|
./kpatch-test -s
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.ko *.log
|
rm -f *.ko *.log
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: src/fs/proc/proc_sysctl.c
|
||||||
|
===================================================================
|
||||||
|
--- src.orig/fs/proc/proc_sysctl.c
|
||||||
|
+++ src/fs/proc/proc_sysctl.c
|
||||||
|
@@ -266,6 +266,7 @@ void sysctl_head_put(struct ctl_table_he
|
||||||
|
|
||||||
|
static struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
|
||||||
|
{
|
||||||
|
+ printk("kpatch-test: testing __bug_table section changes\n");
|
||||||
|
BUG_ON(!head);
|
||||||
|
spin_lock(&sysctl_lock);
|
||||||
|
if (!use_table(head))
|
|
@ -125,21 +125,26 @@ run_load_test() {
|
||||||
module=kpatch-$prefix.ko
|
module=kpatch-$prefix.ko
|
||||||
testprog=$prefix-LOADED.test
|
testprog=$prefix-LOADED.test
|
||||||
|
|
||||||
[[ ! -e $testprog ]] && return
|
[[ $prefix = *-FAIL ]] && return
|
||||||
|
|
||||||
log "load test: $prefix"
|
|
||||||
|
|
||||||
if [[ ! -e $module ]]; then
|
if [[ ! -e $module ]]; then
|
||||||
error "$prefix: can't find $module"
|
log "can't find $module, skipping"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -e $testprog ]]; then
|
||||||
|
log "load test: $prefix"
|
||||||
|
else
|
||||||
|
log "load test: $prefix (no test prog)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if ! $KPATCH replace $module >> $LOG 2>&1; then
|
if ! $KPATCH replace $module >> $LOG 2>&1; then
|
||||||
error "$prefix: kpatch replace failed"
|
error "$prefix: kpatch replace failed"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ./$testprog >> $LOG 2>&1; then
|
if [[ -e $testprog ]] && ! ./$testprog >> $LOG 2>&1; then
|
||||||
error "$prefix: $testprog failed after kpatch replace"
|
error "$prefix: $testprog failed after kpatch replace"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -149,7 +154,7 @@ run_load_test() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ./$testprog >> $LOG 2>&1; then
|
if [[ -e $testprog ]] && ./$testprog >> $LOG 2>&1; then
|
||||||
error "$prefix: $testprog succeeded after kpatch unload"
|
error "$prefix: $testprog succeeded after kpatch unload"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -159,7 +164,7 @@ run_load_test() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ./$testprog >> $LOG 2>&1; then
|
if [[ -e $testprog ]] && ! ./$testprog >> $LOG 2>&1; then
|
||||||
error "$prefix: $testprog failed after kpatch load"
|
error "$prefix: $testprog failed after kpatch load"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
Index: src/fs/proc/generic.c
|
||||||
|
===================================================================
|
||||||
|
--- src.orig/fs/proc/generic.c
|
||||||
|
+++ src/fs/proc/generic.c
|
||||||
|
@@ -132,6 +132,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 @@
|
||||||
|
Index: src/drivers/tty/tty_buffer.c
|
||||||
|
===================================================================
|
||||||
|
--- src.orig/drivers/tty/tty_buffer.c
|
||||||
|
+++ src/drivers/tty/tty_buffer.c
|
||||||
|
@@ -245,6 +245,7 @@ static int __tty_buffer_request_room(str
|
||||||
|
struct tty_buffer *b, *n;
|
||||||
|
int left, change;
|
||||||
|
|
||||||
|
+ printk("kpatch-test: testing .smp_locks section changes\n");
|
||||||
|
b = buf->tail;
|
||||||
|
if (b->flags & TTYB_NORMAL)
|
||||||
|
left = 2 * b->size - b->used;
|
Loading…
Reference in New Issue