From 543ad11ccd063e2db890e4478d5e522f20504beb Mon Sep 17 00:00:00 2001 From: Josh Poimboeuf Date: Thu, 14 Aug 2014 01:02:26 -0500 Subject: [PATCH] create-diff-object: allow new data to be included Allow the inclusion of new global variables. --- kpatch-build/create-diff-object.c | 2 +- test/integration/data-new-LOADED.test | 3 +++ test/integration/data-new.patch | 29 +++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 test/integration/data-new-LOADED.test create mode 100644 test/integration/data-new.patch diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 3da9905..f868ff3 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -1122,7 +1122,7 @@ void kpatch_verify_patchability(struct kpatch_elf *kelf) } /* ensure we aren't including .data.* or .bss.* */ - if (sec->include && + if (sec->include && sec->status != NEW && (!strncmp(sec->name, ".data", 5) || !strncmp(sec->name, ".bss", 4))) { log_normal("data section %s selected for inclusion\n", diff --git a/test/integration/data-new-LOADED.test b/test/integration/data-new-LOADED.test new file mode 100755 index 0000000..598b6bb --- /dev/null +++ b/test/integration/data-new-LOADED.test @@ -0,0 +1,3 @@ +#!/bin/bash + +grep "kpatch: 5" /proc/meminfo diff --git a/test/integration/data-new.patch b/test/integration/data-new.patch new file mode 100644 index 0000000..650db69 --- /dev/null +++ b/test/integration/data-new.patch @@ -0,0 +1,29 @@ +Index: src/fs/proc/meminfo.c +=================================================================== +--- src.orig/fs/proc/meminfo.c ++++ src/fs/proc/meminfo.c +@@ -20,6 +20,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; +@@ -138,6 +140,7 @@ static int meminfo_proc_show(struct seq_ + #ifdef CONFIG_TRANSPARENT_HUGEPAGE + "AnonHugePages: %8lu kB\n" + #endif ++ "kpatch: %d" + , + K(i.totalram), + K(i.freeram), +@@ -193,6 +196,7 @@ static int meminfo_proc_show(struct seq_ + ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * + HPAGE_PMD_NR) + #endif ++ ,foo + ); + + hugetlb_report_meminfo(m);