FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Crash Utility

 
 
LinkBack Thread Tools
 
Old 03-10-2012, 11:04 AM
Rabin Vincent
 
Default ARM: fix vtop -C for kernel addresses

On ARM, [vtop -C task] doesn't work correctly for kernel addresses: it
always uses swapper_pg_dir when it should be using the task's mm->pgd.

The patch below fixes this, and also makes ARM handle kernel threads
like the other arches.

Rabin

diff --git a/arm.c b/arm.c
index 4be224e..cac9a9a 100644
--- a/arm.c
+++ b/arm.c
@@ -1020,22 +1020,37 @@ static int
arm_uvtop(struct task_context *tc, ulong uvaddr, physaddr_t *paddr, int verbose)
{
ulong *pgd;
- ulong mm;

if (!tc)
error(FATAL, "current context invalid
");

*paddr = 0;

- if (IS_KVADDR(uvaddr))
- return arm_kvtop(tc, uvaddr, paddr, verbose);
+ if (is_kernel_thread(tc->task) && IS_KVADDR(uvaddr)) {
+ ulong active_mm;

- mm = task_mm(tc->task, TRUE);
- if (mm)
- pgd = ULONG_PTR(tt->mm_struct + OFFSET(mm_struct_pgd));
- else
- readmem(tc->mm_struct + OFFSET(mm_struct_pgd), KVADDR, &pgd,
- sizeof(long), "mm_struct pgd", FAULT_ON_ERROR);
+ readmem(tc->task + OFFSET(task_struct_active_mm),
+ KVADDR, &active_mm, sizeof(void *),
+ "task active_mm contents", FAULT_ON_ERROR);
+
+ if (!active_mm)
+ error(FATAL,
+ "no active_mm for this kernel thread
");
+
+ readmem(active_mm + OFFSET(mm_struct_pgd),
+ KVADDR, &pgd, sizeof(long),
+ "mm_struct pgd", FAULT_ON_ERROR);
+ } else {
+ ulong mm;
+
+ mm = task_mm(tc->task, TRUE);
+ if (mm)
+ pgd = ULONG_PTR(tt->mm_struct + OFFSET(mm_struct_pgd));
+ else
+ readmem(tc->mm_struct + OFFSET(mm_struct_pgd),
+ KVADDR, &pgd, sizeof(long), "mm_struct pgd",
+ FAULT_ON_ERROR);
+ }

return arm_vtop(uvaddr, pgd, paddr, verbose);
}

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 
Old 03-12-2012, 02:27 PM
Dave Anderson
 
Default ARM: fix vtop -C for kernel addresses

----- Original Message -----
> On ARM, [vtop -C task] doesn't work correctly for kernel addresses: it
> always uses swapper_pg_dir when it should be using the task's
> mm->pgd.
>
> The patch below fixes this, and also makes ARM handle kernel threads
> like the other arches.
>
> Rabin

The patch makes "vtop -c" conform with the other architectures, so unless
Mika has a problem with it, consider it queued for crash-6.0.5.

Thanks,
Dave


> diff --git a/arm.c b/arm.c
> index 4be224e..cac9a9a 100644
> --- a/arm.c
> +++ b/arm.c
> @@ -1020,22 +1020,37 @@ static int
> arm_uvtop(struct task_context *tc, ulong uvaddr, physaddr_t *paddr,
> int verbose)
> {
> ulong *pgd;
> - ulong mm;
>
> if (!tc)
> error(FATAL, "current context invalid
");
>
> *paddr = 0;
>
> - if (IS_KVADDR(uvaddr))
> - return arm_kvtop(tc, uvaddr, paddr, verbose);
> + if (is_kernel_thread(tc->task) && IS_KVADDR(uvaddr)) {
> + ulong active_mm;
>
> - mm = task_mm(tc->task, TRUE);
> - if (mm)
> - pgd = ULONG_PTR(tt->mm_struct + OFFSET(mm_struct_pgd));
> - else
> - readmem(tc->mm_struct + OFFSET(mm_struct_pgd), KVADDR, &pgd,
> - sizeof(long), "mm_struct pgd", FAULT_ON_ERROR);
> + readmem(tc->task + OFFSET(task_struct_active_mm),
> + KVADDR, &active_mm, sizeof(void *),
> + "task active_mm contents", FAULT_ON_ERROR);
> +
> + if (!active_mm)
> + error(FATAL,
> + "no active_mm for this kernel thread
");
> +
> + readmem(active_mm + OFFSET(mm_struct_pgd),
> + KVADDR, &pgd, sizeof(long),
> + "mm_struct pgd", FAULT_ON_ERROR);
> + } else {
> + ulong mm;
> +
> + mm = task_mm(tc->task, TRUE);
> + if (mm)
> + pgd = ULONG_PTR(tt->mm_struct + OFFSET(mm_struct_pgd));
> + else
> + readmem(tc->mm_struct + OFFSET(mm_struct_pgd),
> + KVADDR, &pgd, sizeof(long), "mm_struct pgd",
> + FAULT_ON_ERROR);
> + }
>
> return arm_vtop(uvaddr, pgd, paddr, verbose);
> }
>
> --
> Crash-utility mailing list
> Crash-utility@redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
>

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
 

Thread Tools




All times are GMT. The time now is 11:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org