1. 10 7月, 2023 1 次提交
  2. 08 3月, 2023 28 次提交
  3. 18 10月, 2022 1 次提交
  4. 15 4月, 2022 3 次提交
  5. 04 11月, 2020 1 次提交
    • T
      binder: fix UAF when releasing todo list · 3c7fa538
      Todd Kjos 提交于
      stable inclusion
      from linux-4.19.153
      commit 35cc2facc2a5ff52b9aa03f2dc81dcb000d97da3
      CVE: CVE-2020-0423
      
      --------------------------------
      
      commit f3277cbf upstream.
      
      When releasing a thread todo list when tearing down
      a binder_proc, the following race was possible which
      could result in a use-after-free:
      
      1.  Thread 1: enter binder_release_work from binder_thread_release
      2.  Thread 2: binder_update_ref_for_handle() -> binder_dec_node_ilocked()
      3.  Thread 2: dec nodeA --> 0 (will free node)
      4.  Thread 1: ACQ inner_proc_lock
      5.  Thread 2: block on inner_proc_lock
      6.  Thread 1: dequeue work (BINDER_WORK_NODE, part of nodeA)
      7.  Thread 1: REL inner_proc_lock
      8.  Thread 2: ACQ inner_proc_lock
      9.  Thread 2: todo list cleanup, but work was already dequeued
      10. Thread 2: free node
      11. Thread 2: REL inner_proc_lock
      12. Thread 1: deref w->type (UAF)
      
      The problem was that for a BINDER_WORK_NODE, the binder_work element
      must not be accessed after releasing the inner_proc_lock while
      processing the todo list elements since another thread might be
      handling a deref on the node containing the binder_work element
      leading to the node being freed.
      Signed-off-by: NTodd Kjos <tkjos@google.com>
      Link: https://lore.kernel.org/r/20201009232455.4054810-1-tkjos@google.com
      Cc: <stable@vger.kernel.org> # 4.14, 4.19, 5.4, 5.8
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: NJason Yan <yanaijie@huawei.com>
      Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
      3c7fa538
  6. 27 12月, 2019 4 次提交
  7. 06 12月, 2018 1 次提交
    • T
      binder: fix race that allows malicious free of live buffer · 553927d6
      Todd Kjos 提交于
      commit 7bada55ab50697861eee6bb7d60b41e68a961a9c upstream.
      
      Malicious code can attempt to free buffers using the BC_FREE_BUFFER
      ioctl to binder. There are protections against a user freeing a buffer
      while in use by the kernel, however there was a window where
      BC_FREE_BUFFER could be used to free a recently allocated buffer that
      was not completely initialized. This resulted in a use-after-free
      detected by KASAN with a malicious test program.
      
      This window is closed by setting the buffer's allow_user_free attribute
      to 0 when the buffer is allocated or when the user has previously freed
      it instead of waiting for the caller to set it. The problem was that
      when the struct buffer was recycled, allow_user_free was stale and set
      to 1 allowing a free to go through.
      Signed-off-by: NTodd Kjos <tkjos@google.com>
      Acked-by: NArve Hjønnevåg <arve@android.com>
      Cc: stable <stable@vger.kernel.org> # 4.14
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      553927d6
  8. 08 8月, 2018 1 次提交