1. 22 4月, 2016 1 次提交
    • S
      objtool: Fix Makefile to properly see if libelf is supported · c2bb9e32
      Steven Rostedt 提交于
      When doing a make allmodconfig, I hit the following compile error:
      
        In file included from builtin-check.c:32:0:
        elf.h:22:18: fatal error: gelf.h: No such file or directory
        compilation terminated.
        ...
      
      Digging into it, it appears that the $(shell ..) command in the Makefile does
      not give the proper result when it fails to find -lelf, and continues to
      compile objtool.
      
      Instead, use the "try-run" makefile macro to perform the test. This gives a
      proper result for both cases.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Acked-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
      Fixes: 442f04c3 ("objtool: Add tool to perform compile-time stack metadata validation")
      Link: http://lkml.kernel.org/r/20160420153234.GA24032@home.goodmis.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      c2bb9e32
  2. 11 4月, 2016 1 次提交
  3. 03 4月, 2016 1 次提交
  4. 27 3月, 2016 1 次提交
  5. 23 3月, 2016 1 次提交
    • D
      kernel: add kcov code coverage · 5c9a8750
      Dmitry Vyukov 提交于
      kcov provides code coverage collection for coverage-guided fuzzing
      (randomized testing).  Coverage-guided fuzzing is a testing technique
      that uses coverage feedback to determine new interesting inputs to a
      system.  A notable user-space example is AFL
      (http://lcamtuf.coredump.cx/afl/).  However, this technique is not
      widely used for kernel testing due to missing compiler and kernel
      support.
      
      kcov does not aim to collect as much coverage as possible.  It aims to
      collect more or less stable coverage that is function of syscall inputs.
      To achieve this goal it does not collect coverage in soft/hard
      interrupts and instrumentation of some inherently non-deterministic or
      non-interesting parts of kernel is disbled (e.g.  scheduler, locking).
      
      Currently there is a single coverage collection mode (tracing), but the
      API anticipates additional collection modes.  Initially I also
      implemented a second mode which exposes coverage in a fixed-size hash
      table of counters (what Quentin used in his original patch).  I've
      dropped the second mode for simplicity.
      
      This patch adds the necessary support on kernel side.  The complimentary
      compiler support was added in gcc revision 231296.
      
      We've used this support to build syzkaller system call fuzzer, which has
      found 90 kernel bugs in just 2 months:
      
        https://github.com/google/syzkaller/wiki/Found-Bugs
      
      We've also found 30+ bugs in our internal systems with syzkaller.
      Another (yet unexplored) direction where kcov coverage would greatly
      help is more traditional "blob mutation".  For example, mounting a
      random blob as a filesystem, or receiving a random blob over wire.
      
      Why not gcov.  Typical fuzzing loop looks as follows: (1) reset
      coverage, (2) execute a bit of code, (3) collect coverage, repeat.  A
      typical coverage can be just a dozen of basic blocks (e.g.  an invalid
      input).  In such context gcov becomes prohibitively expensive as
      reset/collect coverage steps depend on total number of basic
      blocks/edges in program (in case of kernel it is about 2M).  Cost of
      kcov depends only on number of executed basic blocks/edges.  On top of
      that, kernel requires per-thread coverage because there are always
      background threads and unrelated processes that also produce coverage.
      With inlined gcov instrumentation per-thread coverage is not possible.
      
      kcov exposes kernel PCs and control flow to user-space which is
      insecure.  But debugfs should not be mapped as user accessible.
      
      Based on a patch by Quentin Casasnovas.
      
      [akpm@linux-foundation.org: make task_struct.kcov_mode have type `enum kcov_mode']
      [akpm@linux-foundation.org: unbreak allmodconfig]
      [akpm@linux-foundation.org: follow x86 Makefile layout standards]
      Signed-off-by: NDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Cc: syzkaller <syzkaller@googlegroups.com>
      Cc: Vegard Nossum <vegard.nossum@oracle.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Tavis Ormandy <taviso@google.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
      Cc: Kostya Serebryany <kcc@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Kees Cook <keescook@google.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Cc: David Drysdale <drysdale@google.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5c9a8750
  6. 16 3月, 2016 1 次提交
    • D
      kbuild: Add option to turn incompatible pointer check into error · ea8daa7b
      Daniel Wagner 提交于
      With the introduction of the simple wait API we have two very
      similar APIs in the kernel. For example wake_up() and swake_up()
      is only one character away. Although the compiler will warn
      happily the wrong usage it keeps on going an even links the kernel.
      Thomas and Peter would rather like to see early missuses reported
      as error early on.
      
      In a first attempt we tried to wrap all swait and wait calls
      into a macro which has an compile time type assertion. The result
      was pretty ugly and wasn't able to catch all wrong usages.
      woken_wake_function(), autoremove_wake_function() and wake_bit_function()
      are assigned as function pointers. Wrapping them with a macro around is
      not possible. Prefixing them with '_' was also not a real option
      because there some users in the kernel which do use them as well.
      All in all this attempt looked to intrusive and too ugly.
      
      An alternative is to turn the pointer type check into an error which
      catches wrong type uses. Obviously not only the swait/wait ones. That
      isn't a bad thing either.
      Signed-off-by: NDaniel Wagner <daniel.wagner@bmw-carit.de>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Acked-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NMichal Marek <mmarek@suse.com>
      ea8daa7b
  7. 14 3月, 2016 1 次提交
  8. 07 3月, 2016 1 次提交
  9. 05 3月, 2016 2 次提交
    • I
      Revert "kbuild: Add option to turn incompatible pointer check into error" · ca031745
      Ingo Molnar 提交于
      This reverts commit ef50c046.
      
      So adding -Werror=incompatible-pointer-types wasn't a bad idea, but it
      should really not be done in the scheduler tree: it exposes us to a
      number of pre-existing warnings (most of them harmless), now upgraded
      to build failures...
      
      This should be done via the kbuild tree.
      
      Cc: Daniel Wagner <daniel.wagner@bmw-carit.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: linux-rt-users@vger.kernel.org
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: linux-kernel@vger.kernel.org
      ca031745
    • J
      objtool: Detect and warn if libelf is missing and don't break the build · 3b27a0c8
      Josh Poimboeuf 提交于
      With CONFIG_STACK_VALIDATION enabled, if the host system doesn't have
      a development version of libelf installed, the build fails with errors
      like:
      
        elf.h:22:18: fatal error: gelf.h: No such file or directory compilation terminated.
      
      Instead of failing to build, instead just print a warning and disable
      stack validation.
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-next@vger.kernel.org
      Cc: linux@roeck-us.net
      Cc: live-patching@vger.kernel.org
      Link: http://lkml.kernel.org/r/8c27fe00face60f42e888ddb3142c97e45223165.1457026550.git.jpoimboe@redhat.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      3b27a0c8
  10. 03 3月, 2016 1 次提交
  11. 29 2月, 2016 2 次提交
  12. 26 2月, 2016 1 次提交
  13. 25 2月, 2016 1 次提交
    • D
      kbuild: Add option to turn incompatible pointer check into error · ef50c046
      Daniel Wagner 提交于
      With the introduction of the simple wait API we have two very
      similar APIs in the kernel. For example wake_up() and swake_up()
      is only one character away. Although the compiler will warn
      happily the wrong usage it keeps on going an even links the kernel.
      Thomas and Peter would rather like to see early missuses reported
      as error early on.
      
      In a first attempt we tried to wrap all swait and wait calls
      into a macro which has an compile time type assertion. The result
      was pretty ugly and wasn't able to catch all wrong usages.
      woken_wake_function(), autoremove_wake_function() and wake_bit_function()
      are assigned as function pointers. Wrapping them with a macro around is
      not possible. Prefixing them with '_' was also not a real option
      because there some users in the kernel which do use them as well.
      All in all this attempt looked to intrusive and too ugly.
      
      An alternative is to turn the pointer type check into an error which
      catches wrong type uses. Obviously not only the swait/wait ones. That
      isn't a bad thing either.
      Signed-off-by: NDaniel Wagner <daniel.wagner@bmw-carit.de>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: linux-rt-users@vger.kernel.org
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1455871601-27484-3-git-send-email-wagi@monom.orgSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      ef50c046
  14. 21 2月, 2016 1 次提交
  15. 15 2月, 2016 1 次提交
  16. 08 2月, 2016 1 次提交
  17. 01 2月, 2016 1 次提交
  18. 25 1月, 2016 1 次提交
  19. 21 1月, 2016 1 次提交
  20. 11 1月, 2016 1 次提交
  21. 04 1月, 2016 1 次提交
  22. 29 12月, 2015 1 次提交
  23. 28 12月, 2015 1 次提交
  24. 21 12月, 2015 1 次提交
  25. 17 12月, 2015 1 次提交
  26. 14 12月, 2015 1 次提交
  27. 10 12月, 2015 1 次提交
  28. 07 12月, 2015 1 次提交
  29. 05 12月, 2015 1 次提交
  30. 30 11月, 2015 1 次提交
  31. 23 11月, 2015 1 次提交
  32. 16 11月, 2015 1 次提交
  33. 02 11月, 2015 1 次提交
  34. 25 10月, 2015 1 次提交
  35. 19 10月, 2015 1 次提交
  36. 12 10月, 2015 1 次提交
  37. 08 10月, 2015 1 次提交
  38. 04 10月, 2015 1 次提交