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.

Reply via email to