lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 10 Jan 2017 11:14:51 +0100 (CET)
From:   Miroslav Benes <mbenes@...e.cz>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
cc:     x86@...nel.org, Dave Jones <davej@...emonkey.org.uk>,
        Dmitry Vyukov <dvyukov@...gle.com>,
        Andy Lutomirski <luto@...capital.net>,
        Brian Gerst <brgerst@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/4] x86/unwind: include __schedule() in stack traces

On Mon, 9 Jan 2017, Josh Poimboeuf wrote:

> In the following commit:
> 
>   0100301bfdf5 ("sched/x86: Rewrite the switch_to() code")
> 
> ... the layout of the 'inactive_task_frame' struct was designed to have
> a frame pointer header embedded in it, so that the unwinder could use
> the 'bp' and 'ret_addr' fields to report __schedule() on the stack (or
> ret_from_fork() for newly forked tasks which haven't actually run yet).
> 
> Finish the job by changing get_frame_pointer() to return a pointer to
> inactive_task_frame's 'bp' field rather than 'bp' itself.  This allows
> the unwinder to start one frame higher on the stack, so that it properly
> reports __schedule().
> 
> Reported-by: Miroslav Benes <mbenes@...e.cz>

You can also add my

Tested-by: Miroslav Benes <mbenes@...e.cz>

One ignorant question below.

> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>
> ---
>  arch/x86/include/asm/stacktrace.h |  5 +----
>  arch/x86/include/asm/switch_to.h  | 10 +++++++++-
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h
> index 20ce3db..2e41c50 100644
> --- a/arch/x86/include/asm/stacktrace.h
> +++ b/arch/x86/include/asm/stacktrace.h
> @@ -52,16 +52,13 @@ static inline bool on_stack(struct stack_info *info, void *addr, size_t len)
>  static inline unsigned long *
>  get_frame_pointer(struct task_struct *task, struct pt_regs *regs)
>  {
> -	struct inactive_task_frame *frame;
> -
>  	if (regs)
>  		return (unsigned long *)regs->bp;
>  
>  	if (task == current)
>  		return __builtin_frame_address(0);
>  
> -	frame = (struct inactive_task_frame *)task->thread.sp;
> -	return (unsigned long *)READ_ONCE_NOCHECK(frame->bp);
> +	return &((struct inactive_task_frame *)task->thread.sp)->bp;

You effectively remove one of the changes from the previous patch - 
READ_ONCE_NOCHECK. Is it intentional?

Regards,
Miroslav

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ