* [PATCH] allow ptrace and /proc/PID/mem to read fixmap pages
@ 2003-04-26 23:46 Roland McGrath
2003-04-26 23:59 ` Jamie Lokier
2003-04-27 1:04 ` Linus Torvalds
0 siblings, 2 replies; 3+ messages in thread
From: Roland McGrath @ 2003-04-26 23:46 UTC (permalink / raw)
To: Linus Torvalds, linux-kernel
It's a problem now that ptrace and /proc/PID/mem pretend the vsyscall page
does not exist, and won't let you read it from the inferior. In fact you
can read it from yourself, but programs like a debugger should not have to
know about such magic addresses. I think access_process_vm ought to give
you access to all of the process's adddress space.
This patch is i386-specific and should probably be done another way, but
it's what I am using now. It works and is well-tested.
Thanks,
Roland
--- stock-2.5.68/kernel/ptrace.c Sat Apr 19 19:51:21 2003
+++ linux-2.5.68/kernel/ptrace.c Wed Apr 23 12:39:52 2003
@@ -201,6 +201,25 @@ int access_process_vm(struct task_struct
up_read(&mm->mmap_sem);
mmput(mm);
+#ifdef FIXADDR_START
+ while (len > 0 && addr < FIXADDR_TOP && addr >= FIXADDR_START) {
+ unsigned long pg = addr & PAGE_MASK;
+ int bytes = (len < pg + PAGE_SIZE - addr
+ ? len : pg + PAGE_SIZE - addr);
+ pte_t *pte = pte_offset_kernel(pmd_offset(pgd_offset_k(pg),
+ pg), pg);
+ if (!pte_read(*pte) || (write && !pte_write(*pte)))
+ break;
+ if (write)
+ memcpy((void *)addr, buf, bytes);
+ else
+ memcpy(buf, (const void *)addr, bytes);
+ len -= bytes;
+ buf += bytes;
+ addr += bytes;
+ }
+#endif
+
return buf - old_buf;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-04-27 0:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-26 23:46 [PATCH] allow ptrace and /proc/PID/mem to read fixmap pages Roland McGrath
2003-04-26 23:59 ` Jamie Lokier
2003-04-27 1:04 ` Linus Torvalds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).