lkml.org 
[lkml]   [2017]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 02/21] x86/unwinder: Handle stack overflows more gracefully
On Mon, Nov 27, 2017 at 06:36:04PM +0100, Borislav Petkov wrote:
> > +static bool deref_stack_iret_regs(struct unwind_state *state, unsigned long addr,
> > + unsigned long *ip, unsigned long *sp)
> > +{
> > + struct pt_regs *regs = (void *)addr - IRET_FRAME_OFFSET;
>
> I guess those are traditionally done with container_of()...

Without modifying pt_regs, there's no container to speak of, but at
least IRET_FRAME_OFFSET uses offsetof(), which is similar.

> But yeah, FWIW, looks ok to me:
>
> Reviewed-by: Borislav Petkov <bp@suse.de>

Thanks!


Ingo, can you fold in the below changes based on Boris' comments?


diff --git a/arch/x86/include/asm/unwind.h b/arch/x86/include/asm/unwind.h
index 5be2fb23825a..c1688c2d0a12 100644
--- a/arch/x86/include/asm/unwind.h
+++ b/arch/x86/include/asm/unwind.h
@@ -57,7 +57,7 @@ void unwind_start(struct unwind_state *state, struct task_struct *task,
#if defined(CONFIG_UNWINDER_ORC) || defined(CONFIG_UNWINDER_FRAME_POINTER)
/*
* WARNING: The entire pt_regs may not be safe to dereference. In some cases,
- * only the iret registers are accessible. Use with caution!
+ * only the iret frame registers are accessible. Use with caution!
*/
static inline struct pt_regs *unwind_get_entry_regs(struct unwind_state *state)
{
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index fc918744ad7d..0bc95be5c638 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -66,7 +66,7 @@ static void show_regs_safe(struct stack_info *info, struct pt_regs *regs)
/*
* When an interrupt or exception occurs in entry code, the
* full pt_regs might not have been saved yet. In that case
- * just print the iret return frame.
+ * just print the iret frame.
*/
show_iret_regs(regs);
}
\
 
 \ /
  Last update: 2017-11-28 05:55    [W:3.607 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site