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 b299359 commit 41854a2
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 134 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ env:
defconfig: |
dipper_defconfig
kernel_patch: |
support-umount-modules-kernel.patch
backport-path-umount.patch
kernelsu_patch: |
support-umount-modules-kernelsu.patch
on:
schedule:
Expand Down Expand Up @@ -225,7 +224,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 @@ -235,6 +234,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
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ env:
defconfig: |
dipper_defconfig
kernel_patch: |
support-umount-modules-kernel.patch
backport-path-umount.patch
kernelsu_patch: |
support-umount-modules-kernelsu.patch
```
## 参数
Expand Down Expand Up @@ -64,6 +63,10 @@ env:

分别是应用到 `内核` 和 `KernelSU` 的补丁文件列表,补丁文件需放在 `patches` 文件夹

补丁详细说明: <https://github.com/tiann/KernelSU/discussions/955>
补丁详细说明:

<https://github.com/tiann/KernelSU/discussions/955>

<https://kernelsu.org/zh_CN/guide/how-to-integrate-for-non-gki.html#how-to-backport-path-umount>

如果 KernelSU 功能正常,**不要** 添加补丁
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 41854a2

Please sign in to comment.