lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20250327115546.21b514b0@gandalf.local.home>
Date: Thu, 27 Mar 2025 11:55:46 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Masami Hiramatsu <mhiramat@...nel.org>, Mathieu Desnoyers
 <mathieu.desnoyers@...icios.com>, Mark Rutland <mark.rutland@....com>,
 Andrew Morton <akpm@...ux-foundation.org>
Subject: [for-next][PATCH] tracing: Use _text and the kernel offset in
 last_boot_info


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
ring-buffer/for-next

Head SHA1: f20423262b368ff860373d28050f0c4b65e82973


Steven Rostedt (1):
      tracing: Use _text and the kernel offset in last_boot_info

----
 kernel/trace/trace.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
---------------------------
commit f20423262b368ff860373d28050f0c4b65e82973
Author: Steven Rostedt <rostedt@...dmis.org>
Date:   Wed Mar 26 22:03:04 2025 -0400

    tracing: Use _text and the kernel offset in last_boot_info
    
    Instead of using kaslr_offset() just record the location of "_text". This
    makes it possible for user space to use either the System.map or
    /proc/kallsyms as what to map all addresses to functions with.
    
    Cc: Masami Hiramatsu <mhiramat@...nel.org>
    Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
    Link: https://lore.kernel.org/20250326220304.38dbedcd@gandalf.local.home
    Signed-off-by: Steven Rostedt (Google) <rostedt@...dmis.org>

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 7ca8a0dbd4fa..f14651ea32bd 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -51,7 +51,7 @@
 #include <linux/workqueue.h>
 #include <linux/sort.h>
 
-#include <asm/setup.h> /* COMMAND_LINE_SIZE and kaslr_offset() */
+#include <asm/setup.h> /* COMMAND_LINE_SIZE */
 
 #include "trace.h"
 #include "trace_output.h"
@@ -5995,7 +5995,7 @@ struct trace_mod_entry {
 };
 
 struct trace_scratch {
-	unsigned long		kaslr_addr;
+	unsigned long		text_addr;
 	unsigned long		nr_entries;
 	struct trace_mod_entry	entries[];
 };
@@ -6133,11 +6133,7 @@ static void update_last_data(struct trace_array *tr)
 	kfree_rcu(module_delta, rcu);
 
 	/* Set the persistent ring buffer meta data to this address */
-#ifdef CONFIG_RANDOMIZE_BASE
-	tscratch->kaslr_addr = kaslr_offset();
-#else
-	tscratch->kaslr_addr = 0;
-#endif
+	tscratch->text_addr = (unsigned long)_text;
 }
 
 /**
@@ -6996,7 +6992,7 @@ static void show_last_boot_header(struct seq_file *m, struct trace_array *tr)
 	 * should not be the same as the current boot.
 	 */
 	if (tscratch && (tr->flags & TRACE_ARRAY_FL_LAST_BOOT))
-		seq_printf(m, "%lx\t[kernel]\n", tscratch->kaslr_addr);
+		seq_printf(m, "%lx\t[kernel]\n", tscratch->text_addr);
 	else
 		seq_puts(m, "# Current\n");
 }
@@ -9461,10 +9457,8 @@ static void setup_trace_scratch(struct trace_array *tr,
 	tr->scratch = tscratch;
 	tr->scratch_size = size;
 
-#ifdef CONFIG_RANDOMIZE_BASE
-	if (tscratch->kaslr_addr)
-		tr->text_delta = kaslr_offset() - tscratch->kaslr_addr;
-#endif
+	if (tscratch->text_addr)
+		tr->text_delta = (unsigned long)_text - tscratch->text_addr;
 
 	if (struct_size(tscratch, entries, tscratch->nr_entries) > size)
 		goto reset;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ