1. 11 5月, 2017 1 次提交
  2. 28 2月, 2017 1 次提交
  3. 11 2月, 2016 1 次提交
    • C
      ARM: 8518/1: Use correct symbols for XIP_KERNEL · 02afa9a8
      Chris Brandt 提交于
      For an XIP build, _etext does not represent the end of the
      binary image that needs to stay mapped into the MODULES_VADDR area.
      Years ago, data came before text in the memory map. However,
      now that the order is text/init/data, an XIP_KERNEL needs to map
      up to the data location in order to keep from cutting off
      parts of the kernel that are needed.
      We only map up to the beginning of data because data has already been
      copied, so there's no reason to keep it around anymore.
      A new symbol is created to make it clear what it is we are referring
      to.
      
      This fixes the bug where you might lose the end of your kernel area
      after page table setup is complete.
      Signed-off-by: NChris Brandt <chris.brandt@renesas.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      02afa9a8
  4. 08 5月, 2015 1 次提交
    • A
      ARM: 8220/1: allow modules outside of bl range · 7d485f64
      Ard Biesheuvel 提交于
      Loading modules far away from the kernel in memory is problematic
      because the 'bl' instruction only has limited reach, and modules are not
      built with PLTs. Instead of using the -mlong-calls option (which affects
      all compiler emitted bl instructions, but not the ones in assembler),
      this patch allocates some additional space at module load time, and
      populates it with PLT like veneers when encountering relocations that
      are out of range.
      
      This should work with all relocations against symbols exported by the
      kernel, including those resulting from GCC generated implicit function
      calls for ftrace etc.
      
      The module memory size increases by about 5% on average, regardless of
      whether any PLT entries were actually needed. However, due to the page
      based rounding that occurs when allocating module memory, the average
      memory footprint increase is negligible.
      Reviewed-by: NNicolas Pitre <nico@linaro.org>
      Signed-off-by: NArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      7d485f64
  5. 23 2月, 2015 1 次提交
  6. 14 2月, 2015 1 次提交
    • A
      mm: vmalloc: pass additional vm_flags to __vmalloc_node_range() · cb9e3c29
      Andrey Ryabinin 提交于
      For instrumenting global variables KASan will shadow memory backing memory
      for modules.  So on module loading we will need to allocate memory for
      shadow and map it at address in shadow that corresponds to the address
      allocated in module_alloc().
      
      __vmalloc_node_range() could be used for this purpose, except it puts a
      guard hole after allocated area.  Guard hole in shadow memory should be a
      problem because at some future point we might need to have a shadow memory
      at address occupied by guard hole.  So we could fail to allocate shadow
      for module_alloc().
      
      Now we have VM_NO_GUARD flag disabling guard page, so we need to pass into
      __vmalloc_node_range().  Add new parameter 'vm_flags' to
      __vmalloc_node_range() function.
      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>
      cb9e3c29
  7. 21 11月, 2014 1 次提交
  8. 27 8月, 2014 1 次提交
    • A
      ARM: 8127/1: module: add support for R_ARM_TARGET1 relocations · 55f0fb6a
      Andrey Ryabinin 提交于
      Kernel module build with GCOV profiling fails to load with the
      following error:
      
       $ insmod test_module.ko
         test_module: unknown relocation: 38
         insmod: can't insert 'test_module.ko': invalid module format
      
      This happens because constructor pointers in the .init_array section
      have not supported R_ARM_TARGET1 relocation type.
      
      Documentation (ELF for the ARM Architecture) says:
          "The relocation must be processed either in the same way as R_ARM_REL32 or
           as R_ARM_ABS32: a virtual platform must specify which method is used."
      
      Since kernel expects to see absolute addresses in .init_array R_ARM_TARGET1
      relocation type should be treated the same way as R_ARM_ABS32.
      Signed-off-by: NAndrey Ryabinin <a.ryabinin@samsung.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      55f0fb6a
  9. 13 11月, 2013 1 次提交
  10. 20 10月, 2013 1 次提交
  11. 02 9月, 2013 1 次提交
  12. 04 6月, 2013 1 次提交
  13. 23 8月, 2011 1 次提交
  14. 04 8月, 2011 1 次提交
  15. 24 7月, 2011 1 次提交
  16. 17 6月, 2011 1 次提交
    • D
      ARM: 6963/1: Thumb-2: Relax relocation requirements for non-function symbols · 9a00318e
      Dave Martin 提交于
      The "Thumb bit" of a symbol is only really meaningful for function
      symbols (STT_FUNC).
      
      However, sometimes a branch is relocated against a non-function
      symbol; for example, PC-relative branches to anonymous assembler
      local symbols are typically fixed up against the start-of-section
      symbol, which is not a function symbol.  Some inline assembler
      generates references of this type, such as fixup code generated by
      macros in <asm/uaccess.h>.
      
      The existing relocation code for R_ARM_THM_CALL/R_ARM_THM_JUMP24
      interprets this case as an error, because the target symbol appears
      to be an ARM symbol; but this is really not the case, since the
      target symbol is just a base in these cases.  The addend defines
      the precise offset to the target location, but since the addend is
      encoded in a non-interworking Thumb branch instruction, there is no
      explicit Thumb bit in the addend.  Because these instructions never
      interwork, the implied Thumb bit in the addend is 1, and the
      destination is Thumb by definition.
      
      This patch removes the extraneous Thumb bit check for non-function
      symbols, enabling modules containing the affected relocation types
      to be loaded.  No modification to the actual relocation code is
      required, since this code does not take bit[0] of the
      location->destination offset into account in any case.
      
      Function symbols are always checked for interworking conflicts, as
      before.
      Signed-off-by: NDave Martin <dave.martin@linaro.org>
      Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      9a00318e
  17. 24 2月, 2011 1 次提交
    • R
      ARM: improve module relocation fixup diagnostics · 68e6fad4
      Russell King 提交于
      Current diagnostics are rather poor when things go wrong:
        ipv6: relocation out of range, section 2 reloc 0 sym 'snmp_mib_free'
      
      Let's include a little more information about the problem:
        ipv6: section 2 reloc 0 sym 'snmp_mib_free': relocation 28 out of range (0xbf0000a4 -> 0xc11b4858)
      
      so that we show exactly what the problem is - not only what type of
      relocation but also the offending address range too.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      68e6fad4
  18. 18 2月, 2011 1 次提交
    • R
      ARM: P2V: introduce phys_to_virt/virt_to_phys runtime patching · dc21af99
      Russell King 提交于
      This idea came from Nicolas, Eric Miao produced an initial version,
      which was then rewritten into this.
      
      Patch the physical to virtual translations at runtime.  As we modify
      the code, this makes it incompatible with XIP kernels, but allows us
      to achieve this with minimal loss of performance.
      
      As many translations are of the form:
      
      	physical = virtual + (PHYS_OFFSET - PAGE_OFFSET)
      	virtual = physical - (PHYS_OFFSET - PAGE_OFFSET)
      
      we generate an 'add' instruction for __virt_to_phys(), and a 'sub'
      instruction for __phys_to_virt().  We calculate at run time (PHYS_OFFSET
      - PAGE_OFFSET) by comparing the address prior to MMU initialization with
      where it should be once the MMU has been initialized, and place this
      constant into the above add/sub instructions.
      
      Once we have (PHYS_OFFSET - PAGE_OFFSET), we can calculate the real
      PHYS_OFFSET as PAGE_OFFSET is a build-time constant, and save this for
      the C-mode PHYS_OFFSET variable definition to use.
      
      At present, we are unable to support Realview with Sparsemem enabled
      as this uses a complex mapping function, and MSM as this requires a
      constant which will not fit in our math instruction.
      
      Add a module version magic string for this feature to prevent
      incompatible modules being loaded.
      Tested-by: NTony Lindgren <tony@atomide.com>
      Reviewed-by: NNicolas Pitre <nicolas.pitre@linaro.org>
      Tested-by: NNicolas Pitre <nicolas.pitre@linaro.org>
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      dc21af99
  19. 10 2月, 2011 1 次提交
  20. 14 1月, 2011 1 次提交
    • D
      mm: unify module_alloc code for vmalloc · d0a21265
      David Rientjes 提交于
      Four architectures (arm, mips, sparc, x86) use __vmalloc_area() for
      module_init().  Much of the code is duplicated and can be generalized in a
      globally accessible function, __vmalloc_node_range().
      
      __vmalloc_node() now calls into __vmalloc_node_range() with a range of
      [VMALLOC_START, VMALLOC_END) for functionally equivalent behavior.
      
      Each architecture may then use __vmalloc_node_range() directly to remove
      the duplication of code.
      Signed-off-by: NDavid Rientjes <rientjes@google.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      d0a21265
  21. 01 12月, 2010 2 次提交
  22. 02 9月, 2010 3 次提交
  23. 05 8月, 2010 3 次提交
  24. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  25. 24 7月, 2009 1 次提交
    • C
      Thumb-2: Add support for loadable modules · adca6dc2
      Catalin Marinas 提交于
      Modules compiled to Thumb-2 have two additional relocations needing to
      be resolved at load time, R_ARM_THM_CALL and R_ARM_THM_JUMP24, for BL
      and B.W instructions. The maximum Thumb-2 addressing range is +/-2^24
      (+/-16MB) therefore the MODULES_VADDR macro in asm/memory.h is set to
      (MODULES_END - 8MB) for the Thumb-2 compiled kernel.
      Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
      adca6dc2
  26. 08 5月, 2009 1 次提交
  27. 21 3月, 2009 1 次提交
  28. 19 2月, 2009 1 次提交
  29. 01 12月, 2008 1 次提交
  30. 07 11月, 2008 1 次提交
    • R
      [ARM] fix naming of MODULE_START / MODULE_END · ab4f2ee1
      Russell King 提交于
      As of 73bdf0a6, the kernel needs
      to know where modules are located in the virtual address space.
      On ARM, we located this region between MODULE_START and MODULE_END.
      Unfortunately, everyone else calls it MODULES_VADDR and MODULES_END.
      Update ARM to use the same naming, so is_vmalloc_or_module_addr()
      can work properly.  Also update the comment on mm/vmalloc.c to
      reflect that ARM also places modules in a separate region from the
      vmalloc space.
      Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
      ab4f2ee1
  31. 01 10月, 2008 1 次提交
  32. 25 7月, 2008 1 次提交
    • A
      PAGE_ALIGN(): correctly handle 64-bit values on 32-bit architectures · 27ac792c
      Andrea Righi 提交于
      On 32-bit architectures PAGE_ALIGN() truncates 64-bit values to the 32-bit
      boundary. For example:
      
      	u64 val = PAGE_ALIGN(size);
      
      always returns a value < 4GB even if size is greater than 4GB.
      
      The problem resides in PAGE_MASK definition (from include/asm-x86/page.h for
      example):
      
      #define PAGE_SHIFT      12
      #define PAGE_SIZE       (_AC(1,UL) << PAGE_SHIFT)
      #define PAGE_MASK       (~(PAGE_SIZE-1))
      ...
      #define PAGE_ALIGN(addr)       (((addr)+PAGE_SIZE-1)&PAGE_MASK)
      
      The "~" is performed on a 32-bit value, so everything in "and" with
      PAGE_MASK greater than 4GB will be truncated to the 32-bit boundary.
      Using the ALIGN() macro seems to be the right way, because it uses
      typeof(addr) for the mask.
      
      Also move the PAGE_ALIGN() definitions out of include/asm-*/page.h in
      include/linux/mm.h.
      
      See also lkml discussion: http://lkml.org/lkml/2008/6/11/237
      
      [akpm@linux-foundation.org: fix drivers/media/video/uvc/uvc_queue.c]
      [akpm@linux-foundation.org: fix v850]
      [akpm@linux-foundation.org: fix powerpc]
      [akpm@linux-foundation.org: fix arm]
      [akpm@linux-foundation.org: fix mips]
      [akpm@linux-foundation.org: fix drivers/media/video/pvrusb2/pvrusb2-dvb.c]
      [akpm@linux-foundation.org: fix drivers/mtd/maps/uclinux.c]
      [akpm@linux-foundation.org: fix powerpc]
      Signed-off-by: NAndrea Righi <righi.andrea@gmail.com>
      Cc: <linux-arch@vger.kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      27ac792c
  33. 09 5月, 2007 1 次提交
  34. 28 9月, 2006 1 次提交
  35. 01 7月, 2006 1 次提交