Skip to content
Snippets Groups Projects
  1. Sep 26, 2022
    • Hyunwoo Kim's avatar
      efi: capsule-loader: Fix use-after-free in efi_capsule_write · 27dfef31
      Hyunwoo Kim authored
      mainline inclusion
      from mainline-v6.0-rc5
      commit 9cb636b5f6a8cc6d1b50809ec8f8d33ae0c84c95
      category: bugfix
      bugzilla: https://gitee.com/src-openeuler/kernel/issues/I5QI0W
      
      
      CVE: CVE-2022-40307
      
      ---------------------------
      
      A race condition may occur if the user calls close() on another thread
      during a write() operation on the device node of the efi capsule.
      
      This is a race condition that occurs between the efi_capsule_write() and
      efi_capsule_flush() functions of efi_capsule_fops, which ultimately
      results in UAF.
      
      So, the page freeing process is modified to be done in
      efi_capsule_release() instead of efi_capsule_flush().
      
      Cc: <stable@vger.kernel.org> # v4.9+
      Signed-off-by: default avatarHyunwoo Kim <imv4bel@gmail.com>
      Link: https://lore.kernel.org/all/20220907102920.GA88602@ubuntu/
      
      
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarXia Longlong <xialonglong1@huawei.com>
      Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Reviewed-by: Xiu Jianfeng <x...
      27dfef31
    • Lu Wei's avatar
      ipvlan: Fix out-of-bound bugs caused by unset skb->mac_header · 4b633c1e
      Lu Wei authored
      mainline inclusion
      from mainline-v6.0-rc6
      commit 81225b2ea161af48e093f58e8dfee6d705b16af4
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I5SYBY
      
      
      CVE: NA
      
      --------------------------------
      
      If an AF_PACKET socket is used to send packets through ipvlan and the
      default xmit function of the AF_PACKET socket is changed from
      dev_queue_xmit() to packet_direct_xmit() via setsockopt() with the option
      name of PACKET_QDISC_BYPASS, the skb->mac_header may not be reset and
      remains as the initial value of 65535, this may trigger slab-out-of-bounds
      bugs as following:
      
      =================================================================
      UG: KASAN: slab-out-of-bounds in ipvlan_xmit_mode_l2+0xdb/0x330 [ipvlan]
      PU: 2 PID: 1768 Comm: raw_send Kdump: loaded Not tainted 6.0.0-rc4+ #6
      ardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33
      all Trace:
      print_address_description.constprop.0+0x1d/0x160
      print_report.cold+0x4f/0x112
      kasan_report+0xa3/0x130
      ipvlan_xmit_mode_l2+0xdb/0x330 [ipvlan]
      ipvlan_start_xmit+0x29/0xa0 [ipvlan]
      __dev_direct_xmit+0x2e2/0x380
      packet_direct_xmit+0x22/0x60
      packet_snd+0x7c9/0xc40
      sock_sendmsg+0x9a/0xa0
      __sys_sendto+0x18a/0x230
      __x64_sys_sendto+0x74/0x90
      do_syscall_64+0x3b/0x90
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      The root cause is:
        1. packet_snd() only reset skb->mac_header when sock->type is SOCK_RAW
           and skb->protocol is not specified as in packet_parse_headers()
      
        2. packet_direct_xmit() doesn't reset skb->mac_header as dev_queue_xmit()
      
      In this case, skb->mac_header is 65535 when ipvlan_xmit_mode_l2() is
      called. So when ipvlan_xmit_mode_l2() gets mac header with eth_hdr() which
      use "skb->head + skb->mac_header", out-of-bound access occurs.
      
      This patch replaces eth_hdr() with skb_eth_hdr() in ipvlan_xmit_mode_l2()
      and reset mac header in multicast to solve this out-of-bound bug.
      
      Fixes: 2ad7bf36 ("ipvlan: Initial check-in of the IPVLAN driver.")
      Signed-off-by: default avatarLu Wei <luwei32@huawei.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarLu Wei <luwei32@huawei.com>
      Reviewed-by: default avatarYue Haibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
      4b633c1e
    • Wang Wensheng's avatar
      mm/sharepool: Fix UAF reported by KASAN · 89f5304b
      Wang Wensheng authored
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I5PD4P
      CVE: NA
      
      --------------------------------
      
      [ 2058.802818][  T290] BUG: KASAN: use-after-free in get_process_sp_res+0x70/0x134
      [ 2058.810194][  T290] Read of size 8 at addr ffff00088dc6ab28 by task test_debug_loop/290
      [ 2058.820520][  T290] CPU: 5 PID: 290 Comm: test_debug_loop Tainted: G        W  OE     5.10.0+ #2
      [ 2058.829377][  T290] Hardware name: EVB(EP) (DT)
      [ 2058.833982][  T290] Call trace:
      [ 2058.837217][  T290]  dump_backtrace+0x0/0x30c
      [ 2058.841660][  T290]  show_stack+0x20/0x30
      [ 2058.845758][  T290]  dump_stack+0x120/0x1b0
      [ 2058.850028][  T290]  print_address_description.constprop.0+0x2c/0x1fc
      [ 2058.856555][  T290]  __kasan_report+0xfc/0x160
      [ 2058.861086][  T290]  kasan_report+0x44/0xb0
      [ 2058.865356][  T290]  __asan_load8+0x94/0xd0
      [ 2058.869623][  T290]  get_process_sp_res+0x70/0x134
      [ 2058.874501][  T290]  proc_usage_show+0x1ac/0x304
      [ 2058.879208][  T290]...
      89f5304b
    • David Jeffery's avatar
      blk-mq: avoid extending delays of active hctx from blk_mq_delay_run_hw_queues · 9c7724ae
      David Jeffery authored
      mainline inclusion
      from mainline-v5.18-rc1
      commit 8f5fea65b06de1cc51d4fc23fb4d378d1abd6ed7
      category: bugfix
      bugzilla: 187541, https://gitee.com/openeuler/kernel/issues/I5RUM6
      
      
      CVE: NA
      
      --------------------------------
      
      When blk_mq_delay_run_hw_queues sets an hctx to run in the future, it can
      reset the delay length for an already pending delayed work run_work. This
      creates a scenario where multiple hctx may have their queues set to run,
      but if one runs first and finds nothing to do, it can reset the delay of
      another hctx and stall the other hctx's ability to run requests.
      
      To avoid this I/O stall when an hctx's run_work is already pending,
      leave it untouched to run at its current designated time rather than
      extending its delay. The work will still run which keeps closed the race
      calling blk_mq_delay_run_hw_queues is needed for while also avoiding the
      I/O stall.
      
      Signed-off-by: default avatarDavid Jeffery <djeffery@redhat.com>
      Reviewed-by: default avatarMing Lei <ming.lei@redhat.com>
      Link: https://lore.kernel.org/r/20220131203337.GA17666@redhat
      
      
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
      Reviewed-by: default avatarJason Yan <yanaijie@huawei.com>
      Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
      9c7724ae
    • Ma Wupeng's avatar
      mm: mem_reliable: Start fallback if no suitable zone found · f8f0da00
      Ma Wupeng authored
      hulk inclusion
      category: bugfix
      bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S
      
      
      CVE: NA
      
      --------------------------------
      
      For reliable memory allocation bind to nodes which do not hvve any
      reliable zones, its memory allocation will fail and then warn message
      will be produced at the end of __alloc_pages_slowpath().
      
      Though this memory allocation can fallback to movable zone in
      check_after_alloc() if fallback is enabled, something should be done to
      prevent this pointless warn log.
      
      To solve this problem, fallback to movable zone if no suitable zone found.
      
      Signed-off-by: default avatarMa Wupeng <mawupeng1@huawei.com>
      Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
      Signed-off-by: default avatarYongqiang Liu <liuyongqiang13@huawei.com>
      f8f0da00
  2. Sep 22, 2022
  3. Sep 20, 2022
  4. Sep 14, 2022
  5. Sep 13, 2022
  6. Sep 07, 2022