1. 20 Feb, 2019 32 commits
  2. 15 Feb, 2019 8 commits
    • Greg Kroah-Hartman's avatar
      Linux 4.14.101 · d6bf9dce
      Greg Kroah-Hartman authored
      d6bf9dce
    • Linus Torvalds's avatar
      Revert "exec: load_script: don't blindly truncate shebang string" · 56f88d75
      Linus Torvalds authored
      commit cb5b020a upstream.
      
      This reverts commit 8099b047.
      
      It turns out that people do actually depend on the shebang string being
      truncated, and on the fact that an interpreter (like perl) will often
      just re-interpret it entirely to get the full argument list.
      Reported-by: default avatarSamuel Dionne-Riel <samuel@dionne-riel.com>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      56f88d75
    • Greg Kroah-Hartman's avatar
      Linux 4.14.100 · 557ac4e2
      Greg Kroah-Hartman authored
      557ac4e2
    • Xiubo Li's avatar
      Revert "uio: use request_threaded_irq instead" · f142573d
      Xiubo Li authored
      commit 3d27c4de upstream.
      
      Since mutex lock in irq hanler is useless currently, here will
      remove it together with it.
      
      This reverts commit 9421e45f.
      
      Reported-by: james.r.harris@intel.com
      CC: Ahsan Atta <ahsan.atta@intel.com>
      Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarTommi Rantala <tommi.t.rantala@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f142573d
    • Xiubo Li's avatar
      uio: fix possible circular locking dependency · 5d07d245
      Xiubo Li authored
      commit b34e9a15 upstream.
      
      The call trace:
      XXX/1910 is trying to acquire lock:
       (&mm->mmap_sem){++++++}, at: [<ffffffff97008c87>] might_fault+0x57/0xb0
      
      but task is already holding lock:
       (&idev->info_lock){+.+...}, at: [<ffffffffc0638a06>] uio_write+0x46/0x130 [uio]
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #1 (&idev->info_lock){+.+...}:
             [<ffffffff96f31fc9>] lock_acquire+0x99/0x1e0
             [<ffffffff975edad3>] mutex_lock_nested+0x93/0x410
             [<ffffffffc063873d>] uio_mmap+0x2d/0x170 [uio]
             [<ffffffff97016b58>] mmap_region+0x428/0x650
             [<ffffffff97017138>] do_mmap+0x3b8/0x4e0
             [<ffffffff96ffaba3>] vm_mmap_pgoff+0xd3/0x120
             [<ffffffff97015261>] SyS_mmap_pgoff+0x1f1/0x270
             [<ffffffff96e387c2>] SyS_mmap+0x22/0x30
             [<ffffffff975ff315>] system_call_fastpath+0x1c/0x21
      
      -> #0 (&mm->mmap_sem){++++++}:
             [<ffffffff96f30e9c>] __lock_acquire+0xdac/0x15f0
             [<ffffffff96f31fc9>] lock_acquire+0x99/0x1e0
             [<ffffffff97008cb4>] might_fault+0x84/0xb0
             [<ffffffffc0638a74>] uio_write+0xb4/0x130 [uio]
             [<ffffffff9706ffa3>] vfs_write+0xc3/0x1f0
             [<ffffffff97070e2a>] SyS_write+0x8a/0x100
             [<ffffffff975ff315>] system_call_fastpath+0x1c/0x21
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
             CPU0                    CPU1
             ----                    ----
        lock(&idev->info_lock);
                                     lock(&mm->mmap_sem);
                                     lock(&idev->info_lock);
        lock(&mm->mmap_sem);
      
       *** DEADLOCK ***
      1 lock held by XXX/1910:
       #0:  (&idev->info_lock){+.+...}, at: [<ffffffffc0638a06>] uio_write+0x46/0x130 [uio]
      
      stack backtrace:
      CPU: 0 PID: 1910 Comm: XXX Kdump: loaded Not tainted #1
      Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/19/2017
      Call Trace:
       [<ffffffff975e9211>] dump_stack+0x19/0x1b
       [<ffffffff975e260a>] print_circular_bug+0x1f9/0x207
       [<ffffffff96f2f6a7>] check_prevs_add+0x957/0x960
       [<ffffffff96f30e9c>] __lock_acquire+0xdac/0x15f0
       [<ffffffff96f2fb19>] ? mark_held_locks+0xb9/0x140
       [<ffffffff96f31fc9>] lock_acquire+0x99/0x1e0
       [<ffffffff97008c87>] ? might_fault+0x57/0xb0
       [<ffffffff97008cb4>] might_fault+0x84/0xb0
       [<ffffffff97008c87>] ? might_fault+0x57/0xb0
       [<ffffffffc0638a74>] uio_write+0xb4/0x130 [uio]
       [<ffffffff9706ffa3>] vfs_write+0xc3/0x1f0
       [<ffffffff9709349c>] ? fget_light+0xfc/0x510
       [<ffffffff97070e2a>] SyS_write+0x8a/0x100
       [<ffffffff975ff315>] system_call_fastpath+0x1c/0x21
      Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarTommi Rantala <tommi.t.rantala@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5d07d245
    • Hailong Liu's avatar
      uio: fix wrong return value from uio_mmap() · 28c618ab
      Hailong Liu authored
      commit e7de2590 upstream.
      
      uio_mmap has multiple fail paths to set return value to nonzero then
      goto out. However, it always returns *0* from the *out* at end, and
      this will mislead callers who check the return value of this function.
      
      Fixes: 57c5f4df ("uio: fix crash after the device is unregistered")
      CC: Xiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarHailong Liu <liu.hailong6@zte.com.cn>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarJiang Biao <jiang.biao2@zte.com.cn>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarTommi Rantala <tommi.t.rantala@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      28c618ab
    • Xiubo Li's avatar
      uio: fix crash after the device is unregistered · 13af019c
      Xiubo Li authored
      commit 57c5f4df upstream.
      
      For the target_core_user use case, after the device is unregistered
      it maybe still opened in user space, then the kernel will crash, like:
      
      [  251.163692] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
      [  251.163820] IP: [<ffffffffc0736213>] show_name+0x23/0x40 [uio]
      [  251.163965] PGD 8000000062694067 PUD 62696067 PMD 0
      [  251.164097] Oops: 0000 [#1] SMP
      ...
      [  251.165605]  e1000 mptscsih mptbase drm_panel_orientation_quirks dm_mirror dm_region_hash dm_log dm_mod
      [  251.166014] CPU: 0 PID: 13380 Comm: tcmu-runner Kdump: loaded Not tainted 3.10.0-916.el7.test.x86_64 #1
      [  251.166381] Hardware name: VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform, BIOS 6.00 05/19/2017
      [  251.166747] task: ffff971eb91db0c0 ti: ffff971e9e384000 task.ti: ffff971e9e384000
      [  251.167137] RIP: 0010:[<ffffffffc0736213>]  [<ffffffffc0736213>] show_name+0x23/0x40 [uio]
      [  251.167563] RSP: 0018:ffff971e9e387dc8  EFLAGS: 00010282
      [  251.167978] RAX: 0000000000000000 RBX: ffff971e9e3f8000 RCX: ffff971eb8368d98
      [  251.168408] RDX: ffff971e9e3f8000 RSI: ffffffffc0738084 RDI: ffff971e9e3f8000
      [  251.168856] RBP: ffff971e9e387dd0 R08: ffff971eb8bc0018 R09: 0000000000000000
      [  251.169296] R10: 0000000000001000 R11: ffffffffa09d444d R12: ffffffffa1076e80
      [  251.169750] R13: ffff971e9e387f18 R14: 0000000000000001 R15: ffff971e9cfb1c80
      [  251.170213] FS:  00007ff37d175880(0000) GS:ffff971ebb600000(0000) knlGS:0000000000000000
      [  251.170693] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  251.171248] CR2: 0000000000000008 CR3: 00000000001f6000 CR4: 00000000003607f0
      [  251.172071] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [  251.172640] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [  251.173236] Call Trace:
      [  251.173789]  [<ffffffffa0c9b2d3>] dev_attr_show+0x23/0x60
      [  251.174356]  [<ffffffffa0f561b2>] ? mutex_lock+0x12/0x2f
      [  251.174892]  [<ffffffffa0ac6d9f>] sysfs_kf_seq_show+0xcf/0x1f0
      [  251.175433]  [<ffffffffa0ac54e6>] kernfs_seq_show+0x26/0x30
      [  251.175981]  [<ffffffffa0a63be0>] seq_read+0x110/0x3f0
      [  251.176609]  [<ffffffffa0ac5d45>] kernfs_fop_read+0xf5/0x160
      [  251.177158]  [<ffffffffa0a3d3af>] vfs_read+0x9f/0x170
      [  251.177707]  [<ffffffffa0a3e27f>] SyS_read+0x7f/0xf0
      [  251.178268]  [<ffffffffa0f648af>] system_call_fastpath+0x1c/0x21
      [  251.178823] Code: 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 55 48 89 e5 53 48 89 d3 e8 7e 96 56 e0 48 8b 80 d8 02 00 00 48 89 df 48 c7 c6 84 80 73 c0 <48> 8b 50 08 31 c0 e8 e2 67 44 e0 5b 48 98 5d c3 0f 1f 00 66 2e
      [  251.180115] RIP  [<ffffffffc0736213>] show_name+0x23/0x40 [uio]
      [  251.180820]  RSP <ffff971e9e387dc8>
      [  251.181473] CR2: 0000000000000008
      
      CC: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
      CC: Mike Christie <mchristi@redhat.com>
      Reviewed-by: default avatarHamish Martin <hamish.martin@alliedtelesis.co.nz>
      Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarTommi Rantala <tommi.t.rantala@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      13af019c
    • Xiubo Li's avatar
      uio: change to use the mutex lock instead of the spin lock · 3f400c2c
      Xiubo Li authored
      commit 543af586 upstream.
      
      We are hitting a regression with the following commit:
      
      commit a93e7b33
      Author: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
      Date:   Mon May 14 13:32:23 2018 +1200
      
          uio: Prevent device destruction while fds are open
      
      The problem is the addition of spin_lock_irqsave in uio_write. This
      leads to hitting  uio_write -> copy_from_user -> _copy_from_user ->
      might_fault and the logs filling up with sleeping warnings.
      
      I also noticed some uio drivers allocate memory, sleep, grab mutexes
      from callouts like open() and release and uio is now doing
      spin_lock_irqsave while calling them.
      Reported-by: default avatarMike Christie <mchristi@redhat.com>
      CC: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
      Reviewed-by: default avatarHamish Martin <hamish.martin@alliedtelesis.co.nz>
      Signed-off-by: default avatarXiubo Li <xiubli@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarTommi Rantala <tommi.t.rantala@nokia.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f400c2c