1. 03 Jun, 2024 1 commit
  2. 30 May, 2024 1 commit
  3. 29 May, 2024 14 commits
    • Christian Brauner's avatar
      Merge patch series "cachefiles: some bugfixes and cleanups for ondemand requests" · a82c13d2
      Christian Brauner authored
      libaokun@huaweicloud.com <libaokun@huaweicloud.com> says:
      
      We've been testing ondemand mode for cachefiles since January, and we're
      almost done. We hit a lot of issues during the testing period, and this
      patch set fixes some of the issues related to ondemand requests.
      The patches have passed internal testing without regression.
      
      The following is a brief overview of the patches, see the patches for
      more details.
      
      Patch 1-5: Holding reference counts of reqs and objects on read requests
      to avoid malicious restore leading to use-after-free.
      
      Patch 6-10: Add some consistency checks to copen/cread/get_fd to avoid
      malicious copen/cread/close fd injections causing use-after-free or hung.
      
      Patch 11: When cache is marked as CACHEFILES_DEAD, flush all requests,
      otherwise the kernel may be hung. since this state is irreversible, the
      daemon can read open requests but cannot copen.
      
      Patch 12: Allow interrupting a read request being processed by killing
      the read process as a way of avoiding hung in some special cases.
      
       fs/cachefiles/daemon.c            |   3 +-
       fs/cachefiles/internal.h          |   5 +
       fs/cachefiles/ondemand.c          | 217 ++++++++++++++++++++++--------
       include/trace/events/cachefiles.h |   8 +-
       4 files changed, 176 insertions(+), 57 deletions(-)
      
      * patches from https://lore.kernel.org/r/20240522114308.2402121-1-libaokun@huaweicloud.com:
        cachefiles: make on-demand read killable
        cachefiles: flush all requests after setting CACHEFILES_DEAD
        cachefiles: Set object to close if ondemand_id < 0 in copen
        cachefiles: defer exposing anon_fd until after copy_to_user() succeeds
        cachefiles: never get a new anonymous fd if ondemand_id is valid
        cachefiles: add spin_lock for cachefiles_ondemand_info
        cachefiles: add consistency check for copen/cread
        cachefiles: remove err_put_fd label in cachefiles_ondemand_daemon_read()
        cachefiles: fix slab-use-after-free in cachefiles_ondemand_daemon_read()
        cachefiles: fix slab-use-after-free in cachefiles_ondemand_get_fd()
        cachefiles: remove requests from xarray during flushing requests
        cachefiles: add output string to cachefiles_obj_[get|put]_ondemand_fd
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      a82c13d2
    • Baokun Li's avatar
      cachefiles: make on-demand read killable · bc9dde61
      Baokun Li authored
      Replacing wait_for_completion() with wait_for_completion_killable() in
      cachefiles_ondemand_send_req() allows us to kill processes that might
      trigger a hunk_task if the daemon is abnormal.
      
      But now only CACHEFILES_OP_READ is killable, because OP_CLOSE and OP_OPEN
      is initiated from kworker context and the signal is prohibited in these
      kworker.
      
      Note that when the req in xas changes, i.e. xas_load(&xas) != req, it
      means that a process will complete the current request soon, so wait
      again for the request to be completed.
      
      In addition, add the cachefiles_ondemand_finish_req() helper function to
      simplify the code.
      Suggested-by: default avatarHou Tao <houtao1@huawei.com>
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-13-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJia Zhu <zhujia.zj@bytedance.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      bc9dde61
    • Baokun Li's avatar
      cachefiles: flush all requests after setting CACHEFILES_DEAD · 85e833cd
      Baokun Li authored
      In ondemand mode, when the daemon is processing an open request, if the
      kernel flags the cache as CACHEFILES_DEAD, the cachefiles_daemon_write()
      will always return -EIO, so the daemon can't pass the copen to the kernel.
      Then the kernel process that is waiting for the copen triggers a hung_task.
      
      Since the DEAD state is irreversible, it can only be exited by closing
      /dev/cachefiles. Therefore, after calling cachefiles_io_error() to mark
      the cache as CACHEFILES_DEAD, if in ondemand mode, flush all requests to
      avoid the above hungtask. We may still be able to read some of the cached
      data before closing the fd of /dev/cachefiles.
      
      Note that this relies on the patch that adds reference counting to the req,
      otherwise it may UAF.
      
      Fixes: c8383054 ("cachefiles: notify the user daemon when looking up cookie")
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-12-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      85e833cd
    • Zizhi Wo's avatar
      cachefiles: Set object to close if ondemand_id < 0 in copen · 4f8703fb
      Zizhi Wo authored
      If copen is maliciously called in the user mode, it may delete the request
      corresponding to the random id. And the request may have not been read yet.
      
      Note that when the object is set to reopen, the open request will be done
      with the still reopen state in above case. As a result, the request
      corresponding to this object is always skipped in select_req function, so
      the read request is never completed and blocks other process.
      
      Fix this issue by simply set object to close if its id < 0 in copen.
      Signed-off-by: default avatarZizhi Wo <wozizhi@huawei.com>
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-11-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJia Zhu <zhujia.zj@bytedance.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      4f8703fb
    • Baokun Li's avatar
      cachefiles: defer exposing anon_fd until after copy_to_user() succeeds · 4b4391e7
      Baokun Li authored
      After installing the anonymous fd, we can now see it in userland and close
      it. However, at this point we may not have gotten the reference count of
      the cache, but we will put it during colse fd, so this may cause a cache
      UAF.
      
      So grab the cache reference count before fd_install(). In addition, by
      kernel convention, fd is taken over by the user land after fd_install(),
      and the kernel should not call close_fd() after that, i.e., it should call
      fd_install() after everything is ready, thus fd_install() is called after
      copy_to_user() succeeds.
      
      Fixes: c8383054 ("cachefiles: notify the user daemon when looking up cookie")
      Suggested-by: default avatarHou Tao <houtao1@huawei.com>
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-10-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      4b4391e7
    • Baokun Li's avatar
      cachefiles: never get a new anonymous fd if ondemand_id is valid · 4988e35e
      Baokun Li authored
      Now every time the daemon reads an open request, it gets a new anonymous fd
      and ondemand_id. With the introduction of "restore", it is possible to read
      the same open request more than once, and therefore an object can have more
      than one anonymous fd.
      
      If the anonymous fd is not unique, the following concurrencies will result
      in an fd leak:
      
           t1     |         t2         |          t3
      ------------------------------------------------------------
       cachefiles_ondemand_init_object
        cachefiles_ondemand_send_req
         REQ_A = kzalloc(sizeof(*req) + data_len)
         wait_for_completion(&REQ_A->done)
                  cachefiles_daemon_read
                   cachefiles_ondemand_daemon_read
                    REQ_A = cachefiles_ondemand_select_req
                    cachefiles_ondemand_get_fd
                      load->fd = fd0
                      ondemand_id = object_id0
                                        ------ restore ------
                                        cachefiles_ondemand_restore
                                         // restore REQ_A
                                        cachefiles_daemon_read
                                         cachefiles_ondemand_daemon_read
                                          REQ_A = cachefiles_ondemand_select_req
                                            cachefiles_ondemand_get_fd
                                              load->fd = fd1
                                              ondemand_id = object_id1
                   process_open_req(REQ_A)
                   write(devfd, ("copen %u,%llu", msg->msg_id, size))
                   cachefiles_ondemand_copen
                    xa_erase(&cache->reqs, id)
                    complete(&REQ_A->done)
         kfree(REQ_A)
                                        process_open_req(REQ_A)
                                        // copen fails due to no req
                                        // daemon close(fd1)
                                        cachefiles_ondemand_fd_release
                                         // set object closed
       -- umount --
       cachefiles_withdraw_cookie
        cachefiles_ondemand_clean_object
         cachefiles_ondemand_init_close_req
          if (!cachefiles_ondemand_object_is_open(object))
            return -ENOENT;
          // The fd0 is not closed until the daemon exits.
      
      However, the anonymous fd holds the reference count of the object and the
      object holds the reference count of the cookie. So even though the cookie
      has been relinquished, it will not be unhashed and freed until the daemon
      exits.
      
      In fscache_hash_cookie(), when the same cookie is found in the hash list,
      if the cookie is set with the FSCACHE_COOKIE_RELINQUISHED bit, then the new
      cookie waits for the old cookie to be unhashed, while the old cookie is
      waiting for the leaked fd to be closed, if the daemon does not exit in time
      it will trigger a hung task.
      
      To avoid this, allocate a new anonymous fd only if no anonymous fd has
      been allocated (ondemand_id == 0) or if the previously allocated anonymous
      fd has been closed (ondemand_id == -1). Moreover, returns an error if
      ondemand_id is valid, letting the daemon know that the current userland
      restore logic is abnormal and needs to be checked.
      
      Fixes: c8383054 ("cachefiles: notify the user daemon when looking up cookie")
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-9-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      4988e35e
    • Baokun Li's avatar
      cachefiles: add spin_lock for cachefiles_ondemand_info · 0a790040
      Baokun Li authored
      The following concurrency may cause a read request to fail to be completed
      and result in a hung:
      
                 t1             |             t2
      ---------------------------------------------------------
                                  cachefiles_ondemand_copen
                                    req = xa_erase(&cache->reqs, id)
      // Anon fd is maliciously closed.
      cachefiles_ondemand_fd_release
        xa_lock(&cache->reqs)
        cachefiles_ondemand_set_object_close(object)
        xa_unlock(&cache->reqs)
                                    cachefiles_ondemand_set_object_open
                                    // No one will ever close it again.
      cachefiles_ondemand_daemon_read
        cachefiles_ondemand_select_req
        // Get a read req but its fd is already closed.
        // The daemon can't issue a cread ioctl with an closed fd, then hung.
      
      So add spin_lock for cachefiles_ondemand_info to protect ondemand_id and
      state, thus we can avoid the above problem in cachefiles_ondemand_copen()
      by using ondemand_id to determine if fd has been closed.
      
      Fixes: c8383054 ("cachefiles: notify the user daemon when looking up cookie")
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-8-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      0a790040
    • Baokun Li's avatar
      cachefiles: add consistency check for copen/cread · a26dc49d
      Baokun Li authored
      This prevents malicious processes from completing random copen/cread
      requests and crashing the system. Added checks are listed below:
      
        * Generic, copen can only complete open requests, and cread can only
          complete read requests.
        * For copen, ondemand_id must not be 0, because this indicates that the
          request has not been read by the daemon.
        * For cread, the object corresponding to fd and req should be the same.
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-7-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      a26dc49d
    • Baokun Li's avatar
      cachefiles: remove err_put_fd label in cachefiles_ondemand_daemon_read() · 3e6d704f
      Baokun Li authored
      The err_put_fd label is only used once, so remove it to make the code
      more readable. In addition, the logic for deleting error request and
      CLOSE request is merged to simplify the code.
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-6-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJia Zhu <zhujia.zj@bytedance.com>
      Reviewed-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
      Reviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      3e6d704f
    • Baokun Li's avatar
      cachefiles: fix slab-use-after-free in cachefiles_ondemand_daemon_read() · da4a8274
      Baokun Li authored
      We got the following issue in a fuzz test of randomly issuing the restore
      command:
      
      ==================================================================
      BUG: KASAN: slab-use-after-free in cachefiles_ondemand_daemon_read+0xb41/0xb60
      Read of size 8 at addr ffff888122e84088 by task ondemand-04-dae/963
      
      CPU: 13 PID: 963 Comm: ondemand-04-dae Not tainted 6.8.0-dirty #564
      Call Trace:
       kasan_report+0x93/0xc0
       cachefiles_ondemand_daemon_read+0xb41/0xb60
       vfs_read+0x169/0xb50
       ksys_read+0xf5/0x1e0
      
      Allocated by task 116:
       kmem_cache_alloc+0x140/0x3a0
       cachefiles_lookup_cookie+0x140/0xcd0
       fscache_cookie_state_machine+0x43c/0x1230
       [...]
      
      Freed by task 792:
       kmem_cache_free+0xfe/0x390
       cachefiles_put_object+0x241/0x480
       fscache_cookie_state_machine+0x5c8/0x1230
       [...]
      ==================================================================
      
      Following is the process that triggers the issue:
      
           mount  |   daemon_thread1    |    daemon_thread2
      ------------------------------------------------------------
      cachefiles_withdraw_cookie
       cachefiles_ondemand_clean_object(object)
        cachefiles_ondemand_send_req
         REQ_A = kzalloc(sizeof(*req) + data_len)
         wait_for_completion(&REQ_A->done)
      
                  cachefiles_daemon_read
                   cachefiles_ondemand_daemon_read
                    REQ_A = cachefiles_ondemand_select_req
                    msg->object_id = req->object->ondemand->ondemand_id
                                        ------ restore ------
                                        cachefiles_ondemand_restore
                                        xas_for_each(&xas, req, ULONG_MAX)
                                         xas_set_mark(&xas, CACHEFILES_REQ_NEW)
      
                                        cachefiles_daemon_read
                                         cachefiles_ondemand_daemon_read
                                          REQ_A = cachefiles_ondemand_select_req
                    copy_to_user(_buffer, msg, n)
                     xa_erase(&cache->reqs, id)
                     complete(&REQ_A->done)
                    ------ close(fd) ------
                    cachefiles_ondemand_fd_release
                     cachefiles_put_object
       cachefiles_put_object
        kmem_cache_free(cachefiles_object_jar, object)
                                          REQ_A->object->ondemand->ondemand_id
                                           // object UAF !!!
      
      When we see the request within xa_lock, req->object must not have been
      freed yet, so grab the reference count of object before xa_unlock to
      avoid the above issue.
      
      Fixes: 0a7e54c1 ("cachefiles: resend an open request if the read request's object is closed")
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-5-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJia Zhu <zhujia.zj@bytedance.com>
      Reviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      da4a8274
    • Baokun Li's avatar
      cachefiles: fix slab-use-after-free in cachefiles_ondemand_get_fd() · de3e26f9
      Baokun Li authored
      We got the following issue in a fuzz test of randomly issuing the restore
      command:
      
      ==================================================================
      BUG: KASAN: slab-use-after-free in cachefiles_ondemand_daemon_read+0x609/0xab0
      Write of size 4 at addr ffff888109164a80 by task ondemand-04-dae/4962
      
      CPU: 11 PID: 4962 Comm: ondemand-04-dae Not tainted 6.8.0-rc7-dirty #542
      Call Trace:
       kasan_report+0x94/0xc0
       cachefiles_ondemand_daemon_read+0x609/0xab0
       vfs_read+0x169/0xb50
       ksys_read+0xf5/0x1e0
      
      Allocated by task 626:
       __kmalloc+0x1df/0x4b0
       cachefiles_ondemand_send_req+0x24d/0x690
       cachefiles_create_tmpfile+0x249/0xb30
       cachefiles_create_file+0x6f/0x140
       cachefiles_look_up_object+0x29c/0xa60
       cachefiles_lookup_cookie+0x37d/0xca0
       fscache_cookie_state_machine+0x43c/0x1230
       [...]
      
      Freed by task 626:
       kfree+0xf1/0x2c0
       cachefiles_ondemand_send_req+0x568/0x690
       cachefiles_create_tmpfile+0x249/0xb30
       cachefiles_create_file+0x6f/0x140
       cachefiles_look_up_object+0x29c/0xa60
       cachefiles_lookup_cookie+0x37d/0xca0
       fscache_cookie_state_machine+0x43c/0x1230
       [...]
      ==================================================================
      
      Following is the process that triggers the issue:
      
           mount  |   daemon_thread1    |    daemon_thread2
      ------------------------------------------------------------
       cachefiles_ondemand_init_object
        cachefiles_ondemand_send_req
         REQ_A = kzalloc(sizeof(*req) + data_len)
         wait_for_completion(&REQ_A->done)
      
                  cachefiles_daemon_read
                   cachefiles_ondemand_daemon_read
                    REQ_A = cachefiles_ondemand_select_req
                    cachefiles_ondemand_get_fd
                    copy_to_user(_buffer, msg, n)
                  process_open_req(REQ_A)
                                        ------ restore ------
                                        cachefiles_ondemand_restore
                                        xas_for_each(&xas, req, ULONG_MAX)
                                         xas_set_mark(&xas, CACHEFILES_REQ_NEW);
      
                                        cachefiles_daemon_read
                                         cachefiles_ondemand_daemon_read
                                          REQ_A = cachefiles_ondemand_select_req
      
                   write(devfd, ("copen %u,%llu", msg->msg_id, size));
                   cachefiles_ondemand_copen
                    xa_erase(&cache->reqs, id)
                    complete(&REQ_A->done)
         kfree(REQ_A)
                                          cachefiles_ondemand_get_fd(REQ_A)
                                           fd = get_unused_fd_flags
                                           file = anon_inode_getfile
                                           fd_install(fd, file)
                                           load = (void *)REQ_A->msg.data;
                                           load->fd = fd;
                                           // load UAF !!!
      
      This issue is caused by issuing a restore command when the daemon is still
      alive, which results in a request being processed multiple times thus
      triggering a UAF. So to avoid this problem, add an additional reference
      count to cachefiles_req, which is held while waiting and reading, and then
      released when the waiting and reading is over.
      
      Note that since there is only one reference count for waiting, we need to
      avoid the same request being completed multiple times, so we can only
      complete the request if it is successfully removed from the xarray.
      
      Fixes: e73fa11a ("cachefiles: add restore command to recover inflight ondemand read requests")
      Suggested-by: default avatarHou Tao <houtao1@huawei.com>
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-4-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJia Zhu <zhujia.zj@bytedance.com>
      Reviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      de3e26f9
    • Baokun Li's avatar
      cachefiles: remove requests from xarray during flushing requests · 0fc75c59
      Baokun Li authored
      Even with CACHEFILES_DEAD set, we can still read the requests, so in the
      following concurrency the request may be used after it has been freed:
      
           mount  |   daemon_thread1    |    daemon_thread2
      ------------------------------------------------------------
       cachefiles_ondemand_init_object
        cachefiles_ondemand_send_req
         REQ_A = kzalloc(sizeof(*req) + data_len)
         wait_for_completion(&REQ_A->done)
                  cachefiles_daemon_read
                   cachefiles_ondemand_daemon_read
                                        // close dev fd
                                        cachefiles_flush_reqs
                                         complete(&REQ_A->done)
         kfree(REQ_A)
                    xa_lock(&cache->reqs);
                    cachefiles_ondemand_select_req
                      req->msg.opcode != CACHEFILES_OP_READ
                      // req use-after-free !!!
                    xa_unlock(&cache->reqs);
                                         xa_destroy(&cache->reqs)
      
      Hence remove requests from cache->reqs when flushing them to avoid
      accessing freed requests.
      
      Fixes: c8383054 ("cachefiles: notify the user daemon when looking up cookie")
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-3-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJia Zhu <zhujia.zj@bytedance.com>
      Reviewed-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
      Reviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      0fc75c59
    • Baokun Li's avatar
      cachefiles: add output string to cachefiles_obj_[get|put]_ondemand_fd · cc5ac966
      Baokun Li authored
      This lets us see the correct trace output.
      
      Fixes: c8383054 ("cachefiles: notify the user daemon when looking up cookie")
      Signed-off-by: default avatarBaokun Li <libaokun1@huawei.com>
      Link: https://lore.kernel.org/r/20240522114308.2402121-2-libaokun@huaweicloud.comAcked-by: default avatarJeff Layton <jlayton@kernel.org>
      Reviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      cc5ac966
    • John Garry's avatar
      statx: Update offset commentary for struct statx · ed7ee6a6
      John Garry authored
      In commit 2a82bb02 ("statx: stx_subvol"), a new member was added to
      struct statx, but the offset comment was not correct. Update it.
      Signed-off-by: default avatarJohn Garry <john.g.garry@oracle.com>
      Link: https://lore.kernel.org/r/20240529081725.3769290-1-john.g.garry@oracle.comSigned-off-by: default avatarChristian Brauner <brauner@kernel.org>
      ed7ee6a6
  4. 28 May, 2024 2 commits
  5. 27 May, 2024 3 commits
  6. 26 May, 2024 5 commits
  7. 25 May, 2024 13 commits
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2024-05-25-09-13' of... · 9b62e02e
      Linus Torvalds authored
      Merge tag 'mm-hotfixes-stable-2024-05-25-09-13' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
      
      Pull misc fixes from Andrew Morton:
       "16 hotfixes, 11 of which are cc:stable.
      
        A few nilfs2 fixes, the remainder are for MM: a couple of selftests
        fixes, various singletons fixing various issues in various parts"
      
      * tag 'mm-hotfixes-stable-2024-05-25-09-13' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm:
        mm/ksm: fix possible UAF of stable_node
        mm/memory-failure: fix handling of dissolved but not taken off from buddy pages
        mm: /proc/pid/smaps_rollup: avoid skipping vma after getting mmap_lock again
        nilfs2: fix potential hang in nilfs_detach_log_writer()
        nilfs2: fix unexpected freezing of nilfs_segctor_sync()
        nilfs2: fix use-after-free of timer for log writer thread
        selftests/mm: fix build warnings on ppc64
        arm64: patching: fix handling of execmem addresses
        selftests/mm: compaction_test: fix bogus test success and reduce probability of OOM-killer invocation
        selftests/mm: compaction_test: fix incorrect write of zero to nr_hugepages
        selftests/mm: compaction_test: fix bogus test success on Aarch64
        mailmap: update email address for Satya Priya
        mm/huge_memory: don't unpoison huge_zero_folio
        kasan, fortify: properly rename memintrinsics
        lib: add version into /proc/allocinfo output
        mm/vmalloc: fix vmalloc which may return null if called with __GFP_NOFAIL
      9b62e02e
    • Linus Torvalds's avatar
      Merge tag 'irq-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a0db36ed
      Linus Torvalds authored
      Pull irq fixes from Ingo Molnar:
      
       - Fix x86 IRQ vector leak caused by a CPU offlining race
      
       - Fix build failure in the riscv-imsic irqchip driver
         caused by an API-change semantic conflict
      
       - Fix use-after-free in irq_find_at_or_after()
      
      * tag 'irq-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        genirq/irqdesc: Prevent use-after-free in irq_find_at_or_after()
        genirq/cpuhotplug, x86/vector: Prevent vector leak during CPU offline
        irqchip/riscv-imsic: Fixup riscv_ipi_set_virq_range() conflict
      a0db36ed
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3a390f24
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
      
       - Fix regressions of the new x86 CPU VFM (vendor/family/model)
         enumeration/matching code
      
       - Fix crash kernel detection on buggy firmware with
         non-compliant ACPI MADT tables
      
       - Address Kconfig warning
      
      * tag 'x86-urgent-2024-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu: Fix x86_match_cpu() to match just X86_VENDOR_INTEL
        crypto: x86/aes-xts - switch to new Intel CPU model defines
        x86/topology: Handle bogus ACPI tables correctly
        x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y
      3a390f24
    • Linus Torvalds's avatar
      Merge tag 'for-linus-6.10-1' of https://github.com/cminyard/linux-ipmi · 56676c4c
      Linus Torvalds authored
      Pull ipmi updates from Corey Minyard:
       "Mostly updates for deprecated interfaces, platform.remove and
        converting from a tasklet to a BH workqueue.
      
        Also use HAS_IOPORT for disabling inb()/outb()"
      
      * tag 'for-linus-6.10-1' of https://github.com/cminyard/linux-ipmi:
        ipmi: kcs_bmc_npcm7xx: Convert to platform remove callback returning void
        ipmi: kcs_bmc_aspeed: Convert to platform remove callback returning void
        ipmi: ipmi_ssif: Convert to platform remove callback returning void
        ipmi: ipmi_si_platform: Convert to platform remove callback returning void
        ipmi: ipmi_powernv: Convert to platform remove callback returning void
        ipmi: bt-bmc: Convert to platform remove callback returning void
        char: ipmi: handle HAS_IOPORT dependencies
        ipmi: Convert from tasklet to BH workqueue
      56676c4c
    • Linus Torvalds's avatar
      Merge tag 'ceph-for-6.10-rc1' of https://github.com/ceph/ceph-client · 74eca356
      Linus Torvalds authored
      Pull ceph updates from Ilya Dryomov:
       "A series from Xiubo that adds support for additional access checks
        based on MDS auth caps which were recently made available to clients.
      
        This is needed to prevent scenarios where the MDS quietly discards
        updates that a UID-restricted client previously (wrongfully) acked to
        the user.
      
        Other than that, just a documentation fixup"
      
      * tag 'ceph-for-6.10-rc1' of https://github.com/ceph/ceph-client:
        doc: ceph: update userspace command to get CephFS metadata
        ceph: add CEPHFS_FEATURE_MDS_AUTH_CAPS_CHECK feature bit
        ceph: check the cephx mds auth access for async dirop
        ceph: check the cephx mds auth access for open
        ceph: check the cephx mds auth access for setattr
        ceph: add ceph_mds_check_access() helper
        ceph: save cap_auths in MDS client when session is opened
      74eca356
    • Linus Torvalds's avatar
      Merge tag 'ntfs3_for_6.10' of https://github.com/Paragon-Software-Group/linux-ntfs3 · 89b61ca4
      Linus Torvalds authored
      Pull ntfs3 updates from Konstantin Komarov:
       "Fixes:
         - reusing of the file index (could cause the file to be trimmed)
         - infinite dir enumeration
         - taking DOS names into account during link counting
         - le32_to_cpu conversion, 32 bit overflow, NULL check
         - some code was refactored
      
        Changes:
         - removed max link count info display during driver init
      
        Remove:
         - atomic_open has been removed for lack of use"
      
      * tag 'ntfs3_for_6.10' of https://github.com/Paragon-Software-Group/linux-ntfs3:
        fs/ntfs3: Break dir enumeration if directory contents error
        fs/ntfs3: Fix case when index is reused during tree transformation
        fs/ntfs3: Mark volume as dirty if xattr is broken
        fs/ntfs3: Always make file nonresident on fallocate call
        fs/ntfs3: Redesign ntfs_create_inode to return error code instead of inode
        fs/ntfs3: Use variable length array instead of fixed size
        fs/ntfs3: Use 64 bit variable to avoid 32 bit overflow
        fs/ntfs3: Check 'folio' pointer for NULL
        fs/ntfs3: Missed le32_to_cpu conversion
        fs/ntfs3: Remove max link count info display during driver init
        fs/ntfs3: Taking DOS names into account during link counting
        fs/ntfs3: remove atomic_open
        fs/ntfs3: use kcalloc() instead of kzalloc()
      89b61ca4
    • Linus Torvalds's avatar
      Merge tag '6.10-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd · 6c8b1a2d
      Linus Torvalds authored
      Pull smb server fixes from Steve French:
       "Two ksmbd server fixes, both for stable"
      
      * tag '6.10-rc-ksmbd-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: ignore trailing slashes in share paths
        ksmbd: avoid to send duplicate oplock break notifications
      6c8b1a2d
    • Linus Torvalds's avatar
      Merge tag 'rtc-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux · 54f71b03
      Linus Torvalds authored
      Pull RTC updates from Alexandre Belloni:
       "There is one new driver and then most of the changes are the device
        tree bindings conversions to yaml.
      
        New driver:
         - Epson RX8111
      
        Drivers:
         - Many Device Tree bindings conversions to dtschema
         - pcf8563: wakeup-source support"
      
      * tag 'rtc-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux:
        pcf8563: add wakeup-source support
        rtc: rx8111: handle VLOW flag
        rtc: rx8111: demote warnings to debug level
        rtc: rx6110: Constify struct regmap_config
        dt-bindings: rtc: convert trivial devices into dtschema
        dt-bindings: rtc: stmp3xxx-rtc: convert to dtschema
        dt-bindings: rtc: pxa-rtc: convert to dtschema
        rtc: Add driver for Epson RX8111
        dt-bindings: rtc: Add Epson RX8111
        rtc: mcp795: drop unneeded MODULE_ALIAS
        rtc: nuvoton: Modify part number value
        rtc: test: Split rtc unit test into slow and normal speed test
        dt-bindings: rtc: nxp,lpc1788-rtc: convert to dtschema
        dt-bindings: rtc: digicolor-rtc: move to trivial-rtc
        dt-bindings: rtc: alphascale,asm9260-rtc: convert to dtschema
        dt-bindings: rtc: armada-380-rtc: convert to dtschema
        rtc: cros-ec: provide ID table for avoiding fallback match
      54f71b03
    • Linus Torvalds's avatar
      Merge tag 'i3c/for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux · 4286e1fc
      Linus Torvalds authored
      Pull i3c updates from Alexandre Belloni:
       "Runtime PM (power management) is improved and hot-join support has
        been added to the dw controller driver.
      
        Core:
         - Allow device driver to trigger controller runtime PM
      
        Drivers:
         - dw: hot-join support
         - svc: better IBI handling"
      
      * tag 'i3c/for-6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/i3c/linux:
        i3c: dw: Add hot-join support.
        i3c: master: Enable runtime PM for master controller
        i3c: master: svc: fix invalidate IBI type and miss call client IBI handler
        i3c: master: svc: change ENXIO to EAGAIN when IBI occurs during start frame
        i3c: Add comment for -EAGAIN in i3c_device_do_priv_xfers()
      4286e1fc
    • Linus Torvalds's avatar
      Merge tag 'jffs2-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs · 6951abe8
      Linus Torvalds authored
      Pull jffs2 updates from Richard Weinberger:
      
       - Fix illegal memory access in jffs2_free_inode()
      
       - Kernel-doc fixes
      
       - print symbolic error names
      
      * tag 'jffs2-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
        jffs2: Fix potential illegal address access in jffs2_free_inode
        jffs2: Simplify the allocation of slab caches
        jffs2: nodemgmt: fix kernel-doc comments
        jffs2: print symbolic error name instead of error code
      6951abe8
    • Linus Torvalds's avatar
      Merge tag 'uml-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux · 2313022e
      Linus Torvalds authored
      Pull UML updates from Richard Weinberger:
      
       - Fixes for -Wmissing-prototypes warnings and further cleanup
      
       - Remove callback returning void from rtc and virtio drivers
      
       - Fix bash location
      
      * tag 'uml-for-linus-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/uml/linux: (26 commits)
        um: virtio_uml: Convert to platform remove callback returning void
        um: rtc: Convert to platform remove callback returning void
        um: Remove unused do_get_thread_area function
        um: Fix -Wmissing-prototypes warnings for __vdso_*
        um: Add an internal header shared among the user code
        um: Fix the declaration of kasan_map_memory
        um: Fix the -Wmissing-prototypes warning for get_thread_reg
        um: Fix the -Wmissing-prototypes warning for __switch_mm
        um: Fix -Wmissing-prototypes warnings for (rt_)sigreturn
        um: Stop tracking host PID in cpu_tasks
        um: process: remove unused 'n' variable
        um: vector: remove unused len variable/calculation
        um: vector: fix bpfflash parameter evaluation
        um: slirp: remove set but unused variable 'pid'
        um: signal: move pid variable where needed
        um: Makefile: use bash from the environment
        um: Add winch to winch_handlers before registering winch IRQ
        um: Fix -Wmissing-prototypes warnings for __warp_* and foo
        um: Fix -Wmissing-prototypes warnings for text_poke*
        um: Move declarations to proper headers
        ...
      2313022e
    • Marc Dionne's avatar
      afs: Don't cross .backup mountpoint from backup volume · 29be9100
      Marc Dionne authored
      Don't cross a mountpoint that explicitly specifies a backup volume
      (target is <vol>.backup) when starting from a backup volume.
      
      It it not uncommon to mount a volume's backup directly in the volume
      itself.  This can cause tools that are not paying attention to get
      into a loop mounting the volume onto itself as they attempt to
      traverse the tree, leading to a variety of problems.
      
      This doesn't prevent the general case of loops in a sequence of
      mountpoints, but addresses a common special case in the same way
      as other afs clients.
      Reported-by: default avatarJan Henrik Sylvester <jan.henrik.sylvester@uni-hamburg.de>
      Link: http://lists.infradead.org/pipermail/linux-afs/2024-May/008454.htmlReported-by: default avatarMarkus Suvanto <markus.suvanto@gmail.com>
      Link: http://lists.infradead.org/pipermail/linux-afs/2024-February/008074.htmlSigned-off-by: default avatarMarc Dionne <marc.dionne@auristor.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Link: https://lore.kernel.org/r/768760.1716567475@warthog.procyon.org.ukReviewed-by: default avatarJeffrey Altman <jaltman@auristor.com>
      cc: linux-afs@lists.infradead.org
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      29be9100
    • Linus Torvalds's avatar
      Merge tag 'drm-next-2024-05-25' of https://gitlab.freedesktop.org/drm/kernel · 56fb6f92
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Some fixes for the end of the merge window, mostly amdgpu and panthor,
        with one nouveau uAPI change that fixes a bad decision we made a few
        months back.
      
        nouveau:
         - fix bo metadata uAPI for vm bind
      
        panthor:
         - Fixes for panthor's heap logical block.
         - Reset on unrecoverable fault
         - Fix VM references.
         - Reset fix.
      
        xlnx:
         - xlnx compile and doc fixes.
      
        amdgpu:
         - Handle vbios table integrated info v2.3
      
        amdkfd:
         - Handle duplicate BOs in reserve_bo_and_cond_vms
         - Handle memory limitations on small APUs
      
        dp/mst:
         - MST null deref fix.
      
        bridge:
         - Don't let next bridge create connector in adv7511 to make probe
           work"
      
      * tag 'drm-next-2024-05-25' of https://gitlab.freedesktop.org/drm/kernel:
        drm/amdgpu/atomfirmware: add intergrated info v2.3 table
        drm/mst: Fix NULL pointer dereference at drm_dp_add_payload_part2
        drm/amdkfd: Let VRAM allocations go to GTT domain on small APUs
        drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
        drm/bridge: adv7511: Attach next bridge without creating connector
        drm/buddy: Fix the warn on's during force merge
        drm/nouveau: use tile_mode and pte_kind for VM_BIND bo allocations
        drm/panthor: Call panthor_sched_post_reset() even if the reset failed
        drm/panthor: Reset the FW VM to NULL on unplug
        drm/panthor: Keep a ref to the VM at the panthor_kernel_bo level
        drm/panthor: Force an immediate reset on unrecoverable faults
        drm/panthor: Document drm_panthor_tiler_heap_destroy::handle validity constraints
        drm/panthor: Fix an off-by-one in the heap context retrieval logic
        drm/panthor: Relax the constraints on the tiler chunk size
        drm/panthor: Make sure the tiler initial/max chunks are consistent
        drm/panthor: Fix tiler OOM handling to allow incremental rendering
        drm: xlnx: zynqmp_dpsub: Fix compilation error
        drm: xlnx: zynqmp_dpsub: Fix few function comments
      56fb6f92
  8. 24 May, 2024 1 commit
    • David Howells's avatar
      cifs: Fix missing set of remote_i_size · 93a43155
      David Howells authored
      Occasionally, the generic/001 xfstest will fail indicating corruption in
      one of the copy chains when run on cifs against a server that supports
      FSCTL_DUPLICATE_EXTENTS_TO_FILE (eg. Samba with a share on btrfs).  The
      problem is that the remote_i_size value isn't updated by cifs_setsize()
      when called by smb2_duplicate_extents(), but i_size *is*.
      
      This may cause cifs_remap_file_range() to then skip the bit after calling
      ->duplicate_extents() that sets sizes.
      
      Fix this by calling netfs_resize_file() in smb2_duplicate_extents() before
      calling cifs_setsize() to set i_size.
      
      This means we don't then need to call netfs_resize_file() upon return from
      ->duplicate_extents(), but we also fix the test to compare against the pre-dup
      inode size.
      
      [Note that this goes back before the addition of remote_i_size with the
      netfs_inode struct.  It should probably have been setting cifsi->server_eof
      previously.]
      
      Fixes: cfc63fc8 ("smb3: fix cached file size problems in duplicate extents (reflink)")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Steve French <sfrench@samba.org>
      cc: Paulo Alcantara <pc@manguebit.com>
      cc: Shyam Prasad N <nspmangalore@gmail.com>
      cc: Rohith Surabattula <rohiths.msft@gmail.com>
      cc: Jeff Layton <jlayton@kernel.org>
      cc: linux-cifs@vger.kernel.org
      cc: netfs@lists.linux.dev
      Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
      93a43155