The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [for-linus][PATCH 0/2] tracing: More fixes for v6.15
@ 2025-04-02 21:31 Steven Rostedt
  2025-04-02 21:31 ` [for-linus][PATCH 1/2] scripts/sorttable: Fix endianness handling in build-time mcount sort Steven Rostedt
  2025-04-02 21:31 ` [for-linus][PATCH 2/2] rv: Fix missing unlock on double nested monitors return path Steven Rostedt
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Rostedt @ 2025-04-02 21:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton


More tracing fixes for 6.15

- Fix mcount sorttable building for different endian type target

  When modifying the ELF file to sort the mcount_loc table in the
  sorttable.c code, the endianess of the file and the host is used
  to determine if the bytes need to be swapped when calculations are
  done. A change was made to the sorting of the mcount_loc that read
  the values from the ELF file into an array and the swap happened
  on the filling of the array. But one of the calculations of the
  array still did the swap when it did not need to. This caused building
  on a little endian machine for a big endian target to not find
  the mcount function in the 'nm' table and it zeroed it out, causing
  there to be no functions available to trace.

- Add goto out_unlock jump to rv_register_monitor() on error path

  One of the error paths in rv_register_monitor() just returned the
  error when it should have jumped to the out_unlock label to release
  the mutex. 

  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/fixes

Head SHA1: fc0585c7faa9fffa0ecdd6e2466e3293cd3239ac


Gabriele Monaco (1):
      rv: Fix missing unlock on double nested monitors return path

Vasily Gorbik (1):
      scripts/sorttable: Fix endianness handling in build-time mcount sort

----
 kernel/trace/rv/rv.c | 3 ++-
 scripts/sorttable.c  | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [for-linus][PATCH 1/2] scripts/sorttable: Fix endianness handling in build-time mcount sort
  2025-04-02 21:31 [for-linus][PATCH 0/2] tracing: More fixes for v6.15 Steven Rostedt
@ 2025-04-02 21:31 ` Steven Rostedt
  2025-04-02 21:31 ` [for-linus][PATCH 2/2] rv: Fix missing unlock on double nested monitors return path Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2025-04-02 21:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	Catalin Marinas, Nathan Chancellor, Heiko Carstens,
	Alexander Gordeev, Ilya Leoshkevich, Ihor Solodrai, Vasily Gorbik

From: Vasily Gorbik <gor@linux.ibm.com>

Kernel cross-compilation with BUILDTIME_MCOUNT_SORT produces zeroed
mcount values if the build-host endianness does not match the ELF
file endianness.

The mcount values array is converted from ELF file
endianness to build-host endianness during initialization in
fill_relocs()/fill_addrs(). Avoid extra conversion of these values during
weak-function zeroing; otherwise, they do not match nm-parsed addresses
and all mcount values are zeroed out.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Link: https://lore.kernel.org/patch.git-dca31444b0f1.your-ad-here.call-01743554658-ext-8692@work.hours
Fixes: ef378c3b8233 ("scripts/sorttable: Zero out weak functions in mcount_loc table")
Reported-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reported-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Closes: https://lore.kernel.org/all/your-ad-here.call-01743522822-ext-4975@work.hours/
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 scripts/sorttable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/sorttable.c b/scripts/sorttable.c
index 7b4b3714b1af..deed676bfe38 100644
--- a/scripts/sorttable.c
+++ b/scripts/sorttable.c
@@ -857,7 +857,7 @@ static void *sort_mcount_loc(void *arg)
 		for (void *ptr = vals; ptr < vals + size; ptr += long_size) {
 			uint64_t key;
 
-			key = long_size == 4 ? r((uint32_t *)ptr) : r8((uint64_t *)ptr);
+			key = long_size == 4 ? *(uint32_t *)ptr : *(uint64_t *)ptr;
 			if (!find_func(key)) {
 				if (long_size == 4)
 					*(uint32_t *)ptr = 0;
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [for-linus][PATCH 2/2] rv: Fix missing unlock on double nested monitors return path
  2025-04-02 21:31 [for-linus][PATCH 0/2] tracing: More fixes for v6.15 Steven Rostedt
  2025-04-02 21:31 ` [for-linus][PATCH 1/2] scripts/sorttable: Fix endianness handling in build-time mcount sort Steven Rostedt
@ 2025-04-02 21:31 ` Steven Rostedt
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2025-04-02 21:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton,
	kernel test robot, Julia Lawall, Gabriele Monaco

From: Gabriele Monaco <gmonaco@redhat.com>

RV doesn't support nested monitors having children monitors themselves
and exits with the EINVAL code. However, it returns without unlocking
the rv_interface_lock.

Unlock the lock before returning from the initialisation function.

Cc: Masami Hiramatsu <mhiramat@kernel.org>
Link: https://lore.kernel.org/20250402071351.19864-2-gmonaco@redhat.com
Fixes: cb85c660fcd4 ("rv: Add option for nested monitors and include sched")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Closes: https://lore.kernel.org/r/202503310200.UBXGitB4-lkp@intel.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/rv/rv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
index 50344aa9f7f9..968c5c3b0246 100644
--- a/kernel/trace/rv/rv.c
+++ b/kernel/trace/rv/rv.c
@@ -809,7 +809,8 @@ int rv_register_monitor(struct rv_monitor *monitor, struct rv_monitor *parent)
 	if (p && rv_is_nested_monitor(p)) {
 		pr_info("Parent monitor %s is already nested, cannot nest further\n",
 			parent->name);
-		return -EINVAL;
+		retval = -EINVAL;
+		goto out_unlock;
 	}
 
 	r = kzalloc(sizeof(struct rv_monitor_def), GFP_KERNEL);
-- 
2.47.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-02 21:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-02 21:31 [for-linus][PATCH 0/2] tracing: More fixes for v6.15 Steven Rostedt
2025-04-02 21:31 ` [for-linus][PATCH 1/2] scripts/sorttable: Fix endianness handling in build-time mcount sort Steven Rostedt
2025-04-02 21:31 ` [for-linus][PATCH 2/2] rv: Fix missing unlock on double nested monitors return path Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox