1. 25 7月, 2017 1 次提交
  2. 18 7月, 2017 2 次提交
    • J
      objtool, x86: Add facility for asm code to provide unwind hints · 39358a03
      Josh Poimboeuf 提交于
      Some asm (and inline asm) code does special things to the stack which
      objtool can't understand.  (Nor can GCC or GNU assembler, for that
      matter.)  In such cases we need a facility for the code to provide
      annotations, so the unwinder can unwind through it.
      
      This provides such a facility, in the form of unwind hints.  They're
      similar to the GNU assembler .cfi* directives, but they give more
      information, and are needed in far fewer places, because objtool can
      fill in the blanks by following branches and adjusting the stack pointer
      for pushes and pops.
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: live-patching@vger.kernel.org
      Link: http://lkml.kernel.org/r/0f5f3c9104fca559ff4088bece1d14ae3bca52d5.1499786555.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      39358a03
    • J
      objtool: Add ORC unwind table generation · 627fce14
      Josh Poimboeuf 提交于
      Now that objtool knows the states of all registers on the stack for each
      instruction, it's straightforward to generate debuginfo for an unwinder
      to use.
      
      Instead of generating DWARF, generate a new format called ORC, which is
      more suitable for an in-kernel unwinder.  See
      Documentation/x86/orc-unwinder.txt for a more detailed description of
      this new debuginfo format and why it's preferable to DWARF.
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: live-patching@vger.kernel.org
      Link: http://lkml.kernel.org/r/c9b9f01ba6c5ed2bdc9bb0957b78167fdbf9632e.1499786555.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      627fce14
  3. 30 6月, 2017 2 次提交
  4. 29 2月, 2016 1 次提交
    • J
      objtool: Add tool to perform compile-time stack metadata validation · 442f04c3
      Josh Poimboeuf 提交于
      This adds a host tool named objtool which has a "check" subcommand which
      analyzes .o files to ensure the validity of stack metadata.  It enforces
      a set of rules on asm code and C inline assembly code so that stack
      traces can be reliable.
      
      For each function, it recursively follows all possible code paths and
      validates the correct frame pointer state at each instruction.
      
      It also follows code paths involving kernel special sections, like
      .altinstructions, __jump_table, and __ex_table, which can add
      alternative execution paths to a given instruction (or set of
      instructions).  Similarly, it knows how to follow switch statements, for
      which gcc sometimes uses jump tables.
      
      Here are some of the benefits of validating stack metadata:
      
      a) More reliable stack traces for frame pointer enabled kernels
      
         Frame pointers are used for debugging purposes.  They allow runtime
         code and debug tools to be able to walk the stack to determine the
         chain of function call sites that led to the currently executing
         code.
      
         For some architectures, frame pointers are enabled by
         CONFIG_FRAME_POINTER.  For some other architectures they may be
         required by the ABI (sometimes referred to as "backchain pointers").
      
         For C code, gcc automatically generates instructions for setting up
         frame pointers when the -fno-omit-frame-pointer option is used.
      
         But for asm code, the frame setup instructions have to be written by
         hand, which most people don't do.  So the end result is that
         CONFIG_FRAME_POINTER is honored for C code but not for most asm code.
      
         For stack traces based on frame pointers to be reliable, all
         functions which call other functions must first create a stack frame
         and update the frame pointer.  If a first function doesn't properly
         create a stack frame before calling a second function, the *caller*
         of the first function will be skipped on the stack trace.
      
         For example, consider the following example backtrace with frame
         pointers enabled:
      
           [<ffffffff81812584>] dump_stack+0x4b/0x63
           [<ffffffff812d6dc2>] cmdline_proc_show+0x12/0x30
           [<ffffffff8127f568>] seq_read+0x108/0x3e0
           [<ffffffff812cce62>] proc_reg_read+0x42/0x70
           [<ffffffff81256197>] __vfs_read+0x37/0x100
           [<ffffffff81256b16>] vfs_read+0x86/0x130
           [<ffffffff81257898>] SyS_read+0x58/0xd0
           [<ffffffff8181c1f2>] entry_SYSCALL_64_fastpath+0x12/0x76
      
         It correctly shows that the caller of cmdline_proc_show() is
         seq_read().
      
         If we remove the frame pointer logic from cmdline_proc_show() by
         replacing the frame pointer related instructions with nops, here's
         what it looks like instead:
      
           [<ffffffff81812584>] dump_stack+0x4b/0x63
           [<ffffffff812d6dc2>] cmdline_proc_show+0x12/0x30
           [<ffffffff812cce62>] proc_reg_read+0x42/0x70
           [<ffffffff81256197>] __vfs_read+0x37/0x100
           [<ffffffff81256b16>] vfs_read+0x86/0x130
           [<ffffffff81257898>] SyS_read+0x58/0xd0
           [<ffffffff8181c1f2>] entry_SYSCALL_64_fastpath+0x12/0x76
      
         Notice that cmdline_proc_show()'s caller, seq_read(), has been
         skipped.  Instead the stack trace seems to show that
         cmdline_proc_show() was called by proc_reg_read().
      
         The benefit of "objtool check" here is that because it ensures that
         *all* functions honor CONFIG_FRAME_POINTER, no functions will ever[*]
         be skipped on a stack trace.
      
         [*] unless an interrupt or exception has occurred at the very
             beginning of a function before the stack frame has been created,
             or at the very end of the function after the stack frame has been
             destroyed.  This is an inherent limitation of frame pointers.
      
      b) 100% reliable stack traces for DWARF enabled kernels
      
         This is not yet implemented.  For more details about what is planned,
         see tools/objtool/Documentation/stack-validation.txt.
      
      c) Higher live patching compatibility rate
      
         This is not yet implemented.  For more details about what is planned,
         see tools/objtool/Documentation/stack-validation.txt.
      
      To achieve the validation, "objtool check" enforces the following rules:
      
      1. Each callable function must be annotated as such with the ELF
         function type.  In asm code, this is typically done using the
         ENTRY/ENDPROC macros.  If objtool finds a return instruction
         outside of a function, it flags an error since that usually indicates
         callable code which should be annotated accordingly.
      
         This rule is needed so that objtool can properly identify each
         callable function in order to analyze its stack metadata.
      
      2. Conversely, each section of code which is *not* callable should *not*
         be annotated as an ELF function.  The ENDPROC macro shouldn't be used
         in this case.
      
         This rule is needed so that objtool can ignore non-callable code.
         Such code doesn't have to follow any of the other rules.
      
      3. Each callable function which calls another function must have the
         correct frame pointer logic, if required by CONFIG_FRAME_POINTER or
         the architecture's back chain rules.  This can by done in asm code
         with the FRAME_BEGIN/FRAME_END macros.
      
         This rule ensures that frame pointer based stack traces will work as
         designed.  If function A doesn't create a stack frame before calling
         function B, the _caller_ of function A will be skipped on the stack
         trace.
      
      4. Dynamic jumps and jumps to undefined symbols are only allowed if:
      
         a) the jump is part of a switch statement; or
      
         b) the jump matches sibling call semantics and the frame pointer has
            the same value it had on function entry.
      
         This rule is needed so that objtool can reliably analyze all of a
         function's code paths.  If a function jumps to code in another file,
         and it's not a sibling call, objtool has no way to follow the jump
         because it only analyzes a single file at a time.
      
      5. A callable function may not execute kernel entry/exit instructions.
         The only code which needs such instructions is kernel entry code,
         which shouldn't be be in callable functions anyway.
      
         This rule is just a sanity check to ensure that callable functions
         return normally.
      
      It currently only supports x86_64.  I tried to make the code generic so
      that support for other architectures can hopefully be plugged in
      relatively easily.
      
      On my Lenovo laptop with a i7-4810MQ 4-core/8-thread CPU, building the
      kernel with objtool checking every .o file adds about three seconds of
      total build time.  It hasn't been optimized for performance yet, so
      there are probably some opportunities for better build performance.
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Chris J Arges <chris.j.arges@canonical.com>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Pedro Alves <palves@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: live-patching@vger.kernel.org
      Link: http://lkml.kernel.org/r/f3efb173de43bd067b060de73f856567c0fa1174.1456719558.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      442f04c3
  5. 09 12月, 2013 1 次提交
  6. 15 10月, 2012 2 次提交
  7. 23 9月, 2011 1 次提交
  8. 14 12月, 2010 1 次提交
  9. 03 11月, 2007 6 次提交
  10. 30 10月, 2007 2 次提交
  11. 23 10月, 2007 1 次提交
    • R
      [MIPS] time: SMP-proofing of Sibyte clockevent/clocksource code. · d0453365
      Ralf Baechle 提交于
      The BCM148 has 4 cores but there are also just 4 generic timers available
      so use the ZBbus cycle counter instead of it.  In addition the ZBbus
      counter also offers a much higher resolution and 64-bit counting so I'm
      considering a later complete conversion to it once I figure out if all
      members of the Sibyte SOC family support it - the docs seem to agree but
      the headers files seem to disagree ...
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      d0453365
  12. 20 10月, 2007 1 次提交
  13. 18 10月, 2007 1 次提交
  14. 12 10月, 2007 3 次提交
  15. 30 11月, 2006 1 次提交
  16. 01 11月, 2006 1 次提交
    • A
      [MIPS] Fixup migration to GENERIC_TIME · 16b7b2ac
      Atsushi Nemoto 提交于
      Since we already moved to GENERIC_TIME, we should implement alternatives
      of old do_gettimeoffset routines to get sub-jiffies resolution from
      gettimeofday().  This patch includes:
      
       * MIPS clocksource support (based on works by Manish Lachwani).
       * remove unused gettimeoffset routines and related codes.
       * remove unised 64bit do_div64_32().
       * simplify mips_hpt_init. (no argument needed, __init tag)
       * simplify c0_hpt_timer_init. (no need to write to c0_count)
       * remove some hpt_init routines.
       * mips_hpt_mask variable to specify bitmask of hpt value.
       * convert jmr3927_do_gettimeoffset to jmr3927_hpt_read.
       * convert ip27_do_gettimeoffset to ip27_hpt_read.
       * convert bcm1480_do_gettimeoffset to bcm1480_hpt_read.
       * simplify sb1250 hpt functions. (no need to subtract and shift)
      Signed-off-by: NAtsushi Nemoto <anemo@mba.ocn.ne.jp>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      16b7b2ac
  17. 09 10月, 2006 1 次提交
  18. 08 10月, 2006 1 次提交
  19. 01 7月, 2006 1 次提交
  20. 19 3月, 2006 2 次提交
    • R
      [MIPS] Sibyte: Fix race in sb1250_gettimeoffset(). · a904f747
      Ralf Baechle 提交于
          
      From Dave Johnson <djohnson+linuxmips@sw.starentnetworks.com>:
          
      sb1250_gettimeoffset() simply reads the current cpu 0 timer remaining
      value, however once this counter reaches 0 and the interrupt is raised,
      it immediately resets and begins to count down again.
          
      If sb1250_gettimeoffset() is called on cpu 1 via do_gettimeofday() after
      the timer has reset but prior to cpu 0 processing the interrupt and
      taking write_seqlock() in timer_interrupt() it will return a full value
      (or close to it) causing time to jump backwards 1ms. Once cpu 0 handles
      the interrupt and timer_interrupt() gets far enough along it will jump
      forward 1ms.
          
      Fix this problem by implementing mips_hpt_*() on sb1250 using a spare
      timer unrelated to the existing periodic interrupt timers. It runs at
      1Mhz with a full 23bit counter.  This eliminated the custom
      do_gettimeoffset() for sb1250 and allowed use of the generic
      fixed_rate_gettimeoffset() using mips_hpt_*() and timerhi/timerlo.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a904f747
    • R
      [MIPS] Sibyte: Fix interrupt timer off by one bug. · 4308cb16
      Ralf Baechle 提交于
          
      From Dave Johnson <djohnson+linuxmips@sw.starentnetworks.com>:
          
      The timers need to be loaded with 1 less than the desired interval not
      the interval itself.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4308cb16
  21. 30 10月, 2005 3 次提交
  22. 17 4月, 2005 1 次提交
    • L
      Linux-2.6.12-rc2 · 1da177e4
      Linus Torvalds 提交于
      Initial git repository build. I'm not bothering with the full history,
      even though we have it. We can create a separate "historical" git
      archive of that later if we want to, and in the meantime it's about
      3.2GB when imported into git - space that would just make the early
      git days unnecessarily complicated, when we don't have a lot of good
      infrastructure for it.
      
      Let it rip!
      1da177e4