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]
Message-ID: <CALCETrXd+vB7SK2eLrATKGxVgr1NhM+6o5HvWMEoA6bbsRJh0g@mail.gmail.com>
Date:	Thu, 21 Jul 2016 15:27:44 -0700
From:	Andy Lutomirski <luto@...capital.net>
To:	Josh Poimboeuf <jpoimboe@...hat.com>
Cc:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...nel.org>,
	"H . Peter Anvin" <hpa@...or.com>, X86 ML <x86@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Brian Gerst <brgerst@...il.com>,
	Kees Cook <keescook@...omium.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Byungchul Park <byungchul.park@....com>
Subject: Re: [PATCH 17/19] x86/entry/dumpstack: encode pt_regs pointer in
 frame pointer

On Thu, Jul 21, 2016 at 2:21 PM, Josh Poimboeuf <jpoimboe@...hat.com> wrote:
> With frame pointers, when a task is interrupted, its stack is no longer
> completely reliable because the function could have been interrupted
> before it had a chance to save the previous frame pointer on the stack.
> So the caller of the interrupted function could get skipped by a stack
> trace.
>
> This is problematic for live patching, which needs to know whether a
> stack trace of a sleeping task can be relied upon.  There's currently no
> way to detect if a sleeping task was interrupted by a page fault
> exception or preemption before it went to sleep.
>
> Another issue is that when dumping the stack of an interrupted task, the
> unwinder has no way of knowing where the saved pt_regs registers are, so
> it can't print them.
>
> This solves those issues by encoding the pt_regs pointer in the frame
> pointer on entry from an interrupt or an exception.  The frame pointer
> unwinder is also updated to decode it.
>
> Suggested-by: Andy Lutomirski <luto@...capital.net>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...hat.com>

>
> +/*
> + * This determines if the frame pointer actually contains an encoded pointer to
> + * pt_regs on the stack.  See ENCODE_FRAME_POINTER.
> + */
> +static struct pt_regs *decode_frame_pointer(struct unwind_state *state,
> +                                           unsigned long *bp)
> +{
> +       struct pt_regs *regs = (struct pt_regs *)bp;
> +       unsigned long *task_begin = task_stack_page(state->task);
> +       unsigned long *task_end   = task_stack_page(state->task) + THREAD_SIZE;
> +
> +       if (test_and_set_bit(BITS_PER_LONG - 1, (unsigned long *)&regs))
> +               return NULL;

test_and_set_bit is a fairly heavyweight atomic operation.  It's
probably better to use plain C bitwise ops.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ