1. 20 12月, 2013 1 次提交
    • K
      stackprotector: Introduce CONFIG_CC_STACKPROTECTOR_STRONG · 8779657d
      Kees Cook 提交于
      This changes the stack protector config option into a choice of
      "None", "Regular", and "Strong":
      
         CONFIG_CC_STACKPROTECTOR_NONE
         CONFIG_CC_STACKPROTECTOR_REGULAR
         CONFIG_CC_STACKPROTECTOR_STRONG
      
      "Regular" means the old CONFIG_CC_STACKPROTECTOR=y option.
      
      "Strong" is a new mode introduced by this patch. With "Strong" the
      kernel is built with -fstack-protector-strong (available in
      gcc 4.9 and later). This option increases the coverage of the stack
      protector without the heavy performance hit of -fstack-protector-all.
      
      For reference, the stack protector options available in gcc are:
      
      -fstack-protector-all:
        Adds the stack-canary saving prefix and stack-canary checking
        suffix to _all_ function entry and exit. Results in substantial
        use of stack space for saving the canary for deep stack users
        (e.g. historically xfs), and measurable (though shockingly still
        low) performance hit due to all the saving/checking. Really not
        suitable for sane systems, and was entirely removed as an option
        from the kernel many years ago.
      
      -fstack-protector:
        Adds the canary save/check to functions that define an 8
        (--param=ssp-buffer-size=N, N=8 by default) or more byte local
        char array. Traditionally, stack overflows happened with
        string-based manipulations, so this was a way to find those
        functions. Very few total functions actually get the canary; no
        measurable performance or size overhead.
      
      -fstack-protector-strong
        Adds the canary for a wider set of functions, since it's not
        just those with strings that have ultimately been vulnerable to
        stack-busting. With this superset, more functions end up with a
        canary, but it still remains small compared to all functions
        with only a small change in performance. Based on the original
        design document, a function gets the canary when it contains any
        of:
      
          - local variable's address used as part of the right hand side
            of an assignment or function argument
          - local variable is an array (or union containing an array),
            regardless of array type or length
          - uses register local variables
      
        https://docs.google.com/a/google.com/document/d/1xXBH6rRZue4f296vGt9YQcuLVQHeE516stHwt8M9xyU
      
      Find below a comparison of "size" and "objdump" output when built with
      gcc-4.9 in three configurations:
      
        - defconfig
      	11430641 kernel text size
      	36110 function bodies
      
        - defconfig + CONFIG_CC_STACKPROTECTOR_REGULAR
      	11468490 kernel text size (+0.33%)
      	1015 of 36110 functions are stack-protected (2.81%)
      
        - defconfig + CONFIG_CC_STACKPROTECTOR_STRONG via this patch
      	11692790 kernel text size (+2.24%)
      	7401 of 36110 functions are stack-protected (20.5%)
      
      With -strong, ARM's compressed boot code now triggers stack
      protection, so a static guard was added. Since this is only used
      during decompression and was never used before, the exposure
      here is very small. Once it switches to the full kernel, the
      stack guard is back to normal.
      
      Chrome OS has been using -fstack-protector-strong for its kernel
      builds for the last 8 months with no problems.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Shawn Guo <shawn.guo@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mips@linux-mips.org
      Cc: linux-arch@vger.kernel.org
      Link: http://lkml.kernel.org/r/1387481759-14535-3-git-send-email-keescook@chromium.org
      [ Improved the changelog and descriptions some more. ]
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      8779657d
  2. 16 3月, 2013 1 次提交
    • S
      ARM: 7671/1: use Kconfig to select uncompress.h · 615967b0
      Shawn Guo 提交于
      Following the approach handling DEBUG_LL inclusion, the patch creates
      a Kconfig symbol CONFIG_UNCOMPRESS_INCLUDE for choosing the correct
      uncompress header.  For traditional build, mach/uncompress.h will be
      included in arch/arm/boot/compressed/misc.c.  For multiplatform build,
      debug/uncompress.h which contains a suite of empty functions will be
      used.  In this way, a platform with particular uncompress.h
      implementation could choose its own uncompress.h with this Kconfig
      option.
      Signed-off-by: NShawn Guo <shawn.guo@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      615967b0
  3. 14 9月, 2012 1 次提交
    • R
      ARM: initial multiplatform support · 387798b3
      Rob Herring 提交于
      This lets us build a multiplatform kernel for experimental purposes.
      However, it will not be useful for any real work, because it relies
      on a number of useful things to be disabled for now:
      
      * SMP support must be turned off because of conflicting symbols.
        Marc Zyngier has proposed a solution by adding a new SOC
        operations structure to hold indirect function pointers
        for these, but that work is currently stalled
      
      * We turn on SPARSE_IRQ unconditionally, which is not supported
        on most platforms. Each of them is currently in a different
        state, but most are being worked on.
      
      * A common clock framework is in place since v3.4 but not yet
        being used. Work on this is on its way.
      
      * DEBUG_LL for early debugging is currently disabled.
      
      * THUMB2_KERNEL does not work with allyesconfig because the
        kernel gets too big
      
      [Rob Herring]: Rebased to not be dependent on the mass mach header rename.
      As a result, omap2plus, imx, mxs and ux500 are not converted. Highbank,
      picoxcell, mvebu, and socfpga are converted.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NRob Herring <rob.herring@calxeda.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Acked-by: NJamie Iles <jamie@jamieiles.com>
      Cc: Dinh Nguyen <dinguyen@altera.com>
      387798b3
  4. 15 9月, 2011 1 次提交
  5. 07 5月, 2011 2 次提交
  6. 29 3月, 2011 1 次提交
    • S
      ARM: 6826/1: Merge v6 and v7 DEBUG_LL DCC support · dfad549d
      Stephen Boyd 提交于
      The inline assembly differences for v6 vs. v7 are purely
      optimizations. On a v7 processor, an mrc with the pc sets the
      condition codes to the 28-31 bits of the register being read. It
      just so happens that the TX/RX full bits the DCC support code is
      testing for are high enough in the register to be put into the
      condition codes. On a v6 processor, this "feature" isn't
      implemented and thus we have to do the usual read, mask, test
      operations to check for TX/RX full. Thus, we can drop the v7
      implementation and just use the v6 implementation for both.
      
      Cc: Tony Lindgren <tony@atomide.com>
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      dfad549d
  7. 03 2月, 2011 1 次提交
  8. 07 7月, 2010 1 次提交
  9. 13 3月, 2010 1 次提交
    • M
      ARM: 5985/2: ARM: Fix Samsung build after "ARM: Eliminate decompressor -Dstatic= PIC hack" · a2302b45
      Mark Brown 提交于
      Commit 5de813b6 (ARM: Eliminate decompressor -Dstatic= PIC hack) among
      other things changed the declared type of the error() function to an
      extern, conflicting with the forward declartion in the Samsung
      plat/uncompress.h which appears to have been relying on the static
      being defined away, causing build failures since error() ends up with
      a GOT relocation but the linker script discards all GOT relocated
      data and functions:
      
      arch/arm/boot/compressed/decompress.o: In function `gunzip':
      /home/broonie/git/linux-2.6/arch/arm/boot/compressed/../../../../lib/decompress_
      +inflate.c:68: undefined reference to `error'
      
      and so on. Fix this by moving the declaration into uncompress/misc.c
      where it is shared with the rest of the code, correcting the definition
      as we go.
      Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      a2302b45
  10. 26 2月, 2010 1 次提交
    • R
      ARM: Eliminate decompressor -Dstatic= PIC hack · 5de813b6
      Russell King 提交于
      We used to build decompressors with -Dstatic= to avoid any local data
      being generated.  The problem is that local data generates GOTOFF
      relocations, which means we can't relocate the data relative to the
      text segment.
      
      Global data, on the other hand, goes through the GOT, and can be
      relocated anywhere.
      
      Unfortunately, with the new decompressors, this presents a problem
      since they declare static data within functions, and this leads to
      stack overflow.
      
      Fix this by separating out the decompressor code into a separate file,
      and removing 'static' from BSS data in misc.c.
      
      Also, discard the .data section - this means that should we end up
      with read/write initialized data, the decompressor will fail to link
      and the problem will be obvious.
      Acked-by: NNicolas Pitre <nico@fluxnic.net>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      5de813b6
  11. 20 1月, 2010 1 次提交
  12. 18 1月, 2010 1 次提交
    • T
      ARM: 5882/1: ARM: Fix uncompress code compile for different defines of flush(void) · b53e9b5e
      Tony Lindgren 提交于
      Because of the include of the decompress_inflate.c file from
      boot/compress/misc.c, there are different flush() defines:
      
      In file included from arch/arm/boot/compressed/misc.c:249:
      arch/arm/boot/compressed/../../../../lib/decompress_inflate.c:138:29: error: macro "flush" passed 2 arguments, but takes just 0
      
      Fix this by removing the define of flush() in misc.c for
      CONFIG_DEBUG_ICEDCC as it's already defined in mach/uncompress.h,
      and that is being included unconditionally.
      
      Also use a static inline function instead of define
      for mach-mxc and mach-gemini to avoid similar bug
      for those platforms.
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      b53e9b5e
  13. 12 1月, 2010 1 次提交
  14. 26 7月, 2009 1 次提交
  15. 31 3月, 2009 1 次提交
    • R
      arm: allow usage of string functions in linux/string.h · aa0d3bb7
      Rusty Russell 提交于
      In introducing a trivial "strstarts()" function in linux/string.h, we
      hit:
      
      	arch/arm/boot/compressed/misc.o: In function `strstarts':
      	misc.c:(.text+0x368): undefined reference to `strlen'
      	misc.c:(.text+0x378): undefined reference to `strncmp'
      
      This is because of "CFLAGS_misc.o := -Dstatic=" in the Makefile.
      "static inline strstarts(...)" becomes non-inline, and refers to the
      other string ops.
      
      The simplest workaround is to include asm/string.h.  This makes sense
      anyway, since lib/string.c won't be linked against this so we can't
      use those functions anyway.
      
      Compile tested here.
      Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
      Acked-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      aa0d3bb7
  16. 28 2月, 2009 1 次提交
  17. 27 11月, 2008 1 次提交
    • R
      [ARM] remove memzero() · 59f0cb0f
      Russell King 提交于
      As suggested by Andrew Morton, remove memzero() - it's not supported
      on other architectures so use of it is a potential build breaking bug.
      Since the compiler optimizes memset(x,0,n) to __memzero() perfectly
      well, we don't miss out on the underlying benefits of memzero().
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      59f0cb0f
  18. 07 8月, 2008 1 次提交
  19. 26 7月, 2008 1 次提交
    • T
      inflate: refactor inflate malloc code · 2d6ffcca
      Thomas Petazzoni 提交于
      Inflate requires some dynamic memory allocation very early in the boot
      process and this is provided with a set of four functions:
      malloc/free/gzip_mark/gzip_release.
      
      The old inflate code used a mark/release strategy rather than implement
      free.  This new version instead keeps a count on the number of outstanding
      allocations and when it hits zero, it resets the malloc arena.
      
      This allows removing all the mark and release implementations and unifying
      all the malloc/free implementations.
      
      The architecture-dependent code must define two addresses:
       - free_mem_ptr, the address of the beginning of the area in which
         allocations should be made
       - free_mem_end_ptr, the address of the end of the area in which
         allocations should be made. If set to 0, then no check is made on
         the number of allocations, it just grows as much as needed
      
      The architecture-dependent code can also provide an arch_decomp_wdog()
      function call.  This function will be called several times during the
      decompression process, and allow to notify the watchdog that the system is
      still running.  If an architecture provides such a call, then it must
      define ARCH_HAS_DECOMP_WDOG so that the generic inflate code calls
      arch_decomp_wdog().
      
      Work initially done by Matt Mackall, updated to a recent version of the
      kernel and improved by me.
      
      [akpm@linux-foundation.org: coding-style fixes]
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Cc: Matt Mackall <mpm@selenic.com>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Mikael Starvik <mikael.starvik@axis.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: Haavard Skinnemoen <hskinnemoen@atmel.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Acked-by: NPaul Mundt <lethal@linux-sh.org>
      Acked-by: NYoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2d6ffcca
  20. 03 5月, 2007 1 次提交
    • J
      [PATCH] x86: deflate stack usage in lib/inflate.c · 35c74226
      Jeremy Fitzhardinge 提交于
      inflate_fixed and huft_build together use around 2.7k of stack.  When
      using 4k stacks, I saw stack overflows from interrupts arriving while
      unpacking the root initrd:
      
      do_IRQ: stack overflow: 384
       [<c0106b64>] show_trace_log_lvl+0x1a/0x30
       [<c01075e6>] show_trace+0x12/0x14
       [<c010763f>] dump_stack+0x16/0x18
       [<c0107ca4>] do_IRQ+0x6d/0xd9
       [<c010202b>] xen_evtchn_do_upcall+0x6e/0xa2
       [<c0106781>] xen_hypervisor_callback+0x25/0x2c
       [<c010116c>] xen_restore_fl+0x27/0x29
       [<c0330f63>] _spin_unlock_irqrestore+0x4a/0x50
       [<c0117aab>] change_page_attr+0x577/0x584
       [<c0117b45>] kernel_map_pages+0x8d/0xb4
       [<c016a314>] cache_alloc_refill+0x53f/0x632
       [<c016a6c2>] __kmalloc+0xc1/0x10d
       [<c0463d34>] malloc+0x10/0x12
       [<c04641c1>] huft_build+0x2a7/0x5fa
       [<c04645a5>] inflate_fixed+0x91/0x136
       [<c04657e2>] unpack_to_rootfs+0x5f2/0x8c1
       [<c0465acf>] populate_rootfs+0x1e/0xe4
      
      (This was under Xen, but there's no reason it couldn't happen on bare
        hardware.)
      
      This patch mallocs the local variables, thereby reducing the stack
      usage to sane levels.
      
      Also, up the heap size for the kernel decompressor to deal with the
      extra allocation.
      Signed-off-by: NJeremy Fitzhardinge <jeremy@xensource.com>
      Signed-off-by: NAndi Kleen <ak@suse.de>
      Cc: Tim Yamin <plasmaroo@gentoo.org>
      Cc: Andi Kleen <ak@suse.de>
      Cc: Matt Mackall <mpm@selenic.com>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Ian Molton <spyro@f2s.com>
      35c74226
  21. 25 9月, 2006 1 次提交
  22. 03 5月, 2006 1 次提交
  23. 28 3月, 2006 2 次提交
  24. 09 11月, 2005 1 次提交
  25. 30 10月, 2005 1 次提交
  26. 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