kdb
[Top] [All Lists]

Re: [rfc] [patch] commands to display x86 hardware structures

To: "kdb@xxxxxxxxxxx" <kdb@xxxxxxxxxxx>
Subject: Re: [rfc] [patch] commands to display x86 hardware structures
From: "Roland Postle" <mail@xxxxxxxxxxxx>
Date: Sat, 06 Dec 2003 02:39:55 +0000
Cc: "vamsi@xxxxxxxxxx" <vamsi@xxxxxxxxxx>
Priority: Normal
Sender: kdb-bounce@xxxxxxxxxxx
Here's a quick patch against kdb-v4.3-2.4.22-i386-1 to prevent a null
dereference when using ptex on user space addresses of a process which
doesn't have an mm structure (ie. swapper).

Incidentaly kdb acts a little strange elsewhere with the swapper
process. If it's an active process it'll list it in ps and begin with
it selected, but if it's not you won't see it in ps and can't select it
(with the pid command) because for_each_task() doesn't enumerate it. I
guess it's something worth debugging, so this should be fixed?

- Roland


diff -u linux-original/kdb/modules/kdbm_x86.c
linux/kdb/modules/kdbm_x86.c                                           
          
--- linux-original/kdb/modules/kdbm_x86.c       2003-12-06
00:55:37.000000000 +0000
+++ linux/kdb/modules/kdbm_x86.c        2003-12-06 01:46:18.000000000
+0000
@@ -610,18 +610,18 @@
 static int
 get_pagetables(unsigned long addr, pgd_t **pgdir, pmd_t **pgmiddle,
pte_t **pte)
 {
-       pgd_t * d;
+       pgd_t * d = NULL;
        pmd_t * m;
        pte_t * t;
 
-       if (addr > PAGE_OFFSET) {
+       if (addr >= PAGE_OFFSET) {
                d = pgd_offset_k(addr);
        } else {
                kdb_printf("pid=%d, process=%s\n",
kdb_current_task->pid, kdb_current_task->comm);
-               d = pgd_offset(kdb_current_task->mm, addr);
+               if(kdb_current_task->mm) d =
pgd_offset(kdb_current_task->mm, addr);
        }
 
-       if (pgd_none(*d) || pgd_bad(*d)) {
+       if (!d || pgd_none(*d) || pgd_bad(*d)) {
                *pgdir = NULL;
                *pgmiddle = NULL;
                *pte = NULL;


Use http://oss.sgi.com/ecartis to modify your settings or to unsubscribe.
<Prev in Thread] Current Thread [Next in Thread>