1. 11 1月, 2018 1 次提交
  2. 10 1月, 2018 9 次提交
    • J
      MIPS: mm: Fix duplicate "const" on insn_table_MM · ccf85c74
      James Hogan 提交于
      Fix the following gcc 7.x build error on microMIPS builds:
      
      arch/mips/mm/uasm-micromips.c:43:26: error: duplicate ‘const’ declaration specifier [-Werror=duplicate-decl-specifier]
       static const struct insn const insn_table_MM[insn_invalid] = {
                                ^~~~~
      
      The same issue has already been fixed in uasm-mips by commit
      00e06297 ("MIPS: mm: remove duplicate "const" qualifier on
      insn_table").
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Fixes: ce807d5f ("MIPS: Optimize uasm insn lookup.")
      Cc: David Daney <david.daney@cavium.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17889/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ccf85c74
    • 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
    • A
      MIPS: ralink: Fix platform_get_irq's error checking · b6ab1a13
      Arvind Yadav 提交于
      The platform_get_irq() function returns negative if an error occurs.
      zero or positive number on success. platform_get_irq() error checking
      for zero is not correct.
      Signed-off-by: NArvind Yadav <arvind.yadav.cs@gmail.com>
      Cc: john@phrozen.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17783/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      b6ab1a13
    • J
      MIPS: Fix CPS SMP NS16550 UART defaults · 7e5e371e
      James Hogan 提交于
      The MIPS_CPS_NS16550_BASE and MIPS_CPS_NS16550_SHIFT options have no
      defaults for non-Malta platforms which select SYS_SUPPORTS_MIPS_CPS
      (i.e. the pistachio and generic platforms). This is problematic for
      automated allyesconfig and allmodconfig builds based on these platforms,
      since make silentoldconfig tries to ask the user for values, and
      especially since v4.15 where the default platform was switched to
      generic.
      
      Default these options to 0 and arrange for MIPS_CPS_NS16550 to be no
      when using that default base address, so that the option only has an
      effect when the default is provided (i.e. Malta) or when a value is
      provided by the user.
      
      Fixes: 609cf6f2 ("MIPS: CPS: Early debug using an ns16550-compatible UART")
      Signed-off-by: NJames Hogan <jhogan@kernel.org>
      Reviewed-by: NPaul Burton <paul.burton@mips.com>
      Tested-by: NGuenter Roeck <linux@roeck-us.net>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/17749/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      7e5e371e
    • M
      MIPS: BCM47XX Avoid compile error with MIPS allnoconfig · dfe00495
      Matt Redfearn 提交于
      Currently MIPS allnoconfig with CONFIG_BCM47XX=y fails to compile due to
      neither BCM47XX_BCMA nor BCM47XX_SSB being selected. This leads the
      enumeration in arch/mips/include/asm/mach-bcm47xx/bcm47xx.h to be empty,
      and compilation fails:
      
      In file included from arch/mips/bcm47xx/irq.c:32:0:
      ./arch/mips/include/asm/mach-bcm47xx/bcm47xx.h:34:1: error: expected
      identifier before '}' token
       };
       ^
      make[2]: *** [scripts/Makefile.build:314: arch/mips/bcm47xx/irq.o] Error 1
      
      Fix this by ensuring that BCM47XX_SSB is selected if BCM47XX_BCMA is
      not. This allows us to select either system or both, but not neither.
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17703/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      dfe00495
    • M
      MIPS: RB532: Avoid undefined mac_pton without GENERIC_NET_UTILS · ecff167c
      Matt Redfearn 提交于
      Currently MIPS allnoconfig with CONFIG_MIKROTIK_RB532=y fails to link
      due to missing support for mac_pton():
      
        LD      vmlinux
      arch/mips/rb532/devices.o: In function `setup_kmac':
      devices.c:(.init.text+0xc): undefined reference to `mac_pton'
      
      Rather than adding dependencies to the platform to force inclusion of
      GENERIC_NET_UTILS which is selected by CONFIG_NET, just exclude the
      setup of the MAC address if CONFIG_NET is not selected in the kernel
      config.
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
      Cc: Neil Armstrong <narmstrong@baylibre.com>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Vladimir Zapolskiy <vz@mleia.com>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17702/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ecff167c
    • M
      MIPS: RB532: Avoid undefined early_serial_setup() without SERIAL_8250_CONSOLE · ff9bed94
      Matt Redfearn 提交于
      Currently MIPS allnoconfig with CONFIG_MIKROTIK_RB532=y fails to link due to
      missing support for early_serial_setup():
      
        LD      vmlinux
      arch/mips/rb532/serial.o: In function `setup_serial_port':
      serial.c:(.init.text+0x14): undefined reference to `early_serial_setup'
      
      Rather than adding dependencies to the platform to force inclusion of
      SERIAL_8250_CONSOLE together with it's dependencies like TTY, HAS_IOMEM,
      etc, just exclude arch/mips/rb532/serial.c from the build when it's
      dependency is not selected in the kernel config.
      Reported-by: NRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17701/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      ff9bed94
    • M
      MIPS: ath25: Avoid undefined early_serial_setup() without SERIAL_8250_CONSOLE · 9dd79fed
      Matt Redfearn 提交于
      Currently MIPS allnoconfig with CONFIG_ATH25=y fails to link due to
      missing support for early_serial_setup():
      
        LD      vmlinux
      arch/mips/ath25/devices.o: In function ath25_serial_setup':
      devices.c:(.init.text+0x68): undefined reference to 'early_serial_setup'
      
      Rather than adding dependencies to the platform to force inclusion of
      SERIAL_8250_CONSOLE together with it's dependencies like TTY, HAS_IOMEM,
      etc, just make ath25_serial_setup() a no-op when the dependency is not
      selected in the kernel config.
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Cc: James Hogan <james.hogan@mips.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-mips@linux-mips.org
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17700/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      9dd79fed
    • J
      MIPS: AR7: ensure the port type's FCR value is used · 0a5191ef
      Jonas Gorski 提交于
      Since commit aef9a7bd ("serial/uart/8250: Add tunable RX interrupt
      trigger I/F of FIFO buffers"), the port's default FCR value isn't used
      in serial8250_do_set_termios anymore, but copied over once in
      serial8250_config_port and then modified as needed.
      
      Unfortunately, serial8250_config_port will never be called if the port
      is shared between kernel and userspace, and the port's flag doesn't have
      UPF_BOOT_AUTOCONF, which would trigger a serial8250_config_port as well.
      
      This causes garbled output from userspace:
      
      [    5.220000] random: procd urandom read with 49 bits of entropy available
      ers
         [kee
      
      Fix this by forcing it to be configured on boot, resulting in the
      expected output:
      
      [    5.250000] random: procd urandom read with 50 bits of entropy available
      Press the [f] key and hit [enter] to enter failsafe mode
      Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
      
      Fixes: aef9a7bd ("serial/uart/8250: Add tunable RX interrupt trigger I/F of FIFO buffers")
      Signed-off-by: NJonas Gorski <jonas.gorski@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Nicolas Schichan <nschichan@freebox.fr>
      Cc: linux-mips@linux-mips.org
      Cc: linux-serial@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/17544/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      0a5191ef
  3. 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
  4. 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
  5. 05 12月, 2017 1 次提交
    • H
      bpf: correct broken uapi for BPF_PROG_TYPE_PERF_EVENT program type · c895f6f7
      Hendrik Brueckner 提交于
      Commit 0515e599 ("bpf: introduce BPF_PROG_TYPE_PERF_EVENT
      program type") introduced the bpf_perf_event_data structure which
      exports the pt_regs structure.  This is OK for multiple architectures
      but fail for s390 and arm64 which do not export pt_regs.  Programs
      using them, for example, the bpf selftest fail to compile on these
      architectures.
      
      For s390, exporting the pt_regs is not an option because s390 wants
      to allow changes to it.  For arm64, there is a user_pt_regs structure
      that covers parts of the pt_regs structure for use by user space.
      
      To solve the broken uapi for s390 and arm64, introduce an abstract
      type for pt_regs and add an asm/bpf_perf_event.h file that concretes
      the type.  An asm-generic header file covers the architectures that
      export pt_regs today.
      
      The arch-specific enablement for s390 and arm64 follows in separate
      commits.
      Reported-by: NThomas Richter <tmricht@linux.vnet.ibm.com>
      Fixes: 0515e599 ("bpf: introduce BPF_PROG_TYPE_PERF_EVENT program type")
      Signed-off-by: NHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Reviewed-and-tested-by: NThomas Richter <tmricht@linux.vnet.ibm.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      c895f6f7
  6. 30 11月, 2017 1 次提交
  7. 28 11月, 2017 2 次提交
    • M
      MIPS: Add custom serial.h with BASE_BAUD override for generic kernel · c8ec2041
      Matt Redfearn 提交于
      Add a custom serial.h header for MIPS, allowing platforms to override
      the asm-generic version if required.
      
      The generic platform uses this header to set BASE_BAUD to 0. The
      generic platform supports multiple boards, which may have different
      UART clocks. Also one of the boards supported is the Boston FPGA board,
      where the UART clock depends on the loaded FPGA bitfile. As such there
      is no way that the generic kernel can set a compile time default
      BASE_BAUD.
      
      Commit 31cb9a85 ("earlycon: initialise baud field of earlycon device
      structure") changed the behavior of of_setup_earlycon such that any baud
      rate set in the device tree is now set in the earlycon structure. The
      UART driver will then calculate a divisor based on BASE_BAUD and set it.
      With MIPS generic kernels this resulted in garbage output due to the
      incorrect uart clock rate being used to calculate a divisor. This
      commit, combined with "serial: 8250_early: Only set divisor if valid clk
      & baud" prevents the earlycon code setting a bad divisor and restores
      earlycon output.
      
      Fixes: 31cb9a85 ("earlycon: initialise baud field of earlycon device structure")
      Cc: stable <stable@vger.kernel.org> # 4.14
      Signed-off-by: NMatt Redfearn <matt.redfearn@mips.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c8ec2041
    • J
      KVM: Let KVM_SET_SIGNAL_MASK work as advertised · 20b7035c
      Jan H. Schönherr 提交于
      KVM API says for the signal mask you set via KVM_SET_SIGNAL_MASK, that
      "any unblocked signal received [...] will cause KVM_RUN to return with
      -EINTR" and that "the signal will only be delivered if not blocked by
      the original signal mask".
      
      This, however, is only true, when the calling task has a signal handler
      registered for a signal. If not, signal evaluation is short-circuited for
      SIG_IGN and SIG_DFL, and the signal is either ignored without KVM_RUN
      returning or the whole process is terminated.
      
      Make KVM_SET_SIGNAL_MASK behave as advertised by utilizing logic similar
      to that in do_sigtimedwait() to avoid short-circuiting of signals.
      Signed-off-by: NJan H. Schönherr <jschoenh@amazon.de>
      Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
      20b7035c
  8. 22 11月, 2017 2 次提交
    • K
      treewide: setup_timer() -> timer_setup() · e99e88a9
      Kees Cook 提交于
      This converts all remaining cases of the old setup_timer() API into using
      timer_setup(), where the callback argument is the structure already
      holding the struct timer_list. These should have no behavioral changes,
      since they just change which pointer is passed into the callback with
      the same available pointers after conversion. It handles the following
      examples, in addition to some other variations.
      
      Casting from unsigned long:
      
          void my_callback(unsigned long data)
          {
              struct something *ptr = (struct something *)data;
          ...
          }
          ...
          setup_timer(&ptr->my_timer, my_callback, ptr);
      
      and forced object casts:
      
          void my_callback(struct something *ptr)
          {
          ...
          }
          ...
          setup_timer(&ptr->my_timer, my_callback, (unsigned long)ptr);
      
      become:
      
          void my_callback(struct timer_list *t)
          {
              struct something *ptr = from_timer(ptr, t, my_timer);
          ...
          }
          ...
          timer_setup(&ptr->my_timer, my_callback, 0);
      
      Direct function assignments:
      
          void my_callback(unsigned long data)
          {
              struct something *ptr = (struct something *)data;
          ...
          }
          ...
          ptr->my_timer.function = my_callback;
      
      have a temporary cast added, along with converting the args:
      
          void my_callback(struct timer_list *t)
          {
              struct something *ptr = from_timer(ptr, t, my_timer);
          ...
          }
          ...
          ptr->my_timer.function = (TIMER_FUNC_TYPE)my_callback;
      
      And finally, callbacks without a data assignment:
      
          void my_callback(unsigned long data)
          {
          ...
          }
          ...
          setup_timer(&ptr->my_timer, my_callback, 0);
      
      have their argument renamed to verify they're unused during conversion:
      
          void my_callback(struct timer_list *unused)
          {
          ...
          }
          ...
          timer_setup(&ptr->my_timer, my_callback, 0);
      
      The conversion is done with the following Coccinelle script:
      
      spatch --very-quiet --all-includes --include-headers \
      	-I ./arch/x86/include -I ./arch/x86/include/generated \
      	-I ./include -I ./arch/x86/include/uapi \
      	-I ./arch/x86/include/generated/uapi -I ./include/uapi \
      	-I ./include/generated/uapi --include ./include/linux/kconfig.h \
      	--dir . \
      	--cocci-file ~/src/data/timer_setup.cocci
      
      @fix_address_of@
      expression e;
      @@
      
       setup_timer(
      -&(e)
      +&e
       , ...)
      
      // Update any raw setup_timer() usages that have a NULL callback, but
      // would otherwise match change_timer_function_usage, since the latter
      // will update all function assignments done in the face of a NULL
      // function initialization in setup_timer().
      @change_timer_function_usage_NULL@
      expression _E;
      identifier _timer;
      type _cast_data;
      @@
      
      (
      -setup_timer(&_E->_timer, NULL, _E);
      +timer_setup(&_E->_timer, NULL, 0);
      |
      -setup_timer(&_E->_timer, NULL, (_cast_data)_E);
      +timer_setup(&_E->_timer, NULL, 0);
      |
      -setup_timer(&_E._timer, NULL, &_E);
      +timer_setup(&_E._timer, NULL, 0);
      |
      -setup_timer(&_E._timer, NULL, (_cast_data)&_E);
      +timer_setup(&_E._timer, NULL, 0);
      )
      
      @change_timer_function_usage@
      expression _E;
      identifier _timer;
      struct timer_list _stl;
      identifier _callback;
      type _cast_func, _cast_data;
      @@
      
      (
      -setup_timer(&_E->_timer, _callback, _E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, &_callback, _E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, _callback, (_cast_data)_E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, &_callback, (_cast_data)_E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, (_cast_func)_callback, _E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, (_cast_func)&_callback, _E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, (_cast_func)_callback, (_cast_data)_E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, (_cast_func)&_callback, (_cast_data)_E);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, (_cast_data)_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, (_cast_data)&_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, &_callback, (_cast_data)_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, &_callback, (_cast_data)&_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, (_cast_func)_callback, (_cast_data)&_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, (_cast_func)&_callback, (_cast_data)&_E);
      +timer_setup(&_E._timer, _callback, 0);
      |
       _E->_timer@_stl.function = _callback;
      |
       _E->_timer@_stl.function = &_callback;
      |
       _E->_timer@_stl.function = (_cast_func)_callback;
      |
       _E->_timer@_stl.function = (_cast_func)&_callback;
      |
       _E._timer@_stl.function = _callback;
      |
       _E._timer@_stl.function = &_callback;
      |
       _E._timer@_stl.function = (_cast_func)_callback;
      |
       _E._timer@_stl.function = (_cast_func)&_callback;
      )
      
      // callback(unsigned long arg)
      @change_callback_handle_cast
       depends on change_timer_function_usage@
      identifier change_timer_function_usage._callback;
      identifier change_timer_function_usage._timer;
      type _origtype;
      identifier _origarg;
      type _handletype;
      identifier _handle;
      @@
      
       void _callback(
      -_origtype _origarg
      +struct timer_list *t
       )
       {
      (
      	... when != _origarg
      	_handletype *_handle =
      -(_handletype *)_origarg;
      +from_timer(_handle, t, _timer);
      	... when != _origarg
      |
      	... when != _origarg
      	_handletype *_handle =
      -(void *)_origarg;
      +from_timer(_handle, t, _timer);
      	... when != _origarg
      |
      	... when != _origarg
      	_handletype *_handle;
      	... when != _handle
      	_handle =
      -(_handletype *)_origarg;
      +from_timer(_handle, t, _timer);
      	... when != _origarg
      |
      	... when != _origarg
      	_handletype *_handle;
      	... when != _handle
      	_handle =
      -(void *)_origarg;
      +from_timer(_handle, t, _timer);
      	... when != _origarg
      )
       }
      
      // callback(unsigned long arg) without existing variable
      @change_callback_handle_cast_no_arg
       depends on change_timer_function_usage &&
                           !change_callback_handle_cast@
      identifier change_timer_function_usage._callback;
      identifier change_timer_function_usage._timer;
      type _origtype;
      identifier _origarg;
      type _handletype;
      @@
      
       void _callback(
      -_origtype _origarg
      +struct timer_list *t
       )
       {
      +	_handletype *_origarg = from_timer(_origarg, t, _timer);
      +
      	... when != _origarg
      -	(_handletype *)_origarg
      +	_origarg
      	... when != _origarg
       }
      
      // Avoid already converted callbacks.
      @match_callback_converted
       depends on change_timer_function_usage &&
                  !change_callback_handle_cast &&
      	    !change_callback_handle_cast_no_arg@
      identifier change_timer_function_usage._callback;
      identifier t;
      @@
      
       void _callback(struct timer_list *t)
       { ... }
      
      // callback(struct something *handle)
      @change_callback_handle_arg
       depends on change_timer_function_usage &&
      	    !match_callback_converted &&
                  !change_callback_handle_cast &&
                  !change_callback_handle_cast_no_arg@
      identifier change_timer_function_usage._callback;
      identifier change_timer_function_usage._timer;
      type _handletype;
      identifier _handle;
      @@
      
       void _callback(
      -_handletype *_handle
      +struct timer_list *t
       )
       {
      +	_handletype *_handle = from_timer(_handle, t, _timer);
      	...
       }
      
      // If change_callback_handle_arg ran on an empty function, remove
      // the added handler.
      @unchange_callback_handle_arg
       depends on change_timer_function_usage &&
      	    change_callback_handle_arg@
      identifier change_timer_function_usage._callback;
      identifier change_timer_function_usage._timer;
      type _handletype;
      identifier _handle;
      identifier t;
      @@
      
       void _callback(struct timer_list *t)
       {
      -	_handletype *_handle = from_timer(_handle, t, _timer);
       }
      
      // We only want to refactor the setup_timer() data argument if we've found
      // the matching callback. This undoes changes in change_timer_function_usage.
      @unchange_timer_function_usage
       depends on change_timer_function_usage &&
                  !change_callback_handle_cast &&
                  !change_callback_handle_cast_no_arg &&
      	    !change_callback_handle_arg@
      expression change_timer_function_usage._E;
      identifier change_timer_function_usage._timer;
      identifier change_timer_function_usage._callback;
      type change_timer_function_usage._cast_data;
      @@
      
      (
      -timer_setup(&_E->_timer, _callback, 0);
      +setup_timer(&_E->_timer, _callback, (_cast_data)_E);
      |
      -timer_setup(&_E._timer, _callback, 0);
      +setup_timer(&_E._timer, _callback, (_cast_data)&_E);
      )
      
      // If we fixed a callback from a .function assignment, fix the
      // assignment cast now.
      @change_timer_function_assignment
       depends on change_timer_function_usage &&
                  (change_callback_handle_cast ||
                   change_callback_handle_cast_no_arg ||
                   change_callback_handle_arg)@
      expression change_timer_function_usage._E;
      identifier change_timer_function_usage._timer;
      identifier change_timer_function_usage._callback;
      type _cast_func;
      typedef TIMER_FUNC_TYPE;
      @@
      
      (
       _E->_timer.function =
      -_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E->_timer.function =
      -&_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E->_timer.function =
      -(_cast_func)_callback;
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E->_timer.function =
      -(_cast_func)&_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E._timer.function =
      -_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E._timer.function =
      -&_callback;
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E._timer.function =
      -(_cast_func)_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      |
       _E._timer.function =
      -(_cast_func)&_callback
      +(TIMER_FUNC_TYPE)_callback
       ;
      )
      
      // Sometimes timer functions are called directly. Replace matched args.
      @change_timer_function_calls
       depends on change_timer_function_usage &&
                  (change_callback_handle_cast ||
                   change_callback_handle_cast_no_arg ||
                   change_callback_handle_arg)@
      expression _E;
      identifier change_timer_function_usage._timer;
      identifier change_timer_function_usage._callback;
      type _cast_data;
      @@
      
       _callback(
      (
      -(_cast_data)_E
      +&_E->_timer
      |
      -(_cast_data)&_E
      +&_E._timer
      |
      -_E
      +&_E->_timer
      )
       )
      
      // If a timer has been configured without a data argument, it can be
      // converted without regard to the callback argument, since it is unused.
      @match_timer_function_unused_data@
      expression _E;
      identifier _timer;
      identifier _callback;
      @@
      
      (
      -setup_timer(&_E->_timer, _callback, 0);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, _callback, 0L);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E->_timer, _callback, 0UL);
      +timer_setup(&_E->_timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, 0);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, 0L);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_E._timer, _callback, 0UL);
      +timer_setup(&_E._timer, _callback, 0);
      |
      -setup_timer(&_timer, _callback, 0);
      +timer_setup(&_timer, _callback, 0);
      |
      -setup_timer(&_timer, _callback, 0L);
      +timer_setup(&_timer, _callback, 0);
      |
      -setup_timer(&_timer, _callback, 0UL);
      +timer_setup(&_timer, _callback, 0);
      |
      -setup_timer(_timer, _callback, 0);
      +timer_setup(_timer, _callback, 0);
      |
      -setup_timer(_timer, _callback, 0L);
      +timer_setup(_timer, _callback, 0);
      |
      -setup_timer(_timer, _callback, 0UL);
      +timer_setup(_timer, _callback, 0);
      )
      
      @change_callback_unused_data
       depends on match_timer_function_unused_data@
      identifier match_timer_function_unused_data._callback;
      type _origtype;
      identifier _origarg;
      @@
      
       void _callback(
      -_origtype _origarg
      +struct timer_list *unused
       )
       {
      	... when != _origarg
       }
      Signed-off-by: NKees Cook <keescook@chromium.org>
      e99e88a9
    • K
      treewide: Switch DEFINE_TIMER callbacks to struct timer_list * · 24ed960a
      Kees Cook 提交于
      This changes all DEFINE_TIMER() callbacks to use a struct timer_list
      pointer instead of unsigned long. Since the data argument has already been
      removed, none of these callbacks are using their argument currently, so
      this renames the argument to "unused".
      
      Done using the following semantic patch:
      
      @match_define_timer@
      declarer name DEFINE_TIMER;
      identifier _timer, _callback;
      @@
      
       DEFINE_TIMER(_timer, _callback);
      
      @change_callback depends on match_define_timer@
      identifier match_define_timer._callback;
      type _origtype;
      identifier _origarg;
      @@
      
       void
      -_callback(_origtype _origarg)
      +_callback(struct timer_list *unused)
       { ... }
      Signed-off-by: NKees Cook <keescook@chromium.org>
      24ed960a
  9. 18 11月, 2017 1 次提交
  10. 16 11月, 2017 1 次提交
  11. 15 11月, 2017 1 次提交
  12. 14 11月, 2017 3 次提交
  13. 13 11月, 2017 6 次提交
  14. 11 11月, 2017 1 次提交
    • J
      MIPS: Fix odd fp register warnings with MIPS64r2 · c7fd89a6
      James Hogan 提交于
      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: 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+: 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
  15. 10 11月, 2017 2 次提交
  16. 09 11月, 2017 1 次提交
    • 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