diff options
| -rw-r--r-- | kernel/livepatch/core.c | 6 | ||||
| -rw-r--r-- | kernel/trace/ftrace.c | 22 | ||||
| -rw-r--r-- | kernel/trace/trace.c | 4 | ||||
| -rw-r--r-- | kernel/trace/trace_output.c | 2 | ||||
| -rw-r--r-- | kernel/trace/trace_uprobe.c | 15 |
5 files changed, 35 insertions, 14 deletions
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c index 2398832947c6..c4ce08f43bd6 100644 --- a/kernel/livepatch/core.c +++ b/kernel/livepatch/core.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/elf.h> | 18 | #include <linux/elf.h> |
| 19 | #include <linux/moduleloader.h> | 19 | #include <linux/moduleloader.h> |
| 20 | #include <linux/completion.h> | 20 | #include <linux/completion.h> |
| 21 | #include <linux/memory.h> | ||
| 21 | #include <asm/cacheflush.h> | 22 | #include <asm/cacheflush.h> |
| 22 | #include "core.h" | 23 | #include "core.h" |
| 23 | #include "patch.h" | 24 | #include "patch.h" |
| @@ -718,16 +719,21 @@ static int klp_init_object_loaded(struct klp_patch *patch, | |||
| 718 | struct klp_func *func; | 719 | struct klp_func *func; |
| 719 | int ret; | 720 | int ret; |
| 720 | 721 | ||
| 722 | mutex_lock(&text_mutex); | ||
| 723 | |||
| 721 | module_disable_ro(patch->mod); | 724 | module_disable_ro(patch->mod); |
| 722 | ret = klp_write_object_relocations(patch->mod, obj); | 725 | ret = klp_write_object_relocations(patch->mod, obj); |
| 723 | if (ret) { | 726 | if (ret) { |
| 724 | module_enable_ro(patch->mod, true); | 727 | module_enable_ro(patch->mod, true); |
| 728 | mutex_unlock(&text_mutex); | ||
| 725 | return ret; | 729 | return ret; |
| 726 | } | 730 | } |
| 727 | 731 | ||
| 728 | arch_klp_init_object_loaded(patch, obj); | 732 | arch_klp_init_object_loaded(patch, obj); |
| 729 | module_enable_ro(patch->mod, true); | 733 | module_enable_ro(patch->mod, true); |
| 730 | 734 | ||
| 735 | mutex_unlock(&text_mutex); | ||
| 736 | |||
| 731 | klp_for_each_func(obj, func) { | 737 | klp_for_each_func(obj, func) { |
| 732 | ret = klp_find_object_symbol(obj->name, func->old_name, | 738 | ret = klp_find_object_symbol(obj->name, func->old_name, |
| 733 | func->old_sympos, | 739 | func->old_sympos, |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index a12aff849c04..38277af44f5c 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -34,6 +34,7 @@ | |||
| 34 | #include <linux/hash.h> | 34 | #include <linux/hash.h> |
| 35 | #include <linux/rcupdate.h> | 35 | #include <linux/rcupdate.h> |
| 36 | #include <linux/kprobes.h> | 36 | #include <linux/kprobes.h> |
| 37 | #include <linux/memory.h> | ||
| 37 | 38 | ||
| 38 | #include <trace/events/sched.h> | 39 | #include <trace/events/sched.h> |
| 39 | 40 | ||
| @@ -2610,10 +2611,12 @@ static void ftrace_run_update_code(int command) | |||
| 2610 | { | 2611 | { |
| 2611 | int ret; | 2612 | int ret; |
| 2612 | 2613 | ||
| 2614 | mutex_lock(&text_mutex); | ||
| 2615 | |||
| 2613 | ret = ftrace_arch_code_modify_prepare(); | 2616 | ret = ftrace_arch_code_modify_prepare(); |
| 2614 | FTRACE_WARN_ON(ret); | 2617 | FTRACE_WARN_ON(ret); |
| 2615 | if (ret) | 2618 | if (ret) |
| 2616 | return; | 2619 | goto out_unlock; |
| 2617 | 2620 | ||
| 2618 | /* | 2621 | /* |
| 2619 | * By default we use stop_machine() to modify the code. | 2622 | * By default we use stop_machine() to modify the code. |
| @@ -2625,6 +2628,9 @@ static void ftrace_run_update_code(int command) | |||
| 2625 | 2628 | ||
| 2626 | ret = ftrace_arch_code_modify_post_process(); | 2629 | ret = ftrace_arch_code_modify_post_process(); |
| 2627 | FTRACE_WARN_ON(ret); | 2630 | FTRACE_WARN_ON(ret); |
| 2631 | |||
| 2632 | out_unlock: | ||
| 2633 | mutex_unlock(&text_mutex); | ||
| 2628 | } | 2634 | } |
| 2629 | 2635 | ||
| 2630 | static void ftrace_run_modify_code(struct ftrace_ops *ops, int command, | 2636 | static void ftrace_run_modify_code(struct ftrace_ops *ops, int command, |
| @@ -2935,14 +2941,13 @@ static int ftrace_update_code(struct module *mod, struct ftrace_page *new_pgs) | |||
| 2935 | p = &pg->records[i]; | 2941 | p = &pg->records[i]; |
| 2936 | p->flags = rec_flags; | 2942 | p->flags = rec_flags; |
| 2937 | 2943 | ||
| 2938 | #ifndef CC_USING_NOP_MCOUNT | ||
| 2939 | /* | 2944 | /* |
| 2940 | * Do the initial record conversion from mcount jump | 2945 | * Do the initial record conversion from mcount jump |
| 2941 | * to the NOP instructions. | 2946 | * to the NOP instructions. |
| 2942 | */ | 2947 | */ |
| 2943 | if (!ftrace_code_disable(mod, p)) | 2948 | if (!__is_defined(CC_USING_NOP_MCOUNT) && |
| 2949 | !ftrace_code_disable(mod, p)) | ||
| 2944 | break; | 2950 | break; |
| 2945 | #endif | ||
| 2946 | 2951 | ||
| 2947 | update_cnt++; | 2952 | update_cnt++; |
| 2948 | } | 2953 | } |
| @@ -4221,10 +4226,13 @@ void free_ftrace_func_mapper(struct ftrace_func_mapper *mapper, | |||
| 4221 | struct ftrace_func_entry *entry; | 4226 | struct ftrace_func_entry *entry; |
| 4222 | struct ftrace_func_map *map; | 4227 | struct ftrace_func_map *map; |
| 4223 | struct hlist_head *hhd; | 4228 | struct hlist_head *hhd; |
| 4224 | int size = 1 << mapper->hash.size_bits; | 4229 | int size, i; |
| 4225 | int i; | 4230 | |
| 4231 | if (!mapper) | ||
| 4232 | return; | ||
| 4226 | 4233 | ||
| 4227 | if (free_func && mapper->hash.count) { | 4234 | if (free_func && mapper->hash.count) { |
| 4235 | size = 1 << mapper->hash.size_bits; | ||
| 4228 | for (i = 0; i < size; i++) { | 4236 | for (i = 0; i < size; i++) { |
| 4229 | hhd = &mapper->hash.buckets[i]; | 4237 | hhd = &mapper->hash.buckets[i]; |
| 4230 | hlist_for_each_entry(entry, hhd, hlist) { | 4238 | hlist_for_each_entry(entry, hhd, hlist) { |
| @@ -5776,6 +5784,7 @@ void ftrace_module_enable(struct module *mod) | |||
| 5776 | struct ftrace_page *pg; | 5784 | struct ftrace_page *pg; |
| 5777 | 5785 | ||
| 5778 | mutex_lock(&ftrace_lock); | 5786 | mutex_lock(&ftrace_lock); |
| 5787 | mutex_lock(&text_mutex); | ||
| 5779 | 5788 | ||
| 5780 | if (ftrace_disabled) | 5789 | if (ftrace_disabled) |
| 5781 | goto out_unlock; | 5790 | goto out_unlock; |
| @@ -5837,6 +5846,7 @@ void ftrace_module_enable(struct module *mod) | |||
| 5837 | ftrace_arch_code_modify_post_process(); | 5846 | ftrace_arch_code_modify_post_process(); |
| 5838 | 5847 | ||
| 5839 | out_unlock: | 5848 | out_unlock: |
| 5849 | mutex_unlock(&text_mutex); | ||
| 5840 | mutex_unlock(&ftrace_lock); | 5850 | mutex_unlock(&ftrace_lock); |
| 5841 | 5851 | ||
| 5842 | process_cached_mods(mod->name); | 5852 | process_cached_mods(mod->name); |
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 1c80521fd436..83e08b78dbee 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
| @@ -6923,7 +6923,7 @@ struct tracing_log_err { | |||
| 6923 | 6923 | ||
| 6924 | static DEFINE_MUTEX(tracing_err_log_lock); | 6924 | static DEFINE_MUTEX(tracing_err_log_lock); |
| 6925 | 6925 | ||
| 6926 | struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) | 6926 | static struct tracing_log_err *get_tracing_log_err(struct trace_array *tr) |
| 6927 | { | 6927 | { |
| 6928 | struct tracing_log_err *err; | 6928 | struct tracing_log_err *err; |
| 6929 | 6929 | ||
| @@ -8192,7 +8192,7 @@ static const struct file_operations buffer_percent_fops = { | |||
| 8192 | .llseek = default_llseek, | 8192 | .llseek = default_llseek, |
| 8193 | }; | 8193 | }; |
| 8194 | 8194 | ||
| 8195 | struct dentry *trace_instance_dir; | 8195 | static struct dentry *trace_instance_dir; |
| 8196 | 8196 | ||
| 8197 | static void | 8197 | static void |
| 8198 | init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer); | 8198 | init_tracer_tracefs(struct trace_array *tr, struct dentry *d_tracer); |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 54373d93e251..ba751f993c3b 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
| @@ -1057,7 +1057,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter, | |||
| 1057 | 1057 | ||
| 1058 | trace_seq_puts(s, "<stack trace>\n"); | 1058 | trace_seq_puts(s, "<stack trace>\n"); |
| 1059 | 1059 | ||
| 1060 | for (p = field->caller; p && *p != ULONG_MAX && p < end; p++) { | 1060 | for (p = field->caller; p && p < end && *p != ULONG_MAX; p++) { |
| 1061 | 1061 | ||
| 1062 | if (trace_seq_has_overflowed(s)) | 1062 | if (trace_seq_has_overflowed(s)) |
| 1063 | break; | 1063 | break; |
diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c index eb7e06b54741..b55906c77ce0 100644 --- a/kernel/trace/trace_uprobe.c +++ b/kernel/trace/trace_uprobe.c | |||
| @@ -426,8 +426,6 @@ end: | |||
| 426 | /* | 426 | /* |
| 427 | * Argument syntax: | 427 | * Argument syntax: |
| 428 | * - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] | 428 | * - Add uprobe: p|r[:[GRP/]EVENT] PATH:OFFSET [FETCHARGS] |
| 429 | * | ||
| 430 | * - Remove uprobe: -:[GRP/]EVENT | ||
| 431 | */ | 429 | */ |
| 432 | static int trace_uprobe_create(int argc, const char **argv) | 430 | static int trace_uprobe_create(int argc, const char **argv) |
| 433 | { | 431 | { |
| @@ -443,10 +441,17 @@ static int trace_uprobe_create(int argc, const char **argv) | |||
| 443 | ret = 0; | 441 | ret = 0; |
| 444 | ref_ctr_offset = 0; | 442 | ref_ctr_offset = 0; |
| 445 | 443 | ||
| 446 | /* argc must be >= 1 */ | 444 | switch (argv[0][0]) { |
| 447 | if (argv[0][0] == 'r') | 445 | case 'r': |
| 448 | is_return = true; | 446 | is_return = true; |
| 449 | else if (argv[0][0] != 'p' || argc < 2) | 447 | break; |
| 448 | case 'p': | ||
| 449 | break; | ||
| 450 | default: | ||
| 451 | return -ECANCELED; | ||
| 452 | } | ||
| 453 | |||
| 454 | if (argc < 2) | ||
| 450 | return -ECANCELED; | 455 | return -ECANCELED; |
| 451 | 456 | ||
| 452 | if (argv[0][1] == ':') | 457 | if (argv[0][1] == ':') |
