diff options
author | Igor Nabirushkin <inabirushkin@nvidia.com> | 2013-10-24 15:12:53 +0400 |
---|---|---|
committer | Bharat Nihalani <bnihalani@nvidia.com> | 2013-10-31 03:28:31 -0700 |
commit | 595172c7300e148e43dc7a1adc9ef6084939f8dc (patch) | |
tree | d6fc1fefe4b9ece3a09f78f0ecf48ac8c545686e /drivers/misc/tegra-profiler/backtrace.c | |
parent | 510724854d6b83b61d2602d70aba02b5fda8b891 (diff) |
tegra-profiler: backtraces from the kernel context
Tegra Profiler: collect backtraces from the kernel context
Bug 1394804
Change-Id: I02ad4d0798802a4515e9f015c83d0dfc1d06ed6d
Signed-off-by: Igor Nabirushkin <inabirushkin@nvidia.com>
Reviewed-on: http://git-master/r/303305
Reviewed-by: Daniel Horowitz <dhorowitz@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Maxim Morin <mmorin@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/misc/tegra-profiler/backtrace.c')
-rw-r--r-- | drivers/misc/tegra-profiler/backtrace.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/misc/tegra-profiler/backtrace.c b/drivers/misc/tegra-profiler/backtrace.c index 6ac559d4c5cf..3191def82ce0 100644 --- a/drivers/misc/tegra-profiler/backtrace.c +++ b/drivers/misc/tegra-profiler/backtrace.c @@ -17,10 +17,11 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/module.h> -#include <asm-generic/uaccess.h> +#include <linux/uaccess.h> +#include <linux/sched.h> +#include <linux/mm.h> #include <linux/tegra_profiler.h> -#include <linux/mm.h> #include "backtrace.h" @@ -112,7 +113,7 @@ quadd_get_user_callchain(struct pt_regs *regs, callchain_data->nr = 0; - if (!regs || !user_mode(regs) || !mm) + if (!regs || !mm) return 0; if (thumb_mode(regs)) @@ -127,12 +128,18 @@ quadd_get_user_callchain(struct pt_regs *regs, return 0; vma = find_vma(mm, sp); + if (!vma) + return 0; + if (check_vma_address(fp, vma)) return 0; - if (__copy_from_user_inatomic(®, (unsigned long __user *)fp, - sizeof(unsigned long))) + if (probe_kernel_address(fp, reg)) { + pr_warn_once("frame error: sp/fp: %#lx/%#lx, pc/lr: %#lx/%#lx, vma: %#lx-%#lx\n", + sp, fp, regs->ARM_pc, regs->ARM_lr, + vma->vm_start, vma->vm_end); return 0; + } if (thumb_mode(regs)) { if (reg <= fp || check_vma_address(reg, vma)) |