Skip to content

Commit

Permalink
使用 ksu 官网的 path_umount backport 补丁
Browse files Browse the repository at this point in the history
  • Loading branch information
bin456789 committed Apr 24, 2024
1 parent de2b781 commit 58f9fd5
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 131 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ env:
vendor/xiaomi/dipper.config
kernel_patch: |
allow-init-exec-ksud-under-nosuid.patch
support-umount-modules-kernel.patch
backport-path-umount.patch
kernelsu_patch: |
support-umount-modules-kernelsu.patch
on:
schedule:
Expand Down Expand Up @@ -227,7 +226,7 @@ jobs:
path: AnyKernel3-master/*

- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.kernelsu_remote_version }}
body: |
Expand All @@ -237,6 +236,9 @@ jobs:
Kernel:
https://github.com/${{ env.kernel_repository }}/tree/${{ env.kernel_commit_id }}
Branch:
${{ env.kernel_branch }}
KernelSU:
https://github.com/tiann/KernelSU/releases/tag/${{ env.kernelsu_remote_version }}
files: |
Expand Down
42 changes: 42 additions & 0 deletions patches/backport-path-umount.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1739,6 +1739,39 @@ static inline bool may_mandlock(void)
}
#endif

+static int can_umount(const struct path *path, int flags)
+{
+ struct mount *mnt = real_mount(path->mnt);
+
+ if (flags & ~(MNT_FORCE | MNT_DETACH | MNT_EXPIRE | UMOUNT_NOFOLLOW))
+ return -EINVAL;
+ if (!may_mount())
+ return -EPERM;
+ if (path->dentry != path->mnt->mnt_root)
+ return -EINVAL;
+ if (!check_mnt(mnt))
+ return -EINVAL;
+ if (mnt->mnt.mnt_flags & MNT_LOCKED) /* Check optimistically */
+ return -EINVAL;
+ if (flags & MNT_FORCE && !capable(CAP_SYS_ADMIN))
+ return -EPERM;
+ return 0;
+}
+
+int path_umount(struct path *path, int flags)
+{
+ struct mount *mnt = real_mount(path->mnt);
+ int ret;
+
+ ret = can_umount(path, flags);
+ if (!ret)
+ ret = do_umount(mnt, flags);
+
+ /* we mustn't call path_put() as that would clear mnt_expiry_mark */
+ dput(path->dentry);
+ mntput_no_expire(mnt);
+ return ret;
+}
/*
* Now umount can handle mount points as well as block devices.
* This is important for filesystems which use unnamed block devices.
49 changes: 0 additions & 49 deletions patches/support-umount-modules-kernel.patch

This file was deleted.

79 changes: 0 additions & 79 deletions patches/support-umount-modules-kernelsu.patch

This file was deleted.

0 comments on commit 58f9fd5

Please sign in to comment.