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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <cover.1469136008.git.jpoimboe@redhat.com>
Date:	Thu, 21 Jul 2016 16:21:37 -0500
From:	Josh Poimboeuf <jpoimboe@...hat.com>
To:	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...nel.org>,
	"H . Peter Anvin" <hpa@...or.com>
Cc:	x86@...nel.org, linux-kernel@...r.kernel.org,
	Andy Lutomirski <luto@...capital.net>,
	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: [PATCH 00/19] x86/dumpstack: rewrite x86 stack dump code

The x86 stack dump code is a bit of a mess.  dump_trace() uses
callbacks, and each user of it seems to have slightly different
requirements, so there are several slightly different callbacks floating
around.

Also there are some upcoming features which will require more changes to
the stack dump code: reliable stack detection for live patching,
hardened user copy, and the DWARF unwinder.  Each of those features
would at least need more callbacks and/or callback interfaces, resulting
in a much bigger mess than what we have today.

Before doing all that, we should try to clean things up and replace
dump_trace() with something cleaner and more flexible.

The new unwinder is a simple state machine which was heavily inspired by
a suggestion from Andy Lutomirski:

  https://lkml.kernel.org/r/CALCETrUbNTqaM2LRyXGRx=kVLRPeY5A3Pc6k4TtQxF320rUT=w@mail.gmail.com

It's also similar to the libunwind API:

  http://www.nongnu.org/libunwind/man/libunwind(3).html

Some if its advantages:

- simplicity: no more callback sprawl and less code duplication.

- flexibility: allows the caller to stop and inspect the stack state at
  each step in the unwinding process.

- modularity: the unwinder code, console stack dump code, and stack
  metadata analysis code are all better separated so that changing one
  of them shouldn't have much of an impact on any of the others.


Josh Poimboeuf (19):
  x86/dumpstack: remove show_trace()
  x86/dumpstack: add get_stack_pointer() and get_frame_pointer()
  x86/dumpstack: remove unnecessary stack pointer arguments
  x86/dumpstack: make printk_stack_address() more generally useful
  x86/dumpstack: fix function graph tracing stack dump reliability
    issues
  x86/dumpstack: remove extra brackets around "EOE"
  x86/dumpstack: add IRQ_USABLE_STACK_SIZE define
  x86/dumpstack: don't disable preemption in show_stack_log_lvl() and
    dump_trace()
  x86/dumpstack: simplify in_exception_stack()
  x86/dumpstack: add get_stack_info() interface
  x86/dumptrace: add new unwind interface and implementations
  perf/x86: convert perf_callchain_kernel() to the new unwinder
  x86/stacktrace: convert save_stack_trace_*() to the new unwinder
  oprofile/x86: convert x86_backtrace() to the new unwinder
  x86/dumpstack: convert show_trace_log_lvl() to the new unwinder
  x86/dumpstack: remove dump_trace()
  x86/entry/dumpstack: encode pt_regs pointer in frame pointer
  x86/dumpstack: print stack identifier on its own line
  x86/dumpstack: print any pt_regs found on the stack

 arch/x86/entry/calling.h             |  21 +++
 arch/x86/entry/entry_64.S            |   7 +-
 arch/x86/events/core.c               |  32 +---
 arch/x86/include/asm/kdebug.h        |   2 -
 arch/x86/include/asm/page_64_types.h |  19 ++-
 arch/x86/include/asm/stacktrace.h    | 127 +++++++-------
 arch/x86/include/asm/unwind.h        |  91 ++++++++++
 arch/x86/kernel/Makefile             |   6 +
 arch/x86/kernel/cpu/common.c         |   2 +-
 arch/x86/kernel/dumpstack.c          | 269 +++++++++++++++---------------
 arch/x86/kernel/dumpstack_32.c       | 120 +++++++-------
 arch/x86/kernel/dumpstack_64.c       | 310 ++++++++++-------------------------
 arch/x86/kernel/setup_percpu.c       |   2 +-
 arch/x86/kernel/stacktrace.c         |  74 ++++-----
 arch/x86/kernel/unwind_frame.c       | 133 +++++++++++++++
 arch/x86/kernel/unwind_guess.c       |  40 +++++
 arch/x86/oprofile/backtrace.c        |  44 +++--
 17 files changed, 713 insertions(+), 586 deletions(-)
 create mode 100644 arch/x86/include/asm/unwind.h
 create mode 100644 arch/x86/kernel/unwind_frame.c
 create mode 100644 arch/x86/kernel/unwind_guess.c

-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ