diff options
| -rw-r--r-- | arch/blackfin/mm/maccess.c | 4 | ||||
| -rw-r--r-- | arch/s390/mm/maccess.c | 4 | ||||
| -rw-r--r-- | arch/x86/kernel/ftrace.c | 12 | ||||
| -rw-r--r-- | include/linux/ftrace_event.h | 12 | ||||
| -rw-r--r-- | include/linux/sched.h | 2 | ||||
| -rw-r--r-- | include/linux/uaccess.h | 8 | ||||
| -rw-r--r-- | include/trace/events/btrfs.h | 4 | ||||
| -rw-r--r-- | include/trace/ftrace.h | 13 | ||||
| -rw-r--r-- | kernel/jump_label.c | 18 | ||||
| -rw-r--r-- | kernel/trace/ftrace.c | 31 | ||||
| -rw-r--r-- | kernel/trace/ring_buffer.c | 10 | ||||
| -rw-r--r-- | kernel/trace/trace.h | 15 | ||||
| -rw-r--r-- | kernel/trace/trace_events.c | 7 | ||||
| -rw-r--r-- | kernel/trace/trace_output.c | 27 | ||||
| -rw-r--r-- | mm/maccess.c | 8 | ||||
| -rw-r--r-- | scripts/recordmcount.h | 8 | ||||
| -rwxr-xr-x | scripts/tags.sh | 6 |
17 files changed, 148 insertions, 41 deletions
diff --git a/arch/blackfin/mm/maccess.c b/arch/blackfin/mm/maccess.c index b71cebc1f8a3..e2532114c5fd 100644 --- a/arch/blackfin/mm/maccess.c +++ b/arch/blackfin/mm/maccess.c | |||
| @@ -16,7 +16,7 @@ static int validate_memory_access_address(unsigned long addr, int size) | |||
| 16 | return bfin_mem_access_type(addr, size); | 16 | return bfin_mem_access_type(addr, size); |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | long probe_kernel_read(void *dst, void *src, size_t size) | 19 | long probe_kernel_read(void *dst, const void *src, size_t size) |
| 20 | { | 20 | { |
| 21 | unsigned long lsrc = (unsigned long)src; | 21 | unsigned long lsrc = (unsigned long)src; |
| 22 | int mem_type; | 22 | int mem_type; |
| @@ -55,7 +55,7 @@ long probe_kernel_read(void *dst, void *src, size_t size) | |||
| 55 | return -EFAULT; | 55 | return -EFAULT; |
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | long probe_kernel_write(void *dst, void *src, size_t size) | 58 | long probe_kernel_write(void *dst, const void *src, size_t size) |
| 59 | { | 59 | { |
| 60 | unsigned long ldst = (unsigned long)dst; | 60 | unsigned long ldst = (unsigned long)dst; |
| 61 | int mem_type; | 61 | int mem_type; |
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 71a4b0d34be0..51e5cd9b906a 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | * using the stura instruction. | 19 | * using the stura instruction. |
| 20 | * Returns the number of bytes copied or -EFAULT. | 20 | * Returns the number of bytes copied or -EFAULT. |
| 21 | */ | 21 | */ |
| 22 | static long probe_kernel_write_odd(void *dst, void *src, size_t size) | 22 | static long probe_kernel_write_odd(void *dst, const void *src, size_t size) |
| 23 | { | 23 | { |
| 24 | unsigned long count, aligned; | 24 | unsigned long count, aligned; |
| 25 | int offset, mask; | 25 | int offset, mask; |
| @@ -45,7 +45,7 @@ static long probe_kernel_write_odd(void *dst, void *src, size_t size) | |||
| 45 | return rc ? rc : count; | 45 | return rc ? rc : count; |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | long probe_kernel_write(void *dst, void *src, size_t size) | 48 | long probe_kernel_write(void *dst, const void *src, size_t size) |
| 49 | { | 49 | { |
| 50 | long copied = 0; | 50 | long copied = 0; |
| 51 | 51 | ||
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index 0ba15a6cc57e..c9a281f272fd 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c | |||
| @@ -123,7 +123,7 @@ static unsigned char *ftrace_call_replace(unsigned long ip, unsigned long addr) | |||
| 123 | static atomic_t nmi_running = ATOMIC_INIT(0); | 123 | static atomic_t nmi_running = ATOMIC_INIT(0); |
| 124 | static int mod_code_status; /* holds return value of text write */ | 124 | static int mod_code_status; /* holds return value of text write */ |
| 125 | static void *mod_code_ip; /* holds the IP to write to */ | 125 | static void *mod_code_ip; /* holds the IP to write to */ |
| 126 | static void *mod_code_newcode; /* holds the text to write to the IP */ | 126 | static const void *mod_code_newcode; /* holds the text to write to the IP */ |
| 127 | 127 | ||
| 128 | static unsigned nmi_wait_count; | 128 | static unsigned nmi_wait_count; |
| 129 | static atomic_t nmi_update_count = ATOMIC_INIT(0); | 129 | static atomic_t nmi_update_count = ATOMIC_INIT(0); |
| @@ -225,7 +225,7 @@ within(unsigned long addr, unsigned long start, unsigned long end) | |||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | static int | 227 | static int |
| 228 | do_ftrace_mod_code(unsigned long ip, void *new_code) | 228 | do_ftrace_mod_code(unsigned long ip, const void *new_code) |
| 229 | { | 229 | { |
| 230 | /* | 230 | /* |
| 231 | * On x86_64, kernel text mappings are mapped read-only with | 231 | * On x86_64, kernel text mappings are mapped read-only with |
| @@ -266,8 +266,8 @@ static const unsigned char *ftrace_nop_replace(void) | |||
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | static int | 268 | static int |
| 269 | ftrace_modify_code(unsigned long ip, unsigned char *old_code, | 269 | ftrace_modify_code(unsigned long ip, unsigned const char *old_code, |
| 270 | unsigned char *new_code) | 270 | unsigned const char *new_code) |
| 271 | { | 271 | { |
| 272 | unsigned char replaced[MCOUNT_INSN_SIZE]; | 272 | unsigned char replaced[MCOUNT_INSN_SIZE]; |
| 273 | 273 | ||
| @@ -301,7 +301,7 @@ ftrace_modify_code(unsigned long ip, unsigned char *old_code, | |||
| 301 | int ftrace_make_nop(struct module *mod, | 301 | int ftrace_make_nop(struct module *mod, |
| 302 | struct dyn_ftrace *rec, unsigned long addr) | 302 | struct dyn_ftrace *rec, unsigned long addr) |
| 303 | { | 303 | { |
| 304 | unsigned char *new, *old; | 304 | unsigned const char *new, *old; |
| 305 | unsigned long ip = rec->ip; | 305 | unsigned long ip = rec->ip; |
| 306 | 306 | ||
| 307 | old = ftrace_call_replace(ip, addr); | 307 | old = ftrace_call_replace(ip, addr); |
| @@ -312,7 +312,7 @@ int ftrace_make_nop(struct module *mod, | |||
| 312 | 312 | ||
| 313 | int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) | 313 | int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) |
| 314 | { | 314 | { |
| 315 | unsigned char *new, *old; | 315 | unsigned const char *new, *old; |
| 316 | unsigned long ip = rec->ip; | 316 | unsigned long ip = rec->ip; |
| 317 | 317 | ||
| 318 | old = ftrace_nop_replace(); | 318 | old = ftrace_nop_replace(); |
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index b5a550a39a70..59d3ef100eb9 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h | |||
| @@ -16,6 +16,11 @@ struct trace_print_flags { | |||
| 16 | const char *name; | 16 | const char *name; |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | struct trace_print_flags_u64 { | ||
| 20 | unsigned long long mask; | ||
| 21 | const char *name; | ||
| 22 | }; | ||
| 23 | |||
| 19 | const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim, | 24 | const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim, |
| 20 | unsigned long flags, | 25 | unsigned long flags, |
| 21 | const struct trace_print_flags *flag_array); | 26 | const struct trace_print_flags *flag_array); |
| @@ -23,6 +28,13 @@ const char *ftrace_print_flags_seq(struct trace_seq *p, const char *delim, | |||
| 23 | const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, | 28 | const char *ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, |
| 24 | const struct trace_print_flags *symbol_array); | 29 | const struct trace_print_flags *symbol_array); |
| 25 | 30 | ||
| 31 | #if BITS_PER_LONG == 32 | ||
| 32 | const char *ftrace_print_symbols_seq_u64(struct trace_seq *p, | ||
| 33 | unsigned long long val, | ||
| 34 | const struct trace_print_flags_u64 | ||
| 35 | *symbol_array); | ||
| 36 | #endif | ||
| 37 | |||
| 26 | const char *ftrace_print_hex_seq(struct trace_seq *p, | 38 | const char *ftrace_print_hex_seq(struct trace_seq *p, |
| 27 | const unsigned char *buf, int len); | 39 | const unsigned char *buf, int len); |
| 28 | 40 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index f18300eddfcb..106bd8a45998 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -1535,7 +1535,7 @@ struct task_struct { | |||
| 1535 | #ifdef CONFIG_TRACING | 1535 | #ifdef CONFIG_TRACING |
| 1536 | /* state flags for use by tracers */ | 1536 | /* state flags for use by tracers */ |
| 1537 | unsigned long trace; | 1537 | unsigned long trace; |
| 1538 | /* bitmask of trace recursion */ | 1538 | /* bitmask and counter of trace recursion */ |
| 1539 | unsigned long trace_recursion; | 1539 | unsigned long trace_recursion; |
| 1540 | #endif /* CONFIG_TRACING */ | 1540 | #endif /* CONFIG_TRACING */ |
| 1541 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */ | 1541 | #ifdef CONFIG_CGROUP_MEM_RES_CTLR /* memcg uses this to do batch job */ |
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index d512d98dfb7d..5ca0951e1855 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
| @@ -93,8 +93,8 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
| 93 | * Safely read from address @src to the buffer at @dst. If a kernel fault | 93 | * Safely read from address @src to the buffer at @dst. If a kernel fault |
| 94 | * happens, handle that and return -EFAULT. | 94 | * happens, handle that and return -EFAULT. |
| 95 | */ | 95 | */ |
| 96 | extern long probe_kernel_read(void *dst, void *src, size_t size); | 96 | extern long probe_kernel_read(void *dst, const void *src, size_t size); |
| 97 | extern long __probe_kernel_read(void *dst, void *src, size_t size); | 97 | extern long __probe_kernel_read(void *dst, const void *src, size_t size); |
| 98 | 98 | ||
| 99 | /* | 99 | /* |
| 100 | * probe_kernel_write(): safely attempt to write to a location | 100 | * probe_kernel_write(): safely attempt to write to a location |
| @@ -105,7 +105,7 @@ extern long __probe_kernel_read(void *dst, void *src, size_t size); | |||
| 105 | * Safely write to address @dst from the buffer at @src. If a kernel fault | 105 | * Safely write to address @dst from the buffer at @src. If a kernel fault |
| 106 | * happens, handle that and return -EFAULT. | 106 | * happens, handle that and return -EFAULT. |
| 107 | */ | 107 | */ |
| 108 | extern long notrace probe_kernel_write(void *dst, void *src, size_t size); | 108 | extern long notrace probe_kernel_write(void *dst, const void *src, size_t size); |
| 109 | extern long notrace __probe_kernel_write(void *dst, void *src, size_t size); | 109 | extern long notrace __probe_kernel_write(void *dst, const void *src, size_t size); |
| 110 | 110 | ||
| 111 | #endif /* __LINUX_UACCESS_H__ */ | 111 | #endif /* __LINUX_UACCESS_H__ */ |
diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index f445cff66ab7..4114129f0794 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h | |||
| @@ -28,7 +28,7 @@ struct extent_buffer; | |||
| 28 | { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) | 28 | { BTRFS_SHARED_DATA_REF_KEY, "SHARED_DATA_REF" }) |
| 29 | 29 | ||
| 30 | #define __show_root_type(obj) \ | 30 | #define __show_root_type(obj) \ |
| 31 | __print_symbolic(obj, \ | 31 | __print_symbolic_u64(obj, \ |
| 32 | { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ | 32 | { BTRFS_ROOT_TREE_OBJECTID, "ROOT_TREE" }, \ |
| 33 | { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ | 33 | { BTRFS_EXTENT_TREE_OBJECTID, "EXTENT_TREE" }, \ |
| 34 | { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ | 34 | { BTRFS_CHUNK_TREE_OBJECTID, "CHUNK_TREE" }, \ |
| @@ -125,7 +125,7 @@ DEFINE_EVENT(btrfs__inode, btrfs_inode_evict, | |||
| 125 | ); | 125 | ); |
| 126 | 126 | ||
| 127 | #define __show_map_type(type) \ | 127 | #define __show_map_type(type) \ |
| 128 | __print_symbolic(type, \ | 128 | __print_symbolic_u64(type, \ |
| 129 | { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ | 129 | { EXTENT_MAP_LAST_BYTE, "LAST_BYTE" }, \ |
| 130 | { EXTENT_MAP_HOLE, "HOLE" }, \ | 130 | { EXTENT_MAP_HOLE, "HOLE" }, \ |
| 131 | { EXTENT_MAP_INLINE, "INLINE" }, \ | 131 | { EXTENT_MAP_INLINE, "INLINE" }, \ |
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h index 3e68366d485a..533c49f48047 100644 --- a/include/trace/ftrace.h +++ b/include/trace/ftrace.h | |||
| @@ -205,6 +205,19 @@ | |||
| 205 | ftrace_print_symbols_seq(p, value, symbols); \ | 205 | ftrace_print_symbols_seq(p, value, symbols); \ |
| 206 | }) | 206 | }) |
| 207 | 207 | ||
| 208 | #undef __print_symbolic_u64 | ||
| 209 | #if BITS_PER_LONG == 32 | ||
| 210 | #define __print_symbolic_u64(value, symbol_array...) \ | ||
| 211 | ({ \ | ||
| 212 | static const struct trace_print_flags_u64 symbols[] = \ | ||
| 213 | { symbol_array, { -1, NULL } }; \ | ||
| 214 | ftrace_print_symbols_seq_u64(p, value, symbols); \ | ||
| 215 | }) | ||
| 216 | #else | ||
| 217 | #define __print_symbolic_u64(value, symbol_array...) \ | ||
| 218 | __print_symbolic(value, symbol_array) | ||
| 219 | #endif | ||
| 220 | |||
| 208 | #undef __print_hex | 221 | #undef __print_hex |
| 209 | #define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len) | 222 | #define __print_hex(buf, buf_len) ftrace_print_hex_seq(p, buf, buf_len) |
| 210 | 223 | ||
diff --git a/kernel/jump_label.c b/kernel/jump_label.c index 74d1c099fbd1..fa27e750dbc0 100644 --- a/kernel/jump_label.c +++ b/kernel/jump_label.c | |||
| @@ -105,9 +105,12 @@ static int __jump_label_text_reserved(struct jump_entry *iter_start, | |||
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | static void __jump_label_update(struct jump_label_key *key, | 107 | static void __jump_label_update(struct jump_label_key *key, |
| 108 | struct jump_entry *entry, int enable) | 108 | struct jump_entry *entry, |
| 109 | struct jump_entry *stop, int enable) | ||
| 109 | { | 110 | { |
| 110 | for (; entry->key == (jump_label_t)(unsigned long)key; entry++) { | 111 | for (; (entry < stop) && |
| 112 | (entry->key == (jump_label_t)(unsigned long)key); | ||
| 113 | entry++) { | ||
| 111 | /* | 114 | /* |
| 112 | * entry->code set to 0 invalidates module init text sections | 115 | * entry->code set to 0 invalidates module init text sections |
| 113 | * kernel_text_address() verifies we are not in core kernel | 116 | * kernel_text_address() verifies we are not in core kernel |
| @@ -181,7 +184,11 @@ static void __jump_label_mod_update(struct jump_label_key *key, int enable) | |||
| 181 | struct jump_label_mod *mod = key->next; | 184 | struct jump_label_mod *mod = key->next; |
| 182 | 185 | ||
| 183 | while (mod) { | 186 | while (mod) { |
| 184 | __jump_label_update(key, mod->entries, enable); | 187 | struct module *m = mod->mod; |
| 188 | |||
| 189 | __jump_label_update(key, mod->entries, | ||
| 190 | m->jump_entries + m->num_jump_entries, | ||
| 191 | enable); | ||
| 185 | mod = mod->next; | 192 | mod = mod->next; |
| 186 | } | 193 | } |
| 187 | } | 194 | } |
| @@ -245,7 +252,8 @@ static int jump_label_add_module(struct module *mod) | |||
| 245 | key->next = jlm; | 252 | key->next = jlm; |
| 246 | 253 | ||
| 247 | if (jump_label_enabled(key)) | 254 | if (jump_label_enabled(key)) |
| 248 | __jump_label_update(key, iter, JUMP_LABEL_ENABLE); | 255 | __jump_label_update(key, iter, iter_stop, |
| 256 | JUMP_LABEL_ENABLE); | ||
| 249 | } | 257 | } |
| 250 | 258 | ||
| 251 | return 0; | 259 | return 0; |
| @@ -371,7 +379,7 @@ static void jump_label_update(struct jump_label_key *key, int enable) | |||
| 371 | 379 | ||
| 372 | /* if there are no users, entry can be NULL */ | 380 | /* if there are no users, entry can be NULL */ |
| 373 | if (entry) | 381 | if (entry) |
| 374 | __jump_label_update(key, entry, enable); | 382 | __jump_label_update(key, entry, __stop___jump_table, enable); |
| 375 | 383 | ||
| 376 | #ifdef CONFIG_MODULES | 384 | #ifdef CONFIG_MODULES |
| 377 | __jump_label_mod_update(key, enable); | 385 | __jump_label_mod_update(key, enable); |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index d017c2c82c44..1ee417fcbfa5 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
| @@ -109,12 +109,18 @@ ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip); | |||
| 109 | static void ftrace_global_list_func(unsigned long ip, | 109 | static void ftrace_global_list_func(unsigned long ip, |
| 110 | unsigned long parent_ip) | 110 | unsigned long parent_ip) |
| 111 | { | 111 | { |
| 112 | struct ftrace_ops *op = rcu_dereference_raw(ftrace_global_list); /*see above*/ | 112 | struct ftrace_ops *op; |
| 113 | |||
| 114 | if (unlikely(trace_recursion_test(TRACE_GLOBAL_BIT))) | ||
| 115 | return; | ||
| 113 | 116 | ||
| 117 | trace_recursion_set(TRACE_GLOBAL_BIT); | ||
| 118 | op = rcu_dereference_raw(ftrace_global_list); /*see above*/ | ||
| 114 | while (op != &ftrace_list_end) { | 119 | while (op != &ftrace_list_end) { |
| 115 | op->func(ip, parent_ip); | 120 | op->func(ip, parent_ip); |
| 116 | op = rcu_dereference_raw(op->next); /*see above*/ | 121 | op = rcu_dereference_raw(op->next); /*see above*/ |
| 117 | }; | 122 | }; |
| 123 | trace_recursion_clear(TRACE_GLOBAL_BIT); | ||
| 118 | } | 124 | } |
| 119 | 125 | ||
| 120 | static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip) | 126 | static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip) |
| @@ -1638,12 +1644,12 @@ static void ftrace_startup_enable(int command) | |||
| 1638 | ftrace_run_update_code(command); | 1644 | ftrace_run_update_code(command); |
| 1639 | } | 1645 | } |
| 1640 | 1646 | ||
| 1641 | static void ftrace_startup(struct ftrace_ops *ops, int command) | 1647 | static int ftrace_startup(struct ftrace_ops *ops, int command) |
| 1642 | { | 1648 | { |
| 1643 | bool hash_enable = true; | 1649 | bool hash_enable = true; |
| 1644 | 1650 | ||
| 1645 | if (unlikely(ftrace_disabled)) | 1651 | if (unlikely(ftrace_disabled)) |
| 1646 | return; | 1652 | return -ENODEV; |
| 1647 | 1653 | ||
| 1648 | ftrace_start_up++; | 1654 | ftrace_start_up++; |
| 1649 | command |= FTRACE_ENABLE_CALLS; | 1655 | command |= FTRACE_ENABLE_CALLS; |
| @@ -1662,6 +1668,8 @@ static void ftrace_startup(struct ftrace_ops *ops, int command) | |||
| 1662 | ftrace_hash_rec_enable(ops, 1); | 1668 | ftrace_hash_rec_enable(ops, 1); |
| 1663 | 1669 | ||
| 1664 | ftrace_startup_enable(command); | 1670 | ftrace_startup_enable(command); |
| 1671 | |||
| 1672 | return 0; | ||
| 1665 | } | 1673 | } |
| 1666 | 1674 | ||
| 1667 | static void ftrace_shutdown(struct ftrace_ops *ops, int command) | 1675 | static void ftrace_shutdown(struct ftrace_ops *ops, int command) |
| @@ -2501,7 +2509,7 @@ static void __enable_ftrace_function_probe(void) | |||
| 2501 | 2509 | ||
| 2502 | ret = __register_ftrace_function(&trace_probe_ops); | 2510 | ret = __register_ftrace_function(&trace_probe_ops); |
| 2503 | if (!ret) | 2511 | if (!ret) |
| 2504 | ftrace_startup(&trace_probe_ops, 0); | 2512 | ret = ftrace_startup(&trace_probe_ops, 0); |
| 2505 | 2513 | ||
| 2506 | ftrace_probe_registered = 1; | 2514 | ftrace_probe_registered = 1; |
| 2507 | } | 2515 | } |
| @@ -3466,7 +3474,11 @@ device_initcall(ftrace_nodyn_init); | |||
| 3466 | static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; } | 3474 | static inline int ftrace_init_dyn_debugfs(struct dentry *d_tracer) { return 0; } |
| 3467 | static inline void ftrace_startup_enable(int command) { } | 3475 | static inline void ftrace_startup_enable(int command) { } |
| 3468 | /* Keep as macros so we do not need to define the commands */ | 3476 | /* Keep as macros so we do not need to define the commands */ |
| 3469 | # define ftrace_startup(ops, command) do { } while (0) | 3477 | # define ftrace_startup(ops, command) \ |
| 3478 | ({ \ | ||
| 3479 | (ops)->flags |= FTRACE_OPS_FL_ENABLED; \ | ||
| 3480 | 0; \ | ||
| 3481 | }) | ||
| 3470 | # define ftrace_shutdown(ops, command) do { } while (0) | 3482 | # define ftrace_shutdown(ops, command) do { } while (0) |
| 3471 | # define ftrace_startup_sysctl() do { } while (0) | 3483 | # define ftrace_startup_sysctl() do { } while (0) |
| 3472 | # define ftrace_shutdown_sysctl() do { } while (0) | 3484 | # define ftrace_shutdown_sysctl() do { } while (0) |
| @@ -3484,6 +3496,10 @@ ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip) | |||
| 3484 | { | 3496 | { |
| 3485 | struct ftrace_ops *op; | 3497 | struct ftrace_ops *op; |
| 3486 | 3498 | ||
| 3499 | if (unlikely(trace_recursion_test(TRACE_INTERNAL_BIT))) | ||
| 3500 | return; | ||
| 3501 | |||
| 3502 | trace_recursion_set(TRACE_INTERNAL_BIT); | ||
| 3487 | /* | 3503 | /* |
| 3488 | * Some of the ops may be dynamically allocated, | 3504 | * Some of the ops may be dynamically allocated, |
| 3489 | * they must be freed after a synchronize_sched(). | 3505 | * they must be freed after a synchronize_sched(). |
| @@ -3496,6 +3512,7 @@ ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip) | |||
| 3496 | op = rcu_dereference_raw(op->next); | 3512 | op = rcu_dereference_raw(op->next); |
| 3497 | }; | 3513 | }; |
| 3498 | preempt_enable_notrace(); | 3514 | preempt_enable_notrace(); |
| 3515 | trace_recursion_clear(TRACE_INTERNAL_BIT); | ||
| 3499 | } | 3516 | } |
| 3500 | 3517 | ||
| 3501 | static void clear_ftrace_swapper(void) | 3518 | static void clear_ftrace_swapper(void) |
| @@ -3799,7 +3816,7 @@ int register_ftrace_function(struct ftrace_ops *ops) | |||
| 3799 | 3816 | ||
| 3800 | ret = __register_ftrace_function(ops); | 3817 | ret = __register_ftrace_function(ops); |
| 3801 | if (!ret) | 3818 | if (!ret) |
| 3802 | ftrace_startup(ops, 0); | 3819 | ret = ftrace_startup(ops, 0); |
| 3803 | 3820 | ||
| 3804 | 3821 | ||
| 3805 | out_unlock: | 3822 | out_unlock: |
| @@ -4045,7 +4062,7 @@ int register_ftrace_graph(trace_func_graph_ret_t retfunc, | |||
| 4045 | ftrace_graph_return = retfunc; | 4062 | ftrace_graph_return = retfunc; |
| 4046 | ftrace_graph_entry = entryfunc; | 4063 | ftrace_graph_entry = entryfunc; |
| 4047 | 4064 | ||
| 4048 | ftrace_startup(&global_ops, FTRACE_START_FUNC_RET); | 4065 | ret = ftrace_startup(&global_ops, FTRACE_START_FUNC_RET); |
| 4049 | 4066 | ||
| 4050 | out: | 4067 | out: |
| 4051 | mutex_unlock(&ftrace_lock); | 4068 | mutex_unlock(&ftrace_lock); |
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 0ef7b4b2a1f7..b0c7aa407943 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c | |||
| @@ -2216,7 +2216,7 @@ static noinline void trace_recursive_fail(void) | |||
| 2216 | 2216 | ||
| 2217 | printk_once(KERN_WARNING "Tracing recursion: depth[%ld]:" | 2217 | printk_once(KERN_WARNING "Tracing recursion: depth[%ld]:" |
| 2218 | "HC[%lu]:SC[%lu]:NMI[%lu]\n", | 2218 | "HC[%lu]:SC[%lu]:NMI[%lu]\n", |
| 2219 | current->trace_recursion, | 2219 | trace_recursion_buffer(), |
| 2220 | hardirq_count() >> HARDIRQ_SHIFT, | 2220 | hardirq_count() >> HARDIRQ_SHIFT, |
| 2221 | softirq_count() >> SOFTIRQ_SHIFT, | 2221 | softirq_count() >> SOFTIRQ_SHIFT, |
| 2222 | in_nmi()); | 2222 | in_nmi()); |
| @@ -2226,9 +2226,9 @@ static noinline void trace_recursive_fail(void) | |||
| 2226 | 2226 | ||
| 2227 | static inline int trace_recursive_lock(void) | 2227 | static inline int trace_recursive_lock(void) |
| 2228 | { | 2228 | { |
| 2229 | current->trace_recursion++; | 2229 | trace_recursion_inc(); |
| 2230 | 2230 | ||
| 2231 | if (likely(current->trace_recursion < TRACE_RECURSIVE_DEPTH)) | 2231 | if (likely(trace_recursion_buffer() < TRACE_RECURSIVE_DEPTH)) |
| 2232 | return 0; | 2232 | return 0; |
| 2233 | 2233 | ||
| 2234 | trace_recursive_fail(); | 2234 | trace_recursive_fail(); |
| @@ -2238,9 +2238,9 @@ static inline int trace_recursive_lock(void) | |||
| 2238 | 2238 | ||
| 2239 | static inline void trace_recursive_unlock(void) | 2239 | static inline void trace_recursive_unlock(void) |
| 2240 | { | 2240 | { |
| 2241 | WARN_ON_ONCE(!current->trace_recursion); | 2241 | WARN_ON_ONCE(!trace_recursion_buffer()); |
| 2242 | 2242 | ||
| 2243 | current->trace_recursion--; | 2243 | trace_recursion_dec(); |
| 2244 | } | 2244 | } |
| 2245 | 2245 | ||
| 2246 | #else | 2246 | #else |
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 6b69c4bd306f..229f8591f61d 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
| @@ -784,4 +784,19 @@ extern const char *__stop___trace_bprintk_fmt[]; | |||
| 784 | FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print)) | 784 | FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print)) |
| 785 | #include "trace_entries.h" | 785 | #include "trace_entries.h" |
| 786 | 786 | ||
| 787 | /* Only current can touch trace_recursion */ | ||
| 788 | #define trace_recursion_inc() do { (current)->trace_recursion++; } while (0) | ||
| 789 | #define trace_recursion_dec() do { (current)->trace_recursion--; } while (0) | ||
| 790 | |||
| 791 | /* Ring buffer has the 10 LSB bits to count */ | ||
| 792 | #define trace_recursion_buffer() ((current)->trace_recursion & 0x3ff) | ||
| 793 | |||
| 794 | /* for function tracing recursion */ | ||
| 795 | #define TRACE_INTERNAL_BIT (1<<11) | ||
| 796 | #define TRACE_GLOBAL_BIT (1<<12) | ||
| 797 | |||
| 798 | #define trace_recursion_set(bit) do { (current)->trace_recursion |= (bit); } while (0) | ||
| 799 | #define trace_recursion_clear(bit) do { (current)->trace_recursion &= ~(bit); } while (0) | ||
| 800 | #define trace_recursion_test(bit) ((current)->trace_recursion & (bit)) | ||
| 801 | |||
| 787 | #endif /* _LINUX_KERNEL_TRACE_H */ | 802 | #endif /* _LINUX_KERNEL_TRACE_H */ |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 2fe110341359..686ec399f2a8 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
| @@ -1657,7 +1657,12 @@ static struct ftrace_ops trace_ops __initdata = | |||
| 1657 | 1657 | ||
| 1658 | static __init void event_trace_self_test_with_function(void) | 1658 | static __init void event_trace_self_test_with_function(void) |
| 1659 | { | 1659 | { |
| 1660 | register_ftrace_function(&trace_ops); | 1660 | int ret; |
| 1661 | ret = register_ftrace_function(&trace_ops); | ||
| 1662 | if (WARN_ON(ret < 0)) { | ||
| 1663 | pr_info("Failed to enable function tracer for event tests\n"); | ||
| 1664 | return; | ||
| 1665 | } | ||
| 1661 | pr_info("Running tests again, along with the function tracer\n"); | 1666 | pr_info("Running tests again, along with the function tracer\n"); |
| 1662 | event_trace_self_tests(); | 1667 | event_trace_self_tests(); |
| 1663 | unregister_ftrace_function(&trace_ops); | 1668 | unregister_ftrace_function(&trace_ops); |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index cf535ccedc86..e37de492a9e1 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
| @@ -353,6 +353,33 @@ ftrace_print_symbols_seq(struct trace_seq *p, unsigned long val, | |||
| 353 | } | 353 | } |
| 354 | EXPORT_SYMBOL(ftrace_print_symbols_seq); | 354 | EXPORT_SYMBOL(ftrace_print_symbols_seq); |
| 355 | 355 | ||
| 356 | #if BITS_PER_LONG == 32 | ||
| 357 | const char * | ||
| 358 | ftrace_print_symbols_seq_u64(struct trace_seq *p, unsigned long long val, | ||
| 359 | const struct trace_print_flags_u64 *symbol_array) | ||
| 360 | { | ||
| 361 | int i; | ||
| 362 | const char *ret = p->buffer + p->len; | ||
| 363 | |||
| 364 | for (i = 0; symbol_array[i].name; i++) { | ||
| 365 | |||
| 366 | if (val != symbol_array[i].mask) | ||
| 367 | continue; | ||
| 368 | |||
| 369 | trace_seq_puts(p, symbol_array[i].name); | ||
| 370 | break; | ||
| 371 | } | ||
| 372 | |||
| 373 | if (!p->len) | ||
| 374 | trace_seq_printf(p, "0x%llx", val); | ||
| 375 | |||
| 376 | trace_seq_putc(p, 0); | ||
| 377 | |||
| 378 | return ret; | ||
| 379 | } | ||
| 380 | EXPORT_SYMBOL(ftrace_print_symbols_seq_u64); | ||
| 381 | #endif | ||
| 382 | |||
| 356 | const char * | 383 | const char * |
| 357 | ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len) | 384 | ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len) |
| 358 | { | 385 | { |
diff --git a/mm/maccess.c b/mm/maccess.c index e2b6f5634e0d..4cee182ab5f3 100644 --- a/mm/maccess.c +++ b/mm/maccess.c | |||
| @@ -15,10 +15,10 @@ | |||
| 15 | * happens, handle that and return -EFAULT. | 15 | * happens, handle that and return -EFAULT. |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | long __weak probe_kernel_read(void *dst, void *src, size_t size) | 18 | long __weak probe_kernel_read(void *dst, const void *src, size_t size) |
| 19 | __attribute__((alias("__probe_kernel_read"))); | 19 | __attribute__((alias("__probe_kernel_read"))); |
| 20 | 20 | ||
| 21 | long __probe_kernel_read(void *dst, void *src, size_t size) | 21 | long __probe_kernel_read(void *dst, const void *src, size_t size) |
| 22 | { | 22 | { |
| 23 | long ret; | 23 | long ret; |
| 24 | mm_segment_t old_fs = get_fs(); | 24 | mm_segment_t old_fs = get_fs(); |
| @@ -43,10 +43,10 @@ EXPORT_SYMBOL_GPL(probe_kernel_read); | |||
| 43 | * Safely write to address @dst from the buffer at @src. If a kernel fault | 43 | * Safely write to address @dst from the buffer at @src. If a kernel fault |
| 44 | * happens, handle that and return -EFAULT. | 44 | * happens, handle that and return -EFAULT. |
| 45 | */ | 45 | */ |
| 46 | long __weak probe_kernel_write(void *dst, void *src, size_t size) | 46 | long __weak probe_kernel_write(void *dst, const void *src, size_t size) |
| 47 | __attribute__((alias("__probe_kernel_write"))); | 47 | __attribute__((alias("__probe_kernel_write"))); |
| 48 | 48 | ||
| 49 | long __probe_kernel_write(void *dst, void *src, size_t size) | 49 | long __probe_kernel_write(void *dst, const void *src, size_t size) |
| 50 | { | 50 | { |
| 51 | long ret; | 51 | long ret; |
| 52 | mm_segment_t old_fs = get_fs(); | 52 | mm_segment_t old_fs = get_fs(); |
diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h index 4be60364a405..f40a6af6bf40 100644 --- a/scripts/recordmcount.h +++ b/scripts/recordmcount.h | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | #undef ELF_R_INFO | 43 | #undef ELF_R_INFO |
| 44 | #undef Elf_r_info | 44 | #undef Elf_r_info |
| 45 | #undef ELF_ST_BIND | 45 | #undef ELF_ST_BIND |
| 46 | #undef ELF_ST_TYPE | ||
| 46 | #undef fn_ELF_R_SYM | 47 | #undef fn_ELF_R_SYM |
| 47 | #undef fn_ELF_R_INFO | 48 | #undef fn_ELF_R_INFO |
| 48 | #undef uint_t | 49 | #undef uint_t |
| @@ -76,6 +77,7 @@ | |||
| 76 | # define ELF_R_INFO ELF64_R_INFO | 77 | # define ELF_R_INFO ELF64_R_INFO |
| 77 | # define Elf_r_info Elf64_r_info | 78 | # define Elf_r_info Elf64_r_info |
| 78 | # define ELF_ST_BIND ELF64_ST_BIND | 79 | # define ELF_ST_BIND ELF64_ST_BIND |
| 80 | # define ELF_ST_TYPE ELF64_ST_TYPE | ||
| 79 | # define fn_ELF_R_SYM fn_ELF64_R_SYM | 81 | # define fn_ELF_R_SYM fn_ELF64_R_SYM |
| 80 | # define fn_ELF_R_INFO fn_ELF64_R_INFO | 82 | # define fn_ELF_R_INFO fn_ELF64_R_INFO |
| 81 | # define uint_t uint64_t | 83 | # define uint_t uint64_t |
| @@ -108,6 +110,7 @@ | |||
| 108 | # define ELF_R_INFO ELF32_R_INFO | 110 | # define ELF_R_INFO ELF32_R_INFO |
| 109 | # define Elf_r_info Elf32_r_info | 111 | # define Elf_r_info Elf32_r_info |
| 110 | # define ELF_ST_BIND ELF32_ST_BIND | 112 | # define ELF_ST_BIND ELF32_ST_BIND |
| 113 | # define ELF_ST_TYPE ELF32_ST_TYPE | ||
| 111 | # define fn_ELF_R_SYM fn_ELF32_R_SYM | 114 | # define fn_ELF_R_SYM fn_ELF32_R_SYM |
| 112 | # define fn_ELF_R_INFO fn_ELF32_R_INFO | 115 | # define fn_ELF_R_INFO fn_ELF32_R_INFO |
| 113 | # define uint_t uint32_t | 116 | # define uint_t uint32_t |
| @@ -427,6 +430,11 @@ static unsigned find_secsym_ndx(unsigned const txtndx, | |||
| 427 | if (txtndx == w2(symp->st_shndx) | 430 | if (txtndx == w2(symp->st_shndx) |
| 428 | /* avoid STB_WEAK */ | 431 | /* avoid STB_WEAK */ |
| 429 | && (STB_LOCAL == st_bind || STB_GLOBAL == st_bind)) { | 432 | && (STB_LOCAL == st_bind || STB_GLOBAL == st_bind)) { |
| 433 | /* function symbols on ARM have quirks, avoid them */ | ||
| 434 | if (w2(ehdr->e_machine) == EM_ARM | ||
| 435 | && ELF_ST_TYPE(symp->st_info) == STT_FUNC) | ||
| 436 | continue; | ||
| 437 | |||
| 430 | *recvalp = _w(symp->st_value); | 438 | *recvalp = _w(symp->st_value); |
| 431 | return symp - sym0; | 439 | return symp - sym0; |
| 432 | } | 440 | } |
diff --git a/scripts/tags.sh b/scripts/tags.sh index bd6185d529cf..75c5d24f1993 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh | |||
| @@ -132,7 +132,7 @@ exuberant() | |||
| 132 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ | 132 | --regex-asm='/^ENTRY\(([^)]*)\).*/\1/' \ |
| 133 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \ | 133 | --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/' \ |
| 134 | --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \ | 134 | --regex-c++='/^TRACE_EVENT\(([^,)]*).*/trace_\1/' \ |
| 135 | --regex-c++='/^DEFINE_EVENT\(([^,)]*).*/trace_\1/' | 135 | --regex-c++='/^DEFINE_EVENT\([^,)]*, *([^,)]*).*/trace_\1/' |
| 136 | 136 | ||
| 137 | all_kconfigs | xargs $1 -a \ | 137 | all_kconfigs | xargs $1 -a \ |
| 138 | --langdef=kconfig --language-force=kconfig \ | 138 | --langdef=kconfig --language-force=kconfig \ |
| @@ -152,7 +152,9 @@ emacs() | |||
| 152 | { | 152 | { |
| 153 | all_sources | xargs $1 -a \ | 153 | all_sources | xargs $1 -a \ |
| 154 | --regex='/^ENTRY(\([^)]*\)).*/\1/' \ | 154 | --regex='/^ENTRY(\([^)]*\)).*/\1/' \ |
| 155 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' | 155 | --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/' \ |
| 156 | --regex='/^TRACE_EVENT(\([^,)]*\).*/trace_\1/' \ | ||
| 157 | --regex='/^DEFINE_EVENT([^,)]*, *\([^,)]*\).*/trace_\1/' | ||
| 156 | 158 | ||
| 157 | all_kconfigs | xargs $1 -a \ | 159 | all_kconfigs | xargs $1 -a \ |
| 158 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' | 160 | --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/' |
