.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | #include <linux/export.h> |
---|
2 | 3 | #include <linux/sched.h> |
---|
3 | 4 | #include <linux/sched/debug.h> |
---|
.. | .. |
---|
52 | 53 | return -EINVAL; |
---|
53 | 54 | |
---|
54 | 55 | frame->sp = frame->fp; |
---|
55 | | - frame->fp = *(unsigned long *)(fp); |
---|
56 | | - frame->pc = *(unsigned long *)(fp + 4); |
---|
| 56 | + frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp)); |
---|
| 57 | + frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp + 4)); |
---|
57 | 58 | #else |
---|
58 | 59 | /* check current frame pointer is within bounds */ |
---|
59 | 60 | if (fp < low + 12 || fp > high - 4) |
---|
60 | 61 | return -EINVAL; |
---|
61 | 62 | |
---|
62 | 63 | /* restore the registers from the stack frame */ |
---|
63 | | - frame->fp = *(unsigned long *)(fp - 12); |
---|
64 | | - frame->sp = *(unsigned long *)(fp - 8); |
---|
65 | | - frame->pc = *(unsigned long *)(fp - 4); |
---|
| 64 | + frame->fp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 12)); |
---|
| 65 | + frame->sp = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 8)); |
---|
| 66 | + frame->pc = READ_ONCE_NOCHECK(*(unsigned long *)(fp - 4)); |
---|
66 | 67 | #endif |
---|
67 | 68 | |
---|
68 | 69 | return 0; |
---|
.. | .. |
---|
140 | 141 | * running on another CPU? For now, ignore it as we |
---|
141 | 142 | * can't guarantee we won't explode. |
---|
142 | 143 | */ |
---|
143 | | - if (trace->nr_entries < trace->max_entries) |
---|
144 | | - trace->entries[trace->nr_entries++] = ULONG_MAX; |
---|
145 | 144 | return; |
---|
146 | 145 | #else |
---|
147 | 146 | frame.fp = thread_saved_fp(tsk); |
---|
.. | .. |
---|
159 | 158 | } |
---|
160 | 159 | |
---|
161 | 160 | walk_stackframe(&frame, save_trace, &data); |
---|
162 | | - if (trace->nr_entries < trace->max_entries) |
---|
163 | | - trace->entries[trace->nr_entries++] = ULONG_MAX; |
---|
164 | 161 | } |
---|
165 | 162 | |
---|
166 | 163 | void save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace) |
---|
.. | .. |
---|
178 | 175 | frame.pc = regs->ARM_pc; |
---|
179 | 176 | |
---|
180 | 177 | walk_stackframe(&frame, save_trace, &data); |
---|
181 | | - if (trace->nr_entries < trace->max_entries) |
---|
182 | | - trace->entries[trace->nr_entries++] = ULONG_MAX; |
---|
183 | 178 | } |
---|
184 | 179 | |
---|
185 | 180 | void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) |
---|