Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143616909
D41210.id125252.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D41210.id125252.diff
View Options
diff --git a/sys/arm/arm/unwind.c b/sys/arm/arm/unwind.c
--- a/sys/arm/arm/unwind.c
+++ b/sys/arm/arm/unwind.c
@@ -35,6 +35,7 @@
#include <sys/kernel.h>
#include <sys/linker.h>
#include <sys/malloc.h>
+#include <sys/proc.h>
#include <sys/queue.h>
#include <sys/systm.h>
@@ -370,6 +371,7 @@
static int
unwind_exec_insn(struct unwind_state *state)
{
+ struct thread *td = curthread;
unsigned int insn;
uint32_t *vsp = (uint32_t *)state->registers[SP];
int update_vsp = 0;
@@ -404,6 +406,10 @@
/* Load the registers */
for (reg = 4; mask && reg < 16; mask >>= 1, reg++) {
if (mask & 1) {
+ if (!kstack_contains(td, (uintptr_t)vsp,
+ sizeof(*vsp)))
+ return 1;
+
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
@@ -430,6 +436,9 @@
update_vsp = 1;
/* Pop the registers */
+ if (!kstack_contains(td, (uintptr_t)vsp,
+ sizeof(*vsp) * (4 + count)))
+ return 1;
for (reg = 4; reg <= 4 + count; reg++) {
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
@@ -437,6 +446,8 @@
/* Check if we are in the pop r14 version */
if ((insn & INSN_POP_TYPE_MASK) != 0) {
+ if (!kstack_contains(td, (uintptr_t)vsp, sizeof(*vsp)))
+ return 1;
state->registers[14] = *vsp++;
}
@@ -457,6 +468,9 @@
/* Load the registers */
for (reg = 0; mask && reg < 4; mask >>= 1, reg++) {
if (mask & 1) {
+ if (!kstack_contains(td, (uintptr_t)vsp,
+ sizeof(*vsp)))
+ return 1;
state->registers[reg] = *vsp++;
state->update_mask |= 1 << reg;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Feb 1, 2:08 AM (5 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28246555
Default Alt Text
D41210.id125252.diff (1 KB)
Attached To
Mode
D41210: arm/unwind: Check stack pointer boundaries before dereferencing
Attached
Detach File
Event Timeline
Log In to Comment