Skip to content
  1. Dec 29, 2021
  2. Dec 22, 2021
    • Greg Kroah-Hartman's avatar
      Linux 5.10.88 · 856f88f2
      Greg Kroah-Hartman authored
      
      
      Link: https://lore.kernel.org/r/20211220143029.352940568@linuxfoundation.org
      Tested-by: default avatarJon Hunter <jonathanh@nvidia.com>
      Tested-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Tested-by: default avatarSalvatore Bonaccorso <carnil@debian.org>
      Tested-by: default avatarShuah Khan <skhan@linuxfoundation.org>
      Tested-by: default avatarHulk Robot <hulkrobot@huawei.com>
      Tested-by: default avatarSudip Mukherjee <sudip.mukherjee@codethink.co.uk>
      Tested-by: default avatarLinux Kernel Functional Testing <lkft@linaro.org>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      856f88f2
    • Juergen Gross's avatar
      xen/netback: don't queue unlimited number of packages · 88f20ccc
      Juergen Gross authored
      commit be81992f upstream.
      
      In case a guest isn't consuming incoming network traffic as fast as it
      is coming in, xen-netback is buffering network packages in unlimited
      numbers today. This can result in host OOM situations.
      
      Commit f48da8b1 ("xen-netback: fix unlimited guest Rx internal
      queue and carrier flapping") meant to introduce a mechanism to limit
      the amount of buffered data by stopping the Tx queue when reaching the
      data limit, but this doesn't work for cases like UDP.
      
      When hitting the limit don't queue further SKBs, but drop them instead.
      In order to be able to tell Rx packages have been dropped increment the
      rx_dropped statistics counter in this case.
      
      It should be noted that the old solution to continue queueing SKBs had
      the additional problem of an overflow of the 32-bit rx_queue_len value
      would result in intermittent Tx queue enabling.
      
      This is part of XSA-392
      
      Fixes: f48da8b1
      
       ("xen-netback: fix unlimited guest Rx internal queue and carrier flapping")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      88f20ccc
    • Juergen Gross's avatar
      xen/netback: fix rx queue stall detection · 525875c4
      Juergen Gross authored
      commit 6032046e upstream.
      
      Commit 1d5d4852 ("xen-netback: require fewer guest Rx slots when
      not using GSO") introduced a security problem in netback, as an
      interface would only be regarded to be stalled if no slot is available
      in the rx queue ring page. In case the SKB at the head of the queued
      requests will need more than one rx slot and only one slot is free the
      stall detection logic will never trigger, as the test for that is only
      looking for at least one slot to be free.
      
      Fix that by testing for the needed number of slots instead of only one
      slot being available.
      
      In order to not have to take the rx queue lock that often, store the
      number of needed slots in the queue data. As all SKB dequeue operations
      happen in the rx queue kernel thread this is safe, as long as the
      number of needed slots is accessed via READ/WRITE_ONCE() only and
      updates are always done with the rx queue lock held.
      
      Add a small helper for obtaining the number of free slots.
      
      This is part of XSA-392
      
      Fixes: 1d5d4852
      
       ("xen-netback: require fewer guest Rx slots when not using GSO")
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      525875c4
    • Juergen Gross's avatar
      xen/console: harden hvc_xen against event channel storms · 8fa3a370
      Juergen Gross authored
      commit fe415186
      
       upstream.
      
      The Xen console driver is still vulnerable for an attack via excessive
      number of events sent by the backend. Fix that by using a lateeoi event
      channel.
      
      For the normal domU initial console this requires the introduction of
      bind_evtchn_to_irq_lateeoi() as there is no xenbus device available
      at the time the event channel is bound to the irq.
      
      As the decision whether an interrupt was spurious or not requires to
      test for bytes having been read from the backend, move sending the
      event into the if statement, as sending an event without having found
      any bytes to be read is making no sense at all.
      
      This is part of XSA-391
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8fa3a370
    • Juergen Gross's avatar
      xen/netfront: harden netfront against event channel storms · d31b3379
      Juergen Gross authored
      commit b27d4795
      
       upstream.
      
      The Xen netfront driver is still vulnerable for an attack via excessive
      number of events sent by the backend. Fix that by using lateeoi event
      channels.
      
      For being able to detect the case of no rx responses being added while
      the carrier is down a new lock is needed in order to update and test
      rsp_cons and the number of seen unconsumed responses atomically.
      
      This is part of XSA-391
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d31b3379
    • Juergen Gross's avatar
      xen/blkfront: harden blkfront against event channel storms · 8ac3b6ee
      Juergen Gross authored
      commit 0fd08a34
      
       upstream.
      
      The Xen blkfront driver is still vulnerable for an attack via excessive
      number of events sent by the backend. Fix that by using lateeoi event
      channels.
      
      This is part of XSA-391
      
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Reviewed-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ac3b6ee
    • Magnus Karlsson's avatar
      Revert "xsk: Do not sleep in poll() when need_wakeup set" · 76ec7fe2
      Magnus Karlsson authored
      commit 0706a78f upstream.
      
      This reverts commit bd0687c1.
      
      This patch causes a Tx only workload to go to sleep even when it does
      not have to, leading to misserable performance in skb mode. It fixed
      one rare problem but created a much worse one, so this need to be
      reverted while I try to craft a proper solution to the original
      problem.
      
      Fixes: bd0687c1
      
       ("xsk: Do not sleep in poll() when need_wakeup set")
      Signed-off-by: default avatarMagnus Karlsson <magnus.karlsson@intel.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20211217145646.26449-1-magnus.karlsson@gmail.com
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      76ec7fe2
    • Tony Lindgren's avatar
      bus: ti-sysc: Fix variable set but not used warning for reinit_modules · e24fc898
      Tony Lindgren authored
      commit 1b1da99b upstream.
      
      Fix drivers/bus/ti-sysc.c:2494:13: error: variable 'error' set but not
      used introduced by commit 9d881361
      
       ("bus: ti-sysc: Add quirk handling
      for reinit on context lost").
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e24fc898
    • Paul E. McKenney's avatar
      rcu: Mark accesses to rcu_state.n_force_qs · 70692b06
      Paul E. McKenney authored
      commit 2431774f
      
       upstream.
      
      This commit marks accesses to the rcu_state.n_force_qs.  These data
      races are hard to make happen, but syzkaller was equal to the task.
      
      Reported-by: default avatar <syzbot+e08a83a1940ec3846cd5@syzkaller.appspotmail.com>
      Acked-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      70692b06
    • George Kennedy's avatar
      scsi: scsi_debug: Sanity check block descriptor length in resp_mode_select() · a9078e79
      George Kennedy authored
      commit e0a2c28d
      
       upstream.
      
      In resp_mode_select() sanity check the block descriptor len to avoid UAF.
      
      BUG: KASAN: use-after-free in resp_mode_select+0xa4c/0xb40 drivers/scsi/scsi_debug.c:2509
      Read of size 1 at addr ffff888026670f50 by task scsicmd/15032
      
      CPU: 1 PID: 15032 Comm: scsicmd Not tainted 5.15.0-01d0625 #15
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      Call Trace:
       <TASK>
       dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:107
       print_address_description.constprop.9+0x28/0x160 mm/kasan/report.c:257
       kasan_report.cold.14+0x7d/0x117 mm/kasan/report.c:443
       __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
       resp_mode_select+0xa4c/0xb40 drivers/scsi/scsi_debug.c:2509
       schedule_resp+0x4af/0x1a10 drivers/scsi/scsi_debug.c:5483
       scsi_debug_queuecommand+0x8c9/0x1e70 drivers/scsi/scsi_debug.c:7537
       scsi_queue_rq+0x16b4/0x2d10 drivers/scsi/scsi_lib.c:1521
       blk_mq_dispatch_rq_list+0xb9b/0x2700 block/blk-mq.c:1640
       __blk_mq_sched_dispatch_requests+0x28f/0x590 block/blk-mq-sched.c:325
       blk_mq_sched_dispatch_requests+0x105/0x190 block/blk-mq-sched.c:358
       __blk_mq_run_hw_queue+0xe5/0x150 block/blk-mq.c:1762
       __blk_mq_delay_run_hw_queue+0x4f8/0x5c0 block/blk-mq.c:1839
       blk_mq_run_hw_queue+0x18d/0x350 block/blk-mq.c:1891
       blk_mq_sched_insert_request+0x3db/0x4e0 block/blk-mq-sched.c:474
       blk_execute_rq_nowait+0x16b/0x1c0 block/blk-exec.c:63
       sg_common_write.isra.18+0xeb3/0x2000 drivers/scsi/sg.c:837
       sg_new_write.isra.19+0x570/0x8c0 drivers/scsi/sg.c:775
       sg_ioctl_common+0x14d6/0x2710 drivers/scsi/sg.c:941
       sg_ioctl+0xa2/0x180 drivers/scsi/sg.c:1166
       __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:52
       do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:50
       entry_SYSCALL_64_after_hwframe+0x44/0xae arch/x86/entry/entry_64.S:113
      
      Link: https://lore.kernel.org/r/1637262208-28850-1-git-send-email-george.kennedy@oracle.com
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a9078e79
    • George Kennedy's avatar
      scsi: scsi_debug: Fix type in min_t to avoid stack OOB · bdb854f1
      George Kennedy authored
      commit 36e07d7e
      
       upstream.
      
      Change min_t() to use type "u32" instead of type "int" to avoid stack out
      of bounds. With min_t() type "int" the values get sign extended and the
      larger value gets used causing stack out of bounds.
      
      BUG: KASAN: stack-out-of-bounds in memcpy include/linux/fortify-string.h:191 [inline]
      BUG: KASAN: stack-out-of-bounds in sg_copy_buffer+0x1de/0x240 lib/scatterlist.c:976
      Read of size 127 at addr ffff888072607128 by task syz-executor.7/18707
      
      CPU: 1 PID: 18707 Comm: syz-executor.7 Not tainted 5.15.0-syzk #1
      Hardware name: Red Hat KVM, BIOS 1.13.0-2
      Call Trace:
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:106
       print_address_description.constprop.9+0x28/0x160 mm/kasan/report.c:256
       __kasan_report mm/kasan/report.c:442 [inline]
       kasan_report.cold.14+0x7d/0x117 mm/kasan/report.c:459
       check_region_inline mm/kasan/generic.c:183 [inline]
       kasan_check_range+0x1a3/0x210 mm/kasan/generic.c:189
       memcpy+0x23/0x60 mm/kasan/shadow.c:65
       memcpy include/linux/fortify-string.h:191 [inline]
       sg_copy_buffer+0x1de/0x240 lib/scatterlist.c:976
       sg_copy_from_buffer+0x33/0x40 lib/scatterlist.c:1000
       fill_from_dev_buffer.part.34+0x82/0x130 drivers/scsi/scsi_debug.c:1162
       fill_from_dev_buffer drivers/scsi/scsi_debug.c:1888 [inline]
       resp_readcap16+0x365/0x3b0 drivers/scsi/scsi_debug.c:1887
       schedule_resp+0x4d8/0x1a70 drivers/scsi/scsi_debug.c:5478
       scsi_debug_queuecommand+0x8c9/0x1ec0 drivers/scsi/scsi_debug.c:7533
       scsi_dispatch_cmd drivers/scsi/scsi_lib.c:1520 [inline]
       scsi_queue_rq+0x16b0/0x2d40 drivers/scsi/scsi_lib.c:1699
       blk_mq_dispatch_rq_list+0xb9b/0x2700 block/blk-mq.c:1639
       __blk_mq_sched_dispatch_requests+0x28f/0x590 block/blk-mq-sched.c:325
       blk_mq_sched_dispatch_requests+0x105/0x190 block/blk-mq-sched.c:358
       __blk_mq_run_hw_queue+0xe5/0x150 block/blk-mq.c:1761
       __blk_mq_delay_run_hw_queue+0x4f8/0x5c0 block/blk-mq.c:1838
       blk_mq_run_hw_queue+0x18d/0x350 block/blk-mq.c:1891
       blk_mq_sched_insert_request+0x3db/0x4e0 block/blk-mq-sched.c:474
       blk_execute_rq_nowait+0x16b/0x1c0 block/blk-exec.c:62
       sg_common_write.isra.18+0xeb3/0x2000 drivers/scsi/sg.c:836
       sg_new_write.isra.19+0x570/0x8c0 drivers/scsi/sg.c:774
       sg_ioctl_common+0x14d6/0x2710 drivers/scsi/sg.c:939
       sg_ioctl+0xa2/0x180 drivers/scsi/sg.c:1165
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:874 [inline]
       __se_sys_ioctl fs/ioctl.c:860 [inline]
       __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:860
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Link: https://lore.kernel.org/r/1636484247-21254-1-git-send-email-george.kennedy@oracle.com
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bdb854f1
    • George Kennedy's avatar
      scsi: scsi_debug: Don't call kcalloc() if size arg is zero · aa1f9127
      George Kennedy authored
      commit 3344b58b
      
       upstream.
      
      If the size arg to kcalloc() is zero, it returns ZERO_SIZE_PTR.  Because of
      that, for a following NULL pointer check to work on the returned pointer,
      kcalloc() must not be called with the size arg equal to zero. Return early
      without error before the kcalloc() call if size arg is zero.
      
      BUG: KASAN: null-ptr-deref in memcpy include/linux/fortify-string.h:191 [inline]
      BUG: KASAN: null-ptr-deref in sg_copy_buffer+0x138/0x240 lib/scatterlist.c:974
      Write of size 4 at addr 0000000000000010 by task syz-executor.1/22789
      
      CPU: 1 PID: 22789 Comm: syz-executor.1 Not tainted 5.15.0-syzk #1
      Hardware name: Red Hat KVM, BIOS 1.13.0-2
      Call Trace:
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0x89/0xb5 lib/dump_stack.c:106
       __kasan_report mm/kasan/report.c:446 [inline]
       kasan_report.cold.14+0x112/0x117 mm/kasan/report.c:459
       check_region_inline mm/kasan/generic.c:183 [inline]
       kasan_check_range+0x1a3/0x210 mm/kasan/generic.c:189
       memcpy+0x3b/0x60 mm/kasan/shadow.c:66
       memcpy include/linux/fortify-string.h:191 [inline]
       sg_copy_buffer+0x138/0x240 lib/scatterlist.c:974
       do_dout_fetch drivers/scsi/scsi_debug.c:2954 [inline]
       do_dout_fetch drivers/scsi/scsi_debug.c:2946 [inline]
       resp_verify+0x49e/0x930 drivers/scsi/scsi_debug.c:4276
       schedule_resp+0x4d8/0x1a70 drivers/scsi/scsi_debug.c:5478
       scsi_debug_queuecommand+0x8c9/0x1ec0 drivers/scsi/scsi_debug.c:7533
       scsi_dispatch_cmd drivers/scsi/scsi_lib.c:1520 [inline]
       scsi_queue_rq+0x16b0/0x2d40 drivers/scsi/scsi_lib.c:1699
       blk_mq_dispatch_rq_list+0xb9b/0x2700 block/blk-mq.c:1639
       __blk_mq_sched_dispatch_requests+0x28f/0x590 block/blk-mq-sched.c:325
       blk_mq_sched_dispatch_requests+0x105/0x190 block/blk-mq-sched.c:358
       __blk_mq_run_hw_queue+0xe5/0x150 block/blk-mq.c:1761
       __blk_mq_delay_run_hw_queue+0x4f8/0x5c0 block/blk-mq.c:1838
       blk_mq_run_hw_queue+0x18d/0x350 block/blk-mq.c:1891
       blk_mq_sched_insert_request+0x3db/0x4e0 block/blk-mq-sched.c:474
       blk_execute_rq_nowait+0x16b/0x1c0 block/blk-exec.c:62
       blk_execute_rq+0xdb/0x360 block/blk-exec.c:102
       sg_scsi_ioctl drivers/scsi/scsi_ioctl.c:621 [inline]
       scsi_ioctl+0x8bb/0x15c0 drivers/scsi/scsi_ioctl.c:930
       sg_ioctl_common+0x172d/0x2710 drivers/scsi/sg.c:1112
       sg_ioctl+0xa2/0x180 drivers/scsi/sg.c:1165
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:874 [inline]
       __se_sys_ioctl fs/ioctl.c:860 [inline]
       __x64_sys_ioctl+0x19d/0x220 fs/ioctl.c:860
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x3a/0x80 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Link: https://lore.kernel.org/r/1636056397-13151-1-git-send-email-george.kennedy@oracle.com
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Acked-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
      Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aa1f9127
    • Miklos Szeredi's avatar
      ovl: fix warning in ovl_create_real() · 6859985a
      Miklos Szeredi authored
      commit 1f5573cf
      
       upstream.
      
      Syzbot triggered the following warning in ovl_workdir_create() ->
      ovl_create_real():
      
      	if (!err && WARN_ON(!newdentry->d_inode)) {
      
      The reason is that the cgroup2 filesystem returns from mkdir without
      instantiating the new dentry.
      
      Weird filesystems such as this will be rejected by overlayfs at a later
      stage during setup, but to prevent such a warning, call ovl_mkdir_real()
      directly from ovl_workdir_create() and reject this case early.
      
      Reported-and-tested-by: default avatar <syzbot+75eab84fd0af9e8bf66b@syzkaller.appspotmail.com>
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6859985a