1. 26 8月, 2015 2 次提交
  2. 18 8月, 2015 1 次提交
    • R
      MIPS: Fix LLVM build issue. · 158d3b2a
      Ralf Baechle 提交于
      Matthew Fortune <Matthew.Fortune@imgtec.com> reports:
      
      The genex.S file appears to mix the case of a macro between its definition and
      use. A cut down example of this is below. The macro __build_clear_none has
      lower case 'build' but ends up being instantiated with upper case BUILD. Can
      this be fixed on master. It has been picked up by the LLVM integrated assembler
      which is currently case sensitive. We are likely to fix the assembler as well
      but the code is currently inconsistent in the kernel.
      
       .macro __build_clear_none
       .endm
      
       .macro __BUILD_HANDLER exception handler clear verbose ext
       .align 5
       .globl handle_\exception; .align 2; .type handle_\exception, @function; .ent
      handle_\exception, 0; handle_\exception: .frame $29, 184, $29
       .set noat
       .globl handle_\exception\ext; .type handle_\exception\ext, @function;
      handle_\exception\ext:
       __BUILD_clear_\clear
       .endm
      
       .macro BUILD_HANDLER exception handler clear verbose
       __BUILD_HANDLER \exception \handler \clear \verbose _int
       .endm
      
      BUILD_HANDLER ftlb ftlb none silent
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      Reported-by: NMatthew Fortune <Matthew.Fortune@imgtec.com>
      158d3b2a
  3. 16 8月, 2015 1 次提交
  4. 07 8月, 2015 1 次提交
    • A
      signal: fix information leak in copy_siginfo_from_user32 · 3c00cb5e
      Amanieu d'Antras 提交于
      This function can leak kernel stack data when the user siginfo_t has a
      positive si_code value.  The top 16 bits of si_code descibe which fields
      in the siginfo_t union are active, but they are treated inconsistently
      between copy_siginfo_from_user32, copy_siginfo_to_user32 and
      copy_siginfo_to_user.
      
      copy_siginfo_from_user32 is called from rt_sigqueueinfo and
      rt_tgsigqueueinfo in which the user has full control overthe top 16 bits
      of si_code.
      
      This fixes the following information leaks:
      x86:   8 bytes leaked when sending a signal from a 32-bit process to
             itself. This leak grows to 16 bytes if the process uses x32.
             (si_code = __SI_CHLD)
      x86:   100 bytes leaked when sending a signal from a 32-bit process to
             a 64-bit process. (si_code = -1)
      sparc: 4 bytes leaked when sending a signal from a 32-bit process to a
             64-bit process. (si_code = any)
      
      parsic and s390 have similar bugs, but they are not vulnerable because
      rt_[tg]sigqueueinfo have checks that prevent sending a positive si_code
      to a different process.  These bugs are also fixed for consistency.
      Signed-off-by: NAmanieu d'Antras <amanieu@gmail.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Chris Metcalf <cmetcalf@ezchip.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3c00cb5e
  5. 05 8月, 2015 1 次提交
    • D
      MIPS: Make set_pte() SMP safe. · 46011e6e
      David Daney 提交于
      On MIPS the GLOBAL bit of the PTE must have the same value in any
      aligned pair of PTEs.  These pairs of PTEs are referred to as
      "buddies".  In a SMP system is is possible for two CPUs to be calling
      set_pte() on adjacent PTEs at the same time.  There is a race between
      setting the PTE and a different CPU setting the GLOBAL bit in its
      buddy PTE.
      
      This race can be observed when multiple CPUs are executing
      vmap()/vfree() at the same time.
      
      Make setting the buddy PTE's GLOBAL bit an atomic operation to close
      the race condition.
      
      The case of CONFIG_64BIT_PHYS_ADDR && CONFIG_CPU_MIPS32 is *not*
      handled.
      Signed-off-by: NDavid Daney <david.daney@cavium.com>
      Cc: <stable@vger.kernel.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10835/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      46011e6e
  6. 03 8月, 2015 14 次提交
    • J
      MIPS: Replace add and sub instructions in relocate_kernel.S with addiu · a4504755
      James Cowgill 提交于
      Fixes the assembler errors generated when compiling a MIPS R6 kernel with
      CONFIG_KEXEC on, by replacing the offending add and sub instructions with
      addiu instructions.
      
      Build errors:
      arch/mips/kernel/relocate_kernel.S: Assembler messages:
      arch/mips/kernel/relocate_kernel.S:27: Error: invalid operands `dadd $16,$16,8'
      arch/mips/kernel/relocate_kernel.S:64: Error: invalid operands `dadd $20,$20,8'
      arch/mips/kernel/relocate_kernel.S:65: Error: invalid operands `dadd $18,$18,8'
      arch/mips/kernel/relocate_kernel.S:66: Error: invalid operands `dsub $22,$22,1'
      scripts/Makefile.build:294: recipe for target 'arch/mips/kernel/relocate_kernel.o' failed
      Signed-off-by: NJames Cowgill <James.Cowgill@imgtec.com>
      Cc: <stable@vger.kernel.org> # 4.0+
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10558/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a4504755
    • J
      MIPS: Flush RPS on kernel entry with EVA · 3aff47c0
      James Hogan 提交于
      When EVA is enabled, flush the Return Prediction Stack (RPS) present on
      some MIPS cores on entry to the kernel from user mode.
      
      This is important specifically for interAptiv with EVA enabled,
      otherwise kernel mode RPS mispredicts may trigger speculative fetches of
      user return addresses, which may be sensitive in the kernel address
      space due to EVA's overlapping user/kernel address spaces.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.15.x-
      Patchwork: https://patchwork.linux-mips.org/patch/10812/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      3aff47c0
    • F
      Revert "MIPS: BCM63xx: Provide a plat_post_dma_flush hook" · 247bfb65
      Florian Fainelli 提交于
      This reverts commit 3cf29543 ("MIPS:
      BCM63xx: Provide a plat_post_dma_flush hook") since this commit was
      found to prevent BCM6358 (early BMIPS4350 cores) and some BCM6368
      (BMIPS4380 cores) from booting reliably.
      
      Alvaro was able to track this down to an issue specifically located to
      devices that use the second thread (TP1) when booting. Since BCM63xx did
      not have a need for plat_post_dma_flush() hook before, let's just keep
      things the way they were.
      Reported-by: NÁlvaro Fernández Rojas <noltari@gmail.com>
      Reported-by: NJonas Gorski <jogo@openwrt.org>
      Signed-off-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Cc: stable@vger.kernel.org
      Cc: Kevin Cernekee <cernekee@gmail.com>
      Cc: Nicolas Schichan <nschichan@freebox.fr>
      Cc: linux-mips@linux-mips.org
      Cc: blogic@openwrt.org
      Cc: noltari@gmail.com
      Cc: jogo@openwrt.org
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: stable@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/10804/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      247bfb65
    • K
      MIPS: BMIPS: Delete unused Kconfig symbol · 3592bb08
      Kevin Cernekee 提交于
      This was left over from an earlier iteration of the BMIPS irqchip changes.
      It doesn't actually have an effect, so let's nuke it.
      Reported-by: NValentin Rothberg <valentinrothberg@gmail.com>
      Signed-off-by: NKevin Cernekee <cernekee@chromium.org>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Cc: stable@vger.kernel.org # v4.1+
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/9910/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      3592bb08
    • F
      MIPS: Export get_c0_perfcount_int() · 0cb0985f
      Felix Fietkau 提交于
      get_c0_perfcount_int is tested from oprofile code. If oprofile is
      compiled as module, get_c0_perfcount_int needs to be exported, otherwise
      it cannot be resolved.
      
      Fixes: a669efc4 ("MIPS: Add hook to get C0 performance counter interrupt")
      Cc: stable@vger.kernel.org # v3.19+
      Signed-off-by: NFelix Fietkau <nbd@openwrt.org>
      Cc: linux-mips@linux-mips.org
      Cc: abrestic@chromium.org
      Patchwork: https://patchwork.linux-mips.org/patch/10763/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      0cb0985f
    • J
      MIPS: show_stack: Fix stack trace with EVA · 1e77863a
      James Hogan 提交于
      The show_stack() function deals exclusively with kernel contexts, but if
      it gets called in user context with EVA enabled, show_stacktrace() will
      attempt to access the stack using EVA accesses, which will either read
      other user mapped data, or more likely cause an exception which will be
      handled by __get_user().
      
      This is easily reproduced using SysRq t to show all task states, which
      results in the following stack dump output:
      
       Stack : (Bad stack address)
      
      Fix by setting the current user access mode to kernel around the call to
      show_stacktrace(). This causes __get_user() to use normal loads to read
      the kernel stack.
      
      Now we get the correct output, like this:
      
       Stack : 00000000 80168960 00000000 004a0000 00000000 00000000 8060016c 1f3abd0c
                 1f172cd8 8056f09c 7ff1e450 8014fc3c 00000001 806dd0b0 0000001d 00000002
                 1f17c6a0 1f17c804 1f17c6a0 8066f6e0 00000000 0000000a 00000000 00000000
                 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
                 00000000 00000000 00000000 00000000 00000000 0110e800 1f3abd6c 1f17c6a0
                 ...
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.15+
      Patchwork: https://patchwork.linux-mips.org/patch/10778/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      1e77863a
    • J
      MIPS: do_mcheck: Fix kernel code dump with EVA · 55c723e1
      James Hogan 提交于
      If a machine check exception is raised in kernel mode, user context,
      with EVA enabled, then the do_mcheck handler will attempt to read the
      code around the EPC using EVA load instructions, i.e. as if the reads
      were from user mode. This will either read random user data if the
      process has anything mapped at the same address, or it will cause an
      exception which is handled by __get_user, resulting in this output:
      
       Code: (Bad address in epc)
      
      Fix by setting the current user access mode to kernel if the saved
      register context indicates the exception was taken in kernel mode. This
      causes __get_user to use normal loads to read the kernel code.
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.15+
      Patchwork: https://patchwork.linux-mips.org/patch/10777/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      55c723e1
    • A
      MIPS: SMP: Don't increment irq_count multiple times for call function IPIs · 4ace6139
      Alex Smith 提交于
      The majority of SMP platforms handle their IPIs through do_IRQ()
      which calls irq_{enter/exit}(). When a call function IPI is received,
      smp_call_function_interrupt() is called which also calls
      irq_{enter,exit}(), meaning irq_count is raised twice.
      
      When tick broadcasting is used (which is implemented via a call
      function IPI), this incorrectly causes all CPU idle time on the core
      receiving broadcast ticks to be accounted as time spent servicing
      IRQs, as account_process_tick() will account as such if irq_count is
      greater than 1. This results in 100% CPU usage being reported on a
      core which receives its ticks via broadcast.
      
      This patch removes the SMP smp_call_function_interrupt() wrapper which
      calls irq_{enter,exit}(). Platforms which handle their IPIs through
      do_IRQ() now call generic_smp_call_function_interrupt() directly to
      avoid incrementing irq_count a second time. Platforms which don't
      (loongson, sgi-ip27, sibyte) call generic_smp_call_function_interrupt()
      wrapped in irq_{enter,exit}().
      Signed-off-by: NAlex Smith <alex.smith@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10770/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      4ace6139
    • R
      MIPS: Partially disable RIXI support. · 55fdcb2d
      Ralf Baechle 提交于
      Execution of break instruction, trap instructions, emulation of unaligned
      loads or floating point instructions - anything that tries to read the
      instruction's opcode from userspace - needs read access to a page.
      
      RIXI (Read Inhibit / Execute Inhibit) support however allows the creation of
      pags that are executable but not readable.  On such a mapping the attempted
      load of the opcode by the kernel is going to cause an endless loop of
      page faults.
      
      The quick workaround for this is to disable the combinations that the kernel
      currently isn't able to handle which are executable mappings.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      55fdcb2d
    • R
      MIPS: Handle page faults of executable but unreadable pages correctly. · e070dab7
      Ralf Baechle 提交于
      Without this we end taking execeptions in an endless loop hanging the
      thread.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e070dab7
    • J
      MIPS: Malta: Don't reinitialise RTC · 106eccb4
      James Hogan 提交于
      On Malta, since commit a87ea88d ("MIPS: Malta: initialise the RTC at
      boot"), the RTC is reinitialised and forced into binary coded decimal
      (BCD) mode during init, even if the bootloader has already initialised
      it, and may even have already put it into binary mode (as YAMON does).
      This corrupts the current time, can result in the RTC seconds being an
      invalid BCD (e.g. 0x1a..0x1f) for up to 6 seconds, as well as confusing
      YAMON for a while after reset, enough for it to report timeouts when
      attempting to load from TFTP (it actually uses the RTC in that code).
      
      Therefore only initialise the RTC to the extent that is necessary so
      that Linux avoids interfering with the bootloader setup, while also
      allowing it to estimate the CPU frequency without hanging, without a
      bootloader necessarily having done anything with the RTC (for example
      when the kernel is loaded via EJTAG).
      
      The divider control is configured for a 32KHZ reference clock if
      necessary, and the SET bit of the RTC_CONTROL register is cleared if
      necessary without changing any other bits (this bit will be set when
      coming out of reset if the battery has been disconnected).
      
      Fixes: a87ea88d ("MIPS: Malta: initialise the RTC at boot")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Reviewed-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.14+
      Patchwork: https://patchwork.linux-mips.org/patch/10739/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      106eccb4
    • J
      MIPS: unaligned: Fix build error on big endian R6 kernels · 531a6d59
      James Cowgill 提交于
      Commit eeb53895 ("MIPS: unaligned: Prevent EVA instructions on kernel
      unaligned accesses") renamed the Load* and Store* defines in unaligned.c
      to _Load* and _Store* as part of its fix. One define was missed out which
      causes big endian R6 kernels to fail to build.
      
      arch/mips/kernel/unaligned.c:880:35:
      error: implicit declaration of function '_StoreDW'
       #define StoreDW(addr, value, res) _StoreDW(addr, value, res)
                                         ^
      Signed-off-by: NJames Cowgill <James.Cowgill@imgtec.com>
      Fixes: eeb53895 ("MIPS: unaligned: Prevent EVA instructions on kernel unaligned accesses")
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: <stable@vger.kernel.org> # 4.0+
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10575/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      531a6d59
    • F
      MIPS: Fix sched_getaffinity with MT FPAFF enabled · 1d62d737
      Felix Fietkau 提交于
      p->thread.user_cpus_allowed is zero-initialized and is only filled on
      the first sched_setaffinity call.
      
      To avoid adding overhead in the task initialization codepath, simply OR
      the returned mask in sched_getaffinity with p->cpus_allowed.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NFelix Fietkau <nbd@openwrt.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10740/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      1d62d737
    • J
      MIPS: Fix build with CONFIG_OF=y for non OF-enabled targets · d3557d96
      Jonas Gorski 提交于
      Commit 01306aea ("MIPS: prepare for user enabling of CONFIG_OF")
      changed the guards in asm/prom.h from CONFIG_OF to CONFIG_USE_OF, but
      missed the actual function declarations in kernel/prom.c, which have
      additional dependencies.
      
      Fixes the following build error:
      
        CC      arch/mips/kernel/prom.o
      arch/mips/kernel/prom.c: In function '__dt_setup_arch':
      arch/mips/kernel/prom.c:54:2: error: implicit declaration of function 'early_init_dt_scan' [-Werror=implicit-function-declaration]
        if (!early_init_dt_scan(bph))
        ^
      
      Fixes: 01306aea ("MIPS: prepare for user enabling of CONFIG_OF")
      Signed-off-by: NJonas Gorski <jogo@openwrt.org>
      Acked-by: NRob Herring <robh@kernel.org>
      Cc: linux-mips@linux-mips.org
      Cc: devicetree@vger.kernel.org
      Cc: Grant Likely <grant.likely@linaro.org>
      Patchwork: https://patchwork.linux-mips.org/patch/10741/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      d3557d96
  7. 19 7月, 2015 1 次提交
  8. 18 7月, 2015 1 次提交
  9. 15 7月, 2015 1 次提交
    • R
      MIPS: SB1: Remove support for Pass 1 parts. · dd0bc75e
      Ralf Baechle 提交于
      Pass 1 parts had a number of significant erratas and were only available
      in small numbers and under NDA.  Full support also required the use of a
      special toolchain that kept branches properly aligned.  These workarounds
      were never upstreamed and the only toolchain known to have them is
      Montavista's GCC 3.0-based toolchain which completly obsoleted if not
      useless these days.
      
      So now that automated testing has tripped over the user of the
      -msb1-pass1-workarounds option, rather than fixing it remove support for
      pass 1 parts.
      
      Probably nobody will notice.  I seem to own the last know pass 1 board
      and I haven't noticed another one in the wild in the past decade, at
      least.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      dd0bc75e
  10. 14 7月, 2015 2 次提交
  11. 10 7月, 2015 5 次提交
  12. 09 7月, 2015 10 次提交