1. 07 11月, 2015 1 次提交
    • R
      test_printf: test printf family at runtime · 707cc728
      Rasmus Villemoes 提交于
      This adds a simple module for testing the kernel's printf facilities.
      Previously, some %p extensions have caused a wrong return value in case
      the entire output didn't fit and/or been unusable in kasprintf().  This
      should help catch such issues.  Also, it should help ensure that changes
      to the formatting algorithms don't break anything.
      
      I'm not sure if we have a struct dentry or struct file lying around at
      boot time or if we can fake one, but most %p extensions should be
      testable, as should the ordinary number and string formatting.
      
      The nature of vararg functions means we can't use a more conventional
      table-driven approach.
      
      For now, this is mostly a skeleton; contributions are very
      welcome. Some tests are/will be slightly annoying to write, since the
      expected output depends on stuff like CONFIG_*, sizeof(long), runtime
      values etc.
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Martin Kletzander <mkletzan@redhat.com>
      Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      707cc728
  2. 08 10月, 2015 1 次提交
  3. 27 8月, 2015 1 次提交
  4. 25 8月, 2015 1 次提交
    • R
      lib: scatterlist: add sg splitting function · f8bcbe62
      Robert Jarzmik 提交于
      Sometimes a scatter-gather has to be split into several chunks, or sub
      scatter lists. This happens for example if a scatter list will be
      handled by multiple DMA channels, each one filling a part of it.
      
      A concrete example comes with the media V4L2 API, where the scatter list
      is allocated from userspace to hold an image, regardless of the
      knowledge of how many DMAs will fill it :
       - in a simple RGB565 case, one DMA will pump data from the camera ISP
         to memory
       - in the trickier YUV422 case, 3 DMAs will pump data from the camera
         ISP pipes, one for pipe Y, one for pipe U and one for pipe V
      
      For these cases, it is necessary to split the original scatter list into
      multiple scatter lists, which is the purpose of this patch.
      
      The guarantees that are required for this patch are :
       - the intersection of spans of any couple of resulting scatter lists is
         empty.
       - the union of spans of all resulting scatter lists is a subrange of
         the span of the original scatter list.
       - streaming DMA API operations (mapping, unmapping) should not happen
         both on both the resulting and the original scatter list. It's either
         the first or the later ones.
       - the caller is reponsible to call kfree() on the resulting
         scatterlists.
      Signed-off-by: NRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      f8bcbe62
  5. 03 8月, 2015 2 次提交
  6. 17 7月, 2015 1 次提交
  7. 11 6月, 2015 1 次提交
    • R
      kbuild: include core debug info when DEBUG_INFO_REDUCED · 50ab9a69
      Rasmus Villemoes 提交于
      With CONFIG_DEBUG_INFO_REDUCED, we do get quite a lot of debug info
      (around 22.7 MB for a defconfig+DEBUG_INFO_REDUCED). However, the
      "basenames must match" rule used by -femit-struct-debug-baseonly
      option means that we miss some core data structures, such as struct
      {device, file, inode, mm_struct, page} etc.
      
      We can easily get these included as well, while still getting the
      benefits of CONFIG_DEBUG_INFO_REDUCED (faster build times and smaller
      individual object files): All it takes is a dummy translation unit
      including a few strategic headers and compiled with a flag overriding
      -femit-struct-debug-baseonly.
      
      This increases the size of .debug_info by ~0.3%, but these 90 KB
      contain some rather useful info.
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      50ab9a69
  8. 11 5月, 2015 1 次提交
    • D
      lib: add software 842 compression/decompression · 2da572c9
      Dan Streetman 提交于
      Add 842-format software compression and decompression functions.
      Update the MAINTAINERS 842 section to include the new files.
      
      The 842 compression function can compress any input data into the 842
      compression format.  The 842 decompression function can decompress any
      standard-format 842 compressed data - specifically, either a compressed
      data buffer created by the 842 software compression function, or a
      compressed data buffer created by the 842 hardware compressor (located
      in PowerPC coprocessors).
      
      The 842 compressed data format is explained in the header comments.
      
      This is used in a later patch to provide a full software 842 compression
      and decompression crypto interface.
      Signed-off-by: NDan Streetman <ddstreet@ieee.org>
      Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
      2da572c9
  9. 19 4月, 2015 2 次提交
  10. 17 4月, 2015 3 次提交
  11. 18 2月, 2015 1 次提交
  12. 14 2月, 2015 1 次提交
    • A
      lib: add kasan test module · 3f15801c
      Andrey Ryabinin 提交于
      This is a test module doing various nasty things like out of bounds
      accesses, use after free.  It is useful for testing kernel debugging
      features like kernel address sanitizer.
      
      It mostly concentrates on testing of slab allocator, but we might want to
      add more different stuff here in future (like stack/global variables out
      of bounds accesses and so on).
      Signed-off-by: NAndrey Ryabinin <a.ryabinin@samsung.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Konstantin Serebryany <kcc@google.com>
      Cc: Dmitry Chernenkov <dmitryc@google.com>
      Signed-off-by: NAndrey Konovalov <adech.fo@gmail.com>
      Cc: Yuri Gribov <tetra2005@gmail.com>
      Cc: Konstantin Khlebnikov <koct9i@gmail.com>
      Cc: Sasha Levin <sasha.levin@oracle.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3f15801c
  13. 13 2月, 2015 1 次提交
  14. 04 2月, 2015 1 次提交
  15. 31 1月, 2015 1 次提交
  16. 29 1月, 2015 1 次提交
  17. 11 12月, 2014 1 次提交
  18. 20 11月, 2014 1 次提交
    • S
      seq_buf: Move the seq_buf code to lib/ · 8d58e99a
      Steven Rostedt (Red Hat) 提交于
      The seq_buf functions are rather useful outside of tracing. Instead
      of having it be dependent on CONFIG_TRACING, move the code into lib/
      and allow other users to have access to it even when tracing is not
      configured.
      
      The seq_buf utility is similar to the seq_file utility, but instead of
      writing sending data back up to userland, it writes it into a buffer
      defined at seq_buf_init(). This allows us to send a descriptor around
      that writes printf() formatted strings into it that can be retrieved
      later.
      
      It is currently used by the tracing facility for such things like trace
      events to convert its binary saved data in the ring buffer into an
      ASCII human readable context to be displayed in /sys/kernel/debug/trace.
      
      It can also be used for doing NMI prints safely from NMI context into
      the seq_buf and retrieved later and dumped to printk() safely. Doing
      printk() from an NMI context is dangerous because an NMI can preempt
      a current printk() and deadlock on it.
      
      Link: http://lkml.kernel.org/p/20140619213952.058255809@goodmis.orgTested-by: NJiri Kosina <jkosina@suse.cz>
      Acked-by: NJiri Kosina <jkosina@suse.cz>
      Reviewed-by: NPetr Mladek <pmladek@suse.cz>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8d58e99a
  19. 17 11月, 2014 1 次提交
  20. 15 11月, 2014 1 次提交
    • J
      Revert "fast_hash: avoid indirect function calls" · a77f9c5d
      Jay Vosburgh 提交于
      This reverts commit e5a2c899.
      
      	Commit e5a2c899 introduced an alternative_call, arch_fast_hash2,
      that selects between __jhash2 and __intel_crc4_2_hash based on the
      X86_FEATURE_XMM4_2.
      
      	Unfortunately, the alternative_call system does not appear to be
      suitable for use with C functions, as register usage is not handled
      properly for the called functions.  The __jhash2 function in particular
      clobbers registers that are not preserved when called via
      alternative_call, resulting in a panic for direct callers of
      arch_fast_hash2 on older CPUs lacking sse4_2.  It is possible that
      __intel_crc4_2_hash works merely by chance because it uses fewer
      registers.
      
      	This commit was suggested as the source of the problem by Jesse
      Gross <jesse@nicira.com>.
      Signed-off-by: NJay Vosburgh <jay.vosburgh@canonical.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a77f9c5d
  21. 06 11月, 2014 1 次提交
  22. 14 10月, 2014 2 次提交
    • V
      lib: rename TEST_MODULE to TEST_LKM · 8a6f0b47
      Valentin Rothberg 提交于
      The "_MODULE" suffix is reserved for tristates compiled as loadable kernel
      modules (LKM).  The "TEST_MODULE" feature thereby violates this
      convention.  The feature is used to compile the lib/test_module.c kernel
      module.
      
      Sadly this convention is not made explicit, but the Kconfig code documents
      it.  The following code (./scripts/kconfig/confdata.c) is used to generate
      the autoconf.h header file during the build process.  When a feature is
      selected as a kernel module ('m'), it is suffixed with "_MODULE" to
      indicate it.
      
      	switch (*value) {
      	case 'n':
      		break;
      	case 'm':
      		suffix = "_MODULE";
      		/* fall through */
      
      This causes problems for static code analysis, which assumes a consistent
      use of the "_MODULE" suffix.
      
      This patch renames the feature and its reference in a Makefile to
      "TEST_LKM", which still expresses the test of a LKM.
      Signed-off-by: NValentin Rothberg <valentinrothberg@gmail.com>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      8a6f0b47
    • L
      lib: remove prio_heap · 6de8ab68
      Lai Jiangshan 提交于
      The prio_heap code is unused since commit 889ed9ce ("cgroup: remove
      css_scan_tasks()").  It should be compiled out to shrink the binary
      kernel size which can be done via introducing CONFIG_PRIO_HEAD or by
      removing the code.
      
      We can simply recover the code from git when needed, so it would be
      better to remove it IMO.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Ingo Molnar <mingo@kernel.org>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Francesco Fusco <ffusco@redhat.com>
      Cc: Greg Thelen <gthelen@google.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: George Spelvin <linux@horizon.com>
      Cc: Mark Salter <msalter@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6de8ab68
  23. 07 8月, 2014 1 次提交
  24. 03 8月, 2014 1 次提交
  25. 18 7月, 2014 1 次提交
  26. 12 5月, 2014 1 次提交
  27. 05 5月, 2014 1 次提交
    • C
      lib: Export interval_tree · a88cc108
      Chris Wilson 提交于
      lib/interval_tree.c provides a simple interface for an interval-tree
      (an augmented red-black tree) but is only built when testing the generic
      macros for building interval-trees. For drivers with modest needs,
      export the simple interval-tree library as is.
      
      v2: Lots of help from Michel Lespinasse to only compile the code
          as required:
          - make INTERVAL_TREE a config option
          - make INTERVAL_TREE_TEST select the library functions
            and sanitize the filenames & Makefile
          - prepare interval_tree for being built as a module if required
      Signed-off-by: NChris Wilson <chris@chris-wilson.co.uk>
      Cc: Michel Lespinasse <walken@google.com>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Reviewed-by: NMichel Lespinasse <walken@google.com>
      [Acked for inclusion via drm/i915 by Andrew Morton.]
      [danvet: switch to _GPL as per the mailing list discussion.]
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      a88cc108
  28. 01 5月, 2014 1 次提交
  29. 20 3月, 2014 1 次提交
  30. 06 2月, 2014 1 次提交
  31. 24 1月, 2014 2 次提交
    • K
      test: check copy_to/from_user boundary validation · 3e2a4c18
      Kees Cook 提交于
      To help avoid an architecture failing to correctly check kernel/user
      boundaries when handling copy_to_user, copy_from_user, put_user, or
      get_user, perform some simple tests and fail to load if any of them
      behave unexpectedly.
      
      Specifically, this is to make sure there is a way to notice if things
      like what was fixed in commit 8404663f ("ARM: 7527/1: uaccess:
      explicitly check __user pointer when !CPU_USE_DOMAINS") ever regresses
      again, for any architecture.
      
      Additionally, adds new "user" selftest target, which loads this module.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3e2a4c18
    • K
      test: add minimal module for verification testing · 93e9ef83
      Kees Cook 提交于
      This is a pair of test modules I'd like to see in the tree.  Instead of
      putting these in lkdtm, where I've been adding various tests that trigger
      crashes, these don't make sense there since they need to be either
      distinctly separate, or their pass/fail state don't need to crash the
      machine.
      
      These live in lib/ for now, along with a few other in-kernel test modules,
      and use the slightly more common "test_" naming convention, instead of
      "test-".  We should likely standardize on the former:
      
      $ find . -name 'test_*.c' | grep -v /tools/ | wc -l
      4
      $ find . -name 'test-*.c' | grep -v /tools/ | wc -l
      2
      
      The first is entirely a no-op module, designed to allow simple testing of
      the module loading and verification interface.  It's useful to have a
      module that has no other uses or dependencies so it can be reliably used
      for just testing module loading and verification.
      
      The second is a module that exercises the user memory access functions, in
      an effort to make sure that we can quickly catch any regressions in
      boundary checking (e.g.  like what was recently fixed on ARM).
      
      This patch (of 2):
      
      When doing module loading verification tests (for example, with module
      signing, or LSM hooks), it is very handy to have a module that can be
      built on all systems under test, isn't auto-loaded at boot, and has no
      device or similar dependencies.  This creates the "test_module.ko" module
      for that purpose, which only reports its load and unload to printk.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: NRusty Russell <rusty@rustcorp.com.au>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      93e9ef83
  32. 18 12月, 2013 1 次提交
    • F
      lib: introduce arch optimized hash library · 71ae8aac
      Francesco Fusco 提交于
      We introduce a new hashing library that is meant to be used in
      the contexts where speed is more important than uniformity of the
      hashed values. The hash library leverages architecture specific
      implementation to achieve high performance and fall backs to
      jhash() for the generic case.
      
      On Intel-based x86 architectures, the library can exploit the crc32l
      instruction, part of the Intel SSE4.2 instruction set, if the
      instruction is supported by the processor. This implementation
      is twice as fast as the jhash() implementation on an i7 processor.
      
      Additional architectures, such as Arm64 provide instructions for
      accelerating the computation of CRC, so they could be added as well
      in follow-up work.
      Signed-off-by: NFrancesco Fusco <ffusco@redhat.com>
      Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
      Signed-off-by: NThomas Graf <tgraf@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      71ae8aac
  33. 20 11月, 2013 1 次提交
  34. 13 11月, 2013 1 次提交