1. 16 4月, 2019 1 次提交
    • A
      MIPS: scall64-o32: Fix indirect syscall number load · 79b4a9cf
      Aurelien Jarno 提交于
      Commit 4c21b8fd (MIPS: seccomp: Handle indirect system calls (o32))
      added indirect syscall detection for O32 processes running on MIPS64,
      but it did not work correctly for big endian kernel/processes. The
      reason is that the syscall number is loaded from ARG1 using the lw
      instruction while this is a 64-bit value, so zero is loaded instead of
      the syscall number.
      
      Fix the code by using the ld instruction instead. When running a 32-bit
      processes on a 64 bit CPU, the values are properly sign-extended, so it
      ensures the value passed to syscall_trace_enter is correct.
      
      Recent systemd versions with seccomp enabled whitelist the getpid
      syscall for their internal  processes (e.g. systemd-journald), but call
      it through syscall(SYS_getpid). This fix therefore allows O32 big endian
      systems with a 64-bit kernel to run recent systemd versions.
      Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
      Cc: <stable@vger.kernel.org> # v3.15+
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: linux-mips@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      79b4a9cf
  2. 15 12月, 2018 2 次提交
    • F
      mips: generate uapi header and system call table files · 99bf73eb
      Firoz Khan 提交于
      System call table generation script must be run to gener-
      ate unistd_(nr_)n64/n32/o32.h and syscall_table_32_o32/
      64_n64/64_n32/64-o32.h files. This patch will have changes
      which will invokes the script.
      
      This patch will generate unistd_(nr_)n64/n32/o32.h and
      syscall_table_32_o32/64_n64/64-n32/64-o32.h files by the
      syscall table generation script invoked by parisc/Make-
      file and the generated files against the removed files
      must be identical.
      
      The generated uapi header file will be included in uapi/-
      asm/unistd.h and generated system call table header file
      will be included by kernel/scall32-o32/64-n64/64-n32/-
      64-o32.Sfile.
      Signed-off-by: NFiroz Khan <firoz.khan@linaro.org>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: y2038@lists.linaro.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-arch@vger.kernel.org
      Cc: arnd@arndb.de
      Cc: deepa.kernel@gmail.com
      Cc: marcin.juszkiewicz@linaro.org
      99bf73eb
    • F
      mips: add +1 to __NR_syscalls in uapi header · be856439
      Firoz Khan 提交于
      All other architectures are hold a value for __NR_syscalls will
      be equal to the last system call number +1.
      
      But in mips architecture, __NR_syscalls hold the value equal to
      total number of system exits in the architecture. One of the
      patch in this patch series will genarate uapi header files.
      
      In order to make the implementation common across all architect-
      ures, add +1 to __NR_syscalls, which will be equal to the last
      system call number +1.
      Signed-off-by: NFiroz Khan <firoz.khan@linaro.org>
      Signed-off-by: NPaul Burton <paul.burton@mips.com>
      Cc: linux-mips@vger.kernel.org
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: James Hogan <jhogan@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: y2038@lists.linaro.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-arch@vger.kernel.org
      Cc: arnd@arndb.de
      Cc: deepa.kernel@gmail.com
      Cc: marcin.juszkiewicz@linaro.org
      be856439
  3. 20 6月, 2018 2 次提交
  4. 29 8月, 2017 1 次提交
  5. 28 6月, 2017 1 次提交
    • J
      MIPS: Save static registers before sysmips · 49955d84
      James Hogan 提交于
      The MIPS sysmips system call handler may return directly from the
      MIPS_ATOMIC_SET case (mips_atomic_set()) to syscall_exit. This path
      restores the static (callee saved) registers, however they won't have
      been saved on entry to the system call.
      
      Use the save_static_function() macro to create a __sys_sysmips wrapper
      function which saves the static registers before calling sys_sysmips, so
      that the correct static register state is restored by syscall_exit.
      
      Fixes: f1e39a4a ("MIPS: Rewrite sysmips(MIPS_ATOMIC_SET, ...) in C with inline assembler")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: stable@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/16149/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      49955d84
  6. 08 3月, 2017 1 次提交
  7. 15 10月, 2016 1 次提交
  8. 28 7月, 2016 1 次提交
  9. 13 5月, 2016 1 次提交
    • M
      MIPS: scall: Handle seccomp filters which redirect syscalls · a400bed6
      Matt Redfearn 提交于
      Commit d218af78 ("MIPS: scall: Always run the seccomp syscall
      filters") modified the syscall code to always call the seccomp filters,
      but missed the case where a filter may redirect the syscall, as
      revealed by the seccomp_bpf self test.
      
      The syscall path now restores the syscall from the stack after the
      filter rather than saving it locally. Syscall number checking and
      syscall function table lookup is done after the filter may have run such
      that redirected syscalls are also checked, and executed.
      
      The regular path of syscall number checking and pointer lookup is also
      made more consistent between ABIs with scall64-64.S being the reference.
      
      With this patch in place, the seccomp_bpf self test now passes
      TRACE_syscall.syscall_redirected and TRACE_syscall.syscall_dropped on
      all MIPS ABIs.
      
      Fixes: d218af78 ("MIPS: scall: Always run the seccomp syscall filters")
      Signed-off-by: NMatt Redfearn <matt.redfearn@imgtec.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Cc: Eric B Munson <emunson@akamai.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: linux-mips@linux-mips.org
      Cc: IMG-MIPSLinuxKerneldevelopers@imgtec.com
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/12916/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      a400bed6
  10. 03 4月, 2016 1 次提交
  11. 06 2月, 2016 1 次提交
  12. 10 11月, 2015 1 次提交
  13. 04 10月, 2015 1 次提交
  14. 30 9月, 2015 1 次提交
  15. 10 7月, 2015 1 次提交
  16. 08 7月, 2015 1 次提交
    • R
      MIPS: O32: Do not handle require 32 bytes from the stack to be readable. · 7928eb03
      Ralf Baechle 提交于
      Commit 46e12c07 (MIPS: O32 / 32-bit:
      Always copy 4 stack arguments.) change the O32 syscall handler to always
      load four arguments from the userspace stack even for syscalls that
      require fewer or no arguments to be copied.  This removes a large table
      from kernel space and need to maintain it.  It appeared that it was ok
      the implementation chosen requires 16 bytes of readable stack space
      above the user stack pointer.
      
      Turned out a few threading implementations munmap the user stack before
      the thread exits resulting in errors due to the unreadable stack.
      
      We now treat any failed load as a if the loaded value was zero and let
      the actual syscall deal with the situation.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      7928eb03
  17. 16 1月, 2015 1 次提交
    • E
      MIPS: Fix restart of indirect syscalls · e967ef02
      Ed Swierk 提交于
      When 32-bit MIPS userspace invokes a syscall indirectly via syscall(number,
      arg1, ..., arg7), the kernel looks up the actual syscall based on the given
      number, shifts the other arguments to the left, and jumps to the syscall.
      
      If the syscall is interrupted by a signal and indicates it needs to be
      restarted by the kernel (by returning ERESTARTNOINTR for example), the
      syscall must be called directly, since the number is no longer the first
      argument, and the other arguments are now staged for a direct call.
      
      Before shifting the arguments, store the syscall number in pt_regs->regs[2].
      This gets copied temporarily into pt_regs->regs[0] after the syscall returns.
      If the syscall needs to be restarted, handle_signal()/do_signal() copies the
      number back to pt_regs->reg[2], which ends up in $v0 once control returns to
      userspace.
      Signed-off-by: NEd Swierk <eswierk@skyportsystems.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/8929/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e967ef02
  18. 13 1月, 2015 1 次提交
  19. 27 10月, 2014 1 次提交
  20. 26 8月, 2014 2 次提交
  21. 20 8月, 2014 1 次提交
    • M
      MIPS: scall64-o32: Fix indirect syscall detection · 52456899
      Markos Chandras 提交于
      Commit 4c21b8fd (MIPS: seccomp: Handle indirect system calls (o32))
      added indirect syscall detection for O32 processes running on MIPS64
      but it did not work as expected. The reason is the the scall64-o32
      implementation differs compared to scall32-o32. In the former, the v0
      (syscall number) register contains the absolute syscall number
      (4000 + X) whereas in the latter it contains the relative syscall
      number (X). Fix the code to avoid doing an extra addition, and load
      the v0 register directly to the first argument for syscall_trace_enter.
      Moreover, set the .reorder assembler option in order to have better
      control on this part of the assembly code.
      Signed-off-by: NMarkos Chandras <markos.chandras@imgtec.com>
      Patchwork: http://patchwork.linux-mips.org/patch/7481/
      Cc: <stable@vger.kernel.org> # v3.15+
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      52456899
  22. 31 7月, 2014 1 次提交
  23. 19 7月, 2014 1 次提交
  24. 13 5月, 2014 1 次提交
  25. 27 3月, 2014 2 次提交
  26. 04 2月, 2014 1 次提交
  27. 30 10月, 2013 1 次提交
  28. 11 6月, 2013 1 次提交
  29. 10 5月, 2013 1 次提交
  30. 04 3月, 2013 3 次提交
  31. 25 2月, 2013 1 次提交
  32. 04 2月, 2013 3 次提交