<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace, branch v6.12</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.12</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.12'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2024-11-16T16:12:43Z</updated>
<entry>
<title>Merge tag 'trace-ringbuffer-v6.12-rc7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace</title>
<updated>2024-11-16T16:12:43Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2024-11-16T16:12:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b5a24181e461e8bfa8cdf35e1804679dc1bebcdd'/>
<id>urn:sha1:b5a24181e461e8bfa8cdf35e1804679dc1bebcdd</id>
<content type='text'>
Pull ring buffer fixes from Steven Rostedt:

 - Revert: "ring-buffer: Do not have boot mapped buffers hook to CPU
   hotplug"

   A crash that happened on cpu hotplug was actually caused by the
   incorrect ref counting that was fixed by commit 2cf9733891a4
   ("ring-buffer: Fix refcount setting of boot mapped buffers"). The
   removal of calling cpu hotplug callbacks on memory mapped buffers was
   not an issue even though the tests at the time pointed toward it. But
   in fact, there's a check in that code that tests to see if the
   buffers are already allocated or not, and will not allocate them
   again if they are. Not calling the cpu hotplug callbacks ended up not
   initializing the non boot CPU buffers.

   Simply remove that change.

 - Clear all CPU buffers when starting tracing in a boot mapped buffer

   To properly process events from a previous boot, the address space
   needs to be accounted for due to KASLR and the events in the buffer
   are updated accordingly when read. This also requires that when the
   buffer has tracing enabled again in the current boot that the buffers
   are reset so that events from the previous boot do not interact with
   the events of the current boot and cause confusing due to not having
   the proper meta data.

   It was found that if a CPU is taken offline, that its per CPU buffer
   is not reset when tracing starts. This allows for events to be from
   both the previous boot and the current boot to be in the buffer at
   the same time. Clear all CPU buffers when tracing is started in a
   boot mapped buffer.

* tag 'trace-ringbuffer-v6.12-rc7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  tracing/ring-buffer: Clear all memory mapped CPU ring buffers on first recording
  Revert: "ring-buffer: Do not have boot mapped buffers hook to CPU hotplug"
</content>
</entry>
<entry>
<title>tracing/ring-buffer: Clear all memory mapped CPU ring buffers on first recording</title>
<updated>2024-11-14T16:54:34Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-11-14T16:28:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=09663753bb7c50b33f8e5fa562c20ce275b88237'/>
<id>urn:sha1:09663753bb7c50b33f8e5fa562c20ce275b88237</id>
<content type='text'>
The events of a memory mapped ring buffer from the previous boot should
not be mixed in with events from the current boot. There's meta data that
is used to handle KASLR so that function names can be shown properly.

Also, since the timestamps of the previous boot have no meaning to the
timestamps of the current boot, having them intermingled in a buffer can
also cause confusion because there could possibly be events in the future.

When a trace is activated the meta data is reset so that the pointers of
are now processed for the new address space. The trace buffers are reset
when tracing starts for the first time. The problem here is that the reset
only happens on online CPUs. If a CPU is offline, it does not get reset.

To demonstrate the issue, a previous boot had tracing enabled in the boot
mapped ring buffer on reboot. On the following boot, tracing has not been
started yet so the function trace from the previous boot is still visible.

 # trace-cmd show -B boot_mapped -c 3 | tail
          &lt;idle&gt;-0       [003] d.h2.   156.462395: __rcu_read_lock &lt;-cpu_emergency_disable_virtualization
          &lt;idle&gt;-0       [003] d.h2.   156.462396: vmx_emergency_disable_virtualization_cpu &lt;-cpu_emergency_disable_virtualization
          &lt;idle&gt;-0       [003] d.h2.   156.462396: __rcu_read_unlock &lt;-__sysvec_reboot
          &lt;idle&gt;-0       [003] d.h2.   156.462397: stop_this_cpu &lt;-__sysvec_reboot
          &lt;idle&gt;-0       [003] d.h2.   156.462397: set_cpu_online &lt;-stop_this_cpu
          &lt;idle&gt;-0       [003] d.h2.   156.462397: disable_local_APIC &lt;-stop_this_cpu
          &lt;idle&gt;-0       [003] d.h2.   156.462398: clear_local_APIC &lt;-disable_local_APIC
          &lt;idle&gt;-0       [003] d.h2.   156.462574: mcheck_cpu_clear &lt;-stop_this_cpu
          &lt;idle&gt;-0       [003] d.h2.   156.462575: mce_intel_feature_clear &lt;-stop_this_cpu
          &lt;idle&gt;-0       [003] d.h2.   156.462575: lmce_supported &lt;-mce_intel_feature_clear

Now, if CPU 3 is taken offline, and tracing is started on the memory
mapped ring buffer, the events from the previous boot in the CPU 3 ring
buffer is not reset. Now those events are using the meta data from the
current boot and produces just hex values.

 # echo 0 &gt; /sys/devices/system/cpu/cpu3/online
 # trace-cmd start -B boot_mapped -p function
 # trace-cmd show -B boot_mapped -c 3 | tail
          &lt;idle&gt;-0       [003] d.h2.   156.462395: 0xffffffff9a1e3194 &lt;-0xffffffff9a0f655e
          &lt;idle&gt;-0       [003] d.h2.   156.462396: 0xffffffff9a0a1d24 &lt;-0xffffffff9a0f656f
          &lt;idle&gt;-0       [003] d.h2.   156.462396: 0xffffffff9a1e6bc4 &lt;-0xffffffff9a0f7323
          &lt;idle&gt;-0       [003] d.h2.   156.462397: 0xffffffff9a0d12b4 &lt;-0xffffffff9a0f732a
          &lt;idle&gt;-0       [003] d.h2.   156.462397: 0xffffffff9a1458d4 &lt;-0xffffffff9a0d12e2
          &lt;idle&gt;-0       [003] d.h2.   156.462397: 0xffffffff9a0faed4 &lt;-0xffffffff9a0d12e7
          &lt;idle&gt;-0       [003] d.h2.   156.462398: 0xffffffff9a0faaf4 &lt;-0xffffffff9a0faef2
          &lt;idle&gt;-0       [003] d.h2.   156.462574: 0xffffffff9a0e3444 &lt;-0xffffffff9a0d12ef
          &lt;idle&gt;-0       [003] d.h2.   156.462575: 0xffffffff9a0e4964 &lt;-0xffffffff9a0d12ef
          &lt;idle&gt;-0       [003] d.h2.   156.462575: 0xffffffff9a0e3fb0 &lt;-0xffffffff9a0e496f

Reset all CPUs when starting a boot mapped ring buffer for the first time,
and not just the online CPUs.

Fixes: 7a1d1e4b9639f ("tracing/ring-buffer: Add last_boot_info file to boot instance")
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>Revert: "ring-buffer: Do not have boot mapped buffers hook to CPU hotplug"</title>
<updated>2024-11-14T15:01:00Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-11-14T04:08:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=580bb355bcae7e9a6606ce9644af09b2a793f1bb'/>
<id>urn:sha1:580bb355bcae7e9a6606ce9644af09b2a793f1bb</id>
<content type='text'>
A crash happened when testing cpu hotplug with respect to the memory
mapped ring buffers. It was assumed that the hot plug code was adding a
per CPU buffer that was already created that caused the crash. The real
problem was due to ref counting and was fixed by commit 2cf9733891a4
("ring-buffer: Fix refcount setting of boot mapped buffers").

When a per CPU buffer is created, it will not be created again even with
CPU hotplug, so the fix to not use CPU hotplug was a red herring. In fact,
it caused only the boot CPU buffer to be created, leaving the other CPU
per CPU buffers disabled.

Revert that change as it was not the culprit of the fix it was intended to
be.

Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Link: https://lore.kernel.org/20241113230839.6c03640f@gandalf.local.home
Fixes: 912da2c384d5 ("ring-buffer: Do not have boot mapped buffers hook to CPU hotplug")
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing: Document tracefs gid mount option</title>
<updated>2024-11-01T12:57:17Z</updated>
<author>
<name>Kalesh Singh</name>
<email>kaleshsingh@google.com</email>
</author>
<published>2024-10-30T17:17:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=fa17cb4b3b42618aeed1e0bce80cc55106561718'/>
<id>urn:sha1:fa17cb4b3b42618aeed1e0bce80cc55106561718</id>
<content type='text'>
Commit ee7f3666995d ("tracefs: Have new files inherit the ownership of
their parent") and commit 48b27b6b5191 ("tracefs: Set all files to the
same group ownership as the mount option") introduced a new gid mount
option that allows specifying a group to apply to all entries in tracefs.

Document this in the tracing readme.

Cc: Eric Sandeen &lt;sandeen@redhat.com&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Cc: Ali Zahraee &lt;ahzahraee@gmail.com&gt;
Cc: Christian Brauner &lt;brauner@kernel.org&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Link: https://lore.kernel.org/20241030171928.4168869-3-kaleshsingh@google.com
Signed-off-by: Kalesh Singh &lt;kaleshsingh@google.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'ftrace-v6.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace</title>
<updated>2024-10-27T18:56:22Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2024-10-27T18:56:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f69a1accfe2e2ee2c43096abd9080b1fdb0c894d'/>
<id>urn:sha1:f69a1accfe2e2ee2c43096abd9080b1fdb0c894d</id>
<content type='text'>
Pull ftrace fixes from Steven Rostedt:

 - Fix missing mutex unlock in error path of register_ftrace_graph()

   A previous fix added a return on an error path and forgot to unlock
   the mutex. Instead of dealing with error paths, use guard(mutex) as
   the mutex is just released at the exit of the function anyway. Other
   functions in this file should be updated with this, but that's a
   cleanup and not a fix.

 - Change cpuhp setup name to be consistent with other cpuhp states

   The same fix that the above patch fixes added a cpuhp_setup_state()
   call with the name of "fgraph_idle_init". I was informed that it
   should instead be something like: "fgraph:online". Update that too.

* tag 'ftrace-v6.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  fgraph: Change the name of cpuhp state to "fgraph:online"
  fgraph: Fix missing unlock in register_ftrace_graph()
</content>
</entry>
<entry>
<title>fgraph: Change the name of cpuhp state to "fgraph:online"</title>
<updated>2024-10-25T03:41:14Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-10-25T02:29:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a574e7f80e86c740e241c762923f50077b2c2a30'/>
<id>urn:sha1:a574e7f80e86c740e241c762923f50077b2c2a30</id>
<content type='text'>
The cpuhp state name given to cpuhp_setup_state() is "fgraph_idle_init"
which doesn't really conform to the names that are used for cpu hotplug
setups. Instead rename it to "fgraph:online" to be in line with other
states.

Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/20241024222944.473d88c5@rorschach.local.home
Suggested-by: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Fixes: 2c02f7375e658 ("fgraph: Use CPU hotplug mechanism to initialize idle shadow stacks")
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>fgraph: Fix missing unlock in register_ftrace_graph()</title>
<updated>2024-10-25T02:26:06Z</updated>
<author>
<name>Li Huafei</name>
<email>lihuafei1@huawei.com</email>
</author>
<published>2024-10-24T15:59:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bd3734db86e01e20dd239a40b419059a0ce9c901'/>
<id>urn:sha1:bd3734db86e01e20dd239a40b419059a0ce9c901</id>
<content type='text'>
Use guard(mutex)() to acquire and automatically release ftrace_lock,
fixing the issue of not unlocking when calling cpuhp_setup_state()
fails.

Fixes smatch warning:

kernel/trace/fgraph.c:1317 register_ftrace_graph() warn: inconsistent returns '&amp;ftrace_lock'.

Link: https://lore.kernel.org/20241024155917.1019580-1-lihuafei1@huawei.com
Fixes: 2c02f7375e65 ("fgraph: Use CPU hotplug mechanism to initialize idle shadow stacks")
Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Reported-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Closes: https://lore.kernel.org/r/202410220121.wxg0olfd-lkp@intel.com/
Suggested-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
Signed-off-by: Li Huafei &lt;lihuafei1@huawei.com&gt;
Acked-by: Masami Hiramatsu (Google) &lt;mhiramat@kernel.org&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf</title>
<updated>2024-10-24T23:53:20Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2024-10-24T23:53:20Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ae90f6a6170d7a7a1aa4fddf664fbd093e3023bc'/>
<id>urn:sha1:ae90f6a6170d7a7a1aa4fddf664fbd093e3023bc</id>
<content type='text'>
Pull bpf fixes from Daniel Borkmann:

 - Fix an out-of-bounds read in bpf_link_show_fdinfo for BPF sockmap
   link file descriptors (Hou Tao)

 - Fix BPF arm64 JIT's address emission with tag-based KASAN enabled
   reserving not enough size (Peter Collingbourne)

 - Fix BPF verifier do_misc_fixups patching for inlining of the
   bpf_get_branch_snapshot BPF helper (Andrii Nakryiko)

 - Fix a BPF verifier bug and reject BPF program write attempts into
   read-only marked BPF maps (Daniel Borkmann)

 - Fix perf_event_detach_bpf_prog error handling by removing an invalid
   check which would skip BPF program release (Jiri Olsa)

 - Fix memory leak when parsing mount options for the BPF filesystem
   (Hou Tao)

* tag 'bpf-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
  bpf: Check validity of link-&gt;type in bpf_link_show_fdinfo()
  bpf: Add the missing BPF_LINK_TYPE invocation for sockmap
  bpf: fix do_misc_fixups() for bpf_get_branch_snapshot()
  bpf,perf: Fix perf_event_detach_bpf_prog error handling
  selftests/bpf: Add test for passing in uninit mtu_len
  selftests/bpf: Add test for writes to .rodata
  bpf: Remove MEM_UNINIT from skb/xdp MTU helpers
  bpf: Fix overloading of MEM_UNINIT's meaning
  bpf: Add MEM_WRITE attribute
  bpf: Preserve param-&gt;string when parsing mount options
  bpf, arm64: Fix address emission with tag-based KASAN enabled
</content>
</entry>
<entry>
<title>bpf,perf: Fix perf_event_detach_bpf_prog error handling</title>
<updated>2024-10-23T21:33:02Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2024-10-23T20:03:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0ee288e69d033850bc87abe0f9cc3ada24763d7f'/>
<id>urn:sha1:0ee288e69d033850bc87abe0f9cc3ada24763d7f</id>
<content type='text'>
Peter reported that perf_event_detach_bpf_prog might skip to release
the bpf program for -ENOENT error from bpf_prog_array_copy.

This can't happen because bpf program is stored in perf event and is
detached and released only when perf event is freed.

Let's drop the -ENOENT check and make sure the bpf program is released
in any case.

Fixes: 170a7e3ea070 ("bpf: bpf_prog_array_copy() should return -ENOENT if exclude_prog not found")
Reported-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/bpf/20241023200352.3488610-1-jolsa@kernel.org

Closes: https://lore.kernel.org/lkml/20241022111638.GC16066@noisy.programming.kicks-ass.net/
</content>
</entry>
<entry>
<title>tracing: Consider the NULL character when validating the event length</title>
<updated>2024-10-23T08:24:47Z</updated>
<author>
<name>Leo Yan</name>
<email>leo.yan@arm.com</email>
</author>
<published>2024-10-07T14:47:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0b6e2e22cb23105fcb171ab92f0f7516c69c8471'/>
<id>urn:sha1:0b6e2e22cb23105fcb171ab92f0f7516c69c8471</id>
<content type='text'>
strlen() returns a string length excluding the null byte. If the string
length equals to the maximum buffer length, the buffer will have no
space for the NULL terminating character.

This commit checks this condition and returns failure for it.

Link: https://lore.kernel.org/all/20241007144724.920954-1-leo.yan@arm.com/

Fixes: dec65d79fd26 ("tracing/probe: Check event name length correctly")
Signed-off-by: Leo Yan &lt;leo.yan@arm.com&gt;
Reviewed-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
Signed-off-by: Masami Hiramatsu (Google) &lt;mhiramat@kernel.org&gt;
</content>
</entry>
</feed>
