diff --git a/patches/observer-release-mount-reference.patch b/patches/observer-release-mount-reference.patch new file mode 100644 index 0000000..390c0bf --- /dev/null +++ b/patches/observer-release-mount-reference.patch @@ -0,0 +1,53 @@ +diff --git a/kernel/manager/pkg_observer.c b/kernel/manager/pkg_observer.c +--- a/kernel/manager/pkg_observer.c ++++ b/kernel/manager/pkg_observer.c +@@ -16,8 +16,6 @@ + struct watch_dir { + const char *path; + u32 mask; +- struct path kpath; +- struct inode *inode; + struct fsnotify_mark *mark; + }; + +@@ -93,20 +91,18 @@ + + static int watch_one_dir(struct watch_dir *wd) + { +- int ret = kern_path(wd->path, LOOKUP_FOLLOW, &wd->kpath); ++ struct path path; ++ int ret = kern_path(wd->path, LOOKUP_FOLLOW, &path); + if (ret) { + pr_info("path not ready: %s (%d)\n", wd->path, ret); + return ret; + } +- wd->inode = d_inode(wd->kpath.dentry); +- ihold(wd->inode); + +- ret = add_mark_on_inode(wd->inode, wd->mask, &wd->mark); ++ // The fsnotify mark owns the inode reference. Do not pin the mount. ++ ret = add_mark_on_inode(d_inode(path.dentry), wd->mask, &wd->mark); ++ path_put(&path); + if (ret) { + pr_err("Add mark failed for %s (%d)\n", wd->path, ret); +- path_put(&wd->kpath); +- iput(wd->inode); +- wd->inode = NULL; + return ret; + } + pr_info("watching %s\n", wd->path); +@@ -119,14 +115,6 @@ + fsnotify_destroy_mark(wd->mark, g); + fsnotify_put_mark(wd->mark); + wd->mark = NULL; +- } +- if (wd->inode) { +- iput(wd->inode); +- wd->inode = NULL; +- } +- if (wd->kpath.dentry) { +- path_put(&wd->kpath); +- memset(&wd->kpath, 0, sizeof(wd->kpath)); + } + } + diff --git a/targets.json b/targets.json index 2d1c936..3b33812 100644 --- a/targets.json +++ b/targets.json @@ -12,15 +12,16 @@ "patches": [ "x86_64-seccomp-skip.patch", "x86_64-do_syscall_64-fallback.patch", - "disable-module-unload.patch" + "disable-module-unload.patch", + "observer-release-mount-reference.patch" ], "kernel_sha256": "b1e5cd842220175a4c07be9a2bcf5beb7b336794b00cf9b7b53abf35557b24df", "kernel_commit": "7e35917775b8b3e3346a87f294e334e258bf15e6", "ksu_version": "v3.3.1", "ksu_commit": "0c0fdb960178fa12d80d6cbcfdcb6ad8be6a865d", "ddk_image": "ghcr.io/ylarod/ddk-min@sha256:1dd6ac340b627a90a4031d6d0df6b129d8cc949b139fb56032c898f023d3d5d3", - "lkm_sha256": "309e048bc2aebcfa493c2b43274f4298c9105438c3be48d23be50b93aa4557c6", - "lkm_size": 259976, + "lkm_sha256": "c7d4b83f60cb7b0b873ab3b56624de45777620af9a1c66fe64fdbb18be7090f4", + "lkm_size": 259360, "ksu_commit_count": 2680 } ]