1. 11 11月, 2015 1 次提交
    • A
      MIPS: Initial implementation of a VDSO · ebb5e78c
      Alex Smith 提交于
      Add an initial implementation of a proper (i.e. an ELF shared library)
      VDSO. With this commit it does not export any symbols, it only replaces
      the current signal return trampoline page. A later commit will add user
      implementations of gettimeofday()/clock_gettime().
      
      To support both new toolchains and old ones which don't generate ABI
      flags section, we define its content manually and then use a tool
      (genvdso) to patch up the section to have the correct name and type.
      genvdso also extracts symbol offsets ({,rt_}sigreturn) needed by the
      kernel, and generates a C file containing a "struct mips_vdso_image"
      containing both the VDSO data and these offsets. This C file is
      compiled into the kernel.
      
      On 64-bit kernels we require a different VDSO for each supported ABI,
      so we may build up to 3 different VDSOs. The VDSO to use is selected by
      the mips_abi structure.
      
      A kernel/user shared data page is created and mapped below the VDSO
      image. This is currently empty, but will be used by the user time
      function implementations which are added later.
      
      [markos.chandras@imgtec.com:
      - Add more comments
      - Move abi detection in genvdso.h since it's the get_symbol function
      that needs it.
      - Add an R6 specific way to calculate the base address of VDSO in order
      to avoid the branch instruction which affects performance.
      - Do not patch .gnu.attributes since it's not needed for dynamic linking.
      - Simplify Makefile a little bit.
      - checkpatch fixes
      - Restrict VDSO support for binutils < 2.25 for pre-R6
      - Include atomic64.h for O32 variant on MIPS64]
      Signed-off-by: NAlex Smith <alex.smith@imgtec.com>
      Signed-off-by: NMarkos Chandras <markos.chandras@imgtec.com>
      Cc: Matthew Fortune <matthew.fortune@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/11337/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ebb5e78c
  2. 24 11月, 2014 1 次提交
    • P
      MIPS: Enable VDSO randomization · ccd39880
      Prem Karat 提交于
      Based on commit 1091458d (mmap randomization)
      
      For 32-bit address spaces randomize within a
      16MB space, for 64-bit within a 256MB space.
      
      Test Results:
      ------------
      Without Patch (VDSO is not randomized)
      ---------------------------------------
      root@Maleo:~# ./aslr vdso
      FAIL: ASLR not functional (vdso always at 0x7fff7000)
      
      root@Maleo:~# ./aslr rekey vdso
      pre_val==cur_val
      value=0x7fff7000
      
      With patch:(VDSO is randmoized and doesn't interfere with stack)
      ----------------------------------------------------------------
      root@cavium-octeon2:~# ./aslr rekey vdso
      pre_val!=cur_val
      previous_value=0x7f830ea2
      current_value=0x776e2000
      root@cavium-octeon2:~# ./aslr rekey vdso
      pre_val!=cur_val
      previous_value=0x7fb0cea2
      current_value=0x77209000
      root@cavium-octeon2:~# ./aslr rekey vdso
      pre_val!=cur_val
      previous_value=0x7f985ea2
      current_value=0x7770c000
      root@cavium-octeon2:~# ./aslr rekey vdso
      pre_val!=cur_val
      previous_value=0x7fbc6ea2
      current_value=0x7fe25000
      
      Maps file output:
      -------------------------
      root@cavium-octeon2:~# ./aslr rekey maps
      78584000-785a5000 rwxp 00000000 00:00 0                                  [heap]
      7f9d0000-7f9f1000 rw-p 00000000 00:00 0                                  [stack]
      7ffa5000-7ffa6000 r-xp 00000000 00:00 0                                  [vdso]
      
      root@cavium-octeon2:~# ./aslr rekey maps
      77de0000-77e01000 rwxp 00000000 00:00 0                                  [heap]
      7f91b000-7f93c000 rw-p 00000000 00:00 0                                  [stack]
      7ff99000-7ff9a000 r-xp 00000000 00:00 0                                  [vdso]
      
      root@cavium-octeon2:~# ./aslr rekey maps
      77d7f000-77da0000 rwxp 00000000 00:00 0                                  [heap]
      7fc2a000-7fc4b000 rw-p 00000000 00:00 0                                  [stack]
      7fe09000-7fe0a000 r-xp 00000000 00:00 0                                  [vdso]
      
      root@cavium-octeon2:~# ./aslr rekey maps
      7794c000-7794d000 r-xp 00000000 00:00 0                                  [vdso]
      77e4b000-77e6c000 rwxp 00000000 00:00 0                                  [heap]
      7f6e7000-7f708000 rw-p 00000000 00:00 0                                  [stack]
      root@cavium-octeon2:~#
      Signed-off-by: NPrem Karat <pkarat@mvista.com>
      Cc: linux-mips@linux-mips.org
      Cc: sergei.shtylyov@cogentembedded.com
      Cc: ddaney.cavm@gmail.com
      Patchwork: https://patchwork.linux-mips.org/patch/6812Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ccd39880
  3. 24 3月, 2012 1 次提交
    • J
      coredump: remove VM_ALWAYSDUMP flag · 909af768
      Jason Baron 提交于
      The motivation for this patchset was that I was looking at a way for a
      qemu-kvm process, to exclude the guest memory from its core dump, which
      can be quite large.  There are already a number of filter flags in
      /proc/<pid>/coredump_filter, however, these allow one to specify 'types'
      of kernel memory, not specific address ranges (which is needed in this
      case).
      
      Since there are no more vma flags available, the first patch eliminates
      the need for the 'VM_ALWAYSDUMP' flag.  The flag is used internally by
      the kernel to mark vdso and vsyscall pages.  However, it is simple
      enough to check if a vma covers a vdso or vsyscall page without the need
      for this flag.
      
      The second patch then replaces the 'VM_ALWAYSDUMP' flag with a new
      'VM_NODUMP' flag, which can be set by userspace using new madvise flags:
      'MADV_DONTDUMP', and unset via 'MADV_DODUMP'.  The core dump filters
      continue to work the same as before unless 'MADV_DONTDUMP' is set on the
      region.
      
      The qemu code which implements this features is at:
      
        http://people.redhat.com/~jbaron/qemu-dump/qemu-dump.patch
      
      In my testing the qemu core dump shrunk from 383MB -> 13MB with this
      patch.
      
      I also believe that the 'MADV_DONTDUMP' flag might be useful for
      security sensitive apps, which might want to select which areas are
      dumped.
      
      This patch:
      
      The VM_ALWAYSDUMP flag is currently used by the coredump code to
      indicate that a vma is part of a vsyscall or vdso section.  However, we
      can determine if a vma is in one these sections by checking it against
      the gate_vma and checking for a non-NULL return value from
      arch_vma_name().  Thus, freeing a valuable vma bit.
      Signed-off-by: NJason Baron <jbaron@redhat.com>
      Acked-by: NRoland McGrath <roland@hack.frob.com>
      Cc: Chris Metcalf <cmetcalf@tilera.com>
      Cc: Avi Kivity <avi@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      909af768
  4. 27 7月, 2010 2 次提交
  5. 13 4月, 2010 1 次提交
    • D
      MIPS: Preliminary VDSO · c52d0d30
      David Daney 提交于
      This is a preliminary patch to add a vdso to all user processes.  Still
      missing are ELF headers and .eh_frame information.  But it is enough to
      allow us to move signal trampolines off of the stack.  Note that emulation
      of branch delay slots in the FPU emulator still requires the stack.
      
      We allocate a single page (the vdso) and write all possible signal
      trampolines into it.  The stack is moved down by one page and the vdso is
      mapped into this space.
      Signed-off-by: NDavid Daney <ddaney@caviumnetworks.com>
      To: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/975/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      c52d0d30