diff options
Diffstat (limited to 'arch/tile/kernel/stack.c')
-rw-r--r-- | arch/tile/kernel/stack.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/arch/tile/kernel/stack.c b/arch/tile/kernel/stack.c index 0d54106be3d6..dd81713a90dc 100644 --- a/arch/tile/kernel/stack.c +++ b/arch/tile/kernel/stack.c | |||
@@ -44,13 +44,6 @@ static int in_kernel_stack(struct KBacktraceIterator *kbt, VirtualAddress sp) | |||
44 | return sp >= kstack_base && sp < kstack_base + THREAD_SIZE; | 44 | return sp >= kstack_base && sp < kstack_base + THREAD_SIZE; |
45 | } | 45 | } |
46 | 46 | ||
47 | /* Is address in the specified kernel code? */ | ||
48 | static int in_kernel_text(VirtualAddress address) | ||
49 | { | ||
50 | return (address >= MEM_SV_INTRPT && | ||
51 | address < MEM_SV_INTRPT + HPAGE_SIZE); | ||
52 | } | ||
53 | |||
54 | /* Is address valid for reading? */ | 47 | /* Is address valid for reading? */ |
55 | static int valid_address(struct KBacktraceIterator *kbt, VirtualAddress address) | 48 | static int valid_address(struct KBacktraceIterator *kbt, VirtualAddress address) |
56 | { | 49 | { |
@@ -63,6 +56,23 @@ static int valid_address(struct KBacktraceIterator *kbt, VirtualAddress address) | |||
63 | if (l1_pgtable == NULL) | 56 | if (l1_pgtable == NULL) |
64 | return 0; /* can't read user space in other tasks */ | 57 | return 0; /* can't read user space in other tasks */ |
65 | 58 | ||
59 | #ifdef CONFIG_64BIT | ||
60 | /* Find the real l1_pgtable by looking in the l0_pgtable. */ | ||
61 | pte = l1_pgtable[HV_L0_INDEX(address)]; | ||
62 | if (!hv_pte_get_present(pte)) | ||
63 | return 0; | ||
64 | pfn = hv_pte_get_pfn(pte); | ||
65 | if (pte_huge(pte)) { | ||
66 | if (!pfn_valid(pfn)) { | ||
67 | pr_err("L0 huge page has bad pfn %#lx\n", pfn); | ||
68 | return 0; | ||
69 | } | ||
70 | return hv_pte_get_present(pte) && hv_pte_get_readable(pte); | ||
71 | } | ||
72 | page = pfn_to_page(pfn); | ||
73 | BUG_ON(PageHighMem(page)); /* No HIGHMEM on 64-bit. */ | ||
74 | l1_pgtable = (HV_PTE *)pfn_to_kaddr(pfn); | ||
75 | #endif | ||
66 | pte = l1_pgtable[HV_L1_INDEX(address)]; | 76 | pte = l1_pgtable[HV_L1_INDEX(address)]; |
67 | if (!hv_pte_get_present(pte)) | 77 | if (!hv_pte_get_present(pte)) |
68 | return 0; | 78 | return 0; |
@@ -92,7 +102,7 @@ static bool read_memory_func(void *result, VirtualAddress address, | |||
92 | { | 102 | { |
93 | int retval; | 103 | int retval; |
94 | struct KBacktraceIterator *kbt = (struct KBacktraceIterator *)vkbt; | 104 | struct KBacktraceIterator *kbt = (struct KBacktraceIterator *)vkbt; |
95 | if (in_kernel_text(address)) { | 105 | if (__kernel_text_address(address)) { |
96 | /* OK to read kernel code. */ | 106 | /* OK to read kernel code. */ |
97 | } else if (address >= PAGE_OFFSET) { | 107 | } else if (address >= PAGE_OFFSET) { |
98 | /* We only tolerate kernel-space reads of this task's stack */ | 108 | /* We only tolerate kernel-space reads of this task's stack */ |
@@ -132,7 +142,7 @@ static struct pt_regs *valid_fault_handler(struct KBacktraceIterator* kbt) | |||
132 | } | 142 | } |
133 | } | 143 | } |
134 | if (EX1_PL(p->ex1) == KERNEL_PL && | 144 | if (EX1_PL(p->ex1) == KERNEL_PL && |
135 | in_kernel_text(p->pc) && | 145 | __kernel_text_address(p->pc) && |
136 | in_kernel_stack(kbt, p->sp) && | 146 | in_kernel_stack(kbt, p->sp) && |
137 | p->sp >= sp) { | 147 | p->sp >= sp) { |
138 | if (kbt->verbose) | 148 | if (kbt->verbose) |