1. 28 12月, 2010 1 次提交
    • O
      modpost: Fix address calculation in reloc_location() · 731ece41
      Olof Johansson 提交于
      This patch fixes a segfault in modpost that is observed when the gold
      linker is used to link the input objects.
      
      The problem is that reloc_location (modpost.c) is computing the
      address of the relocation target incorrectly. Here, elf->hdr points
      to the beginning of the ELF file in memory, sechdr points to the
      relocation section header, section is the index of the section
      being relocated, and sechdrs[section].sh_offset would be the offset
      of that section, relative to the beginning of the ELF file. Adding
      elf->hdr + sechdrs[section].sh_offset gives you the address of the
      beginning of the section, and adding r->r_offset to that gives you the
      address of the location to be relocated. You do not need to subtract
      sechdrs[section].sh_addr from that -- the result of this is an address
      outside the file, and causes the segfault when addend_386_rel tries to
      dereference it.
      
      This bug is not observed when GNU ld is used to link the inputs. The
      object file ubuntu/omnibook/omnibook.o is the result of an ld -r of
      several other files.  When GNU ld does an ld -r, it sets the vaddr
      field for each section to 0, but gold lays out the section addresses
      sequentially instead:
      
      Section Headers:
       [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
       [ 0]                   NULL            00000000 000000 000000 00      0   0  0
       [ 1] .text             PROGBITS        00000000 000034 004794 00  AX  0   0  4
       [ 2] .data             PROGBITS        0000b9d0 0047c8 0009c0 00  WA  0   0  4
       [ 3] .bss              NOBITS          000162f8 005188 00013c 00  WA  0   0  4
       [ 4] .rodata.str1.1    PROGBITS        00004f2d 0052c4 001b1a 01 AMS  0   0  1
       [ 5] .init.text        PROGBITS        00004794 006dde 0005fa 00  AX  0   0  1
       [ 6] .exit.text        PROGBITS        00004d8e 0073d8 00018a 00  AX  0   0  1
        ...
      
      So the bug in the tool remained undiscovered because the section's vaddr
      always happened to be 0.
      Signed-off-by: NRaymes Khoury <raymes@google.com>
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      731ece41
  2. 23 12月, 2010 1 次提交
  3. 20 12月, 2010 1 次提交
  4. 17 12月, 2010 1 次提交
  5. 15 12月, 2010 1 次提交
  6. 14 12月, 2010 1 次提交
  7. 25 11月, 2010 1 次提交
  8. 12 11月, 2010 1 次提交
    • E
      fixdep: use hash table instead of a single array · 8af27e1d
      Eric Dumazet 提交于
      I noticed fixdep uses ~2% of cpu time in kernel build, in function
      use_config()
      
      fixdep spends a lot of cpu cycles in linear searches in its internal
      string array. With about 400 stored strings per dep file, this begins to
      be noticeable.
      
      Convert fixdep to use a hash table.
      
      kbuild results on my x86_64 allmodconfig
      
      Before patch :
      
      real	10m30.414s
      user	61m51.456s
      sys	8m28.200s
      
      real	10m12.334s
      user	61m50.236s
      sys	8m30.448s
      
      real	10m42.947s
      user	61m50.028s
      sys	8m32.380s
      
      After:
      
      real	10m8.180s
      user	61m22.506s
      sys	8m32.384s
      
      real	10m35.039s
      user	61m21.654s
      sys	8m32.212s
      
      real	10m14.487s
      user	61m23.498s
      sys	8m32.312s
      Signed-off-by: NEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: NMichal Marek <mmarek@suse.cz>
      8af27e1d
  9. 30 10月, 2010 3 次提交
    • T
      semaphore: Remove mutex emulation · 4882720b
      Thomas Gleixner 提交于
      Semaphores used as mutexes have been deprecated for years. Now that
      all users are either converted to real semaphores or to mutexes remove
      the cruft.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Christoph Hellwig <hch@infradead.org>
      LKML-Reference: <20100907125057.562399240@linutronix.de>
      4882720b
    • W
      ftrace/MIPS: Add module support for C version of recordmcount · 412910cd
      Wu Zhangjin 提交于
      Since MIPS modules' address space differs from the core kernel space, to access
      the _mcount in the core kernel, the kernel functions in modules must use long
      call (-mlong-calls): load the _mcount address into one register and jump to the
      address stored by the register:
      
       c:  3c030000        lui     v1,0x0  <-------->  b label
                 c: R_MIPS_HI16  _mcount
                 c: R_MIPS_NONE  *ABS*
                 c: R_MIPS_NONE  *ABS*
      10:  64630000        daddiu  v1,v1,0
                10: R_MIPS_LO16 _mcount
                10: R_MIPS_NONE *ABS*
                10: R_MIPS_NONE *ABS*
      14:	03e0082d 	move	at,ra
      18:	0060f809 	jalr	v1
      label:
      
      In the old Perl version of recordmcount, we only need to record the position of
      the 1st R_MIPS_HI16 type of _mcount, and later, in ftrace_make_nop(), replace
      the instruction in this position by a "b label" and in ftrace_make_call(),
      replace it back.
      
      But, the default C version of recordmcount records all of the _mcount symbols,
      so, we must filter the 2nd _mcount like the Perl version of recordmcount does.
      
      The C version of recordmcount copes with the symbols before they are linked, So
      It doesn't know the type of the symbols and therefore can not filter the
      symbols as the Perl version of recordmcount does. But as we can see above, the
      2nd _mcount symbols of the long call alawys follows the 1st _mcount symbol of
      the same long call, which means the offset from the 1st to the 2nd is fixed, it
      is 0x10-0xc = 4 here, 4 is the length of the 1st load instruciton, for MIPS has
      fixed length of instructions, this offset is always 4.
      
      And as we know, the _mcount is inserted into the entry of every kernel
      function, the offset between the other _mcount's is expected to be always
      bigger than 4. So, to filter the 2ns _mcount symbol of the long call, we can
      simply check the offset between two _mcount symbols, If it is 4, then, filter
      the 2nd _mcount symbol.
      
      To avoid touching too much code, an 'empty' function fn_is_fake_mcount() is
      added for all of the archs, and the specific archs can override it via chaning
      the function pointer: is_fake_mcount in do_file() with the e_machine. e.g. This
      patch adds MIPS_is_fake_mcount() to override the default fn_is_fake_mcount()
      pointed by is_fake_mcount.
      
      This fn_is_fake_mcount() checks if the _mcount symbol is fake, e.g. the 2nd
      _mcount symbol of the long call is fake, for there are 2 _mcount symbols mapped
      to one real mcount call, so, one of them is fake and must be filtered.
      
      This fn_is_fake_mcount() is called in sift_rel_mcount() after finding the
      _mcount symbols and before adding the _mcount symbol into mrelp, so, it can
      prevent the fake mcount symbol going into the last __mcount_loc table.
      Signed-off-by: NWu Zhangjin <wuzhangjin@gmail.com>
      LKML-Reference: <b866f0138224340a132d31861fa3f9300dee30ac.1288176026.git.wuzhangjin@gmail.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      412910cd
    • J
      ftrace/MIPS: Add MIPS64 support for C version of recordmcount · a2d49358
      John Reiser 提交于
      MIPS64 has 'weird' Elf64_Rel.r_info[1,2], which must be used instead of
      the generic Elf64_Rel.r_info, otherwise, the C version of recordmcount
      will not work for "segmentation fault".
      
      Usage of "union mips_r_info" and the functions MIPS64_r_sym() and
      MIPS64_r_info() written by Maciej W. Rozycki <macro@linux-mips.org>
      
      ----
      [1] http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf
      [2] arch/mips/include/asm/module.h
      Tested-by: NWu Zhangjin <wuzhangjin@gmail.com>
      Signed-off-by: NJohn Reiser <jreiser@BitWagon.com>
      Signed-off-by: NMaciej W. Rozycki <macro@linux-mips.org>
      LKML-Reference: <AANLkTinwXjLAYACUfhLYaocHD_vBbiErLN3NjwN8JqSy@mail.gmail.com>
      LKML-Reference: <910dc2d5ae1ed042df4f96815fe4a433078d1c2a.1288176026.git.wuzhangjin@gmail.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a2d49358
  10. 29 10月, 2010 6 次提交
  11. 28 10月, 2010 11 次提交
  12. 27 10月, 2010 12 次提交