public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH?] Crash in 2.4.17/ptrace
@ 2002-01-28 20:32 Daniel Jacobowitz
  2002-01-28 21:03 ` Andrew Morton
  0 siblings, 1 reply; 19+ messages in thread
From: Daniel Jacobowitz @ 2002-01-28 20:32 UTC (permalink / raw)
  To: linux-kernel

I've been debugging frame buffer graphics lately, and encountering a
very annoying problem.  If the debugee has /dev/fb/0 mapped, and I try
to print out the contents of a pointer into that buffer, GDB crashes in
kernel/ptrace.c:access_process_vm.  The problem seems to be that
get_user_pages returns a NULL page.  Something as simple as this
prevents the crash:

--- 2.4.18-pre7/2.4.18-pre7/kernel/ptrace.c	Fri Dec 21 12:42:04 2001
+++ 2.4.17/kernel-source-2.4.17/kernel/ptrace.c	Mon Jan 28 15:30:39 2002
@@ -160,6 +160,18 @@ int access_process_vm(struct task_struct
 
 		flush_cache_page(vma, addr);
 
+#if 1
+		if (!page)
+		{
+			/* FIXME: Writes? */
+			if (!write) memset (buf, 0, bytes);
+			len -= bytes;
+			buf += bytes;
+			continue;
+		}
+#endif
+
+
 		maddr = kmap(page);
 		if (write) {
 			memcpy(maddr + offset, buf, bytes);


Of course, I would much rather be able to see the contents of the
framebuffer.  Any suggestions?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: [PATCH?] Crash in 2.4.17/ptrace
@ 2002-01-28 21:33 Manfred Spraul
  2002-01-28 22:05 ` Alan Cox
  0 siblings, 1 reply; 19+ messages in thread
From: Manfred Spraul @ 2002-01-28 21:33 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: linux-kernel, Andrew Morton

> >
> > Not with this patch, I'm afraid.  For your testing purposes you
> > could just remove the VALID_PAGE() test in
mm/memory.c:get_page_map(),
> > and then gdb should be able to get at the framebuffer.
>
> I'm sure there's a good reason to not do that in general.  Mind
> enlightening me?

Please don't do it at all.
The test is there to ensure that there is a 'struct page' for address
found in the pages tables.
For framebuffers addresses, there is no page structure, and then the
page reference count updates read/write to random memory.

--
    Manfred


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

end of thread, other threads:[~2002-01-30  0:16 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-28 20:32 [PATCH?] Crash in 2.4.17/ptrace Daniel Jacobowitz
2002-01-28 21:03 ` Andrew Morton
2002-01-28 21:19   ` Daniel Jacobowitz
2002-01-28 21:29     ` Andrew Morton
2002-01-28 21:55       ` Alan Cox
2002-01-28 22:12       ` Andrew Morton
2002-01-29 22:59         ` [Linux-fbdev-devel] " James Simmons
2002-01-29 23:02           ` Andrew Morton
2002-01-30  0:13             ` James Simmons
2002-01-28 22:15       ` Benjamin Herrenschmidt
2002-01-28 23:57         ` Andrea Arcangeli
2002-01-28 23:54       ` Andrea Arcangeli
2002-01-29  5:35         ` Andrew Morton
2002-01-28 23:47     ` Andrea Arcangeli
2002-01-28 21:42   ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2002-01-28 21:33 Manfred Spraul
2002-01-28 22:05 ` Alan Cox
2002-01-28 22:07   ` Manfred Spraul
2002-01-28 22:26   ` Daniel Jacobowitz

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