1. 28 10月, 2014 1 次提交
  2. 13 2月, 2014 1 次提交
  3. 11 10月, 2013 1 次提交
  4. 30 4月, 2013 1 次提交
  5. 22 2月, 2013 3 次提交
  6. 14 12月, 2012 1 次提交
    • R
      __UNIQUE_ID() · 6f33d587
      Rusty Russell 提交于
      Jan Beulich points out __COUNTER__ (gcc 4.3 and above), so let's use
      that to create unique ids.  This is better than __LINE__ which we use
      today, so provide a wrapper.
      
      Stanislaw Gruszka <sgruszka@redhat.com> reported that some module parameters
      start with a digit, so we need to prepend when we for the unique id.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Acked-by: NJan Beulich <jbeulich@suse.com>
      6f33d587
  7. 06 12月, 2012 1 次提交
    • D
      byteorder: allow arch to opt to use GCC intrinsics for byteswapping · cf66bb93
      David Woodhouse 提交于
      Since GCC 4.4, there have been __builtin_bswap32() and __builtin_bswap16()
      intrinsics. A __builtin_bswap16() came a little later (4.6 for PowerPC,
      48 for other platforms).
      
      By using these instead of the inline assembler that most architectures
      have in their __arch_swabXX() macros, we let the compiler see what's
      actually happening. The resulting code should be at least as good, and
      much *better* in the cases where it can be combined with a nearby load
      or store, using a load-and-byteswap or store-and-byteswap instruction
      (e.g. lwbrx/stwbrx on PowerPC, movbe on Atom).
      
      When GCC is sufficiently recent *and* the architecture opts in to using
      the intrinsics by setting CONFIG_ARCH_USE_BUILTIN_BSWAP, they will be
      used in preference to the __arch_swabXX() macros. An architecture which
      does not set ARCH_USE_BUILTIN_BSWAP will continue to use its own
      hand-crafted macros.
      Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
      Acked-by: NH. Peter Anvin <hpa@linux.intel.com>
      cf66bb93
  8. 12 10月, 2012 1 次提交
  9. 18 9月, 2012 1 次提交
  10. 11 1月, 2012 1 次提交
    • D
      kernel.h: add BUILD_BUG() macro · 1399ff86
      David Daney 提交于
      We can place this in definitions that we expect the compiler to remove by
      dead code elimination.  If this assertion fails, we get a nice error
      message at build time.
      
      The GCC function attribute error("message") was added in version 4.3, so
      we define a new macro __linktime_error(message) to expand to this for
      GCC-4.3 and later.  This will give us an error diagnostic from the
      compiler on the line that fails.  For other compilers
      __linktime_error(message) expands to nothing, and we have to be content
      with a link time error, but at least we will still get a build error.
      
      BUILD_BUG() expands to the undefined function __build_bug_failed() and
      will fail at link time if the compiler ever emits code for it.  On GCC-4.3
      and later, attribute((error())) is used so that the failure will be noted
      at compile time instead.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Acked-by: NDavid Rientjes <rientjes@google.com>
      Cc: DM <dm.n9107@gmail.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Acked-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1399ff86
  11. 25 5月, 2011 1 次提交
  12. 23 3月, 2011 1 次提交
  13. 30 6月, 2010 1 次提交
  14. 06 12月, 2009 1 次提交
  15. 03 12月, 2009 1 次提交
  16. 03 10月, 2009 1 次提交
    • A
      x86: Add a Kconfig option to turn the copy_from_user warnings into errors · 63312b6a
      Arjan van de Ven 提交于
      For automated testing it is useful to have the option to turn
      the warnings on copy_from_user() etc checks into errors:
      
       In function ‘copy_from_user’,
           inlined from ‘fd_copyin’ at drivers/block/floppy.c:3080,
           inlined from ‘fd_ioctl’ at drivers/block/floppy.c:3503:
         linux/arch/x86/include/asm/uaccess_32.h:213:
        error: call to ‘copy_from_user_overflow’ declared with attribute error:
        copy_from_user buffer size is not provably correct
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      LKML-Reference: <20091002075050.4e9f7641@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      63312b6a
  17. 01 10月, 2009 1 次提交
    • A
      x86: Turn the copy_from_user check into an (optional) compile time warning · 4a312769
      Arjan van de Ven 提交于
      A previous patch added the buffer size check to copy_from_user().
      
      One of the things learned from analyzing the result of the previous
      patch is that in general, gcc is really good at proving that the
      code contains sufficient security checks to not need to do a
      runtime check. But that for those cases where gcc could not prove
      this, there was a relatively high percentage of real security
      issues.
      
      This patch turns the case of "gcc cannot prove" into a compile time
      warning, as long as a sufficiently new gcc is in use that supports
      this. The objective is that these warnings will trigger developers
      checking new cases out before a security hole enters a linux kernel
      release.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: James Morris <jmorris@namei.org>
      Cc: Jan Beulich <jbeulich@novell.com>
      LKML-Reference: <20090930130523.348ae6c4@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4a312769
  18. 26 9月, 2009 1 次提交
    • A
      x86: Use __builtin_object_size() to validate the buffer size for copy_from_user() · 9f0cf4ad
      Arjan van de Ven 提交于
      gcc (4.x) supports the __builtin_object_size() builtin, which
      reports the size of an object that a pointer point to, when known
      at compile time. If the buffer size is not known at compile time, a
      constant -1 is returned.
      
      This patch uses this feature to add a sanity check to
      copy_from_user(); if the target buffer is known to be smaller than
      the copy size, the copy is aborted and a WARNing is emitted in
      memory debug mode.
      
      These extra checks compile away when the object size is not known,
      or if both the buffer size and the copy length are constants.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      LKML-Reference: <20090926143301.2c396b94@infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      9f0cf4ad
  19. 27 3月, 2009 1 次提交
  20. 03 1月, 2009 2 次提交
    • L
      Disallow gcc versions 4.1.{0,1} · f9d14250
      Linus Torvalds 提交于
      These compiler versions are known to miscompile __weak functions and
      thus generate kernels that don't necessarily work correctly.  If a weak
      function is int he same compilation unit as a caller, gcc may end up
      inlining it, and thus binding the weak function too early.
      
      See
      
          http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27781
      
      for details.
      
      Cc: Adrian Bunk <bunk@kernel.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Ingo Molnar <mingo@elte.hu>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f9d14250
    • L
      Sanitize gcc version header includes · f153b821
      Linus Torvalds 提交于
       - include the gcc version-dependent header files from the generic gcc
         header file, rather than the other way around (iow: don't make the
         non-gcc header file have to know about gcc versions)
      
       - don't include compiler-gcc4.h for gcc 5 (for whenever it gets
         released).  That's just confusing and made us do odd things in the
         gcc4 header file (testing that we really had version 4!)
      
       - generate the name from the __GNUC__ version directly, rather than
         having a mess of #if conditionals.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f153b821
  21. 10 2月, 2008 1 次提交
  22. 29 1月, 2008 1 次提交
  23. 17 10月, 2007 1 次提交
  24. 22 7月, 2007 1 次提交
    • A
      x86: Support __attribute__((__cold__)) in gcc 4.3 · a586df06
      Andi Kleen 提交于
      gcc 4.3 supports a new __attribute__((__cold__)) to mark functions cold. Any
      path directly leading to a call of this function will be unlikely. And gcc
      will try to generate smaller code for the function itself.
      
      Please use with care. The code generation advantage isn't large and in most
      cases it is not worth uglifying code with this.
      
      This patch marks some common error functions like panic(), printk()
      as cold.  This will longer term make many unlikely()s unnecessary, although
      we can keep them for now for older compilers.
      
      BUG is not marked cold because there is currently no way to tell
      gcc to mark a inline function told.
      
      Also all __init and __exit functions are marked cold. With a non -Os
      build this will tell the compiler to generate slightly smaller code
      for them. I think it currently only uses less alignments for labels,
      but that might change in the future.
      
      One disadvantage over *likely() is that they cannot be easily instrumented
      to verify them.
      
      Another drawback is that only the latest gcc 4.3 snapshots support this.
      Unfortunately we cannot detect this using the preprocessor. This means older
      snapshots will fail now. I don't think that's a problem because they are
      unreleased compilers that nobody should be using.
      
      gcc also has a __hot__ attribute, but I don't see any sense in using
      this in the kernel right now. But someday I hope gcc will be able
      to use more aggressive optimizing for hot functions even in -Os,
      if that happens it should be added.
      
      Includes compile fix from Thomas Gleixner.
      
      Cc: Jan Hubicka <jh@suse.cz>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a586df06
  25. 10 5月, 2007 1 次提交
    • D
      compiler: introduce __used and __maybe_unused · 0d7ebbbc
      David Rientjes 提交于
      __used is defined to be __attribute__((unused)) for all pre-3.3 gcc
      compilers to suppress warnings for unused functions because perhaps they
      are referenced only in inline assembly.  It is defined to be
      __attribute__((used)) for gcc 3.3 and later so that the code is still
      emitted for such functions.
      
      __maybe_unused is defined to be __attribute__((unused)) for both function
      and variable use if it could possibly be unreferenced due to the evaluation
      of preprocessor macros.  Function prototypes shall be marked with
      __maybe_unused if the actual definition of the function is dependant on
      preprocessor macros.
      
      No update to compiler-intel.h is necessary because ICC supports both
      __attribute__((used)) and __attribute__((unused)) as specified by the gcc
      manual.
      
      __attribute_used__ is deprecated and will be removed once all current
      code is converted to using __used.
      
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Adrian Bunk <bunk@stusta.de>
      Signed-off-by: NDavid Rientjes <rientjes@google.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      0d7ebbbc
  26. 08 5月, 2007 1 次提交
  27. 15 1月, 2006 2 次提交
  28. 09 1月, 2006 1 次提交
  29. 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