+33
−20
Loading
mainline inclusion from mainline-v6.10-rc4 commit 4b4391e77a6bf24cba2ef1590e113d9b73b11039 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IA6I1T Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4b4391e77a6bf24cba2ef1590e113d9b73b11039 -------------------------------- 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:Hou Tao <houtao1@huawei.com> Signed-off-by:
Baokun Li <libaokun1@huawei.com> Link: https://lore.kernel.org/r/20240522114308.2402121-10-libaokun@huaweicloud.com Acked-by:
Jeff Layton <jlayton@kernel.org> Signed-off-by:
Christian Brauner <brauner@kernel.org> Signed-off-by:
Zizhi Wo <wozizhi@huawei.com>