1. 13 Nov, 2017 4 commits
  2. 10 Nov, 2017 1 commit
    • James Hogan's avatar
      MIPS: Fix odd fp register warnings with MIPS64r2 · c7fd89a6
      James Hogan authored
      Building 32-bit MIPS64r2 kernels produces warnings like the following
      on certain toolchains (such as GNU assembler 2.24.90, but not GNU
      assembler 2.28.51) since commit 22b8ba76 ("MIPS: Fix MIPS64 FP
      save/restore on 32-bit kernels"), due to the exposure of fpu_save_16odd
      from fpu_save_double and fpu_restore_16odd from fpu_restore_double:
      
      arch/mips/kernel/r4k_fpu.S:47: Warning: float register should be even, was 1
      ...
      arch/mips/kernel/r4k_fpu.S:59: Warning: float register should be even, was 1
      ...
      
      This appears to be because .set mips64r2 does not change the FPU ABI to
      64-bit when -march=mips64r2 (or e.g. -march=xlp) is provided on the
      command line on that toolchain, from the default FPU ABI of 32-bit due
      to the -mabi=32. This makes access to the odd FPU registers invalid.
      
      Fix by explicitly changing the FPU ABI with .set fp=64 directives in
      fpu_save_16odd and fpu_restore_16odd, and moving the undefine of fp up
      in asmmacro.h so fp doesn't turn into $30.
      
      Fixes: 22b8ba76 ("MIPS: Fix MIPS64 FP save/restore on 32-bit kernels")
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 4.0+: 22b8ba76: MIPS: Fix MIPS64 FP save/restore on 32-bit kernels
      Cc: <stable@vger.kernel.org> # 4.0+
      Patchwork: https://patchwork.linux-mips.org/patch/17656/
      c7fd89a6
  3. 09 Nov, 2017 6 commits
    • Mathieu Malaterre's avatar
      watchdog: jz4780: Allow selection of jz4740-wdt driver · fe1a5cbc
      Mathieu Malaterre authored
      This driver works for jz4740 & jz4780.
      Suggested-by: default avatarMaarten ter Huurne <maarten@treewalker.org>
      Signed-off-by: default avatarMathieu Malaterre <malat@debian.org>
      Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Wim Van Sebroeck <wim@iguana.be>
      Cc: Paul Cercueil <paul@crapouillou.net>
      Cc: linux-mips@linux-mips.org
      Cc: linux-watchdog@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17251/Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      fe1a5cbc
    • James Hogan's avatar
      MIPS/ptrace: Update syscall nr on register changes · de8cd0dc
      James Hogan authored
      Update the thread_info::syscall field when registers are modified via
      ptrace to change or cancel the system call being entered.
      
      This is important to allow seccomp and the syscall entry and exit trace
      events to observe the new syscall number changed by the normal ptrace
      hook or seccomp. That includes allowing seccomp's recheck of the system
      call number after SECCOMP_RET_TRACE to notice if the syscall is changed
      to a denied one, which happens in seccomp since commit ce6526e8
      ("seccomp: recheck the syscall after RET_TRACE") in v4.8.
      
      In the process of doing this, the logic to determine whether an indirect
      system call is in progress (i.e. the O32 ABI's syscall()) is abstracted
      into mips_syscall_is_indirect(), and a new mips_syscall_update_nr() is
      used to update the thread_info::syscall based on the register state.
      
      The following ptrace operations are updated:
       - PTRACE_SETREGS (ptrace_setregs()).
       - PTRACE_SETREGSET with NT_PRSTATUS (gpr32_set() and gpr64_set()).
       - PTRACE_POKEUSR with 2/v0 or 4/a0 for indirect syscall
         ([compat_]arch_ptrace()).
      
      Fixes: c2d9f177 ("MIPS: Fix syscall_get_nr for the syscall exit tracing.")
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Lars Persson <larper@axis.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Will Drewry <wad@chromium.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16995/
      de8cd0dc
    • James Hogan's avatar
      MIPS/ptrace: Pick up ptrace/seccomp changed syscalls · b6318a90
      James Hogan authored
      The MIPS syscall_trace_enter() allows the system call number to be
      altered or cancelled by a ptrace tracer, via the normal ptrace hook
      (PTRACE_SYSCALL) and changing the system call number register on entry,
      and similarly via seccomp (PTRACE_EVENT_SECCOMP when a seccomp filter
      returns SECCOMP_RET_TRACE).
      
      Be sure to update the syscall local variable if this happens, so that
      seccomp will filter the correct system call number if the normal ptrace
      hook changes it first, and so that if either the normal ptrace hook or
      seccomp change it the correct system call number is passed to the trace
      event.
      
      This won't have any effect until the next commit, which fixes ptrace to
      update thread_info::syscall.
      
      Fixes: c2d9f177 ("MIPS: Fix syscall_get_nr for the syscall exit tracing.")
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Lars Persson <lars.persson@axis.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Will Drewry <wad@chromium.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/16996/
      b6318a90
    • Maciej W. Rozycki's avatar
      MIPS: Fix an n32 core file generation regset support regression · 547da673
      Maciej W. Rozycki authored
      Fix a commit 7aeb753b ("MIPS: Implement task_user_regset_view.")
      regression, then activated by commit 6a9c001b ("MIPS: Switch ELF
      core dumper to use regsets.)", that caused n32 processes to dump o32
      core files by failing to set the EF_MIPS_ABI2 flag in the ELF core file
      header's `e_flags' member:
      
      $ file tls-core
      tls-core: ELF 32-bit MSB executable, MIPS, N32 MIPS64 rel2 version 1 (SYSV), [...]
      $ ./tls-core
      Aborted (core dumped)
      $ file core
      core: ELF 32-bit MSB core file MIPS, MIPS-I version 1 (SYSV), SVR4-style
      $
      
      Previously the flag was set as the result of a:
      
      statement placed in arch/mips/kernel/binfmt_elfn32.c, however in the
      regset case, i.e. when CORE_DUMP_USE_REGSET is set, ELF_CORE_EFLAGS is
      no longer used by `fill_note_info' in fs/binfmt_elf.c, and instead the
      `->e_flags' member of the regset view chosen is.  We have the views
      defined in arch/mips/kernel/ptrace.c, however only an o32 and an n64
      one, and the latter is used for n32 as well.  Consequently an o32 core
      file is incorrectly dumped from n32 processes (the ELF32 vs ELF64 class
      is chosen elsewhere, and the 32-bit one is correctly selected for n32).
      
      Correct the issue then by defining an n32 regset view and using it as
      appropriate.  Issue discovered in GDB testing.
      
      Fixes: 7aeb753b ("MIPS: Implement task_user_regset_view.")
      Signed-off-by: default avatarMaciej W. Rozycki <macro@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Djordje Todorovic <djordje.todorovic@rt-rk.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.13+
      Patchwork: https://patchwork.linux-mips.org/patch/17617/Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      547da673
    • James Hogan's avatar
      MIPS: Fix MIPS64 FP save/restore on 32-bit kernels · 22b8ba76
      James Hogan authored
      32-bit kernels can be configured to support MIPS64, in which case
      neither CONFIG_64BIT or CONFIG_CPU_MIPS32_R* will be set. This causes
      the CP0_Status.FR checks at the point of floating point register save
      and restore to be compiled out, which results in odd FP registers not
      being saved or restored to the task or signal context even when
      CP0_Status.FR is set.
      
      Fix the ifdefs to use CONFIG_CPU_MIPSR2 and CONFIG_CPU_MIPSR6, which are
      enabled for the relevant revisions of either MIPS32 or MIPS64, along
      with some other CPUs such as Octeon (r2), Loongson1 (r2), XLP (r2),
      Loongson 3A R2.
      
      The suspect code originates from commit 597ce172 ("MIPS: Support for
      64-bit FP with O32 binaries") in v3.14, however the code in
      __enable_fpu() was consistent and refused to set FR=1, falling back to
      software FPU emulation. This was suboptimal but should be functionally
      correct.
      
      Commit fcc53b5f ("MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6
      CPU") in v4.2 (and stable tagged back to 4.0) later introduced the bug
      by updating __enable_fpu() to set FR=1 but failing to update the other
      similar ifdefs to enable FR=1 state handling.
      
      Fixes: fcc53b5f ("MIPS: fpu.h: Allow 64-bit FPU on a 64-bit MIPS R6 CPU")
      Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 4.0+
      Patchwork: https://patchwork.linux-mips.org/patch/16739/
      22b8ba76
    • Florian Fainelli's avatar
      MIPS: page.h: Define virt_to_pfn() · 37d15948
      Florian Fainelli authored
      Define virt_to_pfn() based on the existing definition of virt_to_page()
      which already does a PFN_DOWN(vir_to_phys(kaddr)).
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: Maciej W. Rozycki <macro@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/15409/Signed-off-by: default avatarJames Hogan <jhogan@kernel.org>
      37d15948
  4. 08 Nov, 2017 8 commits
  5. 07 Nov, 2017 16 commits
  6. 09 Oct, 2017 5 commits