From 9fac261ed0c9586b7de78f95663fb6feebb063b5 Mon Sep 17 00:00:00 2001 From: Longjun Luo Date: Thu, 15 Sep 2022 17:13:48 +0800 Subject: [PATCH] kpatch-build: rela section could disappear after patched After patched, rela information for some sections could disappear. For example, a function like the following: " notrace noinline static int version_proc_show(struct seq_file *m, void *v) { return 0; } " Apart from common rela entries, trace and return thunk mechanism will generate rela information. Use `notrace` to remove the effect of trace. Make CONFIG_RETHUNK=n can remove the effect of return thunk. Discovered-by: Zongwu Li Signed-off-by: Longjun Luo --- kpatch-build/create-diff-object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 918d21c..f43154b 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -974,7 +974,7 @@ static void kpatch_correlate_section(struct section *sec_orig, __kpatch_correlate_section(sec_orig->base, sec_patched->base); sec_orig = sec_orig->base; sec_patched = sec_patched->base; - } else if (sec_orig->rela) { + } else if (sec_orig->rela && sec_patched->rela) { __kpatch_correlate_section(sec_orig->rela, sec_patched->rela); }