Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching

Pull livepatching fixes from Jiri Kosina:

- regression (from 4.4) fix for ordering issue, introduced by an
earlier ftrace change, that broke live patching of modules.

The fix replaces the ftrace module notifier by direct call in order
to make the ordering guaranteed and well-defined. The patch, from
Jessica Yu, has been acked both by Steven and Rusty

- error message fix from Miroslav Benes

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
ftrace/module: remove ftrace module notifier
livepatch: change the error message in asm/livepatch.h header files

+11 -39
+1 -1
arch/s390/include/asm/livepatch.h
··· 37 37 regs->psw.addr = ip; 38 38 } 39 39 #else 40 - #error Live patching support is disabled; check CONFIG_LIVEPATCH 40 + #error Include linux/livepatch.h, not asm/livepatch.h 41 41 #endif 42 42 43 43 #endif
+1 -1
arch/x86/include/asm/livepatch.h
··· 41 41 regs->ip = ip; 42 42 } 43 43 #else 44 - #error Live patching support is disabled; check CONFIG_LIVEPATCH 44 + #error Include linux/livepatch.h, not asm/livepatch.h 45 45 #endif 46 46 47 47 #endif /* _ASM_X86_LIVEPATCH_H */
+4 -2
include/linux/ftrace.h
··· 603 603 604 604 extern int skip_trace(unsigned long ip); 605 605 extern void ftrace_module_init(struct module *mod); 606 + extern void ftrace_module_enable(struct module *mod); 606 607 extern void ftrace_release_mod(struct module *mod); 607 608 608 609 extern void ftrace_disable_daemon(void); ··· 613 612 static inline int ftrace_force_update(void) { return 0; } 614 613 static inline void ftrace_disable_daemon(void) { } 615 614 static inline void ftrace_enable_daemon(void) { } 616 - static inline void ftrace_release_mod(struct module *mod) {} 617 - static inline void ftrace_module_init(struct module *mod) {} 615 + static inline void ftrace_module_init(struct module *mod) { } 616 + static inline void ftrace_module_enable(struct module *mod) { } 617 + static inline void ftrace_release_mod(struct module *mod) { } 618 618 static inline __init int register_ftrace_command(struct ftrace_func_command *cmd) 619 619 { 620 620 return -EINVAL;
+4
kernel/module.c
··· 984 984 mod->exit(); 985 985 blocking_notifier_call_chain(&module_notify_list, 986 986 MODULE_STATE_GOING, mod); 987 + ftrace_release_mod(mod); 988 + 987 989 async_synchronize_full(); 988 990 989 991 /* Store the name of the last unloaded module for diagnostic purposes */ ··· 3315 3313 module_put(mod); 3316 3314 blocking_notifier_call_chain(&module_notify_list, 3317 3315 MODULE_STATE_GOING, mod); 3316 + ftrace_release_mod(mod); 3318 3317 free_module(mod); 3319 3318 wake_up_all(&module_wq); 3320 3319 return ret; ··· 3392 3389 mod->state = MODULE_STATE_COMING; 3393 3390 mutex_unlock(&module_mutex); 3394 3391 3392 + ftrace_module_enable(mod); 3395 3393 blocking_notifier_call_chain(&module_notify_list, 3396 3394 MODULE_STATE_COMING, mod); 3397 3395 return 0;
+1 -35
kernel/trace/ftrace.c
··· 4961 4961 mutex_unlock(&ftrace_lock); 4962 4962 } 4963 4963 4964 - static void ftrace_module_enable(struct module *mod) 4964 + void ftrace_module_enable(struct module *mod) 4965 4965 { 4966 4966 struct dyn_ftrace *rec; 4967 4967 struct ftrace_page *pg; ··· 5038 5038 ftrace_process_locs(mod, mod->ftrace_callsites, 5039 5039 mod->ftrace_callsites + mod->num_ftrace_callsites); 5040 5040 } 5041 - 5042 - static int ftrace_module_notify(struct notifier_block *self, 5043 - unsigned long val, void *data) 5044 - { 5045 - struct module *mod = data; 5046 - 5047 - switch (val) { 5048 - case MODULE_STATE_COMING: 5049 - ftrace_module_enable(mod); 5050 - break; 5051 - case MODULE_STATE_GOING: 5052 - ftrace_release_mod(mod); 5053 - break; 5054 - default: 5055 - break; 5056 - } 5057 - 5058 - return 0; 5059 - } 5060 - #else 5061 - static int ftrace_module_notify(struct notifier_block *self, 5062 - unsigned long val, void *data) 5063 - { 5064 - return 0; 5065 - } 5066 5041 #endif /* CONFIG_MODULES */ 5067 - 5068 - struct notifier_block ftrace_module_nb = { 5069 - .notifier_call = ftrace_module_notify, 5070 - .priority = INT_MIN, /* Run after anything that can remove kprobes */ 5071 - }; 5072 5042 5073 5043 void __init ftrace_init(void) 5074 5044 { ··· 5067 5097 ret = ftrace_process_locs(NULL, 5068 5098 __start_mcount_loc, 5069 5099 __stop_mcount_loc); 5070 - 5071 - ret = register_module_notifier(&ftrace_module_nb); 5072 - if (ret) 5073 - pr_warning("Failed to register trace ftrace module exit notifier\n"); 5074 5100 5075 5101 set_ftrace_early_filters(); 5076 5102