1. 19 2月, 2018 1 次提交
  2. 13 2月, 2018 2 次提交
  3. 12 2月, 2018 1 次提交
    • L
      vfs: do bulk POLL* -> EPOLL* replacement · a9a08845
      Linus Torvalds 提交于
      This is the mindless scripted replacement of kernel use of POLL*
      variables as described by Al, done by this script:
      
          for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
              L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
              for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
          done
      
      with de-mangling cleanups yet to come.
      
      NOTE! On almost all architectures, the EPOLL* constants have the same
      values as the POLL* constants do.  But they keyword here is "almost".
      For various bad reasons they aren't the same, and epoll() doesn't
      actually work quite correctly in some cases due to this on Sparc et al.
      
      The next patch from Al will sort out the final differences, and we
      should be all done.
      Scripted-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a9a08845
  4. 08 2月, 2018 1 次提交
  5. 05 2月, 2018 2 次提交
  6. 31 1月, 2018 1 次提交
  7. 23 1月, 2018 3 次提交
  8. 19 1月, 2018 3 次提交
  9. 16 1月, 2018 2 次提交
    • E
      signal: Unify and correct copy_siginfo_to_user32 · ea64d5ac
      Eric W. Biederman 提交于
      Among the existing architecture specific versions of
      copy_siginfo_to_user32 there are several different implementation
      problems.  Some architectures fail to handle all of the cases in in
      the siginfo union.  Some architectures perform a blind copy of the
      siginfo union when the si_code is negative.  A blind copy suggests the
      data is expected to be in 32bit siginfo format, which means that
      receiving such a signal via signalfd won't work, or that the data is
      in 64bit siginfo and the code is copying nonsense to userspace.
      
      Create a single instance of copy_siginfo_to_user32 that all of the
      architectures can share, and teach it to handle all of the cases in
      the siginfo union correctly, with the assumption that siginfo is
      stored internally to the kernel is 64bit siginfo format.
      
      A special case is made for x86 x32 format.  This is needed as presence
      of both x32 and ia32 on x86_64 results in two different 32bit signal
      formats.  By allowing this small special case there winds up being
      exactly one code base that needs to be maintained between all of the
      architectures.  Vastly increasing the testing base and the chances of
      finding bugs.
      
      As the x86 copy of copy_siginfo_to_user32 the call of the x86
      signal_compat_build_tests were moved into sigaction_compat_abi, so
      that they will keep running.
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      ea64d5ac
    • E
      signal: Unify and correct copy_siginfo_from_user32 · 212a36a1
      Eric W. Biederman 提交于
      The function copy_siginfo_from_user32 is used for two things, in ptrace
      since the dawn of siginfo for arbirarily modifying a signal that
      user space sees, and in sigqueueinfo to send a signal with arbirary
      siginfo data.
      
      Create a single copy of copy_siginfo_from_user32 that all architectures
      share, and teach it to handle all of the cases in the siginfo union.
      
      In the generic version of copy_siginfo_from_user32 ensure that all
      of the fields in siginfo are initialized so that the siginfo structure
      can be safely copied to userspace if necessary.
      
      When copying the embedded sigval union copy the si_int member.  That
      ensures the 32bit values passes through the kernel unchanged.
      Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
      212a36a1
  10. 10 1月, 2018 1 次提交
    • J
      MIPS: CM: Drop WARN_ON(vp != 0) · c04de7b1
      James Hogan 提交于
      Since commit 68923cdc ("MIPS: CM: Add cluster & block args to
      mips_cm_lock_other()"), mips_smp_send_ipi_mask() has used
      mips_cm_lock_other_cpu() with each CPU number, rather than
      mips_cm_lock_other() with the first VPE in each core. Prior to r6,
      multicore multithreaded systems such as dual-core dual-thread
      interAptivs with CPU Idle enabled (e.g. MIPS Creator Ci40) results in
      mips_cm_lock_other() repeatedly hitting WARN_ON(vp != 0).
      
      There doesn't appear to be anything fundamentally wrong about passing a
      non-zero VP/VPE number, even if it is a core's region that is locked
      into the other region before r6, so remove that particular WARN_ON().
      
      Fixes: 68923cdc ("MIPS: CM: Add cluster & block args to mips_cm_lock_other()")
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Reviewed-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org # 4.14+
      Patchwork: https://patchwork.linux-mips.org/patch/17883/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      c04de7b1
  11. 20 12月, 2017 1 次提交
    • M
      MIPS: Validate PR_SET_FP_MODE prctl(2) requests against the ABI of the task · b67336ee
      Maciej W. Rozycki 提交于
      Fix an API loophole introduced with commit 9791554b ("MIPS,prctl:
      add PR_[GS]ET_FP_MODE prctl options for MIPS"), where the caller of
      prctl(2) is incorrectly allowed to make a change to CP0.Status.FR or
      CP0.Config5.FRE register bits even if CONFIG_MIPS_O32_FP64_SUPPORT has
      not been enabled, despite that an executable requesting the mode
      requested via ELF file annotation would not be allowed to run in the
      first place, or for n64 and n64 ABI tasks which do not have non-default
      modes defined at all.  Add suitable checks to `mips_set_process_fp_mode'
      and bail out if an invalid mode change has been requested for the ABI in
      effect, even if the FPU hardware or emulation would otherwise allow it.
      
      Always succeed however without taking any further action if the mode
      requested is the same as one already in effect, regardless of whether
      any mode change, should it be requested, would actually be allowed for
      the task concerned.
      Signed-off-by: NMaciej W. Rozycki <macro@mips.com>
      Fixes: 9791554b ("MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS")
      Reviewed-by: NPaul Burton <paul.burton@mips.com>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # 4.0+
      Patchwork: https://patchwork.linux-mips.org/patch/17800/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      b67336ee
  12. 13 12月, 2017 7 次提交
    • M
      MIPS: Disallow outsized PTRACE_SETREGSET NT_PRFPREG regset accesses · c8c5a3a2
      Maciej W. Rozycki 提交于
      Complement commit c23b3d1a ("MIPS: ptrace: Change GP regset to use
      correct core dump register layout") and also reject outsized
      PTRACE_SETREGSET requests to the NT_PRFPREG regset, like with the
      NT_PRSTATUS regset.
      Signed-off-by: NMaciej W. Rozycki <macro@mips.com>
      Fixes: c23b3d1a ("MIPS: ptrace: Change GP regset to use correct core dump register layout")
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Paul Burton <Paul.Burton@mips.com>
      Cc: Alex Smith <alex@alex-smith.me.uk>
      Cc: Dave Martin <Dave.Martin@arm.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v3.17+
      Patchwork: https://patchwork.linux-mips.org/patch/17930/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      c8c5a3a2
    • M
      MIPS: Also verify sizeof `elf_fpreg_t' with PTRACE_SETREGSET · 006501e0
      Maciej W. Rozycki 提交于
      Complement commit d614fd58 ("mips/ptrace: Preserve previous
      registers for short regset write") and like with the PTRACE_GETREGSET
      ptrace(2) request also apply a BUILD_BUG_ON check for the size of the
      `elf_fpreg_t' type in the PTRACE_SETREGSET request handler.
      Signed-off-by: NMaciej W. Rozycki <macro@mips.com>
      Fixes: d614fd58 ("mips/ptrace: Preserve previous registers for short regset write")
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Paul Burton <Paul.Burton@mips.com>
      Cc: Alex Smith <alex@alex-smith.me.uk>
      Cc: Dave Martin <Dave.Martin@arm.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v4.11+
      Patchwork: https://patchwork.linux-mips.org/patch/17929/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      006501e0
    • M
      MIPS: Fix an FCSR access API regression with NT_PRFPREG and MSA · be07a6a1
      Maciej W. Rozycki 提交于
      Fix a commit 72b22bba ("MIPS: Don't assume 64-bit FP registers for
      FP regset") public API regression, then activated by commit 1db1af84
      ("MIPS: Basic MSA context switching support"), that caused the FCSR
      register not to be read or written for CONFIG_CPU_HAS_MSA kernel
      configurations (regardless of actual presence or absence of the MSA
      feature in a given processor) with ptrace(2) PTRACE_GETREGSET and
      PTRACE_SETREGSET requests nor recorded in core dumps.
      
      This is because with !CONFIG_CPU_HAS_MSA configurations the whole of
      `elf_fpregset_t' array is bulk-copied as it is, which includes the FCSR
      in one half of the last, 33rd slot, whereas with CONFIG_CPU_HAS_MSA
      configurations array elements are copied individually, and then only the
      leading 32 FGR slots while the remaining slot is ignored.
      
      Correct the code then such that only FGR slots are copied in the
      respective !MSA and MSA helpers an then the FCSR slot is handled
      separately in common code.  Use `ptrace_setfcr31' to update the FCSR
      too, so that the read-only mask is respected.
      
      Retrieving a correct value of FCSR is important in debugging not only
      for the human to be able to get the right interpretation of the
      situation, but for correct operation of GDB as well.  This is because
      the condition code bits in FSCR are used by GDB to determine the
      location to place a breakpoint at when single-stepping through an FPU
      branch instruction.  If such a breakpoint is placed incorrectly (i.e.
      with the condition reversed), then it will be missed, likely causing the
      debuggee to run away from the control of GDB and consequently breaking
      the process of investigation.
      
      Fortunately GDB continues using the older PTRACE_GETFPREGS ptrace(2)
      request which is unaffected, so the regression only really hits with
      post-mortem debug sessions using a core dump file, in which case
      execution, and consequently single-stepping through branches is not
      possible.  Of course core files created by buggy kernels out there will
      have the value of FCSR recorded clobbered, but such core files cannot be
      corrected and the person using them simply will have to be aware that
      the value of FCSR retrieved is not reliable.
      
      Which also means we can likely get away without defining a replacement
      API which would ensure a correct value of FSCR to be retrieved, or none
      at all.
      
      This is based on previous work by Alex Smith, extensively rewritten.
      Signed-off-by: NAlex Smith <alex@alex-smith.me.uk>
      Signed-off-by: NJames Hogan <james.hogan@mips.com>
      Signed-off-by: NMaciej W. Rozycki <macro@mips.com>
      Fixes: 72b22bba ("MIPS: Don't assume 64-bit FP registers for FP regset")
      Cc: Paul Burton <Paul.Burton@mips.com>
      Cc: Dave Martin <Dave.Martin@arm.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v3.15+
      Patchwork: https://patchwork.linux-mips.org/patch/17928/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      be07a6a1
    • M
      MIPS: Consistently handle buffer counter with PTRACE_SETREGSET · 80b3ffce
      Maciej W. Rozycki 提交于
      Update commit d614fd58 ("mips/ptrace: Preserve previous registers
      for short regset write") bug and consistently consume all data supplied
      to `fpr_set_msa' with the ptrace(2) PTRACE_SETREGSET request, such that
      a zero data buffer counter is returned where insufficient data has been
      given to fill a whole number of FP general registers.
      
      In reality this is not going to happen, as the caller is supposed to
      only supply data covering a whole number of registers and it is verified
      in `ptrace_regset' and again asserted in `fpr_set', however structuring
      code such that the presence of trailing partial FP general register data
      causes `fpr_set_msa' to return with a non-zero data buffer counter makes
      it appear that this trailing data will be used if there are subsequent
      writes made to FP registers, which is going to be the case with the FCSR
      once the missing write to that register has been fixed.
      
      Fixes: d614fd58 ("mips/ptrace: Preserve previous registers for short regset write")
      Signed-off-by: NMaciej W. Rozycki <macro@mips.com>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Paul Burton <Paul.Burton@mips.com>
      Cc: Alex Smith <alex@alex-smith.me.uk>
      Cc: Dave Martin <Dave.Martin@arm.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v4.11+
      Patchwork: https://patchwork.linux-mips.org/patch/17927/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      80b3ffce
    • M
      MIPS: Guard against any partial write attempt with PTRACE_SETREGSET · dc24d0ed
      Maciej W. Rozycki 提交于
      Complement commit d614fd58 ("mips/ptrace: Preserve previous
      registers for short regset write") and ensure that no partial register
      write attempt is made with PTRACE_SETREGSET, as we do not preinitialize
      any temporaries used to hold incoming register data and consequently
      random data could be written.
      
      It is the responsibility of the caller, such as `ptrace_regset', to
      arrange for writes to span whole registers only, so here we only assert
      that it has indeed happened.
      Signed-off-by: NMaciej W. Rozycki <macro@mips.com>
      Fixes: 72b22bba ("MIPS: Don't assume 64-bit FP registers for FP regset")
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Paul Burton <Paul.Burton@mips.com>
      Cc: Alex Smith <alex@alex-smith.me.uk>
      Cc: Dave Martin <Dave.Martin@arm.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v3.15+
      Patchwork: https://patchwork.linux-mips.org/patch/17926/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      dc24d0ed
    • M
      MIPS: Factor out NT_PRFPREG regset access helpers · a03fe725
      Maciej W. Rozycki 提交于
      In preparation to fix a commit 72b22bba ("MIPS: Don't assume 64-bit
      FP registers for FP regset") FCSR access regression factor out
      NT_PRFPREG regset access helpers for the non-MSA and the MSA variants
      respectively, to avoid having to deal with excessive indentation in the
      actual fix.
      
      No functional change, however use `target->thread.fpu.fpr[0]' rather
      than `target->thread.fpu.fpr[i]' for FGR holding type size determination
      as there's no `i' variable to refer to anymore, and for the factored out
      `i' variable declaration use `unsigned int' rather than `unsigned' as
      its type, following the common style.
      Signed-off-by: NMaciej W. Rozycki <macro@mips.com>
      Fixes: 72b22bba ("MIPS: Don't assume 64-bit FP registers for FP regset")
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Paul Burton <Paul.Burton@mips.com>
      Cc: Alex Smith <alex@alex-smith.me.uk>
      Cc: Dave Martin <Dave.Martin@arm.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: stable@vger.kernel.org # v3.15+
      Patchwork: https://patchwork.linux-mips.org/patch/17925/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a03fe725
    • J
      MIPS: CPS: Fix r1 .set mt assembler warning · 17278a91
      James Hogan 提交于
      MIPS CPS has a build warning on kernels configured for MIPS32R1 or
      MIPS64R1, due to the use of .set mt without a prior .set mips{32,64}r2:
      
      arch/mips/kernel/cps-vec.S Assembler messages:
      arch/mips/kernel/cps-vec.S:238: Warning: the `mt' extension requires MIPS32 revision 2 or greater
      
      Add .set MIPS_ISA_LEVEL_RAW before .set mt to silence the warning.
      
      Fixes: 245a7868 ("MIPS: smp-cps: rework core/VPE initialisation")
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Paul Burton <paul.burton@mips.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17699/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      17278a91
  13. 28 11月, 2017 1 次提交
  14. 14 11月, 2017 1 次提交
  15. 13 11月, 2017 1 次提交
    • D
      Pass mode to wait_on_atomic_t() action funcs and provide default actions · 5e4def20
      David Howells 提交于
      Make wait_on_atomic_t() pass the TASK_* mode onto its action function as an
      extra argument and make it 'unsigned int throughout.
      
      Also, consolidate a bunch of identical action functions into a default
      function that can do the appropriate thing for the mode.
      
      Also, change the argument name in the bit_wait*() function declarations to
      reflect the fact that it's the mode and not the bit number.
      
      [Peter Z gives this a grudging ACK, but thinks that the whole atomic_t wait
      should be done differently, though he's not immediately sure as to how]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NPeter Zijlstra <peterz@infradead.org>
      cc: Ingo Molnar <mingo@kernel.org>
      5e4def20
  16. 09 11月, 2017 4 次提交
    • J
      MIPS/ptrace: Update syscall nr on register changes · de8cd0dc
      James Hogan 提交于
      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: NJames 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
    • J
      MIPS/ptrace: Pick up ptrace/seccomp changed syscalls · b6318a90
      James Hogan 提交于
      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: NJames Hogan <jhogan@kernel.org>
      Reviewed-by: NKees 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
    • M
      MIPS: Fix an n32 core file generation regset support regression · 547da673
      Maciej W. Rozycki 提交于
      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: NMaciej 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: NJames Hogan <jhogan@kernel.org>
      547da673
    • J
      MIPS: Fix MIPS64 FP save/restore on 32-bit kernels · 22b8ba76
      James Hogan 提交于
      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: NJames 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
  17. 08 11月, 2017 2 次提交
  18. 04 11月, 2017 1 次提交
    • P
      Update MIPS email addresses · fb615d61
      Paul Burton 提交于
      MIPS will soon not be a part of Imagination Technologies, and as such
      many @imgtec.com email addresses will no longer be valid. This patch
      updates the addresses for those who:
      
       - Have 10 or more patches in mainline authored using an @imgtec.com
         email address, or any patches dated within the past year.
      
       - Are still with Imagination but leaving as part of the MIPS business
         unit, as determined from an internal email address list.
      
       - Haven't already updated their email address (ie. JamesH) or expressed
         a desire to be excluded (ie. Maciej).
      
       - Acked v2 or earlier of this patch, which leaves Deng-Cheng, Matt &
         myself.
      
      New addresses are of the form firstname.lastname@mips.com, and all
      verified against an internal email address list.  An entry is added to
      .mailmap for each person such that get_maintainer.pl will report the new
      addresses rather than @imgtec.com addresses which will soon be dead.
      
      Instances of the affected addresses throughout the tree are then
      mechanically replaced with the new @mips.com address.
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@imgtec.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@mips.com>
      Acked-by: NDengcheng Zhu <dengcheng.zhu@mips.com>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Matt Redfearn <matt.redfearn@mips.com>
      Acked-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Cc: trivial@kernel.org
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fb615d61
  19. 02 11月, 2017 5 次提交
    • M
      MIPS: Update email address for Marcin Nowakowski · ca208b5f
      Marcin Nowakowski 提交于
      MIPS is no longer part of Imagination Technologies and my @imgtec.com
      address will soon stop working. Update any files containing my address
      as well as the .mailmap to point to my new @mips.com address.
      Signed-off-by: NMarcin Nowakowski <marcin.nowakowski@mips.com>
      Patchwork: https://patchwork.linux-mips.org/patch/17579/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      ca208b5f
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
    • J
      MIPS: smp-cmp: Fix vpe_id build error · 7e7bf0ec
      James Hogan 提交于
      The smp-cmp build has been (further) broken since commit 856fbcee
      ("MIPS: Store core & VP IDs in GlobalNumber-style variable") in
      v4.14-rc1 like so:
      
      arch/mips/kernel/smp-cmp.c: In function ‘cmp_init_secondary’:
      arch/mips/kernel/smp-cmp.c:53:4: error: ‘struct cpuinfo_mips’ has no member named ‘vpe_id’
         c->vpe_id = (read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) &
          ^
      
      Fix by replacing vpe_id with cpu_set_vpe_id().
      
      Fixes: 856fbcee ("MIPS: Store core & VP IDs in GlobalNumber-style variable")
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Reviewed-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17569/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      7e7bf0ec
    • J
      MIPS: smp-cmp: Use right include for task_struct · f677b770
      Jason A. Donenfeld 提交于
      When task_struct was moved, this MIPS code was neglected. Evidently
      nobody is using it anymore. This fixes this build error:
      
      In file included from ./arch/mips/include/asm/thread_info.h:15:0,
                       from ./include/linux/thread_info.h:37,
                       from ./include/asm-generic/current.h:4,
                       from ./arch/mips/include/generated/asm/current.h:1,
                       from ./include/linux/sched.h:11,
                       from arch/mips/kernel/smp-cmp.c:22:
      arch/mips/kernel/smp-cmp.c: In function ‘cmp_boot_secondary’:
      ./arch/mips/include/asm/processor.h:384:41: error: implicit declaration
      of function ‘task_stack_page’ [-Werror=implicit-function-declaration]
       #define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + \
                                               ^
      arch/mips/kernel/smp-cmp.c:84:21: note: in expansion of macro ‘__KSTK_TOS’
        unsigned long sp = __KSTK_TOS(idle);
                           ^~~~~~~~~~
      
      Fixes: f3ac6067 ("sched/headers: Move task-stack related APIs from <linux/sched.h> to <linux/sched/task_stack.h>")
      Signed-off-by: NJason A. Donenfeld <Jason@zx2c4.com>
      Cc: <stable@vger.kernel.org> # 4.11+
      Patchwork: https://patchwork.linux-mips.org/patch/17522/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      f677b770
    • M
      MIPS: CPS: Fix use of current_cpu_data in preemptible code · 8a46f71d
      Matt Redfearn 提交于
      Commit 1ec9dd80 ("MIPS: CPS: Detect CPUs in secondary clusters")
      added a check in cps_boot_secondary() that the secondary being booted is
      in the same cluster as the CPU running this code. This check is
      performed using current_cpu_data without disabling preemption. As such
      when CONFIG_PREEMPT=y, a BUG is triggered:
      
      [   57.991693] BUG: using smp_processor_id() in preemptible [00000000] code: hotplug/1749
      <snip>
      [   58.063077] Call Trace:
      [   58.065842] [<8040cdb4>] show_stack+0x84/0x114
      [   58.070830] [<80b11b38>] dump_stack+0xf8/0x140
      [   58.075796] [<8079b12c>] check_preemption_disabled+0xec/0x118
      [   58.082204] [<80415110>] cps_boot_secondary+0x84/0x44c
      [   58.087935] [<80413a14>] __cpu_up+0x34/0x98
      [   58.092624] [<80434240>] bringup_cpu+0x38/0x114
      [   58.097680] [<80434af0>] cpuhp_invoke_callback+0x168/0x8f0
      [   58.103801] [<804362d0>] _cpu_up+0x154/0x1c8
      [   58.108565] [<804363dc>] do_cpu_up+0x98/0xa8
      [   58.113333] [<808261f8>] device_online+0x84/0xc0
      [   58.118481] [<80826294>] online_store+0x60/0x98
      [   58.123562] [<8062261c>] kernfs_fop_write+0x158/0x1d4
      [   58.129196] [<805a2ae4>] __vfs_write+0x4c/0x168
      [   58.134247] [<805a2dc8>] vfs_write+0xe0/0x190
      [   58.139095] [<805a2fe0>] SyS_write+0x68/0xc4
      [   58.143854] [<80415d58>] syscall_common+0x34/0x58
      
      In reality we don't currently support running the kernel on CPUs not in
      cluster 0, so the answer to cpu_cluster(&current_cpu_data) will always
      be 0, even if this task being preempted and continues running on a
      different CPU. Regardless, the BUG should not be triggered, so fix this
      by switching to raw_current_cpu_data. When multicluster support lands
      upstream this check will need removing or changing anyway.
      
      Fixes: 1ec9dd80 ("MIPS: CPS: Detect CPUs in secondary clusters")
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Reviewed-by: NPaul Burton <paul.burton@mips.com>
      CC: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17563/Signed-off-by: NJames Hogan <jhogan@kernel.org>
      8a46f71d