From 92a4ca262188f33721d9f02df08799fa2a48c621 Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Fri, 23 May 2014 07:43:07 -0500 Subject: [PATCH] create-diff-object: support tracepoints and related sections Add support for the following special sections: - __jump_table - __tracepoints - __tracepoints_ptrs - __tracepoints_strings Fixes #157. --- kpatch-build/create-diff-object.c | 14 +++++++++++--- test/integration/tracepoints-section.patch | 13 +++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 test/integration/tracepoints-section.patch diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index f1400cf..609eb5f 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -997,6 +997,7 @@ int smp_locks_group_size(struct section *sec, int offset) { return 4; } int parainstructions_group_size(struct section *sec, int offset) { return 16; } int ex_table_group_size(struct section *sec, int offset) { return 8; } int altinstructions_group_size(struct section *sec, int offset) { return 12; } +int jump_table_group_size(struct section *sec, int offset) { return 24; } int fixup_group_size(struct section *sec, int offset) { @@ -1035,6 +1036,10 @@ struct special_section special_sections[] = { .name = "__ex_table", .group_size = ex_table_group_size, }, + { + .name = "__jump_table", + .group_size = jump_table_group_size, + }, { .name = ".altinstructions", .group_size = altinstructions_group_size, @@ -1167,11 +1172,14 @@ void kpatch_process_special_sections(struct kpatch_elf *kelf) } /* - * The following special section doesn't have relas which reference - * non-included symbols, so its entire rela section can be included. + * The following special sections don't have relas which reference + * non-included symbols, so their entire rela section can be included. */ list_for_each_entry(sec, &kelf->sections, list) { - if (strcmp(sec->name, ".altinstr_replacement")) + if (strcmp(sec->name, ".altinstr_replacement") && + strcmp(sec->name, "__tracepoints") && + strcmp(sec->name, "__tracepoints_ptrs") && + strcmp(sec->name, "__tracepoints_strings")) continue; /* include base section */ diff --git a/test/integration/tracepoints-section.patch b/test/integration/tracepoints-section.patch new file mode 100644 index 0000000..c3845d8 --- /dev/null +++ b/test/integration/tracepoints-section.patch @@ -0,0 +1,13 @@ +Index: src/kernel/timer.c +=================================================================== +--- src.orig/kernel/timer.c ++++ src/kernel/timer.c +@@ -1370,6 +1370,8 @@ static void run_timer_softirq(struct sof + { + struct tvec_base *base = __this_cpu_read(tvec_bases); + ++ printk("kpatch-test: testing __tracepoints section changes\n"); ++ + hrtimer_run_pending(); + + if (time_after_eq(jiffies, base->timer_jiffies))