From 09ef2457cd928f414aad8edcb8f1f206206abdb1 Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Tue, 28 Feb 2017 15:32:46 +0000 Subject: [PATCH] create-diff-object: Mark correlated static local variables the SAME initially Normal correlated symbols are marked the SAME initially but static local variables are correlated in a separate function. Also mark these the SAME. This fixes an issue where patching a function which called printk_once (which uses a static local variable) would fail to build because the static local variable was considered new and thus introduced a new data member into .data..read_mostly which is not allowed to change. Signed-off-by: Ross Lagerwall --- kpatch-build/create-diff-object.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 92ddcc3..f1b5023 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -767,6 +767,9 @@ static void kpatch_correlate_static_local_variables(struct kpatch_elf *base, sym->twin = patched_sym; patched_sym->twin = sym; + /* set initial status, might change */ + sym->status = patched_sym->status = SAME; + if (bundled) { sym->sec->twin = patched_sym->sec; patched_sym->sec->twin = sym->sec;