Re: [Crash-utility] vmlist initialize fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kazuo Moriwaka wrote:

> Hi Dave,
>
> > The problem is that the return vmalloc address of zero eventually
> > gets stored in vt->vmalloc_start, which, among a few other places,
> > is used here:
> >
> >   #define IS_VMALLOC_ADDR(X) ((ulong)(X) >= vt->vmalloc_start)
> >
> > Can you verify that setting it to zero will not cause problems in
> > the macro above, and the other places that it's used directly?
>
> Thank you for your advice.  I rushed..
>
> > Upon a quick examination, it does looks safe enough in the relevant
> > vtop routines, but for example, the search command's use of next_kpage()
> > looks like it might fail.
> >
> > Perhaps IS_VMALLOC_ADDRESS() itself should also verify
> > that vt->vmalloc_start is non-zero, and the other places that
> > use vt->vmalloc_start directly should be verified.  (Of course
> > we don't need to do this kind of check for the processors
> > that have hardwired vmalloc addresses).
>
> I checked all places which use vt->vmalloc_start directory,
> and fixing IS_VMALLOC_ADDRESS looks enough.
>
> All places are:
> 1. IS_VMALLOC_ADDRESS
> 2. in memory.c: they looks work fine with zero.
> 3. each architectures .c: just check if(!vt->vmalloc_start). They'll work.
>
> thanks,
> --
> Kazuo Moriwaka <moriwaka@xxxxxxxxxxxxx>
>

OK, this looks reasonable.  The only issue is that the vtop command
will not do the page-table translation on unity-mapped kernel addresses
at all.  But this is such a rare situation that it's fine with me if it's fine
with you.

Queued for next release.

Thanks,
  Dave


>
> diff -ru crash-4.0-2.31.orig/defs.h crash-4.0-2.31/defs.h
> --- crash-4.0-2.31.orig/defs.h  2006-06-27 23:15:32.000000000 +0900
> +++ crash-4.0-2.31/defs.h       2006-07-11 11:17:31.000000000 +0900
> @@ -1813,7 +1813,7 @@
>  #define MACHINE_TYPE       "X86"
>  #define PTOV(X)            ((unsigned long)(X)+(machdep->kvbase))
>  #define VTOP(X)            ((unsigned long)(X)-(machdep->kvbase))
> -#define IS_VMALLOC_ADDR(X) ((ulong)(X) >= vt->vmalloc_start)
> +#define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start)
>  #define KVBASE_MASK        (0x7fffff)
>
>  #define PGDIR_SHIFT_2LEVEL   (22)
> @@ -2011,7 +2011,7 @@
>
>  #define PTOV(X)            ((unsigned long)(X)+(machdep->kvbase))
>  #define VTOP(X)            ((unsigned long)(X)-(machdep->kvbase))
> -#define IS_VMALLOC_ADDR(X) ((ulong)(X) >= vt->vmalloc_start)
> +#define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start)
>  #define KSEG_BASE_48_BIT   (0xffff800000000000)
>  #define KSEG_BASE          (0xfffffc0000000000)
>  #define _PFN_MASK          (0xFFFFFFFF00000000)
> @@ -2056,7 +2056,7 @@
>
>  #define PTOV(X)            ((unsigned long)(X)+(machdep->kvbase))
>  #define VTOP(X)            ((unsigned long)(X)-(machdep->kvbase))
> -#define IS_VMALLOC_ADDR(X) ((ulong)(X) >= vt->vmalloc_start)
> +#define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start)
>
>  #define PGDIR_SHIFT   (22)
>  #define PTRS_PER_PTE  (1024)
> @@ -2240,7 +2240,7 @@
>
>  #define PTOV(X)            ((unsigned long)(X)+(machdep->kvbase))
>  #define VTOP(X)            ((unsigned long)(X)-(machdep->kvbase))
> -#define IS_VMALLOC_ADDR(X) ((ulong)(X) >= vt->vmalloc_start)
> +#define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start)
>  #define KERNELBASE      machdep->pageoffset
>
>  #define PGDIR_SHIFT     (machdep->pageshift + (machdep->pageshift -3) + (machdep->pageshift - 2))
> @@ -2343,7 +2343,7 @@
>
>  #define PTOV(X)            ((unsigned long)(X)+(machdep->kvbase))
>  #define VTOP(X)            ((unsigned long)(X)-(machdep->kvbase))
> -#define IS_VMALLOC_ADDR(X) ((ulong)(X) >= vt->vmalloc_start)
> +#define IS_VMALLOC_ADDR(X) (vt->vmalloc_start && (ulong)(X) >= vt->vmalloc_start)
>  #define PTRS_PER_PTE    512
>  #define PTRS_PER_PMD    1024
>  #define PTRS_PER_PGD    2048
> diff -ru crash-4.0-2.31.orig/memory.c crash-4.0-2.31/memory.c
> --- crash-4.0-2.31.orig/memory.c        2006-06-27 23:15:32.000000000 +0900
> +++ crash-4.0-2.31/memory.c     2006-07-11 11:20:12.000000000 +0900
> @@ -11049,10 +11049,13 @@
>          ulong vmlist, addr;
>
>          get_symbol_data("vmlist", sizeof(void *), &vmlist);
> -
> -        if (!readmem(vmlist+OFFSET(vm_struct_addr), KVADDR, &addr,
> -           sizeof(void *), "first vmlist addr", RETURN_ON_ERROR))
> -               non_matching_kernel();
> +        if (vmlist != 0x0) {
> +            if (!readmem(vmlist+OFFSET(vm_struct_addr), KVADDR, &addr,
> +               sizeof(void *), "first vmlist addr", RETURN_ON_ERROR))
> +                   non_matching_kernel();
> +        } else {
> +            addr = 0;
> +        }
>
>          return addr;
>  }
>
> --
> Crash-utility mailing list
> Crash-utility@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/crash-utility


[Index of Archives]     [Fedora Development]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]     [Fedora Tools]

 

Powered by Linux