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 tag 'trace-v6.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull tracing fixes from Steven Rostedt:

- Remove redundant __GFP_NOWARN flag is kmalloc

As now __GFP_NOWARN is part of __GFP_NOWAIT, it can be removed from
kmalloc as it is redundant.

- Use copy_from_user_nofault() instead of _inatomic() for trace markers

The trace_marker files are written to to allow user space to quickly
write into the tracing ring buffer.

Back in 2016, the get_user_pages_fast() and the kmap() logic was
replaced by a __copy_from_user_inatomic(), but didn't properly
disable page faults around it.

Since the time this was added, copy_from_user_nofault() was added
which does the required page fault disabling for us.

- Fix the assembly markup in the ftrace direct sample code

The ftrace direct sample code (which is also used for selftests), had
the size directive between the "leave" and the "ret" instead of after
the ret. This caused objtool to think the code was unreachable.

- Only call unregister_pm_notifier() on outer most fgraph registration

There was an error path in register_ftrace_graph() that did not call
unregister_pm_notifier() on error, so it was added in the error path.
The problem with that fix, is that register_pm_notifier() is only
called by the initial user of fgraph. If that succeeds, but another
fgraph registration were to fail, then unregister_pm_notifier() would
be called incorrectly.

- Fix a crash in osnoise when zero size cpumask is passed in

If a zero size CPU mask is passed in, the kmalloc() would return
ZERO_SIZE_PTR which is not checked, and the code would continue
thinking it had real memory and crash. If zero is passed in as the
size of the write, simply return 0.

- Fix possible warning in trace_pid_write()

If while processing a series of numbers passed to the "set_event_pid"
file, and one of the updates fails to allocate (triggered by a fault
injection), it can cause a warning to trigger. Check the return value
of the call to trace_pid_list_set() and break out early with an error
code if it fails.

* tag 'trace-v6.17-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
tracing: Silence warning when chunk allocation fails in trace_pid_write
tracing/osnoise: Fix null-ptr-deref in bitmap_parselist()
trace/fgraph: Fix error handling
ftrace/samples: Fix function size computation
tracing: Fix tracing_marker may trigger page fault during preempt_disable
trace: Remove redundant __GFP_NOWARN

+14 -6
+2 -1
kernel/trace/fgraph.c
··· 1397 1397 ftrace_graph_active--; 1398 1398 gops->saved_func = NULL; 1399 1399 fgraph_lru_release_index(i); 1400 - unregister_pm_notifier(&ftrace_suspend_notifier); 1400 + if (!ftrace_graph_active) 1401 + unregister_pm_notifier(&ftrace_suspend_notifier); 1401 1402 } 1402 1403 return ret; 1403 1404 }
+7 -3
kernel/trace/trace.c
··· 834 834 /* copy the current bits to the new max */ 835 835 ret = trace_pid_list_first(filtered_pids, &pid); 836 836 while (!ret) { 837 - trace_pid_list_set(pid_list, pid); 837 + ret = trace_pid_list_set(pid_list, pid); 838 + if (ret < 0) 839 + goto out; 840 + 838 841 ret = trace_pid_list_next(filtered_pids, pid + 1, &pid); 839 842 nr_pids++; 840 843 } ··· 874 871 trace_parser_clear(&parser); 875 872 ret = 0; 876 873 } 874 + out: 877 875 trace_parser_put(&parser); 878 876 879 877 if (ret < 0) { ··· 7213 7209 entry = ring_buffer_event_data(event); 7214 7210 entry->ip = ip; 7215 7211 7216 - len = __copy_from_user_inatomic(&entry->buf, ubuf, cnt); 7212 + len = copy_from_user_nofault(&entry->buf, ubuf, cnt); 7217 7213 if (len) { 7218 7214 memcpy(&entry->buf, FAULTED_STR, FAULTED_SIZE); 7219 7215 cnt = FAULTED_SIZE; ··· 7310 7306 7311 7307 entry = ring_buffer_event_data(event); 7312 7308 7313 - len = __copy_from_user_inatomic(&entry->id, ubuf, cnt); 7309 + len = copy_from_user_nofault(&entry->id, ubuf, cnt); 7314 7310 if (len) { 7315 7311 entry->id = -1; 7316 7312 memcpy(&entry->buf, FAULTED_STR, FAULTED_SIZE);
+1 -1
kernel/trace/trace_events_user.c
··· 496 496 { 497 497 struct user_event_enabler_fault *fault; 498 498 499 - fault = kmem_cache_zalloc(fault_cache, GFP_NOWAIT | __GFP_NOWARN); 499 + fault = kmem_cache_zalloc(fault_cache, GFP_NOWAIT); 500 500 501 501 if (!fault) 502 502 return false;
+3
kernel/trace/trace_osnoise.c
··· 2322 2322 int running, err; 2323 2323 char *buf __free(kfree) = NULL; 2324 2324 2325 + if (count < 1) 2326 + return 0; 2327 + 2325 2328 buf = kmalloc(count, GFP_KERNEL); 2326 2329 if (!buf) 2327 2330 return -ENOMEM;
+1 -1
samples/ftrace/ftrace-direct-modify.c
··· 75 75 CALL_DEPTH_ACCOUNT 76 76 " call my_direct_func1\n" 77 77 " leave\n" 78 - " .size my_tramp1, .-my_tramp1\n" 79 78 ASM_RET 79 + " .size my_tramp1, .-my_tramp1\n" 80 80 81 81 " .type my_tramp2, @function\n" 82 82 " .globl my_tramp2\n"