1. 06 Jun, 2018 8 commits
    • Steven Rostedt (VMware)'s avatar
      tracing: Fix crash when freeing instances with event triggers · 494aefd9
      Steven Rostedt (VMware) authored
      commit 86b389ff upstream.
      
      If a instance has an event trigger enabled when it is freed, it could cause
      an access of free memory. Here's the case that crashes:
      
       # cd /sys/kernel/tracing
       # mkdir instances/foo
       # echo snapshot > instances/foo/events/initcall/initcall_start/trigger
       # rmdir instances/foo
      
      Would produce:
      
       general protection fault: 0000 [#1] PREEMPT SMP PTI
       Modules linked in: tun bridge ...
       CPU: 5 PID: 6203 Comm: rmdir Tainted: G        W         4.17.0-rc4-test+ #933
       Hardware name: Hewlett-Packard HP Compaq Pro 6300 SFF/339A, BIOS K01 v03.03 07/14/2016
       RIP: 0010:clear_event_triggers+0x3b/0x70
       RSP: 0018:ffffc90003783de0 EFLAGS: 00010286
       RAX: 0000000000000000 RBX: 6b6b6b6b6b6b6b2b RCX: 0000000000000000
       RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff8800c7130ba0
       RBP: ffffc90003783e00 R08: ffff8801131993f8 R09: 0000000100230016
       R10: ffffc90003783d80 R11: 0000000000000000 R12: ffff8800c7130ba0
       R13: ffff8800c7130bd8 R14: ffff8800cc093768 R15: 00000000ffffff9c
       FS:  00007f6f4aa86700(0000) GS:ffff88011eb40000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 00007f6f4a5aed60 CR3: 00000000cd552001 CR4: 00000000001606e0
       Call Trace:
        event_trace_del_tracer+0x2a/0xc5
        instance_rmdir+0x15c/0x200
        tracefs_syscall_rmdir+0x52/0x90
        vfs_rmdir+0xdb/0x160
        do_rmdir+0x16d/0x1c0
        __x64_sys_rmdir+0x17/0x20
        do_syscall_64+0x55/0x1a0
        entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      This was due to the call the clears out the triggers when an instance is
      being deleted not removing the trigger from the link list.
      
      Cc: stable@vger.kernel.org
      Fixes: 85f2b082 ("tracing: Add basic event trigger framework")
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      494aefd9
    • Benjamin Tissoires's avatar
      Input: elan_i2c_smbus - fix corrupted stack · fdab04c1
      Benjamin Tissoires authored
      commit 40f7090b upstream.
      
      New ICs (like the one on the Lenovo T480s) answer to
      ETP_SMBUS_IAP_VERSION_CMD 4 bytes instead of 3. This corrupts the stack
      as i2c_smbus_read_block_data() uses the values returned by the i2c
      device to know how many data it need to return.
      
      i2c_smbus_read_block_data() can read up to 32 bytes (I2C_SMBUS_BLOCK_MAX)
      and there is no safeguard on how many bytes are provided in the return
      value. Ensure we always have enough space for any future firmware.
      Also 0-initialize the values to prevent any access to uninitialized memory.
      
      Cc: <stable@vger.kernel.org> # v4.4.x, v4.9.x, v4.14.x, v4.15.x, v4.16.x
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Acked-by: default avatarKT Liao <kt.liao@emc.com.tw>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fdab04c1
    • Mimi Zohar's avatar
      Revert "ima: limit file hash setting by user to fix and log modes" · 851ae480
      Mimi Zohar authored
      commit f5acb3dc upstream.
      
      Userspace applications have been modified to write security xattrs,
      but they are not context aware.  In the case of security.ima, the
      security xattr can be either a file hash or a file signature.
      Permitting writing one, but not the other requires the application to
      be context aware.
      
      In addition, userspace applications might write files to a staging
      area, which might not be in policy, and then change some file metadata
      (eg. owner) making it in policy.  As a result, these files are not
      labeled properly.
      
      This reverts commit c68ed80c, which
      prevents writing file hashes as security.ima xattrs.
      Requested-by: default avatarPatrick Ohly <patrick.ohly@intel.com>
      Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
      Signed-off-by: default avatarMimi Zohar <zohar@linux.vnet.ibm.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      851ae480
    • Brian Foster's avatar
      xfs: detect agfl count corruption and reset agfl · 55ffb6ac
      Brian Foster authored
      commit a27ba260 upstream.
      
      The struct xfs_agfl v5 header was originally introduced with
      unexpected padding that caused the AGFL to operate with one less
      slot than intended. The header has since been packed, but the fix
      left an incompatibility for users who upgrade from an old kernel
      with the unpacked header to a newer kernel with the packed header
      while the AGFL happens to wrap around the end. The newer kernel
      recognizes one extra slot at the physical end of the AGFL that the
      previous kernel did not. The new kernel will eventually attempt to
      allocate a block from that slot, which contains invalid data, and
      cause a crash.
      
      This condition can be detected by comparing the active range of the
      AGFL to the count. While this detects a padding mismatch, it can
      also trigger false positives for unrelated flcount corruption. Since
      we cannot distinguish a size mismatch due to padding from unrelated
      corruption, we can't trust the AGFL enough to simply repopulate the
      empty slot.
      
      Instead, avoid unnecessarily complex detection logic and and use a
      solution that can handle any form of flcount corruption that slips
      through read verifiers: distrust the entire AGFL and reset it to an
      empty state. Any valid blocks within the AGFL are intentionally
      leaked. This requires xfs_repair to rectify (which was already
      necessary based on the state the AGFL was found in). The reset
      mitigates the side effect of the padding mismatch problem from a
      filesystem crash to a free space accounting inconsistency. The
      generic approach also means that this patch can be safely backported
      to kernels with or without a packed struct xfs_agfl.
      
      Check the AGF for an invalid freelist count on initial read from
      disk. If detected, set a flag on the xfs_perag to indicate that a
      reset is required before the AGFL can be used. In the first
      transaction that attempts to use a flagged AGFL, reset it to empty,
      warn the user about the inconsistency and allow the freelist fixup
      code to repopulate the AGFL with new blocks. The xfs_perag flag is
      cleared to eliminate the need for repeated checks on each block
      allocation operation.
      
      This allows kernels that include the packing fix commit 96f859d5
      ("libxfs: pack the agfl header structure so XFS_AGFL_SIZE is correct")
      to handle older unpacked AGFL formats without a filesystem crash.
      Suggested-by: default avatarDave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
      Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Reviewed-by Dave Chiluk <chiluk+linuxxfs@indeed.com>
      Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
      Signed-off-by: default avatarDave Chiluk <chiluk+linuxxfs@indeed.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      55ffb6ac
    • Yoshinori Sato's avatar
      sh: New gcc support · f8c42dfb
      Yoshinori Sato authored
      commit 940d4113 upstream.
      
      New gcc (4.8 or later) used new shift helper functions.
      So we need added new helper to private libgcc.
      Signed-off-by: default avatarYoshinori Sato <ysato@users.sourceforge.jp>
      Signed-off-by: default avatarRich Felker <dalias@libc.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8c42dfb
    • Geert Uytterhoeven's avatar
      USB: serial: cp210x: use tcflag_t to fix incompatible pointer type · dae7ffc7
      Geert Uytterhoeven authored
      commit 009615ab upstream.
      
      On sparc32, tcflag_t is unsigned long, unlike all other architectures:
      
          drivers/usb/serial/cp210x.c: In function 'cp210x_get_termios':
          drivers/usb/serial/cp210x.c:717:3: warning: passing argument 2 of 'cp210x_get_termios_port' from incompatible pointer type
             cp210x_get_termios_port(tty->driver_data,
             ^
          drivers/usb/serial/cp210x.c:35:13: note: expected 'unsigned int *' but argument is of type 'tcflag_t *'
           static void cp210x_get_termios_port(struct usb_serial_port *port,
      		 ^
      
      Consistently use tcflag_t to fix this.
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dae7ffc7
    • Michael Neuling's avatar
      powerpc/64s: Clear PCR on boot · 783771fd
      Michael Neuling authored
      commit faf37c44 upstream.
      
      Clear the PCR (Processor Compatibility Register) on boot to ensure we
      are not running in a compatibility mode.
      
      We've seen this cause problems when a crash (and kdump) occurs while
      running compat mode guests. The kdump kernel then runs with the PCR
      set and causes problems. The symptom in the kdump kernel (also seen in
      petitboot after fast-reboot) is early userspace programs taking
      sigills on newer instructions (seen in libc).
      Signed-off-by: default avatarMichael Neuling <mikey@neuling.org>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      783771fd
    • Will Deacon's avatar
      arm64: lse: Add early clobbers to some input/output asm operands · 55a0e02e
      Will Deacon authored
      commit 32c3fa7c upstream.
      
      For LSE atomics that read and write a register operand, we need to
      ensure that these operands are annotated as "early clobber" if the
      register is written before all of the input operands have been consumed.
      Failure to do so can result in the compiler allocating the same register
      to both operands, leading to splats such as:
      
       Unable to handle kernel paging request at virtual address 11111122222221
       [...]
       x1 : 1111111122222222 x0 : 1111111122222221
       Process swapper/0 (pid: 1, stack limit = 0x000000008209f908)
       Call trace:
        test_atomic64+0x1360/0x155c
      
      where x0 has been allocated as both the value to be stored and also the
      atomic_t pointer.
      
      This patch adds the missing clobbers.
      
      Cc: <stable@vger.kernel.org>
      Cc: Dave Martin <dave.martin@arm.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Reported-by: default avatarMark Salter <msalter@redhat.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      55a0e02e
  2. 30 May, 2018 32 commits