All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] cobalt/debug: Detect DSOs via presence of vm_file
@ 2022-01-03 18:51 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2022-01-03 18:51 UTC (permalink / raw)
  To: Xenomai

From: Jan Kiszka <jan.kiszka@siemens.com>

VM_DENYWRITE was removed in 5.15, so we need a different criteria.
Presence of a file-backing seems to be a good one.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---

Changes in v2:
 - fixed inverted logic
 - adjusted description

 kernel/cobalt/debug.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/kernel/cobalt/debug.c b/kernel/cobalt/debug.c
index e8458855a6..cde0c17abe 100644
--- a/kernel/cobalt/debug.c
+++ b/kernel/cobalt/debug.c
@@ -250,13 +250,12 @@ void xndebug_trace_relax(int nr, unsigned long *backtrace,
 			continue;
 
 		/*
-		 * Hack. Unlike DSOs, executables and interpreters
-		 * (e.g. dynamic linkers) are protected against write
-		 * attempts. Use this to determine when $pc should be
-		 * fixed up by subtracting the mapping base address in
-		 * the DSO case.
+		 * Interpreter-generated executable mappings are not
+		 * file-backed. Use this to determine when $pc should be fixed
+		 * up by subtracting the mapping base address in the DSO case.
 		 */
-		if (!(vma->vm_flags & VM_DENYWRITE))
+		file = vma->vm_file;
+		if (file != NULL)
 			pc -= vma->vm_start;
 
 		spot.backtrace[depth].pc = pc;
@@ -266,7 +265,6 @@ void xndebug_trace_relax(int nr, unsigned long *backtrace,
 		 * record the PC value, which may still give some hint
 		 * downstream.
 		 */
-		file = vma->vm_file;
 		if (file == NULL)
 			goto next_frame;
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-03 18:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-03 18:51 [PATCH v2] cobalt/debug: Detect DSOs via presence of vm_file Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.