Skip to content

Commit 31dc754

Browse files
author
Fox Snowpatch
committed
1 parent ddf9a4c commit 31dc754

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

arch/powerpc/include/asm/thread_info.h

+4
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@ static inline int arch_within_stack_frames(const void * const stack,
226226
return BAD_STACK;
227227
}
228228

229+
#ifdef CONFIG_PPC32
230+
extern void *emergency_ctx[];
231+
#endif
232+
229233
#endif /* !__ASSEMBLY__ */
230234

231235
#endif /* __KERNEL__ */

arch/powerpc/kernel/process.c

+18-2
Original file line numberDiff line numberDiff line change
@@ -2177,10 +2177,10 @@ static inline int valid_irq_stack(unsigned long sp, struct task_struct *p,
21772177
return 0;
21782178
}
21792179

2180+
#ifdef CONFIG_PPC64
21802181
static inline int valid_emergency_stack(unsigned long sp, struct task_struct *p,
21812182
unsigned long nbytes)
21822183
{
2183-
#ifdef CONFIG_PPC64
21842184
unsigned long stack_page;
21852185
unsigned long cpu = task_cpu(p);
21862186

@@ -2208,10 +2208,26 @@ static inline int valid_emergency_stack(unsigned long sp, struct task_struct *p,
22082208
if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes)
22092209
return 1;
22102210
# endif
2211-
#endif
22122211

22132212
return 0;
22142213
}
2214+
#else
2215+
static inline int valid_emergency_stack(unsigned long sp, struct task_struct *p,
2216+
unsigned long nbytes)
2217+
{
2218+
unsigned long stack_page;
2219+
unsigned long cpu = task_cpu(p);
2220+
2221+
if (!IS_ENABLED(CONFIG_VMAP_STACK))
2222+
return 0;
2223+
2224+
stack_page = (unsigned long)emergency_ctx[cpu] - THREAD_SIZE;
2225+
if (sp >= stack_page && sp <= stack_page + THREAD_SIZE - nbytes)
2226+
return 1;
2227+
2228+
return 0;
2229+
}
2230+
#endif
22152231

22162232
/*
22172233
* validate the stack frame of a particular minimum size, used for when we are

0 commit comments

Comments
 (0)