From e3a9643c7fa2ac5f8093c8ac578ce9dfd45084c7 Mon Sep 17 00:00:00 2001 From: Zhipeng Xie Date: Fri, 2 Nov 2018 17:24:51 +0000 Subject: [PATCH 05/21] create-diff-object: fix correlate static local variables for __param section kpatch-build correlate fail when no sections reference static local variables in __param section, so the static local variables are incorrectly recognized as a new symbol and include a incomplete __param section into the patch. The kernel oops when meet the incomplete __param section. [ 625.961330] Call Trace: [ 625.963279] [] ? kernfs_name_hash+0x17/0xd0 [ 625.965213] [] kernfs_add_one+0x8f/0x150 [ 625.967120] [] __kernfs_create_file+0x7e/0xa0 [ 625.969038] [] sysfs_add_file_mode_ns+0x9b/0x160 [ 625.970912] [] internal_create_group+0xd1/0x250 [ 625.972755] [] ? add_sysfs_param.isra.3+0x89/0x280 [ 625.975274] [] sysfs_create_group+0x13/0x20 [ 625.977108] [] module_param_sysfs_setup+0x94/0xd0 [ 625.978899] [] load_module+0x2392/0x2bc0 [ 625.980693] [] ? ddebug_proc_write+0xf0/0xf0 [ 625.982448] [] ? copy_module_from_fd.isra.43+0x53/0x150 [ 625.984187] [] SyS_finit_module+0xa6/0xd0 [ 625.985926] [] system_call_fastpath+0x1c/0x21 Signed-off-by: Zhipeng Xie --- kpatch-build/create-diff-object.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kpatch-build/create-diff-object.c b/kpatch-build/create-diff-object.c index 267bd66..78f5a7e 100644 --- a/kpatch-build/create-diff-object.c +++ b/kpatch-build/create-diff-object.c @@ -1107,6 +1107,10 @@ static int kpatch_is_normal_static_local(struct symbol *sym) if (is_special_static(sym)) return 0; + if (!strncmp(sym->name, "__param_", strlen("__param_")) && + !strncmp(sym->sec->name, "__param", strlen("__param"))) + return 0; + return 1; } -- 2.18.1