dynup/kpatch — pull request #332 by spartacus06 (2014-07-25 16:13:43+00:00)
Title: add KPATCH_IGNORE_SECTION support (plus fixups)

Add KPATCH_IGNORE_SECTION() macro, which ignores sections that may change as a side effect of another change or might be a non-bundlable section; that is one that does not honor -ffunction-section and create a one-to-one relation from function symbol to section.

Fixes #265

Test patch:
```
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index e0501fe..955ee0d 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -1545,7 +1545,7 @@ void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, struct task_struct *task)
}
EXPORT_SYMBOL_GPL(hrtimer_init_sleeper);

-static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mode)
+static int do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mode)
{
hrtimer_init_sleeper(t, current);

@@ -1564,9 +1564,14 @@ static int __sched do_nanosleep(struct hrtimer_sleeper *t, enum hrtimer_mode mod
} while (t->task && !signal_pending(current));

__set_current_state(TASK_RUNNING);
+	if (jiffies == 0)
+	printk("what?\n");

return t->task == NULL;
}
+#include "kpatch-macros.h"
+KPATCH_IGNORE_SECTION(".sched.text");
+KPATCH_FORCE_UNSAFE(do_nanosleep);

static int update_rmtp(struct hrtimer *timer, struct timespec __user *rmtp)
{
```

Expected Output:
```
Testing patch file
checking file kernel/hrtimer.c
Building original kernel
Building patched kernel
Detecting changed objects
Rebuilding original objects
Extracting new and modified ELF sections
hrtimer.o: NOTICE: symbol do_nanosleep has changed sections
hrtimer.o: ignoring section .sched.text
hrtimer.o: changed function: do_nanosleep
hrtimer.o: function 'do_nanosleep' marked with KPATCH_FORCE_UNSAFE!
Patched objects: vmlinux
Building patch module: kpatch-patch.ko
SUCCESS
```